Skip to:
Content

bbPress.org

Changeset 2596


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.

Location:
branches/plugin
Files:
1 deleted
6 edited

Legend:

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

    r2594 r2596  
    1313class BBP_Admin {
    1414
    15         function bbp_admin () {
     15        function BBP_Admin () {
     16                global $bbp;
     17
    1618                /** General ***********************************************************/
    1719
     
    3537
    3638                // Forum column headers.
    37                 add_filter( 'manage_' . BBP_FORUM_POST_TYPE_ID . '_posts_columns',  array( $this, 'forums_column_headers' ) );
     39                add_filter( 'manage_' . $bbp->forum_id . '_posts_columns',  array( $this, 'forums_column_headers' ) );
    3840
    3941                // Forum columns (in page row)
     
    4446
    4547                // Topic column headers.
    46                 add_filter( 'manage_' . BBP_TOPIC_POST_TYPE_ID . '_posts_columns',  array( $this, 'topics_column_headers' ) );
     48                add_filter( 'manage_' . $bbp->topic_id . '_posts_columns',  array( $this, 'topics_column_headers' ) );
    4749
    4850                // Topic columns (in post row)
     
    5759
    5860                // Reply column headers.
    59                 add_filter( 'manage_' . BBP_REPLY_POST_TYPE_ID . '_posts_columns',  array( $this, 'replies_column_headers' ) );
     61                add_filter( 'manage_' . $bbp->reply_id . '_posts_columns',  array( $this, 'replies_column_headers' ) );
    6062
    6163                // Reply columns (in post row)
     
    9092         */
    9193        function topic_parent_metabox () {
     94                global $bbp;
     95
    9296                add_meta_box (
    9397                        'bbp_topic_parent_id',
    9498                        __( 'Forum', 'bbpress' ),
    9599                        'bbp_topic_metabox',
    96                         BBP_TOPIC_POST_TYPE_ID,
     100                        $bbp->topic_id,
    97101                        'normal'
    98102                );
     
    130134         */
    131135        function reply_parent_metabox () {
     136                global $bbp;
     137
    132138                add_meta_box (
    133139                        'bbp_reply_parent_id',
    134140                        __( 'Topic', 'bbpress' ),
    135141                        'bbp_reply_metabox',
    136                         BBP_REPLY_POST_TYPE_ID,
     142                        $bbp->reply_id,
    137143                        'normal'
    138144                );
     
    170176         */
    171177        function admin_head () {
    172                 global $wp_query;
     178                global $wp_query, $bbp;
    173179
    174180                // Icons for top level admin menus
    175                 $menu_icon_url  = BBP_IMAGES_URL . '/menu.png';
     181                $menu_icon_url  = $bbp->images_url . '/menu.png';
    176182
    177183                // Top level menu classes
    178                 $forum_class = sanitize_html_class( BBP_FORUM_POST_TYPE_ID );
    179                 $topic_class = sanitize_html_class( BBP_TOPIC_POST_TYPE_ID );
    180                 $reply_class = sanitize_html_class( BBP_REPLY_POST_TYPE_ID );
     184                $forum_class = sanitize_html_class( $bbp->forum_id );
     185                $topic_class = sanitize_html_class( $bbp->topic_id );
     186                $reply_class = sanitize_html_class( $bbp->reply_id );
    181187
    182188                // Calculate offset for screen_icon sprite
    183189                if ( bbp_is_forum() || bbp_is_topic() || bbp_is_reply() )
    184                         $icons32_offset = -90 * array_search( $_GET['post_type'], array( BBP_FORUM_POST_TYPE_ID, BBP_TOPIC_POST_TYPE_ID, BBP_REPLY_POST_TYPE_ID ) );
     190                        $icons32_offset = -90 * array_search( $_GET['post_type'], array( $bbp->forum_id, $bbp->topic_id, $bbp->reply_id ) );
    185191
    186192?>
     
    211217                        }
    212218
    213                         <?php if ( in_array ( $_GET['post_type'], array( BBP_FORUM_POST_TYPE_ID, BBP_TOPIC_POST_TYPE_ID, BBP_REPLY_POST_TYPE_ID ) ) ) : ?>
     219                        <?php if ( in_array ( $_GET['post_type'], array( $bbp->forum_id, $bbp->topic_id, $bbp->reply_id ) ) ) : ?>
    214220                        #icon-edit, #icon-post {
    215                                 background: url(<?php echo BBP_IMAGES_URL . '/icons32.png'; ?>) no-repeat -4px <?php echo $icons32_offset; ?>px;
     221                                background: url(<?php echo $bbp->images_url . '/icons32.png'; ?>) no-repeat -4px <?php echo $icons32_offset; ?>px;
    216222                        }
    217223                       
     
    300306         */
    301307        function forums_column_data ( $column, $forum_id ) {
    302                 if ( $_GET['post_type'] !== BBP_FORUM_POST_TYPE_ID )
     308                global $bbp;
     309
     310                if ( $_GET['post_type'] !== $bbp->forum_id )
    303311                        return $column;
    304312
     
    328336         */     
    329337        function forums_row_actions ( $actions, $forum ) {
    330                 if ( BBP_FORUM_POST_TYPE_ID == $forum->post_type ) {
     338                global $bbp;
     339
     340                if ( $bbp->forum_id == $forum->post_type ) {
    331341                        unset( $actions['inline'] );
    332342
     
    370380         */
    371381        function topics_column_data ( $column, $topic_id ) {
    372                 if ( $_GET['post_type'] !== BBP_TOPIC_POST_TYPE_ID )
     382                global $bbp;
     383
     384                if ( $_GET['post_type'] !== $bbp->topic_id )
    373385                        return $column;
    374386
     
    429441         */     
    430442        function topics_row_actions ( $actions, $topic ) {
    431                 if ( in_array( $topic->post_type, array( BBP_TOPIC_POST_TYPE_ID, BBP_REPLY_POST_TYPE_ID ) ) )
     443                global $bbp;
     444
     445                if ( in_array( $topic->post_type, array( $bbp->topic_id, $bbp->reply_id ) ) )
    432446                        unset( $actions['inline hide-if-no-js'] );
    433447
     
    465479         */
    466480        function replies_column_data ( $column, $reply_id ) {
    467                 if ( $_GET['post_type'] !== BBP_REPLY_POST_TYPE_ID )
     481                global $bbp;
     482
     483                if ( $_GET['post_type'] !== $bbp->reply_id )
    468484                        return $column;
    469485
     
    541557         */
    542558        function replies_row_actions ( $actions, $reply ) {
    543                 if ( in_array( $reply->post_type, array( BBP_TOPIC_POST_TYPE_ID, BBP_REPLY_POST_TYPE_ID ) ) ) {
     559                global $bbp;
     560
     561                if ( in_array( $reply->post_type, array( $bbp->topic_id, $bbp->reply_id ) ) ) {
    544562                        unset( $actions['inline hide-if-no-js'] );
    545563
     
    556574         */
    557575        function register_admin_style () {
    558                 wp_admin_css_color( 'bbpress', __( 'Green', 'bbpress' ), BBP_URL . 'bbp-css/admin.css', array( '#222222', '#006600', '#deece1', '#6eb469' ) );
     576                global $bbp;
     577
     578                wp_admin_css_color( 'bbpress', __( 'Green', 'bbpress' ), $bbp->plugin_url . 'bbp-css/admin.css', array( '#222222', '#006600', '#deece1', '#6eb469' ) );
    559579        }
    560580}
     
    594614 */
    595615function bbp_topic_metabox () {
    596         global $post;
     616        global $post, $bbp;
    597617
    598618        $args = array(
    599                 'post_type'         => BBP_FORUM_POST_TYPE_ID,
     619                'post_type'         => $bbp->forum_id,
    600620                'exclude_tree'      => $post->ID,
    601621                'selected'          => $post->post_parent,
     
    635655 */
    636656function bbp_topic_reply_metabox () {
    637         global $post;
     657        global $post, $bbp;
    638658
    639659        $args = array(
    640                 'post_type'         => BBP_TOPIC_POST_TYPE_ID,
     660                'post_type'         => $bbp->topic_id,
    641661                'exclude_tree'      => $post->ID,
    642662                'selected'          => $post->post_parent,
     
    698718}
    699719
    700 // Setup bbPress Admin
    701 $bbp_admin = new BBP_Admin();
     720/**
     721 * bbp_admin ()
     722 *
     723 * Setup bbPress Admin
     724 *
     725 * @global <type> $bbp
     726 */
     727function bbp_admin() {
     728        global $bbp;
     729
     730        $bbp->admin = new BBP_Admin();
     731}
     732add_action( 'bbp_init', 'bbp_admin' );
    702733
    703734?>
  • branches/plugin/bbp-includes/bbp-classes.php

    r2594 r2596  
    1515         * @var string
    1616         */
    17         var $tree_type = BBP_FORUM_POST_TYPE_ID;
     17        var $tree_type;
    1818
    1919        /**
  • branches/plugin/bbp-includes/bbp-functions.php

    r2594 r2596  
    114114 */
    115115function bbp_new_reply_handler () {
     116        global $bbp;
    116117
    117118        // Only proceed if POST is a new reply
     
    143144
    144145                        // Add topic tag ID as main key
    145                         $terms = array( BBP_TOPIC_TAG_ID => $terms );
     146                        $terms = array( $bbp->topic_tag_id => $terms );
    146147
    147148                        // @todo - Handle adding of tags from reply
     
    158159                                'post_parent'   => $topic_id,
    159160                                'post_status'   => 'publish',
    160                                 'post_type'     => BBP_REPLY_POST_TYPE_ID
     161                                'post_type'     => $bbp->reply_id
    161162                        );
    162163
     
    189190 */
    190191function bbp_new_topic_handler () {
     192        global $bbp;
    191193
    192194        // Only proceed if POST is a new topic
     
    218220
    219221                        // Add topic tag ID as main key
    220                         $terms = array( BBP_TOPIC_TAG_ID => $terms );
     222                        $terms = array( $bbp->topic_tag_id => $terms );
    221223
    222224                // No tags
     
    236238                                'tax_input'     => $terms,
    237239                                'post_status'   => 'publish',
    238                                 'post_type'     => BBP_TOPIC_POST_TYPE_ID
     240                                'post_type'     => $bbp->topic_id
    239241                        );
    240242
     
    269271 */
    270272function bbp_get_stickies ( $forum_id = 0 ) {
     273        global $bbp;
     274
    271275        if ( empty( $forum_id ) ) {
    272276                $stickies = get_option( 'bbp_sticky_topics' );
    273277        } else {
    274                 if ( BBP_FORUM_POST_TYPE_ID == get_post_type( $forum_id ) ) {
     278                if ( $bbp->forum_id == get_post_type( $forum_id ) ) {
    275279                        $stickies = get_post_meta( $forum_id );
    276280                } else {
  • 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?>
  • branches/plugin/bbp-includes/bbp-templatetags.php

    r2594 r2596  
    4949 */
    5050function bbp_has_forums ( $args = '' ) {
    51         global $bbp_forums_template, $wp_query;
     51        global $wp_query, $bbp_forums_template, $bbp;
    5252
    5353        if ( bbp_is_forum() )
     
    5757
    5858        $default = array (
    59                 'post_type'     => BBP_FORUM_POST_TYPE_ID,
     59                'post_type'     => $bbp->forum_id,
    6060                'post_parent'   => $post_parent,
    6161                'orderby'       => 'menu_order',
     
    293293         */
    294294        function bbp_get_forum_topic_count ( $forum_id = 0 ) {
     295                global $bbp;
     296
    295297                if ( empty( $forum_id ) )
    296298                        $forum_id = bbp_get_forum_id();
    297299
    298                 $forum_topics = 0; //get_pages( array( 'post_parent' => $forum_id, 'post_type' => BBP_TOPIC_POST_TYPE_ID ) );
     300                $forum_topics = 0; //get_pages( array( 'post_parent' => $forum_id, 'post_type' => $bbp->topic_id ) );
    299301
    300302                return apply_filters( 'bbp_get_forum_topic_count', $forum_topics );
     
    358360         */
    359361        function bbp_get_forum_topic_reply_count ( $forum_id = 0 ) {
     362                global $bbp;
     363
    360364                if ( empty( $forum_id ) )
    361365                        $forum_id = bbp_get_forum_id();
    362366
    363                 $forum_topic_replies = 0; //get_pages( array( 'post_parent' => $forum_id, 'post_type' => BBP_REPLY_POST_TYPE_ID ) );
     367                $forum_topic_replies = 0; //get_pages( array( 'post_parent' => $forum_id, 'post_type' => $bbp->reply_id ) );
    364368
    365369                return apply_filters( 'bbp_get_forum_topic_reply_count', $forum_topic_replies );
     
    412416 */
    413417function bbp_has_topics ( $args = '' ) {
    414         global $bbp_topics_template;
     418        global $bbp_topics_template, $bbp;
    415419
    416420        $default = array (
    417421                // Narrow query down to bbPress topics
    418                 'post_type'        => BBP_TOPIC_POST_TYPE_ID,
     422                'post_type'        => $bbp->topic_id,
    419423
    420424                // Forum ID
     
    985989         */
    986990        function bbp_get_topic_reply_count ( $topic_id = 0 ) {
     991                global $bbp;
     992
    987993                if ( empty( $topic_id ) )
    988994                        $topic_id = bbp_get_topic_id();
    989995
    990                 $topic_replies = 0; //get_pages( array( 'post_parent' => $topic_id, 'post_type' => BBP_REPLY_POST_TYPE_ID ) );
     996                $topic_replies = 0; //get_pages( array( 'post_parent' => $topic_id, 'post_type' => $bbp->reply_id ) );
    991997
    992998                return apply_filters( 'bbp_get_topic_reply_count', $topic_replies );
     
    10851091 */
    10861092function bbp_update_topic_voice_count ( $topic_id = 0 ) {
    1087         global $wpdb;
     1093        global $wpdb, $bbp;
    10881094
    10891095        if ( empty( $topic_id ) )
     
    10911097
    10921098        // If it is not a topic or reply, then we don't need it
    1093         if ( !in_array( get_post_field( 'post_type', $topic_id ), array( BBP_TOPIC_POST_TYPE_ID, BBP_REPLY_POST_TYPE_ID ) ) )
     1099        if ( !in_array( get_post_field( 'post_type', $topic_id ), array( $bbp->topic_id, $bbp->reply_id ) ) )
    10941100                return false;
    10951101
    10961102        // If it's a reply, then get the parent (topic id)
    1097         if ( BBP_REPLY_POST_TYPE_ID == get_post_field( 'post_type', $topic_id ) )
     1103        if ( $bbp->reply_id == get_post_field( 'post_type', $topic_id ) )
    10981104                $topic_id = get_post_field( 'post_parent', $topic_id );
    10991105
    11001106        // There should always be at least 1 voice
    1101         if ( !$voices = count( $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE ( post_parent = %d AND post_status = 'publish' AND post_type = '" . BBP_REPLY_POST_TYPE_ID . "' ) OR ( ID = %d AND post_type = '" . BBP_TOPIC_POST_TYPE_ID . "' );", $topic_id, $topic_id ) ) ) )
     1107        if ( !$voices = count( $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE ( post_parent = %d AND post_status = 'publish' AND post_type = '" . $bbp->reply_id . "' ) OR ( ID = %d AND post_type = '" . $bbp->topic_id . "' );", $topic_id, $topic_id ) ) ) )
    11021108                $voices = 1;
    11031109
     
    11291135         */
    11301136        function bbp_get_topic_tag_list ( $topic_id = 0, $args = '' ) {
     1137                global $bbp;
     1138
    11311139                $defaults = array(
    11321140                        'before' => '<p>' . __( 'Tagged:', 'bbpress' ) . '&nbsp;',
     
    11411149                        $topic_id = bbp_get_topic_id();
    11421150
    1143                 return get_the_term_list( $topic_id, BBP_TOPIC_TAG_ID, $before, $sep, $after );
     1151                return get_the_term_list( $topic_id, $bbp->topic_tag_id, $before, $sep, $after );
    11441152        }
    11451153
     
    12821290 */
    12831291function bbp_has_replies ( $args = '' ) {
    1284         global $bbp_replies_template;
     1292        global $bbp_replies_template, $bbp;
    12851293
    12861294        $default = array(
    12871295                // Narrow query down to bbPress topics
    1288                 'post_type'        => BBP_REPLY_POST_TYPE_ID,
     1296                'post_type'        => $bbp->reply_id,
    12891297
    12901298                // Forum ID
     
    16981706 */
    16991707function bbp_is_forum () {
    1700         global $wp_query;
    1701 
    1702         if ( isset( $wp_query->query_vars['post_type'] ) && BBP_FORUM_POST_TYPE_ID === $wp_query->query_vars['post_type'] )
     1708        global $wp_query, $bbp;
     1709
     1710        if ( isset( $wp_query->query_vars['post_type'] ) && $bbp->forum_id === $wp_query->query_vars['post_type'] )
    17031711                return true;
    17041712
    1705         if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && BBP_FORUM_POST_TYPE_ID === $_GET['post_type'] )
     1713        if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && $bbp->forum_id === $_GET['post_type'] )
    17061714                return true;
    17071715
     
    17201728 */
    17211729function bbp_is_topic () {
    1722         global $wp_query;
    1723 
    1724         if ( isset( $wp_query->query_vars['post_type'] ) && BBP_TOPIC_POST_TYPE_ID === $wp_query->query_vars['post_type'] )
     1730        global $wp_query, $bbp;
     1731
     1732        if ( isset( $wp_query->query_vars['post_type'] ) && $bbp->topic_id === $wp_query->query_vars['post_type'] )
    17251733                return true;
    17261734
    1727         if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && BBP_TOPIC_POST_TYPE_ID === $_GET['post_type'] )
     1735        if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && $bbp->topic_id === $_GET['post_type'] )
    17281736                return true;
    17291737
     
    17421750 */
    17431751function bbp_is_reply () {
    1744         global $wp_query;
    1745 
    1746         if ( isset( $wp_query->query_vars['post_type'] ) && BBP_REPLY_POST_TYPE_ID === $wp_query->query_vars['post_type'] )
     1752        global $wp_query, $bbp;
     1753
     1754        if ( isset( $wp_query->query_vars['post_type'] ) && $bbp->reply_id === $wp_query->query_vars['post_type'] )
    17471755                return true;
    17481756
    1749         if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && BBP_REPLY_POST_TYPE_ID === $_GET['post_type'] )
     1757        if ( isset( $_GET['post_type'] ) && !empty( $_GET['post_type'] ) && $bbp->reply_id === $_GET['post_type'] )
    17501758                return true;
    17511759
     
    19141922         */
    19151923        function bbp_get_breadcrumb( $sep = '&larr;' ) {
    1916                 global $post;
     1924                global $post, $bbp;
    19171925
    19181926                $trail       = '';
     
    19281936                        switch ( $parent->post_type ) {
    19291937                                // Forum
    1930                                 case BBP_FORUM_POST_TYPE_ID :
     1938                                case $bbp->forum_id :
    19311939                                        $breadcrumbs[] = '<a href="' . bbp_get_forum_permalink( $parent->ID ) . '">' . bbp_get_forum_title( $parent->ID ) . '</a>';
    19321940                                        break;
    19331941
    19341942                                // Topic
    1935                                 case BBP_TOPIC_POST_TYPE_ID :
     1943                                case $bbp->topic_id :
    19361944                                        $breadcrumbs[] = '<a href="' . bbp_get_topic_permalink( $parent->ID ) . '">' . bbp_get_topic_title( $parent->ID ) . '</a>';
    19371945                                        break;
    19381946
    19391947                                // Reply (Note: not in most themes)
    1940                                 case BBP_REPLY_POST_TYPE_ID :
     1948                                case $bbp->reply_id :
    19411949                                        $breadcrumbs[] = '<a href="' . bbp_get_reply_permalink( $parent->ID ) . '">' . bbp_get_reply_title( $parent->ID ) . '</a>';
    19421950                                        break;
  • branches/plugin/bbpress.php

    r2595 r2596  
    1515 */
    1616define( 'BBP_VERSION', 'plugin-bleeding' );
     17
     18/**
     19 * Place your custom code (actions/filters) in a file called
     20 * /plugins/bbp-custom.php and it will be loaded before bbPress.
     21 */
     22if ( file_exists( WP_PLUGIN_DIR . '/bbp-custom.php' ) )
     23        require( WP_PLUGIN_DIR . '/bbp-custom.php' );
    1724
    1825if ( !class_exists( 'bbPress' ) ) :
     
    2936class bbPress {
    3037
     38        // Content type and taxonomy identifiers
     39        var $forum_id;
     40        var $topic_id;
     41        var $reply_id;
     42        var $topic_tag_id;
     43
     44        // Slugs
     45        var $forum_slug;
     46        var $topic_slug;
     47        var $reply_slug;
     48        var $topic_tag_slug;
     49
     50        // Absolute Paths
     51        var $plugin_dir;
     52        var $themes_dir;
     53
     54        // URLs
     55        var $plugin_url;
     56        var $images_url;
     57        var $themes_url;
     58
    3159        /**
    3260         * The main bbPress loader
     
    3462        function bbPress () {
    3563                // Load up the bbPress core
    36                 $this->constants();
     64                $this->setup_globals();
    3765                $this->includes();
    3866
    39                 // Attach theme directory bbp_loaded.
     67                // Register content types
     68                add_action( 'bbp_register_content_types',   array ( $this, 'register_content_types'   ), 10, 2 );
     69
     70                // Register taxonomies
     71                add_action( 'bbp_register_taxonomies',      array ( $this, 'register_taxonomies'      ), 10, 2 );
     72
     73                // Register theme directory
    4074                add_action( 'bbp_register_theme_directory', array ( $this, 'register_theme_directory' ), 10, 2 );
    4175
    42                 // Attach textdomain to bbp_init.
    43                 add_action( 'bbp_load_textdomain',          array ( $this, 'textdomain' ), 10, 2 );
    44 
    45                 // Attach post type registration to bbp_init.
    46                 add_action( 'bbp_register_content_types',   array ( $this, 'register_post_types' ), 10, 2 );
    47 
    48                 // Attach topic tag registration bbp_init.
    49                 add_action( 'bbp_register_taxonomies',      array ( $this, 'register_taxonomies' ), 10, 2 );
    50         }
    51 
    52         /**
    53          * constants ()
     76                // Load textdomain
     77                add_action( 'bbp_load_textdomain',          array ( $this, 'register_textdomain'      ), 10, 2 );
     78
     79        }
     80
     81        /**
     82         * setup_globals ()
    5483         *
    5584         * Default component constants that can be overridden or filtered
    5685         */
    57         function constants () {
     86        function setup_globals () {
    5887
    5988                // Let plugins sneak in and predefine constants
    6089                do_action( 'bbp_constants_pre' );
    6190
    62                 // Turn debugging on/off
    63                 if ( !defined( 'BBP_DEBUG' ) )
    64                         define( 'BBP_DEBUG', WP_DEBUG );
    65 
    66                 // The default forum post type ID
    67                 if ( !defined( 'BBP_FORUM_POST_TYPE_ID' ) )
    68                         define( 'BBP_FORUM_POST_TYPE_ID', apply_filters( 'bbp_forum_post_type_id', 'bbp_forum' ) );
    69 
    70                 // The default topic post type ID
    71                 if ( !defined( 'BBP_TOPIC_POST_TYPE_ID' ) )
    72                         define( 'BBP_TOPIC_POST_TYPE_ID', apply_filters( 'bbp_topic_post_type_id', 'bbp_topic' ) );
    73 
    74                 // The default reply post type ID
    75                 if ( !defined( 'BBP_REPLY_POST_TYPE_ID' ) )
    76                         define( 'BBP_REPLY_POST_TYPE_ID', apply_filters( 'bbp_reply_post_type_id', 'bbp_reply' ) );
    77 
    78                 // The default topic taxonomy ID
    79                 if ( !defined( 'BBP_TOPIC_TAG_ID' ) )
    80                         define( 'BBP_TOPIC_TAG_ID', apply_filters( 'bbp_topic_tag_id', 'bbp_topic_tag' ) );
    81 
    82                 // Default slug for root component
    83                 if ( !defined( 'BBP_ROOT_SLUG' ) )
    84                         define( 'BBP_ROOT_SLUG', apply_filters( 'bbp_root_slug', 'forums' ) );
    85 
    86                 // Default slug for topics post type
    87                 if ( !defined( 'BBP_FORUM_SLUG' ) )
    88                         define( 'BBP_FORUM_SLUG', apply_filters( 'bbp_forum_slug', 'forum' ) );
    89 
    90                 // Default slug for topics post type
    91                 if ( !defined( 'BBP_TOPIC_SLUG' ) )
    92                         define( 'BBP_TOPIC_SLUG', apply_filters( 'bbp_topic_slug', 'topic' ) );
    93 
    94                 // Default slug for topic reply post type
    95                 if ( !defined( 'BBP_REPLY_SLUG' ) )
    96                         define( 'BBP_REPLY_SLUG', apply_filters( 'bbp_reply_slug', 'reply' ) );
    97 
    98                 // Default slug for topic tag taxonomy
    99                 if ( !defined( 'BBP_TOPIC_TAG_SLUG' ) )
    100                         define( 'BBP_TOPIC_TAG_SLUG', apply_filters( 'bbp_topic_tag_slug', 'topic-tag' ) );
     91                // Unique identifiers
     92                $this->forum_id       = apply_filters( 'bbp_forum_content_type', 'bbp_forum' );
     93                $this->topic_id       = apply_filters( 'bbp_topic_content_type', 'bbp_topic' );
     94                $this->reply_id       = apply_filters( 'bbp_reply_content_type', 'bbp_reply' );
     95                $this->topic_tag_id   = apply_filters( 'bbp_topic_tag_id',       'bbp_topic_tag' );
     96
     97                // Slugs
     98                $this->root_slug      = apply_filters( 'bbp_root_slug', 'forums' );
     99                $this->forum_slug     = apply_filters( 'bbp_forum_slug', 'forum' );
     100                $this->topic_slug     = apply_filters( 'bbp_topic_slug', 'topic' );
     101                $this->reply_slug     = apply_filters( 'bbp_reply_slug', 'reply' );
     102                $this->topic_tag_slug = apply_filters( 'bbp_topic_tag_slug', 'topic-tag' );
    101103
    102104                // bbPress root directory
    103                 define( 'BBP_DIR', plugin_dir_path( __FILE__ ) );
    104                 define( 'BBP_URL', plugin_dir_url( __FILE__ ) );
    105 
    106                 // Images URL
    107                 define( 'BBP_IMAGES_URL', BBP_URL . 'bbp-images' );
    108 
    109                 // Themes directory and url
    110                 define( 'BBP_THEMES_DIR', BBP_DIR . 'bbp-themes' );
    111                 define( 'BBP_THEMES_URL', BBP_URL . 'bbp-themes' );
     105                $this->plugin_dir     = plugin_dir_path( __FILE__ );
     106                $this->plugin_url     = plugin_dir_url( __FILE__ );
     107
     108                // Images
     109                $this->images_url     = $this->plugin_url . 'bbp-images';
     110
     111                // Themes
     112                $this->themes_dir     = $this->plugin_dir . 'bbp-themes';
     113                $this->themes_url     = $this->plugin_url . 'bbp-images';
    112114        }
    113115
     
    125127
    126128                // Load the files
    127                 require_once ( BBP_DIR . '/bbp-includes/bbp-loader.php' );
    128                 require_once ( BBP_DIR . '/bbp-includes/bbp-caps.php' );
    129                 require_once ( BBP_DIR . '/bbp-includes/bbp-filters.php' );
    130                 require_once ( BBP_DIR . '/bbp-includes/bbp-classes.php' );
    131                 require_once ( BBP_DIR . '/bbp-includes/bbp-functions.php' );
    132                 require_once ( BBP_DIR . '/bbp-includes/bbp-templatetags.php' );
    133 
    134                 // Are we going back to 1985 to fight Biff?
    135                 if ( defined( 'BBP_LOAD_LEGACY' ) )
    136                         require_once ( BBP_DIR . '/bbp-includes/bbp-legacy.php' );
     129                require_once ( $this->plugin_dir . '/bbp-includes/bbp-loader.php' );
     130                require_once ( $this->plugin_dir . '/bbp-includes/bbp-caps.php' );
     131                require_once ( $this->plugin_dir . '/bbp-includes/bbp-filters.php' );
     132                require_once ( $this->plugin_dir . '/bbp-includes/bbp-classes.php' );
     133                require_once ( $this->plugin_dir . '/bbp-includes/bbp-functions.php' );
     134                require_once ( $this->plugin_dir . '/bbp-includes/bbp-templatetags.php' );
    137135
    138136                // Quick admin check and load if needed
    139137                if ( is_admin() )
    140                         require_once ( BBP_DIR . '/bbp-includes/bbp-admin.php' );
    141         }
    142 
    143         /**
    144          * textdomain ()
    145          *
    146          * Load the translation file for current language
    147          */
    148         function textdomain () {
    149                 $locale = apply_filters( 'bbp_textdomain', get_locale() );
    150 
    151                 $mofile = BBP_DIR . "/bbp-languages/bbpress-{$locale}.mo";
     138                        require_once ( $this->plugin_dir . '/bbp-includes/bbp-admin.php' );
     139        }
     140
     141        /**
     142         * register_textdomain ()
     143         *
     144         * Load the translation file for current language. Checks both the languages
     145         * folder inside the bbPress plugin and the default WordPress languages
     146         * folder. Note that languages inside the bbPress plugin folder will be
     147         * removed on bbPress updates, and using the WordPress default folder is safer.
     148         */
     149        function register_textdomain () {
     150                $locale        = apply_filters( 'bbpress_locale', get_locale() );
     151                $mofile        = sprintf( 'bbpress-%s.mo', $locale );
     152                $mofile_global = WP_LANG_DIR . '/' . $mofile;
     153                $mofile_local  = $this->plugin_dir . '/bbp-languages/' . $mofile;
     154
     155                if ( file_exists( $mofile_global ) )
     156                        return load_textdomain( 'bbpress', $mofile_global );
     157                elseif ( file_exists( $mofile_local ) )
     158                        return load_textdomain( 'bbpress', $mofile_local );
     159                else
     160                        return false;
    152161
    153162                load_textdomain( 'bbpress', $mofile );
     
    155164
    156165        /**
    157          * register_theme_directory ()
     166         * theme_directory ()
    158167         *
    159168         * Sets up the bbPress theme directory to use in WordPress
     
    163172         */
    164173        function register_theme_directory () {
    165                 register_theme_directory( BBP_THEMES_DIR );
    166         }
    167 
    168         /**
    169          * register_post_types ()
     174                register_theme_directory( $this->themes_dir );
     175        }
     176
     177        /**
     178         * register_content_types ()
    170179         *
    171180         * Setup the post types and taxonomy for forums
     
    173182         * @todo Finish up the post type admin area with messages, columns, etc...*
    174183         */
    175         function register_post_types () {
     184        function register_content_types () {
    176185
    177186                // Forum labels
    178187                $forum_labels = array (
    179                         'name'                  => __( 'Forums', 'bbpress' ),
    180                         'singular_name'         => __( 'Forum', 'bbpress' ),
    181                         'add_new'               => __( 'New Forum', 'bbpress' ),
    182                         'add_new_item'          => __( 'Create New Forum', 'bbpress' ),
    183                         'edit'                  => __( 'Edit', 'bbpress' ),
    184                         'edit_item'             => __( 'Edit Forum', 'bbpress' ),
    185                         'new_item'              => __( 'New Forum', 'bbpress' ),
    186                         'view'                  => __( 'View Forum', 'bbpress' ),
    187                         'view_item'             => __( 'View Forum', 'bbpress' ),
    188                         'search_items'          => __( 'Search Forums', 'bbpress' ),
    189                         'not_found'             => __( 'No forums found', 'bbpress' ),
    190                         'not_found_in_trash'    => __( 'No forums found in Trash', 'bbpress' ),
    191                         'parent_item_colon'     => __( 'Parent Forum:', 'bbpress' )
     188                        'name'               => __( 'Forums', 'bbpress' ),
     189                        'singular_name'      => __( 'Forum', 'bbpress' ),
     190                        'add_new'            => __( 'New Forum', 'bbpress' ),
     191                        'add_new_item'       => __( 'Create New Forum', 'bbpress' ),
     192                        'edit'               => __( 'Edit', 'bbpress' ),
     193                        'edit_item'          => __( 'Edit Forum', 'bbpress' ),
     194                        'new_item'           => __( 'New Forum', 'bbpress' ),
     195                        'view'               => __( 'View Forum', 'bbpress' ),
     196                        'view_item'          => __( 'View Forum', 'bbpress' ),
     197                        'search_items'       => __( 'Search Forums', 'bbpress' ),
     198                        'not_found'          => __( 'No forums found', 'bbpress' ),
     199                        'not_found_in_trash' => __( 'No forums found in Trash', 'bbpress' ),
     200                        'parent_item_colon'  => __( 'Parent Forum:', 'bbpress' )
    192201                );
    193202
    194203                // Forum rewrite
    195204                $forum_rewrite = array (
    196                         'slug'              => BBP_FORUM_SLUG,
    197                         'with_front'        => false
     205                        'slug'       => $this->forum_slug,
     206                        'with_front' => false
    198207                );
    199208
     
    207216                );
    208217
    209                 // Register Forum post type
     218                // Register Forum content type
    210219                register_post_type (
    211                         BBP_FORUM_POST_TYPE_ID,
    212                         apply_filters( 'bbp_register_forum_post_type',
     220                        $this->forum_id,
     221                        apply_filters( 'bbp_register_forum_content_type',
    213222                                array (
    214                                         'labels'            => $forum_labels,
    215                                         'rewrite'           => $forum_rewrite,
    216                                         'supports'          => $forum_supports,
    217                                         'capabilities'      => bbp_get_forum_caps(),
    218                                         'capability_type'   => 'forum',
    219                                         'menu_position'     => '100',
    220                                         'public'            => true,
    221                                         'show_ui'           => true,
    222                                         'can_export'        => true,
    223                                         'hierarchical'      => true,
    224                                         'query_var'         => true,
    225                                         'menu_icon'         => ''
     223                                        'labels'          => $forum_labels,
     224                                        'rewrite'         => $forum_rewrite,
     225                                        'supports'        => $forum_supports,
     226                                        'capabilities'    => bbp_get_forum_caps(),
     227                                        'capability_type' => 'forum',
     228                                        'menu_position'   => '100',
     229                                        'public'          => true,
     230                                        'show_ui'         => true,
     231                                        'can_export'      => true,
     232                                        'hierarchical'    => true,
     233                                        'query_var'       => true,
     234                                        'menu_icon'       => ''
    226235                                )
    227236                        )
     
    230239                // Topic labels
    231240                $topic_labels = array (
    232                         'name'                  => __( 'Topics', 'bbpress' ),
    233                         'singular_name'         => __( 'Topic', 'bbpress' ),
    234                         'add_new'               => __( 'New Topic', 'bbpress' ),
    235                         'add_new_item'          => __( 'Create New Topic', 'bbpress' ),
    236                         'edit'                  => __( 'Edit', 'bbpress' ),
    237                         'edit_item'             => __( 'Edit Topic', 'bbpress' ),
    238                         'new_item'              => __( 'New Topic', 'bbpress' ),
    239                         'view'                  => __( 'View Topic', 'bbpress' ),
    240                         'view_item'             => __( 'View Topic', 'bbpress' ),
    241                         'search_items'          => __( 'Search Topics', 'bbpress' ),
    242                         'not_found'             => __( 'No topics found', 'bbpress' ),
    243                         'not_found_in_trash'    => __( 'No topics found in Trash', 'bbpress' ),
    244                         'parent_item_colon'     => __( 'Forum:', 'bbpress' )
     241                        'name'               => __( 'Topics', 'bbpress' ),
     242                        'singular_name'      => __( 'Topic', 'bbpress' ),
     243                        'add_new'            => __( 'New Topic', 'bbpress' ),
     244                        'add_new_item'       => __( 'Create New Topic', 'bbpress' ),
     245                        'edit'               => __( 'Edit', 'bbpress' ),
     246                        'edit_item'          => __( 'Edit Topic', 'bbpress' ),
     247                        'new_item'           => __( 'New Topic', 'bbpress' ),
     248                        'view'               => __( 'View Topic', 'bbpress' ),
     249                        'view_item'          => __( 'View Topic', 'bbpress' ),
     250                        'search_items'       => __( 'Search Topics', 'bbpress' ),
     251                        'not_found'          => __( 'No topics found', 'bbpress' ),
     252                        'not_found_in_trash' => __( 'No topics found in Trash', 'bbpress' ),
     253                        'parent_item_colon'  => __( 'Forum:', 'bbpress' )
    245254                );
    246255
    247256                // Topic rewrite
    248257                $topic_rewrite = array (
    249                         'slug'          => BBP_TOPIC_SLUG,
    250                         'with_front'    => false
     258                        'slug'       => $this->topic_slug,
     259                        'with_front' => false
    251260                );
    252261
     
    259268                );
    260269
    261                 // Register topic post type
     270                // Register Topic content type
    262271                register_post_type (
    263                         BBP_TOPIC_POST_TYPE_ID,
    264                         apply_filters( 'bbp_register_topic_post_type',
     272                        $this->topic_id,
     273                        apply_filters( 'bbp_register_topic_content_type',
    265274                                array (
    266                                         'labels'            => $topic_labels,
    267                                         'rewrite'           => $topic_rewrite,
    268                                         'supports'          => $topic_supports,
    269                                         'capabilities'      => bbp_get_topic_caps(),
    270                                         'capability_type'   => 'topic',
    271                                         'menu_position'     => '100',
    272                                         'public'            => true,
    273                                         'show_ui'           => true,
    274                                         'can_export'        => true,
    275                                         'hierarchical'      => false,
    276                                         'query_var'         => true,
    277                                         'menu_icon'         => ''
     275                                        'labels'          => $topic_labels,
     276                                        'rewrite'         => $topic_rewrite,
     277                                        'supports'        => $topic_supports,
     278                                        'capabilities'    => bbp_get_topic_caps(),
     279                                        'capability_type' => 'topic',
     280                                        'menu_position'   => '100',
     281                                        'public'          => true,
     282                                        'show_ui'         => true,
     283                                        'can_export'      => true,
     284                                        'hierarchical'    => false,
     285                                        'query_var'       => true,
     286                                        'menu_icon'       => ''
    278287                                )
    279288                        )
     
    282291                // Reply labels
    283292                $reply_labels = array (
    284                         'name'                  => __( 'Replies', 'bbpress' ),
    285                         'singular_name'         => __( 'Reply', 'bbpress' ),
    286                         'add_new'               => __( 'New Reply', 'bbpress' ),
    287                         'add_new_item'          => __( 'Create New Reply', 'bbpress' ),
    288                         'edit'                  => __( 'Edit', 'bbpress' ),
    289                         'edit_item'             => __( 'Edit Reply', 'bbpress' ),
    290                         'new_item'              => __( 'New Reply', 'bbpress' ),
    291                         'view'                  => __( 'View Reply', 'bbpress' ),
    292                         'view_item'             => __( 'View Reply', 'bbpress' ),
    293                         'search_items'          => __( 'Search Replies', 'bbpress' ),
    294                         'not_found'             => __( 'No replies found', 'bbpress' ),
    295                         'not_found_in_trash'    => __( 'No replies found in Trash', 'bbpress' ),
    296                         'parent_item_colon'     => __( 'Topic:', 'bbpress' )
     293                        'name'               => __( 'Replies', 'bbpress' ),
     294                        'singular_name'      => __( 'Reply', 'bbpress' ),
     295                        'add_new'            => __( 'New Reply', 'bbpress' ),
     296                        'add_new_item'       => __( 'Create New Reply', 'bbpress' ),
     297                        'edit'               => __( 'Edit', 'bbpress' ),
     298                        'edit_item'          => __( 'Edit Reply', 'bbpress' ),
     299                        'new_item'           => __( 'New Reply', 'bbpress' ),
     300                        'view'               => __( 'View Reply', 'bbpress' ),
     301                        'view_item'          => __( 'View Reply', 'bbpress' ),
     302                        'search_items'       => __( 'Search Replies', 'bbpress' ),
     303                        'not_found'          => __( 'No replies found', 'bbpress' ),
     304                        'not_found_in_trash' => __( 'No replies found in Trash', 'bbpress' ),
     305                        'parent_item_colon'  => __( 'Topic:', 'bbpress' )
    297306                );
    298307
    299308                // Reply rewrite
    300309                $reply_rewrite = array (
    301                         'slug'        => BBP_REPLY_SLUG,
    302                         'with_front'  => false
     310                        'slug'       => $this->reply_slug,
     311                        'with_front' => false
    303312                );
    304313
     
    311320                );
    312321
    313                 // Register topic reply post type
     322                // Register reply content type
    314323                register_post_type (
    315                         BBP_REPLY_POST_TYPE_ID,
    316                         apply_filters( 'bbp_register_topic_reply_post_type',
     324                        $this->reply_id,
     325                        apply_filters( 'bbp_register_reply_content_type',
    317326                                array (
    318                                         'labels'            => $reply_labels,
    319                                         'rewrite'           => $reply_rewrite,
    320                                         'supports'          => $reply_supports,
    321                                         'capabilities'      => bbp_get_reply_caps(),
    322                                         'capability_type'   => 'reply',
    323                                         'menu_position'     => '100',
    324                                         'public'            => true,
    325                                         'show_ui'           => true,
    326                                         'can_export'        => true,
    327                                         'hierarchical'      => false,
    328                                         'query_var'         => true,
    329                                         'menu_icon'         => ''
     327                                        'labels'          => $reply_labels,
     328                                        'rewrite'         => $reply_rewrite,
     329                                        'supports'        => $reply_supports,
     330                                        'capabilities'    => bbp_get_reply_caps(),
     331                                        'capability_type' => 'reply',
     332                                        'menu_position'   => '100',
     333                                        'public'          => true,
     334                                        'show_ui'         => true,
     335                                        'can_export'      => true,
     336                                        'hierarchical'    => false,
     337                                        'query_var'       => true,
     338                                        'menu_icon'       => ''
    330339                                )
    331340                        )
     
    347356                // Topic tag labels
    348357                $topic_tag_labels = array (
    349                         'name'              => __( 'Topic Tags', 'bbpress' ),
    350                         'singular_name'     => __( 'Topic Tag', 'bbpress' ),
    351                         'search_items'      => __( 'Search Tags', 'bbpress' ),
    352                         'popular_items'     => __( 'Popular Tags', 'bbpress' ),
    353                         'all_items'         => __( 'All Tags', 'bbpress' ),
    354                         'edit_item'         => __( 'Edit Tag', 'bbpress' ),
    355                         'update_item'       => __( 'Update Tag', 'bbpress' ),
    356                         'add_new_item'      => __( 'Add New Tag', 'bbpress' ),
    357                         'new_item_name'     => __( 'New Tag Name', 'bbpress' )
     358                        'name'          => __( 'Topic Tags', 'bbpress' ),
     359                        'singular_name' => __( 'Topic Tag', 'bbpress' ),
     360                        'search_items'  => __( 'Search Tags', 'bbpress' ),
     361                        'popular_items' => __( 'Popular Tags', 'bbpress' ),
     362                        'all_items'     => __( 'All Tags', 'bbpress' ),
     363                        'edit_item'     => __( 'Edit Tag', 'bbpress' ),
     364                        'update_item'   => __( 'Update Tag', 'bbpress' ),
     365                        'add_new_item'  => __( 'Add New Tag', 'bbpress' ),
     366                        'new_item_name' => __( 'New Tag Name', 'bbpress' )
    358367                );
    359368
    360369                // Topic tag rewrite
    361370                $topic_tag_rewrite = array (
    362                         'slug'       => BBP_TOPIC_TAG_SLUG,
     371                        'slug'       => $this->topic_tag_slug,
    363372                        'with_front' => false
    364373                );
     
    366375                // Register the topic tag taxonomy
    367376                register_taxonomy (
    368                         BBP_TOPIC_TAG_ID,              // The topic tag ID
    369                         BBP_TOPIC_POST_TYPE_ID,         // The topic post type ID
     377                        $this->topic_tag_id, // The topic tag ID
     378                        $this->topic_id,     // The topic content type
    370379                        apply_filters( 'bbp_register_topic_tag',
    371380                                array (
     
    428437                }
    429438
    430                 // And caps to default role
     439                // Add caps to default role
    431440                if ( $default =& get_role( get_option( 'default_role' ) ) ) {
    432441
     
    452461         */
    453462        function deactivation () {
    454                 // Add caps to admin role
     463                // Remove caps from admin role
    455464                if ( $admin =& get_role( 'administrator' ) ) {
    456465
     
    486495                }
    487496
    488                 // And caps to default role
     497                // Remove caps from default role
    489498                if ( $default =& get_role( get_option( 'default_role' ) ) ) {
    490499
     
    502511        }
    503512}
    504 endif; // class_exists check
    505513
    506514// "And now here's something we hope you'll really like!"
    507515$bbp = new bbPress();
    508516
     517endif; // class_exists check
     518
    509519?>
Note: See TracChangeset for help on using the changeset viewer.