Changeset 9180
- Timestamp:
- 10/15/2019 06:53:44 AM (5 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
r9013 r9180 836 836 wp_cache_add_global_groups( array( 'locale-associations' ) ); 837 837 838 // Google doesn't have support for a whole lot of languages and throws errors about it, 839 // so we exclude them, as we're otherwise outputting data that isn't used at all. 840 $unsupported_languages = array( 841 'arq', 842 'art', 843 'art-xemoji', 844 'ary', 845 'ast', 846 'az-ir', 847 'azb', 848 'bcc', 849 'ff-sn', 850 'frp', 851 'fuc', 852 'fur', 853 'haz', 854 'ido', 855 'io', 856 'kab', 857 'li', 858 'li-nl', 859 'lmo', 860 'me', 861 'me-me', 862 'rhg', 863 'rup', 864 'sah', 865 'sc-it', 866 'scn', 867 'skr', 868 'srd', 869 'szl', 870 'tah', 871 'twd', 872 'ty-tj', 873 'tzm', 874 ); 875 838 876 // WARNING: for any changes below, check other uses of the `locale-assosciations` group as there's shared cache keys in use. 839 877 $cache_key = $post ? 'local-sites-' . $post->post_name : 'local-sites'; … … 863 901 } 864 902 903 // Skip unsupported locales. 904 if ( in_array( $gp_locale->slug, $unsupported_languages ) ) { 905 unset( $sites[ $key ] ); 906 continue; 907 } 908 865 909 $sites[ $key ]->subdomain = $subdomains[ $site->wp_locale ]->subdomain; 910 911 // Skip non-existing subdomains, e.g. 'de_CH_informal'. 912 if ( false !== strpos( $site->subdomain, '_' ) ) { 913 unset( $sites[ $key ] ); 914 continue; 915 } 866 916 867 917 // Note that Google only supports ISO 639-1 codes. -
sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/theme-directory.php
r8913 r9180 1105 1105 wp_cache_add_global_groups( array( 'locale-associations' ) ); 1106 1106 1107 // Google doesn't have support for a whole lot of languages and throws errors about it, 1108 // so we exclude them, as we're otherwise outputting data that isn't used at all. 1109 $unsupported_languages = array( 1110 'arq', 1111 'art', 1112 'art-xemoji', 1113 'ary', 1114 'ast', 1115 'az-ir', 1116 'azb', 1117 'bcc', 1118 'ff-sn', 1119 'frp', 1120 'fuc', 1121 'fur', 1122 'haz', 1123 'ido', 1124 'io', 1125 'kab', 1126 'li', 1127 'li-nl', 1128 'lmo', 1129 'me', 1130 'me-me', 1131 'rhg', 1132 'rup', 1133 'sah', 1134 'sc-it', 1135 'scn', 1136 'skr', 1137 'srd', 1138 'szl', 1139 'tah', 1140 'twd', 1141 'ty-tj', 1142 'tzm', 1143 ); 1144 1145 // WARNING: for any changes below, check other uses of the `locale-assosciations` group as there's shared cache keys in use. 1107 1146 if ( false === ( $sites = wp_cache_get( 'local-sites', 'locale-associations' ) ) ) { 1108 1147 global $wpdb; … … 1115 1154 require_once GLOTPRESS_LOCALES_PATH; 1116 1155 1117 foreach ( $sites as $ site ) {1156 foreach ( $sites as $key => $site ) { 1118 1157 $gp_locale = GP_Locales::by_field( 'wp_locale', $site->locale ); 1119 1158 if ( ! $gp_locale ) { 1120 unset( $sites[ $site->locale ] ); 1159 unset( $sites[ $key ] ); 1160 continue; 1161 } 1162 1163 // Skip non-existing subdomains, e.g. 'de_CH_informal'. 1164 if ( false !== strpos( $site->subdomain, '_' ) ) { 1165 unset( $sites[ $key ] ); 1166 continue; 1167 } 1168 1169 // Skip unsupported locales. 1170 if ( in_array( $gp_locale->slug, $unsupported_languages ) ) { 1171 unset( $sites[ $key ] ); 1121 1172 continue; 1122 1173 } … … 1135 1186 } 1136 1187 1137 if ( $hreflang && 'art' !== $hreflang) {1138 $sites[ $ site->locale]->hreflang = strtolower( $hreflang );1188 if ( $hreflang ) { 1189 $sites[ $key ]->hreflang = strtolower( $hreflang ); 1139 1190 } else { 1140 unset( $sites[ $ site->locale] );1191 unset( $sites[ $key ] ); 1141 1192 } 1142 1193 } -
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg/functions.php
r8571 r9180 238 238 $sites = wp_cache_get( 'local-sites', 'locale-associations' ); 239 239 240 // WARNING: for any changes below, check other uses of the `locale-assosciations` group as there's shared cache keys in use. 240 241 if ( false === $sites ) { 241 242 global $wpdb; … … 249 250 require_once GLOTPRESS_LOCALES_PATH; 250 251 251 foreach ( $sites as $ site ) {252 foreach ( $sites as $key => $site ) { 252 253 $gp_locale = \GP_Locales::by_field( 'wp_locale', $site->locale ); 253 254 if ( ! $gp_locale ) { 254 unset( $sites[ $ site->locale] );255 unset( $sites[ $key ] ); 255 256 continue; 256 257 } … … 258 259 // Skip non-existing subdomains, e.g. 'de_CH_informal'. 259 260 if ( false !== strpos( $site->subdomain, '_' ) ) { 260 unset( $sites[ $ site->locale] );261 unset( $sites[ $key ] ); 261 262 continue; 262 263 } 263 264 264 if ( isset( $gp_locale->slug ) && ! in_array( $gp_locale->slug, $unsupported_languages ) ) { 265 $sites[ $site->locale ]->hreflang = $gp_locale->slug; 265 // Skip unsupported locales. 266 if ( in_array( $gp_locale->slug, $unsupported_languages ) ) { 267 unset( $sites[ $key ] ); 268 continue; 269 } 270 271 $hreflang = false; 272 273 // Note that Google only supports ISO 639-1 codes. 274 if ( isset( $gp_locale->lang_code_iso_639_1 ) && isset( $gp_locale->country_code ) ) { 275 $hreflang = $gp_locale->lang_code_iso_639_1 . '-' . $gp_locale->country_code; 276 } elseif ( isset( $gp_locale->lang_code_iso_639_1 ) ) { 277 $hreflang = $gp_locale->lang_code_iso_639_1; 278 } elseif ( isset( $gp_locale->lang_code_iso_639_2 ) ) { 279 $hreflang = $gp_locale->lang_code_iso_639_2; 280 } elseif ( isset( $gp_locale->lang_code_iso_639_3 ) ) { 281 $hreflang = $gp_locale->lang_code_iso_639_3; 282 } 283 284 if ( $hreflang ) { 285 $sites[ $key ]->hreflang = strtolower( $hreflang ); 266 286 } else { 267 unset( $sites[ $ site->locale] );287 unset( $sites[ $key ] ); 268 288 } 269 289 }
Note: See TracChangeset
for help on using the changeset viewer.