WordPress.org

Plugin Directory

Changeset 345914


Ignore:
Timestamp:
02/15/11 15:46:41 (3 years ago)
Author:
webgrrrl
Message:

Committing v.1.4.1 beta

Location:
top-commentators-widget/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • top-commentators-widget/trunk/readme.txt

    r344545 r345914  
    33Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=me%40webgrrrl%2enet&item_name=TCW%20Donation&no_shipping=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8 
    44Tags: comments, widget, seo, sidebar 
    5 Requires at least: 2.0.2 
     5Requires at least: 2.8 
    66Tested up to: 3.0.5 
    7 Stable tag: 1.4 
     7Stable tag: 1.4.1 beta 
    88 
    99Adds a sidebar widget to show the top commentators in your WP site. Adapted from Show Top Commentators plugin at Personal Financial Advice. 
     
    1111== Description == 
    1212 
     131.4.1 beta = MAJOR CODE REWRITE! This may break any customized CSS you may have on TCW. Read the Changelog as well as http://webgrrrl.net/tags/tcw for the latest news on this widget (especially v.1.4). 
    1314The Top Commentators Widget a sidebar widget to show the top commentators in your WP site. Adapted from Show Top Commentators plugin at Personal Financial Advice, this widget is easier to manage via the control form (no need to edit the PHP file); additional options are also available to make it more flexible. Read the FAQ section on how to customize the widget, and take a look at the screen shot to see the control form for customizing the Top Commentators Widget. 
    1415 
     
    20212. Upload the file into the wp-content/plugins folder. 
    21223. In your WP admin console, go to Plugins and activate Top Commentators Widget. 
    22 4. In your WP admin console, go to Design | Widgets and click Add beside the Top Commentators widget. 
    23 5. Click Edit on the Top Commentators then scroll down and click Change. 
    24 6. Drag the Top Commentators to wherever you want it to be, and click the Save Changes button if you want to stick to the default values. 
    25 7. That's it! 
     234. Drag the Top Commentators to wherever you want it to be, and click the Save Changes button if you want to stick to the default values. 
     245. You're done! 
    2625 
    2726= (WordPress 2.3.3 and lower) =  
     
    3433 
    3534== Changelog == 
     35 
     36= v.1.4.1 beta = 
     371. MAJOR CODE REWRITE! This may break any customized CSS you may have on TCW. 
     382. Support for multiple instances of the widget. This means that you can have TCW on as many sidebars in your blog as you want, each with its own unique settings. 
    3639 
    3740= v.1.4 = 
     
    7073 
    7174== Buglist == 
    72  
    73 1. I've just tested the e-mail and website filters; they don't seem to work for some reason. Will investigate and squash them in my next update. 
    7475 
    7576= For those using the v.0.999a widget in WordPress 2.3.3 or lower = 
  • top-commentators-widget/trunk/topcommentators_widget.php

    r344544 r345914  
    1 <?php   
     1<?php 
    22/* Plugin Name: Top Commentators Widget   
    33Description: Adds a sidebar widget to show the top commentators in your WP site. Adapted from Show Top Commentators plugin.   
    44Author: Lorna Timbah (WebGrrrl.net) 
    5 Version: 1.4 
     5Version: 1.4.1 beta 
    66Author URI: http://webgrrrl.net  
    77Plugin URI: http://webgrrrl.net/archives/my-top-commentators-widget-quick-dirty.htm 
    8 */     
    9  
    10 // Put functions into one big function we'll call at the plugins_loaded   
    11 // action. This ensures that all required plugin functions are defined. 
    12  
    13 function widget_topcomm_init() { 
    14     // Check for the required plugin functions. This will prevent fatal 
    15     // errors occurring when you deactivate the dynamic-sidebar plugin. 
    16     if ( !function_exists('register_sidebar_widget') ) 
    17         return; 
    18  
    19     // This is the function that truncates long commentators names to avoid 
    20     // your site design from breaking 
    21     function ns_substr_ellipse($str, $len) { 
    22         if(strlen($str) > $len) { 
    23             $str = substr($str, 0, $len-3) . "..."; 
    24         } 
    25         return $str; 
    26     } 
    27  
    28     // This is the function that queries whether the commenters have entered a URL 
    29     function ns_get_user_url($user) { 
    30         global $wpdb; 
    31         $url = $wpdb->get_var(" 
    32             SELECT comment_author_url 
    33                 FROM $wpdb->comments 
    34             WHERE comment_author = '".addslashes($user)."' 
    35             AND comment_author_url != 'http://' 
    36             AND comment_approved = 1 
    37             ORDER BY comment_date DESC LIMIT 1 
    38         "); 
    39         return $url; 
    40     } 
    41  
    42     // This is the function that writes out the top commentators list 
    43     function ns_show_top_commentators() { 
    44         // Each widget can store its own options. We keep strings here. 
    45         $options = get_option('widget_topcomm'); 
    46  
    47         // This prepares URLs for filtering 
    48         if($options['filterUrl'] != "") { 
    49             $filterUrl = trim($options['filterUrl']); 
    50             $filterUrl = explode(",", $filterUrl); 
    51             for($i=0; $i<count($filterUrl); $i++) { 
    52                 $new_urls .= " AND comment_author_url NOT LIKE '%" . trim($filterUrl[$i]) . "%'"; 
    53             } 
    54             $filterUrl = $new_urls; 
    55         } 
    56  
    57         // This prepares e-mails for filtering 
    58         if($options['filterEmail'] != "") { 
    59             $filterEmail = trim($options['filterEmail']); 
    60             $filterEmail = explode(",", $filterEmail); 
    61             for($i=0; $i<count($filterEmail); $i++) { 
    62                 $new_emails .= " AND comment_author_email NOT LIKE '%" . trim($filterEmail[$i]) . "%'"; 
    63             } 
    64             $filterEmail = $new_emails; 
    65         } 
    66  
    67         // This prepares names for filtering 
    68         if($options['excludeNames'] != "") { 
    69             $excludeNames = trim($options['excludeNames']); 
     8*/    
     9add_action( 'widgets_init', 'topcomm_load_widgets' ); 
     10 
     11// start register widget 
     12function topcomm_load_widgets() { 
     13    register_widget( 'Topcomm_Widget' ); 
     14} // end register widget 
     15 
     16// start class 
     17class Topcomm_Widget extends WP_Widget { 
     18 
     19    // start function Topcomm_Widget 
     20    function Topcomm_Widget() { 
     21        $widget_ops = array( 'classname' => 'topcomm', 'description' => __('Shows the top commentators in your blog.', 'topcomm') ); 
     22        $this->WP_Widget( 'topcomm-widget', __('Top Commentators Widget', 'topcomm'), $widget_ops, $control_ops ); 
     23    } // end function Topcomm_Widget 
     24 
     25  // start function widget  
     26    function widget( $args, $instance ) { 
     27        extract( $args ); 
     28 
     29        // variables 
     30        $title = $instance['title']; 
     31        $listDesc = $instance['listDesc']; 
     32        // start name filter prep 
     33        if($instance['excludeNames'] != "") { 
     34            $excludeNames = trim($instance['excludeNames']); 
    7035            $excludeNames = explode(",", $excludeNames); 
    7136            for($i=0; $i<count($excludeNames); $i++) { 
     
    7338            } 
    7439            $excludeNames = $new_names; 
    75         } 
    76  
    77         if($options['limitList'] != "") 
    78             $limitList = "LIMIT " . $options['limitList']; 
    79         $limitChar = $options['limitChar']; 
    80         $listDesc = $options['listDesc']; 
    81         $listType = $options['listType']; 
    82         $listPeriod = $options['listPeriod']; 
    83         $listNull = $options['listNull']; 
    84         $makeLink = $options['makeLink']; 
    85         $targetBlank = $options['targetBlank']; 
    86         $noFollow = $options['noFollow']; 
    87         $showCount = $options['showCount'];                    
    88         // Gravatar variables by SNascimento 
    89         $displayGravatar = $options['displayGravatar']; 
    90         $avatarSize = $options['avatarSize']; 
    91         $defaultGravatar = $options['defaultGravatar']; 
    92     // Award variable 
    93     $displayAward = $options['displayAward']; 
    94     $iconAward = $options['iconAward']; 
    95     $alignAward = $options['alignAward']; 
    96      
    97         // This sets the type of list to be used 
    98         if($listType == "num") { 
    99             $listStart = "<ol>"; 
    100             $listEnd = "</ol>"; 
    101         } else { 
    102             $listStart = "<ul>"; 
    103             $listEnd = "</ul>"; 
    104         } 
    105  
    106         // This is the function that prepare time period limitation for filtering 
     40        } // end name filter prep 
     41        $listPeriod = $instance['listPeriod']; 
     42        // start list period setup 
    10743        if($listPeriod == "h") { 
    10844            $listPeriod = "DATE_FORMAT(comment_date, '%Y-%m-%d %H') = DATE_FORMAT(CURDATE(), '%Y-%m-%d %H')"; 
     
    12460        } else { 
    12561            $listPeriod = "comment_date >= CURDATE() - INTERVAL 30 DAY"; 
     62        } // end list period setup 
     63        $listPeriod = ' AND ' . $listPeriod; 
     64        $limitList = $instance['limitList']; 
     65        $limitChar = $instance['limitChar']; 
     66        $listNull = $instance['listNull']; 
     67        // start url filter prep 
     68        if($instance['filterUrl'] != "") { 
     69            $filterUrl = trim($instance['filterUrl']); 
     70            $filterUrl = explode(",", $filterUrl); 
     71            for($i=0; $i<count($filterUrl); $i++) { 
     72                $new_urls .= " AND comment_author_url NOT LIKE '%" . trim($filterUrl[$i]) . "%'"; 
     73            } 
     74            $filterUrl = $new_urls; 
     75        } // end url filter prep 
     76        // start email filter prep 
     77        if($instance['filterEmail'] != "") { 
     78            $filterEmail = trim($instance['filterEmail']); 
     79            $filterEmail = explode(",", $filterEmail); 
     80            for($i=0; $i<count($filterEmail); $i++) { 
     81                $new_emails .= " AND comment_author_email NOT LIKE '%" . trim($filterEmail[$i]) . "%'"; 
     82            } 
     83            $filterEmail = $new_emails; 
     84        } // end url filter prep 
     85        $listType = $instance['listType']; 
     86        // start list type setup 
     87        if($listType == "num") { 
     88            $listStart = "<ol>"; 
     89            $listEnd = "</ol>"; 
     90        } else { 
     91            $listStart = "<ul>"; 
     92            $listEnd = "</ul>"; 
     93        } // end list type setup 
     94        $makeLink = $instance['makeLink']; 
     95        $targetBlank = $instance['targetBlank']; 
     96        $noFollow = $instance['noFollow']; 
     97        $showCount = $instance['showCount']; 
     98        // start grouping setup 
     99    if($instance['groupBy'] == "0") { 
     100            $groupBy = " GROUP BY comment_author"; 
     101        } else { 
     102            $groupBy = " GROUP BY comment_author_email"; 
    126103        } 
    127  
    128         // This writes out the proper SQL whether to group commenters 
    129         // by e-mail or user name 
    130         if($options['groupBy'] == "0") { 
    131             $groupBy = "GROUP BY comment_author"; 
     104        $showInHome = $instance['showInHome']; 
     105        $onlyWithUrl = $instance['onlyWithUrl']; 
     106        if( $onlyWithUrl == '1' ) { 
     107          $onlyWithUrl = " AND comment_author_url != '' AND comment_author_url != 'http://'"; 
    132108        } else { 
    133             $groupBy = "GROUP BY comment_author_email"; 
     109      $onlyWithUrl = ''; 
     110    } 
     111        $displayGravatar = $instance['displayGravatar']; 
     112        $defaultGravatar = $instance['defaultGravatar']; 
     113        $avatarSize = $instance['avatarSize']; 
     114        $displayAward = $instance['displayAward']; 
     115    $iconAward = $instance['iconAward']; 
     116        $alignAward = $instance['alignAward']; 
     117 
     118        // display widget in blog 
     119        $writeList = "\n" . $before_widget . "\n" . $before_title . $title . $after_title; 
     120    // comment list                                           
     121    $writeList .= $listDesc . "\n"; 
     122    $writeList .= $listStart . "\n"; 
     123    global $wpdb; 
     124    $commenters = $wpdb->get_results("SELECT COUNT(comment_author) AS comment_comments, comment_author, comment_author_url, comment_author_email  
     125      FROM $wpdb->comments 
     126      WHERE comment_type != 'pingback' 
     127      AND comment_author != '' 
     128      AND comment_approved = '1'  
     129      $excludeNames 
     130      $listPeriod 
     131      $filterUrl 
     132      $filterEmail 
     133      $onlyWithUrl 
     134      $groupBy 
     135      ORDER BY comment_comments DESC, comment_author 
     136      "); 
     137    // start ifarray check 
     138    if(count($commenters) > 0) { 
     139      $commenters = array_slice($commenters,0,$limitList); 
     140      // start foreach commenter 
     141      foreach ($commenters as $k) { 
     142        $url = $wpdb->get_var("SELECT comment_author_url FROM $wpdb->comments 
     143          WHERE comment_author = '".addslashes($k->comment_author)."' 
     144          AND comment_author_url != 'http://' 
     145          AND comment_approved = 1 
     146          ORDER BY comment_date DESC LIMIT 1 
     147          "); 
     148        $writeList .= '<li>'; 
     149        if(trim($url) != '') { 
     150          // start makelink check 
     151          if($makeLink == 1) {                         
     152            $writeList .= "<a href='" . $url . "'"; 
     153          if($noFollow == 1) 
     154            $writeList .= " rel='nofollow'"; 
     155          if($targetBlank == 1) 
     156            $writeList .= " target='_blank'"; 
     157          $writeList .= ">"; 
     158          } // end makelink check 
     159        } 
     160        $nCommentComments = $k->comment_comments; 
     161        $nCommentComments = (int)$nCommentComments; 
     162        // start comment count for award 
     163        if($displayAward == '0') { 
     164          $strDisplayAward = ''; 
     165        } elseif($nCommentComments >= $displayAward) { 
     166          $strDisplayAward='<img class="tcwAward" src="' . $iconAward . '" alt="Top Commentator Award" title="Top Commentator Award" /> '; 
     167        } 
     168        if($alignAward==0)  
     169          $writeList .= $strDisplayAward; 
     170        // start gravatar display check 
     171        if($displayGravatar == 1)  { 
     172          $image=md5(strtolower($k->comment_author_email)); 
     173          $defavatar=urlencode($defaultGravatar); 
     174          $writeList .= '<img class="tcwGravatar" src="http://www.gravatar.com/avatar.php?gravatar_id='.$image.'&amp;size='.$avatarSize.'&amp;default='.$defavatar.'" alt ="'.$k->comment_author.'" title="'.$k->comment_author.'" /> '; 
     175        } // end gravatar display check 
     176        if($alignAward==1) 
     177          $writeList .= $strDisplayAward; 
     178        if(strlen($k->comment_author) > $limitChar) { 
     179          $str = substr($k->comment_author, 0, $limitChar-3) . "..."; 
     180        } else { 
     181          $str = $k->comment_author; 
     182        } 
     183        $writeList .= $str; 
     184        if($showCount == 1) 
     185          $writeList .= ' (' . $nCommentComments . ')'; 
     186        if(trim($url) != '') { 
     187          if($makeLink == 1) 
     188            $writeList .= "</a>"; 
     189        } 
     190        if($alignAward == 2)  
     191          $writeList .= $strDisplayAward; 
     192        $writeList .= "</li>\n"; 
     193        unset($url); 
     194        ++$countList; 
     195        $strDisplayAward = ''; 
     196      } // end foreach 
     197    } else { 
     198      $writeList .= "<li>" . $listNull . "</li>\n"; 
     199    } // end ifarray check 
     200    $writeList .= $listEnd . "\n"; 
     201    $writeList .= $after_widget . "\n"; 
     202    if($showInHome == 1) { 
     203        if(is_home()) { 
     204          echo $writeList; 
     205      } 
     206    } else { 
     207      echo $writeList; 
     208    } 
     209    } // end function widget 
     210 
     211  // start function update widget values 
     212    function update( $new_instance, $old_instance ) { 
     213        $instance = $old_instance; 
     214        $instance['title'] = strip_tags( $new_instance['title'] ); 
     215        $instance['listDesc'] = $new_instance['listDesc']; 
     216        $instance['excludeNames'] = strip_tags( $new_instance['excludeNames'] ); 
     217        if( $new_instance['listPeriodnum'] != '' ) { 
     218      $instance['listPeriod'] = $new_instance['listPeriodnum']; 
     219    } else { 
     220          $instance['listPeriod'] = $new_instance['listPeriod']; 
    134221        } 
    135  
    136         // These lines generate our output. Widgets can be very complex 
    137         // but as you can see here, they can also be very, very simple. 
    138         global $wpdb; 
    139         $commenters = $wpdb->get_results(" 
    140             SELECT COUNT(comment_author) AS comment_comments, comment_author, comment_author_url, comment_author_email 
    141             FROM $wpdb->comments 
    142             WHERE comment_type != 'pingback' 
    143             AND comment_author != '' 
    144             AND comment_approved = '1' 
    145             AND $listPeriod 
    146             $excludeNames 
    147             $filterUrl 
    148             $filterEmail 
    149             $groupBy 
    150             ORDER BY comment_comments DESC, comment_author ASC 
    151             $limitList 
    152             "); 
    153  
    154         if(is_array($commenters)) { 
    155             $countList = 0; 
    156             echo $listDesc . "\n"; 
    157             echo $listStart . "\n"; 
    158             foreach ($commenters as $k) { 
    159                 $url = ns_get_user_url($k->comment_author); 
    160  
    161 // This writes out the list of commentors and checks for 1) Hyperlink each name, 
    162 // 2) NoFollow each name, 3) Limit characters in names, 4) Remarks for blank list, and 
    163 // 5) Display only users with URLs variables 
    164  
    165 // check if onlyWithUrl = 1 
    166 if($options['onlyWithUrl'] == '1') { 
    167 // if onlyWithUrl = 1, check if trimurl != '' 
    168 // write 
    169 if(trim($url) != '') { 
    170                 echo "<li>"; 
    171                 if(trim($url) != '' ) { 
    172                     if($makeLink == 1) { 
    173                         echo "<a href='" . $url . "'"; 
    174                         if($noFollow == 1) echo " rel='nofollow'"; 
    175                         if($targetBlank == 1) echo " target='_blank'"; 
    176                         echo ">"; 
    177                     } 
    178                 } 
    179                 // Award display 
    180                 $nCommentComments = $k->comment_comments; 
    181         $nCommentComments = (int)$nCommentComments;          
    182                 if($nCommentComments >= $displayAward) { 
    183                     $strDisplayAward='<img class="tcwAward" src="' . $iconAward . '" alt="Top Commentator Award" title="Top Commentator Award" /> '; 
    184         } else { 
    185           $strDisplayAward=''; 
    186         } 
    187         // show award if aligned left before gravatar 
    188         if($alignAward==0) echo $strDisplayAward; 
    189                 // Gravatar display by SNascimento 
    190                 if($displayGravatar == 1)  { 
    191                     $image=md5(strtolower($k->comment_author_email)); 
    192                     $defavatar=urlencode($defaultGravatar); 
    193                     echo '<img class="tcwGravatar" src="http://www.gravatar.com/avatar.php?gravatar_id='.$image.'&amp;size='.$avatarSize.'&amp;default='.$defavatar.'" alt ="'.$k->comment_author.'" title="'.$k->comment_author.'" /> '; 
    194                 } 
    195         // show award if aligned left after gravatar 
    196         if($alignAward==1) echo $strDisplayAward;         
    197                 echo ns_substr_ellipse($k->comment_author, $limitChar); 
    198                 if($showCount == 1) echo " (" . $k->comment_comments . ")"; 
    199                 if(trim($url) != '') { 
    200                     if($makeLink == 1) 
    201                         echo "</a>"; 
    202                 } 
    203                 // show award if aligned right 
    204         if($alignAward==2) echo $strDisplayAward; 
    205                 echo "</li>\n"; 
    206                 unset($url); 
    207                 $countList = $ $countList + 1; 
    208 // finish checking trimurl 
    209 } 
    210 // if onlyWithUrl = 0 
    211 // write 
    212 } else { 
    213                 echo "<li>"; 
    214                 if(trim($url) != '' ) { 
    215                     if($makeLink == 1) { 
    216                         echo "<a href='" . $url . "'"; 
    217                         if($noFollow == 1) echo " rel='nofollow'"; 
    218                         if($targetBlank == 1) echo " target='_blank'"; 
    219                         echo ">"; 
    220                     } 
    221                 } 
    222                 // Award display 
    223                 $nCommentComments = $k->comment_comments; 
    224                 $nCommentComments = (int)$nCommentComments; 
    225                 if($nCommentComments >= $displayAward) { 
    226                     $strDisplayAward='<img class="tcwAward" src="' . $iconAward . '" alt="Top Commentator Award" title="Top Commentator Award" /> '; 
    227         } else { 
    228           $strDisplayAward=''; 
    229         } 
    230         // show award if aligned left before gravatar 
    231         if($alignAward==0) echo $strDisplayAward; 
    232               // Gravatar display by SNascimento 
    233                 if($displayGravatar == 1)  { 
    234                     $image=md5(strtolower($k->comment_author_email)); 
    235                     $defavatar=urlencode($defaultGravatar); 
    236                     echo '<img class="tcwGravatar" src="http://www.gravatar.com/avatar.php?gravatar_id='.$image.'&amp;size='.$avatarSize.'&amp;default='.$defavatar.'" alt ="'.$k->comment_author.'" title="'.$k->comment_author.'" border="0"/> '; 
    237                 } 
    238         // show award if aligned left after gravatar 
    239         if($alignAward==1) echo $strDisplayAward; 
    240           echo ns_substr_ellipse($k->comment_author, $limitChar); 
    241                 if($showCount == 1) echo " (" . $k->comment_comments . ")"; 
    242                 if(trim($url) != '') { 
    243                     if($makeLink == 1) 
    244                         echo "</a>"; 
    245                 } 
    246                 // show award if aligned right 
    247         if($alignAward==2) echo $strDisplayAward; 
    248                 echo "</li>\n"; 
    249                 unset($url); 
    250                 $countList = $countList + 1; 
    251 // end check onlyWithUrl 
    252 } 
    253             } 
    254             if($countList == 0) 
    255                 echo "<li>" . $listNull . "</li>\n"; 
    256             echo $listEnd; 
     222        $instance['limitList'] = $new_instance['limitList']; 
     223        $instance['limitChar'] = $new_instance['limitChar']; 
     224        $instance['listNull'] = strip_tags( $new_instance['listNull'] ); 
     225        $instance['filterUrl'] = $new_instance['filterUrl']; 
     226        $instance['filterEmail'] = $new_instance['filterEmail']; 
     227        $instance['listType'] = $new_instance['listType']; 
     228        $instance['makeLink'] = $new_instance['makeLink']; 
     229        $instance['targetBlank'] = $new_instance['targetBlank']; 
     230        $instance['noFollow'] = $new_instance['noFollow']; 
     231        $instance['showCount'] = $new_instance['showCount']; 
     232        $instance['groupBy'] = $new_instance['groupBy']; 
     233        $instance['showInHome'] = $new_instance['showInHome']; 
     234        $instance['onlyWithUrl'] = $new_instance['onlyWithUrl']; 
     235        $instance['displayGravatar'] = $new_instance['displayGravatar']; 
     236        $instance['defaultGravatar'] = $new_instance['defaultGravatar']; 
     237        $instance['avatarSize'] = $new_instance['avatarSize']; 
     238        $instance['displayAward'] = $new_instance['displayAward']; 
     239        if( $new_instance['iconAward'] == '' ) { 
     240          $instance['iconAward'] = 'https://lh3.googleusercontent.com/_gE22WSc7tcQ/TVZOTOGQ66I/AAAAAAAAABg/1mAYCyHmMpw/s800/medal_icon.jpg'; 
    257241        } else { 
    258             echo "<ul><li>" . $listNull . "</li></ul>" . "\n"; 
     242      $instance['iconAward'] = $new_instance['iconAward']; 
    259243        } 
    260     } 
    261  
    262     // This is the function that outputs our top commentators list 
    263     function widget_topcomm($args) { 
    264         // $args is an array of strings that help widgets to conform to 
    265         // the active theme: before_widget, before_title, after_widget, 
    266         // and after_title are the array keys. Default tags: li and h2. 
    267         extract($args); 
    268  
    269         // This one string determines whether you want it to appear in the main page or everywhere 
    270         $options = get_option('widget_topcomm'); 
    271         $showInHome = $options['showInHome']; 
    272         $title = htmlspecialchars(stripcslashes($options['title']), ENT_QUOTES); 
    273         global $wpdb; 
    274         if($showInHome == 1) { 
    275             if(is_home()) 
    276                 echo $before_widget . $before_title . $title . $after_title; 
    277         } else { 
    278             echo $before_widget . $before_title . $title . $after_title; 
    279         } 
    280         if($showInHome == 1) { 
    281             if(is_home()) 
    282                 echo ns_show_top_commentators(); 
    283         } else { 
    284             echo ns_show_top_commentators(); 
    285         } 
    286         if($showInHome == 1) { 
    287             if(is_home()) 
    288                 echo $after_widget . "<!-- end of widget -->"; 
    289         } else { 
    290             echo $after_widget . "<!-- end of widget -->"; 
    291         } 
    292     } 
    293  
    294     function widget_topcomm_control() { 
    295         // Get our options and see if we're handling a form submission. 
    296         $options = get_option('widget_topcomm'); 
    297         if (!is_array($options) ) 
    298             $options = array('title'=>'Top Commentators', 'listDesc'=>'You commented; therefore you are loved:', 'excludeNames'=>'\'Lorna\', \'Administrator\'','limitList'=>'10', 'limitChar'=>'25', 'listNull'=>'Be the first to comment in my site.', 'filterUrl'=>'', 'filterEmail'=>'', 'listType'=>'bul', 'listPeriod'=>'30', 'makeLink'=>'1', 'targetBlank'=>'0', 'noFollow'=>'1', 'showCount'=>'1', 'groupBy'=>'1', 'showInHome'=>'', 'onlyWithUrl'=>'', 'displayGravatar'=>'', 'avatarSize'=>'', 'defaultGravatar'=>'', 'displayAward'=>'', 'iconAward'=>'', 'alignAward'=>'0'); 
    299         if ( $_POST['topcomm-submit'] ) { 
    300             // Remember to sanitize and format use input appropriately. 
    301             $options['title'] = ($_POST['topcomm-title'] ? $_POST['topcomm-title'] : "Top Commentators"); 
    302             $options['excludeNames'] = $_POST['topcomm-excludeNames']; 
    303             $options['limitList'] = ($_POST['topcomm-limitList'] ? $_POST['topcomm-limitList'] : 10); 
    304             $options['limitChar'] = ($_POST['topcomm-limitChar'] ? $_POST['topcomm-limitChar'] : 20); 
    305             $options['listDesc'] = $_POST['topcomm-listDesc']; 
    306             $options['listType'] = $_POST['topcomm-listType']; 
    307             $options['listPeriod'] = ($_POST['topcomm-listPeriod'] ? $_POST['topcomm-listPeriod'] : 30); 
    308             $options['listNull'] = ($_POST['topcomm-listNull'] ? $_POST['topcomm-listNull'] : "Be the first to comment."); 
    309             $options['filterUrl'] = $_POST['topcomm-filterUrl']; 
    310             $options['filterEmail'] = $_POST['topcomm-filterEmail']; 
    311             $options['makeLink'] = ($_POST['topcomm-makeLink'] ? $_POST['topcomm-makeLink'] : 1); 
    312             $options['targetBlank'] = ($_POST['topcomm-targetBlank'] ? $_POST['topcomm-targetBlank'] : 1); 
    313         $options['noFollow'] = ($_POST['topcomm-noFollow'] ? $_POST['topcomm-noFollow'] : 0); 
    314             $options['showInHome'] = ($_POST['topcomm-showInHome'] ? $_POST['topcomm-showInHome'] : 1); 
    315             $options['onlyWithUrl'] = ($_POST['topcomm-onlyWithUrl'] ? $_POST['topcomm-onlyWithUrl'] : 0); 
    316             $options['showCount'] = ($_POST['topcomm-showCount'] ? $_POST['topcomm-showCount'] : 1); 
    317             $options['groupBy'] = ($_POST['topcomm-groupBy'] ? $_POST['topcomm-groupBy'] : 1); 
    318             // Gravatar options 
    319             $options['displayGravatar'] = $_POST['topcomm-displayGravatar'] ? $_POST['topcomm-displayGravatar'] : 0; 
    320             $options['avatarSize'] = ($_POST['topcomm-avatarSize'] ? $_POST['topcomm-avatarSize'] : 20); 
    321             $options['defaultGravatar'] = $_POST['topcomm-defaultGravatar']; 
    322             // Award options 
    323             $options['displayAward'] = ($_POST['topcomm-displayAward'] ? $_POST['topcomm-displayAward'] : 0); 
    324             $options['iconAward'] = ($_POST['topcomm-iconAward'] ? $_POST['topcomm-iconAward'] : "https://lh3.googleusercontent.com/_gE22WSc7tcQ/TVZOTOGQ66I/AAAAAAAAABg/1mAYCyHmMpw/s800/medal_icon.jpg"); 
    325             $options['alignAward'] = $_POST['topcomm-alignAward']; 
    326       update_option('widget_topcomm', $options); 
    327         } 
    328         // Be sure you format your options to be valid HTML attributes. 
    329             // Here is our little form segment. Notice that we don't need a 
    330         // complete form. This will be embedded into the existing form. 
    331         $options = get_option('widget_topcomm'); 
    332         $title = htmlspecialchars(stripcslashes($options['title']), ENT_QUOTES); 
    333         $excludeNames = htmlspecialchars(stripcslashes($options['excludeNames']), ENT_QUOTES); 
    334         $limitList = $options['limitList']; 
    335         $limitChar = $options['limitChar']; 
    336         $listDesc = $options['listDesc']; 
    337         $listType = $options['listType']; 
    338         $listPeriod = $options['listPeriod']; 
    339         $listNull = $options['listNull']; 
    340         $filterUrl = $options['filterUrl']; 
    341         $filterEmail = $options['filterEmail']; 
    342         $makeLink = $options['makeLink']; 
    343         $targetBlank = $options['targetBlank']; 
    344         $noFollow = $options['noFollow']; 
    345         $showInHome = $options['showInHome']; 
    346         $onlyWithUrl = $options['onlyWithUrl']; 
    347         $showCount = $options['showCount']; 
    348         $groupBy = $options['groupBy']; 
    349         $displayGravatar = $options['displayGravatar']; 
    350         $avatarSize = $options['avatarSize']; 
    351         $defaultGravatar = $options['defaultGravatar']; 
    352         $displayAward = $options['displayAward']; 
    353         $iconAward = htmlspecialchars(stripcslashes($options['iconAward']), ENT_QUOTES); 
    354         $alignAward = $options['alignAward']; 
    355         ?> 
    356         <p style="text-align:right;"><label for="topcomm-title">Change widget title:</label> <input style="width: 200px;" id="topcomm-title" name="topcomm-title" type="text" value="<?php echo $title ?>" /></p> 
    357         <p style="text-align:right;"><label for="topcomm-listDesc">Add description below the title:</label> <input style="width: 200px;" id="topcomm-listDesc" name="topcomm-listDesc" type="text" value="<?php echo $listDesc ?>" /><br /><small>Leave blank to exclude description</small></p> 
    358         <p style="text-align:right;"><label for="topcomm-excludeNames">Exclude these users:</label> <input style="width: 200px;" id="topcomm-excludeNames" name="topcomm-excludeNames" type="text" value="<?php echo $excludeNames ?>" /><br /><small>Separate each name with a comma (,)</small></p> 
    359  
    360         <p style="text-align:right;"><label for="topcomm-listPeriod">Reset list every:</label> <select size="1" id="topcomm-listPeriod" name="topcomm-listPeriod"><option value="h" <?php 
    361         if($listPeriod== 'h') 
    362             echo ' selected'; 
    363         echo '>Hour</option><option value="d"'; 
    364         if($listPeriod== 'd') 
    365             echo ' selected'; 
    366         echo '>Day</option><option value="w"'; 
    367         if($listPeriod== 'w') 
    368             echo ' selected'; 
    369         echo '>Week</option><option value="m"'; 
    370         if($listPeriod== 'm' || is_null($listPeriod)) 
    371             echo ' selected'; 
    372         echo '>Month</option><option value="y"'; 
    373         if($listPeriod== 'y') 
    374             echo ' selected'; 
    375         echo '>Year</option><option value="a"'; 
    376         if($listPeriod== 'a') 
    377             echo ' selected'; 
    378         echo '>List all</option></select><br />Or specify number of days / enter range of date: <input style="width: 200px;" id="topcomm-listPeriodnum" name="topcomm-listPeriodnum" type="text" value="'; 
    379         if(is_numeric($listPeriod) || (strpos($listPeriod, 'and') !== false)) 
    380             echo $listPeriod; 
    381         echo '" /><br /><small>E.g. <strong>100</strong> for # of days or <strong>20090301 and 20090531</strong> for date range</small></p>'; 
    382         ?> 
    383         <p style="text-align:right;"><label for="topcomm-limitList">Limit number of names to:</label>  <input style="width: 200px;" id="topcomm-limitList" name="topcomm-limitList" type="text" value="<?php echo $limitList ?>" /><br /><small>Enter numbers only</small></p> 
    384         <p style="text-align:right;"><label for="topcomm-limitChar">Limit characters in names to:</label> <input style="width: 200px;" id="topcomm-limitChar" name="topcomm-limitChar" type="text" value="<?php echo $limitChar ?>" /><br /><small>Enter numbers only</small></p> 
    385         <p style="text-align:right;"><label for="topcomm-listNull">Remarks for blank list:</label> <input style="width: 200px;" id="topcomm-listNull" name="topcomm-listNull" type="text" value="<?php echo $listNull ?>" /></p> 
    386         <p style="text-align:right;"><label for="topcomm-filterUrl">Filter the following full/partial URLs:</label> <input style="width: 200px;" id="topcomm-filterUrl" name="topcomm-filterUrl" type="text" value="<?php echo $filterUrl ?>" /><br /><small>Separate each URL with a comma (,)</small></p> 
    387         <p style="text-align:right;"><label for="topcomm-filterEmail">Filter the following full/partial e-mail:</label> <input style="width: 200px;" id="topcomm-filterEmail" name="topcomm-filterEmail" type="text" value="<?php echo $filterEmail ?>" /><br /><small>Separate each e-mail with a comma (,)</small></p> 
    388         <?php 
    389         echo '<p style="text-align:right;"><label for="topcomm-listType">' . ('Display list type as:') . '</label><select size="1" id="topcomm-listType" name="topcomm-listType"><option value="bul"'; 
    390         if($listType == 'bul') 
    391             echo ' selected'; 
    392         echo '>Bulleted</option><option value="num"'; 
    393         if($listType == 'num') 
    394             echo ' selected'; 
    395         echo '>Numbered</option></select></p>'; 
    396         echo '<p style="text-align:right;"><label for="topcomm-makeLink">' . ('Hyperlink each name?') . '</label><select size="1" id="topcomm-makeLink" name="topcomm-makeLink"><option value="1"'; 
    397         if($makeLink == 1) 
    398             echo ' selected'; 
    399         echo '>Yes</option><option value="0"'; 
    400         if($makeLink == 0) 
    401             echo ' selected'; 
    402         echo '>No</option></select></p>'; 
    403  
    404         echo '<p style="text-align:right;"><label for="topcomm-targetBlank">' . ('Open each link in a new window?') . '</label><select size="1" id="topcomm-targetBlank" name="topcomm-targetBlank"><option value="1"'; 
    405         if($targetBlank == 1) 
    406             echo ' selected'; 
    407         echo '>Yes</option><option value="0"'; 
    408         if($targetBlank == 0) 
    409             echo ' selected'; 
    410         echo '>No</option></select></p>'; 
    411  
    412         echo '<p style="text-align:right;"><label for="topcomm-noFollow">' . ('NoFollow each name if hyperlinked?') . '</label><select size="1" id="topcomm-noFollow" name="topcomm-noFollow"><option value="1"'; 
    413         if($noFollow == 1) 
    414             echo ' selected'; 
    415         echo '>Yes</option><option value="0"'; 
    416         if($noFollow== 0) 
    417             echo ' selected'; 
    418         echo '>No</option></select></p>'; 
    419  
    420         echo '<p style="text-align:right;"><label for="topcomm-showCount">' . ('Show number of comments for each commenter?') . '</label><select size="1" id="topcomm-showCount" name="topcomm-showCount"><option value="1"'; 
    421         if($showCount == 1) 
    422             echo ' selected'; 
    423         echo '>Yes</option><option value="0"'; 
    424         if($showCount == 0) 
    425             echo ' selected'; 
    426         echo '>No</option></select></p>'; 
    427  
    428         echo '<p style="text-align:right;"><label for="topcomm-groupBy">' . ('(Hijack-proof?) Group commentors based on') . '</label><select size="1" id="topcomm-groupBy" name="topcomm-groupBy"><option value="1"'; 
    429         if($groupBy == 1) 
    430             echo ' selected'; 
    431         echo '>E-mail</option><option value="0"'; 
    432         if($groupBy == 0) 
    433             echo ' selected'; 
    434         echo '>User names</option></select></p>'; 
    435  
    436         echo '<p style="text-align:right;"><label for="topcomm-showInHome">' . ('Show in home page only?') . '</label><select size="1" id="topcomm-showInHome" name="topcomm-showInHome"><option value="1"'; 
    437         if($showInHome == 1) 
    438             echo ' selected'; 
    439         echo '>Yes</option><option value="0"'; 
    440         if($showInHome == 0) 
    441             echo ' selected'; 
    442         echo '>No</option></select></p>'; 
    443  
    444         echo '<p style="text-align:right;"><label for="topcomm-onlyWithUrl">' . ('Display only commentors with URL?') . '</label><select size="1" id="topcomm-onlyWithUrl" name="topcomm-onlyWithUrl"><option value="1"'; 
    445         if($onlyWithUrl == 1) 
    446             echo ' selected'; 
    447         echo '>Yes</option><option value="0"'; 
    448         if($onlyWithUrl == 0) 
    449             echo ' selected'; 
    450         echo '>No</option></select></p>'; 
    451  
    452         // Gravatar option forms 
    453         echo '<p style="text-align:right;"><label for="topcomm-displayGravatar">' . ('Display Gravatar?') . '</label><select size="1" id="topcomm-displayGravatar" name="topcomm-displayGravatar"><option value="1"'; 
    454         if($displayGravatar == 1) 
    455             echo ' selected'; 
    456         echo '>Yes</option><option value="0"'; 
    457         if($displayGravatar == 0) 
    458             echo ' selected'; 
    459         echo '>No</option></select></p>'; 
    460     echo '<p style="text-align:right;"><label for="topcomm-defaultGravatar">' . ('Use the following default Gravatar') . '</label><select size="1" id="topcomm-defaultGravatar" name="topcomm-defaultGravatar"><option value="404"'; 
    461     if($defaultGravatar == '404') echo ' selected'; 
    462         echo '>404</option><option value="mm"'; 
    463     if($defaultGravatar == 'mm') echo ' selected'; 
    464     echo '>Mystery Man</option><option value="identicon"'; 
    465     if($defaultGravatar == 'identicon') echo ' selected'; 
    466     echo '>Identicon</option><option value="monsterid"'; 
    467     if($defaultGravatar == 'monsterid') echo ' selected'; 
    468     echo '>MonsterID</option><option value="wavatar"'; 
    469     if($defaultGravatar == 'wavatar') echo ' selected'; 
    470     echo '>Wavatar</option></select>'; 
    471         ?> <label for="topcomm-avatarSize">Size:</label> <input style="width: 50px;" id="topcomm-avatarSize" name="topcomm-avatarSize" type="text" value="<?php echo $avatarSize ?>" /></p> 
    472         <!-- Award options --> 
    473         <p style="text-align:right;"><label for="topcomm-displayAward">Show an Award if comments are equal or greater than</label> <input style="width: 50px;" id="topcomm-displayAward" name="topcomm-displayAward" type="text" value="<?php echo $displayAward ?>" /><br /><small>Award image/icon appears if number greater than zero (0)</small></p> 
    474         <p style="text-align:right;"><label for="topcomm-iconAward">Award icon/image location</label> <input style="width: 200px;" id="topcomm-iconAward" name="topcomm-iconAward" type="text" value="<?php echo $iconAward ?>" /><br /><small>Enter the full URL of image, including http://</small></p> 
    475         <?php 
    476     echo '<p style="text-align:right;"><label for="topcomm-alignAward">' . ('Align the Award icon') . '</label><select size="1" id="topcomm-alignAward" name="topcomm-alignAward"><option value="0"'; 
    477     if($alignAward == 0) echo ' selected'; 
    478         echo '>left before Gravatar</option><option value="1"'; 
    479     if($alignAward == 1) echo ' selected'; 
    480     echo '>left after Gravatar</option><option value="2"'; 
    481     if($alignAward == 2) echo ' selected'; 
    482     echo '>right</option></select></p>'; 
    483         // topcomm ending field 
    484         echo '<input type="hidden" id="topcomm-submit" name="topcomm-submit" value="1" />'; 
    485     } 
    486     // This registers our widget so it appears with the other available 
    487     // widgets and can be dragged and dropped into any active sidebars. 
    488     register_sidebar_widget(array('Top Commentators', 'widgets'), 'widget_topcomm'); 
    489     // This registers our optional widget control form. Because of this 
    490     // our widget will have a button that reveals a 410x500 pixel form. 
    491     register_widget_control(array('Top Commentators', 'widgets'), 'widget_topcomm_control', 410, 500); 
    492 } 
    493 // Run our code later in case this loads prior to any required plugins. 
    494 add_action('widgets_init', 'widget_topcomm_init'); 
     244        $instance['alignAward'] = $new_instance['alignAward'];       
     245    return $instance; 
     246    } // end function update widget values 
     247 
     248  // start function widget form 
     249    function form( $instance ) { 
     250        // default values setting 
     251        $defaults = array( 'title' => 'Top Commentators', 'listDesc' => '', 'excludeNames' => 'admin', 'listPeriod' => 'm', 'limitList' => '10', 'limitChar' => '20', 'listNull' => 'Be the first to comment.', 'filterUrl' => '', 'filterEmail' => '', 'listType' => 'bul', 'makeLink' => '1', 'targetBlank' => '1', 'noFollow' => '0', 'showCount' => '1', 'groupBy' => '0', 'showInHome' => '1', 'onlyWithUrl' => '0', 'displayGravatar' => '1', 'defaultGravatar' => 'mm', 'avatarSize' => '20', 'displayAward' => '0', 'iconAward' => 'https://lh3.googleusercontent.com/_gE22WSc7tcQ/TVZOTOGQ66I/AAAAAAAAABg/1mAYCyHmMpw/s800/medal_icon.jpg', 'alignAward' => '2'); 
     252        $instance = wp_parse_args( (array) $instance, $defaults ); ?> 
     253    <p> 
     254        <label for="<?php echo $this->get_field_id( 'title' ); ?>">Change widget title:</label> 
     255        <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width: 100%;" type="text" /> 
     256        </p> 
     257    <p> 
     258        <label for="<?php echo $this->get_field_id( 'listDesc' ); ?>">Add description below the title:</label> 
     259        <input id="<?php echo $this->get_field_id( 'listDesc' ); ?>" name="<?php echo $this->get_field_name( 'listDesc' ); ?>" value="<?php echo $instance['listDesc']; ?>" style="width: 100%;" type="text" /> 
     260        <br /><small>Leave blank to exclude description</small> 
     261    </p> 
     262    <p> 
     263        <label for="<?php echo $this->get_field_id( 'excludeNames' ); ?>">Exclude these users:</label> 
     264        <input id="<?php echo $this->get_field_id( 'excludeNames' ); ?>" name="<?php echo $this->get_field_name( 'excludeNames' ); ?>" value="<?php echo $instance['excludeNames']; ?>" style="width: 100%;" type="text" /> 
     265        <br /><small>Separate each name with a comma (,)</small> 
     266    </p> 
     267        <p> 
     268        <label for="<?php echo $this->get_field_id( 'listPeriod' ); ?>">Reset period every:</label>  
     269        <select id="<?php echo $this->get_field_id( 'listPeriod' ); ?>" name="<?php echo $this->get_field_name( 'listPeriod' ); ?>"> 
     270        <option value="h"<?php if ( 'h' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Hour</option> 
     271        <option value="d"<?php if ( 'd' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Day</option> 
     272        <option value="w"<?php if ( 'w' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Week</option> 
     273        <option value="m"<?php if ( 'm' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Month</option> 
     274        <option value="y"<?php if ( 'y' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>Year</option> 
     275        <option value="a"<?php if ( 'a' == $instance['listPeriod'] ) echo 'selected="selected"'; ?>>List all</option> 
     276        </select> 
     277        <br />Or specify number of days / enter range of date: <input style="width: 100%;" id="<?php echo $this->get_field_id( 'listPeriodnum' ); ?>" name="<?php echo $this->get_field_name( 'listPeriodnum' ); ?>" type="text" value="<?php 
     278    if( (int)$instance['listPeriod'] || (strpos($instance['$listPeriod'], 'and') !== false) ) 
     279            echo $instance['listPeriod']; 
     280    ?>" /><br /><small>E.g. <strong>100</strong> for # of days or <strong>20090301 and 20090531</strong> for date range</small></p> 
     281        </p> 
     282    <p> 
     283        <label for="<?php echo $this->get_field_id( 'limitList' ); ?>">Limit number of names to:</label> 
     284        <input id="<?php echo $this->get_field_id( 'limitList' ); ?>" name="<?php echo $this->get_field_name( 'limitList' ); ?>" value="<?php echo $instance['limitList']; ?>" style="width: 30px;" type="text" /> 
     285        <br /><small>Enter numbers only</small> 
     286    </p> 
     287    <p> 
     288        <label for="<?php echo $this->get_field_id( 'limitChar' ); ?>">Limit characters in names to:</label> 
     289        <input id="<?php echo $this->get_field_id( 'limitChar' ); ?>" name="<?php echo $this->get_field_name( 'limitChar' ); ?>" value="<?php echo $instance['limitChar']; ?>" style="width: 30px;" type="text" /> 
     290        <br /><small>Enter numbers only</small> 
     291    </p> 
     292    <p> 
     293        <label for="<?php echo $this->get_field_id( 'listNull' ); ?>">Remarks for blank list:</label> 
     294        <input id="<?php echo $this->get_field_id( 'listNull' ); ?>" name="<?php echo $this->get_field_name( 'listNull' ); ?>" value="<?php echo $instance['listNull']; ?>" style="width: 100%;" type="text" /> 
     295    </p> 
     296    <p> 
     297        <label for="<?php echo $this->get_field_id( 'filterUrl' ); ?>">Filter the following full/partial URLs:</label> 
     298        <input id="<?php echo $this->get_field_id( 'filterUrl' ); ?>" name="<?php echo $this->get_field_name( 'filterUrl' ); ?>" value="<?php echo $instance['filterUrl']; ?>" style="width: 100%;" type="text" /> 
     299        <br /><small>Separate each URL with a comma (,)</small> 
     300    </p> 
     301    <p> 
     302        <label for="<?php echo $this->get_field_id( 'filterEmail' ); ?>">Filter the following full/partial emails:</label> 
     303        <input id="<?php echo $this->get_field_id( 'filterEmail' ); ?>" name="<?php echo $this->get_field_name( 'filterEmail' ); ?>" value="<?php echo $instance['filterEmail']; ?>" style="width: 100%;" type="text" /> 
     304        <br /><small>Separate each email with a comma (,)</small> 
     305    </p> 
     306        <p> 
     307        <label for="<?php echo $this->get_field_id( 'listType' ); ?>">Display list as:</label>  
     308        <select id="<?php echo $this->get_field_id( 'listType' ); ?>" name="<?php echo $this->get_field_name( 'listType' ); ?>"> 
     309        <option value="bul"<?php if ( 'bul' == $instance['listType'] ) echo 'selected="selected"'; ?>>Bulleted</option> 
     310        <option value="num"<?php if ( 'num' == $instance['listType'] ) echo 'selected="selected"'; ?>>Numbered</option> 
     311        </select> 
     312        </p> 
     313        <p> 
     314        <label for="<?php echo $this->get_field_id( 'makeLink' ); ?>">Hyperlink each name?</label>  
     315        <select id="<?php echo $this->get_field_id( 'makeLink' ); ?>" name="<?php echo $this->get_field_name( 'makeLink' ); ?>"> 
     316        <option value="0"<?php if ( '0' == $instance['makeLink'] ) echo 'selected="selected"'; ?>>No</option> 
     317        <option value="1"<?php if ( '1' == $instance['makeLink'] ) echo 'selected="selected"'; ?>>Yes</option> 
     318        </select> 
     319        </p> 
     320        <p> 
     321        <label for="<?php echo $this->get_field_id( 'targetBlank' ); ?>">Open each link in a new window?</label>  
     322        <select id="<?php echo $this->get_field_id( 'targetBlank' ); ?>" name="<?php echo $this->get_field_name( 'targetBlank' ); ?>"> 
     323        <option value="0"<?php if ( '0' == $instance['targetBlank'] ) echo 'selected="selected"'; ?>>No</option> 
     324        <option value="1"<?php if ( '1' == $instance['targetBlank'] ) echo 'selected="selected"'; ?>>Yes</option> 
     325        </select> 
     326        </p> 
     327        <p> 
     328        <label for="<?php echo $this->get_field_id( 'noFollow' ); ?>">NoFollow each name if hyperlinked?</label>  
     329        <select id="<?php echo $this->get_field_id( 'noFollow' ); ?>" name="<?php echo $this->get_field_name( 'noFollow' ); ?>"> 
     330        <option value="0"<?php if ( '0' == $instance['noFollow'] ) echo 'selected="selected"'; ?>>No</option> 
     331        <option value="1"<?php if ( '1' == $instance['noFollow'] ) echo 'selected="selected"'; ?>>Yes</option> 
     332        </select> 
     333        </p> 
     334        <p> 
     335        <label for="<?php echo $this->get_field_id( 'showCount' ); ?>">Show number of comments for each commenter?</label>  
     336        <select id="<?php echo $this->get_field_id( 'showCount' ); ?>" name="<?php echo $this->get_field_name( 'showCount' ); ?>"> 
     337        <option value="0"<?php if ( '0' == $instance['showCount'] ) echo 'selected="selected"'; ?>>No</option> 
     338        <option value="1"<?php if ( '1' == $instance['showCount'] ) echo 'selected="selected"'; ?>>Yes</option> 
     339        </select> 
     340        </p> 
     341        <p> 
     342        <label for="<?php echo $this->get_field_id( 'groupBy' ); ?>">(Hijack-proof?) Group commentors based on:</label>  
     343        <select id="<?php echo $this->get_field_id( 'groupBy' ); ?>" name="<?php echo $this->get_field_name( 'groupBy' ); ?>"> 
     344        <option value="0"<?php if ( '0' == $instance['groupBy'] ) echo 'selected="selected"'; ?>>E-mail</option> 
     345        <option value="1"<?php if ( '1' == $instance['groupBy'] ) echo 'selected="selected"'; ?>>User name</option> 
     346        </select> 
     347        </p> 
     348        <p> 
     349        <label for="<?php echo $this->get_field_id( 'showInHome' ); ?>">Show in home page only?</label>  
     350        <select id="<?php echo $this->get_field_id( 'showInHome' ); ?>" name="<?php echo $this->get_field_name( 'showInHome' ); ?>"> 
     351        <option value="0"<?php if ( '0' == $instance['showInHome'] ) echo 'selected="selected"'; ?>>No</option> 
     352        <option value="1"<?php if ( '1' == $instance['showInHome'] ) echo 'selected="selected"'; ?>>Yes</option> 
     353        </select> 
     354        </p> 
     355        <p> 
     356        <label for="<?php echo $this->get_field_id( 'onlyWithUrl' ); ?>">Display only commentors with URL?</label>  
     357        <select id="<?php echo $this->get_field_id( 'onlyWithUrl' ); ?>" name="<?php echo $this->get_field_name( 'onlyWithUrl' ); ?>"> 
     358        <option value="0"<?php if ( '0' == $instance['onlyWithUrl'] ) echo 'selected="selected"'; ?>>No</option> 
     359        <option value="1"<?php if ( '1' == $instance['onlyWithUrl'] ) echo 'selected="selected"'; ?>>Yes</option> 
     360        </select> 
     361        </p> 
     362        <p> 
     363        <label for="<?php echo $this->get_field_id( 'displayGravatar' ); ?>">Display Gravatar?</label>  
     364        <select id="<?php echo $this->get_field_id( 'displayGravatar' ); ?>" name="<?php echo $this->get_field_name( 'displayGravatar' ); ?>"> 
     365        <option value="0"<?php if ( '0' == $instance['displayGravatar'] ) echo 'selected="selected"'; ?>>No</option> 
     366        <option value="1"<?php if ( '1' == $instance['displayGravatar'] ) echo 'selected="selected"'; ?>>Yes</option> 
     367        </select> 
     368        </p> 
     369        <p> 
     370        <label for="<?php echo $this->get_field_id( 'defaultGravatar' ); ?>">Use the following default Gravatar:</label>  
     371        <select id="<?php echo $this->get_field_id( 'defaultGravatar' ); ?>" name="<?php echo $this->get_field_name( 'defaultGravatar' ); ?>"> 
     372        <option value="404"<?php if ( '404' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>404</option> 
     373        <option value="mm"<?php if ( 'mm' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>Mystery Man</option> 
     374        <option value="identicon"<?php if ( 'identicon' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>Identicon</option> 
     375        <option value="monsterid"<?php if ( 'monsterid' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>MonsterID</option> 
     376        <option value="wavatar"<?php if ( 'wavatar' == $instance['defaultGravatar'] ) echo 'selected="selected"'; ?>>Wavatar</option> 
     377        </select> 
     378        Size:<input id="<?php echo $this->get_field_id( 'avatarSize' ); ?>" name="<?php echo $this->get_field_name( 'avatarSize' ); ?>" value="<?php echo $instance['avatarSize']; ?>" style="width: 30px;" type="text" /> 
     379        </p> 
     380    <p> 
     381        <label for="<?php echo $this->get_field_id( 'displayAward' ); ?>">Show an Award if comments are equal or greater than:</label> 
     382        <input id="<?php echo $this->get_field_id( 'displayAward' ); ?>" name="<?php echo $this->get_field_name( 'displayAward' ); ?>" value="<?php echo $instance['displayAward']; ?>" style="width: 30px;" type="text" /> 
     383        <br /><small>Award image/icon appears if number greater than zero (0)</small> 
     384    </p> 
     385    <p> 
     386        <label for="<?php echo $this->get_field_id( 'iconAward' ); ?>">Award icon/image location:</label> 
     387        <input id="<?php echo $this->get_field_id( 'iconAward' ); ?>" name="<?php echo $this->get_field_name( 'iconAward' ); ?>" value="<?php echo $instance['iconAward']; ?>" style="width: 100%;" type="text" /> 
     388    </p> 
     389        <p> 
     390        <label for="<?php echo $this->get_field_id( 'alignAward' ); ?>">Align the Award icon:</label>  
     391        <select id="<?php echo $this->get_field_id( 'alignAward' ); ?>" name="<?php echo $this->get_field_name( 'alignAward' ); ?>"> 
     392        <option value="0"<?php if ( '0' == $instance['alignAward'] ) echo 'selected="selected"'; ?>>Left before Gravatar</option> 
     393        <option value="1"<?php if ( '1' == $instance['alignAward'] ) echo 'selected="selected"'; ?>>Left after Gravatar</option> 
     394        <option value="2"<?php if ( '2' == $instance['alignAward'] ) echo 'selected="selected"'; ?>>Right</option> 
     395        </select> 
     396        </p> 
     397    <?php 
     398  } // end function widget form 
     399} // end class 
    495400?> 
Note: See TracChangeset for help on using the changeset viewer.