Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
10/22/2015 06:12:16 AM (11 years ago)
Author:
tw2113
Message:

Second pass at Messages Component docs cleanup.

See #6403.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-messages/bp-messages-template.php

    r10248 r10304  
    108108        public function __construct( $args = array() ) {
    109109
    110                 // Backward compatibility with old method of passing arguments
     110                // Backward compatibility with old method of passing arguments.
    111111                if ( ! is_array( $args ) || func_num_args() > 1 ) {
    112112                        _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__ ) );
     
    280280                         */
    281281                        do_action( 'messages_box_loop_end' );
    282                         // Do some cleaning up after the loop
     282                        // Do some cleaning up after the loop.
    283283                        $this->rewind_threads();
    284284                }
     
    306306                        $this->thread->messages = array_reverse( (array) $this->thread->messages );
    307307
    308                         // Set up the last message data
     308                        // Set up the last message data.
    309309                        if ( count($this->thread->messages) > 1 ) {
    310310                                if ( 'inbox' == $this->box ) {
     
    333333                }
    334334
    335                 // loop has just started
     335                // Loop has just started.
    336336                if ( 0 == $this->current_thread ) {
    337337
     
    379379        global $messages_template;
    380380
    381         // The default box the user is looking at
     381        // The default box the user is looking at.
    382382        $current_action = bp_current_action();
    383383        switch ( $current_action ) {
     
    396396        $user_id = bp_loggedin_user_id();
    397397
    398         // Search Terms
     398        // Search Terms.
    399399        $search_terms = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
    400400
    401         // Parse the arguments
     401        // Parse the arguments.
    402402        $r = bp_parse_args( $args, array(
    403403                'user_id'      => $user_id,
     
    407407                'type'         => 'all',
    408408                '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.
    410410                'meta_query'   => array()
    411411        ), 'has_message_threads' );
    412412
    413         // Load the messages loop global up with messages
     413        // Load the messages loop global up with messages.
    414414        $messages_template = new BP_Messages_Box_Template( $r );
    415415
     
    542542         *
    543543         * @since 2.0.0
     544         *
    544545         * @return string The raw content of the last message in the thread.
    545546         */
     
    856857         * @param int|bool $thread_id Optional. ID of the thread.
    857858         *                            Defaults to current thread ID.
    858          *
    859859         * @return int
    860860         */
     
    897897         *
    898898         * @param int|bool $thread_id Optional. ID of the thread. Default: current thread ID.
    899          *
    900899         * @return string Markup displaying the total and unread count for the thread.
    901900         */
     
    10731072/**
    10741073 * Generate the "Viewing message x to y (of z messages)" string for a loop.
    1075  *
    1076  * @return string
    10771074 */
    10781075function bp_messages_pagination_count() {
     
    11011098function bp_message_search_form() {
    11021099
    1103         // Get the default search text
     1100        // Get the default search text.
    11041101        $default_search_value = bp_get_search_default_text( 'messages' );
    11051102
    1106         // Setup a few values based on what's being searched for
     1103        // Setup a few values based on what's being searched for.
    11071104        $search_submitted     = ! empty( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : $default_search_value;
    11081105        $search_placeholder   = ( $search_submitted === $default_search_value ) ? ' placeholder="' .  esc_attr( $search_submitted ) . '"' : '';
    11091106        $search_value         = ( $search_submitted !== $default_search_value ) ? ' value="'       .  esc_attr( $search_submitted ) . '"' : '';
    11101107
    1111         // Start the output buffer, so form can be filtered
     1108        // Start the output buffer, so form can be filtered.
    11121109        ob_start(); ?>
    11131110
     
    11201117        <?php
    11211118
    1122         // Get the search form from the above output buffer
     1119        // Get the search form from the above output buffer.
    11231120        $search_form_html = ob_get_clean();
    11241121
     
    12031200        function bp_get_messages_subject_value() {
    12041201
    1205                 // Sanitized in bp-messages-filters.php
     1202                // Sanitized in bp-messages-filters.php.
    12061203                $subject = ! empty( $_POST['subject'] )
    12071204                        ? $_POST['subject']
     
    12341231        function bp_get_messages_content_value() {
    12351232
    1236                 // Sanitized in bp-messages-filters.php
     1233                // Sanitized in bp-messages-filters.php.
    12371234                $content = ! empty( $_POST['content'] )
    12381235                        ? $_POST['content']
     
    16511648        function bp_get_send_message_button() {
    16521649                // 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.
    16541651                return apply_filters( 'bp_get_send_message_button',
    16551652
     
    17361733        function bp_get_message_get_recipient_usernames() {
    17371734
    1738                 // Sanitized in bp-messages-filters.php
     1735                // Sanitized in bp-messages-filters.php.
    17391736                $recipients = isset( $_GET['r'] )
    17401737                        ? $_GET['r']
     
    17511748        }
    17521749
    1753 
    17541750/**
    17551751 * Message Thread Template Class
     
    18251821         * @see BP_Messages_Thread::populate() for full parameter info.
    18261822         *
    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.
    18301826         */
    18311827        public function __construct( $thread_id = 0, $order = 'ASC', $args = array() ) {
     
    18931889                         */
    18941890                        do_action( 'thread_loop_end' );
    1895                         // Do some cleaning up after the loop
     1891                        // Do some cleaning up after the loop.
    18961892                        $this->rewind_messages();
    18971893                }
     
    19141910                $this->message     = $this->next_message();
    19151911
    1916                 // loop has just started
     1912                // Loop has just started.
    19171913                if ( 0 === $this->current_message ) {
    19181914
     
    19541950        }
    19551951
    1956         // Set up extra args
     1952        // Set up extra args.
    19571953        $extra_args = $r;
    19581954        unset( $extra_args['thread_id'], $extra_args['order'] );
     
    21922188                $classes = array();
    21932189
    2194                 // Zebra-striping
     2190                // Zebra-striping.
    21952191                $classes[] = bp_get_the_thread_message_alt_class();
    21962192
    2197                 // ID of the sender
     2193                // ID of the sender.
    21982194                $classes[] = 'sent-by-' . intval( $thread_template->message->sender_id );
    21992195
    2200                 // Whether the sender is the same as the logged-in user
     2196                // Whether the sender is the same as the logged-in user.
    22012197                if ( bp_loggedin_user_id() == $thread_template->message->sender_id ) {
    22022198                        $classes[] = 'sent-by-me';
     
    23252321/**
    23262322 * Output a link to the sender of the current message.
     2323 *
     2324 * @since 1.1.0
    23272325 */
    23282326function bp_the_thread_message_sender_link() {
     
    23322330         * Get a link to the sender of the current message.
    23332331         *
     2332         * @since 1.1.0
     2333         *
    23342334         * @return string
    23352335         */
     
    23492349/**
    23502350 * Output the display name of the sender of the current message.
     2351 *
     2352 * @since 1.1.0
    23512353 */
    23522354function bp_the_thread_message_sender_name() {
     
    23562358         * Get the display name of the sender of the current message.
    23572359         *
     2360         * @since 1.1.0
     2361         *
    23582362         * @return string
    23592363         */
     
    23792383/**
    23802384 * Output the URL for deleting the current thread.
     2385 *
     2386 * @since 1.5.0
    23812387 */
    23822388function bp_the_thread_delete_link() {
     
    23862392         * Get the URL for deleting the current thread.
    23872393         *
     2394         * @since 1.5.0
     2395         *
    23882396         * @return string URL
    23892397         */
     
    24032411/**
    24042412 * Output the 'Sent x hours ago' string for the current message.
     2413 *
     2414 * @since 1.1.0
    24052415 */
    24062416function bp_the_thread_message_time_since() {
     
    24102420         * Generate the 'Sent x hours ago' string for the current message.
    24112421         *
     2422         * @since 1.1.0
     2423         *
    24122424         * @return string
    24132425         */
     
    24562468/**
    24572469 * Output the content of the current message in the loop.
     2470 *
     2471 * @since 1.1.0
    24582472 */
    24592473function bp_the_thread_message_content() {
     
    24622476        /**
    24632477         * Get the content of the current message in the loop.
     2478         *
     2479         * @since 1.1.0
    24642480         *
    24652481         * @return string
     
    25052521 * @param int    $id       The ID of the message item.
    25062522 * @param string $cachekey The cache key generated in BP_Embed::parse_oembed().
    2507  *
    25082523 * @return mixed The cached embeds for this message item.
    25092524 */
     
    25232538 * @param string $cachekey The cache key generated in BP_Embed::parse_oembed().
    25242539 * @param int    $id       The ID of the message item.
    2525  *
    2526  * @return bool True on success, false on failure.
    25272540 */
    25282541function bp_embed_message_save_cache( $cache, $cachekey, $id ) {
Note: See TracChangeset for help on using the changeset viewer.