本文整理汇总了PHP中WPSEO_Options::get_all方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Options::get_all方法的具体用法?PHP WPSEO_Options::get_all怎么用?PHP WPSEO_Options::get_all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Options
的用法示例。
在下文中一共展示了WPSEO_Options::get_all方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Class constructor
*/
public function __construct()
{
$this->options = WPSEO_Options::get_all();
$this->shown_images = array();
// Instantiate as empty array
$this->twitter();
}
示例2: 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]);
}
}
}
示例3: __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);
}
示例4: get_options
/**
* Get Options
*
* @return array
*/
protected function get_options()
{
if (!isset(self::$options)) {
self::$options = WPSEO_Options::get_all();
}
return self::$options;
}
示例5: __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', '');
}
示例6: 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_all();
if (isset($options['post_types-' . $post->post_type . '-not_in_sitemap']) && $options['post_types-' . $post->post_type . '-not_in_sitemap'] === true) {
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');
}
}
}
示例7: __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();
}
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
*
* @api string - The current version of Yoast SEO
*/
do_action('wpseo_run_upgrade', $this->options['version']);
$this->finish_up();
}
示例8: __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);
}
示例9: 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;
}
示例10: 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()));
}
示例11: 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';
}
示例12: __construct
/**
* Generates the html for the snippet preview containing dynamically generated text components.
* Those components are included as properties which are set in the constructor.
*
* @param object $post
* @param string $title
* @param string $description
*/
public function __construct($post, $title, $description)
{
$this->options = WPSEO_Options::get_all();
$this->post = $post;
$this->title = esc_html($title);
$this->description = esc_html($description);
$this->set_date();
$this->set_url();
$this->set_content();
}
示例13: ubik_seo_yoast_twitter_init
function ubik_seo_yoast_twitter_init()
{
if (is_singular() && class_exists('WPSEO_Options')) {
$options = WPSEO_Options::get_all();
if ($options['twitter'] === true) {
add_action('wpseo_head', 'ubik_seo_yoast_twitter_images', 41);
add_filter('wpseo_twitter_image', '__return_empty_string');
// Completely hijack the output; necessary as Yoast's Twitter class privatizes the functions we need access to
}
}
}
示例14: get_posts
/**
* Getting the posts from the database by doing a WP_Query.
*
* @param integer $paged The page.
*
* @return string
*/
private function get_posts($paged)
{
$post_query = new WP_Query(array_merge($this->query_fields, array('posts_per_page' => $this->posts_per_page, 'paged' => $paged, 'posts' => array())));
if ($posts = $post_query->get_posts()) {
$this->options = WPSEO_Options::get_all();
$parsed_posts = $this->parse_posts($posts);
$response = array('posts' => $parsed_posts, 'total_posts' => count($parsed_posts), 'next_page' => $paged + 1);
return json_encode($response);
}
return '';
}
示例15: __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();
}