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


PHP WPSEO_Options类代码示例

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


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

示例1: status_transition

 /**
  * Hooked into transition_post_status. Will initiate search engine pings
  * if the post is being published, is a post type that a sitemap is built for
  * and is a post that is included in sitemaps.
  *
  * @param string   $new_status New post status.
  * @param string   $old_status Old post status.
  * @param \WP_Post $post       Post object.
  */
 function status_transition($new_status, $old_status, $post)
 {
     if ($new_status != 'publish') {
         return;
     }
     wp_cache_delete('lastpostmodified:gmt:' . $post->post_type, 'timeinfo');
     // #17455.
     $options = WPSEO_Options::get_options(array('wpseo_xml', 'wpseo_titles'));
     if (isset($options['post_types-' . $post->post_type . '-not_in_sitemap']) && $options['post_types-' . $post->post_type . '-not_in_sitemap'] === true || $post->post_type === 'nav_menu_item') {
         return;
     }
     if (WP_CACHE) {
         wp_schedule_single_event(time() + 300, 'wpseo_hit_sitemap_index');
     }
     /**
      * Filter: 'wpseo_allow_xml_sitemap_ping' - Check if pinging is not allowed (allowed by default)
      *
      * @api boolean $allow_ping The boolean that is set to true by default.
      */
     if (apply_filters('wpseo_allow_xml_sitemap_ping', true) === false) {
         return;
     }
     // Allow the pinging to happen slightly after the hit sitemap index so the sitemap is fully regenerated when the ping happens.
     $excluded_posts = explode(',', $options['excluded-posts']);
     if (!in_array($post->ID, $excluded_posts)) {
         if (defined('YOAST_SEO_PING_IMMEDIATELY') && YOAST_SEO_PING_IMMEDIATELY) {
             wpseo_ping_search_engines();
         } else {
             wp_schedule_single_event(time() + 300, 'wpseo_ping_search_engines');
         }
     }
 }
开发者ID:Didox,项目名称:beminfinito,代码行数:41,代码来源:class-sitemaps-admin.php

示例2: admin_header

    /**
     * Generates the header for admin pages
     *
     * @param bool   $form             Whether or not the form start tag should be included.
     * @param string $option           The short name of the option to use for the current page.
     * @param bool   $contains_files   Whether the form should allow for file uploads.
     * @param bool   $option_long_name Group name of the option.
     */
    public function admin_header($form = true, $option = 'wpseo', $contains_files = false, $option_long_name = false)
    {
        if (!$option_long_name) {
            $option_long_name = WPSEO_Options::get_group_name($option);
        }
        ?>
		<div class="wrap wpseo-admin-page page-<?php 
        echo $option;
        ?>
">
		<?php 
        /**
         * Display the updated/error messages
         * Only needed as our settings page is not under options, otherwise it will automatically be included
         * @see settings_errors()
         */
        require_once ABSPATH . 'wp-admin/options-head.php';
        ?>
		<h1 id="wpseo-title"><?php 
        echo esc_html(get_admin_page_title());
        ?>
</h1>
		<div class="wpseo_content_wrapper">
		<div class="wpseo_content_cell" id="wpseo_content_top">
		<?php 
        if ($form === true) {
            $enctype = $contains_files ? ' enctype="multipart/form-data"' : '';
            echo '<form action="' . esc_url(admin_url('options.php')) . '" method="post" id="wpseo-conf"' . $enctype . ' accept-charset="' . esc_attr(get_bloginfo('charset')) . '">';
            settings_fields($option_long_name);
        }
        $this->set_option($option);
    }
开发者ID:healthcommcore,项目名称:osnap,代码行数:40,代码来源:class-yoast-form.php

示例3: translate_meta_boxes

 /**
  * Translate text strings for use in the meta box
  *
  * IMPORTANT: if you want to add a new string (option) somewhere, make sure you add that array key to
  * the main meta box definition array in the class WPSEO_Meta() as well!!!!
  */
 public static function translate_meta_boxes()
 {
     /* translators: %s expands to the social network's name */
     $title_text = __('If you don\'t want to use the post title for sharing the post on %s but instead want another title there, write it here.', 'wordpress-seo');
     /* translators: %s expands to the social network's name */
     $description_text = __('If you don\'t want to use the meta description for sharing the post on %s but want another description there, write it here.', 'wordpress-seo');
     /* translators: %s expands to the social network's name */
     $image_text = __('If you want to override the image used on %s for this post, upload / choose an image or add the URL here.', 'wordpress-seo');
     /* translators: %1$s expands to the social network, %2$s to the recommended image size */
     $image_size_text = __('The recommended image size for %1$s is %2$spx.', 'wordpress-seo');
     $options = WPSEO_Options::get_all();
     $social_networks = array('opengraph' => __('Facebook', 'wordpress-seo'), 'twitter' => __('Twitter', 'wordpress-seo'), 'googleplus' => __('Google+', 'wordpress-seo'));
     // Source: https://blog.bufferapp.com/ideal-image-sizes-social-media-posts.
     $recommended_image_sizes = array('opengraph' => '1200 x 628', 'twitter' => '1024 x 512', 'google-plus' => '800 x 1200');
     foreach ($social_networks as $network => $label) {
         if (true === $options[$network]) {
             if ('googleplus' == $network) {
                 $network = 'google-plus';
                 // Yuck, I know.
             }
             self::$meta_fields['social'][$network . '-title']['title'] = sprintf(__('%s Title', 'wordpress-seo'), $label);
             self::$meta_fields['social'][$network . '-title']['description'] = sprintf($title_text, $label);
             self::$meta_fields['social'][$network . '-description']['title'] = sprintf(__('%s Description', 'wordpress-seo'), $label);
             self::$meta_fields['social'][$network . '-description']['description'] = sprintf($description_text, $label);
             self::$meta_fields['social'][$network . '-image']['title'] = sprintf(__('%s Image', 'wordpress-seo'), $label);
             self::$meta_fields['social'][$network . '-image']['description'] = sprintf($image_text, $label) . ' ' . sprintf($image_size_text, $label, $recommended_image_sizes[$network]);
         }
     }
 }
开发者ID:flasomm,项目名称:Montkailash,代码行数:35,代码来源:class-opengraph-admin.php

示例4: __construct

 /**
  * Class constructor
  */
 public function __construct()
 {
     $this->options = WPSEO_Options::get_all();
     $this->shown_images = array();
     // Instantiate as empty array
     $this->twitter();
 }
开发者ID:UPMediaDesign,项目名称:vidaestudiantilip,代码行数:10,代码来源:class-twitter.php

示例5: get_options

 /**
  * Get Options
  *
  * @return array
  */
 protected function get_options()
 {
     if (!isset(self::$options)) {
         self::$options = WPSEO_Options::get_all();
     }
     return self::$options;
 }
开发者ID:rtroncoso,项目名称:MamaSabeBien,代码行数:12,代码来源:class-taxonomy-sitemap-provider.php

示例6: __construct

 /**
  * Class constructor.
  */
 public function __construct()
 {
     $this->options = WPSEO_Options::get_all();
     global $fb_ver;
     if (isset($fb_ver) || class_exists('Facebook_Loader')) {
         add_filter('fb_meta_tags', array($this, 'facebook_filter'), 10, 1);
     } else {
         add_filter('language_attributes', array($this, 'add_opengraph_namespace'));
         add_action('wpseo_opengraph', array($this, 'locale'), 1);
         add_action('wpseo_opengraph', array($this, 'type'), 5);
         add_action('wpseo_opengraph', array($this, 'og_title'), 10);
         add_action('wpseo_opengraph', array($this, 'site_owner'), 20);
         add_action('wpseo_opengraph', array($this, 'description'), 11);
         add_action('wpseo_opengraph', array($this, 'url'), 12);
         add_action('wpseo_opengraph', array($this, 'site_name'), 13);
         add_action('wpseo_opengraph', array($this, 'website_facebook'), 14);
         if (is_singular() && !is_front_page()) {
             add_action('wpseo_opengraph', array($this, 'article_author_facebook'), 15);
             add_action('wpseo_opengraph', array($this, 'tags'), 16);
             add_action('wpseo_opengraph', array($this, 'category'), 17);
             add_action('wpseo_opengraph', array($this, 'publish_date'), 19);
         }
         add_action('wpseo_opengraph', array($this, 'image'), 30);
     }
     remove_action('wp_head', 'jetpack_og_tags');
     add_action('wpseo_head', array($this, 'opengraph'), 30);
 }
开发者ID:phuluang,项目名称:rosewellmusic,代码行数:30,代码来源:class-opengraph.php

示例7: __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', '');
 }
开发者ID:jianqiangsong,项目名称:WordPress,代码行数:38,代码来源:class-admin.php

示例8: __construct

 /**
  * Class constructor
  */
 public function __construct()
 {
     $this->options = WPSEO_Options::get_option('wpseo_xml');
     $GLOBALS['wpseo_admin'] = new WPSEO_Admin();
     $this->pagenow = $GLOBALS['pagenow'];
     $this->asset_manager = new WPSEO_Admin_Asset_Manager();
     add_action('admin_enqueue_scripts', array($this, 'enqueue_dismissible'));
     add_action('admin_init', array($this, 'tagline_notice'), 15);
     add_action('admin_init', array($this, 'blog_public_notice'), 15);
     add_action('admin_init', array($this, 'permalink_notice'), 15);
     add_action('admin_init', array($this, 'page_comments_notice'), 15);
     add_action('admin_init', array($this, 'ga_compatibility_notice'), 15);
     add_action('admin_init', array($this, 'yoast_plugin_compatibility_notification'), 15);
     add_action('admin_init', array($this, 'recalculate_notice'), 15);
     add_action('admin_init', array($this, 'ignore_tour'));
     add_action('admin_init', array($this, 'load_tour'));
     add_action('admin_init', array($this->asset_manager, 'register_assets'));
     add_action('admin_init', array($this, 'show_hook_deprecation_warnings'));
     add_action('admin_init', array('WPSEO_Plugin_Conflict', 'hook_check_for_plugin_conflicts'));
     $this->load_meta_boxes();
     $this->load_taxonomy_class();
     $this->load_admin_page_class();
     $this->load_admin_user_class();
     $this->load_xml_sitemaps_admin();
 }
开发者ID:rtroncoso,项目名称:MamaSabeBien,代码行数:28,代码来源:class-admin-init.php

示例9: __construct

 /**
  * Class constructor
  */
 public function __construct()
 {
     $this->options = WPSEO_Options::get_all();
     add_action('wpseo_head', array($this, 'json_ld'), 90);
     add_action('wpseo_json_ld', array($this, 'website'), 10);
     add_action('wpseo_json_ld', array($this, 'organization_or_person'), 20);
 }
开发者ID:Telemedellin,项目名称:feriadelasfloresmedellin,代码行数:10,代码来源:class-json-ld.php

示例10: is_content_analysis_active

 /**
  * Determines if the content analysis is active or not.
  *
  * @return bool Whether or not the content analysis is active.
  */
 private function is_content_analysis_active()
 {
     $options = WPSEO_Options::get_option('wpseo_titles');
     if (!$options['content-analysis-active']) {
         return 0;
     }
     return !get_the_author_meta('wpseo_content_analysis_disable', get_current_user_id()) ? 1 : 0;
 }
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:13,代码来源:class-metabox-formatter.php

示例11: query_vars

 /**
  * Update the query vars with the redirect var when stripcategorybase is active
  *
  * @param array $query_vars Main query vars to filter.
  *
  * @return array
  */
 function query_vars($query_vars)
 {
     $options = WPSEO_Options::get_all();
     if ($options['stripcategorybase'] === true) {
         $query_vars[] = 'wpseo_category_redirect';
     }
     return $query_vars;
 }
开发者ID:healthcommcore,项目名称:osnap,代码行数:15,代码来源:class-rewrite.php

示例12: test_query_vars

 /**
  * @covers WPSEO_Rewrite::query_vars
  */
 public function test_query_vars()
 {
     $this->assertEquals(array(), self::$class_instance->query_vars(array()));
     $options = WPSEO_Options::get_all();
     $options['stripcategorybase'] = true;
     update_option(WPSEO_Option_Permalinks::get_instance()->option_name, $options);
     $this->assertEquals(array('wpseo_category_redirect'), self::$class_instance->query_vars(array()));
 }
开发者ID:centre-for-effective-altruism,项目名称:wordpress-seo,代码行数:11,代码来源:test-class-rewrite.php

示例13: base_url_for_js

 /**
  * Returns a base URL for use in the JS, takes permalink structure into account
  *
  * @return string
  */
 private function base_url_for_js()
 {
     $base_url = home_url('/', null);
     $options = WPSEO_Options::get_option('wpseo_permalinks');
     if (!$options['stripcategorybase']) {
         $base_url = trailingslashit($base_url . $this->taxonomy->rewrite['slug']);
     }
     return $base_url;
 }
开发者ID:Garth619,项目名称:Femi9,代码行数:14,代码来源:class-term-metabox-formatter.php

示例14: __construct

 /**
  * Setting the class properties
  *
  * @param stdClass $term    The current term.
  * @param array    $options The options.
  */
 public function __construct($term, array $options = null)
 {
     $this->term = $term;
     if ($options !== null) {
         $this->options = $options;
     } else {
         $this->options = WPSEO_Options::get_options(array('wpseo_titles', 'wpseo_internallinks', 'wpseo_social'));
     }
 }
开发者ID:domalexxx,项目名称:nashvancouver,代码行数:15,代码来源:class-taxonomy-fields.php

示例15: user_profile

 /**
  * Add the inputs needed for SEO values to the User Profile page
  *
  * @param    object $user
  */
 public function user_profile($user)
 {
     if (!current_user_can('edit_users')) {
         return;
     }
     $options = WPSEO_Options::get_all();
     wp_nonce_field('wpseo_user_profile_update', 'wpseo_nonce');
     require_once 'views/user-profile.php';
 }
开发者ID:HealthStaffTraining,项目名称:healthstafftraining,代码行数:14,代码来源:class-admin-user-profile.php


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