Skip to:
Content

bbPress.org


Ignore:
Timestamp:
11/15/2010 04:08:11 AM (16 years ago)
Author:
johnjamesjacoby
Message:

Replace constants with $bbp global. Rename 'post type' references to 'content type.' Various human readability fixes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/plugin/bbp-includes/bbp-loader.php

    r2594 r2596  
    1515
    1616        /**
    17          * The main bbPress loader
     17         * The main bbPress loader. Action priorities included within this function
     18         * are for the sake of human readability and clarification.
    1819         */
    19         function bbp_loader () {
    20                 // Attach the bbp_loaded action to the WordPress plugins_loaded action.
    21                 add_action( 'plugins_loaded',  array ( $this, 'loaded' ) );
     20        function BBP_Loader () {
     21                // Attach to WordPress actions
     22                add_action( 'plugins_loaded', array ( $this, 'loaded'                   ), 10 );
     23                add_action( 'init',           array ( $this, 'init'                     ), 10 );
    2224
    23                 // Attach the bbp_init to the WordPress init action.
    24                 add_action( 'init',            array ( $this, 'init' ) );
     25                // Attach to bbp_loaded.
     26                add_action( 'bbp_loaded',     array ( $this, 'constants'                ), 2  );
     27                add_action( 'bbp_loaded',     array ( $this, 'boot_strap_globals'       ), 4  );
     28                add_action( 'bbp_loaded',     array ( $this, 'includes'                 ), 6  );
     29                add_action( 'bbp_loaded',     array ( $this, 'setup_globals'            ), 8  );
     30                add_action( 'bbp_loaded',     array ( $this, 'register_theme_directory' ), 10 );
    2531
    26                 // Attach constants to bbp_loaded.
    27                 add_action( 'bbp_loaded',      array ( $this, 'constants' ) );
     32                // Attach to bbp_init.
     33                add_action( 'bbp_init',       array ( $this, 'register_content_types'   ), 6  );
     34                add_action( 'bbp_init',       array ( $this, 'register_taxonomies'      ), 8  );
     35                add_action( 'bbp_init',       array ( $this, 'register_textdomain',     ), 10 );
    2836
    29                 // Attach includes to bbp_loaded.
    30                 add_action( 'bbp_loaded',      array ( $this, 'includes' ) );
    31 
    32                 // Attach theme directory bbp_loaded.
    33                 add_action( 'bbp_loaded',      array ( $this, 'register_theme_directory' ) );
    34 
    35                 // Attach textdomain to bbp_init.
    36                 add_action( 'bbp_init',        array ( $this, 'textdomain' ) );
    37 
    38                 // Attach post type registration to bbp_init.
    39                 add_action( 'bbp_init',        array ( $this, 'register_content_types' ) );
    40 
    41                 // Attach topic tag registration bbp_init.
    42                 add_action( 'bbp_init',        array ( $this, 'register_taxonomies' ) );
    43 
    44                 // Register bbPress activation sequence
    45                 register_activation_hook( __FILE__, array( $this, 'activation' ) );
    46 
    47                 // Register bbPress deactivation sequence
    48                 register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) );
     37                // Register bbPress activation/deactivation sequences
     38                register_activation_hook  ( __FILE__, array ( $this, 'activation'       ), 10 );
     39                register_deactivation_hook( __FILE__, array ( $this, 'deactivation'     ), 10 );
    4940        }
    5041
     
    5243         * constants ()
    5344         *
    54          * Default component constants that can be overridden or filtered
     45         * Setup constants
    5546         */
    5647        function constants () {
     
    5950
    6051        /**
     52         * boot_strap_globals ()
     53         *
     54         * Setup globals BEFORE includes
     55         */
     56        function boot_strap_globals () {
     57                do_action( 'bbp_boot_strap_globals' );
     58        }
     59
     60        /**
    6161         * includes ()
    6262         *
    63          * Include required files
    64          *
    65          * @uses is_admin If in WordPress admin, load additional file
     63         * Include files
    6664         */
    6765        function includes () {
     
    7068
    7169        /**
     70         * setup_globals ()
     71         *
     72         * Setup globals AFTER includes
     73         */
     74        function setup_globals () {
     75                do_action( 'bbp_setup_globals' );
     76        }
     77
     78        /**
    7279         * loaded ()
    7380         *
    74          * A bbPress specific action to say that it has started its
    75          * boot strapping sequence. It's attached to the existing WordPress
    76          * action 'plugins_loaded' because that's when all plugins have loaded. Duh. :P
    77          *
    78          * @uses do_action()
     81         * Main action responsible for constants, globals, and includes
    7982         */
    8083        function loaded () {
     
    8588         * init ()
    8689         *
    87          * Initialize bbPress as part of the WordPress initilization process
    88          *
    89          * @uses do_action Calls custom action to allow external enhancement
     90         * Initialize any code after everything has been loaded
    9091         */
    9192        function init () {
     
    9495
    9596        /**
    96          * textdomain ()
     97         * register_textdomain ()
    9798         *
    98          * Load the translation file for current language
     99         * Load translations for current language
    99100         */
    100         function textdomain () {
     101        function register_textdomain () {
    101102                do_action( 'bbp_load_textdomain' );
    102103        }
     
    105106         * register_theme_directory ()
    106107         *
    107          * Sets up the bbPress theme directory to use in WordPress
     108         * Sets up the theme directory
    108109         *
    109110         * @since bbPress (r2507)
    110          * @uses register_theme_directory
    111111         */
    112112        function register_theme_directory () {
     
    117117         * register_content_types ()
    118118         *
    119          * Setup the post types and taxonomy for forums
     119         * Setup the content types
    120120         *
    121          * @todo Finish up the post type admin area with messages, columns, etc...*
     121         * @since bbPress (r2464)
    122122         */
    123123        function register_content_types () {
     
    131131         *
    132132         * @since bbPress (r2464)
    133          *
    134          * @uses register_taxonomy()
    135          * @uses apply_filters(0
    136133         */
    137134        function register_taxonomies () {
     
    173170}
    174171
     172$bbp->loader = new BBP_Loader();
     173
    175174endif; // class_exists check
    176175
    177 $bbp_loader = new BBP_Loader();
    178 
    179176?>
Note: See TracChangeset for help on using the changeset viewer.