Making WordPress.org


Ignore:
Timestamp:
10/30/2020 06:47:16 AM (6 years ago)
Author:
dd32
Message:

Trac Notifications plugin: Add extra getters for Trac details.

This removes some now unused code too.

File:
1 edited

Legend:

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

    r9353 r10420  
    1111
    1212        protected $trac;
     13        protected $api;
    1314        protected $components;
    1415
     
    2728
    2829                $this->trac = $trac;
    29 
    30                 if ( 'core' === $trac && function_exists( 'add_db_table' ) ) {
    31                         $tables = array( 'ticket', '_ticket_subs', '_notifications', 'ticket_change', 'component', 'milestone', 'ticket_custom' );
    32                         foreach ( $tables as $table ) {
    33                                 add_db_table( 'trac_' . $trac, $table );
    34                         }
    35                 }
    36 
    37                 $this->api = new Trac_Notifications_HTTP_Client( $this->trac_url() . '/wpapi', TRAC_NOTIFICATIONS_API_KEY );
     30                $this->api  = new Trac_Notifications_HTTP_Client( $this->trac_url() . '/wpapi', TRAC_NOTIFICATIONS_API_KEY );
    3831
    3932                if ( 'core' === $trac ) {
     
    4942        function trac_url() {
    5043                return 'https://' . $this->trac . '.trac.wordpress.org';
     44        }
     45
     46        function trac_name() {
     47                return ucfirst( $this->trac );
     48        }
     49
     50        function trac_api() {
     51                if ( ! $this->trac || ! $this->api ) {
     52                        return false;
     53                }
     54
     55                return $this->api;
    5156        }
    5257
Note: See TracChangeset for help on using the changeset viewer.