Changeset 4840 for trunk/bp-core/bp-core-template.php
- Timestamp:
- 07/24/2011 10:22:55 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/bp-core/bp-core-template.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bp-core/bp-core-template.php
r4839 r4840 471 471 } 472 472 473 /** 474 * Return the value of $bp->action_variables 475 * 476 * @package BuddyPress 477 * 478 * @param mixed $action_variables The action variables array, or false if the array is empty 479 */ 473 480 function bp_action_variables() { 474 481 global $bp; 475 482 $action_variables = !empty( $bp->action_variables ) ? $bp->action_variables : false; 476 483 return apply_filters( 'bp_action_variables', $action_variables ); 484 } 485 486 /** 487 * Return the value of a given action variable 488 * 489 * @package BuddyPress 490 * @since 1.3 491 * 492 * @param int $position The key of the action_variables array that you want 493 * @return str $action_variable The value of that position in the array 494 */ 495 function bp_action_variable( $position = 0 ) { 496 $action_variables = bp_action_variables(); 497 498 $action_variable = isset( $action_variables[$position] ) ? $action_variables[$position] : false; 499 500 return apply_filters( 'bp_action_variable', $action_variable, $position ); 477 501 } 478 502 … … 677 701 } 678 702 703 /** 704 * Check to see whether the current page matches a given action. 705 * 706 * Along with bp_is_current_component() and bp_is_action_variable(), this function is mostly used 707 * to help determine when to use a given screen function. 708 * 709 * In BP parlance, the current_action is the URL chunk that comes directly after the 710 * current item slug. E.g., in 711 * http://example.com/groups/my-group/members 712 * the current_action is 'members'. 713 * 714 * @package BuddyPress 715 * @since 1.3 716 * 717 * @param str $action The action being tested against 718 * @return bool True if the current action matches $action 719 */ 679 720 function bp_is_current_action( $action = '' ) { 680 721 global $bp; … … 684 725 685 726 return false; 727 } 728 729 /** 730 * Check to see whether the current page matches a given action_variable. 731 * 732 * Along with bp_is_current_component() and bp_is_current_action(), this function is mostly used 733 * to help determine when to use a given screen function. 734 * 735 * In BP parlance, action_variables are an array made up of the URL chunks appearing after the 736 * current_action in a URL. For example, 737 * http://example.com/groups/my-group/admin/group-settings 738 * $action_variables[0] is 'group-settings'. 739 * 740 * @package BuddyPress 741 * @since 1.3 742 * 743 * @param str $action_variable The action_variable being tested against 744 * @param int $position The array key you're testing against. If you don't provide a $position, 745 * the function will return true if the $action_variable is found *anywhere* in the action 746 * variables array. 747 * @return bool 748 */ 749 function bp_is_action_variable( $action_variable = '', $position = false ) { 750 $is_action_variable = false; 751 752 if ( false !== $position ) { 753 // When a $position is specified, check that slot in the action_variables array 754 if ( $action_variable ) { 755 $is_action_variable = $action_variable == bp_action_variable( $position ); 756 } else { 757 // If no $action_variable is provided, we are essentially checking to see 758 // whether the slot is empty 759 $is_action_variable = !bp_action_variable( $position ); 760 } 761 } else { 762 // When no $position is specified, check the entire array 763 $is_action_variable = in_array( $action_variable, bp_action_variables() ); 764 } 765 766 return apply_filters( 'bp_is_action_variable', $is_action_variable, $action_variable, $position ); 686 767 } 687 768
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)