WordPress.org

Plugin Directory

Changeset 755730


Ignore:
Timestamp:
08/13/13 18:33:00 (8 months ago)
Author:
joedolson
Message:

Update to 1.0.2: Extend timeout on WP HTTP, improved debugging, bug fixes to support form.

Location:
botsmasher
Files:
23 added
3 edited

Legend:

Unmodified
Added
Removed
  • botsmasher/trunk/botsmasher.php

    r755345 r755730  
    44Plugin URI: http://www.joedolson.com/articles/botsmasher/ 
    55Description: BotSmasher smashes bots.  
    6 Version: 1.0.1 
     6Version: 1.0.2 
    77Author: Joe Dolson 
    88Author URI: http://www.joedolson.com/ 
     
    3030load_plugin_textdomain( 'botsmasher',false, dirname( plugin_basename( __FILE__ ) ) . '/lang' ); 
    3131 
     32//define( 'BS_DEBUG_TO', 'debug@joedolson.com' ); // use this to send debugging to Joe. Please, only if you contacted me first! 
     33define( 'BS_DEBUG_TO', get_option( 'admin_email' ) ); 
     34define( 'BS_DEBUGGING', false ); 
     35 
    3236$bs_api_url = 'https://www.botsmasher.com/api/index.php'; 
    33 $bs_version = '1.0.0';  
     37$bs_version = '1.0.2';  
    3438 
    3539if ( !class_exists('botsmasherClient') ) { 
     
    358362    if ( isset($_POST['wpt_support']) ) { 
    359363        $nonce=$_REQUEST['_wpnonce']; 
    360         if (! wp_verify_nonce($nonce,'botsmasher-nonce') ) die("Security check failed");     
     364        if (! wp_verify_nonce($nonce,'bs-nonce') ) die("Security check failed");     
    361365        $request = ( !empty($_POST['support_request']) )?stripslashes($_POST['support_request']):false; 
    362366        $has_donated = ( $_POST['has_donated'] == 'on')?"Donor":"No donation"; 
     
    383387    echo " 
    384388    <form method='post' action='$admin_url'> 
    385         <div><input type='hidden' name='_wpnonce' value='".wp_create_nonce('botsmasher-nonce')."' /></div> 
     389        <div><input type='hidden' name='_wpnonce' value='".wp_create_nonce('bs-nonce')."' /></div> 
    386390        <div>"; 
    387391        echo " 
     
    394398        </p> 
    395399        <p> 
    396         <input type='checkbox' name='has_read_faq' id='has_read_faq' value='on' /> <label for='has_read_faq'>".sprintf(__('I have read <a href="%1$s">the FAQ for this plug-in</a> <span>(required)</span>','botsmasher'),'http://www.joedolson.com/articles/botsmasher/faqs/')."</label> 
     400        <input type='checkbox' name='has_read_faq' id='has_read_faq' value='on' /> <label for='has_read_faq'>".sprintf(__('I have read <a href="%1$s">the FAQ for this plug-in</a> <span>(required)</span>','botsmasher'),'http://wordpress.org/plugins/botsmasher/faq/')."</label> 
    397401        </p> 
    398402        <p> 
     
    415419} 
    416420 
    417 function bs_handle_exception( $e ) { 
    418     //wp_mail( 'joe@joedolson.com', 'Handled Exception', print_r( $e, 1 ) ); 
     421function bs_handle_exception( $e, $response ) { 
     422    if ( defined ( 'BS_DEBUGGING' ) && BS_DEBUGGING == true ) { 
     423        wp_mail( BS_DEBUG_TO, 'BotSmasher: Handled Exception', print_r( $e, 1 )."\n\n".print_r( $response, 1 ) ); 
     424    } 
    419425    $exceptions = get_option( 'bs_exceptions' ); 
    420426    if ( !is_array( $exceptions ) ) { 
     
    423429    if ( count( $exceptions ) > 20 ) { // only track the latest 20 issues. 
    424430        array_shift( $exceptions ); 
    425     } 
    426     $exceptions[] = array( 'date'=>current_time( 'timestamp' ), 'message'=> $e->getMessage() ); 
     431    }    
     432    if ( $response == 'is_wp_error' ) { 
     433        $message = "BS: ".$e->get_error_message(); 
     434    } else { 
     435        $message = "WP: ".$e->getMessage(); 
     436    } 
     437    $exceptions[] = array( 'date'=>current_time( 'timestamp' ), 'message'=> $message ); 
    427438    update_option( 'bs_exceptions', $exceptions ); 
    428439} 
  • botsmasher/trunk/botsmasherClient.class.php

    r755333 r755730  
    6464        $this -> opts['key'] = $this -> apiKey; 
    6565 
    66         if (TRUE == $printInfo) { 
     66        if ( TRUE == $printInfo ) { 
    6767            echo '<pre>'; 
    6868            var_dump($this -> opts); 
     
    7070        } 
    7171 
    72         if (FALSE == $this -> validateOpts()) { 
     72        if ( FALSE == $this -> validateOpts() ) { 
    7373            if (TRUE == $printInfo) { 
    7474                echo 'INVALID OPTS'; 
     
    7777        } 
    7878         
    79         $args = array( 'method'=>'POST', 'body'=>$this -> opts, 'headers'=>'', 'sslverify'=>false ); 
     79        $args = array( 'method'=>'POST', 'body' => $this -> opts, 'headers' => '', 'sslverify' => false, 'timeout' => 30 ); 
    8080        $result = wp_remote_post( $this -> apiURL, $args ); 
    8181         
     
    9292            }  
    9393        } else { 
    94             if (TRUE == $printInfo) { 
    95                 echo '<pre>'; 
    96                 var_dump( $result ); 
    97                 echo '</pre>'; 
    98             }            
     94            bs_handle_exception( $result, 'is_wp_error' ); 
     95            $body = false; 
    9996        } 
    10097        //the results 
     
    140137            } 
    141138        } catch (Exception $e) { 
    142             bs_handle_exception( $e ); 
     139            bs_handle_exception( $e, $this->response ); 
    143140            return FALSE; 
    144141        } 
     
    175172            } 
    176173        } catch (Exception $e) { 
    177             bs_handle_exception( $e ); 
     174            bs_handle_exception( $e, $this->response ); 
    178175            return null; 
    179176        } 
  • botsmasher/trunk/readme.txt

    r755345 r755730  
    55Requires at least: 3.4.2 
    66Tested up to: 3.6.0 
    7 Stable tag: 1.0.1 
     7Stable tag: 1.0.2 
    88License: GPLv2 or later 
    99 
     
    2828BotSmasher includes an integrated and accessible contact form with basic customization options. The contact form shortcode is documented on the settings page, but can also be configured via the widget tool.  
    2929 
     30= Translations = 
     31 
     32Available languages (in order of completeness): 
     33There aren't any yet! 
     34 
     35Visit the [BotSmasher translations site](http://translate.joedolson.com/projects/botsmasher) to help out! 
     36 
     37Translating my plug-ins is always appreciated. Visit <a href="http://translate.joedolson.com">my translations site</a> to start getting your language into shape! 
     38 
     39<a href="http://www.joedolson.com/articles/translator-credits/">Translator Credits</a> 
     40 
    3041== Installation == 
    3142 
     
    33442. Login to your WordPress dashboard, click "Plugins", and activate BotSmasher. 
    34453. At http://www.botsmasher.com, register to get an API key. 
    35 2. Add your API key on the Settings > BotSmasher screen. 
     464. Add your API key on the Settings > BotSmasher screen. 
    3647 
    3748== Changelog == 
     49 
     50= 1.0.2 = 
     51 
     52* Fixed FAQ link in support request form. 
     53* Fixed support form nonce 
     54* Lengthened timeout period on HTTP requests 
     55* Added WP errors to error log. 
     56* Ability to enable debugging. 
     57* Added botsmasher.pot to download.  
    3858 
    3959= 1.0.1 = 
Note: See TracChangeset for help on using the changeset viewer.