Version Description
Download this release
Release Info
Developer | oferwald |
Plugin | Transposh WordPress Translation |
Version | 0.2.8 |
Comparing to | |
See all releases |
Code changes from version 0.2.7 to 0.2.8
- core/constants.php +3 -0
- core/utils.php +20 -1
- css/transposh.css +1 -1
- css/transposh_flags.css +1 -0
- css/transposh_widget.css +1 -1
- img/flags.png +0 -0
- js/transposh.js +1 -1
- readme.txt +22 -2
- transposh.php +17 -18
- transposh_admin.php +50 -3
- transposh_db.php +2 -2
- transposh_widget.php +15 -12
core/constants.php
CHANGED
@@ -103,6 +103,9 @@ define("ENABLE_DEFAULT_TRANSLATE", "transposh_enable_default_translate");
|
|
103 |
//Option to enable/disable footer scripts (2.8 and up)
|
104 |
define("ENABLE_FOOTER_SCRIPTS", "transposh_enable_footer_scripts");
|
105 |
|
|
|
|
|
|
|
106 |
//Option defining the default language
|
107 |
define("DEFAULT_LANG", "transposh_default_language");
|
108 |
|
103 |
//Option to enable/disable footer scripts (2.8 and up)
|
104 |
define("ENABLE_FOOTER_SCRIPTS", "transposh_enable_footer_scripts");
|
105 |
|
106 |
+
//Use CSS sprites for flags if available
|
107 |
+
define("ENABLE_CSS_FLAGS", "transposh_enable_css_flags");
|
108 |
+
|
109 |
//Option defining the default language
|
110 |
define("DEFAULT_LANG", "transposh_default_language");
|
111 |
|
core/utils.php
CHANGED
@@ -30,7 +30,7 @@ require_once("constants.php");
|
|
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
|
@@ -50,6 +50,14 @@ function cleanup_url($url, $remove_host = false) {
|
|
50 |
|
51 |
//cleanup lang identifier in permalinks
|
52 |
//remove the language from the url permalink (if in start of path, and is a defined language)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
53 |
if (strlen($parsedurl['path']) > 2) {
|
54 |
$secondslashpos = strpos($parsedurl['path'], "/",1);
|
55 |
if (!$secondslashpos) $secondslashpos = strlen($parsedurl['path']);
|
@@ -57,6 +65,7 @@ function cleanup_url($url, $remove_host = false) {
|
|
57 |
if (isset ($languages[$prevlang])) {
|
58 |
|
59 |
$parsedurl['path'] = substr($parsedurl['path'],$secondslashpos);
|
|
|
60 |
}
|
61 |
}
|
62 |
if ($remove_host) {
|
@@ -191,4 +200,14 @@ function base64_url_decode($input) {
|
|
191 |
return base64_decode(strtr($input, '-_,', '+/='));
|
192 |
}
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
?>
|
30 |
* Return the scrubed url
|
31 |
*/
|
32 |
function cleanup_url($url, $remove_host = false) {
|
33 |
+
global $languages, $home_url;
|
34 |
|
35 |
$parsedurl = parse_url($url);
|
36 |
//cleanup previous lang & edit parameter from url
|
50 |
|
51 |
//cleanup lang identifier in permalinks
|
52 |
//remove the language from the url permalink (if in start of path, and is a defined language)
|
53 |
+
$home_path = rtrim(parse_url($home_url,PHP_URL_PATH),"/");
|
54 |
+
|
55 |
+
if ($home_path && strpos($parsedurl['path'], $home_path) === 0) {
|
56 |
+
|
57 |
+
$parsedurl['path'] = substr($parsedurl['path'],strlen($home_path));
|
58 |
+
$gluebackhome = true;
|
59 |
+
}
|
60 |
+
|
61 |
if (strlen($parsedurl['path']) > 2) {
|
62 |
$secondslashpos = strpos($parsedurl['path'], "/",1);
|
63 |
if (!$secondslashpos) $secondslashpos = strlen($parsedurl['path']);
|
65 |
if (isset ($languages[$prevlang])) {
|
66 |
|
67 |
$parsedurl['path'] = substr($parsedurl['path'],$secondslashpos);
|
68 |
+
if ($gluebackhome) $parsedurl['path'] = $home_path.$parsedurl['path'];
|
69 |
}
|
70 |
}
|
71 |
if ($remove_host) {
|
200 |
return base64_decode(strtr($input, '-_,', '+/='));
|
201 |
}
|
202 |
|
203 |
+
function display_flag ($path, $flag, $language, $css = false, $blank_gif = "") {
|
204 |
+
if (!$css) {
|
205 |
+
return "<img src=\"$path/$flag.png\" title=\"$language\" alt=\"$language\"/>";
|
206 |
+
} else {
|
207 |
+
//return "<img size=\"16x11\" title=\"$language\" alt=\"$language\" src=\"$blank_gif\" class=\"trf trf-{$flag}\"/>";
|
208 |
+
//return "<a href=\"\" title=\"$language\" class=\"trf trf-{$flag}\"/>";
|
209 |
+
return "<span title=\"$language\" class=\"trf trf-{$flag}\"></span>";
|
210 |
+
}
|
211 |
+
}
|
212 |
+
|
213 |
?>
|
css/transposh.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.post .postbody .tr_img_,.attachment .tr_img_,.navigation .alignleft .tr_img_,.navigation .alignright .tr_img_,.tr_img_{border:0;margin:0;}.tr-icon{background-image:url(../img/tr_imgs.png);height:12px;width:12px;background-repeat:no-repeat;overflow:hidden;text-indent:-99999px;}.tr-icon-yellow{background-position:-12px
|
1 |
+
.post .postbody .tr_img_,.attachment .tr_img_,.navigation .alignleft .tr_img_,.navigation .alignright .tr_img_,.tr_img_{border:0;margin:0;}.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
ADDED
@@ -0,0 +1 @@
|
|
|
1 |
+
.trf{background-image:url(../img/flags.png);height:11px;width:16px;background-repeat:no-repeat;overflow:hidden;display:inline-block;}.trf-al{background-position:-24px 0;}.trf-sa{background-position:-48px 0;}.trf-bg{background-position:-72px 0;}.trf-catalonia{background-position:-96px 0;}.trf-cn{background-position:-120px 0;}.trf-tw{background-position:-144px 0;}.trf-hr{background-position:-168px 0;}.trf-cz{background-position:-192px 0;}.trf-dk{background-position:-216px 0;}.trf-nl{background-position:-240px 0;}.trf-ee{background-position:-264px 0;}.trf-fi{background-position:-288px 0;}.trf-fr{background-position:-312px 0;}.trf-galicia{background-position:-336px 0;}.trf-de{background-position:-360px 0;}.trf-gr{background-position:-384px 0;}.trf-il{background-position:-408px 0;}.trf-in{background-position:-432px 0;}.trf-hu{background-position:-456px 0;}.trf-id{background-position:-480px 0;}.trf-it{background-position:-504px 0;}.trf-is{background-position:-528px 0;}.trf-jp{background-position:-552px 0;}.trf-kr{background-position:-576px 0;}.trf-lv{background-position:-600px 0;}.trf-lt{background-position:-624px 0;}.trf-mt{background-position:-648px 0;}.trf-no{background-position:-672px 0;}.trf-ir{background-position:-696px 0;}.trf-pl{background-position:-720px 0;}.trf-pt{background-position:-744px 0;}.trf-ro{background-position:-768px 0;}.trf-ru{background-position:-792px 0;}.trf-rs{background-position:-816px 0;}.trf-sk{background-position:-840px 0;}.trf-sl{background-position:-864px 0;}.trf-es{background-position:-888px 0;}.trf-se{background-position:-912px 0;}.trf-ph{background-position:-936px 0;}.trf-th{background-position:-960px 0;}.trf-tr{background-position:-984px 0;}.trf-ua{background-position:-1008px 0;}.trf-vn{background-position:-1032px 0;}
|
css/transposh_widget.css
CHANGED
@@ -1 +1 @@
|
|
1 |
-
.transposh_flags{direction:ltr;}.transposh_flags a{
|
1 |
+
.transposh_flags{direction:ltr;}.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;}
|
img/flags.png
ADDED
Binary file
|
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('<
|
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('<span title="computer" style="display: inline-block; margin-right: 0.3em;" class="ui-icon ui-icon-gear"></span>');jQuery("table tbody td[source='0']",e.panel).append('<span title="human" style="display: inline-block; margin-right: 0.3em;" class="ui-icon ui-icon-person"></span>')}).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").css("padding","1px").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|fa".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}}});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|fa".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('<span id="'+transposh_params.prefix+"img_"+a+'" class="tr-icon" title="'+jQuery(this).attr("orig")+'"></span>');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
@@ -3,8 +3,8 @@ Contributors: oferwald, amirperlman
|
|
3 |
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.
|
8 |
|
9 |
Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
|
10 |
|
@@ -88,6 +88,19 @@ Just add the following line to your template:
|
|
88 |
|
89 |
<?php if(function_exists("transposh_widget")) { transposh_widget(array()); } ?>
|
90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
91 |
== Screenshots ==
|
92 |
|
93 |
1. This is a screen shot of a site using Transposh widget on the sidebar
|
@@ -97,6 +110,13 @@ Just add the following line to your template:
|
|
97 |
5. Widget style selection
|
98 |
|
99 |
== Release notes ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
* 2009/06/20 - 0.2.7
|
101 |
* Added Persian (Farsi) support to auto translation (thanks to google and Iranian "elections")
|
102 |
* 2009/06/17 - 0.2.6
|
3 |
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.1
|
7 |
+
Stable tag: 0.2.8
|
8 |
|
9 |
Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
|
10 |
|
88 |
|
89 |
<?php if(function_exists("transposh_widget")) { transposh_widget(array()); } ?>
|
90 |
|
91 |
+
= I have php speedy (http://aciddrop.com/php-speedy/) and the plugin does not work =
|
92 |
+
|
93 |
+
Users of php speedy will have to deactivate it, add “transposh.js” in the ignore list, click on “Test configuration” then reactivate it.
|
94 |
+
|
95 |
+
= I want my own css image with less flags =
|
96 |
+
|
97 |
+
This is coming soon
|
98 |
+
|
99 |
+
= css flags have issues on IE6 for my users =
|
100 |
+
|
101 |
+
First, there's always the ability to use another option for the plugin which is more compatible, such as the selection box. Second, you can
|
102 |
+
change the .css from transparent background to your page background color. And last - we urge anyone using IE6 to upgrade...
|
103 |
+
|
104 |
== Screenshots ==
|
105 |
|
106 |
1. This is a screen shot of a site using Transposh widget on the sidebar
|
110 |
5. Widget style selection
|
111 |
|
112 |
== Release notes ==
|
113 |
+
* 2009/07/19 - 0.2.8
|
114 |
+
* Don't touch XML RPC
|
115 |
+
* Allow usage of CSS sprites when available
|
116 |
+
* Removed use of local blank image (thanks [Marek](http://marenkuv.blogspot.com/))
|
117 |
+
* Fixed unicode in Transposh RSS feed (Admin panel)
|
118 |
+
* Smarter inclusion of .css files (only when needed)
|
119 |
+
* Fixed bug with url_cleanup which prevented return to original language when blog was installed in a subdir
|
120 |
* 2009/06/20 - 0.2.7
|
121 |
* Added Persian (Farsi) support to auto translation (thanks to google and Iranian "elections")
|
122 |
* 2009/06/17 - 0.2.6
|
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.
|
8 |
Author URI: http://transposh.org/
|
9 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
10 |
*/
|
@@ -45,7 +45,7 @@ function process_page(&$buffer) {
|
|
45 |
$start_time = microtime(TRUE);
|
46 |
|
47 |
// Refrain from touching the administrative interface
|
48 |
-
if(stripos($_SERVER['REQUEST_URI'],'/wp-admin/') !== FALSE) {
|
49 |
|
50 |
return $buffer;
|
51 |
}
|
@@ -88,17 +88,22 @@ function process_page(&$buffer) {
|
|
88 |
function init_global_vars() {
|
89 |
global $home_url, $tr_plugin_url, $enable_permalinks_rewrite, $wp_rewrite;
|
90 |
|
91 |
-
|
|
|
92 |
// Handle windows ('C:\wordpress')
|
93 |
$local_dir = preg_replace("/\\\\/", "/", dirname(__FILE__));
|
94 |
// Get last directory name
|
95 |
$local_dir = preg_replace("/.*\//", "", $local_dir);
|
96 |
$tr_plugin_url= WP_PLUGIN_URL .'/'. $local_dir;
|
|
|
|
|
97 |
|
|
|
98 |
|
99 |
-
if($wp_rewrite
|
100 |
-
$
|
101 |
-
|
|
|
102 |
}
|
103 |
|
104 |
/*
|
@@ -131,12 +136,6 @@ function on_init() {
|
|
131 |
elseif (isset($_GET['tr_token_hist'])) {
|
132 |
get_translation_history($_GET['tr_token_hist'], $_GET['lang']);
|
133 |
}
|
134 |
-
elseif (isset($_GET['tp_gif'])) {
|
135 |
-
$trans_gif_64 = "R0lGODlhAQABAIAAAAAAAAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==";
|
136 |
-
header("Content-type: image/gif");
|
137 |
-
print(base64_decode($trans_gif_64));
|
138 |
-
exit;
|
139 |
-
}
|
140 |
else {
|
141 |
//set the callback for translating the page when it's done
|
142 |
ob_start("process_page");
|
@@ -257,7 +256,7 @@ function plugin_activate() {
|
|
257 |
add_filter('rewrite_rules_array', 'update_rewrite_rules');
|
258 |
$wp_rewrite->flush_rules();
|
259 |
|
260 |
-
|
261 |
}
|
262 |
|
263 |
/*
|
@@ -349,7 +348,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.
|
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 |
}
|
@@ -390,7 +389,7 @@ function add_transposh_js() {
|
|
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.
|
394 |
}
|
395 |
}
|
396 |
|
@@ -407,7 +406,7 @@ function is_editing_permitted() {
|
|
407 |
if(!is_translator()) return FALSE;
|
408 |
// and only on the non-default lang (unless strictly specified)
|
409 |
if (!get_option(ENABLE_DEFAULT_TRANSLATE) && $GLOBALS['lang'] == get_default_lang()) return false;
|
410 |
-
|
411 |
return is_editable_lang($GLOBALS['lang']);
|
412 |
}
|
413 |
|
@@ -484,8 +483,8 @@ add_action('init', 'on_init');
|
|
484 |
add_action('shutdown', 'on_shutdown');
|
485 |
|
486 |
add_action( 'plugins_loaded', 'plugin_loaded');
|
487 |
-
register_activation_hook(
|
488 |
-
register_deactivation_hook(
|
489 |
|
490 |
add_filter('rewrite_rules_array', 'update_rewrite_rules');
|
491 |
?>
|
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.8
|
8 |
Author URI: http://transposh.org/
|
9 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
10 |
*/
|
45 |
$start_time = microtime(TRUE);
|
46 |
|
47 |
// Refrain from touching the administrative interface
|
48 |
+
if(stripos($_SERVER['REQUEST_URI'],'/wp-admin/') !== FALSE || stripos($_SERVER['REQUEST_URI'],'/xmlrpc.php') !== FALSE) {
|
49 |
|
50 |
return $buffer;
|
51 |
}
|
88 |
function init_global_vars() {
|
89 |
global $home_url, $tr_plugin_url, $enable_permalinks_rewrite, $wp_rewrite;
|
90 |
|
91 |
+
if (!$GLOBALS['home_url'])
|
92 |
+
$GLOBALS['home_url'] = get_option('home');
|
93 |
// Handle windows ('C:\wordpress')
|
94 |
$local_dir = preg_replace("/\\\\/", "/", dirname(__FILE__));
|
95 |
// Get last directory name
|
96 |
$local_dir = preg_replace("/.*\//", "", $local_dir);
|
97 |
$tr_plugin_url= WP_PLUGIN_URL .'/'. $local_dir;
|
98 |
+
// TODO - test on more platforms - this failed in 2.7.1 so I am reverting for now...
|
99 |
+
//$tr_plugin_url= plugins_url('', __FILE__);
|
100 |
|
101 |
+
//
|
102 |
|
103 |
+
if (is_object($wp_rewrite))
|
104 |
+
if($wp_rewrite->using_permalinks() && get_option(ENABLE_PERMALINKS_REWRITE)) {
|
105 |
+
$enable_permalinks_rewrite = TRUE;
|
106 |
+
}
|
107 |
}
|
108 |
|
109 |
/*
|
136 |
elseif (isset($_GET['tr_token_hist'])) {
|
137 |
get_translation_history($_GET['tr_token_hist'], $_GET['lang']);
|
138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
else {
|
140 |
//set the callback for translating the page when it's done
|
141 |
ob_start("process_page");
|
256 |
add_filter('rewrite_rules_array', 'update_rewrite_rules');
|
257 |
$wp_rewrite->flush_rules();
|
258 |
|
259 |
+
|
260 |
}
|
261 |
|
262 |
/*
|
348 |
return;
|
349 |
}
|
350 |
//include the transposh.css
|
351 |
+
wp_enqueue_style("transposh","$tr_plugin_url/css/transposh.css",array(),'0.2.8');
|
352 |
wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css",array(),'1.0');
|
353 |
|
354 |
}
|
389 |
// jQuery pushing below might cause issues
|
390 |
//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));
|
391 |
wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1',get_option(ENABLE_FOOTER_SCRIPTS));
|
392 |
+
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.8',get_option(ENABLE_FOOTER_SCRIPTS));
|
393 |
}
|
394 |
}
|
395 |
|
406 |
if(!is_translator()) return FALSE;
|
407 |
// and only on the non-default lang (unless strictly specified)
|
408 |
if (!get_option(ENABLE_DEFAULT_TRANSLATE) && $GLOBALS['lang'] == get_default_lang()) return false;
|
409 |
+
|
410 |
return is_editable_lang($GLOBALS['lang']);
|
411 |
}
|
412 |
|
483 |
add_action('shutdown', 'on_shutdown');
|
484 |
|
485 |
add_action( 'plugins_loaded', 'plugin_loaded');
|
486 |
+
register_activation_hook(__FILE__, 'plugin_activate');
|
487 |
+
register_deactivation_hook(__FILE__,'plugin_deactivate');
|
488 |
|
489 |
add_filter('rewrite_rules_array', 'update_rewrite_rules');
|
490 |
?>
|
transposh_admin.php
CHANGED
@@ -69,7 +69,8 @@ function insert_supported_langs() {
|
|
69 |
list ($language,$flag,$autot) = explode (",",$lang);
|
70 |
if(!($i % $columns)) echo '<tr'.(!($i/2 % $columns) ? ' class="alternate"':'').'>';
|
71 |
$i++;
|
72 |
-
|
|
|
73 |
echo '<td align="center"><input type="checkbox" id="' . $code .'_view" name="' .
|
74 |
$code . '_view" onchange="chbx_change(\'' . $code . '\')" ' . is_viewable($code) . '/></td>';
|
75 |
echo '<td class="tr_editable"'.$extrastyle.' align="center"><input type="checkbox" id="' . $code . '_edit" name="' .
|
@@ -151,6 +152,15 @@ function insert_script_footer_option() {
|
|
151 |
'Requires that your theme should have proper footer support.';
|
152 |
}
|
153 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
154 |
/*
|
155 |
* Insert the option to enable/disable automatic translation.
|
156 |
* Enabled by default.
|
@@ -237,6 +247,9 @@ function update_admin_options() {
|
|
237 |
if(get_option(ENABLE_FOOTER_SCRIPTS) != $_POST['enable_footer_scripts'])
|
238 |
update_option(ENABLE_FOOTER_SCRIPTS, $_POST['enable_footer_scripts']);
|
239 |
|
|
|
|
|
|
|
240 |
if(get_option(ENABLE_AUTO_TRANSLATE,1) != $_POST['enable_autotranslate'])
|
241 |
update_option(ENABLE_AUTO_TRANSLATE, $_POST['enable_autotranslate']);
|
242 |
|
@@ -250,7 +263,9 @@ class transposh_plugin {
|
|
250 |
|
251 |
//constructor of class, PHP4 compatible construction for backward compatibility
|
252 |
function transposh_plugin() {
|
253 |
-
|
|
|
|
|
254 |
add_filter('screen_layout_columns', array(&$this, 'on_screen_layout_columns'), 10, 2);
|
255 |
//add some help
|
256 |
add_filter('contextual_help_list', array(&$this, 'on_contextual_help'),100,2);
|
@@ -281,6 +296,8 @@ class transposh_plugin {
|
|
281 |
//extend the admin menu
|
282 |
function on_admin_menu() {
|
283 |
//add our own option page, you can also add it to different sections or use your own one
|
|
|
|
|
284 |
$this->pagehook = add_options_page('Transposh control center', "Transposh", 'manage_options', TRANSPOSH_ADMIN_PAGE_NAME, array(&$this, 'on_show_page'));
|
285 |
//register callback gets call prior your own page gets rendered
|
286 |
add_action('load-'.$this->pagehook, array(&$this, 'on_load_page'));
|
@@ -389,8 +406,34 @@ class transposh_plugin {
|
|
389 |
|
390 |
function on_sidebox_news_content($data) {
|
391 |
require_once(ABSPATH . WPINC . '/rss.php');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
392 |
echo '<div style="margin:6px">';
|
393 |
-
|
394 |
echo '</div>';
|
395 |
}
|
396 |
function on_sidebox_stats_content($data) {
|
@@ -421,6 +464,10 @@ class transposh_plugin {
|
|
421 |
echo '<h4>Add scripts to footer</h4>';
|
422 |
insert_script_footer_option();
|
423 |
}
|
|
|
|
|
|
|
|
|
424 |
}
|
425 |
function on_contentbox_community_content($data) {
|
426 |
echo "<p>This space is reserved for the coming community features of Transposh that will help you find translators to help with your site.</p>";
|
69 |
list ($language,$flag,$autot) = explode (",",$lang);
|
70 |
if(!($i % $columns)) echo '<tr'.(!($i/2 % $columns) ? ' class="alternate"':'').'>';
|
71 |
$i++;
|
72 |
+
|
73 |
+
echo "<td>".display_flag("$tr_plugin_url/img/flags/", $flag, $language,get_option(ENABLE_CSS_FLAGS),$GLOBALS['blank_gif'])." $language</td>";
|
74 |
echo '<td align="center"><input type="checkbox" id="' . $code .'_view" name="' .
|
75 |
$code . '_view" onchange="chbx_change(\'' . $code . '\')" ' . is_viewable($code) . '/></td>';
|
76 |
echo '<td class="tr_editable"'.$extrastyle.' align="center"><input type="checkbox" id="' . $code . '_edit" name="' .
|
152 |
'Requires that your theme should have proper footer support.';
|
153 |
}
|
154 |
|
155 |
+
/*
|
156 |
+
* Insert the option to enable/disable css flags.
|
157 |
+
*/
|
158 |
+
function insert_css_flags_option() {
|
159 |
+
$checked = (get_option(ENABLE_CSS_FLAGS)) ? 'checked="checked"' :'';
|
160 |
+
echo '<input type="checkbox" value="1" name="enable_css_flags" '. $checked . '/> '.
|
161 |
+
'Use a single sprite with all flags, makes pages load faster. Currently not suitable if you made changes to the flags.';
|
162 |
+
}
|
163 |
+
|
164 |
/*
|
165 |
* Insert the option to enable/disable automatic translation.
|
166 |
* Enabled by default.
|
247 |
if(get_option(ENABLE_FOOTER_SCRIPTS) != $_POST['enable_footer_scripts'])
|
248 |
update_option(ENABLE_FOOTER_SCRIPTS, $_POST['enable_footer_scripts']);
|
249 |
|
250 |
+
if(get_option(ENABLE_CSS_FLAGS) != $_POST['enable_css_flags'])
|
251 |
+
update_option(ENABLE_CSS_FLAGS, $_POST['enable_css_flags']);
|
252 |
+
|
253 |
if(get_option(ENABLE_AUTO_TRANSLATE,1) != $_POST['enable_autotranslate'])
|
254 |
update_option(ENABLE_AUTO_TRANSLATE, $_POST['enable_autotranslate']);
|
255 |
|
263 |
|
264 |
//constructor of class, PHP4 compatible construction for backward compatibility
|
265 |
function transposh_plugin() {
|
266 |
+
if (get_option(ENABLE_CSS_FLAGS))
|
267 |
+
wp_enqueue_style("transposh-flags",plugins_url('', __FILE__)."/css/transposh_flags.css",array(),'0.2.8');
|
268 |
+
//add filter for WordPress 2.8 changed backend box system !
|
269 |
add_filter('screen_layout_columns', array(&$this, 'on_screen_layout_columns'), 10, 2);
|
270 |
//add some help
|
271 |
add_filter('contextual_help_list', array(&$this, 'on_contextual_help'),100,2);
|
296 |
//extend the admin menu
|
297 |
function on_admin_menu() {
|
298 |
//add our own option page, you can also add it to different sections or use your own one
|
299 |
+
// TODO (Will I? hardcoded path)
|
300 |
+
// $this->pagehook = add_menu_page('Transposh control center', "Transposh", 'manage_options', TRANSPOSH_ADMIN_PAGE_NAME, array(&$this, 'on_show_page'),WP_PLUGIN_URL .'/transposh/img/tplogo.png');
|
301 |
$this->pagehook = add_options_page('Transposh control center', "Transposh", 'manage_options', TRANSPOSH_ADMIN_PAGE_NAME, array(&$this, 'on_show_page'));
|
302 |
//register callback gets call prior your own page gets rendered
|
303 |
add_action('load-'.$this->pagehook, array(&$this, 'on_load_page'));
|
406 |
|
407 |
function on_sidebox_news_content($data) {
|
408 |
require_once(ABSPATH . WPINC . '/rss.php');
|
409 |
+
// Ugly hack copy of RSS because of Unicode chars misprinting
|
410 |
+
function wp_rss2( $url, $num_items = -1 ) {
|
411 |
+
if ( $rss = fetch_rss( $url ) ) {
|
412 |
+
echo '<ul>';
|
413 |
+
|
414 |
+
if ( $num_items !== -1 ) {
|
415 |
+
$rss->items = array_slice( $rss->items, 0, $num_items );
|
416 |
+
}
|
417 |
+
|
418 |
+
foreach ( (array) $rss->items as $item ) {
|
419 |
+
printf(
|
420 |
+
'<li><a href="%1$s" title="%2$s">%3$s</a></li>',
|
421 |
+
//esc_url( $item['link'] ),
|
422 |
+
//esc_attr( strip_tags( $item['description'] ) ),
|
423 |
+
// Switched to 2.7 compatability functions
|
424 |
+
clean_url( $item['link'] ),
|
425 |
+
attribute_escape( strip_tags( $item['description'] ) ),
|
426 |
+
htmlentities( $item['title'],ENT_COMPAT,'UTF-8' )
|
427 |
+
);
|
428 |
+
}
|
429 |
+
|
430 |
+
echo '</ul>';
|
431 |
+
} else {
|
432 |
+
_e( 'An error has occurred, which probably means the feed is down. Try again later.' );
|
433 |
+
}
|
434 |
+
}
|
435 |
echo '<div style="margin:6px">';
|
436 |
+
wp_rss2('http://feeds2.feedburner.com/transposh', 5);
|
437 |
echo '</div>';
|
438 |
}
|
439 |
function on_sidebox_stats_content($data) {
|
464 |
echo '<h4>Add scripts to footer</h4>';
|
465 |
insert_script_footer_option();
|
466 |
}
|
467 |
+
|
468 |
+
echo '<h4>Use css flags (experimental)</h4>';
|
469 |
+
insert_css_flags_option();
|
470 |
+
|
471 |
}
|
472 |
function on_contentbox_community_content($data) {
|
473 |
echo "<p>This space is reserved for the coming community features of Transposh that will help you find translators to help with your site.</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.
|
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.
|
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.8 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.8 db_version-". DB_VERSION);
|
231 |
|
232 |
$query = "SELECT translated, translated_by, timestamp, source, user_login ".
|
233 |
"FROM $table_name ".
|
transposh_widget.php
CHANGED
@@ -81,10 +81,17 @@ function transposh_widget_init() {
|
|
81 |
* Add custom css, i.e. transposh.css
|
82 |
*/
|
83 |
function add_transposh_widget_css() {
|
84 |
-
global $tr_plugin_url;
|
85 |
-
|
86 |
//include the transposh_widget.css
|
87 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
|
89 |
}
|
90 |
|
@@ -132,15 +139,11 @@ function transposh_widget($args) {
|
|
132 |
}
|
133 |
|
134 |
|
135 |
-
if ($options['style'] == 1) {
|
136 |
-
echo "<a href=\"" . $page_url . "\">".
|
137 |
-
"<img src=\"$plugpath/img/flags/$flag.png\" title=\"$language\" alt=\"$language\"".
|
138 |
-
" style=\"padding: 1px 3px;border: 0px\"/></a>";
|
139 |
-
}
|
140 |
-
else {
|
141 |
echo "<a href=\"" . $page_url . "\">".
|
142 |
-
"
|
143 |
-
"
|
|
|
|
|
144 |
}
|
145 |
$is_showing_languages = TRUE;
|
146 |
}
|
@@ -190,7 +193,7 @@ function transposh_widget($args) {
|
|
190 |
|
191 |
echo "</form>";
|
192 |
//echo "<button onClick=\"do_auto_translate();\">translate all</button>";
|
193 |
-
echo "<div id=\"".SPAN_PREFIX."credit\">by <a href=\"http://transposh.org\"><img class=\"".NO_TRANSLATE_CLASS."\" src=\"$plugpath/img/tplogo.png\" style=\"padding:1px;border:0px\" title=\"Transposh\" alt=\"Transposh\"/></a></div>";
|
194 |
echo $after_widget;
|
195 |
}
|
196 |
|
81 |
* Add custom css, i.e. transposh.css
|
82 |
*/
|
83 |
function add_transposh_widget_css() {
|
|
|
|
|
84 |
//include the transposh_widget.css
|
85 |
+
// TODO: user generated version
|
86 |
+
$options = get_option(WIDGET_TRANSPOSH);
|
87 |
+
if ($options['style'] == 1 || $options['style'] == 2) {
|
88 |
+
wp_enqueue_style("transposh_widget","{$GLOBALS['tr_plugin_url']}/css/transposh_widget.css",array(),'0.2.8');
|
89 |
+
if (get_option(ENABLE_CSS_FLAGS)) {
|
90 |
+
wp_enqueue_style("transposh_flags", "{$GLOBALS['tr_plugin_url']}/css/transposh_flags.css",array(),'0.2.8');
|
91 |
+
if (file_exists("{$GLOBALS['tr_plugin_url']}/css/transposh_flags_u.css"))
|
92 |
+
wp_enqueue_style("transposh_flags", "{$GLOBALS['tr_plugin_url']}/css/transposh_flags_u.css",array(),'0.2.8');
|
93 |
+
}
|
94 |
+
}
|
95 |
|
96 |
}
|
97 |
|
139 |
}
|
140 |
|
141 |
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
echo "<a href=\"" . $page_url . "\">".
|
143 |
+
display_flag("$plugpath/img/flags/", $flag, $language,get_option(ENABLE_CSS_FLAGS),$GLOBALS['blank_gif']).
|
144 |
+
"</a>";
|
145 |
+
if ($options['style'] != 1) {
|
146 |
+
echo "$language<br/>";
|
147 |
}
|
148 |
$is_showing_languages = TRUE;
|
149 |
}
|
193 |
|
194 |
echo "</form>";
|
195 |
//echo "<button onClick=\"do_auto_translate();\">translate all</button>";
|
196 |
+
echo "<div id=\"".SPAN_PREFIX."credit\">by <a href=\"http://transposh.org\"><img class=\"".NO_TRANSLATE_CLASS."\" height=\"16\" width=\"16\" src=\"$plugpath/img/tplogo.png\" style=\"padding:1px;border:0px\" title=\"Transposh\" alt=\"Transposh\"/></a></div>";
|
197 |
echo $after_widget;
|
198 |
}
|
199 |
|