Skip to:
Content

BuddyPress.org


Ignore:
Timestamp:
08/26/2024 11:10:35 PM (2 years ago)
Author:
espellcaste
Message:

WPCS: Part I: miscellaneous fixes for some of the files of the blogs component.

See #9174
See #9173

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/bp-blogs/classes/class-bp-blogs-template.php

    r13802 r14010  
    9696         * @see BP_Blogs_Blog::get() for a description of parameters.
    9797         *
    98          * @param array $args {
     98         * @param array ...$args {
    9999         *     Array of arguments. See {@link BP_Blogs_Blog::get()}.
    100100         * }
    … …  
    103103                // Backward compatibility with old method of passing arguments.
    104104                if ( ! is_array( $args[0] ) || count( $args ) > 1 ) {
    105                         _deprecated_argument( __METHOD__, '10.0.0', sprintf( esc_html__( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ), __METHOD__, __FILE__ ) );
    106 
    107                         $old_args_keys = [
    108                                 0  => 'type',
    109                                 1  => 'page',
    110                                 2  => 'per_page',
    111                                 3  => 'max',
    112                                 4  => 'user_id',
    113                                 5  => 'search_terms',
    114                                 6  => 'page_arg',
    115                                 7  => 'update_meta_cache',
    116                                 8  => 'include_blog_ids',
    117                         ];
     105                        _deprecated_argument(
     106                                __METHOD__,
     107                                '10.0.0',
     108                                sprintf(
     109                                        // translators: 1: the name of the method. 2: the name of the file.
     110                                        esc_html__( 'Arguments passed to %1$s should be in an associative array. See the inline documentation at %2$s for more details.', 'buddypress' ),
     111                                        __METHOD__,
     112                                        __FILE__
     113                                )
     114                        );
     115
     116                        $old_args_keys = array(
     117                                0 => 'type',
     118                                1 => 'page',
     119                                2 => 'per_page',
     120                                3 => 'max',
     121                                4 => 'user_id',
     122                                5 => 'search_terms',
     123                                6 => 'page_arg',
     124                                7 => 'update_meta_cache',
     125                                8 => 'include_blog_ids',
     126                        );
    118127
    119128                        $args = bp_core_parse_args_array( $old_args_keys, $args );
    … …  
    147156                        $this->blogs = BP_Blogs_Blog::get_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page );
    148157
    149                 // Typical blogs query.
     158                        // Typical blogs query.
    150159                } else {
    151                         $this->blogs = bp_blogs_get_blogs( array(
    152                                 'type'              => $r['type'],
    153                                 'per_page'          => $this->pag_num,
    154                                 'page'              => $this->pag_page,
    155                                 'user_id'           => $r['user_id'],
    156                                 'search_terms'      => $r['search_terms'],
    157                                 'update_meta_cache' => $r['update_meta_cache'],
    158                                 'include_blog_ids'  => $r['include_blog_ids'],
    159                                 'date_query'        => $r['date_query']
    160                         ) );
     160                        $this->blogs = bp_blogs_get_blogs(
     161                                array(
     162                                        'type'              => $r['type'],
     163                                        'per_page'          => $this->pag_num,
     164                                        'page'              => $this->pag_page,
     165                                        'user_id'           => $r['user_id'],
     166                                        'search_terms'      => $r['search_terms'],
     167                                        'update_meta_cache' => $r['update_meta_cache'],
     168                                        'include_blog_ids'  => $r['include_blog_ids'],
     169                                        'date_query'        => $r['date_query'],
     170                                )
     171                        );
    161172                }
    162173
    … …  
    185196                // Build pagination links based on total blogs and current page number.
    186197                if ( ! empty( $this->total_blog_count ) && ! empty( $this->pag_num ) ) {
    187                         $this->pag_links = paginate_links( array(
    188                                 'base'      => add_query_arg( $this->pag_arg, '%#%' ),
    189                                 'format'    => '',
    190                                 'total'     => ceil( (int) $this->total_blog_count / (int) $this->pag_num ),
    191                                 'current'   => (int) $this->pag_page,
    192                                 'prev_text' => _x( '←', 'Blog pagination previous text', 'buddypress' ),
    193                                 'next_text' => _x( '→', 'Blog pagination next text',     'buddypress' ),
    194                                 'mid_size'  => 1,
    195                                 'add_args'  => array(),
    196                         ) );
     198                        $this->pag_links = paginate_links(
     199                                array(
     200                                        'base'      => add_query_arg( $this->pag_arg, '%#%' ),
     201                                        'format'    => '',
     202                                        'total'     => ceil( (int) $this->total_blog_count / (int) $this->pag_num ),
     203                                        'current'   => (int) $this->pag_page,
     204                                        'prev_text' => _x( '←', 'Blog pagination previous text', 'buddypress' ),
     205                                        'next_text' => _x( '→', 'Blog pagination next text', 'buddypress' ),
     206                                        'mid_size'  => 1,
     207                                        'add_args'  => array(),
     208                                )
     209                        );
    197210                }
    198211        }
    … …  
    206219         */
    207220        public function has_blogs() {
    208                 return (bool) ! empty( $this->blog_count );
     221                return ! empty( $this->blog_count );
    209222        }
    210223
    … …  
    215228         */
    216229        public function next_blog() {
    217                 $this->current_blog++;
     230                ++$this->current_blog;
    218231                $this->blog = $this->blogs[ $this->current_blog ];
    219232
    … …  
    271284         */
    272285        public function the_blog() {
    273 
    274286                $this->in_the_loop = true;
    275287                $this->blog        = $this->next_blog();
Note: See TracChangeset for help on using the changeset viewer.