WordPress.org

Plugin Directory

Changeset 522770


Ignore:
Timestamp:
03/23/12 19:09:40 (2 years ago)
Author:
neoxx
Message:

1.31

  • changed handling of contextual help for WordPress 3.3
  • adopted handling of default settings
  • external files are now registered in init-hook
Location:
featuring-countcomments/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • featuring-countcomments/trunk/featuring-countcomments.php

    r407314 r522770  
    66Description: Counts the number of comments for each user who has been logged in at the time of commenting. 
    77Author: Dr. Bernhard Riedl 
    8 Version: 1.30 
     8Version: 1.31 
    99Author URI: http://www.bernhard.riedl.name/ 
    1010*/ 
    1111 
    1212/* 
    13 Copyright 2006-2011 Dr. Bernhard Riedl 
    14  
    15 Inspirations & Proof-Reading 2007-2011 
     13Copyright 2006-2012 Dr. Bernhard Riedl 
     14 
     15Inspirations & Proof-Reading 2007-2012 
    1616by Veronika Grascher 
    1717original idea by Martijn van der Kwast 
     
    190190            'fields' => array( 
    191191                'include_user_admin' => 'Display comment count on User page in Admin Menu', 
    192                 'all_users_can_view_other_users_comment_counts' => 'All users can view other users comment counts', 
     192                'all_users_can_view_other_users_comment_counts' => 'All users can view other users\' comment counts', 
    193193                'view_other_users_comment_counts_capability' => 'Capability to view comment count of other users', 
    194194                'debug_mode' => 'Enable Debug-Mode' 
     
    209209        $this->set_plugin_url(); 
    210210        $this->retrieve_settings(); 
    211         $this->register_scripts(); 
    212211        $this->register_hooks(); 
    213212    } 
     
    217216    */ 
    218217 
    219     private function register_scripts() { 
     218    function register_scripts() { 
    220219        wp_register_script($this->get_prefix().'utils', $this->get_plugin_url().'js/utils.js', array('jquery'), '1.30'); 
    221220 
     
    228227 
    229228    private function register_hooks() { 
     229 
     230        /* 
     231        register externals 
     232        */ 
     233 
     234        add_action('init', array(&$this, 'register_scripts')); 
    230235 
    231236        /* 
     
    384389 
    385390        /* 
    386         for some strange reason, 
    387         WordPress doesn't like to 
    388         write to an empty option 
     391        we intentionally write 
     392        the fallbacks in the 
     393        database to activate 
     394        built-in caching 
     395        and repair a broken 
     396        settings-array 
    389397        */ 
    390398 
    391399        else { 
    392             update_option($this->get_prefix(false), array()); 
     400            update_option( 
     401                $this->get_prefix(false), 
     402                array( 
     403                    'defaults' => $this->fallback_defaults, 
     404                    'options' => $this->fallback_options 
     405                ) 
     406            ); 
    393407        } 
    394408 
     
    437451 
    438452        /* 
    439         check-fields are either 0 or 1 
     453        check-fields will be 
     454        converted to true/false 
    440455        */ 
    441456 
     
    453468 
    454469        foreach ($check_fields as $check_field) { 
    455             $input[$check_field] = (isset($input[$check_field]) && $input[$check_field] == 1 ? true : false); 
     470            $input[$check_field] = (isset($input[$check_field]) && $input[$check_field] == 1) ? true : false; 
    456471        } 
    457472 
     
    768783 
    769784    /* 
     785    Options Page Help Tab 
     786    */ 
     787 
     788    function options_page_help_tab() { 
     789        $this->add_help_tab($this->options_page_help()); 
     790    } 
     791 
     792    /* 
    770793    white list options 
    771794    */ 
     
    790813        add_action('admin_print_scripts-'.$options_page, array(&$this, 'settings_print_scripts')); 
    791814        add_action('admin_head-'.$options_page, array(&$this, 'admin_styles')); 
    792         add_contextual_help($options_page, $this->options_page_help()); 
     815        add_action('load-'.$options_page, array(&$this, 'options_page_help_tab')); 
    793816    } 
    794817 
     
    798821 
    799822    function head_meta() { 
    800         echo("<meta name=\"".$this->get_nicename()."\" content=\"1.30\" />\n"); 
     823        echo("<meta name=\"".$this->get_nicename()."\" content=\"1.31\" />\n"); 
    801824    } 
    802825 
     
    12771300 
    12781301        if (!isset($this->cache[$user_id])) { 
    1279             $this->log('cache user count for user_id '.$user_id); 
     1302            $this->log('cache user comment count for user_id '.$user_id); 
    12801303 
    12811304            $q = "SELECT COUNT($wpdb->comments.comment_ID) FROM $wpdb->comments WHERE $wpdb->comments.comment_approved = '1' AND $wpdb->comments.user_id = $user_id"; 
     
    14861509 
    14871510    /* 
     1511    handles adding a help-tab 
     1512    */ 
     1513 
     1514    private function add_help_tab($help_text) { 
     1515        $current_screen=get_current_screen(); 
     1516 
     1517        /* 
     1518        WP >= 3.0 
     1519        */ 
     1520 
     1521        if (!method_exists($current_screen, 'add_help_tab')) 
     1522            add_contextual_help($current_screen, $help_text); 
     1523 
     1524        /* 
     1525        WP >= 3.3 
     1526        */ 
     1527 
     1528        else { 
     1529            $help_options=array( 
     1530                'id' => $this->get_prefix(), 
     1531                'title' => $this->get_nicename(), 
     1532                'content' => $help_text 
     1533            ); 
     1534 
     1535            $current_screen->add_help_tab($help_options); 
     1536        } 
     1537    } 
     1538 
     1539    /* 
    14881540    Settings Page 
    14891541    */ 
     
    18311883        <ul> 
    18321884 
    1833             <li>You can select the default <em>Query Type</em> and whether you want to <em>Display</em> the results.</li> 
     1885            <li>You can select the default <em>Query Type</em> and whether you want to <em>Display</em> the <em>Results</em>.</li> 
    18341886 
    18351887            <li>If you select to <em>Format</em> the results, you can choose how the formatted string should look like in the fields <em>Text 0 comments</em>, <em>Text 1 comments</em> and <em>Text more comments</em>. <em>%c</em> will be replaced with the user's comment count. Moreover you can choose the format of the <em>Thousands Separator</em>.</li> 
     
    18961948            <li>If you select <em>Display comment count on User page in Admin Menu</em>, every user's comment count will be displayed on the <a href="users.php">users-page</a>.</li> 
    18971949 
    1898             <li>If you want to keep the comment counts as a secret, you can deactivate <em>All users can view other users comment counts</em>. In that case, only users with the <em><a target="_blank" href="http://codex.wordpress.org/Roles_and_Capabilities">Capability</a> to view comment count of other users</em> can access this information.</li> 
     1950            <li>If you want to keep the comment counts as a secret, you can deactivate <em>All users can view other users' comment counts</em>. In that case, only users with the <em><a target="_blank" href="http://codex.wordpress.org/Roles_and_Capabilities">Capability</a> to view comment count of other users</em> can access this information.</li> 
    18991951 
    19001952            <li>The <em>Debug Mode</em> can be used to have a look on the actions undertaken by <?php echo($this->get_nicename()); ?> and to investigate unexpected behaviour.</li> 
  • featuring-countcomments/trunk/readme.txt

    r436073 r522770  
    44Tags: count, comment, comments, author, authors, user, users, widget, dashboard, sidebar, shortcode, multisite, multi-site 
    55Requires at least: 3.2 
    6 Tested up to: 3.3 
     6Tested up to: 3.4 
    77Stable tag: trunk 
    88 
     
    1515**starting from version 1.00 with a new API and widget functionality** 
    1616 
     17* extends information on Users page in Admin Menu with comment counts 
    1718* optionpage-configurable for standard functions 
    1819* easy to integrate (ships with multi/sidebar- and dashboard-widget functionality) 
    19 * possible to integrate in "Right Now" box on the dashboard or on the user's profile page 
    20 * extends information on Users page in Admin Menu with comment counts 
    21 * high performing because user counts are re-used within a page-call 
     20* possible to integrate in "Right Now" box or to display as widget on the dashboard and on the user's profile page 
     21* high performance because users' comment counts are re-used within a page-call 
    2222* fully compatible with [https/SSL/TLS-sites](http://codex.wordpress.org/Administration_Over_SSL) 
    2323* fully WP 3.0 multi-site network compatible 
     
    246246 
    247247== Changelog == 
     248 
     249= 1.31 = 
     250 
     251* changed handling of contextual help for WordPress 3.3 
     252* adopted handling of default settings 
     253* external files are now registered in init-hook 
    248254 
    249255= 1.30 = 
Note: See TracChangeset for help on using the changeset viewer.