Changeset 5502
- Timestamp:
- 05/21/2017 01:51:02 PM (7 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins
- Files:
-
- 1 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/locale-project.php
r4996 r5502 77 77 printf( 78 78 '<li><a href="%s">%s <span>%s</span></a>', 79 gp_url_project( $sub_project->path, gp_url_join( $locale->slug, $set_slug) ),79 esc_url( gp_url_project( $sub_project->path, gp_url_join( $locale->slug, $set_slug ) ) ), 80 80 $sub_project->name, 81 81 $sub_project_status->percent_complete . '%' … … 88 88 printf( 89 89 '<li><a href="%s">%s <span>%s</span></a>', 90 gp_url_project( $_sub_project->path, gp_url_join( $locale->slug, $set_slug) ),90 esc_url( gp_url_project( $_sub_project->path, gp_url_join( $locale->slug, $set_slug ) ) ), 91 91 $_sub_project->name, 92 92 $status->percent_complete . '%' -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/locale-projects.php
r4996 r5502 69 69 printf( 70 70 '<li><a href="%s"%s>%s</a></li>', 71 gp_url_join( '/locale', $locale_slug, $set_slug, $top_level_project->slug),71 esc_url( gp_url_join( '/locale', $locale_slug, $set_slug, $top_level_project->slug ) ), 72 72 ( $top_level_project->path == $project_path ) ? ' class="current"' : '', 73 73 $top_level_project->name -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/projects-wp-plugins-contributors.php
r4512 r5502 32 32 <li><span>Contributors</span> 33 33 <ul> 34 <li><a href="<?php echo gp_url_project( $project); ?>">Projects</a></li>35 <li><a href="<?php echo gp_url_join( gp_url_project( $project), 'language-packs' ); ?>">Language Packs</a></li>34 <li><a href="<?php echo esc_url( gp_url_project( $project ) ); ?>">Projects</a></li> 35 <li><a href="<?php echo esc_url( gp_url_join( gp_url_project( $project ) ), 'language-packs' ); ?>">Language Packs</a></li> 36 36 </ul> 37 37 </li> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/projects-wp-plugins-language-packs.php
r2660 r5502 31 31 <li><span>Language Packs</span> 32 32 <ul> 33 <li><a href="<?php echo gp_url_project( $project); ?>">Projects</a></li>34 <li><a href="<?php echo gp_url_join( gp_url_project( $project), 'contributors' ); ?>">Contributors</a></li>33 <li><a href="<?php echo esc_url( gp_url_project( $project ) ); ?>">Projects</a></li> 34 <li><a href="<?php echo esc_url( gp_url_join( gp_url_project( $project ) ), 'contributors' ); ?>">Contributors</a></li> 35 35 </ul> 36 36 </li> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/projects-wp-plugins.php
r4513 r5502 37 37 <li><span>Projects</span> 38 38 <ul> 39 <li><a href="<?php echo gp_url_join( gp_url_project( $project), 'contributors' ); ?>">Contributors</a></li>40 <li><a href="<?php echo gp_url_join( gp_url_project( $project), 'language-packs' ); ?>">Language Packs</a></li>39 <li><a href="<?php echo esc_url( gp_url_join( gp_url_project( $project ) ), 'contributors' ); ?>">Contributors</a></li> 40 <li><a href="<?php echo esc_url( gp_url_join( gp_url_project( $project ) ), 'language-packs' ); ?>">Language Packs</a></li> 41 41 </ul> 42 42 </li> … … 90 90 <tr> 91 91 <th title="<?php echo esc_attr( $gp_locale->wp_locale ); ?>"> 92 <a href="<?php echo gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path) ); ?>">92 <a href="<?php echo esc_url( gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path ) ) ); ?>"> 93 93 <?php echo esc_html( $gp_locale->english_name ); ?> 94 94 </a> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/projects-wp-themes-contributors.php
r2864 r5502 32 32 <li><span>Contributors</span> 33 33 <ul> 34 <li><a href="<?php echo gp_url_project( $project); ?>">Projects</a></li>35 <li><a href="<?php echo gp_url_join( gp_url_project( $project), 'language-packs' ); ?>">Language Packs</a></li>34 <li><a href="<?php echo esc_url( gp_url_project( $project ) ); ?>">Projects</a></li> 35 <li><a href="<?php echo esc_url( gp_url_join( gp_url_project( $project ) ), 'language-packs' ); ?>">Language Packs</a></li> 36 36 </ul> 37 37 </li> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/projects-wp-themes-language-packs.php
r2864 r5502 31 31 <li><span>Language Packs</span> 32 32 <ul> 33 <li><a href="<?php echo gp_url_project( $project); ?>">Projects</a></li>34 <li><a href="<?php echo gp_url_join( gp_url_project( $project ), 'contributors'); ?>">Contributors</a></li>33 <li><a href="<?php echo esc_url( gp_url_project( $project ) ); ?>">Projects</a></li> 34 <li><a href="<?php echo esc_url( gp_url_join( gp_url_project( $project ), 'contributors' ) ); ?>">Contributors</a></li> 35 35 </ul> 36 36 </li> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/projects-wp-themes.php
r4187 r5502 34 34 <li><span>Projects</span> 35 35 <ul> 36 <li><a href="<?php echo gp_url_join( gp_url_project( $project ), 'contributors'); ?>">Contributors</a></li>37 <li><a href="<?php echo gp_url_join( gp_url_project( $project ), 'language-packs'); ?>">Language Packs</a></li>36 <li><a href="<?php echo esc_url( gp_url_join( gp_url_project( $project ), 'contributors' ) ); ?>">Contributors</a></li> 37 <li><a href="<?php echo esc_url( gp_url_join( gp_url_project( $project ), 'language-packs' ) ); ?>">Language Packs</a></li> 38 38 </ul> 39 39 </li> … … 81 81 <tr> 82 82 <th title="<?php echo esc_attr( $gp_locale->wp_locale ); ?>"> 83 <a href="<?php echo gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path) ); ?>">83 <a href="<?php echo esc_url( gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug, $project->path ) ) ); ?>"> 84 84 <?php echo esc_html( $gp_locale->english_name ); ?> 85 85 </a> -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/stats-overview.php
r4179 r5502 43 43 <tr> 44 44 <th title="<?php echo esc_attr( $gp_locale->english_name ); ?>"> 45 <a href="<?php echo gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug) ); ?>">45 <a href="<?php echo esc_url( gp_url( gp_url_join( 'locale', $gp_locale->slug, $set_slug ) ) ); ?>"> 46 46 <?php echo esc_html( $gp_locale->wp_locale ); ?> 47 47 </a> … … 63 63 } 64 64 $percent_class = 'percent' . $percent_class; 65 echo '<td data-column-title="' . esc_attr( $project_name ) . '" data-sort-value="'. esc_attr( $percent ) . '" class="' . $percent_class .'"><a href="' . $projecturl. '">' . number_format( $percent ) . '</a></td>';65 echo '<td data-column-title="' . esc_attr( $project_name ) . '" data-sort-value="'. esc_attr( $percent ) . '" class="' . $percent_class .'"><a href="' . esc_url( $projecturl ) . '">' . number_format( $percent ) . '</a></td>'; 66 66 } else { 67 67 $percent_class = 'percent' . (int) ( $percent / 10 ) * 10; 68 echo '<td data-column-title="' . esc_attr( $project_name ) . '" data-sort-value="' . esc_attr( $percent ) . '" class="' . $percent_class .'"><a href="' . $projecturl. '">' . $percent . '%</a></td>';68 echo '<td data-column-title="' . esc_attr( $project_name ) . '" data-sort-value="' . esc_attr( $percent ) . '" class="' . $percent_class .'"><a href="' . esc_url( $projecturl ) . '">' . $percent . '%</a></td>'; 69 69 } 70 70 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-routes/inc/routes/class-locale.php
r4996 r5502 17 17 class Locale extends GP_Route { 18 18 19 private $cache_group = 'wporg-translate'; 20 19 21 /** 20 22 * Adapter for the rosetta roles plugin. … … 49 51 $locale = GP_Locales::by_slug( $locale_slug ); 50 52 if ( ! $locale ) { 53 return $this->die_with_404(); 54 } 55 56 if ( ! $this->translation_set_slug_exists( $locale, $set_slug ) ) { 51 57 return $this->die_with_404(); 52 58 } … … 88 94 } 89 95 90 91 96 $paged_sub_projects = $this->get_paged_active_sub_projects( 92 97 $project, … … 136 141 $can_create_locale_glossary = GP::$permission->current_user_can( 'admin' ); 137 142 $locale_glossary_translation_set = GP::$translation_set->by_project_id_slug_and_locale( 0, $set_slug, $locale_slug ); 138 $locale_glossary = GP::$glossary->by_set_id( $locale_glossary_translation_set->id ); 143 $locale_glossary = false; 144 if ( $locale_glossary_translation_set ) { 145 $locale_glossary = GP::$glossary->by_set_id( $locale_glossary_translation_set->id ); 146 } 139 147 140 148 $this->tmpl( 'locale-projects', get_defined_vars() ); … … 152 160 $locale = GP_Locales::by_slug( $locale_slug ); 153 161 if ( ! $locale ) { 162 return $this->die_with_404(); 163 } 164 165 if ( ! $this->translation_set_slug_exists( $locale, $set_slug ) ) { 154 166 return $this->die_with_404(); 155 167 } … … 198 210 199 211 $this->tmpl( 'locale-project', get_defined_vars() ); 212 } 213 214 /** 215 * Whether a translation set slug exists for a locale. 216 * 217 * @param \GP_Locale $locale The locale. 218 * @param string $slug The slug of a translation set. 219 * @return bool True if slug exists, false if not. 220 */ 221 private function translation_set_slug_exists( $locale, $slug ) { 222 $cache_key = "translation_set_slugs:{$locale->slug}"; 223 $slugs = wp_cache_get( $cache_key, $this->cache_group ); 224 225 if ( false === $slugs ) { 226 global $wpdb; 227 $slugs = $wpdb->get_col( $wpdb->prepare( 228 "SELECT DISTINCT(slug) FROM {$wpdb->gp_translation_sets} WHERE locale = %s", 229 $locale->slug 230 ) ); 231 232 wp_cache_set( $cache_key, $slugs, $this->cache_group, DAY_IN_SECONDS ); 233 } 234 235 return in_array( $slug, $slugs, true ); 200 236 } 201 237
Note: See TracChangeset
for help on using the changeset viewer.