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


PHP WPSEO_Utils::clear_cache方法代碼示例

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


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

示例1: wpseo_title_test

/**
 * Test whether force rewrite should be enabled or not.
 */
function wpseo_title_test()
{
    $options = get_option('wpseo_titles');
    $options['forcerewritetitle'] = false;
    $options['title_test'] = 1;
    update_option('wpseo_titles', $options);
    // Setting title_test to > 0 forces the plugin to output the title below through a filter in class-frontend.php.
    $expected_title = 'This is a Yoast Test Title';
    WPSEO_Utils::clear_cache();
    $args = array('user-agent' => sprintf('WordPress/%1$s; %2$s - Yoast', $GLOBALS['wp_version'], get_site_url()));
    $resp = wp_remote_get(get_bloginfo('url'), $args);
    if ($resp && !is_wp_error($resp) && (200 == $resp['response']['code'] && isset($resp['body']))) {
        $res = preg_match('`<title>([^<]+)</title>`im', $resp['body'], $matches);
        if ($res && strcmp($matches[1], $expected_title) !== 0) {
            $options['forcerewritetitle'] = true;
            $resp = wp_remote_get(get_bloginfo('url'), $args);
            $res = false;
            if ($resp && !is_wp_error($resp) && (200 == $resp['response']['code'] && isset($resp['body']))) {
                $res = preg_match('`/<title>([^>]+)</title>`im', $resp['body'], $matches);
            }
        }
        if (!$res || $matches[1] != $expected_title) {
            $options['forcerewritetitle'] = false;
        }
    } else {
        // If that dies, let's make sure the titles are correct and force the output.
        $options['forcerewritetitle'] = true;
    }
    $options['title_test'] = 0;
    update_option('wpseo_titles', $options);
}
開發者ID:Friends-School-Atlanta,項目名稱:Deployable-WordPress,代碼行數:34,代碼來源:wpseo-non-ajax-functions.php

示例2: clear_cache

 /**
  * Clears the cache
  *
  * @deprecated 1.5.0
  * @deprecated use WPSEO_Utils::clear_cache()
  * @see        WPSEO_Utils::clear_cache()
  */
 function clear_cache()
 {
     _deprecated_function(__METHOD__, 'WPSEO 1.5.0', 'WPSEO_Utils::clear_cache()');
     WPSEO_Utils::clear_cache();
 }
開發者ID:jianqiangsong,項目名稱:WordPress,代碼行數:12,代碼來源:class-admin.php

示例3: _wpseo_deactivate

/**
 * On deactivation, flush the rewrite rules so XML sitemaps stop working.
 */
function _wpseo_deactivate()
{
    require_once WPSEO_PATH . 'inc/wpseo-functions.php';
    if (is_multisite() && ms_is_switched()) {
        delete_option('rewrite_rules');
    } else {
        add_action('shutdown', 'flush_rewrite_rules');
    }
    wpseo_remove_capabilities();
    // Clear cache so the changes are obvious.
    WPSEO_Utils::clear_cache();
    do_action('wpseo_deactivate');
}
開發者ID:misfist,項目名稱:missdrepants-network,代碼行數:16,代碼來源:wp-seo-main.php

示例4: _wpseo_deactivate

/**
 * On deactivation, flush the rewrite rules so XML sitemaps stop working.
 */
function _wpseo_deactivate()
{
    require_once WPSEO_PATH . 'inc/wpseo-functions.php';
    add_action('shutdown', 'flush_rewrite_rules');
    wpseo_remove_capabilities();
    // Force unschedule
    WPSEO_Utils::schedule_yoast_tracking(null, get_option('wpseo'), true);
    // Clear cache so the changes are obvious.
    WPSEO_Utils::clear_cache();
    do_action('wpseo_deactivate');
}
開發者ID:BennyHudson,項目名稱:foundations,代碼行數:14,代碼來源:wp-seo-main.php

示例5: _wpseo_deactivate

/**
 * On deactivation, flush the rewrite rules so XML sitemaps stop working.
 */
function _wpseo_deactivate()
{
    require_once WPSEO_PATH . 'inc/wpseo-functions.php';
    add_action('shutdown', 'flush_rewrite_rules');
    wpseo_remove_capabilities();
    // Clear cache so the changes are obvious.
    WPSEO_Utils::clear_cache();
    do_action('wpseo_deactivate');
}
開發者ID:crazyyy,項目名稱:octagram,代碼行數:12,代碼來源:wp-seo-main.php

示例6: clear_cache

 /**
  * Clears the WP or W3TC cache depending on which is used
  *
  * @deprecated 1.5.6.1
  * @deprecated use WPSEO_Utils::clear_cache()
  * @see        WPSEO_Utils::clear_cache()
  */
 public static function clear_cache()
 {
     _deprecated_function(__METHOD__, 'WPSEO 1.5.6.1', 'WPSEO_Utils::clear_cache()');
     WPSEO_Utils::clear_cache();
 }
開發者ID:BennyHudson,項目名稱:foundations,代碼行數:12,代碼來源:class-wpseo-options.php


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