Changeset 9352
- Timestamp:
- 01/13/2015 01:35:21 AM (10 years ago)
- Location:
- trunk/src/bp-notifications
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-notifications/bp-notifications-actions.php
r9351 r9352 126 126 * Handles bulk management (mark as read/unread, delete) of notifications. 127 127 * 128 * @since BuddyPress (2.2 )128 * @since BuddyPress (2.2.0) 129 129 * 130 130 * @return bool -
trunk/src/bp-notifications/bp-notifications-cache.php
r8958 r9352 12 12 * @since BuddyPress (2.0.0) 13 13 * 14 * @param BP_Notification _Notification $n Notification object.14 * @param BP_Notifications_Notification $n Notification object. 15 15 */ 16 16 function bp_notifications_clear_all_for_user_cache_after_save( BP_Notifications_Notification $n ) { -
trunk/src/bp-notifications/bp-notifications-classes.php
r9351 r9352 139 139 $data_format = array( '%d', '%d', '%d', '%s', '%s', '%s', '%d' ); 140 140 141 /** 142 * Fires before the current notification item gets saved. 143 * 144 * Please use this hook to filter the properties above. Each part will be passed in. 145 * 146 * @since BuddyPress (2.0.0) 147 * 148 * @param BP_Notifications_Notification Current instance of the notification item being saved. Passed by reference. 149 */ 141 150 do_action_ref_array( 'bp_notification_before_save', array( &$this ) ); 142 151 … … 158 167 } 159 168 169 /** 170 * Fires after the current notification item gets saved. 171 * 172 * @since BuddyPress (2.0.0) 173 * 174 * @param BP_Notifications_Notification Current instance of the notification item being saved. Passed by reference. 175 */ 160 176 do_action_ref_array( 'bp_notification_after_save', array( &$this ) ); 161 177 … … 704 720 $where = self::get_query_clauses( $args ); 705 721 722 /** 723 * Fires before the deletion of a notification item. 724 * 725 * @since BuddyPress (2.0.0) 726 * 727 * @param array $args Associative array of columns/values, to determine 728 * which rows should be deleted. Of the format 729 * array( 'item_id' => 7, 'component_action' => 'members' ). 730 */ 706 731 do_action( 'bp_notification_before_delete', $args ); 707 732 -
trunk/src/bp-notifications/bp-notifications-functions.php
r9351 r9352 152 152 } 153 153 154 // Filter and return 154 /** 155 * Filters all notifications for a user. 156 * 157 * @since BuddyPress (2.1.0) 158 * 159 * @param array $notifications Array of notifications for user. 160 * @param int $user_id ID of the user being fetched. 161 */ 155 162 return apply_filters( 'bp_notifications_get_all_notifications_for_user', $notifications, $user_id ); 156 163 } … … 262 269 if ( 'object' === $format ) { 263 270 264 // Retrieve the content of the notification using the callback 271 /** 272 * Filters the notifications for a user. 273 * 274 * @since BuddyPress (1.9.0) 275 * 276 * @param array $ref_array Array of properties for the current notification being rendered. 277 */ 265 278 $content = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', $ref_array ); 266 279 … … 282 295 // Return an array of content strings 283 296 } else { 297 298 /** This filters is documented in bp-notifications/bp-notifications-functions.php */ 284 299 $renderable[] = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', $ref_array ); 285 300 } … … 293 308 } 294 309 295 // Filter and return 310 /** 311 * Filters the final array of notifications to be displayed for a user. 312 * 313 * @since BuddyPress (1.6.0) 314 * 315 * @param Array|Bool $renderable Array of notifications to render or false if no notifications. 316 * @param int $user_id ID of the user whose notifications are being displayed. 317 * @param string $format Display format requested for the notifications. 318 */ 296 319 return apply_filters( 'bp_core_get_notifications_for_user', $renderable, $user_id, $format ); 297 320 } … … 541 564 $count = ! empty( $notifications ) ? count( $notifications ) : 0; 542 565 566 /** 567 * Filters the count of unread notification items for a user. 568 * 569 * @since BuddyPress (1.9.0) 570 * 571 * @param int $count Count of unread notification items for a user. 572 */ 543 573 return apply_filters( 'bp_notifications_get_total_notification_count', (int) $count ); 544 574 } … … 572 602 } 573 603 574 // Return active components with registered notifications callbacks 604 /** 605 * Filters active components with registered notifications callbacks. 606 * 607 * @since BuddyPress (1.9.1) 608 * 609 * @param array $component_names Array of registered component names. 610 * @param array $active_components Array of active components. 611 */ 575 612 return apply_filters( 'bp_notifications_get_registered_components', $component_names, $active_components ); 576 613 } -
trunk/src/bp-notifications/bp-notifications-screens.php
r8958 r9352 21 21 */ 22 22 function bp_notifications_screen_unread() { 23 24 /** 25 * Fires right before the loading of the notifications unread screen template file. 26 * 27 * @since BuddyPress (1.9.0) 28 */ 23 29 do_action( 'bp_notifications_screen_unread' ); 24 30 31 /** 32 * Filters the template to load for the notifications unread screen. 33 * 34 * @since BuddyPress (1.9.0) 35 * 36 * @param string $template Path to the notifications unread template to load. 37 */ 25 38 bp_core_load_template( apply_filters( 'bp_notifications_template_unread', 'members/single/home' ) ); 26 39 } … … 32 45 */ 33 46 function bp_notifications_screen_read() { 47 48 /** 49 * Fires right before the loading of the notifications read screen template file. 50 * 51 * @since BuddyPress (1.9.0) 52 */ 34 53 do_action( 'bp_notifications_screen_read' ); 35 54 55 /** 56 * Filters the template to load for the notifications read screen. 57 * 58 * @since BuddyPress (1.9.0) 59 * 60 * @param string $template Path to the notifications read template to load. 61 */ 36 62 bp_core_load_template( apply_filters( 'bp_notifications_template_read', 'members/single/home' ) ); 37 63 } -
trunk/src/bp-notifications/bp-notifications-template.php
r9351 r9352 27 27 */ 28 28 function bp_get_notifications_slug() { 29 30 /** 31 * Filters the notifications component slug. 32 * 33 * @since BuddyPress (1.9.0) 34 * 35 * @param string $slug Notifications component slug. 36 */ 29 37 return apply_filters( 'bp_get_notifications_slug', buddypress()->notifications->slug ); 30 38 } … … 47 55 function bp_get_notifications_permalink() { 48 56 $retval = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() ); 57 58 /** 59 * Filters the notifications permalink. 60 * 61 * @since BuddyPress (1.9.0) 62 * 63 * @param string $retval Permalink for the notifications. 64 */ 49 65 return apply_filters( 'bp_get_notifications_permalink', $retval ); 50 66 } … … 67 83 function bp_get_notifications_unread_permalink() { 68 84 $retval = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() . '/unread' ); 85 86 /** 87 * Filters the unread notifications permalink. 88 * 89 * @since BuddyPress (1.9.0) 90 * 91 * @param string $retval Permalink for the unread notifications. 92 */ 69 93 return apply_filters( 'bp_get_notifications_unread_permalink', $retval ); 70 94 } … … 87 111 function bp_get_notifications_read_permalink() { 88 112 $retval = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() . '/read' ); 113 114 /** 115 * Filters the read notifications permalink. 116 * 117 * @since BuddyPress (1.9.0) 118 * 119 * @param string $retval Permalink for the read notifications. 120 */ 89 121 return apply_filters( 'bp_get_notifications_unread_permalink', $retval ); 90 122 } … … 390 422 391 423 } elseif ( $this->current_notification + 1 == $this->notification_count ) { 424 425 /** 426 * Fires right before the rewinding of notification posts. 427 * 428 * @since BuddyPress (1.9.0) 429 */ 392 430 do_action( 'notifications_loop_end'); 393 431 … … 416 454 // loop has just started 417 455 if ( 0 === $this->current_notification ) { 456 457 /** 458 * Fires if the current notification item is the first in the notification loop. 459 * 460 * @since BuddyPress (1.9.0) 461 */ 418 462 do_action( 'notifications_loop_start' ); 419 463 } … … 490 534 buddypress()->notifications->query_loop = $query_loop; 491 535 536 /** 537 * Filters whether or not the user has notifications to display. 538 * 539 * @since BuddyPress (1.9.0) 540 * 541 * @param bool $value Whether or not there are notifications to display. 542 * @param BP_Notifications_Template $query_loop BP_Notifications_Template object instance. 543 */ 492 544 return apply_filters( 'bp_has_notifications', $query_loop->has_notifications(), $query_loop ); 493 545 } … … 533 585 */ 534 586 function bp_get_the_notification_id() { 587 588 /** 589 * Filters the ID of the notification currently being iterated on. 590 * 591 * @since BuddyPress (1.9.0) 592 * 593 * @param int $id ID of the notification being iterated on. 594 */ 535 595 return apply_filters( 'bp_get_the_notification_id', buddypress()->notifications->query_loop->notification->id ); 536 596 } … … 552 612 */ 553 613 function bp_get_the_notification_item_id() { 614 615 /** 616 * Filters the associated item ID of the notification currently being iterated on. 617 * 618 * @since BuddyPress (1.9.0) 619 * 620 * @param int $item_id ID of the associated item. 621 */ 554 622 return apply_filters( 'bp_get_the_notification_item_id', buddypress()->notifications->query_loop->notification->item_id ); 555 623 } … … 571 639 */ 572 640 function bp_get_the_notification_secondary_item_id() { 641 642 /** 643 * Filters the secondary associated item ID of the notification currently being iterated on. 644 * 645 * @since BuddyPress (1.9.0) 646 * 647 * @param int $secondary_item_id ID of the secondary associated item. 648 */ 573 649 return apply_filters( 'bp_get_the_notification_secondary_item_id', buddypress()->notifications->query_loop->notification->secondary_item_id ); 574 650 } … … 590 666 */ 591 667 function bp_get_the_notification_component_name() { 668 669 /** 670 * Filters the name of the component associated with the notification currently being iterated on. 671 * 672 * @since BuddyPress (1.9.0) 673 * 674 * @param int $component_name Name of the component associated with the current notification. 675 */ 592 676 return apply_filters( 'bp_get_the_notification_component_name', buddypress()->notifications->query_loop->notification->component_name ); 593 677 } … … 609 693 */ 610 694 function bp_get_the_notification_component_action() { 695 696 /** 697 * Filters the name of the action associated with the notification currently being iterated on. 698 * 699 * @since BuddyPress (1.9.0) 700 * 701 * @param int $component_action Name of the action associated with the current notification. 702 */ 611 703 return apply_filters( 'bp_get_the_notification_component_action', buddypress()->notifications->query_loop->notification->component_action ); 612 704 } … … 628 720 */ 629 721 function bp_get_the_notification_date_notified() { 722 723 /** 724 * Filters the timestamp of the current notification. 725 * 726 * @since BuddyPress (1.9.0) 727 * 728 * @param string $date_notified Timestamp of the current notification. 729 */ 630 730 return apply_filters( 'bp_get_the_notification_date_notified', buddypress()->notifications->query_loop->notification->date_notified ); 631 731 } … … 660 760 } 661 761 762 /** 763 * Filters the time since value of the current notification. 764 * 765 * @since BuddyPress (1.9.0) 766 * 767 * @param string $retval Time since value for current notification. 768 */ 662 769 return apply_filters( 'bp_get_the_notification_time_since', $retval ); 663 770 } … … 693 800 // Allow non BuddyPress components to hook in 694 801 } else { 802 803 /** This filter is documented in bp-notifications/bp-notifications-functions.php */ 695 804 $description = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', array( $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 ) ); 696 805 } 697 806 698 // Filter and return 807 /** 808 * Filters the full-text description for a specific notification. 809 * 810 * @since BuddyPress (1.9.0) 811 * 812 * @param string $description Full-text description for a specific notification. 813 */ 699 814 return apply_filters( 'bp_get_the_notification_description', $description ); 700 815 } … … 724 839 <?php $retval = ob_get_clean(); 725 840 841 /** 842 * Filters the mark read link for the current notification. 843 * 844 * @since BuddyPress (1.9.0) 845 * 846 * @param string $retval HTML for the mark read link for the current notification. 847 */ 726 848 return apply_filters( 'bp_get_the_notification_mark_read_link', $retval ); 727 849 } … … 761 883 $url = wp_nonce_url( $url, 'bp_notification_mark_read_' . $id ); 762 884 763 // Filter and return 885 /** 886 * Filters the URL used for marking a single notification as read. 887 * 888 * @since BuddyPress (2.1.0) 889 * 890 * @param string $url URL to use for marking the single notification as read. 891 */ 764 892 return apply_filters( 'bp_get_the_notification_mark_read_url', $url ); 765 893 } 766 894 767 895 /** 768 * Output the mark read link for the current notification.896 * Output the mark unread link for the current notification. 769 897 * 770 898 * @since BuddyPress (1.9.0) … … 776 904 } 777 905 /** 778 * Return the mark read link for the current notification.906 * Return the mark unread link for the current notification. 779 907 * 780 908 * @since BuddyPress (1.9.0) … … 789 917 <?php $retval = ob_get_clean(); 790 918 919 /** 920 * Filters the link used for marking a single notification as unread. 921 * 922 * @since BuddyPress (1.9.0) 923 * 924 * @param string $retval HTML for the mark unread link for the current notification. 925 */ 791 926 return apply_filters( 'bp_get_the_notification_mark_unread_link', $retval ); 792 927 } … … 826 961 $url = wp_nonce_url( $url, 'bp_notification_mark_unread_' . $id ); 827 962 828 // Filter and return 963 /** 964 * Filters the URL used for marking a single notification as unread. 965 * 966 * @since BuddyPress (2.1.0) 967 * 968 * @param string $url URL to use for marking the single notification as unread. 969 */ 829 970 return apply_filters( 'bp_get_the_notification_mark_unread_url', $url ); 830 971 } … … 853 994 } 854 995 996 /** 997 * Filters the mark link for the current notification. 998 * 999 * @since BuddyPress (1.9.0) 1000 * 1001 * @param string $retval The mark link for the current notification. 1002 */ 855 1003 return apply_filters( 'bp_get_the_notification_mark_link', $retval ); 856 1004 } … … 880 1028 <?php $retval = ob_get_clean(); 881 1029 1030 /** 1031 * Filters the delete link for the current notification. 1032 * 1033 * @since BuddyPress (1.9.0) 1034 * 1035 * @param string $retval HTML for the delete link for the current notification. 1036 */ 882 1037 return apply_filters( 'bp_get_the_notification_delete_link', $retval ); 883 1038 } … … 927 1082 $url = wp_nonce_url( $url, 'bp_notification_delete_' . $id ); 928 1083 929 // Filter and return 1084 /** 1085 * Filters the URL used for deleting a single notification. 1086 * 1087 * @since BuddyPress (2.1.0) 1088 * 1089 * @param string $url URL used for deleting a single notification. 1090 */ 930 1091 return apply_filters( 'bp_get_the_notification_delete_url', $url ); 931 1092 } … … 969 1130 $retval = $r['before'] . implode( $r['links'], $r['sep'] ) . $r['after']; 970 1131 1132 /** 1133 * Filters the action links for the current notification. 1134 * 1135 * @since BuddyPress (1.9.0) 1136 * 1137 * @param string $retval HTML links for actions to take on single notifications. 1138 */ 971 1139 return apply_filters( 'bp_get_the_notification_action_links', $retval ); 972 1140 } … … 995 1163 $pag = sprintf( _n( 'Viewing 1 notification', 'Viewing %1$s - %2$s of %3$s notifications', $total, 'buddypress' ), $from_num, $to_num, $total ); 996 1164 1165 /** 1166 * Filters the pagination count for the current notification loop. 1167 * 1168 * @since BuddyPress (1.9.0) 1169 * 1170 * @param string $pag HTML for the pagination count. 1171 */ 997 1172 return apply_filters( 'bp_notifications_pagination_count', $pag ); 998 1173 } … … 1014 1189 */ 1015 1190 function bp_get_notifications_pagination_links() { 1191 1192 /** 1193 * Filters the pagination links for the current notification loop. 1194 * 1195 * @since BuddyPress (1.9.0) 1196 * 1197 * @param string $pag_links HTML for the pagination links. 1198 */ 1016 1199 return apply_filters( 'bp_get_notifications_pagination_links', buddypress()->notifications->query_loop->pag_links ); 1017 1200 }
Note: See TracChangeset
for help on using the changeset viewer.