} } else { wpseo_description_test(); $msg .= '<span class="warning">' . __('Earlier found meta description was not found in file. Renewed the description test data.', 'wordpress-seo') . '</span>'; } add_settings_error('yoast_wpseo_dashboard_options', 'error', $msg, 'updated'); } } } // Clean up the referrer url for later use. if (isset($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = remove_query_arg(array('nonce', 'fixmetadesc'), $_SERVER['REQUEST_URI']); } } if (!isset($options['theme_has_description']) || (isset($options['theme_has_description']) && $options['theme_has_description'] === true || $options['theme_description_found'] !== '') || isset($_GET['checkmetadesc']) && check_admin_referer('wpseo-check-metadesc', 'nonce')) { wpseo_description_test(); // Renew the options after the test. $options = get_option('wpseo'); } if (isset($_GET['checkmetadesc'])) { // Clean up the referrer url for later use. if (isset($_SERVER['REQUEST_URI'])) { $_SERVER['REQUEST_URI'] = remove_query_arg(array('nonce', 'checkmetadesc'), $_SERVER['REQUEST_URI']); } } $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) { echo '<p id="blocking_files" class="wrong">'; echo '<a href="javascript:wpseoKillBlockingFiles(\'', esc_js(wp_create_nonce('wpseo-blocking-files')), '\')" class="button fixit">', __('Fix it.', 'wordpress-seo'), '</a>';
/** * Abuse a filter to check if the current theme was updated and if so, test the updated theme * for the title and meta description tag * * @since 1.4.14 * * @param array $update_actions Updated actions set. * @param WP_Theme|string $updated_theme Theme object instance or stylesheet name. * * @return array $update_actions Unchanged array */ function wpseo_update_theme_complete_actions($update_actions, $updated_theme) { $options = get_option('wpseo'); // Break if admin_notice already in place. if ((isset($options['theme_has_description']) && $options['theme_has_description'] === true || $options['theme_description_found'] !== '') && $options['ignore_meta_description_warning'] !== true) { return $update_actions; } $theme = get_stylesheet(); if (is_object($updated_theme)) { /* Bulk update and $updated_theme only contains info on which theme was last in the list of updated themes, so go & test */ // Commented out? wpseo_title_test(); R. wpseo_description_test(); } elseif ($updated_theme === $theme) { /* Single theme update for the active theme */ // Commented out? wpseo_title_test(); R. wpseo_description_test(); } return $update_actions; }
/** * Abuse a filter to check if the current theme was updated and if so, test the updated theme * for the meta description tag * * @since 1.4.14 * * @return array $update_actions Unchanged array */ function wpseo_update_theme_complete_actions($update_actions, $updated_theme) { $options = get_option('wpseo'); // Break if admin_notice already in place if (isset($options['meta_description_warning']) && true === $options['meta_description_warning']) { return $update_actions; } $theme = get_stylesheet(); if (is_object($updated_theme)) { /* Bulk update and $updated_theme only contains info on which theme was last in the list of updated themes, so go & test */ wpseo_description_test(); } else { if ($updated_theme === $theme) { /* Single theme update for the active theme */ wpseo_description_test(); } } return $update_actions; }
/** * Initialize some options on first install/activate/reset * * @static * @return void */ public static function initialize() { /* Make sure title_test and description_test function are available even when called from the isolated activation */ require_once WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php'; // wpseo_title_test(); wpseo_description_test(); /* Force WooThemes to use WordPress SEO data. */ if (function_exists('woo_version_init')) { update_option('seo_woo_use_third_party_data', 'true'); } }
/** * Determine whether the wpseo option holds the current version, if it doesn't, run * the upgrade procedures. */ function maybe_upgrade() { $options = get_option('wpseo'); $current_version = isset($options['version']) ? $options['version'] : 0; if (version_compare($current_version, WPSEO_VERSION, '==')) { return; } // <= 0.3.5: flush rewrite rules for new XML sitemaps if ($current_version == 0) { $this->schedule_rewrite_flush(); } if (version_compare($current_version, '0.4.2', '<')) { $xml_opt = array(); // Move XML Sitemap settings from general array to XML specific array, general settings first foreach (array('enablexmlsitemap', 'xml_include_images', 'xml_ping_google', 'xml_ping_bing', 'xml_ping_yahoo', 'xml_ping_ask', 'xmlnews_posttypes') as $opt) { if (isset($options[$opt])) { $xml_opt[$opt] = $options[$opt]; unset($options[$opt]); } } // Per post type settings foreach (get_post_types() as $post_type) { if (in_array($post_type, array('revision', 'nav_menu_item', 'attachment'))) { continue; } if (isset($options['post_types-' . $post_type . '-not_in_sitemap'])) { $xml_opt['post_types-' . $post_type . '-not_in_sitemap'] = $options['post_types-' . $post_type . '-not_in_sitemap']; unset($options['post_types-' . $post_type . '-not_in_sitemap']); } } // Per taxonomy settings foreach (get_taxonomies() as $taxonomy) { if (in_array($taxonomy, array('nav_menu', 'link_category', 'post_format'))) { continue; } if (isset($options['taxonomies-' . $taxonomy . '-not_in_sitemap'])) { $xml_opt['taxonomies-' . $taxonomy . '-not_in_sitemap'] = $options['taxonomies-' . $taxonomy . '-not_in_sitemap']; unset($options['taxonomies-' . $taxonomy . '-not_in_sitemap']); } } if (get_option('wpseo_xml') === false) { update_option('wpseo_xml', $xml_opt); } unset($xml_opt); // Clean up other no longer used settings unset($options['wpseodir'], $options['wpseourl']); } if (version_compare($current_version, '1.0.2.2', '<')) { $opt = (array) get_option('wpseo_indexation'); unset($opt['hideindexrel'], $opt['hidestartrel'], $opt['hideprevnextpostlink'], $opt['hidewpgenerator']); update_option('wpseo_indexation', $opt); } if (version_compare($current_version, '1.0.4', '<')) { $opt = (array) get_option('wpseo_indexation'); $newopt = array('opengraph' => isset($opt['opengraph']) ? $opt['opengraph'] : '', 'fb_adminid' => isset($opt['fb_adminid']) ? $opt['fb_adminid'] : '', 'fb_appid' => isset($opt['fb_appid']) ? $opt['fb_appid'] : ''); update_option('wpseo_social', $newopt); unset($opt['opengraph'], $opt['fb_pageid'], $opt['fb_adminid'], $opt['fb_appid']); update_option('wpseo_indexation', $opt); } if (version_compare($current_version, '1.2', '<')) { $opt = get_option('wpseo_indexation'); $metaopt = get_option('wpseo_titles'); $metaopt['noindex-author'] = isset($opt['noindexauthor']) ? $opt['noindexauthor'] : ''; $metaopt['disable-author'] = isset($opt['disableauthor']) ? $opt['disableauthor'] : ''; $metaopt['noindex-archive'] = isset($opt['noindexdate']) ? $opt['noindexdate'] : ''; $metaopt['noindex-category'] = isset($opt['noindexcat']) ? $opt['noindexcat'] : ''; $metaopt['noindex-post_tag'] = isset($opt['noindextag']) ? $opt['noindextag'] : ''; $metaopt['noindex-post_format'] = isset($opt['noindexpostformat']) ? $opt['noindexpostformat'] : ''; $metaopt['noindex-subpages'] = isset($opt['noindexsubpages']) ? $opt['noindexsubpages'] : ''; $metaopt['hide-rsdlink'] = isset($opt['hidersdlink']) ? $opt['hidersdlink'] : ''; $metaopt['hide-feedlinks'] = isset($opt['hidefeedlinks']) ? $opt['hidefeedlinks'] : ''; $metaopt['hide-wlwmanifest'] = isset($opt['hidewlwmanifest']) ? $opt['hidewlwmanifest'] : ''; $metaopt['hide-shortlink'] = isset($opt['hideshortlink']) ? $opt['hideshortlink'] : ''; update_option('wpseo_titles', $metaopt); delete_option('wpseo_indexation'); wpseo_title_test(); } // Clean up the wrong wpseo options if (version_compare($current_version, '1.2.3', '<')) { $opt = get_option('wpseo'); if (is_array($opt)) { foreach ($opt as $key => $val) { if (!in_array($key, array('ignore_blog_public_warning', 'ignore_tour', 'ignore_page_comments', 'ignore_permalink', 'ms_defaults_set', 'version', 'disableadvanced_meta', 'googleverify', 'msverify', 'alexaverify'))) { unset($opt[$key]); } } update_option('wpseo', $opt); unset($opt); } } // Fix wrongness created by buggy version 1.2.2 if (version_compare($current_version, '1.2.4', '<')) { $options = get_option('wpseo_titles'); if (is_array($options) && isset($options['title-home']) && $options['title-home'] == '%%sitename%% - %%sitedesc%% - 12345') { $options['title-home'] = '%%sitename%% - %%sitedesc%%'; update_option('wpseo_titles', $options); } } if (version_compare($current_version, '1.2.8', '<')) { $options = get_option('wpseo'); if (is_array($options) && isset($options['presstrends'])) { $options['yoast_tracking'] = 'on'; unset($options['presstrends']); update_option('wpseo', $options); } } if (version_compare($current_version, '1.2.8.2', '<')) { $options = get_option('wpseo'); if (is_array($options) && isset($options['presstrends'])) { $options['yoast_tracking'] = 'on'; unset($options['presstrends']); } if (is_array($options) && isset($options['presstrends_popup'])) { $options['tracking_popup'] = 'on'; unset($options['presstrends_popup']); } update_option('wpseo', $options); } if (version_compare($current_version, '1.3.2', '<')) { $options = get_option('wpseo_xml'); $options['post_types-attachment-not_in_sitemap'] = true; update_option('wpseo_xml', $options); } if (version_compare($current_version, '1.4.13', '<')) { wpseo_description_test(); } if (version_compare($current_version, '1.4.15', '<')) { $this->schedule_rewrite_flush(); } if (version_compare($current_version, '1.4.16', '<')) { $options = get_option('wpseo_permalinks'); if (!is_array($options)) { $options = array(); } $options['cleanslugs'] = 'on'; update_option('wpseo_permalinks', $options); } $options = get_option('wpseo'); $options['version'] = WPSEO_VERSION; update_option('wpseo', $options); }