当前位置: 首页>>代码示例>>PHP>>正文


PHP WPSEO_Options::get_instance方法代码示例

本文整理汇总了PHP中WPSEO_Options::get_instance方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Options::get_instance方法的具体用法?PHP WPSEO_Options::get_instance怎么用?PHP WPSEO_Options::get_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WPSEO_Options的用法示例。


在下文中一共展示了WPSEO_Options::get_instance方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wpseo_init

/**
 * On plugins_loaded: load the minimum amount of essential files for this plugin
 */
function wpseo_init()
{
    require_once WPSEO_PATH . 'inc/wpseo-functions.php';
    // Make sure our option and meta value validation routines and default values are always registered and available
    WPSEO_Options::get_instance();
    WPSEO_Meta::init();
    $options = WPSEO_Options::get_all();
    if (version_compare($options['version'], WPSEO_VERSION, '<')) {
        new WPSEO_Upgrade();
        // get a cleaned up version of the $options
        $options = WPSEO_Options::get_all();
    }
    if ($options['stripcategorybase'] === true) {
        $GLOBALS['wpseo_rewrite'] = new WPSEO_Rewrite();
    }
    if ($options['enablexmlsitemap'] === true) {
        $GLOBALS['wpseo_sitemaps'] = new WPSEO_Sitemaps();
    }
    if (!defined('DOING_AJAX') || !DOING_AJAX) {
        require_once WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
    }
}
开发者ID:BennyHudson,项目名称:foundations,代码行数:25,代码来源:wp-seo-main.php

示例2: wpseo_init

/**
 * On plugins_loaded: load the minimum amount of essential files for this plugin
 */
function wpseo_init()
{
    require_once WPSEO_PATH . 'inc/wpseo-functions.php';
    // Make sure our option and meta value validation routines and default values are always registered and available.
    WPSEO_Options::get_instance();
    WPSEO_Meta::init();
    $options = WPSEO_Options::get_options(array('wpseo', 'wpseo_permalinks', 'wpseo_xml'));
    if (version_compare($options['version'], WPSEO_VERSION, '<')) {
        new WPSEO_Upgrade();
        // Get a cleaned up version of the $options.
        $options = WPSEO_Options::get_options(array('wpseo', 'wpseo_permalinks', 'wpseo_xml'));
    }
    if ($options['stripcategorybase'] === true) {
        $GLOBALS['wpseo_rewrite'] = new WPSEO_Rewrite();
    }
    if ($options['enablexmlsitemap'] === true) {
        $GLOBALS['wpseo_sitemaps'] = new WPSEO_Sitemaps();
    }
    if (!defined('DOING_AJAX') || !DOING_AJAX) {
        require_once WPSEO_PATH . 'inc/wpseo-non-ajax-functions.php';
    }
    // Init it here because the filter must be present on the frontend as well or it won't work in the customizer.
    new WPSEO_Customizer();
}
开发者ID:misfist,项目名称:missdrepants-network,代码行数:27,代码来源:wp-seo-main.php

示例3: wpseo_remove_stopwords_sample_permalink

/**
 * Removes stopword from the sample permalink that is generated in an AJAX request
 *
 * @param array  $permalink The permalink generated for this post by WordPress.
 * @param int    $post_ID The ID of the post.
 * @param string $title The title for the post that the user used.
 * @param string $name The name for the post that the user used.
 *
 * @return array
 */
function wpseo_remove_stopwords_sample_permalink($permalink, $post_ID, $title, $name)
{
    WPSEO_Options::get_instance();
    $options = WPSEO_Options::get_options(array('wpseo_permalinks'));
    if ($options['cleanslugs'] !== true) {
        return $permalink;
    }
    /*
     * If the name is empty and the title is not, WordPress will generate a slug. In that case we want to remove stop
     * words from the slug.
     */
    if (empty($name) && !empty($title)) {
        $stop_words = new WPSEO_Admin_Stop_Words();
        // The second element is the slug.
        $permalink[1] = $stop_words->remove_in($permalink[1]);
    }
    return $permalink;
}
开发者ID:AnkushVarshneya,项目名称:wordpress-theme,代码行数:28,代码来源:ajax.php


注:本文中的WPSEO_Options::get_instance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。