WordPress.org

Plugin Directory

Changeset 637051


Ignore:
Timestamp:
12/11/12 14:45:27 (16 months ago)
Author:
wpsmith
Message:

Duplicate Class names fix.

Location:
genesis-latest-tweets/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • genesis-latest-tweets/trunk/genesis-latest-tweets.php

    r635214 r637051  
    11<?php 
    22/* 
    3 Plugin Name: Genesis Twitter 
     3Plugin Name: Genesis Latest Tweets Widget 
    44Plugin URI: http://wpsmith.net/ 
    5 Description: Genesis Twitter Widget. 
     5Description: Genesis Latest Tweets Widget. 
    66Version: 1.0.0 
    77Author: wpsmith 
     
    4040 * 
    4141 * @category Genesis_Twitter 
    42  * @package Widgets 
    43  * @author  Travis Smith 
     42 * @package  Widgets 
     43 * @author   Travis Smith 
    4444 * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later) 
    4545 * @link     http://www.studiopress.com/themes/genesis 
     
    5656    function __construct() { 
    5757 
    58         load_plugin_textdomain( 'genesis-latest-tweets', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 
     58        load_plugin_textdomain( 'genesis-twitter', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); 
    5959 
    60         add_action( 'widgets_init', array( $this, 'load_widget' ) ); 
     60        add_action( 'widgets_init', array( $this, 'load_widget' ), 25 ); 
    6161         
    62         // TODO Waiting on Nathan to determine activation/deactivation steps 
     62        // @todo Waiting on Nathan to determine activation/deactivation steps 
    6363        register_activation_hook( __FILE__, array( $this, 'activate' ) ); 
    6464        //register_deactivation_hook( __FILE__, array( $this, 'deactivate' ) ); 
     
    7272     */ 
    7373    public function load_widget() { 
     74        // Remove Genesis Twiter Widget 
     75        unregister_widget( 'Genesis_Latest_Tweets_Widget' ); 
     76     
    7477        require_once( GENESIS_TWITTER_DIR . '/includes/latest-tweets-widget.php' ); 
    75         register_widget( 'Genesis_Latest_Tweets_Widget' ); 
     78        register_widget( 'GLTW_Latest_Tweets_Widget' ); 
    7679    } // end load_widget 
    7780     
     
    8487        $latest = '1.9'; 
    8588 
    86         $theme = wp_get_theme(); 
     89        $theme  = wp_get_theme(); 
    8790        $parent = wp_get_theme( $theme->Template ); 
    8891 
     
    111114         
    112115        // Output message 
    113         printf( '<div id="message" class="error"><p>' . __( 'Sorry, you can\'t activate unless you have installed <a href="%s">Genesis %s</a> or greater', 'genesis-latest-tweets' ) . '</p></div>', 'http://www.studiopress.com/genesis', __( $latest, 'genesis-latest-tweets' ) ); 
     116        printf( '<div id="message" class="error"><p>' . __( 'Sorry, you can\'t activate unless you have installed <a href="%s">Genesis %s</a> or greater', 'genesis-twitter' ) . '</p></div>', 'http://www.studiopress.com/genesis', __( $latest, 'genesis-twitter' ) ); 
    114117         
    115118        // Remove single activation notice hack. 
  • genesis-latest-tweets/trunk/includes/formatting.php

    r635214 r637051  
    55 * @category Genesis_Twitter 
    66 * @package  Functions 
    7  * @author   StudioPress 
    8  * @author   Travis Smith 
     7 * @author   Travis Smith, for StudioPress 
    98 * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later) 
    109 */ 
    11  
    1210 
    1311/** 
     
    2523 * @return string Linkified tweet content 
    2624 */ 
    27 function genesis_tweet_linkify( $text ) { 
     25function gltw_tweet_linkify( $text ) { 
    2826 
    2927    $text = preg_replace( "#(^|[\n ])([\w]+?://[\w]+[^ \"\n\r\t< ]*)#", '\\1<a href="\\2" target="_blank">\\2</a>', $text ); 
  • genesis-latest-tweets/trunk/includes/latest-tweets-widget.php

    r635214 r637051  
    55 * @category Genesis_Twitter 
    66 * @package  Widgets 
    7  * @author   StudioPress 
    8  * @author   Travis Smith 
     7 * @author   Travis Smith, for StudioPress 
    98 * @license  http://www.opensource.org/licenses/gpl-license.php GPL v2.0 (or later) 
    109 */ 
    11  
    1210 
    1311/** 
     
    1917 * @since 1.0.0 
    2018 */ 
    21 class Genesis_Latest_Tweets_Widget extends WP_Widget { 
     19class GLTW_Latest_Tweets_Widget extends WP_Widget { 
    2220 
    2321    /** 
     
    4745        $widget_ops = array( 
    4846            'classname'   => 'latest-tweets', 
    49             'description' => __( 'Display a list of your latest tweets.', 'genesis-latest-tweets' ), 
     47            'description' => __( 'Display a list of your latest tweets.', 'genesis-twitter' ), 
    5048        ); 
    5149 
     
    5654        ); 
    5755 
    58         $this->WP_Widget( 'latest-tweets', __( 'Genesis - Latest Tweets', 'genesis-latest-tweets' ), $widget_ops, $control_ops ); 
     56        $this->WP_Widget( 'latest-tweets', __( 'Genesis - Latest Tweets', 'genesis-twitter' ), $widget_ops, $control_ops ); 
    5957 
    6058    } 
     
    9896 
    9997            if ( ! $twitter ) { 
    100                 $tweets[] = '<li>' . __( 'The Twitter API is taking too long to respond. Please try again later.', 'genesis-latest-tweets' ) . '</li>' . "\n"; 
     98                $tweets[] = '<li>' . __( 'The Twitter API is taking too long to respond. Please try again later.', 'genesis-twitter' ) . '</li>' . "\n"; 
    10199            } 
    102100            elseif ( is_wp_error( $twitter ) ) { 
    103                 $tweets[] = '<li>' . __( 'There was an error while attempting to contact the Twitter API. Please try again.', 'genesis-latest-tweets' ) . '</li>' . "\n"; 
     101                $tweets[] = '<li>' . __( 'There was an error while attempting to contact the Twitter API. Please try again.', 'genesis-twitter' ) . '</li>' . "\n"; 
    104102            } 
    105103            elseif ( is_object( $json ) && $json->error ) { 
    106                 $tweets[] = '<li>' . __( 'The Twitter API returned an error while processing your request. Please try again.', 'genesis-latest-tweets' ) . '</li>' . "\n"; 
     104                $tweets[] = '<li>' . __( 'The Twitter API returned an error while processing your request. Please try again.', 'genesis-twitter' ) . '</li>' . "\n"; 
    107105            } 
    108106            else { 
     
    118116 
    119117                    /** Add tweet to array */ 
    120                     $timeago = sprintf( __( 'about %s ago', 'genesis-latest-tweets' ), human_time_diff( strtotime( $tweet->created_at ) ) ); 
     118                    $timeago = sprintf( __( 'about %s ago', 'genesis-twitter' ), human_time_diff( strtotime( $tweet->created_at ) ) ); 
    121119                    $timeago_link = sprintf( '<a href="%s" rel="nofollow">%s</a>', esc_url( sprintf( 'http://twitter.com/%s/status/%s', $instance['twitter_id'], $tweet->id_str ) ), esc_html( $timeago ) ); 
    122120 
    123                     $tweets[] = '<li>' . genesis_tweet_linkify( $tweet->text ) . ' <span style="font-size: 85%;">' . $timeago_link . '</span></li>' . "\n"; 
     121                    $tweets[] = '<li>' . gltw_tweet_linkify( $tweet->text ) . ' <span style="font-size: 85%;">' . $timeago_link . '</span></li>' . "\n"; 
    124122                } 
    125123 
     
    181179        ?> 
    182180        <p> 
    183             <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'genesis-latest-tweets' ); ?>:</label> 
     181            <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title', 'genesis-twitter' ); ?>:</label> 
    184182            <input type="text" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $instance['title'] ); ?>" class="widefat" /> 
    185183        </p> 
    186184 
    187185        <p> 
    188             <label for="<?php echo $this->get_field_id( 'twitter_id' ); ?>"><?php _e( 'Twitter Username', 'genesis-latest-tweets' ); ?>:</label> 
     186            <label for="<?php echo $this->get_field_id( 'twitter_id' ); ?>"><?php _e( 'Twitter Username', 'genesis-twitter' ); ?>:</label> 
    189187            <input type="text" id="<?php echo $this->get_field_id( 'twitter_id' ); ?>" name="<?php echo $this->get_field_name( 'twitter_id' ); ?>" value="<?php echo esc_attr( $instance['twitter_id'] ); ?>" class="widefat" /> 
    190188        </p> 
    191189 
    192190        <p> 
    193             <label for="<?php echo $this->get_field_id( 'twitter_num' ); ?>"><?php _e( 'Number of Tweets to Show', 'genesis-latest-tweets' ); ?>:</label> 
     191            <label for="<?php echo $this->get_field_id( 'twitter_num' ); ?>"><?php _e( 'Number of Tweets to Show', 'genesis-twitter' ); ?>:</label> 
    194192            <input type="text" id="<?php echo $this->get_field_id( 'twitter_num' ); ?>" name="<?php echo $this->get_field_name( 'twitter_num' ); ?>" value="<?php echo esc_attr( $instance['twitter_num'] ); ?>" size="3" /> 
    195193        </p> 
     
    197195        <p> 
    198196            <input id="<?php echo $this->get_field_id( 'twitter_hide_replies' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'twitter_hide_replies' ); ?>" value="1" <?php checked( $instance['twitter_hide_replies'] ); ?>/> 
    199             <label for="<?php echo $this->get_field_id( 'twitter_hide_replies' ); ?>"><?php _e( 'Hide @ Replies', 'genesis-latest-tweets' ); ?></label> 
    200         </p> 
    201  
    202         <p> 
    203             <label for="<?php echo $this->get_field_id( 'twitter_duration' ); ?>"><?php _e( 'Load new Tweets every', 'genesis-latest-tweets' ); ?></label> 
     197            <label for="<?php echo $this->get_field_id( 'twitter_hide_replies' ); ?>"><?php _e( 'Hide @ Replies', 'genesis-twitter' ); ?></label> 
     198        </p> 
     199 
     200        <p> 
     201            <label for="<?php echo $this->get_field_id( 'twitter_duration' ); ?>"><?php _e( 'Load new Tweets every', 'genesis-twitter' ); ?></label> 
    204202            <select name="<?php echo $this->get_field_name( 'twitter_duration' ); ?>" id="<?php echo $this->get_field_id( 'twitter_duration' ); ?>"> 
    205                 <option value="5" <?php selected( 5, $instance['twitter_duration'] ); ?>><?php _e( '5 Min.' , 'genesis-latest-tweets' ); ?></option> 
    206                 <option value="15" <?php selected( 15, $instance['twitter_duration'] ); ?>><?php _e( '15 Minutes' , 'genesis-latest-tweets' ); ?></option> 
    207                 <option value="30" <?php selected( 30, $instance['twitter_duration'] ); ?>><?php _e( '30 Minutes' , 'genesis-latest-tweets' ); ?></option> 
    208                 <option value="60" <?php selected( 60, $instance['twitter_duration'] ); ?>><?php _e( '1 Hour' , 'genesis-latest-tweets' ); ?></option> 
    209                 <option value="120" <?php selected( 120, $instance['twitter_duration'] ); ?>><?php _e( '2 Hours' , 'genesis-latest-tweets' ); ?></option> 
    210                 <option value="240" <?php selected( 240, $instance['twitter_duration'] ); ?>><?php _e( '4 Hours' , 'genesis-latest-tweets' ); ?></option> 
    211                 <option value="720" <?php selected( 720, $instance['twitter_duration'] ); ?>><?php _e( '12 Hours' , 'genesis-latest-tweets' ); ?></option> 
    212                 <option value="1440" <?php selected( 1440, $instance['twitter_duration'] ); ?>><?php _e( '24 Hours' , 'genesis-latest-tweets' ); ?></option> 
     203                <option value="5" <?php selected( 5, $instance['twitter_duration'] ); ?>><?php _e( '5 Min.' , 'genesis-twitter' ); ?></option> 
     204                <option value="15" <?php selected( 15, $instance['twitter_duration'] ); ?>><?php _e( '15 Minutes' , 'genesis-twitter' ); ?></option> 
     205                <option value="30" <?php selected( 30, $instance['twitter_duration'] ); ?>><?php _e( '30 Minutes' , 'genesis-twitter' ); ?></option> 
     206                <option value="60" <?php selected( 60, $instance['twitter_duration'] ); ?>><?php _e( '1 Hour' , 'genesis-twitter' ); ?></option> 
     207                <option value="120" <?php selected( 120, $instance['twitter_duration'] ); ?>><?php _e( '2 Hours' , 'genesis-twitter' ); ?></option> 
     208                <option value="240" <?php selected( 240, $instance['twitter_duration'] ); ?>><?php _e( '4 Hours' , 'genesis-twitter' ); ?></option> 
     209                <option value="720" <?php selected( 720, $instance['twitter_duration'] ); ?>><?php _e( '12 Hours' , 'genesis-twitter' ); ?></option> 
     210                <option value="1440" <?php selected( 1440, $instance['twitter_duration'] ); ?>><?php _e( '24 Hours' , 'genesis-twitter' ); ?></option> 
    213211            </select> 
    214212        </p> 
     
    216214        <p> 
    217215            <input id="<?php echo $this->get_field_id( 'follow_link_show' ); ?>" type="checkbox" name="<?php echo $this->get_field_name( 'follow_link_show' ); ?>" value="1" <?php checked( $instance['follow_link_show'] ); ?>/> 
    218             <label for="<?php echo $this->get_field_id( 'follow_link_show' ); ?>"><?php _e( 'Include link to twitter page?', 'genesis-latest-tweets' ); ?></label> 
    219         </p> 
    220  
    221         <p> 
    222             <label for="<?php echo $this->get_field_id( 'follow_link_text' ); ?>"><?php _e( 'Link Text (required)', 'genesis-latest-tweets' ); ?>:</label> 
     216            <label for="<?php echo $this->get_field_id( 'follow_link_show' ); ?>"><?php _e( 'Include link to twitter page?', 'genesis-twitter' ); ?></label> 
     217        </p> 
     218 
     219        <p> 
     220            <label for="<?php echo $this->get_field_id( 'follow_link_text' ); ?>"><?php _e( 'Link Text (required)', 'genesis-twitter' ); ?>:</label> 
    223221            <input type="text" id="<?php echo $this->get_field_id( 'follow_link_text' ); ?>" name="<?php echo $this->get_field_name( 'follow_link_text' ); ?>" value="<?php echo esc_attr( $instance['follow_link_text'] ); ?>" class="widefat" /> 
    224222        </p> 
Note: See TracChangeset for help on using the changeset viewer.