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


PHP Jetpack::update_option方法代码示例

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


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

示例1: authorize

 function authorize()
 {
     $data = stripslashes_deep($_GET);
     $args = array();
     do {
         $jetpack = Jetpack::init();
         $role = $jetpack->translate_current_user_to_role();
         if (!$role) {
             Jetpack::state('error', 'no_role');
             break;
         }
         $cap = $jetpack->translate_role_to_cap($role);
         if (!$cap) {
             Jetpack::state('error', 'no_cap');
             break;
         }
         check_admin_referer("jetpack-authorize_{$role}");
         if (!empty($data['error'])) {
             Jetpack::state('error', $data['error']);
             break;
         }
         if (empty($data['state'])) {
             Jetpack::state('error', 'no_state');
             break;
         }
         if (!ctype_digit($data['state'])) {
             Jetpack::state('error', 'invalid_state');
             break;
         }
         $current_user_id = get_current_user_id();
         if ($current_user_id != $data['state']) {
             Jetpack::state('error', 'wrong_state');
             break;
         }
         if (empty($data['code'])) {
             Jetpack::state('error', 'no_code');
             break;
         }
         $token = $this->get_token($data);
         if (is_wp_error($token)) {
             if ($error = $token->get_error_code()) {
                 Jetpack::state('error', $error);
             } else {
                 Jetpack::state('error', 'invalid_token');
             }
             Jetpack::state('error_description', $token->get_error_message());
             break;
         }
         if (!$token) {
             Jetpack::state('error', 'no_token');
             break;
         }
         Jetpack::update_option('user_token', sprintf('%s.%d', $token, $current_user_id), true);
         Jetpack::state('message', 'authorized');
         if ($active_modules = Jetpack::get_option('active_modules')) {
             Jetpack::delete_option('active_modules');
             Jetpack::activate_default_modules(999, 1, $active_modules);
         } else {
             Jetpack::activate_default_modules();
         }
         // Start nonce cleaner
         wp_clear_scheduled_hook('jetpack_clean_nonces');
         wp_schedule_event(time(), 'hourly', 'jetpack_clean_nonces');
     } while (false);
     wp_safe_redirect(Jetpack::admin_url());
     exit;
 }
开发者ID:Bencheci,项目名称:blueRavenStudiosProject,代码行数:67,代码来源:jetpack.php

示例2: options_save_tumblr

 function options_save_tumblr()
 {
     // Nonce check
     check_admin_referer('save_tumblr_blog_' . $_REQUEST['connection']);
     $id = $_POST['connection'];
     $options = array('tumblr_base_hostname' => $_POST['selected_id']);
     Jetpack::load_xml_rpc_client();
     $xml = new Jetpack_IXR_Client();
     $xml->query('jetpack.setPublicizeOptions', $id, $options);
     if (!$xml->isError()) {
         $response = $xml->getResponse();
         Jetpack::update_option('publicize_connections', $response);
     }
     $this->globalization();
 }
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:15,代码来源:publicize-jetpack.php

示例3: set_time_diff

 public static function set_time_diff(&$response, $force_set = false)
 {
     $code = wp_remote_retrieve_response_code($response);
     // Only trust the Date header on some responses
     if (200 != $code && 304 != $code && 400 != $code && 401 != $code) {
         return;
     }
     if (!($date = wp_remote_retrieve_header($response, 'date'))) {
         return;
     }
     if (0 >= ($time = (int) strtotime($date))) {
         return;
     }
     $time_diff = $time - time();
     if ($force_set) {
         // during register
         Jetpack::update_option('time_diff', $time_diff);
     } else {
         // otherwise
         $old_diff = Jetpack::get_option('time_diff');
         if (false === $old_diff || abs($time_diff - (int) $old_diff) > 10) {
             Jetpack::update_option('time_diff', $time_diff);
         }
     }
 }
开发者ID:mostafiz93,项目名称:PrintfScanf,代码行数:25,代码来源:class.jetpack-client.php

示例4: check_privacy

 public static function check_privacy($file)
 {
     static $is_site_publicly_accessible = null;
     if (is_null($is_site_publicly_accessible)) {
         $is_site_publicly_accessible = false;
         Jetpack::load_xml_rpc_client();
         $rpc = new Jetpack_IXR_Client();
         $success = $rpc->query('jetpack.isSitePubliclyAccessible', home_url());
         if ($success) {
             $response = $rpc->getResponse();
             if ($response) {
                 $is_site_publicly_accessible = true;
             }
         }
         Jetpack::update_option('public', (int) $is_site_publicly_accessible);
     }
     if ($is_site_publicly_accessible) {
         return;
     }
     $module_slug = self::get_module_slug($file);
     $privacy_checks = Jetpack::state('privacy_checks');
     if (!$privacy_checks) {
         $privacy_checks = $module_slug;
     } else {
         $privacy_checks .= ",{$module_slug}";
     }
     Jetpack::state('privacy_checks', $privacy_checks);
 }
开发者ID:uniquegel,项目名称:Feminnova,代码行数:28,代码来源:class.jetpack.php


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