- Timestamp:
- 01/16/2011 12:41:03 AM (16 months ago)
- Location:
- trunk/WordPress/plugin/transposh
- Files:
-
- 5 edited
-
transposh.php (modified) (7 diffs)
-
wp/transposh_3rdparty.php (modified) (2 diffs)
-
wp/transposh_admin.php (modified) (1 diff)
-
wp/transposh_ajax.php (modified) (1 diff)
-
wp/transposh_widget.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/transposh.php
r580 r599 89 89 /** @var might be that page is json... */ 90 90 private $attempt_json = false; 91 /** @var boolean Is the wp_redirect being called by transposh? */ 92 private $transposh_redirect = false; 91 93 92 94 /** … … 161 163 162 164 // debug function for bad redirects 163 //add_filter('wp_redirect', array(&$this, 'on_wp_redirect'), 10, 2);165 add_filter('wp_redirect', array(&$this, 'on_wp_redirect'), 10, 2); 164 166 add_filter('redirect_canonical', array(&$this, 'on_redirect_canonical'), 10, 2); 165 167 // … … 175 177 } 176 178 177 // function on_wp_redirect($location, $status) { 178 // logger($location); 179 // logger($status); 180 // $trace = debug_backtrace(); 181 // logger($trace); 182 // return $location; 183 // } 179 /** 180 * Attempt to fix a wp_redirect being called by someone else to include the language 181 * hoping for no cycles 182 * @param string $location 183 * @param int $status 184 * @return string 185 */ 186 function on_wp_redirect($location, $status) { 187 if ($this->transposh_redirect) return $location; 188 logger($status . ' ' . $location); 189 // $trace = debug_backtrace(); 190 // logger($trace); 191 // logger($this->target_language); 192 $location = str_replace(array('%2F', '%3A', '%3B', '%3F', '%3D', '%26'), array('/', ':', ';', '?', '=', '&'), urlencode($this->rewrite_url($location))); 193 return $location; 194 } 195 196 /** 197 * Internally used by transposh redirection, to avoid being rewritten by self 198 * assuming we know what we are doing when redirecting 199 * @param string $location 200 * @param int $status 201 */ 202 function tp_redirect($location, $status = 302) { 203 $this->transposh_redirect = true; 204 wp_redirect($location, $status); 205 } 184 206 185 207 /** … … 265 287 if (file_exists(ABSPATH . $wp->query_vars['pagename'])) { 266 288 logger('Redirecting a static file ' . $wp->query_vars['pagename'], 1); 267 wp_redirect('/' . $wp->query_vars['pagename'], 301);289 $this->tp_redirect('/' . $wp->query_vars['pagename'], 301); 268 290 } 269 291 } … … 449 471 $url = transposh_utils::cleanup_url($_SERVER["REQUEST_URI"], $this->home_url); 450 472 logger("redirected to $url because of cookie", 4); 451 wp_redirect($url);473 $this->tp_redirect($url); 452 474 exit; 453 475 } … … 461 483 $url = transposh_utils::cleanup_url($_SERVER['REQUEST_URI'], $this->home_url); 462 484 logger("redirected to $url because of bestlang", 4); 463 wp_redirect($url);485 $this->tp_redirect($url); 464 486 exit; 465 487 } … … 477 499 } 478 500 if (transposh_utils::get_language_from_url($_SERVER['HTTP_REFERER'], $this->home_url) && !transposh_utils::get_language_from_url($_SERVER['REQUEST_URI'], $this->home_url)) { 479 wp_redirect(transposh_utils::rewrite_url_lang_param($_SERVER["REQUEST_URI"], $this->home_url, $this->enable_permalinks_rewrite, transposh_utils::get_language_from_url($_SERVER['HTTP_REFERER'], $this->home_url), false)); //."&stop=y");501 $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['HTTP_REFERER'], $this->home_url), false)); //."&stop=y"); 480 502 exit; 481 503 } -
trunk/WordPress/plugin/transposh/wp/transposh_3rdparty.php
r558 r599 38 38 add_action('bp_activity_after_save', array(&$this, 'bp_activity_after_save')); 39 39 add_action('transposh_human_translation', array(&$this, 'transposh_buddypress_stream'), 10, 3); 40 40 //bp_activity_permalink_redirect_url (can fit here if generic setting fails) 41 41 42 // google xml sitemaps - with patch 42 43 add_action('sm_addurl', array(&$this, 'add_sm_transposh_urls')); … … 190 191 191 192 } 193 192 194 ?> -
trunk/WordPress/plugin/transposh/wp/transposh_admin.php
r587 r599 267 267 268 268 // lets redirect the post request into get request (you may add additional params at the url, if you need to show save results 269 wp_redirect($_POST['_wp_http_referer']);269 $this->transposh->tp_redirect($_POST['_wp_http_referer']); 270 270 } 271 271 -
trunk/WordPress/plugin/transposh/wp/transposh_ajax.php
r587 r599 68 68 setcookie('TR_LNG', transposh_utils::get_language_from_url($_SERVER['HTTP_REFERER'], $my_transposh_plugin->home_url), time() + 90 * 24 * 60 * 60, COOKIEPATH, COOKIE_DOMAIN); 69 69 if ($_SERVER['HTTP_REFERER']) { 70 wp_redirect($_SERVER['HTTP_REFERER']);70 $this->transposh->tp_redirect($_SERVER['HTTP_REFERER']); 71 71 } else { 72 wp_redirect($my_transposh_plugin->home_url);72 $this->transposh->tp_redirect($my_transposh_plugin->home_url); 73 73 } 74 74 } -
trunk/WordPress/plugin/transposh/wp/transposh_widget.php
r588 r599 71 71 logger("Widget redirect url: $ref", 3); 72 72 73 wp_redirect($ref);73 $this->transposh->tp_redirect($ref); 74 74 exit; 75 75 } … … 277 277 echo '<div id="' . SPAN_PREFIX . 'credit">'; 278 278 if (!$this->transposh->options->get_widget_remove_logo()) { 279 echo 'by <a href="http://tran' . 'sposh.org/' . $extralang . '"><img class="' . NO_TRANSLATE_CLASS . '"height="16" width="16" src="' .279 echo 'by <a href="http://tran' . 'sposh.org/' . $extralang . '"><img height="16" width="16" src="' . 280 280 $plugpath . '/img/tplog' . 'o.png" style="padding:1px;border:0px" title="' . $tagline . '" alt="' . $tagline . '"/></a>'; 281 281 }
Note: See TracChangeset
for help on using the changeset viewer.
