Changeset 9313
- Timestamp:
- 12/05/2019 06:46:34 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/wporg-gp-customizations/inc/class-plugin.php
r9312 r9313 370 370 * @return string Filtered $content where any WordPress.org links have been replaced with $wp_locale subdomain links. 371 371 */ 372 function localize_links( $content, $wp_locale = false) {372 function localize_links( $content, $wp_locale ) { 373 373 global $wpdb; 374 374 375 static $subdomains = null;376 if ( is_null( $subdomains ) && $wp_locale) {377 $subdomain s = $wpdb->get_results( 'SELECT locale, subdomain FROM wporg_locales', OBJECT_K);378 } 379 380 if ( $ wp_locale && isset( $subdomains[ $wp_locale ] )) {375 static $subdomains = []; 376 if ( ! isset( $subdomains[ $wp_locale ] ) ) { 377 $subdomain[ $wp_locale ] = $wpdb->get_var( $wpdb->prepare( 'SELECT subdomain FROM wporg_locales WHERE locale = %s LIMIT 1', $wp_locale ) ); 378 } 379 380 if ( $subdomains[ $wp_locale ] ) { 381 381 $content = preg_replace( 382 382 '!(?<=[\'"])https?://wordpress.org/!i', // Only match when it's a url within an attribute. 383 'https://' . $subdomains[ $wp_locale ] ->subdomain. '.wordpress.org/',383 'https://' . $subdomains[ $wp_locale ] . '.wordpress.org/', 384 384 $content 385 385 );
Note: See TracChangeset
for help on using the changeset viewer.