本文整理汇总了PHP中WPSEO_Options::get_default方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSEO_Options::get_default方法的具体用法?PHP WPSEO_Options::get_default怎么用?PHP WPSEO_Options::get_default使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSEO_Options
的用法示例。
在下文中一共展示了WPSEO_Options::get_default方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: clear_all
/**
* Clear all the facebook that has been set already
*
*/
private function clear_all()
{
$this->verify_nonce('fbclearall');
// Reset to defaults, don't unset as otherwise the old values will be retained
$this->options['fb_admins'] = WPSEO_Options::get_default('wpseo_social', 'fb_admins');
$this->save_options();
$this->success_notice(__('Successfully cleared all Facebook Data', 'wordpress-seo'));
// Clean up the referrer url for later use
if (filter_input(INPUT_SERVER, 'REQUEST_URI')) {
$this->cleanup_referrer_url('nonce', 'fbclearall');
}
}
示例2: wpseo_retrieve_seperator
/**
* Retrieve the separator for use as replacement string.
*
* @see WPSEO_Replace_Vars::retrive_sep()
*
* @return string
*/
function wpseo_retrieve_seperator()
{
$replacement = WPSEO_Options::get_default('wpseo_titles', 'separator');
// Get the titles option and the separator options
$titles_options = get_option('wpseo_titles');
$seperator_options = WPSEO_Option_Titles::get_instance()->get_separator_options();
// This should always be set, but just to be sure
if (isset($seperator_options[$titles_options['separator']])) {
// Set the new replacement
$replacement = $seperator_options[$titles_options['separator']];
}
/**
* Filter: 'wpseo_replacements_filter_sep' - Allow customization of the separator character(s)
*
* @api string $replacement The current separator
*/
return apply_filters('wpseo_replacements_filter_sep', $replacement);
}
示例3: import_rss_footer
/**
* Import from old Yoast RSS Footer plugin
*/
public function import_rss_footer()
{
$optold = get_option('RSSFooterOptions');
$optnew = get_option('wpseo_rss');
if ($optold['position'] == 'after') {
if ($optnew['rssafter'] === '' || $optnew['rssafter'] === WPSEO_Options::get_default('wpseo_rss', 'rssafter')) {
$optnew['rssafter'] = $optold['footerstring'];
}
} else {
/* @internal Uncomment the second part if a default would be given to the rssbefore value */
if ($optnew['rssbefore'] === '') {
$optnew['rssbefore'] = $optold['footerstring'];
}
}
update_option('wpseo_rss', $optnew);
$this->set_msg(__('RSS Footer options imported successfully.', 'wordpress-seo'));
}
示例4: unset
case 'nofollow':
WPSEO_Meta::set_value('meta-robots-nofollow', '1', $post->ID);
break;
}
}
}
}
}
unset($posts, $post, $pieces, $meta);
$msg .= __(sprintf('Robots Meta values imported. We recommend %sdisabling the Robots-Meta plugin%s to avoid any conflicts.', '<a href="' . esc_url(admin_url('admin.php?page=wpseo_import&deactivate_robots_meta=1')) . '">', '</a>'), 'wordpress-seo');
}
if (isset($_POST['wpseo']['importrssfooter'])) {
$optold = get_option('RSSFooterOptions');
$optnew = get_option('wpseo_rss');
if ($optold['position'] == 'after') {
if ($optnew['rssafter'] === '' || $optnew['rssafter'] === WPSEO_Options::get_default('wpseo_rss', 'rssafter')) {
$optnew['rssafter'] = $optold['footerstring'];
}
} else {
/* @internal Uncomment the second part if a default would be given to the rssbefore value */
if ($optnew['rssbefore'] === '') {
$optnew['rssbefore'] = $optold['footerstring'];
}
}
update_option('wpseo_rss', $optnew);
unset($optold, $optnew);
$msg .= __('RSS Footer options imported successfully.', 'wordpress-seo');
}
if (isset($_POST['wpseo']['importbreadcrumbs'])) {
$optold = get_option('yoast_breadcrumbs');
$optnew = get_option('wpseo_internallinks');
示例5: __
$content .= '<h2>' . __('General settings', 'wordpress-seo') . '</h2>';
$content .= '<p>' . __('After content publication, the plugin automatically pings Google and Bing, do you need it to ping other search engines too? If so, check the box:', 'wordpress-seo') . '</p>';
$content .= $wpseo_admin_pages->checkbox('xml_ping_yahoo', __('Ping Yahoo!', 'wordpress-seo'), false);
$content .= $wpseo_admin_pages->checkbox('xml_ping_ask', __('Ping Ask.com', 'wordpress-seo'), false);
$post_types = apply_filters('wpseo_sitemaps_supported_post_types', get_post_types(array('public' => true), 'objects'));
if (is_array($post_types) && $post_types !== array()) {
$content .= '<h2>' . __('Exclude post types', 'wordpress-seo') . '</h2>';
$content .= '<p>' . __('Please check the appropriate box below if there\'s a post type that you do <strong>NOT</strong> want to include in your sitemap:', 'wordpress-seo') . '</p>';
foreach ($post_types as $pt) {
$content .= $wpseo_admin_pages->checkbox('post_types-' . $pt->name . '-not_in_sitemap', $pt->labels->name . ' (<code>' . $pt->name . '</code>)');
}
}
$taxonomies = apply_filters('wpseo_sitemaps_supported_taxonomies', get_taxonomies(array('public' => true), 'objects'));
if (is_array($taxonomies) && $taxonomies !== array()) {
$content .= '<h2>' . __('Exclude taxonomies', 'wordpress-seo') . '</h2>';
$content .= '<p>' . __('Please check the appropriate box below if there\'s a taxonomy that you do <strong>NOT</strong> want to include in your sitemap:', 'wordpress-seo') . '</p>';
foreach ($taxonomies as $tax) {
if (isset($tax->labels->name) && trim($tax->labels->name) != '') {
$content .= $wpseo_admin_pages->checkbox('taxonomies-' . $tax->name . '-not_in_sitemap', $tax->labels->name . ' (<code>' . $tax->name . '</code>)');
}
}
}
$content .= '<br/>';
$content .= '<h2>' . __('Entries per page', 'wordpress-seo') . '</h2>';
$content .= '<p>' . sprintf(__('Please enter the maximum number of entries per sitemap page (defaults to %s, you might want to lower this to prevent memory issues on some installs):', 'wordpress-seo'), WPSEO_Options::get_default('wpseo_xml', 'entries-per-page')) . '</p>';
$content .= $wpseo_admin_pages->textinput('entries-per-page', __('Max entries per sitemap page', 'wordpress-seo'));
$content .= '<br class="clear"/>';
$content .= '</div>';
$wpseo_admin_pages->postbox('xmlsitemaps', __('XML Sitemap', 'wordpress-seo'), $content);
do_action('wpseo_xmlsitemaps_config');
$wpseo_admin_pages->admin_footer();
示例6: add_settings_error
add_settings_error('yoast_wpseo_social_options', 'success', sprintf(__('Successfully removed admin %s', 'wordpress-seo'), $fbadmin), 'updated');
unset($fbadmin);
}
unset($id);
// Clean up the referrer url for later use
if (isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = remove_query_arg(array('nonce', 'delfbadmin'), $_SERVER['REQUEST_URI']);
}
} elseif (isset($_GET['fbclearall'])) {
if (wp_verify_nonce($_GET['nonce'], 'fbclearall') != 1) {
die("I don't think that's really nice of you!.");
}
// Reset to defaults, don't unset as otherwise the old values will be retained
$options['fb_admins'] = WPSEO_Options::get_default('wpseo_social', 'fb_admins');
$options['fbapps'] = WPSEO_Options::get_default('wpseo_social', 'fbapps');
$options['fbadminapp'] = WPSEO_Options::get_default('wpseo_social', 'fbadminapp');
update_option('wpseo_social', $options);
add_settings_error('yoast_wpseo_social_options', 'success', __('Successfully cleared all Facebook Data', 'wordpress-seo'), 'updated');
// Clean up the referrer url for later use
if (isset($_SERVER['REQUEST_URI'])) {
$_SERVER['REQUEST_URI'] = remove_query_arg(array('nonce', 'fbclearall'), $_SERVER['REQUEST_URI']);
}
} elseif (isset($_GET['key'])) {
if ($_GET['key'] === $options['fbconnectkey']) {
if (isset($_GET['userid'])) {
$user_id = sanitize_text_field($_GET['userid']);
if (!isset($options['fb_admins'][$user_id])) {
$options['fb_admins'][$user_id]['name'] = sanitize_text_field(urldecode($_GET['userrealname']));
$options['fb_admins'][$user_id]['link'] = sanitize_text_field(urldecode($_GET['link']));
update_option('wpseo_social', $options);
add_settings_error('yoast_wpseo_social_options', 'success', sprintf(__('Successfully added %s as a Facebook Admin!', 'wordpress-seo'), '<a href="' . esc_url($options['fb_admins'][$user_id]['link']) . '">' . esc_html($options['fb_admins'][$user_id]['name']) . '</a>'), 'updated');
示例7: wp_page_title
/**
* Get CiviCRM basepage title for <title> element
*
* Callback method for 'wp_title' hook, called at the end of function wp_title
*
* @param string $title Title that might have already been set
* @param string $separator Separator determined in theme (but defaults to WordPress default)
* @param string $separator_location Whether the separator should be left or right
*/
public function wp_page_title($title, $separator = '»', $separator_location = '')
{
// if feed, return just the title
if (is_feed()) {
return $this->basepage_title;
}
// set default separator location, if it isn't defined
if ('' === trim($separator_location)) {
$separator_location = is_rtl() ? 'left' : 'right';
}
// if we have WP SEO present, use its separator
if (class_exists('WPSEO_Options')) {
$separator_code = WPSEO_Options::get_default('wpseo_titles', 'separator');
$separator_array = WPSEO_Option_Titles::get_instance()->get_separator_options();
if (array_key_exists($separator_code, $separator_array)) {
$separator = $separator_array[$separator_code];
}
}
// construct title depending on separator location
if ($separator_location == 'right') {
$title = $this->basepage_title . " {$separator} " . get_bloginfo('name', 'display');
} else {
$title = get_bloginfo('name', 'display') . " {$separator} " . $this->basepage_title;
}
// return modified title
return $title;
}