Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
01/13/2015 01:35:21 AM (9 years ago)
Author:
tw2113
Message:

Adds hooks documentation to the BP-Notifications component.

Fixes #5946.

File:
1 edited

Legend:

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

    r9351 r9352  
    2727     */
    2828    function bp_get_notifications_slug() {
     29
     30        /**
     31         * Filters the notifications component slug.
     32         *
     33         * @since BuddyPress (1.9.0)
     34         *
     35         * @param string $slug Notifications component slug.
     36         */
    2937        return apply_filters( 'bp_get_notifications_slug', buddypress()->notifications->slug );
    3038    }
     
    4755    function bp_get_notifications_permalink() {
    4856        $retval = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() );
     57
     58        /**
     59         * Filters the notifications permalink.
     60         *
     61         * @since BuddyPress (1.9.0)
     62         *
     63         * @param string $retval Permalink for the notifications.
     64         */
    4965        return apply_filters( 'bp_get_notifications_permalink', $retval );
    5066    }
     
    6783    function bp_get_notifications_unread_permalink() {
    6884        $retval = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() . '/unread' );
     85
     86        /**
     87         * Filters the unread notifications permalink.
     88         *
     89         * @since BuddyPress (1.9.0)
     90         *
     91         * @param string $retval Permalink for the unread notifications.
     92         */
    6993        return apply_filters( 'bp_get_notifications_unread_permalink', $retval );
    7094    }
     
    87111    function bp_get_notifications_read_permalink() {
    88112        $retval = trailingslashit( bp_loggedin_user_domain() . bp_get_notifications_slug() . '/read' );
     113
     114        /**
     115         * Filters the read notifications permalink.
     116         *
     117         * @since BuddyPress (1.9.0)
     118         *
     119         * @param string $retval Permalink for the read notifications.
     120         */
    89121        return apply_filters( 'bp_get_notifications_unread_permalink', $retval );
    90122    }
     
    390422
    391423        } elseif ( $this->current_notification + 1 == $this->notification_count ) {
     424
     425            /**
     426             * Fires right before the rewinding of notification posts.
     427             *
     428             * @since BuddyPress (1.9.0)
     429             */
    392430            do_action( 'notifications_loop_end');
    393431
     
    416454        // loop has just started
    417455        if ( 0 === $this->current_notification ) {
     456
     457            /**
     458             * Fires if the current notification item is the first in the notification loop.
     459             *
     460             * @since BuddyPress (1.9.0)
     461             */
    418462            do_action( 'notifications_loop_start' );
    419463        }
     
    490534    buddypress()->notifications->query_loop = $query_loop;
    491535
     536    /**
     537     * Filters whether or not the user has notifications to display.
     538     *
     539     * @since BuddyPress (1.9.0)
     540     *
     541     * @param bool                      $value      Whether or not there are notifications to display.
     542     * @param BP_Notifications_Template $query_loop BP_Notifications_Template object instance.
     543     */
    492544    return apply_filters( 'bp_has_notifications', $query_loop->has_notifications(), $query_loop );
    493545}
     
    533585     */
    534586    function bp_get_the_notification_id() {
     587
     588        /**
     589         * Filters the ID of the notification currently being iterated on.
     590         *
     591         * @since BuddyPress (1.9.0)
     592         *
     593         * @param int $id ID of the notification being iterated on.
     594         */
    535595        return apply_filters( 'bp_get_the_notification_id', buddypress()->notifications->query_loop->notification->id );
    536596    }
     
    552612     */
    553613    function bp_get_the_notification_item_id() {
     614
     615        /**
     616         * Filters the associated item ID of the notification currently being iterated on.
     617         *
     618         * @since BuddyPress (1.9.0)
     619         *
     620         * @param int $item_id ID of the associated item.
     621         */
    554622        return apply_filters( 'bp_get_the_notification_item_id', buddypress()->notifications->query_loop->notification->item_id );
    555623    }
     
    571639     */
    572640    function bp_get_the_notification_secondary_item_id() {
     641
     642        /**
     643         * Filters the secondary associated item ID of the notification currently being iterated on.
     644         *
     645         * @since BuddyPress (1.9.0)
     646         *
     647         * @param int $secondary_item_id ID of the secondary associated item.
     648         */
    573649        return apply_filters( 'bp_get_the_notification_secondary_item_id', buddypress()->notifications->query_loop->notification->secondary_item_id );
    574650    }
     
    590666     */
    591667    function bp_get_the_notification_component_name() {
     668
     669        /**
     670         * Filters the name of the component associated with the notification currently being iterated on.
     671         *
     672         * @since BuddyPress (1.9.0)
     673         *
     674         * @param int $component_name Name of the component associated with the current notification.
     675         */
    592676        return apply_filters( 'bp_get_the_notification_component_name', buddypress()->notifications->query_loop->notification->component_name );
    593677    }
     
    609693     */
    610694    function bp_get_the_notification_component_action() {
     695
     696        /**
     697         * Filters the name of the action associated with the notification currently being iterated on.
     698         *
     699         * @since BuddyPress (1.9.0)
     700         *
     701         * @param int $component_action Name of the action associated with the current notification.
     702         */
    611703        return apply_filters( 'bp_get_the_notification_component_action', buddypress()->notifications->query_loop->notification->component_action );
    612704    }
     
    628720     */
    629721    function bp_get_the_notification_date_notified() {
     722
     723        /**
     724         * Filters the timestamp of the current notification.
     725         *
     726         * @since BuddyPress (1.9.0)
     727         *
     728         * @param string $date_notified Timestamp of the current notification.
     729         */
    630730        return apply_filters( 'bp_get_the_notification_date_notified', buddypress()->notifications->query_loop->notification->date_notified );
    631731    }
     
    660760        }
    661761
     762        /**
     763         * Filters the time since value of the current notification.
     764         *
     765         * @since BuddyPress (1.9.0)
     766         *
     767         * @param string $retval Time since value for current notification.
     768         */
    662769        return apply_filters( 'bp_get_the_notification_time_since', $retval );
    663770    }
     
    693800        // Allow non BuddyPress components to hook in
    694801        } else {
     802
     803            /** This filter is documented in bp-notifications/bp-notifications-functions.php */
    695804            $description = apply_filters_ref_array( 'bp_notifications_get_notifications_for_user', array( $notification->component_action, $notification->item_id, $notification->secondary_item_id, 1 ) );
    696805        }
    697806
    698         // Filter and return
     807        /**
     808         * Filters the full-text description for a specific notification.
     809         *
     810         * @since BuddyPress (1.9.0)
     811         *
     812         * @param string $description Full-text description for a specific notification.
     813         */
    699814        return apply_filters( 'bp_get_the_notification_description', $description );
    700815    }
     
    724839        <?php $retval = ob_get_clean();
    725840
     841        /**
     842         * Filters the mark read link for the current notification.
     843         *
     844         * @since BuddyPress (1.9.0)
     845         *
     846         * @param string $retval HTML for the mark read link for the current notification.
     847         */
    726848        return apply_filters( 'bp_get_the_notification_mark_read_link', $retval );
    727849    }
     
    761883        $url = wp_nonce_url( $url, 'bp_notification_mark_read_' . $id );
    762884
    763         // Filter and return
     885        /**
     886         * Filters the URL used for marking a single notification as read.
     887         *
     888         * @since BuddyPress (2.1.0)
     889         *
     890         * @param string $url URL to use for marking the single notification as read.
     891         */
    764892        return apply_filters( 'bp_get_the_notification_mark_read_url', $url );
    765893    }
    766894
    767895/**
    768  * Output the mark read link for the current notification.
     896 * Output the mark unread link for the current notification.
    769897 *
    770898 * @since BuddyPress (1.9.0)
     
    776904}
    777905    /**
    778      * Return the mark read link for the current notification.
     906     * Return the mark unread link for the current notification.
    779907     *
    780908     * @since BuddyPress (1.9.0)
     
    789917        <?php $retval = ob_get_clean();
    790918
     919        /**
     920         * Filters the link used for marking a single notification as unread.
     921         *
     922         * @since BuddyPress (1.9.0)
     923         *
     924         * @param string $retval HTML for the mark unread link for the current notification.
     925         */
    791926        return apply_filters( 'bp_get_the_notification_mark_unread_link', $retval );
    792927    }
     
    826961        $url = wp_nonce_url( $url, 'bp_notification_mark_unread_' . $id );
    827962
    828         // Filter and return
     963        /**
     964         * Filters the URL used for marking a single notification as unread.
     965         *
     966         * @since BuddyPress (2.1.0)
     967         *
     968         * @param string $url URL to use for marking the single notification as unread.
     969         */
    829970        return apply_filters( 'bp_get_the_notification_mark_unread_url', $url );
    830971    }
     
    853994        }
    854995
     996        /**
     997         * Filters the mark link for the current notification.
     998         *
     999         * @since BuddyPress (1.9.0)
     1000         *
     1001         * @param string $retval The mark link for the current notification.
     1002         */
    8551003        return apply_filters( 'bp_get_the_notification_mark_link', $retval );
    8561004    }
     
    8801028        <?php $retval = ob_get_clean();
    8811029
     1030        /**
     1031         * Filters the delete link for the current notification.
     1032         *
     1033         * @since BuddyPress (1.9.0)
     1034         *
     1035         * @param string $retval HTML for the delete link for the current notification.
     1036         */
    8821037        return apply_filters( 'bp_get_the_notification_delete_link', $retval );
    8831038    }
     
    9271082        $url = wp_nonce_url( $url, 'bp_notification_delete_' . $id );
    9281083
    929         // Filter and return
     1084        /**
     1085         * Filters the URL used for deleting a single notification.
     1086         *
     1087         * @since BuddyPress (2.1.0)
     1088         *
     1089         * @param string $url URL used for deleting a single notification.
     1090         */
    9301091        return apply_filters( 'bp_get_the_notification_delete_url', $url );
    9311092    }
     
    9691130        $retval = $r['before'] . implode( $r['links'], $r['sep'] ) . $r['after'];
    9701131
     1132        /**
     1133         * Filters the action links for the current notification.
     1134         *
     1135         * @since BuddyPress (1.9.0)
     1136         *
     1137         * @param string $retval HTML links for actions to take on single notifications.
     1138         */
    9711139        return apply_filters( 'bp_get_the_notification_action_links', $retval );
    9721140    }
     
    9951163        $pag        = sprintf( _n( 'Viewing 1 notification', 'Viewing %1$s - %2$s of %3$s notifications', $total, 'buddypress' ), $from_num, $to_num, $total );
    9961164
     1165        /**
     1166         * Filters the pagination count for the current notification loop.
     1167         *
     1168         * @since BuddyPress (1.9.0)
     1169         *
     1170         * @param string $pag HTML for the pagination count.
     1171         */
    9971172        return apply_filters( 'bp_notifications_pagination_count', $pag );
    9981173    }
     
    10141189     */
    10151190    function bp_get_notifications_pagination_links() {
     1191
     1192        /**
     1193         * Filters the pagination links for the current notification loop.
     1194         *
     1195         * @since BuddyPress (1.9.0)
     1196         *
     1197         * @param string $pag_links HTML for the pagination links.
     1198         */
    10161199        return apply_filters( 'bp_get_notifications_pagination_links', buddypress()->notifications->query_loop->pag_links );
    10171200    }
Note: See TracChangeset for help on using the changeset viewer.