Skip to:
Content

bbPress.org

Changeset 5131 for trunk/bbpress.php


Ignore:
Timestamp:
10/17/2013 04:37:14 AM (13 years ago)
Author:
johnjamesjacoby
Message:

Use wrapper functions introduced in r5130 for custom post-types and taxonomy.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/bbpress.php

    r5129 r5131  
    457457        // Look in local /wp-content/plugins/bbpress/bbp-languages/ folder
    458458        load_textdomain( $this->domain, $mofile_local );
     459
     460        // Look in global /wp-content/languages/plugins/
     461        load_plugin_textdomain( $this->domain );
    459462    }
    460463
     
    469472    public static function register_post_types() {
    470473
    471         // Define local variable(s)
    472         $post_type = array();
    473 
    474474        /** Forums ************************************************************/
    475 
    476         // Forum labels
    477         $post_type['labels'] = array(
    478             'name'               => __( 'Forums',                   'bbpress' ),
    479             'menu_name'          => __( 'Forums',                   'bbpress' ),
    480             'singular_name'      => __( 'Forum',                    'bbpress' ),
    481             'all_items'          => __( 'All Forums',               'bbpress' ),
    482             'add_new'            => __( 'New Forum',                'bbpress' ),
    483             'add_new_item'       => __( 'Create New Forum',         'bbpress' ),
    484             'edit'               => __( 'Edit',                     'bbpress' ),
    485             'edit_item'          => __( 'Edit Forum',               'bbpress' ),
    486             'new_item'           => __( 'New Forum',                'bbpress' ),
    487             'view'               => __( 'View Forum',               'bbpress' ),
    488             'view_item'          => __( 'View Forum',               'bbpress' ),
    489             'search_items'       => __( 'Search Forums',            'bbpress' ),
    490             'not_found'          => __( 'No forums found',          'bbpress' ),
    491             'not_found_in_trash' => __( 'No forums found in Trash', 'bbpress' ),
    492             'parent_item_colon'  => __( 'Parent Forum:',            'bbpress' )
    493         );
    494 
    495         // Forum rewrite
    496         $post_type['rewrite'] = array(
    497             'slug'       => bbp_get_forum_slug(),
    498             'with_front' => false
    499         );
    500 
    501         // Forum supports
    502         $post_type['supports'] = array(
    503             'title',
    504             'editor',
    505             'revisions'
    506         );
    507475
    508476        // Register Forum content type
     
    510478            bbp_get_forum_post_type(),
    511479            apply_filters( 'bbp_register_forum_post_type', array(
    512                 'labels'              => $post_type['labels'],
    513                 'rewrite'             => $post_type['rewrite'],
    514                 'supports'            => $post_type['supports'],
     480                'labels'              => bbp_get_forum_post_type_labels(),
     481                'rewrite'             => bbp_get_forum_post_type_rewrite(),
     482                'supports'            => bbp_get_forum_post_type_supports(),
    515483                'description'         => __( 'bbPress Forums', 'bbpress' ),
    516484                'capabilities'        => bbp_get_forum_caps(),
     
    531499        /** Topics ************************************************************/
    532500
    533         // Topic labels
    534         $post_type['labels'] = array(
    535             'name'               => __( 'Topics',                   'bbpress' ),
    536             'menu_name'          => __( 'Topics',                   'bbpress' ),
    537             'singular_name'      => __( 'Topic',                    'bbpress' ),
    538             'all_items'          => __( 'All Topics',               'bbpress' ),
    539             'add_new'            => __( 'New Topic',                'bbpress' ),
    540             'add_new_item'       => __( 'Create New Topic',         'bbpress' ),
    541             'edit'               => __( 'Edit',                     'bbpress' ),
    542             'edit_item'          => __( 'Edit Topic',               'bbpress' ),
    543             'new_item'           => __( 'New Topic',                'bbpress' ),
    544             'view'               => __( 'View Topic',               'bbpress' ),
    545             'view_item'          => __( 'View Topic',               'bbpress' ),
    546             'search_items'       => __( 'Search Topics',            'bbpress' ),
    547             'not_found'          => __( 'No topics found',          'bbpress' ),
    548             'not_found_in_trash' => __( 'No topics found in Trash', 'bbpress' ),
    549             'parent_item_colon'  => __( 'Forum:',                   'bbpress' )
    550         );
    551 
    552         // Topic rewrite
    553         $post_type['rewrite'] = array(
    554             'slug'       => bbp_get_topic_slug(),
    555             'with_front' => false
    556         );
    557 
    558         // Topic supports
    559         $post_type['supports'] = array(
    560             'title',
    561             'editor',
    562             'revisions'
    563         );
    564 
    565501        // Register Topic content type
    566502        register_post_type(
    567503            bbp_get_topic_post_type(),
    568504            apply_filters( 'bbp_register_topic_post_type', array(
    569                 'labels'              => $post_type['labels'],
    570                 'rewrite'             => $post_type['rewrite'],
    571                 'supports'            => $post_type['supports'],
     505                'labels'              => bbp_get_topic_post_type_labels(),
     506                'rewrite'             => bbp_get_topic_post_type_rewrite(),
     507                'supports'            => bbp_get_topic_post_type_supports(),
    572508                'description'         => __( 'bbPress Topics', 'bbpress' ),
    573509                'capabilities'        => bbp_get_topic_caps(),
     
    588524        /** Replies ***********************************************************/
    589525
    590         // Reply labels
    591         $post_type['labels'] = array(
    592             'name'               => __( 'Replies',                   'bbpress' ),
    593             'menu_name'          => __( 'Replies',                   'bbpress' ),
    594             'singular_name'      => __( 'Reply',                     'bbpress' ),
    595             'all_items'          => __( 'All Replies',               'bbpress' ),
    596             'add_new'            => __( 'New Reply',                 'bbpress' ),
    597             'add_new_item'       => __( 'Create New Reply',          'bbpress' ),
    598             'edit'               => __( 'Edit',                      'bbpress' ),
    599             'edit_item'          => __( 'Edit Reply',                'bbpress' ),
    600             'new_item'           => __( 'New Reply',                 'bbpress' ),
    601             'view'               => __( 'View Reply',                'bbpress' ),
    602             'view_item'          => __( 'View Reply',                'bbpress' ),
    603             'search_items'       => __( 'Search Replies',            'bbpress' ),
    604             'not_found'          => __( 'No replies found',          'bbpress' ),
    605             'not_found_in_trash' => __( 'No replies found in Trash', 'bbpress' ),
    606             'parent_item_colon'  => __( 'Topic:',                    'bbpress' )
    607         );
    608 
    609         // Reply rewrite
    610         $post_type['rewrite'] = array(
    611             'slug'       => bbp_get_reply_slug(),
    612             'with_front' => false
    613         );
    614 
    615         // Reply supports
    616         $post_type['supports'] = array(
    617             'title',
    618             'editor',
    619             'revisions'
    620         );
    621 
    622526        // Register reply content type
    623527        register_post_type(
    624528            bbp_get_reply_post_type(),
    625529            apply_filters( 'bbp_register_reply_post_type', array(
    626                 'labels'              => $post_type['labels'],
    627                 'rewrite'             => $post_type['rewrite'],
    628                 'supports'            => $post_type['supports'],
     530                'labels'              => bbp_get_reply_post_type_labels(),
     531                'rewrite'             => bbp_get_reply_post_type_rewrite(),
     532                'supports'            => bbp_get_reply_post_type_supports(),
    629533                'description'         => __( 'bbPress Replies', 'bbpress' ),
    630534                'capabilities'        => bbp_get_reply_caps(),
     
    740644    public static function register_taxonomies() {
    741645
    742         // Define local variable(s)
    743         $topic_tag = array();
    744 
    745         // Topic tag labels
    746         $topic_tag['labels'] = array(
    747             'name'          => __( 'Topic Tags',     'bbpress' ),
    748             'singular_name' => __( 'Topic Tag',      'bbpress' ),
    749             'search_items'  => __( 'Search Tags',    'bbpress' ),
    750             'popular_items' => __( 'Popular Tags',   'bbpress' ),
    751             'all_items'     => __( 'All Tags',       'bbpress' ),
    752             'edit_item'     => __( 'Edit Tag',       'bbpress' ),
    753             'update_item'   => __( 'Update Tag',     'bbpress' ),
    754             'add_new_item'  => __( 'Add New Tag',    'bbpress' ),
    755             'new_item_name' => __( 'New Tag Name',   'bbpress' ),
    756             'view_item'     => __( 'View Topic Tag', 'bbpress' )
    757         );
    758 
    759         // Topic tag rewrite
    760         $topic_tag['rewrite'] = array(
    761             'slug'       => bbp_get_topic_tag_tax_slug(),
    762             'with_front' => false
    763         );
    764 
    765         // Register the topic tag taxonomy
     646        // Register the topic-tag taxonomy
    766647        register_taxonomy(
    767648            bbp_get_topic_tag_tax_id(),
    768649            bbp_get_topic_post_type(),
    769650            apply_filters( 'bbp_register_topic_taxonomy', array(
    770                 'labels'                => $topic_tag['labels'],
    771                 'rewrite'               => $topic_tag['rewrite'],
     651                'labels'                => bbp_get_topic_tag_tax_labels(),
     652                'rewrite'               => bbp_get_topic_tag_tax_rewrite(),
    772653                'capabilities'          => bbp_get_topic_tag_caps(),
    773654                'update_count_callback' => '_update_post_term_count',
Note: See TracChangeset for help on using the changeset viewer.