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


PHP Jetpack_IXR_Client::getResponse方法代码示例

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


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

示例1: is_site_public

 /**
  * Checks if the site is public and returns the result.
  * @return Boolean $is_public
  */
 protected function is_site_public()
 {
     if ($this->xmlrpc->query('jetpack.isSitePubliclyAccessible', home_url())) {
         return $this->xmlrpc->getResponse();
     }
     return false;
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:11,代码来源:class.jetpack-core-api-xmlrpc-consumer-endpoint.php

示例2:

 static function send_data($data)
 {
     Jetpack::load_xml_rpc_client();
     // add an extra parameter to the URL so we can tell it's a sync action
     $url = add_query_arg('sync', '1', Jetpack::xmlrpc_api_url());
     $rpc = new Jetpack_IXR_Client(array('url' => $url, 'user_id' => get_current_user_id(), 'timeout' => 30));
     $result = $rpc->query('jetpack.syncActions', $data);
     if (!$result) {
         return $rpc->get_jetpack_error();
     }
     return $rpc->getResponse();
 }
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:12,代码来源:class.jetpack-sync-actions.php

示例3: is_frame_nonce_valid

 /**
  * Verify that frame nonce exists, and if so, validate the nonce by calling WP.com.
  *
  * @since 4.4.0
  *
  * @return bool
  */
 public function is_frame_nonce_valid()
 {
     if (empty($_GET['frame-nonce'])) {
         return false;
     }
     Jetpack::load_xml_rpc_client();
     $xml = new Jetpack_IXR_Client();
     $xml->query('jetpack.verifyFrameNonce', sanitize_key($_GET['frame-nonce']));
     if ($xml->isError()) {
         return false;
     }
     return (bool) $xml->getResponse();
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:20,代码来源:class.frame-nonce-preview.php

示例4: reindex_status

 public function reindex_status()
 {
     $response = array('status' => 'ERROR');
     // Assume reindexing is done if it was not triggered in the first place
     if (false === Jetpack_Options::get_option('sync_bulk_reindexing')) {
         return array('status' => 'DONE');
     }
     Jetpack::load_xml_rpc_client();
     $client = new Jetpack_IXR_Client(array('user_id' => JETPACK_MASTER_USER));
     $client->query('jetpack.reindexStatus');
     if (!$client->isError()) {
         $response = $client->getResponse();
         if ('DONE' == $response['status']) {
             Jetpack_Options::delete_option('sync_bulk_reindexing');
         }
     }
     return $response;
 }
开发者ID:elliott-stocks,项目名称:jetpack,代码行数:18,代码来源:class.jetpack-sync-reindex.php

示例5: get_cloud_site_options

 public static function get_cloud_site_options($option_names)
 {
     $option_names = array_filter((array) $option_names, 'is_string');
     Jetpack::load_xml_rpc_client();
     $xml = new Jetpack_IXR_Client(array('user_id' => get_current_user_id()));
     $xml->query('jetpack.fetchSiteOptions', $option_names);
     if ($xml->isError()) {
         return array_flip($option_names);
     }
     $cloud_site_options = $xml->getResponse();
     // If we want to intentionally jumble the results to test it ...
     if (isset($_GET['spoof_identity_crisis'])) {
         foreach ($cloud_site_options as $key => $value) {
             $cloud_site_options[$key] = wp_generate_password();
         }
     }
     return $cloud_site_options;
 }
开发者ID:uniquegel,项目名称:Feminnova,代码行数:18,代码来源:class.jetpack.php

示例6: user_receives_notifications

 public function user_receives_notifications()
 {
     Jetpack::load_xml_rpc_client();
     $xml = new Jetpack_IXR_Client(array('user_id' => get_current_user_id()));
     $xml->query('jetpack.monitor.isUserInNotifications');
     if ($xml->isError()) {
         wp_die(sprintf('%s: %s', $xml->getErrorCode(), $xml->getErrorMessage()));
     }
     return $xml->getResponse();
 }
开发者ID:dot2006,项目名称:jobify,代码行数:10,代码来源:monitor.php

示例7: array

 /**
  * The function that actually handles the login!
  */
 function handle_login()
 {
     $wpcom_nonce = sanitize_key($_GET['sso_nonce']);
     $wpcom_user_id = (int) $_GET['user_id'];
     Jetpack::load_xml_rpc_client();
     $xml = new Jetpack_IXR_Client(array('user_id' => get_current_user_id()));
     $xml->query('jetpack.sso.validateResult', $wpcom_nonce, $wpcom_user_id);
     if ($xml->isError()) {
         $error_message = sanitize_text_field(sprintf('%s: %s', $xml->getErrorCode(), $xml->getErrorMessage()));
         JetpackTracking::record_user_event('sso_login_failed', array('error_message' => $error_message));
         wp_die($error_message);
     }
     $user_data = $xml->getResponse();
     if (empty($user_data)) {
         JetpackTracking::record_user_event('sso_login_failed', array('error_message' => 'invalid_response_data'));
         wp_die(__('Error, invalid response data.', 'jetpack'));
     }
     $user_data = (object) $user_data;
     $user = null;
     /**
      * Fires before Jetpack's SSO modifies the log in form.
      *
      * @module sso
      *
      * @since 2.6.0
      *
      * @param object $user_data WordPress.com User information.
      */
     do_action('jetpack_sso_pre_handle_login', $user_data);
     if (Jetpack_SSO_Helpers::is_two_step_required() && 0 === (int) $user_data->two_step_enabled) {
         $this->user_data = $user_data;
         JetpackTracking::record_user_event('sso_login_failed', array('error_message' => 'error_msg_enable_two_step'));
         /** This filter is documented in core/src/wp-includes/pluggable.php */
         do_action('wp_login_failed', $user_data->login);
         add_filter('login_message', array($this, 'error_msg_enable_two_step'));
         return;
     }
     $user_found_with = '';
     if (empty($user) && isset($user_data->external_user_id)) {
         $user_found_with = 'external_user_id';
         $user = get_user_by('id', intval($user_data->external_user_id));
         if ($user) {
             update_user_meta($user->ID, 'wpcom_user_id', $user_data->ID);
         }
     }
     // If we don't have one by wpcom_user_id, try by the email?
     if (empty($user) && Jetpack_SSO_Helpers::match_by_email()) {
         $user_found_with = 'match_by_email';
         $user = get_user_by('email', $user_data->email);
         if ($user) {
             update_user_meta($user->ID, 'wpcom_user_id', $user_data->ID);
         }
     }
     // If we've still got nothing, create the user.
     if (empty($user) && (get_option('users_can_register') || Jetpack_SSO_Helpers::new_user_override())) {
         // If not matching by email we still need to verify the email does not exist
         // or this blows up
         /**
          * If match_by_email is true, we know the email doesn't exist, as it would have
          * been found in the first pass.  If get_user_by( 'email' ) doesn't find the
          * user, then we know that email is unused, so it's safe to add.
          */
         if (Jetpack_SSO_Helpers::match_by_email() || !get_user_by('email', $user_data->email)) {
             $username = $user_data->login;
             if (username_exists($username)) {
                 $username = $user_data->login . '_' . $user_data->ID;
             }
             $tries = 0;
             while (username_exists($username)) {
                 $username = $user_data->login . '_' . $user_data->ID . '_' . mt_rand();
                 if ($tries++ >= 5) {
                     JetpackTracking::record_user_event('sso_login_failed', array('error_message' => 'could_not_create_username'));
                     wp_die(__("Error: Couldn't create suitable username.", 'jetpack'));
                 }
             }
             $user_found_with = Jetpack_SSO_Helpers::new_user_override() ? 'user_created_new_user_override' : 'user_created_users_can_register';
             $password = wp_generate_password(20);
             $user_id = wp_create_user($username, $password, $user_data->email);
             $user = get_userdata($user_id);
             $user->display_name = $user_data->display_name;
             $user->first_name = $user_data->first_name;
             $user->last_name = $user_data->last_name;
             $user->url = $user_data->url;
             $user->description = $user_data->description;
             wp_update_user($user);
             update_user_meta($user->ID, 'wpcom_user_id', $user_data->ID);
         } else {
             JetpackTracking::record_user_event('sso_login_failed', array('error_message' => 'error_msg_email_already_exists'));
             $this->user_data = $user_data;
             add_action('login_message', array($this, 'error_msg_email_already_exists'));
             return;
         }
     }
     /**
      * Fires after we got login information from WordPress.com.
      *
      * @module sso
//.........这里部分代码省略.........
开发者ID:kanei,项目名称:vantuch.cz,代码行数:101,代码来源:sso.php

示例8: get_cloud_site_options

 /**
  * Pings the WordPress.com Mirror Site for the specified options.
  *
  * @param string|array $option_names The option names to request from the WordPress.com Mirror Site
  *
  * @return array An associative array of the option values as stored in the WordPress.com Mirror Site
  */
 public static function get_cloud_site_options($option_names)
 {
     $option_names = array_filter((array) $option_names, 'is_string');
     Jetpack::load_xml_rpc_client();
     $xml = new Jetpack_IXR_Client(array('user_id' => JETPACK_MASTER_USER));
     $xml->query('jetpack.fetchSiteOptions', $option_names);
     if ($xml->isError()) {
         return array_flip($option_names);
     }
     $cloud_site_options = $xml->getResponse();
     return $cloud_site_options;
 }
开发者ID:lokenxo,项目名称:familygenerator,代码行数:19,代码来源:class.jetpack.php

示例9: array

 static function send_data($data, $codec_name, $sent_timestamp, $queue_id)
 {
     Jetpack::load_xml_rpc_client();
     $query_args = array('sync' => '1', 'codec' => $codec_name, 'timestamp' => $sent_timestamp, 'queue' => $queue_id, 'home' => get_home_url(), 'siteurl' => get_site_url());
     // Has the site opted in to IDC mitigation?
     if (Jetpack::sync_idc_optin()) {
         $query_args['idc'] = true;
     }
     $url = add_query_arg($query_args, Jetpack::xmlrpc_api_url());
     $rpc = new Jetpack_IXR_Client(array('url' => $url, 'user_id' => JETPACK_MASTER_USER, 'timeout' => 30));
     $result = $rpc->query('jetpack.syncActions', $data);
     if (!$result) {
         $error = $rpc->get_jetpack_error();
         if ('jetpack_url_mismatch' === $error->get_error_code()) {
             Jetpack_Options::update_option('sync_error_idc', Jetpack::get_sync_error_idc_option());
         }
         return $error;
     }
     return $rpc->getResponse();
 }
开发者ID:iamtakashi,项目名称:jetpack,代码行数:20,代码来源:class.jetpack-sync-actions.php

示例10: array

 function fetch_subscriber_count()
 {
     $subs_count = get_transient('wpcom_subscribers_total');
     if (FALSE === $subs_count || 'failed' == $subs_count['status']) {
         Jetpack::load_xml_rpc_client();
         $xml = new Jetpack_IXR_Client(array('user_id' => JETPACK_MASTER_USER));
         $xml->query('jetpack.fetchSubscriberCount');
         if ($xml->isError()) {
             // if we get an error from .com, set the status to failed so that we will try again next time the data is requested
             $subs_count = array('status' => 'failed', 'code' => $xml->getErrorCode(), 'message' => $xml->getErrorMessage(), 'value' => isset($subs_count['value']) ? $subs_count['value'] : 0);
         } else {
             $subs_count = array('status' => 'success', 'value' => $xml->getResponse());
         }
         set_transient('wpcom_subscribers_total', $subs_count, 3600);
         // try to cache the result for at least 1 hour
     }
     return $subs_count;
 }
开发者ID:sdh100shaun,项目名称:pantheon,代码行数:18,代码来源:subscriptions.php

示例11:

 function delete_post_by_email_address()
 {
     Jetpack::load_xml_rpc_client();
     $xml = new Jetpack_IXR_Client(array('user_id' => get_current_user_id()));
     $xml->query('jetpack.deletePostByEmailAddress');
     if ($xml->isError()) {
         echo json_encode(array('response' => 'error', 'message' => __('Unable to disable your Post By Email address. Please try again later.', 'jetpack')));
         die;
     }
     $response = $xml->getResponse();
     if (empty($response)) {
         echo json_encode(array('response' => 'error', 'message' => __('Unable to disable your Post By Email address. Please try again later.', 'jetpack')));
         die;
     }
     echo $response;
     die;
 }
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:17,代码来源:post-by-email.php

示例12: 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:vsalx,项目名称:rattieinfo,代码行数:28,代码来源:jetpack.php

示例13:

 static function send_data($data, $codec_name, $sent_timestamp, $queue_id)
 {
     Jetpack::load_xml_rpc_client();
     $url = add_query_arg(array('sync' => '1', 'codec' => $codec_name, 'timestamp' => $sent_timestamp, 'queue' => $queue_id), Jetpack::xmlrpc_api_url());
     $rpc = new Jetpack_IXR_Client(array('url' => $url, 'user_id' => JETPACK_MASTER_USER, 'timeout' => 30));
     $result = $rpc->query('jetpack.syncActions', $data);
     if (!$result) {
         return $rpc->get_jetpack_error();
     }
     return $rpc->getResponse();
 }
开发者ID:kanei,项目名称:vantuch.cz,代码行数:11,代码来源:class.jetpack-sync-actions.php

示例14: monitor_get_last_downtime

 public function monitor_get_last_downtime()
 {
     Jetpack::load_xml_rpc_client();
     $xml = new Jetpack_IXR_Client(array('user_id' => get_current_user_id()));
     $xml->query('jetpack.monitor.getLastDowntime');
     if ($xml->isError()) {
         return new WP_Error('monitor-downtime', $xml->getErrorMessage());
     }
     return $xml->getResponse();
 }
开发者ID:pcuervo,项目名称:wp-carnival,代码行数:10,代码来源:monitor.php

示例15:

 function register_via_jetpack()
 {
     if (!class_exists('Jetpack')) {
         return false;
     }
     Jetpack::load_xml_rpc_client();
     $xml = new Jetpack_IXR_Client(array('user_id' => get_current_user_id()));
     $xml->query('vaultpress.registerSite');
     if (!$xml->isError()) {
         return $xml->getResponse();
     }
     return new WP_Error($xml->getErrorCode(), $xml->getErrorMessage());
 }
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:13,代码来源:vaultpress.php


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