本文整理汇总了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';
}
}
示例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();
}
示例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;
}