Making WordPress.org


Ignore:
Timestamp:
04/05/2016 04:05:02 PM (9 years ago)
Author:
kovshenin
Message:

WordCamp.org: Reintegrate application-tracking branch into trunk.

Location:
sites/trunk/wordcamp.org
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordcamp.org

  • sites/trunk/wordcamp.org/public_html/wp-content/plugins/wcpt/wcpt-loader.php

    r171 r2898  
    1515 */
    1616define( 'WCPT_VERSION', '0.1' );
     17define( 'WCPT_DIR', plugin_dir_path( __FILE__ ) );
     18define( 'WCPT_URL', plugins_url( '/', __FILE__ ) );
    1719
    1820if ( !class_exists( 'WCPT_Loader' ) ) :
     
    3032     * The main WordCamp Post Type loader
    3133     */
    32     function wcpt_loader () {
    33         /** COMPONENT HOOKS ***************************************************/
     34    function __construct() {
     35        add_action( 'plugins_loaded', array( $this, 'core_admin' ) );
     36        add_action( 'init', array( $this, 'core_text_domain' ) );
    3437
    35         // Attach the wcpt_loaded action to the WordPress plugins_loaded action.
    36         add_action( 'plugins_loaded',   array ( $this, 'component_loaded' ) );
    37 
    38         // Attach the wcpt_init to the WordPress init action.
    39         add_action( 'init',             array ( $this, 'component_init' ) );
    40 
    41         // Attach constants to wcpt_loaded.
    42         add_action( 'wcpt_loaded',      array ( $this, 'component_constants' ) );
    43 
    44         // Attach includes to wcpt_loaded.
    45         add_action( 'wcpt_loaded',      array ( $this, 'component_includes' ) );
    46 
    47         // Attach post type registration to wcpt_init.
    48         add_action( 'wcpt_init',        array ( $this, 'component_post_types' ) );
    49 
    50         // Attach tag registration wcpt_init.
    51         add_action( 'wcpt_init',        array ( $this, 'component_taxonomies' ) );
    52 
    53         /** CORE HOOKS ********************************************************/
    54 
    55         // Core Constants
    56         add_action( 'wcpt_started',     array ( $this, 'core_constants' ) );
    57 
    58         // Core Includes
    59         add_action( 'wcpt_started',     array ( $this, 'core_includes' ) );
    60 
    61         // Core Admin
    62         add_action( 'wcpt_loaded',      array ( $this, 'core_admin' ) );
    63 
    64         // Attach theme directory wcpt_loaded.
    65         add_action( 'wcpt_loaded',      array ( $this, 'core_theme_directory' ) );
    66 
    67         // Attach textdomain to wcpt_init.
    68         add_action( 'wcpt_init',        array ( $this, 'core_text_domain' ) );
    69 
    70         // Register WordCamp Post Type activation sequence
    71         register_activation_hook( __FILE__,   array( $this, 'activation' ) );
    72 
    73         // Register WordCamp Post Type deactivation sequence
    74         register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
    75 
    76         // Get this party started
    77         do_action( 'wcpt_started' );       
     38        $this->includes();
    7839    }
    7940
    8041    /**
    81      * core_constants ()
    82      *
    83      * WordCamp Core Constants
    84      */
    85     function core_constants () {
    86         // Turn debugging on/off
    87         if ( !defined( 'WCPT_DEBUG' ) )
    88             define( 'WCPT_DEBUG', WP_DEBUG );
    89 
    90         // Default slug for post type
    91         if ( !defined( 'WCPT_THEMES_DIR' ) )
    92             define( 'WCPT_THEMES_DIR', apply_filters( 'wcpt_themes_dir', WP_PLUGIN_DIR . '/wcpt-themes' ) );
    93 
    94         // WordCamp Post Type root directory
    95         define( 'WCPT_DIR', WP_PLUGIN_DIR . '/wcpt' );
    96         define( 'WCPT_URL', plugins_url( $path = '/wcpt' ) );
    97 
    98         // Images URL
    99         define( 'WCPT_IMAGES_URL', WCPT_URL . '/wcpt-images' );
    100     }
    101 
    102     /**
    103      * core_includes ()
    104      *
    10542     * WordCamp Core File Includes
    10643     */
    107     function core_includes () {
     44    function includes() {
    10845        // Load the files
    109         require_once ( WCPT_DIR . '/wcpt-functions.php' );
    110         require_once ( WCPT_DIR . '/wcpt-wordcamp/wordcamp-loader.php' );
     46        require_once ( WCPT_DIR . 'wcpt-functions.php' );
     47        require_once ( WCPT_DIR . 'wcpt-wordcamp/wordcamp-loader.php' );
     48        require_once ( WCPT_DIR . 'applications/common.php' );
     49        require_once ( WCPT_DIR . 'applications/tracker.php' );
     50        require_once ( WCPT_DIR . 'applications/wordcamp.php' );
     51
    11152        // Require admin files.
    11253        if ( is_admin() ) {
    113             require_once ( WCPT_DIR . '/wcpt-admin.php' );
    114             require_once ( WCPT_DIR . '/wcpt-wordcamp/wordcamp-admin.php' );
     54            require_once ( WCPT_DIR . 'wcpt-admin.php' );
     55            require_once ( WCPT_DIR . 'wcpt-wordcamp/wordcamp-admin.php' );
    11556        }
    11657    }
    11758
    118     function core_admin () {
     59    function core_admin() {
    11960        // Quick admin check
    12061        if ( !is_admin() )
     
    12263
    12364        // Create admin
    124         $GLOBALS['wcpt_admin']      = new WCPT_Admin();
    125         $GLOBALS['wordcamp_admin']  = new WordCamp_Admin();
     65        $GLOBALS['wcpt_admin'] = new WCPT_Admin;
     66        $GLOBALS['wordcamp_admin'] = new WordCamp_Admin;
    12667    }
    12768
     
    13172     * Load the translation file for current language
    13273     */
    133     function core_text_domain () {
     74    function core_text_domain() {
    13475        $locale = apply_filters( 'wcpt_textdomain', get_locale() );
    135 
    136         $mofile = WCPT_DIR . "/wcpt-languages/wcpt-$locale.mo";
     76        $mofile = WCPT_DIR . "wcpt-languages/wcpt-$locale.mo";
    13777
    13878        load_textdomain( 'wcpt', $mofile );
    139 
    140         /**
    141          * Text domain has been loaded
    142          */
    143         do_action( 'wcpt_load_textdomain' );
    144     }
    145 
    146     /**
    147      * core_theme_directory ()
    148      *
    149      * Sets up the WordCamp Post Type theme directory to use in WordPress
    150      *
    151      * @since WordCamp Post Type (0.1)
    152      * @uses register_theme_directory
    153      */
    154     function core_theme_directory () {
    155         register_theme_directory( WCPT_THEMES_DIR );
    156 
    157         /**
    158          * Theme directory has been registered
    159          */
    160         do_action( 'wcpt_register_theme_directory' );
    161     }
    162 
    163     /**
    164      * activation ()
    165      *
    166      * Runs on WordCamp Post Type activation
    167      *
    168      * @since WordCamp Post Type (0.1)
    169      */
    170     function activation () {
    171         register_uninstall_hook( __FILE__, array( $this, 'uninstall' ) );
    172 
    173         /**
    174          * WordCamp Post Type has been activated
    175          */
    176         do_action( 'wcpt_activation' );
    177     }
    178 
    179     /**
    180      * deactivation ()
    181      *
    182      * Runs on WordCamp Post Type deactivation
    183      *
    184      * @since WordCamp Post Type (0.1)
    185      */
    186     function deactivation () {
    187         do_action( 'wcpt_deactivation' );
    188     }
    189 
    190     /**
    191      * uninstall ()
    192      *
    193      * Runs when uninstalling WordCamp Post Type
    194      *
    195      * @since WordCamp Post Type (0.1)
    196      */
    197     function uninstall () {
    198         do_action( 'wcpt_uninstall' );
    199     }
    200 
    201     /**
    202      * component_constants ()
    203      *
    204      * Default component constants that can be overridden or filtered
    205      */
    206     function component_constants () {
    207         do_action( 'wcpt_constants' );
    208     }
    209 
    210     /**
    211      * component_includes ()
    212      *
    213      * Include required files
    214      *
    215      */
    216     function component_includes () {
    217         do_action( 'wcpt_includes' );
    218     }
    219 
    220     /**
    221      * component_loaded ()
    222      *
    223      * A WordCamp Post Type specific action to say that it has started its
    224      * boot strapping sequence. It's attached to the existing WordPress
    225      * action 'plugins_loaded' because that's when all plugins have loaded.
    226      *
    227      * @uses is_admin If in WordPress admin, load additional file
    228      * @uses do_action()
    229      */
    230     function component_loaded () {
    231         do_action( 'wcpt_loaded' );
    232     }
    233 
    234     /**
    235      * component_init ()
    236      *
    237      * Initialize WordCamp Post Type as part of the WordPress initilization process
    238      *
    239      * @uses do_action Calls custom action to allow external enhancement
    240      */
    241     function component_init () {
    242         do_action ( 'wcpt_init' );
    243     }
    244 
    245     /**
    246      * component_post_type ()
    247      *
    248      * Setup the post types and taxonomies
    249      */
    250     function component_post_types () {
    251         do_action ( 'wcpt_register_post_types' );
    252     }
    253 
    254     /**
    255      * component_taxonomies ()
    256      *
    257      * Register the built in WordCamp Post Type taxonomies
    258      *
    259      * @since WordCamp Post Type (0.1)
    260      *
    261      * @uses register_taxonomy()
    262      * @uses apply_filters()
    263      */
    264     function component_taxonomies () {
    265         do_action ( 'wcpt_register_taxonomies' );
    26679    }
    26780}
     
    27083
    27184// Load everything up
    272 $wcpt_loader      = new WCPT_Loader();
    273 $wordcamp_loader  = new WordCamp_Loader();
    274 ?>
     85$wcpt_loader     = new WCPT_Loader;
     86$wordcamp_loader = new WordCamp_Loader;
Note: See TracChangeset for help on using the changeset viewer.