Version Description
= 0.4.0 = This version provides integration with google-sitemaps-xml and wp-super-cache = 0.3.9 = This version allows sorting of languages within the widget
Download this release
Release Info
Developer | oferwald |
Plugin | Transposh WordPress Translation |
Version | 0.4.1 |
Comparing to | |
See all releases |
Code changes from version 0.4.0 to 0.4.1
- core/constants.php +1 -1
- css/transposh.css +1 -1
- css/transposh_flags.css +1 -1
- css/transposh_widget.css +1 -1
- js/lazy.js +5 -0
- js/transposh.js +18 -1
- js/transposhadmin.js +6 -1
- js/transposhcontrol.js +6 -1
- readme.txt +18 -4
- transposh.php +63 -34
- wp/transposh_widget.php +8 -10
core/constants.php
CHANGED
@@ -96,7 +96,7 @@ $bing_languages = array("en", "ar", "bg", "zh", "zh-tw", "cs", "da", "nl", "fi",
|
|
96 |
//Define the new capability that will be assigned to roles - translator
|
97 |
define("TRANSLATOR", 'translator');
|
98 |
|
99 |
-
define("TRANSPOSH_PLUGIN_VER",'0.4.
|
100 |
|
101 |
//Define segment id prefix, will be included in span tag. also used as class identifier
|
102 |
define("SPAN_PREFIX", "tr_");
|
96 |
//Define the new capability that will be assigned to roles - translator
|
97 |
define("TRANSLATOR", 'translator');
|
98 |
|
99 |
+
define("TRANSPOSH_PLUGIN_VER",'0.4.1');
|
100 |
|
101 |
//Define segment id prefix, will be included in span tag. also used as class identifier
|
102 |
define("SPAN_PREFIX", "tr_");
|
css/transposh.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.
|
1 |
+
.tr-icon{background-image:url(../img/tr_imgs.png);height:12px;width:12px;background-repeat:no-repeat;overflow:hidden;text-indent:-99999px;display:inline-block;}.tr-icon-yellow{background-position:-12px 0;}.tr-icon-green{background-position:-24px 0;}
|
css/transposh_flags.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.trf{background-image:url(../img/flags.png);height:11px;width:16px;background-repeat:no-repeat;overflow:hidden;display:inline-block;}.trf-za{background-position:-24px 0;}.trf-al{background-position:-48px 0;}.trf-sa{background-position:-72px 0;}.trf-by{background-position:-96px 0;}.trf-bg{background-position:-120px 0;}.trf-catalonia{background-position:-144px 0;}.trf-cn{background-position:-168px 0;}.trf-tw{background-position:-192px 0;}.trf-hr{background-position:-216px 0;}.trf-cz{background-position:-240px 0;}.trf-dk{background-position:-264px 0;}.trf-nl{background-position:-288px 0;}.trf-ee{background-position:-312px 0;}.trf-fi{background-position:-336px 0;}.trf-fr{background-position:-360px 0;}.trf-galicia{background-position:-384px 0;}.trf-de{background-position:-408px 0;}.trf-gr{background-position:-432px 0;}.trf-il{background-position:-456px 0;}.trf-in{background-position:-480px 0;}.trf-hu{background-position:-504px 0;}.trf-id{background-position:-528px 0;}.trf-it{background-position:-552px 0;}.trf-is{background-position:-576px 0;}.trf-ie{background-position:-600px 0;}.trf-jp{background-position:-624px 0;}.trf-kr{background-position:-648px 0;}.trf-lv{background-position:-672px 0;}.trf-lt{background-position:-696px 0;}.trf-mk{background-position:-720px 0;}.trf-my{background-position:-744px 0;}.trf-mt{background-position:-768px 0;}.trf-no{background-position:-792px 0;}.trf-ir{background-position:-816px 0;}.trf-pl{background-position:-840px 0;}.trf-pt{background-position:-864px 0;}.trf-ro{background-position:-888px 0;}.trf-ru{background-position:-912px 0;}.trf-rs{background-position:-936px 0;}.trf-sk{background-position:-960px 0;}.trf-sl{background-position:-984px 0;}.trf-es{background-position:-1008px 0;}.trf-ke{background-position:-1032px 0;}.trf-se{background-position:-1056px 0;}.trf-ph{background-position:-1080px 0;}.trf-th{background-position:-1104px 0;}.trf-tr{background-position:-1128px 0;}.trf-ua{background-position:-1152px 0;}.trf-vn{background-position:-1176px 0;}.trf-wales{background-position:-1200px 0;}.trf-europeanunion{background-position:-1224px 0;}
|
1 |
+
.transposh_flags{direction:ltr;line-height:0;}.transposh_flags a{display:inline;}.transposh_flags a:hover{background:transparent;}.transposh_flags a span,.transposh_flags a img{border-color:transparent;border-style:solid;border-width:1px 3px;padding:0;}.transposh_flags a span:hover,.transposh_flags a img:hover{border-color:blue;}.trf{background-image:url(../img/flags.png);height:11px;width:16px;background-repeat:no-repeat;overflow:hidden;display:inline-block;}.trf-za{background-position:-24px 0;}.trf-al{background-position:-48px 0;}.trf-sa{background-position:-72px 0;}.trf-by{background-position:-96px 0;}.trf-bg{background-position:-120px 0;}.trf-catalonia{background-position:-144px 0;}.trf-cn{background-position:-168px 0;}.trf-tw{background-position:-192px 0;}.trf-hr{background-position:-216px 0;}.trf-cz{background-position:-240px 0;}.trf-dk{background-position:-264px 0;}.trf-nl{background-position:-288px 0;}.trf-ee{background-position:-312px 0;}.trf-fi{background-position:-336px 0;}.trf-fr{background-position:-360px 0;}.trf-galicia{background-position:-384px 0;}.trf-de{background-position:-408px 0;}.trf-gr{background-position:-432px 0;}.trf-il{background-position:-456px 0;}.trf-in{background-position:-480px 0;}.trf-hu{background-position:-504px 0;}.trf-id{background-position:-528px 0;}.trf-it{background-position:-552px 0;}.trf-is{background-position:-576px 0;}.trf-ie{background-position:-600px 0;}.trf-jp{background-position:-624px 0;}.trf-kr{background-position:-648px 0;}.trf-lv{background-position:-672px 0;}.trf-lt{background-position:-696px 0;}.trf-mk{background-position:-720px 0;}.trf-my{background-position:-744px 0;}.trf-mt{background-position:-768px 0;}.trf-no{background-position:-792px 0;}.trf-ir{background-position:-816px 0;}.trf-pl{background-position:-840px 0;}.trf-pt{background-position:-864px 0;}.trf-ro{background-position:-888px 0;}.trf-ru{background-position:-912px 0;}.trf-rs{background-position:-936px 0;}.trf-sk{background-position:-960px 0;}.trf-sl{background-position:-984px 0;}.trf-es{background-position:-1008px 0;}.trf-ke{background-position:-1032px 0;}.trf-se{background-position:-1056px 0;}.trf-ph{background-position:-1080px 0;}.trf-th{background-position:-1104px 0;}.trf-tr{background-position:-1128px 0;}.trf-ua{background-position:-1152px 0;}.trf-vn{background-position:-1176px 0;}.trf-wales{background-position:-1200px 0;}.trf-europeanunion{background-position:-1224px 0;}
|
css/transposh_widget.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.transposh_flags{direction:ltr;line-height:0;}.transposh_flags a:hover{background:transparent;}.transposh_flags a span,.transposh_flags a img{border-color:transparent;border-style:solid;border-width:1px 3px;padding:0;}.transposh_flags a span:hover,.transposh_flags a img:hover{border-color:blue;}
|
1 |
+
.transposh_flags{direction:ltr;line-height:0;}.transposh_flags a{display:inline;}.transposh_flags a:hover{background:transparent;}.transposh_flags a span,.transposh_flags a img{border-color:transparent;border-style:solid;border-width:1px 3px;padding:0;}.transposh_flags a span:hover,.transposh_flags a img:hover{border-color:blue;}
|
js/lazy.js
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(b){function s(){function h(a,d){t[a](d,function(c){c=="error"?i.push(d):k.push(d)&&g.each(d);o()},"lazy-loaded-"+(g.name?g.name:(new Date).getTime()))}function j(a){g.complete(a,k,i);g[a](a=="error"?i:k);clearTimeout(p);clearTimeout(u)}function o(){if(k.length==l.length)j("success");else k.length+i.length==l.length&&j("error")}function q(){i.push(this.src);o()}var t=this,g,k=[],i=[],p,u,n,l=[];this.init=function(a){if(a){g=b.extend({},b.xLazyLoader.defaults,a);n={js:g.js,css:g.css,img:g.img};
|
2 |
+
b.each(n,function(d,c){if(typeof c=="string")c=c.split(",");l=l.concat(c)});if(l.length){if(g.timeout)p=setTimeout(function(){var d=k.concat(i);b.each(l,function(c,f){b.inArray(f,d)==-1&&i.push(f)});j("error")},g.timeout);b.each(n,function(d,c){if(b.isArray(c))b.each(c,function(f,e){h(d,e)});else typeof c=="string"&&h(d,c)})}else j("error")}};this.js=function(a,d,c){var f=b('script[src*="'+a+'"]');if(f.length)f.attr("pending")?f.bind("scriptload",d):d();else{var e=document.createElement("script");
|
3 |
+
e.setAttribute("type","text/javascript");e.setAttribute("src",a);e.setAttribute("id",c);e.setAttribute("pending",1);e.onerror=q;b(e).bind("scriptload",function(){b(this).removeAttr("pending");d();setTimeout(function(){b(e).unbind("scriptload")},10)});var r=false;e.onload=e.onreadystatechange=function(){if(!r&&(!this.readyState||/loaded|complete/.test(this.readyState))){r=true;e.onload=e.onreadystatechange=null;b(e).trigger("scriptload")}};m.appendChild(e)}};this.css=function(a,d,c){if(b('link[href*="'+
|
4 |
+
a+'"]').length)d();else{var f=b('<link rel="stylesheet" type="text/css" media="all" href="'+a+'" id="'+c+'"></link>')[0];if(b.browser.msie)f.onreadystatechange=function(){/loaded|complete/.test(f.readyState)&&d()};else if(b.browser.opera)f.onload=d;else{c=location.hostname.replace("www.","");a=/http:/.test(a)?/^(\w+:)?\/\/([^\/?#]+)/.exec(a)[2]:c;c!=a&&b.browser.mozilla?d():function(){d()}()}m.appendChild(f)}};this.img=function(a,d){var c=new Image;c.onload=d;c.onerror=q;c.src=a};this.disable=function(a){b("#lazy-loaded-"+
|
5 |
+
a,m).attr("disabled","disabled")};this.enable=function(a){b("#lazy-loaded-"+a,m).removeAttr("disabled")};this.destroy=function(a){b("#lazy-loaded-"+a,m).remove()}}b.xLazyLoader=function(h,j){if(typeof h=="object"){j=h;h="init"}(new s)[h](j)};b.xLazyLoader.defaults={js:[],css:[],img:[],name:null,timeout:2E4,success:function(){},error:function(){},complete:function(){},each:function(){}};var m=document.getElementsByTagName("head")[0]})(jQuery);
|
js/transposh.js
CHANGED
@@ -1 +1,18 @@
|
|
1 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function(){function m(){if(typeof google==="undefined"){j=function(){m()};jQuery.xLazyLoader({js:"http://www.google.com/jsapi",success:k})}else{jQuery(":button:contains('Suggest - Google')").attr("disabled","disabled").addClass("ui-state-disabled");google.language.translate(jQuery("#"+t_jp.prefix+"original").val(),"",t_jp.lang,function(a){a.error||jQuery("#"+t_jp.prefix+"translation").val(jQuery("<div>"+a.translation+"</div>").text()).keyup()})}}function n(){if(typeof Microsoft==="undefined")jQuery.xLazyLoader({js:"http://api.microsofttranslator.com/V1/Ajax.svc/Embed?appId="+
|
2 |
+
t_jp.msnkey,success:function(){n()}});else{jQuery(":button:contains('Suggest - Bing')").attr("disabled","disabled").addClass("ui-state-disabled");var a=t_jp.lang;if(a==="zh")a="zh-chs";if(a==="zh-tw")a="zh-cht";try{Microsoft.Translator.translate(jQuery("#"+t_jp.prefix+"original").val(),"",a,function(e){jQuery("#"+t_jp.prefix+"translation").val(jQuery("<div>"+e+"</div>").text()).keyup()})}catch(b){alert("There was an error using Microsoft.Translator - probably a bad key or URL used in key. ("+b+")")}}}
|
3 |
+
function u(a,b,e){var c=jQuery("#"+t_jp.prefix+e).attr("token"),d=a;if(jQuery.trim(a).length===0)d=jQuery("#"+t_jp.prefix+e).attr("orig");jQuery("*[token='"+c+"'][hidden!='y']").html(d).each(function(){var f=jQuery(this).attr("id").substr(jQuery(this).attr("id").lastIndexOf("_")+1),g=jQuery("#"+t_jp.prefix+"img_"+f);jQuery("#"+t_jp.prefix+f).attr("source",b);g.removeClass("tr-icon-yellow").removeClass("tr-icon-green");if(jQuery.trim(a).length!==0)b===1?g.addClass("tr-icon-yellow"):g.addClass("tr-icon-green")});
|
4 |
+
jQuery("*[token='"+c+"'][hidden='y']").attr("trans",d).each(function(){var f=jQuery(this).attr("id").substr(jQuery(this).attr("id").lastIndexOf("_")+1),g=jQuery("#"+t_jp.prefix+"img_"+f);jQuery("#"+t_jp.prefix+f).attr("source",b);g.removeClass("tr-icon-yellow").removeClass("tr-icon-green");if(jQuery.trim(a).length!==0)b===1?g.addClass("tr-icon-yellow"):g.addClass("tr-icon-green")})}function o(a,b,e){clearTimeout(p);i.push(jQuery("#"+t_jp.prefix+e).attr("token"));l.push(a);u(a,b,e);p=setTimeout(function(){var c=
|
5 |
+
{lang:t_jp.lang,source:b,translation_posted:"1",items:i.length},d;for(d=0;d<i.length;d+=1){c["tk"+d]=i[d];c["tr"+d]=l[d];if(b>0)q+=jQuery("*[token='"+i[d]+"']").size()}jQuery.ajax({type:"POST",url:t_jp.post_url,data:c,success:function(){t_jp.progress&&h>4&&b>0&&jQuery("#progress_bar2").progressbar("value",q/h*100)},error:function(f){b===0&&alert("Error !!! failed to translate.\n\nServer's message: "+f.statusText)}});l=[];i=[]},200)}function r(){var a=[],b;if(t_jp.progress){h=jQuery("."+t_jp.prefix+
|
6 |
+
'[source=""]').size();if(h>4){jQuery("#"+t_jp.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"})}b=0}jQuery("."+t_jp.prefix+'[source=""]').each(function(){var e=jQuery(this).attr("id"),c=jQuery(this).attr("orig");
|
7 |
+
if(c===undefined)c=jQuery(this).html();if(a[c]!==1){a[c]=1;google.language.translate(c,"",t_jp.lang,function(d){if(!d.error){var f=e.substr(e.lastIndexOf("_")+1);o(jQuery("<div>"+d.translation+"</div>").text(),1,f);if(t_jp.progress){b=h-jQuery("."+t_jp.prefix+'[source=""]').size();h>4&&jQuery("#progress_bar").progressbar("value",b/h*100)}}})}})}function v(){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,
|
8 |
+
resizable:false,height:140,modal:true,overlay:{backgroundColor:"#000",opacity:0.5},buttons:{Discard:function(){jQuery("#"+t_jp.prefix+"translation").data("edit",{changed:false});jQuery(this).dialog("close");jQuery("#"+t_jp.prefix+"d-tabs").dialog("close")},Cancel:function(){jQuery(this).dialog("close")}}})}function s(a){var b={},e={};if(w.indexOf(t_jp.lang)>-1&&t_jp.msnkey!=="")b["Suggest - Bing"]=function(){n()};if(t.indexOf(t_jp.lang)>-1)b["Suggest - Google"]=function(){m()};b.Ok=function(){var c=
|
9 |
+
jQuery("#"+t_jp.prefix+"translation").val();if(jQuery("#"+t_jp.prefix+"translation").data("edit").changed){o(c,0,a);jQuery("#"+t_jp.prefix+"translation").data("edit",{changed:false})}jQuery(this).dialog("close")};e={Close:function(){jQuery(this).dialog("close")}};jQuery("#"+t_jp.prefix+"d-tabs").remove();jQuery('<div id="'+t_jp.prefix+'d-tabs" title="Edit Translation"/>').appendTo("body");jQuery("#"+t_jp.prefix+"d-tabs").append("<ul/>").tabs({cache:true}).tabs("add","#"+t_jp.prefix+"d-tabs-1","Translate").tabs("add",
|
10 |
+
t_jp.post_url+"?tr_token_hist="+jQuery("#"+t_jp.prefix+a).attr("token")+"&lang="+t_jp.lang,"History").css("text-align","left").css("padding",0).bind("tabsload",function(c,d){jQuery("table",d.panel).addClass("ui-widget ui-widget-content").css({width:"95%",padding:"0"});jQuery("table thead tr",d.panel).addClass("ui-widget-header");jQuery("table tbody td[source='1']",d.panel).append('<span title="computer" style="display: inline-block; margin-right: 0.3em;" class="ui-icon ui-icon-gear"></span>');jQuery("table tbody td[source='0']",
|
11 |
+
d.panel).append('<span title="human" style="display: inline-block; margin-right: 0.3em;" class="ui-icon ui-icon-person"></span>')}).bind("tabsselect",function(c,d){jQuery(d.tab).text()==="Translate"?jQuery("#"+t_jp.prefix+"d-tabs").dialog("option","buttons",b):jQuery("#"+t_jp.prefix+"d-tabs").dialog("option","buttons",e)}).bind("dialogbeforeclose",function(){if(jQuery("#"+t_jp.prefix+"translation").data("edit").changed){v();return false}return true});jQuery("#"+t_jp.prefix+"d-tabs li").css("list-style-type",
|
12 |
+
"none").css("list-style-position","outside");jQuery("#"+t_jp.prefix+"d-tabs-1").css("padding","1px").append('<form id="'+t_jp.prefix+'form"><fieldset><label for="original">Original Text</label><textarea cols="80" row="3" name="original" id="'+t_jp.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="'+t_jp.prefix+'translation" value="" class="text ui-widget-content ui-corner-all"/></fieldset></form>');
|
13 |
+
jQuery("#"+t_jp.prefix+"d-tabs-1 label").css("display","block");jQuery("#"+t_jp.prefix+"d-tabs-1 textarea.text").css({"margin-bottom":"12px",width:"95%",padding:".4em"});jQuery("#"+t_jp.prefix+"original").val(jQuery("#"+t_jp.prefix+a).attr("orig"));jQuery("#"+t_jp.prefix+"translation").val(jQuery("#"+t_jp.prefix+a).html());jQuery("#"+t_jp.prefix+a).attr("trans")&&jQuery("#"+t_jp.prefix+"translation").val(jQuery("#"+t_jp.prefix+a).attr("trans"));jQuery("#"+t_jp.prefix+"translation").data("edit",{changed:false});
|
14 |
+
jQuery("#"+t_jp.prefix+"translation").keyup(function(){if(jQuery("#"+t_jp.prefix+a).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})}});jQuery("#"+t_jp.prefix+"d-tabs").dialog({bgiframe:true,modal:true,width:500,buttons:b})}var j,k,q=0,h=0,p,i=[],l=[],t="af|sq|ar|be|bg|ca|zh|zh-CN|zh-TW|hr|cs|da|nl|en|et|tl|fi|fr|gl|de|el|iw|hi|hu|is|id|ga|it|ja|ko|lv|lt|mk|ms|mt|no|fa|pl|pt-PT|ro|ru|sr|sk|sl|es|sw|sv|tl|th|tr|uk|vi|cy|yi|he|zh-tw|pt",
|
15 |
+
w="ar,bg,zh-chs,zh-cht,cs,da,nl,en,fi,fr,de,el,he,it,ja,ko,pl,pt,ru,es,sv,th,zh,zh-tw";jQuery.noConflict();k=function(){google.load("language","1",{callback:j})};jQuery(document).ready(function(){jQuery("#"+t_jp.prefix+"setdeflang").click(function(){jQuery.get(t_jp.post_url+"?tr_cookie="+Math.random());jQuery(this).hide("slow");return false});var a=window.eval("("+jQuery("meta[name=translation-stats]").attr("content")+")"),b;if(a!==undefined){a=a.total_phrases-a.translated_phrases-(a.meta_phrases-
|
16 |
+
a.meta_translated_phrases);b=new Date;if((a>5||b.getHours()===4&&a>0)&&t.indexOf(t_jp.lang)>-1){jQuery.ajaxSetup({cache:true});j=function(){t_jp.progress?jQuery.getScript(t_jp.plugin_url+"/js/lazy.js",function(){jQuery.xLazyLoader({js:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js",css:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css",success:function(){r()}})}):r()};jQuery.getScript("http://www.google.com/jsapi",k)}}t_jp.edit&&jQuery("."+
|
17 |
+
t_jp.prefix).each(function(){var e=jQuery(this).attr("id").substr(jQuery(this).attr("id").lastIndexOf("_")+1),c;jQuery(this).after('<span id="'+t_jp.prefix+"img_"+e+'" class="tr-icon" title="'+jQuery(this).attr("orig")+'"></span>');c=jQuery("#"+t_jp.prefix+"img_"+e);c.click(function(){if(typeof jQuery.fn.tabs!=="function"){jQuery.ajaxSetup({cache:true});jQuery.getScript(t_jp.plugin_url+"/js/lazy.js",function(){jQuery.xLazyLoader({js:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js",
|
18 |
+
css:"http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css",success:function(){s(e)}})})}else s(e);return false}).css({border:"0px",margin:"1px",padding:"0px"});if(jQuery(this).attr("source")==="1")c.addClass("tr-icon-yellow");else jQuery(this).attr("source")==="0"&&c.addClass("tr-icon-green");jQuery(this).attr("hidden")==="y"&&c.css({opacity:"0.6"})})})})();
|
js/transposhadmin.js
CHANGED
@@ -1 +1,6 @@
|
|
1 |
-
var timer
|
|
|
|
|
|
|
|
|
|
1 |
+
var timer,items=0,translations=[],tokens=[],langs=[];
|
2 |
+
function ajax_translate_me(e,c,b){clearTimeout(timer);items++;tokens.push(e);translations.push(c);langs.push(b);timer=setTimeout(function(){for(var d={sr0:1,translation_posted:"2",items:items},a=0;a<items;a++){if(tokens[a]!=tokens[a-1])d["tk"+a]=tokens[a];if(langs[a]!=langs[a-1])d["ln"+a]=langs[a];if(translations[a]!=translations[a-1])d["tr"+a]=translations[a]}jQuery.ajax({type:"POST",url:transposh_params.post_url,data:d,success:function(){},error:function(){}});translations=[];tokens=[];langs=[]},
|
3 |
+
200)}jQuery.noConflict();google.load("language","1");var transposh_params=[],ext_langs="he|zh-tw|pt|fa|af|be|is|ga|mk|ms|sw|ws|cy|yi";jQuery("script[src*='transposhadmin.js']").each(function(){for(var e=unescape(this.src.substring(this.src.indexOf("?")+1)).split("&"),c=0;c<e.length;c++){var b=e[c].indexOf("=");if(b>0){var d=e[c].substring(0,b);b=e[c].substring(b+1);transposh_params[d]=b}}});
|
4 |
+
jQuery(document).ready(function(){var e=0,c="",b=0;jQuery.getJSON(transposh_params.post_url+"?tr_phrases_post=y&post="+transposh_params.post+"&random="+Math.random(),function(d){if(d==null)jQuery("#tr_loading").replaceWith("Nothing left to translate");else{jQuery("#tr_loading").replaceWith('Translating<br/>Phrase: <span id="p"></span><div id="progress_bar"/>Target lanaguage: <span id="l"></span><div id="progress_bar2"/><span id="r"></span>');jQuery("#progress_bar").progressbar({value:0});jQuery("#progress_bar2").progressbar({value:0});
|
5 |
+
jQuery.each(d.p,function(a,f){jQuery("#progress_bar2").progressbar("value",b/f.l.length*100);jQuery.each(f.l,function(i,g){google.language.translate(a,"",g,function(h){if(!h.error){if(c!=a){c=a;b=0;e++}jQuery("#progress_bar").progressbar("value",e/d.length*100);b++;jQuery("#progress_bar2").progressbar("value",b/f.l.length*100);jQuery("#p").text(jQuery("<div>"+a+"</div>").text());jQuery("#l").text(g);jQuery("#r").text(jQuery("<div>"+h.translation+"</div>").text());ajax_translate_me(f.t,jQuery("<div>"+
|
6 |
+
h.translation+"</div>").text(),g)}})})})}})});
|
js/transposhcontrol.js
CHANGED
@@ -1 +1,6 @@
|
|
1 |
-
jQuery(function(){jQuery("#tr_anon").click(function(){if(jQuery("#tr_anon").attr("checked")){jQuery(".translateable").addClass("active").removeClass("translateable");jQuery("#sortable .active").each(function(){jQuery("input",this).val(jQuery(this).attr("id")+",v,t")})}jQuery("#yellowcolor").toggleClass("hidden")});jQuery("#sortable").sortable({placeholder:"highlight",update:function(a
|
|
|
|
|
|
|
|
|
|
1 |
+
jQuery(function(){jQuery("#tr_anon").click(function(){if(jQuery("#tr_anon").attr("checked")){jQuery(".translateable").addClass("active").removeClass("translateable");jQuery("#sortable .active").each(function(){jQuery("input",this).val(jQuery(this).attr("id")+",v,t")})}jQuery("#yellowcolor").toggleClass("hidden")});jQuery("#sortable").sortable({placeholder:"highlight",update:function(b,a){a.item.unbind("click");a.item.one("click",function(c){c.stopImmediatePropagation();jQuery(this).click(clickfunction)})}});
|
2 |
+
jQuery("#sortable").disableSelection();jQuery("#changename").click(function(){jQuery(".langname").toggleClass("hidden");return false});jQuery("#selectall").click(function(){jQuery("#sortable .languages").addClass("active").removeClass("translateable");jQuery("#sortable .active").each(function(){jQuery("input",this).val(jQuery(this).attr("id")+",v,t")});return false});clickfunction=function(){if(jQuery(this).attr("id")!=jQuery("#default_list li").attr("id")){if(jQuery("#tr_anon").attr("checked"))jQuery(this).toggleClass("active");
|
3 |
+
else if(jQuery(this).hasClass("active")){jQuery(this).removeClass("active");jQuery(this).addClass("translateable")}else jQuery(this).hasClass("translateable")?jQuery(this).removeClass("translateable"):jQuery(this).addClass("active");jQuery("input",this).val(jQuery(this).attr("id")+(jQuery(this).hasClass("active")?",v":",")+(jQuery(this).hasClass("translateable")?",t":","))}};jQuery(".languages").dblclick(clickfunction).click(clickfunction);jQuery("#default_lang").droppable({accept:".languages",activeClass:"highlight_default",
|
4 |
+
drop:function(b,a){jQuery("#default_list").empty();jQuery(a.draggable.clone().removeAttr("style").removeClass("active").removeClass("translateable")).appendTo("#default_list").show("slow");jQuery("#default_list .logoicon").remove();jQuery("#sortable").find("#"+a.draggable.attr("id")).addClass("active")}});jQuery("#sortiso").click(function(){jQuery("#sortable li").sort(function(b,a){if(jQuery(b).attr("id")==jQuery("#default_list li").attr("id"))return-1;if(jQuery(a).attr("id")==jQuery("#default_list li").attr("id"))return 1;
|
5 |
+
return jQuery(b).attr("id")>jQuery(a).attr("id")?1:-1}).remove().appendTo("#sortable").dblclick(clickfunction).click(clickfunction);return false});jQuery("#sortname").click(function(){jQuery("#sortable li").sort(function(b,a){langa=jQuery(".langname",b).filter(function(){return!jQuery(this).hasClass("hidden")}).text();langb=jQuery(".langname",a).filter(function(){return!jQuery(this).hasClass("hidden")}).text();langdef=jQuery(".langname","#default_list li").filter(function(){return!jQuery(this).hasClass("hidden")}).text();
|
6 |
+
if(langa==langdef)return-1;if(langb==langdef)return 1;return langa>langb?1:-1}).remove().appendTo("#sortable").dblclick(clickfunction).click(clickfunction);return false})});
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Transposh - translation filter for wordpress ===
|
2 |
Contributors: oferwald, amirperlman
|
3 |
Donate link: http://transposh.org/donate/
|
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.9.
|
7 |
-
Stable tag: 0.4.
|
8 |
|
9 |
Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
|
10 |
|
@@ -117,7 +117,9 @@ Users of php speedy will have to deactivate it, add “transposh.js” in the ig
|
|
117 |
= Plugin support: Google-Sitemaps-XML =
|
118 |
|
119 |
Currently the plugin is able to add the multilingual urls to the sitemap, and you need to add the following line at the sitemap-core.php, add-url function (line 1509 at version 3.2.2)
|
120 |
-
|
|
|
|
|
121 |
We hope that future versions will include this by default, and for now you can get the patched file from our site.
|
122 |
After a change of languages used, you are welcomed to trigger a new sitemap buildup.
|
123 |
|
@@ -143,6 +145,11 @@ change the .css from transparent background to your page background color. And l
|
|
143 |
|
144 |
You can wrap the element with the "no_translate" class, or add a span similar to `<span class="no_translate">`
|
145 |
|
|
|
|
|
|
|
|
|
|
|
146 |
== Screenshots ==
|
147 |
|
148 |
1. This is a screen shot of Transposh home page with the flagged widget on the right sidebar
|
@@ -158,6 +165,13 @@ This version provides integration with google-sitemaps-xml and wp-super-cache
|
|
158 |
This version allows sorting of languages within the widget
|
159 |
|
160 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
161 |
= 2010/01/01 - 0.4.0 =
|
162 |
* Solve activation/deactivation bug
|
163 |
* Parser provides statistics in meta tag
|
1 |
=== Transposh - translation filter for wordpress ===
|
2 |
Contributors: oferwald, amirperlman
|
3 |
Donate link: http://transposh.org/donate/
|
4 |
+
Tags: translation, widget, filter, bilingual, multilingual, transposh, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese, translate
|
5 |
Requires at least: 2.7
|
6 |
+
Tested up to: 2.9.1
|
7 |
+
Stable tag: 0.4.1
|
8 |
|
9 |
Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
|
10 |
|
117 |
= Plugin support: Google-Sitemaps-XML =
|
118 |
|
119 |
Currently the plugin is able to add the multilingual urls to the sitemap, and you need to add the following line at the sitemap-core.php, add-url function (line 1509 at version 3.2.2)
|
120 |
+
|
121 |
+
`do_action('sm_addurl', &$page);`
|
122 |
+
|
123 |
We hope that future versions will include this by default, and for now you can get the patched file from our site.
|
124 |
After a change of languages used, you are welcomed to trigger a new sitemap buildup.
|
125 |
|
145 |
|
146 |
You can wrap the element with the "no_translate" class, or add a span similar to `<span class="no_translate">`
|
147 |
|
148 |
+
= Can I make different images appear in different languages in my themes? =
|
149 |
+
|
150 |
+
Yes, although a bit tricky - you can use the `$my_transposh_plugin->target_language` as part of the image descriptor, this will load different
|
151 |
+
images based on the current language
|
152 |
+
|
153 |
== Screenshots ==
|
154 |
|
155 |
1. This is a screen shot of Transposh home page with the flagged widget on the right sidebar
|
165 |
This version allows sorting of languages within the widget
|
166 |
|
167 |
== Changelog ==
|
168 |
+
= 2010/01/13 - 0.4.1 =
|
169 |
+
* Fixed a few redirection bugs (administrative pages, and referred pages)
|
170 |
+
* Fixed documentation bug (regarding google-sitemap-generator patch requirement)
|
171 |
+
* Support on demand and async loading of transposh script
|
172 |
+
* Using google closure compiler to reduce script size (now only 3k when gzipped)
|
173 |
+
* Script now passes jslint.com (almost)
|
174 |
+
* Css optimizations and reduction in number of file requests in most scenarios
|
175 |
= 2010/01/01 - 0.4.0 =
|
176 |
* Solve activation/deactivation bug
|
177 |
* Parser provides statistics in meta tag
|
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.4.
|
8 |
Author URI: http://transposh.org/
|
9 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
10 |
*/
|
@@ -77,8 +77,6 @@ class transposh_plugin {
|
|
77 |
private $admin_msg;
|
78 |
/** @var string Saved search variables*/
|
79 |
private $search_s;
|
80 |
-
/** @var boolean If transposh.js is on the page*/
|
81 |
-
public $js_included = false;
|
82 |
|
83 |
/**
|
84 |
* class constructor
|
@@ -117,11 +115,22 @@ class transposh_plugin {
|
|
117 |
add_action('shutdown', array(&$this,'on_shutdown'));
|
118 |
add_action('wp_print_styles', array(&$this,'add_transposh_css'));
|
119 |
add_action('wp_print_scripts', array(&$this,'add_transposh_js'));
|
|
|
120 |
add_action("sm_addurl",array(&$this,'add_sm_transposh_urls'));
|
121 |
register_activation_hook(__FILE__, array(&$this,'plugin_activate'));
|
122 |
register_deactivation_hook(__FILE__,array(&$this,'plugin_deactivate'));
|
123 |
}
|
124 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
/**
|
126 |
* Called when the buffer containing the original page is flushed. Triggers the translation process.
|
127 |
* @param string $buffer Original page
|
@@ -132,9 +141,7 @@ class transposh_plugin {
|
|
132 |
$start_time = microtime(TRUE);
|
133 |
|
134 |
// Refrain from touching the administrative interface and important pages
|
135 |
-
if(
|
136 |
-
stripos($_SERVER['REQUEST_URI'],'/wp-admin/') !== FALSE ||
|
137 |
-
stripos($_SERVER['REQUEST_URI'],'/xmlrpc.php') !== FALSE) {
|
138 |
|
139 |
return $buffer;
|
140 |
}
|
@@ -275,8 +282,9 @@ class transposh_plugin {
|
|
275 |
$this->target_language = $this->options->get_default_language();
|
276 |
|
277 |
|
278 |
-
// we'll go into this code of redirection only if we have options that need it (and no bot is involved, for the non-cookie)
|
279 |
-
if ($this->options->get_enable_detect_language() || $this->options->get_widget_allow_set_default_language())
|
|
|
280 |
// we are starting a session if needed
|
281 |
if (!session_id()) session_start();
|
282 |
// no redirections if we already redirected in this session or we suspect cyclic redirections
|
@@ -451,15 +459,16 @@ class transposh_plugin {
|
|
451 |
* Add custom css, i.e. transposh.css
|
452 |
*/
|
453 |
function add_transposh_css() {
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
|
|
458 |
//include the transposh.css
|
459 |
wp_enqueue_style("transposh","{$this->transposh_plugin_url}/css/transposh.css",array(),TRANSPOSH_PLUGIN_VER);
|
460 |
// we have to load the jquery-ui css just in some cases
|
461 |
-
if ($this->edit_mode || $this->options->get_widget_progressbar())
|
462 |
-
wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css",array(),'1.0');
|
463 |
|
464 |
}
|
465 |
|
@@ -472,33 +481,53 @@ class transposh_plugin {
|
|
472 |
return;
|
473 |
}
|
474 |
|
475 |
-
$edit_param = "";
|
476 |
-
if($this->edit_mode) {
|
477 |
-
$edit_param = "&".EDIT_PARAM."=y";
|
478 |
-
}
|
479 |
-
|
480 |
-
if($this->edit_mode || $this->options->get_widget_progressbar()) {
|
481 |
-
wp_enqueue_script("jqueryui","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js",array("jquery"),'1.7.2',$this->options->get_enable_footer_scripts());
|
482 |
-
}
|
483 |
-
|
484 |
if($this->edit_mode || $this->is_auto_translate_permitted()) {
|
485 |
//TODO - fix (onetime var)
|
486 |
wp_deregister_script('jquery');
|
487 |
wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2');
|
488 |
// toying around - for later...
|
489 |
-
//wp_enqueue_script("jquery","http://code.jquery.com/jquery-1.
|
490 |
-
// jQuery pushing below might cause issues
|
491 |
-
//wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2', $this->options->get_enable_footer_scripts());
|
492 |
-
wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1',$this->options->get_enable_footer_scripts());
|
493 |
-
// Make sure msn translate is not needlessly loaded when we are only auto translating
|
494 |
-
if ($this->options->get_enable_msn_translate() && $this->edit_mode) {
|
495 |
-
wp_enqueue_script("mstranslate","http://api.microsofttranslator.com/V1/Ajax.svc/Embed?appId=".$this->options->get_msn_key(),array(),'1',$this->options->get_enable_footer_scripts());
|
496 |
-
}
|
497 |
-
wp_enqueue_script("transposh","{$this->transposh_plugin_url}/js/transposh.js?post_url={$this->post_url}{$edit_param}&lang={$this->target_language}&prefix=".SPAN_PREFIX,array("jquery"),TRANSPOSH_PLUGIN_VER,$this->options->get_enable_footer_scripts());
|
498 |
-
$this->js_included = true;
|
499 |
}
|
500 |
}
|
501 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
502 |
|
503 |
/**
|
504 |
* Determine if the currently selected language (taken from the query parameters) is in the admin's list
|
@@ -641,7 +670,7 @@ class transposh_plugin {
|
|
641 |
* This function integrates with google sitemap generator, and adds for each viewable language, the rest of the languages url
|
642 |
* Also - priority is reduced by 0.2
|
643 |
* And this requires the following line at the sitemap-core.php, add-url function (line 1509 at version 3.2.2)
|
644 |
-
* do_action('sm_addurl'
|
645 |
* @param GoogleSitemapGeneratorPage $sm_page Object containing the page information
|
646 |
*/
|
647 |
function add_sm_transposh_urls(&$sm_page) {
|
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.4.1
|
8 |
Author URI: http://transposh.org/
|
9 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
10 |
*/
|
77 |
private $admin_msg;
|
78 |
/** @var string Saved search variables*/
|
79 |
private $search_s;
|
|
|
|
|
80 |
|
81 |
/**
|
82 |
* class constructor
|
115 |
add_action('shutdown', array(&$this,'on_shutdown'));
|
116 |
add_action('wp_print_styles', array(&$this,'add_transposh_css'));
|
117 |
add_action('wp_print_scripts', array(&$this,'add_transposh_js'));
|
118 |
+
add_action('wp_head', array(&$this,'add_transposh_async'));
|
119 |
add_action("sm_addurl",array(&$this,'add_sm_transposh_urls'));
|
120 |
register_activation_hook(__FILE__, array(&$this,'plugin_activate'));
|
121 |
register_deactivation_hook(__FILE__,array(&$this,'plugin_deactivate'));
|
122 |
}
|
123 |
|
124 |
+
/**
|
125 |
+
* Check if page is special (one that we normally should not touch
|
126 |
+
* @param string $url Url to check
|
127 |
+
* @return boolean Is it a special page?
|
128 |
+
*/
|
129 |
+
function is_special_page($url) {
|
130 |
+
return (stripos($url,'/wp-login.php') !== FALSE ||
|
131 |
+
stripos($url,'/wp-admin/') !== FALSE ||
|
132 |
+
stripos($url,'/xmlrpc.php') !== FALSE);
|
133 |
+
}
|
134 |
/**
|
135 |
* Called when the buffer containing the original page is flushed. Triggers the translation process.
|
136 |
* @param string $buffer Original page
|
141 |
$start_time = microtime(TRUE);
|
142 |
|
143 |
// Refrain from touching the administrative interface and important pages
|
144 |
+
if($this->is_special_page($_SERVER['REQUEST_URI'])) {
|
|
|
|
|
145 |
|
146 |
return $buffer;
|
147 |
}
|
282 |
$this->target_language = $this->options->get_default_language();
|
283 |
|
284 |
|
285 |
+
// we'll go into this code of redirection only if we have options that need it (and no bot is involved, for the non-cookie) and this is not a special page or one that is refered by our site
|
286 |
+
if (($this->options->get_enable_detect_language() || $this->options->get_widget_allow_set_default_language()) &&
|
287 |
+
!($this->is_special_page($_SERVER['REQUEST_URI']) || strpos($_SERVER['HTTP_REFERER'], $this->home_url) !== false)) {
|
288 |
// we are starting a session if needed
|
289 |
if (!session_id()) session_start();
|
290 |
// no redirections if we already redirected in this session or we suspect cyclic redirections
|
459 |
* Add custom css, i.e. transposh.css
|
460 |
*/
|
461 |
function add_transposh_css() {
|
462 |
+
//translation not allowed - no need for the transposh.css
|
463 |
+
if(!$this->is_editing_permitted() && !$this->is_auto_translate_permitted()) return;
|
464 |
+
// actually - this is only needed when editing
|
465 |
+
if (!$this->edit_mode) return;
|
466 |
+
// TODO - remove on lazy load...
|
467 |
//include the transposh.css
|
468 |
wp_enqueue_style("transposh","{$this->transposh_plugin_url}/css/transposh.css",array(),TRANSPOSH_PLUGIN_VER);
|
469 |
// we have to load the jquery-ui css just in some cases
|
470 |
+
// if ($this->edit_mode || $this->options->get_widget_progressbar())
|
471 |
+
// wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/themes/ui-lightness/jquery-ui.css",array(),'1.0');
|
472 |
|
473 |
}
|
474 |
|
481 |
return;
|
482 |
}
|
483 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
484 |
if($this->edit_mode || $this->is_auto_translate_permitted()) {
|
485 |
//TODO - fix (onetime var)
|
486 |
wp_deregister_script('jquery');
|
487 |
wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2');
|
488 |
// toying around - for later...
|
489 |
+
//wp_enqueue_script("jquery","http://code.jquery.com/jquery-1.4rc1.js",array(),'1.4rc');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
}
|
491 |
}
|
492 |
|
493 |
+
/**
|
494 |
+
* Inserts the transposh async loading in the head.
|
495 |
+
* @return nothing
|
496 |
+
*/
|
497 |
+
function add_transposh_async() {
|
498 |
+
if (!$this->edit_mode && !$this->is_auto_translate_permitted()) {
|
499 |
+
return;
|
500 |
+
}
|
501 |
+
|
502 |
+
echo "<script type=\"text/javascript\">";
|
503 |
+
echo "var t_jp=t_jp || [];";
|
504 |
+
echo "t_jp.post_url='{$this->post_url}';";
|
505 |
+
echo "t_jp.plugin_url='{$this->transposh_plugin_url}';";
|
506 |
+
echo "t_jp.edit=".($this->edit_mode? 'true' : 'false').";";
|
507 |
+
//echo "t_jp.rtl=".(in_array ($this->target_language, $GLOBALS['rtl_languages'])? 'true' : 'false').";";
|
508 |
+
echo "t_jp.lang='{$this->target_language}';";
|
509 |
+
echo "t_jp.prefix='".SPAN_PREFIX."';";
|
510 |
+
echo "t_jp.msnkey='{$this->options->get_msn_key()}';";
|
511 |
+
echo "t_jp.progress=".($this->edit_mode || $this->options->get_widget_progressbar() ? 'true' : 'false').";";
|
512 |
+
|
513 |
+
/*
|
514 |
+
* // let's lazy load! (worked, didn't make sense)
|
515 |
+
// jQuery(document).ready(
|
516 |
+
jQuery(window).load(
|
517 |
+
function() {
|
518 |
+
jQuery.ajax({
|
519 |
+
type: 'GET',
|
520 |
+
url: '{$this->transposh_plugin_url}/js/transposh.js?ver=".TRANSPOSH_PLUGIN_VER."',
|
521 |
+
dataType: 'script',
|
522 |
+
cache: true
|
523 |
+
});
|
524 |
+
});
|
525 |
+
*/
|
526 |
+
echo "var tp = document.createElement('script'); tp.type = 'text/javascript'; tp.async = true;";
|
527 |
+
echo "tp.src = '{$this->transposh_plugin_url}/js/transposh.js?ver=".TRANSPOSH_PLUGIN_VER."';";
|
528 |
+
echo "(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(tp);";
|
529 |
+
echo"</script>";
|
530 |
+
}
|
531 |
|
532 |
/**
|
533 |
* Determine if the currently selected language (taken from the query parameters) is in the admin's list
|
670 |
* This function integrates with google sitemap generator, and adds for each viewable language, the rest of the languages url
|
671 |
* Also - priority is reduced by 0.2
|
672 |
* And this requires the following line at the sitemap-core.php, add-url function (line 1509 at version 3.2.2)
|
673 |
+
* do_action('sm_addurl', &$page);
|
674 |
* @param GoogleSitemapGeneratorPage $sm_page Object containing the page information
|
675 |
*/
|
676 |
function add_sm_transposh_urls(&$sm_page) {
|
wp/transposh_widget.php
CHANGED
@@ -87,18 +87,20 @@ class transposh_plugin_widget {
|
|
87 |
add_action('wp_print_styles', array(&$this,'add_transposh_widget_css'));
|
88 |
}
|
89 |
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
function add_transposh_widget_css() {
|
94 |
//include the transposh_widget.css
|
95 |
// TODO: user generated version
|
96 |
if ($this->transposh->options->get_widget_style() == 1 || $this->transposh->options->get_widget_style() == 2) {
|
97 |
wp_enqueue_style("transposh_widget","{$this->transposh->transposh_plugin_url}/css/transposh_widget.css",array(),TRANSPOSH_PLUGIN_VER);
|
98 |
if ($this->transposh->options->get_widget_css_flags()) {
|
99 |
-
|
|
|
100 |
if (file_exists("{$this->transposh->transposh_plugin_url}/css/transposh_flags_u.css"))
|
101 |
-
|
|
|
102 |
}
|
103 |
}
|
104 |
|
@@ -194,11 +196,7 @@ class transposh_plugin_widget {
|
|
194 |
if($is_showing_languages) {
|
195 |
if ($this->transposh->options->get_widget_allow_set_default_language()) {
|
196 |
If ((isset($_COOKIE['TR_LNG']) && $_COOKIE['TR_LNG'] != $this->transposh->target_language) || (!isset($_COOKIE['TR_LNG']) && !$this->transposh->options->is_default_language($this->transposh->target_language))) {
|
197 |
-
|
198 |
-
echo '<a href="#" id="'.SPAN_PREFIX.'setdeflang" onClick="return false;">Set as default language</a><br/>';
|
199 |
-
} else {
|
200 |
-
echo '<a href="'.$this->transposh->post_url.'?tr_cookie_bck">Set as default language</a><br/>';
|
201 |
-
}
|
202 |
}
|
203 |
}
|
204 |
//Add the edit checkbox only for translators on languages marked as editable
|
87 |
add_action('wp_print_styles', array(&$this,'add_transposh_widget_css'));
|
88 |
}
|
89 |
|
90 |
+
/**
|
91 |
+
* Add custom css, i.e. transposh_widget.css, flags now override widget
|
92 |
+
*/
|
93 |
function add_transposh_widget_css() {
|
94 |
//include the transposh_widget.css
|
95 |
// TODO: user generated version
|
96 |
if ($this->transposh->options->get_widget_style() == 1 || $this->transposh->options->get_widget_style() == 2) {
|
97 |
wp_enqueue_style("transposh_widget","{$this->transposh->transposh_plugin_url}/css/transposh_widget.css",array(),TRANSPOSH_PLUGIN_VER);
|
98 |
if ($this->transposh->options->get_widget_css_flags()) {
|
99 |
+
wp_deregister_style("transposh_widget");
|
100 |
+
wp_enqueue_style("transposh_widget", "{$this->transposh->transposh_plugin_url}/css/transposh_flags.css",array(),TRANSPOSH_PLUGIN_VER);
|
101 |
if (file_exists("{$this->transposh->transposh_plugin_url}/css/transposh_flags_u.css"))
|
102 |
+
wp_deregister_style("transposh_widget");
|
103 |
+
wp_enqueue_style("transposh_widget", "{$this->transposh->transposh_plugin_url}/css/transposh_flags_u.css",array(),TRANSPOSH_PLUGIN_VER);
|
104 |
}
|
105 |
}
|
106 |
|
196 |
if($is_showing_languages) {
|
197 |
if ($this->transposh->options->get_widget_allow_set_default_language()) {
|
198 |
If ((isset($_COOKIE['TR_LNG']) && $_COOKIE['TR_LNG'] != $this->transposh->target_language) || (!isset($_COOKIE['TR_LNG']) && !$this->transposh->options->is_default_language($this->transposh->target_language))) {
|
199 |
+
echo '<a id="'.SPAN_PREFIX.'setdeflang" onClick="return false;" href="'.$this->transposh->post_url.'?tr_cookie_bck">Set as default language</a><br/>';
|
|
|
|
|
|
|
|
|
200 |
}
|
201 |
}
|
202 |
//Add the edit checkbox only for translators on languages marked as editable
|