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


PHP WP_HTTP_IXR_Client类代码示例

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


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

示例1: __call

 public function __call($name, $arguments)
 {
     // Make sure no error already exists
     if ($this->error) {
         return new WP_Error('invalid-request', __('You must provide a subdomain and API key for your Infusionsoft application.', 'infusionsoftwp'));
     }
     // Get the full method name with the service and method
     $method = ucfirst($name) . 'Service' . '.' . array_shift($arguments);
     $arguments = array_merge(array($method, $this->api_key), $arguments);
     // Initialize the client
     $client = new WP_HTTP_IXR_Client('https://' . $this->subdomain . '.infusionsoft.com/api/xmlrpc');
     // Call the function and return any error that happens
     if (!call_user_func_array(array($client, 'query'), $arguments)) {
         return new WP_Error('invalid-request', $client->getErrorMessage());
     }
     // Pass the response directly to the user
     return $client->getResponse();
 }
开发者ID:phupx,项目名称:genco,代码行数:18,代码来源:infusionsoft.php

示例2: wprt_screen

function wprt_screen()
{
    echo '<div class="wrap"><h2>WP Remote Test</h2>';
    $action = isset($_POST['action']) ? $_POST['action'] : null;
    $url = isset($_POST['url']) ? $_POST['url'] : null;
    $method = isset($_POST['method']) ? $_POST['method'] : null;
    $useragent = isset($_POST['useragent']) ? $_POST['useragent'] : null;
    if ($action == 'xmlrpc') {
        echo "<h3>Results</h3>";
        require_once ABSPATH . WPINC . '/class-IXR.php';
        require_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
        $client = new WP_HTTP_IXR_Client($url);
        $client->useragent = $useragent;
        if (!$client->query($method)) {
            print_r($client->error);
        } else {
            print_r($client->getResponse());
        }
    }
    ?>
  <h3>XML/RPC (WP_HTTP_IXR_Client)</h3>
  <form id="posts-filter" action="" method="POST">
    <p>
      <label>URL</label><br />
      <input type="text" name="url" style="width: 360px;" value="http://apps.meow.fr/xmlrpc.php"><br />
    </p>
    <p>
      <label>Method</label><br />
      <input type="text" name="method" style="width: 360px;" value="meow_sales.auth"><br />
    </p>
    <p>
      <label>User Agent</label><br />
      <input type="text" name="useragent" style="width: 360px;" value="MeowApps"><br />
    </p>
    <input type="hidden" name="action" value="xmlrpc">
    <input type="submit" class="button" value="Query">
  </form>
  <?php 
    echo '</div>';
}
开发者ID:jordymeow,项目名称:wp-remote-test,代码行数:40,代码来源:wp-remote-test.php

示例3: weblog_ping

/**
 * Send a pingback.
 *
 * @since 1.2.0
 *
 * @global string $wp_version
 *
 * @param string $server Host of blog to connect to.
 * @param string $path Path to send the ping.
 */
function weblog_ping($server = '', $path = '')
{
    global $wp_version;
    include_once ABSPATH . WPINC . '/class-IXR.php';
    include_once ABSPATH . WPINC . '/class-wp-http-ixr-client.php';
    // using a timeout of 3 seconds should be enough to cover slow servers
    $client = new WP_HTTP_IXR_Client($server, !strlen(trim($path)) || '/' == $path ? false : $path);
    $client->timeout = 3;
    $client->useragent .= ' -- WordPress/' . $wp_version;
    // when set to true, this outputs debug messages by itself
    $client->debug = false;
    $home = trailingslashit(home_url());
    if (!$client->query('weblogUpdates.extendedPing', get_option('blogname'), $home, get_bloginfo('rss2_url'))) {
        // then try a normal ping
        $client->query('weblogUpdates.ping', get_option('blogname'), $home);
    }
}
开发者ID:hadywisam,项目名称:WordPress,代码行数:27,代码来源:comment-functions.php

示例4: wr2x_validate_pro

function wr2x_validate_pro($subscr_id)
{
    if (empty($subscr_id)) {
        delete_option('wr2x_pro_serial', "");
        delete_option('wr2x_pro_status', "");
        set_transient('wr2x_validated', false, 0);
        return false;
    }
    require_once wr2x_get_wordpress_root() . WPINC . '/class-IXR.php';
    require_once wr2x_get_wordpress_root() . WPINC . '/class-wp-http-ixr-client.php';
    $client = new WP_HTTP_IXR_Client('http://apps.meow.fr/xmlrpc.php');
    if (!$client->query('meow_sales.auth', $subscr_id, 'retina', get_site_url())) {
        update_option('wr2x_pro_serial', "");
        update_option('wr2x_pro_status', "A network error: " . $client->getErrorMessage());
        set_transient('wr2x_validated', false, 0);
        return false;
    }
    $post = $client->getResponse();
    if (!$post['success']) {
        if ($post['message_code'] == "NO_SUBSCRIPTION") {
            $status = __("Your serial does not seem right.");
        } else {
            if ($post['message_code'] == "NOT_ACTIVE") {
                $status = __("Your subscription is not active.");
            } else {
                if ($post['message_code'] == "TOO_MANY_URLS") {
                    $status = __("Too many URLs are linked to your subscription.");
                } else {
                    $status = "There is a problem with your subscription.";
                }
            }
        }
        update_option('wr2x_pro_serial', "");
        update_option('wr2x_pro_status', $status);
        set_transient('wr2x_validated', false, 0);
        return false;
    }
    set_transient('wr2x_validated', $subscr_id, 3600 * 24 * 100);
    update_option('wr2x_pro_serial', $subscr_id);
    update_option('wr2x_pro_status', __("Your subscription is enabled."));
    return true;
}
开发者ID:radscheit,项目名称:unicorn,代码行数:42,代码来源:wp-retina-2x.php

示例5: _send_request

 /**
  * Send an XMLRPC request to the Catalyst API.
  *
  * @param string $request
  * @param array  $args
  *
  * @return bool|IXR_Error
  */
 protected function _send_request($request, $args)
 {
     $client = new WP_HTTP_IXR_Client(trailingslashit(CATALYST_URL) . 'xmlrpc.php');
     $response = $client->query("catalyst.{$request}", $args);
     if (false === $response) {
         // store error for use in implementation
         $this->request_error = isset($client->error->message) ? $client->error->message : '';
         return $client->error;
     }
     return $client->getResponse();
 }
开发者ID:Neminath,项目名称:lastmile,代码行数:19,代码来源:class-catalyst-api.php

示例6: infusionsoft_lists

 function infusionsoft_lists()
 {
     // Include WordPress libraries to handle XML-RPC
     require_once ABSPATH . '/wp-includes/class-IXR.php';
     require_once ABSPATH . '/wp-includes/class-wp-http-ixr-client.php';
     // get options
     $options = get_option('optinoid_options');
     // Initialize the client
     $client = new WP_HTTP_IXR_Client('https://' . $options['infusionsoft_subdomain'] . '.infusionsoft.com/api/xmlrpc');
     $client->query('WebFormService.getMap', $options['infusionsoft_api']);
     $response = $client->getResponse();
     // empty list array
     $lists = array();
     if (!empty($response['faultCode'])) {
         wp_send_json(array('error' => $response['faultString']));
     } else {
         if (!empty($response)) {
             foreach ($response as $k => $v) {
                 $lists[$k]['id'] = $k;
                 $lists[$k]['name'] = $v;
             }
         }
         wp_send_json($lists);
     }
     wp_die();
 }
开发者ID:stefanolaru,项目名称:optinoid,代码行数:26,代码来源:Admin.php

示例7: infusionsoft_subscribe

 public function infusionsoft_subscribe($list_id, $email, $name = null)
 {
     // Include WordPress libraries to handle XML-RPC
     require_once ABSPATH . '/wp-includes/class-IXR.php';
     require_once ABSPATH . '/wp-includes/class-wp-http-ixr-client.php';
     // get options
     $options = get_option('optinoid_options');
     // Initialize the client
     $client = new WP_HTTP_IXR_Client('https://' . $options['infusionsoft_subdomain'] . '.infusionsoft.com/api/xmlrpc');
     $first_name = null;
     $last_name = null;
     if (!empty($name)) {
         $name_arr = explode(' ', $name);
         if (!empty($name_arr[0])) {
             $first_name = $name_arr[0];
         }
         if (!empty($name_arr[1])) {
             $last_name = $name_arr[1];
         }
     }
     $client->query('WebFormService.getHTML', $options['infusionsoft_api'], $list_id);
     $dom = new DOMDocument();
     $dom->loadHTML($client->getResponse());
     $inputs = $dom->getelementsbytagname('input');
     $data = array();
     foreach ($inputs as $input) {
         $name = $input->getAttribute('name');
         if ($name == 'inf_field_Email') {
             $data[$name] = $email;
         } elseif ($name == 'inf_field_FirstName') {
             $data[$name] = $first_name;
         } elseif ($name == 'inf_field_LastName') {
             $data[$name] = $last_name;
         } else {
             $data[$name] = $input->getAttribute('value');
         }
     }
     $endpoint = 'https://' . $options['infusionsoft_subdomain'] . '.infusionsoft.com/app/form/process/' . $data['inf_form_xid'];
     $response = wp_remote_post($endpoint, array('body' => $data));
 }
开发者ID:stefanolaru,项目名称:optinoid,代码行数:40,代码来源:Api.php

示例8: untrailingslashit

 function __construct($site_ID)
 {
     // @TODO check port, timeout etc
     $server = untrailingslashit(get_post_meta($site_ID, 'syn_site_url', true));
     if (false === strpos($server, 'xmlrpc.php')) {
         $server = esc_url_raw(trailingslashit($server) . 'xmlrpc.php');
     } else {
         $server = esc_url_raw($server);
     }
     $this->username = get_post_meta($site_ID, 'syn_site_username', true);
     $this->password = push_syndicate_decrypt(get_post_meta($site_ID, 'syn_site_password', true));
     $this->site_ID = $site_ID;
     parent::__construct($server);
     if (true === apply_filters('syn_xmlrpc_push_send_thumbnail', true, $site_ID, $this)) {
         add_action('syn_xmlrpc_push_new_post_success', array($this, 'post_push_send_thumbnail'), 10, 6);
         add_action('syn_xmlrpc_push_edit_post_success', array($this, 'post_push_send_thumbnail'), 10, 6);
         // TODO: on delete post, delete thumbnail
     }
 }
开发者ID:gopinathshiva,项目名称:wordpress-vip-plugins,代码行数:19,代码来源:class-syndication-wp-xmlrpc-client.php

示例9: init

 public function init($site_ID = 0)
 {
     global $settings_manager;
     $this->username = get_post_meta($site_ID, 'syn_site_username', true);
     $this->password = $settings_manager->syndicate_decrypt(get_post_meta($site_ID, 'syn_site_password', true));
     $this->site_ID = $site_ID;
     $server = untrailingslashit(get_post_meta($site_ID, 'syn_site_url', true));
     /**
      * Set up the callbacks for attachments.
      */
     /**
      * Filter whether the XML push client should push thumbnails.
      *
      * Return false to skip sending thumbnails.
      *
      * @param bool     $push_thumbnails Whether to push thumbnails. Default is true.
      * @param int      $site_ID         The id of the site being pushed to.
      * @param XML_Push $this            The push client instance.
      */
     if (true === apply_filters('syn_xmlrpc_push_send_thumbnail', true, $site_ID, $this)) {
         add_action('syn_xmlrpc_push_new_post_success', array($this, 'post_push_send_thumbnail'), 10, 6);
         add_action('syn_xmlrpc_push_edit_post_success', array($this, 'post_push_send_thumbnail'), 10, 6);
         // TODO: on delete post, delete thumbnail
     }
     /**
      * Bail on connection test if we don't have a server URL.
      */
     if ('' === $server) {
         return false;
     }
     if (false === strpos($server, 'xmlrpc.php')) {
         $server = esc_url_raw(trailingslashit($server) . 'xmlrpc.php');
     } else {
         $server = esc_url_raw($server);
     }
     parent::__construct($server);
 }
开发者ID:adamsilverstein,项目名称:syndication,代码行数:37,代码来源:class-push-client.php


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