WordPress.org

Plugin Directory

Changeset 774406


Ignore:
Timestamp:
09/18/13 04:29:19 (7 months ago)
Author:
aaroncampbell
Message:

Tag Version 2.6.0

Location:
twitter-widget-pro
Files:
6 edited
1 copied

Legend:

Unmodified
Added
Removed
  • twitter-widget-pro/tags/2.6.0/lib/wp-twitter.php

    r679878 r774406  
    118118        if ( !is_wp_error( $resp ) && $resp['response']['code'] >= 200 && $resp['response']['code'] < 300 ) { 
    119119            $decoded_response = json_decode( $resp['body'] ); 
    120             if ( empty( $decoded_response ) && ! empty( $resp['body'] ) ) 
     120            /** 
     121             * There is a problem with some versions of PHP that will cause 
     122             * json_decode to return the string passed to it in certain cases 
     123             * when the string isn't valid JSON.  This is causing me all sorts 
     124             * of pain.  The solution so far is to check if the return isset() 
     125             * which is the correct response if the string isn't JSON.  Then 
     126             * also check if a string is returned that has an = in it and if 
     127             * that's the case assume it's a string that needs to fall back to 
     128             * using wp_parse_args() 
     129             * @see https://bugs.php.net/bug.php?id=45989 
     130             * @see https://github.com/OpenRange/twitter-widget-pro/pull/8 
     131             */ 
     132            if ( ( ! isset( $decoded_response ) && ! empty( $resp['body'] ) ) || ( is_string( $decoded_response ) && false !== strpos( $resp['body'], '=' ) ) ) 
    121133                $decoded_response = wp_parse_args( $resp['body'] ); 
    122134            return $decoded_response; 
  • twitter-widget-pro/tags/2.6.0/readme.txt

    r715746 r774406  
    55Requires at least: 3.0 
    66Tested up to: 3.6 
    7 Stable tag: 2.5.4 
     7Stable tag: 2.6.0 
    88 
    99A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links. 
     
    132132== Upgrade Notice == 
    133133 
     134= 2.6.0 = 
     135Fix lists and add ability to remove accounts, as well as plenty of minor bug fixes. 
     136 
    134137= 2.5.4 = 
    135138Minor fix for a strict PHP notice 
     
    147150Upgrade to the new Twitter API and add support for lists 
    148151 
    149 = 2.4.1 = 
    150 Better support for hashtags with international characters & new German translation 
    151  
    152 = 2.4.0 = 
    153 Better linking to fix issues with links followed by punctuation plus support for extended characters in hashtags 
    154  
    155 = 2.3.11 = 
    156 Fix issue with "Include Retweets" not unchecking 
    157  
    158 = 2.3.10 = 
    159 Update feeds and links to Ran.ge, moves screenshots outside of plugin zip 
    160  
    161 = 2.3.9 = 
    162 Display dates based on your WordPress timezone setting 
    163  
    164 = 2.3.8 = 
    165 Fix issue with mixed content warning on HTTPS pages 
    166  
    167 = 2.3.7 = 
    168 Adds an option to clear update locks, which may fix the updating issue some people are having 
    169  
    170 = 2.3.6 = 
    171 Small fix for "invalid argument supplied for foreach" error that some people are getting 
    172  
    173 = 2.3.5 = 
    174 Added HTTP & HTTPS API setting and fixed support forum links 
    175  
    176 = 2.3.4 = 
    177 Fixed the conflict with Jetpack!  Also a new Arabic translation 
    178  
    179 = 2.3.3 = 
    180 Fixed issue with updates getting stuck, and add data-lang support for Twitter intents 
    181  
    182 = 2.3.2 = 
    183 Fixes some strings that were not translatable 
    184  
    185 = 2.3.1 = 
    186 Fixes an issue with the intents and follow settings not being saved 
    187  
    188 = 2.3.0 = 
    189 Fewer "could not connect to Twitter" messages, new links (reply, retweet, favorite), new follow button, and avatar fixes 
    190  
    191152== Changelog == 
     153 
     154= 2.6.0 = 
     155* Add ability to remove accounts 
     156* Fix bug that made lists not work 
     157* Work around PHP bug in json_decode() - https://bugs.php.net/bug.php?id=45989 
     158* Fix some strict standards warnings 
    192159 
    193160= 2.5.4 = 
  • twitter-widget-pro/tags/2.6.0/wp-twitter-widget.php

    r715746 r774406  
    44 * Plugin URI: http://bluedogwebservices.com/wordpress-plugin/twitter-widget-pro/ 
    55 * Description: A widget that properly handles twitter feeds, including @username, #hashtag, and link parsing.  It can even display profile images for the users.  Requires PHP5. 
    6  * Version: 2.5.4 
     6 * Version: 2.6.0 
    77 * Author: Aaron D. Campbell 
    88 * Author URI: http://ran.ge/ 
     
    3131require_once( 'tlc-transients.php' ); 
    3232require_once( 'range-plugin-framework.php' ); 
    33 define( 'TWP_VERSION', '2.5.2' ); 
     33define( 'TWP_VERSION', '2.6.0' ); 
    3434 
    3535/** 
     
    195195            </p> 
    196196            <p><?php echo $wpTwitterWidget->get_support_forum_link(); ?></p> 
     197            <script type="text/javascript"> 
     198                jQuery( '#<?php echo $this->get_field_id( 'username' ) ?>' ).on( 'change', function() { 
     199                    jQuery('#<?php echo $this->get_field_id( 'list' ) ?>' ).val(0); 
     200                }); 
     201                jQuery( '#<?php echo $this->get_field_id( 'list' ) ?>' ).on( 'change', function() { 
     202                    jQuery('#<?php echo $this->get_field_id( 'username' ) ?>' ).val(0); 
     203                }); 
     204            </script> 
    197205<?php 
    198206        return; 
     
    315323        } 
    316324 
     325        if ( 'remove' == $_GET['action'] ) { 
     326            check_admin_referer( 'remove-' . $_GET['screen_name'] ); 
     327 
     328            $redirect_args = array( 
     329                'message'    => 'removed', 
     330                'removed' => '', 
     331            ); 
     332            unset( $this->_settings['twp-authed-users'][strtolower($_GET['screen_name'])] ); 
     333            if ( update_option( 'twp-authed-users', $this->_settings['twp-authed-users'] ) ); 
     334                $redirect_args['removed'] = $_GET['screen_name']; 
     335 
     336            wp_safe_redirect( add_query_arg( $redirect_args, $this->get_options_url() ) ); 
     337            exit; 
     338        } 
    317339        if ( 'authorize' == $_GET['action'] ) { 
    318340            check_admin_referer( 'authorize' ); 
     
    340362 
    341363            $token = $this->_wp_twitter_oauth->get_access_token( $_GET['oauth_verifier'] ); 
    342             $this->_settings['twp-authed-users'][strtolower($token['screen_name'])] = $token; 
    343             update_option( 'twp-authed-users', $this->_settings['twp-authed-users'] ); 
    344  
    345             $redirect_args['authorized'] = $token['screen_name']; 
     364            if ( ! is_wp_error( $token ) ) { 
     365                $this->_settings['twp-authed-users'][strtolower($token['screen_name'])] = $token; 
     366                update_option( 'twp-authed-users', $this->_settings['twp-authed-users'] ); 
     367 
     368                $redirect_args['authorized'] = $token['screen_name']; 
     369            } 
    346370            wp_safe_redirect( add_query_arg( $redirect_args, $this->get_options_url() ) ); 
    347371            exit; 
     
    361385                else 
    362386                    $msg = __( 'There was a problem authorizing your account.', $this->_slug ); 
     387            } elseif ( 'removed' == $_GET['message'] ) { 
     388                if ( ! empty( $_GET['removed'] ) ) 
     389                    $msg = sprintf( __( 'Successfully removed @%s', $this->_slug ), $_GET['removed'] ); 
     390                else 
     391                    $msg = __( 'There was a problem removing your account.', $this->_slug ); 
    363392            } 
    364393            if ( ! empty( $msg ) ) 
     
    420449                $auth_link = ' - <a href="' . esc_url( $authorize_user_url ) . '">' . __( 'Reauthorize', $this->_slug ) . '</a>'; 
    421450            } 
     451            $query_args = array( 
     452                'action' => 'remove', 
     453                'screen_name' => $u['screen_name'], 
     454            ); 
     455            $remove_user_url = wp_nonce_url( add_query_arg( $query_args ), 'remove-' . $u['screen_name'] ); 
    422456            ?> 
    423457                <tr valign="top"> 
    424458                    <th scope="row" style="<?php echo esc_attr( $style ); ?>"> 
    425                         <strong>@<?php echo esc_html( $u['screen_name'] ) . $auth_link; ?></strong> 
     459                        <strong>@<?php echo esc_html( $u['screen_name'] ) . $auth_link;?></strong> 
     460                        <br /><a href="<?php echo esc_url( $remove_user_url ) ?>"><?php _e( 'Remove', $this->_slug ) ?></a> 
    426461                    </th> 
    427462                    <?php 
     
    10451080            } 
    10461081        } elseif ( ! empty( $parameters['list_id'] ) ) { 
    1047             $user = array_shift( explode( '::', $widgetOptions['list'] ) ); 
     1082            $list_info = explode( '::', $widgetOptions['list'] ); 
     1083            $user = array_shift( $list_info ); 
    10481084            $this->_wp_twitter_oauth->set_token( $this->_settings['twp-authed-users'][strtolower( $user )] ); 
    10491085 
    1050             $response = $this->_wp_twitter_oauth->send_authed_request( 'statuses/user_timeline', 'GET', $parameters ); 
     1086            $response = $this->_wp_twitter_oauth->send_authed_request( 'lists/statuses', 'GET', $parameters ); 
    10511087            if ( ! is_wp_error( $response ) ) 
    10521088                return $response; 
     
    10841120        ); 
    10851121 
    1086         if ( ! empty( $widgetOptions['username'] ) ) 
     1122        if ( ! empty( $widgetOptions['username'] ) ) { 
    10871123            $parameters['screen_name'] = $widgetOptions['username']; 
    1088         elseif ( ! empty( $widgetOptions['list'] ) ) 
    1089             $parameters['list_id'] = array_pop( explode( '::', $widgetOptions['list'] ) ); 
     1124        } elseif ( ! empty( $widgetOptions['list'] ) ) { 
     1125            $list_info = explode( '::', $widgetOptions['list'] ); 
     1126            $parameters['list_id'] = array_pop( $list_info ); 
     1127        } 
    10901128 
    10911129        if ( 'true' == $widgetOptions['hidereplies'] ) 
  • twitter-widget-pro/trunk/lib/wp-twitter.php

    r679878 r774406  
    118118        if ( !is_wp_error( $resp ) && $resp['response']['code'] >= 200 && $resp['response']['code'] < 300 ) { 
    119119            $decoded_response = json_decode( $resp['body'] ); 
    120             if ( empty( $decoded_response ) && ! empty( $resp['body'] ) ) 
     120            /** 
     121             * There is a problem with some versions of PHP that will cause 
     122             * json_decode to return the string passed to it in certain cases 
     123             * when the string isn't valid JSON.  This is causing me all sorts 
     124             * of pain.  The solution so far is to check if the return isset() 
     125             * which is the correct response if the string isn't JSON.  Then 
     126             * also check if a string is returned that has an = in it and if 
     127             * that's the case assume it's a string that needs to fall back to 
     128             * using wp_parse_args() 
     129             * @see https://bugs.php.net/bug.php?id=45989 
     130             * @see https://github.com/OpenRange/twitter-widget-pro/pull/8 
     131             */ 
     132            if ( ( ! isset( $decoded_response ) && ! empty( $resp['body'] ) ) || ( is_string( $decoded_response ) && false !== strpos( $resp['body'], '=' ) ) ) 
    121133                $decoded_response = wp_parse_args( $resp['body'] ); 
    122134            return $decoded_response; 
  • twitter-widget-pro/trunk/readme.txt

    r715746 r774406  
    55Requires at least: 3.0 
    66Tested up to: 3.6 
    7 Stable tag: 2.5.4 
     7Stable tag: 2.6.0 
    88 
    99A widget that properly handles twitter feeds, including parsing @username, #hashtags, and URLs into links. 
     
    132132== Upgrade Notice == 
    133133 
     134= 2.6.0 = 
     135Fix lists and add ability to remove accounts, as well as plenty of minor bug fixes. 
     136 
    134137= 2.5.4 = 
    135138Minor fix for a strict PHP notice 
     
    147150Upgrade to the new Twitter API and add support for lists 
    148151 
    149 = 2.4.1 = 
    150 Better support for hashtags with international characters & new German translation 
    151  
    152 = 2.4.0 = 
    153 Better linking to fix issues with links followed by punctuation plus support for extended characters in hashtags 
    154  
    155 = 2.3.11 = 
    156 Fix issue with "Include Retweets" not unchecking 
    157  
    158 = 2.3.10 = 
    159 Update feeds and links to Ran.ge, moves screenshots outside of plugin zip 
    160  
    161 = 2.3.9 = 
    162 Display dates based on your WordPress timezone setting 
    163  
    164 = 2.3.8 = 
    165 Fix issue with mixed content warning on HTTPS pages 
    166  
    167 = 2.3.7 = 
    168 Adds an option to clear update locks, which may fix the updating issue some people are having 
    169  
    170 = 2.3.6 = 
    171 Small fix for "invalid argument supplied for foreach" error that some people are getting 
    172  
    173 = 2.3.5 = 
    174 Added HTTP & HTTPS API setting and fixed support forum links 
    175  
    176 = 2.3.4 = 
    177 Fixed the conflict with Jetpack!  Also a new Arabic translation 
    178  
    179 = 2.3.3 = 
    180 Fixed issue with updates getting stuck, and add data-lang support for Twitter intents 
    181  
    182 = 2.3.2 = 
    183 Fixes some strings that were not translatable 
    184  
    185 = 2.3.1 = 
    186 Fixes an issue with the intents and follow settings not being saved 
    187  
    188 = 2.3.0 = 
    189 Fewer "could not connect to Twitter" messages, new links (reply, retweet, favorite), new follow button, and avatar fixes 
    190  
    191152== Changelog == 
     153 
     154= 2.6.0 = 
     155* Add ability to remove accounts 
     156* Fix bug that made lists not work 
     157* Work around PHP bug in json_decode() - https://bugs.php.net/bug.php?id=45989 
     158* Fix some strict standards warnings 
    192159 
    193160= 2.5.4 = 
  • twitter-widget-pro/trunk/wp-twitter-widget.php

    r715746 r774406  
    44 * Plugin URI: http://bluedogwebservices.com/wordpress-plugin/twitter-widget-pro/ 
    55 * Description: A widget that properly handles twitter feeds, including @username, #hashtag, and link parsing.  It can even display profile images for the users.  Requires PHP5. 
    6  * Version: 2.5.4 
     6 * Version: 2.6.0 
    77 * Author: Aaron D. Campbell 
    88 * Author URI: http://ran.ge/ 
     
    3131require_once( 'tlc-transients.php' ); 
    3232require_once( 'range-plugin-framework.php' ); 
    33 define( 'TWP_VERSION', '2.5.2' ); 
     33define( 'TWP_VERSION', '2.6.0' ); 
    3434 
    3535/** 
     
    195195            </p> 
    196196            <p><?php echo $wpTwitterWidget->get_support_forum_link(); ?></p> 
     197            <script type="text/javascript"> 
     198                jQuery( '#<?php echo $this->get_field_id( 'username' ) ?>' ).on( 'change', function() { 
     199                    jQuery('#<?php echo $this->get_field_id( 'list' ) ?>' ).val(0); 
     200                }); 
     201                jQuery( '#<?php echo $this->get_field_id( 'list' ) ?>' ).on( 'change', function() { 
     202                    jQuery('#<?php echo $this->get_field_id( 'username' ) ?>' ).val(0); 
     203                }); 
     204            </script> 
    197205<?php 
    198206        return; 
     
    315323        } 
    316324 
     325        if ( 'remove' == $_GET['action'] ) { 
     326            check_admin_referer( 'remove-' . $_GET['screen_name'] ); 
     327 
     328            $redirect_args = array( 
     329                'message'    => 'removed', 
     330                'removed' => '', 
     331            ); 
     332            unset( $this->_settings['twp-authed-users'][strtolower($_GET['screen_name'])] ); 
     333            if ( update_option( 'twp-authed-users', $this->_settings['twp-authed-users'] ) ); 
     334                $redirect_args['removed'] = $_GET['screen_name']; 
     335 
     336            wp_safe_redirect( add_query_arg( $redirect_args, $this->get_options_url() ) ); 
     337            exit; 
     338        } 
    317339        if ( 'authorize' == $_GET['action'] ) { 
    318340            check_admin_referer( 'authorize' ); 
     
    340362 
    341363            $token = $this->_wp_twitter_oauth->get_access_token( $_GET['oauth_verifier'] ); 
    342             $this->_settings['twp-authed-users'][strtolower($token['screen_name'])] = $token; 
    343             update_option( 'twp-authed-users', $this->_settings['twp-authed-users'] ); 
    344  
    345             $redirect_args['authorized'] = $token['screen_name']; 
     364            if ( ! is_wp_error( $token ) ) { 
     365                $this->_settings['twp-authed-users'][strtolower($token['screen_name'])] = $token; 
     366                update_option( 'twp-authed-users', $this->_settings['twp-authed-users'] ); 
     367 
     368                $redirect_args['authorized'] = $token['screen_name']; 
     369            } 
    346370            wp_safe_redirect( add_query_arg( $redirect_args, $this->get_options_url() ) ); 
    347371            exit; 
     
    361385                else 
    362386                    $msg = __( 'There was a problem authorizing your account.', $this->_slug ); 
     387            } elseif ( 'removed' == $_GET['message'] ) { 
     388                if ( ! empty( $_GET['removed'] ) ) 
     389                    $msg = sprintf( __( 'Successfully removed @%s', $this->_slug ), $_GET['removed'] ); 
     390                else 
     391                    $msg = __( 'There was a problem removing your account.', $this->_slug ); 
    363392            } 
    364393            if ( ! empty( $msg ) ) 
     
    420449                $auth_link = ' - <a href="' . esc_url( $authorize_user_url ) . '">' . __( 'Reauthorize', $this->_slug ) . '</a>'; 
    421450            } 
     451            $query_args = array( 
     452                'action' => 'remove', 
     453                'screen_name' => $u['screen_name'], 
     454            ); 
     455            $remove_user_url = wp_nonce_url( add_query_arg( $query_args ), 'remove-' . $u['screen_name'] ); 
    422456            ?> 
    423457                <tr valign="top"> 
    424458                    <th scope="row" style="<?php echo esc_attr( $style ); ?>"> 
    425                         <strong>@<?php echo esc_html( $u['screen_name'] ) . $auth_link; ?></strong> 
     459                        <strong>@<?php echo esc_html( $u['screen_name'] ) . $auth_link;?></strong> 
     460                        <br /><a href="<?php echo esc_url( $remove_user_url ) ?>"><?php _e( 'Remove', $this->_slug ) ?></a> 
    426461                    </th> 
    427462                    <?php 
     
    10451080            } 
    10461081        } elseif ( ! empty( $parameters['list_id'] ) ) { 
    1047             $user = array_shift( explode( '::', $widgetOptions['list'] ) ); 
     1082            $list_info = explode( '::', $widgetOptions['list'] ); 
     1083            $user = array_shift( $list_info ); 
    10481084            $this->_wp_twitter_oauth->set_token( $this->_settings['twp-authed-users'][strtolower( $user )] ); 
    10491085 
    1050             $response = $this->_wp_twitter_oauth->send_authed_request( 'statuses/user_timeline', 'GET', $parameters ); 
     1086            $response = $this->_wp_twitter_oauth->send_authed_request( 'lists/statuses', 'GET', $parameters ); 
    10511087            if ( ! is_wp_error( $response ) ) 
    10521088                return $response; 
     
    10841120        ); 
    10851121 
    1086         if ( ! empty( $widgetOptions['username'] ) ) 
     1122        if ( ! empty( $widgetOptions['username'] ) ) { 
    10871123            $parameters['screen_name'] = $widgetOptions['username']; 
    1088         elseif ( ! empty( $widgetOptions['list'] ) ) 
    1089             $parameters['list_id'] = array_pop( explode( '::', $widgetOptions['list'] ) ); 
     1124        } elseif ( ! empty( $widgetOptions['list'] ) ) { 
     1125            $list_info = explode( '::', $widgetOptions['list'] ); 
     1126            $parameters['list_id'] = array_pop( $list_info ); 
     1127        } 
    10901128 
    10911129        if ( 'true' == $widgetOptions['hidereplies'] ) 
Note: See TracChangeset for help on using the changeset viewer.