Changeset 7898
- Timestamp:
- 11/26/2018 04:51:14 AM (6 years ago)
- Location:
- sites/trunk/wordpress.org/public_html/wp-content
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/class-template.php
r7282 r7898 783 783 ); 784 784 785 // Add x-default to the list of sites. 786 $sites['x-default'] = (object) array( 787 'locale' => 'x-default', 788 'hreflang' => 'x-default', 789 'subdomain' => '', 790 ); 791 785 792 uasort( $sites, function( $a, $b ) { 786 793 return strcasecmp( $a->hreflang, $b->hreflang ); … … 788 795 789 796 wp_cache_set( 'local-sites-' . get_post()->post_name, $sites, 'locale-associations', DAY_IN_SECONDS ); 797 } 798 799 if ( is_singular() ) { 800 $path = parse_url( get_permalink(), PHP_URL_PATH ); 801 if ( get_query_var( 'plugin_advanced' ) ) { 802 $path .= 'advanced/'; 803 } 804 } else { 805 // WordPress doesn't have a good way to get the canonical version of non-singular urls. 806 $path = $_SERVER['REQUEST_URI']; // phpcs:ignore 790 807 } 791 808 … … 794 811 'https://%swordpress.org%s', 795 812 $site->subdomain ? "{$site->subdomain}." : '', 796 $ _SERVER['REQUEST_URI']813 $path 797 814 ); 798 815 -
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
r7600 r7898 1090 1090 */ 1091 1091 function wporg_themes_add_hreflang_link_attributes() { 1092 if ( is_404() ) { 1093 return; 1094 } 1095 1092 1096 wp_cache_add_global_groups( array( 'locale-associations' ) ); 1093 1097 … … 1136 1140 ); 1137 1141 1142 // Add x-default to the list of sites. 1143 $sites['x-default'] = (object) array( 1144 'locale' => 'x-default', 1145 'hreflang' => 'x-default', 1146 'subdomain' => '', 1147 ); 1148 1138 1149 uasort( $sites, function( $a, $b ) { 1139 1150 return strcasecmp( $a->hreflang, $b->hreflang ); … … 1141 1152 1142 1153 wp_cache_set( 'local-sites', $sites, 'locale-associations' ); 1154 } 1155 1156 if ( is_singular() ) { 1157 $path = parse_url( get_permalink(), PHP_URL_PATH ); 1158 } else { 1159 // WordPress doesn't have a good way to get the canonical version of non-singular urls. 1160 $path = $_SERVER['REQUEST_URI']; // phpcs:ignore 1143 1161 } 1144 1162 … … 1147 1165 'https://%swordpress.org%s', 1148 1166 $site->subdomain ? "{$site->subdomain}." : '', 1149 $ _SERVER[ 'REQUEST_URI' ]1167 $path 1150 1168 ); 1151 1169 -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/functions.php
r7641 r7898 191 191 */ 192 192 function hreflang_link_attributes() { 193 // No hreflangs on 404 pages. 194 if ( is_404() ) { 195 return; 196 } 197 193 198 wp_cache_add_global_groups( array( 'locale-associations' ) ); 194 199 … … 265 270 ); 266 271 272 // Add x-default to the list of sites. 273 $sites['x-default'] = (object) array( 274 'locale' => 'x-default', 275 'hreflang' => 'x-default', 276 'subdomain' => '', 277 ); 278 267 279 uasort( $sites, function( $a, $b ) { 268 280 return strcasecmp( $a->hreflang, $b->hreflang ); … … 270 282 271 283 wp_cache_set( 'local-sites', $sites, 'locale-associations' ); 284 } 285 286 if ( is_singular() ) { 287 $path = parse_url( get_permalink(), PHP_URL_PATH ); 288 } else { 289 // WordPress doesn't have a good way to get the canonical version of non-singular urls. 290 $path = $_SERVER['REQUEST_URI']; // phpcs:ignore 272 291 } 273 292 … … 276 295 'https://%swordpress.org%s', 277 296 $site->subdomain ? "{$site->subdomain}." : '', 278 $ _SERVER['REQUEST_URI'] // phpcs:ignore297 $path 279 298 ); 280 299
Note: See TracChangeset
for help on using the changeset viewer.