Changeset 9312
- Timestamp:
- 12/05/2019 06:37:42 AM (5 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php
r8751 r9312 362 362 return $sub_projects; 363 363 } 364 365 /** 366 * Localize any WordPress.org links. 367 * 368 * @param string $content The content to search for WordPress.org links in. 369 * @param string $wp_locale The WP_Locale subdomain that the content should reference. 370 * @return string Filtered $content where any WordPress.org links have been replaced with $wp_locale subdomain links. 371 */ 372 function localize_links( $content, $wp_locale = false ) { 373 global $wpdb; 374 375 static $subdomains = null; 376 if ( is_null( $subdomains ) && $wp_locale ) { 377 $subdomains = $wpdb->get_results( 'SELECT locale, subdomain FROM wporg_locales', OBJECT_K ); 378 } 379 380 if ( $wp_locale && isset( $subdomains[ $wp_locale ] ) ) { 381 $content = preg_replace( 382 '!(?<=[\'"])https?://wordpress.org/!i', // Only match when it's a url within an attribute. 383 'https://' . $subdomains[ $wp_locale ]->subdomain . '.wordpress.org/', 384 $content 385 ); 386 } 387 388 return $content; 389 } 364 390 } -
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/templates/locale-project.php
r8558 r9312 12 12 13 13 <div class="project-header"> 14 <p class="project-description"><?php echo $sub_project->description; ?></p> 14 <p class="project-description"><?php 15 $description = apply_filters( 'project_description', $sub_project->description, $sub_project ); 16 17 // Localize the links to the currently viewed locale. 18 $description = WordPressdotorg\GlotPress\Customizations\Plugin::get_instance()->localize_links( $description, $locale->wp_locale ); 19 20 echo $description; 21 ?></p> 15 22 16 23 <div class="project-box percent-<?php echo $project_status->percent_complete; ?>"> … … 33 40 <?php 34 41 foreach ( $variants as $variant ) { 35 $selected =36 42 printf( 37 43 '<option name="%s" data-project-url="%s"%s>%s</option>',
Note: See TracChangeset
for help on using the changeset viewer.