Skip to:
Content

BuddyPress.org

Changeset 8479


Ignore:
Timestamp:
06/07/2014 06:57:23 PM (12 years ago)
Author:
boonebgorges
Message:

Improved inline documentation in bp-messages.

See #5022

Location:
trunk/src/bp-messages
Files:
4 edited

Legend:

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

    r6546 r8479  
    44 * BuddyPress Messages Actions
    55 *
    6  * Action functions are exactly the same as screen functions, however they do not
    7  * have a template screen associated with them. Usually they will send the user
    8  * back to the default screen after execution.
     6 * Action functions are exactly the same as screen functions, however they do
     7 * not have a template screen associated with them. Usually they will send the
     8 * user back to the default screen after execution.
    99 *
    1010 * @package BuddyPress
    … …  
    1515if ( !defined( 'ABSPATH' ) ) exit;
    1616
     17/**
     18 * Process a request to view a single message thread.
     19 */
    1720function messages_action_conversation() {
    1821
    … …  
    4851add_action( 'bp_actions', 'messages_action_conversation' );
    4952
     53/**
     54 * Process a request to delete a message.
     55 *
     56 * @return bool False on failure.
     57 */
    5058function messages_action_delete_message() {
    5159
    … …  
    7280add_action( 'bp_actions', 'messages_action_delete_message' );
    7381
     82/**
     83 * Process a request to bulk delete messages.
     84 *
     85 * @return bool False on failure.
     86 */
    7487function messages_action_bulk_delete() {
    7588
  • trunk/src/bp-messages/bp-messages-cache.php

    r8053 r8479  
    88 *
    99 * @package BuddyPress
    10  * @subpackage SettingsLoader
    1110 */
    1211
    … …  
    2524
    2625/**
    27  * Clears unread count cache for each recipient after a message is sent.
     26 * Clear unread count cache for each recipient after a message is sent.
    2827 *
    2928 * @since BuddyPress (2.0.0)
    … …  
    3938
    4039/**
    41  * Clears unread count cache for the logged-in user after a message is deleted.
     40 * Clear unread count cache for the logged-in user after a message is deleted.
    4241 *
    4342 * @since BuddyPress (2.0.0)
    … …  
    5251
    5352/**
    54  * Invalidates cache for notices.
    55  * 
     53 * Invalidate cache for notices.
     54 *
    5655 * Currently, invalidates active notice cache.
    5756 *
  • trunk/src/bp-messages/bp-messages-classes.php

    r8099 r8479  
    521521}
    522522
     523/**
     524 * Single message class.
     525 */
    523526class BP_Messages_Message {
     527        /**
     528         * ID of the message.
     529         *
     530         * @var int
     531         */
    524532        public $id;
     533
     534        /**
     535         * ID of the message thread.
     536         *
     537         * @var int
     538         */
    525539        public $thread_id;
     540
     541        /**
     542         * ID of the sender.
     543         *
     544         * @var int
     545         */
    526546        public $sender_id;
     547
     548        /**
     549         * Subject line of the message.
     550         *
     551         * @var string
     552         */
    527553        public $subject;
     554
     555        /**
     556         * Content of the message.
     557         *
     558         * @var string
     559         */
    528560        public $message;
     561
     562        /**
     563         * Date the message was sent.
     564         *
     565         * @var string
     566         */
    529567        public $date_sent;
    530568
     569        /**
     570         * Message recipients.
     571         *
     572         * @var bool|array
     573         */
    531574        public $recipients = false;
    532575
     576        /**
     577         * Constructor.
     578         *
     579         * @param int $id Optional. ID of the message.
     580         */
    533581        public function __construct( $id = null ) {
    534582                $this->date_sent = bp_core_current_time();
    … …  
    540588        }
    541589
     590        /**
     591         * Set up data related to a specific message object.
     592         *
     593         * @param int $id ID of the message.
     594         */
    542595        public function populate( $id ) {
    543596                global $wpdb, $bp;
    … …  
    553606        }
    554607
     608        /**
     609         * Send a message.
     610         *
     611         * @return int|bool ID of the newly created message on success, false
     612         *         on failure.
     613         */
    555614        public function send() {
    556615                global $wpdb, $bp;
    … …  
    606665        }
    607666
     667        /**
     668         * Get a list of recipients for a message.
     669         *
     670         * @return array
     671         */
    608672        public function get_recipients() {
    609673                global $bp, $wpdb;
    … …  
    611675        }
    612676
    613         /** Static Functions ******************************************************/
    614 
     677        /** Static Functions **************************************************/
     678
     679        /**
     680         * Get list of recipient IDs from their usernames.
     681         *
     682         * @param array $recipient_usernames Usernames of recipients.
     683         * @return array
     684         */
    615685        public static function get_recipient_ids( $recipient_usernames ) {
    616686                if ( !$recipient_usernames )
    … …  
    628698        }
    629699
     700        /**
     701         * Get the ID of the message last sent by the logged-in user for a given thread.
     702         *
     703         * @param int $thread_id ID of the thread.
     704         * @return int|null ID of the message if found, otherwise null.
     705         */
    630706        public static function get_last_sent_for_user( $thread_id ) {
    631707                global $wpdb, $bp;
    … …  
    633709        }
    634710
     711        /**
     712         * Check whether a user is the sender of a message.
     713         *
     714         * @param int $user_id ID of the user.
     715         * @param int $message_id ID of the message.
     716         * @return int|null Returns the ID of the message if the user is the
     717         *         sender, otherwise null.
     718         */
    635719        public static function is_user_sender( $user_id, $message_id ) {
    636720                global $wpdb, $bp;
    … …  
    638722        }
    639723
     724        /**
     725         * Get the ID of the sender of a message.
     726         *
     727         * @param int $message_id ID of the message.
     728         * @return int|null The ID of the sender if found, otherwise null.
     729         */
    640730        public static function get_message_sender( $message_id ) {
    641731                global $wpdb, $bp;
  • trunk/src/bp-messages/bp-messages-cssjs.php

    r7756 r8479  
    33/**
    44 * BuddyPress Messages CSS and JS
    5  *
    6  * Apply WordPress defined filters to private messages
    75 *
    86 * @package BuddyPress
    … …  
    1311if ( !defined( 'ABSPATH' ) ) exit;
    1412
     13/**
     14 * Enqueue the JS for messages autocomplete.
     15 */
    1516function messages_add_autocomplete_js() {
    1617
    … …  
    2930add_action( 'bp_actions', 'messages_add_autocomplete_js' );
    3031
     32/**
     33 * Enqueue the CSS for messages autocomplete.
     34 *
     35 * @todo Why do we call wp_print_styles()?
     36 */
    3137function messages_add_autocomplete_css() {
    3238
    … …  
    4046add_action( 'wp_head', 'messages_add_autocomplete_css' );
    4147
     48/**
     49 * Print inline JS for initializing the messages autocomplete.
     50 *
     51 * @todo Why is this here and not in a properly enqueued file?
     52 */
    4253function messages_autocomplete_init_jsblock() {
    4354?>
Note: See TracChangeset for help on using the changeset viewer.