Changeset 8482
- Timestamp:
- 06/08/2014 09:12:34 PM (10 years ago)
- Location:
- trunk/src/bp-messages
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-notifications.php
r8414 r8482 14 14 15 15 /** 16 * Email message recipients to alert them of a new unread private message 17 * 18 * @since BuddyPress (1.0) 19 * @param array $raw_args 16 * Email message recipients to alert them of a new unread private message. 17 * 18 * @since BuddyPress (1.0.0) 19 * 20 * @param array|BP_Messages_Message $raw_args { 21 * Array of arguments. Also accepts a BP_Messages_Message object. 22 * @type array $recipients User IDs of recipients. 23 * @type string $email_subject Subject line of message. 24 * @type string $email_content Content of message. 25 * @type int $sender_id User ID of sender. 26 * } 20 27 */ 21 28 function messages_notification_new_message( $raw_args = array() ) { … … 102 109 103 110 /** 104 * Format the BuddyBar/Toolbar notifications for the Messages component 105 * 106 * @since BuddyPress (1.0) 107 * @param string $action The kind of notification being rendered 108 * @param int $item_id The primary item id 109 * @param int $secondary_item_id The secondary item id 110 * @param int $total_items The total number of messaging-related notifications waiting for the user 111 * @param string $format 'string' for BuddyBar-compatible notifications; 'array' for WP Toolbar 111 * Format the BuddyBar/Toolbar notifications for the Messages component. 112 * 113 * @since BuddyPress (1.0.0) 114 * 115 * @param string $action The kind of notification being rendered. 116 * @param int $item_id The primary item id. 117 * @param int $secondary_item_id The secondary item id. 118 * @param int $total_items The total number of messaging-related notifications 119 * waiting for the user 120 * @param string $format Return value format. 'string' for BuddyBar-compatible 121 * notifications; 'array' for WP Toolbar. Default: 'string'. 122 * @return string|array Formatted notifications. 112 123 */ 113 124 function messages_format_notifications( $action, $item_id, $secondary_item_id, $total_items, $format = 'string' ) { … … 151 162 152 163 /** 153 * Send notifications to message recipients 164 * Send notifications to message recipients. 154 165 * 155 166 * @since BuddyPress (1.9.0) 156 * @param obj $message 167 * 168 * @param BP_Messages_Message $message Message object. 157 169 */ 158 170 function bp_messages_message_sent_add_notification( $message ) { -
trunk/src/bp-messages/bp-messages-screens.php
r6806 r8482 4 4 * BuddyPress Messages Screens 5 5 * 6 * Screen functions are the controllers of BuddyPress. They will execute when their7 * specific URL is caught. They will first save or manipulate data using business8 * functions, then pass on the user to a template file.6 * Screen functions are the controllers of BuddyPress. They will execute when 7 * their specific URL is caught. They will first save or manipulate data using 8 * business functions, then pass on the user to a template file. 9 9 * 10 10 * @package BuddyPress … … 15 15 if ( !defined( 'ABSPATH' ) ) exit; 16 16 17 /** 18 * Load the Messages > Inbox screen. 19 */ 17 20 function messages_screen_inbox() { 18 21 if ( bp_action_variables() ) { … … 25 28 } 26 29 30 /** 31 * Load the Messages > Sent screen. 32 */ 27 33 function messages_screen_sentbox() { 28 34 if ( bp_action_variables() ) { … … 35 41 } 36 42 43 /** 44 * Load the Messages > Compose screen. 45 */ 37 46 function messages_screen_compose() { 38 47 global $bp; … … 87 96 } 88 97 98 /** 99 * Load an individual conversation screen. 100 * 101 * @return bool|null False on failure. 102 */ 89 103 function messages_screen_conversation() { 90 104 … … 110 124 add_action( 'bp_screens', 'messages_screen_conversation' ); 111 125 126 /** 127 * Load the Messages > Notices screen. 128 * 129 * @return false|null False on failure. 130 */ 112 131 function messages_screen_notices() { 113 132 global $notice_id; … … 153 172 } 154 173 174 /** 175 * Render the markup for the Messages section of Settings > Notifications. 176 */ 155 177 function messages_screen_notification_settings() { 156 178 if ( bp_action_variables() ) { -
trunk/src/bp-messages/bp-messages-template.php
r8202 r8482 15 15 */ 16 16 class BP_Messages_Box_Template { 17 /** 18 * The loop iterator. 19 * 20 * @access public 21 * @var int 22 */ 17 23 var $current_thread = -1; 24 25 /** 26 * The number of threads returned by the paged query. 27 * 28 * @access public 29 * @var int 30 */ 18 31 var $current_thread_count; 32 33 /** 34 * Total number of threads matching the query params. 35 * 36 * @access public 37 * @var int 38 */ 19 39 var $total_thread_count; 40 41 /** 42 * Array of threads located by the query. 43 * 44 * @access public 45 * @var array 46 */ 20 47 var $threads; 48 49 /** 50 * The thread object currently being iterated on. 51 * 52 * @access public 53 * @var object 54 */ 21 55 var $thread; 22 56 57 /** 58 * A flag for whether the loop is currently being iterated. 59 * 60 * @access public 61 * @var bool 62 */ 23 63 var $in_the_loop; 64 65 /** 66 * User ID of the current inbox. 67 * 68 * @access public 69 * @var int 70 */ 24 71 var $user_id; 72 73 /** 74 * The current "box" view ('notices', 'sentbox', 'inbox') 75 * 76 * @access public 77 * @var string 78 */ 25 79 var $box; 26 80 81 /** 82 * The page number being requested. 83 * 84 * @access public 85 * @var int 86 */ 27 87 var $pag_page; 88 89 /** 90 * The number of items being requested per page. 91 * 92 * @access public 93 * @var int 94 */ 28 95 var $pag_num; 96 97 /** 98 * An HTML string containing pagination links. 99 * 100 * @access public 101 * @var string 102 */ 29 103 var $pag_links; 104 105 /** 106 * Search terms for limiting the thread query. 107 * 108 * @access public 109 * @var string 110 */ 30 111 var $search_terms; 31 112 113 /** 114 * Constructor method. 115 * 116 * @param int $user_id ID of the user whose Messages box is being 117 * viewed. 118 * @param string $box Type of box being viewed ('notices', 'sentbox', 119 * 'inbox'). 120 * @param int $per_page Number of thread to return per page of results. 121 * @param int $max Max number of results to return. 122 * @param string $type Type of results to return. 'unread', 'read', 123 * or 'all'. 124 * @param string $search_terms Search terms for limiting results. 125 * @param string $page_arg Optional. URL argument for pagination 126 * parameter. Default: 'mpage'. 127 */ 32 128 function __construct( $user_id, $box, $per_page, $max, $type, $search_terms, $page_arg = 'mpage' ) { 33 129 $this->pag_page = isset( $_GET[$page_arg] ) ? intval( $_GET[$page_arg] ) : 1; … … 89 185 } 90 186 187 /** 188 * Whether there are threads available in the loop. 189 * 190 * @see bp_has_message_threads() 191 * 192 * @return bool True if there are items in the loop, otherwise false. 193 */ 91 194 function has_threads() { 92 195 if ( $this->thread_count ) … … 96 199 } 97 200 201 /** 202 * Set up the next member and iterate index. 203 * 204 * @return object The next member to iterate over. 205 */ 98 206 function next_thread() { 99 207 $this->current_thread++; … … 103 211 } 104 212 213 /** 214 * Rewind the threads and reset thread index. 215 */ 105 216 function rewind_threads() { 106 217 $this->current_thread = -1; … … 110 221 } 111 222 223 /** 224 * Whether there are threads left in the loop to iterate over. 225 * 226 * This method is used by {@link bp_message_threads()} as part of the 227 * while loop that controls iteration inside the threads loop, eg: 228 * while ( bp_message_threads() ) { ... 229 * 230 * @see bp_message_threads() 231 * 232 * @return bool True if there are more threads to show, otherwise false. 233 */ 112 234 function message_threads() { 113 235 if ( $this->current_thread + 1 < $this->thread_count ) { … … 123 245 } 124 246 247 /** 248 * Set up the current thread inside the loop. 249 * 250 * Used by {@link bp_message_thread()} to set up the current thread data 251 * while looping, so that template tags used during that iteration make 252 * reference to the current thread. 253 * 254 * @see bp_message_thread() 255 */ 125 256 function the_message_thread() { 126 257 … … 167 298 168 299 /** 169 * Retrieve private message threads for display in inbox/sentbox/notices 300 * Retrieve private message threads for display in inbox/sentbox/notices. 170 301 * 171 302 * Similar to WordPress's have_posts() function, this function is responsible … … 176 307 * 177 308 * @global BP_Messages_Box_Template $messages_template 178 * @param array $args 179 * @return object 309 * 310 * @param array $args { 311 * Array of arguments. All are optional. 312 * @type int $user_id ID of the user whose threads are being loaded. 313 * Default: ID of the logged-in user. 314 * @type string $box Current "box" view. If not provided here, the current 315 * view will be inferred from the URL. 316 * @type int $per_page Number of results to return per page. Default: 10. 317 * @type int $max Max results to return. Default: false. 318 * @type string $search_terms Terms to which to limit results. Default: 319 * the value of $_REQUEST['s']. 320 * @type string $page_arg URL argument used for the pagination param. 321 * Default: 'mpage'. 322 * } 323 * @return bool True if there are threads to display, otherwise false. 180 324 */ 181 325 function bp_has_message_threads( $args = '' ) { … … 221 365 } 222 366 367 /** 368 * Check whether there are more threads to iterate over. 369 * 370 * @return bool 371 */ 223 372 function bp_message_threads() { 224 373 global $messages_template; … … 226 375 } 227 376 377 /** 378 * Set up the current thread inside the loop. 379 * 380 * @return object 381 */ 228 382 function bp_message_thread() { 229 383 global $messages_template; … … 231 385 } 232 386 387 /** 388 * Output the ID of the current thread in the loop. 389 */ 233 390 function bp_message_thread_id() { 234 391 echo bp_get_message_thread_id(); 235 392 } 393 /** 394 * Get the ID of the current thread in the loop. 395 * 396 * @return int 397 */ 236 398 function bp_get_message_thread_id() { 237 399 global $messages_template; … … 240 402 } 241 403 404 /** 405 * Output the subject of the current thread in the loop. 406 */ 242 407 function bp_message_thread_subject() { 243 408 echo bp_get_message_thread_subject(); 244 409 } 410 /** 411 * Get the subject of the current thread in the loop. 412 * 413 * @return string 414 */ 245 415 function bp_get_message_thread_subject() { 246 416 global $messages_template; … … 249 419 } 250 420 421 /** 422 * Output an excerpt from the current message in the loop. 423 */ 251 424 function bp_message_thread_excerpt() { 252 425 echo bp_get_message_thread_excerpt(); 253 426 } 427 /** 428 * Generate an excerpt from the current message in the loop. 429 * 430 * @return string 431 */ 254 432 function bp_get_message_thread_excerpt() { 255 433 global $messages_template; … … 290 468 } 291 469 470 /** 471 * Output a link to the page of the current thread's last author. 472 */ 292 473 function bp_message_thread_from() { 293 474 echo bp_get_message_thread_from(); 294 475 } 476 /** 477 * Get a link to the page of the current thread's last author. 478 * 479 * @return string 480 */ 295 481 function bp_get_message_thread_from() { 296 482 global $messages_template; … … 299 485 } 300 486 487 /** 488 * Output links to the pages of the current thread's recipients. 489 */ 301 490 function bp_message_thread_to() { 302 491 echo bp_get_message_thread_to(); 303 492 } 493 /** 494 * Generate HTML links to the pages of the current thread's recipients. 495 * 496 * @return string 497 */ 304 498 function bp_get_message_thread_to() { 305 499 global $messages_template; … … 307 501 } 308 502 503 /** 504 * Output the permalink for a particular thread. 505 * 506 * @param int $thread_id Optional. ID of the thread. Default: current thread 507 * being iterated on in the loop. 508 */ 309 509 function bp_message_thread_view_link( $thread_id = 0 ) { 310 510 echo bp_get_message_thread_view_link( $thread_id ); 311 511 } 512 /** 513 * Get the permalink of a particular thread. 514 * 515 * @param int $thread_id Optional. ID of the thread. Default: current 516 * thread being iterated on in the loop. 517 * @return string 518 */ 312 519 function bp_get_message_thread_view_link( $thread_id = 0 ) { 313 520 global $messages_template; … … 322 529 } 323 530 531 /** 532 * Output the URL for deleting the current thread. 533 */ 324 534 function bp_message_thread_delete_link() { 325 535 echo bp_get_message_thread_delete_link(); 326 536 } 537 /** 538 * Generate the URL for deleting the current thread. 539 * 540 * @return string 541 */ 327 542 function bp_get_message_thread_delete_link() { 328 543 global $messages_template, $bp; … … 330 545 } 331 546 547 /** 548 * Output the CSS class for the current thread. 549 */ 332 550 function bp_message_css_class() { 333 551 echo bp_get_message_css_class(); 334 552 } 335 553 /** 554 * Generate the CSS class for the current thread. 555 * 556 * @return string 557 */ 336 558 function bp_get_message_css_class() { 337 559 global $messages_template; … … 345 567 } 346 568 569 /** 570 * Check whether the current thread has unread items. 571 * 572 * @return bool True if there are unread items, otherwise false. 573 */ 347 574 function bp_message_thread_has_unread() { 348 575 global $messages_template; … … 354 581 } 355 582 583 /** 584 * Output the current thread's unread count. 585 */ 356 586 function bp_message_thread_unread_count() { 357 587 echo bp_get_message_thread_unread_count(); 358 588 } 589 /** 590 * Get the current thread's unread count. 591 * 592 * @return int 593 */ 359 594 function bp_get_message_thread_unread_count() { 360 595 global $messages_template; … … 366 601 } 367 602 603 /** 604 * Output the date of the last post in the current thread. 605 */ 368 606 function bp_message_thread_last_post_date() { 369 607 echo bp_get_message_thread_last_post_date(); 370 608 } 609 /** 610 * Get the date of the last post in the current thread. 611 * 612 * @return string 613 */ 371 614 function bp_get_message_thread_last_post_date() { 372 615 global $messages_template; … … 431 674 } 432 675 676 /** 677 * Output the unread messages count for the current inbox. 678 */ 433 679 function bp_total_unread_messages_count() { 434 680 echo bp_get_total_unread_messages_count(); 435 681 } 682 /** 683 * Get the unread messages count for the current inbox. 684 * 685 * @return int 686 */ 436 687 function bp_get_total_unread_messages_count() { 437 688 return apply_filters( 'bp_get_total_unread_messages_count', BP_Messages_Thread::get_inbox_count() ); 438 689 } 439 690 691 /** 692 * Output the pagination HTML for the current thread loop. 693 */ 440 694 function bp_messages_pagination() { 441 695 echo bp_get_messages_pagination(); 442 696 } 697 /** 698 * Get the pagination HTML for the current thread loop. 699 * 700 * @return string 701 */ 443 702 function bp_get_messages_pagination() { 444 703 global $messages_template; … … 446 705 } 447 706 707 /** 708 * Generate the "Viewing message x to y (of z messages)" string for a loop. 709 * 710 * @return string 711 */ 448 712 function bp_messages_pagination_count() { 449 713 global $messages_template; … … 458 722 459 723 /** 460 * Output the Private Message search form 461 * 462 * @since BuddyPress (1.6 )724 * Output the Private Message search form. 725 * 726 * @since BuddyPress (1.6.0) 463 727 */ 464 728 function bp_message_search_form() { … … 476 740 477 741 /** 478 * Echoes the form action for Messages HTML forms 479 * 480 * @package BuddyPress 742 * Echo the form action for Messages HTML forms. 481 743 */ 482 744 function bp_messages_form_action() { … … 484 746 } 485 747 /** 486 * Returns the form action for Messages HTML forms 487 * 488 * @package BuddyPress 748 * Return the form action for Messages HTML forms. 489 749 * 490 750 * @return string The form action … … 494 754 } 495 755 756 /** 757 * Output the default username for the recipient box. 758 */ 496 759 function bp_messages_username_value() { 497 760 echo bp_get_messages_username_value(); 498 761 } 762 /** 763 * Get the default username for the recipient box. 764 * 765 * @return string 766 */ 499 767 function bp_get_messages_username_value() { 500 768 if ( isset( $_COOKIE['bp_messages_send_to'] ) ) { … … 505 773 } 506 774 775 /** 776 * Output the default value for the Subject field. 777 */ 507 778 function bp_messages_subject_value() { 508 779 echo bp_get_messages_subject_value(); 509 780 } 781 /** 782 * Get the default value for the Subject field. 783 * 784 * Will get a value out of $_POST['subject'] if available (ie after a 785 * failed submission). 786 * 787 * @return string 788 */ 510 789 function bp_get_messages_subject_value() { 511 790 $subject = ''; … … 516 795 } 517 796 797 /** 798 * Output the default value for the Compose content field. 799 */ 518 800 function bp_messages_content_value() { 519 801 echo bp_get_messages_content_value(); 520 802 } 803 /** 804 * Get the default value fo the Compose content field. 805 * 806 * Will get a value out of $_POST['content'] if available (ie after a 807 * failed submission). 808 * 809 * @return string 810 */ 521 811 function bp_get_messages_content_value() { 522 812 $content = ''; … … 527 817 } 528 818 819 /** 820 * Output the markup for the message type dropdown. 821 */ 529 822 function bp_messages_options() { 530 823 ?> … … 552 845 553 846 /** 554 * Return whether or not the notice is currently active 555 * 556 * @since BuddyPress (1.6) 557 * @uses bp_get_messages_is_active_notice() 847 * Return whether or not the notice is currently active. 848 * 849 * @since BuddyPress (1.6.0) 558 850 */ 559 851 function bp_messages_is_active_notice() { … … 567 859 568 860 /** 569 * Output a string for the active notice 570 * 571 * Since 1.6 this function has been deprecated in favor of text in the theme 572 * 573 * @since BuddyPress (1.0 )574 * @deprecated BuddyPress (1.6 )861 * Output a string for the active notice. 862 * 863 * Since 1.6 this function has been deprecated in favor of text in the theme. 864 * 865 * @since BuddyPress (1.0.0) 866 * @deprecated BuddyPress (1.6.0) 575 867 * @uses bp_get_message_is_active_notice() 576 868 */ … … 579 871 } 580 872 /** 581 * Returns a string for the active notice 582 * 583 * Since 1.6 this function has been deprecated in favor of text in the theme 584 * 585 * @since BuddyPress (1.0) 586 * @deprecated BuddyPress (1.6) 873 * Returns a string for the active notice. 874 * 875 * Since 1.6 this function has been deprecated in favor of text in the 876 * theme. 877 * 878 * @since BuddyPress (1.0.0) 879 * @deprecated BuddyPress (1.6.0) 587 880 * @uses bp_messages_is_active_notice() 588 881 */ … … 596 889 } 597 890 891 /** 892 * Output the ID of the current notice in the loop. 893 */ 598 894 function bp_message_notice_id() { 599 895 echo bp_get_message_notice_id(); 600 896 } 897 /** 898 * Get the ID of the current notice in the loop. 899 * 900 * @return int 901 */ 601 902 function bp_get_message_notice_id() { 602 903 global $messages_template; … … 604 905 } 605 906 907 /** 908 * Output the post date of the current notice in the loop. 909 */ 606 910 function bp_message_notice_post_date() { 607 911 echo bp_get_message_notice_post_date(); 608 912 } 913 /** 914 * Get the post date of the current notice in the loop. 915 * 916 * @return string 917 */ 609 918 function bp_get_message_notice_post_date() { 610 919 global $messages_template; … … 612 921 } 613 922 923 /** 924 * Output the subject of the current notice in the loop. 925 */ 614 926 function bp_message_notice_subject() { 615 927 echo bp_get_message_notice_subject(); 616 928 } 929 /** 930 * Get the subject of the current notice in the loop. 931 * 932 * @return string 933 */ 617 934 function bp_get_message_notice_subject() { 618 935 global $messages_template; … … 620 937 } 621 938 939 /** 940 * Output the text of the current notice in the loop. 941 */ 622 942 function bp_message_notice_text() { 623 943 echo bp_get_message_notice_text(); 624 944 } 945 /** 946 * Get the text of the current notice in the loop. 947 * 948 * @return string 949 */ 625 950 function bp_get_message_notice_text() { 626 951 global $messages_template; … … 628 953 } 629 954 955 /** 956 * Output the URL for deleting the current notice. 957 */ 630 958 function bp_message_notice_delete_link() { 631 959 echo bp_get_message_notice_delete_link(); 632 960 } 961 /** 962 * Get the URL for deleting the current notice. 963 * 964 * @return string Delete URL. 965 */ 633 966 function bp_get_message_notice_delete_link() { 634 967 global $messages_template, $bp; … … 637 970 } 638 971 972 /** 973 * Output the URL for deactivating the current notice. 974 */ 639 975 function bp_message_activate_deactivate_link() { 640 976 echo bp_get_message_activate_deactivate_link(); 641 977 } 978 /** 979 * Get the URL for deactivating the current notice. 980 * 981 * @return string 982 */ 642 983 function bp_get_message_activate_deactivate_link() { 643 984 global $messages_template, $bp; … … 651 992 } 652 993 994 /** 995 * Output the Deactivate/Activate text for the notice action link. 996 */ 653 997 function bp_message_activate_deactivate_text() { 654 998 echo bp_get_message_activate_deactivate_text(); 655 999 } 1000 /** 1001 * Generate the text ('Deactivate' or 'Activate' for the notice action link. 1002 * 1003 * @return string 1004 */ 656 1005 function bp_get_message_activate_deactivate_text() { 657 1006 global $messages_template; … … 666 1015 667 1016 /** 668 * Output the messages component slug 669 * 670 * @package BuddyPress 671 * @subpackage Messages Template 672 * @since BuddyPress (1.5) 1017 * Output the messages component slug. 1018 * 1019 * @since BuddyPress (1.5.0) 673 1020 * 674 1021 * @uses bp_get_messages_slug() … … 678 1025 } 679 1026 /** 680 * Return the messages component slug 681 * 682 * @ package BuddyPress683 * @subpackage Messages Template684 * @ since BuddyPress (1.5)1027 * Return the messages component slug. 1028 * 1029 * @since BuddyPress (1.5.0) 1030 * 1031 * @return string 685 1032 */ 686 1033 function bp_get_messages_slug() { … … 689 1036 } 690 1037 1038 /** 1039 * Generate markup for currently active notices. 1040 */ 691 1041 function bp_message_get_notices() { 692 1042 $notice = BP_Messages_Notice::get_active(); … … 715 1065 } 716 1066 1067 /** 1068 * Output the URL for the Private Message link in member profile headers. 1069 */ 717 1070 function bp_send_private_message_link() { 718 1071 echo bp_get_send_private_message_link(); 719 1072 } 1073 /** 1074 * Generate the URL for the Private Message link in member profile headers. 1075 * 1076 * @return bool|string False on failure, otherwise the URL. 1077 */ 720 1078 function bp_get_send_private_message_link() { 721 1079 … … 727 1085 728 1086 /** 729 * bp_send_private_message_button()1087 * Output the 'Private Message' button for member profile headers. 730 1088 * 731 1089 * Explicitly named function to avoid confusion with public messages. 732 1090 * 1091 * @since BuddyPress (1.2.6) 1092 * 733 1093 * @uses bp_get_send_message_button() 734 * @since BuddyPress (1.2.6)735 1094 */ 736 1095 function bp_send_private_message_button() { … … 738 1097 } 739 1098 1099 /** 1100 * Output the 'Private Message' button for member profile headers. 1101 */ 740 1102 function bp_send_message_button() { 741 1103 echo bp_get_send_message_button(); 742 1104 } 1105 /** 1106 * Generate the 'Private Message' button for member profile headers. 1107 * 1108 * @return string 1109 */ 743 1110 function bp_get_send_message_button() { 744 1111 // Note: 'bp_get_send_message_button' is a legacy filter. Use … … 759 1126 } 760 1127 1128 /** 1129 * Output the URL of the Messages AJAX loader gif. 1130 */ 761 1131 function bp_message_loading_image_src() { 762 1132 echo bp_get_message_loading_image_src(); 763 1133 } 1134 /** 1135 * Get the URL of the Messages AJAX loader gif. 1136 * 1137 * @return string 1138 */ 764 1139 function bp_get_message_loading_image_src() { 765 1140 global $bp; … … 767 1142 } 768 1143 1144 /** 1145 * Output the markup for the message recipient tabs. 1146 */ 769 1147 function bp_message_get_recipient_tabs() { 770 1148 $recipients = explode( ' ', bp_get_message_get_recipient_usernames() ); … … 786 1164 } 787 1165 1166 /** 1167 * Output recipient usernames for prefilling the 'To' field on the Compose screen. 1168 */ 788 1169 function bp_message_get_recipient_usernames() { 789 1170 echo bp_get_message_get_recipient_usernames(); 790 1171 } 1172 /** 1173 * Get the recipient usernames for prefilling the 'To' field on the Compose screen. 1174 * 1175 * @return string 1176 */ 791 1177 function bp_get_message_get_recipient_usernames() { 792 1178 $recipients = isset( $_GET['r'] ) ? stripslashes( $_GET['r'] ) : ''; … … 796 1182 797 1183 798 /** ***************************************************************************1184 /** 799 1185 * Message Thread Template Class 800 **/ 801 1186 */ 802 1187 class BP_Messages_Thread_Template { 1188 /** 1189 * The loop iterator. 1190 * 1191 * @access public 1192 * @var int 1193 */ 803 1194 var $current_message = -1; 1195 1196 /** 1197 * Number of messages returned by the paged query. 1198 * 1199 * @access public 1200 * @var int 1201 */ 804 1202 var $message_count; 1203 1204 /** 1205 * The message object currently being iterated on. 1206 * 1207 * @access public 1208 * @var object 1209 */ 805 1210 var $message; 806 1211 1212 /** 1213 * Thread that the current messages belong to. 1214 * 1215 * @access public 1216 * @var BP_Messages_Thread 1217 */ 807 1218 var $thread; 808 1219 1220 /** 1221 * A flag for whether the loop is currently being iterated. 1222 * 1223 * @access public 1224 * @var bool 1225 */ 809 1226 var $in_the_loop; 810 1227 1228 /** 1229 * The page number being requested. 1230 * 1231 * @access public 1232 * @var int 1233 */ 811 1234 var $pag_page; 1235 1236 /** 1237 * The number of items being requested per page. 1238 * 1239 * @access public 1240 * @var int 1241 */ 812 1242 var $pag_num; 1243 1244 /** 1245 * An HTML string containing pagination links. 1246 * 1247 * @access public 1248 * @var string 1249 */ 813 1250 var $pag_links; 1251 1252 /** 1253 * The total number of messages matching the query. 1254 * 1255 * @access public 1256 * @var int 1257 */ 814 1258 var $total_message_count; 815 1259 1260 /** 1261 * Constructor method. 1262 * 1263 * @param int $thread_id ID of the message thread. 1264 * @param string $order 'ASC' or 'DESC'. 1265 */ 816 1266 function __construct( $thread_id, $order ) { 817 1267 $this->thread = new BP_Messages_Thread( $thread_id, $order ); … … 826 1276 } 827 1277 1278 /** 1279 * Whether there are messages available in the loop. 1280 * 1281 * @see bp_thread_has_messages() 1282 * 1283 * @return bool True if there are items in the loop, otherwise false. 1284 */ 828 1285 function has_messages() { 829 1286 if ( $this->message_count ) … … 833 1290 } 834 1291 1292 /** 1293 * Set up the next member and iterate index. 1294 * 1295 * @return object The next member to iterate over. 1296 */ 835 1297 function next_message() { 836 1298 $this->current_message++; … … 840 1302 } 841 1303 1304 /** 1305 * Rewind the messages and reset message index. 1306 */ 842 1307 function rewind_messages() { 843 1308 $this->current_message = -1; … … 847 1312 } 848 1313 1314 /** 1315 * Whether there are messages left in the loop to iterate over. 1316 * 1317 * This method is used by {@link bp_thread_messages()} as part of the 1318 * while loop that controls iteration inside the messages loop, eg: 1319 * while ( bp_thread_messages() ) { ... 1320 * 1321 * @see bp_thread_messages() 1322 * 1323 * @return bool True if there are more messages to show, otherwise false. 1324 */ 849 1325 function messages() { 850 1326 if ( $this->current_message + 1 < $this->message_count ) { … … 860 1336 } 861 1337 1338 /** 1339 * Set up the current message inside the loop. 1340 * 1341 * Used by {@link bp_thread_the_message()} to set up the current 1342 * message data while looping, so that template tags used during 1343 * that iteration make reference to the current message. 1344 * 1345 * @see bp_thread_the_message() 1346 */ 862 1347 function the_message() { 863 1348 $this->in_the_loop = true; … … 870 1355 } 871 1356 1357 /** 1358 * Initialize the messages template loop for a specific thread. 1359 * 1360 * @param array $args { 1361 * Array of arguments. All are optional. 1362 * @type int $thread_id ID of the thread whose messages you are displaying. 1363 * Default: if viewing a thread, the thread ID will be parsed from 1364 * the URL (bp_action_variable( 0 )). 1365 * @type string $order 'ASC' or 'DESC'. Default: 'ASC'. 1366 * } 1367 * @return bool True if there are messages to display, otherwise false. 1368 */ 872 1369 function bp_thread_has_messages( $args = '' ) { 873 1370 global $thread_template; … … 888 1385 } 889 1386 1387 /** 1388 * Output the 'ASC' or 'DESC' messages order string for this loop. 1389 */ 890 1390 function bp_thread_messages_order() { 891 1391 echo bp_get_thread_messages_order(); 892 1392 } 893 1393 /** 1394 * Get the 'ASC' or 'DESC' messages order string for this loop. 1395 * 1396 * @return string 1397 */ 894 1398 function bp_get_thread_messages_order() { 895 1399 global $thread_template; … … 897 1401 } 898 1402 1403 /** 1404 * Check whether there are more messages to iterate over. 1405 * 1406 * @return bool 1407 */ 899 1408 function bp_thread_messages() { 900 1409 global $thread_template; … … 903 1412 } 904 1413 1414 /** 1415 * Set up the current thread inside the loop. 1416 * 1417 * @return object 1418 */ 905 1419 function bp_thread_the_message() { 906 1420 global $thread_template; … … 909 1423 } 910 1424 1425 /** 1426 * Output the ID of the thread that the current loop belongs to. 1427 */ 911 1428 function bp_the_thread_id() { 912 1429 echo bp_get_the_thread_id(); 913 1430 } 1431 /** 1432 * Get the ID of the thread that the current loop belongs to. 1433 * 1434 * @return int 1435 */ 914 1436 function bp_get_the_thread_id() { 915 1437 global $thread_template; … … 918 1440 } 919 1441 1442 /** 1443 * Output the subject of the thread currently being iterated over. 1444 */ 920 1445 function bp_the_thread_subject() { 921 1446 echo bp_get_the_thread_subject(); 922 1447 } 1448 /** 1449 * Get the subject of the thread currently being iterated over. 1450 * 1451 * @return string 1452 */ 923 1453 function bp_get_the_thread_subject() { 924 1454 global $thread_template; … … 927 1457 } 928 1458 1459 /** 1460 * Output HTML links to recipients in the current thread. 1461 */ 929 1462 function bp_the_thread_recipients() { 930 1463 echo bp_get_the_thread_recipients(); 931 1464 } 1465 /** 1466 * Generate HTML links to the profiles of recipients in the current thread. 1467 * 1468 * @return string 1469 */ 932 1470 function bp_get_the_thread_recipients() { 933 1471 global $thread_template; … … 954 1492 955 1493 /** 956 * Echo es the ID of the current message in the thread957 * 958 * @since BuddyPress (1.9 )1494 * Echo the ID of the current message in the thread. 1495 * 1496 * @since BuddyPress (1.9.0) 959 1497 */ 960 1498 function bp_the_thread_message_id() { … … 962 1500 } 963 1501 /** 964 * Gets the ID of the current message in the thread 965 * 966 * @since BuddyPress (1.9) 1502 * Get the ID of the current message in the thread. 1503 * 1504 * @since BuddyPress (1.9.0) 1505 * 967 1506 * @return int 968 1507 */ … … 974 1513 } 975 1514 1515 /** 1516 * Output the CSS class used for message zebra striping. 1517 */ 976 1518 function bp_the_thread_message_alt_class() { 977 1519 echo bp_get_the_thread_message_alt_class(); 978 1520 } 1521 /** 1522 * Get the CSS class used for message zebra striping. 1523 * 1524 * @return string 1525 */ 979 1526 function bp_get_the_thread_message_alt_class() { 980 1527 global $thread_template; … … 989 1536 } 990 1537 1538 /** 1539 * Output the avatar for the current message sender. 1540 * 1541 * @param array $args See {@link bp_get_the_thread_message_sender_avatar_thumb()} 1542 * for a description. 1543 */ 991 1544 function bp_the_thread_message_sender_avatar( $args = '' ) { 992 1545 echo bp_get_the_thread_message_sender_avatar_thumb( $args ); 993 1546 } 1547 /** 1548 * Get the avatar for the current message sender. 1549 * 1550 * @param array $args { 1551 * Array of arguments. See {@link bp_core_fetch_avatar()} for more 1552 * complete details. All arguments are optional. 1553 * @type string $type Avatar type. Default: 'thumb'. 1554 * @type int $width Avatar width. Default: default for your $type. 1555 * @type int $height Avatar height. Default: default for your $type. 1556 * } 1557 * @return string <img> tag containing the avatar. 1558 */ 994 1559 function bp_get_the_thread_message_sender_avatar_thumb( $args = '' ) { 995 1560 global $thread_template; … … 1007 1572 } 1008 1573 1574 /** 1575 * Output a link to the sender of the current message. 1576 */ 1009 1577 function bp_the_thread_message_sender_link() { 1010 1578 echo bp_get_the_thread_message_sender_link(); 1011 1579 } 1580 /** 1581 * Get a link to the sender of the current message. 1582 * 1583 * @return string 1584 */ 1012 1585 function bp_get_the_thread_message_sender_link() { 1013 1586 global $thread_template; … … 1016 1589 } 1017 1590 1591 /** 1592 * Output the display name of the sender of the current message. 1593 */ 1018 1594 function bp_the_thread_message_sender_name() { 1019 1595 echo bp_get_the_thread_message_sender_name(); 1020 1596 } 1597 /** 1598 * Get the display name of the sender of the current message. 1599 * 1600 * @return string 1601 */ 1021 1602 function bp_get_the_thread_message_sender_name() { 1022 1603 global $thread_template; … … 1030 1611 } 1031 1612 1613 /** 1614 * Output the URL for deleting the current thread. 1615 */ 1032 1616 function bp_the_thread_delete_link() { 1033 1617 echo bp_get_the_thread_delete_link(); 1034 1618 } 1619 /** 1620 * Get the URL for deleting the current thread. 1621 * 1622 * @return string URL 1623 */ 1035 1624 function bp_get_the_thread_delete_link() { 1036 1625 global $bp; … … 1039 1628 } 1040 1629 1630 /** 1631 * Output the 'Sent x hours ago' string for the current message. 1632 */ 1041 1633 function bp_the_thread_message_time_since() { 1042 1634 echo bp_get_the_thread_message_time_since(); 1043 1635 } 1636 /** 1637 * Generate the 'Sent x hours ago' string for the current message. 1638 * 1639 * @return string 1640 */ 1044 1641 function bp_get_the_thread_message_time_since() { 1045 1642 global $thread_template; … … 1048 1645 } 1049 1646 1647 /** 1648 * Output the content of the current message in the loop. 1649 */ 1050 1650 function bp_the_thread_message_content() { 1051 1651 echo bp_get_the_thread_message_content(); 1052 1652 } 1653 /** 1654 * Get the content of the current message in the loop. 1655 * 1656 * @return string 1657 */ 1053 1658 function bp_get_the_thread_message_content() { 1054 1659 global $thread_template; … … 1060 1665 1061 1666 /** 1062 * Enable o embed support for Messages.1667 * Enable oEmbed support for Messages. 1063 1668 * 1064 1669 * There's no caching as BP 1.5 does not have a Messages meta API. 1065 1670 * 1671 * @since BuddyPress (1.5.0) 1672 * 1066 1673 * @see BP_Embed 1067 * @since BuddyPress (1.5)1674 * 1068 1675 * @todo Add Messages meta? 1069 1676 */ -
trunk/src/bp-messages/bp-messages-widgets.php
r7430 r8482 17 17 add_action( 'bp_register_widgets', 'bp_messages_register_widgets' ); 18 18 19 /** Sitewide Notices widget ************************************************* /19 /** Sitewide Notices widget ***************************************************/ 20 20 21 21 /**
Note: See TracChangeset
for help on using the changeset viewer.