/** * Import HeadSpace SEO settings */ public function import_headspace() { global $wpdb; YMBESEO_Meta::replace_meta('_headspace_description', YMBESEO_Meta::$meta_prefix . 'metadesc', $this->replace); YMBESEO_Meta::replace_meta('_headspace_keywords', YMBESEO_Meta::$meta_prefix . 'metakeywords', $this->replace); YMBESEO_Meta::replace_meta('_headspace_page_title', YMBESEO_Meta::$meta_prefix . 'title', $this->replace); /** * @todo [JRF => whomever] verify how headspace sets these metas ( 'noindex', 'nofollow', 'noarchive', 'noodp', 'noydir' ) * and if the values saved are concurrent with the ones we use (i.e. 0/1/2) */ YMBESEO_Meta::replace_meta('_headspace_noindex', YMBESEO_Meta::$meta_prefix . 'meta-robots-noindex', $this->replace); YMBESEO_Meta::replace_meta('_headspace_nofollow', YMBESEO_Meta::$meta_prefix . 'meta-robots-nofollow', $this->replace); /* * @todo - [JRF => whomever] check if this can be done more efficiently by querying only the meta table * possibly directly changing it using concat on the existing values */ $posts = $wpdb->get_results("SELECT ID FROM {$wpdb->posts}"); if (is_array($posts) && $posts !== array()) { foreach ($posts as $post) { $custom = get_post_custom($post->ID); $robotsmeta_adv = ''; if (isset($custom['_headspace_noarchive'])) { $robotsmeta_adv .= 'noarchive,'; } if (isset($custom['_headspace_noodp'])) { $robotsmeta_adv .= 'noodp,'; } if (isset($custom['_headspace_noydir'])) { $robotsmeta_adv .= 'noydir'; } $robotsmeta_adv = preg_replace('`,$`', '', $robotsmeta_adv); YMBESEO_Meta::set_value('meta-robots-adv', $robotsmeta_adv, $post->ID); } } if ($this->replace) { $hs_meta = array('noarchive', 'noodp', 'noydir'); foreach ($hs_meta as $meta) { delete_post_meta_by_key('_headspace_' . $meta); } unset($hs_meta, $meta); } $this->set_msg(__('HeadSpace2 data successfully imported', 'ymbeseo')); }
/** * Import meta values if they're applicable */ private function import_metas() { YMBESEO_Meta::replace_meta('seo_follow', YMBESEO_Meta::$meta_prefix . 'meta-robots-nofollow', $this->replace); YMBESEO_Meta::replace_meta('seo_noindex', YMBESEO_Meta::$meta_prefix . 'meta-robots-noindex', $this->replace); // If WooSEO is set to use the Woo titles, import those. if ('true' == get_option('seo_woo_wp_title')) { YMBESEO_Meta::replace_meta('seo_title', YMBESEO_Meta::$meta_prefix . 'title', $this->replace); } // If WooSEO is set to use the Woo meta descriptions, import those. if ('b' == get_option('seo_woo_meta_single_desc')) { YMBESEO_Meta::replace_meta('seo_description', YMBESEO_Meta::$meta_prefix . 'metadesc', $this->replace); } // If WooSEO is set to use the Woo meta keywords, import those. if ('b' == get_option('seo_woo_meta_single_key')) { YMBESEO_Meta::replace_meta('seo_keywords', YMBESEO_Meta::$meta_prefix . 'metakeywords', $this->replace); } foreach (array('seo_woo_wp_title', 'seo_woo_meta_single_desc', 'seo_woo_meta_single_key') as $option) { $this->perhaps_delete($option); } }
/** * Import All In One SEO meta values */ private function import_metas() { YMBESEO_Meta::replace_meta('_aioseop_description', YMBESEO_Meta::$meta_prefix . 'metadesc', $this->replace); YMBESEO_Meta::replace_meta('_aioseop_keywords', YMBESEO_Meta::$meta_prefix . 'metakeywords', $this->replace); YMBESEO_Meta::replace_meta('_aioseop_title', YMBESEO_Meta::$meta_prefix . 'title', $this->replace); }
/** * Used for imports, both in dashboard and import settings pages, this functions either copies * $old_metakey into $new_metakey or just plain replaces $old_metakey with $new_metakey * * @deprecated 1.5.0 * @deprecated use YMBESEO_Meta::replace_meta() * @see YMBESEO_Meta::replace_meta() * * @param string $old_metakey The old name of the meta value. * @param string $new_metakey The new name of the meta value, usually the Yoast SEO name. * @param bool $replace Whether to replace or to copy the values. */ function replace_meta($old_metakey, $new_metakey, $replace = false) { _deprecated_function(__FUNCTION__, 'WPSEO 1.5.0', 'YMBESEO_Meta::replace_meta()'); YMBESEO_Meta::replace_meta($old_metakey, $new_metakey, $replace); }