本文整理汇总了PHP中WPSEO_Utils::register_cache_clear_option方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Utils::register_cache_clear_option方法的具体用法?PHP WPSEO_Utils::register_cache_clear_option怎么用?PHP WPSEO_Utils::register_cache_clear_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Utils
的用法示例。
在下文中一共展示了WPSEO_Utils::register_cache_clear_option方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
/**
* Constructor for the WPSEO_Local_Core class.
*
* @since 1.0
*/
function __construct()
{
$this->options = get_option("wpseo_local");
$this->days = array('monday' => __('Monday', 'yoast-local-seo'), 'tuesday' => __('Tuesday', 'yoast-local-seo'), 'wednesday' => __('Wednesday', 'yoast-local-seo'), 'thursday' => __('Thursday', 'yoast-local-seo'), 'friday' => __('Friday', 'yoast-local-seo'), 'saturday' => __('Saturday', 'yoast-local-seo'), 'sunday' => __('Sunday', 'yoast-local-seo'));
if (wpseo_has_multiple_locations()) {
add_action('init', array($this, 'create_custom_post_type'), 10, 1);
add_action('init', array($this, 'create_taxonomies'), 10, 1);
add_action('init', array($this, 'exclude_taxonomy'), 10, 1);
}
if (is_admin()) {
$this->license_manager = $this->get_license_manager();
$this->license_manager->setup_hooks();
add_action('wpseo_licenses_forms', array($this->license_manager, 'show_license_form'));
add_action('update_option_wpseo_local', array($this, 'save_permalinks_on_option_save'), 10, 2);
// Setting action for removing the transient on update options
if (method_exists('WPSEO_Utils', 'register_cache_clear_option')) {
WPSEO_Utils::register_cache_clear_option('wpseo_local', 'kml');
}
} else {
// XML Sitemap Index addition
add_action('template_redirect', array($this, 'redirect_old_sitemap'));
add_action('init', array($this, 'init'), 11);
add_filter('wpseo_sitemap_index', array($this, 'add_to_index'));
}
// Add support for Jetpack's Omnisearch
add_action('init', array($this, 'support_jetpack_omnisearch'));
add_action('save_post', array($this, 'invalidate_sitemap'));
// Run update if needed
add_action('plugins_loaded', array(&$this, 'do_upgrade'), 14);
// Extend the search with metafields
add_action('pre_get_posts', array(&$this, 'enhance_search'));
add_filter('the_excerpt', array(&$this, 'enhance_location_search_results'));
}
示例3: __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_Utils::register_cache_clear_option('wpseo', '');
}
示例4: init_admin
/**
* Initialize the admin page
*/
private function init_admin()
{
// Edit Post JS
global $pagenow;
if ('post.php' == $pagenow || 'post-new.php' == $pagenow) {
add_action('admin_head', array($this, 'edit_post_css'));
add_action('admin_enqueue_scripts', array($this, 'enqueue_edit_post'));
}
// Upgrade Manager
$upgrade_manager = new WPSEO_News_Upgrade_Manager();
$upgrade_manager->check_update();
// License Manager
$license_manager = new Yoast_Plugin_License_Manager(new WPSEO_News_Product());
$license_manager->setup_hooks();
add_action('wpseo_licenses_forms', array($license_manager, 'show_license_form'));
// Setting action for removing the transient on update options
if (method_exists('WPSEO_Utils', 'register_cache_clear_option')) {
WPSEO_Utils::register_cache_clear_option('wpseo_news', $this->get_sitemap_name(false));
}
}
示例5: __construct
/**
* Constructor for the WPSEO_Video_Sitemap class.
*
* @todo Deal with upgrade from license constant WPSEO_VIDEO_LICENSE
* @since 0.1
*/
public function __construct()
{
// Initialize the options
$this->option_instance = WPSEO_Option_Video::get_instance();
$options = get_option('wpseo_video');
// run upgrade routine
$this->upgrade();
add_filter('wpseo_tax_meta_special_term_id_validation__video', array($this, 'validate_video_tax_meta'));
if (!isset($GLOBALS['content_width']) && $options['content_width'] > 0) {
$GLOBALS['content_width'] = $options['content_width'];
}
add_action('setup_theme', array($this, 'init'));
add_action('admin_init', array($this, 'init'));
add_action('init', array($this, 'register_sitemap'), 20);
// Register sitemap after cpts have been added
add_action('admin_bar_menu', array($this, 'add_admin_bar_item'), 97);
add_filter('oembed_providers', array($this, 'sync_oembed_providers'));
if (is_admin()) {
add_action('admin_menu', array($this, 'register_settings_page'));
add_filter('wpseo_admin_pages', array($this, 'style_admin'));
add_action('save_post', array($this, 'update_video_post_meta'));
if (in_array($GLOBALS['pagenow'], array('edit.php', 'post.php', 'post-new.php')) || apply_filters('wpseo_always_register_metaboxes_on_admin', false)) {
$this->metabox_tab = new WPSEO_Video_Metabox();
}
// Licensing part
$yoast_product = new Yoast_Product_WPSEO_Video();
$license_manager = new Yoast_Plugin_License_Manager($yoast_product);
// Setup constant name
$license_manager->set_license_constant_name('WPSEO_VIDEO_LICENSE');
// Setup hooks
$license_manager->setup_hooks();
// Add form
add_action('wpseo_licenses_forms', array($license_manager, 'show_license_form'));
add_action('admin_enqueue_scripts', array($this, 'admin_video_enqueue_scripts'));
add_action('admin_init', array($this, 'admin_video_enqueue_styles'));
add_action('wp_ajax_index_posts', array($this, 'index_posts_callback'));
add_action('save_post', array($this, 'invalidate_sitemap'));
// Setting action for removing the transient on update options
if (method_exists('WPSEO_Utils', 'register_cache_clear_option')) {
WPSEO_Utils::register_cache_clear_option('wpseo_video', $this->video_sitemap_basename());
}
// Maybe show 'Recommend re-index' admin notice
if (get_transient('video_seo_recommend_reindex') === '1') {
add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts_ignore'));
add_action('all_admin_notices', array($this, 'recommend_force_index'));
add_action('wp_ajax_videoseo_set_ignore', array($this, 'set_ignore'));
}
} else {
// OpenGraph
add_action('wpseo_opengraph', array($this, 'opengraph'));
add_filter('wpseo_opengraph_type', array($this, 'opengraph_type'), 10, 1);
add_filter('wpseo_opengraph_image', array($this, 'opengraph_image'), 5, 1);
// XML Sitemap Index addition
add_filter('wpseo_sitemap_index', array($this, 'add_to_index'));
// Setting stylesheet for cached sitemap
add_action('wpseo_sitemap_stylesheet_cache_video', array($this, 'set_stylesheet_cache'));
// Content filter for non-detected videos
add_filter('the_content', array($this, 'content_filter'), 5, 1);
if ($options['fitvids'] === true) {
// Fitvids scripting
add_action('wp_head', array($this, 'fitvids'));
}
if ($options['disable_rss'] !== true) {
// MRSS
add_action('rss2_ns', array($this, 'mrss_namespace'));
add_action('rss2_item', array($this, 'mrss_item'), 10, 1);
add_filter('mrss_media', array($this, 'mrss_add_video'));
}
}
// @todo Maybe enable ?
// Run on low prio to allow other filters to add their extensions first
//add_filter( 'wp_video_extensions', array( $this, 'filter_video_extensions' ), 99 );
}
示例6: __construct
/**
* Class constructor
*/
function __construct()
{
add_action('transition_post_status', array($this, 'status_transition'), 10, 3);
add_action('admin_init', array($this, 'delete_sitemaps'));
WPSEO_Utils::register_cache_clear_option('wpseo_xml', '');
}