Changeset 10304 for trunk/src/bp-messages/bp-messages-template.php
- Timestamp:
- 10/22/2015 06:12:16 AM (10 years ago)
- File:
-
- 1 edited
-
trunk/src/bp-messages/bp-messages-template.php (modified) (35 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-messages/bp-messages-template.php
r10248 r10304 108 108 public function __construct( $args = array() ) { 109 109 110 // Backward compatibility with old method of passing arguments 110 // Backward compatibility with old method of passing arguments. 111 111 if ( ! is_array( $args ) || func_num_args() > 1 ) { 112 112 _deprecated_argument( __METHOD__, '2.2.0', sprintf( __( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) ); … … 280 280 */ 281 281 do_action( 'messages_box_loop_end' ); 282 // Do some cleaning up after the loop 282 // Do some cleaning up after the loop. 283 283 $this->rewind_threads(); 284 284 } … … 306 306 $this->thread->messages = array_reverse( (array) $this->thread->messages ); 307 307 308 // Set up the last message data 308 // Set up the last message data. 309 309 if ( count($this->thread->messages) > 1 ) { 310 310 if ( 'inbox' == $this->box ) { … … 333 333 } 334 334 335 // loop has just started335 // Loop has just started. 336 336 if ( 0 == $this->current_thread ) { 337 337 … … 379 379 global $messages_template; 380 380 381 // The default box the user is looking at 381 // The default box the user is looking at. 382 382 $current_action = bp_current_action(); 383 383 switch ( $current_action ) { … … 396 396 $user_id = bp_loggedin_user_id(); 397 397 398 // Search Terms 398 // Search Terms. 399 399 $search_terms = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; 400 400 401 // Parse the arguments 401 // Parse the arguments. 402 402 $r = bp_parse_args( $args, array( 403 403 'user_id' => $user_id, … … 407 407 'type' => 'all', 408 408 'search_terms' => $search_terms, 409 'page_arg' => 'mpage', // See https://buddypress.trac.wordpress.org/ticket/3679 409 'page_arg' => 'mpage', // See https://buddypress.trac.wordpress.org/ticket/3679. 410 410 'meta_query' => array() 411 411 ), 'has_message_threads' ); 412 412 413 // Load the messages loop global up with messages 413 // Load the messages loop global up with messages. 414 414 $messages_template = new BP_Messages_Box_Template( $r ); 415 415 … … 542 542 * 543 543 * @since 2.0.0 544 * 544 545 * @return string The raw content of the last message in the thread. 545 546 */ … … 856 857 * @param int|bool $thread_id Optional. ID of the thread. 857 858 * Defaults to current thread ID. 858 *859 859 * @return int 860 860 */ … … 897 897 * 898 898 * @param int|bool $thread_id Optional. ID of the thread. Default: current thread ID. 899 *900 899 * @return string Markup displaying the total and unread count for the thread. 901 900 */ … … 1073 1072 /** 1074 1073 * Generate the "Viewing message x to y (of z messages)" string for a loop. 1075 *1076 * @return string1077 1074 */ 1078 1075 function bp_messages_pagination_count() { … … 1101 1098 function bp_message_search_form() { 1102 1099 1103 // Get the default search text 1100 // Get the default search text. 1104 1101 $default_search_value = bp_get_search_default_text( 'messages' ); 1105 1102 1106 // Setup a few values based on what's being searched for 1103 // Setup a few values based on what's being searched for. 1107 1104 $search_submitted = ! empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value; 1108 1105 $search_placeholder = ( $search_submitted === $default_search_value ) ? ' placeholder="' . esc_attr( $search_submitted ) . '"' : ''; 1109 1106 $search_value = ( $search_submitted !== $default_search_value ) ? ' value="' . esc_attr( $search_submitted ) . '"' : ''; 1110 1107 1111 // Start the output buffer, so form can be filtered 1108 // Start the output buffer, so form can be filtered. 1112 1109 ob_start(); ?> 1113 1110 … … 1120 1117 <?php 1121 1118 1122 // Get the search form from the above output buffer 1119 // Get the search form from the above output buffer. 1123 1120 $search_form_html = ob_get_clean(); 1124 1121 … … 1203 1200 function bp_get_messages_subject_value() { 1204 1201 1205 // Sanitized in bp-messages-filters.php 1202 // Sanitized in bp-messages-filters.php. 1206 1203 $subject = ! empty( $_POST['subject'] ) 1207 1204 ? $_POST['subject'] … … 1234 1231 function bp_get_messages_content_value() { 1235 1232 1236 // Sanitized in bp-messages-filters.php 1233 // Sanitized in bp-messages-filters.php. 1237 1234 $content = ! empty( $_POST['content'] ) 1238 1235 ? $_POST['content'] … … 1651 1648 function bp_get_send_message_button() { 1652 1649 // Note: 'bp_get_send_message_button' is a legacy filter. Use 1653 // 'bp_get_send_message_button_args' instead. See #4536 1650 // 'bp_get_send_message_button_args' instead. See #4536. 1654 1651 return apply_filters( 'bp_get_send_message_button', 1655 1652 … … 1736 1733 function bp_get_message_get_recipient_usernames() { 1737 1734 1738 // Sanitized in bp-messages-filters.php 1735 // Sanitized in bp-messages-filters.php. 1739 1736 $recipients = isset( $_GET['r'] ) 1740 1737 ? $_GET['r'] … … 1751 1748 } 1752 1749 1753 1754 1750 /** 1755 1751 * Message Thread Template Class … … 1825 1821 * @see BP_Messages_Thread::populate() for full parameter info. 1826 1822 * 1827 * @param int $thread_id 1828 * @param string $order 1829 * @param array $args 1823 * @param int $thread_id ID of the message thread to display. 1824 * @param string $order Order to show the thread's messages in. 1825 * @param array $args Array of arguments for the query. 1830 1826 */ 1831 1827 public function __construct( $thread_id = 0, $order = 'ASC', $args = array() ) { … … 1893 1889 */ 1894 1890 do_action( 'thread_loop_end' ); 1895 // Do some cleaning up after the loop 1891 // Do some cleaning up after the loop. 1896 1892 $this->rewind_messages(); 1897 1893 } … … 1914 1910 $this->message = $this->next_message(); 1915 1911 1916 // loop has just started1912 // Loop has just started. 1917 1913 if ( 0 === $this->current_message ) { 1918 1914 … … 1954 1950 } 1955 1951 1956 // Set up extra args 1952 // Set up extra args. 1957 1953 $extra_args = $r; 1958 1954 unset( $extra_args['thread_id'], $extra_args['order'] ); … … 2192 2188 $classes = array(); 2193 2189 2194 // Zebra-striping 2190 // Zebra-striping. 2195 2191 $classes[] = bp_get_the_thread_message_alt_class(); 2196 2192 2197 // ID of the sender 2193 // ID of the sender. 2198 2194 $classes[] = 'sent-by-' . intval( $thread_template->message->sender_id ); 2199 2195 2200 // Whether the sender is the same as the logged-in user 2196 // Whether the sender is the same as the logged-in user. 2201 2197 if ( bp_loggedin_user_id() == $thread_template->message->sender_id ) { 2202 2198 $classes[] = 'sent-by-me'; … … 2325 2321 /** 2326 2322 * Output a link to the sender of the current message. 2323 * 2324 * @since 1.1.0 2327 2325 */ 2328 2326 function bp_the_thread_message_sender_link() { … … 2332 2330 * Get a link to the sender of the current message. 2333 2331 * 2332 * @since 1.1.0 2333 * 2334 2334 * @return string 2335 2335 */ … … 2349 2349 /** 2350 2350 * Output the display name of the sender of the current message. 2351 * 2352 * @since 1.1.0 2351 2353 */ 2352 2354 function bp_the_thread_message_sender_name() { … … 2356 2358 * Get the display name of the sender of the current message. 2357 2359 * 2360 * @since 1.1.0 2361 * 2358 2362 * @return string 2359 2363 */ … … 2379 2383 /** 2380 2384 * Output the URL for deleting the current thread. 2385 * 2386 * @since 1.5.0 2381 2387 */ 2382 2388 function bp_the_thread_delete_link() { … … 2386 2392 * Get the URL for deleting the current thread. 2387 2393 * 2394 * @since 1.5.0 2395 * 2388 2396 * @return string URL 2389 2397 */ … … 2403 2411 /** 2404 2412 * Output the 'Sent x hours ago' string for the current message. 2413 * 2414 * @since 1.1.0 2405 2415 */ 2406 2416 function bp_the_thread_message_time_since() { … … 2410 2420 * Generate the 'Sent x hours ago' string for the current message. 2411 2421 * 2422 * @since 1.1.0 2423 * 2412 2424 * @return string 2413 2425 */ … … 2456 2468 /** 2457 2469 * Output the content of the current message in the loop. 2470 * 2471 * @since 1.1.0 2458 2472 */ 2459 2473 function bp_the_thread_message_content() { … … 2462 2476 /** 2463 2477 * Get the content of the current message in the loop. 2478 * 2479 * @since 1.1.0 2464 2480 * 2465 2481 * @return string … … 2505 2521 * @param int $id The ID of the message item. 2506 2522 * @param string $cachekey The cache key generated in BP_Embed::parse_oembed(). 2507 *2508 2523 * @return mixed The cached embeds for this message item. 2509 2524 */ … … 2523 2538 * @param string $cachekey The cache key generated in BP_Embed::parse_oembed(). 2524 2539 * @param int $id The ID of the message item. 2525 *2526 * @return bool True on success, false on failure.2527 2540 */ 2528 2541 function bp_embed_message_save_cache( $cache, $cachekey, $id ) {
Note: See TracChangeset
for help on using the changeset viewer.