Skip to:
Content

BuddyPress.org

Changeset 10303


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

More docs cleanup for Notifications component.

See #6404.

Location:
trunk/src/bp-notifications
Files:
8 edited

Legend:

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

    r10138 r10303  
    2323function bp_notifications_action_mark_read() {
    2424
    25         // Bail if not the unread screen
     25        // Bail if not the unread screen.
    2626        if ( ! bp_is_notifications_component() || ! bp_is_current_action( 'unread' ) ) {
    2727                return false;
    2828        }
    2929
    30         // Get the action
     30        // Get the action.
    3131        $action = !empty( $_GET['action']          ) ? $_GET['action']          : '';
    3232        $nonce  = !empty( $_GET['_wpnonce']        ) ? $_GET['_wpnonce']        : '';
    3333        $id     = !empty( $_GET['notification_id'] ) ? $_GET['notification_id'] : '';
    3434
    35         // Bail if no action or no ID
     35        // Bail if no action or no ID.
    3636        if ( ( 'read' !== $action ) || empty( $id ) || empty( $nonce ) ) {
    3737                return false;
    3838        }
    3939
    40         // Check the nonce and mark the notification
     40        // Check the nonce and mark the notification.
    4141        if ( bp_verify_nonce_request( 'bp_notification_mark_read_' . $id ) && bp_notifications_mark_notification( $id, false ) ) {
    4242                bp_core_add_message( __( 'Notification successfully marked read.',         'buddypress' )          );
    … …  
    4545        }
    4646
    47         // Redirect
     47        // Redirect.
    4848        bp_core_redirect( bp_displayed_user_domain() . bp_get_notifications_slug() . '/unread/' );
    4949}
    … …  
    5959function bp_notifications_action_mark_unread() {
    6060
    61         // Bail if not the read screen
     61        // Bail if not the read screen.
    6262        if ( ! bp_is_notifications_component() || ! bp_is_current_action( 'read' ) ) {
    6363                return false;
    6464        }
    6565
    66         // Get the action
     66        // Get the action.
    6767        $action = !empty( $_GET['action']          ) ? $_GET['action']          : '';
    6868        $nonce  = !empty( $_GET['_wpnonce']        ) ? $_GET['_wpnonce']        : '';
    6969        $id     = !empty( $_GET['notification_id'] ) ? $_GET['notification_id'] : '';
    7070
    71         // Bail if no action or no ID
     71        // Bail if no action or no ID.
    7272        if ( ( 'unread' !== $action ) || empty( $id ) || empty( $nonce ) ) {
    7373                return false;
    7474        }
    7575
    76         // Check the nonce and mark the notification
     76        // Check the nonce and mark the notification.
    7777        if ( bp_verify_nonce_request( 'bp_notification_mark_unread_' . $id ) && bp_notifications_mark_notification( $id, true ) ) {
    7878                bp_core_add_message( __( 'Notification successfully marked unread.',       'buddypress' )          );
    … …  
    8181        }
    8282
    83         // Redirect
     83        // Redirect.
    8484        bp_core_redirect( bp_displayed_user_domain() . bp_get_notifications_slug() . '/read/' );
    8585}
    … …  
    9595function bp_notifications_action_delete() {
    9696
    97         // Bail if not the read or unread screen
     97        // Bail if not the read or unread screen.
    9898        if ( ! bp_is_notifications_component() || ! ( bp_is_current_action( 'read' ) || bp_is_current_action( 'unread' ) ) ) {
    9999                return false;
    100100        }
    101101
    102         // Get the action
     102        // Get the action.
    103103        $action = !empty( $_GET['action']          ) ? $_GET['action']          : '';
    104104        $nonce  = !empty( $_GET['_wpnonce']        ) ? $_GET['_wpnonce']        : '';
    105105        $id     = !empty( $_GET['notification_id'] ) ? $_GET['notification_id'] : '';
    106106
    107         // Bail if no action or no ID
     107        // Bail if no action or no ID.
    108108        if ( ( 'delete' !== $action ) || empty( $id ) || empty( $nonce ) ) {
    109109                return false;
    110110        }
    111111
    112         // Check the nonce and delete the notification
     112        // Check the nonce and delete the notification.
    113113        if ( bp_verify_nonce_request( 'bp_notification_delete_' . $id ) && bp_notifications_delete_notification( $id ) ) {
    114114                bp_core_add_message( __( 'Notification successfully deleted.',              'buddypress' )          );
    … …  
    117117        }
    118118
    119         // Redirect
     119        // Redirect.
    120120        bp_core_redirect( bp_displayed_user_domain() . bp_get_notifications_slug() . '/' . bp_current_action() . '/' );
    121121}
    … …  
    136136        }
    137137
    138         // Get the action
     138        // Get the action.
    139139        $action = !empty( $_POST['notification_bulk_action'] ) ? $_POST['notification_bulk_action'] : '';
    140140        $nonce  = !empty( $_POST['notifications_bulk_nonce'] ) ? $_POST['notifications_bulk_nonce'] : '';
    … …  
    178178        }
    179179
    180         // Redirect
     180        // Redirect.
    181181        bp_core_redirect( bp_displayed_user_domain() . bp_get_notifications_slug() . '/' . bp_current_action() . '/' );
    182182}
  • trunk/src/bp-notifications/bp-notifications-adminbar.php

    r10138 r10303  
    3232        $menu_link     = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() );
    3333
    34         // Add the top-level Notifications button
     34        // Add the top-level Notifications button.
    3535        $wp_admin_bar->add_menu( array(
    3636                'parent'    => 'top-secondary',
  • trunk/src/bp-notifications/bp-notifications-cache.php

    r10138 r10303  
    33 * Functions related to notifications caching.
    44 *
    5  * @since 2.0.0
    6  *
    75 * @package BuddyPress
    86 * @subpackage NotificationsCache
     7 * @since 2.0.0
    98 */
    109
    … …  
    6867function bp_notifications_clear_all_for_user_cache_before_delete( $args ) {
    6968
    70         // Pull up a list of items matching the args (those about te be deleted)
     69        // Pull up a list of items matching the args (those about te be deleted).
    7170        $ns = BP_Notifications_Notification::get( $args );
    7271
    … …  
    9392function bp_notifications_clear_all_for_user_cache_before_update( $update_args, $where_args ) {
    9493
    95         // User ID is passed in where arugments
     94        // User ID is passed in where arugments.
    9695        if ( ! empty( $where_args['user_id'] ) ) {
    9796                bp_notifications_clear_all_for_user_cache( $where_args['user_id'] );
    9897
    99         // Get user ID from Notification ID
     98        // Get user ID from Notification ID.
    10099        } elseif ( ! empty( $where_args['id'] ) ) {
    101100                $n = bp_notifications_get_notification( $where_args['id'] );
  • trunk/src/bp-notifications/bp-notifications-classes.php

    r10138 r10303  
    77 * @package BuddyPress
    88 * @subpackage NotificationsClasses
    9  *
    109 * @since 1.9.0
    1110 */
  • trunk/src/bp-notifications/bp-notifications-functions.php

    r10284 r10303  
    3030 * }
    3131 * @return int|bool ID of the newly created notification on success, false
    32  *         on failure.
     32 *                  on failure.
    3333 */
    3434function bp_notifications_add_notification( $args = array() ) {
    … …  
    4545        ), 'notifications_add_notification' );;
    4646
    47         // Check for existing duplicate notifications
     47        // Check for existing duplicate notifications.
    4848        if ( ! $r['allow_duplicate'] ) {
    49                 // date_notified, allow_duplicate don't count toward
    50                 // duplicate status
     49                // Date_notified, allow_duplicate don't count toward
     50                // duplicate status.
    5151                $existing = BP_Notifications_Notification::get( array(
    5252                        'user_id'           => $r['user_id'],
    … …  
    6363        }
    6464
    65         // Setup the new notification
     65        // Setup the new notification.
    6666        $notification                    = new BP_Notifications_Notification;
    6767        $notification->user_id           = $r['user_id'];
    … …  
    7373        $notification->is_new            = $r['is_new'];
    7474
    75         // Save the new notification
     75        // Save the new notification.
    7676        return $notification->save();
    7777}
    … …  
    8383 *
    8484 * @param int $id ID of the notification.
    85  *
    86  * @return BP_Notifications_Notification
     85 * @return BP_Notifications_Notification Notification object for ID specified.
    8786 */
    8887function bp_notifications_get_notification( $id ) {
    … …  
    9695 *
    9796 * @param int $id ID of the notification to delete.
    98  *
    9997 * @return bool True on success, false on failure.
    10098 */
    … …  
    116114 * @param int      $id     ID of the notification.
    117115 * @param int|bool $is_new 0 for read, 1 for unread.
    118  *
    119116 * @return bool True on success, false on failure.
    120117 */
    … …  
    136133 *
    137134 * @param int $user_id ID of the user whose notifications are being fetched.
    138  *
    139  * @return array
     135 * @return array $notifications Array of notifications for user.
    140136 */
    141137function bp_notifications_get_all_notifications_for_user( $user_id = 0 ) {
    142138
    143         // Default to displayed user if no ID is passed
     139        // Default to displayed user if no ID is passed.
    144140        if ( empty( $user_id ) ) {
    145141                $user_id = ( bp_displayed_user_id() ) ? bp_displayed_user_id() : bp_loggedin_user_id();
    146142        }
    147143
    148         // Get notifications out of the cache, or query if necessary
     144        // Get notifications out of the cache, or query if necessary.
    149145        $notifications = wp_cache_get( 'all_for_user_' . $user_id, 'bp_notifications' );
    150146        if ( false === $notifications ) {
    … …  
    174170 * @param string $format  Format of the returned values. 'string' returns HTML,
    175171 *                        while 'object' returns a structured object for parsing.
    176  *
    177172 * @return mixed Object or array on success, false on failure.
    178173 */
    179174function bp_notifications_get_notifications_for_user( $user_id, $format = 'string' ) {
    180175
    181         // Setup local variables
     176        // Setup local variables.
    182177        $bp = buddypress();
    183178
    184         // Get notifications (out of the cache, or query if necessary)
     179        // Get notifications (out of the cache, or query if necessary).
    185180        $notifications         = bp_notifications_get_all_notifications_for_user( $user_id );
    186         $grouped_notifications = array(); // Notification groups
    187         $renderable            = array(); // Renderable notifications
    188 
    189         // Group notifications by component and component_action and provide totals
     181        $grouped_notifications = array(); // Notification groups.
     182        $renderable            = array(); // Renderable notifications.
     183
     184        // Group notifications by component and component_action and provide totals.
    190185        for ( $i = 0, $count = count( $notifications ); $i < $count; ++$i ) {
    191186                $notification = $notifications[$i];
    … …  
    193188        }
    194189
    195         // Bail if no notification groups
     190        // Bail if no notification groups.
    196191        if ( empty( $grouped_notifications ) ) {
    197192                return false;
    198193        }
    199194
    200         // Calculate a renderable output for each notification type
     195        // Calculate a renderable output for each notification type.
    201196        foreach ( $grouped_notifications as $component_name => $action_arrays ) {
    202197
    … …  
    209204                }
    210205
    211                 // Skip if group is empty
     206                // Skip if group is empty.
    212207                if ( empty( $action_arrays ) ) {
    213208                        continue;
    214209                }
    215210
    216                 // Loop through each actionable item and try to map it to a component
     211                // Loop through each actionable item and try to map it to a component.
    217212                foreach ( (array) $action_arrays as $component_action_name => $component_action_items ) {
    218213
    219                         // Get the number of actionable items
     214                        // Get the number of actionable items.
    220215                        $action_item_count = count( $component_action_items );
    221216
    222                         // Skip if the count is less than 1
     217                        // Skip if the count is less than 1.
    223218                        if ( $action_item_count < 1 ) {
    224219                                continue;
    225220                        }
    226221
    227                         // Callback function exists
     222                        // Callback function exists.
    228223                        if ( isset( $bp->{$component_name}->notification_callback ) && is_callable( $bp->{$component_name}->notification_callback ) ) {
    229224
    230                                 // Function should return an object
     225                                // Function should return an object.
    231226                                if ( 'object' === $format ) {
    232227
    233                                         // Retrieve the content of the notification using the callback
     228                                        // Retrieve the content of the notification using the callback.
    234229                                        $content = call_user_func(
    235230                                                $bp->{$component_name}->notification_callback,
    … …  
    241236                                        );
    242237
    243                                         // Create the object to be returned
     238                                        // Create the object to be returned.
    244239                                        $notification_object = $component_action_items[0];
    245240
    246241                                        // Minimal backpat with non-compatible notification
    247                                         // callback functions
     242                                        // callback functions.
    248243                                        if ( is_string( $content ) ) {
    249244                                                $notification_object->content = $content;
    … …  
    256251                                        $renderable[] = $notification_object;
    257252
    258                                 // Return an array of content strings
     253                                // Return an array of content strings.
    259254                                } else {
    260255                                        $content      = call_user_func( $bp->{$component_name}->notification_callback, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count );
    … …  
    266261                                $renderable[] = call_user_func( $bp->{$component_name}->format_notification_function, $component_action_name, $component_action_items[0]->item_id, $component_action_items[0]->secondary_item_id, $action_item_count );
    267262
    268                         // Allow non BuddyPress components to hook in
     263                        // Allow non BuddyPress components to hook in.
    269264                        } else {
    270265
    271                                 // The array to reference with apply_filters_ref_array()
     266                                // The array to reference with apply_filters_ref_array().
    272267                                $ref_array = array(
    273268                                        $component_action_name,
    … …  
    278273                                );
    279274
    280                                 // Function should return an object
     275                                // Function should return an object.
    281276                                if ( 'object' === $format ) {
    282277
    … …  
    290285                                        $content = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', $ref_array );
    291286
    292                                         // Create the object to be returned
     287                                        // Create the object to be returned.
    293288                                        $notification_object = $component_action_items[0];
    294289
    295290                                        // Minimal backpat with non-compatible notification
    296                                         // callback functions
     291                                        // callback functions.
    297292                                        if ( is_string( $content ) ) {
    298293                                                $notification_object->content = $content;
    … …  
    305300                                        $renderable[] = $notification_object;
    306301
    307                                 // Return an array of content strings
     302                                // Return an array of content strings.
    308303                                } else {
    309304
    … …  
    315310        }
    316311
    317         // If renderable is empty array, set to false
     312        // If renderable is empty array, set to false.
    318313        if ( empty( $renderable ) ) {
    319314                $renderable = false;
    … …  
    345340 * @param string $component_name   Name of the associated component.
    346341 * @param string $component_action Name of the associated action.
    347  *
    348342 * @return bool True on success, false on failure.
    349343 */
    … …  
    369363 * @param string   $component_action  Name of the associated action.
    370364 * @param int|bool $secondary_item_id ID of the secondary associated item.
    371  *
    372365 * @return bool True on success, false on failure.
    373366 */
    … …  
    393386 * @param string|bool $component_action  Optional. Name of the associated action.
    394387 * @param int|bool    $secondary_item_id Optional. ID of the secondary associated item.
    395  *
    396388 * @return bool True on success, false on failure.
    397389 */
    … …  
    419411 * @param string $component_name   Name of the associated component.
    420412 * @param string $component_action Name of the associated action.
    421  *
    422413 * @return bool True on success, false on failure.
    423414 */
    … …  
    444435 * @param string   $component_action Name of the associated action.
    445436 * @param int|bool $is_new           0 for read, 1 for unread.
    446  *
    447437 * @return bool True on success, false on failure.
    448438 */
    … …  
    474464 * @param int|bool $secondary_item_id ID of the secondary associated item.
    475465 * @param int|bool $is_new            0 for read, 1 for unread.
    476  *
    477466 * @return bool True on success, false on failure.
    478467 */
    … …  
    504493 * @param int|bool    $secondary_item_id Optional. ID of the secondary associated item.
    505494 * @param int|bool    $is_new            0 for read, 1 for unread.
    506  *
    507495 * @return bool True on success, false on failure.
    508496 */
    … …  
    536524 * @param string   $component_action Name of the associated action.
    537525 * @param int|bool $is_new           0 for read, 1 for unread.
    538  *
    539526 * @return bool True on success, false on failure.
    540527 */
    … …  
    563550 * @param int $user_id         ID of the user being checked.
    564551 * @param int $notification_id ID of the notification being checked.
    565  *
    566552 * @return bool True if the notification belongs to the user, otherwise false.
    567553 */
    … …  
    577563 * @param int $user_id ID of the user whose unread notifications are being
    578564 *                     counted.
    579  *
    580565 * @return int Unread notification count.
    581566 */
    … …  
    602587 * @see http://buddypress.trac.wordpress.org/ticket/5300
    603588 *
    604  * @return array
     589 * @return array $component_names Array of registered components.
    605590 */
    606591function bp_notifications_get_registered_components() {
    607592
    608         // Load BuddyPress
     593        // Load BuddyPress.
    609594        $bp = buddypress();
    610595
    611         // Setup return value
     596        // Setup return value.
    612597        $component_names = array();
    613598
    614         // Get the active components
     599        // Get the active components.
    615600        $active_components = array_keys( $bp->active_components );
    616601
    617         // Loop through components, look for callbacks, add to return value
     602        // Loop through components, look for callbacks, add to return value.
    618603        foreach ( $active_components as $component ) {
    619604                if ( !empty( $bp->$component->notification_callback ) ) {
    … …  
    654639 *                                deleted if the meta_value matches this parameter.
    655640 * @param bool   $delete_all      Optional. If true, delete matching metadata entries
    656  *                                    for all objects, ignoring the specified object_id. Otherwise,
    657  *                                    only delete matching metadata entries for the specified
    658  *                                    notification item. Default: false.
    659  *
     641 *                                for all objects, ignoring the specified object_id. Otherwise,
     642 *                                only delete matching metadata entries for the specified
     643 *                                notification item. Default: false.
    660644 * @return bool                   True on success, false on failure.
    661645 */
    662646function bp_notifications_delete_meta( $notification_id, $meta_key = '', $meta_value = '', $delete_all = false ) {
    663647
    664         // Legacy - if no meta_key is passed, delete all for the item
     648        // Legacy - if no meta_key is passed, delete all for the item.
    665649        if ( empty( $meta_key ) ) {
    666650                $all_meta = bp_notifications_get_meta( $notification_id );
    … …  
    669653                        : array();
    670654
    671                 // With no meta_key, ignore $delete_all
     655                // With no meta_key, ignore $delete_all.
    672656                $delete_all = false;
    673657        } else {
    … …  
    698682 *                                notification item will be fetched.
    699683 * @param bool   $single          Optional. If true, return only the first value of the
    700  *                                    specified meta_key. This parameter has no effect if meta_key is not
    701  *                                    specified. Default: true.
    702  *
     684 *                                specified meta_key. This parameter has no effect if meta_key is not
     685 *                                specified. Default: true.
    703686 * @return mixed                  The meta value(s) being requested.
    704687 */
    … …  
    733716 *                                 metadata entries with the specified value.
    734717 *                                 Otherwise, update all entries.
    735  *
    736718 * @return bool|int                Returns false on failure. On successful
    737719 *                                 update of existing metadata, returns true. On
    … …  
    758740 *                                for the given key. If true, and the object already has a value for
    759741 *                                the key, no change will be made. Default: false.
    760  *
    761742 * @return int|bool               The meta ID on successful update, false on failure.
    762743 */
  • trunk/src/bp-notifications/bp-notifications-loader.php

    r10138 r10303  
    1313defined( 'ABSPATH' ) || exit;
    1414
     15/**
     16 * Extends the component class to set up the Notifications component.
     17 */
    1518class BP_Notifications_Component extends BP_Component {
    1619
    … …  
    6669                $bp = buddypress();
    6770
    68                 // Define a slug, if necessary
     71                // Define a slug, if necessary.
    6972                if ( ! defined( 'BP_NOTIFICATIONS_SLUG' ) ) {
    7073                        define( 'BP_NOTIFICATIONS_SLUG', $this->id );
    7174                }
    7275
    73                 // Global tables for the notifications component
     76                // Global tables for the notifications component.
    7477                $global_tables = array(
    7578                        'table_name'      => $bp->table_prefix . 'bp_notifications',
    … …  
    103106        public function setup_nav( $main_nav = array(), $sub_nav = array() ) {
    104107
    105                 // Determine user to use
     108                // Determine user to use.
    106109                if ( bp_displayed_user_domain() ) {
    107110                        $user_domain = bp_displayed_user_domain();
    … …  
    116119                $notifications_link = trailingslashit( $user_domain . $slug );
    117120
    118                 // Only grab count if we're on a user page and current user has access
     121                // Only grab count if we're on a user page and current user has access.
    119122                if ( bp_is_user() && bp_user_has_access() ) {
    120123                        $count    = bp_notifications_get_unread_notification_count( bp_displayed_user_id() );
    … …  
    125128                }
    126129
    127                 // Add 'Notifications' to the main navigation
     130                // Add 'Notifications' to the main navigation.
    128131                $main_nav = array(
    129132                        'name'                    => $nav_name,
    … …  
    136139                );
    137140
    138                 // Add the subnav items to the notifications nav item
     141                // Add the subnav items to the notifications nav item.
    139142                $sub_nav[] = array(
    140143                        'name'            => _x( 'Unread', 'Notification screen nav', 'buddypress' ),
    … …  
    174177        public function setup_admin_bar( $wp_admin_nav = array() ) {
    175178
    176                 // Menus for logged in user
     179                // Menus for logged in user.
    177180                if ( is_user_logged_in() ) {
    178181
    179                         // Setup the logged in user variables
     182                        // Setup the logged in user variables.
    180183                        $notifications_link = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() );
    181184
    182                         // Pending notification requests
     185                        // Pending notification requests.
    183186                        $count = bp_notifications_get_unread_notification_count( bp_loggedin_user_id() );
    184187                        if ( ! empty( $count ) ) {
    … …  
    190193                        }
    191194
    192                         // Add the "My Account" sub menus
     195                        // Add the "My Account" sub menus.
    193196                        $wp_admin_nav[] = array(
    194197                                'parent' => buddypress()->my_account_menu_id,
    … …  
    198201                        );
    199202
    200                         // Unread
     203                        // Unread.
    201204                        $wp_admin_nav[] = array(
    202205                                'parent' => 'my-account-' . $this->id,
    … …  
    206209                        );
    207210
    208                         // Read
     211                        // Read.
    209212                        $wp_admin_nav[] = array(
    210213                                'parent' => 'my-account-' . $this->id,
    … …  
    225228        public function setup_title() {
    226229
    227                 // Adjust title
     230                // Adjust title.
    228231                if ( bp_is_notifications_component() ) {
    229232                        $bp = buddypress();
    … …  
    251254        public function setup_cache_groups() {
    252255
    253                 // Global groups
     256                // Global groups.
    254257                wp_cache_add_global_groups( array(
    255258                        'bp_notifications',
  • trunk/src/bp-notifications/bp-notifications-template.php

    r10248 r10303  
    266266        public function __construct( $args = array() ) {
    267267
    268                 // Parse arguments
     268                // Parse arguments.
    269269                $r = wp_parse_args( $args, array(
    270270                        'id'                => false,
    … …  
    286286                ) );
    287287
    288                 // Overrides
    289 
    290                 // Sort order direction
     288                // Sort order direction.
    291289                $orders = array( 'ASC', 'DESC' );
    292290                if ( ! empty( $_GET['sort_order'] ) && in_array( $_GET['sort_order'], $orders ) ) {
    … …  
    296294                }
    297295
    298                 // Setup variables
     296                // Setup variables.
    299297                $this->pag_arg      = sanitize_key( $r['page_arg'] );
    300298                $this->pag_page     = bp_sanitize_pagination_arg( $this->pag_arg, $r['page']     );
    … …  
    322320                );
    323321
    324                 // Setup the notifications to loop through
     322                // Setup the notifications to loop through.
    325323                $this->notifications            = BP_Notifications_Notification::get( $this->query_vars );
    326324                $this->total_notification_count = BP_Notifications_Notification::get_total_count( $this->query_vars );
    … …  
    457455                $this->notification = $this->next_notification();
    458456
    459                 // loop has just started
     457                // Loop has just started.
    460458                if ( 0 === $this->current_notification ) {
    461459
    … …  
    492490 *                            Default: 'npage'.
    493491 * }
    494  *
    495492 * @return bool
    496493 */
    497494function bp_has_notifications( $args = '' ) {
    498495
    499         // Get the default is_new argument
     496        // Get the default is_new argument.
    500497        if ( bp_is_current_action( 'unread' ) ) {
    501498                $is_new = 1;
    … …  
    503500                $is_new = 0;
    504501
    505         // not on a notifications page? default to fetch new notifications
     502        // Not on a notifications page? default to fetch new notifications.
    506503        } else {
    507504                $is_new = 1;
    508505        }
    509506
    510         // Get the user ID
     507        // Get the user ID.
    511508        if ( bp_displayed_user_id() ) {
    512509                $user_id = bp_displayed_user_id();
    … …  
    515512        }
    516513
    517         // Parse the args
     514        // Parse the args.
    518515        $r = bp_parse_args( $args, array(
    519516                'id'                => false,
    … …  
    531528                'per_page'          => 25,
    532529
    533                 // these are additional arguments that are not available in
    534                 // BP_Notifications_Notification::get()
     530                // These are additional arguments that are not available in
     531                // BP_Notifications_Notification::get().
    535532                'max'               => false,
    536533                'page_arg'          => 'npage',
    537534        ), 'has_notifications' );
    538535
    539         // Get the notifications
     536        // Get the notifications.
    540537        $query_loop = new BP_Notifications_Template( $r );
    541538
    542         // Setup the global query loop
     539        // Setup the global query loop.
    543540        buddypress()->notifications->query_loop = $query_loop;
    544541
    … …  
    757754        function bp_get_the_notification_time_since() {
    758755
    759                 // Get the notified date
     756                // Get the notified date.
    760757                $date_notified = bp_get_the_notification_date_notified();
    761758
    762                 // Notified date has legitimate data
     759                // Notified date has legitimate data.
    763760                if ( '0000-00-00 00:00:00' !== $date_notified ) {
    764761                        $retval = bp_core_time_since( $date_notified );
    765762
    766                 // Notified date is empty, so return a fun string
     763                // Notified date is empty, so return a fun string.
    767764                } else {
    768765                        $retval = __( 'Date not found', 'buddypress' );
    … …  
    799796                $notification = $bp->notifications->query_loop->notification;
    800797
    801                 // Callback function exists
     798                // Callback function exists.
    802799                if ( isset( $bp->{ $notification->component_name }->notification_callback ) && is_callable( $bp->{ $notification->component_name }->notification_callback ) ) {
    803800                        $description = call_user_func( $bp->{ $notification->component_name }->notification_callback, $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 );
    … …  
    807804                        $description = call_user_func( $bp->{ $notification->component_name }->format_notification_function, $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 );
    808805
    809                 // Allow non BuddyPress components to hook in
     806                // Allow non BuddyPress components to hook in.
    810807                } else {
    811808
    … …  
    843840        function bp_get_the_notification_mark_read_link() {
    844841
    845                 // Start the output buffer
     842                // Start the output buffer.
    846843                ob_start(); ?>
    847844
    … …  
    874871        /**
    875872         * Return the URL used for marking a single notification as read.
    876          *
     873         *
    877874         * @since 2.1.0
    878875         */
    879876        function bp_get_the_notification_mark_read_url() {
    880877
    881                 // Get the notification ID
     878                // Get the notification ID.
    882879                $id   = bp_get_the_notification_id();
    883880
    884                 // Get the args to add to the URL
     881                // Get the args to add to the URL.
    885882                $args = array(
    886883                        'action'          => 'read',
    … …  
    888885                );
    889886
    890                 // Add the args to the URL
     887                // Add the args to the URL.
    891888                $url = add_query_arg( $args, bp_get_notifications_unread_permalink() );
    892889
    893                 // Add the nonce
     890                // Add the nonce.
    894891                $url = wp_nonce_url( $url, 'bp_notification_mark_read_' . $id );
    895892
    … …  
    921918        function bp_get_the_notification_mark_unread_link() {
    922919
    923                 // Start the output buffer
     920                // Start the output buffer.
    924921                ob_start(); ?>
    925922
    … …  
    952949        /**
    953950         * Return the URL used for marking a single notification as unread.
    954          *
     951         *
    955952         * @since 2.1.0
    956953         */
    957954        function bp_get_the_notification_mark_unread_url() {
    958955
    959                 // Get the notification ID
     956                // Get the notification ID.
    960957                $id   = bp_get_the_notification_id();
    961958
    962                 // Get the args to add to the URL
     959                // Get the args to add to the URL.
    963960                $args = array(
    964961                        'action'          => 'unread',
    … …  
    966963                );
    967964
    968                 // Add the args to the URL
     965                // Add the args to the URL.
    969966                $url = add_query_arg( $args, bp_get_notifications_read_permalink() );
    970967
    971                 // Add the nonce
     968                // Add the nonce.
    972969                $url = wp_nonce_url( $url, 'bp_notification_mark_unread_' . $id );
    973970
    … …  
    10321029        function bp_get_the_notification_delete_link() {
    10331030
    1034                 // Start the output buffer
     1031                // Start the output buffer.
    10351032                ob_start(); ?>
    10361033
    … …  
    10711068        function bp_get_the_notification_delete_url() {
    10721069
    1073                 // URL to add nonce to
     1070                // URL to add nonce to.
    10741071                if ( bp_is_current_action( 'unread' ) ) {
    10751072                        $link = bp_get_notifications_unread_permalink();
    … …  
    10781075                }
    10791076
    1080                 // Get the ID
     1077                // Get the ID.
    10811078                $id = bp_get_the_notification_id();
    10821079
    1083                 // Get the args to add to the URL
     1080                // Get the args to add to the URL.
    10841081                $args = array(
    10851082                        'action'          => 'delete',
    … …  
    10871084                );
    10881085
    1089                 // Add the args
     1086                // Add the args.
    10901087                $url = add_query_arg( $args, $link );
    10911088
    1092                 // Add the nonce
     1089                // Add the nonce.
    10931090                $url = wp_nonce_url( $url, 'bp_notification_delete_' . $id );
    10941091
    … …  
    11061103 * Output the action links for the current notification.
    11071104 *
     1105 * @since 1.9.0
     1106 *
    11081107 * @param array|string $args Array of arguments.
    1109  * @since 1.9.0
    11101108 */
    11111109function bp_the_notification_action_links( $args = '' ) {
    … …  
    11231121         *     @type array  $links  Array of links to implode by 'sep'.
    11241122         * }
    1125          *
    11261123         * @return string HTML links for actions to take on single notifications.
    11271124         */
    11281125        function bp_get_the_notification_action_links( $args = '' ) {
    11291126
    1130                 // Parse
     1127                // Parse.
    11311128                $r = wp_parse_args( $args, array(
    11321129                        'before' => '',
    … …  
    11391136                ) );
    11401137
    1141                 // Build the links
     1138                // Build the links.
    11421139                $retval = $r['before'] . implode( $r['links'], $r['sep'] ) . $r['after'];
    11431140
    … …  
    12261223function bp_notifications_sort_order_form() {
    12271224
    1228         // Setup local variables
     1225        // Setup local variables.
    12291226        $orders   = array( 'DESC', 'ASC' );
    12301227        $selected = 'DESC';
    12311228
    1232         // Check for a custom sort_order
     1229        // Check for a custom sort_order.
    12331230        if ( !empty( $_REQUEST['sort_order'] ) ) {
    12341231                if ( in_array( $_REQUEST['sort_order'], $orders ) ) {
  • trunk/src/bp-notifications/classes/class-bp-notifications-notification.php

    r10248 r10303  
    77 * @package BuddyPress
    88 * @subpackage NotificationsClasses
    9  *
    109 * @since 1.9.0
    1110 */
    … …  
    115114        public function save() {
    116115
    117                 // Return value
     116                // Return value.
    118117                $retval = false;
    119118
    120                 // Default data and format
     119                // Default data and format.
    121120                $data = array(
    122121                        'user_id'           => $this->user_id,
    … …  
    141140                do_action_ref_array( 'bp_notification_before_save', array( &$this ) );
    142141
    143                 // Update
     142                // Update.
    144143                if ( ! empty( $this->id ) ) {
    145144                        $result = self::_update( $data, array( 'ID' => $this->id ), $data_format, array( '%d' ) );
    146145
    147                 // Insert
     146                // Insert.
    148147                } else {
    149148                        $result = self::_insert( $data, $data_format );
    150149                }
    151150
    152                 // Set the notification ID if successful
     151                // Set the notification ID if successful.
    153152                if ( ! empty( $result ) && ! is_wp_error( $result ) ) {
    154153                        global $wpdb;
    … …  
    163162                 * @since 2.0.0
    164163                 *
    165                  * @param BP_Notifications_Notification $value Current instance of the notification item being saved. Passed by reference.
     164                 * @param BP_Notifications_Notification $value Current instance of the notification item being saved.
     165                 *                                             Passed by reference.
    166166                 */
    167167                do_action_ref_array( 'bp_notification_after_save', array( &$this ) );
    168168
    169                 // Return the result
     169                // Return the result.
    170170                return $retval;
    171171        }
    … …  
    184184                $bp = buddypress();
    185185
    186                 // Look for a notification
     186                // Look for a notification.
    187187                $notification = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$bp->notifications->table_name} WHERE id = %d", $this->id ) );
    188188
    189                 // Setup the notification data
     189                // Setup the notification data.
    190190                if ( ! empty( $notification ) && ! is_wp_error( $notification ) ) {
    191191                        $this->item_id           = $notification->item_id;
    … …  
    240240         * @param array $data_format  See {@link wpdb::insert()}.
    241241         * @param array $where_format See {@link wpdb::insert()}.
    242          *
    243242         * @return int|false The number of rows updated, or false on error.
    244243         */
    … …  
    259258         *                            BP_Notification_Notification object.
    260259         * @param array $where_format See {@link wpdb::insert()}.
    261          *
    262260         * @return int|false The number of rows updated, or false on error.
    263261         */
    … …  
    281279         * @param string $join_sql       SQL JOIN fragment.
    282280         * @param string $meta_query_sql SQL meta query fragment.
    283          *
    284281         * @return string WHERE clause.
    285282         */
    … …  
    290287                $where            = '';
    291288
    292                 // id
     289                // The id.
    293290                if ( ! empty( $args['id'] ) ) {
    294291                        $id_in = implode( ',', wp_parse_id_list( $args['id'] ) );
    … …  
    296293                }
    297294
    298                 // user_id
     295                // The user_id.
    299296                if ( ! empty( $args['user_id'] ) ) {
    300297                        $user_id_in = implode( ',', wp_parse_id_list( $args['user_id'] ) );
    … …  
    302299                }
    303300
    304                 // item_id
     301                // The item_id.
    305302                if ( ! empty( $args['item_id'] ) ) {
    306303                        $item_id_in = implode( ',', wp_parse_id_list( $args['item_id'] ) );
    … …  
    308305                }
    309306
    310                 // secondary_item_id
     307                // The secondary_item_id.
    311308                if ( ! empty( $args['secondary_item_id'] ) ) {
    312309                        $secondary_item_id_in = implode( ',', wp_parse_id_list( $args['secondary_item_id'] ) );
    … …  
    314311                }
    315312
    316                 // component_name
     313                // The component_name.
    317314                if ( ! empty( $args['component_name'] ) ) {
    318315                        if ( ! is_array( $args['component_name'] ) ) {
    … …  
    331328                }
    332329
    333                 // component_action
     330                // The component_action.
    334331                if ( ! empty( $args['component_action'] ) ) {
    335332                        if ( ! is_array( $args['component_action'] ) ) {
    … …  
    348345                }
    349346
    350                 // is_new
     347                // If is_new.
    351348                if ( ! empty( $args['is_new'] ) && 'both' !== $args['is_new'] ) {
    352349                        $where_conditions['is_new'] = "is_new = 1";
    … …  
    355352                }
    356353
    357                 // search_terms
     354                // The search_terms.
    358355                if ( ! empty( $args['search_terms'] ) ) {
    359356                        $search_terms_like = '%' . bp_esc_like( $args['search_terms'] ) . '%';
    … …  
    361358                }
    362359
    363                 // date query
     360                // The date query.
    364361                if ( ! empty( $args['date_query'] ) ) {
    365362                        $where_conditions['date_query'] = self::get_date_query_sql( $args['date_query'] );
    366363                }
    367364
    368                 // meta query
     365                // The meta query.
    369366                if ( ! empty( $meta_query_sql['where'] ) ) {
    370367                        $where_conditions['meta_query'] = $meta_query_sql['where'];
    … …  
    385382                $where_conditions = apply_filters( 'bp_notifications_get_where_conditions', $where_conditions, $args, $select_sql, $from_sql, $join_sql, $meta_query_sql );
    386383
    387                 // Custom WHERE
     384                // Custom WHERE.
    388385                if ( ! empty( $where_conditions ) ) {
    389386                        $where = 'WHERE ' . implode( ' AND ', $where_conditions );
    … …  
    403400         * @param array $args See {@link BP_Notifications_Notification::get()}
    404401         *                    for more details.
    405          *
    406402         * @return string ORDER BY clause.
    407403         */
    408404        protected static function get_order_by_sql( $args = array() ) {
    409405
    410                 // Setup local variable
     406                // Setup local variable.
    411407                $conditions = array();
    412408                $retval     = '';
    413409
    414                 // Order by
     410                // Order by.
    415411                if ( ! empty( $args['order_by'] ) ) {
    416412                        $order_by               = implode( ', ', (array) $args['order_by'] );
    … …  
    418414                }
    419415
    420                 // Sort order direction
     416                // Sort order direction.
    421417                if ( ! empty( $args['sort_order'] ) && in_array( $args['sort_order'], array( 'ASC', 'DESC' ) ) ) {
    422418                        $sort_order               = $args['sort_order'];
    … …  
    424420                }
    425421
    426                 // Custom ORDER BY
     422                // Custom ORDER BY.
    427423                if ( ! empty( $conditions ) ) {
    428424                        $retval = 'ORDER BY ' . implode( ' ', $conditions );
    … …  
    441437         * @param array $args See {@link BP_Notifications_Notification::get()}
    442438         *                    for more details.
    443          *
    444          * @return string LIMIT clause.
     439         * @return string $retval LIMIT clause.
    445440         */
    446441        protected static function get_paged_sql( $args = array() ) {
    447442                global $wpdb;
    448443
    449                 // Setup local variable
     444                // Setup local variable.
    450445                $retval = '';
    451446
    452                 // Custom LIMIT
     447                // Custom LIMIT.
    453448                if ( ! empty( $args['page'] ) && ! empty( $args['per_page'] ) ) {
    454449                        $page     = absint( $args['page']     );
    … …  
    500495         *                    See {@BP_Notifications_Notification::get()}
    501496         *                    for a breakdown.
    502          *
    503497         * @return array Associative array of 'data' and 'format' args.
    504498         */
    … …  
    509503                );
    510504
    511                 // id
     505                // The id.
    512506                if ( ! empty( $args['id'] ) ) {
    513507                        $where_clauses['data']['id'] = absint( $args['id'] );
    … …  
    515509                }
    516510
    517                 // user_id
     511                // The user_id.
    518512                if ( ! empty( $args['user_id'] ) ) {
    519513                        $where_clauses['data']['user_id'] = absint( $args['user_id'] );
    … …  
    521515                }
    522516
    523                 // item_id
     517                // The item_id.
    524518                if ( ! empty( $args['item_id'] ) ) {
    525519                        $where_clauses['data']['item_id'] = absint( $args['item_id'] );
    … …  
    527521                }
    528522
    529                 // secondary_item_id
     523                // The secondary_item_id.
    530524                if ( ! empty( $args['secondary_item_id'] ) ) {
    531525                        $where_clauses['data']['secondary_item_id'] = absint( $args['secondary_item_id'] );
    … …  
    533527                }
    534528
    535                 // component_name
     529                // The component_name.
    536530                if ( ! empty( $args['component_name'] ) ) {
    537531                        $where_clauses['data']['component_name'] = $args['component_name'];
    … …  
    539533                }
    540534
    541                 // component_action
     535                // The component_action.
    542536                if ( ! empty( $args['component_action'] ) ) {
    543537                        $where_clauses['data']['component_action'] = $args['component_action'];
    … …  
    545539                }
    546540
    547                 // is_new
     541                // If is_new.
    548542                if ( isset( $args['is_new'] ) ) {
    549543                        $where_clauses['data']['is_new'] = ! empty( $args['is_new'] ) ? 1 : 0;
    … …  
    563557         * @param int $user_id         ID of the user being checked.
    564558         * @param int $notification_id ID of the notification being checked.
    565          *
    566559         * @return bool True if the notification belongs to the user, otherwise
    567560         *              false.
    … …  
    580573         * @since 2.3.0
    581574         *
    582          * @param  mixed $args
     575         * @param mixed $args Args to parse.
    583576         * @return array
    584577         */
    … …  
    643636                global $wpdb;
    644637
    645                 // Parse the arguments
     638                // Parse the arguments.
    646639                $r = self::parse_args( $args );
    647640
    648                 // Get BuddyPress
     641                // Get BuddyPress.
    649642                $bp = buddypress();
    650643
    651                 // METADATA
     644                // METADATA.
    652645                $meta_query_sql = self::get_meta_query_sql( $r['meta_query'] );
    653646
    654                 // SELECT
     647                // SELECT.
    655648                $select_sql = "SELECT *";
    656649
    657                 // FROM
     650                // FROM.
    658651                $from_sql   = "FROM {$bp->notifications->table_name} n ";
    659652
    660                 // JOIN
     653                // JOIN.
    661654                $join_sql   = $meta_query_sql['join'];
    662655
    663                 // WHERE
     656                // WHERE.
    664657                $where_sql  = self::get_where_sql( array(
    665658                        'id'                => $r['id'],
    … …  
    674667                ), $select_sql, $from_sql, $join_sql, $meta_query_sql );
    675668
    676                 // ORDER BY
     669                // ORDER BY.
    677670                $order_sql  = self::get_order_by_sql( array(
    678671                        'order_by'   => $r['order_by'],
    … …  
    680673                ) );
    681674
    682                 // LIMIT %d, %d
     675                // LIMIT %d, %d.
    683676                $pag_sql    = self::get_paged_sql( array(
    684677                        'page'     => $r['page'],
    … …  
    686679                ) );
    687680
    688                 // Concatenate query parts
     681                // Concatenate query parts.
    689682                $sql = "{$select_sql} {$from_sql} {$join_sql} {$where_sql} {$order_sql} {$pag_sql}";
    690683
    … …  
    697690         * @since 1.9.0
    698691         *
    699          * @see BP_Notifications_Notification::get() for a description of
    700          *      arguments.
     692         * @see BP_Notifications_Notification::get() for a description of arguments.
    701693         *
    702694         * @param array $args See {@link BP_Notifications_Notification::get()}.
    703          *
    704695         * @return int Count of located items.
    705696         */
    … …  
    707698                global $wpdb;
    708699
    709                 // Parse the arguments
     700                // Parse the arguments.
    710701                $r = self::parse_args( $args );
    711702
    712                 // Load BuddyPress
     703                // Load BuddyPress.
    713704                $bp = buddypress();
    714705
    715                 // METADATA
     706                // METADATA.
    716707                $meta_query_sql = self::get_meta_query_sql( $r['meta_query'] );
    717708
    718                 // SELECT
     709                // SELECT.
    719710                $select_sql = "SELECT COUNT(*)";
    720711
    721                 // FROM
     712                // FROM.
    722713                $from_sql   = "FROM {$bp->notifications->table_name} n ";
    723714
    724                 // JOIN
     715                // JOIN.
    725716                $join_sql   = $meta_query_sql['join'];
    726717
    727                 // WHERE
     718                // WHERE.
    728719                $where_sql  = self::get_where_sql( array(
    729720                        'id'                => $r['id'],
    … …  
    738729                ), $select_sql, $from_sql, $join_sql, $meta_query_sql );
    739730
    740                 // Concatenate query parts
     731                // Concatenate query parts.
    741732                $sql = "{$select_sql} {$from_sql} {$join_sql} {$where_sql}";
    742733
    743                 // Return the queried results
     734                // Return the queried results.
    744735                return $wpdb->get_var( $sql );
    745736        }
    … …  
    758749         * @param  array $meta_query An array of meta_query filters. See the
    759750         *                           documentation for WP_Meta_Query for details.
    760          *
    761751         * @return array $sql_array 'join' and 'where' clauses.
    762752         */
    763753        public static function get_meta_query_sql( $meta_query = array() ) {
    764754
    765                 // Default array keys & empty values
     755                // Default array keys & empty values.
    766756                $sql_array = array(
    767757                        'join'  => '',
    … …  
    769759                );
    770760
    771                 // Bail if no meta query
     761                // Bail if no meta query.
    772762                if ( empty( $meta_query ) ) {
    773763                        return $sql_array;
    774764                }
    775765
    776                 // WP_Meta_Query expects the table name at $wpdb->notificationmeta
     766                // WP_Meta_Query expects the table name at $wpdb->notificationmeta.
    777767                $GLOBALS['wpdb']->notificationmeta = buddypress()->notifications->table_name_meta;
    778768
    … …  
    780770                $meta_sql     = $n_meta_query->get_sql( 'notification', 'n', 'id' );
    781771
    782                 // Strip the leading AND - it's handled in get()
     772                // Strip the leading AND - it's handled in get().
    783773                $sql_array['where'] = preg_replace( '/^\sAND/', '', $meta_sql['where'] );
    784774                $sql_array['join']  = $meta_sql['join'];
    … …  
    800790         * @param array $date_query An array of date_query parameters. See the
    801791         *                          documentation for the first parameter of WP_Date_Query.
    802          *
    803792         * @return string
    804793         */
    805794        public static function get_date_query_sql( $date_query = array() ) {
    806795
    807                 // Bail if not a proper date query format
     796                // Bail if not a proper date query format.
    808797                if ( empty( $date_query ) || ! is_array( $date_query ) ) {
    809798                        return '';
    810799                }
    811800
    812                 // Date query
     801                // Date query.
    813802                $date_query = new BP_Date_Query( $date_query, 'date_recorded' );
    814803
    815                 // Strip the leading AND - it's handled in get()
     804                // Strip the leading AND - it's handled in get().
    816805                return preg_replace( '/^\sAND/', '', $date_query->get_sql() );
    817806        }
    … …  
    827816         * @param array $update_args Associative array of fields to update,
    828817         *                           and the values to update them to. Of the format
    829          *                           array( 'user_id' => 4, 'component_name' => 'groups', )
     818         *                           array( 'user_id' => 4, 'component_name' => 'groups', ).
    830819         * @param array $where_args  Associative array of columns/values, to
    831820         *                           determine which rows should be updated. Of the format
    832          *                           array( 'item_id' => 7, 'component_action' => 'members', )
    833          *
     821         *                           array( 'item_id' => 7, 'component_action' => 'members', ).
    834822         * @return int|bool Number of rows updated on success, false on failure.
    835823         */
    … …  
    866854         * @param array $args Associative array of columns/values, to determine
    867855         *                    which rows should be deleted.  Of the format
    868          *                    array( 'item_id' => 7, 'component_action' => 'members', )
    869          *
     856         *                    array( 'item_id' => 7, 'component_action' => 'members', ).
    870857         * @return int|bool Number of rows deleted on success, false on failure.
    871858         */
    … …  
    898885         *
    899886         * @param int $id ID of the notification item to be deleted.
    900          *
    901887         * @return bool True on success, false on failure.
    902888         */
    … …  
    916902         * @param string $status  Optional. Status of notifications to fetch.
    917903         *                        'is_new' to get only unread items, 'all' to get all.
    918          *
    919904         * @return array Associative array of notification items.
    920905         */
    … …  
    933918         * @param int $user_id ID of the user whose notifications are being
    934919         *                     fetched.
    935          *
    936920         * @return array Associative array of unread notification items.
    937921         */
    … …  
    950934         * @param int $user_id ID of the user whose notifications are being
    951935         *                     fetched.
    952          *
    953936         * @return array Associative array of unread notification items.
    954937         */
    … …  
    994977                $notifications = self::get( $r );
    995978
    996                 // Bail if no notifications
     979                // Bail if no notifications.
    997980                if ( empty( $notifications ) ) {
    998981                        return false;
    … …  
    10171000         * @param string $component_action  Name of the component action.
    10181001         * @param int    $secondary_item_id The ID of the secondary item.
    1019          *
    10201002         * @return bool|int False on failure to update. ID on success.
    10211003         */
    10221004        public static function mark_all_for_user( $user_id, $is_new = 0, $item_id = 0, $component_name = '', $component_action = '', $secondary_item_id = 0 ) {
    10231005
    1024                 // Values to be updated
     1006                // Values to be updated.
    10251007                $update_args = array(
    10261008                        'is_new' => $is_new,
    10271009                );
    10281010
    1029                 // WHERE clauses
     1011                // WHERE clauses.
    10301012                $where_args = array(
    10311013                        'user_id' => $user_id,
    … …  
    10611043         * @param string $component_action  Name of the component action.
    10621044         * @param int    $secondary_item_id The ID of the secondary item.
    1063          *
    10641045         * @return bool|int
    10651046         */
    10661047        public static function mark_all_from_user( $user_id, $is_new = 0, $component_name = '', $component_action = '', $secondary_item_id = 0 ) {
    10671048
    1068                 // Values to be updated
     1049                // Values to be updated.
    10691050                $update_args = array(
    10701051                        'is_new' => $is_new,
    10711052                );
    10721053
    1073                 // WHERE clauses
     1054                // WHERE clauses.
    10741055                $where_args = array(
    10751056                        'item_id' => $user_id,
    … …  
    11061087         * @param int    $secondary_item_id Optional. ID of the secondary
    11071088         *                                  associated item.
    1108          *
    11091089         * @return bool|int
    11101090         */
    11111091        public static function mark_all_by_type( $item_id, $is_new = 0, $component_name = '', $component_action = '', $secondary_item_id = 0 ) {
    11121092
    1113                 // Values to be updated
     1093                // Values to be updated.
    11141094                $update_args = array(
    11151095                        'is_new' => $is_new,
    11161096                );
    11171097
    1118                 // WHERE clauses
     1098                // WHERE clauses.
    11191099                $where_args = array(
    11201100                        'item_id' => $item_id,
Note: See TracChangeset for help on using the changeset viewer.