Changeset 6772
- Timestamp:
- 01/23/2018 11:26:56 PM (8 years ago)
- Location:
- trunk/src/includes/admin
- Files:
-
- 3 edited
-
forums.php (modified) (3 diffs)
-
replies.php (modified) (3 diffs)
-
topics.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/includes/admin/forums.php
r6771 r6772 475 475 476 476 /** 477 * Returns an array of keys used to sort row actions 478 * 479 * @since 2.6.0 bbPress (r6771) 480 * 481 * @return array 482 */ 483 private function get_row_action_sort_order() { 484 485 // Filter & return 486 return (array) apply_filters( 'bbp_admin_forum_row_action_sort_order', array( 487 'edit', 488 'closed', 489 'trash', 490 'untrash', 491 'delete', 492 'view' 493 ) ); 494 } 495 496 /** 477 497 * Returns an array of notice toggles 478 498 * … … 596 616 * @since 2.0.0 bbPress (r2577) 597 617 * 598 * @param array $actions Actions 599 * @param array $forum Forum object 618 * @param array $actions Actions 619 * @param object $forum Topic object 620 * 600 621 * @return array $actions Actions 601 622 */ 602 public function row_actions( $actions, $forum ) { 603 623 public function row_actions( $actions = array(), $forum = false ) { 624 625 // Disable quick edit (too much to do here) 604 626 unset( $actions['inline hide-if-no-js'] ); 605 627 … … 621 643 bbp_forum_content( $forum->ID ); 622 644 623 return $actions; 645 // Sort & return 646 return $this->sort_row_actions( $actions ); 647 } 648 649 /** 650 * Sort row actions by key 651 * 652 * @since 2.6.0 653 * 654 * @param array $actions 655 * 656 * @return array 657 */ 658 private function sort_row_actions( $actions = array() ) { 659 660 // Return value 661 $retval = array(); 662 663 // Known row actions, in sort order 664 $known_actions = $this->get_row_action_sort_order(); 665 666 // Sort known actions, and keep any unknown ones 667 foreach ( $known_actions as $key ) { 668 if ( isset( $actions[ $key ] ) ) { 669 $retval[ $key ] = $actions[ $key ]; 670 unset( $actions[ $key ] ); 671 } 672 } 673 674 // Combine & return 675 return $retval + $actions; 624 676 } 625 677 -
trunk/src/includes/admin/replies.php
r6771 r6772 596 596 597 597 /** 598 * Returns an array of keys used to sort row actions 599 * 600 * @since 2.6.0 bbPress (r6771) 601 * 602 * @return array 603 */ 604 private function get_row_action_sort_order() { 605 606 // Filter & return 607 return (array) apply_filters( 'bbp_admin_reply_row_action_sort_order', array( 608 'edit', 609 'approved', 610 'unapproved', 611 'spam', 612 'trash', 613 'untrash', 614 'delete', 615 'view' 616 ) ); 617 } 618 619 /** 598 620 * Returns an array of notice toggles 599 621 * … … 754 776 * @since 2.0.0 bbPress (r2577) 755 777 * 756 * @param array $actions Actions757 * @param array $reply Replyobject778 * @param array $actions Actions 779 * @param object $reply Topic object 758 780 * 759 781 * @return array $actions Actions 760 782 */ 761 public function row_actions( $actions, $reply ) { 762 783 public function row_actions( $actions = array(), $reply = false ) { 784 785 // Disable quick edit (too much to do here) 763 786 unset( $actions['inline hide-if-no-js'] ); 764 787 … … 819 842 } 820 843 821 return $actions; 844 // Sort & return 845 return $this->sort_row_actions( $actions ); 846 } 847 848 /** 849 * Sort row actions by key 850 * 851 * @since 2.6.0 852 * 853 * @param array $actions 854 * 855 * @return array 856 */ 857 private function sort_row_actions( $actions = array() ) { 858 859 // Return value 860 $retval = array(); 861 862 // Known row actions, in sort order 863 $known_actions = $this->get_row_action_sort_order(); 864 865 // Sort known actions, and keep any unknown ones 866 foreach ( $known_actions as $key ) { 867 if ( isset( $actions[ $key ] ) ) { 868 $retval[ $key ] = $actions[ $key ]; 869 unset( $actions[ $key ] ); 870 } 871 } 872 873 // Combine & return 874 return $retval + $actions; 822 875 } 823 876 -
trunk/src/includes/admin/topics.php
r6771 r6772 777 777 778 778 /** 779 * Returns an array of keys used to sort row actions 780 * 781 * @since 2.6.0 bbPress (r6771) 782 * 783 * @return array 784 */ 785 private function get_row_action_sort_order() { 786 787 // Filter & return 788 return (array) apply_filters( 'bbp_admin_topics_row_action_sort_order', array( 789 'edit', 790 'stick', 791 'approved', 792 'unapproved', 793 'closed', 794 'spam', 795 'trash', 796 'untrash', 797 'delete', 798 'view' 799 ) ); 800 } 801 802 /** 779 803 * Returns an array of notice toggles 780 804 * … … 930 954 * @since 2.0.0 bbPress (r2485) 931 955 * 932 * @param array $actions Actions 933 * @param array $topic Topic object 956 * @param array $actions Actions 957 * @param object $topic Topic object 958 * 934 959 * @return array $actions Actions 935 960 */ 936 public function row_actions( $actions, $topic ) { 937 961 public function row_actions( $actions = array(), $topic = false ) { 962 963 // Disable quick edit (too much to do here) 938 964 unset( $actions['inline hide-if-no-js'] ); 939 965 … … 1014 1040 } 1015 1041 1016 return $actions; 1042 // Sort & return 1043 return $this->sort_row_actions( $actions ); 1044 } 1045 1046 /** 1047 * Sort row actions by key 1048 * 1049 * @since 2.6.0 1050 * 1051 * @param array $actions 1052 * 1053 * @return array 1054 */ 1055 private function sort_row_actions( $actions = array() ) { 1056 1057 // Return value 1058 $retval = array(); 1059 1060 // Known row actions, in sort order 1061 $known_actions = $this->get_row_action_sort_order(); 1062 1063 // Sort known actions, and keep any unknown ones 1064 foreach ( $known_actions as $key ) { 1065 if ( isset( $actions[ $key ] ) ) { 1066 $retval[ $key ] = $actions[ $key ]; 1067 unset( $actions[ $key ] ); 1068 } 1069 } 1070 1071 // Combine & return 1072 return $retval + $actions; 1017 1073 } 1018 1074
Note: See TracChangeset
for help on using the changeset viewer.