WordPress.org

Plugin Directory

Changeset 616406


Ignore:
Timestamp:
10/23/12 17:44:33 (18 months ago)
Author:
tmoorewp
Message:

Widgets: Twitter: Remove a Twitter API call that checks the username entered in the widget options. This is causing the username to be blank in same cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • jetpack/branches/1.8/modules/widgets/twitter.php

    r605245 r616406  
    210210    } 
    211211 
    212     /** 
    213      * Test if Twitter screenname exists on Twitter.com. 
    214      * Used to test input before saving. 
    215      */ 
    216     public static function twitter_screenname_exists( $screenname ) { 
    217         if ( empty( $screenname ) ) 
    218             return false; 
    219  
    220         $twitter_json_url = esc_url_raw( 'http://api.twitter.com/1/users/show.json?' . http_build_query( array( 'screen_name' => $screenname ) ), array( 'http', 'https' ) ); 
    221         $response = wp_remote_head( $twitter_json_url, array( 'httpversion' => '1.1', 'timeout' => 3, 'redirection' => 0 ) ); 
    222         if ( wp_remote_retrieve_response_code( $response ) === 200 ) 
    223             return true; 
    224         else 
    225             return false; 
    226     } 
    227  
    228212    function update( $new_instance, $old_instance ) { 
    229213        $instance = array(); 
     
    231215        $instance['account'] = trim( wp_kses( $new_instance['account'], array() ) ); 
    232216        $instance['account'] = str_replace( array( 'http://twitter.com/', '/', '@', '#!', ), array( '', '', '', '', ), $instance['account'] ); 
    233  
    234         if (  ! empty( $instance['account'] ) && ( ! isset( $old_instance['account'] ) || $instance['account'] !== $old_instance['account'] ) ) { 
    235             if ( ! self::twitter_screenname_exists( $instance['account'] ) ) 
    236                 $instance['account'] = ''; 
    237         } 
    238217 
    239218        $instance['title']           = wp_kses( $new_instance['title'], array() ); 
Note: See TracChangeset for help on using the changeset viewer.