Skip to:
Content

bbPress.org


Ignore:
Timestamp:
01/05/2011 06:52:36 PM (15 years ago)
Author:
johnjamesjacoby
Message:

Rename bbp-filters.php to bbp-hooks.php, and move a majority of actions/filters into it. Introduce ability to edit topics/posts from front-end of theme, and consequently introduce page-bbp_edit.php. Also includes various phpDoc clean-up. Props GautamGupta via Google Code-in

File:
1 edited

Legend:

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

    r2727 r2753  
    11<?php
     2
    23/**
    3  * bbp-loader.php
    4  *
    5  * The main bbPress loader. Action priorities included for the sake of human
    6  * readability and clarification.
     4 * The main bbPress loader.
    75 *
    86 * @package bbPress
    97 * @subpackage Loader
    10  * @since bbPress (r2464)
    118 */
    12 
    13 // Attach to WordPress actions
    14 add_action( 'plugins_loaded',         'bbp_loaded'                   , 10 );
    15 add_action( 'init',                   'bbp_init'                     , 10 );
    16 add_action( 'generate_rewrite_rules', 'bbp_generate_rewrite_rules'   , 12 );
    17 
    18 // Attach to bbp_loaded.
    19 add_action( 'bbp_loaded',             'bbp_constants'                , 2  );
    20 add_action( 'bbp_loaded',             'bbp_boot_strap_globals'       , 4  );
    21 add_action( 'bbp_loaded',             'bbp_includes'                 , 6  );
    22 add_action( 'bbp_loaded',             'bbp_setup_globals'            , 8  );
    23 add_action( 'bbp_loaded',             'bbp_register_theme_directory' , 10 );
    24 
    25 // Attach to bbp_init.
    26 add_action( 'bbp_init',               'bbp_setup_current_user'       , 2  );
    27 add_action( 'bbp_init',               'bbp_register_post_types'      , 4  );
    28 add_action( 'bbp_init',               'bbp_register_post_statuses'   , 6  );
    29 add_action( 'bbp_init',               'bbp_register_taxonomies'      , 8  );
    30 add_action( 'bbp_init',               'bbp_register_textdomain'      , 10 );
    31 add_action( 'bbp_init',               'bbp_add_user_rewrite_tag'     , 12 );
    32 add_action( 'bbp_init',               'bbp_ready'                    , 999 );
    339
    3410/** Main Actions **************************************************************/
    3511
    3612/**
    37  * bbp_bbp_constants ()
     13 * Setup constants
    3814 *
    39  * Setup constants
     15 * @since bbPress (r2599)
     16 *
     17 * @uses do_action() Calls 'bbp_constants'
    4018 */
    41 function bbp_constants () {
     19function bbp_constants() {
    4220    do_action( 'bbp_constants' );
    4321}
    4422
    4523/**
    46  * boot_strap_globals ()
     24 * Setup globals BEFORE includes
    4725 *
    48  * Setup globals BEFORE includes
     26 * @since bbPress (r2599)
     27 *
     28 * @uses do_action() Calls 'bbp_boot_strap_globals'
    4929 */
    50 function bbp_boot_strap_globals () {
     30function bbp_boot_strap_globals() {
    5131    do_action( 'bbp_boot_strap_globals' );
    5232}
    5333
    5434/**
    55  * bbp_includes ()
     35 * Include files
    5636 *
    57  * Include files
     37 * @since bbPress (r2599)
     38 *
     39 * @uses do_action() Calls 'bbp_includes'
    5840 */
    59 function bbp_includes () {
     41function bbp_includes() {
    6042    do_action( 'bbp_includes' );
    6143}
    6244
    6345/**
    64  * bbp_setup_globals ()
     46 * Setup globals AFTER includes
    6547 *
    66  * Setup globals AFTER includes
     48 * @since bbPress (r2599)
     49 *
     50 * @uses do_action() Calls 'bbp_setup_globals'
    6751 */
    68 function bbp_setup_globals () {
     52function bbp_setup_globals() {
    6953    do_action( 'bbp_setup_globals' );
    7054}
    7155
    7256/**
    73  * bbp_loaded ()
     57 * Main action responsible for constants, globals, and includes
    7458 *
    75  * Main action responsible for constants, globals, and includes
     59 * @since bbPress (r2599)
     60 *
     61 * @uses do_action() Calls 'bbp_loaded'
    7662 */
    77 function bbp_loaded () {
     63function bbp_loaded() {
    7864    do_action( 'bbp_loaded' );
    7965}
    8066
    8167/**
    82  * bbp_init ()
     68 * Initialize any code after everything has been loaded
    8369 *
    84  * Initialize any code after everything has been loaded
     70 * @since bbPress (r2599)
     71 *
     72 * @uses do_action() Calls 'bbp_init'
    8573 */
    86 function bbp_init () {
     74function bbp_init() {
    8775    do_action ( 'bbp_init' );
    8876}
     
    9179
    9280/**
    93  * bbp_setup_current_user ()
    94  *
    9581 * Setup the currently logged-in user
    9682 *
    9783 * @since bbPress (r2695)
     84 *
     85 * @uses do_action() Calls 'bbp_setup_current_user'
    9886 */
    99 function bbp_setup_current_user () {
     87function bbp_setup_current_user() {
    10088    do_action ( 'bbp_setup_current_user' );
    10189}
    10290
    10391/**
    104  * register_textdomain ()
     92 * Load translations for current language
    10593 *
    106  * Load translations for current language
     94 * @since bbPress (r2599)
     95 *
     96 * @uses do_action() Calls 'bbp_load_textdomain'
    10797 */
    108 function bbp_register_textdomain () {
     98function bbp_register_textdomain() {
    10999    do_action( 'bbp_load_textdomain' );
    110100}
    111101
    112102/**
    113  * bbp_register_theme_directory ()
    114  *
    115103 * Sets up the theme directory
    116104 *
    117105 * @since bbPress (r2507)
     106 *
     107 * @uses do_action() Calls 'bbp_register_theme_directory'
    118108 */
    119 function bbp_register_theme_directory () {
     109function bbp_register_theme_directory() {
    120110    do_action( 'bbp_register_theme_directory' );
    121111}
    122112
    123113/**
    124  * bbp_register_post_types ()
    125  *
    126114 * Setup the post types
    127115 *
    128116 * @since bbPress (r2464)
     117 *
     118 * @uses do_action() Calls 'bbp_register_post_type'
    129119 */
    130 function bbp_register_post_types () {
     120function bbp_register_post_types() {
    131121    do_action ( 'bbp_register_post_types' );
    132122}
    133123
    134124/**
    135  * bbp_register_post_statuses ()
    136  *
    137125 * Setup the post statuses
    138126 *
    139127 * @since bbPress (r2727)
     128 *
     129 * @uses do_action() Calls 'bbp_register_post_statuses'
    140130 */
    141 function bbp_register_post_statuses () {
     131function bbp_register_post_statuses() {
    142132    do_action ( 'bbp_register_post_statuses' );
    143133}
    144134
    145135/**
    146  * bbp_register_taxonomies ()
    147  *
    148136 * Register the built in bbPress taxonomies
    149137 *
    150138 * @since bbPress (r2464)
     139 *
     140 * @uses do_action() Calls 'bbp_register_taxonomies'
    151141 */
    152 function bbp_register_taxonomies () {
     142function bbp_register_taxonomies() {
    153143    do_action ( 'bbp_register_taxonomies' );
    154144}
    155145
    156146/**
    157  * bbp_add_user_rewrite_tag ()
     147 * Add the bbPress-specific rewrite tags
    158148 *
    159  * Add the %bbp_user% rewrite tag
     149 * @since bbPress (r2753)
    160150 *
    161  * @since bbPress (r2688)
     151 * @uses do_action() Calls 'bbp_add_rewrite_tags'
    162152 */
    163 function bbp_add_user_rewrite_tag () {
    164     do_action ( 'bbp_add_user_rewrite_tag' );
     153function bbp_add_rewrite_tags() {
     154    do_action ( 'bbp_add_rewrite_tags' );
    165155}
    166156
    167157/**
    168  * bbp_generate_rewrite_rules ()
    169  *
    170  * Generate rewrite rules, particularly for /user/%bbp_user%/ pages
     158 * Generate bbPress-specific rewrite rules
    171159 *
    172160 * @since bbPress (r2688)
    173161 *
    174  * @param object $wp_rewrite
     162 * @param WP_Rewrite $wp_rewrite
     163 *
     164 * @uses do_action() Calls 'bbp_generate_rewrite_rules' with {@link WP_Rewrite}
    175165 */
    176 function bbp_generate_rewrite_rules ( $wp_rewrite ) {
     166function bbp_generate_rewrite_rules( $wp_rewrite ) {
    177167    do_action_ref_array( 'bbp_generate_rewrite_rules', array( &$wp_rewrite ) );
    178168}
     
    181171
    182172/**
    183  * bbp_ready ()
     173 * bbPress has loaded and initialized everything, and is okay to go
    184174 *
    185  * bbPress has loaded and initialized everything, and is okay to go
     175 * @since bbPress (r2618)
     176 *
     177 * @uses do_action() Calls 'bbp_ready'
    186178 */
    187 function bbp_ready () {
     179function bbp_ready() {
    188180    do_action( 'bbp_ready' );
    189181}
Note: See TracChangeset for help on using the changeset viewer.