Changeset 14010 for trunk/src/bp-blogs/classes/class-bp-blogs-template.php
- Timestamp:
- 08/26/2024 11:10:35 PM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bp-blogs/classes/class-bp-blogs-template.php
r13802 r14010 96 96 * @see BP_Blogs_Blog::get() for a description of parameters. 97 97 * 98 * @param array $args {98 * @param array ...$args { 99 99 * Array of arguments. See {@link BP_Blogs_Blog::get()}. 100 100 * } … … 103 103 // Backward compatibility with old method of passing arguments. 104 104 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 ); 118 127 119 128 $args = bp_core_parse_args_array( $old_args_keys, $args ); … … 147 156 $this->blogs = BP_Blogs_Blog::get_by_letter( $_REQUEST['letter'], $this->pag_num, $this->pag_page ); 148 157 149 // Typical blogs query.158 // Typical blogs query. 150 159 } 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 ); 161 172 } 162 173 … … 185 196 // Build pagination links based on total blogs and current page number. 186 197 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 ); 197 210 } 198 211 } … … 206 219 */ 207 220 public function has_blogs() { 208 return (bool)! empty( $this->blog_count );221 return ! empty( $this->blog_count ); 209 222 } 210 223 … … 215 228 */ 216 229 public function next_blog() { 217 $this->current_blog++;230 ++$this->current_blog; 218 231 $this->blog = $this->blogs[ $this->current_blog ]; 219 232 … … 271 284 */ 272 285 public function the_blog() { 273 274 286 $this->in_the_loop = true; 275 287 $this->blog = $this->next_blog();
Note: See TracChangeset
for help on using the changeset viewer.