Changeset 7476
- Timestamp:
- 10/24/2013 01:46:03 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-catchuri.php
r7471 r7476 2 2 3 3 /** 4 * BuddyPress URI catcher 4 * BuddyPress URI catcher. 5 5 * 6 6 * Functions for parsing the URI and determining which BuddyPress template file … … 15 15 16 16 /** 17 * Analyzes the URI structure and breaks it down into parts for use in code. 18 * BuddyPress can use complete custom friendly URI's without the user having to 19 * add new re-write rules. Custom components are able to use their own custom 17 * Analyze the URI and break it down into BuddyPress-usable chunks. 18 * 19 * BuddyPress can use complete custom friendly URIs without the user having to 20 * add new rewrite rules. Custom components are able to use their own custom 20 21 * URI structures with very little work. 21 22 * 22 * The URI 's are broken down as follows:23 * The URIs are broken down as follows: 23 24 * - http:// domain.com / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ... 24 25 * - OUTSIDE ROOT: http:// domain.com / sites / buddypress / members / andy / [current_component] / [current_action] / [action_variables] / [action_variables] / ... … … 30 31 * - $bp->action_variables: array ['group', 5] 31 32 * 32 * @package BuddyPress Core 33 * @since BuddyPress (1.0) 33 * @since BuddyPress (1.0.0) 34 34 */ 35 35 function bp_core_set_uri_globals() { … … 317 317 318 318 /** 319 * Are root profiles enabled and allowed 320 * 321 * @since BuddyPress (1.6) 322 * @return bool True if yes, false if no 319 * Are root profiles enabled and allowed? 320 * 321 * @since BuddyPress (1.6.0) 322 * 323 * @return bool True if yes, false if no. 323 324 */ 324 325 function bp_core_enable_root_profiles() { … … 340 341 * wp-content/themes/[activated_theme]/members/index.php 341 342 * 342 * @package BuddyPress Core 343 * @param string $username Username to check. 344 * @return int|bool The user ID of the matched user, or false. 343 * @param array $templates Array of templates to attempt to load. 344 * @return bool|null Returns false on failure. 345 345 */ 346 346 function bp_core_load_template( $templates ) { … … 413 413 414 414 /** 415 * bp_core_catch_profile_uri() 416 * 417 * If the extended profiles component is not installed we still need 418 * to catch the /profile URI's and display whatever we have installed. 419 * 415 * Redirect away from /profile URIs if XProfile is not enabled. 420 416 */ 421 417 function bp_core_catch_profile_uri() { … … 426 422 427 423 /** 428 * Catches invalid access to BuddyPress pages and redirects them accordingly. 429 * 430 * @package BuddyPress Core 431 * @since BuddyPress (1.5) 424 * Catch unauthorized access to certain BuddyPress pages and redirect accordingly. 425 * 426 * @since BuddyPress (1.5.0) 432 427 */ 433 428 function bp_core_catch_no_access() { … … 446 441 447 442 /** 448 * Redirects a user to login for BP pages that require access control and adds an error message (if 449 * one is provided). 443 * Redirect a user to log in for BP pages that require access control. 444 * 445 * Add an error message (if one is provided). 446 * 450 447 * If authenticated, redirects user back to requested content by default. 451 448 * 452 * @package BuddyPress Core 453 * @since BuddyPress (1.5) 449 * @since BuddyPress (1.5.0) 450 * 451 * @param array $args { 452 * @type int $mode Specifies the destintation of the redirect. 1 will 453 * direct to the root domain (home page), which assumes you have a 454 * log-in form there; 2 directs to wp-login.php. Default: 2. 455 * @type string $redirect The URL the user will be redirected to after 456 * successfully logging in. Default: the URL originally requested. 457 * @type string $root The root URL of the site, used in case of error or 458 * mode 1 redirects. Default: the value of {@link bp_get_root_domain()}. 459 * @type string $message An error message to display to the user on the 460 * log-in page. Default: "You must log in to access the page you 461 * requested." 462 * } 454 463 */ 455 464 function bp_core_no_access( $args = '' ) { … … 513 522 514 523 /** 515 * Adds an error message to wp-login.php. 524 * Add an error message to wp-login.php. 525 * 516 526 * Hooks into the "bpnoaccess" action defined in bp_core_no_access(). 517 527 * 518 * @ package BuddyPress Core519 * @global $error520 * @ since BuddyPress (1.5)528 * @since BuddyPress (1.5.0) 529 * 530 * @global $error Error message to pass to wp-login.php 521 531 */ 522 532 function bp_core_no_access_wp_login_error() { … … 531 541 532 542 /** 533 * Canonicalizes BuddyPress URLs 534 * 535 * This function ensures that requests for BuddyPress content are always redirected to their 536 * canonical versions. Canonical versions are always trailingslashed, and are typically the most 537 * general possible versions of the URL - eg, example.com/groups/mygroup/ instead of 538 * example.com/groups/mygroup/home/ 539 * 540 * @since BuddyPress (1.6) 541 * @see BP_Members_Component::setup_globals() where $bp->canonical_stack['base_url'] and 542 * ['component'] may be set 543 * @see bp_core_new_nav_item() where $bp->canonical_stack['action'] may be set 543 * Canonicalize BuddyPress URLs. 544 * 545 * This function ensures that requests for BuddyPress content are always 546 * redirected to their canonical versions. Canonical versions are always 547 * trailingslashed, and are typically the most general possible versions of the 548 * URL - eg, example.com/groups/mygroup/ instead of 549 * example.com/groups/mygroup/home/. 550 * 551 * @since BuddyPress (1.6.0) 552 * 553 * @see BP_Members_Component::setup_globals() where 554 * $bp->canonical_stack['base_url'] and ['component'] may be set. 555 * @see bp_core_new_nav_item() where $bp->canonical_stack['action'] may be set. 544 556 * @uses bp_get_canonical_url() 545 557 * @uses bp_get_requested_url() … … 589 601 590 602 /** 591 * Output rel=canonical header tag for BuddyPress content 592 * 593 * @since BuddyPress (1.6 )603 * Output rel=canonical header tag for BuddyPress content. 604 * 605 * @since BuddyPress (1.6.0) 594 606 */ 595 607 function bp_rel_canonical() { … … 601 613 602 614 /** 603 * Returns the canonical URL of the current page 604 * 605 * @since BuddyPress (1.6) 606 * @uses apply_filters() Filter bp_get_canonical_url to modify return value 607 * @param array $args 608 * @return string 615 * Get the canonical URL of the current page. 616 * 617 * @since BuddyPress (1.6.0) 618 * 619 * @uses apply_filters() Filter bp_get_canonical_url to modify return value. 620 * 621 * @param array $args { 622 * Optional array of arguments. 623 * @type bool $include_query_args Whether to include current URL arguments 624 * in the canonical URL returned from the function. 625 * } 626 * @return string Canonical URL for the current page. 609 627 */ 610 628 function bp_get_canonical_url( $args = array() ) { … … 684 702 685 703 /** 686 * Returns the URL as requested on the current page load by the user agent 687 * 688 * @since BuddyPress (1.6) 689 * @return string 704 * Return the URL as requested on the current page load by the user agent. 705 * 706 * @since BuddyPress (1.6.0) 707 * 708 * @return string Requested URL string. 690 709 */ 691 710 function bp_get_requested_url() { … … 701 720 702 721 /** 703 * Remove WordPress's really awesome canonical redirect if we are trying to load 704 * BuddyPress specific content. Avoids issues with WordPress thinking that a 705 * BuddyPress URL might actually be a blog post or page. 722 * Remove WP's canonical redirect when we are trying to load BP-specific content. 723 * 724 * Avoids issues with WordPress thinking that a BuddyPress URL might actually 725 * be a blog post or page. 706 726 * 707 727 * This function should be considered temporary, and may be removed without 708 728 * notice in future versions of BuddyPress. 709 729 * 710 * @since BuddyPress (1.6) 730 * @since BuddyPress (1.6.0) 731 * 711 732 * @uses bp_is_blog_page() 712 733 */ … … 718 739 719 740 /** 720 * Rehook maybe_redirect_404() to run later than the default 741 * Rehook maybe_redirect_404() to run later than the default. 721 742 * 722 743 * WordPress's maybe_redirect_404() allows admins on a multisite installation … … 753 774 754 775 /** 755 * Remove WordPress's rel=canonical HTML tag if we are trying to load BuddyPress 756 * specific content. 776 * Remove WP's rel=canonical HTML tag if we are trying to load BP-specific content. 757 777 * 758 778 * This function should be considered temporary, and may be removed without 759 779 * notice in future versions of BuddyPress. 760 780 * 761 * @since BuddyPress (1.6 )781 * @since BuddyPress (1.6.0) 762 782 */ 763 783 function _bp_maybe_remove_rel_canonical() {
Note: See TracChangeset
for help on using the changeset viewer.