當前位置: 首頁>>代碼示例>>PHP>>正文


PHP WPSEO_Options::ensure_options_exist方法代碼示例

本文整理匯總了PHP中WPSEO_Options::ensure_options_exist方法的典型用法代碼示例。如果您正苦於以下問題:PHP WPSEO_Options::ensure_options_exist方法的具體用法?PHP WPSEO_Options::ensure_options_exist怎麽用?PHP WPSEO_Options::ensure_options_exist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在WPSEO_Options的用法示例。


在下文中一共展示了WPSEO_Options::ensure_options_exist方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: wpseo_do_upgrade

/**
 * Run the upgrade procedures.
 *
 * @todo - [JRF => Yoast] check: if upgrade is run on multi-site installation, upgrade for all sites ?
 * Maybe not necessary as it is now run on plugins_loaded, so upgrade will run as soon as any page
 * on a site is requested.
 */
function wpseo_do_upgrade()
{
    /* Make sure title_test and description_test functions are available */
    require_once WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
    $option_wpseo = get_option('wpseo');
    WPSEO_Options::maybe_set_multisite_defaults(false);
    //	if ( $option_wpseo['version'] === '' || version_compare( $option_wpseo['version'], '1.2', '<' ) ) {
    //		add_action( 'init', 'wpseo_title_test' );
    //	}
    if ($option_wpseo['version'] === '' || version_compare($option_wpseo['version'], '1.4.13', '<')) {
        // Run description test once theme has loaded
        add_action('init', 'wpseo_description_test');
    }
    if ($option_wpseo['version'] === '' || version_compare($option_wpseo['version'], '1.4.15', '<')) {
        add_action('shutdown', 'flush_rewrite_rules');
    }
    if (version_compare($option_wpseo['version'], '1.5.0', '<')) {
        // Clean up options and meta
        WPSEO_Options::clean_up(null, $option_wpseo['version']);
        WPSEO_Meta::clean_up();
        // Add new capabilities on upgrade
        wpseo_add_capabilities();
    }
    /* Only correct the breadcrumb defaults for upgrades from v1.5+ to v1.5.2.3, upgrades from earlier version
       will already get this functionality in the clean_up routine. */
    if (version_compare($option_wpseo['version'], '1.4.25', '>') && version_compare($option_wpseo['version'], '1.5.2.3', '<')) {
        add_action('init', array('WPSEO_Options', 'bring_back_breadcrumb_defaults'), 3);
    }
    if (version_compare($option_wpseo['version'], '1.4.25', '>') && version_compare($option_wpseo['version'], '1.5.2.4', '<')) {
        /* Make sure empty maintax/mainpt strings will convert to 0 */
        WPSEO_Options::clean_up('wpseo_internallinks', $option_wpseo['version']);
        /* Remove slashes from taxonomy meta texts */
        WPSEO_Options::clean_up('wpseo_taxonomy_meta', $option_wpseo['version']);
    }
    /* Clean up stray wpseo_ms options from the options table, option should only exist in the sitemeta table */
    delete_option('wpseo_ms');
    // Make sure version nr gets updated for any version without specific upgrades
    $option_wpseo = get_option('wpseo');
    // re-get to make sure we have the latest version
    if (version_compare($option_wpseo['version'], WPSEO_VERSION, '<')) {
        update_option('wpseo', $option_wpseo);
    }
    // Make sure all our options always exist - issue #1245
    WPSEO_Options::ensure_options_exist();
}
開發者ID:CrankMaster336,項目名稱:FFW-TR,代碼行數:52,代碼來源:wpseo-functions.php

示例2: _wpseo_activate

/**
 * Runs on activation of the plugin.
 */
function _wpseo_activate()
{
    require_once WPSEO_PATH . 'inc/wpseo-functions.php';
    wpseo_load_textdomain();
    // Make sure we have our translations available for the defaults.
    WPSEO_Options::get_instance();
    if (!is_multisite()) {
        WPSEO_Options::initialize();
    } else {
        WPSEO_Options::maybe_set_multisite_defaults(true);
    }
    WPSEO_Options::ensure_options_exist();
    if (is_multisite() && ms_is_switched()) {
        delete_option('rewrite_rules');
    } else {
        add_action('shutdown', 'flush_rewrite_rules');
    }
    wpseo_add_capabilities();
    // Clear cache so the changes are obvious.
    WPSEO_Utils::clear_cache();
    do_action('wpseo_activate');
}
開發者ID:misfist,項目名稱:missdrepants-network,代碼行數:25,代碼來源:wp-seo-main.php

示例3: finish_up

 /**
  * 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.
 }
開發者ID:Didox,項目名稱:beminfinito,代碼行數:16,代碼來源:class-upgrade.php

示例4: _wpseo_activate

/**
 * Runs on activation of the plugin.
 */
function _wpseo_activate()
{
    require_once WPSEO_PATH . 'inc/wpseo-functions.php';
    wpseo_load_textdomain();
    // Make sure we have our translations available for the defaults
    WPSEO_Options::get_instance();
    if (!is_multisite()) {
        WPSEO_Options::initialize();
    } else {
        WPSEO_Options::maybe_set_multisite_defaults(true);
    }
    WPSEO_Options::ensure_options_exist();
    flush_rewrite_rules();
    wpseo_add_capabilities();
    WPSEO_Options::schedule_yoast_tracking(null, get_option('wpseo'));
    // Clear cache so the changes are obvious.
    WPSEO_Options::clear_cache();
    do_action('wpseo_activate');
}
開發者ID:UPMediaDesign,項目名稱:vidaestudiantilip,代碼行數:22,代碼來源:wp-seo-main.php

示例5: finish_up

 /**
  * Runs the needed cleanup after an update, setting the DB version to latest version, flushing caches etc.
  */
 private function finish_up()
 {
     $this->options = get_option('wpseo');
     // re-get to make sure we have the latest version
     $this->options['seen_about'] = false;
     // make sure user is redirected to the about screen
     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
 }
開發者ID:goodbayscott,項目名稱:wwr-temp,代碼行數:18,代碼來源:class-upgrade.php

示例6: wpseo_do_upgrade

/**
 * Run the upgrade procedures.
 *
 * @todo - [JRF => Yoast] check: if upgrade is run on multi-site installation, upgrade for all sites ?
 * Maybe not necessary as it is now run on plugins_loaded, so upgrade will run as soon as any page
 * on a site is requested.
 */
function wpseo_do_upgrade()
{
    /* Make sure title_test and description_test functions are available */
    require_once WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
    $option_wpseo = get_option('wpseo');
    WPSEO_Options::maybe_set_multisite_defaults(false);
    // Just flush rewrites, always, to at least make them work after an upgrade.
    add_action('shutdown', 'flush_rewrite_rules');
    WPSEO_Utils::clear_sitemap_cache();
    if (version_compare($option_wpseo['version'], '1.8.0', '<')) {
        $options_titles = get_option('wpseo_titles');
        $options_permalinks = get_option('wpseo_permalinks');
        foreach (array('hide-feedlinks', 'hide-rsdlink', 'hide-shortlink', 'hide-wlwmanifest') as $hide) {
            if (isset($options_titles[$hide])) {
                $options_permalinks[$hide] = $options_titles[$hide];
                unset($options_titles[$hide]);
                update_option('wpseo_permalinks', $options_permalinks);
                update_option('wpseo_titles', $options_titles);
            }
        }
        unset($options_titles, $options_permalinks);
        $options_social = get_option('wpseo_social');
        if (isset($option_wpseo['pinterestverify'])) {
            $options_social['pinterestverify'] = $option_wpseo['pinterestverify'];
            unset($option_wpseo['pinterestverify']);
            update_option('wpseo_social', $options_social);
            update_option('wpseo', $option_wpseo);
        }
        unset($options_social);
    }
    if ($option_wpseo['version'] === '' || version_compare($option_wpseo['version'], '1.4.13', '<')) {
        // Run description test once theme has loaded
        add_action('init', 'wpseo_description_test');
    }
    if (version_compare($option_wpseo['version'], '1.5.0', '<')) {
        // Clean up options and meta
        WPSEO_Options::clean_up(null, $option_wpseo['version']);
        WPSEO_Meta::clean_up();
        // Add new capabilities on upgrade
        wpseo_add_capabilities();
    }
    /* Only correct the breadcrumb defaults for upgrades from v1.5+ to v1.5.2.3, upgrades from earlier version
       will already get this functionality in the clean_up routine. */
    if (version_compare($option_wpseo['version'], '1.4.25', '>') && version_compare($option_wpseo['version'], '1.5.2.3', '<')) {
        add_action('init', array('WPSEO_Options', 'bring_back_breadcrumb_defaults'), 3);
    }
    if (version_compare($option_wpseo['version'], '1.4.25', '>') && version_compare($option_wpseo['version'], '1.5.2.4', '<')) {
        /* Make sure empty maintax/mainpt strings will convert to 0 */
        WPSEO_Options::clean_up('wpseo_internallinks', $option_wpseo['version']);
        /* Remove slashes from taxonomy meta texts */
        WPSEO_Options::clean_up('wpseo_taxonomy_meta', $option_wpseo['version']);
    }
    /* Clean up stray wpseo_ms options from the options table, option should only exist in the sitemeta table */
    delete_option('wpseo_ms');
    // Make sure version nr gets updated for any version without specific upgrades
    $option_wpseo = get_option('wpseo');
    // re-get to make sure we have the latest version
    if (version_compare($option_wpseo['version'], WPSEO_VERSION, '<')) {
        update_option('wpseo', $option_wpseo);
    }
    // Make sure all our options always exist - issue #1245
    WPSEO_Options::ensure_options_exist();
    add_action('admin_footer', 'wpseo_redirect_to_about');
}
開發者ID:BennyHudson,項目名稱:ben-hudson,代碼行數:71,代碼來源:wpseo-functions.php


注:本文中的WPSEO_Options::ensure_options_exist方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。