WordPress.org

Plugin Directory

Changeset 497627


Ignore:
Timestamp:
01/31/12 00:07:01 (2 years ago)
Author:
wpmuguru
Message:

metabox bugfix, tag & release 3.0.10

Location:
scribe
Files:
79 added
3 edited

Legend:

Unmodified
Added
Removed
  • scribe/trunk/lib/ecordia-access/ecordia-user-account.class.php

    r283704 r497627  
    77     * @var nusoap_client 
    88     */ 
    9     var $client; 
    10     var $results = null; 
    11     var $requestHasBeenExecuted = false; 
     9    var $client; 
     10    var $results = null; 
     11    var $requestHasBeenExecuted = false; 
    1212    var $useSsl = false; 
     13    var $_option_cachedUserInfo = '_ecordia_cachedUserInfo'; 
     14    var $_option_cachedUserResults = '_ecordia_cachedUserResults'; 
    1315 
    14     function EcordiaUserAccount($apiKey, $useSsl = false) { 
    15         $this->apiKey = $apiKey; 
     16    function EcordiaUserAccount($apiKey, $useSsl = false, $live = false) { 
     17        $this->apiKey = $apiKey; 
    1618        $this->useSsl = $useSsl; 
    1719 
    18         $loc = ($this->useSsl ? 'https' : 'http') . '://vesta.ecordia.com/optimizer/v1/usermanagement.svc/' . ($this->useSsl ? 'ssl' : 'nonssl') . '/'; 
    19         $this->client = new nusoap_client($loc); 
    20         $this->client->soap_defencoding = 'utf-8'; 
    21         $this->client->use_curl = true; 
    22     } 
     20        if ( $live ) 
     21            return $this->init_client(); 
    2322 
    24     function UserAccountStatus() { 
    25         $contents = '<GetAccountStatus xmlns="https://vesta.ecordia.com"><submission xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:ApiKey>'.$this->apiKey.'</a:ApiKey></submission></GetAccountStatus>'; 
    26         $contents = $this->client->serializeEnvelope($contents); 
     23        $results = get_option( $this->_option_cachedUserResults ); 
     24        if ( !empty( $results ) && is_array( $results ) ) { 
    2725 
     26            $this->results = $results; 
     27            $this->requestHasBeenExecuted = true; 
     28            return; 
     29 
     30        } 
     31        // see if we can convert the old object over 
     32        $obj = get_option( $this->_option_cachedUserInfo ); 
     33        if ( is_a( 'EcordiaUserAccount', $obj ) ) { 
     34 
     35            update_option( $this->_option_cachedUserResults, $obj->results ); 
     36            delete_option( $this->_option_cachedUserInfo ); 
     37            $this->results = $obj->results; 
     38            $this->requestHasBeenExecuted = true; 
     39 
     40        } 
     41 
     42    } 
     43 
     44    function init_client() { 
     45 
     46        if ( ! is_object( $this->client ) ) { 
     47 
     48            $loc = ($this->useSsl ? 'https' : 'http') . '://vesta.ecordia.com/optimizer/v1/usermanagement.svc/' . ($this->useSsl ? 'ssl' : 'nonssl') . '/'; 
     49            $this->client = new nusoap_client($loc); 
     50            $this->client->soap_defencoding = 'utf-8'; 
     51            $this->client->use_curl = true; 
     52 
     53        } 
     54    } 
     55 
     56    function UserAccountStatus() { 
     57 
     58        $this->init_client(); 
     59 
     60        $contents = '<GetAccountStatus xmlns="https://vesta.ecordia.com"><submission xmlns:a="http://optimizer.ecordia.com/types/" xmlns:i="http://www.w3.org/2001/XMLSchema-instance"><a:ApiKey>'.$this->apiKey.'</a:ApiKey></submission></GetAccountStatus>'; 
     61        $contents = $this->client->serializeEnvelope($contents); 
    2862        $endpoint = 'https://vesta.ecordia.com/IUserManagement/GetAccountStatus'; 
    29         $results = $this->client->send($contents, $endpoint,0,180); 
    30         $this->results = $results; 
    31         $this->requestHasBeenExecuted = true; 
    32     } 
     63 
     64        $results = $this->client->send($contents, $endpoint,0,180); 
     65        $this->results = $results; 
     66        $this->requestHasBeenExecuted = true; 
     67 
     68        update_option( $this->_option_cachedUserResults, $results ); 
     69 
     70    } 
     71 
     72    function has_results() { 
     73 
     74        return $this->requestHasBeenExecuted; 
     75 
     76    } 
    3377 
    3478    function getRawResults() { 
     
    4185 
    4286    function hasError() { 
    43         return $this->requestHasBeenExecuted && (!empty($this->results['faultcode']) || ($error = $this->client->getError()) || ! empty($this->results['GetAccountStatusResult']['Exception']['Message'])); 
     87        return $this->requestHasBeenExecuted && ( ! empty( $this->results['faultcode'] ) || ( method_exists( $this->client, 'getError' ) && $error = $this->client->getError() ) || ! empty( $this->results['GetAccountStatusResult']['Exception']['Message'] ) ); 
    4488    } 
    4589 
  • scribe/trunk/readme.txt

    r474188 r497627  
    55Requires at least: 3.3 
    66Tested up to: 3.3 
    7 Stable tag: 3.0.9 
     7Stable tag: 3.0.10 
    88 
    99Scribe makes SEO Copywriting Simple. 
     
    8989== Changelog == 
    9090 
     91= 3.0.10 = 
     92* Bugfix for intermittent error in metaboxes. 
     93 
    9194= 3.0.9 = 
    9295* Update for WordPress 3.3. 
     
    147150 
    148151== Upgrade Notice == 
     152= 3.0.10 = 
     153Bugfix for intermittent error in metaboxes. 
     154 
    149155= 3.0.8 = 
    150156Improved support for older versions of WordPress. 
  • scribe/trunk/scribe.php

    r474183 r497627  
    44 Plugin URI: http://scribeseo.com 
    55 Description: Quickly and easily check your content against SEO best practices utilizing the Scribe Content Optimizer.  You will need a <a href="https://my.scribeseo.com" title="My Scribe API key">Scribe API Key</a> in order to use the application. If you do not have an API Key, go to <a href="http://scribeseo.com" title="Get Scribe API Key">http://scribeseo.com</a>. <strong>Please</strong> make sure you are using a supported theme or plugin. For an updated list, go to <a href="http://scribeseo.com/compatibility/" title="Scribe Compatibility List">http://scribeseo.com/compatibility/</a>. 
    6  Version: 3.0.9 
     6 Version: 3.0.10 
    77 Author: Copyblogger Media 
    88 Author URI: http://www.copyblogger.com 
     
    2828    class Ecordia { 
    2929 
    30         var $version = '3.0.9'; 
     30        var $version = '3.0.10'; 
    3131        var $_meta_seoInfo = '_ecordia_seo_info'; 
    3232        var $_meta_linkResearchInfo = '_ecordia_link_research'; 
    3333        var $_option_ecordiaSettings = '_ecordia_settings'; 
    34         var $_option_cachedUserInfo = '_ecordia_cachedUserInfo'; 
     34        var $_option_cachedUserResults = '_ecordia_cachedUserResults'; 
    3535        var $_option_keywordResearchList = '_ecordia_keyword_research_history'; 
    3636 
     
    772772 
    773773        function getUserInfo($live = false) { 
     774 
    774775            $settings = $this->getSettings(); 
    775             if ($live) { 
    776                 if ( empty($settings['api-key'])) { 
    777                     delete_option($this->_option_cachedUserInfo); 
    778                     return new WP_Error(-1, __('You must set an API key.')); 
    779                 } else { 
    780                     $userAccountAccess = new EcordiaUserAccount($settings['api-key'], $settings['use-ssl']); 
    781                     $userAccountAccess->UserAccountStatus(); 
    782                     if ($userAccountAccess->hasError()) { 
    783                         return new WP_Error($userAccountAccess->getErrorType(), $userAccountAccess->getErrorMessage() . $userAccountAccess->client->response . '<br /> ' .$userAccountAccess->client->request, $userAccountAccess); 
    784                     } else { 
    785                         update_option($this->_option_cachedUserInfo, $userAccountAccess); 
    786                         return $userAccountAccess; 
    787                     } 
    788                 } 
    789             } else { 
    790                 $userAccountAccess = get_option($this->_option_cachedUserInfo); 
    791                 if (!$userAccountAccess) { 
    792                     return new WP_Error(-100, __('Fetching Information...')); 
    793                 } else { 
    794                     return $userAccountAccess; 
    795                 } 
    796             } 
     776            if ( $live && empty( $settings['api-key'] ) ) { 
     777 
     778                delete_option( $this->_option_cachedUserResults ); 
     779                return new WP_Error(-1, __('You must set an API key.')); 
     780 
     781            } 
     782 
     783            $userAccountAccess = new EcordiaUserAccount( $settings['api-key'], $settings['use-ssl'], $live ); 
     784 
     785            if ( $live ) { 
     786 
     787                $userAccountAccess->UserAccountStatus(); 
     788                if ( $userAccountAccess->hasError() ) 
     789                    return new WP_Error($userAccountAccess->getErrorType(), $userAccountAccess->getErrorMessage() . $userAccountAccess->client->response . '<br /> ' .$userAccountAccess->client->request, $userAccountAccess); 
     790 
     791            } elseif ( ! $userAccountAccess->has_results() ) { 
     792 
     793                return new WP_Error(-100, __('Fetching Information...')); 
     794 
     795            } 
     796 
     797            return $userAccountAccess; 
     798 
    797799        } 
    798800 
Note: See TracChangeset for help on using the changeset viewer.