• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP WPCOM_JSON_API类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: callback

 function callback($path = '', $blog_id = 0)
 {
     global $wpdb;
     if ('mine' === $blog_id) {
         $api = WPCOM_JSON_API::init();
         if (!$api->token_details || empty($api->token_details['blog_id'])) {
             return new WP_Error('authorization_required', 'An active access token must be used to query information about the current blog.', 403);
         }
         $blog_id = $api->token_details['blog_id'];
     }
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     $response = $this->build_current_site_response();
     do_action('wpcom_json_api_objects', 'sites');
     return $response;
 }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:18,代码来源:class.wpcom-json-api-get-site-endpoint.php


示例2: callback

 function callback($path = '', $blog_id = 0)
 {
     if ('mine' === $blog_id) {
         $api = WPCOM_JSON_API::init();
         if (!$api->token_details || empty($api->token_details['blog_id'])) {
             return new WP_Error('authorization_required', 'An active access token must be used to query information about the current blog.', 403);
         }
         $blog_id = $api->token_details['blog_id'];
     }
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     // TODO: enable this when we can do so without being interfered with by
     // other endpoints that might be wrapping this one.
     // Uncomment and see failing test: test_jetpack_site_should_have_true_jetpack_property_via_site_meta
     // $this->filter_fields_and_options();
     $response = $this->build_current_site_response();
     /** This action is documented in json-endpoints/class.wpcom-json-api-site-settings-endpoint.php */
     do_action('wpcom_json_api_objects', 'sites');
     return $response;
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:22,代码来源:class.wpcom-json-api-get-site-endpoint.php


示例3: write_post


//.........这里部分代码省略.........
         foreach ($terms as $term) {
             if (!ctype_digit($term)) {
                 // skip anything that doesn't look like an ID
                 continue;
             }
             $term = (int) $term;
             $term_info = get_term_by('id', $term, $taxonomy, ARRAY_A);
             if ($term_info && !is_wp_error($term_info)) {
                 if ($is_hierarchical) {
                     // Categories must be added by ID
                     $tax_input[$taxonomy][] = $term;
                 } else {
                     // Tags must be added by name
                     $tax_input[$taxonomy][] = $term_info['name'];
                 }
             }
         }
     }
     if ((isset($input['categories']) || isset($input['categories_by_id'])) && empty($tax_input['category']) && 'revision' !== $post_type->name) {
         $tax_input['category'][] = get_option('default_category');
     }
     unset($input['tags'], $input['categories'], $input['tags_by_id'], $input['categories_by_id']);
     $insert = array();
     if (!empty($input['slug'])) {
         $insert['post_name'] = $input['slug'];
         unset($input['slug']);
     }
     if (isset($input['discussion'])) {
         $discussion = (array) $input['discussion'];
         foreach (array('comment', 'ping') as $discussion_type) {
             $discussion_open = sprintf('%ss_open', $discussion_type);
             $discussion_status = sprintf('%s_status', $discussion_type);
             if (isset($discussion[$discussion_open])) {
                 $is_open = WPCOM_JSON_API::is_truthy($discussion[$discussion_open]);
                 $discussion[$discussion_status] = $is_open ? 'open' : 'closed';
             }
             if (in_array($discussion[$discussion_status], array('open', 'closed'))) {
                 $insert[$discussion_status] = $discussion[$discussion_status];
             }
         }
     }
     unset($input['discussion']);
     if (isset($input['menu_order'])) {
         $insert['menu_order'] = $input['menu_order'];
         unset($input['menu_order']);
     }
     if (isset($input['publicize'])) {
         $publicize = $input['publicize'];
         unset($input['publicize']);
     }
     if (isset($input['publicize_message'])) {
         $publicize_custom_message = $input['publicize_message'];
         unset($input['publicize_message']);
     }
     if (isset($input['featured_image'])) {
         $featured_image = trim($input['featured_image']);
         $delete_featured_image = empty($featured_image);
         unset($input['featured_image']);
     }
     if (isset($input['metadata'])) {
         $metadata = $input['metadata'];
         unset($input['metadata']);
     }
     if (isset($input['likes_enabled'])) {
         $likes = $input['likes_enabled'];
         unset($input['likes_enabled']);
开发者ID:brooklyntri,项目名称:btc-plugins,代码行数:67,代码来源:class.wpcom-json-api-update-post-v1-2-endpoint.php


示例4: update_settings


//.........这里部分代码省略.........
                 // settings are stored as on|off
                 $coerce_value = $value ? 'on' : 'off';
                 if (update_option($key, $coerce_value)) {
                     $updated[$key] = $value;
                 }
                 break;
             case 'wga':
                 if (!isset($value['code']) || !preg_match('/^$|^UA-[\\d-]+$/i', $value['code'])) {
                     return new WP_Error('invalid_code', 'Invalid UA ID');
                 }
                 $wga = get_option('wga', array());
                 $wga['code'] = $value['code'];
                 // maintain compatibility with wp-google-analytics
                 if (update_option('wga', $wga)) {
                     $updated[$key] = $value;
                 }
                 $enabled_or_disabled = $wga['code'] ? 'enabled' : 'disabled';
                 do_action('jetpack_bump_stats_extras', 'google-analytics', $enabled_or_disabled);
                 $business_plugins = WPCOM_Business_Plugins::instance();
                 $business_plugins->activate_plugin('wp-google-analytics');
                 break;
             case 'jetpack_comment_likes_enabled':
                 // settings are stored as 1|0
                 $coerce_value = (int) $value;
                 if (update_option($key, $coerce_value)) {
                     $updated[$key] = $value;
                 }
                 break;
                 // Sharing options
             // Sharing options
             case 'sharing_button_style':
             case 'sharing_show':
             case 'sharing_open_links':
                 $sharing_options[preg_replace('/^sharing_/', '', $key)] = $value;
                 break;
             case 'sharing_label':
                 $sharing_options[$key] = $value;
                 break;
                 // Keyring token option
             // Keyring token option
             case 'eventbrite_api_token':
                 // These options can only be updated for sites hosted on WordPress.com
                 if (defined('IS_WPCOM') && IS_WPCOM) {
                     if (empty($value) || WPCOM_JSON_API::is_falsy($value)) {
                         if (delete_option($key)) {
                             $updated[$key] = null;
                         }
                     } else {
                         if (update_option($key, $value)) {
                             $updated[$key] = (int) $value;
                         }
                     }
                 }
                 break;
                 // no worries, we've already whitelisted and casted arguments above
             // no worries, we've already whitelisted and casted arguments above
             default:
                 if (update_option($key, $value)) {
                     $updated[$key] = $value;
                 }
         }
     }
     if (count($jetpack_relatedposts_options)) {
         // track new jetpack_relatedposts options against old
         $old_relatedposts_options = Jetpack_Options::get_option('relatedposts');
         if (Jetpack_Options::update_option('relatedposts', $jetpack_relatedposts_options)) {
             foreach ($jetpack_relatedposts_options as $key => $value) {
                 if ($value !== $old_relatedposts_options[$key]) {
                     $updated['jetpack_relatedposts_' . $key] = $value;
                 }
             }
         }
     }
     if (!empty($sharing_options) && class_exists('Sharing_Service')) {
         $ss = new Sharing_Service();
         // Merge current values with updated, since Sharing_Service expects
         // all values to be included when updating
         $current_sharing_options = $ss->get_global_options();
         foreach ($current_sharing_options as $key => $val) {
             if (!isset($sharing_options[$key])) {
                 $sharing_options[$key] = $val;
             }
         }
         $updated_social_options = $ss->set_global_options($sharing_options);
         if (isset($input['sharing_button_style'])) {
             $updated['sharing_button_style'] = (string) $updated_social_options['button_style'];
         }
         if (isset($input['sharing_label'])) {
             // Sharing_Service won't report label as updated if set to default
             $updated['sharing_label'] = (string) $sharing_options['sharing_label'];
         }
         if (isset($input['sharing_show'])) {
             $updated['sharing_show'] = (array) $updated_social_options['show'];
         }
         if (isset($input['sharing_open_links'])) {
             $updated['sharing_open_links'] = (string) $updated_social_options['open_links'];
         }
     }
     return array('updated' => $updated);
 }
开发者ID:annbransom,项目名称:techishowl_prod_backup,代码行数:101,代码来源:class.wpcom-json-api-site-settings-endpoint.php


示例5: __construct

 protected function __construct()
 {
     $this->api = WPCOM_JSON_API::init();
 }
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:4,代码来源:class.json-api-links.php


示例6: json_api

 function json_api($args = array())
 {
     $json_api_args = $args[0];
     $verify_api_user_args = $args[1];
     $method = (string) $json_api_args[0];
     $url = (string) $json_api_args[1];
     $post_body = is_null($json_api_args[2]) ? null : (string) $json_api_args[2];
     $my_id = (int) $json_api_args[3];
     $user_details = (array) $json_api_args[4];
     if (!$verify_api_user_args) {
         $user_id = 0;
     } elseif ('internal' === $verify_api_user_args[0]) {
         $user_id = (int) $verify_api_user_args[1];
         if ($user_id) {
             $user = get_user_by('id', $user_id);
             if (!$user || is_wp_error($user)) {
                 return false;
             }
         }
     } else {
         $user_id = call_user_func(array($this, 'test_api_user_code'), $verify_api_user_args);
         if (!$user_id) {
             return false;
         }
     }
     /* debugging
     		error_log( "-- begin json api via jetpack debugging -- " );
     		error_log( "METHOD: $method" );
     		error_log( "URL: $url" );
     		error_log( "POST BODY: $post_body" );
     		error_log( "MY JETPACK ID: $my_id" );
     		error_log( "VERIFY_ARGS: " . print_r( $verify_api_user_args, 1 ) );
     		error_log( "VERIFIED USER_ID: " . (int) $user_id );
     		error_log( "-- end json api via jetpack debugging -- " );
     		*/
     $old_user = wp_get_current_user();
     wp_set_current_user($user_id);
     $token = Jetpack_Data::get_access_token(get_current_user_id());
     if (!$token || is_wp_error($token)) {
         return false;
     }
     define('REST_API_REQUEST', true);
     define('WPCOM_JSON_API__BASE', 'public-api.wordpress.com/rest/v1');
     // needed?
     require_once ABSPATH . 'wp-admin/includes/admin.php';
     require_once dirname(__FILE__) . '/class.json-api.php';
     $api = WPCOM_JSON_API::init($method, $url, $post_body);
     $api->token_details['user'] = $user_details;
     require_once dirname(__FILE__) . '/class.json-api-endpoints.php';
     $display_errors = ini_set('display_errors', 0);
     ob_start();
     $content_type = $api->serve(false);
     $output = ob_get_clean();
     ini_set('display_errors', $display_errors);
     $nonce = wp_generate_password(10, false);
     $hmac = hash_hmac('md5', $nonce . $output, $token->secret);
     wp_set_current_user(isset($old_user->ID) ? $old_user->ID : 0);
     return array((string) $output, (string) $nonce, (string) $hmac);
 }
开发者ID:estrategasdigitales,项目名称:flazam,代码行数:59,代码来源:class.jetpack-xmlrpc-server.php


示例7: cast_and_filter_item


//.........这里部分代码省略.........
                     $next_type = array_shift($types);
                     return $this->cast_and_filter_item($return, $next_type, $key, $value, $types, $for_output);
                 }
             }
             if (isset($type['children'])) {
                 $children = array();
                 foreach ((array) $value as $k => $child) {
                     $this->cast_and_filter_item($children, $type['children'], $k, $child, array(), $for_output);
                 }
                 $return[$key] = (array) $children;
                 break;
             }
             $return[$key] = (array) $value;
             break;
         case 'iso 8601 datetime':
         case 'datetime':
             // (string)s
             $dates = $this->parse_date((string) $value);
             if ($for_output) {
                 $return[$key] = $this->format_date($dates[1], $dates[0]);
             } else {
                 list($return[$key], $return["{$key}_gmt"]) = $dates;
             }
             break;
         case 'float':
             $return[$key] = (double) $value;
             break;
         case 'int':
         case 'integer':
             $return[$key] = (int) $value;
             break;
         case 'bool':
         case 'boolean':
             $return[$key] = (bool) WPCOM_JSON_API::is_truthy($value);
             break;
         case 'object':
             // Fallback object -> false
             if (is_scalar($value) || is_null($value)) {
                 if (!empty($types[0]) && 'false' === $types[0]['type']) {
                     return $this->cast_and_filter_item($return, 'false', $key, $value, $types, $for_output);
                 }
             }
             if (isset($type['children'])) {
                 $children = array();
                 foreach ((array) $value as $k => $child) {
                     $this->cast_and_filter_item($children, $type['children'], $k, $child, array(), $for_output);
                 }
                 $return[$key] = (object) $children;
                 break;
             }
             if (isset($type['subtype'])) {
                 return $this->cast_and_filter_item($return, $type['subtype'], $key, $value, $types, $for_output);
             }
             $return[$key] = (object) $value;
             break;
         case 'post':
             $return[$key] = (object) $this->cast_and_filter($value, $this->post_object_format, false, $for_output);
             break;
         case 'comment':
             $return[$key] = (object) $this->cast_and_filter($value, $this->comment_object_format, false, $for_output);
             break;
         case 'tag':
         case 'category':
             $docs = array('ID' => '(int)', 'name' => '(string)', 'slug' => '(string)', 'description' => '(HTML)', 'post_count' => '(int)', 'meta' => '(object)');
             if ('category' === $type['type']) {
                 $docs['parent'] = '(int)';
开发者ID:frontend-labs,项目名称:post-template,代码行数:67,代码来源:class.json-api-endpoints.php


示例8: callback

 function callback($path = '', $blog_id = 0)
 {
     global $wpdb;
     if ('mine' === $blog_id) {
         $api = WPCOM_JSON_API::init();
         if (!$api->token_details || empty($api->token_details['blog_id'])) {
             return new WP_Error('authorization_required', 'An active access token must be used to query information about the current blog.', 403);
         }
         $blog_id = $api->token_details['blog_id'];
     }
     $blog_id = $this->api->switch_to_blog_and_validate_user($this->api->get_blog_id($blog_id));
     if (is_wp_error($blog_id)) {
         return $blog_id;
     }
     $is_user_logged_in = is_user_logged_in();
     $response = array();
     foreach (array_keys($this->response_format) as $key) {
         switch ($key) {
             case 'ID':
                 $response[$key] = (int) $this->api->get_blog_id_for_output();
                 break;
             case 'name':
                 $response[$key] = (string) get_bloginfo('name');
                 break;
             case 'description':
                 $response[$key] = (string) get_bloginfo('description');
                 break;
             case 'URL':
                 $response[$key] = (string) home_url();
                 break;
             case 'jetpack':
                 if ($is_user_logged_in) {
                     $response[$key] = false;
                 }
                 // magic
                 break;
             case 'post_count':
                 if ($is_user_logged_in) {
                     $response[$key] = (int) $wpdb->get_var("SELECT COUNT(*) FROM {$wpdb->posts} WHERE post_status = 'publish'");
                 }
                 break;
             case 'lang':
                 if ($is_user_logged_in) {
                     $response[$key] = (string) get_bloginfo('language');
                 }
                 break;
             case 'meta':
                 $response[$key] = (object) array('links' => (object) array('self' => (string) $this->get_site_link($this->api->get_blog_id_for_output()), 'help' => (string) $this->get_site_link($this->api->get_blog_id_for_output(), 'help'), 'posts' => (string) $this->get_site_link($this->api->get_blog_id_for_output(), 'posts/'), 'comments' => (string) $this->get_site_link($this->api->get_blog_id_for_output(), 'comments/')));
                 break;
         }
     }
     do_action('wpcom_json_api_objects', 'sites');
     return $response;
 }
开发者ID:vsalx,项目名称:rattieinfo,代码行数:54,代码来源:class.json-api-endpoints.php


示例9: cast_and_filter_item


//.........这里部分代码省略.........
                     $next_type = array_shift($types);
                     return $this->cast_and_filter_item($return, $next_type, $key, $value, $types, $for_output);
                 }
             }
             if (isset($type['children'])) {
                 $children = array();
                 foreach ((array) $value as $k => $child) {
                     $this->cast_and_filter_item($children, $type['children'], $k, $child, array(), $for_output);
                 }
                 $return[$key] = (array) $children;
                 break;
             }
             $return[$key] = (array) $value;
             break;
         case 'iso 8601 datetime':
         case 'datetime':
             // (string)s
             $dates = $this->parse_date((string) $value);
             if ($for_output) {
                 $return[$key] = $this->format_date($dates[1], $dates[0]);
             } else {
                 list($return[$key], $return["{$key}_gmt"]) = $dates;
             }
             break;
         case 'float':
             $return[$key] = (double) $value;
             break;
         case 'int':
         case 'integer':
             $return[$key] = (int) $value;
             break;
         case 'bool':
         case 'boolean':
             $return[$key] = (bool) WPCOM_JSON_API::is_truthy($value);
             break;
         case 'object':
             // Fallback object -> false
             if (is_scalar($value) || is_null($value)) {
                 if (!empty($types[0]) && 'false' === $types[0]['type']) {
                     return $this->cast_and_filter_item($return, 'false', $key, $value, $types, $for_output);
                 }
             }
             if (isset($type['children'])) {
                 $children = array();
                 foreach ((array) $value as $k => $child) {
                     $this->cast_and_filter_item($children, $type['children'], $k, $child, array(), $for_output);
                 }
                 $return[$key] = (object) $children;
                 break;
             }
             if (isset($type['subtype'])) {
                 return $this->cast_and_filter_item($return, $type['subtype'], $key, $value, $types, $for_output);
             }
             $return[$key] = (object) $value;
             break;
         case 'post':
             $return[$key] = (object) $this->cast_and_filter($value, $this->post_object_format, false, $for_output);
             break;
         case 'comment':
             $return[$key] = (object) $this->cast_and_filter($value, $this->comment_object_format, false, $for_output);
             break;
         case 'tag':
         case 'category':
             $docs = array('ID' => '(int)', 'name' => '(string)', 'slug' => '(string)', 'description' => '(HTML)', 'post_count' => '(int)', 'meta' => '(object)');
             if ('category' === $type['type']) {
                 $docs['parent'] = '(int)';
开发者ID:spielhoelle,项目名称:amnesty,代码行数:67,代码来源:class.json-api-endpoints.php


示例10: json_api

 function json_api($args = array())
 {
     $json_api_args = $args[0];
     $verify_api_user_args = $args[1];
     $method = (string) $json_api_args[0];
     $url = (string) $json_api_args[1];
     $post_body = is_null($json_api_args[2]) ? null : (string) $json_api_args[2];
     $user_details = (array) $json_api_args[4];
     $locale = (string) $json_api_args[5];
     if (!$verify_api_user_args) {
         $user_id = 0;
     } elseif ('internal' === $verify_api_user_args[0]) {
         $user_id = (int) $verify_api_user_args[1];
         if ($user_id) {
             $user = get_user_by('id', $user_id);
             if (!$user || is_wp_error($user)) {
                 return false;
             }
         }
     } else {
         $user_id = call_user_func(array($this, 'test_api_user_code'), $verify_api_user_args);
         if (!$user_id) {
             return false;
         }
     }
     /* debugging
     		error_log( "-- begin json api via jetpack debugging -- " );
     		error_log( "METHOD: $method" );
     		error_log( "URL: $url" );
     		error_log( "POST BODY: $post_body" );
     		error_log( "VERIFY_ARGS: " . print_r( $verify_api_user_args, 1 ) );
     		error_log( "VERIFIED USER_ID: " . (int) $user_id );
     		error_log( "-- end json api via jetpack debugging -- " );
     		*/
     if ('en' !== $locale) {
         // .org mo files are named slightly different from .com, and all we have is this the locale -- try to guess them.
         $new_locale = $locale;
         if (strpos($locale, '-') !== false) {
             $pieces = explode('-', $locale);
             $new_locale = $locale_pieces[0];
             $new_locale .= !empty($locale_pieces[1]) ? '_' . strtoupper($locale_pieces[1]) : '';
         } else {
             // .com might pass 'fr' because thats what our language files are named as, where core seems
             // to do fr_FR - so try that if we don't think we can load the file.
             if (!file_exists(WP_LANG_DIR . '/' . $locale . '.mo')) {
                 $new_locale = $locale . '_' . strtoupper($locale);
             }
         }
         if (file_exists(WP_LANG_DIR . '/' . $new_locale . '.mo')) {
             unload_textdomain('default');
             load_textdomain('default', WP_LANG_DIR . '/' . $new_locale . '.mo');
         }
     }
     $old_user = wp_get_current_user();
     wp_set_current_user($user_id);
     $token = Jetpack_Data::get_access_token(get_current_user_id());
     if (!$token || is_wp_error($token)) {
         return false;
     }
     define('REST_API_REQUEST', true);
     define('WPCOM_JSON_API__BASE', 'public-api.wordpress.com/rest/v1');
     // needed?
     require_once ABSPATH . 'wp-admin/includes/admin.php';
     require_once JETPACK__PLUGIN_DIR . 'class.json-api.php';
     $api = WPCOM_JSON_API::init($method, $url, $post_body);
     $api->token_details['user'] = $user_details;
     require_once JETPACK__PLUGIN_DIR . 'class.json-api-endpoints.php';
     $display_errors = ini_set('display_errors', 0);
     ob_start();
     $content_type = $api->serve(false);
     $output = ob_get_clean();
     ini_set('display_errors', $display_errors);
     $nonce = wp_generate_password(10, false);
     $hmac = hash_hmac('md5', $nonce . $output, $token->secret);
     wp_set_current_user(isset($old_user->ID) ? $old_user->ID : 0);
     return array((string) $output, (string) $nonce, (string) $hmac);
 }
开发者ID:jordankoschei,项目名称:jordankoschei-dot-com,代码行数:77,代码来源:class.jetpack-xmlrpc-server.php


示例11: update_settings


//.........这里部分代码省略.........
                 break;
             case 'jetpack_testimonial':
             case 'jetpack_portfolio':
             case 'jetpack_comment_likes_enabled':
                 // settings are stored as 1|0
                 $coerce_value = (int) $value;
                 if (update_option($key, $coerce_value)) {
                     $updated[$key] = (bool) $value;
                 }
                 break;
             case 'jetpack_testimonial_posts_per_page':
             case 'jetpack_portfolio_posts_per_page':
                 // settings are stored as numeric
                 $coerce_value = (int) $value;
                 if (update_option($key, $coerce_value)) {
                     $updated[$key] = $coerce_value;
                 }
                 break;
                 // Sharing options
             // Sharing options
             case 'sharing_button_style':
             case 'sharing_show':
             case 'sharing_open_links':
                 $sharing_options[preg_replace('/^sharing_/', '', $key)] = $value;
                 break;
             case 'sharing_label':
                 $sharing_options[$key] = $value;
                 break;
                 // Keyring token option
             // Keyring token option
             case 'eventbrite_api_token':
                 // These options can only be updated for sites hosted on WordPress.com
                 if (defined('IS_WPCOM') && IS_WPCOM) {
                     if (empty($value) || WPCOM_JSON_API::is_falsy($value)) {
                         if (delete_option($key)) {
                             $updated[$key] = null;
                         }
                     } else {
                         if (update_option($key, $value)) {
                             $updated[$key] = (int) $value;
                         }
                     }
                 }
                 break;
             case 'holidaysnow':
                 if (empty($value) || WPCOM_JSON_API::is_falsy($value)) {
                     if (function_exists('jetpack_holiday_snow_option_name') && delete_option(jetpack_holiday_snow_option_name())) {
                         $updated[$key] = false;
                     }
                 } else {
                     if (function_exists('jetpack_holiday_snow_option_name') && update_option(jetpack_holiday_snow_option_name(), 'letitsnow')) {
                         $updated[$key] = true;
                     }
                 }
                 break;
             case 'timezone_string':
                 // Map UTC+- timezones to gmt_offsets and set timezone_string to empty
                 // https://github.com/WordPress/WordPress/blob/4.4.2/wp-admin/options.php#L175
                 if (!empty($value) && preg_match('/^UTC[+-]/', $value)) {
                     $gmt_offset = preg_replace('/UTC\\+?/', '', $value);
                     if (update_option('gmt_offset', $gmt_offset)) {
                         $updated['gmt_offset'] = $gmt_offset;
                     }
                     $value = '';
                 }
                 // Always set timezone_string either with the given value or with an
开发者ID:kanei,项目名称:vantuch.cz,代码行数:67,代码来源:class.wpcom-json-api-site-settings-endpoint.php


示例12: init

	static function init( $method = null, $url = null, $post_body = null ) {
		if ( !self::$self ) {
			$class = function_exists( 'get_called_class' ) ? get_called_class() : __CLASS__;
			self::$self = new $class( $method, $url, $post_body );
		}
		return self::$self;
	}
开发者ID:kevinreilly,项目名称:mendelements.com,代码行数:7,代码来源:class.json-api.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP WPFB_Core类代码示例发布时间:2022-05-23
下一篇:
PHP WPCF_Roles类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap