当前位置: 首页>>代码示例>>PHP>>正文


PHP Jetpack_Options::get_option方法代码示例

本文整理汇总了PHP中Jetpack_Options::get_option方法的典型用法代码示例。如果您正苦于以下问题:PHP Jetpack_Options::get_option方法的具体用法?PHP Jetpack_Options::get_option怎么用?PHP Jetpack_Options::get_option使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Jetpack_Options的用法示例。


在下文中一共展示了Jetpack_Options::get_option方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: get_jetpack_modules

 function get_jetpack_modules()
 {
     if (is_user_member_of_blog()) {
         return array_values(Jetpack_Options::get_option('active_modules', array()));
     }
     return null;
 }
开发者ID:jrodd32,项目名称:mwux16,代码行数:7,代码来源:class.json-api-site-jetpack-base.php

示例2: get_access_token

 /**
  * Gets locally stored token
  *
  * @return object|false
  */
 public static function get_access_token($user_id = false)
 {
     if ($user_id) {
         if (!($tokens = Jetpack_Options::get_option('user_tokens'))) {
             return false;
         }
         if ($user_id === JETPACK_MASTER_USER) {
             if (!($user_id = Jetpack_Options::get_option('master_user'))) {
                 return false;
             }
         }
         if (!isset($tokens[$user_id]) || !($token = $tokens[$user_id])) {
             return false;
         }
         $token_chunks = explode('.', $token);
         if (empty($token_chunks[1]) || empty($token_chunks[2])) {
             return false;
         }
         if ($user_id != $token_chunks[2]) {
             return false;
         }
         $token = "{$token_chunks[0]}.{$token_chunks[1]}";
     } else {
         $token = Jetpack_Options::get_option('blog_token');
         if (empty($token)) {
             return false;
         }
     }
     return (object) array('secret' => $token, 'external_user_id' => (int) $user_id);
 }
开发者ID:Nancers,项目名称:Snancy-Website-Files,代码行数:35,代码来源:class.jetpack-data.php

示例3: prepare_jitms

 /**
  * Prepare actions according to screen and post type.
  *
  * @since 3.8.2
  *
  * @param object $screen
  */
 function prepare_jitms($screen)
 {
     global $pagenow;
     $post_type = $screen->post_type;
     self::$jetpack_hide_jitm = Jetpack_Options::get_option('hide_jitm');
     $showphoton = empty(self::$jetpack_hide_jitm['photon']) ? 'show' : self::$jetpack_hide_jitm['photon'];
     $showmanage = empty(self::$jetpack_hide_jitm['manage']) ? 'show' : self::$jetpack_hide_jitm['manage'];
     $show_manage_pi = empty(self::$jetpack_hide_jitm['manage-pi']) ? 'show' : self::$jetpack_hide_jitm['manage-pi'];
     $show_editor = empty(self::$jetpack_hide_jitm['editor']) ? 'show' : self::$jetpack_hide_jitm['editor'];
     if ('media-new.php' == $pagenow && !Jetpack::is_module_active('photon') && 'hide' != $showphoton) {
         add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
         add_action('post-plupload-upload-ui', array($this, 'photon_msg'));
     } else {
         if ('update-core.php' == $pagenow && 'hide' != $showmanage) {
             add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
             add_action('admin_notices', array($this, 'manage_msg'));
         } elseif ('plugins.php' === $pagenow && isset($_GET['activate']) && 'true' === $_GET['activate'] && 'hide' != $show_manage_pi) {
             add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
             add_action('pre_current_active_plugins', array($this, 'manage_pi_msg'));
         } elseif ('post-new.php' === $pagenow && in_array($post_type, array('post', 'page')) && 'hide' != $show_editor) {
             add_action('admin_enqueue_scripts', array($this, 'jitm_enqueue_files'));
             add_action('admin_notices', array($this, 'editor_msg'));
         }
     }
 }
开发者ID:jfbelisle,项目名称:magexpress,代码行数:32,代码来源:class.jetpack-jitm.php

示例4: cron_exec

 /**
  * Method that gets executed on the wp-cron call
  *
  * @since 2.3.3
  * @global string $wp_version
  */
 public function cron_exec()
 {
     $jetpack = Jetpack::init();
     /*
      * This should run daily.  Figuring in for variances in
      * WP_CRON, don't let it run more than every 23 hours at most.
      *
      * i.e. if it ran less than 23 hours ago, fail out.
      */
     $last = (int) Jetpack_Options::get_option('last_heartbeat');
     if ($last && $last + DAY_IN_SECONDS - HOUR_IN_SECONDS > time()) {
         return;
     }
     /*
      * Check for an identity crisis
      *
      * If one exists:
      * - Bump stat for ID crisis
      * - Email site admin about potential ID crisis
      */
     // Coming Soon!
     foreach (self::generate_stats_array('v2-') as $key => $value) {
         $jetpack->stat($key, $value);
     }
     Jetpack_Options::update_option('last_heartbeat', time());
     $jetpack->do_stats('server_side');
 }
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:33,代码来源:class.jetpack-heartbeat.php

示例5: jetpack_load_custom_css

/**
 * Module Name: Custom CSS
 * Module Description: Tweak your site’s CSS without modifying your theme.
 * Sort Order: 2
 * First Introduced: 1.7
 * Requires Connection: No
 * Auto Activate: Yes
 * Module Tags: Appearance
 * Feature: Appearance
 * Additional Search Queries: css, customize, custom, style, editor, less, sass, preprocessor, font, mobile, appearance, theme, stylesheet
 */
function jetpack_load_custom_css()
{
    // If WordPress has the core version of Custom CSS, load our new version.
    // @see https://core.trac.wordpress.org/changeset/38829
    if (function_exists('wp_get_custom_css')) {
        if (!function_exists('wp_update_custom_css_post')) {
            wp_die('Please run a SVN up to get the latest version of trunk, or update to at least 4.7 RC1');
        }
        if (!Jetpack_Options::get_option('custom_css_4.7_migration')) {
            include_once dirname(__FILE__) . '/custom-css/migrate-to-core.php';
        } else {
            if (defined('WP_CLI') && WP_CLI) {
                function jetpack_custom_css_undo_data_migration_cli()
                {
                    Jetpack_Options::delete_option('custom_css_4.7_migration');
                    WP_CLI::success(__('Option deleted, re-migrate via `wp jetpack custom-css migrate`.', 'jetpack'));
                }
                WP_CLI::add_command('jetpack custom-css undo-migrate', 'jetpack_custom_css_undo_data_migration_cli');
            }
        }
        // TODO: END DELETE THIS
        include_once dirname(__FILE__) . '/custom-css/custom-css/preprocessors.php';
        include_once dirname(__FILE__) . '/custom-css/custom-css-4.7.php';
        return;
    }
    include_once dirname(__FILE__) . "/custom-css/custom-css.php";
    add_action('init', array('Jetpack_Custom_CSS', 'init'));
}
开发者ID:uwmadisoncals,项目名称:Cluster-Plugins,代码行数:39,代码来源:custom-css.php

示例6: record_user_event

 public function record_user_event($event_type, $data = array())
 {
     if (!function_exists('jetpack_tracks_record_event')) {
         $this->log('Error. jetpack_tracks_record_event is not defined.');
         return;
     }
     $user = wp_get_current_user();
     $site_url = get_option('siteurl');
     // Check for WooCommerce
     $wc_version = 'unavailable';
     if (function_exists('WC')) {
         $wc_version = WC()->version;
     }
     // Check for Jetpack
     $jp_version = 'unavailable';
     if (defined('JETPACK__VERSION')) {
         $jp_version = JETPACK__VERSION;
     }
     $jetpack_blog_id = -1;
     if (class_exists('Jetpack_Options') && method_exists('Jetpack_Options', 'get_option')) {
         $jetpack_blog_id = Jetpack_Options::get_option('id');
     }
     $data['_via_ua'] = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
     $data['_via_ip'] = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
     $data['_lg'] = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
     $data['blog_url'] = $site_url;
     $data['blog_id'] = $jetpack_blog_id;
     $data['jetpack_version'] = $jp_version;
     $data['wc_version'] = $wc_version;
     $data['wp_version'] = get_bloginfo('version');
     $event_type = self::$product_name . '_' . $event_type;
     $this->log('Tracked the following event: ' . $event_type);
     return jetpack_tracks_record_event($user, $event_type, $data);
 }
开发者ID:Automattic,项目名称:woocommerce-connect-client,代码行数:34,代码来源:class-wc-connect-tracks.php

示例7: __construct

 /**
  * Constructor.
  */
 public function __construct()
 {
     $theme_support = get_theme_support('social-links');
     /* An array of named arguments must be passed as the second parameter
      * of add_theme_support().
      */
     if (!isset($theme_support[0]) || empty($theme_support[0])) {
         return;
     }
     $this->links = Jetpack_Options::get_option('social_links', array());
     global $publicize;
     if (is_a($publicize, 'Publicize')) {
         $this->publicize = $publicize;
         $this->services = array_intersect(array_keys($this->publicize->get_services('connected')), $theme_support[0]);
         add_action('customize_register', array($this, 'customize_register'));
         add_filter('sanitize_option_jetpack_options', array($this, 'sanitize_link'));
     }
     add_filter('jetpack_has_social_links', array($this, 'has_social_links'));
     add_filter('jetpack_get_social_links', array($this, 'get_social_links'));
     foreach ($theme_support[0] as $service) {
         add_filter("pre_option_jetpack-{$service}", array($this, 'get_social_link_filter'));
         // get_option( 'jetpack-service' );
         add_filter("theme_mod_jetpack-{$service}", array($this, 'get_social_link_filter'));
         // get_theme_mod( 'jetpack-service' );
     }
 }
开发者ID:estrategasdigitales,项目名称:flazam,代码行数:29,代码来源:social-links.php

示例8: verify_action

 /**
  * @return WP_Error|string secret_2 on success, WP_Error( error_code => error_code, error_message => error description, error_data => status code ) on failure
  *
  * Possible error_codes:
  *
  * verify_secret_1_missing
  * verify_secret_1_malformed
  * verify_secrets_missing: No longer have verification secrets stored
  * verify_secrets_mismatch: stored secret_1 does not match secret_1 sent by Jetpack.WordPress.com
  */
 function verify_action($params)
 {
     $action = $params[0];
     $verify_secret = $params[1];
     if (empty($verify_secret)) {
         return $this->error(new Jetpack_Error('verify_secret_1_missing', sprintf('The required "%s" parameter is missing.', 'secret_1'), 400));
     } else {
         if (!is_string($verify_secret)) {
             return $this->error(new Jetpack_Error('verify_secret_1_malformed', sprintf('The required "%s" parameter is malformed.', 'secret_1'), 400));
         }
     }
     $secrets = Jetpack_Options::get_option($action);
     if (!$secrets || is_wp_error($secrets)) {
         Jetpack_Options::delete_option($action);
         return $this->error(new Jetpack_Error('verify_secrets_missing', 'Verification took too long', 400));
     }
     @(list($secret_1, $secret_2, $secret_eol) = explode(':', $secrets));
     if (empty($secret_1) || empty($secret_2) || empty($secret_eol) || $secret_eol < time()) {
         Jetpack_Options::delete_option($action);
         return $this->error(new Jetpack_Error('verify_secrets_missing', 'Verification took too long', 400));
     }
     if ($verify_secret !== $secret_1) {
         Jetpack_Options::delete_option($action);
         return $this->error(new Jetpack_Error('verify_secrets_mismatch', 'Secret mismatch', 400));
     }
     Jetpack_Options::delete_option($action);
     return $secret_2;
 }
开发者ID:estrategasdigitales,项目名称:flazam,代码行数:38,代码来源:class.jetpack-xmlrpc-server.php

示例9: jetpack_site_icon_url

 function jetpack_site_icon_url($blog_id = null, $size = '512', $default = false)
 {
     $url = '';
     if (!is_int($blog_id)) {
         $blog_id = get_current_blog_id();
     }
     if (function_exists('get_blog_option')) {
         $site_icon_id = get_blog_option($blog_id, 'jetpack_site_icon_id');
     } else {
         $site_icon_id = Jetpack_Options::get_option('site_icon_id');
     }
     if (!$site_icon_id) {
         if ($default === false && defined('SITE_ICON_DEFAULT_URL')) {
             $url = SITE_ICON_DEFAULT_URL;
         } else {
             $url = $default;
         }
     } else {
         if ($size >= 512) {
             $size_data = 'full';
         } else {
             $size_data = array($size, $size);
         }
         $url_data = wp_get_attachment_image_src($site_icon_id, $size_data);
         $url = $url_data[0];
     }
     return $url;
 }
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:28,代码来源:site-icon-functions.php

示例10: jetpack_json_api_configuration_screen

function jetpack_json_api_configuration_screen()
{
    ?>
	<div class="narrow">
		<form method="post">
			<input type='hidden' name='action' value='save_options' />
			<?php 
    wp_nonce_field('json-api');
    ?>
			<table id="menu" class="form-table">
				<tr valign="top"><th scope="row"><label for="json_api_full_management"><?php 
    _e('Allow management', 'jetpack');
    ?>
</label></th>
					<td><label><input type='checkbox'<?php 
    checked(Jetpack_Options::get_option('json_api_full_management'));
    ?>
 name='json_api_full_management' id='json_api_full_management' /> <?php 
    printf(__('Allow remote management of themes, plugins, and WordPress via the JSON API. (<a href="%s" title="Learn more about JSON API">More info</a>).', 'jetpack'), '//jetpack.me/support/json-api');
    ?>
</label></td></tr>

			</table>
			<p class="submit"><input type='submit' class='button-primary' value='<?php 
    echo esc_attr(__('Save configuration', 'jetpack'));
    ?>
' /></p>
		</form>
	</div>
<?php 
}
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:31,代码来源:json-api.php

示例11: fetch_options

 function fetch_options()
 {
     $options = $this->in_jetpack() ? Jetpack_Options::get_option('wpcc_options') : get_option('wpcc_options');
     $args = wp_parse_args($options, $this->default_options());
     $args['new_user_override'] = defined('WPCC_NEW_USER_OVERRIDE') ? WPCC_NEW_USER_OVERRIDE : false;
     $args['match_by_email'] = defined('WPCC_MATCH_BY_EMAIL') ? WPCC_MATCH_BY_EMAIL : true;
     return $args;
 }
开发者ID:briancompton,项目名称:knightsplaza,代码行数:8,代码来源:wpcc-sign-on.php

示例12: jetpack_enhanced_distribution_feed_id

function jetpack_enhanced_distribution_feed_id()
{
    (int) ($id = Jetpack_Options::get_option('id'));
    if ($id > 0) {
        $output = sprintf('<site xmlns="com-wordpress:feed-additions:1">%d</site>', $id);
        echo $output;
    }
}
开发者ID:kanei,项目名称:vantuch.cz,代码行数:8,代码来源:enhanced-distribution.php

示例13: __construct

 function __construct()
 {
     $this->jetpack = Jetpack::init();
     self::$block_page_rendering_for_idc = Jetpack::validate_sync_error_idc_option() && !Jetpack_Options::get_option('safe_mode_confirmed');
     if (!self::$block_page_rendering_for_idc) {
         add_action('admin_enqueue_scripts', array($this, 'additional_styles'));
     }
 }
开发者ID:netmagik,项目名称:netmagik,代码行数:8,代码来源:class.jetpack-admin-page.php

示例14: jetpack_get_freshly_pressed_data

 function jetpack_get_freshly_pressed_data()
 {
     if (is_single()) {
         wp_send_json_success(array('blog_id' => Jetpack_Options::get_option('id'), 'post_id' => get_the_ID()));
     } else {
         wp_send_json_error(array('message' => 'Not Singular'));
     }
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:8,代码来源:enhanced-distribution.php

示例15: autoupdate_core

 function autoupdate_core($update, $item)
 {
     $autoupdate_core = Jetpack_Options::get_option('autoupdate_core', false);
     if ($autoupdate_core) {
         return $autoupdate_core;
     }
     return $update;
 }
开发者ID:dtekcth,项目名称:datateknologer.se,代码行数:8,代码来源:class.jetpack-autoupdate.php


注:本文中的Jetpack_Options::get_option方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。