本文整理匯總了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;
}