本文整理汇总了PHP中WPSEO_Options::get_option方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Options::get_option方法的具体用法?PHP WPSEO_Options::get_option怎么用?PHP WPSEO_Options::get_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Options
的用法示例。
在下文中一共展示了WPSEO_Options::get_option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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();
}
示例2: __construct
/**
* Class constructor.
*/
public function __construct()
{
$this->options = WPSEO_Options::get_option('wpseo_social');
if (isset($GLOBALS['fb_ver']) || class_exists('Facebook_Loader', false)) {
add_filter('fb_meta_tags', array($this, 'facebook_filter'), 10, 1);
} else {
add_filter('language_attributes', array($this, 'add_opengraph_namespace'), 15);
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);
}
add_filter('jetpack_enable_open_graph', '__return_false');
add_action('wpseo_head', array($this, 'opengraph'), 30);
}
示例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_option('wpseo_social');
$social_networks = array('opengraph' => __('Facebook', 'wordpress-seo'), 'twitter' => __('Twitter', 'wordpress-seo'));
// Source: https://blog.bufferapp.com/ideal-image-sizes-social-media-posts.
$recommended_image_sizes = array('opengraph' => '1200 × 630', 'twitter' => '1024 × 512');
foreach ($social_networks as $network => $label) {
if (true === $options[$network]) {
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]);
}
}
}
示例4: 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_option('wpseo_permalinks');
if ($options['stripcategorybase'] === true) {
$query_vars[] = 'wpseo_category_redirect';
}
return $query_vars;
}
示例5: 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;
}
示例6: 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;
}
示例7: set_data
/**
* Set new data
*
* @param string $visible Visible (true) or hidden (false).
*
* @return bool
*/
public function set_data($visible)
{
$post_type = $this->get_post_type();
$option = WPSEO_Options::get_option('wpseo_xml');
$option['post_types-' . $post_type . '-not_in_sitemap'] = $visible === 'false';
update_option('wpseo_xml', $option);
// Check if everything got saved properly.
$saved_option = WPSEO_Options::get_option('wpseo_xml');
return $visible === 'false' && $saved_option['post_types-' . $post_type . '-not_in_sitemap'] === true;
}
示例8: set_data
/**
* Set the data in the options.
*
* @param {string} $data The data to set for the field.
*
* @return bool Returns true or false for successful storing the data.
*/
public function set_data($data)
{
$value = $data === 'yes';
$option = WPSEO_Options::get_option('wpseo');
$option['has_multiple_authors'] = $value;
update_option('wpseo', $option);
// Check if everything got saved properly.
$saved_option = WPSEO_Options::get_option('wpseo');
return $saved_option['has_multiple_authors'] === $option['has_multiple_authors'];
}
示例9: set_data
/**
* Set the data in the options.
*
* @param {string} $data The data to set for the field.
*
* @return bool Returns true or false for successful storing the data.
*/
public function set_data($data)
{
$value = $data;
$option = WPSEO_Options::get_option('wpseo');
$option['website_name'] = $value;
update_option('wpseo', $option);
// Check if everything got saved properly.
$saved_option = WPSEO_Options::get_option('wpseo');
return $saved_option['website_name'] === $option['website_name'];
}
示例10: set_data
/**
* Set new data.
*
* @param string $environment_type The site's environment type.
*
* @return bool Returns whether the value is successfully set.
*/
public function set_data($environment_type)
{
$option = WPSEO_Options::get_option('wpseo');
if ($option['environment_type'] !== $environment_type) {
$option['environment_type'] = $environment_type;
update_option('wpseo', $option);
if (!$this->set_indexation($environment_type)) {
return false;
}
}
$saved_environment_option = WPSEO_Options::get_option('wpseo');
return $saved_environment_option['environment_type'] === $option['environment_type'];
}
示例11: get_data
/**
* Get the data from the stored options.
*
* @return null|string
*/
public function get_data()
{
$option = WPSEO_Options::get_option('wpseo');
if (isset($option['has_multiple_authors'])) {
$value = $option['has_multiple_authors'];
}
if (!isset($value) || is_null($value)) {
// If there are more than one users with level > 1 default to multiple authors.
$users = get_users(array('fields' => 'IDs', 'who' => 'authors'));
$value = count($users) > 1;
}
return $value ? 'yes' : 'no';
}
示例12: __construct
/**
* Class constructor
*/
public function __construct()
{
$this->options = WPSEO_Options::get_option('wpseo_xml');
$GLOBALS['wpseo_admin'] = new WPSEO_Admin();
$this->pagenow = $GLOBALS['pagenow'];
add_action('admin_enqueue_scripts', array($this, 'enqueue_dismissible'));
add_action('admin_init', array($this, 'after_update_notice'), 15);
add_action('admin_init', array($this, 'tagline_notice'), 15);
add_action('admin_init', array($this, 'ga_compatibility_notice'), 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, 'show_hook_deprecation_warnings'));
$this->load_meta_boxes();
$this->load_taxonomy_class();
$this->load_admin_page_class();
$this->load_admin_user_class();
$this->load_xml_sitemaps_admin();
}
示例13: hook_check_for_plugin_conflicts
/**
* After activating any plugin, this method will be executed by a hook.
*
* If the activated plugin is conflicting with ours a notice will be shown.
*
* @param string|bool $plugin Optional plugin basename to check.
*/
public static function hook_check_for_plugin_conflicts($plugin = false)
{
// The instance of itself.
$instance = self::get_instance();
// Only add plugin as active plugin if $plugin isn't false.
if ($plugin && is_string($plugin)) {
// Because it's just activated.
$instance->add_active_plugin($instance->find_plugin_category($plugin), $plugin);
}
$plugin_sections = array();
// Only check for open graph problems when they are enabled.
$social_options = WPSEO_Options::get_option('wpseo_social');
if ($social_options['opengraph']) {
/* translators: %1$s expands to Yoast SEO, %2%s: 'Facebook' plugin name of possibly conflicting plugin with regard to creating OpenGraph output*/
$plugin_sections['open_graph'] = __('Both %1$s and %2$s create OpenGraph output, which might make Facebook, Twitter, LinkedIn and other social networks use the wrong texts and images when your pages are being shared.', 'wordpress-seo') . '<br/><br/>' . '<a target="_blank" class="button" href="' . admin_url('admin.php?page=wpseo_social#top#facebook') . '">' . sprintf(__('Configure %1$s\'s OpenGraph settings', 'wordpress-seo'), 'Yoast SEO') . '</a>';
}
// Only check for XML conflicts if sitemaps are enabled.
$xml_sitemap_options = WPSEO_Options::get_option('wpseo_xml');
if ($xml_sitemap_options['enablexmlsitemap']) {
/* translators: %1$s expands to Yoast SEO, %2$s: 'Google XML Sitemaps' plugin name of possibly conflicting plugin with regard to the creation of sitemaps*/
$plugin_sections['xml_sitemaps'] = __('Both %1$s and %2$s can create XML sitemaps. Having two XML sitemaps is not beneficial for search engines, yet might slow down your site.', 'wordpress-seo') . '<br/><br/>' . '<a target="_blank" class="button" href="' . admin_url('admin.php?page=wpseo_xml') . '">' . sprintf(__('Configure %1$s\'s XML Sitemap settings', 'wordpress-seo'), 'Yoast SEO') . '</a>';
}
$instance->check_plugin_conflicts($plugin_sections);
}
示例14: is_globally_enabled
/**
* Whether or not this analysis is enabled globally.
*
* @return bool Whether or not this analysis is enabled globally.
*/
public function is_globally_enabled()
{
$options = WPSEO_Options::get_option('wpseo_titles');
return (bool) $options['keyword-analysis-active'];
}
示例15: finish_up
/**
* Runs the needed cleanup after an update, setting the DB version to latest version, flushing caches etc.
*/
private function finish_up()
{
$this->options = WPSEO_Options::get_option('wpseo');
// Re-get to make sure we have the latest version.
update_option('wpseo', $this->options);
// This also ensures the DB version is equal to WPSEO_VERSION.
add_action('shutdown', 'flush_rewrite_rules');
// Just flush rewrites, always, to at least make them work after an upgrade.
WPSEO_Utils::clear_sitemap_cache();
// Flush the sitemap cache.
WPSEO_Options::ensure_options_exist();
// Make sure all our options always exist - issue #1245.
}