Plugin Directory

Changeset 1734093


Ignore:
Timestamp:
09/22/2017 06:35:47 AM (9 years ago)
Author:
itamarg
Message:
  • Fixed request time-outs on some cases when using web audit widget.
Location:
sr-partner/trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • sr-partner/trunk/includes/class-sr-partner-helper.php

    r1725925 r1734093  
    135135        $response = wp_remote_post(
    136136            $params['url'],
    137             array(
    138                 'body' => $params['post_string']
    139             )
     137            [
     138                'body'    => $params['post_string'],
     139                'timeout' => SR_PARTNER_API_REQUEST_TIMEOUT,
     140            ]
    140141        );
     142
     143        $this->log($params, 'call_api');
     144        $this->log($response, 'call_api_response');
     145
     146        if (is_wp_error($response)) {
     147          return false;
     148        }
    141149
    142150        if (is_object($response)) {
    143151          $response =  $this->objectToArray($response);
    144         }
    145 
    146         $this->log($params, 'call_api');
    147         $this->log($response, 'call_api_response');
     152        }       
    148153
    149154        if (isset($response['body'])) {
     
    426431     */
    427432    public function objectToArray ($object) {
    428         if(!is_object($object) && !is_array($object))
     433        if (!is_object($object) && !is_array($object)) {
    429434            return $object;
     435        }           
    430436
    431437        return array_map(array($this, 'objectToArray'), (array) $object);
  • sr-partner/trunk/languages/sr-partner-en_US.po

    r1717421 r1734093  
    492492msgstr "Oh snap!"
    493493
    494 msgid "An unknown error occured. Please try again."
    495 msgstr "An unknown error occured. Please try again."
     494msgid "There was a problem processing your request. Please try again."
     495msgstr "There was a problem processing your request. Please try again."
    496496
    497497msgid "Website URL is required."
  • sr-partner/trunk/languages/sr-partner.pot

    r1717421 r1734093  
    492492msgstr "Oh snap!"
    493493
    494 msgid "An unknown error occured. Please try again."
    495 msgstr "An unknown error occured. Please try again."
     494msgid "There was a problem processing your request. Please try again."
     495msgstr "There was a problem processing your request. Please try again."
    496496
    497497msgid "Website URL is required."
  • sr-partner/trunk/public/class-sr-partner-public.php

    r1717421 r1734093  
    7777                    success             : "'. __("Success!","sr-partner") .'",
    7878                    oh_snap             : "'. __("Oh snap!","sr-partner") .'",
    79                     error_occured       : "'. __("An unknown error occured. Please try again.","sr-partner") .'",
     79                    error_occured       : "'. __("There was a problem processing your request. Please try again.","sr-partner") .'",
    8080                    web_url_required    : "'. __("Website URL is required.","sr-partner") .'",
    8181                    web_url_invalid     : "'. __("Website URL is invalid.","sr-partner") .'",
     
    181181                    $api_params['post_string']  = $params;
    182182
    183                     $res            = $this->_helper->call_api($api_params);               
    184                     $post_response  = json_decode($res, true);
     183                    $res            = $this->_helper->call_api($api_params);
     184
     185                    if (!empty($res)) {
     186                        $post_response  = json_decode($res, true);
     187                    } else {
     188                        $post_response = [
     189                            'statusCode' => '422',
     190                            'response'   => ['error' => __("There was a problem processing your request. Please try again.","sr-partner")]
     191                        ];
     192                    }
    185193
    186194                    echo json_encode($post_response);
  • sr-partner/trunk/public/js/sr-partner-public.js

    r1717421 r1734093  
    435435                data: data,
    436436                success : function(response,status,xhr) {
    437                     if(response.statusCode == 200 ) {
     437                    if (response.hasOwnProperty('statusCode') && response.statusCode == 200 ) {
    438438
    439439                        _parent.setHtmlAlert('<b>'+_parent.getLocalization('success', "Success!")+'</b> '+response.response.info+'','success');
    440 
    441440                        $email.val('');
    442441                        $url.val('');
    443442
    444                     } else if(response.statusCode == 400 || response.statusCode == 422 ) {
     443                    } else if(response.hasOwnProperty('statusCode') &&  response.statusCode == 400 || response.statusCode == 422 ) {
    445444                        if (typeof(response.data) !== 'undefined' && typeof(response.data.error) !== 'undefined') {
    446445                            _parent.setHtmlAlert('<b>'+_parent.getLocalization('oh_snap', "Oh snap!")+'</b> '+response.data.error+'','danger');   
     
    448447                            _parent.setHtmlAlert('<b>'+_parent.getLocalization('oh_snap', "Oh snap!")+'</b> '+response.response.error+'','danger');   
    449448                        } else {
    450                             _parent.setHtmlAlert('<b>'+_parent.getLocalization('oh_snap', "Oh snap!")+'</b> '+_parent.getLocalization('error_occured', "An unknown error occured. Please try again."),'danger');
     449                            _parent.setHtmlAlert('<b>'+_parent.getLocalization('oh_snap', "Oh snap!")+'</b> '+_parent.getLocalization('error_occured', "There was a problem processing your request. Please try again."),'danger');
    451450                        }                           
    452451                       
    453452                    } else {
    454                         _parent.setHtmlAlert('<b>'+_parent.getLocalization('oh_snap', "Oh snap!")+'</b> '+_parent.getLocalization('error_occured', "An unknown error occured. Please try again."),'danger');
     453                        _parent.setHtmlAlert('<b>'+_parent.getLocalization('oh_snap', "Oh snap!")+'</b> '+_parent.getLocalization('error_occured', "There was a problem processing your request. Please try again."),'danger');
    455454                    }                       
    456455                    _parent.addLoaderWrapperEvents();
    457456                },
    458457                error : function(xhr,status,error) {               
    459                     _parent.setHtmlAlert('<b>'+_parent.getLocalization('oh_snap', "Oh snap!")+'</b> '+_parent.getLocalization('error_occured', "An unknown error occured. Please try again."),'danger');
     458                    _parent.setHtmlAlert('<b>'+_parent.getLocalization('oh_snap', "Oh snap!")+'</b> '+_parent.getLocalization('error_occured', "There was a problem processing your request. Please try again."),'danger');
    460459                    _parent.addLoaderWrapperEvents();
    461460                }
  • sr-partner/trunk/readme.txt

    r1725925 r1734093  
    44Requires at least: 4.6
    55Tested up to: 4.8.1
    6 Stable tag: 1.1.4
     6Stable tag: 1.1.5
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    4949== Changelog ==
    5050
     51= 1.1.5 =
     52
     53* Release date: September 22, 2017
     54
     55**Bug fixes**
     56* Fixed request timeouts on some cases when using web audit widget.
     57
    5158= 1.1.4 =
    5259
  • sr-partner/trunk/sr-partner.php

    r1725925 r1734093  
    1717 * Plugin URI:        https://www.seoreseller.com/
    1818 * Description:       SEOReseller's suite of tools for building, managing, and growing your digital marketing agency.
    19  * Version:           1.1.4
     19 * Version:           1.1.5
    2020 * Author:            SEOReseller Team
    2121 * Author URI:        https://www.seoreseller.com/
     
    2727
    2828// If this file is called directly, abort.
    29 if ( ! defined( 'WPINC' ) ) {
     29if (!defined('WPINC')) {
    3030    die;
    3131}
     
    3939*/
    4040
    41 const SR_PARTNER_MIN_PHP_VERSION_REQUIRED   = '5.0';
    42 
    43 const SR_PARTNER_PLUGIN_NAME                = 'sr-partner';
    44 
    45 const SR_PARTNER_VERSION                    = '1.1.4';
    46 const SR_PARTNER_DEBUG                      = false;
    47 
    48 const SR_PARTNER_GENERATE_URL               = 'https://www.accesshub.co/web-audit-generator';
    49 const SR_PARTNER_DASHBOARD_URL              = 'https://www.accesshub.co/';
    50 const SR_PARTNER_PORTFOLIO_URL              = 'https://view.accesshub.co/';
    51 
    52 const SR_PARTNER_ACCOUNT_URL                = 'https://account.seoreseller.com';
    53 const SR_PARTNER_HELPCENTER_URL             = 'http://helpcenter.seoreseller.com';
    54 
    55 const SR_PARTNER_GEN_KEY                    = 'sr_partner_api_key';
    56 const SR_PARTNER_ADMIN_NOTICE               = 'sr_partner_admin_notice';
    57 
    58 const SR_PARTNER_INSTALL_TO_ALL_PAGES       = 'sr_partner_install_to_all_pages';
    59 const SR_PARTNER_INSTALLED_TO_ALL           = 'sr_partner_installed_to_all';
    60 
    61 const SR_PARTNER_DASHBOARD_PAGE_TITLE       = 'Dashboard';
    62 const SR_PARTNER_DASHBOARD_PAGE_INFO        = 'sr_partner_dashboard_page_info';
    63 
    64 const SR_PARTNER_PORTFOLIO_PAGE_TITLE       = 'Web Portfolio';
    65 const SR_PARTNER_PORTFOLIO_PAGE_INFO        = 'sr_partner_portfolio_page_info';
    66 
    67 const SR_PARTNER_DASHBOARD_STATUS           = 'sr_partner_dashboard_status';
    68 const SR_PARTNER_PORTFOLIO_STATUS           = 'sr_partner_portfolio_status';
    69 const PARTNER_PLUGIN_STATUS                 = 'sr_partner_audit_status';
    70 const SR_PARTNER_LEAD_STATUS                = 'sr_partner_lead_status';
    71 
    72 const SR_PARTNER_ALERT_MESSAGES             = 'sr_partner_alert_messages';
     41defined('SR_PARTNER_MIN_PHP_VERSION_REQUIRED') || define('SR_PARTNER_MIN_PHP_VERSION_REQUIRED', '5.0');
     42
     43defined('SR_PARTNER_PLUGIN_NAME') || define('SR_PARTNER_PLUGIN_NAME', 'sr-partner');
     44
     45defined('SR_PARTNER_VERSION') || define('SR_PARTNER_VERSION', '1.1.5');
     46defined('SR_PARTNER_DEBUG')   || define('SR_PARTNER_DEBUG', false);
     47
     48defined('SR_PARTNER_GENERATE_URL')  || define('SR_PARTNER_GENERATE_URL', 'https://www.accesshub.co/web-audit-generator');
     49defined('SR_PARTNER_DASHBOARD_URL') || define('SR_PARTNER_DASHBOARD_URL', 'https://www.accesshub.co/');
     50defined('SR_PARTNER_PORTFOLIO_URL') || define('SR_PARTNER_PORTFOLIO_URL', 'https://view.accesshub.co/');
     51
     52defined('SR_PARTNER_ACCOUNT_URL')    || define('SR_PARTNER_ACCOUNT_URL', 'https://account.seoreseller.com');
     53defined('SR_PARTNER_HELPCENTER_URL') || define('SR_PARTNER_HELPCENTER_URL', 'http://helpcenter.seoreseller.com');
     54
     55defined('SR_PARTNER_GEN_KEY')      || define('SR_PARTNER_GEN_KEY', 'sr_partner_api_key');
     56defined('SR_PARTNER_ADMIN_NOTICE') || define('SR_PARTNER_ADMIN_NOTICE', 'sr_partner_admin_notice');
     57
     58defined('SR_PARTNER_INSTALL_TO_ALL_PAGES') || define('SR_PARTNER_INSTALL_TO_ALL_PAGES', 'sr_partner_install_to_all_pages');
     59defined('SR_PARTNER_INSTALLED_TO_ALL')     || define('SR_PARTNER_INSTALLED_TO_ALL', 'sr_partner_installed_to_all');
     60
     61defined('SR_PARTNER_DASHBOARD_PAGE_TITLE') || define('SR_PARTNER_DASHBOARD_PAGE_TITLE', 'Dashboard');
     62defined('SR_PARTNER_DASHBOARD_PAGE_INFO')  || define('SR_PARTNER_DASHBOARD_PAGE_INFO', 'sr_partner_dashboard_page_info');
     63
     64defined('SR_PARTNER_PORTFOLIO_PAGE_TITLE') || define('SR_PARTNER_PORTFOLIO_PAGE_TITLE', 'Web Portfolio');
     65defined('SR_PARTNER_PORTFOLIO_PAGE_INFO')  || define('SR_PARTNER_PORTFOLIO_PAGE_INFO', 'sr_partner_portfolio_page_info');
     66
     67defined('SR_PARTNER_DASHBOARD_STATUS') || define('SR_PARTNER_DASHBOARD_STATUS', 'sr_partner_dashboard_status');
     68defined('SR_PARTNER_PORTFOLIO_STATUS') || define('SR_PARTNER_PORTFOLIO_STATUS', 'sr_partner_portfolio_status');
     69defined('PARTNER_PLUGIN_STATUS')       || define('PARTNER_PLUGIN_STATUS', 'sr_partner_audit_status');
     70defined('SR_PARTNER_LEAD_STATUS')      || define('SR_PARTNER_LEAD_STATUS', 'sr_partner_lead_status');
     71
     72defined('SR_PARTNER_ALERT_MESSAGES')      || define('SR_PARTNER_ALERT_MESSAGES', 'sr_partner_alert_messages');
     73defined('SR_PARTNER_API_REQUEST_TIMEOUT') || define('SR_PARTNER_API_REQUEST_TIMEOUT', 30);
    7374
    7475/**
Note: See TracChangeset for help on using the changeset viewer.