本文整理汇总了PHP中WPSEO_Options::maybe_set_multisite_defaults方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Options::maybe_set_multisite_defaults方法的具体用法?PHP WPSEO_Options::maybe_set_multisite_defaults怎么用?PHP WPSEO_Options::maybe_set_multisite_defaults使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Options
的用法示例。
在下文中一共展示了WPSEO_Options::maybe_set_multisite_defaults方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class constructor
*/
function __construct()
{
$this->options = WPSEO_Options::get_all();
if (is_multisite()) {
WPSEO_Options::maybe_set_multisite_defaults(false);
}
if ($this->options['stripcategorybase'] === true) {
add_action('created_category', array($this, 'schedule_rewrite_flush'));
add_action('edited_category', array($this, 'schedule_rewrite_flush'));
add_action('delete_category', array($this, 'schedule_rewrite_flush'));
}
$this->page_gsc = new WPSEO_GSC();
$this->dashboard_widget = new Yoast_Dashboard_Widget();
// Needs the lower than default priority so other plugins can hook underneath it without issue.
add_action('admin_menu', array($this, 'register_settings_page'), 5);
add_action('network_admin_menu', array($this, 'register_network_settings_page'));
add_filter('plugin_action_links_' . WPSEO_BASENAME, array($this, 'add_action_link'), 10, 2);
add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
if ('0' == get_option('blog_public')) {
add_action('admin_footer', array($this, 'blog_public_warning'));
}
if ((isset($this->options['theme_has_description']) && $this->options['theme_has_description'] === true || $this->options['theme_description_found'] !== '') && $this->options['ignore_meta_description_warning'] !== true) {
add_action('admin_footer', array($this, 'meta_description_warning'));
}
if ($this->options['cleanslugs'] === true) {
add_filter('name_save_pre', array($this, 'remove_stopwords_from_slug'), 0);
}
add_filter('user_contactmethods', array($this, 'update_contactmethods'), 10, 1);
add_action('after_switch_theme', array($this, 'switch_theme'));
add_action('switch_theme', array($this, 'switch_theme'));
add_filter('set-screen-option', array($this, 'save_bulk_edit_options'), 10, 3);
add_action('admin_init', array('WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts'), 10, 1);
add_action('admin_init', array($this, 'import_plugin_hooks'));
WPSEO_Utils::register_cache_clear_option('wpseo', '');
}
示例2: __construct
/**
* Class constructor
*/
public function __construct()
{
$this->options = WPSEO_Options::get_option('wpseo');
WPSEO_Options::maybe_set_multisite_defaults(false);
$this->init();
if (version_compare($this->options['version'], '1.5.0', '<')) {
$this->upgrade_15($this->options['version']);
}
if (version_compare($this->options['version'], '2.0', '<')) {
$this->upgrade_20();
}
if (version_compare($this->options['version'], '2.1', '<')) {
$this->upgrade_21();
}
if (version_compare($this->options['version'], '2.2', '<')) {
$this->upgrade_22();
}
if (version_compare($this->options['version'], '2.3', '<')) {
$this->upgrade_23();
}
if (version_compare($this->options['version'], '3.0', '<')) {
$this->upgrade_30();
}
/**
* Filter: 'wpseo_run_upgrade' - Runs the upgrade hook which are dependent on Yoast SEO
*
* @deprecated Since 3.1
*
* @api string - The current version of Yoast SEO
*/
do_action('wpseo_run_upgrade', $this->options['version']);
$this->finish_up();
}
示例3: __construct
/**
* Class constructor
*/
public function __construct()
{
$this->options = WPSEO_Options::get_all();
WPSEO_Options::maybe_set_multisite_defaults(false);
$this->init();
if (version_compare($this->options['version'], '1.5.0', '<')) {
$this->upgrade_15($this->options['version']);
}
if (version_compare($this->options['version'], '2.0', '<')) {
$this->upgrade_20();
}
$this->finish_up();
}
示例4: __construct
/**
* Class constructor
*/
function __construct()
{
global $pagenow;
$this->options = WPSEO_Options::get_options(array('wpseo', 'wpseo_permalinks'));
if (is_multisite()) {
WPSEO_Options::maybe_set_multisite_defaults(false);
}
if ($this->options['stripcategorybase'] === true) {
add_action('created_category', array($this, 'schedule_rewrite_flush'));
add_action('edited_category', array($this, 'schedule_rewrite_flush'));
add_action('delete_category', array($this, 'schedule_rewrite_flush'));
}
$this->admin_features = array('google_search_console' => new WPSEO_GSC(), 'dashboard_widget' => new Yoast_Dashboard_Widget());
if (WPSEO_Metabox::is_post_overview($pagenow) || WPSEO_Metabox::is_post_edit($pagenow)) {
$this->admin_features['primary_category'] = new WPSEO_Primary_Term_Admin();
}
if (filter_input(INPUT_GET, 'page') === 'wpseo_tools' && filter_input(INPUT_GET, 'tool') === null) {
new WPSEO_Recalculate_Scores();
}
// Needs the lower than default priority so other plugins can hook underneath it without issue.
add_action('admin_menu', array($this, 'register_settings_page'), 5);
add_action('network_admin_menu', array($this, 'register_network_settings_page'));
add_filter('plugin_action_links_' . WPSEO_BASENAME, array($this, 'add_action_link'), 10, 2);
add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
add_action('admin_enqueue_scripts', array($this, 'enqueue_global_style'));
if ($this->options['cleanslugs'] === true) {
add_filter('name_save_pre', array($this, 'remove_stopwords_from_slug'), 0);
}
add_filter('user_contactmethods', array($this, 'update_contactmethods'), 10, 1);
add_action('after_switch_theme', array($this, 'switch_theme'));
add_action('switch_theme', array($this, 'switch_theme'));
add_filter('set-screen-option', array($this, 'save_bulk_edit_options'), 10, 3);
add_action('admin_init', array('WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts'), 10, 1);
add_action('admin_init', array($this, 'import_plugin_hooks'));
add_filter('wpseo_submenu_pages', array($this, 'filter_settings_pages'));
WPSEO_Sitemaps_Cache::register_clear_on_option_update('wpseo');
if (WPSEO_Utils::is_yoast_seo_page()) {
add_action('admin_enqueue_scripts', array($this, 'enqueue_assets'));
}
if (WPSEO_Utils::is_api_available()) {
$configuration = new WPSEO_Configuration_Page();
if (filter_input(INPUT_GET, 'page') === self::PAGE_IDENTIFIER) {
$configuration->catch_configuration_request();
}
}
}
示例5: 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();
}
示例6: __construct
/**
* Class constructor
*/
public function __construct()
{
$this->options = WPSEO_Options::get_option('wpseo');
WPSEO_Options::maybe_set_multisite_defaults(false);
if (version_compare($this->options['version'], '1.5.0', '<')) {
$this->upgrade_15($this->options['version']);
}
if (version_compare($this->options['version'], '2.0', '<')) {
$this->upgrade_20();
}
if (version_compare($this->options['version'], '2.1', '<')) {
$this->upgrade_21();
}
if (version_compare($this->options['version'], '2.2', '<')) {
$this->upgrade_22();
}
if (version_compare($this->options['version'], '2.3', '<')) {
$this->upgrade_23();
}
if (version_compare($this->options['version'], '3.0', '<')) {
$this->upgrade_30();
}
if (version_compare($this->options['version'], '3.3', '<')) {
$this->upgrade_33();
}
if (version_compare($this->options['version'], '3.6', '<')) {
$this->upgrade_36();
}
// Since 3.7.
$features = new WPSEO_Features();
if (!$features->is_premium()) {
$upsell_notice = new WPSEO_Product_Upsell_Notice();
$upsell_notice->set_upgrade_notice();
}
/**
* Filter: 'wpseo_run_upgrade' - Runs the upgrade hook which are dependent on Yoast SEO
*
* @deprecated Since 3.1
*
* @api string - The current version of Yoast SEO
*/
do_action('wpseo_run_upgrade', $this->options['version']);
$this->finish_up();
}
示例7: __construct
/**
* Class constructor
*/
function __construct()
{
global $pagenow;
$this->options = WPSEO_Options::get_options(array('wpseo', 'wpseo_permalinks'));
if (is_multisite()) {
WPSEO_Options::maybe_set_multisite_defaults(false);
}
if ($this->options['stripcategorybase'] === true) {
add_action('created_category', array($this, 'schedule_rewrite_flush'));
add_action('edited_category', array($this, 'schedule_rewrite_flush'));
add_action('delete_category', array($this, 'schedule_rewrite_flush'));
}
$this->admin_features = array('google_search_console' => new WPSEO_GSC(), 'dashboard_widget' => new Yoast_Dashboard_Widget());
if (in_array($pagenow, array('post-new.php', 'post.php', 'edit.php'))) {
$this->admin_features['primary_category'] = new WPSEO_Primary_Term_Admin();
}
if (filter_input(INPUT_GET, 'page') === 'wpseo_tools' && filter_input(INPUT_GET, 'tool') === null) {
new WPSEO_Recalculate_Scores();
}
// Needs the lower than default priority so other plugins can hook underneath it without issue.
add_action('admin_menu', array($this, 'register_settings_page'), 5);
add_action('network_admin_menu', array($this, 'register_network_settings_page'));
add_filter('plugin_action_links_' . WPSEO_BASENAME, array($this, 'add_action_link'), 10, 2);
add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
if ('0' === get_option('blog_public')) {
add_action('admin_footer', array($this, 'blog_public_warning'));
}
if ((isset($this->options['theme_has_description']) && $this->options['theme_has_description'] === true || $this->options['theme_description_found'] !== '') && $this->options['ignore_meta_description_warning'] !== true) {
add_action('admin_footer', array($this, 'meta_description_warning'));
}
if ($this->options['cleanslugs'] === true) {
add_filter('name_save_pre', array($this, 'remove_stopwords_from_slug'), 0);
}
add_filter('user_contactmethods', array($this, 'update_contactmethods'), 10, 1);
add_action('after_switch_theme', array($this, 'switch_theme'));
add_action('switch_theme', array($this, 'switch_theme'));
add_filter('set-screen-option', array($this, 'save_bulk_edit_options'), 10, 3);
add_action('admin_init', array('WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts'), 10, 1);
add_action('admin_init', array($this, 'import_plugin_hooks'));
WPSEO_Sitemaps_Cache::register_clear_on_option_update('wpseo');
}
示例8: __construct
/**
* Class constructor
*/
function __construct()
{
$options = WPSEO_Options::get_all();
if (is_multisite()) {
WPSEO_Options::maybe_set_multisite_defaults(false);
}
if ($options['stripcategorybase'] === true) {
add_action('created_category', array($this, 'schedule_rewrite_flush'));
add_action('edited_category', array($this, 'schedule_rewrite_flush'));
add_action('delete_category', array($this, 'schedule_rewrite_flush'));
}
// Needs the lower than default priority so other plugins can hook underneath it without issue.
add_action('admin_menu', array($this, 'register_settings_page'), 5);
add_action('network_admin_menu', array($this, 'register_network_settings_page'));
add_filter('plugin_action_links_' . WPSEO_BASENAME, array($this, 'add_action_link'), 10, 2);
add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
if ('0' == get_option('blog_public')) {
add_action('admin_footer', array($this, 'blog_public_warning'));
}
if ((isset($options['theme_has_description']) && $options['theme_has_description'] === true || $options['theme_description_found'] !== '') && $options['ignore_meta_description_warning'] !== true) {
add_action('admin_footer', array($this, 'meta_description_warning'));
}
if ($options['cleanslugs'] === true) {
add_filter('name_save_pre', array($this, 'remove_stopwords_from_slug'), 0);
}
add_action('show_user_profile', array($this, 'user_profile'));
add_action('edit_user_profile', array($this, 'user_profile'));
add_action('personal_options_update', array($this, 'process_user_option_update'));
add_action('edit_user_profile_update', array($this, 'process_user_option_update'));
add_action('personal_options_update', array($this, 'update_user_profile'));
add_action('edit_user_profile_update', array($this, 'update_user_profile'));
add_filter('user_contactmethods', array($this, 'update_contactmethods'), 10, 1);
add_action('after_switch_theme', array($this, 'switch_theme'));
add_action('switch_theme', array($this, 'switch_theme'));
add_filter('set-screen-option', array($this, 'save_bulk_edit_options'), 10, 3);
add_filter('upgrader_post_install', array($this, 'remove_transients_on_update'), 10, 1);
add_action('activated_plugin', array('WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts'), 10, 1);
}
示例9: _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');
}
示例10: _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');
}
示例11: 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');
}