Changeset 1593555
- Timestamp:
- 02/10/2017 10:27:24 PM (9 years ago)
- Location:
- language-redirect/trunk
- Files:
-
- 2 edited
-
language-redirect.php (modified) (2 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
language-redirect/trunk/language-redirect.php
r1432257 r1593555 28 28 29 29 function language_redirect_plugins_loaded() { 30 if ( language_redirect_is_login() ) { 30 if ( ! defined( 'WP_USE_THEMES' ) ) { 31 return; 32 } 33 if ( language_redirect_is_robots_txt() ) { 31 34 return; 32 35 } … … 59 62 } 60 63 61 function language_redirect_is_login() { 62 $request_protocol = array_key_exists( 'HTTPS', $_SERVER ) && $_SERVER['HTTPS'] ? 'https' : 'http'; 63 $request_port = $_SERVER['SERVER_PORT'] == '80' ? '' : ':'.$_SERVER['SERVER_PORT']; 64 $request_url = $request_protocol . '://' . $_SERVER['HTTP_HOST'] . $request_port . $_SERVER['PHP_SELF']; 65 if ( strpos( $request_url, site_url() ) !== 0 ) { 66 return false; 67 } 68 $relative_url = substr( $request_url, strlen( site_url() ) ); 69 if ( $relative_url == '/wp-login.php' ) { 70 return true; 71 } 72 return false; 64 function language_redirect_is_robots_txt() { 65 $home_path = parse_url( home_url() ); 66 $robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => 'index.php' . '?robots=1' ) : array(); 67 return $robots_rewrite; 73 68 } 74 69 -
language-redirect/trunk/readme.txt
r1580628 r1593555 4 4 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XS98Y5ASSH5S4 5 5 Requires at least: 3.4 6 Tested up to: 4.7. 16 Tested up to: 4.7.2 7 7 Stable tag: trunk 8 8 License: GPLv3 … … 46 46 * Support country based locales like en-US 47 47 * Try to match languages prefixes of country based locales as a fallback, e.g. given 'en-US' in header and 'en' in configuration 48 49 = 1.0.3 = 50 * Redirect only if /index.php was invoked. This is the case for all frontend visits. 51 * Don't redirect robots.txt 52 * Delete options when plugin is uninstalled
Note: See TracChangeset
for help on using the changeset viewer.