Plugin Directory

Changeset 1593555


Ignore:
Timestamp:
02/10/2017 10:27:24 PM (9 years ago)
Author:
bjoerne
Message:

Version 1.0.3. See readme.txt

Location:
language-redirect/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • language-redirect/trunk/language-redirect.php

    r1432257 r1593555  
    2828
    2929function 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() ) {
    3134        return;
    3235    }
     
    5962}
    6063
    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;
     64function 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;
    7368}
    7469
  • language-redirect/trunk/readme.txt

    r1580628 r1593555  
    44Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=XS98Y5ASSH5S4
    55Requires at least: 3.4
    6 Tested up to: 4.7.1
     6Tested up to: 4.7.2
    77Stable tag: trunk
    88License: GPLv3
     
    4646* Support country based locales like en-US
    4747* 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.