本文整理汇总了PHP中Jetpack_Options::get_option_and_ensure_autoload方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack_Options::get_option_and_ensure_autoload方法的具体用法?PHP Jetpack_Options::get_option_and_ensure_autoload怎么用?PHP Jetpack_Options::get_option_and_ensure_autoload使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Jetpack_Options
的用法示例。
在下文中一共展示了Jetpack_Options::get_option_and_ensure_autoload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jetpack_check_mobile
function jetpack_check_mobile()
{
if (defined('XMLRPC_REQUEST') && XMLRPC_REQUEST || defined('APP_REQUEST') && APP_REQUEST) {
return false;
}
if (!isset($_SERVER["HTTP_USER_AGENT"]) || isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'false') {
return false;
}
if (jetpack_mobile_exclude()) {
return false;
}
if (1 == Jetpack_Options::get_option_and_ensure_autoload('wp_mobile_disable', '0')) {
return false;
}
if (isset($_COOKIE['akm_mobile']) && $_COOKIE['akm_mobile'] == 'true') {
return true;
}
$is_mobile = jetpack_is_mobile();
/**
* Filter the Mobile check results.
*
* @module minileven
*
* @since 1.8.0
*
* @param bool $is_mobile Is the reader on a mobile device.
*/
return apply_filters('jetpack_check_mobile', $is_mobile);
}
示例2: jetpack_load_minileven
/**
* Module Name: Mobile Theme
* Module Description: Optimize your site for smartphones and tablets.
* Sort Order: 21
* Recommendation Order: 11
* First Introduced: 1.8
* Requires Connection: No
* Auto Activate: No
* Module Tags: Appearance, Mobile, Recommended
* Feature: Appearance
* Additional Search Queries: mobile, theme, minileven
*/
function jetpack_load_minileven()
{
include dirname(__FILE__) . "/minileven/minileven.php";
if (Jetpack_Options::get_option_and_ensure_autoload('wp_mobile_app_promos', '0') != '1') {
remove_action('wp_mobile_theme_footer', 'jetpack_mobile_app_promo');
}
}
示例3: maybe_register_cpt
/**
* Registers the custom post types and adds action/filter handlers, but
* only if the site supports it
*/
function maybe_register_cpt()
{
// Add an option to enable the CPT
add_action('admin_init', array($this, 'settings_api_init'));
// Check on theme switch if theme supports CPT and setting is disabled
add_action('after_switch_theme', array($this, 'activation_post_type_support'));
$setting = Jetpack_Options::get_option_and_ensure_autoload(self::OPTION_NAME, '0');
// Bail early if Testimonial option is not set and the theme doesn't declare support
if (empty($setting) && !$this->site_supports_custom_post_type()) {
return;
}
if ((!defined('IS_WPCOM') || !IS_WPCOM) && !Jetpack::is_module_active('custom-content-types')) {
return;
}
// Enable Omnisearch for CPT.
if (class_exists('Jetpack_Omnisearch_Posts')) {
new Jetpack_Omnisearch_Posts(self::CUSTOM_POST_TYPE);
}
// CPT magic
$this->register_post_types();
add_action(sprintf('add_option_%s', self::OPTION_NAME), array($this, 'flush_rules_on_enable'), 10);
add_action(sprintf('update_option_%s', self::OPTION_NAME), array($this, 'flush_rules_on_enable'), 10);
add_action(sprintf('publish_%s', self::CUSTOM_POST_TYPE), array($this, 'flush_rules_on_first_testimonial'));
add_action('after_switch_theme', array($this, 'flush_rules_on_switch'));
// Admin Customization
add_filter('enter_title_here', array($this, 'change_default_title'));
add_filter(sprintf('manage_%s_posts_columns', self::CUSTOM_POST_TYPE), array($this, 'edit_title_column_label'));
add_filter('post_updated_messages', array($this, 'updated_messages'));
add_action('customize_register', array($this, 'customize_register'));
// Only add the 'Customize' sub-menu if the theme supports it.
$num_testimonials = self::count_testimonials();
if (!empty($num_testimonials) && current_theme_supports(self::CUSTOM_POST_TYPE)) {
add_action('admin_menu', array($this, 'add_customize_page'));
}
if (defined('IS_WPCOM') && IS_WPCOM) {
// Track all the things
add_action(sprintf('add_option_%s', self::OPTION_NAME), array($this, 'new_activation_stat_bump'));
add_action(sprintf('update_option_%s', self::OPTION_NAME), array($this, 'update_option_stat_bump'), 11, 2);
add_action(sprintf('publish_%s', self::CUSTOM_POST_TYPE), array($this, 'new_testimonial_stat_bump'));
// Add to Dotcom XML sitemaps
add_filter('wpcom_sitemap_post_types', array($this, 'add_to_sitemap'));
} else {
// Add to Jetpack XML sitemap
add_filter('jetpack_sitemap_post_types', array($this, 'add_to_sitemap'));
}
// Adjust CPT archive and custom taxonomies to obey CPT reading setting
add_filter('pre_get_posts', array($this, 'query_reading_setting'), 20);
add_filter('infinite_scroll_settings', array($this, 'infinite_scroll_click_posts_per_page'));
// Register [jetpack_testimonials] always and
// register [testimonials] if [testimonials] isn't already set
add_shortcode('jetpack_testimonials', array($this, 'jetpack_testimonial_shortcode'));
if (!shortcode_exists('testimonials')) {
add_shortcode('testimonials', array($this, 'jetpack_testimonial_shortcode'));
}
// If CPT was enabled programatically and no CPT items exist when user switches away, disable
if ($setting && $this->site_supports_custom_post_type()) {
add_action('switch_theme', array($this, 'deactivation_post_type_support'));
}
}
示例4: __construct
/**
* Conditionally hook into WordPress.
*
* Setup user option for enabling CPT
* If user has CPT enabled, show in admin
*/
function __construct()
{
// Add an option to enable the CPT
add_action('admin_init', array($this, 'settings_api_init'));
// Check on theme switch if theme supports CPT and setting is disabled
add_action('after_switch_theme', array($this, 'activation_post_type_support'));
// Make sure the post types are loaded for imports
add_action('import_start', array($this, 'register_post_types'));
// Add to REST API post type whitelist
add_filter('rest_api_allowed_post_types', array($this, 'allow_portfolio_rest_api_type'));
$setting = Jetpack_Options::get_option_and_ensure_autoload(self::OPTION_NAME, '0');
// Bail early if Portfolio option is not set and the theme doesn't declare support
if (empty($setting) && !$this->site_supports_custom_post_type()) {
return;
}
// Enable Omnisearch for Portfolio Items.
if (class_exists('Jetpack_Omnisearch_Posts')) {
new Jetpack_Omnisearch_Posts(self::CUSTOM_POST_TYPE);
}
// CPT magic
$this->register_post_types();
add_action(sprintf('add_option_%s', self::OPTION_NAME), array($this, 'flush_rules_on_enable'), 10);
add_action(sprintf('update_option_%s', self::OPTION_NAME), array($this, 'flush_rules_on_enable'), 10);
add_action(sprintf('publish_%s', self::CUSTOM_POST_TYPE), array($this, 'flush_rules_on_first_project'));
add_action('after_switch_theme', array($this, 'flush_rules_on_switch'));
// Admin Customization
add_filter('post_updated_messages', array($this, 'updated_messages'));
add_filter(sprintf('manage_%s_posts_columns', self::CUSTOM_POST_TYPE), array($this, 'edit_admin_columns'));
add_filter(sprintf('manage_%s_posts_custom_column', self::CUSTOM_POST_TYPE), array($this, 'image_column'), 10, 2);
add_action('customize_register', array($this, 'customize_register'));
add_image_size('jetpack-portfolio-admin-thumb', 50, 50, true);
add_action('admin_enqueue_scripts', array($this, 'enqueue_admin_styles'));
// register jetpack_portfolio shortcode and portfolio shortcode (legacy)
add_shortcode('portfolio', array($this, 'portfolio_shortcode'));
add_shortcode('jetpack_portfolio', array($this, 'portfolio_shortcode'));
if (defined('IS_WPCOM') && IS_WPCOM) {
// Add to Dotcom XML sitemaps
add_filter('wpcom_sitemap_post_types', array($this, 'add_to_sitemap'));
} else {
// Add to Jetpack XML sitemap
add_filter('jetpack_sitemap_post_types', array($this, 'add_to_sitemap'));
}
// Adjust CPT archive and custom taxonomies to obey CPT reading setting
add_filter('pre_get_posts', array($this, 'query_reading_setting'));
// If CPT was enabled programatically and no CPT items exist when user switches away, disable
if ($setting && $this->site_supports_custom_post_type()) {
add_action('switch_theme', array($this, 'deactivation_post_type_support'));
}
}
示例5: jetpack_verification_print_meta
function jetpack_verification_print_meta()
{
$verification_services_codes = Jetpack_Options::get_option_and_ensure_autoload('verification_services_codes', '0');
if (is_array($verification_services_codes)) {
$ver_output = "<!-- Jetpack Site Verification Tags -->\n";
foreach (jetpack_verification_services() as $name => $service) {
if (is_array($service) && !empty($verification_services_codes["{$name}"])) {
$ver_tag = sprintf('<meta name="%s" content="%s" />', esc_attr($service["key"]), esc_attr($verification_services_codes["{$name}"]));
/**
* Filter the meta tag template used for all verification tools.
*
* @module verification-tools
*
* @since 3.0.0
*
* @param string $ver_tag Verification Tool meta tag.
*/
$ver_output .= apply_filters('jetpack_site_verification_output', $ver_tag);
$ver_output .= "\n";
}
}
echo $ver_output;
}
}
示例6: is_enabled_sitewide
/**
* Returns the current state of the "WordPress.com Likes are" option.
* @return boolean true if enabled sitewide, false if not
*/
function is_enabled_sitewide()
{
/**
* Filters whether Likes are enabled by default on all posts.
* true if enabled sitewide, false if not.
*
* @module likes
*
* @since 2.2.0
*
* @param bool $option Are Likes enabled sitewide.
*/
return (bool) apply_filters('wpl_is_enabled_sitewide', !Jetpack_Options::get_option_and_ensure_autoload('disabled_likes', 0));
}
示例7: admin_init
function admin_init()
{
// If the plugin is not connected, display a connect message.
if (Jetpack_Options::get_option_and_ensure_autoload('do_activate', '0') || !Jetpack_Options::get_option('activated')) {
Jetpack::plugin_initialize();
}
if (!Jetpack::is_active() && !Jetpack::is_development_mode()) {
Jetpack_Connection_Banner::init();
} elseif (false === Jetpack_Options::get_option('fallback_no_verify_ssl_certs')) {
// Upgrade: 1.1 -> 1.1.1
// Check and see if host can verify the Jetpack servers' SSL certificate
$args = array();
Jetpack_Client::_wp_remote_request(Jetpack::fix_url_for_bad_hosts(Jetpack::api_url('test')), $args, true);
} else {
if ($this->can_display_jetpack_manage_notice() && !Jetpack_Options::get_option('dismissed_manage_banner')) {
// Show the notice on the Dashboard only for now
add_action('load-index.php', array($this, 'prepare_manage_jetpack_notice'));
}
}
if (current_user_can('manage_options') && 'AUTO' == JETPACK_CLIENT__HTTPS && !self::permit_ssl()) {
add_action('jetpack_notices', array($this, 'alert_auto_ssl_fail'));
}
add_action('load-plugins.php', array($this, 'intercept_plugin_error_scrape_init'));
add_action('admin_enqueue_scripts', array($this, 'admin_menu_css'));
add_filter('plugin_action_links_' . plugin_basename(JETPACK__PLUGIN_DIR . 'jetpack.php'), array($this, 'plugin_action_links'));
if (Jetpack::is_active() || Jetpack::is_development_mode()) {
// Artificially throw errors in certain whitelisted cases during plugin activation
add_action('activate_plugin', array($this, 'throw_error_on_activate_plugin'));
}
// Jetpack Manage Activation Screen from .com
Jetpack::module_configuration_activation_screen('manage', array($this, 'manage_activate_screen'));
// Add custom column in wp-admin/users.php to show whether user is linked.
add_filter('manage_users_columns', array($this, 'jetpack_icon_user_connected'));
add_action('manage_users_custom_column', array($this, 'jetpack_show_user_connected_icon'), 10, 3);
add_action('admin_print_styles', array($this, 'jetpack_user_col_style'));
}
示例8: filter_infinite_scroll_js_settings
/**
* Modify Infinite Scroll configuration information
*
* @uses Jetpack::get_active_modules, is_user_logged_in, stats_get_options, Jetpack_Options::get_option, get_option, JETPACK__API_VERSION, JETPACK__VERSION
* @filter infinite_scroll_js_settings
* @return array
*/
public function filter_infinite_scroll_js_settings($settings)
{
// Provide WP Stats info for tracking Infinite Scroll loads
// Abort if Stats module isn't active
if (in_array('stats', Jetpack::get_active_modules())) {
// Abort if user is logged in but logged-in users shouldn't be tracked.
if (is_user_logged_in() && function_exists('stats_get_options')) {
$stats_options = stats_get_options();
$track_loggedin_users = isset($stats_options['reg_users']) ? (bool) $stats_options['reg_users'] : false;
if (!$track_loggedin_users) {
return $settings;
}
}
// We made it this far, so gather the data needed to track IS views
$settings['stats'] = 'blog=' . Jetpack_Options::get_option('id') . '&host=' . parse_url(get_option('home'), PHP_URL_HOST) . '&v=ext&j=' . JETPACK__API_VERSION . ':' . JETPACK__VERSION;
// Pagetype parameter
$settings['stats'] .= '&x_pagetype=infinite';
if ('click' == $settings['type']) {
$settings['stats'] .= '-click';
}
$settings['stats'] .= '-jetpack';
}
// Check if Google Analytics tracking is requested
$settings['google_analytics'] = (bool) Jetpack_Options::get_option_and_ensure_autoload($this->option_name_google_analytics, 0);
return $settings;
}
示例9: site_tag
static function site_tag()
{
$site_tag = Jetpack_Options::get_option_and_ensure_autoload('jetpack-twitter-cards-site-tag', '');
if (empty($site_tag)) {
if (defined('IS_WPCOM') && IS_WPCOM) {
return 'wordpressdotcom';
} else {
return;
}
}
return $site_tag;
}
示例10: sharing_init
function sharing_init()
{
if (Jetpack_Options::get_option_and_ensure_autoload('sharedaddy_disable_resources', '0')) {
add_filter('sharing_js', 'sharing_disable_js');
remove_action('wp_head', 'sharing_add_header', 1);
}
}
示例11: link_tag
static function link_tag()
{
global $blog_id, $current_blog;
if (apply_filters('safecss_style_error', false)) {
return;
}
if (!is_super_admin() && isset($current_blog) && (1 == $current_blog->spam || 1 == $current_blog->deleted)) {
return;
}
if (Jetpack_Custom_CSS::is_customizer_preview()) {
return;
}
$css = '';
$option = Jetpack_Custom_CSS::is_preview() ? 'safecss_preview' : 'safecss';
if ('safecss' == $option) {
if (Jetpack_Options::get_option_and_ensure_autoload('safecss_revision_migrated', '0')) {
$safecss_post = Jetpack_Custom_CSS::get_post();
if (!empty($safecss_post['post_content'])) {
$css = $safecss_post['post_content'];
}
} else {
$current_revision = Jetpack_Custom_CSS::get_current_revision();
if (!empty($current_revision['post_content'])) {
$css = $current_revision['post_content'];
}
}
// Fix for un-migrated Custom CSS
if (empty($safecss_post)) {
$_css = Jetpack_Options::get_option_and_ensure_autoload('safecss', '');
if (!empty($_css)) {
$css = $_css;
}
}
}
if ('safecss_preview' == $option) {
$safecss_post = Jetpack_Custom_CSS::get_current_revision();
if (!empty($safecss_post['post_content'])) {
$css = $safecss_post['post_content'];
}
}
$css = str_replace(array('\\\\00BB \\\\0020', '\\0BB \\020', '0BB 020'), '\\00BB \\0020', $css);
if ($css == '') {
return;
}
if (apply_filters('safecss_embed_style', false, $css)) {
echo "\r\n" . '<style id="custom-css-css">' . Jetpack_Custom_CSS::get_css(true) . "</style>\r\n";
} else {
$href = home_url('/');
$href = add_query_arg('custom-css', 1, $href);
$href = add_query_arg('csblog', $blog_id, $href);
$href = add_query_arg('cscache', 6, $href);
$href = add_query_arg('csrev', (int) get_option($option . '_rev'), $href);
/**
* Filter the Custom CSS link enqueued in the head.
*
* @module custom-css
*
* @since 1.7.0
*
* @param string $href Custom CSS link enqueued in the head.
* @param string $blog_id Blog ID.
*/
$href = apply_filters('safecss_href', $href, $blog_id);
if (Jetpack_Custom_CSS::is_preview()) {
$href = add_query_arg('csspreview', 'true', $href);
}
?>
<link rel="stylesheet" id="custom-css-css" type="text/css" href="<?php
echo esc_url($href);
?>
" />
<?php
}
/**
* Fires after creating the <link> in the <head> element for the custom css stylesheet.
*
* @module custom-css
*
* @since 2.2.2
*/
do_action('safecss_link_tag_post');
}
示例12: enqueue_assets
function enqueue_assets($output)
{
if (!empty($output) && !apply_filters('jp_carousel_force_enable', false)) {
// Bail because someone is overriding the [gallery] shortcode.
remove_filter('gallery_style', array($this, 'add_data_to_container'));
remove_filter('wp_get_attachment_image_attributes', array($this, 'add_data_to_images'));
// Display message that carousel has bailed, if user is super_admin, and if we're not on WordPress.com.
if (is_super_admin() && !(defined('IS_WPCOM') && IS_WPCOM)) {
add_filter('post_gallery', array($this, 'display_bail_message'));
}
return $output;
}
/**
* Fires when thumbnails are shown in Carousel.
*
* @module carousel
*
* @since 1.6.0
**/
do_action('jp_carousel_thumbnails_shown');
if ($this->first_run) {
wp_enqueue_script('jetpack-carousel', plugins_url('jetpack-carousel.js', __FILE__), array('jquery.spin'), $this->asset_version('20160325'), true);
// Note: using home_url() instead of admin_url() for ajaxurl to be sure to get same domain on wpcom when using mapped domains (also works on self-hosted)
// Also: not hardcoding path since there is no guarantee site is running on site root in self-hosted context.
$is_logged_in = is_user_logged_in();
$current_user = wp_get_current_user();
$comment_registration = intval(get_option('comment_registration'));
$require_name_email = intval(get_option('require_name_email'));
$localize_strings = array('widths' => $this->prebuilt_widths, 'is_logged_in' => $is_logged_in, 'lang' => strtolower(substr(get_locale(), 0, 2)), 'ajaxurl' => set_url_scheme(admin_url('admin-ajax.php')), 'nonce' => wp_create_nonce('carousel_nonce'), 'display_exif' => $this->test_1or0_option(Jetpack_Options::get_option_and_ensure_autoload('carousel_display_exif', true)), 'display_geo' => $this->test_1or0_option(Jetpack_Options::get_option_and_ensure_autoload('carousel_display_geo', true)), 'background_color' => $this->carousel_background_color_sanitize(Jetpack_Options::get_option_and_ensure_autoload('carousel_background_color', '')), 'comment' => __('Comment', 'jetpack'), 'post_comment' => __('Post Comment', 'jetpack'), 'write_comment' => __('Write a Comment...', 'jetpack'), 'loading_comments' => __('Loading Comments...', 'jetpack'), 'download_original' => sprintf(__('View full size <span class="photo-size">%1$s<span class="photo-size-times">×</span>%2$s</span>', 'jetpack'), '{0}', '{1}'), 'no_comment_text' => __('Please be sure to submit some text with your comment.', 'jetpack'), 'no_comment_email' => __('Please provide an email address to comment.', 'jetpack'), 'no_comment_author' => __('Please provide your name to comment.', 'jetpack'), 'comment_post_error' => __('Sorry, but there was an error posting your comment. Please try again later.', 'jetpack'), 'comment_approved' => __('Your comment was approved.', 'jetpack'), 'comment_unapproved' => __('Your comment is in moderation.', 'jetpack'), 'camera' => __('Camera', 'jetpack'), 'aperture' => __('Aperture', 'jetpack'), 'shutter_speed' => __('Shutter Speed', 'jetpack'), 'focal_length' => __('Focal Length', 'jetpack'), 'comment_registration' => $comment_registration, 'require_name_email' => $require_name_email, 'login_url' => wp_login_url(apply_filters('the_permalink', get_permalink())));
if (!isset($localize_strings['jetpack_comments_iframe_src']) || empty($localize_strings['jetpack_comments_iframe_src'])) {
// We're not using Comments after all, so fallback to standard local comments.
if ($is_logged_in) {
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . sprintf(__('Commenting as %s', 'jetpack'), $current_user->data->display_name) . '</p>';
} else {
if ($comment_registration) {
$localize_strings['local_comments_commenting_as'] = '<p id="jp-carousel-commenting-as">' . __('You must be <a href="#" class="jp-carousel-comment-login">logged in</a> to post a comment.', 'jetpack') . '</p>';
} else {
$required = $require_name_email ? __('%s (Required)', 'jetpack') : '%s';
$localize_strings['local_comments_commenting_as'] = '' . '<fieldset><label for="email">' . sprintf($required, __('Email', 'jetpack')) . '</label> ' . '<input type="text" name="email" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-email-field" /></fieldset>' . '<fieldset><label for="author">' . sprintf($required, __('Name', 'jetpack')) . '</label> ' . '<input type="text" name="author" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-author-field" /></fieldset>' . '<fieldset><label for="url">' . __('Website', 'jetpack') . '</label> ' . '<input type="text" name="url" class="jp-carousel-comment-form-field jp-carousel-comment-form-text-field" id="jp-carousel-comment-form-url-field" /></fieldset>';
}
}
}
/**
* Handle WP stats for images in full-screen.
* Build string with tracking info.
*/
if (in_array('stats', Jetpack::get_active_modules()) && !Jetpack::is_development_mode()) {
$localize_strings['stats'] = 'blog=' . Jetpack_Options::get_option('id') . '&host=' . parse_url(get_option('home'), PHP_URL_HOST) . '&v=ext&j=' . JETPACK__API_VERSION . ':' . JETPACK__VERSION;
// Set the stats as empty if user is logged in but logged-in users shouldn't be tracked.
if (is_user_logged_in() && function_exists('stats_get_options')) {
$stats_options = stats_get_options();
$track_loggedin_users = isset($stats_options['reg_users']) ? (bool) $stats_options['reg_users'] : false;
if (!$track_loggedin_users) {
$localize_strings['stats'] = '';
}
}
}
/**
* Filter the strings passed to the Carousel's js file.
*
* @module carousel
*
* @since 1.6.0
*
* @param array $localize_strings Array of strings passed to the Jetpack js file.
*/
$localize_strings = apply_filters('jp_carousel_localize_strings', $localize_strings);
wp_localize_script('jetpack-carousel', 'jetpackCarouselStrings', $localize_strings);
if (is_rtl()) {
wp_enqueue_style('jetpack-carousel', plugins_url('/rtl/jetpack-carousel-rtl.css', __FILE__), array(), $this->asset_version('20120629'));
} else {
wp_enqueue_style('jetpack-carousel', plugins_url('jetpack-carousel.css', __FILE__), array(), $this->asset_version('20120629'));
}
wp_register_style('jetpack-carousel-ie8fix', plugins_url('jetpack-carousel-ie8fix.css', __FILE__), array(), $this->asset_version('20121024'));
$GLOBALS['wp_styles']->add_data('jetpack-carousel-ie8fix', 'conditional', 'lte IE 8');
wp_enqueue_style('jetpack-carousel-ie8fix');
/**
* Fires after carousel assets are enqueued for the first time.
* Allows for adding additional assets to the carousel page.
*
* @module carousel
*
* @since 1.6.0
*
* @param bool $first_run First load if Carousel on the page.
* @param array $localized_strings Array of strings passed to the Jetpack js file.
*/
do_action('jp_carousel_enqueue_assets', $this->first_run, $localize_strings);
$this->first_run = false;
}
return $output;
}
示例13: tiles_enabled
public function tiles_enabled()
{
// Check the setting status
return '' != Jetpack_Options::get_option_and_ensure_autoload('tiled_galleries', '');
}
示例14: is_commenting_enabled
/**
* Is Markdown conversion for comments enabled?
* @return boolean
*/
public function is_commenting_enabled()
{
return (bool) Jetpack_Options::get_option_and_ensure_autoload(self::COMMENT_OPTION, '');
}
示例15: jetpack_og_tags
function jetpack_og_tags()
{
/**
* Allow Jetpack to output Open Graph Meta Tags.
*
* @module sharedaddy, publicize
*
* @since 2.0.0
* @deprecated 2.0.3 Duplicative filter. Use `jetpack_enable_open_graph`.
*
* @param bool true Should Jetpack's Open Graph Meta Tags be enabled. Default to true.
*/
if (false === apply_filters('jetpack_enable_opengraph', true)) {
_deprecated_function('jetpack_enable_opengraph', '2.0.3', 'jetpack_enable_open_graph');
return;
}
// Disable the widont filter on WP.com to avoid stray  s
$disable_widont = remove_filter('the_title', 'widont');
$og_output = "\n<!-- Jetpack Open Graph Tags -->\n";
$tags = array();
/**
* Filter the minimum width of the images used in Jetpack Open Graph Meta Tags.
*
* @module sharedaddy, publicize
*
* @since 2.0.0
*
* @param int 200 Minimum image width used in Jetpack Open Graph Meta Tags.
*/
$image_width = absint(apply_filters('jetpack_open_graph_image_width', 200));
/**
* Filter the minimum height of the images used in Jetpack Open Graph Meta Tags.
*
* @module sharedaddy, publicize
*
* @since 2.0.0
*
* @param int 200 Minimum image height used in Jetpack Open Graph Meta Tags.
*/
$image_height = absint(apply_filters('jetpack_open_graph_image_height', 200));
$description_length = 197;
if (is_home() || is_front_page()) {
$site_type = Jetpack_Options::get_option_and_ensure_autoload('open_graph_protocol_site_type', '');
$tags['og:type'] = !empty($site_type) ? $site_type : 'website';
$tags['og:title'] = get_bloginfo('name');
$tags['og:description'] = get_bloginfo('description');
$front_page_id = get_option('page_for_posts');
if ('page' == get_option('show_on_front') && $front_page_id && is_home()) {
$tags['og:url'] = get_permalink($front_page_id);
} else {
$tags['og:url'] = home_url('/');
}
// Associate a blog's root path with one or more Facebook accounts
$facebook_admins = Jetpack_Options::get_option_and_ensure_autoload('facebook_admins', array());
if (!empty($facebook_admins)) {
$tags['fb:admins'] = $facebook_admins;
}
} else {
if (is_author()) {
$tags['og:type'] = 'profile';
$author = get_queried_object();
$tags['og:title'] = $author->display_name;
if (!empty($author->user_url)) {
$tags['og:url'] = $author->user_url;
} else {
$tags['og:url'] = get_author_posts_url($author->ID);
}
$tags['og:description'] = $author->description;
$tags['profile:first_name'] = get_the_author_meta('first_name', $author->ID);
$tags['profile:last_name'] = get_the_author_meta('last_name', $author->ID);
} else {
if (is_singular()) {
global $post;
$data = $post;
// so that we don't accidentally explode the global
$tags['og:type'] = 'article';
if (empty($data->post_title)) {
$tags['og:title'] = ' ';
} else {
/** This filter is documented in core/src/wp-includes/post-template.php */
$tags['og:title'] = wp_kses(apply_filters('the_title', $data->post_title, $data->ID), array());
}
$tags['og:url'] = get_permalink($data->ID);
if (!post_password_required()) {
if (!empty($data->post_excerpt)) {
$tags['og:description'] = preg_replace('@https?://[\\S]+@', '', strip_shortcodes(wp_kses($data->post_excerpt, array())));
} else {
$exploded_content_on_more_tag = explode('<!--more-->', $data->post_content);
$tags['og:description'] = wp_trim_words(preg_replace('@https?://[\\S]+@', '', strip_shortcodes(wp_kses($exploded_content_on_more_tag[0], array()))));
}
}
if (empty($tags['og:description'])) {
/**
* Filter the fallback `og:description` used when no excerpt information is provided.
*
* @module sharedaddy, publicize
*
* @since 3.9.0
*
* @param string $var Fallback og:description. Default is translated `Visit the post for more'.
//.........这里部分代码省略.........