Making WordPress.org


Ignore:
Timestamp:
11/22/2015 10:30:57 PM (8 years ago)
Author:
ocean90
Message:

Translate: Convert and merge the GP plugins "wporg-user-stats" and "wporg-project-stats" to a WP plugin.

See #1352.

Location:
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-custom-stats
Files:
2 added
1 copied

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-custom-stats/stats/user.php

    r2102 r2114  
    88 * @author dd32
    99 */
    10 class GP_WPorg_User_Stats extends GP_Plugin {
    11     var $id = 'wporg-user-stats';
     10class WPorg_GP_User_Stats {
    1211
    1312    function __construct() {
    14         global $gpdb;
     13        global $wpdb, $gp_table_prefix;
    1514
    16         parent::__construct();
    17         $this->add_action( 'translation_created' );
    18         $this->add_action( 'translation_saved' );
     15        add_action( 'translation_created', array( $this, 'translation_created' ) );
     16        add_action( 'translation_saved', array( $this, 'translation_saved' ) );
    1917
    20         $gpdb->user_translations_count = $gpdb->prefix . 'user_translations_count';
     18        $wpdb->user_translations_count = $gp_table_prefix . 'user_translations_count';
    2119    }
    2220
     
    4543
    4644        }
    47 
    4845    }
    4946
    5047    function bump_user_stat( $user_id, $locale, $locale_slug, $suggested = 0, $accepted = 0 ) {
    51         global $gpdb;
    52         $gpdb->query( $gpdb->prepare(
    53             "INSERT INTO {$gpdb->user_translations_count} (`user_id`, `locale`, `locale_slug`, `suggested`, `accepted`) VALUES (%d, %s, %s, %d, %d)
     48        global $wpdb;
     49        $wpdb->query( $wpdb->prepare(
     50            "INSERT INTO {$wpdb->user_translations_count} (`user_id`, `locale`, `locale_slug`, `suggested`, `accepted`) VALUES (%d, %s, %s, %d, %d)
    5451            ON DUPLICATE KEY UPDATE `suggested`=`suggested` + VALUES(`suggested`), `accepted`=`accepted` + VALUES(`accepted`)",
    5552            $user_id, $locale, $locale_slug, $suggested, $accepted
     
    5855
    5956}
    60 GP::$plugins->wporg_user_stats = new GP_WPorg_User_Stats;
    6157
    6258/*
Note: See TracChangeset for help on using the changeset viewer.