Changeset 621 for trunk


Ignore:
Timestamp:
03/05/2011 08:30:02 PM (15 months ago)
Author:
ofer
Message:

Make bots redirect on edit pages so they won't index those

Location:
trunk/WordPress/plugin/transposh
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/WordPress/plugin/transposh/core/utils.php

    r613 r621  
    426426    } 
    427427 
     428    public static function is_bot() { 
     429        return preg_match("#(bot|yandex|validator|google|jeeves|spider|crawler|slurp)#si", $_SERVER['HTTP_USER_AGENT']); 
     430    } 
     431 
    428432} 
    429433 
  • trunk/WordPress/plugin/transposh/transposh.php

    r620 r621  
    463463        if (($this->options->get_enable_detect_language() || $this->options->get_widget_allow_set_default_language()) && 
    464464                !($this->is_special_page($_SERVER['REQUEST_URI']) || strpos($_SERVER['HTTP_REFERER'], $this->home_url) !== false) && 
    465                 !(preg_match("#(bot|yandex|validator|google|jeeves|spider|crawler|slurp)#si", $_SERVER['HTTP_USER_AGENT']))) { 
     465                !(transposh_utils::is_bot())) { 
    466466            // we are starting a session if needed 
    467467            if (!session_id()) session_start(); 
     
    513513        if (isset($wp->query_vars[EDIT_PARAM]) && $wp->query_vars[EDIT_PARAM] && $this->is_editing_permitted()) { 
    514514            $this->edit_mode = true; 
     515            // redirect bots away from edit pages to avoid double indexing 
     516            if (transposh_utils::is_bot()) { 
     517                $this->tp_redirect(transposh_utils::rewrite_url_lang_param($_SERVER["REQUEST_URI"], $this->home_url, $this->enable_permalinks_rewrite, transposh_utils::get_language_from_url($_SERVER["REQUEST_URI"], $this->home_url), false)); //."&stop=y"); 
     518                exit; 
     519            } 
    515520        } else { 
    516521            $this->edit_mode = false; 
Note: See TracChangeset for help on using the changeset viewer.