Making WordPress.org

Changeset 2120


Ignore:
Timestamp:
11/23/2015 09:28:30 PM (11 years ago)
Author:
ocean90
Message:

Translate: Merge the GP plugin "wporg-log-discarded-warnings" into the custom stats WP plugin for GlotPress.

See #1352.

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

Legend:

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

    r2115 r2120  
    11<?php
     2
    23/**
    34 * This plugin logs discared warnings into a database table.
     
    56 * @author Dominik Schilling (ocean90)
    67 */
    7 class GP_WPorg_Log_Discarded_Warnings extends GP_Plugin {
    8         var $id = 'wporg-log-discarded-warnings';
     8class WPorg_GP_Discarded_Warning_Stats {
    99
    1010        /**
     
    1313         * @var string
    1414         */
    15         var $table_name = 'translate_dotorg_warnings';
     15        private $table_name = 'translate_dotorg_warnings';
    1616
    17         function __construct() {
    18                 parent::__construct();
    19                 $this->add_action( 'warning_discarded', array( 'args' => 5 ) );
     17        public function __construct() {
     18                add_action( 'warning_discarded', array( $this, 'log_discarded_warning' ), 10, 5 );
    2019        }
    2120
     
    2928         * @param  int    $user            ID of the user.
    3029         */
    31         function warning_discarded( $project_id, $translation_set, $translation, $warning, $user ) {
    32                 global $gpdb;
     30        public function log_discarded_warning( $project_id, $translation_set, $translation, $warning, $user ) {
     31                global $wpdb;
    3332
    3433                $warning = array(
     
    4140                );
    4241                $format = array( '%d', '%d', '%d', '%s', '%d', '%s' );
    43                 $gpdb->insert(
     42                $wpdb->insert(
    4443                        $this->table_name,
    4544                        $warning,
     
    4847        }
    4948}
    50 GP::$plugins->wporg_log_discared_warnings = new GP_WPorg_Log_Discarded_Warnings;
    5149
    5250/*
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-custom-stats/wporg-gp-custom-stats.php

    r2114 r2120  
    1010class WPorg_GP_Custom_Stats {
    1111
     12        /**
     13         * Holds the user stats instance.
     14         *
     15         * @var WPorg_GP_User_Stats
     16         */
    1217        public $user;
     18
     19        /**
     20         * Holds the project stats instance.
     21         *
     22         * @var WPorg_GP_Project_Stats
     23         */
    1324        public $project;
     25
     26        /**
     27         * Holds the discarded warning stats instance.
     28         *
     29         * @var WPorg_GP_Discarded_Warning_Stats
     30         */
     31        public $discarded_warning;
    1432
    1533        public function __construct() {
     
    1735        }
    1836
     37        /**
     38         * Initializes custom stats classes.
     39         */
    1940        public function init_stats() {
    20 
    2141                $this->user    = new WPorg_GP_User_Stats();
    2242                $this->project = new WPorg_GP_Project_Stats();
     43                $this->discarded_warning = new WPorg_GP_Discarded_Warning_Stats();
    2344        }
    2445}
Note: See TracChangeset for help on using the changeset viewer.