Skip to:
Content

BuddyPress.org

Changeset 13405


Ignore:
Timestamp:
01/19/2023 01:07:13 AM (15 months ago)
Author:
espellcaste
Message:

Adding PHPDoc Improvements to the Blogs (component) files.

Props imath

Closes https://github.com/buddypress/buddypress/pull/56
See #8553

Location:
trunk/src
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/bp-blogs-activity.php

    r13342 r13405  
    1515 *
    1616 * @since 1.0.0
    17  *
    18  * @return bool|null Returns false if activity component is not active.
    1917 */
    2018function bp_blogs_register_activity_actions() {
     
    241239        restore_current_blog();
    242240
    243         if ( ! empty( $post ) && ! is_wp_error( $post ) ) {
     241        if ( ! empty( $post ) && $post instanceof WP_Post ) {
    244242            $post_url = add_query_arg( 'p', $post->ID, trailingslashit( get_home_url( $activity->item_id ) ) );
    245243            $action   = apply_filters_deprecated( 'bp_blogs_activity_new_post_action', array( $action, $post, $post_url ), '2.0.0', 'bp_blogs_format_activity_action_new_blog_post' );
     
    353351        restore_current_blog();
    354352
    355         if ( ! empty( $comment ) && ! is_wp_error( $comment ) ) {
     353        if ( ! empty( $comment ) && $comment instanceof WP_Comment ) {
    356354            $action = apply_filters_deprecated( 'bp_blogs_activity_new_comment_action', array( $action, $comment, $post_url . '#' . $activity->secondary_item_id ), '2.0.0', 'bp_blogs_format_activity_action_new_blog_comment' );
    357355        }
     
    454452         * @since 1.2.0
    455453         *
    456          * @param string $value Generated summary from content for the activity stream.
    457          * @param string $value Content for the activity stream.
    458          * @param array  $r     Array of arguments used for the activity stream item.
     454         * @param string $summary Generated summary from content for the activity stream.
     455         * @param string $content Content for the activity stream.
     456         * @param array  $r       Array of arguments used for the activity stream item.
    459457         */
    460458        $r['content'] = apply_filters( 'bp_blogs_record_activity_content', bp_activity_create_summary( $r['content'], $r ), $r['content'], $r );
     
    500498    );
    501499
    502     bp_activity_delete_by_item_id( $r );
     500    return bp_activity_delete_by_item_id( $r );
    503501}
    504502
     
    615613             * @since 1.1.0
    616614             *
    617              * @param string $value Blog primary link.
    618              * @param int    $value Blog ID.
     615             * @param string $link    Blog primary link.
     616             * @param int    $blog_id Blog ID.
    619617             */
    620618            'primary_link' => apply_filters( 'bp_blogs_activity_created_blog_primary_link', bp_blogs_get_blogmeta( $recorded_blog->blog_id, 'url' ), $recorded_blog->blog_id ),
     
    678676 * @param int $user_id Optional. Defaults to the logged-in user ID. This param
    679677 *                     is currently unused in the function (but is passed to hooks).
    680  * @return bool
    681678 */
    682679function bp_blogs_remove_post( $post_id, $blog_id = 0, $user_id = 0 ) {
  • trunk/src/bp-blogs/bp-blogs-filters.php

    r12906 r13405  
    2626 * @since 1.6.0
    2727 *
    28  *       returned value.
    29  *
    3028 * @param string $url The original URL (points to wp-signup.php by default).
    3129 * @return string The new URL.
     
    3836     * @since 1.6.0
    3937     *
    40      * @param string $value URL for the 'Create a new site' signup page.
     38     * @param string $permalink URL for the 'Create a new site' signup page.
     39     * @param string $url       The original URL (points to wp-signup.php by default).
    4140     */
    4241    return apply_filters( 'bp_blogs_creation_location', trailingslashit( bp_get_blogs_directory_permalink() . 'create' ), $url );
  • trunk/src/bp-blogs/bp-blogs-functions.php

    r13395 r13405  
    347347 * @param bool $no_activity Optional. Whether to skip recording an activity
    348348 *                          item about this blog creation. Default: false.
    349  * @return false|null Returns false on failure.
    350349 */
    351350function bp_blogs_record_blog( $blog_id, $user_id, $no_activity = false ) {
     
    357356    // If blog is not recordable, do not record the activity.
    358357    if ( ! bp_blogs_is_blog_recordable( $blog_id, $user_id ) ) {
    359         return false;
     358        return;
    360359    }
    361360
     
    721720 * @param  array           $activity_args        Array of activity arguments.
    722721 * @param  object|null     $activity_post_object The post type tracking args object.
    723  * @return WP_Error|bool|int Returns false if no activity, the activity id otherwise.
    724722 */
    725723function bp_blogs_comment_sync_activity_comment( &$activity_id, $comment = null, $activity_args = array(), $activity_post_object = null ) {
    726724    if ( empty( $activity_args ) || empty( $comment->post->ID ) || empty( $activity_post_object->comment_action_id ) ) {
    727         return false;
     725        return;
    728726    }
    729727
     
    749747        }
    750748
    751         if ( empty( $activity_post_object ) ) {
    752             $activity_post_object = bp_activity_get_post_type_tracking_args( $comment->post->post_type );
    753         }
     749        $activity_post_object = bp_activity_get_post_type_tracking_args( $comment->post->post_type );
    754750
    755751        if ( isset( $activity_post_object->action_id ) && isset( $activity_post_object->component_id ) ) {
     
    831827
    832828    if ( 'new_blog_comment' === $activity_post_object->comment_action_id ) {
     829
    833830        /**
    834831         * Fires after BuddyPress has recorded metadata about a published blog post comment.
     
    836833         * @since 2.5.0
    837834         *
    838          * @param int     $value    Comment ID of the blog post comment being recorded.
    839          * @param WP_Post $post  WP_Comment object for the current blog post.
    840          * @param string  $value ID of the user associated with the current blog post comment.
     835         * @param int        $comment_id Comment ID of the blog post comment being recorded.
     836         * @param WP_Comment $post       WP_Comment object for the current blog post.
     837         * @param int        $user_id    ID of the user associated with the current blog post comment.
    841838         */
    842         do_action( 'bp_blogs_new_blog_comment', $comment->comment_ID, $comment, bp_loggedin_user_id() );
     839        do_action( 'bp_blogs_new_blog_comment', (int) $comment->comment_ID, $comment, bp_loggedin_user_id() );
    843840    }
    844841
     
    861858 * @param string|bool $role    User's WordPress role for this blog ID.
    862859 * @param int         $blog_id Blog ID user is being added to.
    863  * @return false|null False on failure.
    864860 */
    865861function bp_blogs_add_user_to_blog( $user_id, $role = false, $blog_id = 0 ) {
     
    918914 * @since 2.1.0
    919915 *
    920  * @return string
     916 * @return array
    921917 */
    922918function bp_blogs_get_allowed_roles() {
     
    927923     * @since 2.1.0
    928924     *
    929      * @param array $value Array of potential roles user needs.
     925     * @param array $roles Array of allowed roles.
    930926     */
    931927    return apply_filters( 'bp_blogs_get_allowed_roles', array( 'contributor', 'author', 'editor', 'administrator' ) );
     
    10451041 * @param object $activity_post_object The post type tracking args object.
    10461042 * @param string $activity_type        The post type comment activity type.
    1047  *
    1048  * @return bool True on success. False on error.
    10491043 */
    10501044function bp_blogs_post_type_remove_comment( $deleted, $comment_id, $activity_post_object, $activity_type = '' ) {
     
    10971091         * @since 1.0.0
    10981092         *
    1099          * @param int $value      ID for the blog associated with the removed comment.
     1093         * @param int $blog_id    ID for the blog associated with the removed comment.
    11001094         * @param int $comment_id ID of the comment being removed.
    1101          * @param int $value      ID of the current logged in user.
     1095         * @param int $user_id    ID of the current logged in user.
    11021096         */
    11031097        do_action( 'bp_blogs_remove_comment', get_current_blog_id(), $comment_id, bp_loggedin_user_id() );
     
    14161410 *
    14171411 * @param int $user_id ID whose blog data should be removed.
    1418  * @return bool Returns false on failure.
    14191412 */
    14201413function bp_blogs_remove_data( $user_id ) {
    1421     if ( !is_multisite() )
    1422         return false;
     1414    if ( ! is_multisite() ) {
     1415        return;
     1416    }
    14231417
    14241418    /**
  • trunk/src/bp-blogs/bp-blogs-template.php

    r13395 r13405  
    15221522 *
    15231523 * @since 2.2.0
    1524  *
    1525  * @return string|null HTML Output
    15261524 */
    15271525function bp_blog_backcompat_create_nav_item() {
  • trunk/src/bp-blogs/classes/class-bp-blogs-blog.php

    r13372 r13405  
    8181         * @since 1.0.0
    8282         *
    83          * @param int $value User ID.
    84          * @param int $value Site ID.
     83         * @param int $user_id User ID.
     84         * @param int $site_id Site ID.
    8585         */
    8686        $this->user_id = apply_filters( 'bp_blogs_blog_user_id_before_save', $this->user_id, $this->id );
     
    9191         * @since 1.0.0
    9292         *
    93          * @param int $value Blog ID.
    94          * @param int $value Site ID.
     93         * @param int $blog_id Blog ID.
     94         * @param int $site_id Site ID.
    9595         */
    9696        $this->blog_id = apply_filters( 'bp_blogs_blog_id_before_save', $this->blog_id, $this->id );
  • trunk/src/bp-blogs/classes/class-bp-blogs-component.php

    r13144 r13405  
    265265     * @param array $wp_admin_nav See BP_Component::setup_admin_bar()
    266266     *                            for description.
    267      * @return bool
    268267     */
    269268    public function setup_admin_bar( $wp_admin_nav = array() ) {
     
    275274         */
    276275        if ( ! is_multisite() ) {
    277             return false;
     276            return;
    278277        }
    279278
  • trunk/src/bp-blogs/classes/class-bp-blogs-template.php

    r13399 r13405  
    3030     * @var int
    3131     */
    32     public $blog_count = 0;
     32    public $blog_count;
    3333
    3434    /**
     
    8686     * @var int
    8787     */
    88     public $total_blog_count = 0;
     88    public $total_blog_count;
    8989
    9090    /**
     
    161161        }
    162162
     163        $max = (int) wp_unslash( $r['max'] );
     164
    163165        // Set the total blog count.
    164         if ( empty( $r['max'] ) || ( $r['max'] >= (int) $this->blogs['total'] ) ) {
     166        if ( empty( $max ) || ( $max >= (int) $this->blogs['total'] ) ) {
    165167            $this->total_blog_count = (int) $this->blogs['total'];
    166168        } else {
    167             $this->total_blog_count = (int) $max;
     169            $this->total_blog_count = $max;
    168170        }
    169171
     
    175177
    176178        // Set the current blog count.
    177         if ( empty( $r['max'] ) || ( $r['max'] >= (int) $blog_count ) ) {
     179        if ( empty( $max ) || ( $max >= (int) $blog_count ) ) {
    178180            $this->blog_count = (int) $blog_count;
    179181        } else {
    180             $this->blog_count = (int) $max;
     182            $this->blog_count = $max;
    181183        }
    182184
  • trunk/src/bp-core/bp-core-caps.php

    r12740 r13405  
    2121 * @since 2.1.0
    2222 *
    23  * @return object
     23 * @global WP_Roles $wp_roles WordPress role management object.
     24 *
     25 * @return array
    2426 */
    2527function bp_get_current_blog_roles() {
     
    5759 *
    5860 * @since 1.6.0
     61 *
     62 * @global WP_Roles $wp_roles WordPress role management object.
    5963 */
    6064function bp_add_caps() {
     
    8993 *
    9094 * @since 1.6.0
     95 *
     96 * @global WP_Roles $wp_roles WordPress role management object.
    9197 */
    9298function bp_remove_caps() {
Note: See TracChangeset for help on using the changeset viewer.