Changeset 6484
- Timestamp:
- 01/31/2018 04:07:08 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/class-themes-api.php
r6465 r6484 294 294 295 295 /** 296 * Retrieve specific information about multiple theme. 297 */ 298 public function theme_information_multiple() { 299 if ( empty( $this->request->slugs ) ) { 300 $this->response = (object) array( 'error' => 'Slugs not provided' ); 301 return; 302 } 303 304 $slugs = is_array( $this->request->slugs ) ? $this->request->slugs : explode( ',', $this->request->slugs ); 305 $slugs = array_unique( array_map( 'trim', $slugs ) ); 306 307 if ( count( $slugs ) > 100 ) { 308 $this->response = (object) array( 'error' => 'A maximum of 100 themes can be queried at once.' ); 309 return; 310 } 311 312 $response = array(); 313 unset( $this->request->slugs ); // So it doesn't affect caching. 314 foreach ( $slugs as $slug ) { 315 $this->request->slug = $slug; 316 $this->theme_information(); 317 $response[ $slug ] = $this->response; 318 } 319 320 $this->response = $response; 321 } 322 323 /** 296 324 * Retrieve specific information about a theme. 297 325 */ 298 326 public function theme_information() { 299 327 global $post; 328 329 // Support the 'slugs' parameter to fetch multiple themes at once. 330 if ( ! empty( $this->request->slugs ) ) { 331 $this->theme_information_multiple(); 332 return; 333 } 334 300 335 // Theme slug to identify theme. 301 336 if ( empty( $this->request->slug ) ) {
Note: See TracChangeset
for help on using the changeset viewer.