WordPress.org

Plugin Directory

Changeset 1180266


Ignore:
Timestamp:
06/13/15 16:22:27 (3 years ago)
Author:
Rimon_Habib
Message:

Version 1.2.5 released, fatal error fix

Location:
rimons-twitter-widget
Files:
10 added
1 edited

Legend:

Unmodified
Added
Removed
  • rimons-twitter-widget/trunk/widget.php

    r731625 r1180266  
    22class rtw_twitter_widget extends WP_Widget{ 
    33 
    4   function rtw_twitter_widget(){ 
    5       parent::WP_Widget( $id = 'rtw_twitter_widget', $name = 'Rimons Twitter Widget'/*get_class($this)*/, $options = array( 'description' => 'Grab your tweets from twitter and show it to your sidebar' ) ); 
    6     } 
    7      
    8   function widget( $args, $instance) { 
    9       extract( $args ); 
    10       $title = apply_filters( 'widget_title', $instance['rtw_twitter_title'] ); 
    11     echo $before_widget; 
    12       if ( $title ) 
    13          echo $before_title . $title . $after_title;  
    14      
    15     $rtw = get_option('rtw_settings'); 
    16     $rtw_config = $rtw['config']; 
    17         if( count($rtw_config) == 4 ){ 
    18             rtw_tweet_markup(' ',$instance['rtw_twitter_number']); 
    19     } 
    20     else{ 
    21       echo "<p>Please configure your twitter API settings</p>"; 
    22     } 
    23       echo $after_widget; 
    24   } 
    25      
    26   function update( $new_instance, $old_instance ) { 
    27     $instance = $old_instance; 
    28  
    29     $instance['rtw_twitter_title'] = strip_tags($new_instance['rtw_twitter_title']); 
    30     $instance['rtw_twitter_font_size'] = strip_tags($new_instance['rtw_twitter_font_size']); 
    31      
    32     $instance['rtw_twitter_number'] = $new_instance['rtw_twitter_number']; 
    33     $instance['rtw_twitter_width'] = $new_instance['rtw_twitter_width']; 
    34     $instance['rtw_twitter_height'] = $new_instance['rtw_twitter_height']; 
    35  
    36     $instance['rtw_twitter_container_background'] = $new_instance['rtw_twitter_container_background']; 
    37     $instance['rtw_twitter_container_color'] = $new_instance['rtw_twitter_container_color']; 
    38     $instance['rtw_twitter_tweet_background'] = $new_instance['rtw_twitter_tweet_background']; 
    39     $instance['rtw_twitter_tweet_color'] = $new_instance['rtw_twitter_tweet_color']; 
    40     $instance['rtw_twitter_tweet_link_color'] = $new_instance['rtw_twitter_tweet_link_color']; 
    41  
    42     $instance['rtw_twitter_scroll'] = $new_instance['rtw_twitter_scroll']; 
    43     $instance['rtw_twitter_live'] = $new_instance['rtw_twitter_live']; 
    44     $instance['rtw_twitter_show_logo'] = $new_instance['rtw_twitter_show_logo']; 
    45     $instance['rtw_twitter_show_username'] = $new_instance['rtw_twitter_show_username']; 
    46     $instance['rtw_twitter_show_credit'] = $new_instance['rtw_twitter_show_credit']; 
    47     return $instance; 
    48     } 
    49          
    50   function form ($instance){  
    51     global $logo; 
    52     $rtw = get_option('rtw_settings'); 
    53     $rtw_config = $rtw['config']; 
    54     if( count($rtw_config) < 4 ){ 
    55       echo 'Please configure your twitter API setting first from <a href="'.site_url().'/wp-admin/admin.php?page=rimons_twitter_widget">here</a>'; 
    56       return; 
    57     } 
    58      
    59     $instance['rtw_twitter_number']= ($instance['rtw_twitter_number'] ?  $instance['rtw_twitter_number'] : 7 ); 
    60     $instance['rtw_twitter_width']= ($instance['rtw_twitter_width'] ?  $instance['rtw_twitter_width'] : '198' ); 
    61     $instance['rtw_twitter_height']= ($instance['rtw_twitter_height'] ?  $instance['rtw_twitter_height'] : '300' ); 
    62     $instance['rtw_twitter_container_background']= ($instance['rtw_twitter_container_background'] ?  $instance['rtw_twitter_container_background'] : '#c4deeb' ); 
    63     $instance['rtw_twitter_container_color']= ($instance['rtw_twitter_container_color'] ?  $instance['rtw_twitter_container_color'] : '#3d2c3d' ); 
    64     $instance['rtw_twitter_tweet_background']= ($instance['rtw_twitter_tweet_background'] ?  $instance['rtw_twitter_tweet_background'] : '#eaf6fd' ); 
    65     $instance['rtw_twitter_font_size']= ($instance['rtw_twitter_number'] ?  $instance['rtw_twitter_font_size'] : '' ); 
    66      
    67     $instance['rtw_twitter_tweet_color']= ($instance['rtw_twitter_tweet_color'] ?  $instance['rtw_twitter_tweet_color'] : '#816666' ); 
    68     $instance['rtw_twitter_tweet_link_color']= ($instance['rtw_twitter_tweet_link_color'] ?  $instance['rtw_twitter_tweet_link_color'] : '#497da8' ); 
    69     $scroll_select= ($instance['rtw_twitter_scroll']=='false' ? " selected " : ''); 
    70     $live_select= ($instance['rtw_twitter_live']=='false' ? " selected " : ''); 
    71     $logo_select= ($instance['rtw_twitter_show_logo']=='false' ? " selected " : ''); 
    72     $username_select= ($instance['rtw_twitter_show_username']=='false' ? " selected " : ''); 
    73     $credit_select = ($instance['rtw_twitter_show_credit']=='false' ? " selected " : ''); 
    74      
    75     ?> 
    76                    
    77     <label for="<?php echo $this->get_field_id('rtw_twitter_title'); ?>"><?php _e('Title:'); ?></label>          
    78     <input class="widefat" id="<?php echo $this->get_field_id('rtw_twitter_title'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_title'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_title']); ?>" /> 
    79     <br> 
    80      
    81     <label for="<?php echo $this->get_field_id('rtw_twitter_number'); ?>"><?php _e('number of tweets:'); ?></label>          
    82     <input class="widefat" id="<?php echo $this->get_field_id('rtw_twitter_number'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_number'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_number']); ?>" /> 
    83     <br> 
    84      
    85      
    86     <label for="<?php echo $this->get_field_id('rtw_twitter_width'); ?>"><?php _e('Width:'); ?></label>          
    87     <input class="widefat" size="3" id="<?php echo $this->get_field_id('rtw_twitter_width'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_width'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_width']); ?>" /> 
    88      
    89     <label for="<?php echo $this->get_field_id('rtw_twitter_height'); ?>"><?php _e('Height:'); ?></label>            
    90     <input class="widefat" size="3" id="<?php echo $this->get_field_id('rtw_twitter_height'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_height'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_height']); ?>" /> 
    91     <br> 
    92  
    93      
    94     <label for="<?php echo $this->get_field_id('rtw_twitter_container_background'); ?>"><?php _e('Container Background:'); ?></label>            
    95     <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_container_background'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_container_background'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_container_background']); ?>" /> 
    96     <br> 
    97      
    98     <label for="<?php echo $this->get_field_id('rtw_twitter_container_color'); ?>"><?php _e('Container Text Color:'); ?></label>             
    99     <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_container_color'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_container_color'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_container_color']); ?>" /> 
    100     <br> 
    101      
    102     <label for="<?php echo $this->get_field_id('rtw_twitter_tweet_background'); ?>"><?php _e('Tweets Background:'); ?></label>           
    103     <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_tweet_background'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_tweet_background'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_tweet_background']); ?>" /> 
    104     <br> 
    105      
    106     <label for="<?php echo $this->get_field_id('rtw_twitter_font_size'); ?>"><?php _e('Font size (in px):'); ?></label>          
    107     <input class="widefat" id="<?php echo $this->get_field_id('rtw_twitter_font_size'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_font_size'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_font_size']); ?>" /> 
    108     <br> 
    109      
    110     <label for="<?php echo $this->get_field_id('rtw_twitter_tweet_color'); ?>"><?php _e('Tweet Text Color:'); ?></label>             
    111     <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_tweet_color'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_tweet_color'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_tweet_color']); ?>" /> 
    112     <br> 
    113      
    114     <label for="<?php echo $this->get_field_id('rtw_twitter_tweet_link_color'); ?>"><?php _e('Tweets Link Color:'); ?></label>           
    115     <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_tweet_link_color'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_tweet_link_color'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_tweet_link_color']); ?>" /> 
    116     <br> 
    117      
    118     <label for="<?php echo $this->get_field_id('rtw_twitter_scroll'); ?>"><?php _e('Scroll:'); ?></label>            
    119     <select  id="<?php echo $this->get_field_id('rtw_twitter_scroll'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_scroll'); ?>" > 
    120      
    121         <option value="true">True</option> 
    122         <option value="false" <?php echo $scroll_select; ?> >False</option> 
    123          
    124     </select> 
    125     <br> 
    126  
    127     <label for="<?php echo $this->get_field_id('rtw_twitter_live'); ?>"><?php _e('Live:'); ?></label>            
    128     <select  id="<?php echo $this->get_field_id('rtw_twitter_live'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_live'); ?>" > 
    129      
    130         <option value="true">True</option> 
    131         <option value="false" <?php echo $live_select; ?> >False</option> 
    132          
    133     </select> 
    134     <br> 
    135      
    136     <label for="<?php echo $this->get_field_id('rtw_twitter_show_logo'); ?>"><?php _e('Show Twitter Logo'); ?></label>           
    137     <select  id="<?php echo $this->get_field_id('rtw_twitter_show_logo'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_show_logo'); ?>" > 
    138      
    139         <option value="true">True</option> 
    140         <option value="false" <?php echo $logo_select; ?> >False</option> 
    141          
    142     </select> 
    143      
    144     <br> 
    145      
    146     <label for="<?php echo $this->get_field_id('rtw_twitter_show_username'); ?>"><?php _e('Show Twitter Username'); ?></label>           
    147     <select  id="<?php echo $this->get_field_id('rtw_twitter_show_username'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_show_username'); ?>" > 
    148      
    149         <option value="true">True</option> 
    150         <option value="false" <?php echo $username_select; ?> >False</option> 
    151          
    152     </select> 
    153  
    154     <br> 
    155      
    156     <label for="<?php echo $this->get_field_id('rtw_twitter_show_credit'); ?>"><?php _e('Credit link'); ?></label>           
    157     <select  id="<?php echo $this->get_field_id('rtw_twitter_show_credit'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_show_credit'); ?>" > 
    158      
    159         <option value="true">True</option> 
    160         <option value="false" <?php echo $credit_select; ?> >False</option> 
    161          
    162     </select>    
    163              
    164     <?  
    165   } 
    166      
    167   public function rtw_get_style(){ 
    168      $ops = get_option('widget_'.$this->id_base); 
    169      $key = key( array_slice( $ops, -2, 1, TRUE ) ); 
    170      $style = '<style type="text/css">'; 
    171       
    172           
    173          if(isset($ops[$key]['rtw_twitter_show_logo']) && $ops[$key]['rtw_twitter_show_logo'] == 'false'){ 
     4    function rtw_twitter_widget(){ 
     5        parent::WP_Widget( $id = 'rtw_twitter_widget', $name = 'Rimons Twitter Widget'/*get_class($this)*/, $options = array( 'description' => 'Grab your tweets from twitter and show it to your sidebar' ) ); 
     6    } 
     7 
     8    function widget( $args, $instance) { 
     9        extract( $args ); 
     10        $title = apply_filters( 'widget_title', $instance['rtw_twitter_title'] ); 
     11        echo $before_widget; 
     12        if ( $title ) 
     13            echo $before_title . $title . $after_title; 
     14 
     15        $rtw = get_option('rtw_settings'); 
     16        $rtw_config = $rtw['config']; 
     17        if( count($rtw_config) == 4 ){ 
     18            rtw_tweet_markup(' ',$instance['rtw_twitter_number']); 
     19        } 
     20        else{ 
     21            echo "<p>Please configure your twitter API settings</p>"; 
     22        } 
     23        echo $after_widget; 
     24    } 
     25 
     26    function update( $new_instance, $old_instance ) { 
     27        $instance = $old_instance; 
     28 
     29        $instance['rtw_twitter_title'] = strip_tags($new_instance['rtw_twitter_title']); 
     30        $instance['rtw_twitter_font_size'] = strip_tags($new_instance['rtw_twitter_font_size']); 
     31 
     32        $instance['rtw_twitter_number'] = $new_instance['rtw_twitter_number']; 
     33        $instance['rtw_twitter_width'] = $new_instance['rtw_twitter_width']; 
     34        $instance['rtw_twitter_height'] = $new_instance['rtw_twitter_height']; 
     35 
     36        $instance['rtw_twitter_container_background'] = $new_instance['rtw_twitter_container_background']; 
     37        $instance['rtw_twitter_container_color'] = $new_instance['rtw_twitter_container_color']; 
     38        $instance['rtw_twitter_tweet_background'] = $new_instance['rtw_twitter_tweet_background']; 
     39        $instance['rtw_twitter_tweet_color'] = $new_instance['rtw_twitter_tweet_color']; 
     40        $instance['rtw_twitter_tweet_link_color'] = $new_instance['rtw_twitter_tweet_link_color']; 
     41 
     42        $instance['rtw_twitter_scroll'] = $new_instance['rtw_twitter_scroll']; 
     43        $instance['rtw_twitter_live'] = $new_instance['rtw_twitter_live']; 
     44        $instance['rtw_twitter_show_logo'] = $new_instance['rtw_twitter_show_logo']; 
     45        $instance['rtw_twitter_show_username'] = $new_instance['rtw_twitter_show_username']; 
     46        $instance['rtw_twitter_show_credit'] = $new_instance['rtw_twitter_show_credit']; 
     47        return $instance; 
     48    } 
     49 
     50    function form ($instance){ 
     51        global $logo; 
     52        $rtw = get_option('rtw_settings'); 
     53        $rtw_config = $rtw['config']; 
     54        if( count($rtw_config) < 4 ){ 
     55            echo 'Please configure your twitter API setting first from <a href="'.site_url().'/wp-admin/admin.php?page=rimons_twitter_widget">here</a>'; 
     56            return; 
     57        } 
     58 
     59        $instance['rtw_twitter_number']= ($instance['rtw_twitter_number'] ?  $instance['rtw_twitter_number'] : 7 ); 
     60        $instance['rtw_twitter_width']= ($instance['rtw_twitter_width'] ?  $instance['rtw_twitter_width'] : '198' ); 
     61        $instance['rtw_twitter_height']= ($instance['rtw_twitter_height'] ?  $instance['rtw_twitter_height'] : '300' ); 
     62        $instance['rtw_twitter_container_background']= ($instance['rtw_twitter_container_background'] ?  $instance['rtw_twitter_container_background'] : '#c4deeb' ); 
     63        $instance['rtw_twitter_container_color']= ($instance['rtw_twitter_container_color'] ?  $instance['rtw_twitter_container_color'] : '#3d2c3d' ); 
     64        $instance['rtw_twitter_tweet_background']= ($instance['rtw_twitter_tweet_background'] ?  $instance['rtw_twitter_tweet_background'] : '#eaf6fd' ); 
     65        $instance['rtw_twitter_font_size']= ($instance['rtw_twitter_number'] ?  $instance['rtw_twitter_font_size'] : '' ); 
     66 
     67        $instance['rtw_twitter_tweet_color']= ($instance['rtw_twitter_tweet_color'] ?  $instance['rtw_twitter_tweet_color'] : '#816666' ); 
     68        $instance['rtw_twitter_tweet_link_color']= ($instance['rtw_twitter_tweet_link_color'] ?  $instance['rtw_twitter_tweet_link_color'] : '#497da8' ); 
     69        $scroll_select= ($instance['rtw_twitter_scroll']=='false' ? " selected " : ''); 
     70        $live_select= ($instance['rtw_twitter_live']=='false' ? " selected " : ''); 
     71        $logo_select= ($instance['rtw_twitter_show_logo']=='false' ? " selected " : ''); 
     72        $username_select= ($instance['rtw_twitter_show_username']=='false' ? " selected " : ''); 
     73        $credit_select = ($instance['rtw_twitter_show_credit']=='false' ? " selected " : ''); 
     74 
     75        ?> 
     76 
     77        <label for="<?php echo $this->get_field_id('rtw_twitter_title'); ?>"><?php _e('Title:'); ?></label> 
     78        <input class="widefat" id="<?php echo $this->get_field_id('rtw_twitter_title'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_title'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_title']); ?>" /> 
     79        <br> 
     80 
     81        <label for="<?php echo $this->get_field_id('rtw_twitter_number'); ?>"><?php _e('number of tweets:'); ?></label> 
     82        <input class="widefat" id="<?php echo $this->get_field_id('rtw_twitter_number'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_number'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_number']); ?>" /> 
     83        <br> 
     84 
     85 
     86        <label for="<?php echo $this->get_field_id('rtw_twitter_width'); ?>"><?php _e('Width:'); ?></label> 
     87        <input class="widefat" size="3" id="<?php echo $this->get_field_id('rtw_twitter_width'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_width'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_width']); ?>" /> 
     88 
     89        <label for="<?php echo $this->get_field_id('rtw_twitter_height'); ?>"><?php _e('Height:'); ?></label> 
     90        <input class="widefat" size="3" id="<?php echo $this->get_field_id('rtw_twitter_height'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_height'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_height']); ?>" /> 
     91        <br> 
     92 
     93 
     94        <label for="<?php echo $this->get_field_id('rtw_twitter_container_background'); ?>"><?php _e('Container Background:'); ?></label> 
     95        <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_container_background'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_container_background'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_container_background']); ?>" /> 
     96        <br> 
     97 
     98        <label for="<?php echo $this->get_field_id('rtw_twitter_container_color'); ?>"><?php _e('Container Text Color:'); ?></label> 
     99        <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_container_color'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_container_color'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_container_color']); ?>" /> 
     100        <br> 
     101 
     102        <label for="<?php echo $this->get_field_id('rtw_twitter_tweet_background'); ?>"><?php _e('Tweets Background:'); ?></label> 
     103        <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_tweet_background'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_tweet_background'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_tweet_background']); ?>" /> 
     104        <br> 
     105 
     106        <label for="<?php echo $this->get_field_id('rtw_twitter_font_size'); ?>"><?php _e('Font size (in px):'); ?></label> 
     107        <input class="widefat" id="<?php echo $this->get_field_id('rtw_twitter_font_size'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_font_size'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_font_size']); ?>" /> 
     108        <br> 
     109 
     110        <label for="<?php echo $this->get_field_id('rtw_twitter_tweet_color'); ?>"><?php _e('Tweet Text Color:'); ?></label> 
     111        <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_tweet_color'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_tweet_color'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_tweet_color']); ?>" /> 
     112        <br> 
     113 
     114        <label for="<?php echo $this->get_field_id('rtw_twitter_tweet_link_color'); ?>"><?php _e('Tweets Link Color:'); ?></label> 
     115        <input class="widefat colorpick"  id="<?php echo $this->get_field_id('rtw_twitter_tweet_link_color'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_tweet_link_color'); ?>" type="text" value="<?php echo esc_attr($instance['rtw_twitter_tweet_link_color']); ?>" /> 
     116        <br> 
     117 
     118        <label for="<?php echo $this->get_field_id('rtw_twitter_scroll'); ?>"><?php _e('Scroll:'); ?></label> 
     119        <select  id="<?php echo $this->get_field_id('rtw_twitter_scroll'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_scroll'); ?>" > 
     120 
     121            <option value="true">True</option> 
     122            <option value="false" <?php echo $scroll_select; ?> >False</option> 
     123 
     124        </select> 
     125        <br> 
     126 
     127        <label for="<?php echo $this->get_field_id('rtw_twitter_live'); ?>"><?php _e('Live:'); ?></label> 
     128        <select  id="<?php echo $this->get_field_id('rtw_twitter_live'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_live'); ?>" > 
     129 
     130            <option value="true">True</option> 
     131            <option value="false" <?php echo $live_select; ?> >False</option> 
     132 
     133        </select> 
     134        <br> 
     135 
     136        <label for="<?php echo $this->get_field_id('rtw_twitter_show_logo'); ?>"><?php _e('Show Twitter Logo'); ?></label> 
     137        <select  id="<?php echo $this->get_field_id('rtw_twitter_show_logo'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_show_logo'); ?>" > 
     138 
     139            <option value="true">True</option> 
     140            <option value="false" <?php echo $logo_select; ?> >False</option> 
     141 
     142        </select> 
     143 
     144        <br> 
     145 
     146        <label for="<?php echo $this->get_field_id('rtw_twitter_show_username'); ?>"><?php _e('Show Twitter Username'); ?></label> 
     147        <select  id="<?php echo $this->get_field_id('rtw_twitter_show_username'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_show_username'); ?>" > 
     148 
     149            <option value="true">True</option> 
     150            <option value="false" <?php echo $username_select; ?> >False</option> 
     151 
     152        </select> 
     153 
     154        <br> 
     155 
     156        <label for="<?php echo $this->get_field_id('rtw_twitter_show_credit'); ?>"><?php _e('Credit link'); ?></label> 
     157        <select  id="<?php echo $this->get_field_id('rtw_twitter_show_credit'); ?>" name="<?php echo $this->get_field_name('rtw_twitter_show_credit'); ?>" > 
     158 
     159            <option value="true">True</option> 
     160            <option value="false" <?php echo $credit_select; ?> >False</option> 
     161 
     162        </select> 
     163 
     164    <?php 
     165    } 
     166 
     167    public function rtw_get_style(){ 
     168        $ops = get_option('widget_'.$this->id_base); 
     169        $key = key( array_slice( (array)$ops, -2, 1, TRUE ) ); 
     170        $style = '<style type="text/css">'; 
     171 
     172 
     173        if(isset($ops[$key]['rtw_twitter_show_logo']) && $ops[$key]['rtw_twitter_show_logo'] == 'false'){ 
    174174            $style .= ".rtw_footer .twitter_widget_footer_logo img{ display: none; }"; 
    175           } 
    176  
    177          if(isset($ops[$key]['rtw_twitter_show_username']) && $ops[$key]['rtw_twitter_show_username'] == 'false' ) 
    178                  $style .= ".rtw_twitter_username h3{ display: none; } "; 
    179           
    180          if( $ops[$key]['rtw_twitter_show_credit'] != 'false' ) 
    181                  add_action('wp_footer','rimon_credit_link'); 
    182           
    183          if($ops[$key]['rtw_twitter_font_size']) 
    184                   $style .= ".rtw_tweets li p{ font-size:".$ops[$key]['rtw_twitter_font_size'] ."px !important; }"; 
    185            
    186           if($ops[$key]['rtw_twitter_width']) 
    187                   $style .= ".rtw_container{ width:".$ops[$key]['rtw_twitter_width']."px !important; }"; 
    188  
    189           if($ops[$key]['rtw_twitter_height']) 
    190                  $style .= ".rtw_tweets{ height:".$ops[$key]['rtw_twitter_height']."px !important; }"; 
    191  
    192           if($ops[$key]['rtw_twitter_container_background']) 
    193                  $style .= ".rtw_container{ background:".$ops[$key]['rtw_twitter_container_background'] ." !important; }"; 
    194  
    195           if($ops[$key]['rtw_twitter_container_color']) 
    196                   $style .= ".rtw_twitter_username p a,.rtw_twitter_username h3 a,.rtw_footer .twitter_widget_footer_link a{ color:".$ops[$key]['rtw_twitter_container_color'] ." !important; }"; 
    197            
    198           if($ops[$key]['rtw_twitter_tweet_background']) 
    199                  $style .= ".rtw_tweets{ background:".$ops[$key]['rtw_twitter_tweet_background'] ." !important; }"; 
    200  
    201           if($ops[$key]['rtw_twitter_tweet_color']) 
    202                   $style .= ".rtw_tweets li p{ color:". $ops[$key]['rtw_twitter_tweet_color'] ." !important; }"; 
    203            
    204           if($ops[$key]['rtw_twitter_tweet_link_color']) 
    205                   $style .= ".rtw_tweets li a,.rtw_tweets li p a{ color:". $ops[$key]['rtw_twitter_tweet_link_color'] ." !important; }"; 
    206  
    207           if($ops[$key]['rtw_twitter_scroll'] == 'false') 
    208                   $style .= ".rtw_tweets{ overflow-y: hidden !important; }"; 
    209            
    210            
    211  
    212           if($ops[$key]['rtw_twitter_live'] == 'true'){ 
     175        } 
     176 
     177        if(isset($ops[$key]['rtw_twitter_show_username']) && $ops[$key]['rtw_twitter_show_username'] == 'false' ) 
     178            $style .= ".rtw_twitter_username h3{ display: none; } "; 
     179 
     180        if( $ops[$key]['rtw_twitter_show_credit'] != 'false' ) 
     181            add_action('wp_footer','rimon_credit_link'); 
     182 
     183        if($ops[$key]['rtw_twitter_font_size']) 
     184            $style .= ".rtw_tweets li p{ font-size:".$ops[$key]['rtw_twitter_font_size'] ."px !important; }"; 
     185 
     186        if($ops[$key]['rtw_twitter_width']) 
     187            $style .= ".rtw_container{ width:".$ops[$key]['rtw_twitter_width']."px !important; }"; 
     188 
     189        if($ops[$key]['rtw_twitter_height']) 
     190            $style .= ".rtw_tweets{ height:".$ops[$key]['rtw_twitter_height']."px !important; }"; 
     191 
     192        if($ops[$key]['rtw_twitter_container_background']) 
     193            $style .= ".rtw_container{ background:".$ops[$key]['rtw_twitter_container_background'] ." !important; }"; 
     194 
     195        if($ops[$key]['rtw_twitter_container_color']) 
     196            $style .= ".rtw_twitter_username p a,.rtw_twitter_username h3 a,.rtw_footer .twitter_widget_footer_link a{ color:".$ops[$key]['rtw_twitter_container_color'] ." !important; }"; 
     197 
     198        if($ops[$key]['rtw_twitter_tweet_background']) 
     199            $style .= ".rtw_tweets{ background:".$ops[$key]['rtw_twitter_tweet_background'] ." !important; }"; 
     200 
     201        if($ops[$key]['rtw_twitter_tweet_color']) 
     202            $style .= ".rtw_tweets li p{ color:". $ops[$key]['rtw_twitter_tweet_color'] ." !important; }"; 
     203 
     204        if($ops[$key]['rtw_twitter_tweet_link_color']) 
     205            $style .= ".rtw_tweets li a,.rtw_tweets li p a{ color:". $ops[$key]['rtw_twitter_tweet_link_color'] ." !important; }"; 
     206 
     207        if($ops[$key]['rtw_twitter_scroll'] == 'false') 
     208            $style .= ".rtw_tweets{ overflow-y: hidden !important; }"; 
     209 
     210 
     211 
     212        if($ops[$key]['rtw_twitter_live'] == 'true'){ 
    213213            $script .= '<script type="text/javascript">'; 
    214214            $script .= '$(function(){ 
    215215                        $.post() 
    216216            })'; 
    217              
     217 
    218218            $script .= '</script>'; 
    219              
    220           } 
    221  
    222           $style .= "</style>"; 
    223      //$live_select= ($instance['rtw_twitter_live']=='false' ? " selected " : ''); 
    224  
    225       
    226      return $style; 
    227   } 
    228  
    229      
    230      
    231  } // rtw_twitter_widget Class Ends 
     219 
     220        } 
     221 
     222        $style .= "</style>"; 
     223        //$live_select= ($instance['rtw_twitter_live']=='false' ? " selected " : ''); 
     224 
     225 
     226        return $style; 
     227    } 
     228 
     229 
     230 
     231} // rtw_twitter_widget Class Ends 
    232232 
    233233add_action( 'widgets_init', create_function( '', 'register_widget("rtw_twitter_widget");' ) ); 
Note: See TracChangeset for help on using the changeset viewer.