Making WordPress.org


Ignore:
Timestamp:
02/25/2016 05:03:19 AM (10 years ago)
Author:
dd32
Message:

Plugin Directory: Switch to using namespaces instead of implemeting them through classnames.
This change introduces an autoloader and relies upon it for most file inclusions, this should encourage us to keep a standard naming schema and writing more component classes going forward.
See #1584

File:
1 moved

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-tools.php

    r2562 r2611  
    11<?php
    2 /**
    3  * @package WPorg_Plugin_Directory
    4  */
     2namespace WordPressdotorg\Plugin_Directory;
    53
    64/**
    75 * Various functions used by other processes, will make sense to move to specific classes.
     6 *
     7 * @package WordPressdotorg_Plugin_Directory
    88 */
    9 class WPorg_Plugin_Directory_Tools {
     9class Tools {
    1010
    1111    /**
     
    1919        include_once __DIR__ . '/readme-parser/compat.php';
    2020
    21         $data = (object) WPorg_Readme::parse_readme( $readme );
     21        $data = (object) \WPorg_Readme::parse_readme( $readme );
    2222
    2323        unset( $data->sections['screenshots'] ); // Useless.
     
    5353        }
    5454
    55         $tonesque = new Tonesque( $file_location );
     55        $tonesque = new \Tonesque( $file_location );
    5656        return $tonesque->color();
    5757    }
     
    7676     */
    7777    public static function grant_plugin_committer( $plugin_slug, $user ) {
    78         global $wpdb, $wporg_plugin_directory;
    79         if ( ! $user instanceof WP_User ) {
    80             $user = new WP_User( $user );
     78        global $wpdb;
     79        if ( ! $user instanceof \WP_User ) {
     80            $user = new \WP_User( $user );
    8181        }
    8282
    83         if ( ! $user->exists() || ! $wporg_plugin_directory->get_plugin_post( $plugin_slug ) ) {
     83        if ( ! $user->exists() || ! Plugin_Directory::instance()->get_plugin_post( $plugin_slug ) ) {
    8484            return false;
    8585        }
     
    108108     */
    109109    public static function revoke_plugin_committer( $plugin_slug, $user ) {
    110         global $wpdb, $wporg_plugin_directory;
    111         if ( ! $user instanceof WP_User ) {
    112             $user = new WP_User( $user );
     110        global $wpdb;
     111        if ( ! $user instanceof \WP_User ) {
     112            $user = new \WP_User( $user );
    113113        }
    114114
    115         if ( ! $user->exists() || ! $wporg_plugin_directory->get_plugin_post( $plugin_slug ) ) {
     115        if ( ! $user->exists() || ! Plugin_Directory::instance()->get_plugin_post( $plugin_slug ) ) {
    116116            return false;
    117117        }
Note: See TracChangeset for help on using the changeset viewer.