/** * Class constructor */ public function __construct() { $this->options = WPSEO_Options::get_option('wpseo_xml'); $GLOBALS['wpseo_admin'] = new WPSEO_Admin(); $this->pagenow = $GLOBALS['pagenow']; $this->asset_manager = new WPSEO_Admin_Asset_Manager(); add_action('admin_enqueue_scripts', array($this, 'enqueue_dismissible')); add_action('admin_init', array($this, 'tagline_notice'), 15); add_action('admin_init', array($this, 'blog_public_notice'), 15); add_action('admin_init', array($this, 'permalink_notice'), 15); add_action('admin_init', array($this, 'page_comments_notice'), 15); add_action('admin_init', array($this, 'ga_compatibility_notice'), 15); add_action('admin_init', array($this, 'yoast_plugin_compatibility_notification'), 15); add_action('admin_init', array($this, 'recalculate_notice'), 15); add_action('admin_init', array($this, 'ignore_tour')); add_action('admin_init', array($this, 'load_tour')); add_action('admin_init', array($this->asset_manager, 'register_assets')); add_action('admin_init', array($this, 'show_hook_deprecation_warnings')); add_action('admin_init', array('WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts')); $this->load_meta_boxes(); $this->load_taxonomy_class(); $this->load_admin_page_class(); $this->load_admin_user_class(); $this->load_xml_sitemaps_admin(); }
/** * Class constructor. */ public function __construct() { $this->options = WPSEO_Options::get_option('wpseo_social'); if (isset($GLOBALS['fb_ver']) || class_exists('Facebook_Loader', false)) { add_filter('fb_meta_tags', array($this, 'facebook_filter'), 10, 1); } else { add_filter('language_attributes', array($this, 'add_opengraph_namespace'), 15); add_action('wpseo_opengraph', array($this, 'locale'), 1); add_action('wpseo_opengraph', array($this, 'type'), 5); add_action('wpseo_opengraph', array($this, 'og_title'), 10); add_action('wpseo_opengraph', array($this, 'site_owner'), 20); add_action('wpseo_opengraph', array($this, 'description'), 11); add_action('wpseo_opengraph', array($this, 'url'), 12); add_action('wpseo_opengraph', array($this, 'site_name'), 13); add_action('wpseo_opengraph', array($this, 'website_facebook'), 14); if (is_singular() && !is_front_page()) { add_action('wpseo_opengraph', array($this, 'article_author_facebook'), 15); add_action('wpseo_opengraph', array($this, 'tags'), 16); add_action('wpseo_opengraph', array($this, 'category'), 17); add_action('wpseo_opengraph', array($this, 'publish_date'), 19); } add_action('wpseo_opengraph', array($this, 'image'), 30); } add_filter('jetpack_enable_open_graph', '__return_false'); add_action('wpseo_head', array($this, 'opengraph'), 30); }
/** * Translate text strings for use in the meta box * * IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to * the main meta box definition array in the class WPSEO_Meta() as well!!!! */ public static function translate_meta_boxes() { /* translators: %s expands to the social network's name */ $title_text = __('If you don\'t want to use the post title for sharing the post on %s but instead want another title there, write it here.', 'wordpress-seo'); /* translators: %s expands to the social network's name */ $description_text = __('If you don\'t want to use the meta description for sharing the post on %s but want another description there, write it here.', 'wordpress-seo'); /* translators: %s expands to the social network's name */ $image_text = __('If you want to override the image used on %s for this post, upload / choose an image or add the URL here.', 'wordpress-seo'); /* translators: %1$s expands to the social network, %2$s to the recommended image size */ $image_size_text = __('The recommended image size for %1$s is %2$spx.', 'wordpress-seo'); $options = WPSEO_Options::get_option('wpseo_social'); $social_networks = array('opengraph' => __('Facebook', 'wordpress-seo'), 'twitter' => __('Twitter', 'wordpress-seo')); // Source: https://blog.bufferapp.com/ideal-image-sizes-social-media-posts. $recommended_image_sizes = array('opengraph' => '1200 × 630', 'twitter' => '1024 × 512'); foreach ($social_networks as $network => $label) { if (true === $options[$network]) { self::$meta_fields['social'][$network . '-title']['title'] = sprintf(__('%s Title', 'wordpress-seo'), $label); self::$meta_fields['social'][$network . '-title']['description'] = sprintf($title_text, $label); self::$meta_fields['social'][$network . '-description']['title'] = sprintf(__('%s Description', 'wordpress-seo'), $label); self::$meta_fields['social'][$network . '-description']['description'] = sprintf($description_text, $label); self::$meta_fields['social'][$network . '-image']['title'] = sprintf(__('%s Image', 'wordpress-seo'), $label); self::$meta_fields['social'][$network . '-image']['description'] = sprintf($image_text, $label) . ' ' . sprintf($image_size_text, $label, $recommended_image_sizes[$network]); } } }
/** * Update the query vars with the redirect var when stripcategorybase is active * * @param array $query_vars Main query vars to filter. * * @return array */ function query_vars($query_vars) { $options = WPSEO_Options::get_option('wpseo_permalinks'); if ($options['stripcategorybase'] === true) { $query_vars[] = 'wpseo_category_redirect'; } return $query_vars; }
/** * Determines if the content analysis is active or not. * * @return bool Whether or not the content analysis is active. */ private function is_content_analysis_active() { $options = WPSEO_Options::get_option('wpseo_titles'); if (!$options['content-analysis-active']) { return 0; } return !get_the_author_meta('wpseo_content_analysis_disable', get_current_user_id()) ? 1 : 0; }
/** * Returns a base URL for use in the JS, takes permalink structure into account * * @return string */ private function base_url_for_js() { $base_url = home_url('/', null); $options = WPSEO_Options::get_option('wpseo_permalinks'); if (!$options['stripcategorybase']) { $base_url = trailingslashit($base_url . $this->taxonomy->rewrite['slug']); } return $base_url; }
/** * Set new data * * @param string $visible Visible (true) or hidden (false). * * @return bool */ public function set_data($visible) { $post_type = $this->get_post_type(); $option = WPSEO_Options::get_option('wpseo_xml'); $option['post_types-' . $post_type . '-not_in_sitemap'] = $visible === 'false'; update_option('wpseo_xml', $option); // Check if everything got saved properly. $saved_option = WPSEO_Options::get_option('wpseo_xml'); return $visible === 'false' && $saved_option['post_types-' . $post_type . '-not_in_sitemap'] === true; }
/** * Set the data in the options. * * @param {string} $data The data to set for the field. * * @return bool Returns true or false for successful storing the data. */ public function set_data($data) { $value = $data === 'yes'; $option = WPSEO_Options::get_option('wpseo'); $option['has_multiple_authors'] = $value; update_option('wpseo', $option); // Check if everything got saved properly. $saved_option = WPSEO_Options::get_option('wpseo'); return $saved_option['has_multiple_authors'] === $option['has_multiple_authors']; }
/** * Set the data in the options. * * @param {string} $data The data to set for the field. * * @return bool Returns true or false for successful storing the data. */ public function set_data($data) { $value = $data; $option = WPSEO_Options::get_option('wpseo'); $option['website_name'] = $value; update_option('wpseo', $option); // Check if everything got saved properly. $saved_option = WPSEO_Options::get_option('wpseo'); return $saved_option['website_name'] === $option['website_name']; }
/** * Set new data. * * @param string $environment_type The site's environment type. * * @return bool Returns whether the value is successfully set. */ public function set_data($environment_type) { $option = WPSEO_Options::get_option('wpseo'); if ($option['environment_type'] !== $environment_type) { $option['environment_type'] = $environment_type; update_option('wpseo', $option); if (!$this->set_indexation($environment_type)) { return false; } } $saved_environment_option = WPSEO_Options::get_option('wpseo'); return $saved_environment_option['environment_type'] === $option['environment_type']; }
/** * Get the data from the stored options. * * @return null|string */ public function get_data() { $option = WPSEO_Options::get_option('wpseo'); if (isset($option['has_multiple_authors'])) { $value = $option['has_multiple_authors']; } if (!isset($value) || is_null($value)) { // If there are more than one users with level > 1 default to multiple authors. $users = get_users(array('fields' => 'IDs', 'who' => 'authors')); $value = count($users) > 1; } return $value ? 'yes' : 'no'; }
/** * Class constructor */ public function __construct() { $this->options = WPSEO_Options::get_option('wpseo_xml'); $GLOBALS['wpseo_admin'] = new WPSEO_Admin(); $this->pagenow = $GLOBALS['pagenow']; add_action('admin_enqueue_scripts', array($this, 'enqueue_dismissible')); add_action('admin_init', array($this, 'after_update_notice'), 15); add_action('admin_init', array($this, 'tagline_notice'), 15); add_action('admin_init', array($this, 'ga_compatibility_notice'), 15); add_action('admin_init', array($this, 'recalculate_notice'), 15); add_action('admin_init', array($this, 'ignore_tour')); add_action('admin_init', array($this, 'load_tour')); add_action('admin_init', array($this, 'show_hook_deprecation_warnings')); $this->load_meta_boxes(); $this->load_taxonomy_class(); $this->load_admin_page_class(); $this->load_admin_user_class(); $this->load_xml_sitemaps_admin(); }
/** * After activating any plugin, this method will be executed by a hook. * * If the activated plugin is conflicting with ours a notice will be shown. * * @param string|bool $plugin Optional plugin basename to check. */ public static function hook_check_for_plugin_conflicts($plugin = false) { // The instance of itself. $instance = self::get_instance(); // Only add plugin as active plugin if $plugin isn't false. if ($plugin && is_string($plugin)) { // Because it's just activated. $instance->add_active_plugin($instance->find_plugin_category($plugin), $plugin); } $plugin_sections = array(); // Only check for open graph problems when they are enabled. $social_options = WPSEO_Options::get_option('wpseo_social'); if ($social_options['opengraph']) { /* translators: %1$s expands to Yoast SEO, %2%s: 'Facebook' plugin name of possibly conflicting plugin with regard to creating OpenGraph output*/ $plugin_sections['open_graph'] = __('Both %1$s and %2$s create OpenGraph output, which might make Facebook, Twitter, LinkedIn and other social networks use the wrong texts and images when your pages are being shared.', 'wordpress-seo') . '<br/><br/>' . '<a target="_blank" class="button" href="' . admin_url('admin.php?page=wpseo_social#top#facebook') . '">' . sprintf(__('Configure %1$s\'s OpenGraph settings', 'wordpress-seo'), 'Yoast SEO') . '</a>'; } // Only check for XML conflicts if sitemaps are enabled. $xml_sitemap_options = WPSEO_Options::get_option('wpseo_xml'); if ($xml_sitemap_options['enablexmlsitemap']) { /* translators: %1$s expands to Yoast SEO, %2$s: 'Google XML Sitemaps' plugin name of possibly conflicting plugin with regard to the creation of sitemaps*/ $plugin_sections['xml_sitemaps'] = __('Both %1$s and %2$s can create XML sitemaps. Having two XML sitemaps is not beneficial for search engines, yet might slow down your site.', 'wordpress-seo') . '<br/><br/>' . '<a target="_blank" class="button" href="' . admin_url('admin.php?page=wpseo_xml') . '">' . sprintf(__('Configure %1$s\'s XML Sitemap settings', 'wordpress-seo'), 'Yoast SEO') . '</a>'; } $instance->check_plugin_conflicts($plugin_sections); }
/** * Whether or not this analysis is enabled globally. * * @return bool Whether or not this analysis is enabled globally. */ public function is_globally_enabled() { $options = WPSEO_Options::get_option('wpseo_titles'); return (bool) $options['keyword-analysis-active']; }
/** * Runs the needed cleanup after an update, setting the DB version to latest version, flushing caches etc. */ private function finish_up() { $this->options = WPSEO_Options::get_option('wpseo'); // Re-get to make sure we have the latest version. update_option('wpseo', $this->options); // This also ensures the DB version is equal to WPSEO_VERSION. add_action('shutdown', 'flush_rewrite_rules'); // Just flush rewrites, always, to at least make them work after an upgrade. WPSEO_Utils::clear_sitemap_cache(); // Flush the sitemap cache. WPSEO_Options::ensure_options_exist(); // Make sure all our options always exist - issue #1245. }
/** * Retrieves a template. * Check if metabox for current taxonomy should be displayed. * * @return bool */ private function show_metabox() { $options = WPSEO_Options::get_option('wpseo_titles'); $option_key = 'hideeditbox-tax-' . $this->taxonomy; return empty($options[$option_key]); }
/** * Retrieve the page title. * * @param int $post_id Post to retrieve the title for. * * @return string */ private function page_title($post_id) { $fixed_title = WPSEO_Meta::get_value('title', $post_id); if ($fixed_title !== '') { return $fixed_title; } $post = get_post($post_id); $options = WPSEO_Options::get_option('wpseo_titles'); if (is_object($post) && (isset($options['title-' . $post->post_type]) && $options['title-' . $post->post_type] !== '')) { $title_template = $options['title-' . $post->post_type]; $title_template = str_replace(' %%page%% ', ' ', $title_template); return wpseo_replace_vars($title_template, $post); } return wpseo_replace_vars('%%title%%', $post); }
/** * Saves the option to the database. * * @param string $wpseo_options_group_name The name for the wpseo option group in the database. * @param string $option_name The name for the option to set. * @param * $option_value The value for the option. * * @return boolean Returns true if the option is successfully saved in the database. */ public static function save_option($wpseo_options_group_name, $option_name, $option_value) { $options = WPSEO_Options::get_option($wpseo_options_group_name); $options[$option_name] = $option_value; update_option($wpseo_options_group_name, $options); // Check if everything got saved properly. $saved_option = self::get_option($wpseo_options_group_name); return $saved_option[$option_name] === $options[$option_name]; }
/** * Returns the metabox section for the social settings. * * @return WPSEO_Metabox_Section */ private function get_social_meta_section() { $options = WPSEO_Options::get_option('wpseo_social'); $taxonomy_social_fields = new WPSEO_Taxonomy_Social_Fields($this->term); $tabs = array(); if ($options['opengraph'] === true) { $facebook_meta_fields = $taxonomy_social_fields->get_by_network('opengraph'); $tabs[] = new WPSEO_Metabox_Form_Tab('facebook', $this->taxonomy_tab_content->html($facebook_meta_fields), '<span class="dashicons dashicons-facebook-alt"></span>', array('link_title' => __('Facebook / Opengraph metadata', 'wordpress-seo'))); } if ($options['twitter'] === true) { $twitter_meta_fields = $taxonomy_social_fields->get_by_network('twitter'); $tabs[] = new WPSEO_Metabox_Form_Tab('twitter', $this->taxonomy_tab_content->html($twitter_meta_fields), '<span class="dashicons dashicons-twitter"></span>', array('link_title' => __('Twitter metadata', 'wordpress-seo'))); } return new WPSEO_Metabox_Tab_Section('social', '<span class="dashicons dashicons-share"></span>', $tabs, array('link_title' => __('Social', 'wordpress-seo'))); }
* google-sitemaps-plugin/generator and remove as it will cause errors for our sitemaps * (or inform the user and disallow enabling of sitemaps ) * @todo - [JRF => whomever] check if anything along these lines is already being done */ if (!defined('WPSEO_VERSION')) { header('Status: 403 Forbidden'); header('HTTP/1.1 403 Forbidden'); exit; } $yform = Yoast_Form::get_instance(); $yform->admin_header(true, 'wpseo_xml'); $options = get_option('wpseo_xml'); echo '<br/>'; $yform->light_switch('enablexmlsitemap', __('XML sitemap functionality', 'wordpress-seo')); $tabs = new WPSEO_Option_Tabs('sitemaps'); $tabs->add_tab(new WPSEO_Option_Tab('general', __('General', 'wordpress-seo'), array('video_url' => 'https://yoa.st/screencast-sitemaps'))); $title_options = WPSEO_Options::get_option('wpseo_titles'); if (empty($title_options['disable-author'])) { $tabs->add_tab(new WPSEO_Option_Tab('user-sitemap', __('User sitemap', 'wordpress-seo'), array('video_url' => 'https://yoa.st/screencast-sitemaps-user-sitemap'))); } $tabs->add_tab(new WPSEO_Option_Tab('post-types', __('Post Types', 'wordpress-seo'), array('video_url' => 'https://yoa.st/screencast-sitemaps-post-types'))); $tabs->add_tab(new WPSEO_Option_Tab('exclude-post', __('Excluded Posts', 'wordpress-seo'), array('video_url' => 'https://yoa.st/screencast-sitemaps-exclude-post'))); $tabs->add_tab(new WPSEO_Option_Tab('taxonomies', __('Taxonomies', 'wordpress-seo'), array('video_url' => 'https://yoa.st/screencast-sitemaps-taxonomies'))); echo '<div id="sitemapinfo">'; $tabs->display($yform, $options); echo '</div>'; /** * Fires at the end of XML Sitemaps configuration form. */ do_action('wpseo_xmlsitemaps_config'); $yform->admin_footer();
/** * Pass variables to js for use with the post-scraper * * @return array */ public function localize_post_scraper_script() { $post = $this->get_metabox_post(); $permalink = ''; if (is_object($post)) { $permalink = get_sample_permalink($post->ID); $permalink = $permalink[0]; } $post_formatter = new WPSEO_Metabox_Formatter(new WPSEO_Post_Metabox_Formatter($post, WPSEO_Options::get_option('wpseo_titles'), $permalink)); return $post_formatter->get_values(); }
/** * Retrieve the meta box form field definitions for the given tab and post type. * * @static * * @param string $tab Tab for which to retrieve the field definitions. * @param string $post_type Post type of the current post. * * @return array Array containing the meta box field definitions */ public static function get_meta_field_defs($tab, $post_type = 'post') { if (!isset(self::$meta_fields[$tab])) { return array(); } $field_defs = self::$meta_fields[$tab]; switch ($tab) { case 'non-form': // Prevent non-form fields from being passed to forms. $field_defs = array(); break; case 'general': $options = WPSEO_Options::get_option('wpseo_titles'); if ($options['usemetakeywords'] === true) { /* Adjust the link in the keywords description text string based on the post type */ $field_defs['metakeywords']['description'] = sprintf($field_defs['metakeywords']['description'], '<a target="_blank" href="' . esc_url(admin_url('admin.php?page=wpseo_titles#top#post_types')) . '">', '</a>'); } else { /* Don't show the keywords field if keywords aren't enabled */ unset($field_defs['metakeywords']); } /** * Filter the WPSEO metabox form field definitions for the general tab, backward compatibility * * @deprecated 1.5.0 * @deprecated use the 'wpseo_metabox_entries_general' filter instead * @see WPSEO_Meta::get_meta_field_defs() * * @param array $field_defs Metabox orm definitions. * * @return array */ $field_defs = apply_filters('wpseo_metabox_entries', $field_defs); break; case 'advanced': global $post; $options = WPSEO_Options::get_options(array('wpseo', 'wpseo_titles', 'wpseo_internallinks')); if (!current_user_can('manage_options') && $options['disableadvanced_meta']) { return array(); } $post_type = ''; if (isset($post->post_type)) { $post_type = $post->post_type; } elseif (!isset($post->post_type) && isset($_GET['post_type'])) { $post_type = sanitize_text_field($_GET['post_type']); } /* Adjust the no-index 'default for post type' text string based on the post type */ $field_defs['meta-robots-noindex']['options']['0'] = sprintf($field_defs['meta-robots-noindex']['options']['0'], isset($options['noindex-' . $post_type]) && $options['noindex-' . $post_type] === true ? 'noindex' : 'index'); /* Adjust the robots advanced 'site-wide default' text string based on those settings */ if ($options['noodp'] !== false) { $robots_adv = array(); if ($options['noodp'] === true) { // Use translation from field def options - mind that $options and $field_def['options'] keys should be the same! $robots_adv[] = $field_defs['meta-robots-adv']['options']['noodp']; } $robots_adv = implode(', ', $robots_adv); } else { $robots_adv = __('None', 'wordpress-seo'); } $field_defs['meta-robots-adv']['options']['-'] = sprintf($field_defs['meta-robots-adv']['options']['-'], $robots_adv); unset($robots_adv); /* Don't show the breadcrumb title field if breadcrumbs aren't enabled */ if ($options['breadcrumbs-enable'] !== true && !current_theme_supports('yoast-seo-breadcrumbs')) { unset($field_defs['bctitle']); } global $post; if (empty($post->ID) || !empty($post->ID) && self::get_value('redirect', $post->ID) === '') { unset($field_defs['redirect']); } break; } /** * Filter the WPSEO metabox form field definitions for a tab * {tab} can be 'general', 'advanced' or 'social' * * @param array $field_defs Metabox form definitions. * @param string $post_type Post type of the post the metabox is for, defaults to 'post'. * * @return array */ return apply_filters('wpseo_metabox_entries_' . $tab, $field_defs, $post_type); }
/** * Returns the metabox section for the social settings. * * @return WPSEO_Metabox_Section */ private function get_social_meta_section() { $options = WPSEO_Options::get_option('wpseo_social'); $taxonomy_social_fields = new WPSEO_Taxonomy_Social_Fields($this->term); $tabs = array(); $single = true; if ($options['opengraph'] === true && $options['twitter'] === true) { $single = null; } if ($options['opengraph'] === true) { $facebook_meta_fields = $taxonomy_social_fields->get_by_network('opengraph'); $tabs[] = new WPSEO_Metabox_Form_Tab('facebook', $this->taxonomy_tab_content->html($facebook_meta_fields), '<span class="screen-reader-text">' . __('Facebook / Open Graph metadata', 'wordpress-seo') . '</span><span class="dashicons dashicons-facebook-alt"></span>', array('link_aria_label' => __('Facebook / Open Graph metadata', 'wordpress-seo'), 'link_class' => 'yoast-tooltip yoast-tooltip-se', 'single' => $single)); } if ($options['twitter'] === true) { $twitter_meta_fields = $taxonomy_social_fields->get_by_network('twitter'); $tabs[] = new WPSEO_Metabox_Form_Tab('twitter', $this->taxonomy_tab_content->html($twitter_meta_fields), '<span class="screen-reader-text">' . __('Twitter metadata', 'wordpress-seo') . '</span><span class="dashicons dashicons-twitter"></span>', array('link_aria_label' => __('Twitter metadata', 'wordpress-seo'), 'link_class' => 'yoast-tooltip yoast-tooltip-se', 'single' => $single)); } return new WPSEO_Metabox_Tab_Section('social', '<span class="screen-reader-text">' . __('Social', 'wordpress-seo') . '</span><span class="dashicons dashicons-share"></span>', $tabs, array('link_aria_label' => __('Social', 'wordpress-seo'), 'link_class' => 'yoast-tooltip yoast-tooltip-e')); }
return; } $options = get_option('wpseo'); if (isset($_GET['allow_tracking']) && check_admin_referer('wpseo_activate_tracking', 'nonce')) { $options['yoast_tracking'] = $_GET['allow_tracking'] == 'yes'; update_option('wpseo', $options); if (isset($_SERVER['HTTP_REFERER'])) { wp_safe_redirect($_SERVER['HTTP_REFERER'], 307); exit; } } $yform = Yoast_Form::get_instance(); $yform->admin_header(true, 'wpseo'); do_action('wpseo_all_admin_notices'); if (is_array($options['blocking_files']) && count($options['blocking_files']) > 0) { $xml_sitemap_options = WPSEO_Options::get_option('wpseo_xml'); if ($xml_sitemap_options['enablexmlsitemap']) { echo '<div class="notice notice-error inline yoast-notice-blocking-files"><p id="blocking_files">'; printf(_n('The following file is blocking your XML sitemaps from working properly. Either delete it (this can be done with the "Fix it" button) or disable %1$s XML sitemaps.', 'The following files are blocking your XML sitemaps from working properly. Either delete them (this can be done with the "Fix it" button) or disable %1$s XML sitemaps.', count($options['blocking_files']), 'wordpress-seo'), 'Yoast SEO'); foreach ($options['blocking_files'] as $file) { echo '<br/>', '<code>', esc_html($file), '</code>'; } unset($file); echo '<br><button type="button" data-nonce="', esc_js(wp_create_nonce('wpseo-blocking-files')), '" class="button">', __('Fix it', 'wordpress-seo'), '</button>'; echo '</p></div>'; } } $tabs = new WPSEO_Option_Tabs('dashboard'); $tabs->add_tab(new WPSEO_Option_Tab('dashboard', __('Dashboard', 'wordpress-seo'), array('video_url' => 'https://yoa.st/screencast-notification-center'))); $tabs->add_tab(new WPSEO_Option_Tab('general', __('General', 'wordpress-seo'), array('video_url' => 'https://yoa.st/screencast-general'))); $knowledge_graph_label = 'company' === $options['company_or_person'] ? __('Company Info', 'wordpress-seo') : __('Your Info', 'wordpress-seo');
/** * Instantiate the different social classes on the frontend */ function wpseo_frontend_head_init() { $options = WPSEO_Options::get_option('wpseo_social'); if ($options['twitter'] === true) { add_action('wpseo_head', array('WPSEO_Twitter', 'get_instance'), 40); } if ($options['opengraph'] === true) { $GLOBALS['wpseo_og'] = new WPSEO_OpenGraph(); } }
/** * After import finished, walk through imported post_types and update info. */ public function status_transition_bulk_finished() { if (!defined('WP_IMPORTING')) { return; } if (empty($this->importing_post_types)) { return; } $options = WPSEO_Options::get_option('wpseo_xml'); $ping_search_engines = false; foreach ($this->importing_post_types as $post_type) { wp_cache_delete('lastpostmodified:gmt:' . $post_type, 'timeinfo'); // #17455. // Just have the cache deleted for nav_menu_item. if ('nav_menu_item' === $post_type) { continue; } $option = sprintf('post_types-%s-not_in_sitemap', $post_type); if (!isset($options[$option]) || $options[$option] === false) { $ping_search_engines = true; } } // Nothing to do. if (false === $ping_search_engines) { return; } if (WP_CACHE) { do_action('wpseo_hit_sitemap_index'); } WPSEO_Sitemaps::ping_search_engines(); }
/** * Instantiate the different social classes on the frontend */ function wpseo_frontend_head_init() { $options = WPSEO_Options::get_option('wpseo_social'); if ($options['twitter'] === true) { add_action('wpseo_head', array('WPSEO_Twitter', 'get_instance'), 40); } if ($options['opengraph'] === true) { $GLOBALS['wpseo_og'] = new WPSEO_OpenGraph(); } if ($options['googleplus'] === true && (is_singular() || (is_category() || is_tax() || is_tag()))) { add_action('wpseo_head', array('WPSEO_GooglePlus', 'get_instance'), 35); } }
/** * Add the inputs needed for SEO values to the User Profile page * * @param WP_User $user User instance to output for. */ public function user_profile($user) { $options = WPSEO_Options::get_option('wpseo_titles'); wp_nonce_field('wpseo_user_profile_update', 'wpseo_nonce'); require_once 'views/user-profile.php'; }
/** * Returns whether or not showing the date in the snippet preview is enabled. * * @param WP_Post $post The post to retrieve this for. * @return bool */ private function is_show_date_enabled($post) { $post_type = $post->post_type; $options = WPSEO_Options::get_option('wpseo_titles'); $key = sprintf('showdate-%s', $post_type); return isset($options[$key]) && true === $options[$key]; }
/** * Class constructor */ public function __construct() { $this->options = WPSEO_Options::get_option('wpseo_social'); $this->twitter(); }