'description',
'_headspace_metakey' => 'keywords',
);
/**
* Register plugin's hooks
*
* @return null
*/
private function __construct() {
add_action( 'wp_head', array( $this, 'action_wp_head' ) );
}
/**
*
*/
public function action_wp_head() {
// Applies only to individual post objects
if ( ! is_singular() ) {
return;
}
// Check for HS data
$hs_data = array();
foreach ( array_merge( $this->hs_string_keys, $this->hs_robots_keys ) as $hs_key ) {
$value = get_post_meta( get_the_ID(), $hs_key, true );
if ( ! empty( $value ) ) {
$hs_data[ $hs_key ] = $value;
}
}
// Bail if no HS data exists for this post
if ( empty( $hs_data ) ) {
return;
}
// Build output
echo "\n\n";
// Handle basic, string-containing keys
foreach ( $hs_data as $hs_key => $hs_value ) {
switch( $hs_key ) {
case '_headspace_description' :
case '_headspace_metakey' :
echo '' . "\n";
break;
default :
continue;
break;
}
}
// Handle robots key, which is build from several meta keys
$robots = array();
foreach ( $this->hs_robots_keys as $hs_robot_key ) {
if ( isset( $hs_data[ $hs_robot_key] ) ) {
$robots[] = str_replace( '_headspace_', '', $hs_robot_key );
}
}
if ( ! empty( $robots ) ) {
if ( 1 === count( $robots ) && in_array( 'noindex', $robots ) ) {
$robots[] = 'follow';
}
$robots = implode( ',', $robots );
echo '' . "\n";
}
// Mark end of output
echo "\n";
}
}
ETH_Escape_HeadSpace2::get_instance();