/**
  * This filter method helps buddypress understand the transposh generated URLs
  * @param string $uri The url that was originally received
  * @return string The url that buddypress should see
  */
 function bp_uri_filter($uri)
 {
     $lang = transposh_utils::get_language_from_url($uri, $this->transposh->home_url);
     //TODO - check using get_clean_url
     $uri = transposh_utils::cleanup_url($uri, $this->transposh->home_url);
     if ($this->transposh->options->enable_url_translate) {
         $uri = transposh_utils::get_original_url($uri, '', $lang, array($this->transposh->database, 'fetch_original'));
     }
     return $uri;
 }
Exemple #2
0
 /**
  * This function enables the correct parsing of translated URLs
  * @global object $wp the wordpress global
  * @param array $query
  * @return $query
  */
 function request_filter($query)
 {
     //We only do this once, and if we have a lang
     $requri = $_SERVER['REQUEST_URI'];
     $lang = transposh_utils::get_language_from_url($requri, $this->home_url);
     if ($lang && !$this->got_request) {
         tp_logger('Trying to find original url');
         $this->got_request = true;
         // the trick is to replace the URI and put it back afterwards
         $_SERVER['REQUEST_URI'] = transposh_utils::get_original_url($requri, '', $lang, array($this->database, 'fetch_original'));
         global $wp;
         $wp->parse_request();
         $query = $wp->query_vars;
         $_SERVER['REQUEST_URI'] = $requri;
         tp_logger('new query vars are');
         tp_logger($query);
     }
     return $query;
 }