Changeset 1780
- Timestamp:
- 07/23/2015 10:43:49 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/translate.wordpress.org/includes/gp-plugins/wporg-routes/routes/locale.php
r1778 r1780 69 69 } 70 70 71 $top_level_projects = GP::$project->top_level();71 $top_level_projects = $this->get_active_top_level_projects(); 72 72 usort( $top_level_projects, array( $this, '_sort_reverse_name_callback' ) ); 73 73 … … 199 199 global $gpdb; 200 200 201 $table = GP::$translation_set->table;202 201 $project_ids = implode( ',', $project_ids ); 203 202 $slugs = $gpdb->get_col( $gpdb->prepare( " 204 203 SELECT DISTINCT(slug), name 205 FROM $table204 FROM {$gpdb->translation_sets} 206 205 WHERE 207 206 project_id IN( $project_ids ) … … 278 277 */ 279 278 private function get_active_sub_projects( $project, $with_sub_projects = false ) { 279 global $gpdb; 280 280 281 $_projects = $project->many( " 281 282 SELECT * 282 FROM $project->table283 FROM {$gpdb->projects} 283 284 WHERE 284 285 parent_project_id = %d AND … … 295 296 $sub_projects = $project->many( " 296 297 SELECT * 297 FROM $project->table298 FROM {$gpdb->projects} 298 299 WHERE 299 300 parent_project_id = %d AND … … 367 368 * If not, we can simply filter them out, so that paging only has items returned that actually exist. 368 369 */ 369 $translation_sets_table = GP::$translation_set->table;370 370 $_projects = $project->many( " 371 371 SELECT SQL_CALC_FOUND_ROWS tp.* 372 FROM {$ project->table} tp373 LEFT JOIN {$ project->table} tp_sub ON tp.id = tp_sub.parent_project_id AND tp_sub.active = 1374 LEFT JOIN {$ translation_sets_table} sets ON sets.project_id = tp.id AND sets.locale = %s AND sets.slug = %s375 LEFT JOIN {$ translation_sets_table} sets_sub ON sets_sub.project_id = tp_sub.id AND sets_sub.locale = %s AND sets_sub.slug = %s372 FROM {$gpdb->projects} tp 373 LEFT JOIN {$gpdb->projects} tp_sub ON tp.id = tp_sub.parent_project_id AND tp_sub.active = 1 374 LEFT JOIN {$gpdb->translation_sets} sets ON sets.project_id = tp.id AND sets.locale = %s AND sets.slug = %s 375 LEFT JOIN {$gpdb->translation_sets} sets_sub ON sets_sub.project_id = tp_sub.id AND sets_sub.locale = %s AND sets_sub.slug = %s 376 376 WHERE 377 377 tp.parent_project_id = %d … … 385 385 386 386 $results = (int) $project->found_rows(); 387 $pages = (int) ceil( $results / $per_page );387 $pages = (int) ceil( $results / $per_page ); 388 388 389 389 $projects = array(); … … 398 398 } 399 399 400 /** 401 * Retrieves active top level projects. 402 * 403 * @return array List of top level projects. 404 */ 405 public function get_active_top_level_projects() { 406 global $gpdb; 407 408 return GP::$project->many( " 409 SELECT * 410 FROM {$gpdb->projects} 411 WHERE 412 parent_project_id IS NULL 413 AND active = 1 414 ORDER BY name ASC 415 " ); 416 } 417 400 418 private function _sort_reverse_name_callback( $a, $b ) { 401 419 return - strcasecmp( $a->name, $b->name );
Note: See TracChangeset
for help on using the changeset viewer.