Changeset 2700 for branches/plugin/bbp-includes/bbp-classes.php
- Timestamp:
- 12/06/2010 09:56:22 AM (15 years ago)
- File:
-
- 1 edited
-
branches/plugin/bbp-includes/bbp-classes.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-classes.php
r2680 r2700 1 1 <?php 2 3 if ( !class_exists( 'BBP_Component' ) ) : 4 /** 5 * BBP_Component 6 * 7 * The main bbPress component class is responsible for wrapping up the creation 8 * of the bbPress Forum, Topic, and Reply objects. 9 * 10 * @since (r2688) 11 */ 12 class BBP_Component { 13 14 // Unique name (For internal identification) 15 var $name; 16 17 // Unique ID (Normally for custom post type) 18 var $id; 19 20 // Unique slug (should be filterable) 21 var $slug; 22 23 // The loop for this component 24 var $query; 25 26 // The current ID of the queried object 27 var $current_id; 28 29 function BBP_Component ( $args = '' ) { 30 if ( empty( $args ) ) 31 return; 32 33 $this->_setup_globals( $args ); 34 $this->_includes(); 35 $this->_setup_actions(); 36 } 37 38 /** 39 * _setup_globals () 40 * 41 * Component global variables 42 */ 43 function _setup_globals ( $args = '' ) { 44 $this->name = $args['name']; 45 $this->id = apply_filters( 'bbp_' . $this->name . '_id', $args['id'] ); 46 $this->slug = apply_filters( 'bbp_' . $this->name . '_slug', $args['slug'] ); 47 } 48 49 /** 50 * _includes () 51 * 52 * Include required files 53 * 54 * @since bbPress (r2688) 55 */ 56 function _includes () { 57 do_action( 'bbp_' . $this->name . '_includes' ); 58 } 59 60 /** 61 * _setup_actions () 62 * 63 * Setup the default hooks and actions 64 * 65 * @since bbPress (r2688) 66 */ 67 function _setup_actions () { 68 // Register content types 69 add_action( 'bbp_register_post_types', array ( $this, 'register_post_types' ), 10, 2 ); 70 71 // Register taxonomies 72 add_action( 'bbp_register_taxonomies', array ( $this, 'register_taxonomies' ), 10, 2 ); 73 74 // Add the rewrite tags 75 add_action( 'bbp_add_rewrite_tags', array ( $this, 'add_rewrite_tags' ), 10, 2 ); 76 77 // Generate rewrite rules 78 add_action( 'bbp_generate_rewrite_rules', array ( $this, 'generate_rewrite_rules' ), 10, 2 ); 79 80 do_action( 'bbp_' . $this->name . '_setup_actions' ); 81 } 82 83 /** 84 * register_post_types () 85 * 86 * Setup the content types and taxonomies for forums 87 * 88 * @since bbPress (r2688) 89 */ 90 function register_post_types () { 91 do_action( 'bbp_' . $this->name . '_register_post_types' ); 92 } 93 94 /** 95 * register_taxonomies () 96 * 97 * Register the built in bbPress taxonomies 98 * 99 * @since bbPress (r2688) 100 */ 101 function register_taxonomies () { 102 do_action( 'bbp_' . $this->name . '_register_taxonomies' ); 103 } 104 105 /** 106 * add_rewrite_tags () 107 * 108 * Add the %bbp_user% rewrite tag 109 * 110 * @since bbPress (r2688) 111 */ 112 function add_rewrite_tags () { 113 do_action( 'bbp_' . $this->name . '_add_rewrite_tags' ); 114 } 115 116 /** 117 * generate_rewrite_rules () 118 * 119 * Generate rewrite rules for /user/%bbp_user%/ pages 120 * 121 * @since bbPress (r2688) 122 */ 123 function generate_rewrite_rules ( $wp_rewrite ) { 124 do_action( 'bbp_' . $this->name . '_generate_rewrite_rules' ); 125 } 126 } 127 endif; // BBP_Component 2 128 3 129 if ( class_exists( 'Walker' ) ) :
Note: See TracChangeset
for help on using the changeset viewer.