Transposh WordPress Translation - Version 0.2.6

Version Description

Download this release

Release Info

Developer oferwald
Plugin Icon 128x128 Transposh WordPress Translation
Version 0.2.6
Comparing to
See all releases

Code changes from version 0.2.5 to 0.2.6

core/utils.php CHANGED
@@ -30,10 +30,12 @@ require_once("constants.php");
30
  * Return the scrubed url
31
  */
32
  function cleanup_url($url, $remove_host = false) {
 
 
33
  $parsedurl = parse_url($url);
34
  //cleanup previous lang & edit parameter from url
35
 
36
- if ($parsedurl['query']) {
37
  $params = explode('&',$parsedurl['query']);
38
  foreach ($params as $key => $param) {
39
  if (stripos($param,LANG_PARAM) === 0) unset ($params[$key]);
@@ -42,7 +44,7 @@ function cleanup_url($url, $remove_host = false) {
42
  }
43
  // clean the query
44
  unset($parsedurl['query']);
45
- if($params) {
46
  $parsedurl['query'] = implode('&',$params);
47
  }
48
 
@@ -58,8 +60,8 @@ function cleanup_url($url, $remove_host = false) {
58
  }
59
  }
60
  if ($remove_host) {
61
- unset ($parsedurl[scheme]);
62
- unset ($parsedurl[host]);
63
  }
64
  $url = glue_url($parsedurl);
65
  return $url;
@@ -81,12 +83,12 @@ function rewrite_url_lang_param($url, $lang, $is_edit, $use_params_only=FALSE) {
81
  $parsedurl = parse_url($newurl);
82
 
83
  // if we are dealing with some other url, we won't touch it!
84
- if ($parsedurl['host'] && !($parsedurl['host'] == parse_url($home_url,PHP_URL_HOST))) {
85
  return $url;
86
  }
87
 
88
  //remove prev lang and edit params - from query string - reserve other params
89
- if ($parsedurl['query']) {
90
  $params = explode('&',$parsedurl['query']);
91
  foreach ($params as $key => $param) {
92
  if (stripos($param,LANG_PARAM) === 0) unset ($params[$key]);
@@ -97,6 +99,13 @@ function rewrite_url_lang_param($url, $lang, $is_edit, $use_params_only=FALSE) {
97
  unset($parsedurl['query']);
98
 
99
  //remove the language from the url permalink (if in start of path, and is a defined language)
 
 
 
 
 
 
 
100
  if (strlen($parsedurl['path']) > 2) {
101
  $secondslashpos = strpos($parsedurl['path'], "/",1);
102
  if (!$secondslashpos) $secondslashpos = strlen($parsedurl['path']);
@@ -118,16 +127,17 @@ function rewrite_url_lang_param($url, $lang, $is_edit, $use_params_only=FALSE) {
118
  }
119
 
120
  if($use_params_only) {
121
- $params[lang] = LANG_PARAM . "=$lang";
122
  }
123
  else {
124
  if (!$parsedurl['path']) $parsedurl['path'] = "/";
125
  $parsedurl['path'] = "/".$lang.$parsedurl['path'];
 
126
  }
127
 
128
 
129
  //insert params to url
130
- if($params) {
131
  $parsedurl['query'] = implode('&',$params);
132
  }
133
 
30
  * Return the scrubed url
31
  */
32
  function cleanup_url($url, $remove_host = false) {
33
+ global $languages;
34
+
35
  $parsedurl = parse_url($url);
36
  //cleanup previous lang & edit parameter from url
37
 
38
+ if (isset($parsedurl['query'])) {
39
  $params = explode('&',$parsedurl['query']);
40
  foreach ($params as $key => $param) {
41
  if (stripos($param,LANG_PARAM) === 0) unset ($params[$key]);
44
  }
45
  // clean the query
46
  unset($parsedurl['query']);
47
+ if(isset($params) && $params) {
48
  $parsedurl['query'] = implode('&',$params);
49
  }
50
 
60
  }
61
  }
62
  if ($remove_host) {
63
+ unset ($parsedurl['scheme']);
64
+ unset ($parsedurl['host']);
65
  }
66
  $url = glue_url($parsedurl);
67
  return $url;
83
  $parsedurl = parse_url($newurl);
84
 
85
  // if we are dealing with some other url, we won't touch it!
86
+ if (isset($parsedurl['host']) && !($parsedurl['host'] == parse_url($home_url,PHP_URL_HOST))) {
87
  return $url;
88
  }
89
 
90
  //remove prev lang and edit params - from query string - reserve other params
91
+ if (isset($parsedurl['query'])) {
92
  $params = explode('&',$parsedurl['query']);
93
  foreach ($params as $key => $param) {
94
  if (stripos($param,LANG_PARAM) === 0) unset ($params[$key]);
99
  unset($parsedurl['query']);
100
 
101
  //remove the language from the url permalink (if in start of path, and is a defined language)
102
+ $home_path = rtrim(parse_url($home_url,PHP_URL_PATH),"/");
103
+
104
+ if ($home_path && strpos($parsedurl['path'], $home_path) === 0) {
105
+
106
+ $parsedurl['path'] = substr($parsedurl['path'],strlen($home_path));
107
+ $gluebackhome = true;
108
+ }
109
  if (strlen($parsedurl['path']) > 2) {
110
  $secondslashpos = strpos($parsedurl['path'], "/",1);
111
  if (!$secondslashpos) $secondslashpos = strlen($parsedurl['path']);
127
  }
128
 
129
  if($use_params_only) {
130
+ $params['lang'] = LANG_PARAM . "=$lang";
131
  }
132
  else {
133
  if (!$parsedurl['path']) $parsedurl['path'] = "/";
134
  $parsedurl['path'] = "/".$lang.$parsedurl['path'];
135
+ if ($gluebackhome) $parsedurl['path'] = $home_path.$parsedurl['path'];
136
  }
137
 
138
 
139
  //insert params to url
140
+ if(isset($params) && $params) {
141
  $parsedurl['query'] = implode('&',$params);
142
  }
143
 
js/transposh.js CHANGED
@@ -1 +1 @@
1
- function getgt(){jQuery(":button:contains('Suggest - Google')").attr("disabled","disabled").addClass("ui-state-disabled");google.language.translate(jQuery("#"+transposh_params.prefix+"original").val(),"",transposh_params.lang,function(a){if(!a.error){jQuery("#"+transposh_params.prefix+"translation").val(jQuery("<div>"+a.translation+"</div>").text()).keyup()}})}var done_p=0;var togo=0;function ajax_translate(c,b,a){jQuery.ajax({type:"POST",url:transposh_params.post_url,data:{token:jQuery("#"+transposh_params.prefix+a).attr("token"),translation:c,lang:transposh_params.lang,source:b,translation_posted:"1"},success:function(e){fix_page(c,b,a);if(transposh_params.progress){var d=jQuery("#"+transposh_params.prefix+a).attr("token");done_p+=jQuery("*[token='"+d+"']").size();if(togo>4){jQuery("#progress_bar2").progressbar("value",done_p/togo*100)}}},error:function(d){if(b==0){alert("Error !!! failed to translate.\n\nServer's message: "+d.statusText)}}})}function fix_page(e,d,c){var b=jQuery("#"+transposh_params.prefix+c).attr("token");var a=e;if(jQuery.trim(e).length===0){a=jQuery("#"+transposh_params.prefix+c).attr("orig")}jQuery("*[token='"+b+"'][hidden!='y']").html(a).each(function(g){var h=jQuery(this).attr("id").substr(jQuery(this).attr("id").lastIndexOf("_")+1);jQuery("#"+transposh_params.prefix+h).attr("source",d);var f=jQuery("#"+transposh_params.prefix+"img_"+h);f.removeClass("tr-icon-yellow").removeClass("tr-icon-green");if(jQuery.trim(e).length!==0){if(d==1){f.addClass("tr-icon-yellow")}else{f.addClass("tr-icon-green")}}});jQuery("*[token='"+b+"'][hidden='y']").attr("trans",a).each(function(g){var h=jQuery(this).attr("id").substr(jQuery(this).attr("id").lastIndexOf("_")+1);jQuery("#"+transposh_params.prefix+h).attr("source",d);var f=jQuery("#"+transposh_params.prefix+"img_"+h);f.removeClass("tr-icon-yellow").removeClass("tr-icon-green");if(jQuery.trim(e).length!==0){if(d==1){f.addClass("tr-icon-yellow")}else{f.addClass("tr-icon-green")}}})}function do_auto_translate(){if(transposh_params.progress){togo=jQuery("."+transposh_params.prefix+'[source=""]').size();if(togo>4){jQuery("#"+transposh_params.prefix+"credit").append('<div style="float: left;width: 90%;height: 10px" id="progress_bar"/><div style="margin-bottom:10px;float:left;width: 90%;height: 10px" id="progress_bar2"/>');jQuery("#progress_bar").progressbar({value:0});jQuery("#progress_bar2").progressbar({value:0});jQuery("#progress_bar2 > div").css({background:"#28F828",border:"#08A908 1px solid"})}var a=0}var b=new Array();jQuery("."+transposh_params.prefix+'[source=""]').each(function(d){var c=jQuery(this).attr("id");var e=jQuery(this).attr("orig");if(e==undefined){e=jQuery(this).html()}if(!(b[e]==1)){b[e]=1;google.language.translate(e,"",transposh_params.lang,function(f){if(!f.error){var g=c.substr(c.lastIndexOf("_")+1);fix_page(jQuery("<div>"+f.translation+"</div>").text(),1,g);ajax_translate(jQuery("<div>"+f.translation+"</div>").text(),1,g);if(transposh_params.progress){a=togo-jQuery("."+transposh_params.prefix+'[source=""]').size();if(togo>4){jQuery("#progress_bar").progressbar("value",a/togo*100)}}}})}})}function confirm_close(){jQuery('<div id="dial" title="Close without saving?"><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>You have made a change to the translation. Are you sure you want to discard it?</p></div>').appendTo("body").dialog({bgiframe:true,resizable:false,height:140,modal:true,overlay:{backgroundColor:"#000",opacity:0.5},buttons:{Discard:function(){jQuery("#"+transposh_params.prefix+"translation").data("edit",{changed:false});jQuery(this).dialog("close");jQuery("#"+transposh_params.prefix+"d-tabs").dialog("close")},Cancel:function(){jQuery(this).dialog("close")}}})}function translate_dialog(b){jQuery("#"+transposh_params.prefix+"d-tabs").remove();jQuery('<div id="'+transposh_params.prefix+'d-tabs" title="Edit Translation"/>').appendTo("body");jQuery("#"+transposh_params.prefix+"d-tabs").append("<ul/>").tabs({cache:true}).tabs("add","#"+transposh_params.prefix+"d-tabs-1","Translate").tabs("add",transposh_params.post_url+"?tr_token_hist="+jQuery("#"+transposh_params.prefix+b).attr("token")+"&lang="+transposh_params.lang,"History").css("text-align","left").css("padding",0).bind("tabsload",function(d,e){jQuery("table",e.panel).addClass("ui-widget ui-widget-content").css({width:"95%",padding:"0"});jQuery("table thead tr",e.panel).addClass("ui-widget-header");jQuery("table tbody td[source='1']",e.panel).append('<img size="16x16" src="'+transposh_params.blank+'" title="computer" style="display: inline; margin-right: 0.3em;" class="ui-icon ui-icon-gear"/>');jQuery("table tbody td[source='0']",e.panel).append('<img size="16x16" src="'+transposh_params.blank+'" title="human" style="display: inline; margin-right: 0.3em;" class="ui-icon ui-icon-person"/>')}).bind("tabsselect",function(d,e){if(jQuery(e.tab).text()=="Translate"){jQuery("#"+transposh_params.prefix+"d-tabs").dialog("option","buttons",a)}else{jQuery("#"+transposh_params.prefix+"d-tabs").dialog("option","buttons",c)}}).bind("dialogbeforeclose",function(d,e){if(jQuery("#"+transposh_params.prefix+"translation").data("edit").changed){confirm_close();return false}return true});jQuery("#"+transposh_params.prefix+"d-tabs li").css("list-style-type","none").css("list-style-position","outside");jQuery("#"+transposh_params.prefix+"d-tabs-1").append('<form id="'+transposh_params.prefix+'form"><fieldset><label for="original">Original Text</label><textarea cols="80" row="3" name="original" id="'+transposh_params.prefix+'original" class="text ui-widget-content ui-corner-all" readonly="y"/><label for="translation">Translate To</label><textarea cols="80" row="3" name="translation" id="'+transposh_params.prefix+'translation" value="" class="text ui-widget-content ui-corner-all"/></fieldset></form>');jQuery("#"+transposh_params.prefix+"d-tabs-1 label").css("display","block");jQuery("#"+transposh_params.prefix+"d-tabs-1 textarea.text").css({"margin-bottom":"12px",width:"95%",padding:".4em"});jQuery("#"+transposh_params.prefix+"original").val(jQuery("#"+transposh_params.prefix+b).attr("orig"));jQuery("#"+transposh_params.prefix+"translation").val(jQuery("#"+transposh_params.prefix+b).html());if(jQuery("#"+transposh_params.prefix+b).attr("trans")){jQuery("#"+transposh_params.prefix+"translation").val(jQuery("#"+transposh_params.prefix+b).attr("trans"))}jQuery("#"+transposh_params.prefix+"translation").data("edit",{changed:false});jQuery("#"+transposh_params.prefix+"translation").keyup(function(d){if(jQuery("#"+transposh_params.prefix+b).text()!=jQuery(this).val()){jQuery(this).css("background","yellow");jQuery(this).data("edit",{changed:true})}else{jQuery(this).css("background","");jQuery(this).data("edit",{changed:false})}});var a;if(google.language.isTranslatable(transposh_params.lang)||"he|zh-tw|pt".indexOf(transposh_params.lang)>-1){a={"Suggest - Google":function(){getgt()},Ok:function(){var d=jQuery("#"+transposh_params.prefix+"translation").val();if(jQuery("#"+transposh_params.prefix+"translation").data("edit").changed){ajax_translate(d,0,b);jQuery("#"+transposh_params.prefix+"translation").data("edit",{changed:false})}jQuery(this).dialog("close")}}}else{a={Ok:function(){var d=jQuery("#"+transposh_params.prefix+"translation").val();if(jQuery("#"+transposh_params.prefix+"translation").data("edit").changed){ajax_translate(d,0,b);jQuery("#"+transposh_params.prefix+"translation").data("edit",{changed:false})}jQuery(this).dialog("close")}}}var c={Close:function(){jQuery(this).dialog("close")}};jQuery("#"+transposh_params.prefix+"d-tabs").dialog({bgiframe:true,modal:true,width:500,buttons:a})}jQuery.noConflict();var transposh_params=new Array();jQuery("script[src*='transposh.js']").each(function(a){var e=unescape(this.src.substring(this.src.indexOf("?")+1));var d=e.split("&");for(var c=0;c<d.length;c++){var g=d[c].indexOf("=");if(g>0){var b=d[c].substring(0,g);var f=d[c].substring(g+1);transposh_params[b]=f}}});transposh_params.blank="transposh_params.post_url+'?tp_gif=y";google.load("language","1");jQuery(document).ready(function(){if(typeof(jQuery().progressbar)!="undefined"){transposh_params.progress=true}if(google.language.isTranslatable(transposh_params.lang)||"he|zh-tw|pt".indexOf(transposh_params.lang)>-1){do_auto_translate()}if(transposh_params.edit){jQuery("."+transposh_params.prefix).each(function(c){var a=jQuery(this).attr("id").substr(jQuery(this).attr("id").lastIndexOf("_")+1);jQuery(this).after('<img id="'+transposh_params.prefix+"img_"+a+'" class="tr-icon" size="12x12" title="'+jQuery(this).attr("orig")+'" src="'+transposh_params.blank+'"/>');var b=jQuery("#"+transposh_params.prefix+"img_"+a);b.click(function(){translate_dialog(a);return false}).css({border:"0px",margin:"1px",padding:"0px"});if(jQuery(this).attr("source")=="1"){b.addClass("tr-icon-yellow")}else{if(jQuery(this).attr("source")=="0"){b.addClass("tr-icon-green")}}if(jQuery(this).attr("hidden")=="y"){b.css({opacity:"0.6"})}})}});
1
+ function getgt(){jQuery(":button:contains('Suggest - Google')").attr("disabled","disabled").addClass("ui-state-disabled");google.language.translate(jQuery("#"+transposh_params.prefix+"original").val(),"",transposh_params.lang,function(a){if(!a.error){jQuery("#"+transposh_params.prefix+"translation").val(jQuery("<div>"+a.translation+"</div>").text()).keyup()}})}var done_p=0;var togo=0;function ajax_translate(c,b,a){jQuery.ajax({type:"POST",url:transposh_params.post_url,data:{token:jQuery("#"+transposh_params.prefix+a).attr("token"),translation:c,lang:transposh_params.lang,source:b,translation_posted:"1"},success:function(e){fix_page(c,b,a);if(transposh_params.progress){var d=jQuery("#"+transposh_params.prefix+a).attr("token");done_p+=jQuery("*[token='"+d+"']").size();if(togo>4){jQuery("#progress_bar2").progressbar("value",done_p/togo*100)}}},error:function(d){if(b==0){alert("Error !!! failed to translate.\n\nServer's message: "+d.statusText)}}})}function fix_page(e,d,c){var b=jQuery("#"+transposh_params.prefix+c).attr("token");var a=e;if(jQuery.trim(e).length===0){a=jQuery("#"+transposh_params.prefix+c).attr("orig")}jQuery("*[token='"+b+"'][hidden!='y']").html(a).each(function(g){var h=jQuery(this).attr("id").substr(jQuery(this).attr("id").lastIndexOf("_")+1);jQuery("#"+transposh_params.prefix+h).attr("source",d);var f=jQuery("#"+transposh_params.prefix+"img_"+h);f.removeClass("tr-icon-yellow").removeClass("tr-icon-green");if(jQuery.trim(e).length!==0){if(d==1){f.addClass("tr-icon-yellow")}else{f.addClass("tr-icon-green")}}});jQuery("*[token='"+b+"'][hidden='y']").attr("trans",a).each(function(g){var h=jQuery(this).attr("id").substr(jQuery(this).attr("id").lastIndexOf("_")+1);jQuery("#"+transposh_params.prefix+h).attr("source",d);var f=jQuery("#"+transposh_params.prefix+"img_"+h);f.removeClass("tr-icon-yellow").removeClass("tr-icon-green");if(jQuery.trim(e).length!==0){if(d==1){f.addClass("tr-icon-yellow")}else{f.addClass("tr-icon-green")}}})}function do_auto_translate(){if(transposh_params.progress){togo=jQuery("."+transposh_params.prefix+'[source=""]').size();if(togo>4){jQuery("#"+transposh_params.prefix+"credit").append('<div style="float: left;width: 90%;height: 10px" id="progress_bar"/><div style="margin-bottom:10px;float:left;width: 90%;height: 10px" id="progress_bar2"/>');jQuery("#progress_bar").progressbar({value:0});jQuery("#progress_bar2").progressbar({value:0});jQuery("#progress_bar2 > div").css({background:"#28F828",border:"#08A908 1px solid"})}var a=0}var b=new Array();jQuery("."+transposh_params.prefix+'[source=""]').each(function(d){var c=jQuery(this).attr("id");var e=jQuery(this).attr("orig");if(e==undefined){e=jQuery(this).html()}if(!(b[e]==1)){b[e]=1;google.language.translate(e,"",transposh_params.lang,function(f){if(!f.error){var g=c.substr(c.lastIndexOf("_")+1);fix_page(jQuery("<div>"+f.translation+"</div>").text(),1,g);ajax_translate(jQuery("<div>"+f.translation+"</div>").text(),1,g);if(transposh_params.progress){a=togo-jQuery("."+transposh_params.prefix+'[source=""]').size();if(togo>4){jQuery("#progress_bar").progressbar("value",a/togo*100)}}}})}})}function confirm_close(){jQuery('<div id="dial" title="Close without saving?"><p><span class="ui-icon ui-icon-alert" style="float:left; margin:0 7px 20px 0;"></span>You have made a change to the translation. Are you sure you want to discard it?</p></div>').appendTo("body").dialog({bgiframe:true,resizable:false,height:140,modal:true,overlay:{backgroundColor:"#000",opacity:0.5},buttons:{Discard:function(){jQuery("#"+transposh_params.prefix+"translation").data("edit",{changed:false});jQuery(this).dialog("close");jQuery("#"+transposh_params.prefix+"d-tabs").dialog("close")},Cancel:function(){jQuery(this).dialog("close")}}})}function translate_dialog(b){jQuery("#"+transposh_params.prefix+"d-tabs").remove();jQuery('<div id="'+transposh_params.prefix+'d-tabs" title="Edit Translation"/>').appendTo("body");jQuery("#"+transposh_params.prefix+"d-tabs").append("<ul/>").tabs({cache:true}).tabs("add","#"+transposh_params.prefix+"d-tabs-1","Translate").tabs("add",transposh_params.post_url+"?tr_token_hist="+jQuery("#"+transposh_params.prefix+b).attr("token")+"&lang="+transposh_params.lang,"History").css("text-align","left").css("padding",0).bind("tabsload",function(d,e){jQuery("table",e.panel).addClass("ui-widget ui-widget-content").css({width:"95%",padding:"0"});jQuery("table thead tr",e.panel).addClass("ui-widget-header");jQuery("table tbody td[source='1']",e.panel).append('<img size="16x16" src="'+transposh_params.blank+'" title="computer" style="display: inline; margin-right: 0.3em;" class="ui-icon ui-icon-gear"/>');jQuery("table tbody td[source='0']",e.panel).append('<img size="16x16" src="'+transposh_params.blank+'" title="human" style="display: inline; margin-right: 0.3em;" class="ui-icon ui-icon-person"/>')}).bind("tabsselect",function(d,e){if(jQuery(e.tab).text()=="Translate"){jQuery("#"+transposh_params.prefix+"d-tabs").dialog("option","buttons",a)}else{jQuery("#"+transposh_params.prefix+"d-tabs").dialog("option","buttons",c)}}).bind("dialogbeforeclose",function(d,e){if(jQuery("#"+transposh_params.prefix+"translation").data("edit").changed){confirm_close();return false}return true});jQuery("#"+transposh_params.prefix+"d-tabs li").css("list-style-type","none").css("list-style-position","outside");jQuery("#"+transposh_params.prefix+"d-tabs-1").append('<form id="'+transposh_params.prefix+'form"><fieldset><label for="original">Original Text</label><textarea cols="80" row="3" name="original" id="'+transposh_params.prefix+'original" class="text ui-widget-content ui-corner-all" readonly="y"/><label for="translation">Translate To</label><textarea cols="80" row="3" name="translation" id="'+transposh_params.prefix+'translation" value="" class="text ui-widget-content ui-corner-all"/></fieldset></form>');jQuery("#"+transposh_params.prefix+"d-tabs-1 label").css("display","block");jQuery("#"+transposh_params.prefix+"d-tabs-1 textarea.text").css({"margin-bottom":"12px",width:"95%",padding:".4em"});jQuery("#"+transposh_params.prefix+"original").val(jQuery("#"+transposh_params.prefix+b).attr("orig"));jQuery("#"+transposh_params.prefix+"translation").val(jQuery("#"+transposh_params.prefix+b).html());if(jQuery("#"+transposh_params.prefix+b).attr("trans")){jQuery("#"+transposh_params.prefix+"translation").val(jQuery("#"+transposh_params.prefix+b).attr("trans"))}jQuery("#"+transposh_params.prefix+"translation").data("edit",{changed:false});jQuery("#"+transposh_params.prefix+"translation").keyup(function(d){if(jQuery("#"+transposh_params.prefix+b).text()!=jQuery(this).val()){jQuery(this).css("background","yellow");jQuery(this).data("edit",{changed:true})}else{jQuery(this).css("background","");jQuery(this).data("edit",{changed:false})}});var a;if(google.language.isTranslatable(transposh_params.lang)||"he|zh-tw|pt".indexOf(transposh_params.lang)>-1){a={"Suggest - Google":function(){getgt()},Ok:function(){var d=jQuery("#"+transposh_params.prefix+"translation").val();if(jQuery("#"+transposh_params.prefix+"translation").data("edit").changed){ajax_translate(d,0,b);jQuery("#"+transposh_params.prefix+"translation").data("edit",{changed:false})}jQuery(this).dialog("close")}}}else{a={Ok:function(){var d=jQuery("#"+transposh_params.prefix+"translation").val();if(jQuery("#"+transposh_params.prefix+"translation").data("edit").changed){ajax_translate(d,0,b);jQuery("#"+transposh_params.prefix+"translation").data("edit",{changed:false})}jQuery(this).dialog("close")}}}var c={Close:function(){jQuery(this).dialog("close")}};jQuery("#"+transposh_params.prefix+"d-tabs").dialog({bgiframe:true,modal:true,width:500,buttons:a})}jQuery.noConflict();var transposh_params=new Array();jQuery("script[src*='transposh.js']").each(function(a){var e=unescape(this.src.substring(this.src.indexOf("?")+1));var d=e.split("&");for(var c=0;c<d.length;c++){var g=d[c].indexOf("=");if(g>0){var b=d[c].substring(0,g);var f=d[c].substring(g+1);transposh_params[b]=f}}});transposh_params.blank=transposh_params.post_url+"?tp_gif=y";google.load("language","1");jQuery(document).ready(function(){if(typeof(jQuery().progressbar)!="undefined"){transposh_params.progress=true}if(google.language.isTranslatable(transposh_params.lang)||"he|zh-tw|pt".indexOf(transposh_params.lang)>-1){do_auto_translate()}if(transposh_params.edit){jQuery("."+transposh_params.prefix).each(function(c){var a=jQuery(this).attr("id").substr(jQuery(this).attr("id").lastIndexOf("_")+1);jQuery(this).after('<img id="'+transposh_params.prefix+"img_"+a+'" class="tr-icon" size="12x12" title="'+jQuery(this).attr("orig")+'" src="'+transposh_params.blank+'"/>');var b=jQuery("#"+transposh_params.prefix+"img_"+a);b.click(function(){translate_dialog(a);return false}).css({border:"0px",margin:"1px",padding:"0px"});if(jQuery(this).attr("source")=="1"){b.addClass("tr-icon-yellow")}else{if(jQuery(this).attr("source")=="0"){b.addClass("tr-icon-green")}}if(jQuery(this).attr("hidden")=="y"){b.css({opacity:"0.6"})}})}});
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://transposh.org/
4
  Tags: translation, widget, filter, bilingual, multilingual, transposh, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
5
  Requires at least: 2.7
6
  Tested up to: 2.8
7
- Stable tag: 0.2.5
8
 
9
  Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
10
 
@@ -97,6 +97,9 @@ Just add the following line to your template:
97
  5. Widget style selection
98
 
99
  == Release notes ==
 
 
 
100
  * 2009/06/16 - 0.2.5
101
  * Fixed url rewrite bug reported by ([Mike](http://www.nostate.com/))
102
  * Allow translation of even more hidden elements such as keywords, descriptions and stuff inside select tags
4
  Tags: translation, widget, filter, bilingual, multilingual, transposh, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
5
  Requires at least: 2.7
6
  Tested up to: 2.8
7
+ Stable tag: 0.2.6
8
 
9
  Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
10
 
97
  5. Widget style selection
98
 
99
  == Release notes ==
100
+ * 2009/06/17 - 0.2.6
101
+ * Fixed regressions in urls reported by ([Mike](http://www.nostate.com/)) and ([Julian](http://julianmegson.com/blog/about/))
102
+ * Will not push jQuery to the bottom, as it might conflict with other plugins
103
  * 2009/06/16 - 0.2.5
104
  * Fixed url rewrite bug reported by ([Mike](http://www.nostate.com/))
105
  * Allow translation of even more hidden elements such as keywords, descriptions and stuff inside select tags
transposh.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://transposh.org/
5
  Description: Translation filter for WordPress, After enabling please set languages at the <a href="options-general.php?page=transposh">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>.
6
  Author: Team Transposh
7
- Version: 0.2.5
8
  Author URI: http://transposh.org/
9
  License: GPL (http://www.gnu.org/licenses/gpl.txt)
10
  */
@@ -218,7 +218,7 @@ function on_parse_request($wp) {
218
  $GLOBALS['lang'] = $wp->query_vars[LANG_PARAM];
219
  if (!$GLOBALS['lang']) $GLOBALS['lang'] = get_default_lang();
220
 
221
- if ($wp->query_vars[EDIT_PARAM] && is_editing_permitted()) {
222
  $GLOBALS['is_edit_mode'] = true;
223
  } else {
224
  $GLOBALS['is_edit_mode'] = false;
@@ -349,7 +349,7 @@ function add_transposh_css() {
349
  return;
350
  }
351
  //include the transposh.css
352
- wp_enqueue_style("transposh","$tr_plugin_url/css/transposh.css",array(),'0.2.5');
353
  wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css",array(),'1.0');
354
 
355
  }
@@ -386,9 +386,11 @@ function add_transposh_js() {
386
  if($GLOBALS['is_edit_mode'] || $enable_auto_translate) {
387
  $post_url = $home_url . '/index.php';
388
  wp_deregister_script('jquery');
389
- wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2', get_option(ENABLE_FOOTER_SCRIPTS));
 
 
390
  wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1',get_option(ENABLE_FOOTER_SCRIPTS));
391
- wp_enqueue_script("transposh","$tr_plugin_url/js/transposh.js?post_url=$post_url{$edit_mode}&lang={$GLOBALS['lang']}&prefix=".SPAN_PREFIX,array("jquery"),'0.2.5',get_option(ENABLE_FOOTER_SCRIPTS));
392
  }
393
  }
394
 
4
  Plugin URI: http://transposh.org/
5
  Description: Translation filter for WordPress, After enabling please set languages at the <a href="options-general.php?page=transposh">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>.
6
  Author: Team Transposh
7
+ Version: 0.2.6
8
  Author URI: http://transposh.org/
9
  License: GPL (http://www.gnu.org/licenses/gpl.txt)
10
  */
218
  $GLOBALS['lang'] = $wp->query_vars[LANG_PARAM];
219
  if (!$GLOBALS['lang']) $GLOBALS['lang'] = get_default_lang();
220
 
221
+ if (isset($wp->query_vars[EDIT_PARAM]) && $wp->query_vars[EDIT_PARAM] && is_editing_permitted()) {
222
  $GLOBALS['is_edit_mode'] = true;
223
  } else {
224
  $GLOBALS['is_edit_mode'] = false;
349
  return;
350
  }
351
  //include the transposh.css
352
+ wp_enqueue_style("transposh","$tr_plugin_url/css/transposh.css",array(),'0.2.6');
353
  wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css",array(),'1.0');
354
 
355
  }
386
  if($GLOBALS['is_edit_mode'] || $enable_auto_translate) {
387
  $post_url = $home_url . '/index.php';
388
  wp_deregister_script('jquery');
389
+ wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2');
390
+ // jQuery pushing below might cause issues
391
+ //wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2', get_option(ENABLE_FOOTER_SCRIPTS));
392
  wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1',get_option(ENABLE_FOOTER_SCRIPTS));
393
+ wp_enqueue_script("transposh","$tr_plugin_url/js/transposh.js?post_url=$post_url{$edit_mode}&lang={$GLOBALS['lang']}&prefix=".SPAN_PREFIX,array("jquery"),'0.2.6',get_option(ENABLE_FOOTER_SCRIPTS));
394
  }
395
  }
396
 
transposh_admin.php CHANGED
@@ -64,6 +64,7 @@ function insert_supported_langs() {
64
  }
65
  echo '</tr>';
66
 
 
67
  foreach($languages as $code => $lang) {
68
  list ($language,$flag,$autot) = explode (",",$lang);
69
  if(!($i % $columns)) echo '<tr'.(!($i/2 % $columns) ? ' class="alternate"':'').'>';
@@ -323,11 +324,11 @@ class transposh_plugin {
323
 
324
  <div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
325
  <div id="side-info-column" class="inner-sidebar">
326
- <?php do_meta_boxes($this->pagehook, 'side', $data); ?>
327
  </div>
328
  <div id="post-body" class="has-sidebar">
329
  <div id="post-body-content" class="has-sidebar-content">
330
- <?php do_meta_boxes($this->pagehook, 'normal', $data);
331
  /* Maybe add static content here later */
332
  //do_meta_boxes($this->pagehook, 'additional', $data); ?>
333
  <p>
64
  }
65
  echo '</tr>';
66
 
67
+ $i=0;
68
  foreach($languages as $code => $lang) {
69
  list ($language,$flag,$autot) = explode (",",$lang);
70
  if(!($i % $columns)) echo '<tr'.(!($i/2 % $columns) ? ' class="alternate"':'').'>';
324
 
325
  <div id="poststuff" class="metabox-holder<?php echo 2 == $screen_layout_columns ? ' has-right-sidebar' : ''; ?>">
326
  <div id="side-info-column" class="inner-sidebar">
327
+ <?php do_meta_boxes($this->pagehook, 'side', ""); ?>
328
  </div>
329
  <div id="post-body" class="has-sidebar">
330
  <div id="post-body-content" class="has-sidebar-content">
331
+ <?php do_meta_boxes($this->pagehook, 'normal', "");
332
  /* Maybe add static content here later */
333
  //do_meta_boxes($this->pagehook, 'additional', $data); ?>
334
  <p>
transposh_db.php CHANGED
@@ -129,7 +129,7 @@ function update_translation() {
129
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
130
 
131
  //add our own custom header - so we will know that we got here
132
- header("Transposh: ver-0.2.5 db_version-". DB_VERSION);
133
 
134
  list($translated_text, $old_source) = fetch_translation($original, $lang);
135
  if ($translated_text) {
@@ -227,7 +227,7 @@ function get_translation_history($token, $lang) {
227
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
228
 
229
  //add our own custom header - so we will know that we got here
230
- header("Transposh: ver-0.2.5 db_version-". DB_VERSION);
231
 
232
  $query = "SELECT translated, translated_by, timestamp, source, user_login ".
233
  "FROM $table_name ".
129
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
130
 
131
  //add our own custom header - so we will know that we got here
132
+ header("Transposh: ver-0.2.6 db_version-". DB_VERSION);
133
 
134
  list($translated_text, $old_source) = fetch_translation($original, $lang);
135
  if ($translated_text) {
227
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
228
 
229
  //add our own custom header - so we will know that we got here
230
+ header("Transposh: ver-0.2.6 db_version-". DB_VERSION);
231
 
232
  $query = "SELECT translated, translated_by, timestamp, source, user_login ".
233
  "FROM $table_name ".
transposh_widget.php CHANGED
@@ -84,7 +84,7 @@ function add_transposh_widget_css() {
84
  global $tr_plugin_url;
85
 
86
  //include the transposh_widget.css
87
- wp_enqueue_style("transposh_widget","$tr_plugin_url/css/transposh_widget.css",array(),'0.2.5');
88
 
89
  }
90
 
84
  global $tr_plugin_url;
85
 
86
  //include the transposh_widget.css
87
+ wp_enqueue_style("transposh_widget","$tr_plugin_url/css/transposh_widget.css",array(),'0.2.6');
88
 
89
  }
90