WordPress.org

Plugin Directory

Changeset 531237


Ignore:
Timestamp:
04/15/12 01:15:40 (2 years ago)
Author:
ericmann
Message:

Add version 1.2 - includes Codex contribution widget.

Location:
wp-core-contributions-widget
Files:
18 added
6 edited

Legend:

Unmodified
Added
Removed
  • wp-core-contributions-widget/trunk/inc/wp-core-contributions-widget-template.php

    r473970 r531237  
    2424    <p> 
    2525        <a href="<?php echo esc_url( 'https://core.trac.wordpress.org/search?q=' . $user . '&noquickjump=1&changeset=on&max=20' ); ?>"> 
    26             <?php printf( _n( "View the ticket on Trac.", "View all %d tickets on Trac.", $total ), $total ); ?> 
     26            <?php 
     27                if ( $total == 2 ) { 
     28                    _e( "View both tickets on Trac.", 'wp-core-contributions-widget' ); 
     29                } else { 
     30                    printf( _n( "View the ticket on Trac.", "View all %d tickets on Trac.", $total, 'wp-core-contributions-widget' ), $total ); 
     31                } 
     32            ?> 
    2733        </a> 
    2834    </p> 
  • wp-core-contributions-widget/trunk/lang/wp-core-contributions-widget.po

    r478111 r531237  
    33"Project-Id-Version: WP Core Contributions Widget 0.2\n" 
    44"Report-Msgid-Bugs-To: \n" 
    5 "POT-Creation-Date: 2011-12-11 19:00-0800\n" 
    6 "PO-Revision-Date: 2011-12-11 19:00-0800\n" 
     5"POT-Creation-Date: 2012-04-14 18:07-0800\n" 
     6"PO-Revision-Date: 2012-04-14 18:07-0800\n" 
    77"Last-Translator: Eric Mann <eric@eamann.com>\n" 
    88"Language-Team: Jumping Duck Media <info@jumping-duck.com>\n" 
     
    1616"X-Poedit-SearchPath-0: C:\\xampp\\htdocs\\wp-test\\wp-content\\plugins\\wp-core-contributions-widget\n" 
    1717 
     18#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/inc/wp-codex-contributions-widget-template.php:14 
     19#, php-format 
     20msgid "For %1$s" 
     21msgstr "" 
     22 
     23#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/inc/wp-codex-contributions-widget-template.php:23 
     24msgid "View both changes in the Codex." 
     25msgstr "" 
     26 
    1827#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/inc/wp-core-contributions-widget-template.php:13 
    1928#, php-format 
     
    2635msgstr "" 
    2736 
     37#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/inc/wp-core-contributions-widget-template.php:28 
     38msgid "View both tickets on Trac." 
     39msgstr "" 
     40 
     41#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-codex-contributions-widget.php:8 
     42msgid "Add a list of your contributions to the WordPress Codex as a sidebar widget." 
     43msgstr "" 
     44 
     45#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-codex-contributions-widget.php:11 
     46#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-codex-contributions-widget.php:21 
     47msgid "WP Codex Contributions" 
     48msgstr "" 
     49 
     50#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-codex-contributions-widget.php:27 
     51msgid "Codex Username" 
     52msgstr "" 
     53 
     54#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-codex-contributions-widget.php:37 
     55#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:37 
     56msgid "Title:" 
     57msgstr "" 
     58 
     59#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-codex-contributions-widget.php:40 
     60msgid "Codex Username:" 
     61msgstr "" 
     62 
     63#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-codex-contributions-widget.php:43 
     64msgid "Display How Many Changes?" 
     65msgstr "" 
     66 
    2867#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:8 
    2968msgid "Add a list of your accepted contributions to WordPress Core as a sidebar widget." 
     
    3170 
    3271#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:11 
    33 #: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:23 
     72#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:21 
    3473msgid "WP Core Contributions" 
    3574msgstr "" 
    3675 
    37 #: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:24 
     76#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:27 
    3877msgid "Trac Username" 
    3978msgstr "" 
    4079 
    41 #: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:29 
    42 msgid "Title:" 
    43 msgstr "" 
    44  
    45 #: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:32 
     80#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:40 
    4681msgid "Trac Username:" 
    4782msgstr "" 
    4883 
    49 #: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:35 
     84#: C:\xampp\htdocs\wp-test\wp-content\plugins\wp-core-contributions-widget/lib/class.wp-core-contributions-widget.php:43 
    5085msgid "Display How Many Tickets?" 
    5186msgstr "" 
  • wp-core-contributions-widget/trunk/lib/class.wp-core-contributions.php

    r478111 r531237  
    1414    public static function register_widget() { 
    1515        register_widget('WP_Core_Contributions_Widget'); 
     16        register_widget('WP_Codex_Contributions_Widget'); 
    1617    } 
    1718 
     
    6364        return $count; 
    6465    } 
     66     
     67    public static function get_codex_items( $username, $limit = 10 ) { 
     68        if ( $username == null ) return array(); 
     69         
     70        if ( false == ( $formatted = get_transient( 'wp-codex-contributions-' . $username ) ) ) { 
     71             
     72            $results_url = 'http://codex.wordpress.org/api.php?action=query&list=usercontribs&ucuser=' . $username . '&uclimit=' . $limit . '&ucdir=older&format=xml'; 
     73            $results = wp_remote_retrieve_body( wp_remote_get( $results_url, array('sslverify'=>false) ) ); 
     74             
     75            /* Expected XML format is as follows: 
     76             * <?xml version="1.0"?> 
     77             * <api> 
     78             *   <query> 
     79             *     <usercontribs> 
     80             *       <item user="Ericmann" pageid="21224" revid="109742" ns="0" title="Nginx" timestamp="2011-09-30T20:39:55Z" comment="External Links" /> 
     81             *       <item user="Ericmann" pageid="15227" revid="107245" ns="0" title="Switching to PHP5" timestamp="2011-07-08T21:41:56Z" comment="" /> 
     82             *       <item user="Ericmann" pageid="4580" revid="105196" ns="0" title="Using Subversion" timestamp="2011-05-19T15:47:29Z" comment="Add a resource." /> 
     83             *       <item user="Ericmann" pageid="4580" revid="104777" ns="0" title="Using Subversion" timestamp="2011-05-12T15:11:59Z" comment="Add a resource." /> 
     84             *       <item user="Ericmann" pageid="21198" revid="102162" ns="0" title="GSoC2011" timestamp="2011-03-17T13:58:14Z" comment="Mentors" /> 
     85             *       <item user="Ericmann" pageid="21198" revid="102100" ns="0" title="GSoC2011" timestamp="2011-03-15T13:55:20Z" minor="" comment="Mentors" /> 
     86             *       <item user="Ericmann" pageid="19084" revid="93082" ns="0" title="Post Types" timestamp="2010-09-18T17:08:51Z" comment="Fixing typos" /> 
     87             *     </usercontribs> 
     88             *   </query> 
     89             *   <query-continue> 
     90             *     <usercontribs ucstart="2010-09-18T16:48:17Z"/> 
     91             *   </query-continue> 
     92             * </api> 
     93             **/ 
     94             
     95            $raw = new SimpleXMLElement( $results ); 
     96             
     97            $formatted = array(); 
     98             
     99            foreach( $raw->query->usercontribs->item as $item ) { 
     100                $newItem = array( 
     101                    'title' => (string)$item['title'], 
     102                    'description' => (string)$item['comment'], 
     103                    'revision' => (int)$item['revid'] 
     104                ); 
     105                array_push( $formatted, $newItem ); 
     106            } 
     107             
     108            set_transient( 'wp-codex-contributions-' . $username, $formatted, 60 * 60 * 12 ); 
     109        } 
     110         
     111        return $formatted; 
     112    } 
     113     
     114    public static function get_codex_count( $username ) { 
     115        if ( $username == null ) return array(); 
     116 
     117        if ( false == ( $count = get_transient( 'wp-codex-contributions-count-' . $username ) ) ) { 
     118             
     119            $results_url = 'http://codex.wordpress.org/api.php?action=query&list=users&ususers=' . $username . '&usprop=editcount&format=xml'; 
     120            $results = wp_remote_retrieve_body( wp_remote_get( $results_url, array('sslverify'=>false) ) ); 
     121             
     122            /* Expected XML format is as follows: 
     123             * <?xml version="1.0"?> 
     124             * <api> 
     125             *   <query> 
     126             *     <users> 
     127             *       <user name="Ericmann" editcount="8" /> 
     128             *     </users> 
     129             *   </query> 
     130             * </api> 
     131             **/ 
     132             
     133            $raw = new SimpleXMLElement( $results ); 
     134            $count = (int)$raw->query->users->user["editcount"]; 
     135             
     136            set_transient( 'wp-codex-contributions-count-' . $username, $count, 60 * 60 * 12 ); 
     137        } 
     138 
     139        return $count;   
     140    } 
    65141} 
    66142 
  • wp-core-contributions-widget/trunk/readme.txt

    r512632 r531237  
    11=== WP Core Contributions Widget === 
    2 Contributors: ericmann, mfields, JohnPBloch 
     2Contributors: ericmann, mfields, JohnPBloch, mbijon 
    33Donate link: http://jumping-duck.com/wordpress 
    44Tags: core, widget, contributions 
    55Requires at least: 3.2.1 
    6 Tested up to: 3.3 
    7 Stable tag: 1.1 
    8 License: GPLv2+ 
     6Tested up to: 3.4 
     7Stable tag: 1.2 
     8License GPLv2+ 
    99 
    1010Add a list of your accepted contributions to WordPress Core as a sidebar widget. 
     
    1212== Description == 
    1313 
    14 A lot of people write code.  A lot of people write WordPress plugins.  A lot of people write WordPress themes.  But only a handful of people contribute code back to the core WordPress project.  Take a second to show off the patches that you've submitted that have made it into core.  It's a great way to highlight your coding credentials and back up your resume. 
     14A lot of people write code.  A lot of people write WordPress plugins.  A lot of people write WordPress themes. 
     15 
     16Only a handful of people contribute code back to the core WordPress project.  Even fewer contribute documentation to the WordPress Codex. 
     17 
     18Take a second to show off the patches that you've submitted that have made it into core and the updates you've submitted to the Codex.  It's a great way to highlight your coding credentials and back up your resume. 
    1519 
    1620== Installation == 
     
    21251. Activate the plugin through the 'Plugins' menu in WordPress 
    22261. Add the WP Core Contributions Widget to your sidebar (be sure to enter your Trac username!) 
     271. Add the WP Codex Contributions Widget to your sidebar (be sure to enter your Codex username!) 
    2328 
    2429== Frequently Asked Questions == 
    2530 
    26 = Not all of my patches show up, what's wrong? = 
     31= Not all of my Trac patches show up, what's wrong? = 
    2732 
    2833The system currently only parses the first page of search results.  So your latest 10 patches will always be displayed. 
    2934 
    30 = How can I customize the template? = 
     35= How can I customize the templates? = 
    3136 
    32 Take a look at the default template in `/inc/wp-core-contributions-widget-template.php`.  This is the way the widget displays by default. 
     37Take a look at the default templates in the `/inc/1 directory that the widgets display by default: 
     38 
     39* `wp-core-contributions-widget-template.php` 
     40* `wp-codex-contributions-widget-template.php` 
    3341 
    3442However, you can place a custom template in your theme directory to override this.  Just place a `wp-core-contributions-widget-template.php` file in your theme directory to override the defaults. 
     
    3644Remember, all of the parsed Trac tickets are contained in the `$items` array.  The total count of the user's contributions is contained in the `$total` variable.  Aside from that, use any variables you like. 
    3745 
    38 The `$items` array is a collection of associative arrays each containing: 
     46The Trac `$items` array is a collection of associative arrays each containing: 
    3947 
    4048* `link` -> A link to the actual Trac changeset. 
     
    4351* `ticket` -> The ID of the ticket fixed by the patch. 
    4452 
     53The parsed Codex pages are also contained in an `$items` array.  The total count of the user's contributions is contained in the `$total` variable. 
     54 
     55The Codex `$items` array is a collection of associative arrays, each containing: 
     56 
     57* `title` -> Title of the page being changed. 
     58* `description` -> Description of the change made. 
     59* `revision` -> Revision number according to the Codex wiki (used to create a link). 
     60 
    4561== Screenshots == 
    4662 
    47631. Example widget showing the default markup on the Twenty Eleven theme and contributions by [ericmann](http://profiles.wordpress.org/users/ericmann/). 
     641. Example widget showing the default Codex contributions widget on the Twenty Eleven theme (contributions by [ericmann](http://profiles.wordpress.org/users/ericmann/). 
    4865 
    4966== Changelog == 
     67 
     68= 1.2 = 
     69* Add Codex contributions widget 
    5070 
    5171= 1.1 = 
  • wp-core-contributions-widget/trunk/wp-core-contributions-widget.php

    r512632 r531237  
    44Plugin URI: http://jumping-duck.com/wordpress 
    55Description: Add a list of your accepted contributions to WordPress Core as a sidebar widget. 
    6 Version: 1.1 
     6Version: 1.2 
    77Author: Eric Mann 
    88Author URI: http://eamann.com 
     
    3333require_once( 'lib/class.wp-core-contributions.php' ); 
    3434require_once( 'lib/class.wp-core-contributions-widget.php' ); 
     35require_once( 'lib/class.wp-codex-contributions-widget.php' ); 
    3536 
    3637WP_Core_Contributions::init(); 
Note: See TracChangeset for help on using the changeset viewer.