Changeset 3333
- Timestamp:
- 06/19/2011 09:10:13 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbpress.php
r3329 r3333 343 343 $this->user_id = apply_filters( 'bbp_view_id', 'bbp_user' ); 344 344 $this->view_id = apply_filters( 'bbp_spam_id', 'bbp_view' ); 345 $this->edit_id = apply_filters( 'bbp_ spam_id', 'edit' );345 $this->edit_id = apply_filters( 'bbp_edit_id', 'edit' ); 346 346 347 347 /** Slugs *************************************************************/ … … 454 454 register_deactivation_hook( $this->file, 'bbp_deactivation' ); 455 455 456 // Setup the currently logged in user 457 add_action( 'bbp_setup_current_user', array( $this, 'setup_current_user' ), 10 ); 458 459 // Register content types 460 add_action( 'bbp_register_post_types', array( $this, 'register_post_types' ), 10 ); 461 462 // Register post statuses 463 add_action( 'bbp_register_post_statuses', array( $this, 'register_post_statuses' ), 10 ); 464 465 // Register taxonomies 466 add_action( 'bbp_register_taxonomies', array( $this, 'register_taxonomies' ), 10 ); 467 468 // Register the views 469 add_action( 'bbp_register_views', array( $this, 'register_views' ), 10 ); 470 471 // Register the theme directory 472 add_action( 'bbp_register_theme_directory', array( $this, 'register_theme_directory' ), 10 ); 473 474 // Load textdomain 475 add_action( 'bbp_load_textdomain', array( $this, 'register_textdomain' ), 10 ); 476 477 // Add the %bbp_user% rewrite tag 478 add_action( 'bbp_add_rewrite_tags', array( $this, 'add_rewrite_tags' ), 10 ); 479 480 // Generate rewrite rules 481 add_action( 'bbp_generate_rewrite_rules', array( $this, 'generate_rewrite_rules' ), 10 ); 482 } 483 484 /** 485 * Register Textdomain 486 * 456 // Array of bbPress core actions as keys, and class actions as values 457 $actions = array( 458 459 // Setup the currently logged in user 460 'bbp_setup_current_user' => 'setup_current_user', 461 462 // Register content types 463 'bbp_register_post_types' => 'register_post_types', 464 465 // Register post statuses 466 'bbp_register_post_statuses' => 'register_post_statuses', 467 468 // Register taxonomies 469 'bbp_register_taxonomies' => 'register_taxonomies', 470 471 // Register the views 472 'bbp_register_views' => 'register_views', 473 474 // Register the theme directory 475 'bbp_register_theme_directory' => 'register_theme_directory', 476 477 // Load textdomain 478 'bbp_load_textdomain' => 'load_textdomain', 479 480 // Add the %bbp_user% rewrite tag 481 'bbp_add_rewrite_tags' => 'add_rewrite_tags', 482 483 // Generate rewrite rules 484 'bbp_generate_rewrite_rules' => 'generate_rewrite_rules' 485 ); 486 487 // Add the actions 488 foreach( $actions as $bbp_core_action => $class_action ) 489 add_action( $bbp_core_action, array( $this, $class_action ), 10 ); 490 } 491 492 /** 487 493 * Load the translation file for current language. Checks the languages 488 494 * folder inside the bbPress plugin first, and then the default WordPress … … 500 506 * @return bool True on success, false on failure 501 507 */ 502 function register_textdomain() {508 function load_textdomain() { 503 509 504 510 // Allow locale to be filtered … … 549 555 function register_post_types() { 550 556 551 /** F ORUMS************************************************************/557 /** Forums ************************************************************/ 552 558 553 559 // Forum labels … … 606 612 register_post_type( $this->forum_post_type, $bbp_cpt['forum'] ); 607 613 608 /** T OPICS************************************************************/614 /** Topics ************************************************************/ 609 615 610 616 // Topic labels … … 663 669 register_post_type( $this->topic_post_type, $bbp_cpt['topic'] ); 664 670 665 /** R EPLIES***********************************************************/671 /** Replies ***********************************************************/ 666 672 667 673 // Reply labels … … 893 899 function add_rewrite_tags() { 894 900 901 // Pad attributes 902 $pad = 2; 903 $wrapper = '%'; 904 905 // Setup the tags 906 $bbp_user = str_pad( $this->user_id, strlen( $this->user_id ) + $pad, $wrapper, STR_PAD_BOTH ); 907 $bbp_view = str_pad( $this->view_id, strlen( $this->view_id ) + $pad, $wrapper, STR_PAD_BOTH ); 908 $bbp_edit = str_pad( $this->edit_id, strlen( $this->edit_id ) + $pad, $wrapper, STR_PAD_BOTH ); 909 895 910 // User Profile tag 896 add_rewrite_tag( '%bbp_user%', '([^/]+)' );911 add_rewrite_tag( $bbp_user, '([^/]+)' ); 897 912 898 913 // View Page tag 899 add_rewrite_tag( '%bbp_view%', '([^/]+)' );914 add_rewrite_tag( $bbp_view, '([^/]+)' ); 900 915 901 916 // Edit Page tag 902 add_rewrite_tag( '%edit%','([1]{1,})' );917 add_rewrite_tag( $bbp_edit, '([1]{1,})' ); 903 918 } 904 919 … … 926 941 $this->user_slug . '/([^/]+)/page/?([0-9]{1,})/?$' => 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ), 927 942 $this->user_slug . '/([^/]+)/?$' => 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ), 928 $this->user_slug . '/([^/]+)/edit/?$'=> 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1',943 $this->user_slug . '/([^/]+)/edit/?$' => 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1', 929 944 930 945 // @todo - favorites feeds
Note: See TracChangeset
for help on using the changeset viewer.