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


PHP WP_HTTP_IXR_Client::getErrorMessage方法代码示例

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


在下文中一共展示了WP_HTTP_IXR_Client::getErrorMessage方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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


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