Changeset 3760
- Timestamp:
- 02/26/2012 07:51:14 PM (13 years ago)
- Location:
- branches/plugin
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/plugin/bbp-includes/bbp-common-template.php
r3758 r3760 1667 1667 $pre_include_root = $pre_include_home = $pre_include_current = true; 1668 1668 1669 // Get bbPress1670 $bbp = bbpress();1671 1672 1669 /** Home Text *********************************************************/ 1673 1670 … … 1690 1687 // No custom root text 1691 1688 if ( empty( $args['root_text'] ) ) { 1692 $page = bbp_get_page_by_path( $bbp->root_slug);1689 $page = bbp_get_page_by_path( bbp_get_root_slug() ); 1693 1690 if ( !empty( $page ) ) { 1694 1691 $root_id = $page->ID; … … 1800 1797 1801 1798 // Page exists at root slug path, so use its permalink 1802 $page = bbp_get_page_by_path( $bbp->root_slug);1799 $page = bbp_get_page_by_path( bbp_get_root_slug() ); 1803 1800 if ( !empty( $page ) ) { 1804 1801 $root_url = get_permalink( $page->ID ); -
branches/plugin/bbp-includes/bbp-core-options.php
r3758 r3760 426 426 } 427 427 428 /** Slugs *********************************************************************/ 429 430 /** 431 * Return the root slug 432 * 433 * @since bbPress (r3759) 434 * @return string 435 */ 436 function bbp_get_root_slug( $default = 'forums' ) { 437 return apply_filters( 'bbp_get_root_slug', get_option( '_bbp_root_slug', $default ) ); 438 } 439 440 /** 441 * Are we including the root slug in front of forum pages? 442 * 443 * @since bbPress (r3759) 444 * @return string 445 */ 446 function bbp_include_root_slug( $default = true ) { 447 return (bool) apply_filters( 'bbp_include_root_slug', (bool) get_option( '_bbp_include_root', $default ) ); 448 } 449 450 /** 451 * Maybe return the root slug, based on whether or not it's included in the url 452 * 453 * @since bbPress (r3759) 454 * @return string 455 */ 456 function bbp_maybe_get_root_slug() { 457 $retval = ''; 458 459 if ( bbp_get_root_slug() && bbp_include_root_slug() ) 460 $retval = trailingslashit( bbp_get_root_slug() ); 461 462 return apply_filters( 'bbp_maybe_get_root_slug', $retval ); 463 } 464 465 /** 466 * Return the single forum slug 467 * 468 * @since bbPress (r3759) 469 * @return string 470 */ 471 function bbp_get_forum_slug( $default = 'forum' ) {; 472 return apply_filters( 'bbp_get_root_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_forum_slug', $default ) ); 473 } 474 475 /** 476 * Return the topic archive slug 477 * 478 * @since bbPress (r3759) 479 * @return string 480 */ 481 function bbp_get_topic_archive_slug( $default = 'topics' ) { 482 return apply_filters( 'bbp_get_topic_archive_slug', get_option( '_bbp_topic_archive_slug', $default ) ); 483 } 484 485 /** 486 * Return the single topic slug 487 * 488 * @since bbPress (r3759) 489 * @return string 490 */ 491 function bbp_get_topic_slug( $default = 'topic' ) { 492 return apply_filters( 'bbp_get_topic_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_topic_slug', $default ) ); 493 } 494 495 /** 496 * Return the topic-tag taxonomy slug 497 * 498 * @since bbPress (r3759) 499 * @return string 500 */ 501 function bbp_get_topic_tag_taxonomy_slug( $default = 'topic-tag' ) { 502 return apply_filters( 'bbp_get_topic_tag_taxonomy_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_topic_tag_slug', $default ) ); 503 } 504 505 /** 506 * Return the single reply slug (used mostly for editing) 507 * 508 * @since bbPress (r3759) 509 * @return string 510 */ 511 function bbp_get_reply_slug( $default = 'reply' ) { 512 return apply_filters( 'bbp_get_reply_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_reply_slug', $default ) ); 513 } 514 515 /** 516 * Return the single user slug 517 * 518 * @since bbPress (r3759) 519 * @return string 520 */ 521 function bbp_get_user_slug( $default = 'user' ) { 522 return apply_filters( 'bbp_get_user_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_user_slug', $default ) ); 523 } 524 525 /** 526 * Return the topic view slug 527 * 528 * @since bbPress (r3759) 529 * @return string 530 */ 531 function bbp_get_view_slug( $default = 'view' ) { 532 return apply_filters( 'bbp_get_view_slug', bbp_maybe_get_root_slug() . get_option( '_bbp_view_slug', $default ) ); 533 } 534 428 535 ?> -
branches/plugin/bbp-includes/bbp-extend-buddypress.php
r3758 r3760 937 937 938 938 // Name and slug 939 $this->name = __( 'Forums', 'bbpress');940 $this->nav_item_name = __( 'Forums', 'bbpress');941 $this->slug = b p_get_option( '_bbp_forum_slug', 'forum');942 $this->topic_slug = b p_get_option( '_bbp_topic_slug', 'topic');943 $this->reply_slug = b p_get_option( '_bbp_reply_slug', 'reply');939 $this->name = bbp_get_forum_archive_title(); 940 $this->nav_item_name = bbp_get_forum_archive_title(); 941 $this->slug = bbp_get_forum_slug(); 942 $this->topic_slug = bbp_get_topic_slug(); 943 $this->reply_slug = bbp_get_reply_slug(); 944 944 945 945 // Forum component is visible @todo configure? -
branches/plugin/bbp-includes/bbp-forum-template.php
r3758 r3760 344 344 345 345 // Set root text to page title 346 $page = bbp_get_page_by_path( bbp ress()->root_slug);346 $page = bbp_get_page_by_path( bbp_get_root_slug() ); 347 347 if ( !empty( $page ) ) { 348 348 $title = get_the_title( $page->ID ); -
branches/plugin/bbp-includes/bbp-theme-compatibility.php
r3758 r3760 563 563 564 564 // Page exists where this archive should be 565 $page = bbp_get_page_by_path( $bbp->root_slug);565 $page = bbp_get_page_by_path( bbp_get_root_slug() ); 566 566 if ( !empty( $page ) ) { 567 567 … … 589 589 590 590 // Page exists where this archive should be 591 $page = bbp_get_page_by_path( $bbp->topic_archive_slug);591 $page = bbp_get_page_by_path( bbp_get_topic_archive_slug() ); 592 592 if ( !empty( $page ) ) { 593 593 -
branches/plugin/bbp-includes/bbp-topic-template.php
r3758 r3760 259 259 // Topic archive 260 260 elseif ( bbp_is_topic_archive() ) 261 $base = home_url( $bbp->topic_archive_slug);261 $base = home_url( bbp_get_topic_archive_slug() ); 262 262 263 263 // Default … … 538 538 539 539 // Set root text to page title 540 $page = bbp_get_page_by_path( bbp ress()->topic_archive_slug);540 $page = bbp_get_page_by_path( bbp_get_topic_archive_slug() ); 541 541 if ( !empty( $page ) ) { 542 542 $title = get_the_title( $page->ID ); -
branches/plugin/bbp-includes/bbp-user-template.php
r3758 r3760 285 285 // Pretty permalinks 286 286 if ( $wp_rewrite->using_permalinks() ) { 287 $url = $wp_rewrite->root . $bbp->user_slug. '/%' . $bbp->user_id . '%';287 $url = $wp_rewrite->root . bbp_get_user_slug() . '/%' . $bbp->user_id . '%'; 288 288 289 289 // Get username if not passed … … 382 382 // Pretty permalinks 383 383 if ( $wp_rewrite->using_permalinks() ) { 384 $url = $wp_rewrite->root . $bbp->user_slug. '/%' . $bbp->user_id . '%/' . $bbp->edit_id;384 $url = $wp_rewrite->root . bbp_get_user_slug() . '/%' . $bbp->user_id . '%/' . $bbp->edit_id; 385 385 386 386 // Get username if not passed -
branches/plugin/bbpress.php
r3758 r3760 139 139 public $hidden_status_id = ''; 140 140 141 /** Slugs *****************************************************************/142 143 /**144 * @var string Root slug145 */146 public $root_slug = '';147 148 /**149 * @var string Forum slug150 */151 public $forum_slug = '';152 153 /**154 * @var string Topic slug155 */156 public $topic_slug = '';157 158 /**159 * @var string Topic archive slug160 */161 public $topic_archive_slug = '';162 163 /**164 * @var string Reply slug165 */166 public $reply_slug = '';167 168 /**169 * @var string Topic tag slug170 */171 public $topic_tag_slug = '';172 173 /**174 * @var string User slug175 */176 public $user_slug = '';177 178 /**179 * @var string View slug180 */181 public $view_slug = '';182 183 141 /** Paths *****************************************************************/ 184 142 … … 399 357 /** Paths *************************************************************/ 400 358 401 // bbPress root directory359 // Setup some base path and URL information 402 360 $this->file = __FILE__; 403 361 $this->basename = plugin_basename( $this->file ); … … 415 373 416 374 // Post type identifiers 417 $this->forum_post_type 418 $this->topic_post_type 419 $this->reply_post_type 420 $this->topic_tag_tax_id 375 $this->forum_post_type = apply_filters( 'bbp_forum_post_type', 'forum' ); 376 $this->topic_post_type = apply_filters( 'bbp_topic_post_type', 'topic' ); 377 $this->reply_post_type = apply_filters( 'bbp_reply_post_type', 'reply' ); 378 $this->topic_tag_tax_id = apply_filters( 'bbp_topic_tag_tax_id', 'topic-tag' ); 421 379 422 380 // Status identifiers 423 $this->spam_status_id 424 $this->closed_status_id 425 $this->orphan_status_id 426 $this->public_status_id 427 $this->pending_status_id 428 $this->private_status_id 429 $this->hidden_status_id 430 $this->trash_status_id 381 $this->spam_status_id = apply_filters( 'bbp_spam_post_status', 'spam' ); 382 $this->closed_status_id = apply_filters( 'bbp_closed_post_status', 'closed' ); 383 $this->orphan_status_id = apply_filters( 'bbp_orphan_post_status', 'orphan' ); 384 $this->public_status_id = apply_filters( 'bbp_public_post_status', 'publish' ); 385 $this->pending_status_id = apply_filters( 'bbp_pending_post_status', 'pending' ); 386 $this->private_status_id = apply_filters( 'bbp_private_post_status', 'private' ); 387 $this->hidden_status_id = apply_filters( 'bbp_hidden_post_status', 'hidden' ); 388 $this->trash_status_id = apply_filters( 'bbp_trash_post_status', 'trash' ); 431 389 432 390 // Other identifiers 433 $this->user_id = apply_filters( 'bbp_user_id', 'bbp_user' ); 434 $this->view_id = apply_filters( 'bbp_view_id', 'bbp_view' ); 435 $this->edit_id = apply_filters( 'bbp_edit_id', 'edit' ); 436 437 /** Slugs *************************************************************/ 438 439 // Root forum slug 440 $this->root_slug = apply_filters( 'bbp_root_slug', get_option( '_bbp_root_slug', 'forums' ) ); 441 $this->topic_archive_slug = apply_filters( 'bbp_topic_archive_slug', get_option( '_bbp_topic_archive_slug', 'topics' ) ); 442 443 // Should we include the root slug in front of component slugs 444 $prefix = !empty( $this->root_slug ) && get_option( '_bbp_include_root', true ) ? trailingslashit( $this->root_slug ) : ''; 445 446 // Component slugs 447 $this->forum_slug = apply_filters( 'bbp_forum_slug', $prefix . get_option( '_bbp_forum_slug', 'forum' ) ); 448 $this->topic_slug = apply_filters( 'bbp_topic_slug', $prefix . get_option( '_bbp_topic_slug', 'topic' ) ); 449 $this->reply_slug = apply_filters( 'bbp_reply_slug', $prefix . get_option( '_bbp_reply_slug', 'reply' ) ); 450 451 // Taxonomy slugs 452 $this->topic_tag_slug = apply_filters( 'bbp_topic_tag_slug', $prefix . get_option( '_bbp_topic_tag_slug', 'topic-tag' ) ); 453 454 /** Other Slugs *******************************************************/ 455 456 $this->user_slug = apply_filters( 'bbp_user_slug', $prefix . get_option( '_bbp_user_slug', 'user' ) ); 457 $this->view_slug = apply_filters( 'bbp_view_slug', $prefix . get_option( '_bbp_view_slug', 'view' ) ); 391 $this->user_id = apply_filters( 'bbp_user_id', 'bbp_user' ); 392 $this->view_id = apply_filters( 'bbp_view_id', 'bbp_view' ); 393 $this->edit_id = apply_filters( 'bbp_edit_id', 'edit' ); 458 394 459 395 /** Queries ***********************************************************/ 460 461 $this->forum_query 462 $this->topic_query 463 $this->reply_query 396 397 $this->forum_query = new stdClass; 398 $this->topic_query = new stdClass; 399 $this->reply_query = new stdClass; 464 400 465 401 /** Misc **************************************************************/ 466 402 467 403 // Errors 468 $this->errors 404 $this->errors = new WP_Error(); 469 405 470 406 // Views 471 $this->views 407 $this->views = array(); 472 408 473 409 // Tab Index 474 $this->tab_index 410 $this->tab_index = apply_filters( 'bbp_default_tab_index', 100 ); 475 411 476 412 /** Cache *************************************************************/ … … 492 428 /** Core **************************************************************/ 493 429 430 require( $this->plugin_dir . 'bbp-includes/bbp-core-options.php' ); // Configuration Options 494 431 require( $this->plugin_dir . 'bbp-includes/bbp-core-actions.php' ); // All actions 495 432 require( $this->plugin_dir . 'bbp-includes/bbp-core-filters.php' ); // All filters 496 require( $this->plugin_dir . 'bbp-includes/bbp-core-options.php' ); // Configuration Options497 433 require( $this->plugin_dir . 'bbp-includes/bbp-core-caps.php' ); // Roles and capabilities 498 434 require( $this->plugin_dir . 'bbp-includes/bbp-core-classes.php' ); // Common classes … … 500 436 require( $this->plugin_dir . 'bbp-includes/bbp-core-shortcodes.php' ); // Shortcodes for use with pages and posts 501 437 require( $this->plugin_dir . 'bbp-includes/bbp-core-update.php' ); // Database updater 502 438 503 439 /** Templates *********************************************************/ 504 440 505 441 require( $this->plugin_dir . 'bbp-includes/bbp-template-functions.php' ); // Template functions 506 442 require( $this->plugin_dir . 'bbp-includes/bbp-template-loader.php' ); // Template loader 507 443 require( $this->plugin_dir . 'bbp-includes/bbp-theme-compatibility.php' ); // Theme compatibility for existing themes 508 444 509 445 /** Extensions ********************************************************/ 510 446 511 447 require( $this->plugin_dir . 'bbp-includes/bbp-extend-akismet.php' ); // Spam prevention for topics and replies 512 448 … … 679 615 // Forum rewrite 680 616 $forum['rewrite'] = array( 681 'slug' => $this->forum_slug,617 'slug' => bbp_get_forum_slug(), 682 618 'with_front' => false 683 619 ); … … 699 635 'capability_type' => array( 'forum', 'forums' ), 700 636 'menu_position' => 56, 701 'has_archive' => $this->root_slug,637 'has_archive' => bbp_get_root_slug(), 702 638 'exclude_from_search' => true, 703 639 'show_in_nav_menus' => true, … … 736 672 // Topic rewrite 737 673 $topic['rewrite'] = array( 738 'slug' => $this->topic_slug,674 'slug' => bbp_get_topic_slug(), 739 675 'with_front' => false 740 676 ); … … 756 692 'capability_type' => array( 'topic', 'topics' ), 757 693 'menu_position' => 57, 758 'has_archive' => $this->topic_archive_slug,694 'has_archive' => bbp_get_topic_archive_slug(), 759 695 'exclude_from_search' => true, 760 696 'show_in_nav_menus' => false, … … 793 729 // Reply rewrite 794 730 $reply['rewrite'] = array( 795 'slug' => $this->reply_slug,731 'slug' => bbp_get_reply_slug(), 796 732 'with_front' => false 797 733 ); … … 933 869 // Topic tag rewrite 934 870 $topic_tag['rewrite'] = array( 935 'slug' => $this->topic_tag_slug,871 'slug' => bbp_get_topic_tag_taxonomy_slug(), 936 872 'with_front' => false 937 873 ); … … 1032 968 public function generate_rewrite_rules( $wp_rewrite ) { 1033 969 970 $user_slug = bbp_get_user_slug(); 971 $view_slug = bbp_get_view_slug(); 972 973 $root_rule = '/([^/]+)/?$'; 974 $edit_rule = '/([^/]+)/edit/?$'; 975 $feed_rule = '/([^/]+)/feed/?$'; 976 $page_rule = '/([^/]+)/page/?([0-9]{1,})/?$'; 977 1034 978 // New rules to merge with existing 1035 979 $bbp_rules = array( 1036 980 1037 981 // Edit Forum/Topic/Reply 1038 $this->forum_slug . '/([^/]+)/edit/?$'=> 'index.php?' . $this->forum_post_type . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1',1039 $this->topic_slug . '/([^/]+)/edit/?$'=> 'index.php?' . $this->topic_post_type . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1',1040 $this->reply_slug . '/([^/]+)/edit/?$'=> 'index.php?' . $this->reply_post_type . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1',982 bbp_get_forum_slug() . $edit_rule => 'index.php?' . $this->forum_post_type . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1', 983 bbp_get_topic_slug() . $edit_rule => 'index.php?' . $this->topic_post_type . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1', 984 bbp_get_reply_slug() . $edit_rule => 'index.php?' . $this->reply_post_type . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1', 1041 985 1042 986 // Edit Topic Tag 1043 $this->topic_tag_slug . '/([^/]+)/edit/?$'=> 'index.php?' . $this->topic_tag_tax_id . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1',987 bbp_get_topic_tag_taxonomy_slug() . $edit_rule => 'index.php?' . $this->topic_tag_tax_id . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1', 1044 988 1045 989 // Profile Page 1046 $ this->user_slug . '/([^/]+)/page/?([0-9]{1,})/?$'=> 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ),1047 $ this->user_slug . '/([^/]+)/?$' => 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ),1048 $ this->user_slug . '/([^/]+)/edit/?$' => 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1',990 $user_slug . $page_rule => 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ), 991 $user_slug . $edit_rule => 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ) . '&edit=1', 992 $user_slug . $root_rule => 'index.php?' . $this->user_id . '=' . $wp_rewrite->preg_index( 1 ), 1049 993 1050 994 // View Page 1051 $ this->view_slug . '/([^/]+)/page/?([0-9]{1,})/?$'=> 'index.php?' . $this->view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ),1052 $ this->view_slug . '/([^/]+)/feed/?$'=> 'index.php?' . $this->view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&feed=' . $wp_rewrite->preg_index( 2 ),1053 $ this->view_slug . '/([^/]+)/?$' => 'index.php?' . $this->view_id . '=' . $wp_rewrite->preg_index( 1 )995 $view_slug . $page_rule => 'index.php?' . $this->view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&paged=' . $wp_rewrite->preg_index( 2 ), 996 $view_slug . $feed_rule => 'index.php?' . $this->view_id . '=' . $wp_rewrite->preg_index( 1 ) . '&feed=' . $wp_rewrite->preg_index( 2 ), 997 $view_slug . $root_rule => 'index.php?' . $this->view_id . '=' . $wp_rewrite->preg_index( 1 ), 1054 998 ); 1055 999
Note: See TracChangeset
for help on using the changeset viewer.