WordPress.org

Making WordPress.org

Changeset 289


Ignore:
Timestamp:
01/13/2014 02:12:36 PM (7 years ago)
Author:
nacin
Message:

Trac Notifications: Add conditional support for remaining Tracs. see #127.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/trac-notifications/trac-notifications.php

    r280 r289  
    11<?php
    22/* Plugin Name: Trac Notifications
    3  * Description: For make.wordpress.org/core only, at the moment. Adds notifications endpoints for Trac, as well as notification management.
     3 * Description: Adds notifications endpoints for Trac, as well as notification management.
    44 * Author: Nacin
    5  * Version: 1.0
     5 * Version: 1.1
    66 */
    77
     
    1010    protected $trac_subdomain;
    1111
     12    protected $tracs_supported = array( 'core', 'meta', 'themes', 'plugins' );
     13    protected $tracs_supported_extra = array( 'bbpress', 'buddypress', 'gsoc', 'glotpress' );
     14
    1215    function __construct() {
    13         $this->set_trac( 'core' );
     16        $make_site = explode( '/', home_url( '' ) );
     17        $trac = $make_site[3];
     18        if ( $make_site[2] !== 'make.wordpress.org' || ! in_array( $trac, $this->tracs_supported ) ) {
     19            return;
     20        }
     21        if ( 'core' === $trac && isset( $_GET['trac'] ) && in_array( $_GET['trac'], $this->tracs_supported_extra ) ) {
     22            $trac = $_GET['trac'];
     23        }
     24        $this->set_trac( $trac );
    1425        add_filter( 'allowed_http_origins', array( $this, 'filter_allowed_http_origins' ) );
    1526        add_action( 'template_redirect', array( $this, 'action_template_redirect' ) );
     
    7990
    8091    function get_trac_milestones() {
    81         // Only shoe 3.8+, when this feature was launched.
     92        // Only show 3.8+, when this feature was launched.
    8293        return $this->trac->get_results( "SELECT name, completed FROM milestone
    8394            WHERE name NOT IN ('WordPress.org', '3.5.3', '3.6.2', '3.7.2') AND (completed = 0 OR completed >= 1386864000000000)
Note: See TracChangeset for help on using the changeset viewer.