- Timestamp:
- 12/11/2011 07:58:43 PM (5 months ago)
- Location:
- trunk/WordPress/plugin/transposh
- Files:
-
- 2 edited
-
core/utils.php (modified) (2 diffs)
-
transposh.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WordPress/plugin/transposh/core/utils.php
r667 r696 396 396 // | ( "1" [ "." 0*3("0") ] ) 397 397 preg_match_all("/([[:alpha:]]{1,8})(-([[:alpha:]|-]{1,8}))?" . 398 "(\s*;\s*q\s*=\s*(1\.0{0,3}|0\.\d{0,3}))?\s*(,|$)/i", 399 $http_accept_language, $hits, PREG_SET_ORDER); 398 "(\s*;\s*q\s*=\s*(1\.0{0,3}|0\.\d{0,3}))?\s*(,|$)/i", $http_accept_language, $hits, PREG_SET_ORDER); 400 399 401 400 // default language (in case of no hits) is the first in the array … … 433 432 } 434 433 434 public static function allow_cors() { 435 header('Access-Control-Allow-Origin: *'); 436 header('Access-Control-Allow-Methods: GET, POST, OPTIONS'); 437 header('Access-Control-Allow-Headers: X-Requested-With'); 438 header('Access-Control-Max-Age: 86400'); 439 } 440 435 441 } 436 442 -
trunk/WordPress/plugin/transposh/transposh.php
r682 r696 709 709 function add_transposh_js() { 710 710 //not in any translation mode - no need for any js. 711 if (!($this->edit_mode || $this->is_auto_translate_permitted() || is_admin())) return; // TODO, check just for settings page admin and pages with our translate 711 if (!($this->edit_mode || $this->is_auto_translate_permitted() || is_admin())) 712 return; // TODO, check just for settings page admin and pages with our translate 712 713 713 714 wp_enqueue_script('transposh', $this->transposh_plugin_url . '/' . TRANSPOSH_DIR_JS . '/transposh.js', array('jquery'), TRANSPOSH_PLUGIN_VER); … … 1200 1201 // we need curl for this proxy 1201 1202 if (!function_exists('curl_init')) return; 1203 transposh_utils::allow_cors(); 1202 1204 $tl = $_GET['tl']; 1203 1205 // we want to avoid unneeded work or dos attacks on languages we don't support … … 1247 1249 // we need curl for this proxy 1248 1250 if (!function_exists('curl_init')) return; 1251 transposh_utils::allow_cors(); 1249 1252 // target language 1250 1253 $tl = $_GET['tl']; … … 1343 1346 function on_ajax_nopriv_tp_history() { 1344 1347 // deleting 1348 transposh_utils::allow_cors(); 1345 1349 if (isset($_GET['timestamp'])) { 1346 1350 $this->database->del_translation_history($_GET['token'], $_GET['lang'], $_GET['timestamp']); … … 1352 1356 // the case of posted translation 1353 1357 function on_ajax_nopriv_tp_translation() { 1358 transposh_utils::allow_cors(); 1354 1359 do_action('transposh_translation_posted'); 1355 1360 $this->database->update_translation(); … … 1359 1364 // getting translation alternates 1360 1365 function on_ajax_nopriv_tp_trans_alts() { 1366 transposh_utils::allow_cors(); 1361 1367 $this->database->get_translation_alt($_GET['token']); 1362 1368 die();
Note: See TracChangeset
for help on using the changeset viewer.
