本文整理汇总了PHP中WPSEO_Utils类的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Utils类的具体用法?PHP WPSEO_Utils怎么用?PHP WPSEO_Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WPSEO_Utils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Checks if Yoast SEO is installed for the first time.
*/
public function __construct()
{
$is_first_install = $this->is_first_install();
if ($is_first_install && WPSEO_Utils::is_api_available()) {
add_action('wpseo_activate', array($this, 'set_first_install_options'));
}
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:10,代码来源:class-wpseo-installation.php
示例2: get_home_url
/**
* Get Home URL
*
* This has been moved from the constructor because wp_rewrite is not available on plugins_loaded in multisite.
* It will now be requested on need and not on initialization.
*
* @return string
*/
protected function get_home_url()
{
if (!isset($this->home_url)) {
$this->home_url = WPSEO_Utils::home_url();
}
return $this->home_url;
}
开发者ID:SayenkoDesign,项目名称:ividf,代码行数:15,代码来源:class-post-type-sitemap-provider.php
示例3: get_home_url
/**
* Get Home URL
*
* This has been moved from the constructor because wp_rewrite is not available on plugins_loaded in multisite.
* It will now be requested on need and not on initialization.
*
* @return string
*/
protected function get_home_url()
{
if (!isset(self::$home_url)) {
self::$home_url = WPSEO_Utils::home_url();
}
return self::$home_url;
}
开发者ID:rtroncoso,项目名称:MamaSabeBien,代码行数:15,代码来源:class-post-type-sitemap-provider.php
示例4: add_admin
/**
* Adding a new admin
*
* @param string $admin_name Name string.
* @param string $admin_id ID string.
*
* @return string
*/
public function add_admin($admin_name, $admin_id)
{
$success = 0;
// If one of the fields is empty.
if (empty($admin_name) || empty($admin_id)) {
$response_body = $this->get_response_body('not_present');
} else {
$admin_id = $this->parse_admin_id($admin_id);
if (!isset($this->options['fb_admins'][$admin_id])) {
$name = sanitize_text_field(urldecode($admin_name));
$admin_id = sanitize_text_field($admin_id);
if (preg_match('/[0-9]+?/', $admin_id) && preg_match('/[\\w\\s]+?/', $name)) {
$this->options['fb_admins'][$admin_id]['name'] = $name;
$this->options['fb_admins'][$admin_id]['link'] = urldecode('http://www.facebook.com/' . $admin_id);
$this->save_options();
$success = 1;
$response_body = $this->form->get_admin_link($admin_id, $this->options['fb_admins'][$admin_id]);
} else {
$response_body = $this->get_response_body('invalid_format');
}
} else {
$response_body = $this->get_response_body('already_exists');
}
}
return WPSEO_Utils::json_encode(array('success' => $success, 'html' => $response_body));
}
开发者ID:healthcommcore,项目名称:osnap,代码行数:34,代码来源:class-social-facebook.php
示例5: __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'));
}
开发者ID:scottnkerr,项目名称:eeco,代码行数:38,代码来源:class-core.php
示例6: filter_input_post
/**
* Filter POST variables.
*
* @param string $var_name
*
* @return mixed
*/
private function filter_input_post($var_name)
{
$val = filter_input(INPUT_POST, $var_name);
if ($val) {
return WPSEO_Utils::sanitize_text_field($val);
}
return '';
}
开发者ID:rianrietveld,项目名称:wordpress-seo,代码行数:15,代码来源:class-admin-user-profile.php
示例7: print_scripts
/**
* Prints the pointer script
*
* @param string $selector The CSS selector the pointer is attached to.
* @param array $options The options for the pointer.
*/
public function print_scripts($selector, $options)
{
// Button1 is the close button, which always exists.
$button_array_defaults = array('button2' => array('text' => false, 'function' => ''), 'button3' => array('text' => false, 'function' => ''));
$this->button_array = wp_parse_args($this->button_array, $button_array_defaults);
?>
<script type="text/javascript">
//<![CDATA[
(function ($) {
// Don't show the tour on screens with an effective width smaller than 1024px or an effective height smaller than 768px.
if (jQuery(window).width() < 1024 || jQuery(window).availWidth < 1024) {
return;
}
var wpseo_pointer_options = <?php
echo WPSEO_Utils::json_encode($options);
?>
, setup;
wpseo_pointer_options = $.extend(wpseo_pointer_options, {
buttons: function (event, t) {
var button = jQuery('<a href="<?php
echo $this->get_ignore_url();
?>
" id="pointer-close" style="margin:0 5px;" class="button-secondary">' + '<?php
_e('Close', 'wordpress-seo');
?>
' + '</a>');
button.bind('click.pointer', function () {
t.element.pointer('close');
});
return button;
},
close: function () {
}
});
setup = function () {
$('<?php
echo $selector;
?>
').pointer(wpseo_pointer_options).pointer('open');
var lastOpenedPointer = jQuery( '.wp-pointer').slice( -1 );
<?php
$this->button2();
$this->button3();
?>
};
if (wpseo_pointer_options.position && wpseo_pointer_options.position.defer_loading)
$(window).bind('load.wp-pointers', setup);
else
$(document).ready(setup);
})(jQuery);
//]]>
</script>
<?php
}
开发者ID:designomx,项目名称:DMXFrmwrk,代码行数:64,代码来源:class-pointers.php
示例8: init
/**
* Make sure the needed scripts are loaded for admin pages
*/
function init()
{
if (filter_input(INPUT_GET, 'wpseo_reset_defaults') && wp_verify_nonce(filter_input(INPUT_GET, 'nonce'), 'wpseo_reset_defaults') && current_user_can('manage_options')) {
WPSEO_Options::reset();
wp_redirect(admin_url('admin.php?page=wpseo_dashboard'));
}
if (WPSEO_Utils::grant_access()) {
add_action('admin_enqueue_scripts', array($this, 'config_page_scripts'));
add_action('admin_enqueue_scripts', array($this, 'config_page_styles'));
}
}
开发者ID:tfrommen,项目名称:wordpress-seo,代码行数:14,代码来源:class-config.php
示例9: get_post
/**
* Retrieves post data given a post ID or the global
*
* @return array|null|WP_Post Returns a post if found, otherwise returns an empty array.
*/
private function get_post()
{
if ($post = filter_input(INPUT_GET, 'post')) {
$post_id = (int) WPSEO_Utils::validate_int($post);
return get_post($post_id);
}
if (isset($GLOBALS['post'])) {
return $GLOBALS['post'];
}
return array();
}
开发者ID:mazykin46,项目名称:portfolio,代码行数:16,代码来源:class-custom-fields-plugin.php
示例10: recalculate_scores
/**
* Start recalculation
*/
public function recalculate_scores()
{
check_ajax_referer('wpseo_recalculate', 'nonce');
$fetch_object = $this->get_fetch_object();
if (!empty($fetch_object)) {
$paged = filter_input(INPUT_POST, 'paged', FILTER_VALIDATE_INT);
$response = $fetch_object->get_items_to_recalculate($paged);
if (!empty($response)) {
wp_die(WPSEO_Utils::json_encode($response));
}
}
wp_die('');
}
开发者ID:Didox,项目名称:beminfinito,代码行数:16,代码来源:class-recalculate-scores-ajax.php
示例11: get_datetime_with_timezone
/**
* Get the datetime object, in site's time zone, if the datetime string was valid
*
* @todo This is messed up, output type changed, doc wrong. Revert, add new method for formatted. R.
*
* @param string $datetime_string The datetime string in UTC time zone, that needs to be converted to a DateTime object.
* @param string $format Date format to use.
*
* @return DateTime|null in site's time zone
*/
public function get_datetime_with_timezone($datetime_string, $format = 'c')
{
static $utc_timezone, $local_timezone;
if (!isset($utc_timezone)) {
$utc_timezone = new DateTimeZone('UTC');
$local_timezone = new DateTimeZone($this->get_timezone_string());
}
if (!empty($datetime_string) && WPSEO_Utils::is_valid_datetime($datetime_string)) {
$datetime = new DateTime($datetime_string, $utc_timezone);
$datetime->setTimezone($local_timezone);
return $datetime->format($format);
}
return null;
}
开发者ID:Didox,项目名称:beminfinito,代码行数:24,代码来源:class-sitemap-timezone.php
示例12: addPostMeta
/**
* Post Meta
*/
public function addPostMeta($post)
{
// Hidden in Nested Pages?
$np_status = get_post_meta($post->ID, 'nested_pages_status', true);
$this->post_data->np_status = $np_status == 'hide' ? 'hide' : 'show';
// Yoast Score
if (function_exists('wpseo_auto_load')) {
$yoast_score = get_post_meta($post->ID, '_yoast_wpseo_meta-robots-noindex', true);
if (!$yoast_score) {
$yoast_score = get_post_meta($post->ID, '_yoast_wpseo_linkdex', true);
$this->post_data->score = \WPSEO_Utils::translate_score($yoast_score);
} else {
$this->post_data->score = 'noindex';
}
}
}
开发者ID:scrapbird,项目名称:wp-nested-pages,代码行数:19,代码来源:PostDataFactory.php
示例13: init
/**
* Run init logic.
*/
public function init()
{
// Setting the screen option.
if (filter_input(INPUT_GET, 'page') === 'wpseo_search_console') {
if (filter_input(INPUT_GET, 'tab') !== 'settings' && WPSEO_GSC_Settings::get_profile() === '') {
wp_redirect(add_query_arg('tab', 'settings'));
exit;
}
$this->set_hooks();
$this->set_dependencies();
$this->request_handler();
} elseif (WPSEO_Utils::is_yoast_seo_page() && current_user_can('manage_options') && WPSEO_GSC_Settings::get_profile() === '' && get_user_option('wpseo_dismissed_gsc_notice', get_current_user_id()) !== '1') {
add_action('admin_init', array($this, 'register_gsc_notification'));
}
add_action('admin_init', array($this, 'register_settings'));
}
开发者ID:healthcommcore,项目名称:osnap,代码行数:19,代码来源:class-gsc.php
示例14: config_page_scripts
/**
* Loads the required scripts for the config page.
*/
function config_page_scripts()
{
$this->asset_manager->enqueue_script('admin-script');
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoAdminL10n', $this->localize_admin_script());
wp_enqueue_script('dashboard');
wp_enqueue_script('thickbox');
$page = filter_input(INPUT_GET, 'page');
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-script', 'wpseoSelect2Locale', WPSEO_Utils::get_language(get_locale()));
if (in_array($page, array('wpseo_social', WPSEO_Admin::PAGE_IDENTIFIER))) {
wp_enqueue_media();
$this->asset_manager->enqueue_script('admin-media');
wp_localize_script(WPSEO_Admin_Asset_Manager::PREFIX . 'admin-media', 'wpseoMediaL10n', $this->localize_media_script());
}
if ('wpseo_tools' === $page) {
$this->enqueue_tools_scripts();
}
}
开发者ID:ActiveWebsite,项目名称:BoojPressPlugins,代码行数:20,代码来源:class-config.php
示例15: intro_tour
/**
* Load the introduction tour
*/
function intro_tour()
{
global $pagenow, $current_user;
// @FIXME: Links to tabs only work with target="_blank" and thus open in a new window
$adminpages = array('wpseo_dashboard' => array('content' => '<h3>' . __('Dashboard', 'wordpress-seo') . '</h3><p>' . __('This is the WordPress SEO Dashboard, here you can restart this tour or revert the WP SEO settings to default.', 'wordpress-seo') . '</p>' . '<p><strong>' . __('More WordPress SEO', 'wordpress-seo') . '</strong><br/>' . sprintf(__('There’s more to learn about WordPress & SEO than just using this plugin. A great start is our article %1$sthe definitive guide to WordPress SEO%2$s.', 'wordpress-seo'), '<a target="_blank" href="' . esc_url('https://yoast.com/articles/wordpress-seo/#utm_source=wpseo_dashboard&utm_medium=wpseo_tour&utm_campaign=tour') . '">', '</a>') . '</p>' . '<p><strong>' . __('Tracking', 'wordpress-seo') . '</strong><br/>' . __('To provide you with the best experience possible, we need your help. Please enable tracking to help us gather anonymous usage data.', 'wordpress-seo') . '</p>' . '<p><strong>' . __('Webmaster Tools', 'wordpress-seo') . '</strong><br/>' . __('You can also add the verification codes for the different Webmaster Tools programs here, we highly encourage you to check out both Google and Bing’s Webmaster Tools.', 'wordpress-seo') . '</p>' . '<p><strong>' . __('WordPress SEO Tour', 'wordpress-seo') . '</strong><br/>' . __('This tour will show you around in the plugin, to give you a general overview of the plugin.', 'wordpress-seo') . '</p>' . '<p><strong>' . __('Newsletter', 'wordpress-seo') . '</strong><br/>' . __('If you would like us to keep you up-to-date regarding WordPress SEO and other plugins by Yoast, subscribe to our newsletter:', 'wordpress-seo') . '</p>' . '<form action="http://yoast.us1.list-manage1.com/subscribe/post?u=ffa93edfe21752c921f860358&id=972f1c9122" method="post" id="newsletter-form" accept-charset="' . esc_attr(get_bloginfo('charset')) . '">' . '<p>' . '<label for="newsletter-email">' . __('Email', 'wordpress-seo') . ':</label> <input style="margin: 5px; color:#666" name="EMAIL" value="' . esc_attr($current_user->user_email) . '" id="newsletter-email" placeholder="' . __('Email', 'wordpress-seo') . '"/><br/>' . '<input type="hidden" name="group" value="2"/>' . '<button type="submit" class="button-primary">' . __('Subscribe', 'wordpress-seo') . '</button>' . '</p></form>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . admin_url('admin.php?page=wpseo_titles') . '";', 'position' => array('edge' => 'top', 'align' => 'center')), 'wpseo_titles' => array('content' => '<h3>' . __('Title & Metas settings', 'wordpress-seo') . '</h3>' . '<p>' . __('This is where you set the titles and meta-information for all your post types, taxonomies, archives, special pages and for your homepage. The page is divided into different tabs. Make sure you check ’em all out!', 'wordpress-seo') . '</p>' . '<p><strong>' . __('Sitewide settings', 'wordpress-seo') . '</strong><br/>' . __('The first tab will show you site-wide settings. You can also set some settings for the entire site here to add specific meta tags or to remove some unneeded cruft.', 'wordpress-seo') . '</p>' . '<p><strong>' . __('Templates and settings', 'wordpress-seo') . '</strong><br/>' . sprintf(__('Now click on the ‘%1$sPost Types%2$s’-tab, as this will be our example.', 'wordpress-seo'), '<a target="_blank" href="' . esc_url(admin_url('admin.php?page=wpseo_titles#top#post_types')) . '">', '</a>') . '<br />' . __('The templates are built using variables. You can find all these variables in the help tab (in the top-right corner of the page). The settings allow you to set specific behavior for the post types.', 'wordpress-seo') . '</p>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . admin_url('admin.php?page=wpseo_social') . '";', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_dashboard') . '";'), 'wpseo_social' => array('content' => '<h3>' . __('Social settings', 'wordpress-seo') . '</h3>' . '<p><strong>' . __('Facebook', 'wordpress-seo') . '</strong><br/>' . sprintf(__('On this tab you can enable the %1$sFacebook Open Graph%2$s functionality from this plugin, as well as assign a Facebook user or Application to be the admin of your site, so you can view the Facebook insights.', 'wordpress-seo'), '<a target="_blank" href="' . esc_url('https://yoast.com/facebook-open-graph-protocol/#utm_source=wpseo_social&utm_medium=wpseo_tour&utm_campaign=tour') . '">', '</a>') . '</p><p>' . __('The frontpage settings allow you to set meta-data for your homepage, whereas the default settings allow you to set a fallback for all posts/pages without images. ', 'wordpress-seo') . '</p>' . '<p><strong>' . __('Twitter', 'wordpress-seo') . '</strong><br/>' . sprintf(__('With %1$sTwitter Cards%2$s, you can attach rich photos, videos and media experience to tweets that drive traffic to your website. Simply check the box, sign up for the service, and users who Tweet links to your content will have a “Card” added to the tweet that’s visible to all of their followers.', 'wordpress-seo'), '<a target="_blank" href="' . esc_url('https://yoast.com/twitter-cards/#utm_source=wpseo_social&utm_medium=wpseo_tour&utm_campaign=tour') . '">', '</a>') . '</p>' . '<p><strong>' . __('Google+', 'wordpress-seo') . '</strong><br/>' . sprintf(__('This tab allows you to add specific post meta data for Google+. And if you have a Google+ page for your business, add that URL here and link it on your %1$sGoogle+%2$s page’s about page.', 'wordpress-seo'), '<a target="_blank" href="' . esc_url('https://plus.google.com/') . '">', '</a>') . '</p>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . admin_url('admin.php?page=wpseo_xml') . '";', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_titles') . '";'), 'wpseo_xml' => array('content' => '<h3>' . __('XML Sitemaps', 'wordpress-seo') . '</h3>' . '<p><strong>' . __('What are XML sitemaps?', 'wordpress-seo') . '</strong><br/>' . __('A Sitemap is an XML file that lists the URLs for a site. It allows webmasters to include additional information about each URL: when it was last updated, how often it changes, and how important it is in relation to other URLs in the site. This allows search engines to crawl the site more intelligently.', 'wordpress-seo') . '</p>' . '<p><strong>' . __('What does the plugin do with XML Sitemaps?', 'wordpress-seo') . '</strong><br/>' . __('This plugin adds XML sitemaps to your site. The sitemaps are automatically updated when you publish a new post, page or custom post and Google and Bing will be automatically notified. You can also have the plugin automatically notify Yahoo! and Ask.com.', 'wordpress-seo') . '</p><p>' . __('If you want to exclude certain post types and/or taxonomies, you can also set that on this page.', 'wordpress-seo') . '</p><p>' . __('Is your webserver low on memory? Decrease the entries per sitemap (default: 1000) to reduce load.', 'wordpress-seo') . '</p>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . admin_url('admin.php?page=wpseo_permalinks') . '";', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_social') . '";'), 'wpseo_permalinks' => array('content' => '<h3>' . __('Permalink Settings', 'wordpress-seo') . '</h3><p>' . __('All of the options here are for advanced users only, if you don’t know whether you should check any, don’t touch them.', 'wordpress-seo') . '</p>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . admin_url('admin.php?page=wpseo_internal-links') . '";', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_xml') . '";'), 'wpseo_internal-links' => array('content' => '<h3>' . __('Breadcrumbs Settings', 'wordpress-seo') . '</h3><p>' . sprintf(__('If your theme supports my breadcrumbs, as all Genesis and WooThemes themes as well as a couple of other ones do, you can change the settings for those here. If you want to modify your theme to support them, %sfollow these instructions%s.', 'wordpress-seo'), '<a target="_blank" href="' . esc_url('https://yoast.com/wordpress/plugins/breadcrumbs/#utm_source=wpseo_permalinks&utm_medium=wpseo_tour&utm_campaign=tour') . '">', '</a>') . '</p>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . admin_url('admin.php?page=wpseo_rss') . '";', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_permalinks') . '";'), 'wpseo_rss' => array('content' => '<h3>' . __('RSS Settings', 'wordpress-seo') . '</h3><p>' . __('This incredibly powerful function allows you to add content to the beginning and end of your posts in your RSS feed. This helps you gain links from people who steal your content!', 'wordpress-seo') . '</p>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . admin_url('admin.php?page=wpseo_import') . '";', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_internal-links') . '";'), 'wpseo_import' => array('content' => '<h3>' . esc_html__('Import & Export', 'wordpress-seo') . '</h3>' . '<p><strong>' . __('Import from other (SEO) plugins', 'wordpress-seo') . '</strong><br/>' . __('We can imagine that you switch from another SEO plugin to WordPress SEO. If you just did, you can use these options to transfer your SEO-data. If you were using one of my older plugins like Robots Meta & RSS Footer, you can import the settings here too.', 'wordpress-seo') . '</p>' . '<p><strong>' . __('Other imports', 'wordpress-seo') . '</strong><br/>' . sprintf(__('If you’re using one of our premium plugins, such as %1$sLocal SEO%2$s, you can also find specific import-options for that plugin here.', 'wordpress-seo'), '<a target="_blank" href="' . esc_url('https://yoast.com/wordpress/plugins/local-seo/#utm_source=wpseo_import&utm_medium=wpseo_tour&utm_campaign=tour') . '">', '</a>') . '</p>' . '<p><strong>' . __('Export', 'wordpress-seo') . '</strong><br/>' . __('If you have multiple blogs and you’re happy with how you’ve configured this blog, you can export the settings and import them on another blog so you don’t have to go through this process twice!', 'wordpress-seo') . '</p>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . network_admin_url('admin.php?page=wpseo_bulk-editor') . '";', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_rss') . '";'), 'wpseo_bulk-editor' => array('content' => '<h3>' . __('Bulk Editor', 'wordpress-seo') . '</h3><p>' . __('This page lets you view and edit the titles and meta descriptions of all posts and pages on your site. This allows you to edit the title or meta description of all your pages in one place, rather than having to edit each individual page.', 'wordpress-seo') . '</p>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . admin_url('admin.php?page=wpseo_files') . '";', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_import') . '";'), 'wpseo_files' => array('content' => '<h3>' . __('File Editor', 'wordpress-seo') . '</h3><p>' . __('Here you can edit the .htaccess and robots.txt files, two of the most powerful files in your WordPress install, if your WordPress installation has write-access to the files. But please, only touch these files if you know what you’re doing!', 'wordpress-seo') . '</p>', 'next' => __('Next', 'wordpress-seo'), 'next_function' => 'window.location="' . admin_url('admin.php?page=wpseo_licenses') . '";', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_bulk-editor') . '";'), 'wpseo_licenses' => array('content' => '<h3>' . __('Extensions and Licenses', 'wordpress-seo') . '</h3>' . '<p><strong>' . __('Extensions', 'wordpress-seo') . '</strong><br/>' . sprintf(__('The powerful functions of WordPress SEO can be extended with %1$sYoast premium plugins%2$s. These premium plugins require the installation of WordPress SEO or WordPress SEO Premium and add specific functionality. You can read all about the Yoast Premium Plugins on %1$shttp://yoast.com/wordpress/plugins/%2$s.', 'wordpress-seo'), '<a target="_blank" href="' . esc_url('https://yoast.com/wordpress/plugins/#utm_source=wpseo_licenses&utm_medium=wpseo_tour&utm_campaign=tour') . '">', '</a>') . '</p>' . '<p><strong>' . __('Licenses', 'wordpress-seo') . '</strong><br/>' . __('Once you’ve purchased WordPress SEO Premium or any other premium Yoast plugin, you’ll have to enter a license key. You can do so on the Licenses-tab. Once you’ve activated your premium plugin, you can use all its powerful features.', 'wordpress-seo') . '</p>' . '<p><strong>' . __('Like this plugin?', 'wordpress-seo') . '</strong><br/>' . sprintf(__('So, we’ve come to the end of the tour. If you like the plugin, please %srate it 5 stars on WordPress.org%s!', 'wordpress-seo'), '<a target="_blank" href="https://wordpress.org/plugins/wordpress-seo/">', '</a>') . '</p>' . '<p>' . sprintf(__('Thank you for using my plugin and good luck with your SEO!<br/><br/>Best,<br/>Team Yoast - %1$sYoast.com%2$s', 'wordpress-seo'), '<a target="_blank" href="' . esc_url('https://yoast.com/#utm_source=wpseo_licenses&utm_medium=wpseo_tour&utm_campaign=tour') . '">', '</a>') . '</p>', 'prev' => __('Previous', 'wordpress-seo'), 'prev_function' => 'window.location="' . admin_url('admin.php?page=wpseo_files') . '";'));
// Skip tour about wpseo_files page if file editing is disallowed or if the site is a multisite and the current user isn't a superadmin
if (false === WPSEO_Utils::allow_system_file_edit()) {
unset($adminpages['wpseo_files']);
$adminpages['wpseo_bulk-editor']['function'] = 'window.location="' . admin_url('admin.php?page=wpseo_licenses') . '";';
}
$page = '';
if (isset($_GET['page'])) {
$page = $_GET['page'];
}
$button_array = array('button1' => array('text' => __('Close', 'wordpress-seo'), 'function' => ''));
$opt_arr = array();
$id = '#wpseo-title';
if ('admin.php' != $pagenow || !array_key_exists($page, $adminpages)) {
$id = 'li.toplevel_page_wpseo_dashboard';
$content = '<h3>' . __('Congratulations!', 'wordpress-seo') . '</h3>';
$content .= '<p>' . __('You’ve just installed WordPress SEO by Yoast! Click “Start Tour” to view a quick introduction of this plugin’s core functionality.', 'wordpress-seo') . '</p>';
$opt_arr = array('content' => $content, 'position' => array('edge' => 'bottom', 'align' => 'center'));
$button_array['button2']['text'] = __('Start Tour', 'wordpress-seo');
$button_array['button2']['function'] = 'document.location="' . admin_url('admin.php?page=wpseo_dashboard') . '";';
} else {
if ('' != $page && in_array($page, array_keys($adminpages))) {
$align = is_rtl() ? 'left' : 'right';
$opt_arr = array('content' => $adminpages[$page]['content'], 'position' => isset($adminpages[$page]['position']) ? $adminpages[$page]['position'] : array('edge' => 'top', 'align' => $align), 'pointerWidth' => 450);
if (isset($adminpages[$page]['next']) && isset($adminpages[$page]['next_function'])) {
$button_array['button2'] = array('text' => $adminpages[$page]['next'], 'function' => $adminpages[$page]['next_function']);
}
if (isset($adminpages[$page]['prev']) && isset($adminpages[$page]['prev_function'])) {
$button_array['button3'] = array('text' => $adminpages[$page]['prev'], 'function' => $adminpages[$page]['prev_function']);
}
}
}
$this->print_scripts($id, $opt_arr, $button_array);
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:41,代码来源:class-pointers.php
示例16: addPostMeta
/**
* Post Meta
*/
public function addPostMeta($post)
{
$meta = get_metadata('post', $post->ID);
$this->post_data->nav_title = isset($meta['np_nav_title'][0]) ? $meta['np_nav_title'][0] : null;
$this->post_data->link_target = isset($meta['np_link_target'][0]) ? $meta['np_link_target'][0] : null;
$this->post_data->nav_title_attr = isset($meta['np_title_attribute'][0]) ? $meta['np_title_attribute'][0] : null;
$this->post_data->nav_css = isset($meta['np_nav_css_classes'][0]) ? $meta['np_nav_css_classes'][0] : null;
$this->post_data->nav_object = isset($meta['np_nav_menu_item_object'][0]) ? $meta['np_nav_menu_item_object'][0] : null;
$this->post_data->nav_object_id = isset($meta['np_nav_menu_item_object_id'][0]) ? $meta['np_nav_menu_item_object_id'][0] : null;
$this->post_data->nav_type = isset($meta['np_nav_menu_item_type'][0]) ? $meta['np_nav_menu_item_type'][0] : null;
$this->post_data->nav_status = isset($meta['np_nav_status'][0]) && $meta['np_nav_status'][0] == 'hide' ? 'hide' : 'show';
$this->post_data->np_status = isset($meta['nested_pages_status'][0]) && $meta['nested_pages_status'][0] == 'hide' ? 'hide' : 'show';
$this->post_data->template = isset($meta['_wp_page_template'][0]) ? $meta['_wp_page_template'][0] : false;
// Yoast Score
if (function_exists('wpseo_auto_load')) {
$yoast_score = get_post_meta($post->ID, '_yoast_wpseo_meta-robots-noindex', true);
if (!$yoast_score) {
$yoast_score = get_post_meta($post->ID, '_yoast_wpseo_linkdex', true);
$this->post_data->score = \WPSEO_Utils::translate_score($yoast_score);
} else {
$this->post_data->score = 'noindex';
}
}
}
开发者ID:dtwist,项目名称:wp-nested-pages,代码行数:27,代码来源:PostDataFactory.php
示例17: sanitize_post_meta
/**
* Validate the post meta values
*
* @static
*
* @param mixed $meta_value The new value.
* @param string $meta_key The full meta key (including prefix).
*
* @return string Validated meta value
*/
public static function sanitize_post_meta($meta_value, $meta_key)
{
$field_def = self::$meta_fields[self::$fields_index[$meta_key]['subset']][self::$fields_index[$meta_key]['key']];
$clean = self::$defaults[$meta_key];
switch (true) {
case $meta_key === self::$meta_prefix . 'linkdex':
$int = WPSEO_Utils::validate_int($meta_value);
if ($int !== false && $int >= 0) {
$clean = strval($int);
// Convert to string to make sure default check works.
}
break;
case $field_def['type'] === 'checkbox':
// Only allow value if it's one of the predefined options.
if (in_array($meta_value, array('on', 'off'), true)) {
$clean = $meta_value;
}
break;
case $field_def['type'] === 'select' || $field_def['type'] === 'radio':
// Only allow value if it's one of the predefined options.
if (isset($field_def['options'][$meta_value])) {
$clean = $meta_value;
}
break;
case $field_def['type'] === 'multiselect' && $meta_key === self::$meta_prefix . 'meta-robots-adv':
$clean = self::validate_meta_robots_adv($meta_value);
break;
case $field_def['type'] === 'text' && $meta_key === self::$meta_prefix . 'canonical':
case $field_def['type'] === 'text' && $meta_key === self::$meta_prefix . 'redirect':
// Validate as url(-part).
$url = WPSEO_Utils::sanitize_url($meta_value);
if ($url !== '') {
$clean = $url;
}
break;
case $field_def['type'] === 'upload' && $meta_key === self::$meta_prefix . 'opengraph-image':
// Validate as url.
$url = WPSEO_Utils::sanitize_url($meta_value, array('http', 'https', 'ftp', 'ftps'));
if ($url !== '') {
$clean = $url;
}
break;
case $field_def['type'] === 'textarea':
if (is_string($meta_value)) {
// Remove line breaks and tabs.
// @todo [JRF => Yoast] verify that line breaks and the likes aren't allowed/recommended in meta header fields.
$meta_value = str_replace(array("\n", "\r", "\t", ' '), ' ', $meta_value);
$clean = WPSEO_Utils::sanitize_text_field(trim($meta_value));
}
break;
case 'multiselect' === $field_def['type']:
$clean = $meta_value;
break;
case $field_def['type'] === 'text':
default:
if (is_string($meta_value)) {
$clean = WPSEO_Utils::sanitize_text_field(trim($meta_value));
}
if ($meta_key === self::$meta_prefix . 'focuskw') {
$clean = str_replace(array('<', '>', '"', '`', '<', '>', '"', '`'), '', $clean);
}
break;
}
$clean = apply_filters('wpseo_sanitize_post_meta_' . $meta_key, $clean, $meta_value, $field_def, $meta_key);
return $clean;
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:76,代码来源:class-wpseo-meta.php
示例18: validate_option
/**
* Validate the option
*
* @param array $dirty New value for the option.
* @param array $clean Clean value for the option, normally the defaults.
* @param array $old Old value of the option.
*
* @return array Validated clean value for the option to be saved to the database
*/
protected function validate_option($dirty, $clean, $old)
{
foreach ($clean as $key => $value) {
switch ($key) {
case 'version':
$clean[$key] = WPSEO_VERSION;
break;
case 'blocking_files':
/**
* @internal [JRF] to really validate this we should also do a file_exists()
* on each array entry and remove files which no longer exist, but that might be overkill
*/
if (isset($dirty[$key]) && is_array($dirty[$key])) {
$clean[$key] = array_unique($dirty[$key]);
} elseif (isset($old[$key]) && is_array($old[$key])) {
$clean[$key] = array_unique($old[$key]);
}
break;
case 'company_or_person':
if (isset($dirty[$key]) && $dirty[$key] !== '') {
if (in_array($dirty[$key], array('company', 'person'))) {
$clean[$key] = $dirty[$key];
}
}
break;
/* text fields */
/* text fields */
case 'company_name':
case 'person_name':
case 'website_name':
case 'alternate_website_name':
if (isset($dirty[$key]) && $dirty[$key] !== '') {
$clean[$key] = sanitize_text_field($dirty[$key]);
}
break;
case 'company_logo':
$this->validate_url($key, $dirty, $old, $clean);
break;
/* verification strings */
/* verification strings */
case 'googleverify':
case 'msverify':
case 'yandexverify':
$this->validate_verification_string($key, $dirty, $old, $clean);
break;
/*
Boolean dismiss warnings - not fields - may not be in form
(and don't need to be either as long as the default is false)
*/
/*
Boolean dismiss warnings - not fields - may not be in form
(and don't need to be either as long as the default is false)
*/
case 'ms_defaults_set':
if (isset($dirty[$key])) {
$clean[$key] = WPSEO_Utils::validate_bool($dirty[$key]);
} elseif (isset($old[$key])) {
$clean[$key] = WPSEO_Utils::validate_bool($old[$key]);
}
break;
case 'site_type':
$clean[$key] = '';
if (isset($dirty[$key]) && in_array($dirty[$key], $this->site_types, true)) {
$clean[$key] = $dirty[$key];
|
请发表评论