qTranslate X - Version 2.7.8

Version Description

  • user-friendly activation hook to deactivate/import/export other qTranslate forks.
  • import/export settings from other forks
Download this release

Release Info

Developer johnclause
Plugin Icon wp plugin qTranslate X
Version 2.7.8
Comparing to
See all releases

Version 2.7.8

Files changed (322) hide show
  1. admin/activation_hook.php +150 -0
  2. admin/import_export.php +131 -0
  3. arrowdown.png +0 -0
  4. arrowup.png +0 -0
  5. flags/aa.png +0 -0
  6. flags/ad.alt.png +0 -0
  7. flags/ad.png +0 -0
  8. flags/ae.png +0 -0
  9. flags/af.png +0 -0
  10. flags/ag.png +0 -0
  11. flags/ai.alt.png +0 -0
  12. flags/ai.png +0 -0
  13. flags/al.png +0 -0
  14. flags/am.png +0 -0
  15. flags/an.png +0 -0
  16. flags/ao.png +0 -0
  17. flags/aq.png +0 -0
  18. flags/ar.alt.png +0 -0
  19. flags/ar.png +0 -0
  20. flags/arle.png +0 -0
  21. flags/as.png +0 -0
  22. flags/at.alt.png +0 -0
  23. flags/at.png +0 -0
  24. flags/au.png +0 -0
  25. flags/aw.png +0 -0
  26. flags/ax.png +0 -0
  27. flags/az.png +0 -0
  28. flags/ba.png +0 -0
  29. flags/bb.png +0 -0
  30. flags/bd.png +0 -0
  31. flags/be.png +0 -0
  32. flags/bf.png +0 -0
  33. flags/bg.png +0 -0
  34. flags/bh.png +0 -0
  35. flags/bi.alt.png +0 -0
  36. flags/bi.png +0 -0
  37. flags/bj.png +0 -0
  38. flags/bl.png +0 -0
  39. flags/bm.png +0 -0
  40. flags/bn.png +0 -0
  41. flags/bo.png +0 -0
  42. flags/bq.png +0 -0
  43. flags/br.png +0 -0
  44. flags/bs.png +0 -0
  45. flags/bt.png +0 -0
  46. flags/bv.png +0 -0
  47. flags/bw.png +0 -0
  48. flags/by.png +0 -0
  49. flags/bz.png +0 -0
  50. flags/ca.alt.png +0 -0
  51. flags/ca.png +0 -0
  52. flags/cc.alt.png +0 -0
  53. flags/cc.png +0 -0
  54. flags/cd.png +0 -0
  55. flags/cf.png +0 -0
  56. flags/cg.png +0 -0
  57. flags/ch.png +0 -0
  58. flags/ci.png +0 -0
  59. flags/ck.png +0 -0
  60. flags/cl.png +0 -0
  61. flags/cm.png +0 -0
  62. flags/cn.png +0 -0
  63. flags/co.png +0 -0
  64. flags/cr.alt.png +0 -0
  65. flags/cr.png +0 -0
  66. flags/cs.png +0 -0
  67. flags/cu.png +0 -0
  68. flags/cv.png +0 -0
  69. flags/cw.png +0 -0
  70. flags/cx.png +0 -0
  71. flags/cy.png +0 -0
  72. flags/cz.png +0 -0
  73. flags/de.png +0 -0
  74. flags/dj.png +0 -0
  75. flags/dk.png +0 -0
  76. flags/dm.png +0 -0
  77. flags/do.png +0 -0
  78. flags/dz.png +0 -0
  79. flags/ec.alt.png +0 -0
  80. flags/ec.png +0 -0
  81. flags/ee.png +0 -0
  82. flags/eg.png +0 -0
  83. flags/eh.alt.png +0 -0
  84. flags/eh.png +0 -0
  85. flags/eo.png +0 -0
  86. flags/er.png +0 -0
  87. flags/es.alt.png +0 -0
  88. flags/es.png +0 -0
  89. flags/et.alt.png +0 -0
  90. flags/et.png +0 -0
  91. flags/eu.png +0 -0
  92. flags/fi.png +0 -0
  93. flags/fj.png +0 -0
  94. flags/fk.png +0 -0
  95. flags/fm.png +0 -0
  96. flags/fo.png +0 -0
  97. flags/fr.png +0 -0
  98. flags/ga.png +0 -0
  99. flags/galego.png +0 -0
  100. flags/gb.png +0 -0
  101. flags/gd.png +0 -0
  102. flags/ge.png +0 -0
  103. flags/gf.png +0 -0
  104. flags/gg.png +0 -0
  105. flags/gh.png +0 -0
  106. flags/gi.png +0 -0
  107. flags/gl.png +0 -0
  108. flags/gm.png +0 -0
  109. flags/gn.png +0 -0
  110. flags/gp.png +0 -0
  111. flags/gq.png +0 -0
  112. flags/gr.png +0 -0
  113. flags/gs.png +0 -0
  114. flags/gt.alt.png +0 -0
  115. flags/gt.png +0 -0
  116. flags/gu.png +0 -0
  117. flags/gw.png +0 -0
  118. flags/gy.png +0 -0
  119. flags/hk.png +0 -0
  120. flags/hm.png +0 -0
  121. flags/hn.png +0 -0
  122. flags/hr.png +0 -0
  123. flags/ht.alt.png +0 -0
  124. flags/ht.png +0 -0
  125. flags/hu.png +0 -0
  126. flags/id.png +0 -0
  127. flags/ie.png +0 -0
  128. flags/il.png +0 -0
  129. flags/im.png +0 -0
  130. flags/in.png +0 -0
  131. flags/io.png +0 -0
  132. flags/iq.png +0 -0
  133. flags/ir.png +0 -0
  134. flags/is.png +0 -0
  135. flags/it.png +0 -0
  136. flags/je.png +0 -0
  137. flags/jm.png +0 -0
  138. flags/jo.png +0 -0
  139. flags/jp.png +0 -0
  140. flags/ke.png +0 -0
  141. flags/kg.png +0 -0
  142. flags/kh.png +0 -0
  143. flags/ki.png +0 -0
  144. flags/km.png +0 -0
  145. flags/kn.png +0 -0
  146. flags/kp.png +0 -0
  147. flags/kr.png +0 -0
  148. flags/kw.png +0 -0
  149. flags/ky.png +0 -0
  150. flags/kz.png +0 -0
  151. flags/la.png +0 -0
  152. flags/lb.png +0 -0
  153. flags/lc.png +0 -0
  154. flags/li.png +0 -0
  155. flags/lk.png +0 -0
  156. flags/lr.png +0 -0
  157. flags/ls.png +0 -0
  158. flags/lt.png +0 -0
  159. flags/lu.png +0 -0
  160. flags/lv.png +0 -0
  161. flags/ly.png +0 -0
  162. flags/ma.png +0 -0
  163. flags/mc.png +0 -0
  164. flags/md.png +0 -0
  165. flags/me.png +0 -0
  166. flags/mf.png +0 -0
  167. flags/mg.png +0 -0
  168. flags/mh.png +0 -0
  169. flags/mk.png +0 -0
  170. flags/ml.png +0 -0
  171. flags/mm.png +0 -0
  172. flags/mn.png +0 -0
  173. flags/mo.png +0 -0
  174. flags/mp.png +0 -0
  175. flags/mq.png +0 -0
  176. flags/mr.png +0 -0
  177. flags/ms.png +0 -0
  178. flags/mt.png +0 -0
  179. flags/mu.png +0 -0
  180. flags/mv.png +0 -0
  181. flags/mw.png +0 -0
  182. flags/mx.png +0 -0
  183. flags/my.png +0 -0
  184. flags/mz.png +0 -0
  185. flags/na.png +0 -0
  186. flags/nc.png +0 -0
  187. flags/ne.png +0 -0
  188. flags/nf.png +0 -0
  189. flags/ng.png +0 -0
  190. flags/ni.alt.png +0 -0
  191. flags/ni.png +0 -0
  192. flags/nl.png +0 -0
  193. flags/no.png +0 -0
  194. flags/np.png +0 -0
  195. flags/nr.png +0 -0
  196. flags/nu.png +0 -0
  197. flags/nz.png +0 -0
  198. flags/om.png +0 -0
  199. flags/pa.png +0 -0
  200. flags/pe.png +0 -0
  201. flags/pf.alt.png +0 -0
  202. flags/pf.png +0 -0
  203. flags/pg.png +0 -0
  204. flags/ph.png +0 -0
  205. flags/pk.png +0 -0
  206. flags/pl.png +0 -0
  207. flags/pm.png +0 -0
  208. flags/pn.png +0 -0
  209. flags/pr.png +0 -0
  210. flags/ps.png +0 -0
  211. flags/pt.png +0 -0
  212. flags/pw.png +0 -0
  213. flags/py.png +0 -0
  214. flags/qa.png +0 -0
  215. flags/re.png +0 -0
  216. flags/ro.png +0 -0
  217. flags/rs.png +0 -0
  218. flags/ru.png +0 -0
  219. flags/rw.png +0 -0
  220. flags/sa.png +0 -0
  221. flags/sb.png +0 -0
  222. flags/sc.png +0 -0
  223. flags/sd.png +0 -0
  224. flags/se.png +0 -0
  225. flags/sg.png +0 -0
  226. flags/sh.png +0 -0
  227. flags/si.png +0 -0
  228. flags/sj.png +0 -0
  229. flags/sk.png +0 -0
  230. flags/sl.png +0 -0
  231. flags/sm.png +0 -0
  232. flags/sn.png +0 -0
  233. flags/so.png +0 -0
  234. flags/sr.png +0 -0
  235. flags/ss.png +0 -0
  236. flags/st.png +0 -0
  237. flags/sv.alt.png +0 -0
  238. flags/sv.png +0 -0
  239. flags/sx.png +0 -0
  240. flags/sy.png +0 -0
  241. flags/sz.png +0 -0
  242. flags/tc.png +0 -0
  243. flags/td.png +0 -0
  244. flags/tf.png +0 -0
  245. flags/tg.png +0 -0
  246. flags/th.png +0 -0
  247. flags/tj.png +0 -0
  248. flags/tk.png +0 -0
  249. flags/tl.png +0 -0
  250. flags/tm.png +0 -0
  251. flags/tn.png +0 -0
  252. flags/to.png +0 -0
  253. flags/tr.png +0 -0
  254. flags/tt.png +0 -0
  255. flags/tv.png +0 -0
  256. flags/tw.png +0 -0
  257. flags/tz.png +0 -0
  258. flags/ua.png +0 -0
  259. flags/ug.png +0 -0
  260. flags/uk.png +0 -0
  261. flags/um.png +0 -0
  262. flags/us.png +0 -0
  263. flags/uy.png +0 -0
  264. flags/uz.png +0 -0
  265. flags/va.png +0 -0
  266. flags/vc.png +0 -0
  267. flags/ve.png +0 -0
  268. flags/vg.png +0 -0
  269. flags/vi.png +0 -0
  270. flags/vn.png +0 -0
  271. flags/vu.png +0 -0
  272. flags/wf.alt.png +0 -0
  273. flags/wf.png +0 -0
  274. flags/ws.png +0 -0
  275. flags/ye.png +0 -0
  276. flags/yt.png +0 -0
  277. flags/yu.png +0 -0
  278. flags/za.png +0 -0
  279. flags/zm.png +0 -0
  280. flags/zw.png +0 -0
  281. flags/zz.png +0 -0
  282. lang/qtranslate-az_AZ.mo +0 -0
  283. lang/qtranslate-bg_BG.mo +0 -0
  284. lang/qtranslate-cs_CZ.mo +0 -0
  285. lang/qtranslate-da_DK.mo +0 -0
  286. lang/qtranslate-de_DE.mo +0 -0
  287. lang/qtranslate-eo.mo +0 -0
  288. lang/qtranslate-es_CA.mo +0 -0
  289. lang/qtranslate-es_ES.mo +0 -0
  290. lang/qtranslate-fr_FR.mo +0 -0
  291. lang/qtranslate-hu_HU.mo +0 -0
  292. lang/qtranslate-id_ID.mo +0 -0
  293. lang/qtranslate-it_IT.mo +0 -0
  294. lang/qtranslate-ja_JP.mo +0 -0
  295. lang/qtranslate-mk_MK.mo +0 -0
  296. lang/qtranslate-ms_MY.mo +0 -0
  297. lang/qtranslate-nl_NL.mo +0 -0
  298. lang/qtranslate-pl_PL.mo +0 -0
  299. lang/qtranslate-pt_BR.mo +0 -0
  300. lang/qtranslate-pt_PT.mo +0 -0
  301. lang/qtranslate-ro_RO.mo +0 -0
  302. lang/qtranslate-ru_RU.mo +0 -0
  303. lang/qtranslate-sv_SE.mo +0 -0
  304. lang/qtranslate-tr_TR.mo +0 -0
  305. lang/qtranslate-zh_CN.mo +0 -0
  306. lang/qtranslate.pot +836 -0
  307. license.txt +674 -0
  308. qtranslate.css +108 -0
  309. qtranslate.min.js +1 -0
  310. qtranslate.php +503 -0
  311. qtranslate_configuration.css +54 -0
  312. qtranslate_configuration.php +885 -0
  313. qtranslate_core.php +951 -0
  314. qtranslate_frontend.php +189 -0
  315. qtranslate_hooks.php +282 -0
  316. qtranslate_services.php +909 -0
  317. qtranslate_utils.php +243 -0
  318. qtranslate_widget.php +137 -0
  319. readme.txt +174 -0
  320. screenshot-1.png +0 -0
  321. screenshot-2.png +0 -0
  322. screenshot-3.png +0 -0
admin/activation_hook.php ADDED
@@ -0,0 +1,150 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // encoding: utf-8
2
+ /*
3
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ function qtranxf_admin_notice_deactivate_plugin($nm,$plugin)
21
+ {
22
+ deactivate_plugins($plugin,true);
23
+ $d=dirname($plugin);
24
+ $link='<a href="https://wordpress.org/plugins/'.$d.'/" target="_blank">'.$nm.'</a>';
25
+ $qtxnm='qTranslate&#8209;X';
26
+ $qtxlink='<a href="https://wordpress.org/plugins/qtranslate-x/" target="_blank">'.$qtxnm.'</a>';
27
+ $f='qtranxf_migrate_import_'.str_replace('-','_',dirname($plugin));
28
+ $imported=false;
29
+ if(function_exists($f)){
30
+ global $wpdb;
31
+ $options = $wpdb->get_col("SELECT `option_name` FROM {$wpdb->options} WHERE `option_name` LIKE 'qtranslate_%'");
32
+ if(empty($options)){
33
+ $f();
34
+ $imported=true;
35
+ }
36
+ }
37
+ $msg=sprintf(__('Activation of plugin %s deactivated plugin %s since they cannot run simultaneously.','qtranslate'),$qtxlink,$link).' ';
38
+ if($imported){
39
+ $msg.=sprintf(__('The compatible settings from %s have been imported to %s. Further tuning, import, export and reset of options can be done at Settings/Languages configuration page, once %s is running.%sContinue%s','qtranslate'),$nm,$qtxnm,$qtxnm,'</p><p><a class="button" href="">','</a>');
40
+ }else{
41
+ $msg.=sprintf(__('You may import/export compatible settings from %s to %s on Settings/Languages configuration page, once %s is running.%sContinue%s','qtranslate'),$nm,$qtxnm,$qtxnm,'</p><p><a class="button" href="">','</a>');
42
+ }
43
+ //$nonce=wp_create_nonce('deactivate-plugin_'.$plugin);
44
+ //$msg=sprintf(__('Plugin %s cannot run concurrently with %s, please %sdeactivate %s%s. You may import compatible settings from %s to %s on Settings/Languages configuration page, once %s is running.','qtranslate'),$qtxlink,$link,'<a href="'.admin_url('plugins.php?action=deactivate&plugin='.encode($plugin).'&plugin_status=all&paged=1&s&_wpnonce='.$nonce.'">',$nm,'</a>',$nm,$qtxnm,$qtxnm);
45
+ //$msg=sprintf(__('Activation of plugin %s deactivated plugin %s since they cannot run simultaneously. You may import compatible settings from %s to %s on Settings/%sLanguages%s configuration page, once %s is running.%sContinue%s','qtranslate'),$qtxlink,$link,$nm,$qtxnm,'<a href="'.admin_url('/options-general.php?page=qtranslate-x').'">','</a>',$qtxnm,'</p><p><a class="button" href="">','</a>');
46
+ wp_die('<p>'.$msg.'</p>');
47
+ }
48
+
49
+ function qtranxf_activation_hook()
50
+ {
51
+ // Check if other qTranslate forks are activated.
52
+ if ( is_plugin_active( 'mqtranslate/mqtranslate.php' ) )
53
+ qtranxf_admin_notice_deactivate_plugin('mqTranslate','mqtranslate/mqtranslate.php');
54
+
55
+ if ( is_plugin_active( 'qtranslate/qtranslate.php' ) )
56
+ qtranxf_admin_notice_deactivate_plugin('qTranslate','qtranslate/qtranslate.php');
57
+
58
+ if ( is_plugin_active( 'qtranslate-xp/ppqtranslate.php' ) )
59
+ qtranxf_admin_notice_deactivate_plugin('qTranslate Plus','qtranslate-xp/ppqtranslate.php');
60
+
61
+ if ( is_plugin_active( 'ztranslate/ztranslate.php' ) )
62
+ qtranxf_admin_notice_deactivate_plugin('zTranslate','ztranslate/ztranslate.php');
63
+
64
+ //deactivate_plugins(plugin_basename(__FILE__)); // Deactivate ourself
65
+ }
66
+
67
+ /*
68
+ function qtranxf_admin_notice_deactivated($plugin)
69
+ {
70
+ $plugin_file=WP_CONTENT_DIR.'/plugins/'.$plugin;
71
+ $plugin_data=get_plugin_data( plugin_file, false, true );
72
+ echo "qtranxf_admin_notice_deactivated: $plugin";
73
+ var_dump($plugin_data);
74
+ if(!$plugin_data) return;
75
+ $nm='<a href="https://wordpress.org/plugins/'.dirname($plugin).'/">'.$plugin_data['Name'].'</a>';
76
+ echo printf(__('Plugin qTranslate&#8209;X deactivated plugin %s since they cannot run simultaneously. You may import compatible settings from %s to qTranslate&#8209;X on Settings/"<a href="%s">Languages</a>" configuration page.','qtranslate'),$nm,$nm,admin_url('options-general.php?page=qtranslate-x'));
77
+ }
78
+
79
+ function qtranxf_admin_notices($nm)
80
+ {
81
+ //if($_SERVER['REQUEST_METHOD']!='GET') return;
82
+ if(isset($_REQUEST['qtx_dismiss'])){
83
+ update_option('qtranslate_admin_notices',array());
84
+ return;
85
+ }
86
+ $admin_notices=get_option('qtranslate_admin_notices',array());
87
+ if(empty($admin_notices)) return;
88
+ //echo '<div class="updated">';
89
+ echo '<div class="update-nag">';
90
+ echo '<div style="float: right"><a href="?qtx_dismiss"><small>dismiss</small></a></div>';
91
+ foreach($admin_notices as $key=>$notice){
92
+ echo '<p>';
93
+ switch($key){
94
+ case 'mqtranslate/mqtranslate.php':
95
+ case 'qtranslate/qtranslate.php':
96
+ case 'qtranslate-xp/ppqtranslate.php':
97
+ case 'ztranslate/ztranslate.php':
98
+ qtranxf_admin_notice_deactivated($key);
99
+ break;
100
+ default: echo $notice; break;
101
+ }
102
+ echo '</p>';
103
+ }
104
+ echo '</div>';
105
+ }
106
+
107
+ function qtranxf_check_qtranslate_other()
108
+ {
109
+ // Check if other qTranslate forks are active.
110
+ $plugins=array();
111
+ if(is_plugin_active('mqtranslate/mqtranslate.php')) $plugins[]='qtranslate-xp/ppqtranslate.php';
112
+ if(is_plugin_active('qtranslate/qtranslate.php')) $plugins[]='qtranslate/qtranslate.php';
113
+ if(is_plugin_active('qtranslate-xp/ppqtranslate.php')) $plugins[]='qtranslate-xp/ppqtranslate.php';
114
+ if(is_plugin_active('ztranslate/ztranslate.php')) $plugins[]='ztranslate/ztranslate.php';
115
+ if(empty($plugins)) return;
116
+ $admin_notices=get_option('qtranslate_admin_notices',array());
117
+ $t=time();
118
+ foreach($plugins as $plugin){
119
+ $admin_notices[$plugin]=$t;
120
+ }
121
+ deactivate_plugins($plugins,true);
122
+ add_action('admin_notices', 'qtranxf_admin_notices');
123
+ }
124
+ //muplugins_loaded plugins_loaded
125
+ //add_action('admin_init', 'qtranxf_check_qtranslate_other', 0);
126
+ */
127
+
128
+ function qtranxf_admin_notice_plugin_conflict($title,$plugin)
129
+ {
130
+ if(!is_plugin_active($plugin)) return;
131
+ $me='<a href="https://wordpress.org/plugins/qtranslate-x/" style="color:blue" target="_blank">qTranslate&#8209;X</a>';
132
+ $link='<a href="https://wordpress.org/plugins/'.dirname($plugin).'/" style="color:magenta" target="_blank">'.$title.'</a>';
133
+ echo '<div class="error"><p style="font-size: larger">';
134
+ echo '<span style="color:red"><strong>'.__('Error').':</strong></span> '.sprintf(__('plugin %s cannot run concurrently with plugin %s. You may import and export compatible settings between %s and %s on Settings/<a href="%s">Languages</a> configuration page. Then you have to deactivate one of the plugins to continue.','qtranslate'),$me,$link,'qTranslate&#8209;X',$title,admin_url('options-general.php?page=qtranslate-x'));
135
+ $nonce=wp_create_nonce('deactivate-plugin_'.$plugin);
136
+ echo '</p><p> &nbsp; &nbsp; &nbsp; &nbsp;<a class="button" href="'.admin_url('plugins.php?action=deactivate&plugin='.urlencode($plugin).'&plugin_status=all&paged=1&s&_wpnonce='.$nonce).'"><strong>'.__('Deactivate ').'<span style="color:magenta">'.$title.'</span></strong></a>';
137
+ $nonce=wp_create_nonce('deactivate-plugin_qtranslate-x/qtranslate.php');
138
+ echo ' &nbsp; &nbsp; &nbsp; &nbsp;<a class="button" href="'.admin_url('plugins.php?action=deactivate&plugin='.urlencode('qtranslate-x/qtranslate.php').'&plugin_status=all&paged=1&s&_wpnonce='.$nonce).'"><strong>'.__('Deactivate ').'<span style="color:blue">qTranslate&#8209;X</span></strong></a>';
139
+ echo '</p></div>';
140
+ }
141
+
142
+ function qtranxf_admin_notices_plugin_conflicts()
143
+ {
144
+ qtranxf_admin_notice_plugin_conflict('qTranslate','qtranslate/qtranslate.php');
145
+ qtranxf_admin_notice_plugin_conflict('mqTranslate','mqtranslate/mqtranslate.php');
146
+ qtranxf_admin_notice_plugin_conflict('qTranslate Plus','qtranslate-xp/ppqtranslate.php');
147
+ qtranxf_admin_notice_plugin_conflict('zTranslate','ztranslate/ztranslate.php');
148
+ }
149
+ add_action('admin_notices', 'qtranxf_admin_notices_plugin_conflicts');
150
+ ?>
admin/import_export.php ADDED
@@ -0,0 +1,131 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // encoding: utf-8
2
+ /*
3
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ function qtranxf_migrate_options_update($nm_to,$nm_from)
21
+ {
22
+ global $wpdb;
23
+ $option_names = $wpdb->get_col("SELECT `option_name` FROM {$wpdb->options} WHERE `option_name` LIKE '$nm_to\_%'");
24
+ foreach ($option_names as $name)
25
+ {
26
+ if(strpos($name,'_flag_location')>0) continue;
27
+ $nm = str_replace($nm_to,$nm_from,$name);
28
+ $value=get_option($nm);
29
+ if($value===FALSE) continue;
30
+ update_option($name,$value);
31
+ }
32
+ }
33
+
34
+ function qtranxf_migrate_options_copy($nm_to,$nm_from)
35
+ {
36
+ global $wpdb;
37
+ $options = $wpdb->get_results("SELECT option_name, option_value FROM {$wpdb->options} WHERE `option_name` LIKE '$nm_from\_%'");
38
+ foreach ($options as $option)
39
+ {
40
+ $name=$option->option_name;
41
+ $value=$option->option_value;
42
+ if(strpos($name,'_flag_location')>0) continue;
43
+ $nm = str_replace($nm_from,$nm_to,$name);
44
+ update_option($nm,$value);
45
+ }
46
+ }
47
+
48
+ function qtranxf_migrate_import_mqtranslate(){ qtranxf_migrate_options_update('qtranslate','mqtranslate'); }
49
+ function qtranxf_migrate_export_mqtranslate(){ qtranxf_migrate_options_copy('mqtranslate','qtranslate'); }
50
+
51
+ function qtranxf_migrate_import_qtranslate_xp(){ qtranxf_migrate_options_update('qtranslate','ppqtranslate'); }
52
+ function qtranxf_migrate_export_qtranslate_xp(){ qtranxf_migrate_options_copy('ppqtranslate','qtranslate'); }
53
+
54
+ //function qtranxf_migrate_import_ztranslate(){ qtranxf_migrate_options_update('qtranslate','ztranslate'); }
55
+ //function qtranxf_migrate_export_ztranslate(){ qtranxf_migrate_options_copy('ztranslate','qtranslate'); }
56
+
57
+ function qtranxf_migrate_plugin($plugin){
58
+ $var=$plugin.'-migration';
59
+ if(!isset($_POST[$var])) return;
60
+ if($_POST[$var]=='none') return;
61
+ qtranxf_loadConfig();
62
+ qtranxf_saveConfig();
63
+ $f='qtranxf_migrate_'.$_POST[$var].'_'.str_replace('-','_',$plugin);
64
+ $f();
65
+ }
66
+
67
+ function qtranxf_migrate_plugins()
68
+ {
69
+ qtranxf_migrate_plugin('mqtranslate');
70
+ qtranxf_migrate_plugin('qtranslate-xp');
71
+ //qtranxf_migrate_plugin('ztranslate');//ok same db
72
+ }
73
+ add_action('qtranxf_init_begin','qtranxf_migrate_plugins',11);
74
+
75
+ function qtranxf_add_row_migrate($nm,$plugin) {
76
+ if(!file_exists(WP_CONTENT_DIR.'/plugins/'.$plugin)) return;
77
+ ?>
78
+ <tr valign="top" id="qtranslate-<?php echo $plugin; ?>">
79
+ <th scope="row"><?php _e('Plugin');?> <a href="https://wordpress.org/plugins/<?php echo $plugin; ?>/" target="_blank"><?php echo $nm; ?></a></th>
80
+ <td>
81
+ <?php
82
+ if($plugin=='qtranslate' || $plugin=='ztranslate'){
83
+ _e('There is no need to migrate any setting, the database schema is compatible with this plugin.');
84
+ }else{
85
+ ?>
86
+ <label for="qtranslate_no_migration"><input type="radio" name="<?php echo $plugin; ?>-migration" id="<?php echo $plugin; ?>_no_migration" value="none" checked /> <?php _e('Do not migrate any setting', 'qtranslate'); ?></label>
87
+ <br/>
88
+ <label for="qtranslate_import_migration"><input type="radio" name="<?php echo $plugin; ?>-migration" id="qtranslate_import_migration" value="import" /> <?php echo __('Import settings from ', 'qtranslate').$nm; ?></label>
89
+ <br/>
90
+ <label for="qtranslate_export_migration"><input type="radio" name="<?php echo $plugin; ?>-migration" id="qtranslate_export_migration" value="export" /> <?php echo __('Export settings to ', 'qtranslate').$nm; ?></label>
91
+ <?php } ?>
92
+ </td>
93
+ </tr>
94
+ <?php
95
+ }
96
+
97
+ function qtranxf_admin_section_import_export($request_uri)
98
+ {
99
+ qtranxf_admin_section_start(__('Import').'/'.__('Export'),'import');
100
+ ?>
101
+ <table class="form-table" id="qtranslate-admin-import" style="display: none">
102
+ <tr valign="top" id="qtranslate-convert-database">
103
+ <th scope="row"><?php _e('Convert Database', 'qtranslate');?></th>
104
+ <td>
105
+ <?php printf(__('If you are updating from qTranslate 1.x or Polyglot, <a href="%s">click here</a> to convert posts to the new language tag format.', 'qtranslate'), $clean_uri.'&convert=true'); ?>
106
+ <?php printf(__('If you have installed qTranslate for the first time on a Wordpress with existing posts, you can either go through all your posts manually and save them in the correct language or <a href="%s">click here</a> to mark all existing posts as written in the default language.', 'qtranslate'), $clean_uri.'&markdefault=true'); ?>
107
+ <?php _e('Both processes are <b>irreversible</b>! Be sure to make a full database backup before clicking one of the links.', 'qtranslate'); ?>
108
+ </td>
109
+ </tr>
110
+ <?php qtranxf_add_row_migrate('qTranslate','qtranslate'); ?>
111
+ <?php qtranxf_add_row_migrate('mqTranslate','mqtranslate'); ?>
112
+ <?php qtranxf_add_row_migrate('qTranslate Plus','qtranslate-xp'); ?>
113
+ <?php qtranxf_add_row_migrate('zTranslate','ztranslate'); ?>
114
+ <tr valign="top">
115
+ <th scope="row"><?php _e('Reset qTranslate', 'qtranslate');?></th>
116
+ <td>
117
+ <label for="qtranslate_reset"><input type="checkbox" name="qtranslate_reset" id="qtranslate_reset" value="1"/> <?php _e('Check this box and click Save Changes to reset all qTranslate settings.', 'qtranslate'); ?></label>
118
+ <br/>
119
+ <label for="qtranslate_reset2"><input type="checkbox" name="qtranslate_reset2" id="qtranslate_reset2" value="1"/> <?php _e('Yes, I really want to reset qTranslate.', 'qtranslate'); ?></label>
120
+ <br/>
121
+ <label for="qtranslate_reset3"><input type="checkbox" name="qtranslate_reset3" id="qtranslate_reset3" value="1"/> <?php _e('Also delete Translations for Categories/Tags/Link Categories.', 'qtranslate'); ?></label>
122
+ <br/>
123
+ <?php _e('If something isn\'t working correctly, you can always try to reset all qTranslate settings. A Reset won\'t delete any posts but will remove all settings (including all languages added).', 'qtranslate'); ?>
124
+ </td>
125
+ </tr>
126
+ </table>
127
+ <?php
128
+ qtranxf_admin_section_end('import');
129
+ }
130
+ add_action('qtranslate_configuration', 'qtranxf_admin_section_import_export', 9);
131
+ ?>
arrowdown.png ADDED
Binary file
arrowup.png ADDED
Binary file
flags/aa.png ADDED
Binary file
flags/ad.alt.png ADDED
Binary file
flags/ad.png ADDED
Binary file
flags/ae.png ADDED
Binary file
flags/af.png ADDED
Binary file
flags/ag.png ADDED
Binary file
flags/ai.alt.png ADDED
Binary file
flags/ai.png ADDED
Binary file
flags/al.png ADDED
Binary file
flags/am.png ADDED
Binary file
flags/an.png ADDED
Binary file
flags/ao.png ADDED
Binary file
flags/aq.png ADDED
Binary file
flags/ar.alt.png ADDED
Binary file
flags/ar.png ADDED
Binary file
flags/arle.png ADDED
Binary file
flags/as.png ADDED
Binary file
flags/at.alt.png ADDED
Binary file
flags/at.png ADDED
Binary file
flags/au.png ADDED
Binary file
flags/aw.png ADDED
Binary file
flags/ax.png ADDED
Binary file
flags/az.png ADDED
Binary file
flags/ba.png ADDED
Binary file
flags/bb.png ADDED
Binary file
flags/bd.png ADDED
Binary file
flags/be.png ADDED
Binary file
flags/bf.png ADDED
Binary file
flags/bg.png ADDED
Binary file
flags/bh.png ADDED
Binary file
flags/bi.alt.png ADDED
Binary file
flags/bi.png ADDED
Binary file
flags/bj.png ADDED
Binary file
flags/bl.png ADDED
Binary file
flags/bm.png ADDED
Binary file
flags/bn.png ADDED
Binary file
flags/bo.png ADDED
Binary file
flags/bq.png ADDED
Binary file
flags/br.png ADDED
Binary file
flags/bs.png ADDED
Binary file
flags/bt.png ADDED
Binary file
flags/bv.png ADDED
Binary file
flags/bw.png ADDED
Binary file
flags/by.png ADDED
Binary file
flags/bz.png ADDED
Binary file
flags/ca.alt.png ADDED
Binary file
flags/ca.png ADDED
Binary file
flags/cc.alt.png ADDED
Binary file
flags/cc.png ADDED
Binary file
flags/cd.png ADDED
Binary file
flags/cf.png ADDED
Binary file
flags/cg.png ADDED
Binary file
flags/ch.png ADDED
Binary file
flags/ci.png ADDED
Binary file
flags/ck.png ADDED
Binary file
flags/cl.png ADDED
Binary file
flags/cm.png ADDED
Binary file
flags/cn.png ADDED
Binary file
flags/co.png ADDED
Binary file
flags/cr.alt.png ADDED
Binary file
flags/cr.png ADDED
Binary file
flags/cs.png ADDED
Binary file
flags/cu.png ADDED
Binary file
flags/cv.png ADDED
Binary file
flags/cw.png ADDED
Binary file
flags/cx.png ADDED
Binary file
flags/cy.png ADDED
Binary file
flags/cz.png ADDED
Binary file
flags/de.png ADDED
Binary file
flags/dj.png ADDED
Binary file
flags/dk.png ADDED
Binary file
flags/dm.png ADDED
Binary file
flags/do.png ADDED
Binary file
flags/dz.png ADDED
Binary file
flags/ec.alt.png ADDED
Binary file
flags/ec.png ADDED
Binary file
flags/ee.png ADDED
Binary file
flags/eg.png ADDED
Binary file
flags/eh.alt.png ADDED
Binary file
flags/eh.png ADDED
Binary file
flags/eo.png ADDED
Binary file
flags/er.png ADDED
Binary file
flags/es.alt.png ADDED
Binary file
flags/es.png ADDED
Binary file
flags/et.alt.png ADDED
Binary file
flags/et.png ADDED
Binary file
flags/eu.png ADDED
Binary file
flags/fi.png ADDED
Binary file
flags/fj.png ADDED
Binary file
flags/fk.png ADDED
Binary file
flags/fm.png ADDED
Binary file
flags/fo.png ADDED
Binary file
flags/fr.png ADDED
Binary file
flags/ga.png ADDED
Binary file
flags/galego.png ADDED
Binary file
flags/gb.png ADDED
Binary file
flags/gd.png ADDED
Binary file
flags/ge.png ADDED
Binary file
flags/gf.png ADDED
Binary file
flags/gg.png ADDED
Binary file
flags/gh.png ADDED
Binary file
flags/gi.png ADDED
Binary file
flags/gl.png ADDED
Binary file
flags/gm.png ADDED
Binary file
flags/gn.png ADDED
Binary file
flags/gp.png ADDED
Binary file
flags/gq.png ADDED
Binary file
flags/gr.png ADDED
Binary file
flags/gs.png ADDED
Binary file
flags/gt.alt.png ADDED
Binary file
flags/gt.png ADDED
Binary file
flags/gu.png ADDED
Binary file
flags/gw.png ADDED
Binary file
flags/gy.png ADDED
Binary file
flags/hk.png ADDED
Binary file
flags/hm.png ADDED
Binary file
flags/hn.png ADDED
Binary file
flags/hr.png ADDED
Binary file
flags/ht.alt.png ADDED
Binary file
flags/ht.png ADDED
Binary file
flags/hu.png ADDED
Binary file
flags/id.png ADDED
Binary file
flags/ie.png ADDED
Binary file
flags/il.png ADDED
Binary file
flags/im.png ADDED
Binary file
flags/in.png ADDED
Binary file
flags/io.png ADDED
Binary file
flags/iq.png ADDED
Binary file
flags/ir.png ADDED
Binary file
flags/is.png ADDED
Binary file
flags/it.png ADDED
Binary file
flags/je.png ADDED
Binary file
flags/jm.png ADDED
Binary file
flags/jo.png ADDED
Binary file
flags/jp.png ADDED
Binary file
flags/ke.png ADDED
Binary file
flags/kg.png ADDED
Binary file
flags/kh.png ADDED
Binary file
flags/ki.png ADDED
Binary file
flags/km.png ADDED
Binary file
flags/kn.png ADDED
Binary file
flags/kp.png ADDED
Binary file
flags/kr.png ADDED
Binary file
flags/kw.png ADDED
Binary file
flags/ky.png ADDED
Binary file
flags/kz.png ADDED
Binary file
flags/la.png ADDED
Binary file
flags/lb.png ADDED
Binary file
flags/lc.png ADDED
Binary file
flags/li.png ADDED
Binary file
flags/lk.png ADDED
Binary file
flags/lr.png ADDED
Binary file
flags/ls.png ADDED
Binary file
flags/lt.png ADDED
Binary file
flags/lu.png ADDED
Binary file
flags/lv.png ADDED
Binary file
flags/ly.png ADDED
Binary file
flags/ma.png ADDED
Binary file
flags/mc.png ADDED
Binary file
flags/md.png ADDED
Binary file
flags/me.png ADDED
Binary file
flags/mf.png ADDED
Binary file
flags/mg.png ADDED
Binary file
flags/mh.png ADDED
Binary file
flags/mk.png ADDED
Binary file
flags/ml.png ADDED
Binary file
flags/mm.png ADDED
Binary file
flags/mn.png ADDED
Binary file
flags/mo.png ADDED
Binary file
flags/mp.png ADDED
Binary file
flags/mq.png ADDED
Binary file
flags/mr.png ADDED
Binary file
flags/ms.png ADDED
Binary file
flags/mt.png ADDED
Binary file
flags/mu.png ADDED
Binary file
flags/mv.png ADDED
Binary file
flags/mw.png ADDED
Binary file
flags/mx.png ADDED
Binary file
flags/my.png ADDED
Binary file
flags/mz.png ADDED
Binary file
flags/na.png ADDED
Binary file
flags/nc.png ADDED
Binary file
flags/ne.png ADDED
Binary file
flags/nf.png ADDED
Binary file
flags/ng.png ADDED
Binary file
flags/ni.alt.png ADDED
Binary file
flags/ni.png ADDED
Binary file
flags/nl.png ADDED
Binary file
flags/no.png ADDED
Binary file
flags/np.png ADDED
Binary file
flags/nr.png ADDED
Binary file
flags/nu.png ADDED
Binary file
flags/nz.png ADDED
Binary file
flags/om.png ADDED
Binary file
flags/pa.png ADDED
Binary file
flags/pe.png ADDED
Binary file
flags/pf.alt.png ADDED
Binary file
flags/pf.png ADDED
Binary file
flags/pg.png ADDED
Binary file
flags/ph.png ADDED
Binary file
flags/pk.png ADDED
Binary file
flags/pl.png ADDED
Binary file
flags/pm.png ADDED
Binary file
flags/pn.png ADDED
Binary file
flags/pr.png ADDED
Binary file
flags/ps.png ADDED
Binary file
flags/pt.png ADDED
Binary file
flags/pw.png ADDED
Binary file
flags/py.png ADDED
Binary file
flags/qa.png ADDED
Binary file
flags/re.png ADDED
Binary file
flags/ro.png ADDED
Binary file
flags/rs.png ADDED
Binary file
flags/ru.png ADDED
Binary file
flags/rw.png ADDED
Binary file
flags/sa.png ADDED
Binary file
flags/sb.png ADDED
Binary file
flags/sc.png ADDED
Binary file
flags/sd.png ADDED
Binary file
flags/se.png ADDED
Binary file
flags/sg.png ADDED
Binary file
flags/sh.png ADDED
Binary file
flags/si.png ADDED
Binary file
flags/sj.png ADDED
Binary file
flags/sk.png ADDED
Binary file
flags/sl.png ADDED
Binary file
flags/sm.png ADDED
Binary file
flags/sn.png ADDED
Binary file
flags/so.png ADDED
Binary file
flags/sr.png ADDED
Binary file
flags/ss.png ADDED
Binary file
flags/st.png ADDED
Binary file
flags/sv.alt.png ADDED
Binary file
flags/sv.png ADDED
Binary file
flags/sx.png ADDED
Binary file
flags/sy.png ADDED
Binary file
flags/sz.png ADDED
Binary file
flags/tc.png ADDED
Binary file
flags/td.png ADDED
Binary file
flags/tf.png ADDED
Binary file
flags/tg.png ADDED
Binary file
flags/th.png ADDED
Binary file
flags/tj.png ADDED
Binary file
flags/tk.png ADDED
Binary file
flags/tl.png ADDED
Binary file
flags/tm.png ADDED
Binary file
flags/tn.png ADDED
Binary file
flags/to.png ADDED
Binary file
flags/tr.png ADDED
Binary file
flags/tt.png ADDED
Binary file
flags/tv.png ADDED
Binary file
flags/tw.png ADDED
Binary file
flags/tz.png ADDED
Binary file
flags/ua.png ADDED
Binary file
flags/ug.png ADDED
Binary file
flags/uk.png ADDED
Binary file
flags/um.png ADDED
Binary file
flags/us.png ADDED
Binary file
flags/uy.png ADDED
Binary file
flags/uz.png ADDED
Binary file
flags/va.png ADDED
Binary file
flags/vc.png ADDED
Binary file
flags/ve.png ADDED
Binary file
flags/vg.png ADDED
Binary file
flags/vi.png ADDED
Binary file
flags/vn.png ADDED
Binary file
flags/vu.png ADDED
Binary file
flags/wf.alt.png ADDED
Binary file
flags/wf.png ADDED
Binary file
flags/ws.png ADDED
Binary file
flags/ye.png ADDED
Binary file
flags/yt.png ADDED
Binary file
flags/yu.png ADDED
Binary file
flags/za.png ADDED
Binary file
flags/zm.png ADDED
Binary file
flags/zw.png ADDED
Binary file
flags/zz.png ADDED
Binary file
lang/qtranslate-az_AZ.mo ADDED
Binary file
lang/qtranslate-bg_BG.mo ADDED
Binary file
lang/qtranslate-cs_CZ.mo ADDED
Binary file
lang/qtranslate-da_DK.mo ADDED
Binary file
lang/qtranslate-de_DE.mo ADDED
Binary file
lang/qtranslate-eo.mo ADDED
Binary file
lang/qtranslate-es_CA.mo ADDED
Binary file
lang/qtranslate-es_ES.mo ADDED
Binary file
lang/qtranslate-fr_FR.mo ADDED
Binary file
lang/qtranslate-hu_HU.mo ADDED
Binary file
lang/qtranslate-id_ID.mo ADDED
Binary file
lang/qtranslate-it_IT.mo ADDED
Binary file
lang/qtranslate-ja_JP.mo ADDED
Binary file
lang/qtranslate-mk_MK.mo ADDED
Binary file
lang/qtranslate-ms_MY.mo ADDED
Binary file
lang/qtranslate-nl_NL.mo ADDED
Binary file
lang/qtranslate-pl_PL.mo ADDED
Binary file
lang/qtranslate-pt_BR.mo ADDED
Binary file
lang/qtranslate-pt_PT.mo ADDED
Binary file
lang/qtranslate-ro_RO.mo ADDED
Binary file
lang/qtranslate-ru_RU.mo ADDED
Binary file
lang/qtranslate-sv_SE.mo ADDED
Binary file
lang/qtranslate-tr_TR.mo ADDED
Binary file
lang/qtranslate-zh_CN.mo ADDED
Binary file
lang/qtranslate.pot ADDED
@@ -0,0 +1,836 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # SOME DESCRIPTIVE TITLE.
2
+ # Copyright (C) YEAR Qian Qin
3
+ # This file is distributed under the same license as the PACKAGE package.
4
+ # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
+ #
6
+ #, fuzzy
7
+ msgid ""
8
+ msgstr ""
9
+ "Project-Id-Version: PACKAGE VERSION\n"
10
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/qtranslate\n"
11
+ "POT-Creation-Date: 2009-10-11 12:35+0000\n"
12
+ "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
+ "Language-Team: LANGUAGE <LL@li.org>\n"
15
+ "MIME-Version: 1.0\n"
16
+ "Content-Type: text/plain; charset=CHARSET\n"
17
+ "Content-Transfer-Encoding: 8bit\n"
18
+
19
+ #: qtranslate_configuration.php:25
20
+ msgid "Language Management"
21
+ msgstr ""
22
+
23
+ #: qtranslate_configuration.php:25 qtranslate_configuration.php:582
24
+ #: qtranslate_hooks.php:168
25
+ msgid "Languages"
26
+ msgstr ""
27
+
28
+ #: qtranslate_configuration.php:35
29
+ msgid "language_name"
30
+ msgstr ""
31
+
32
+ #: qtranslate_configuration.php:45
33
+ msgid "Language Code"
34
+ msgstr ""
35
+
36
+ #: qtranslate_configuration.php:47
37
+ msgid ""
38
+ "2-Letter <a href=\"http://www.w3.org/WAI/ER/IG/ert/iso639.htm#2letter\">ISO "
39
+ "Language Code</a> for the Language you want to insert. (Example: en)"
40
+ msgstr ""
41
+
42
+ #: qtranslate_configuration.php:50
43
+ msgid "Flag"
44
+ msgstr ""
45
+
46
+ #: qtranslate_configuration.php:75
47
+ msgid "Incorrect Flag Image Path! Please correct it!"
48
+ msgstr ""
49
+
50
+ #: qtranslate_configuration.php:78
51
+ msgid "Choose the corresponding country flag for language. (Example: gb.png)"
52
+ msgstr ""
53
+
54
+ #: qtranslate_configuration.php:91 qtranslate_configuration.php:180
55
+ msgid "Name"
56
+ msgstr ""
57
+
58
+ #: qtranslate_configuration.php:93
59
+ msgid ""
60
+ "The Name of the language, which will be displayed on the site. (Example: "
61
+ "English)"
62
+ msgstr ""
63
+
64
+ #: qtranslate_configuration.php:96
65
+ msgid "Locale"
66
+ msgstr ""
67
+
68
+ #: qtranslate_configuration.php:99
69
+ msgid "PHP and Wordpress Locale for the language. (Example: en_US)"
70
+ msgstr ""
71
+
72
+ #: qtranslate_configuration.php:100
73
+ msgid "You will need to install the .mo file for this language."
74
+ msgstr ""
75
+
76
+ #: qtranslate_configuration.php:104
77
+ msgid "Date Format"
78
+ msgstr ""
79
+
80
+ #: qtranslate_configuration.php:106
81
+ msgid ""
82
+ "Depending on your Date / Time Conversion Mode, you can either enter a <a "
83
+ "href=\"http://www.php.net/manual/function.strftime.php\">strftime</a> (use %"
84
+ "q for day suffix (st,nd,rd,th)) or <a href=\"http://www.php.net/manual/"
85
+ "function.date.php\">date</a> format. This field is optional. (Example: %A %B "
86
+ "%e%q, %Y)"
87
+ msgstr ""
88
+
89
+ #: qtranslate_configuration.php:109
90
+ msgid "Time Format"
91
+ msgstr ""
92
+
93
+ #: qtranslate_configuration.php:111
94
+ msgid ""
95
+ "Depending on your Date / Time Conversion Mode, you can either enter a <a "
96
+ "href=\"http://www.php.net/manual/function.strftime.php\">strftime</a> or <a "
97
+ "href=\"http://www.php.net/manual/function.date.php\">date</a> format. This "
98
+ "field is optional. (Example: %I:%M %p)"
99
+ msgstr ""
100
+
101
+ #: qtranslate_configuration.php:114
102
+ msgid "Not Available Message"
103
+ msgstr ""
104
+
105
+ #: qtranslate_configuration.php:117
106
+ msgid ""
107
+ "Message to display if post is not available in the requested language. "
108
+ "(Example: Sorry, this entry is only available in %LANG:, : and %.)"
109
+ msgstr ""
110
+
111
+ #: qtranslate_configuration.php:118
112
+ msgid ""
113
+ "%LANG:&lt;normal_seperator&gt;:&lt;last_seperator&gt;% generates a list of "
114
+ "languages seperated by &lt;normal_seperator&gt; except for the last one, "
115
+ "where &lt;last_seperator&gt; will be used instead."
116
+ msgstr ""
117
+
118
+ #: qtranslate_configuration.php:181 qtranslate_services.php:306
119
+ msgid "Action"
120
+ msgstr ""
121
+
122
+ #: qtranslate_configuration.php:207
123
+ msgid "qTranslate has been reset."
124
+ msgstr ""
125
+
126
+ #: qtranslate_configuration.php:220
127
+ msgid "Gettext databases updated."
128
+ msgstr ""
129
+
130
+ #: qtranslate_configuration.php:225
131
+ msgid "The Language must have a Not-Available Message!"
132
+ msgstr ""
133
+
134
+ #: qtranslate_configuration.php:226
135
+ msgid "The Language must have a Locale!"
136
+ msgstr ""
137
+
138
+ #: qtranslate_configuration.php:227
139
+ msgid "The Language must have a name!"
140
+ msgstr ""
141
+
142
+ #: qtranslate_configuration.php:228
143
+ msgid "Language Code has to be 2 characters long!"
144
+ msgstr ""
145
+
146
+ #: qtranslate_configuration.php:232 qtranslate_configuration.php:238
147
+ msgid "There is already a language with the same Language Code!"
148
+ msgstr ""
149
+
150
+ #: qtranslate_configuration.php:339
151
+ msgid "Language is already enabled or invalid!"
152
+ msgstr ""
153
+
154
+ #: qtranslate_configuration.php:344
155
+ msgid "Cannot disable Default Language!"
156
+ msgstr ""
157
+
158
+ #: qtranslate_configuration.php:347 qtranslate_configuration.php:354
159
+ #: qtranslate_configuration.php:370
160
+ msgid "No such language!"
161
+ msgstr ""
162
+
163
+ #: qtranslate_configuration.php:350
164
+ msgid "Language is already disabled!"
165
+ msgstr ""
166
+
167
+ #: qtranslate_configuration.php:358
168
+ msgid "Language is already first!"
169
+ msgstr ""
170
+
171
+ #: qtranslate_configuration.php:364 qtranslate_configuration.php:380
172
+ msgid "New order saved."
173
+ msgstr ""
174
+
175
+ #: qtranslate_configuration.php:374
176
+ msgid "Language is already last!"
177
+ msgstr ""
178
+
179
+ #: qtranslate_configuration.php:391
180
+ msgid "Options saved."
181
+ msgstr ""
182
+
183
+ #: qtranslate_configuration.php:396
184
+ #, php-format
185
+ msgid "Could not write to \"%s\", Gettext Databases could not be downloaded!"
186
+ msgstr ""
187
+
188
+ #: qtranslate_configuration.php:418
189
+ msgid "Edit Language"
190
+ msgstr ""
191
+
192
+ #: qtranslate_configuration.php:421
193
+ msgid "Save Changes &raquo;"
194
+ msgstr ""
195
+
196
+ #: qtranslate_configuration.php:426
197
+ msgid "Language Management (qTranslate Configuration)"
198
+ msgstr ""
199
+
200
+ #: qtranslate_configuration.php:427
201
+ #, php-format
202
+ msgid ""
203
+ "For help on how to configure qTranslate correctly, take a look at the <a "
204
+ "href=\"%1$s\">qTranslate FAQ</a> and the <a href=\"%2$s\">Support Forum</a>."
205
+ msgstr ""
206
+
207
+ #: qtranslate_configuration.php:429
208
+ msgid "General Settings"
209
+ msgstr ""
210
+
211
+ #: qtranslate_configuration.php:432
212
+ msgid "Default Language / Order"
213
+ msgstr ""
214
+
215
+ #: qtranslate_configuration.php:434
216
+ msgid "Default Language"
217
+ msgstr ""
218
+
219
+ #: qtranslate_configuration.php:450
220
+ #, php-format
221
+ msgid ""
222
+ "Choose the default language of your blog. This is the language which will be "
223
+ "shown on %s. You can also change the order the languages by clicking on the "
224
+ "arrows above."
225
+ msgstr ""
226
+
227
+ #: qtranslate_configuration.php:455
228
+ msgid "Hide Untranslated Content"
229
+ msgstr ""
230
+
231
+ #: qtranslate_configuration.php:457
232
+ msgid "Hide Content which is not available for the selected language."
233
+ msgstr ""
234
+
235
+ #: qtranslate_configuration.php:459
236
+ msgid ""
237
+ "When checked, posts will be hidden if the content is not available for the "
238
+ "selected language. If unchecked, a message will appear showing all the "
239
+ "languages the content is available in."
240
+ msgstr ""
241
+
242
+ #: qtranslate_configuration.php:460
243
+ msgid ""
244
+ "This function will not work correctly if you installed qTranslate on a blog "
245
+ "with existing entries. In this case you will need to take a look at "
246
+ "\"Convert Database\" under \"Advanced Settings\"."
247
+ msgstr ""
248
+
249
+ #: qtranslate_configuration.php:464
250
+ msgid "Detect Browser Language"
251
+ msgstr ""
252
+
253
+ #: qtranslate_configuration.php:466
254
+ msgid "Detect the language of the browser and redirect accordingly."
255
+ msgstr ""
256
+
257
+ #: qtranslate_configuration.php:468
258
+ msgid ""
259
+ "When the frontpage is visited via bookmark/external link/type-in, the "
260
+ "visitor will be forwarded to the correct URL for the language specified by "
261
+ "his browser."
262
+ msgstr ""
263
+
264
+ #: qtranslate_configuration.php:472
265
+ msgid "Advanced Settings"
266
+ msgstr ""
267
+
268
+ #: qtranslate_configuration.php:472 qtranslate_services.php:313
269
+ msgid "Show"
270
+ msgstr ""
271
+
272
+ #: qtranslate_configuration.php:475 qtranslate_configuration.php:477
273
+ msgid "URL Modification Mode"
274
+ msgstr ""
275
+
276
+ #: qtranslate_configuration.php:478
277
+ msgid "Use Query Mode (?lang=en)"
278
+ msgstr ""
279
+
280
+ #: qtranslate_configuration.php:479
281
+ msgid "Use Pre-Path Mode (Default, puts /en/ in front of URL)"
282
+ msgstr ""
283
+
284
+ #: qtranslate_configuration.php:480
285
+ msgid "Use Pre-Domain Mode (uses http://en.yoursite.com)"
286
+ msgstr ""
287
+
288
+ #: qtranslate_configuration.php:482
289
+ msgid ""
290
+ "Pre-Path and Pre-Domain mode will only work with mod_rewrite/pretty "
291
+ "permalinks. Additional Configuration is needed for Pre-Domain mode!"
292
+ msgstr ""
293
+
294
+ #: qtranslate_configuration.php:483
295
+ msgid "Hide URL language information for default language."
296
+ msgstr ""
297
+
298
+ #: qtranslate_configuration.php:487
299
+ msgid "Flag Image Path"
300
+ msgstr ""
301
+
302
+ #: qtranslate_configuration.php:491
303
+ msgid ""
304
+ "Path to the flag images under wp-content, with trailing slash. (Default: "
305
+ "plugins/qtranslate/flags/)"
306
+ msgstr ""
307
+
308
+ #: qtranslate_configuration.php:495
309
+ msgid "Ignore Links"
310
+ msgstr ""
311
+
312
+ #: qtranslate_configuration.php:499
313
+ msgid ""
314
+ "Don't convert Links to files of the given file types. (Default: gif,jpg,jpeg,"
315
+ "png,pdf,swf,tif,rar,zip,7z,mpg,divx,mpeg,avi,css,js)"
316
+ msgstr ""
317
+
318
+ #: qtranslate_configuration.php:503
319
+ msgid "Update Gettext Databases"
320
+ msgstr ""
321
+
322
+ #: qtranslate_configuration.php:505
323
+ msgid "Automatically check for .mo-Database Updates of installed languages."
324
+ msgstr ""
325
+
326
+ #: qtranslate_configuration.php:507
327
+ msgid "Update Gettext databases now."
328
+ msgstr ""
329
+
330
+ #: qtranslate_configuration.php:509
331
+ msgid ""
332
+ "qTranslate will query the Wordpress Localisation Repository every week and "
333
+ "download the latest Gettext Databases (.mo Files)."
334
+ msgstr ""
335
+
336
+ #: qtranslate_configuration.php:513
337
+ msgid "Date / Time Conversion"
338
+ msgstr ""
339
+
340
+ #: qtranslate_configuration.php:515
341
+ msgid "Use emulated date function."
342
+ msgstr ""
343
+
344
+ #: qtranslate_configuration.php:516
345
+ msgid ""
346
+ "Use emulated date function and replace formats with the predefined formats "
347
+ "for each language."
348
+ msgstr ""
349
+
350
+ #: qtranslate_configuration.php:517
351
+ msgid "Use strftime instead of date."
352
+ msgstr ""
353
+
354
+ #: qtranslate_configuration.php:518
355
+ msgid ""
356
+ "Use strftime instead of date and replace formats with the predefined formats "
357
+ "for each language."
358
+ msgstr ""
359
+
360
+ #: qtranslate_configuration.php:519
361
+ msgid ""
362
+ "Depending on the mode selected, additional customizations of the theme may "
363
+ "be needed."
364
+ msgstr ""
365
+
366
+ #: qtranslate_configuration.php:523
367
+ msgid "Reset qTranslate"
368
+ msgstr ""
369
+
370
+ #: qtranslate_configuration.php:525
371
+ msgid "Check this box and click Save Changes to reset all qTranslate settings."
372
+ msgstr ""
373
+
374
+ #: qtranslate_configuration.php:527
375
+ msgid "Yes, I really want to reset qTranslate."
376
+ msgstr ""
377
+
378
+ #: qtranslate_configuration.php:529
379
+ msgid "Also delete Translations for Categories/Tags/Link Categories."
380
+ msgstr ""
381
+
382
+ #: qtranslate_configuration.php:531
383
+ msgid ""
384
+ "If something isn't working correctly, you can always try to reset all "
385
+ "qTranslate settings. A Reset won't delete any posts but will remove all "
386
+ "settings (including all languages added)."
387
+ msgstr ""
388
+
389
+ #: qtranslate_configuration.php:535
390
+ msgid "Convert Database"
391
+ msgstr ""
392
+
393
+ #: qtranslate_configuration.php:537
394
+ #, php-format
395
+ msgid ""
396
+ "If you are updating from qTranslate 1.x or Polyglot, <a href=\"%s\">click "
397
+ "here</a> to convert posts to the new language tag format."
398
+ msgstr ""
399
+
400
+ #: qtranslate_configuration.php:538
401
+ #, php-format
402
+ msgid ""
403
+ "If you have installed qTranslate for the first time on a Wordpress with "
404
+ "existing posts, you can either go through all your posts manually and save "
405
+ "them in the correct language or <a href=\"%s\">click here</a> to mark all "
406
+ "existing posts as written in the default language."
407
+ msgstr ""
408
+
409
+ #: qtranslate_configuration.php:539
410
+ msgid ""
411
+ "Both processes are <b>irreversible</b>! Be sure to make a full database "
412
+ "backup before clicking one of the links."
413
+ msgstr ""
414
+
415
+ #: qtranslate_configuration.php:543
416
+ msgid "Debugging Information"
417
+ msgstr ""
418
+
419
+ #: qtranslate_configuration.php:545
420
+ #, php-format
421
+ msgid ""
422
+ "If you encounter any problems and you are unable to solve them yourself, you "
423
+ "can visit the <a href=\"%s\">Support Forum</a>. Posting the following "
424
+ "Content will help other detect any misconfigurations."
425
+ msgstr ""
426
+
427
+ #: qtranslate_configuration.php:575
428
+ msgid "Save Changes"
429
+ msgstr ""
430
+
431
+ #: qtranslate_configuration.php:606
432
+ msgid "Disable"
433
+ msgstr ""
434
+
435
+ #: qtranslate_configuration.php:606
436
+ msgid "Enable"
437
+ msgstr ""
438
+
439
+ #: qtranslate_configuration.php:607
440
+ msgid "Edit"
441
+ msgstr ""
442
+
443
+ #: qtranslate_configuration.php:608
444
+ msgid "Default"
445
+ msgstr ""
446
+
447
+ #: qtranslate_configuration.php:608
448
+ msgid "Delete"
449
+ msgstr ""
450
+
451
+ #: qtranslate_configuration.php:613
452
+ msgid ""
453
+ "Enabling a language will cause qTranslate to update the Gettext-Database for "
454
+ "the language, which can take a while depending on your server's connection "
455
+ "speed."
456
+ msgstr ""
457
+
458
+ #: qtranslate_configuration.php:620
459
+ msgid "Add Language"
460
+ msgstr ""
461
+
462
+ #: qtranslate_configuration.php:623
463
+ msgid "Add Language &raquo;"
464
+ msgstr ""
465
+
466
+ #: qtranslate_hooks.php:155
467
+ msgid "Settings"
468
+ msgstr ""
469
+
470
+ #: qtranslate_services.php:47
471
+ msgid "The language/s do not have a valid ISO 639-1 representation."
472
+ msgstr ""
473
+
474
+ #: qtranslate_services.php:48
475
+ msgid "The language/s you used are not supported by the service."
476
+ msgstr ""
477
+
478
+ #: qtranslate_services.php:49
479
+ msgid "There is no such service."
480
+ msgstr ""
481
+
482
+ #: qtranslate_services.php:50
483
+ msgid "The system could not process your order."
484
+ msgstr ""
485
+
486
+ #: qtranslate_services.php:51
487
+ msgid "There has been an error with the selected service."
488
+ msgstr ""
489
+
490
+ #: qtranslate_services.php:52
491
+ msgid "An unknown error occured with the selected service."
492
+ msgstr ""
493
+
494
+ #: qtranslate_services.php:53
495
+ msgid "The server returned a debugging message."
496
+ msgstr ""
497
+
498
+ #: qtranslate_services.php:154
499
+ #, php-format
500
+ msgid "<div>Translate to %s</div>"
501
+ msgstr ""
502
+
503
+ #: qtranslate_services.php:185 qtranslate_services.php:186
504
+ msgid "Translate to"
505
+ msgstr ""
506
+
507
+ #: qtranslate_services.php:273
508
+ msgid "Order deleted."
509
+ msgstr ""
510
+
511
+ #: qtranslate_services.php:277
512
+ msgid "Status updated for all open orders."
513
+ msgstr ""
514
+
515
+ #: qtranslate_services.php:302
516
+ msgid "Post Title"
517
+ msgstr ""
518
+
519
+ #: qtranslate_services.php:303
520
+ msgid "Service"
521
+ msgstr ""
522
+
523
+ #: qtranslate_services.php:304
524
+ msgid "Source Language"
525
+ msgstr ""
526
+
527
+ #: qtranslate_services.php:305
528
+ msgid "Target Language"
529
+ msgstr ""
530
+
531
+ #: qtranslate_services.php:313
532
+ msgid "qTranslate Services Settings"
533
+ msgstr ""
534
+
535
+ #: qtranslate_services.php:316 qtranslate_services.php:587
536
+ #: qtranslate_services.php:597 qtranslate_services.php:621
537
+ msgid "qTranslate Services"
538
+ msgstr ""
539
+
540
+ #: qtranslate_services.php:318
541
+ #, php-format
542
+ msgid ""
543
+ "<div id=\"message\" class=\"error fade\"><p>qTranslate Services could not "
544
+ "load <a href=\"%s\">OpenSSL</a>!</p></div>"
545
+ msgstr ""
546
+
547
+ #: qtranslate_services.php:319
548
+ msgid "Enable qTranslate Services"
549
+ msgstr ""
550
+
551
+ #: qtranslate_services.php:321
552
+ msgid ""
553
+ "With qTranslate Services, you will be able to use professional human "
554
+ "translation services with a few clicks. (Requires OpenSSL)"
555
+ msgstr ""
556
+
557
+ #: qtranslate_services.php:322
558
+ msgid "Save after enabling to see more Configuration options."
559
+ msgstr ""
560
+
561
+ #: qtranslate_services.php:332
562
+ msgid "Open Orders"
563
+ msgstr ""
564
+
565
+ #: qtranslate_services.php:354
566
+ #, php-format
567
+ msgid "Edit %s"
568
+ msgstr ""
569
+
570
+ #: qtranslate_services.php:355 qtranslate_services.php:392
571
+ #: qtranslate_services.php:688 qtranslate_services.php:695
572
+ msgid "Website"
573
+ msgstr ""
574
+
575
+ #: qtranslate_services.php:365
576
+ #, php-format
577
+ msgid "Current Status: %s"
578
+ msgstr ""
579
+
580
+ #: qtranslate_services.php:373
581
+ #, php-format
582
+ msgid ""
583
+ "qTranslate Services will automatically check every hour whether the "
584
+ "translations are finished and update your posts accordingly. You can always "
585
+ "<a href=\"%s\">check manually</a>."
586
+ msgstr ""
587
+
588
+ #: qtranslate_services.php:374
589
+ msgid ""
590
+ "Deleting an open order doesn't cancel it. You will have to logon to the "
591
+ "service homepage and cancel it there."
592
+ msgstr ""
593
+
594
+ #: qtranslate_services.php:376
595
+ msgid "No open orders."
596
+ msgstr ""
597
+
598
+ #: qtranslate_services.php:382
599
+ msgid "Service Configuration"
600
+ msgstr ""
601
+
602
+ #: qtranslate_services.php:383
603
+ msgid ""
604
+ "Below, you will find configuration settings for qTranslate Service "
605
+ "Providers, which are required for them to operate."
606
+ msgstr ""
607
+
608
+ #: qtranslate_services.php:392
609
+ msgid "service_name"
610
+ msgstr ""
611
+
612
+ #: qtranslate_services.php:393
613
+ msgid "service_description"
614
+ msgstr ""
615
+
616
+ #: qtranslate_services.php:476
617
+ #, php-format
618
+ msgid ""
619
+ "To translate a post, please go to the <a href=\"%s\">edit posts overview</a>."
620
+ msgstr ""
621
+
622
+ #: qtranslate_services.php:488
623
+ #, php-format
624
+ msgid "Post with id \"%s\" not found!"
625
+ msgstr ""
626
+
627
+ #: qtranslate_services.php:496
628
+ msgid "The requested Post has no content, no Translation possible."
629
+ msgstr ""
630
+
631
+ #: qtranslate_services.php:505
632
+ msgid ""
633
+ "The Post already has content for the selected target language. If a "
634
+ "translation request is send, the current text for the target language will "
635
+ "be overwritten."
636
+ msgstr ""
637
+
638
+ #: qtranslate_services.php:566
639
+ #, php-format
640
+ msgid "An error occured: %s"
641
+ msgstr ""
642
+
643
+ #: qtranslate_services.php:568
644
+ #, php-format
645
+ msgid "Additional information: %s"
646
+ msgstr ""
647
+
648
+ #: qtranslate_services.php:589
649
+ #, php-format
650
+ msgid ""
651
+ "An serious error occured and qTranslate Services cannot proceed. For help, "
652
+ "please visit the <a href=\"%s\">Support Forum</a>"
653
+ msgstr ""
654
+
655
+ #: qtranslate_services.php:598
656
+ msgid "Order successfully sent."
657
+ msgstr ""
658
+
659
+ #: qtranslate_services.php:599
660
+ msgid ""
661
+ "Your translation order has been successfully transfered to the selected "
662
+ "service."
663
+ msgstr ""
664
+
665
+ #: qtranslate_services.php:603
666
+ #, php-format
667
+ msgid "The service returned this message: %s"
668
+ msgstr ""
669
+
670
+ #: qtranslate_services.php:607
671
+ msgid "Feel free to choose an action:"
672
+ msgstr ""
673
+
674
+ #: qtranslate_services.php:609
675
+ msgid "Translate this post to another language."
676
+ msgstr ""
677
+
678
+ #: qtranslate_services.php:610
679
+ msgid "Translate a different post."
680
+ msgstr ""
681
+
682
+ #: qtranslate_services.php:611
683
+ msgid "View all open orders."
684
+ msgstr ""
685
+
686
+ #: qtranslate_services.php:612
687
+ msgid "Let qTranslate Services check if any open orders are finished."
688
+ msgstr ""
689
+
690
+ #: qtranslate_services.php:613
691
+ msgid "View this post."
692
+ msgstr ""
693
+
694
+ #: qtranslate_services.php:638
695
+ #, php-format
696
+ msgid ""
697
+ "Your article is available in multiple languages. If you do not want to "
698
+ "translate from %1$s, you can switch to one of the following languages: %2$s"
699
+ msgstr ""
700
+
701
+ #: qtranslate_services.php:646
702
+ msgid "Please choose the language you want to translate to:"
703
+ msgstr ""
704
+
705
+ #: qtranslate_services.php:658
706
+ msgid "Continue"
707
+ msgstr ""
708
+
709
+ #: qtranslate_services.php:663
710
+ #, php-format
711
+ msgid "Please review your article and <a href=\"%s\">edit</a> it if needed."
712
+ msgstr ""
713
+
714
+ #: qtranslate_services.php:669
715
+ msgid ""
716
+ "ERROR: Could not connect to qTranslate Services. Please try again later."
717
+ msgstr ""
718
+
719
+ #: qtranslate_services.php:675
720
+ msgid "Use the following Translation Service:"
721
+ msgstr ""
722
+
723
+ #: qtranslate_services.php:689
724
+ #, php-format
725
+ msgid ""
726
+ "Cannot use this service, not all <a href=\"%s\">required fields</a> filled "
727
+ "in for this service."
728
+ msgstr ""
729
+
730
+ #: qtranslate_services.php:701
731
+ msgid ""
732
+ "Your article will be SSL encrypted and securly sent to qTranslate Services, "
733
+ "which will forward your text to the chosen Translation Service. Once "
734
+ "qTranslate Services receives the translated text, it will automatically "
735
+ "appear on your blog."
736
+ msgstr ""
737
+
738
+ #: qtranslate_services.php:704
739
+ msgid "Request Translation"
740
+ msgstr ""
741
+
742
+ #: qtranslate_services.php:717
743
+ msgid "Translate"
744
+ msgstr ""
745
+
746
+ #: qtranslate_widget.php:24
747
+ msgid "Allows your visitors to choose a Language."
748
+ msgstr ""
749
+
750
+ #: qtranslate_widget.php:25
751
+ msgid "qTranslate Language Chooser"
752
+ msgstr ""
753
+
754
+ #: qtranslate_widget.php:32
755
+ msgid "Language"
756
+ msgstr ""
757
+
758
+ #: qtranslate_widget.php:57
759
+ msgid "Title:"
760
+ msgstr ""
761
+
762
+ #: qtranslate_widget.php:58
763
+ msgid "Hide Title:"
764
+ msgstr ""
765
+
766
+ #: qtranslate_widget.php:59
767
+ msgid "Display:"
768
+ msgstr ""
769
+
770
+ #: qtranslate_widget.php:60
771
+ msgid "Text only"
772
+ msgstr ""
773
+
774
+ #: qtranslate_widget.php:61
775
+ msgid "Image only"
776
+ msgstr ""
777
+
778
+ #: qtranslate_widget.php:62
779
+ msgid "Text and Image"
780
+ msgstr ""
781
+
782
+ #: qtranslate_widget.php:63
783
+ msgid "Dropdown Box"
784
+ msgstr ""
785
+
786
+ #: qtranslate_wphacks.php:46 qtranslate_wphacks.php:54
787
+ msgid "Category Name"
788
+ msgstr ""
789
+
790
+ #: qtranslate_wphacks.php:50
791
+ msgid "Tag Name"
792
+ msgstr ""
793
+
794
+ #: qtranslate_wphacks.php:63
795
+ msgid ""
796
+ "This version of qTranslate has not been tested with your Wordpress version. "
797
+ "To prevent Wordpress from malfunctioning, the qTranslate Editor has been "
798
+ "disabled. You can reenable it by <a href=\"javascript:qtrans_editorInit();\" "
799
+ "title=\"Activate qTranslate\" id=\"qtrans_imsg_link\">clicking here</a> (may "
800
+ "cause <b>data loss</b>!). To remove this message, please update qTranslate "
801
+ "to the <a href=\"http://www.qianqin.de/qtranslate/download/\">corresponding "
802
+ "version</a>."
803
+ msgstr ""
804
+
805
+ #: qtranslate_wphacks.php:320
806
+ msgid "Title"
807
+ msgstr ""
808
+
809
+ #. Plugin Name of an extension
810
+ msgid "qTranslate"
811
+ msgstr ""
812
+
813
+ #. Plugin URI of an extension
814
+ msgid "http://www.qianqin.de/qtranslate/"
815
+ msgstr ""
816
+
817
+ #. Description of an extension
818
+ msgid ""
819
+ "Adds userfriendly multilingual content support into Wordpress. For Problems "
820
+ "visit the <a href=\"http://www.qianqin.de/qtranslate/forum/\">Support Forum</"
821
+ "a>."
822
+ msgstr ""
823
+
824
+ #. Author of an extension
825
+ msgid "Qian Qin"
826
+ msgstr ""
827
+
828
+ #. Author URI of an extension
829
+ msgid "http://www.qianqin.de"
830
+ msgstr ""
831
+
832
+ #. Tags of an extension
833
+ msgid ""
834
+ "multilingual, multi, language, admin, tinymce, qTranslate, Polyglot, "
835
+ "bilingual, widget, switcher, professional, human, translation, service"
836
+ msgstr ""
license.txt ADDED
@@ -0,0 +1,674 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ GNU GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+ Preamble
9
+
10
+ The GNU General Public License is a free, copyleft license for
11
+ software and other kinds of works.
12
+
13
+ The licenses for most software and other practical works are designed
14
+ to take away your freedom to share and change the works. By contrast,
15
+ the GNU General Public License is intended to guarantee your freedom to
16
+ share and change all versions of a program--to make sure it remains free
17
+ software for all its users. We, the Free Software Foundation, use the
18
+ GNU General Public License for most of our software; it applies also to
19
+ any other work released this way by its authors. You can apply it to
20
+ your programs, too.
21
+
22
+ When we speak of free software, we are referring to freedom, not
23
+ price. Our General Public Licenses are designed to make sure that you
24
+ have the freedom to distribute copies of free software (and charge for
25
+ them if you wish), that you receive source code or can get it if you
26
+ want it, that you can change the software or use pieces of it in new
27
+ free programs, and that you know you can do these things.
28
+
29
+ To protect your rights, we need to prevent others from denying you
30
+ these rights or asking you to surrender the rights. Therefore, you have
31
+ certain responsibilities if you distribute copies of the software, or if
32
+ you modify it: responsibilities to respect the freedom of others.
33
+
34
+ For example, if you distribute copies of such a program, whether
35
+ gratis or for a fee, you must pass on to the recipients the same
36
+ freedoms that you received. You must make sure that they, too, receive
37
+ or can get the source code. And you must show them these terms so they
38
+ know their rights.
39
+
40
+ Developers that use the GNU GPL protect your rights with two steps:
41
+ (1) assert copyright on the software, and (2) offer you this License
42
+ giving you legal permission to copy, distribute and/or modify it.
43
+
44
+ For the developers' and authors' protection, the GPL clearly explains
45
+ that there is no warranty for this free software. For both users' and
46
+ authors' sake, the GPL requires that modified versions be marked as
47
+ changed, so that their problems will not be attributed erroneously to
48
+ authors of previous versions.
49
+
50
+ Some devices are designed to deny users access to install or run
51
+ modified versions of the software inside them, although the manufacturer
52
+ can do so. This is fundamentally incompatible with the aim of
53
+ protecting users' freedom to change the software. The systematic
54
+ pattern of such abuse occurs in the area of products for individuals to
55
+ use, which is precisely where it is most unacceptable. Therefore, we
56
+ have designed this version of the GPL to prohibit the practice for those
57
+ products. If such problems arise substantially in other domains, we
58
+ stand ready to extend this provision to those domains in future versions
59
+ of the GPL, as needed to protect the freedom of users.
60
+
61
+ Finally, every program is threatened constantly by software patents.
62
+ States should not allow patents to restrict development and use of
63
+ software on general-purpose computers, but in those that do, we wish to
64
+ avoid the special danger that patents applied to a free program could
65
+ make it effectively proprietary. To prevent this, the GPL assures that
66
+ patents cannot be used to render the program non-free.
67
+
68
+ The precise terms and conditions for copying, distribution and
69
+ modification follow.
70
+
71
+ TERMS AND CONDITIONS
72
+
73
+ 0. Definitions.
74
+
75
+ "This License" refers to version 3 of the GNU General Public License.
76
+
77
+ "Copyright" also means copyright-like laws that apply to other kinds of
78
+ works, such as semiconductor masks.
79
+
80
+ "The Program" refers to any copyrightable work licensed under this
81
+ License. Each licensee is addressed as "you". "Licensees" and
82
+ "recipients" may be individuals or organizations.
83
+
84
+ To "modify" a work means to copy from or adapt all or part of the work
85
+ in a fashion requiring copyright permission, other than the making of an
86
+ exact copy. The resulting work is called a "modified version" of the
87
+ earlier work or a work "based on" the earlier work.
88
+
89
+ A "covered work" means either the unmodified Program or a work based
90
+ on the Program.
91
+
92
+ To "propagate" a work means to do anything with it that, without
93
+ permission, would make you directly or secondarily liable for
94
+ infringement under applicable copyright law, except executing it on a
95
+ computer or modifying a private copy. Propagation includes copying,
96
+ distribution (with or without modification), making available to the
97
+ public, and in some countries other activities as well.
98
+
99
+ To "convey" a work means any kind of propagation that enables other
100
+ parties to make or receive copies. Mere interaction with a user through
101
+ a computer network, with no transfer of a copy, is not conveying.
102
+
103
+ An interactive user interface displays "Appropriate Legal Notices"
104
+ to the extent that it includes a convenient and prominently visible
105
+ feature that (1) displays an appropriate copyright notice, and (2)
106
+ tells the user that there is no warranty for the work (except to the
107
+ extent that warranties are provided), that licensees may convey the
108
+ work under this License, and how to view a copy of this License. If
109
+ the interface presents a list of user commands or options, such as a
110
+ menu, a prominent item in the list meets this criterion.
111
+
112
+ 1. Source Code.
113
+
114
+ The "source code" for a work means the preferred form of the work
115
+ for making modifications to it. "Object code" means any non-source
116
+ form of a work.
117
+
118
+ A "Standard Interface" means an interface that either is an official
119
+ standard defined by a recognized standards body, or, in the case of
120
+ interfaces specified for a particular programming language, one that
121
+ is widely used among developers working in that language.
122
+
123
+ The "System Libraries" of an executable work include anything, other
124
+ than the work as a whole, that (a) is included in the normal form of
125
+ packaging a Major Component, but which is not part of that Major
126
+ Component, and (b) serves only to enable use of the work with that
127
+ Major Component, or to implement a Standard Interface for which an
128
+ implementation is available to the public in source code form. A
129
+ "Major Component", in this context, means a major essential component
130
+ (kernel, window system, and so on) of the specific operating system
131
+ (if any) on which the executable work runs, or a compiler used to
132
+ produce the work, or an object code interpreter used to run it.
133
+
134
+ The "Corresponding Source" for a work in object code form means all
135
+ the source code needed to generate, install, and (for an executable
136
+ work) run the object code and to modify the work, including scripts to
137
+ control those activities. However, it does not include the work's
138
+ System Libraries, or general-purpose tools or generally available free
139
+ programs which are used unmodified in performing those activities but
140
+ which are not part of the work. For example, Corresponding Source
141
+ includes interface definition files associated with source files for
142
+ the work, and the source code for shared libraries and dynamically
143
+ linked subprograms that the work is specifically designed to require,
144
+ such as by intimate data communication or control flow between those
145
+ subprograms and other parts of the work.
146
+
147
+ The Corresponding Source need not include anything that users
148
+ can regenerate automatically from other parts of the Corresponding
149
+ Source.
150
+
151
+ The Corresponding Source for a work in source code form is that
152
+ same work.
153
+
154
+ 2. Basic Permissions.
155
+
156
+ All rights granted under this License are granted for the term of
157
+ copyright on the Program, and are irrevocable provided the stated
158
+ conditions are met. This License explicitly affirms your unlimited
159
+ permission to run the unmodified Program. The output from running a
160
+ covered work is covered by this License only if the output, given its
161
+ content, constitutes a covered work. This License acknowledges your
162
+ rights of fair use or other equivalent, as provided by copyright law.
163
+
164
+ You may make, run and propagate covered works that you do not
165
+ convey, without conditions so long as your license otherwise remains
166
+ in force. You may convey covered works to others for the sole purpose
167
+ of having them make modifications exclusively for you, or provide you
168
+ with facilities for running those works, provided that you comply with
169
+ the terms of this License in conveying all material for which you do
170
+ not control copyright. Those thus making or running the covered works
171
+ for you must do so exclusively on your behalf, under your direction
172
+ and control, on terms that prohibit them from making any copies of
173
+ your copyrighted material outside their relationship with you.
174
+
175
+ Conveying under any other circumstances is permitted solely under
176
+ the conditions stated below. Sublicensing is not allowed; section 10
177
+ makes it unnecessary.
178
+
179
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
180
+
181
+ No covered work shall be deemed part of an effective technological
182
+ measure under any applicable law fulfilling obligations under article
183
+ 11 of the WIPO copyright treaty adopted on 20 December 1996, or
184
+ similar laws prohibiting or restricting circumvention of such
185
+ measures.
186
+
187
+ When you convey a covered work, you waive any legal power to forbid
188
+ circumvention of technological measures to the extent such circumvention
189
+ is effected by exercising rights under this License with respect to
190
+ the covered work, and you disclaim any intention to limit operation or
191
+ modification of the work as a means of enforcing, against the work's
192
+ users, your or third parties' legal rights to forbid circumvention of
193
+ technological measures.
194
+
195
+ 4. Conveying Verbatim Copies.
196
+
197
+ You may convey verbatim copies of the Program's source code as you
198
+ receive it, in any medium, provided that you conspicuously and
199
+ appropriately publish on each copy an appropriate copyright notice;
200
+ keep intact all notices stating that this License and any
201
+ non-permissive terms added in accord with section 7 apply to the code;
202
+ keep intact all notices of the absence of any warranty; and give all
203
+ recipients a copy of this License along with the Program.
204
+
205
+ You may charge any price or no price for each copy that you convey,
206
+ and you may offer support or warranty protection for a fee.
207
+
208
+ 5. Conveying Modified Source Versions.
209
+
210
+ You may convey a work based on the Program, or the modifications to
211
+ produce it from the Program, in the form of source code under the
212
+ terms of section 4, provided that you also meet all of these conditions:
213
+
214
+ a) The work must carry prominent notices stating that you modified
215
+ it, and giving a relevant date.
216
+
217
+ b) The work must carry prominent notices stating that it is
218
+ released under this License and any conditions added under section
219
+ 7. This requirement modifies the requirement in section 4 to
220
+ "keep intact all notices".
221
+
222
+ c) You must license the entire work, as a whole, under this
223
+ License to anyone who comes into possession of a copy. This
224
+ License will therefore apply, along with any applicable section 7
225
+ additional terms, to the whole of the work, and all its parts,
226
+ regardless of how they are packaged. This License gives no
227
+ permission to license the work in any other way, but it does not
228
+ invalidate such permission if you have separately received it.
229
+
230
+ d) If the work has interactive user interfaces, each must display
231
+ Appropriate Legal Notices; however, if the Program has interactive
232
+ interfaces that do not display Appropriate Legal Notices, your
233
+ work need not make them do so.
234
+
235
+ A compilation of a covered work with other separate and independent
236
+ works, which are not by their nature extensions of the covered work,
237
+ and which are not combined with it such as to form a larger program,
238
+ in or on a volume of a storage or distribution medium, is called an
239
+ "aggregate" if the compilation and its resulting copyright are not
240
+ used to limit the access or legal rights of the compilation's users
241
+ beyond what the individual works permit. Inclusion of a covered work
242
+ in an aggregate does not cause this License to apply to the other
243
+ parts of the aggregate.
244
+
245
+ 6. Conveying Non-Source Forms.
246
+
247
+ You may convey a covered work in object code form under the terms
248
+ of sections 4 and 5, provided that you also convey the
249
+ machine-readable Corresponding Source under the terms of this License,
250
+ in one of these ways:
251
+
252
+ a) Convey the object code in, or embodied in, a physical product
253
+ (including a physical distribution medium), accompanied by the
254
+ Corresponding Source fixed on a durable physical medium
255
+ customarily used for software interchange.
256
+
257
+ b) Convey the object code in, or embodied in, a physical product
258
+ (including a physical distribution medium), accompanied by a
259
+ written offer, valid for at least three years and valid for as
260
+ long as you offer spare parts or customer support for that product
261
+ model, to give anyone who possesses the object code either (1) a
262
+ copy of the Corresponding Source for all the software in the
263
+ product that is covered by this License, on a durable physical
264
+ medium customarily used for software interchange, for a price no
265
+ more than your reasonable cost of physically performing this
266
+ conveying of source, or (2) access to copy the
267
+ Corresponding Source from a network server at no charge.
268
+
269
+ c) Convey individual copies of the object code with a copy of the
270
+ written offer to provide the Corresponding Source. This
271
+ alternative is allowed only occasionally and noncommercially, and
272
+ only if you received the object code with such an offer, in accord
273
+ with subsection 6b.
274
+
275
+ d) Convey the object code by offering access from a designated
276
+ place (gratis or for a charge), and offer equivalent access to the
277
+ Corresponding Source in the same way through the same place at no
278
+ further charge. You need not require recipients to copy the
279
+ Corresponding Source along with the object code. If the place to
280
+ copy the object code is a network server, the Corresponding Source
281
+ may be on a different server (operated by you or a third party)
282
+ that supports equivalent copying facilities, provided you maintain
283
+ clear directions next to the object code saying where to find the
284
+ Corresponding Source. Regardless of what server hosts the
285
+ Corresponding Source, you remain obligated to ensure that it is
286
+ available for as long as needed to satisfy these requirements.
287
+
288
+ e) Convey the object code using peer-to-peer transmission, provided
289
+ you inform other peers where the object code and Corresponding
290
+ Source of the work are being offered to the general public at no
291
+ charge under subsection 6d.
292
+
293
+ A separable portion of the object code, whose source code is excluded
294
+ from the Corresponding Source as a System Library, need not be
295
+ included in conveying the object code work.
296
+
297
+ A "User Product" is either (1) a "consumer product", which means any
298
+ tangible personal property which is normally used for personal, family,
299
+ or household purposes, or (2) anything designed or sold for incorporation
300
+ into a dwelling. In determining whether a product is a consumer product,
301
+ doubtful cases shall be resolved in favor of coverage. For a particular
302
+ product received by a particular user, "normally used" refers to a
303
+ typical or common use of that class of product, regardless of the status
304
+ of the particular user or of the way in which the particular user
305
+ actually uses, or expects or is expected to use, the product. A product
306
+ is a consumer product regardless of whether the product has substantial
307
+ commercial, industrial or non-consumer uses, unless such uses represent
308
+ the only significant mode of use of the product.
309
+
310
+ "Installation Information" for a User Product means any methods,
311
+ procedures, authorization keys, or other information required to install
312
+ and execute modified versions of a covered work in that User Product from
313
+ a modified version of its Corresponding Source. The information must
314
+ suffice to ensure that the continued functioning of the modified object
315
+ code is in no case prevented or interfered with solely because
316
+ modification has been made.
317
+
318
+ If you convey an object code work under this section in, or with, or
319
+ specifically for use in, a User Product, and the conveying occurs as
320
+ part of a transaction in which the right of possession and use of the
321
+ User Product is transferred to the recipient in perpetuity or for a
322
+ fixed term (regardless of how the transaction is characterized), the
323
+ Corresponding Source conveyed under this section must be accompanied
324
+ by the Installation Information. But this requirement does not apply
325
+ if neither you nor any third party retains the ability to install
326
+ modified object code on the User Product (for example, the work has
327
+ been installed in ROM).
328
+
329
+ The requirement to provide Installation Information does not include a
330
+ requirement to continue to provide support service, warranty, or updates
331
+ for a work that has been modified or installed by the recipient, or for
332
+ the User Product in which it has been modified or installed. Access to a
333
+ network may be denied when the modification itself materially and
334
+ adversely affects the operation of the network or violates the rules and
335
+ protocols for communication across the network.
336
+
337
+ Corresponding Source conveyed, and Installation Information provided,
338
+ in accord with this section must be in a format that is publicly
339
+ documented (and with an implementation available to the public in
340
+ source code form), and must require no special password or key for
341
+ unpacking, reading or copying.
342
+
343
+ 7. Additional Terms.
344
+
345
+ "Additional permissions" are terms that supplement the terms of this
346
+ License by making exceptions from one or more of its conditions.
347
+ Additional permissions that are applicable to the entire Program shall
348
+ be treated as though they were included in this License, to the extent
349
+ that they are valid under applicable law. If additional permissions
350
+ apply only to part of the Program, that part may be used separately
351
+ under those permissions, but the entire Program remains governed by
352
+ this License without regard to the additional permissions.
353
+
354
+ When you convey a copy of a covered work, you may at your option
355
+ remove any additional permissions from that copy, or from any part of
356
+ it. (Additional permissions may be written to require their own
357
+ removal in certain cases when you modify the work.) You may place
358
+ additional permissions on material, added by you to a covered work,
359
+ for which you have or can give appropriate copyright permission.
360
+
361
+ Notwithstanding any other provision of this License, for material you
362
+ add to a covered work, you may (if authorized by the copyright holders of
363
+ that material) supplement the terms of this License with terms:
364
+
365
+ a) Disclaiming warranty or limiting liability differently from the
366
+ terms of sections 15 and 16 of this License; or
367
+
368
+ b) Requiring preservation of specified reasonable legal notices or
369
+ author attributions in that material or in the Appropriate Legal
370
+ Notices displayed by works containing it; or
371
+
372
+ c) Prohibiting misrepresentation of the origin of that material, or
373
+ requiring that modified versions of such material be marked in
374
+ reasonable ways as different from the original version; or
375
+
376
+ d) Limiting the use for publicity purposes of names of licensors or
377
+ authors of the material; or
378
+
379
+ e) Declining to grant rights under trademark law for use of some
380
+ trade names, trademarks, or service marks; or
381
+
382
+ f) Requiring indemnification of licensors and authors of that
383
+ material by anyone who conveys the material (or modified versions of
384
+ it) with contractual assumptions of liability to the recipient, for
385
+ any liability that these contractual assumptions directly impose on
386
+ those licensors and authors.
387
+
388
+ All other non-permissive additional terms are considered "further
389
+ restrictions" within the meaning of section 10. If the Program as you
390
+ received it, or any part of it, contains a notice stating that it is
391
+ governed by this License along with a term that is a further
392
+ restriction, you may remove that term. If a license document contains
393
+ a further restriction but permits relicensing or conveying under this
394
+ License, you may add to a covered work material governed by the terms
395
+ of that license document, provided that the further restriction does
396
+ not survive such relicensing or conveying.
397
+
398
+ If you add terms to a covered work in accord with this section, you
399
+ must place, in the relevant source files, a statement of the
400
+ additional terms that apply to those files, or a notice indicating
401
+ where to find the applicable terms.
402
+
403
+ Additional terms, permissive or non-permissive, may be stated in the
404
+ form of a separately written license, or stated as exceptions;
405
+ the above requirements apply either way.
406
+
407
+ 8. Termination.
408
+
409
+ You may not propagate or modify a covered work except as expressly
410
+ provided under this License. Any attempt otherwise to propagate or
411
+ modify it is void, and will automatically terminate your rights under
412
+ this License (including any patent licenses granted under the third
413
+ paragraph of section 11).
414
+
415
+ However, if you cease all violation of this License, then your
416
+ license from a particular copyright holder is reinstated (a)
417
+ provisionally, unless and until the copyright holder explicitly and
418
+ finally terminates your license, and (b) permanently, if the copyright
419
+ holder fails to notify you of the violation by some reasonable means
420
+ prior to 60 days after the cessation.
421
+
422
+ Moreover, your license from a particular copyright holder is
423
+ reinstated permanently if the copyright holder notifies you of the
424
+ violation by some reasonable means, this is the first time you have
425
+ received notice of violation of this License (for any work) from that
426
+ copyright holder, and you cure the violation prior to 30 days after
427
+ your receipt of the notice.
428
+
429
+ Termination of your rights under this section does not terminate the
430
+ licenses of parties who have received copies or rights from you under
431
+ this License. If your rights have been terminated and not permanently
432
+ reinstated, you do not qualify to receive new licenses for the same
433
+ material under section 10.
434
+
435
+ 9. Acceptance Not Required for Having Copies.
436
+
437
+ You are not required to accept this License in order to receive or
438
+ run a copy of the Program. Ancillary propagation of a covered work
439
+ occurring solely as a consequence of using peer-to-peer transmission
440
+ to receive a copy likewise does not require acceptance. However,
441
+ nothing other than this License grants you permission to propagate or
442
+ modify any covered work. These actions infringe copyright if you do
443
+ not accept this License. Therefore, by modifying or propagating a
444
+ covered work, you indicate your acceptance of this License to do so.
445
+
446
+ 10. Automatic Licensing of Downstream Recipients.
447
+
448
+ Each time you convey a covered work, the recipient automatically
449
+ receives a license from the original licensors, to run, modify and
450
+ propagate that work, subject to this License. You are not responsible
451
+ for enforcing compliance by third parties with this License.
452
+
453
+ An "entity transaction" is a transaction transferring control of an
454
+ organization, or substantially all assets of one, or subdividing an
455
+ organization, or merging organizations. If propagation of a covered
456
+ work results from an entity transaction, each party to that
457
+ transaction who receives a copy of the work also receives whatever
458
+ licenses to the work the party's predecessor in interest had or could
459
+ give under the previous paragraph, plus a right to possession of the
460
+ Corresponding Source of the work from the predecessor in interest, if
461
+ the predecessor has it or can get it with reasonable efforts.
462
+
463
+ You may not impose any further restrictions on the exercise of the
464
+ rights granted or affirmed under this License. For example, you may
465
+ not impose a license fee, royalty, or other charge for exercise of
466
+ rights granted under this License, and you may not initiate litigation
467
+ (including a cross-claim or counterclaim in a lawsuit) alleging that
468
+ any patent claim is infringed by making, using, selling, offering for
469
+ sale, or importing the Program or any portion of it.
470
+
471
+ 11. Patents.
472
+
473
+ A "contributor" is a copyright holder who authorizes use under this
474
+ License of the Program or a work on which the Program is based. The
475
+ work thus licensed is called the contributor's "contributor version".
476
+
477
+ A contributor's "essential patent claims" are all patent claims
478
+ owned or controlled by the contributor, whether already acquired or
479
+ hereafter acquired, that would be infringed by some manner, permitted
480
+ by this License, of making, using, or selling its contributor version,
481
+ but do not include claims that would be infringed only as a
482
+ consequence of further modification of the contributor version. For
483
+ purposes of this definition, "control" includes the right to grant
484
+ patent sublicenses in a manner consistent with the requirements of
485
+ this License.
486
+
487
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
488
+ patent license under the contributor's essential patent claims, to
489
+ make, use, sell, offer for sale, import and otherwise run, modify and
490
+ propagate the contents of its contributor version.
491
+
492
+ In the following three paragraphs, a "patent license" is any express
493
+ agreement or commitment, however denominated, not to enforce a patent
494
+ (such as an express permission to practice a patent or covenant not to
495
+ sue for patent infringement). To "grant" such a patent license to a
496
+ party means to make such an agreement or commitment not to enforce a
497
+ patent against the party.
498
+
499
+ If you convey a covered work, knowingly relying on a patent license,
500
+ and the Corresponding Source of the work is not available for anyone
501
+ to copy, free of charge and under the terms of this License, through a
502
+ publicly available network server or other readily accessible means,
503
+ then you must either (1) cause the Corresponding Source to be so
504
+ available, or (2) arrange to deprive yourself of the benefit of the
505
+ patent license for this particular work, or (3) arrange, in a manner
506
+ consistent with the requirements of this License, to extend the patent
507
+ license to downstream recipients. "Knowingly relying" means you have
508
+ actual knowledge that, but for the patent license, your conveying the
509
+ covered work in a country, or your recipient's use of the covered work
510
+ in a country, would infringe one or more identifiable patents in that
511
+ country that you have reason to believe are valid.
512
+
513
+ If, pursuant to or in connection with a single transaction or
514
+ arrangement, you convey, or propagate by procuring conveyance of, a
515
+ covered work, and grant a patent license to some of the parties
516
+ receiving the covered work authorizing them to use, propagate, modify
517
+ or convey a specific copy of the covered work, then the patent license
518
+ you grant is automatically extended to all recipients of the covered
519
+ work and works based on it.
520
+
521
+ A patent license is "discriminatory" if it does not include within
522
+ the scope of its coverage, prohibits the exercise of, or is
523
+ conditioned on the non-exercise of one or more of the rights that are
524
+ specifically granted under this License. You may not convey a covered
525
+ work if you are a party to an arrangement with a third party that is
526
+ in the business of distributing software, under which you make payment
527
+ to the third party based on the extent of your activity of conveying
528
+ the work, and under which the third party grants, to any of the
529
+ parties who would receive the covered work from you, a discriminatory
530
+ patent license (a) in connection with copies of the covered work
531
+ conveyed by you (or copies made from those copies), or (b) primarily
532
+ for and in connection with specific products or compilations that
533
+ contain the covered work, unless you entered into that arrangement,
534
+ or that patent license was granted, prior to 28 March 2007.
535
+
536
+ Nothing in this License shall be construed as excluding or limiting
537
+ any implied license or other defenses to infringement that may
538
+ otherwise be available to you under applicable patent law.
539
+
540
+ 12. No Surrender of Others' Freedom.
541
+
542
+ If conditions are imposed on you (whether by court order, agreement or
543
+ otherwise) that contradict the conditions of this License, they do not
544
+ excuse you from the conditions of this License. If you cannot convey a
545
+ covered work so as to satisfy simultaneously your obligations under this
546
+ License and any other pertinent obligations, then as a consequence you may
547
+ not convey it at all. For example, if you agree to terms that obligate you
548
+ to collect a royalty for further conveying from those to whom you convey
549
+ the Program, the only way you could satisfy both those terms and this
550
+ License would be to refrain entirely from conveying the Program.
551
+
552
+ 13. Use with the GNU Affero General Public License.
553
+
554
+ Notwithstanding any other provision of this License, you have
555
+ permission to link or combine any covered work with a work licensed
556
+ under version 3 of the GNU Affero General Public License into a single
557
+ combined work, and to convey the resulting work. The terms of this
558
+ License will continue to apply to the part which is the covered work,
559
+ but the special requirements of the GNU Affero General Public License,
560
+ section 13, concerning interaction through a network will apply to the
561
+ combination as such.
562
+
563
+ 14. Revised Versions of this License.
564
+
565
+ The Free Software Foundation may publish revised and/or new versions of
566
+ the GNU General Public License from time to time. Such new versions will
567
+ be similar in spirit to the present version, but may differ in detail to
568
+ address new problems or concerns.
569
+
570
+ Each version is given a distinguishing version number. If the
571
+ Program specifies that a certain numbered version of the GNU General
572
+ Public License "or any later version" applies to it, you have the
573
+ option of following the terms and conditions either of that numbered
574
+ version or of any later version published by the Free Software
575
+ Foundation. If the Program does not specify a version number of the
576
+ GNU General Public License, you may choose any version ever published
577
+ by the Free Software Foundation.
578
+
579
+ If the Program specifies that a proxy can decide which future
580
+ versions of the GNU General Public License can be used, that proxy's
581
+ public statement of acceptance of a version permanently authorizes you
582
+ to choose that version for the Program.
583
+
584
+ Later license versions may give you additional or different
585
+ permissions. However, no additional obligations are imposed on any
586
+ author or copyright holder as a result of your choosing to follow a
587
+ later version.
588
+
589
+ 15. Disclaimer of Warranty.
590
+
591
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
592
+ APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
593
+ HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
594
+ OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
595
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
596
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
597
+ IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
598
+ ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
599
+
600
+ 16. Limitation of Liability.
601
+
602
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
603
+ WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
604
+ THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
605
+ GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
606
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
607
+ DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
608
+ PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
609
+ EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
610
+ SUCH DAMAGES.
611
+
612
+ 17. Interpretation of Sections 15 and 16.
613
+
614
+ If the disclaimer of warranty and limitation of liability provided
615
+ above cannot be given local legal effect according to their terms,
616
+ reviewing courts shall apply local law that most closely approximates
617
+ an absolute waiver of all civil liability in connection with the
618
+ Program, unless a warranty or assumption of liability accompanies a
619
+ copy of the Program in return for a fee.
620
+
621
+ END OF TERMS AND CONDITIONS
622
+
623
+ How to Apply These Terms to Your New Programs
624
+
625
+ If you develop a new program, and you want it to be of the greatest
626
+ possible use to the public, the best way to achieve this is to make it
627
+ free software which everyone can redistribute and change under these terms.
628
+
629
+ To do so, attach the following notices to the program. It is safest
630
+ to attach them to the start of each source file to most effectively
631
+ state the exclusion of warranty; and each file should have at least
632
+ the "copyright" line and a pointer to where the full notice is found.
633
+
634
+ <one line to give the program's name and a brief idea of what it does.>
635
+ Copyright (C) <year> <name of author>
636
+
637
+ This program is free software: you can redistribute it and/or modify
638
+ it under the terms of the GNU General Public License as published by
639
+ the Free Software Foundation, either version 3 of the License, or
640
+ (at your option) any later version.
641
+
642
+ This program is distributed in the hope that it will be useful,
643
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
644
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
645
+ GNU General Public License for more details.
646
+
647
+ You should have received a copy of the GNU General Public License
648
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
649
+
650
+ Also add information on how to contact you by electronic and paper mail.
651
+
652
+ If the program does terminal interaction, make it output a short
653
+ notice like this when it starts in an interactive mode:
654
+
655
+ <program> Copyright (C) <year> <name of author>
656
+ This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
657
+ This is free software, and you are welcome to redistribute it
658
+ under certain conditions; type `show c' for details.
659
+
660
+ The hypothetical commands `show w' and `show c' should show the appropriate
661
+ parts of the General Public License. Of course, your program's commands
662
+ might be different; for a GUI interface, you would use an "about box".
663
+
664
+ You should also get your employer (if you work as a programmer) or school,
665
+ if any, to sign a "copyright disclaimer" for the program, if necessary.
666
+ For more information on this, and how to apply and follow the GNU GPL, see
667
+ <http://www.gnu.org/licenses/>.
668
+
669
+ The GNU General Public License does not permit incorporating your program
670
+ into proprietary programs. If your program is a subroutine library, you
671
+ may consider it more useful to permit linking proprietary applications with
672
+ the library. If this is what you want to do, use the GNU Lesser General
673
+ Public License instead of this License. But first, please read
674
+ <http://www.gnu.org/philosophy/why-not-lgpl.html>.
qtranslate.css ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ //.hide{ display:none; }
2
+
3
+ /* Language switch buttons on post, category, tag editors */
4
+ .qtranxs-lang-switch-wrap
5
+ {
6
+ //margin: 10px 0;
7
+ margin: 0;
8
+ }
9
+
10
+ .qtranxs-lang-switch
11
+ {
12
+ border: 1px solid #ccc;
13
+ background-image: linear-gradient(to top,#e5e5e5,#f4f4f4);
14
+ //margin-top: 2px;
15
+ //padding: 8px;
16
+ padding: 0 0 2px 4px;
17
+ margin: 0 4px 0 0;
18
+ cursor: default;
19
+ display: inline-block;
20
+ }
21
+
22
+ .qtranxs-lang-switch.active
23
+ {
24
+ border-color: #888;
25
+ background-image: none;
26
+ background-color: #bbb;
27
+ color: #555;
28
+ }
29
+
30
+ .qtranxs-lang-switch>*
31
+ {
32
+ vertical-align: middle;
33
+ margin-right: 4px;
34
+ }
35
+
36
+ /* Language menu items
37
+
38
+ .qtranxs-lang-menu img
39
+ {
40
+ vertical-align: middle;
41
+ }
42
+
43
+ .qtranxs-lang-menu-item img
44
+ {
45
+ vertical-align: middle;
46
+ }
47
+ */
48
+
49
+ /* Admin bar language icons */
50
+
51
+ #wpadminbar #wp-admin-bar-language>div.ab-item
52
+ {
53
+ padding-right: 30px;
54
+ cursor: default;
55
+ }
56
+ #wpadminbar #wp-admin-bar-language>div.ab-item,
57
+ #wpadminbar #wp-admin-bar-language ul li
58
+ {
59
+ background-repeat: no-repeat;
60
+ background-position: right;
61
+ background-size: 22px;
62
+ }
63
+
64
+
65
+ /* qTranslate-X config page */
66
+
67
+ #qtranxs-languages-menu img {
68
+ vertical-align: middle;
69
+ }
70
+ .qtranxs-language-list td
71
+ {
72
+ vertical-align: middle;
73
+ }
74
+
75
+
76
+ /* qTranslate-X widget */
77
+
78
+ .top-widget
79
+ {
80
+ width: auto;
81
+ }
82
+ .qtranxs-widget ul li
83
+ {
84
+ display: inline;
85
+ list-style-type: none;
86
+ opacity: 0.5;
87
+ -o-transition: 1s ease opacity;
88
+ -moz-transition: 1s ease opacity;
89
+ -webkit-transition: 1s ease opacity;
90
+ transition: 1s ease opacity;
91
+ }
92
+ .qtranxs-widget ul
93
+ {
94
+ margin: 0;
95
+ }
96
+ .qtranxs-widget ul li.active
97
+ {
98
+ opacity: 0.8;
99
+ }
100
+ .qtranxs-widget ul li:hover
101
+ {
102
+ opacity: 1;
103
+ }
104
+ .qtranxs-widget img
105
+ {
106
+ box-shadow: none;
107
+ vertical-align: middle;
108
+ }
qtranslate.min.js ADDED
@@ -0,0 +1 @@
 
1
+ function qtranxj_get_cookie(e){for(var n=document.cookie.split(";"),a=0;a<n.length;a++){var t=n[a],r=t.split("=");if(r[0].trim()==e&&!(n.length<2))return r[1].trim()}return""}function qtranxj_isArray(e){return e.constructor.toString().indexOf("Array")>=0}function qtranxj_ce(e,n,a,t){var r=document.createElement(e);if(n)for(prop in n)r[prop]=n[prop];return a&&(t&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r)),r}function LanguageSwitch(e,n){function a(){var e=this;if(!e.lang)return void alert("qTranslate-X: This should not have happened: Please, report this incident to the developers: !tabSwitch.lang");if(i!==e.lang){i&&l[i].classList.remove("active"),i=e.lang,e.classList.add("active");for(var n=0;n<o.length;n++)o[n].call(this)}}var t=qTranslateConfig.enabled_languages,r=qTranslateConfig.language_name,i=n,l={},o=[];location.pathname.indexOf();for(var s=0;s<t.length;s++){var g=qTranslateConfig.WP_CONTENT_URL+qTranslateConfig.flag_location,u=t[s],c=qtranxj_ce("li",{lang:u,className:"qtranxs-lang-switch",onclick:a},e);qtranxj_ce("img",{src:g+qTranslateConfig.flag[u]},c),qtranxj_ce("span",{innerHTML:r[u]},c),l[u]=c,i==u&&c.classList.add("active")}this.getActiveLanguage=function(){return i},this.onSwitch=function(e){"function"==typeof e&&o.push(e)}}qtranxj_split=function(e){for(var n=new Object,a=0;a<qTranslateConfig.enabled_languages.length;a++){var t=qTranslateConfig.enabled_languages[a];n[t]=""}var r=/(<!--.*?-->)/gi,i=e.xsplit(r);if(!qtranxj_isArray(i))return n;var l,o;if(i.length>1)l=/<!--:([a-z]{2})-->/gi,o=/<!--:-->/gi;else{var s=/(\[:[a-z]{2}\])/gi;if(i=e.xsplit(s),!qtranxj_isArray(i))return n;l=/\[:([a-z]{2})\]/gi}if(!i.length)return n;if(1==i.length)for(var g=i[0],u=0;u<qTranslateConfig.enabled_languages.length;u++){var t=qTranslateConfig.enabled_languages[u];n[t]+=g}else for(var c,t=!1,a=0;a<i.length;a++){var g=i[a];g.length&&(null!=(c=l.exec(g))?t=c[1]:o&&o.test(g)?t=!1:t&&(n[t]+=g,t=!1))}for(var f=/(<!--more-->|<!--nextpage-->)+$/gi,a=0;a<n.length;a++)n[a]=n[a].replace(f,"");return n},qtranxj_join_c=function(e){for(var n="",a=0;a<qTranslateConfig.enabled_languages.length;a++){var t=qTranslateConfig.enabled_languages[a],r=e[t];r&&""!=r&&(n+="<!--:"+t+"-->",n+=r,n+="<!--:-->")}return n},qtranxj_join_b=function(e){for(var n="",a=0;a<qTranslateConfig.enabled_languages.length;a++){var t=qTranslateConfig.enabled_languages[a],r=e[t];r&&""!=r&&(n+="[:"+t+"]",n+=r)}return n},String.prototype.xsplit=function(e){if(3==="a~b".split(/(~)/).length)return this.split(e);e.global||(e=new RegExp(e.source,"g"+(e.ignoreCase?"i":"")));for(var n,a=0,t=[];null!=(n=e.exec(this));)t.push(this.slice(a,n.index)),n.length>1&&t.push(n[1]),a=e.lastIndex;return a<this.length&&t.push(this.slice(a)),a==this.length&&t.push(""),t};var qTranslateX=function(){function e(e){return document.getElementById(e)}function n(e,n){var a=g[e],t=languageSwitch.getActiveLanguage(),r=/(<!--more-->|<!--nextpage-->)+$/gi;a.contents[t]=n.replace(r,""),a.mlContentField.value="<"===a.separator?qtranxj_join_c(a.contents):qtranxj_join_b(a.contents)}function a(e,a,t){if(e){var r=g[e.id]={};r.contentField=e,r.contents=qtranxj_split(e.value),r.mlContentField=qtranxj_ce(e.tagName,{name:e.name,className:"hidden",value:e.value},a,!0),t||(t="TEXTAREA"===e.tagName?"<":"["),r.separator=t,e.name+="_edit",e.value=r.contents[s],e.onblur=function(){n(this.id,this.value)}}}function t(e,n){a(e,n,"<")}function r(e,n){a(e,n,"[")}function i(){var n,a,t=!!e("tag-name");t?(n="tag-",a="addtag"):(n="",a="edittag");var r=e(n+"name"),i=e(a);if(!i||!r)return!1;var l=qTranslateConfig.language;build_translator=function(e,n){var a={};for(var t in qTranslateConfig.term_name){var r=qTranslateConfig.term_name[t],i=r[e],l=r[n];if(!i||!l){var o=r[qTranslateConfig.default_language];if(!o)continue;i||(i=o+"("+qTranslateConfig.default_language+")"),l||(l=o+"("+qTranslateConfig.default_language+")")}a[i]=l}return a};var o=e("the-list");hideQuickEdit=function(){if(o)for(var e=o.getElementsByTagName("TR"),n=0;n<e.length;n++)for(var a=e[n],t=a.getElementsByTagName("TD")[0],r=t.getElementsByClassName("inline"),i=0;i<r.length;i++){var l=r[i];l.style.display="none"}},hideQuickEdit(),updateNames=function(e,n){if(o)for(var a=o.getElementsByTagName("TR"),t=0;t<a.length;t++){for(var r,i=a[t],s=i.getElementsByTagName("TD")[0],g=s.getElementsByTagName("DIV"),u=0;u<g.length;u++){var c=g[u];if("name"===c.className){r=c.innerHTML;break}}if(l!=qTranslateConfig.default_language){var f=build_translator(l,qTranslateConfig.default_language);r=f[r]}for(var d=qTranslateConfig.term_name[r]||{},h=d[e]||"",v=d[n]||"",m=s.getElementsByClassName("row-title"),p=0;p<m.length;p++){var c=m[p];h?c.innerHTML=c.innerHTML.replace(h,v):c.innerHTML+=v}}};var g=document.getElementsByClassName("tagcloud")[0];updateTagCloud=function(e,n){if(g){var a=g.getElementsByTagName("A");if(a.length)for(var t=build_translator(e,n),r=0;r<a.length;r++){var i=a[r],l=i.innerHTML,o=t[l];o&&(i.innerHTML=o)}}},updateNamesAndTagCloud=function(e,n){updateNames(e,n),updateTagCloud(e,n)},l!==s&&updateNamesAndTagCloud(l,s);var u=qtranxj_ce("input",{name:r.name,className:"hidden",value:r.value},i,!0);r.name="";var c=qTranslateConfig.term_name[r.value]||{};s!==qTranslateConfig.default_language&&(r.value=c[s]||""),editinline_activated=function(){return!0};for(var f=document.getElementsByClassName("editinline"),d=0;d<f.length;d++){var h=f[d];"A"===h.tagName&&h.addEventListener("click",editinline_activated)}onTabSwitch=function(){s!==this.lang&&(r.value=c[this.lang]||"",updateNamesAndTagCloud(s,this.lang),s=this.lang)};for(var v=qTranslateConfig.enabled_languages,m={},d=0;d<v.length;d++){var p=v[d];m[p]=qtranxj_ce("input",{name:"qtranx_term_"+p,className:"hidden",value:name[p]||""},i,!0)}return r.onblur=function(){var e=languageSwitch.getActiveLanguage();m[e].value=this.value,c[e]=this.value,e===qTranslateConfig.default_language&&(u.value=this.value)},!0}function l(){function i(e,n){switch(qTranslateConfig.url_mode.toString()){case"1":e.search?e.search+="&lang="+n:e.search="?lang="+n;break;case"2":var a=e.pathname.indexOf(qTranslateConfig.url_info.home);e.pathname=qTranslateConfig.url_info.home+n+e.pathname.substring(a+qTranslateConfig.url_info.home.length-1);break;case"3":e.host=n+"."+e.host}}function l(n){if(!C){var a=e("view-post-btn");if(!a||!a.children.length)return;if(C=a.children[0],"A"!=C.tagName)return;q=C.href,w=qtranxj_ce("a",{})}w.href=q,i(w,n),C.href=w.href;var t=e("preview-action");if(t&&t.children.length&&(t.children[0].href=w.href),1!=qTranslateConfig.url_mode){if(!x){var r=e("sample-permalink");r&&r.childNodes.length&&(x=r.childNodes[0],b=x.nodeValue)}x&&(w.href=b,i(w,n),x.nodeValue=w.href)}}function o(e){var a=e.id;if(a){var t=g[a];t.mce||(t.mce=e,e.getBody().addEventListener("blur",function(){n(e.id,e.getContent())}))}}var u=e("post");if(!u)return!1;var c=e("title");c&&t(c,u);for(var f=u.getElementsByClassName("wp-editor-area"),d=0;d<f.length;++d){var h=f[d];t(h,u)}var v=e("attachment_caption");v&&t(v,u);for(var d=0;d<qTranslateConfig.custom_fields.length;++d){var m,p=qTranslateConfig.custom_fields[d];(0==p.indexOf("<")||0==p.indexOf("["))&&(m=p.substring(0,1),p=p.substring(1));var _=e(p);a(_,u,m)}var T=e("attachment_alt");T&&r(T,u);var C,q,w,x,b;return l(s),onTabSwitch=function(){for(var e in g){var n=g[e];n.contentField.value=n.contents[this.lang]}if(T&&(T.value=alttexts[this.lang]),l(this.lang),window.tinyMCE)for(var a=0;a<tinyMCE.editors.length;++a){var t=tinyMCE.editors[a],n=g[t.id];n&&t.setContent(n.contentField.value)}},window.addEventListener("load",function(){if(window.tinyMCE){for(var e=0;e<tinyMCE.editors.length;++e){var n=tinyMCE.editors[e];o(n)}for(var a in g){var t=g[a];t.mce||"TEXTAREA"===t.contentField.tagName&&(tinyMCEPreInit.mceInit[a].init_instance_callback=function(e){o(e)})}}}),!0}function o(){var n=document.getElementsByTagName("FORM");if(!n.length)return!1;var a=n[0];return r(e("blogname"),a),r(e("blogdescription"),a),onTabSwitch=function(){for(var e in g){var n=g[e];n.contentField.value=n.contents[this.lang]}},!0}var s=qtranxj_get_cookie("qtrans_edit_language");s||(s=qTranslateConfig.language);var g={};setLangCookie=function(){document.cookie="qtrans_edit_language="+this.lang};var u=location.pathname.match(/(\/wp-admin\/([^\/]*))$/);switch(u&&u[1]){case"/wp-admin/post.php":case"/wp-admin/post-new.php":if(!l())return;break;case"/wp-admin/edit-tags.php":if(!i())return;break;case"/wp-admin/options-general.php":if(location.search.indexOf("page=")>=0)return;if(!o())return;break;default:return}var c=qtranxj_ce("ul",{className:"qtranxs-lang-switch-wrap"}),f=document.getElementsByClassName("wrap")[0],d=f.getElementsByTagName("form")[0];d.parentNode.insertBefore(c,d),languageSwitch=new LanguageSwitch(c,s),languageSwitch.onSwitch(onTabSwitch),languageSwitch.onSwitch(setLangCookie)};new qTranslateX;
qtranslate.php ADDED
@@ -0,0 +1,503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // encoding: utf-8
2
+ /**
3
+ Plugin Name: qTranslate-X
4
+ Plugin URI: http://wordpress.org/plugins/qtranslate-x/
5
+ Description: Adds user-friendly and database-friendly multilingual content support into WordPress.
6
+ Version: 2.7.8
7
+ Author: John Clause based on original code by Qian Qin
8
+ Author URI: http://qtranslatexteam.wordpress.com/about
9
+ Tags: multilingual, multi, language, admin, tinymce, Polyglot, bilingual, widget, switcher, professional, human, translation, service, qTranslate, zTranslate, mqTranslate, qTranslate Plus, WPML
10
+ License: GPL2
11
+ Author e-mail: qTranslateTeam@gmail.com
12
+ Original Author: Qian Qin (http://www.qianqin.de mail@qianqin.de)
13
+ */
14
+ /* Unused keywords (as described in http://codex.wordpress.org/Writing_a_Plugin):
15
+ * Text Domain: Optional. Plugin's text domain for localization. Example: mytextdomain
16
+ * Domain Path: Optional. Plugin's relative directory path to .mo files. Example: /locale/
17
+ * Network: Optional. Whether the plugin can only be activated network wide. Example: true
18
+ */
19
+ /*
20
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
21
+
22
+ This program is free software; you can redistribute it and/or modify
23
+ it under the terms of the GNU General Public License as published by
24
+ the Free Software Foundation; either version 2 of the License, or
25
+ (at your option) any later version.
26
+
27
+ This program is distributed in the hope that it will be useful,
28
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
29
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
30
+ GNU General Public License for more details.
31
+
32
+ You should have received a copy of the GNU General Public License
33
+ along with this program; if not, write to the Free Software
34
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
35
+ */
36
+ /*
37
+ Most flags in flags directory are made by Luc Balemans and downloaded from
38
+ FOTW Flags Of The World website at http://flagspot.net/flags/
39
+ (http://www.crwflags.com/FOTW/FLAGS/wflags.html)
40
+ */
41
+ /*
42
+ Default Language Contributers
43
+ =============================
44
+ en, de by Qian Qin
45
+ zh by Junyan Chen
46
+ fi by Tatu Siltanen
47
+ fr by Damien Choizit
48
+ nl by RobV
49
+ sv by bear3556, johdah
50
+ it by Lorenzo De Tomasi
51
+ ro, hu by Jani Monoses
52
+ ja by Brian Parker
53
+ es by June
54
+ vi by hathhai
55
+ ar by Mohamed Magdy
56
+ pt by netolazaro
57
+ gl by Andrés Bott
58
+
59
+ Plugin Translation Contributers
60
+ ===============================
61
+ en, de by Qian Qin
62
+ es_ES by Alejandro Urrutia
63
+ fr by eriath
64
+ tr by freeuser
65
+ it by shecky
66
+ nl by BlackDex
67
+ id by Masino Sinaga
68
+ pt by claudiotereso
69
+ az by evlenirikbiz
70
+ bg by Dimitar Mitev
71
+ da by meviper
72
+ mk by Pavle Boskoski
73
+ cz by bengo
74
+ ja by dapperdanman1400
75
+ ms by webgrrrl
76
+ es_CA by CarlosSanz
77
+ hu by nb000
78
+ zh_CN by silverfox
79
+ eo by Chuck Smith
80
+ pt_BR by Marcelo Paoli
81
+ ru by viaestvita
82
+ ro by ipuiu
83
+ sv by tobi
84
+
85
+ Sponsored Features
86
+ ==================
87
+ Excerpt Translation by bastiaan van rooden (www.nothing.ch)
88
+
89
+ Specials thanks
90
+ ===============
91
+ All Supporters! Thanks for all the gifts, cards and donations!
92
+ */
93
+
94
+ if ( ! function_exists( 'add_filter' ) ) {
95
+ header( 'Status: 403 Forbidden' );
96
+ header( 'HTTP/1.1 403 Forbidden' );
97
+ exit();
98
+ }
99
+
100
+ if ( ! defined( 'QTRANSLATE_FILE' ) ) {
101
+ define( 'QTRANSLATE_FILE', __FILE__ );
102
+ }
103
+
104
+ /* DEFAULT CONFIGURATION PART BEGINS HERE */
105
+
106
+ /* There is no need to edit anything here! */
107
+
108
+ define('QTX_STRING', 1);
109
+ define('QTX_BOOLEAN', 2);
110
+ define('QTX_INTEGER', 3);
111
+ define('QTX_URL', 4);
112
+ define('QTX_LANGUAGE', 5);
113
+ define('QTX_ARRAY', 6);
114
+
115
+ define('QTX_URL_QUERY', 1);
116
+ define('QTX_URL_PATH', 2);
117
+ define('QTX_URL_DOMAIN', 3);
118
+
119
+ define('QTX_STRFTIME_OVERRIDE', 1);
120
+ define('QTX_DATE_OVERRIDE', 2);
121
+ define('QTX_DATE', 3);
122
+ define('QTX_STRFTIME', 4);
123
+
124
+ $q_config = array();
125
+
126
+ // enable the use of following languages (order=>language)
127
+ $q_config['enabled_languages'] = array(
128
+ '0' => 'de',
129
+ '1' => 'en',
130
+ '2' => 'zh'
131
+ );
132
+
133
+ // sets default language
134
+ $q_config['default_language'] = 'en';
135
+
136
+ // enables browser language detection
137
+ $q_config['detect_browser_language'] = true;
138
+
139
+ // hide pages without content
140
+ $q_config['hide_untranslated'] = false;
141
+
142
+ // automatically update .mo files
143
+ $q_config['auto_update_mo'] = true;
144
+
145
+ // hide language tag for default language
146
+ $q_config['hide_default_language'] = true;
147
+
148
+ // sets default url mode
149
+ // QTX_URL_QUERY(1) - query (questionmark)
150
+ // QTX_URL_PATH(2) - pre-path
151
+ // QTX_URL_DOMAIN(3) - pre-domain
152
+ $q_config['url_mode'] = QTX_URL_PATH;
153
+
154
+ // pre-Domain Endings - for future use
155
+ $q_config['pre_domain']['de'] = "de";
156
+ $q_config['pre_domain']['en'] = "en";
157
+ $q_config['pre_domain']['zh'] = "zh";
158
+ $q_config['pre_domain']['ru'] = "ru";
159
+ $q_config['pre_domain']['fi'] = "fs";
160
+ $q_config['pre_domain']['fr'] = "fr";
161
+ $q_config['pre_domain']['nl'] = "nl";
162
+ $q_config['pre_domain']['sv'] = "sv";
163
+ $q_config['pre_domain']['it'] = "it";
164
+ $q_config['pre_domain']['ro'] = "ro";
165
+ $q_config['pre_domain']['hu'] = "hu";
166
+ $q_config['pre_domain']['ja'] = "ja";
167
+ $q_config['pre_domain']['es'] = "es";
168
+ $q_config['pre_domain']['vi'] = "vi";
169
+ $q_config['pre_domain']['ar'] = "ar";
170
+ $q_config['pre_domain']['pt'] = "pt";
171
+ $q_config['pre_domain']['pl'] = "pl";
172
+ $q_config['pre_domain']['gl'] = "gl";
173
+ $q_config['pre_domain']['tr'] = "tr";
174
+
175
+ // Names for languages in the corresponding language, add more if needed
176
+ $q_config['language_name']['de'] = "Deutsch";
177
+ $q_config['language_name']['en'] = "English";
178
+ $q_config['language_name']['zh'] = "中文";
179
+ $q_config['language_name']['ru'] = "Русский";
180
+ $q_config['language_name']['fi'] = "suomi";
181
+ $q_config['language_name']['fr'] = "Français";
182
+ $q_config['language_name']['nl'] = "Nederlands";
183
+ $q_config['language_name']['sv'] = "Svenska";
184
+ $q_config['language_name']['it'] = "Italiano";
185
+ $q_config['language_name']['ro'] = "Română";
186
+ $q_config['language_name']['hu'] = "Magyar";
187
+ $q_config['language_name']['ja'] = "日本語";
188
+ $q_config['language_name']['es'] = "Español";
189
+ $q_config['language_name']['vi'] = "Tiếng Việt";
190
+ $q_config['language_name']['ar'] = "العربية";
191
+ $q_config['language_name']['pt'] = "Português";
192
+ $q_config['language_name']['pl'] = "Polski";
193
+ $q_config['language_name']['gl'] = "galego";
194
+ $q_config['language_name']['tr'] = "Turkish";
195
+
196
+ // Locales for languages
197
+ // see locale -a for available locales
198
+ $q_config['locale']['de'] = "de_DE";
199
+ $q_config['locale']['en'] = "en_US";
200
+ $q_config['locale']['zh'] = "zh_CN";
201
+ $q_config['locale']['ru'] = "ru_RU";
202
+ $q_config['locale']['fi'] = "fi";
203
+ $q_config['locale']['fr'] = "fr_FR";
204
+ $q_config['locale']['nl'] = "nl_NL";
205
+ $q_config['locale']['sv'] = "sv_SE";
206
+ $q_config['locale']['it'] = "it_IT";
207
+ $q_config['locale']['ro'] = "ro_RO";
208
+ $q_config['locale']['hu'] = "hu_HU";
209
+ $q_config['locale']['ja'] = "ja";
210
+ $q_config['locale']['es'] = "es_ES";
211
+ $q_config['locale']['vi'] = "vi";
212
+ $q_config['locale']['ar'] = "ar";
213
+ $q_config['locale']['pt'] = "pt_BR";
214
+ $q_config['locale']['pl'] = "pl_PL";
215
+ $q_config['locale']['gl'] = "gl_ES";
216
+ $q_config['locale']['tr'] = "tr_TR";
217
+
218
+ // Language not available messages
219
+ // %LANG:<normal_seperator>:<last_seperator>% generates a list of languages seperated by <normal_seperator> except for the last one, where <last_seperator> will be used instead.
220
+ $q_config['not_available']['de'] = "Leider ist der Eintrag nur auf %LANG:, : und % verfügbar.";
221
+ $q_config['not_available']['en'] = "Sorry, this entry is only available in %LANG:, : and %.";
222
+ $q_config['not_available']['zh'] = "对不起,此内容只适用于%LANG:,:和%。";
223
+ $q_config['not_available']['ru'] = "Извините, этот техт доступен только в %LANG:, : и %.";
224
+ $q_config['not_available']['fi'] = "Anteeksi, mutta tämä kirjoitus on saatavana ainoastaan näillä kielillä: %LANG:, : ja %.";
225
+ $q_config['not_available']['fr'] = "Désolé, cet article est seulement disponible en %LANG:, : et %.";
226
+ $q_config['not_available']['nl'] = "Onze verontschuldigingen, dit bericht is alleen beschikbaar in %LANG:, : en %.";
227
+ $q_config['not_available']['sv'] = "Tyvärr är denna artikel enbart tillgänglig på %LANG:, : och %.";
228
+ $q_config['not_available']['it'] = "Ci spiace, ma questo articolo è disponibile soltanto in %LANG:, : e %.";
229
+ $q_config['not_available']['ro'] = "Din păcate acest articol este disponibil doar în %LANG:, : și %.";
230
+ $q_config['not_available']['hu'] = "Sajnos ennek a bejegyzésnek csak %LANG:, : és % nyelvű változata van.";
231
+ $q_config['not_available']['ja'] = "申し訳ありません、このコンテンツはただ今 %LANG:、 :と % のみです。";
232
+ $q_config['not_available']['es'] = "Disculpa, pero esta entrada está disponible sólo en %LANG:, : y %.";
233
+ $q_config['not_available']['vi'] = "Rất tiếc, mục này chỉ tồn tại ở %LANG:, : và %.";
234
+ $q_config['not_available']['ar'] = "عفوا، هذه المدخلة موجودة فقط في %LANG:, : و %.";
235
+ $q_config['not_available']['pt'] = "Desculpe-nos, mas este texto esta apenas disponível em %LANG:, : y %.";
236
+ $q_config['not_available']['pl'] = "Przepraszamy, ten wpis jest dostępny tylko w języku %LANG:, : i %.";
237
+ $q_config['not_available']['gl'] = "Sentímolo moito, ista entrada atopase unicamente en %LANG;,: e %.";
238
+ $q_config['not_available']['tr'] = "Sorry, this entry is only available in %LANG:, : and %.";
239
+
240
+ // qTranslate Services
241
+ $q_config['qtranslate_services'] = false;
242
+
243
+ // strftime usage (backward compability)
244
+ $q_config['use_strftime'] = QTX_DATE;
245
+
246
+ // Date Configuration
247
+ $q_config['date_format']['en'] = '%A %B %e%q, %Y';
248
+ $q_config['date_format']['de'] = '%A, der %e. %B %Y';
249
+ $q_config['date_format']['zh'] = '%x %A';
250
+ $q_config['date_format']['ru'] = '%A %B %e%q, %Y';
251
+ $q_config['date_format']['fi'] = '%e.&m.%C';
252
+ $q_config['date_format']['fr'] = '%A %e %B %Y';
253
+ $q_config['date_format']['nl'] = '%d/%m/%y';
254
+ $q_config['date_format']['sv'] = '%Y/%m/%d';
255
+ $q_config['date_format']['it'] = '%e %B %Y';
256
+ $q_config['date_format']['ro'] = '%A, %e %B %Y';
257
+ $q_config['date_format']['hu'] = '%Y %B %e, %A';
258
+ $q_config['date_format']['ja'] = '%Y年%m月%d日';
259
+ $q_config['date_format']['es'] = '%d de %B de %Y';
260
+ $q_config['date_format']['vi'] = '%d/%m/%Y';
261
+ $q_config['date_format']['ar'] = '%d/%m/%Y';
262
+ $q_config['date_format']['pt'] = '%d de %B de %Y';
263
+ $q_config['date_format']['pl'] = '%d/%m/%y';
264
+ $q_config['date_format']['gl'] = '%d de %B de %Y';
265
+ $q_config['date_format']['tr'] = '%A %B %e%q, %Y';
266
+
267
+ $q_config['time_format']['en'] = '%I:%M %p';
268
+ $q_config['time_format']['de'] = '%H:%M';
269
+ $q_config['time_format']['zh'] = '%I:%M%p';
270
+ $q_config['time_format']['ru'] = '%H:%M';
271
+ $q_config['time_format']['fi'] = '%H:%M';
272
+ $q_config['time_format']['fr'] = '%H:%M';
273
+ $q_config['time_format']['nl'] = '%H:%M';
274
+ $q_config['time_format']['sv'] = '%H:%M';
275
+ $q_config['time_format']['it'] = '%H:%M';
276
+ $q_config['time_format']['ro'] = '%H:%M';
277
+ $q_config['time_format']['hu'] = '%H:%M';
278
+ $q_config['time_format']['ja'] = '%H:%M';
279
+ $q_config['time_format']['es'] = '%H:%M hrs.';
280
+ $q_config['time_format']['vi'] = '%H:%M';
281
+ $q_config['time_format']['ar'] = '%H:%M';
282
+ $q_config['time_format']['pt'] = '%H:%M hrs.';
283
+ $q_config['time_format']['pl'] = '%H:%M';
284
+ $q_config['time_format']['gl'] = '%H:%M hrs.';
285
+ $q_config['time_format']['tr'] = '%H:%M';
286
+
287
+ // Flag images configuration
288
+ // Look in /flags/ directory for a huge list of flags for usage
289
+ $q_config['flag']['en'] = 'gb.png';
290
+ $q_config['flag']['de'] = 'de.png';
291
+ $q_config['flag']['zh'] = 'cn.png';
292
+ $q_config['flag']['ru'] = 'ru.png';
293
+ $q_config['flag']['fi'] = 'fi.png';
294
+ $q_config['flag']['fr'] = 'fr.png';
295
+ $q_config['flag']['nl'] = 'nl.png';
296
+ $q_config['flag']['sv'] = 'se.png';
297
+ $q_config['flag']['it'] = 'it.png';
298
+ $q_config['flag']['ro'] = 'ro.png';
299
+ $q_config['flag']['hu'] = 'hu.png';
300
+ $q_config['flag']['ja'] = 'jp.png';
301
+ $q_config['flag']['es'] = 'es.png';
302
+ $q_config['flag']['vi'] = 'vn.png';
303
+ $q_config['flag']['ar'] = 'arle.png';
304
+ $q_config['flag']['pt'] = 'br.png';
305
+ $q_config['flag']['pl'] = 'pl.png';
306
+ $q_config['flag']['gl'] = 'galego.png';
307
+ $q_config['flag']['tr'] = 'tr.png';
308
+
309
+ // Location of flags (needs trailing slash!)
310
+ $q_config['flag_location'] = 'plugins/qtranslate-x/flags/';
311
+
312
+ // Don't convert URLs to this file types
313
+ $q_config['ignore_file_types'] = 'gif,jpg,jpeg,png,pdf,swf,tif,rar,zip,7z,mpg,divx,mpeg,avi,css,js';
314
+
315
+ /* DEFAULT CONFIGURATION PART ENDS HERE */
316
+
317
+ $q_config['term_name'] = array();
318
+
319
+ // Full country names as locales for Windows systems
320
+ $q_config['windows_locale']['aa'] = "Afar";
321
+ $q_config['windows_locale']['ab'] = "Abkhazian";
322
+ $q_config['windows_locale']['ae'] = "Avestan";
323
+ $q_config['windows_locale']['af'] = "Afrikaans";
324
+ $q_config['windows_locale']['am'] = "Amharic";
325
+ $q_config['windows_locale']['ar'] = "Arabic";
326
+ $q_config['windows_locale']['as'] = "Assamese";
327
+ $q_config['windows_locale']['ay'] = "Aymara";
328
+ $q_config['windows_locale']['az'] = "Azerbaijani";
329
+ $q_config['windows_locale']['ba'] = "Bashkir";
330
+ $q_config['windows_locale']['be'] = "Belarusian";
331
+ $q_config['windows_locale']['bg'] = "Bulgarian";
332
+ $q_config['windows_locale']['bh'] = "Bihari";
333
+ $q_config['windows_locale']['bi'] = "Bislama";
334
+ $q_config['windows_locale']['bn'] = "Bengali";
335
+ $q_config['windows_locale']['bo'] = "Tibetan";
336
+ $q_config['windows_locale']['br'] = "Breton";
337
+ $q_config['windows_locale']['bs'] = "Bosnian";
338
+ $q_config['windows_locale']['ca'] = "Catalan";
339
+ $q_config['windows_locale']['ce'] = "Chechen";
340
+ $q_config['windows_locale']['ch'] = "Chamorro";
341
+ $q_config['windows_locale']['co'] = "Corsican";
342
+ $q_config['windows_locale']['cs'] = "Czech";
343
+ $q_config['windows_locale']['cu'] = "Church Slavic";
344
+ $q_config['windows_locale']['cv'] = "Chuvash";
345
+ $q_config['windows_locale']['cy'] = "Welsh";
346
+ $q_config['windows_locale']['da'] = "Danish";
347
+ $q_config['windows_locale']['de'] = "German";
348
+ $q_config['windows_locale']['dz'] = "Dzongkha";
349
+ $q_config['windows_locale']['el'] = "Greek";
350
+ $q_config['windows_locale']['en'] = "English";
351
+ $q_config['windows_locale']['eo'] = "Esperanto";
352
+ $q_config['windows_locale']['es'] = "Spanish";
353
+ $q_config['windows_locale']['et'] = "Estonian";
354
+ $q_config['windows_locale']['eu'] = "Basque";
355
+ $q_config['windows_locale']['fa'] = "Persian";
356
+ $q_config['windows_locale']['fi'] = "Finnish";
357
+ $q_config['windows_locale']['fj'] = "Fijian";
358
+ $q_config['windows_locale']['fo'] = "Faeroese";
359
+ $q_config['windows_locale']['fr'] = "French";
360
+ $q_config['windows_locale']['fy'] = "Frisian";
361
+ $q_config['windows_locale']['ga'] = "Irish";
362
+ $q_config['windows_locale']['gd'] = "Gaelic (Scots)";
363
+ $q_config['windows_locale']['gl'] = "Gallegan";
364
+ $q_config['windows_locale']['gn'] = "Guarani";
365
+ $q_config['windows_locale']['gu'] = "Gujarati";
366
+ $q_config['windows_locale']['gv'] = "Manx";
367
+ $q_config['windows_locale']['ha'] = "Hausa";
368
+ $q_config['windows_locale']['he'] = "Hebrew";
369
+ $q_config['windows_locale']['hi'] = "Hindi";
370
+ $q_config['windows_locale']['ho'] = "Hiri Motu";
371
+ $q_config['windows_locale']['hr'] = "Croatian";
372
+ $q_config['windows_locale']['hu'] = "Hungarian";
373
+ $q_config['windows_locale']['hy'] = "Armenian";
374
+ $q_config['windows_locale']['hz'] = "Herero";
375
+ $q_config['windows_locale']['ia'] = "Interlingua";
376
+ $q_config['windows_locale']['id'] = "Indonesian";
377
+ $q_config['windows_locale']['ie'] = "Interlingue";
378
+ $q_config['windows_locale']['ik'] = "Inupiaq";
379
+ $q_config['windows_locale']['is'] = "Icelandic";
380
+ $q_config['windows_locale']['it'] = "Italian";
381
+ $q_config['windows_locale']['iu'] = "Inuktitut";
382
+ $q_config['windows_locale']['ja'] = "Japanese";
383
+ $q_config['windows_locale']['jw'] = "Javanese";
384
+ $q_config['windows_locale']['ka'] = "Georgian";
385
+ $q_config['windows_locale']['ki'] = "Kikuyu";
386
+ $q_config['windows_locale']['kj'] = "Kuanyama";
387
+ $q_config['windows_locale']['kk'] = "Kazakh";
388
+ $q_config['windows_locale']['kl'] = "Kalaallisut";
389
+ $q_config['windows_locale']['km'] = "Khmer";
390
+ $q_config['windows_locale']['kn'] = "Kannada";
391
+ $q_config['windows_locale']['ko'] = "Korean";
392
+ $q_config['windows_locale']['ks'] = "Kashmiri";
393
+ $q_config['windows_locale']['ku'] = "Kurdish";
394
+ $q_config['windows_locale']['kv'] = "Komi";
395
+ $q_config['windows_locale']['kw'] = "Cornish";
396
+ $q_config['windows_locale']['ky'] = "Kirghiz";
397
+ $q_config['windows_locale']['la'] = "Latin";
398
+ $q_config['windows_locale']['lb'] = "Letzeburgesch";
399
+ $q_config['windows_locale']['ln'] = "Lingala";
400
+ $q_config['windows_locale']['lo'] = "Lao";
401
+ $q_config['windows_locale']['lt'] = "Lithuanian";
402
+ $q_config['windows_locale']['lv'] = "Latvian";
403
+ $q_config['windows_locale']['mg'] = "Malagasy";
404
+ $q_config['windows_locale']['mh'] = "Marshall";
405
+ $q_config['windows_locale']['mi'] = "Maori";
406
+ $q_config['windows_locale']['mk'] = "Macedonian";
407
+ $q_config['windows_locale']['ml'] = "Malayalam";
408
+ $q_config['windows_locale']['mn'] = "Mongolian";
409
+ $q_config['windows_locale']['mo'] = "Moldavian";
410
+ $q_config['windows_locale']['mr'] = "Marathi";
411
+ $q_config['windows_locale']['ms'] = "Malay";
412
+ $q_config['windows_locale']['mt'] = "Maltese";
413
+ $q_config['windows_locale']['my'] = "Burmese";
414
+ $q_config['windows_locale']['na'] = "Nauru";
415
+ $q_config['windows_locale']['nb'] = "Norwegian Bokmal";
416
+ $q_config['windows_locale']['nd'] = "Ndebele, North";
417
+ $q_config['windows_locale']['ne'] = "Nepali";
418
+ $q_config['windows_locale']['ng'] = "Ndonga";
419
+ $q_config['windows_locale']['nl'] = "Dutch";
420
+ $q_config['windows_locale']['nn'] = "Norwegian Nynorsk";
421
+ $q_config['windows_locale']['no'] = "Norwegian";
422
+ $q_config['windows_locale']['nr'] = "Ndebele, South";
423
+ $q_config['windows_locale']['nv'] = "Navajo";
424
+ $q_config['windows_locale']['ny'] = "Chichewa; Nyanja";
425
+ $q_config['windows_locale']['oc'] = "Occitan (post 1500)";
426
+ $q_config['windows_locale']['om'] = "Oromo";
427
+ $q_config['windows_locale']['or'] = "Oriya";
428
+ $q_config['windows_locale']['os'] = "Ossetian; Ossetic";
429
+ $q_config['windows_locale']['pa'] = "Panjabi";
430
+ $q_config['windows_locale']['pi'] = "Pali";
431
+ $q_config['windows_locale']['pl'] = "Polish";
432
+ $q_config['windows_locale']['ps'] = "Pushto";
433
+ $q_config['windows_locale']['pt'] = "Portuguese";
434
+ $q_config['windows_locale']['qu'] = "Quechua";
435
+ $q_config['windows_locale']['rm'] = "Rhaeto-Romance";
436
+ $q_config['windows_locale']['rn'] = "Rundi";
437
+ $q_config['windows_locale']['ro'] = "Romanian";
438
+ $q_config['windows_locale']['ru'] = "Russian";
439
+ $q_config['windows_locale']['rw'] = "Kinyarwanda";
440
+ $q_config['windows_locale']['sa'] = "Sanskrit";
441
+ $q_config['windows_locale']['sc'] = "Sardinian";
442
+ $q_config['windows_locale']['sd'] = "Sindhi";
443
+ $q_config['windows_locale']['se'] = "Sami";
444
+ $q_config['windows_locale']['sg'] = "Sango";
445
+ $q_config['windows_locale']['si'] = "Sinhalese";
446
+ $q_config['windows_locale']['sk'] = "Slovak";
447
+ $q_config['windows_locale']['sl'] = "Slovenian";
448
+ $q_config['windows_locale']['sm'] = "Samoan";
449
+ $q_config['windows_locale']['sn'] = "Shona";
450
+ $q_config['windows_locale']['so'] = "Somali";
451
+ $q_config['windows_locale']['sq'] = "Albanian";
452
+ $q_config['windows_locale']['sr'] = "Serbian";
453
+ $q_config['windows_locale']['ss'] = "Swati";
454
+ $q_config['windows_locale']['st'] = "Sotho";
455
+ $q_config['windows_locale']['su'] = "Sundanese";
456
+ $q_config['windows_locale']['sv'] = "Swedish";
457
+ $q_config['windows_locale']['sw'] = "Swahili";
458
+ $q_config['windows_locale']['ta'] = "Tamil";
459
+ $q_config['windows_locale']['te'] = "Telugu";
460
+ $q_config['windows_locale']['tg'] = "Tajik";
461
+ $q_config['windows_locale']['th'] = "Thai";
462
+ $q_config['windows_locale']['ti'] = "Tigrinya";
463
+ $q_config['windows_locale']['tk'] = "Turkmen";
464
+ $q_config['windows_locale']['tl'] = "Tagalog";
465
+ $q_config['windows_locale']['tn'] = "Tswana";
466
+ $q_config['windows_locale']['to'] = "Tonga";
467
+ $q_config['windows_locale']['tr'] = "Turkish";
468
+ $q_config['windows_locale']['ts'] = "Tsonga";
469
+ $q_config['windows_locale']['tt'] = "Tatar";
470
+ $q_config['windows_locale']['tw'] = "Twi";
471
+ $q_config['windows_locale']['ug'] = "Uighur";
472
+ $q_config['windows_locale']['uk'] = "Ukrainian";
473
+ $q_config['windows_locale']['ur'] = "Urdu";
474
+ $q_config['windows_locale']['uz'] = "Uzbek";
475
+ $q_config['windows_locale']['vi'] = "Vietnamese";
476
+ $q_config['windows_locale']['vo'] = "Volapuk";
477
+ $q_config['windows_locale']['wo'] = "Wolof";
478
+ $q_config['windows_locale']['xh'] = "Xhosa";
479
+ $q_config['windows_locale']['yi'] = "Yiddish";
480
+ $q_config['windows_locale']['yo'] = "Yoruba";
481
+ $q_config['windows_locale']['za'] = "Zhuang";
482
+ $q_config['windows_locale']['zh'] = "Chinese";
483
+ $q_config['windows_locale']['zu'] = "Zulu";
484
+
485
+ // Load qTranslate-X
486
+
487
+ register_activation_hook(__FILE__, 'qtranxf_activation_hook');//does not work if inside qtranslate_configuration.php
488
+
489
+ require_once(dirname(__FILE__)."/qtranslate_utils.php");
490
+ require_once(dirname(__FILE__)."/qtranslate_core.php");
491
+ require_once(dirname(__FILE__)."/qtranslate_widget.php");
492
+ if(is_admin()){
493
+ require_once(dirname(__FILE__)."/qtranslate_configuration.php");
494
+ // load qTranslate Services if available
495
+ if(file_exists(dirname(__FILE__)."/qtranslate_services.php"))
496
+ require_once(dirname(__FILE__)."/qtranslate_services.php");
497
+ }else{
498
+ require_once(dirname(__FILE__)."/qtranslate_frontend.php");
499
+ }
500
+
501
+ // set hooks at the end
502
+ require_once(dirname(__FILE__)."/qtranslate_hooks.php");
503
+ ?>
qtranslate_configuration.css ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .qtranxs_title_input {
2
+ border:0pt none;
3
+ font-size:1.7em;
4
+ outline-color:invert;
5
+ outline-style:none;
6
+ outline-width:medium;
7
+ padding:0pt;
8
+ width:100%;
9
+ }
10
+ .qtranxs_title_wrap {
11
+ border-color:#CCCCCC;
12
+ border-style:solid;
13
+ border-width:1px;
14
+ padding:2px 3px;
15
+ }
16
+ #qtranxf_textarea_content {
17
+ padding:6px;
18
+ border:0 none;
19
+ line-height:150%;
20
+ outline: none;
21
+ margin:0pt;
22
+ width:100%;
23
+ -moz-box-sizing:
24
+ border-box;
25
+ -webkit-box-sizing: border-box;
26
+ -khtml-box-sizing: border-box;
27
+ box-sizing: border-box;
28
+ }
29
+ .qtranxs_title {
30
+ -moz-border-radius: 6px 6px 0 0;
31
+ -webkit-border-top-right-radius: 6px;
32
+ -webkit-border-top-left-radius: 6px;
33
+ -khtml-border-top-right-radius: 6px;
34
+ -khtml-border-top-left-radius: 6px;
35
+ border-top-right-radius: 6px;
36
+ border-top-left-radius: 6px;
37
+ }
38
+ .hide-if-no-js.wp-switch-editor.switch-tmce { margin-left:6px !important; }
39
+ #qtranxs_debug { width:100%; height:200px }
40
+ #qtranxs_custom_fields { width:100%; }
41
+ #postexcerpt textarea { height:4em; margin:0; width:98% }
42
+ .qtranxs_lang_div {
43
+ float:right;
44
+ height:12px;
45
+ width:18px;
46
+ padding:6px 5px 8px 5px;
47
+ cursor:pointer;
48
+ }
49
+ .qtranxs_lang_div.active {
50
+ background: #DFDFDF;
51
+ border-left:1px solid #D0D0D0;
52
+ border-right: 1px solid #F7F7F7;
53
+ padding:6px 4px 8px 4px;
54
+ }
qtranslate_configuration.php ADDED
@@ -0,0 +1,885 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // encoding: utf-8
2
+ /*
3
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ require_once(dirname(__FILE__)."/admin/import_export.php");
21
+ require_once(dirname(__FILE__)."/admin/activation_hook.php");
22
+
23
+ function qtranxf_update_config()
24
+ {
25
+ //if(!defined('WP_ADMIN')) return;
26
+ if(!current_user_can('manage_options')) return;
27
+ if(isset($_POST['qtranslate_reset']) && isset($_POST['qtranslate_reset2'])) {
28
+ // reset all settings
29
+ delete_option('qtranslate_language_names');
30
+ delete_option('qtranslate_enabled_languages');
31
+ delete_option('qtranslate_default_language');
32
+ delete_option('qtranslate_flag_location');
33
+ delete_option('qtranslate_flags');
34
+ delete_option('qtranslate_locales');
35
+ delete_option('qtranslate_na_messages');
36
+ delete_option('qtranslate_date_formats');
37
+ delete_option('qtranslate_time_formats');
38
+ delete_option('qtranslate_use_strftime');
39
+ delete_option('qtranslate_ignore_file_types');
40
+ delete_option('qtranslate_url_mode');
41
+ delete_option('qtranslate_detect_browser_language');
42
+ delete_option('qtranslate_hide_untranslated');
43
+ delete_option('qtranslate_auto_update_mo');
44
+ delete_option('qtranslate_next_update_mo');
45
+ delete_option('qtranslate_hide_default_language');
46
+ delete_option('qtranslate_custom_fields');
47
+ if(isset($_POST['qtranslate_reset3'])) {
48
+ delete_option('qtranslate_term_name');
49
+ }
50
+ }
51
+ }
52
+ add_action('qtranxf_init_begin','qtranxf_update_config',10);
53
+
54
+ function qtranxf_add_admin_js () {
55
+ global $q_config;
56
+ //wp_register_script( 'qtranslate-script', plugins_url( '/qtranslate.js', __FILE__ ) );
57
+ wp_register_script( 'qtranslate-script', plugins_url( '/qtranslate.min.js', __FILE__ ) );
58
+ wp_enqueue_script( 'qtranslate-script' );
59
+ wp_deregister_script( 'autosave' );//autosave script saves the active language only and messes it up later in a hard way
60
+ //echo '<script>var qTranslateConfig='.json_encode($q_config).';</script>';
61
+ ?>
62
+ <script type="text/javascript">
63
+ // <![CDATA[
64
+ var qTranslateConfig=<?php echo json_encode($q_config); ?>;
65
+ function qtranxj_getcookie(cname)
66
+ {
67
+ var nm = cname + "=";
68
+ var ca = document.cookie.split(';');
69
+ for(var i=0; i<ca.length; i++) {
70
+ var c = ca[i];
71
+ var p = c.indexOf(nm);
72
+ if (p >= 0) return c.substring(p+nm.length,c.length);
73
+ }
74
+ return '';
75
+ }
76
+ function qtranxj_delcookie(cname)
77
+ {
78
+ var date = new Date();
79
+ date.setTime(date.getTime()-(24*60*60*1000));
80
+ document.cookie=cname+'=; expires='+date.toGMTString();
81
+ }
82
+ function qtranxj_readShowHideCookie(id) {
83
+ var e=document.getElementById(id);
84
+ if(!e) return;
85
+ if(qtranxj_getcookie(id)){
86
+ e.style.display='block';
87
+ }else{
88
+ e.style.display='none';
89
+ }
90
+ }
91
+ function qtranxj_toggleShowHide(id) {
92
+ var e = document.getElementById(id);
93
+ if (e.style.display == 'block'){
94
+ qtranxj_delcookie(id);
95
+ e.style.display = 'none';
96
+ }else{
97
+ document.cookie=id+'=1';
98
+ e.style.display='block';
99
+ }
100
+ return false;
101
+ }
102
+ <?php
103
+ do_action('qtranslate_js');
104
+ ?>
105
+ //]]>
106
+ </script>
107
+ <?php
108
+ }
109
+
110
+ function qtranxf_add_admin_lang_icons ()
111
+ {
112
+ global $q_config;
113
+ echo "<style>\n";
114
+ echo "#wpadminbar #wp-admin-bar-language>div.ab-item{ background-size: 0;";
115
+ echo "background-image: url(".trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$q_config['language']].");}\n";
116
+ foreach($q_config['enabled_languages'] as $language)
117
+ {
118
+ echo "#wpadminbar ul li#wp-admin-bar-".$language." {background-size: 0; background-image: url(".trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$language].");}\n";
119
+ }
120
+ echo "</style>\n";
121
+ }
122
+
123
+ function qtranxf_add_admin_css () {
124
+ qtranxf_add_admin_lang_icons();
125
+ echo "<style type=\"text/css\" media=\"screen\">\n";
126
+ /*
127
+ echo ".qtranxs_title_input { border:0pt none; font-size:1.7em; outline-color:invert; outline-style:none; outline-width:medium; padding:0pt; width:100%; }\n";
128
+ echo ".qtranxs_title_wrap { border-color:#CCCCCC; border-style:solid; border-width:1px; padding:2px 3px; }\n";
129
+ echo "#qtranxf_textarea_content { padding:6px; border:0 none; line-height:150%; outline: none; margin:0pt; width:100%; -moz-box-sizing: border-box;";
130
+ echo "-webkit-box-sizing: border-box; -khtml-box-sizing: border-box; box-sizing: border-box; }\n";
131
+ echo ".qtranxs_title { -moz-border-radius: 6px 6px 0 0;";
132
+ echo "-webkit-border-top-right-radius: 6px; -webkit-border-top-left-radius: 6px; -khtml-border-top-right-radius: 6px; -khtml-border-top-left-radius: 6px;";
133
+ echo "border-top-right-radius: 6px; border-top-left-radius: 6px; }\n";
134
+ echo ".hide-if-no-js.wp-switch-editor.switch-tmce { margin-left:6px !important;}";
135
+ echo "#postexcerpt textarea { height:4em; margin:0; width:98% }";
136
+ echo ".qtranxs_lang_div { float:right; height:12px; width:18px; padding:6px 5px 8px 5px; cursor:pointer }";
137
+ echo ".qtranxs_lang_div.active { background: #DFDFDF; border-left:1px solid #D0D0D0; border-right: 1px solid #F7F7F7; padding:6px 4px 8px 4px }";
138
+ */
139
+ //echo "#qtranxs_debug { width:100%; height:200px }";
140
+ do_action('qtranslate_css');
141
+ echo "</style>\n";
142
+ }
143
+
144
+ function qtranxf_admin_head() {
145
+ wp_register_style( 'qtranslate-admin-style', plugins_url('qtranslate_configuration.css', __FILE__) );
146
+ wp_enqueue_style( 'qtranslate-admin-style' );
147
+ qtranxf_add_admin_css();
148
+ qtranxf_add_admin_js();
149
+ qtranxf_optionFilter('disable');
150
+ }
151
+
152
+ /* qTranslate-X Management Interface */
153
+ function qtranxf_adminMenu() {
154
+ global $menu, $submenu, $q_config;
155
+
156
+ /* Configuration Page */
157
+ add_options_page(__('Language Management', 'qtranslate'), __('Languages', 'qtranslate'), 'manage_options', 'qtranslate-x', 'qtranxf_conf');
158
+
159
+ /* Language Switcher for Admin */
160
+ return;
161
+ // don't display menu if there is only 1 language active
162
+ if(sizeof($q_config['enabled_languages']) <= 1) return;
163
+
164
+ // generate menu with flags for every enabled language
165
+ foreach($q_config['enabled_languages'] as $id => $language) {
166
+ $link = add_query_arg('lang', $language);
167
+ $link = (strpos($link, "wp-admin/") === false) ? preg_replace('#[^?&]*/#i', '', $link) : preg_replace('#[^?&]*wp-admin/#i', '', $link);
168
+ if(strpos($link, "?")===0||strpos($link, "index.php?")===0) {
169
+ if(current_user_can('manage_options'))
170
+ $link = 'options-general.php?page=qtranslate-x&godashboard=1&lang='.$language;
171
+ else
172
+ $link = 'index.php?lang='.$language;
173
+ }
174
+ add_menu_page(__($q_config['language_name'][$language], 'qtranslate'), __($q_config['language_name'][$language], 'qtranslate'), 'read', $link, NULL, trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$language]);
175
+ }
176
+ }
177
+
178
+ function qtranxf_language_form($lang = '', $language_code = '', $language_name = '', $language_locale = '', $language_date_format = '', $language_time_format = '', $language_flag ='', $language_na_message = '', $language_default = '', $original_lang='') {
179
+ global $q_config;
180
+ ?>
181
+ <input type="hidden" name="original_lang" value="<?php echo $original_lang; ?>" />
182
+ <div class="form-field">
183
+ <label for="language_code"><?php _e('Language Code', 'qtranslate') ?></label>
184
+ <input name="language_code" id="language_code" type="text" value="<?php echo $language_code; ?>" size="2" maxlength="2"/>
185
+ <p><?php _e('2-Letter <a href="http://www.w3.org/WAI/ER/IG/ert/iso639.htm#2letter">ISO Language Code</a> for the Language you want to insert. (Example: en)', 'qtranslate'); ?></p>
186
+ </div>
187
+ <div class="form-field">
188
+ <label for="language_flag"><?php _e('Flag', 'qtranslate') ?></label>
189
+ <?php
190
+ $files = array();
191
+ if($dir_handle = @opendir(trailingslashit(WP_CONTENT_DIR).$q_config['flag_location'])) {
192
+ while (false !== ($file = readdir($dir_handle))) {
193
+ if(preg_match("/\.(jpeg|jpg|gif|png)$/i",$file)) {
194
+ $files[] = $file;
195
+ }
196
+ }
197
+ sort($files);
198
+ }
199
+ if(sizeof($files)>0){
200
+ ?>
201
+ <select name="language_flag" id="language_flag" onchange="switch_flag(this.value);" onclick="switch_flag(this.value);" onkeypress="switch_flag(this.value);">
202
+ <?php
203
+ foreach ($files as $file) {
204
+ ?>
205
+ <option value="<?php echo $file; ?>" <?php echo ($language_flag==$file)?'selected="selected"':''?>><?php echo $file; ?></option>
206
+ <?php
207
+ }
208
+ ?>
209
+ </select>
210
+ <img src="" alt="Flag" id="preview_flag" style="vertical-align:middle; display:none"/>
211
+ <?php
212
+ } else {
213
+ _e('Incorrect Flag Image Path! Please correct it!', 'qtranslate');
214
+ }
215
+ ?>
216
+ <p><?php _e('Choose the corresponding country flag for language. (Example: gb.png)', 'qtranslate'); ?></p>
217
+ </div>
218
+ <script type="text/javascript">
219
+ //<![CDATA[
220
+ function switch_flag(url) {
221
+ document.getElementById('preview_flag').style.display = "inline";
222
+ document.getElementById('preview_flag').src = "<?php echo trailingslashit(WP_CONTENT_URL).$q_config['flag_location'];?>" + url;
223
+ }
224
+ switch_flag(document.getElementById('language_flag').value);
225
+ //]]>
226
+ </script>
227
+ <div class="form-field">
228
+ <label for="language_name"><?php _e('Name', 'qtranslate') ?></label>
229
+ <input name="language_name" id="language_name" type="text" value="<?php echo $language_name; ?>"/>
230
+ <p><?php _e('The Name of the language, which will be displayed on the site. (Example: English)', 'qtranslate'); ?></p>
231
+ </div>
232
+ <div class="form-field">
233
+ <label for="language_locale"><?php _e('Locale', 'qtranslate') ?></label>
234
+ <input name="language_locale" id="language_locale" type="text" value="<?php echo $language_locale; ?>" size="5" maxlength="5"/>
235
+ <p>
236
+ <?php _e('PHP and Wordpress Locale for the language. (Example: en_US)', 'qtranslate'); ?><br />
237
+ <?php _e('You will need to install the .mo file for this language.', 'qtranslate'); ?>
238
+ </p>
239
+ </div>
240
+ <div class="form-field">
241
+ <label for="language_date_format"><?php _e('Date Format', 'qtranslate') ?></label>
242
+ <input name="language_date_format" id="language_date_format" type="text" value="<?php echo $language_date_format; ?>"/>
243
+ <p><?php _e('Depending on your Date / Time Conversion Mode, you can either enter a <a href="http://www.php.net/manual/function.strftime.php">strftime</a> (use %q for day suffix (st,nd,rd,th)) or <a href="http://www.php.net/manual/function.date.php">date</a> format. This field is optional. (Example: %A %B %e%q, %Y)', 'qtranslate'); ?></p>
244
+ </div>
245
+ <div class="form-field">
246
+ <label for="language_time_format"><?php _e('Time Format', 'qtranslate') ?></label>
247
+ <input name="language_time_format" id="language_time_format" type="text" value="<?php echo $language_time_format; ?>"/>
248
+ <p><?php _e('Depending on your Date / Time Conversion Mode, you can either enter a <a href="http://www.php.net/manual/function.strftime.php">strftime</a> or <a href="http://www.php.net/manual/function.date.php">date</a> format. This field is optional. (Example: %I:%M %p)', 'qtranslate'); ?></p>
249
+ </div>
250
+ <div class="form-field">
251
+ <label for="language_na_message"><?php _e('Not Available Message', 'qtranslate') ?></label>
252
+ <input name="language_na_message" id="language_na_message" type="text" value="<?php echo $language_na_message; ?>"/>
253
+ <p>
254
+ <?php _e('Message to display if post is not available in the requested language. (Example: Sorry, this entry is only available in %LANG:, : and %.)', 'qtranslate'); ?><br />
255
+ <?php _e('%LANG:&lt;normal_seperator&gt;:&lt;last_seperator&gt;% generates a list of languages seperated by &lt;normal_seperator&gt; except for the last one, where &lt;last_seperator&gt; will be used instead.', 'qtranslate'); ?><br />
256
+ </p>
257
+ </div>
258
+ <?php
259
+ }
260
+
261
+ function qtranxf_updateSetting($var, $type = QTX_STRING) {
262
+ global $q_config;
263
+ if(!isset($_POST['submit'])) return false;
264
+ switch($type) {
265
+ case QTX_URL:
266
+ case QTX_LANGUAGE:
267
+ case QTX_STRING:
268
+ if(!isset($_POST[$var])) return false;
269
+ if($type == QTX_URL) $_POST[$var] = trailingslashit($_POST[$var]);
270
+ else if($type == QTX_LANGUAGE && !qtranxf_isEnabled($_POST[$var])) return false;
271
+ if($q_config[$var] == $_POST[$var]) return false;
272
+ $q_config[$var] = $_POST[$var];
273
+ update_option('qtranslate_'.$var, $q_config[$var]);
274
+ return true;
275
+ case QTX_ARRAY:
276
+ if(!isset($_POST[$var])) return false;
277
+ $val=preg_split('/[\s,]+/',$_POST[$var]);
278
+ $diff=array_diff($q_config[$var],$val);
279
+ if(empty($diff)) return false;
280
+ $q_config[$var] = $val;
281
+ update_option('qtranslate_'.$var, $q_config[$var]);
282
+ return true;
283
+ case QTX_BOOLEAN:
284
+ if(isset($_POST[$var])&&$_POST[$var]==1) {
285
+ if($q_config[$var]) return false;
286
+ $q_config[$var] = true;
287
+ update_option('qtranslate_'.$var, '1');
288
+ } else {
289
+ if(!$q_config[$var]) return false;
290
+ $q_config[$var] = false;
291
+ update_option('qtranslate_'.$var, '0');
292
+ }
293
+ return true;
294
+ case QTX_INTEGER:
295
+ if(!isset($_POST[$var])) return false;
296
+ $val = intval($_POST[$var]);
297
+ if($q_config[$var] == $val) return false;
298
+ $q_config[$var] = $val;
299
+ update_option('qtranslate_'.$var, $q_config[$var]);
300
+ return true;
301
+ }
302
+ return false;
303
+ }
304
+
305
+ function qtranxf_language_columns($columns) {
306
+ return array(
307
+ 'flag' => 'Flag',
308
+ 'name' => __('Name', 'qtranslate'),
309
+ 'status' => __('Action', 'qtranslate'),
310
+ 'status2' => '',
311
+ 'status3' => ''
312
+ );
313
+ }
314
+
315
+ function qtranxf_useAdminTermLib($obj) {
316
+ if ($_SERVER["SCRIPT_NAME"]==="/wp-admin/edit-tags.php" &&
317
+ strstr($_SERVER["QUERY_STRING"], "action=edit" ))
318
+ {
319
+ return $obj;
320
+ }
321
+ else
322
+ {
323
+ return qtranxf_useTermLib($obj);
324
+ }
325
+ }
326
+
327
+ function qtranxf_admin_section_start($section, $nm) {
328
+ echo '<h3>'.__($section, 'qtranslate').'<span id="qtranxs-show-'.$nm.'"> ( <a name="qtranslate_'.$nm.'_settings" href="#" onclick="return qtranxj_toggleShowHide(\'qtranslate-admin-'.$nm.'\');">'.__('Show', 'qtranslate').' / '.__('Hide', 'qtranslate').'</a> )</span></h3>';
329
+ }
330
+
331
+ function qtranxf_admin_section_end($nm) {
332
+ ?>
333
+ <script type="text/javascript">
334
+ //<![CDATA[
335
+ qtranxj_readShowHideCookie('qtranslate-admin-<?php echo $nm; ?>');
336
+ // ]]>
337
+ </script>
338
+ <?php
339
+ }
340
+
341
+ function qtranxf_conf() {
342
+ global $q_config, $wpdb;
343
+
344
+ // do redirection for dashboard
345
+ if(isset($_GET['godashboard'])) {
346
+ echo '<h2>'.__('Switching Language', 'qtranslate').'</h2>'.sprintf(__('Switching language to %1$s... If the Dashboard isn\'t loading, use this <a href="%2$s" title="Dashboard">link</a>.','qtranslate'),$q_config['language_name'][qtranxf_getLanguage()],admin_url()).'<script type="text/javascript">document.location="'.admin_url().'";</script>';
347
+ exit();
348
+ }
349
+
350
+ // init some needed variables
351
+ $error = '';
352
+ $original_lang = '';
353
+ $language_code = '';
354
+ $language_name = '';
355
+ $language_locale = '';
356
+ $language_date_format = '';
357
+ $language_time_format = '';
358
+ $language_na_message = '';
359
+ $language_flag = '';
360
+ $language_default = '';
361
+ $altered_table = false;
362
+
363
+ $message = apply_filters('qtranslate_configuration_pre','');
364
+
365
+ // check for action
366
+ if(isset($_POST['qtranslate_reset']) && isset($_POST['qtranslate_reset2'])) {
367
+ $message = __('qTranslate&#8209;X has been reset.', 'qtranslate');
368
+ } elseif(isset($_POST['default_language'])) {
369
+ // save settings
370
+ qtranxf_updateSetting('default_language', QTX_LANGUAGE);
371
+ qtranxf_updateSetting('flag_location', QTX_URL);
372
+ qtranxf_updateSetting('ignore_file_types', QTX_STRING);
373
+ qtranxf_updateSetting('detect_browser_language', QTX_BOOLEAN);
374
+ qtranxf_updateSetting('hide_untranslated', QTX_BOOLEAN);
375
+ qtranxf_updateSetting('use_strftime', QTX_INTEGER);
376
+ qtranxf_updateSetting('url_mode', QTX_INTEGER);
377
+ qtranxf_updateSetting('auto_update_mo', QTX_BOOLEAN);
378
+ qtranxf_updateSetting('hide_default_language', QTX_BOOLEAN);
379
+ qtranxf_updateSetting('custom_fields', QTX_ARRAY);
380
+ if(isset($_POST['update_mo_now']) && $_POST['update_mo_now']=='1' && qtranxf_updateGettextDatabases(true))
381
+ $message = __('Gettext databases updated.', 'qtranslate');
382
+ }
383
+
384
+ if(isset($_POST['original_lang'])) {
385
+ // validate form input
386
+ if($_POST['language_na_message']=='') $error = __('The Language must have a Not-Available Message!', 'qtranslate');
387
+ if(strlen($_POST['language_locale'])<2) $error = __('The Language must have a Locale!', 'qtranslate');
388
+ if($_POST['language_name']=='') $error = __('The Language must have a name!', 'qtranslate');
389
+ if(strlen($_POST['language_code'])!=2) $error = __('Language Code has to be 2 characters long!', 'qtranslate');
390
+ if($_POST['original_lang']==''&&$error=='') {
391
+ // new language
392
+ if(isset($q_config['language_name'][$_POST['language_code']])) {
393
+ $error = __('There is already a language with the same Language Code!', 'qtranslate');
394
+ }
395
+ }
396
+ if($_POST['original_lang']!=''&&$error=='') {
397
+ // language update
398
+ if($_POST['language_code']!=$_POST['original_lang']&&isset($q_config['language_name'][$_POST['language_code']])) {
399
+ $error = __('There is already a language with the same Language Code!', 'qtranslate');
400
+ } else {
401
+ // remove old language
402
+ unset($q_config['language_name'][$_POST['original_lang']]);
403
+ unset($q_config['flag'][$_POST['original_lang']]);
404
+ unset($q_config['locale'][$_POST['original_lang']]);
405
+ unset($q_config['date_format'][$_POST['original_lang']]);
406
+ unset($q_config['time_format'][$_POST['original_lang']]);
407
+ unset($q_config['not_available'][$_POST['original_lang']]);
408
+ if(in_array($_POST['original_lang'],$q_config['enabled_languages'])) {
409
+ // was enabled, so set modified one to enabled too
410
+ for($i = 0; $i < sizeof($q_config['enabled_languages']); $i++) {
411
+ if($q_config['enabled_languages'][$i] == $_POST['original_lang']) {
412
+ $q_config['enabled_languages'][$i] = $_POST['language_code'];
413
+ }
414
+ }
415
+ }
416
+ if($_POST['original_lang']==$q_config['default_language'])
417
+ // was default, so set modified the default
418
+ $q_config['default_language'] = $_POST['language_code'];
419
+ }
420
+ }
421
+ if(get_magic_quotes_gpc()) {
422
+ if(isset($_POST['language_date_format'])) $_POST['language_date_format'] = stripslashes($_POST['language_date_format']);
423
+ if(isset($_POST['language_time_format'])) $_POST['language_time_format'] = stripslashes($_POST['language_time_format']);
424
+ }
425
+ if($error=='') {
426
+ // everything is fine, insert language
427
+ $q_config['language_name'][$_POST['language_code']] = $_POST['language_name'];
428
+ $q_config['flag'][$_POST['language_code']] = $_POST['language_flag'];
429
+ $q_config['locale'][$_POST['language_code']] = $_POST['language_locale'];
430
+ $q_config['date_format'][$_POST['language_code']] = $_POST['language_date_format'];
431
+ $q_config['time_format'][$_POST['language_code']] = $_POST['language_time_format'];
432
+ $q_config['not_available'][$_POST['language_code']] = $_POST['language_na_message'];
433
+ }
434
+ if($error!=''||isset($_GET['edit'])) {
435
+ // get old values in the form
436
+ $original_lang = $_POST['original_lang'];
437
+ $language_code = $_POST['language_code'];
438
+ $language_name = $_POST['language_name'];
439
+ $language_locale = $_POST['language_locale'];
440
+ $language_date_format = $_POST['language_date_format'];
441
+ $language_time_format = $_POST['language_time_format'];
442
+ $language_na_message = $_POST['language_na_message'];
443
+ $language_flag = $_POST['language_flag'];
444
+ $language_default = $_POST['language_default'];
445
+ }
446
+ } elseif(isset($_GET['convert'])){
447
+ // update language tags
448
+ global $wpdb;
449
+ $wpdb->show_errors();
450
+ foreach($q_config['enabled_languages'] as $lang) {
451
+ $wpdb->query('UPDATE '.$wpdb->posts.' set post_title = REPLACE(post_title, "[lang_'.$lang.']","<!--:'.$lang.'-->")');
452
+ $wpdb->query('UPDATE '.$wpdb->posts.' set post_title = REPLACE(post_title, "[/lang_'.$lang.']","<!--:-->")');
453
+ $wpdb->query('UPDATE '.$wpdb->posts.' set post_content = REPLACE(post_content, "[lang_'.$lang.']","<!--:'.$lang.'-->")');
454
+ $wpdb->query('UPDATE '.$wpdb->posts.' set post_content = REPLACE(post_content, "[/lang_'.$lang.']","<!--:-->")');
455
+ }
456
+ $message = "Database Update successful!";
457
+ } elseif(isset($_GET['markdefault'])){
458
+ // update language tags
459
+ global $wpdb;
460
+ $wpdb->show_errors();
461
+ $result = $wpdb->get_results('SELECT ID, post_title, post_content FROM '.$wpdb->posts.' WHERE NOT (post_content LIKE "%<!--:-->%" OR post_title LIKE "%<!--:-->%")');
462
+ foreach($result as $post) {
463
+ $content = qtranxf_split($post->post_content);
464
+ $title = qtranxf_split($post->post_title);
465
+ foreach($q_config['enabled_languages'] as $language) {
466
+ if($language != $q_config['default_language']) {
467
+ $content[$language] = "";
468
+ $title[$language] = "";
469
+ }
470
+ }
471
+ $content = qtranxf_join($content);
472
+ $title = qtranxf_join($title);
473
+ $wpdb->query('UPDATE '.$wpdb->posts.' set post_content = "'.mysql_escape_string($content).'", post_title = "'.mysql_escape_string($title).'" WHERE ID='.$post->ID);
474
+ }
475
+ $message = "All Posts marked as default language!";
476
+ } elseif(isset($_GET['edit'])){
477
+ $original_lang = $_GET['edit'];
478
+ $language_code = $_GET['edit'];
479
+ $language_name = $q_config['language_name'][$_GET['edit']];
480
+ $language_locale = $q_config['locale'][$_GET['edit']];
481
+ $language_date_format = $q_config['date_format'][$_GET['edit']];
482
+ $language_time_format = $q_config['time_format'][$_GET['edit']];
483
+ $language_na_message = $q_config['not_available'][$_GET['edit']];
484
+ $language_flag = $q_config['flag'][$_GET['edit']];
485
+ } elseif(isset($_GET['delete'])) {
486
+ // validate delete (protect code)
487
+ if($q_config['default_language']==$_GET['delete'])
488
+ $error = 'Cannot delete Default Language!';
489
+ if(!isset($q_config['language_name'][$_GET['delete']])||strtolower($_GET['delete'])=='code')
490
+ $error = 'No such language!';
491
+ if($error=='') {
492
+ // everything seems fine, delete language
493
+ qtranxf_disableLanguage($_GET['delete']);
494
+ unset($q_config['language_name'][$_GET['delete']]);
495
+ unset($q_config['flag'][$_GET['delete']]);
496
+ unset($q_config['locale'][$_GET['delete']]);
497
+ unset($q_config['date_format'][$_GET['delete']]);
498
+ unset($q_config['time_format'][$_GET['delete']]);
499
+ unset($q_config['not_available'][$_GET['delete']]);
500
+ }
501
+ } elseif(isset($_GET['enable'])) {
502
+ // enable validate
503
+ if(!qtranxf_enableLanguage($_GET['enable'])) {
504
+ $error = __('Language is already enabled or invalid!', 'qtranslate');
505
+ }
506
+ } elseif(isset($_GET['disable'])) {
507
+ // enable validate
508
+ if($_GET['disable']==$q_config['default_language'])
509
+ $error = __('Cannot disable Default Language!', 'qtranslate');
510
+ if(!qtranxf_isEnabled($_GET['disable']))
511
+ if(!isset($q_config['language_name'][$_GET['disable']]))
512
+ $error = __('No such language!', 'qtranslate');
513
+ // everything seems fine, disable language
514
+ if($error=='' && !qtranxf_disableLanguage($_GET['disable'])) {
515
+ $error = __('Language is already disabled!', 'qtranslate');
516
+ }
517
+ } elseif(isset($_GET['moveup'])) {
518
+ $languages = qtranxf_getSortedLanguages();
519
+ $message = __('No such language!', 'qtranslate');
520
+ foreach($languages as $key => $language) {
521
+ if($language==$_GET['moveup']) {
522
+ if($key==0) {
523
+ $message = __('Language is already first!', 'qtranslate');
524
+ break;
525
+ }
526
+ $languages[$key] = $languages[$key-1];
527
+ $languages[$key-1] = $language;
528
+ $q_config['enabled_languages'] = $languages;
529
+ $message = __('New order saved.', 'qtranslate');
530
+ break;
531
+ }
532
+ }
533
+ } elseif(isset($_GET['movedown'])) {
534
+ $languages = qtranxf_getSortedLanguages();
535
+ $message = __('No such language!', 'qtranslate');
536
+ foreach($languages as $key => $language) {
537
+ if($language==$_GET['movedown']) {
538
+ if($key==sizeof($languages)-1) {
539
+ $message = __('Language is already last!', 'qtranslate');
540
+ break;
541
+ }
542
+ $languages[$key] = $languages[$key+1];
543
+ $languages[$key+1] = $language;
544
+ $q_config['enabled_languages'] = $languages;
545
+ $message = __('New order saved.', 'qtranslate');
546
+ break;
547
+ }
548
+ }
549
+ }
550
+
551
+ $everything_fine = ((isset($_POST['submit'])||isset($_GET['delete'])||isset($_GET['enable'])||isset($_GET['disable'])||isset($_GET['moveup'])||isset($_GET['movedown']))&&$error=='');
552
+ if($everything_fine) {
553
+ // settings might have changed, so save
554
+ qtranxf_saveConfig();
555
+ if(empty($message)) {
556
+ $message = __('Options saved.', 'qtranslate');
557
+ }
558
+ }
559
+ if($q_config['auto_update_mo']) {
560
+ if(!is_dir(WP_LANG_DIR) || !$ll = @fopen(trailingslashit(WP_LANG_DIR).'qtranslate.test','a')) {
561
+ $error = sprintf(__('Could not write to "%s", Gettext Databases could not be downloaded!', 'qtranslate'), WP_LANG_DIR);
562
+ } else {
563
+ @fclose($ll);
564
+ @unlink(trailingslashit(WP_LANG_DIR).'qtranslate.test');
565
+ }
566
+ }
567
+ // don't accidentally delete/enable/disable twice
568
+ $clean_uri = preg_replace("/&(delete|enable|disable|convert|markdefault|moveup|movedown)=[^&#]*/i","",$_SERVER['REQUEST_URI']);
569
+ $clean_uri = apply_filters('qtranslate_clean_uri', $clean_uri);
570
+
571
+ // Generate XHTML
572
+
573
+ ?>
574
+ <?php if ($message) : ?>
575
+ <div id="message" class="updated fade"><p><strong><?php echo $message; ?></strong></p></div>
576
+ <?php endif; ?>
577
+ <?php if ($error!='') : ?>
578
+ <div id="message" class="error fade"><p><strong><?php echo $error; ?></strong></p></div>
579
+ <?php endif; ?>
580
+
581
+ <?php if(isset($_GET['edit'])) { ?>
582
+ <div class="wrap">
583
+ <h2><?php _e('Edit Language', 'qtranslate'); ?></h2>
584
+ <form action="" method="post" id="qtranxs-edit-language">
585
+ <?php qtranxf_language_form($language_code, $language_code, $language_name, $language_locale, $language_date_format, $language_time_format, $language_flag, $language_na_message, $language_default, $original_lang); ?>
586
+ <p class="submit"><input type="submit" name="submit" value="<?php _e('Save Changes &raquo;', 'qtranslate'); ?>" /></p>
587
+ </form>
588
+ </div>
589
+ <?php } else { ?>
590
+ <div class="wrap">
591
+ <h2><?php _e('Language Management (qTranslate Configuration)', 'qtranslate'); ?></h2>
592
+ <div class="tablenav"><?php printf(__('For help on how to configure qTranslate correctly, take a look at the <a href="%1$s">qTranslate FAQ</a> and the <a href="%2$s">Support Forum</a>.', 'qtranslate'), 'http://wordpress.org/plugins/qtranslate-x/faq/', 'https://wordpress.org/support/plugin/qtranslate-x'); ?></div>
593
+ <form action="<?php echo $clean_uri;?>" method="post">
594
+ <?php qtranxf_admin_section_start('General Settings','general'); ?>
595
+ <table class="form-table" id="qtranslate-admin-general">
596
+ <tr>
597
+ <th scope="row"><?php _e('Default Language / Order', 'qtranslate') ?></th>
598
+ <td>
599
+ <fieldset id="qtranxs-languages-menu"><legend class="hidden"><?php _e('Default Language', 'qtranslate') ?></legend>
600
+ <?php
601
+ foreach ( qtranxf_getSortedLanguages() as $key => $language ) {
602
+ echo "\t<label title='" . $q_config['language_name'][$language] . "'><input type='radio' name='default_language' value='" . $language . "'";
603
+ if ( $language == $q_config['default_language'] ) {
604
+ echo " checked='checked'";
605
+ }
606
+ echo ' />';
607
+ echo ' <a href="'.add_query_arg('moveup', $language, $clean_uri).'"><img src="'.WP_PLUGIN_URL.'/qtranslate-x/arrowup.png" alt="up" /></a>';
608
+ echo ' <a href="'.add_query_arg('movedown', $language, $clean_uri).'"><img src="'.WP_PLUGIN_URL.'/qtranslate-x/arrowdown.png" alt="down" /></a>';
609
+ echo ' <img src="' . trailingslashit(WP_CONTENT_URL) .$q_config['flag_location'].$q_config['flag'][$language] . '" alt="' . $q_config['language_name'][$language] . '" /> ';
610
+ echo ' '.$q_config['language_name'][$language] . "</label><br />\n";
611
+ }
612
+ ?>
613
+ </br>
614
+ <?php printf(__('Choose the default language of your blog. This is the language which will be shown on %s. You can also change the order the languages by clicking on the arrows above.', 'qtranslate'), get_bloginfo('url')); ?>
615
+ </fieldset>
616
+ </td>
617
+ </tr>
618
+ <tr valign="top">
619
+ <th scope="row"><?php _e('Hide Untranslated Content', 'qtranslate');?></th>
620
+ <td>
621
+ <label for="hide_untranslated"><input type="checkbox" name="hide_untranslated" id="hide_untranslated" value="1"<?php echo ($q_config['hide_untranslated'])?' checked="checked"':''; ?>/> <?php _e('Hide Content which is not available for the selected language.', 'qtranslate'); ?></label>
622
+ <br/>
623
+ <?php _e('When checked, posts will be hidden if the content is not available for the selected language. If unchecked, a message will appear showing all the languages the content is available in.', 'qtranslate'); ?>
624
+ <?php _e('This function will not work correctly if you installed qTranslate on a blog with existing entries. In this case you will need to take a look at "Convert Database" under "Advanced Settings".', 'qtranslate'); ?>
625
+ </td>
626
+ </tr>
627
+ <tr valign="top">
628
+ <th scope="row"><?php _e('Detect Browser Language', 'qtranslate');?></th>
629
+ <td>
630
+ <label for="detect_browser_language"><input type="checkbox" name="detect_browser_language" id="detect_browser_language" value="1"<?php echo ($q_config['detect_browser_language'])?' checked="checked"':''; ?>/> <?php _e('Detect the language of the browser and redirect accordingly.', 'qtranslate'); ?></label>
631
+ <br/>
632
+ <?php _e('When the frontpage is visited via bookmark/external link/type-in, the visitor will be forwarded to the correct URL for the language specified by his browser.', 'qtranslate'); ?>
633
+ </td>
634
+ </tr>
635
+ </table>
636
+ <?php qtranxf_admin_section_end('general'); ?>
637
+ <?php qtranxf_admin_section_start('Advanced Settings','advanced'); ?>
638
+ <table class="form-table" id="qtranslate-admin-advanced" style="display: none">
639
+ <tr>
640
+ <th scope="row"><?php _e('URL Modification Mode', 'qtranslate') ?></th>
641
+ <td>
642
+ <fieldset><legend class="hidden"><?php _e('URL Modification Mode', 'qtranslate') ?></legend>
643
+ <label title="Pre-Path Mode"><input type="radio" name="url_mode" value="<?php echo QTX_URL_PATH; ?>" <?php echo ($q_config['url_mode']==QTX_URL_PATH)?"checked=\"checked\"":""; ?> /> <?php echo __('Use Pre-Path Mode (Default, puts /en/ in front of URL)', 'qtranslate').'. SEO '.__('friendly', 'qtranslate').'.'; ?></label><br />
644
+ <label title="Pre-Domain Mode"><input type="radio" name="url_mode" value="<?php echo QTX_URL_DOMAIN; ?>" <?php echo ($q_config['url_mode']==QTX_URL_DOMAIN)?"checked=\"checked\"":""; ?> /> <?php echo __('Use Pre-Domain Mode (uses http://en.yoursite.com)', 'qtranslate').'. '.__('You will need to configure DNS sub-domains on your site.', 'qtranslate'); ?></label><br />
645
+ <label title="Query Mode"><input type="radio" name="url_mode" value="<?php echo QTX_URL_QUERY; ?>" <?php echo ($q_config['url_mode']==QTX_URL_QUERY)?"checked=\"checked\"":""; ?> /> <?php echo __('Use Query Mode (?lang=en)', 'qtranslate').'. '.__('Most SEO unfriendly, not recommended.', 'qtranslate'); ?></label><br />
646
+ </fieldset><br/>
647
+ <?php _e('Pre-Path and Pre-Domain mode will only work with mod_rewrite/pretty permalinks. Additional Configuration is needed for Pre-Domain mode!', 'qtranslate'); ?><br/>
648
+ <label for="hide_default_language"><input type="checkbox" name="hide_default_language" id="hide_default_language" value="1"<?php echo ($q_config['hide_default_language'])?' checked="checked"':''; ?>/> <?php _e('Hide URL language information for default language.', 'qtranslate'); ?></label>
649
+ </td>
650
+ </tr>
651
+ <tr valign="top">
652
+ <th scope="row"><?php _e('Flag Image Path', 'qtranslate');?></th>
653
+ <td>
654
+ <?php echo trailingslashit(WP_CONTENT_URL); ?><input type="text" name="flag_location" id="flag_location" value="<?php echo $q_config['flag_location']; ?>" style="width:50%"/>
655
+ <br/>
656
+ <?php _e('Path to the flag images under wp-content, with trailing slash. (Default: plugins/qtranslate-x/flags/)', 'qtranslate'); ?>
657
+ </td>
658
+ </tr>
659
+ <tr valign="top">
660
+ <th scope="row"><?php _e('Ignore Links', 'qtranslate');?></th>
661
+ <td>
662
+ <input type="text" name="ignore_file_types" id="ignore_file_types" value="<?php echo $q_config['ignore_file_types']; ?>" style="width:100%"/>
663
+ <br/>
664
+ <?php _e('Don\'t convert Links to files of the given file types. (Default: gif,jpg,jpeg,png,pdf,swf,tif,rar,zip,7z,mpg,divx,mpeg,avi,css,js)', 'qtranslate'); ?>
665
+ </td>
666
+ </tr>
667
+ <tr valign="top">
668
+ <th scope="row"><?php _e('Update Gettext Databases', 'qtranslate');?></th>
669
+ <td>
670
+ <label for="auto_update_mo"><input type="checkbox" name="auto_update_mo" id="auto_update_mo" value="1"<?php echo ($q_config['auto_update_mo'])?' checked="checked"':''; ?>/> <?php _e('Automatically check for .mo-Database Updates of installed languages.', 'qtranslate'); ?></label>
671
+ <br/>
672
+ <label for="update_mo_now"><input type="checkbox" name="update_mo_now" id="update_mo_now" value="1" /> <?php _e('Update Gettext databases now.', 'qtranslate'); ?></label>
673
+ <br/>
674
+ <?php _e('qTranslate will query the Wordpress Localisation Repository every week and download the latest Gettext Databases (.mo Files).', 'qtranslate'); ?>
675
+ </td>
676
+ </tr>
677
+ <tr valign="top">
678
+ <th scope="row"><?php _e('Date / Time Conversion', 'qtranslate');?></th>
679
+ <td>
680
+ <label><input type="radio" name="use_strftime" value="<?php echo QTX_DATE; ?>" <?php echo ($q_config['use_strftime']==QTX_DATE)?' checked="checked"':''; ?>/> <?php _e('Use emulated date function.', 'qtranslate'); ?></label><br />
681
+ <label><input type="radio" name="use_strftime" value="<?php echo QTX_DATE_OVERRIDE; ?>" <?php echo ($q_config['use_strftime']==QTX_DATE_OVERRIDE)?' checked="checked"':''; ?>/> <?php _e('Use emulated date function and replace formats with the predefined formats for each language.', 'qtranslate'); ?></label><br />
682
+ <label><input type="radio" name="use_strftime" value="<?php echo QTX_STRFTIME; ?>" <?php echo ($q_config['use_strftime']==QTX_STRFTIME)?' checked="checked"':''; ?>/> <?php _e('Use strftime instead of date.', 'qtranslate'); ?></label><br />
683
+ <label><input type="radio" name="use_strftime" value="<?php echo QTX_STRFTIME_OVERRIDE; ?>" <?php echo ($q_config['use_strftime']==QTX_STRFTIME_OVERRIDE)?' checked="checked"':''; ?>/> <?php _e('Use strftime instead of date and replace formats with the predefined formats for each language.', 'qtranslate'); ?></label><br />
684
+ <?php _e('Depending on the mode selected, additional customizations of the theme may be needed.', 'qtranslate'); ?>
685
+ </td>
686
+ </tr>
687
+ <tr valign="top">
688
+ <th scope="row"><?php _e('Custom Fields', 'qtranslate');?></th>
689
+ <td>
690
+ <input type="text" name="custom_fields" id="qtranxs_custom_fields" value="<?php echo implode(' ',$q_config['custom_fields']); ?>" style="width:100%">
691
+ <p><?php printf(__('Enter "id" attribute of text fields from your theme, which you wish to translate. This applies to post, page and media editors (/wp-admin/post*). To lookup "id", right-click on the field in the post or the page editor and choose "Inspect Element". Look for an attribute of the field named "id". Enter it here, as many as you need, space-separated. After saving configuration, these fields will start responding to the language switching buttons, and you can enter different text for each language. For more information, read %sFAQ%s.', 'qtranslate'),'<a href="https://wordpress.org/plugins/qtranslate-x/faq/">','</a>'); ?></p>
692
+ </td>
693
+ </tr>
694
+ <?php/*
695
+ <tr>
696
+ <th scope="row"><?php _e('Debugging Information', 'qtranslate');?></th>
697
+ <td>
698
+ <p><?php printf(__('If you encounter any problems and you are unable to solve them yourself, you can visit the <a href="%s">Support Forum</a>. Posting the following Content will help other detect any misconfigurations.', 'qtranslate'), 'https://wordpress.org/support/plugin/qtranslate-x'); ?></p>
699
+ <textarea readonly="readonly" id="qtranxs_debug"><?php
700
+ $q_config_copy = $q_config;
701
+ // remove information to keep data anonymous and other not needed things
702
+ unset($q_config_copy['url_info']);
703
+ unset($q_config_copy['js']);
704
+ unset($q_config_copy['windows_locale']);
705
+ unset($q_config_copy['pre_domain']);
706
+ unset($q_config_copy['term_name']);
707
+ echo htmlspecialchars(print_r($q_config_copy, true));
708
+ ?></textarea>
709
+ </td>
710
+ </tr>
711
+ */?>
712
+ </table>
713
+ <?php qtranxf_admin_section_end('advanced'); ?>
714
+ <?php do_action('qtranslate_configuration', $clean_uri); ?>
715
+ <p class="submit">
716
+ <input type="submit" name="submit" class="button-primary" value="<?php _e('Save Changes', 'qtranslate') ?>" />
717
+ </p>
718
+ </form>
719
+
720
+ </div>
721
+ <div class="wrap">
722
+
723
+ <h2><?php _e('Languages', 'qtranslate') ?></h2>
724
+ <div id="col-container">
725
+
726
+ <div id="col-right">
727
+ <div class="col-wrap">
728
+
729
+ <table class="widefat">
730
+ <thead>
731
+ <tr>
732
+ <?php print_column_headers('language'); ?>
733
+ </tr>
734
+ </thead>
735
+
736
+ <tfoot>
737
+ <tr>
738
+ <?php print_column_headers('language', false); ?>
739
+ </tr>
740
+ </tfoot>
741
+
742
+ <tbody id="the-list" class="qtranxs-language-list" class="list:cat">
743
+ <?php foreach($q_config['language_name'] as $lang => $language){ if($lang!='code') { ?>
744
+ <tr>
745
+ <td><img src="<?php echo trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$lang]; ?>" alt="<?php echo $language; ?> Flag"></td>
746
+ <td><?php echo $language; ?></td>
747
+ <td><?php if(in_array($lang,$q_config['enabled_languages'])) { ?><a class="edit" href="<?php echo $clean_uri; ?>&disable=<?php echo $lang; ?>"><?php _e('Disable', 'qtranslate'); ?></a><?php } else { ?><a class="edit" href="<?php echo $clean_uri; ?>&enable=<?php echo $lang; ?>"><?php _e('Enable', 'qtranslate'); ?></a><?php } ?></td>
748
+ <td><a class="edit" href="<?php echo $clean_uri; ?>&edit=<?php echo $lang; ?>"><?php _e('Edit', 'qtranslate'); ?></a></td>
749
+ <td><?php if($q_config['default_language']==$lang) { ?><?php _e('Default', 'qtranslate'); ?><?php } else { ?><a class="delete" href="<?php echo $clean_uri; ?>&delete=<?php echo $lang; ?>"><?php _e('Delete', 'qtranslate'); ?></a><?php } ?></td>
750
+ </tr>
751
+ <?php }} ?>
752
+ </tbody>
753
+ </table>
754
+ <p><?php _e('Enabling a language will cause qTranslate to update the Gettext-Database for the language, which can take a while depending on your server\'s connection speed.', 'qtranslate');?></p>
755
+ </div>
756
+ </div><!-- /col-right -->
757
+
758
+ <div id="col-left">
759
+ <div class="col-wrap">
760
+ <div class="form-wrap">
761
+ <h3><?php _e('Add Language', 'qtranslate'); ?></h3>
762
+ <form name="addcat" id="addcat" method="post" class="add:the-list: validate">
763
+ <?php qtranxf_language_form($language_code, $language_code, $language_name, $language_locale, $language_date_format, $language_time_format, $language_flag, $language_default, $language_na_message); ?>
764
+ <p class="submit"><input type="submit" name="submit" value="<?php _e('Add Language &raquo;', 'qtranslate'); ?>" /></p>
765
+ </form></div>
766
+ </div>
767
+ </div><!-- /col-left -->
768
+
769
+ </div><!-- /col-container -->
770
+ <?php
771
+ }
772
+ }
773
+
774
+ /* Add a metabox in admin menu page */
775
+ function qtranxf_nav_menu_metabox( $object )
776
+ {
777
+ global $nav_menu_selected_id;
778
+
779
+ $elems = array( '#qtransLangSwLM#' => __('Language Menu') );
780
+
781
+ class qtranxcLangSwItems {
782
+ public $db_id = 0;
783
+ public $object = 'qtranslangsw';
784
+ public $object_id;
785
+ public $menu_item_parent = 0;
786
+ public $type = 'custom';
787
+ public $title;
788
+ public $url;
789
+ public $target = '';
790
+ public $attr_title = '';
791
+ public $classes = array();
792
+ public $xfn = '';
793
+ }
794
+
795
+ $elems_obj = array();
796
+ foreach ( $elems as $value => $title ) {
797
+ $elems_obj[$title] = new qtranxcLangSwItems();
798
+ $elems_obj[$title]->object_id = esc_attr( $value );
799
+ $elems_obj[$title]->title = esc_attr( $title );
800
+ $elems_obj[$title]->url = esc_attr( $value );
801
+ }
802
+
803
+ $walker = new Walker_Nav_Menu_Checklist( array() );
804
+ /* Language menu items
805
+ .qtranxs-lang-menu
806
+ {
807
+ //background-position: top left;
808
+ background-position-y: 8px;
809
+ padding-left: 22px;
810
+ }
811
+
812
+ .qtranxs-lang-menu-item
813
+ {
814
+ background-position: center left;
815
+ //background-position-x: 5px;
816
+ //background-position-y:50%;
817
+ padding-left: 22px;
818
+ }
819
+ */
820
+ ?>
821
+ <div id="qtranxs-langsw" class="qtranxslangswdiv">
822
+ <div id="tabs-panel-qtranxs-langsw-all" class="tabs-panel tabs-panel-view-all tabs-panel-active">
823
+ <ul id="qtranxs-langswchecklist" class="list:qtranxs-langsw categorychecklist form-no-clear">
824
+ <?php echo walk_nav_menu_tree( array_map( 'wp_setup_nav_menu_item', $elems_obj ), 0, (object)array( 'walker' => $walker ) ); ?>
825
+ </ul>
826
+ </div>
827
+ <span class="list-controls hide-if-no-js">
828
+ <a href="javascript:void(0);" class="help" onclick="jQuery( '#help-login-links' ).toggle();"><?php _e( 'Help' ); ?></a>
829
+ <span class="hide-if-js" id="help-login-links"><br /><a name="help-login-links"></a>
830
+ Menu item added is replaced with a sub-menu of available languages when menu is rendered. Depending on how your theme renders menu you may need to override and customize css entries .qtranxs-lang-menu and .qtranxs-lang-menu-item, originally defined in qtranslate.css.
831
+ </span>
832
+ </span>
833
+ <p class="button-controls">
834
+ <span class="add-to-menu">
835
+ <input type="submit"<?php disabled( $nav_menu_selected_id, 0 ); ?> class="button-secondary submit-add-to-menu right" value="<?php esc_attr_e('Add to Menu'); ?>" name="add-qtranxs-langsw-menu-item" id="submit-qtranxs-langsw" />
836
+ <span class="spinner"></span>
837
+ </span>
838
+ </p>
839
+ </div>
840
+ <?php
841
+ }
842
+
843
+ function qtranxf_add_nav_menu_metabox()
844
+ {
845
+ add_meta_box( 'add-qtranxs-language-switcher', __( 'Language Switcher' ), 'qtranxf_nav_menu_metabox', 'nav-menus', 'side', 'default' );
846
+ }
847
+
848
+ function qtranxf_add_language_menu( $wp_admin_bar )
849
+ {
850
+ global $q_config;
851
+ if ( !is_admin() || !is_admin_bar_showing() )
852
+ return;
853
+
854
+ $wp_admin_bar->add_menu( array(
855
+ 'id' => 'language',
856
+ 'parent' => 'top-secondary',
857
+ //'meta' => array('class'),
858
+ 'title' => $q_config['language_name'][$q_config['language']]
859
+ )
860
+ );
861
+
862
+ foreach($q_config['enabled_languages'] as $language)
863
+ {
864
+ $wp_admin_bar->add_menu(
865
+ array
866
+ (
867
+ 'id' => $language,
868
+ 'parent' => 'language',
869
+ 'title' => $q_config['language_name'][$language],
870
+ 'href' => add_query_arg('lang', $language)
871
+ )
872
+ );
873
+ }
874
+ }
875
+
876
+ add_filter('get_term', 'qtranxf_useAdminTermLib',0);
877
+ add_filter('get_terms', 'qtranxf_useAdminTermLib',0);
878
+
879
+ add_action('admin_head', 'qtranxf_add_css');
880
+ add_action('admin_head', 'qtranxf_admin_head');
881
+ add_action('admin_head-nav-menus.php', 'qtranxf_add_nav_menu_metabox');
882
+ add_action('admin_menu', 'qtranxf_adminMenu');
883
+ add_action('admin_bar_menu', 'qtranxf_add_language_menu', 999);
884
+ add_action('wp_before_admin_bar_render', 'qtranxf_fixAdminBar');
885
+ ?>
qtranslate_core.php ADDED
@@ -0,0 +1,951 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // encoding: utf-8
2
+ /*
3
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ /* qTranslate Functions */
21
+
22
+ function qtranxf_init() {
23
+ global $q_config;
24
+ // check if it isn't already initialized
25
+ if(defined('QTRANX_INIT')) return;
26
+ define('QTRANX_INIT',true);
27
+
28
+ do_action('qtranxf_init_begin');
29
+
30
+ qtranxf_loadConfig();
31
+ if(isset($_COOKIE['qtrans_cookie_test'])) {
32
+ $q_config['cookie_enabled'] = true;
33
+ } else {
34
+ $q_config['cookie_enabled'] = false;
35
+ }
36
+
37
+ // update Gettext Databases if on Backend
38
+ if(defined('WP_ADMIN') && $q_config['auto_update_mo']) qtranxf_updateGettextDatabases();
39
+
40
+ // update definitions if neccesary
41
+ if(defined('WP_ADMIN') && current_user_can('manage_categories')) qtranxf_updateTermLibrary();
42
+
43
+ // extract url information
44
+ $q_config['url_info'] = qtranxf_extractURL($_SERVER['REQUEST_URI'], $_SERVER["HTTP_HOST"], isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '');
45
+
46
+ $q_config['WP_CONTENT_URL'] = trailingslashit(WP_CONTENT_URL);
47
+
48
+ // set test cookie
49
+ setcookie('qtrans_cookie_test', 'qTranslateookie Test', 0, $q_config['url_info']['home'], $q_config['url_info']['host']);
50
+ // check cookies for admin
51
+ if(defined('WP_ADMIN')) {
52
+ if(isset($_GET['lang']) && qtranxf_isEnabled($_GET['lang'])) {
53
+ $q_config['language'] = $q_config['url_info']['language'];
54
+ setcookie('qtrans_admin_language', $q_config['language'], time()+60*60*24*30);
55
+ } elseif(isset($_COOKIE['qtrans_admin_language']) && qtranxf_isEnabled($_COOKIE['qtrans_admin_language'])) {
56
+ $q_config['language'] = $_COOKIE['qtrans_admin_language'];
57
+ } else {
58
+ $q_config['language'] = $q_config['default_language'];
59
+ }
60
+ } else {
61
+ $q_config['language'] = $q_config['url_info']['language'];
62
+ }
63
+
64
+ $q_config['language'] = apply_filters('qtranslate_language', $q_config['language']);
65
+
66
+ // detect language and forward if needed
67
+ if($q_config['detect_browser_language'] && $q_config['url_info']['redirect'] && !isset($_COOKIE['qtrans_cookie_test']) && $q_config['url_info']['language'] == $q_config['default_language']) {
68
+ $target = false;
69
+ $prefered_languages = array();
70
+ if(isset($_SERVER["HTTP_ACCEPT_LANGUAGE"]) && preg_match_all("#([^;,]+)(;[^,0-9]*([0-9\.]+)[^,]*)?#i",$_SERVER["HTTP_ACCEPT_LANGUAGE"], $matches, PREG_SET_ORDER)) {
71
+ $priority = 1.0;
72
+ foreach($matches as $match) {
73
+ if(!isset($match[3])) {
74
+ $pr = $priority;
75
+ $priority -= 0.001;
76
+ } else {
77
+ $pr = floatval($match[3]);
78
+ }
79
+ $prefered_languages[$match[1]] = $pr;
80
+ }
81
+ arsort($prefered_languages, SORT_NUMERIC);
82
+ foreach($prefered_languages as $language => $priority) {
83
+ if(strlen($language)>2) $language = substr($language,0,2);
84
+ if(qtranxf_isEnabled($language)) {
85
+ if($q_config['hide_default_language'] && $language == $q_config['default_language']) break;
86
+ $target = qtranxf_convertURL(get_option('home'),$language);
87
+ break;
88
+ }
89
+ }
90
+ }
91
+ $target = apply_filters("qtranslate_language_detect_redirect", $target);
92
+ if($target !== false) {
93
+ wp_redirect($target);
94
+ exit();
95
+ }
96
+ }
97
+
98
+ /*
99
+ // Check for WP Secret Key Missmatch
100
+ global $wp_default_secret_key;
101
+ if(strpos($q_config['url_info']['url'],'wp-login.php')!==false && defined('AUTH_KEY') && isset($wp_default_secret_key) && $wp_default_secret_key != AUTH_KEY) {
102
+ global $error;
103
+ $error = __('Your $wp_default_secret_key is mismatchting with your AUTH_KEY. This might cause you not to be able to login anymore.', 'qtranslate');
104
+ }
105
+ */
106
+
107
+ // Filter all options for language tags
108
+ if(!defined('WP_ADMIN')) {
109
+ $alloptions = wp_load_alloptions();
110
+ foreach($alloptions as $option => $value) {
111
+ add_filter('option_'.$option, 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
112
+ }
113
+ }
114
+
115
+ // load plugin translations
116
+ load_plugin_textdomain('qtranslate', false, dirname(plugin_basename( __FILE__ )).'/lang');
117
+
118
+ // remove traces of language (or better not?)
119
+ //unset($_GET['lang']);
120
+ $_SERVER['REQUEST_URI'] = $q_config['url_info']['url'];
121
+ $_SERVER['HTTP_HOST'] = $q_config['url_info']['host'];
122
+
123
+ // fix url to prevent xss
124
+ $q_config['url_info']['url'] = qtranxf_convertURL(add_query_arg('lang',$q_config['default_language'],$q_config['url_info']['url']));
125
+
126
+ //allow other plugins to initialize whatever they need
127
+ do_action('qtranxf_init');
128
+
129
+ /* /"WordPress SEO" plugin support - not yet
130
+ //if(is_plugin_active( 'wordpress-seo/wp-seo.php' )){//in admin only
131
+ if ( defined( 'WPSEO_FILE' ) ) {
132
+ //add_filter('wpseo_replacements', 'qtranxf_wpseo_replacements', 0);
133
+ add_filter('wpseo_replacements', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage', 0);
134
+ }*/
135
+ }
136
+
137
+ function qtranxf_resolveLangCase($lang,&$caseredirect)
138
+ {
139
+ if(qtranxf_isEnabled($lang)) return $lang;
140
+ $lng=strtolower($lang);
141
+ if(qtranxf_isEnabled($lng)){
142
+ $caseredirect=true;
143
+ return $lng;
144
+ }
145
+ $lng=strtoupper($lang);
146
+ if(qtranxf_isEnabled($lng)){
147
+ $caseredirect=true;
148
+ return $lng;
149
+ }
150
+ return FALSE;
151
+ }
152
+
153
+ // returns cleaned string and language information
154
+ function qtranxf_extractURL($url, $host = '', $referer = '') {
155
+ global $q_config;
156
+ $home = qtranxf_parseURL(get_option('home'));
157
+ $home['path'] = trailingslashit($home['path']);
158
+ $referer = qtranxf_parseURL($referer);
159
+
160
+ $result = array();
161
+ $result['url'] = $url;
162
+ $result['original_url'] = $url;
163
+ $result['host'] = $host;
164
+ $result['redirect'] = false;
165
+ $result['internal_referer'] = false;
166
+ $result['home'] = $home['path'];
167
+ $caseredirect=false;
168
+
169
+ switch($q_config['url_mode']) {
170
+ case QTX_URL_PATH:
171
+ // pre url
172
+ $url = substr($url, strlen($home['path']));
173
+ if($url) {
174
+ // might have language information
175
+ if(preg_match("#^([a-z]{2})(/.*)?$#i",$url,$match)) {
176
+ $lang = qtranxf_resolveLangCase($match[1],$caseredirect);
177
+ if($lang){
178
+ // found language information
179
+ $result['language'] = $lang;
180
+ $result['url'] = $home['path'].substr($url, 3);
181
+ }
182
+ }
183
+ }
184
+ break;
185
+ case QTX_URL_DOMAIN:
186
+ // pre domain
187
+ if($host) {
188
+ if(preg_match("#^([a-z]{2}).#i",$host,$match)) {
189
+ $lang = qtranxf_resolveLangCase($match[1],$caseredirect);
190
+ if($lang){
191
+ // found language information
192
+ $result['language'] = $lang;
193
+ $result['host'] = substr($host, 3);
194
+ }
195
+ }
196
+ }
197
+ break;
198
+ }
199
+
200
+ if (isset($result['language'])){
201
+ setcookie('language', $lang, time()+1209600, COOKIEPATH);
202
+ }else{
203
+ if (isset($_COOKIE['language'])){
204
+ $lang=qtranxf_resolveLangCase($_COOKIE['language'],$caseredirect);
205
+ if($lang){
206
+ $result['language']=$lang;
207
+ if($caseredirect){
208
+ setcookie('language', $lang, time()+1209600, COOKIEPATH);
209
+ $caseredirect=false;
210
+ }
211
+ }
212
+ }else{
213
+ $result['language']=$q_config['default_language'];
214
+ }
215
+ }
216
+
217
+ // check if referer is internal
218
+ if($referer['host']==$result['host'] && qtranxf_startsWith($referer['path'], $home['path'])) {
219
+ // user coming from internal link
220
+ $result['internal_referer'] = true;
221
+ }
222
+
223
+ if(isset($_GET['lang'])){
224
+ $lang = qtranxf_resolveLangCase($_GET['lang'],$caseredirect);
225
+ if($lang){
226
+ // language override given
227
+ $result['language'] = $lang;
228
+ $result['url'] = preg_replace("#(&|\?)lang=".$lang."&?#i","$1",$result['url']);
229
+ $result['url'] = preg_replace("#[\?\&]+$#i","",$result['url']);
230
+ } elseif($home['host'] == $result['host'] && $home['path'] == $result['url']) {
231
+ if(empty($referer['host'])||!$q_config['hide_default_language']) {
232
+ $result['redirect'] = true;
233
+ }else{
234
+ // check if activating language detection is possible
235
+ if(preg_match("#^([a-z]{2}).#i",$referer['host'],$match)) {
236
+ $lang = qtranxf_resolveLangCase($match[1],$cs);
237
+ if($lang) {
238
+ // found language information
239
+ $referer['host'] = substr($referer['host'], 3);
240
+ }
241
+ }
242
+ if(!$result['internal_referer']) {
243
+ // user coming from external link
244
+ $result['redirect'] = true;
245
+ }
246
+ }
247
+ }
248
+ }
249
+
250
+ if($caseredirect){
251
+ $url=$result['host'].$result['url'];
252
+ if(isset($_SERVER['HTTPS']))
253
+ $url='https://'.$url;
254
+ else
255
+ $url='http://'.$url;
256
+ $url=qtranxf_convertURL($url,$lang,false,true);
257
+ header('Location: '.$url);
258
+ exit();
259
+ }
260
+
261
+ return $result;
262
+ }
263
+
264
+ function qtranxf_validateBool($var, $default) {
265
+ if($var==='0') return false; elseif($var==='1') return true; else return $default;
266
+ }
267
+
268
+ // loads config via get_option and defaults to values set on top
269
+ function qtranxf_loadConfig() {
270
+ global $q_config;
271
+
272
+ //for other plugins and jave scripts to be able to fork by version
273
+ //$q_config['version'] = get_plugin_data( plugins_url( '/qtranslate.php', __FILE__ ), false, false )['Version'];
274
+
275
+ // Load everything
276
+ $language_names = get_option('qtranslate_language_names');
277
+ $enabled_languages = get_option('qtranslate_enabled_languages');
278
+ $default_language = get_option('qtranslate_default_language');
279
+ $flag_location = get_option('qtranslate_flag_location');
280
+ $flags = get_option('qtranslate_flags');
281
+ $locales = get_option('qtranslate_locales');
282
+ $na_messages = get_option('qtranslate_na_messages');
283
+ $date_formats = get_option('qtranslate_date_formats');
284
+ $time_formats = get_option('qtranslate_time_formats');
285
+ $use_strftime = get_option('qtranslate_use_strftime');
286
+ $ignore_file_types = get_option('qtranslate_ignore_file_types');
287
+ $url_mode = get_option('qtranslate_url_mode');
288
+ $detect_browser_language = get_option('qtranslate_detect_browser_language');
289
+ $hide_untranslated = get_option('qtranslate_hide_untranslated');
290
+ $auto_update_mo = get_option('qtranslate_auto_update_mo');
291
+ $term_name = get_option('qtranslate_term_name');
292
+ $hide_default_language = get_option('qtranslate_hide_default_language');
293
+ $custom_fields = get_option('qtranslate_custom_fields');
294
+
295
+ // default if not set
296
+ if(!is_array($date_formats)) $date_formats = $q_config['date_format'];
297
+ if(!is_array($time_formats)) $time_formats = $q_config['time_format'];
298
+ if(!is_array($na_messages)) $na_messages = $q_config['not_available'];
299
+ if(!is_array($locales)) $locales = $q_config['locale'];
300
+ if(!is_array($flags)) $flags = $q_config['flag'];
301
+ if(!is_array($language_names)) $language_names = $q_config['language_name'];
302
+ if(!is_array($enabled_languages)) $enabled_languages = $q_config['enabled_languages'];
303
+ if(!is_array($term_name)) $term_name = $q_config['term_name'];
304
+ if(!is_array($custom_fields)) $custom_fields = array();
305
+ if(empty($ignore_file_types)) $ignore_file_types = $q_config['ignore_file_types'];
306
+ if(empty($default_language)) $default_language = $q_config['default_language'];
307
+ if(empty($use_strftime)) $use_strftime = $q_config['use_strftime'];
308
+ if(empty($url_mode)) $url_mode = $q_config['url_mode'];
309
+ if(!is_string($flag_location) || $flag_location==='') $flag_location = $q_config['flag_location'];
310
+ $detect_browser_language = qtranxf_validateBool($detect_browser_language, $q_config['detect_browser_language']);
311
+ $hide_untranslated = qtranxf_validateBool($hide_untranslated, $q_config['hide_untranslated']);
312
+ $auto_update_mo = qtranxf_validateBool($auto_update_mo, $q_config['auto_update_mo']);
313
+ $hide_default_language = qtranxf_validateBool($hide_default_language, $q_config['hide_default_language']);
314
+
315
+ // url fix for upgrading users
316
+ $flag_location = trailingslashit(preg_replace('#^wp-content/#','',$flag_location));
317
+
318
+ // check for invalid permalink/url mode combinations
319
+ $permalink_structure = get_option('permalink_structure');
320
+ if($permalink_structure===""||strpos($permalink_structure,'?')!==false||strpos($permalink_structure,'index.php')!==false) $url_mode = QTX_URL_QUERY;
321
+
322
+ // overwrite default values with loaded values
323
+ $q_config['date_format'] = $date_formats;
324
+ $q_config['time_format'] = $time_formats;
325
+ $q_config['not_available'] = $na_messages;
326
+ $q_config['locale'] = $locales;
327
+ $q_config['flag'] = $flags;
328
+ $q_config['language_name'] = $language_names;
329
+ $q_config['enabled_languages'] = $enabled_languages;
330
+ $q_config['default_language'] = $default_language;
331
+ $q_config['flag_location'] = $flag_location;
332
+ $q_config['use_strftime'] = $use_strftime;
333
+ $q_config['ignore_file_types'] = $ignore_file_types;
334
+ $q_config['url_mode'] = $url_mode;
335
+ $q_config['detect_browser_language'] = $detect_browser_language;
336
+ $q_config['hide_untranslated'] = $hide_untranslated;
337
+ $q_config['auto_update_mo'] = $auto_update_mo;
338
+ $q_config['hide_default_language'] = $hide_default_language;
339
+ $q_config['term_name'] = $term_name;
340
+ $q_config['custom_fields'] = $custom_fields;
341
+
342
+ do_action('qtranslate_loadConfig');
343
+ }
344
+
345
+ // saves entire configuration
346
+ function qtranxf_saveConfig() {
347
+ global $q_config;
348
+
349
+ // save everything
350
+ update_option('qtranslate_language_names', $q_config['language_name']);
351
+ update_option('qtranslate_enabled_languages', $q_config['enabled_languages']);
352
+ update_option('qtranslate_default_language', $q_config['default_language']);
353
+ update_option('qtranslate_flag_location', $q_config['flag_location']);
354
+ update_option('qtranslate_flags', $q_config['flag']);
355
+ update_option('qtranslate_locales', $q_config['locale']);
356
+ update_option('qtranslate_na_messages', $q_config['not_available']);
357
+ update_option('qtranslate_date_formats', $q_config['date_format']);
358
+ update_option('qtranslate_time_formats', $q_config['time_format']);
359
+ update_option('qtranslate_ignore_file_types', $q_config['ignore_file_types']);
360
+ update_option('qtranslate_url_mode', $q_config['url_mode']);
361
+ update_option('qtranslate_term_name', $q_config['term_name']);
362
+ update_option('qtranslate_use_strftime', $q_config['use_strftime']);
363
+ update_option('qtranslate_custom_fields', $q_config['custom_fields']);
364
+ if($q_config['detect_browser_language'])
365
+ update_option('qtranslate_detect_browser_language', '1');
366
+ else
367
+ update_option('qtranslate_detect_browser_language', '0');
368
+ if($q_config['hide_untranslated'])
369
+ update_option('qtranslate_hide_untranslated', '1');
370
+ else
371
+ update_option('qtranslate_hide_untranslated', '0');
372
+ if($q_config['auto_update_mo'])
373
+ update_option('qtranslate_auto_update_mo', '1');
374
+ else
375
+ update_option('qtranslate_auto_update_mo', '0');
376
+ if($q_config['hide_default_language'])
377
+ update_option('qtranslate_hide_default_language', '1');
378
+ else
379
+ update_option('qtranslate_hide_default_language', '0');
380
+
381
+ do_action('qtranslate_saveConfig');
382
+ }
383
+
384
+ function qtranxf_updateGettextDatabaseFile($lcr,$mo){
385
+ $tmpfile=$mo.'.filepart';
386
+ $ll = fopen($tmpfile,'w');
387
+ if(!$ll) return false;
388
+ while(!feof($lcr)) {
389
+ // try to get some more time
390
+ @set_time_limit(30);
391
+ $lc = fread($lcr, 8192);
392
+ if(!$lc){
393
+ fclose($lcr);
394
+ fclose($ll);
395
+ unlink($tmpfile);
396
+ return false;
397
+ }
398
+ fwrite($ll,$lc);
399
+ }
400
+ fclose($lcr);
401
+ fclose($ll);
402
+ // only use completely download .mo files
403
+ rename($tmpfile,$mo);
404
+ return true;
405
+ }
406
+
407
+ function qtranxf_updateGettextDatabaseFiles($lcr,$locale,$dstdir,$srcdir){
408
+ if($lcr){
409
+ $mo=$dstdir.$locale.'.mo';
410
+ qtranxf_updateGettextDatabaseFile($lcr,$mo);
411
+ }
412
+ if(!$m) return;
413
+ }
414
+
415
+ function qtranxf_updateGettextDatabase($locale,$repository){
416
+ $dstdir=trailingslashit(WP_LANG_DIR);
417
+ $tmpfile=$dstdir.$locale.'.mo.filepart';
418
+ if(!$ll = @fopen($tmpfile,'a'))
419
+ return false; // cannot access .mo file
420
+ fclose($ll);
421
+ $wp_version = $GLOBALS['wp_version'];
422
+ // try to find a .mo file
423
+ if(!($locale == 'en_US' && $lcr=@fopen('http://www.qianqin.de/wp-content/languages/'.$locale.'.mo','r')))
424
+ if(!$lcr=@fopen(($m=$repository.$locale.'/tags/'.$wp_version.'/messages/').$locale.'.mo','r'))
425
+ if(!$lcr=@fopen(($m=$repository.substr($locale,0,2).'/tags/'.$wp_version.'/messages/').$locale.'.mo','r'))
426
+ if(!$lcr=@fopen(($m=$repository.$locale.'/branches/'.$wp_version.'/messages/').$locale.'.mo','r'))
427
+ if(!$lcr=@fopen(($m=$repository.substr($locale,0,2).'/branches/'.$wp_version.'/messages/').$locale.'.mo','r'))
428
+ if(!$lcr=@fopen($repository.$locale.'/branches/'.$wp_version.'/'.$locale.'.mo','r'))
429
+ if(!$lcr=@fopen($repository.substr($locale,0,2).'/branches/'.$wp_version.'/'.$locale.'.mo','r'))
430
+ if(!$lcr=@fopen($repository.$locale.'/trunk/messages/'.$locale.'.mo','r'))
431
+ if(!$lcr=@fopen($repository.substr($locale,0,2).'/trunk/messages/'.$locale.'.mo','r'))
432
+ {
433
+ $tagsfile=file($repository.$locale.'/tags/');
434
+ $tags=array();
435
+ foreach( $tagsfile as $ln ){
436
+ if(!preg_match('/href="(\d.*)"/',$ln,$match)) continue;
437
+ $tag=$match[1];
438
+ $tags[]=$tag;
439
+ }
440
+ $tags=array_reverse($tags);
441
+ foreach( $tags as $tag ){
442
+ $m=$repository.$locale.'/tags/'.$tag.'messages/';
443
+ $mo=$m.$locale.'.mo';
444
+ //if(file_exists())
445
+ if(!$lcr=@fopen($mo,'r')) continue;
446
+ break;
447
+ }
448
+ if(!$lcr){// couldn't find a .mo file
449
+ if(filesize($tmpfile)==0) unlink($tmpfile);
450
+ return false;
451
+ }
452
+ }
453
+ // found a .mo file, update local .mo
454
+ qtranxf_updateGettextDatabaseFiles($lcr,$locale,$dstdir,$m);
455
+ return true;
456
+ }
457
+
458
+ function qtranxf_updateGettextDatabases($force = false, $only_for_language = '') {
459
+ global $q_config;
460
+ if($only_for_language && !qtranxf_isEnabled($only_for_language)) return false;
461
+ if(!is_dir(WP_LANG_DIR)) {
462
+ if(!@mkdir(WP_LANG_DIR))
463
+ return false;
464
+ }
465
+ $next_update = get_option('qtranslate_next_update_mo');
466
+ if(time() < $next_update && !$force) return true;
467
+ update_option('qtranslate_next_update_mo', time() + 7*24*60*60);
468
+ //$repository='http://i18n.svn.wordpress.org/';
469
+ $repository='http://svn.automattic.com/wordpress-i18n/';
470
+ foreach($q_config['locale'] as $lang => $locale) {
471
+ if($only_for_language && $lang != $only_for_language) continue;
472
+ if(!qtranxf_isEnabled($lang)) continue;
473
+ qtranxf_updateGettextDatabase($locale,$repository);
474
+ }
475
+ return true;
476
+ }
477
+
478
+ function qtranxf_updateTermLibrary() {
479
+ global $q_config;
480
+ if(!isset($_POST['action'])) return;
481
+ switch($_POST['action']) {
482
+ case 'editedtag':
483
+ case 'addtag':
484
+ case 'editedcat':
485
+ case 'addcat':
486
+ case 'add-cat':
487
+ case 'add-tag':
488
+ case 'add-link-cat':
489
+ if(isset($_POST['qtranx_term_'.$q_config['default_language']]) && $_POST['qtranx_term_'.$q_config['default_language']]!='') {
490
+ $default = htmlspecialchars(qtranxf_stripSlashesIfNecessary($_POST['qtranx_term_'.$q_config['default_language']]), ENT_NOQUOTES);
491
+ if(!isset($q_config['term_name'][$default]) || !is_array($q_config['term_name'][$default])) $q_config['term_name'][$default] = array();
492
+ foreach($q_config['enabled_languages'] as $lang) {
493
+ $_POST['qtranx_term_'.$lang] = qtranxf_stripSlashesIfNecessary($_POST['qtranx_term_'.$lang]);
494
+ if($_POST['qtranx_term_'.$lang]!='') {
495
+ $q_config['term_name'][$default][$lang] = htmlspecialchars($_POST['qtranx_term_'.$lang], ENT_NOQUOTES);
496
+ } else {
497
+ $q_config['term_name'][$default][$lang] = $default;
498
+ }
499
+ }
500
+ update_option('qtranslate_term_name',$q_config['term_name']);
501
+ }
502
+ break;
503
+ }
504
+ }
505
+
506
+ /* BEGIN DATE TIME FUNCTIONS */
507
+
508
+ function qtranxf_strftime($format, $date, $default = '', $before = '', $after = '') {
509
+ // don't do anything if format is not given
510
+ if($format=='') return $default;
511
+ // add date suffix ability (%q) to strftime
512
+ $day = intval(ltrim(strftime("%d",$date),'0'));
513
+ $search = array();
514
+ $replace = array();
515
+
516
+ // date S
517
+ $search[] = '/(([^%])%q|^%q)/';
518
+ if($day==1||$day==21||$day==31) {
519
+ $replace[] = '$2st';
520
+ } elseif($day==2||$day==22) {
521
+ $replace[] = '$2nd';
522
+ } elseif($day==3||$day==23) {
523
+ $replace[] = '$2rd';
524
+ } else {
525
+ $replace[] = '$2th';
526
+ }
527
+
528
+ $search[] = '/(([^%])%E|^%E)/'; $replace[] = '${2}'.$day; // date j
529
+ $search[] = '/(([^%])%f|^%f)/'; $replace[] = '${2}'.date('w',$date); // date w
530
+ $search[] = '/(([^%])%F|^%F)/'; $replace[] = '${2}'.date('z',$date); // date z
531
+ $search[] = '/(([^%])%i|^%i)/'; $replace[] = '${2}'.date('n',$date); // date i
532
+ $search[] = '/(([^%])%J|^%J)/'; $replace[] = '${2}'.date('t',$date); // date t
533
+ $search[] = '/(([^%])%k|^%k)/'; $replace[] = '${2}'.date('L',$date); // date L
534
+ $search[] = '/(([^%])%K|^%K)/'; $replace[] = '${2}'.date('B',$date); // date B
535
+ $search[] = '/(([^%])%l|^%l)/'; $replace[] = '${2}'.date('g',$date); // date g
536
+ $search[] = '/(([^%])%L|^%L)/'; $replace[] = '${2}'.date('G',$date); // date G
537
+ $search[] = '/(([^%])%N|^%N)/'; $replace[] = '${2}'.date('u',$date); // date u
538
+ $search[] = '/(([^%])%Q|^%Q)/'; $replace[] = '${2}'.date('e',$date); // date e
539
+ $search[] = '/(([^%])%o|^%o)/'; $replace[] = '${2}'.date('I',$date); // date I
540
+ $search[] = '/(([^%])%O|^%O)/'; $replace[] = '${2}'.date('O',$date); // date O
541
+ $search[] = '/(([^%])%s|^%s)/'; $replace[] = '${2}'.date('P',$date); // date P
542
+ $search[] = '/(([^%])%v|^%v)/'; $replace[] = '${2}'.date('T',$date); // date T
543
+ $search[] = '/(([^%])%1|^%1)/'; $replace[] = '${2}'.date('Z',$date); // date Z
544
+ $search[] = '/(([^%])%2|^%2)/'; $replace[] = '${2}'.date('c',$date); // date c
545
+ $search[] = '/(([^%])%3|^%3)/'; $replace[] = '${2}'.date('r',$date); // date r
546
+ $search[] = '/(([^%])%4|^%4)/'; $replace[] = '${2}'.$date; // date U
547
+ $format = preg_replace($search,$replace,$format);
548
+ return $before.strftime($format, $date).$after;
549
+ }
550
+
551
+ function qtranxf_dateFromPostForCurrentLanguage($old_date, $format ='') {
552
+ global $post;
553
+ return qtranxf_strftime(qtranxf_convertDateFormat($format), mysql2date('U',$post->post_date), $old_date);
554
+ }
555
+
556
+ function qtranxf_dateModifiedFromPostForCurrentLanguage($old_date, $format ='') {
557
+ global $post;
558
+ return qtranxf_strftime(qtranxf_convertDateFormat($format), mysql2date('U',$post->post_modified), $old_date);
559
+ }
560
+
561
+ function qtranxf_timeFromPostForCurrentLanguage($old_date, $format = '', $post = null, $gmt = false) {
562
+ $post = get_post($post);
563
+
564
+ $post_date = $gmt? $post->post_date_gmt : $post->post_date;
565
+ return qtranxf_strftime(qtranxf_convertTimeFormat($format), mysql2date('U',$post_date), $old_date);
566
+ }
567
+
568
+ function qtranxf_timeModifiedFromPostForCurrentLanguage($old_date, $format = '', $gmt = false) {
569
+ global $post;
570
+ $post_date = $gmt? $post->post_modified_gmt : $post->post_modified;
571
+ return qtranxf_strftime(qtranxf_convertTimeFormat($format), mysql2date('U',$post_date), $old_date);
572
+ }
573
+
574
+ function qtranxf_dateFromCommentForCurrentLanguage($old_date, $format ='') {
575
+ global $comment;
576
+ return qtranxf_strftime(qtranxf_convertDateFormat($format), mysql2date('U',$comment->comment_date), $old_date);
577
+ }
578
+
579
+ function qtranxf_timeFromCommentForCurrentLanguage($old_date, $format = '', $gmt = false, $translate = true) {
580
+ if(!$translate) return $old_date;
581
+ global $comment;
582
+ $comment_date = $gmt? $comment->comment_date_gmt : $comment->comment_date;
583
+ return qtranxf_strftime(qtranxf_convertTimeFormat($format), mysql2date('U',$comment_date), $old_date);
584
+ }
585
+
586
+ /* END DATE TIME FUNCTIONS */
587
+
588
+ if (!function_exists('qtranxf_useTermLib')){
589
+ function qtranxf_useTermLib($obj) {
590
+ global $q_config;
591
+ if(is_array($obj)) {
592
+ // handle arrays recursively
593
+ foreach($obj as $key => $t) {
594
+ $obj[$key] = qtranxf_useTermLib($obj[$key]);
595
+ }
596
+ return $obj;
597
+ }
598
+ if(is_object($obj)) {
599
+ // object conversion
600
+ if(isset($q_config['term_name'][$obj->name][$q_config['language']])) {
601
+ $obj->name = $q_config['term_name'][$obj->name][$q_config['language']];
602
+ }
603
+ } elseif(isset($q_config['term_name'][$obj][$q_config['language']])) {
604
+ $obj = $q_config['term_name'][$obj][$q_config['language']];
605
+ }
606
+ return $obj;
607
+ }
608
+ }
609
+
610
+ function qtranxf_convertBlogInfoURL($url, $what) {
611
+ if($what=='stylesheet_url') return $url;
612
+ if($what=='template_url') return $url;
613
+ if($what=='template_directory') return $url;
614
+ if($what=='stylesheet_directory') return $url;
615
+ return qtranxf_convertURL($url);
616
+ }
617
+
618
+ if (!function_exists('qtranxf_convertURL')){
619
+ function qtranxf_convertURL($url='', $lang='', $forceadmin = false, $showDefaultLanguage = false) {
620
+ global $q_config;
621
+
622
+ // invalid language
623
+ if($url=='') $url = esc_url($q_config['url_info']['url']);
624
+ if($lang=='') $lang = $q_config['language'];
625
+ if(defined('WP_ADMIN')&&!$forceadmin) return $url;
626
+ if(!qtranxf_isEnabled($lang)) return "";
627
+
628
+ // & workaround
629
+ $url = str_replace('&amp;','&',$url);
630
+ $url = str_replace('&#038;','&',$url);
631
+
632
+ // check for trailing slash
633
+ $nottrailing = (strpos($url,'?')===false && strpos($url,'#')===false && substr($url,-1,1)!='/');
634
+
635
+ // check if it's an external link
636
+ $urlinfo = qtranxf_parseURL($url);
637
+ $home = rtrim(get_option('home'),"/");
638
+ if($urlinfo['host']!='') {
639
+ // check for already existing pre-domain language information
640
+ if($q_config['url_mode'] == QTX_URL_DOMAIN && preg_match("#^([a-z]{2}).#i",$urlinfo['host'],$match)) {
641
+ if(qtranxf_isEnabled($match[1])) {
642
+ // found language information, remove it
643
+ $url = preg_replace("/".$match[1]."\./i","",$url, 1);
644
+ // reparse url
645
+ $urlinfo = qtranxf_parseURL($url);
646
+ }
647
+ }
648
+ if(substr($url,0,strlen($home))!=$home) {
649
+ return $url;
650
+ }
651
+ // strip home path
652
+ $url = substr($url,strlen($home));
653
+ } else {
654
+ // relative url, strip home path
655
+ $homeinfo = qtranxf_parseURL($home);
656
+ if($homeinfo['path']==substr($url,0,strlen($homeinfo['path']))) {
657
+ $url = substr($url,strlen($homeinfo['path']));
658
+ }
659
+ }
660
+
661
+ // check for query language information and remove if found
662
+ if(preg_match("#(&|\?)lang=([^&\#]+)#i",$url,$match) && qtranxf_isEnabled($match[2])) {
663
+ $url = preg_replace("#(&|\?)lang=".$match[2]."&?#i","$1",$url);
664
+ }
665
+
666
+ // remove any slashes out front
667
+ $url = ltrim($url,"/");
668
+
669
+ // remove any useless trailing characters
670
+ $url = rtrim($url,"?&");
671
+
672
+ // reparse url without home path
673
+ $urlinfo = qtranxf_parseURL($url);
674
+
675
+ // check if its a link to an ignored file type
676
+ $ignore_file_types = preg_split('/\s*,\s*/', strtolower($q_config['ignore_file_types']));
677
+ $pathinfo = pathinfo($urlinfo['path']);
678
+ if(isset($pathinfo['extension']) && in_array(strtolower($pathinfo['extension']), $ignore_file_types)) {
679
+ return $home."/".$url;
680
+ }
681
+
682
+ // ignore wp internal links
683
+ if(preg_match("#^(wp-login.php|wp-signup.php|wp-register.php|wp-admin/)#", $url)) {
684
+ return $home."/".$url;
685
+ }
686
+
687
+ switch($q_config['url_mode']) {
688
+ case QTX_URL_PATH: // pre url
689
+ // might already have language information
690
+ if(preg_match("#^([a-z]{2})/#i",$url,$match)) {
691
+ if(qtranxf_isEnabled($match[1])) {
692
+ // found language information, remove it
693
+ $url = substr($url, 3);
694
+ }
695
+ }
696
+ if(!$q_config['hide_default_language'] || $lang!=$q_config['default_language'] || $showDefaultLanguage) $url = $lang."/".$url;
697
+ break;
698
+ case QTX_URL_DOMAIN: // pre domain
699
+ if(!$q_config['hide_default_language']||$lang!=$q_config['default_language']) $home = preg_replace("#//#","//".$lang.".",$home,1);
700
+ break;
701
+ default: // query
702
+ if(!$q_config['hide_default_language']||$lang!=$q_config['default_language']){
703
+ if(strpos($url,'?')===false) {
704
+ $url .= '?';
705
+ } else {
706
+ $url .= '&';
707
+ }
708
+ $url .= "lang=".$lang;
709
+ }
710
+ }
711
+
712
+ // see if cookies are activated
713
+ if(!$q_config['cookie_enabled'] && !$q_config['url_info']['internal_referer'] && $urlinfo['path'] == '' && $lang == $q_config['default_language'] && $q_config['language'] != $q_config['default_language'] && $q_config['hide_default_language']) {
714
+ // :( now we have to make unpretty URLs
715
+ $url = preg_replace("#(&|\?)lang=".$match[2]."&?#i","$1",$url);
716
+ if(strpos($url,'?')===false) {
717
+ $url .= '?';
718
+ } else {
719
+ $url .= '&';
720
+ }
721
+ $url .= "lang=".$lang;
722
+ }
723
+
724
+ // &amp; workaround
725
+ $complete = str_replace('&','&amp;',$home."/".$url);
726
+
727
+ // remove trailing slash if there wasn't one to begin with
728
+ if($nottrailing && strpos($complete,'?')===false && strpos($complete,'#')===false && substr($complete,-1,1)=='/')
729
+ $complete = substr($complete,0,-1);
730
+
731
+ return $complete;
732
+ }
733
+ }
734
+
735
+ // splits text with language tags into array
736
+ function qtranxf_split($text, $quicktags = true) {
737
+ global $q_config;
738
+
739
+ //init vars
740
+ $split_regex = "#(<!--[^-]*-->|\[:[a-z]{2}\])#ism";
741
+ $current_language = "";
742
+ $result = array();
743
+ foreach($q_config['enabled_languages'] as $language) {
744
+ $result[$language] = "";
745
+ }
746
+
747
+ // split text at all xml comments
748
+ $blocks = preg_split($split_regex, $text, -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
749
+ foreach($blocks as $block) {
750
+ # detect language tags
751
+ if(preg_match("#^<!--:([a-z]{2})-->$#ism", $block, $matches)) {
752
+ if(qtranxf_isEnabled($matches[1])) {
753
+ $current_language = $matches[1];
754
+ } else {
755
+ $current_language = "invalid";
756
+ }
757
+ continue;
758
+ // detect quicktags
759
+ } elseif($quicktags && preg_match("#^\[:([a-z]{2})\]$#ism", $block, $matches)) {
760
+ if(qtranxf_isEnabled($matches[1])) {
761
+ $current_language = $matches[1];
762
+ } else {
763
+ $current_language = "invalid";
764
+ }
765
+ continue;
766
+ // detect ending tags
767
+ } elseif(preg_match("#^<!--:-->$#ism", $block, $matches)) {
768
+ $current_language = "";
769
+ continue;
770
+ // detect defective more tag
771
+ } elseif(preg_match("#^<!--more-->$#ism", $block, $matches)) {
772
+ foreach($q_config['enabled_languages'] as $language) {
773
+ $result[$language] .= $block;
774
+ }
775
+ continue;
776
+ }
777
+ // correctly categorize text block
778
+ if($current_language == "") {
779
+ // general block, add to all languages
780
+ foreach($q_config['enabled_languages'] as $language) {
781
+ $result[$language] .= $block;
782
+ }
783
+ } elseif($current_language != "invalid") {
784
+ // specific block, only add to active language
785
+ $result[$current_language] .= $block;
786
+ }
787
+ }
788
+ foreach($result as $lang => $lang_content) {
789
+ $result[$lang] = preg_replace("#(<!--more-->|<!--nextpage-->)+$#ism","",$lang_content);
790
+ }
791
+ return $result;
792
+ }
793
+
794
+ function qtranxf_join($texts) {
795
+ global $q_config;
796
+ if(!is_array($texts)) $texts = qtranxf_split($texts, false);
797
+ $split_regex = "#<!--more-->#ism";
798
+ $max = 0;
799
+ $text = "";
800
+
801
+ foreach($q_config['enabled_languages'] as $language) {
802
+ $texts[$language] = preg_split($split_regex, $texts[$language]);
803
+ if(sizeof($texts[$language]) > $max) $max = sizeof($texts[$language]);
804
+ }
805
+ for($i=0;$i<$max;$i++) {
806
+ if($i>=1) {
807
+ $text .= '<!--more-->';
808
+ }
809
+ foreach($q_config['enabled_languages'] as $language) {
810
+ if(isset($texts[$language][$i]) && $texts[$language][$i] !== '') {
811
+ $text .= '<!--:'.$language.'-->'.$texts[$language][$i].'<!--:-->';
812
+ }
813
+ }
814
+ }
815
+ return $text;
816
+ }
817
+
818
+ function qtranxf_disableLanguage($lang) {
819
+ global $q_config;
820
+ if(qtranxf_isEnabled($lang)) {
821
+ $new_enabled = array();
822
+ for($i = 0; $i < sizeof($q_config['enabled_languages']); $i++) {
823
+ if($q_config['enabled_languages'][$i] != $lang) {
824
+ $new_enabled[] = $q_config['enabled_languages'][$i];
825
+ }
826
+ }
827
+ $q_config['enabled_languages'] = $new_enabled;
828
+ return true;
829
+ }
830
+ return false;
831
+ }
832
+
833
+ function qtranxf_enableLanguage($lang) {
834
+ global $q_config;
835
+ if(qtranxf_isEnabled($lang) || !isset($q_config['language_name'][$lang])) {
836
+ return false;
837
+ }
838
+ $q_config['enabled_languages'][] = $lang;
839
+ // force update of .mo files
840
+ if ($q_config['auto_update_mo']) qtranxf_updateGettextDatabases(true, $lang);
841
+ return true;
842
+ }
843
+
844
+ if (!function_exists('qtranxf_use')){
845
+ function qtranxf_use($lang, $text, $show_available=false) {
846
+ global $q_config;
847
+ // return full string if language is not enabled
848
+ if(!qtranxf_isEnabled($lang)) return $text;
849
+ if(is_array($text)) {
850
+ // handle arrays recursively
851
+ foreach($text as $key => $t) {
852
+ $text[$key] = qtranxf_use($lang,$text[$key],$show_available);
853
+ }
854
+ return $text;
855
+ }
856
+
857
+ if(is_object($text)||@get_class($text) == '__PHP_Incomplete_Class') {
858
+ foreach(get_object_vars($text) as $key => $t) {
859
+ $text->$key = qtranxf_use($lang,$text->$key,$show_available);
860
+ }
861
+ return $text;
862
+ }
863
+
864
+ // prevent filtering weird data types and save some resources
865
+ if(!is_string($text) || $text == '') {
866
+ return $text;
867
+ }
868
+
869
+ // get content
870
+ $content = qtranxf_split($text);
871
+ // find available languages
872
+ $available_languages = array();
873
+ foreach($content as $language => $lang_text) {
874
+ $lang_text = trim($lang_text);
875
+ if(!empty($lang_text)) $available_languages[] = $language;
876
+ }
877
+
878
+ // if no languages available show full text
879
+ if(sizeof($available_languages)==0) return $text;
880
+ // if content is available show the content in the requested language
881
+ if(!empty($content[$lang])) {
882
+ return $content[$lang];
883
+ }
884
+ // content not available in requested language (bad!!) what now?
885
+ if(!$show_available){
886
+ // check if content is available in default language, if not return first language found. (prevent empty result)
887
+ if($lang!=$q_config['default_language'])
888
+ return "(".$q_config['language_name'][$q_config['default_language']].") ".qtranxf_use($q_config['default_language'], $text, $show_available);
889
+ foreach($content as $language => $lang_text) {
890
+ $lang_text = trim($lang_text);
891
+ if(!empty($lang_text)) {
892
+ return "(".$q_config['language_name'][$language].") ".$lang_text;
893
+ }
894
+ }
895
+ }
896
+ // display selection for available languages
897
+ $available_languages = array_unique($available_languages);
898
+ $language_list = "";
899
+ if(preg_match('/%LANG:([^:]*):([^%]*)%/',$q_config['not_available'][$lang],$match)) {
900
+ $normal_seperator = $match[1];
901
+ $end_seperator = $match[2];
902
+ // build available languages string backward
903
+ $i = 0;
904
+ foreach($available_languages as $language) {
905
+ if($i==1) $language_list = $end_seperator.$language_list;
906
+ if($i>1) $language_list = $normal_seperator.$language_list;
907
+ $language_list = "<a href=\"".qtranxf_convertURL('', $language)."\">".$q_config['language_name'][$language]."</a>".$language_list;
908
+ $i++;
909
+ }
910
+ }
911
+ return "<p>".preg_replace('/%LANG:([^:]*):([^%]*)%/', $language_list, $q_config['not_available'][$lang])."</p>";
912
+ }
913
+ }
914
+
915
+ function qtranxf_showAllSeperated($text) {
916
+ if(empty($text)) return $text;
917
+ global $q_config;
918
+ $result = "";
919
+ foreach(qtranxf_getSortedLanguages() as $language) {
920
+ $result .= $q_config['language_name'][$language].":\n".qtranxf_use($language, $text)."\n\n";
921
+ }
922
+ return $result;
923
+ }
924
+
925
+ function qtranxf_add_css ()
926
+ {
927
+ wp_register_style( 'qtranslate-style', plugins_url('qtranslate.css', __FILE__) );
928
+ wp_enqueue_style( 'qtranslate-style' );
929
+ }
930
+
931
+ function qtranxf_optionFilter($do='enable') {//do we need it?
932
+ $options = array( 'option_widget_pages',
933
+ 'option_widget_archives',
934
+ 'option_widget_meta',
935
+ 'option_widget_calendar',
936
+ 'option_widget_text',
937
+ 'option_widget_categories',
938
+ 'option_widget_recent_entries',
939
+ 'option_widget_recent_comments',
940
+ 'option_widget_rss',
941
+ 'option_widget_tag_cloud'
942
+ );
943
+ if($do!='disable'){
944
+ foreach($options as $option)
945
+ add_filter($option, 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
946
+ }else{
947
+ foreach($options as $option)
948
+ remove_filter($option, 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
949
+ }
950
+ }
951
+ ?>
qtranslate_frontend.php ADDED
@@ -0,0 +1,189 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ add_filter( 'wp_get_nav_menu_items', 'qtranxf_get_nav_menu_items', 0, 3 );
21
+ function qtranxf_get_nav_menu_items( $items, $menu, $args )
22
+ {
23
+ global $q_config;
24
+ $language=$q_config['language'];
25
+ $flag_location=$q_config['WP_CONTENT_URL'].$q_config['flag_location'];
26
+ $itemid=0;
27
+ $menu_order=0;
28
+ $qtransmenu=null;
29
+ foreach($items as $item)
30
+ {
31
+ if($itemid<$item->ID) $itemid=$item->ID;
32
+ if($menu_order<$item->menu_order) $menu_order=$item->menu_order;
33
+ if( !isset( $item->url ) || strstr( $item->url, '#qtransLangSw' ) === FALSE ) continue;
34
+ $item->title=__('Language','qtranslate').':'.'&nbsp;<img src="'.$flag_location.$q_config['flag'][$language].'">';
35
+ $item->url=null;
36
+ //$item->classes[] = 'qtranxs-flag-'.$language;
37
+ $item->classes[] = 'qtranxs-lang-menu';
38
+ $qtransmenu = $item;
39
+ }
40
+ if(!$qtransmenu) return $items;
41
+ foreach($q_config['enabled_languages'] as $lang)
42
+ {
43
+ $item=new WP_Post((object)array('ID' => ++$itemid));
44
+ //$item->db_id=$item->ID;
45
+ $item->menu_item_parent=$qtransmenu->ID;
46
+ $item->menu_order=++$menu_order;
47
+ $item->post_type='nav_menu_item';
48
+ $item->object='custom';
49
+ //$item->object_id=0;
50
+ $item->type='custom';
51
+ $item->type_label='Custom';
52
+ $item->title='<img src="'.$flag_location.$q_config['flag'][$lang].'">&nbsp;'.$q_config['language_name'][$lang];
53
+ $item->post_title=$item->title;
54
+ $item->post_name='language-menuitem-'.$lang;
55
+ if($lang!=$language)
56
+ $item->url=qtranxf_convertURL($url, $lang, false, true);
57
+ $item->classes=array();
58
+ //$item->classes[] = 'qtranxs-flag-'.$lang;
59
+ $item->classes[] = 'qtranxs-lang-menu-item';
60
+ $items[]=$item;
61
+ ++$menu->count;
62
+ }
63
+ return $items;
64
+ }
65
+
66
+ function qtranxf_add_lang_icons ()
67
+ {
68
+ global $q_config;
69
+ echo "<style>\n";
70
+ foreach($q_config['enabled_languages'] as $lang)
71
+ {
72
+ echo '.qtranxs-flag-'.$lang.' {background-image: url('.trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$lang]."); background-repeat: no-repeat;}\n";
73
+ }
74
+ echo "</style>\n";
75
+ }
76
+ add_filter('wp_head', 'qtranxf_add_lang_icons');
77
+
78
+ function qtranxf_postsFilter($posts) {
79
+ if(is_array($posts)) {
80
+ foreach($posts as $post) {
81
+ $post->post_content = qtranxf_useCurrentLanguageIfNotFoundShowAvailable($post->post_content);
82
+ $post = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($post);
83
+ }
84
+ }
85
+ return $posts;
86
+ }
87
+ add_filter('the_posts', 'qtranxf_postsFilter');
88
+
89
+ function qtranxf_get_attachment_image_attributes($attr, $attachment, $size)
90
+ {
91
+ foreach( $attr as $name => $value ){
92
+ if($name!=='alt') continue;
93
+ $attr[$name]=qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($value);
94
+ }
95
+ return $attr;
96
+ }
97
+ add_filter('wp_get_attachment_image_attributes', 'qtranxf_get_attachment_image_attributes',0,3);
98
+
99
+ function qtranxf_excludeUntranslatedPosts($where) {
100
+ global $q_config, $wpdb;
101
+ if($q_config['hide_untranslated'] && !is_singular()) {
102
+ $where .= " AND $wpdb->posts.post_content LIKE '%<!--:".qtranxf_getLanguage()."-->%'";
103
+ }
104
+ return $where;
105
+ }
106
+ // don't filter untranslated posts in admin
107
+ add_filter('posts_where_request', 'qtranxf_excludeUntranslatedPosts');
108
+
109
+ $qtranxv_home=get_home_url().'/';
110
+ function qtranxf_home_url($href)
111
+ {
112
+ global $qtranxv_home;
113
+ if ($href===$qtranxv_home)
114
+ {
115
+ return qtranxf_convertURL($qtranxv_home);
116
+ }
117
+ else
118
+ {
119
+ return $href;
120
+ }
121
+ }
122
+ add_filter('home_url', 'qtranxf_home_url');
123
+
124
+ function qtranxf_esc_html($text) {
125
+ //echo "\nqtranxf_esc_html:text=$text\n";
126
+ return qtranxf_useDefaultLanguage($text);
127
+ }
128
+ // filter options
129
+ add_filter('esc_html', 'qtranxf_esc_html', 0);
130
+
131
+ /*
132
+ function qtranxf_translate($text){
133
+ $lang=qtranxf_getLanguage();
134
+ echo "\nqtranxf_translate:lang=".$lang."\n";
135
+ echo "text=$text\n";
136
+ $split_regex = "#(<!--:[^-]+-->|\[:[a-z]{2}\])#ism";
137
+ $skip=true;
138
+ $quicktags=false;
139
+ $blocks = preg_split($split_regex, $text, -1, PREG_SPLIT_NO_EMPTY|PREG_SPLIT_DELIM_CAPTURE);
140
+ foreach($blocks as $block) {
141
+ echo "block=$block\n";
142
+ if(preg_match("#^<!--:([a-z]{2})-->$#ism", $block, $matches)) {
143
+ $skip=($lang != $matches[1]);
144
+ continue;
145
+ } elseif($quicktags && preg_match("#^\[:([a-z]{2})\]$#ism", $block, $matches)) {
146
+ $skip=($lang != $matches[1]);
147
+ continue;
148
+ } elseif(preg_match("#^<!--:-->$#ism", $block, $matches)) {
149
+ $skip=false;
150
+ continue;
151
+ // detect defective more tag
152
+ //} elseif(preg_match("#^<!--more-->$#ism", $block, $matches)) {
153
+ // foreach($q_config['enabled_languages'] as $language) {
154
+ // $result[$language] .= $block;
155
+ // }
156
+ // continue;
157
+ }
158
+ if($skip) continue;
159
+ $result .= $block;
160
+ }
161
+ return $result;
162
+ //return qtranxf_useDefaultLanguage($text);
163
+ }
164
+ //add_filter('wpseo_title', 'qtranxf_translate', 0);
165
+ */
166
+
167
+ // Compability with Default Widgets
168
+ qtranxf_optionFilter();
169
+ add_filter('widget_title', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
170
+ add_filter('widget_text', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
171
+
172
+ add_filter('wp_head', 'qtranxf_add_css');
173
+ add_filter('wp_setup_nav_menu_item', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage');
174
+
175
+ add_filter('get_comment_author', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
176
+ add_filter('the_author', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
177
+ add_filter('tml_title', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
178
+
179
+ // translate terms
180
+ add_filter('cat_row', 'qtranxf_useTermLib',0);
181
+ add_filter('cat_rows', 'qtranxf_useTermLib',0);
182
+ add_filter('wp_get_object_terms', 'qtranxf_useTermLib',0);
183
+ add_filter('single_tag_title', 'qtranxf_useTermLib',0);
184
+ add_filter('single_cat_title', 'qtranxf_useTermLib',0);
185
+ add_filter('the_category', 'qtranxf_useTermLib',0);
186
+ add_filter('get_term', 'qtranxf_useTermLib',0);
187
+ add_filter('get_terms', 'qtranxf_useTermLib',0);
188
+ add_filter('get_category', 'qtranxf_useTermLib',0);
189
+ ?>
qtranslate_hooks.php ADDED
@@ -0,0 +1,282 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // encoding: utf-8
2
+ /*
3
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ /* qTranslate-X Hooks */
21
+
22
+ function qtranxf_header(){
23
+ global $q_config;
24
+ echo "\n<meta http-equiv=\"Content-Language\" content=\"".str_replace('_','-',$q_config['locale'][$q_config['language']])."\" />\n";
25
+ $css = "<style type=\"text/css\" media=\"screen\">\n";
26
+ $css .=".qtranxf_flag span { display:none }\n";
27
+ $css .=".qtranxf_flag { height:12px; width:18px; display:block }\n";
28
+ $css .=".qtranxf_flag_and_text { padding-left:20px }\n";
29
+ $baseurl = WP_CONTENT_URL;
30
+ if(isset($_SERVER['HTTPS']) && ($_SERVER['HTTPS'] == '1' || $_SERVER['HTTPS'] == 'on')) {
31
+ $baseurl = preg_replace('#^http://#','https://', $baseurl);
32
+ }
33
+ foreach($q_config['enabled_languages'] as $language) {
34
+ $css .=".qtranxf_flag_".$language." { background:url(".$baseurl.'/'.$q_config['flag_location'].$q_config['flag'][$language].") no-repeat }\n";
35
+ }
36
+ $css .="</style>\n";
37
+ // skip the rest if 404
38
+ if(is_404()) return;
39
+ // set links to translations of current page
40
+ foreach($q_config['enabled_languages'] as $language) {
41
+ if($language != qtranxf_getLanguage())
42
+ echo '<link hreflang="'.$language.'" href="'.qtranxf_convertURL('',$language).'" rel="alternate" />'."\n";
43
+ }
44
+ }
45
+
46
+ function qtranxf_localeForCurrentLanguage($locale){
47
+ global $q_config;
48
+ // try to figure out the correct locale
49
+ $locale = array();
50
+ $locale[] = $q_config['locale'][$q_config['language']].".utf8";
51
+ $locale[] = $q_config['locale'][$q_config['language']]."@euro";
52
+ $locale[] = $q_config['locale'][$q_config['language']];
53
+ $locale[] = $q_config['windows_locale'][$q_config['language']];
54
+ $locale[] = $q_config['language'];
55
+
56
+ // return the correct locale and most importantly set it (wordpress doesn't, which is bad)
57
+ // only set LC_TIME as everyhing else doesn't seem to work with windows
58
+ setlocale(LC_TIME, $locale);
59
+
60
+ return $q_config['locale'][$q_config['language']];
61
+ }
62
+
63
+ function qtranxf_useCurrentLanguageIfNotFoundShowAvailable($content) {
64
+ global $q_config;
65
+ return qtranxf_use($q_config['language'], $content, true);
66
+ }
67
+
68
+ function qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($content) {
69
+ global $q_config;
70
+ return qtranxf_use($q_config['language'], $content, false);
71
+ }
72
+
73
+ function qtranxf_useDefaultLanguage($content) {
74
+ global $q_config;
75
+ return qtranxf_use($q_config['default_language'], $content, false);
76
+ }
77
+
78
+ function qtranxf_excludePages($pages) {
79
+ global $wpdb, $q_config;
80
+ static $exclude = 0;
81
+ if(!$q_config['hide_untranslated']) return $pages;
82
+ if(is_array($exclude)) return array_merge($exclude, $pages);
83
+ $query = "SELECT id FROM $wpdb->posts WHERE post_type = 'page' AND post_status = 'publish' AND NOT ($wpdb->posts.post_content LIKE '%<!--:".qtranxf_getLanguage()."-->%')" ;
84
+ $hide_pages = $wpdb->get_results($query);
85
+ $exclude = array();
86
+ foreach($hide_pages as $page) {
87
+ $exclude[] = $page->id;
88
+ }
89
+ return array_merge($exclude, $pages);
90
+ }
91
+
92
+ function qtranxf_links($links, $file){ // copied from Sociable Plugin
93
+ //Static so we don't call plugin_basename on every plugin row.
94
+ static $this_plugin;
95
+ if (!$this_plugin) $this_plugin = plugin_basename(dirname(__FILE__).'/qtranslate.php');
96
+
97
+ if ($file == $this_plugin){
98
+ $settings_link = '<a href="options-general.php?page=qtranslate-x">' . __('Settings', 'qtranslate') . '</a>';
99
+ array_unshift( $links, $settings_link ); // before other links
100
+ }
101
+ return $links;
102
+ }
103
+
104
+ function qtranxf_languageColumnHeader($columns){
105
+ $new_columns = array();
106
+ if(isset($columns['cb'])) $new_columns['cb'] = '';
107
+ if(isset($columns['title'])) $new_columns['title'] = '';
108
+ if(isset($columns['author'])) $new_columns['author'] = '';
109
+ if(isset($columns['categories'])) $new_columns['categories'] = '';
110
+ if(isset($columns['tags'])) $new_columns['tags'] = '';
111
+ $new_columns['language'] = __('Languages', 'qtranslate');
112
+ return array_merge($new_columns, $columns);;
113
+ }
114
+
115
+ function qtranxf_languageColumn($column) {
116
+ global $q_config, $post;
117
+ if ($column == 'language') {
118
+ $available_languages = qtranxf_getAvailableLanguages($post->post_content);
119
+ $missing_languages = array_diff($q_config['enabled_languages'], $available_languages);
120
+ $available_languages_name = array();
121
+ $missing_languages_name = array();
122
+ foreach($available_languages as $language) {
123
+ $available_languages_name[] = $q_config['language_name'][$language];
124
+ }
125
+ $available_languages_names = join(", ", $available_languages_name);
126
+
127
+ echo apply_filters('qtranslate_available_languages_names',$available_languages_names);
128
+ do_action('qtranslate_languageColumn', $available_languages, $missing_languages);
129
+ }
130
+ return $column;
131
+ }
132
+
133
+ function qtranxf_versionLocale() {
134
+ return 'en_US';
135
+ }
136
+
137
+ function qtranxf_useRawTitle($title, $raw_title = '', $context = 'save') {
138
+ if($raw_title=='') $raw_title = $title;
139
+ if('save'==$context) {
140
+ $raw_title = qtranxf_useDefaultLanguage($raw_title);
141
+ $title = remove_accents($raw_title);
142
+ }
143
+ return $title;
144
+ }
145
+
146
+ function qtranxf_checkCanonical($redirect_url, $requested_url) {
147
+ // fix canonical conflicts with language urls
148
+ if(qtranxf_convertURL($redirect_url)==qtranxf_convertURL($requested_url))
149
+ return false;
150
+ return $redirect_url;
151
+ }
152
+
153
+ function qtranxf_fixSearchForm($form) {
154
+ $form = preg_replace('#action="[^"]*"#','action="'.trailingslashit(qtranxf_convertURL(get_home_url())).'"',$form);
155
+ return $form;
156
+ }
157
+
158
+ function qtranxf_fixAdminBar($wp_admin_bar) {
159
+ global $wp_admin_bar;
160
+ foreach($wp_admin_bar->get_nodes() as $node) {
161
+ $wp_admin_bar->add_node(qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($node));
162
+ }
163
+ }
164
+
165
+ /*
166
+ //it was a test
167
+ function qtranxf_wpseo_replacements($replacements){
168
+ foreach($replacements as $key => $s) {
169
+ $replacements[$key]=__($s);
170
+ }
171
+ return $replacements;
172
+ }
173
+ */
174
+
175
+ // Hooks for Plugin compatibility
176
+
177
+ function qtranxf_supercache_dir($uri) {
178
+ global $q_config;
179
+ if(isset($q_config['url_info']['original_url'])) {
180
+ $uri = $q_config['url_info']['original_url'];
181
+ } else {
182
+ $uri = $_SERVER['REQUEST_URI'];
183
+ }
184
+ $uri = preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', str_replace( '/index.php', '/', str_replace( '..', '', preg_replace("/(\?.*)?$/", '', $uri ) ) ) );
185
+ $uri = str_replace( '\\', '', $uri );
186
+ $uri = strtolower(preg_replace('/:.*$/', '', $_SERVER["HTTP_HOST"])) . $uri; // To avoid XSS attacs
187
+ return $uri;
188
+ }
189
+ add_filter('supercache_dir', 'qtranxf_supercache_dir',0);
190
+
191
+ // Hooks (Actions)
192
+ add_action('wp_head', 'qtranxf_header');
193
+ // add_action('category_edit_form', 'qtranxf_modifyTermFormFor');
194
+ // //add_action('post_tag_edit_form', 'qtranxf_modifyTermFormFor');
195
+ // add_action('link_category_edit_form', 'qtranxf_modifyTermFormFor');
196
+ // add_action('category_add_form', 'qtranxf_modifyTermFormFor');
197
+ // add_action('post_tag_add_form', 'qtranxf_modifyTermFormFor');
198
+ // add_action('link_category_add_form', 'qtranxf_modifyTermFormFor');
199
+ add_action('widgets_init', 'qtranxf_widget_init');
200
+ add_action('plugins_loaded', 'qtranxf_init', 2);
201
+
202
+ // Hooks (execution time critical filters)
203
+ add_filter('the_content', 'qtranxf_useCurrentLanguageIfNotFoundShowAvailable', 0);
204
+ add_filter('the_excerpt', 'qtranxf_useCurrentLanguageIfNotFoundShowAvailable', 0);
205
+ add_filter('the_excerpt_rss', 'qtranxf_useCurrentLanguageIfNotFoundShowAvailable', 0);
206
+ add_filter('sanitize_title', 'qtranxf_useRawTitle',0, 3);
207
+ add_filter('comment_moderation_subject', 'qtranxf_useDefaultLanguage',0);
208
+ add_filter('comment_moderation_text', 'qtranxf_useDefaultLanguage',0);
209
+ add_filter('get_comment_date', 'qtranxf_dateFromCommentForCurrentLanguage',0,2);
210
+ add_filter('get_comment_time', 'qtranxf_timeFromCommentForCurrentLanguage',0,4);
211
+ add_filter('get_post_modified_time', 'qtranxf_timeModifiedFromPostForCurrentLanguage',0,3);
212
+ add_filter('get_the_time', 'qtranxf_timeFromPostForCurrentLanguage',0,3);
213
+ add_filter('get_the_date', 'qtranxf_dateFromPostForCurrentLanguage',0,2);
214
+ add_filter('locale', 'qtranxf_localeForCurrentLanguage',99);
215
+ add_filter('the_title', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage', 0);//WP: fires for display purposes only
216
+ add_filter('post_title', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage', 0);
217
+ add_filter('term_name', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
218
+ add_filter('tag_rows', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
219
+ add_filter('list_cats', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
220
+ add_filter('wp_list_categories', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
221
+ add_filter('wp_dropdown_cats', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
222
+ add_filter('wp_title', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
223
+ add_filter('single_post_title', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
224
+ add_filter('bloginfo', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
225
+ add_filter('get_others_drafts', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
226
+ add_filter('get_bloginfo_rss', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
227
+ add_filter('get_wp_title_rss', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
228
+ add_filter('wp_title_rss', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
229
+ add_filter('the_title_rss', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
230
+ add_filter('the_content_rss', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
231
+ add_filter('gettext', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
232
+ add_filter('get_pages', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
233
+ add_filter('category_description', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
234
+ add_filter('bloginfo_rss', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
235
+ add_filter('the_category_rss', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
236
+ add_filter('wp_generate_tag_cloud', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
237
+ add_filter('term_links-post_tag', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
238
+ add_filter('link_name', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
239
+ add_filter('link_description', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
240
+ add_filter('pre_option_rss_language', 'qtranxf_getLanguage',0);
241
+ add_filter('the_author', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage',0);
242
+ add_filter( "_wp_post_revision_field_post_title", 'qtranxf_showAllSeperated', 0);
243
+ add_filter( "_wp_post_revision_field_post_content", 'qtranxf_showAllSeperated', 0);
244
+ add_filter( "_wp_post_revision_field_post_excerpt", 'qtranxf_showAllSeperated', 0);
245
+
246
+ // // Hooks (execution time non-critical filters)
247
+ add_filter('author_feed_link', 'qtranxf_convertURL');
248
+ add_filter('author_link', 'qtranxf_convertURL');
249
+ add_filter('author_feed_link', 'qtranxf_convertURL');
250
+ add_filter('day_link', 'qtranxf_convertURL');
251
+ add_filter('get_comment_author_url_link', 'qtranxf_convertURL');
252
+ add_filter('month_link', 'qtranxf_convertURL');
253
+ add_filter('page_link', 'qtranxf_convertURL');
254
+ add_filter('post_link', 'qtranxf_convertURL');
255
+ add_filter('year_link', 'qtranxf_convertURL');
256
+ add_filter('category_feed_link', 'qtranxf_convertURL');
257
+ add_filter('category_link', 'qtranxf_convertURL');
258
+ add_filter('tag_link', 'qtranxf_convertURL');
259
+ add_filter('term_link', 'qtranxf_convertURL');
260
+ add_filter('the_permalink', 'qtranxf_convertURL');
261
+ add_filter('feed_link', 'qtranxf_convertURL');
262
+ add_filter('post_comments_feed_link', 'qtranxf_convertURL');
263
+ add_filter('tag_feed_link', 'qtranxf_convertURL');
264
+ add_filter('get_pagenum_link', 'qtranxf_convertURL');
265
+ add_filter('get_search_form', 'qtranxf_fixSearchForm', 10, 1);
266
+ add_filter('manage_posts_columns', 'qtranxf_languageColumnHeader');
267
+ add_filter('manage_posts_custom_column', 'qtranxf_languageColumn');
268
+ add_filter('manage_pages_columns', 'qtranxf_languageColumnHeader');
269
+ add_filter('manage_pages_custom_column', 'qtranxf_languageColumn');
270
+ add_filter('wp_list_pages_excludes', 'qtranxf_excludePages');
271
+ add_filter('comment_notification_text', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage');
272
+ add_filter('comment_notification_headers', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage');
273
+ add_filter('comment_notification_subject', 'qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage');
274
+
275
+ // add_filter('the_editor', 'qtranxf_modifyRichEditor');
276
+ //add_filter('admin_footer', 'qtranxf_modifyExcerpt');
277
+ add_filter('bloginfo_url', 'qtranxf_convertBlogInfoURL',10,2);
278
+ add_filter('plugin_action_links', 'qtranxf_links', 10, 2);
279
+ add_filter('manage_language_columns', 'qtranxf_language_columns');
280
+ add_filter('core_version_check_locale', 'qtranxf_versionLocale');
281
+ add_filter('redirect_canonical', 'qtranxf_checkCanonical', 10, 2);
282
+ ?>
qtranslate_services.php ADDED
@@ -0,0 +1,909 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // encoding: utf-8
2
+ /*
3
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ /* qTranslate Services */
21
+
22
+ // generate public key
23
+ $qts_public_key = '-----BEGIN PUBLIC KEY-----|MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDNccmB4Up9V9+vD5kWWiE6zpRV|m7y1sdFihreycdpmu3aPjKooG5LWUbTTyc993nTxV71SKuuYdkPzu5JxniAsI2N0|7DsySZ/bQ2/BEANNwJD3pmz4NmIHgIeNaUze/tvTZq6m+FTVHSvEqAaXJIsQbO19|HeegbfEpmCj1d/CgOwIDAQAB|-----END PUBLIC KEY-----|';
24
+
25
+ // OpenSSL functions used
26
+ $qts_openssl_functions_used = array(
27
+ 'openssl_pkey_new',
28
+ 'openssl_pkey_export',
29
+ 'openssl_pkey_get_details',
30
+ 'openssl_seal',
31
+ 'openssl_open',
32
+ 'openssl_free_key'
33
+ );
34
+
35
+ // check schedule
36
+ if (!wp_next_scheduled('qts_cron_hook')) {
37
+ wp_schedule_event( time(), 'hourly', 'qts_cron_hook' );
38
+ }
39
+
40
+ define('QTS_FAST_TIMEOUT', 10);
41
+ define('QTS_VERIFY', 'verify');
42
+ define('QTS_GET_SERVICES', 'get_services');
43
+ define('QTS_INIT_TRANSLATION', 'init_translation');
44
+ define('QTS_RETRIEVE_TRANSLATION', 'retrieve_translation');
45
+ define('QTS_QUOTE', 'quote');
46
+ define('QTS_STATE_OPEN', 'open');
47
+ define('QTS_STATE_ERROR', 'error');
48
+ define('QTS_STATE_CLOSED', 'closed');
49
+ define('QTS_ERROR_INVALID_LANGUAGE', 'QTS_ERROR_INVALID_LANGUAGE');
50
+ define('QTS_ERROR_NOT_SUPPORTED_LANGUAGE', 'QTS_ERROR_NOT_SUPPORTED_LANGUAGE');
51
+ define('QTS_ERROR_INVALID_SERVICE', 'QTS_ERROR_INVALID_SERVICE');
52
+ define('QTS_ERROR_INVALID_ORDER', 'QTS_ERROR_INVALID_ORDER');
53
+ define('QTS_ERROR_SERVICE_GENERIC', 'QTS_ERROR_SERVICE_GENERIC');
54
+ define('QTS_ERROR_SERVICE_UNKNOWN', 'QTS_ERROR_SERVICE_UNKNOWN');
55
+ define('QTS_DEBUG','QTS_DEBUG');
56
+
57
+ // error messages
58
+ $qts_error_messages[QTS_ERROR_INVALID_LANGUAGE] = __('The language/s do not have a valid ISO 639-1 representation.','qtranslate');
59
+ $qts_error_messages[QTS_ERROR_NOT_SUPPORTED_LANGUAGE] = __('The language/s you used are not supported by the service.','qtranslate');
60
+ $qts_error_messages[QTS_ERROR_INVALID_SERVICE] = __('There is no such service.','qtranslate');
61
+ $qts_error_messages[QTS_ERROR_INVALID_ORDER] = __('The system could not process your order.','qtranslate');
62
+ $qts_error_messages[QTS_ERROR_SERVICE_GENERIC] = __('There has been an error with the selected service.','qtranslate');
63
+ $qts_error_messages[QTS_ERROR_SERVICE_UNKNOWN] = __('An unknown error occured with the selected service.','qtranslate');
64
+ $qts_error_messages[QTS_DEBUG] = __('The server returned a debugging message.','qtranslate');
65
+
66
+ // hooks
67
+ add_action('qtranslate_css', 'qts_css');
68
+ add_action('qts_cron_hook', 'qts_cron');
69
+ add_action('qtranslate_configuration', 'qts_config_hook', 10);
70
+ add_action('qtranslate_loadConfig', 'qts_load');
71
+ add_action('qtranslate_saveConfig', 'qts_save');
72
+ add_action('qtranslate_clean_uri', 'qts_clean_uri');
73
+ add_action('admin_menu', 'qts_init');
74
+ add_action('wp_ajax_qts_quote', 'qts_quote');
75
+
76
+ add_filter('manage_order_columns', 'qts_order_columns');
77
+ add_filter('qtranslate_configuration_pre', 'qts_config_pre_hook');
78
+
79
+ // serializing/deserializing functions
80
+ function qts_base64_serialize($var) {
81
+ if(is_array($var)) {
82
+ foreach($var as $key => $value) {
83
+ $var[$key] = qts_base64_serialize($value);
84
+ }
85
+ }
86
+ $var = serialize($var);
87
+ $var = strtr(base64_encode($var), '-_,', '+/=');
88
+ return $var;
89
+ }
90
+
91
+ function qts_base64_unserialize($var) {
92
+ $var = base64_decode(strtr($var, '-_,', '+/='));
93
+ $var = unserialize($var);
94
+ if(is_array($var)) {
95
+ foreach($var as $key => $value) {
96
+ $var[$key] = qts_base64_unserialize($value);
97
+ }
98
+ }
99
+ return $var;
100
+ }
101
+
102
+ // sends a encrypted message to qTranslate Services and decrypts the received data
103
+ function qts_queryQS($action, $data='', $fast = false) {
104
+ global $qts_public_key;
105
+ // generate new private key
106
+ $key = openssl_pkey_new();
107
+ openssl_pkey_export($key, $private_key);
108
+ $public_key=openssl_pkey_get_details($key);
109
+ $public_key=$public_key["key"];
110
+ $message = qts_base64_serialize(array('key'=>$public_key, 'data'=>$data));
111
+ openssl_seal($message, $message, $server_key, array($qts_public_key));
112
+ $message = qts_base64_serialize(array('key'=>$server_key[0], 'data'=>$message));
113
+ $data = "message=".$message;
114
+
115
+ // connect to qts
116
+ if($fast) {
117
+ $fp = fsockopen('www.qianqin.de', 80, $errno, $errstr, QTS_FAST_TIMEOUT);
118
+ stream_set_timeout($fp, QTS_FAST_TIMEOUT);
119
+ } else {
120
+ $fp = fsockopen('www.qianqin.de', 80);
121
+ }
122
+ if(!$fp) return false;
123
+
124
+ fputs($fp, "POST /qtranslate/services/$action HTTP/1.1\r\n");
125
+ fputs($fp, "Host: www.qianqin.de\r\n");
126
+ fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n");
127
+ fputs($fp, "Content-length: ". strlen($data) ."\r\n");
128
+ fputs($fp, "Connection: close\r\n\r\n");
129
+ fputs($fp, $data);
130
+ $res = '';
131
+ while(!feof($fp)) {
132
+ $res .= fgets($fp, 128);
133
+ }
134
+ // check for timeout
135
+ $info = stream_get_meta_data($fp);
136
+ if($info['timed_out']) return false;
137
+ fclose($fp);
138
+
139
+ preg_match("#^Content-Length:\s*([0-9]+)\s*$#ism",$res, $match);
140
+ if(isset($match[1])) {
141
+ $content_length = $match[1];
142
+ $content = substr($res, -$content_length, $content_length);
143
+ } else {
144
+ $content = $res;
145
+ }
146
+ $debug = $content;
147
+ $content = qts_base64_unserialize($content);
148
+ openssl_open($content['data'], $content, $content['key'], $private_key);
149
+ if($content===false) {
150
+ echo "<pre>DEBUG:\n";
151
+ echo $debug;
152
+ echo "</pre>";
153
+ }
154
+ openssl_free_key($key);
155
+ return qts_cleanup(qts_base64_unserialize($content), $action);
156
+ }
157
+
158
+ function qts_clean_uri($clean_uri) {
159
+ return preg_replace("/&(qts_delete|qts_cron)=[^&#]*/i","",$clean_uri);
160
+ }
161
+
162
+ function qts_translateButtons($available_languages, $missing_languages) {
163
+ global $q_config, $post;
164
+ if(sizeof($missing_languages)==0) return;
165
+ $missing_languages_name = array();
166
+ foreach($missing_languages as $language) {
167
+ $missing_languages_name[] = '<a href="edit.php?page=qtranslate_services&post='.$post->ID.'&target_language='.$language.'">'.$q_config['language_name'][$language].'</a>';
168
+ }
169
+ $missing_languages_names = join(', ', $missing_languages_name);
170
+ printf(__('<div>Translate to %s</div>', 'qtranslate') ,$missing_languages_names);
171
+ }
172
+
173
+ function qts_css() {
174
+ //<style type="text/css" media="screen">
175
+ ?>
176
+ p.error {background-color:#ffebe8;border-color:#c00;border-width:1px;border-style:solid;padding:0 .6em;margin:5px 15px 2px;-moz-border-radius:3px;-khtml-border-radius:3px;-webkit-border-radius:3px;border-radius:3px;}
177
+ p.error a{color:#c00;}
178
+ #qts_boxes { margin-right:300px }
179
+ #qts_boxes .postbox h3.hndle, #submitboxcontainer .postbox h3.hndle {cursor:auto}
180
+ #qts_boxes div.inside {margin: 6px 6px 8px;}
181
+ #submitboxcontainer { float:right; width:280px }
182
+ #qts_content_preview { width:100%; height:200px }
183
+ .service_description { margin-left:20px; margin-top:0 }
184
+ #qtranslate-services h4 { margin-top:0 }
185
+ #qtranslate-services h5 { margin-bottom:0 }
186
+ #qtranslate-services .description { font-size:11px }
187
+ #qtrans_select_translate { margin-right:11px }
188
+ .qts_status { border:0 }
189
+ .qts_no-bottom-border { border-bottom:0 !important }
190
+ #submitboxcontainer p { margin:6px 6px ; }
191
+ .qts_submit { text-align:right; padding:6px }
192
+ <?php
193
+ //</style>
194
+ }
195
+
196
+ function qts_load() {
197
+ global $q_config, $qts_public_key;
198
+ $qtranslate_services = get_option('qtranslate_qtranslate_services');
199
+ $qtranslate_services = qtranxf_validateBool($qtranslate_services, $q_config['qtranslate_services']);
200
+ $q_config['qtranslate_services'] = $qtranslate_services && qts_isOpenSSLAvailable();
201
+ if($q_config['qtranslate_services'] && is_string($qts_public_key)) {
202
+ $qts_public_key = openssl_get_publickey(join("\n",explode("|",$qts_public_key)));
203
+ }
204
+ }
205
+
206
+ function qts_isOpenSSLAvailable() {
207
+ global $qts_openssl_functions_used;
208
+ foreach($qts_openssl_functions_used as $function) {
209
+ if(!function_exists($function)) return false;
210
+ }
211
+ return true;
212
+ }
213
+
214
+ function qts_init() {
215
+ global $q_config;
216
+ if($q_config['qtranslate_services']) {
217
+ /* disabled for meta box
218
+ add_filter('qtranslate_toolbar', 'qts_toobar');
219
+ add_filter('qtranslate_modify_editor_js', 'qts_editor_js');
220
+ */
221
+ add_meta_box('translatediv', __('Translate to','qtranslate'), 'qts_translate_box', 'post', 'side', 'core');
222
+ add_meta_box('translatediv', __('Translate to','qtranslate'), 'qts_translate_box', 'page', 'side', 'core');
223
+
224
+ add_action('qtranslate_languageColumn', 'qts_translateButtons', 10, 2);
225
+
226
+ // add plugin page without menu link for users with permission
227
+ if(current_user_can('edit_published_posts')) {
228
+ //add_posts_page(__('Translate','qtranslate'), __('Translate','qtranslate'), 'edit_published_posts', 'qtranslate_services', 'qts_service');
229
+ global $_registered_pages;
230
+ $hookname = get_plugin_page_hookname('qtranslate_services', 'edit.php');
231
+ add_action($hookname, 'qts_service');
232
+ $_registered_pages[$hookname] = true;
233
+ }
234
+ }
235
+ }
236
+
237
+ function qts_save() {
238
+ global $q_config;
239
+ if($q_config['qtranslate_services'])
240
+ update_option('qtranslate_qtranslate_services', '1');
241
+ else
242
+ update_option('qtranslate_qtranslate_services', '0');
243
+ }
244
+
245
+ function qts_cleanup($var, $action) {
246
+ switch($action) {
247
+ case QTS_GET_SERVICES:
248
+ foreach($var as $service_id => $service) {
249
+ // make array out of serialized field
250
+ $fields = array();
251
+ $required_fields = explode('|',$service['service_required_fields']);
252
+ foreach($required_fields as $required_field) {
253
+ if(strpos($required_field, " ")!==false) {
254
+ list($fieldname, $title) = explode(' ', $required_field, 2);
255
+ if($fieldname!='') {
256
+ $fields[] = array('name' => $fieldname, 'value' => '', 'title' => $title);
257
+ }
258
+ }
259
+ }
260
+ $var[$service_id]['service_required_fields'] = $fields;
261
+ }
262
+ break;
263
+ }
264
+ if(isset($var['error']) && $var['error'] == QTS_DEBUG) {
265
+ echo "<pre>Debug message received from Server: \n";
266
+ var_dump($var['message']);
267
+ echo "</pre>";
268
+ }
269
+ return $var;
270
+ }
271
+
272
+ function qts_config_pre_hook($message) {
273
+ global $q_config;
274
+ if(isset($_POST['default_language'])) {
275
+ qtranxf_updateSetting('qtranslate_services', QTX_BOOLEAN);
276
+ qts_load();
277
+ if($q_config['qtranslate_services']) {
278
+ $services = qts_queryQS(QTS_GET_SERVICES);
279
+ $service_settings = get_option('qts_service_settings');
280
+ if(!is_array($service_settings)) $service_settings = array();
281
+
282
+ foreach($services as $service_id => $service) {
283
+ // check if there are already settings for the field
284
+ if(!isset($service_settings[$service_id])||!is_array($service_settings[$service_id])) $service_settings[$service_id] = array();
285
+
286
+ // update fields
287
+ foreach($service['service_required_fields'] as $field) {
288
+ if(isset($_POST['qts_'.$service_id.'_'.$field['name']])) {
289
+ // skip empty passwords to keep the old value
290
+ if($_POST['qts_'.$service_id.'_'.$field['name']]=='' && $field['name']=='password') continue;
291
+ $service_settings[$service_id][$field['name']] = $_POST['qts_'.$service_id.'_'.$field['name']];
292
+ }
293
+ }
294
+ }
295
+ update_option('qts_service_settings', $service_settings);
296
+ }
297
+ }
298
+ if(isset($_GET['qts_delete'])) {
299
+ $_GET['qts_delete'] = intval($_GET['qts_delete']);
300
+ $orders = get_option('qts_orders');
301
+ if(is_array($orders)) {
302
+ foreach($orders as $key => $order) {
303
+ if($orders[$key]['order']['order_id'] == $_GET['qts_delete']) {
304
+ unset($orders[$key]);
305
+ update_option('qts_orders',$orders);
306
+ }
307
+ }
308
+ }
309
+ $message = __('Order deleted.','qtranslate');
310
+ }
311
+ if(isset($_GET['qts_cron'])) {
312
+ qts_cron();
313
+ $message = __('Status updated for all open orders.','qtranslate');
314
+ }
315
+ return $message;
316
+ }
317
+
318
+ function qts_translate_box($post) {
319
+ global $q_config;
320
+ $languages = qtranxf_getSortedLanguages();
321
+ ?>
322
+ <ul>
323
+ <?php
324
+ $from = $q_config['default_language'];
325
+ $to = '';
326
+ foreach($languages as $language) {
327
+ if($language!=$from) $to = $language;
328
+ if(isset($_REQUEST['post'])) {
329
+ ?>
330
+ <li><img src="<?php echo trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$language]; ?>" alt="<?php echo $q_config['language_name'][$language]; ?>"> <a href="edit.php?page=qtranslate_services&post=<?php echo intval($_REQUEST['post']); ?>&target_language=<?php echo $language; ?>"><?php echo $q_config['language_name'][$language]; ?> <span class="qsprice"></span></a></li>
331
+ <?php
332
+ } else {
333
+ echo '<li>'.__('Please save your post first.','qtranslate').'</li>';
334
+ break;
335
+ }
336
+ }
337
+ ?>
338
+ </ul>
339
+ <script type="text/javascript">
340
+ // <![CDATA[
341
+ jQuery(document).ready(function() {
342
+ jQuery.post(ajaxurl, {
343
+ action: 'qts_quote',
344
+ mode: 'price_only',
345
+ translate_from: '<?php echo $from; ?>',
346
+ translate_to: '<?php echo $to; ?>',
347
+ service_id: 5,
348
+ post_id: '<?php echo intval($_REQUEST['post']); ?>'},
349
+ function(response) {
350
+ eval(response);
351
+ })
352
+ });
353
+ // ]]>
354
+ </script>
355
+
356
+ <?php
357
+ }
358
+
359
+ function qts_order_columns($columns) {
360
+ return array(
361
+ 'title' => __('Post Title', 'qtranslate'),
362
+ 'service' => __('Service', 'qtranslate'),
363
+ 'source_language' => __('Source Language', 'qtranslate'),
364
+ 'target_language' => __('Target Language', 'qtranslate'),
365
+ 'action' => __('Action', 'qtranslate')
366
+ );
367
+ }
368
+
369
+ function qts_config_hook($request_uri) {
370
+ global $q_config;
371
+ qtranxf_admin_section_start('qTranslate Services Settings','service');
372
+ ?>
373
+ <table class="form-table" id="qtranslate-admin-service" style="display: none">
374
+ <tr>
375
+ <th scope="row"><?php _e('qTranslate Services', 'qtranslate') ?></th>
376
+ <td>
377
+ <?php if(!qts_isOpenSSLAvailable()) { printf(__('<div id="message" class="error fade"><p>qTranslate Services could not load <a href="%s">OpenSSL</a>!</p></div>'), 'http://www.php.net/manual/book.openssl.php'); } ?>
378
+ <label for="qtranslate_services"><input type="checkbox" name="qtranslate_services" id="qtranslate_services" value="1"<?php echo ($q_config['qtranslate_services'])?' checked="checked"':''; ?>/> <?php _e('Enable qTranslate Services', 'qtranslate'); ?></label>
379
+ <br/>
380
+ <?php _e('With qTranslate Services, you will be able to use professional human translation services with a few clicks.', 'qtranslate'); ?><br />
381
+ </td>
382
+ </tr>
383
+ <?php
384
+ if($q_config['qtranslate_services']) {
385
+ $service_settings = get_option('qts_service_settings');
386
+ $services = qts_queryQS(QTS_GET_SERVICES);
387
+ $orders = get_option('qts_orders');
388
+ ?>
389
+ <tr valign="top">
390
+ <th scope="row"><h4><?php _e('Open Orders', 'qtranslate'); ?></h4></th>
391
+ <td>
392
+ <?php if(is_array($orders) && sizeof($orders)>0) { ?>
393
+ <table class="widefat">
394
+ <thead>
395
+ <tr>
396
+ <?php print_column_headers('order'); ?>
397
+ </tr>
398
+ </thead>
399
+
400
+ <tfoot>
401
+ <tr>
402
+ <?php print_column_headers('order', false); ?>
403
+ </tr>
404
+ </tfoot>
405
+ <?php
406
+ foreach($orders as $order) {
407
+ $post = &get_post($order['post_id']);
408
+ if(!$post) continue;
409
+ $post->post_title = esc_html(qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($post->post_title));
410
+ ?>
411
+ <tr>
412
+ <td class="qts_no-bottom-border"><a href="post.php?action=edit&post=<?php echo $order['post_id']; ?>" title="<?php printf(__('Edit %s', 'qtranslate'),$post->post_title); ?>"><?php echo $post->post_title; ?></a></td>
413
+ <td class="qts_no-bottom-border"><?php if(isset($services[$order['service_id']])): ?><a href="<?php echo $services[$order['service_id']]['service_url']; ?>" title="<?php _e('Website', 'qtranslate'); ?>"><?php echo $services[$order['service_id']]['service_name']; ?></a><?php endif; ?></td>
414
+ <td class="qts_no-bottom-border"><?php echo $q_config['language_name'][$order['source_language']]; ?></td>
415
+ <td class="qts_no-bottom-border"><?php echo $q_config['language_name'][$order['target_language']]; ?></td>
416
+ <td class="qts_no-bottom-border"><a class="delete" href="<?php echo add_query_arg('qts_delete', $order['order']['order_id'], $request_uri); ?>#qtranslate_service_settings">Delete</a></td>
417
+ </tr>
418
+ <?php
419
+ if(isset($order['status'])) {
420
+ ?>
421
+ <tr class="qts_status">
422
+ <td colspan="5">
423
+ <?php printf(__('Current Status: %s','qtranslate'), $order['status']); ?>
424
+ </td>
425
+ </tr>
426
+ <?php
427
+ }
428
+ }
429
+ ?>
430
+ </table>
431
+ <p><?php printf(__('qTranslate Services will automatically check every hour whether the translations are finished and update your posts accordingly. You can always <a href="%s">check manually</a>.','qtranslate'),'options-general.php?page=qtranslate-x&qts_cron=true#qtranslate_service_settings'); ?></p>
432
+ <p><?php _e('Deleting an open order doesn\'t cancel it. You will have to logon to the service homepage and cancel it there.','qtranslate'); ?></p>
433
+ <?php } else { ?>
434
+ <p><?php _e('No open orders.','qtranslate'); ?></p>
435
+ <?php } ?>
436
+ </td>
437
+ </tr>
438
+ <?php
439
+ if(!empty($services)){
440
+ $showservices=false;
441
+ foreach($services as $service) {
442
+ if(sizeof($service['service_required_fields'])==0) continue;
443
+ $showservices=true;
444
+ break;
445
+ }
446
+ if($showservices){
447
+ ?>
448
+ <tr valign="top">
449
+ <th scope="row" colspan="2">
450
+ <h4><?php _e('Service Configuration', 'qtranslate');?></h4>
451
+ <p class="description"><?php _e('Below, you will find configuration settings for qTranslate Service Providers, which are required for them to operate.', 'qtranslate'); ?></p>
452
+ </th>
453
+ </tr>
454
+ <?php
455
+ foreach($services as $service) {
456
+ if(sizeof($service['service_required_fields'])>0) {
457
+ ?>
458
+ <tr valign="top">
459
+ <th scope="row" colspan="2">
460
+ <h5><?php _e($service['service_name']);?> ( <a name="qts_service_<?php echo $service['service_id']; ?>" href="<?php echo $service['service_url']; ?>"><?php _e('Website', 'qtranslate'); ?></a> )</h5>
461
+ <p class="description"><?php _e($service['service_description']); ?></p>
462
+ </th>
463
+ </tr>
464
+ <?php
465
+ foreach($service['service_required_fields'] as $field) {
466
+ ?>
467
+ <tr valign="top">
468
+ <th scope="row"><?php echo $field['title']; ?></th>
469
+ <td>
470
+ <input type="<?php echo ($field['name']=='password')?'password':'text';?>" name="<?php echo 'qts_'.$service['service_id']."_".$field['name']; ?>" value="<?php echo (isset($service_settings[$service['service_id']][$field['name']])&&$field['name']!='password')?$service_settings[$service['service_id']][$field['name']]:''; ?>" style="width:100%"/>
471
+ </td>
472
+ </tr>
473
+ <?php
474
+ }
475
+ }
476
+ }}}
477
+ }
478
+ ?>
479
+ </table>
480
+ <?php
481
+ qtranxf_admin_section_end('service');
482
+ }
483
+
484
+ function qts_cron() {
485
+ global $wpdb;
486
+ // poll translations
487
+ $orders = get_option('qts_orders');
488
+ if(!is_array($orders)) return;
489
+ foreach($orders as $key => $order) {
490
+ qts_UpdateOrder($order['order']['order_id']);
491
+ }
492
+ }
493
+
494
+ function qts_UpdateOrder($order_id) {
495
+ global $wpdb;
496
+ $orders = get_option('qts_orders');
497
+ if(!is_array($orders)) return false;
498
+ foreach($orders as $key => $order) {
499
+ // search for wanted order
500
+ if($order['order']['order_id']!=$order_id) continue;
501
+
502
+ // query server for updates
503
+ $order['order']['order_url'] = get_option('home');
504
+ $result = qts_queryQS(QTS_RETRIEVE_TRANSLATION, $order['order']);
505
+ if(isset($result['order_comment'])) $orders[$key]['status'] = $result['order_comment'];
506
+ // update db if post is updated
507
+ if(isset($result['order_status']) && $result['order_status']==QTS_STATE_CLOSED) {
508
+ $order['post_id'] = intval($order['post_id']);
509
+ $post = &get_post($order['post_id']);
510
+ $title = qtranxf_split($post->post_title);
511
+ $content = qtranxf_split($post->post_content);
512
+ $title[$order['target_language']] = $result['order_translated_title'];
513
+ $content[$order['target_language']] = $result['order_translated_text'];
514
+ $post->post_title = qtranxf_join($title);
515
+ $post->post_content = qtranxf_join($content);
516
+ $wpdb->show_errors();
517
+ $wpdb->query('UPDATE '.$wpdb->posts.' SET post_title="'.mysql_escape_string($post->post_title).'", post_content = "'.mysql_escape_string($post->post_content).'" WHERE ID = "'.$post->ID.'"');
518
+ wp_cache_add($post->ID, $post, 'posts');
519
+ unset($orders[$key]);
520
+ }
521
+ update_option('qts_orders',$orders);
522
+ return true;
523
+ }
524
+ return false;
525
+ }
526
+
527
+ function qts_service() {
528
+ global $q_config, $qts_public_key, $qts_error_messages;
529
+ if(!isset($_REQUEST['post'])) {
530
+ echo '<script type="text/javascript">document.location="edit.php";</script>';
531
+ printf(__('To translate a post, please go to the <a href="%s">edit posts overview</a>.','qtranslate'), 'edit.php');
532
+ exit();
533
+ }
534
+ $post_id = intval($_REQUEST['post']);
535
+ $confirm = isset($_GET['confirm'])?true:false;
536
+ $translate_from = '';
537
+ $translate_to = '';
538
+ $translate_from_name = '';
539
+ $translate_to_name = '';
540
+ if(isset($_REQUEST['source_language'])&&qtranxf_isEnabled($_REQUEST['source_language']))
541
+ $translate_from = $_REQUEST['source_language'];
542
+ if(isset($_REQUEST['target_language'])&&qtranxf_isEnabled($_REQUEST['target_language']))
543
+ $translate_to = $_REQUEST['target_language'];
544
+ if($translate_to == $translate_from) $translate_to = '';
545
+ $post = &get_post($post_id);
546
+ if(!$post) {
547
+ printf(__('Post with id "%s" not found!','qtranslate'), $post_id);
548
+ return;
549
+ }
550
+ $default_service = intval(get_option('qts_default_service'));
551
+ $service_settings = get_option('qts_service_settings');
552
+ // Detect available Languages and possible target languages
553
+ $available_languages = qtranxf_getAvailableLanguages($post->post_content);
554
+ if(sizeof($available_languages)==0) {
555
+ $error = __('The requested Post has no content, no Translation possible.', 'qtranslate');
556
+ }
557
+
558
+ // try to guess source and target language
559
+ if(!in_array($translate_from, $available_languages)) $translate_from = '';
560
+ $missing_languages = array_diff($q_config['enabled_languages'], $available_languages);
561
+ if(empty($translate_from) && in_array($q_config['default_language'], $available_languages) && $translate_to!=$q_config['default_language']) $translate_from = $q_config['default_language'];
562
+ if(empty($translate_to) && sizeof($missing_languages)==1) $translate_to = $missing_languages[0];
563
+ if(in_array($translate_to, $available_languages)) {
564
+ $message = __('The Post already has content for the selected target language. If a translation request is send, the current text for the target language will be overwritten.','qtranslate');
565
+ }
566
+ if(sizeof($available_languages)==1) {
567
+ if($available_languages[0] == $translate_to) {
568
+ unset($translate_to);
569
+ }
570
+ $translate_from = $available_languages[0];
571
+ } elseif($translate_from == '' && sizeof($available_languages) > 1) {
572
+ $languages = qtranxf_getSortedLanguages();
573
+ foreach($languages as $language) {
574
+ if($language != $translate_to && in_array($language, $available_languages)) {
575
+ $translate_from = $language;
576
+ break;
577
+ }
578
+ }
579
+ }
580
+
581
+ // link to current page with get variables
582
+ $url_link = add_query_arg('post', $post_id);
583
+ if(!empty($translate_to)) $url_link = add_query_arg('target_language', $translate_to, $url_link);
584
+ if(!empty($translate_from)) $url_link = add_query_arg('source_language', $translate_from, $url_link);
585
+
586
+ // get correct title and content
587
+ $post_title = qtranxf_use($translate_from,$post->post_title);
588
+ $post_content = qtranxf_use($translate_from,$post->post_content);
589
+ $post_excerpt = qtranxf_use($translate_from,$post->post_excerpt);
590
+ if(!empty($translate_from)) $translate_from_name = $q_config['language_name'][$translate_from];
591
+ if(!empty($translate_to)) $translate_to_name = $q_config['language_name'][$translate_to];
592
+ if(!empty($translate_from) && !empty($translate_to)) {
593
+ $title = sprintf('Translate &quot;%1$s&quot; from %2$s to %3$s', htmlspecialchars($post_title), $translate_from_name, $translate_to_name);
594
+ } elseif(!empty($translate_from)) {
595
+ $title = sprintf('Translate &quot;%1$s&quot; from %2$s', htmlspecialchars($post_title), $translate_from_name);
596
+ } else {
597
+ $title = sprintf('Translate &quot;%1$s&quot;', htmlspecialchars($post_title));
598
+ }
599
+
600
+ // Check data
601
+ if(isset($_POST['service_id'])) {
602
+ $service_id = intval($_POST['service_id']);
603
+ $default_service = $service_id;
604
+ update_option('qts_default_service', $service_id);
605
+ $order_key = substr(md5(time().AUTH_KEY),0,20);
606
+ $request = array(
607
+ 'order_service_id' => $service_id,
608
+ 'order_url' => get_option('home'),
609
+ 'order_key' => $order_key,
610
+ 'order_title' => $post_title,
611
+ 'order_text' => $post_content,
612
+ 'order_excerpt' => $post_excerpt,
613
+ 'order_source_language' => $translate_from,
614
+ 'order_source_locale' => $q_config['locale'][$translate_from],
615
+ 'order_target_language' => $translate_to,
616
+ 'order_target_locale' => $q_config['locale'][$translate_to]
617
+ );
618
+ // check for additional fields
619
+ if(isset($service_settings[$service_id]) && is_array($service_settings[$service_id])) {
620
+ $request['order_required_field'] = array();
621
+ foreach($service_settings[$service_id] as $setting => $value) {
622
+ $request['order_required_field'][$setting] = $value;
623
+ }
624
+ }
625
+ if(isset($_POST['token'])) $request['order_token'] = $_POST['token'];
626
+ $answer = qts_queryQS(QTS_INIT_TRANSLATION, $request);
627
+ if(isset($answer['error'])) {
628
+ $error = sprintf(__('An error occured: %s', 'qtranslate'), $qts_error_messages[$answer['error']]);
629
+ if($answer['message']!='') {
630
+ $error.='<br />'.sprintf(__('Additional information: %s', 'qtranslate'), qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($answer['message']));
631
+ }
632
+ }
633
+ if(isset($answer['order_id'])) {
634
+ $orders = get_option('qts_orders');
635
+ if(!is_array($orders)) $orders = array();
636
+ $orders[] = array('post_id'=>$post_id, 'service_id' => $service_id, 'source_language'=>$translate_from, 'target_language'=>$translate_to, 'order' => array('order_key' => $order_key, 'order_id' => $answer['order_id']));
637
+ update_option('qts_orders', $orders);
638
+ if(empty($answer['message'])) {
639
+ $order_completed_message = '';
640
+ } else {
641
+ $order_completed_message = htmlspecialchars($answer['message']);
642
+ }
643
+ qts_UpdateOrder($answer['order_id']);
644
+ }
645
+ }
646
+ if(isset($error)) {
647
+ ?>
648
+ <div class="wrap">
649
+ <h2><?php _e('qTranslate Services', 'qtranslate'); ?></h2>
650
+ <div id="message" class="error fade"><p><?php echo $error; ?></p></div>
651
+ <p><?php printf(__('An serious error occured and qTranslate Services cannot proceed. For help, please visit the <a href="%s">Support Forum</a>','qtranslate'), 'http://www.qianqin.de/qtranslate/forum/');?></p>
652
+ </div>
653
+ <?php
654
+ return;
655
+ }
656
+ if(isset($order_completed_message)) {
657
+ ?>
658
+ <div class="wrap">
659
+ <h2><?php _e('qTranslate Services', 'qtranslate'); ?></h2>
660
+ <div id="message" class="updated fade"><p><?php _e('Order successfully sent.', 'qtranslate'); ?></p></div>
661
+ <p><?php _e('Your translation order has been successfully transfered to the selected service.','qtranslate'); ?></p>
662
+ <?php
663
+ if(!empty($order_completed_message)) {
664
+ ?>
665
+ <p><?php printf(__('The service returned this message: %s','qtranslate'), $order_completed_message);?></p>
666
+ <?php
667
+ }
668
+ ?>
669
+ <p><?php _e('Feel free to choose an action:', 'qtranslate'); ?></p>
670
+ <ul>
671
+ <li><a href="<?php echo add_query_arg('target_language', null, $url_link); ?>"><?php _e('Translate this post to another language.', 'qtranslate'); ?></a></li>
672
+ <li><a href="edit.php"><?php _e('Translate a different post.', 'qtranslate'); ?></a></li>
673
+ <li><a href="options-general.php?page=qtranslate-x#qtranslate_service_settings"><?php _e('View all open orders.', 'qtranslate'); ?></a></li>
674
+ <li><a href="options-general.php?page=qtranslate-x&qts_cron=true#qtranslate_service_settings"><?php _e('Let qTranslate Services check if any open orders are finished.', 'qtranslate'); ?></a></li>
675
+ <li><a href="<?php echo get_permalink($post_id); ?> "><?php _e('View this post.', 'qtranslate'); ?></a></li>
676
+ </ul>
677
+ </div>
678
+ <?php
679
+ return;
680
+ }
681
+ ?>
682
+ <div class="wrap">
683
+ <h2><?php _e('qTranslate Services', 'qtranslate'); ?></h2>
684
+ <?php
685
+ if(!empty($message)) {
686
+ ?>
687
+ <div id="message" class="updated fade"><p><?php echo $message; ?></p></div>
688
+ <?php
689
+ }
690
+ ?>
691
+ <h3><?php echo $title;?></h3>
692
+ <form action="edit.php?page=qtranslate_services" method="post" id="qtranslate-services-translate">
693
+ <p><?php
694
+ if(sizeof($available_languages)>1) {
695
+ $available_languages_name = array();
696
+ foreach(array_diff($available_languages,array($translate_from)) as $language) {
697
+ $available_languages_name[] = '<a href="'.add_query_arg('source_language',$language, $url_link).'">'.$q_config['language_name'][$language].'</a>';
698
+ }
699
+ $available_languages_names = join(", ", $available_languages_name);
700
+ printf(__('Your article is available in multiple languages. If you do not want to translate from %1$s, you can switch to one of the following languages: %2$s', 'qtranslate'),$q_config['language_name'][$translate_from],$available_languages_names);
701
+ }
702
+ ?></p>
703
+ <input type="hidden" name="post" value="<?php echo $post_id; ?>"/>
704
+ <input type="hidden" name="source_language" value="<?php echo $translate_from; ?>"/>
705
+ <?php
706
+ if(empty($translate_to)) {
707
+ ?>
708
+ <p><?php _e('Please choose the language you want to translate to:', 'qtranslate');?></p>
709
+ <ul>
710
+ <?php
711
+ foreach($q_config['enabled_languages'] as $language) {
712
+ if($translate_from == $language) continue;
713
+ ?>
714
+ <li><label><input type="radio" name="target_language" value="<?php echo $language;?>" /> <?php echo $q_config['language_name'][$language]; ?></li>
715
+ <?php
716
+ }
717
+ ?>
718
+ </ul>
719
+ <p class="submit">
720
+ <input type="submit" name="submit" class="button-primary" value="<?php _e('Continue', 'qtranslate') ?>" />
721
+ </p>
722
+ <?php
723
+ } else {
724
+ ?>
725
+ <input type="hidden" name="target_language" value="<?php echo $translate_to; ?>"/>
726
+ <?php if($confirm): ?>
727
+ <input type="hidden" name="service_id" value="<?php echo $_REQUEST['service_id']; ?>"/>
728
+ <input type="hidden" name="token" value="<?php echo $_REQUEST['token']; ?>"/>
729
+ <div id="submitboxcontainer" class="metabox-holder">
730
+ <div id="submitdiv" class="postbox">
731
+ <h3 class="hndle"><?php _e('Confirm Order', 'qtranslate'); ?></h3>
732
+ <div class="inside">
733
+ <p><?php _e('Please confirm your order.', 'qtranslate'); ?></p>
734
+ <div class="qts_submit"><a class="button-primary" onclick="sendorder();"><?php _e('Confirm Order', 'qtranslate'); ?></a></div>
735
+ </div>
736
+ </div>
737
+ </div>
738
+ <?php else: ?>
739
+ <div id="submitboxcontainer" class="metabox-holder">
740
+ <div id="submitdiv" class="postbox">
741
+ <h3 class="hndle"><?php _e('Request Translation', 'qtranslate'); ?></h3>
742
+ <div class="inside request">
743
+ <noscript><?php _e('Javascript is required for qTranslate Services', 'qtranslate'); ?></noscript>
744
+ <p><?php _e('Please choose a service first', 'qtranslate'); ?></p>
745
+ </div>
746
+ </div>
747
+ </div>
748
+ <?php endif; ?>
749
+ <?php
750
+ $timestamp = time();
751
+ if($timestamp != qts_queryQS(QTS_VERIFY, $timestamp)) {
752
+ ?>
753
+ <p class="error"><?php _e('ERROR: Could not connect to qTranslate Services. Please try again later.', 'qtranslate');?></p>
754
+ <?php
755
+ return;
756
+ }
757
+
758
+ ?>
759
+ <div id="qts_boxes" class="metabox-holder">
760
+ <div class="postbox">
761
+ <h3 class="hndle"><?php _e('Translation Service', 'qtranslate'); ?></h3>
762
+ <div class="inside">
763
+
764
+ <ul>
765
+ <?php
766
+ if($services = qts_queryQS(QTS_GET_SERVICES)) {
767
+ foreach($services as $service_id => $service) {
768
+ // check if we have data for all required fields
769
+ $requirements_matched = true;
770
+ foreach($service['service_required_fields'] as $field) {
771
+ if(!isset($service_settings[$service_id][$field['name']]) || $service_settings[$service_id][$field['name']] == '') $requirements_matched = false;
772
+ }
773
+ if(!$requirements_matched) {
774
+ ?>
775
+ <li>
776
+ <label><input type="radio" name="service_id" disabled="disabled" /> <b><?php echo qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($service['service_name']); ?></b> ( <a href="<?php echo $service['service_url']; ?>" target="_blank"><?php _e('Website', 'qtranslate'); ?></a> )</label>
777
+ <p class="error"><?php printf(__('Cannot use this service, not all <a href="%s">required fields</a> filled in for this service.','qtranslate'), 'options-general.php?page=qtranslate-x#qts_service_'.$service_id); ?></p>
778
+ <p class="service_description"><?php echo qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($service['service_description']); ?></p>
779
+ </li>
780
+ <?php
781
+ } else {
782
+ ?>
783
+ <li><label><input type="radio" id="qts_service_<?php echo $service['service_id'];?>" onclick="chooseservice(this.value)" value="<?php echo $service['service_id'];?>" <?php echo $confirm?'disabled="disabled"':'name="service_id"'; ?> /> <b><?php echo qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($service['service_name']); ?></b> ( <a href="<?php echo $service['service_url']; ?>" target="_blank"><?php _e('Website', 'qtranslate'); ?></a> )</label><p class="service_description"><?php echo qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($service['service_description']); ?></p></li>
784
+ <?php
785
+ }
786
+ }
787
+ ?>
788
+ </ul>
789
+ <script type="text/javascript">
790
+ function chooseservice(id) {
791
+ jQuery('#qts_service_'+id).attr('checked','checked');
792
+ jQuery('#submitdiv .request').html('<?php _e('<p><img src="images/wpspin_light.gif"> Getting Quote...</p>', 'qtranslate'); ?>');
793
+ jQuery.post(ajaxurl, {
794
+ action: 'qts_quote',
795
+ translate_from: '<?php echo $translate_from; ?>',
796
+ translate_to: '<?php echo $translate_to; ?>',
797
+ service_id: id,
798
+ post_id: '<?php echo $post_id; ?>'},
799
+ function(response) {
800
+ eval(response);
801
+ });
802
+ }
803
+
804
+ function sendorder() {
805
+ jQuery("#qtranslate-services-translate").submit();
806
+ }
807
+
808
+ chooseservice('<?php echo isset($_REQUEST['service_id'])?$_REQUEST['service_id']:$default_service; ?>');
809
+ </script>
810
+ </div>
811
+ </div>
812
+ <div class="postbox closed">
813
+ <div class="handlediv" title="<?php _e('Click to toggle'); ?>" onclick="jQuery(this).parent().removeClass('closed');jQuery(this).hide();"><br></div>
814
+ <h3 class="hndle"><?php _e('Review Article', 'qtranslate'); ?></h3>
815
+ <div class="inside">
816
+ <textarea name="qts_content_preview" id="qts_content_preview" readonly="readonly"><?php echo $post_content; ?></textarea>
817
+ </div>
818
+ </div>
819
+
820
+ <p><?php _e('Your article will be SSL encrypted and securly sent to qTranslate Services, which will forward your text to the chosen Translation Service. Once qTranslate Services receives the translated text, it will automatically appear on your blog.', 'qtranslate'); ?></p>
821
+ <?php
822
+ }
823
+ ?>
824
+ </div>
825
+ <?php
826
+ }
827
+ ?>
828
+ </div>
829
+ </form>
830
+ <?php
831
+ }
832
+
833
+ function qts_quote() {
834
+ global $q_config;
835
+ $mode = 'full';
836
+ if(isset($_POST['mode'])) $mode = $_POST['mode'];
837
+ if($mode!='price_only') $mode = 'full';
838
+ $service_id = $_POST['service_id'];
839
+ $translate_from = $_POST['translate_from'];
840
+ $translate_to = $_POST['translate_to'];
841
+ $post = &get_post($_POST['post_id']);
842
+ $post = qtranxf_use($translate_from, $post);
843
+ $post_title = $post->post_title;
844
+ $post_content = $post->post_content;
845
+ $post_excerpt = $post->post_excerpt;
846
+ $request = array(
847
+ 'order_service_id' => $service_id,
848
+ 'order_title' => $post_title,
849
+ 'order_text' => $post_content,
850
+ 'order_excerpt' => $post_excerpt,
851
+ 'order_source_language' => $translate_from,
852
+ 'order_source_locale' => $q_config['locale'][$translate_from],
853
+ 'order_target_language' => $translate_to,
854
+ 'order_target_locale' => $q_config['locale'][$translate_to],
855
+ 'order_confirm_url' => get_admin_url(null, 'edit.php?page=qtranslate_services&confirm=1&post='.$_POST['post_id'].'&source_language='.$translate_from.'&target_language='.$translate_to.'&service_id='.$service_id),
856
+ 'order_failure_url' => get_admin_url(null, 'edit.php?page=qtranslate_services&post='.$_POST['post_id'].'&source_language='.$translate_from.'&target_language='.$translate_to.'&service_id='.$service_id)
857
+ );
858
+ $answer = qts_queryQS(QTS_QUOTE, $request);
859
+ $price = __('unavailable', 'qtranslate');
860
+ $currency = '';
861
+ $short = '';
862
+ if(isset($answer['price'])) {
863
+ if($answer['price'] == 0) {
864
+ $price = __('free', 'qtranslate');
865
+ } else if($answer['price'] < 0) {
866
+ $price = __('unavailable', 'qtranslate');
867
+ } else {
868
+ $price = number_format_i18n($answer['price'],2);
869
+ $currency = $answer['currency'];
870
+ }
871
+ $content = sprintf(__('<p>Price: %1$s %2$s</p>','qtranslate'), $currency, $price);
872
+ $short = sprintf(__('~ %1$s %2$s','qtranslate'), $currency, $price);
873
+ if(!empty($answer['paypalurl'])) {
874
+ $content .= '<div class="qts_submit"><a href="'.$answer['paypalurl'].'"><img src="https://fpdbs.paypal.com/dynamicimageweb?cmd=_dynamic-image&locale='.$q_config['locale'][$q_config['language']].'"></a></div>';
875
+ } else {
876
+ $content .= '<div class="qts_submit"><a class="button-primary" onclick="sendorder();">'.__('Request Translation', 'qtranslate').'</a></div>';
877
+ }
878
+ } else {
879
+ $content = '<p>'.__('An error occured!', 'qtranslate');
880
+ if(isset($answer['error'])) $content .= '<br>'.$answer['message'];
881
+ $content .= '</p>';
882
+ }
883
+ if($mode == 'full') {
884
+ echo "jQuery('#submitdiv .request').html('";
885
+ echo $content;
886
+ echo "');";
887
+ } else if($mode == 'price_only') {
888
+ echo "jQuery('.qsprice').html('";
889
+ echo $short;
890
+ echo "');";
891
+ }
892
+ die();
893
+ }
894
+
895
+ function qts_toobar($content) {
896
+ // Create Translate Button
897
+ $content .= qtranxf_createEditorToolbarButton('translate', 'translate', 'init_qs', __('Translate'));
898
+ return $content;
899
+ }
900
+
901
+ function qts_editor_js($content) {
902
+ $content .= "
903
+ init_qs = function(action, id) {
904
+ document.location.href = 'edit.php?page=qtranslate_services&post=".intval($_REQUEST['post'])."';
905
+ }
906
+ ";
907
+ return $content;
908
+ }
909
+ ?>
qtranslate_utils.php ADDED
@@ -0,0 +1,243 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // encoding: utf-8
2
+ /*
3
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ /* qTranslate-X Utilities */
21
+
22
+ function qtranxf_parseURL($url) {
23
+ $r = '!(?:(\w+)://)?(?:(\w+)\:(\w+)@)?([^/:]+)?';
24
+ $r .= '(?:\:(\d*))?([^#?]+)?(?:\?([^#]+))?(?:#(.+$))?!i';
25
+
26
+ preg_match ( $r, $url, $out );
27
+ $result = @array(
28
+ "scheme" => $out[1],
29
+ "host" => $out[4].(($out[5]=='')?'':':'.$out[5]),
30
+ "user" => $out[2],
31
+ "pass" => $out[3],
32
+ "path" => $out[6],
33
+ "query" => $out[7],
34
+ "fragment" => $out[8]
35
+ );
36
+ return $result;
37
+ }
38
+
39
+ function qtranxf_stripSlashesIfNecessary($str) {
40
+ if(1==get_magic_quotes_gpc()) {
41
+ $str = stripslashes($str);
42
+ }
43
+ return $str;
44
+ }
45
+
46
+ function qtranxf_insertDropDownElement($language, $url, $id){
47
+ global $q_config;
48
+ $html ="
49
+ var sb = document.getElementById('qtranxs_select_".$id."');
50
+ var o = document.createElement('option');
51
+ var l = document.createTextNode('".$q_config['language_name'][$language]."');
52
+ ";
53
+ if($q_config['language']==$language)
54
+ $html .= "o.selected = 'selected';";
55
+ $html .= "
56
+ o.value = '".addslashes(htmlspecialchars_decode($url, ENT_NOQUOTES))."';
57
+ o.appendChild(l);
58
+ sb.appendChild(o);
59
+ ";
60
+ return $html;
61
+ }
62
+
63
+ if (!function_exists('qtranxf_getLanguage')){
64
+ function qtranxf_getLanguage() {
65
+ global $q_config;
66
+ return $q_config['language'];
67
+ }
68
+ }
69
+
70
+ function qtranxf_getLanguageName($lang = '') {
71
+ global $q_config;
72
+ if($lang=='' || !qtranxf_isEnabled($lang)) $lang = $q_config['language'];
73
+ return $q_config['language_name'][$lang];
74
+ }
75
+
76
+ function qtranxf_isEnabled($lang) {
77
+ global $q_config;
78
+ return in_array($lang, $q_config['enabled_languages']);
79
+ }
80
+
81
+ function qtranxf_startsWith($s, $n) {
82
+ if(strlen($n)>strlen($s)) return false;
83
+ if($n == substr($s,0,strlen($n))) return true;
84
+ return false;
85
+ }
86
+
87
+ function qtranxf_getAvailableLanguages($text) {
88
+ global $q_config;
89
+ $result = array();
90
+ $content = qtranxf_split($text);
91
+ foreach($content as $language => $lang_text) {
92
+ $lang_text = trim($lang_text);
93
+ if(!empty($lang_text)) $result[] = $language;
94
+ }
95
+ if(sizeof($result)==0) {
96
+ // add default language to keep default URL
97
+ $result[] = $q_config['language'];
98
+ }
99
+ return $result;
100
+ }
101
+
102
+ function qtranxf_isAvailableIn($post_id, $language='') {
103
+ global $q_config;
104
+ if($language == '') $language = $q_config['default_language'];
105
+ $post = &get_post($post_id);
106
+ $languages = qtranxf_getAvailableLanguages($post->post_content);
107
+ return in_array($language,$languages);
108
+ }
109
+
110
+ function qtranxf_convertDateFormatToStrftimeFormat($format) {
111
+ $mappings = array(
112
+ 'd' => '%d',
113
+ 'D' => '%a',
114
+ 'j' => '%E',
115
+ 'l' => '%A',
116
+ 'N' => '%u',
117
+ 'S' => '%q',
118
+ 'w' => '%f',
119
+ 'z' => '%F',
120
+ 'W' => '%V',
121
+ 'F' => '%B',
122
+ 'm' => '%m',
123
+ 'M' => '%b',
124
+ 'n' => '%i',
125
+ 't' => '%J',
126
+ 'L' => '%k',
127
+ 'o' => '%G',
128
+ 'Y' => '%Y',
129
+ 'y' => '%y',
130
+ 'a' => '%P',
131
+ 'A' => '%p',
132
+ 'B' => '%K',
133
+ 'g' => '%l',
134
+ 'G' => '%L',
135
+ 'h' => '%I',
136
+ 'H' => '%H',
137
+ 'i' => '%M',
138
+ 's' => '%S',
139
+ 'u' => '%N',
140
+ 'e' => '%Q',
141
+ 'I' => '%o',
142
+ 'O' => '%O',
143
+ 'P' => '%s',
144
+ 'T' => '%v',
145
+ 'Z' => '%1',
146
+ 'c' => '%2',
147
+ 'r' => '%3',
148
+ 'U' => '%4'
149
+ );
150
+
151
+ $date_parameters = array();
152
+ $strftime_parameters = array();
153
+ $date_parameters[] = '#%#'; $strftime_parameters[] = '%';
154
+ foreach($mappings as $df => $sf) {
155
+ $date_parameters[] = '#(([^%\\\\])'.$df.'|^'.$df.')#'; $strftime_parameters[] = '${2}'.$sf;
156
+ }
157
+ // convert everything
158
+ $format = preg_replace($date_parameters, $strftime_parameters, $format);
159
+ // remove single backslashes from dates
160
+ $format = preg_replace('#\\\\([^\\\\]{1})#','${1}',$format);
161
+ // remove double backslashes from dates
162
+ $format = preg_replace('#\\\\\\\\#','\\\\',$format);
163
+ return $format;
164
+ }
165
+
166
+ function qtranxf_convertFormat($format, $default_format) {
167
+ global $q_config;
168
+ // if timestamp is requested, don't replace it
169
+ if('U'==$format) return qtranxf_convertDateFormatToStrftimeFormat($format);
170
+ // check for multilang formats
171
+ $format = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($format);
172
+ $default_format = qtranxf_useCurrentLanguageIfNotFoundUseDefaultLanguage($default_format);
173
+ switch($q_config['use_strftime']) {
174
+ case QTX_DATE:
175
+ if($format=='') $format = $default_format;
176
+ return qtranxf_convertDateFormatToStrftimeFormat($format);
177
+ case QTX_DATE_OVERRIDE:
178
+ return qtranxf_convertDateFormatToStrftimeFormat($default_format);
179
+ case QTX_STRFTIME:
180
+ return $format;
181
+ case QTX_STRFTIME_OVERRIDE:
182
+ return $default_format;
183
+ }
184
+ }
185
+
186
+ function qtranxf_convertDateFormat($format) {
187
+ global $q_config;
188
+ if(isset($q_config['date_format'][$q_config['language']])) {
189
+ $default_format = $q_config['date_format'][$q_config['language']];
190
+ } elseif(isset($q_config['date_format'][$q_config['default_language']])) {
191
+ $default_format = $q_config['date_format'][$q_config['default_language']];
192
+ } else {
193
+ $default_format = '';
194
+ }
195
+ return qtranxf_convertFormat($format, $default_format);
196
+ }
197
+
198
+ function qtranxf_convertTimeFormat($format) {
199
+ global $q_config;
200
+ if(isset($q_config['time_format'][$q_config['language']])) {
201
+ $default_format = $q_config['time_format'][$q_config['language']];
202
+ } elseif(isset($q_config['time_format'][$q_config['default_language']])) {
203
+ $default_format = $q_config['time_format'][$q_config['default_language']];
204
+ } else {
205
+ $default_format = '';
206
+ }
207
+ return qtranxf_convertFormat($format, $default_format);
208
+ }
209
+
210
+ function qtranxf_formatCommentDateTime($format) {
211
+ global $comment;
212
+ return qtranxf_strftime(qtranxf_convertFormat($format, $format), mysql2date('U',$comment->comment_date), '', $before, $after);
213
+ }
214
+
215
+ function qtranxf_formatPostDateTime($format) {
216
+ global $post;
217
+ return qtranxf_strftime(qtranxf_convertFormat($format, $format), mysql2date('U',$post->post_date), '', $before, $after);
218
+ }
219
+
220
+ function qtranxf_formatPostModifiedDateTime($format) {
221
+ global $post;
222
+ return qtranxf_strftime(qtranxf_convertFormat($format, $format), mysql2date('U',$post->post_modified), '', $before, $after);
223
+ }
224
+
225
+ function qtranxf_realURL($url = '') {
226
+ global $q_config;
227
+ return $q_config['url_info']['original_url'];
228
+ }
229
+
230
+ function qtranxf_getSortedLanguages($reverse = false) {
231
+ global $q_config;
232
+ $languages = $q_config['enabled_languages'];
233
+ ksort($languages);
234
+ // fix broken order
235
+ $clean_languages = array();
236
+ foreach($languages as $lang) {
237
+ $clean_languages[] = $lang;
238
+ }
239
+ if($reverse) krsort($clean_languages);
240
+ return $clean_languages;
241
+ }
242
+
243
+ ?>
qtranslate_widget.php ADDED
@@ -0,0 +1,137 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php // encoding: utf-8
2
+ /*
3
+ Copyright 2014 qTranslate Team (email : qTranslateTeam@gmail.com )
4
+
5
+ This program is free software; you can redistribute it and/or modify
6
+ it under the terms of the GNU General Public License as published by
7
+ the Free Software Foundation; either version 2 of the License, or
8
+ (at your option) any later version.
9
+
10
+ This program is distributed in the hope that it will be useful,
11
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
12
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the
13
+ GNU General Public License for more details.
14
+
15
+ You should have received a copy of the GNU General Public License
16
+ along with this program; if not, write to the Free Software
17
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
+ */
19
+
20
+ /* qTranslate-X Widget */
21
+
22
+ class qTranslateXWidget extends WP_Widget {
23
+ function qTranslateXWidget() {
24
+ $widget_ops = array('classname' => 'qtranxs-widget', 'description' => __('Allows your visitors to choose a Language.', 'qtranslate') );
25
+ $this->WP_Widget('qtranslate', __('qTranslate Language Chooser', 'qtranslate'), $widget_ops);
26
+ }
27
+
28
+ function widget($args, $instance) {
29
+ extract($args);
30
+
31
+ echo $before_widget;
32
+ $title = empty($instance['title']) ? __('Language', 'qtranslate') : apply_filters('widget_title', $instance['title']);
33
+ $hide_title = empty($instance['hide-title']) ? false : 'on';
34
+ $type = $instance['type'];
35
+ if($type!='text'&&$type!='image'&&$type!='both'&&$type!='dropdown') $type='text';
36
+
37
+ if($hide_title!='on') { echo $before_title . $title . $after_title; };
38
+ qtranxf_generateLanguageSelectCode($type, $this->id);
39
+ echo $after_widget;
40
+ }
41
+
42
+ function update($new_instance, $old_instance) {
43
+ $instance = $old_instance;
44
+ $instance['title'] = $new_instance['title'];
45
+ if(isset($new_instance['hide-title'])) $instance['hide-title'] = $new_instance['hide-title'];
46
+ $instance['type'] = $new_instance['type'];
47
+
48
+ return $instance;
49
+ }
50
+
51
+ function form($instance) {
52
+ $instance = wp_parse_args( (array) $instance, array( 'title' => '', 'hide-title' => false, 'type' => 'text' ) );
53
+ $title = $instance['title'];
54
+ $hide_title = $instance['hide-title'];
55
+ $type = $instance['type'];
56
+ ?>
57
+ <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:', 'qtranslate'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" /></label></p>
58
+ <p><label for="<?php echo $this->get_field_id('hide-title'); ?>"><?php _e('Hide Title:', 'qtranslate'); ?> <input type="checkbox" id="<?php echo $this->get_field_id('hide-title'); ?>" name="<?php echo $this->get_field_name('hide-title'); ?>" <?php echo ($hide_title=='on')?'checked="checked"':''; ?>/></label></p>
59
+ <p><?php _e('Display:', 'qtranslate'); ?></p>
60
+ <p><label for="<?php echo $this->get_field_id('type'); ?>1"><input type="radio" name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>1" value="text"<?php echo ($type=='text')?' checked="checked"':'' ?>/> <?php _e('Text only', 'qtranslate'); ?></label></p>
61
+ <p><label for="<?php echo $this->get_field_id('type'); ?>2"><input type="radio" name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>2" value="image"<?php echo ($type=='image')?' checked="checked"':'' ?>/> <?php _e('Image only', 'qtranslate'); ?></label></p>
62
+ <p><label for="<?php echo $this->get_field_id('type'); ?>3"><input type="radio" name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>3" value="both"<?php echo ($type=='both')?' checked="checked"':'' ?>/> <?php _e('Text and Image', 'qtranslate'); ?></label></p>
63
+ <p><label for="<?php echo $this->get_field_id('type'); ?>4"><input type="radio" name="<?php echo $this->get_field_name('type'); ?>" id="<?php echo $this->get_field_id('type'); ?>4" value="dropdown"<?php echo ($type=='dropdown')?' checked="checked"':'' ?>/> <?php _e('Dropdown Box', 'qtranslate'); ?></label></p>
64
+ <?php
65
+ }
66
+ }
67
+
68
+ // Language Select Code for non-Widget users
69
+ function qtranxf_generateLanguageSelectCode($style='', $id='') {
70
+ global $q_config;
71
+ if($style=='') $style='text';
72
+ if(is_bool($style)&&$style) $style='image';
73
+ if(is_404()) $url = get_option('home'); else $url = '';
74
+ if($id=='') $id = 'qtranslate';
75
+ $id .= '-chooser';
76
+ switch($style) {
77
+ case 'image':
78
+ case 'text':
79
+ case 'dropdown':
80
+ echo '<ul class="qtranxf_language_chooser" id="'.$id.'">';
81
+ foreach(qtranxf_getSortedLanguages() as $language) {
82
+ $classes = array('lang-'.$language);
83
+ if($language == $q_config['language'])
84
+ $classes[] = 'active';
85
+ echo '<li class="'. implode(' ', $classes) .'"><a href="'.qtranxf_convertURL($url, $language, false, true).'"';
86
+ // set hreflang
87
+ echo ' hreflang="'.$language.'" title="'.$q_config['language_name'][$language].'"';
88
+ if($style=='image')
89
+ //echo ' class="qtranxf_flag qtranxf_flag_'.$language.'"';
90
+ echo '>';
91
+ if($style=='image')
92
+ {
93
+ echo '<img src="'.trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$language].'"></img>';
94
+ }
95
+ echo '<span';
96
+ if($style=='image')
97
+ echo ' style="display:none"';
98
+ echo '>'.$q_config['language_name'][$language].'</span></a></li>';
99
+ }
100
+ echo "</ul><div class=\"qtranxf_widget_end\"></div>";
101
+ if($style=='dropdown') {
102
+ echo "<script type=\"text/javascript\">\n// <![CDATA[\r\n";
103
+ echo "var lc = document.getElementById('".$id."');\n";
104
+ echo "var s = document.createElement('select');\n";
105
+ echo "s.id = 'qtranxs_select_".$id."';\n";
106
+ echo "lc.parentNode.insertBefore(s,lc);";
107
+ // create dropdown fields for each language
108
+ foreach(qtranxf_getSortedLanguages() as $language) {
109
+ echo qtranxf_insertDropDownElement($language, qtranxf_convertURL($url, $language, false, true), $id);
110
+ }
111
+ // hide html language chooser text
112
+ echo "s.onchange = function() { document.location.href = this.value;}\n";
113
+ echo "lc.style.display='none';\n";
114
+ echo "// ]]>\n</script>\n";
115
+ }
116
+ break;
117
+ case 'both':
118
+ echo '<ul class="qtranxf_language_chooser" id="'.$id.'">';
119
+ foreach(qtranxf_getSortedLanguages() as $language) {
120
+ echo '<li';
121
+ if($language == $q_config['language'])
122
+ echo ' class="active"';
123
+ echo '><a href="'.qtranxf_convertURL($url, $language).'"';
124
+ echo ' class="qtranxf_flag_'.$language.' qtranxf_flag_and_text" title="'.$q_config['language_name'][$language].'">';
125
+ echo '<img src="'.trailingslashit(WP_CONTENT_URL).$q_config['flag_location'].$q_config['flag'][$language].'"></img>';
126
+ echo '<span>'.$q_config['language_name'][$language].'</span></a></li>';
127
+ }
128
+ echo "</ul><div class=\"qtranxf_widget_end\"></div>";
129
+ break;
130
+ }
131
+ }
132
+
133
+ function qtranxf_widget_init() {
134
+ register_widget('qTranslateXWidget');
135
+ }
136
+
137
+ ?>
readme.txt ADDED
@@ -0,0 +1,174 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === qTranslate-X ===
2
+ Developed by: qTranslate Team based on original code by Qian Qin
3
+ Contributors: johnclause, chineseleper, Vavooon
4
+ Tags: multilingual, language, admin, tinymce, bilingual, widget, switcher, i18n, l10n, multilanguage, translation
5
+ Requires at least: 3.9
6
+ Tested up to: 4.1
7
+ Stable tag: 2.7.8
8
+ License: GPLv3 or later
9
+ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QEXEK3HX8AR6U
10
+ License URI: http://www.gnu.org/licenses/gpl-3.0.html
11
+
12
+ Adds user-friendly and database-friendly multilingual content management and translation support. It is a fork and a bug fixer of qTranslate.
13
+
14
+ == Description ==
15
+
16
+ This plugin is a descendant of [qTranslate](https://wordpress.org/plugins/qtranslate/ "Original qTranslate plugin"), which has apparently been abandoned by the original author, [Qian Qin](http://www.qianqin.de/qtranslate/ "the original author of qTranslate").
17
+
18
+ While the back-end database framework is left almost intact and fully compatible with former qTranslate, the design of editors is drastically changed and improved to be much less vulnerable to WP updates. Instead of seeing multiple lines per each language for title, qTranslate-X provides language switching buttons, which, once pressed, make all the text fields to be filled with the language chosen. The instant language change happens locally in your browser without sending an additional request to the server.
19
+
20
+ qTranslate-X makes creation of multilingual content as easy as working with a single language. Here are some features:
21
+
22
+ - One-click local switching between the languages - Changing the language as easy as switching between Visual and HTML.
23
+ - Language customizations without changing the .mo files - It stores all the translations in the same post fields, while shows it to user for editing one by one depending on the language to edit chosen.
24
+ - In-line syntax '`<!--:en-->English Text<--:--><!--:de-->Deutsch<--:-->`' or '`[:en]English Text[:de]Deutsch`' for theme-custom fields gets them translated. See [FAQ](https://wordpress.org/plugins/qtranslate-x/faq/ "qTranslate-X FAQ") for more information.
25
+ - Multilingual dates out of the box - Translates dates and time for you.
26
+ - Theme custom fields can be configured to be translatable too.
27
+ - Comes with a number of languages already built-in - English, German, Simplified Chinese, for example, and many more.
28
+ - Choose one of 3 Modes to make your URLs look pretty and SEO-friendly. - The simple and beautiful `/en/foo/`, or nice and neat `en.yoursite.com`, and everywhere compatible `?lang=en`.
29
+ - One language for each URL - Users and SEO will thank you for not mixing multilingual content.
30
+ - qTranslate-X supports unlimited number of languages, which can be easily added/modified/deleted via a comfortable Configuration Page at Settings->Languages.
31
+ - You may use [Google XML Sitemaps v3 for qTranslate](https://wordpress.org/plugins/google-xml-sitemaps-v3-for-qtranslate/) plugin to rebuild your XML sitemap for better SEO support.
32
+
33
+ You may still find a lot of useful information through reading [qTranslate](https://wordpress.org/plugins/qtranslate/ "Original qTranslate plugin")'s original documentation, which is not duplicated here in full. There are also other plugins, which offer multilingual support, but it seems that Qian Qin has very good original back-end design, and many people have been pleasantly using his plugin ever since. It stores all translations in the same single post, which makes it easy to maintain and to use it with other plugins. However, the user interface of former qTranslate got out of sync with the recent versions of Wordpress, especially after WP went to TinyMCE 4. There is a number of forks of qTranslate, see for example, [mqTranslate](https://wordpress.org/plugins/mqtranslate/ "mqTranslate plugin"), [qTranslate Plus](https://wordpress.org/plugins/qtranslate-xp/ "qTranslate Plus plugin") and [zTranslate](https://wordpress.org/plugins/ztranslate/ "zTranslate plugin"). They all try to fix qTranslate's user interface preserving its original back-end, which is what this plugin does too. This plugin is a hybrid of all of them and fixes a few bugs in each of them. It also has many new features too, like theme custom translatable fields, for example. We hope that this plugin is the most complete working version which combines the best features of [qTranslate](https://wordpress.org/plugins/qtranslate/ "Original qTranslate plugin"), [mqTranslate](https://wordpress.org/plugins/mqtranslate/ "mqTranslate fork"), [qTranslate Plus](https://wordpress.org/plugins/qtranslate-xp/ "qTranslate Plus fork") and [zTranslate](https://wordpress.org/plugins/ztranslate/ "zTranslate fork").
34
+
35
+ We suggest all mentioned authors to get together and to continue supporting one single qTranslate-ish plugin in a joint effort.
36
+
37
+ == Installation ==
38
+
39
+ Installation of this plugin is no different from any other plugin:
40
+
41
+ 1. Download the plugin from [here](http://wordpress.org/plugins/qtranslate-x/ "qTranslate-X").
42
+ 1. Extract all the files.
43
+ 1. Upload everything (keeping the directory structure) to the `/wp-content/plugins/` directory.
44
+ 1. Deactivate plugin qTranslate, mqTranslate, qTranslate Plus, or zTranslate, if you running any.
45
+ 1. Activate qTranslate-X through the 'Plugins' configuration page in WordPress.
46
+ 1. Open Settings->Languages configuration page and add/delete/disable any languages you need.
47
+ 1. Add the qTranslate Widget or Language Switcher menu item to let your visitors switch the language.
48
+ 1. You may use [Google XML Sitemaps v3 for qTranslate](https://wordpress.org/plugins/google-xml-sitemaps-v3-for-qtranslate/) plugin to rebuild your XML sitemap for better SEO support.
49
+ 1. Configure theme custom fields to be translatable if needed (Settings -> Languages: "Custom Fields").
50
+ 1. Upgrading from [qTranslate](https://wordpress.org/plugins/qtranslate/ "qTranslate original plugin") required no additional actions, qTranslate-X will continue to work from the database entries of qTranslate. One may also go back to qTranslate at any time. Upgrading from other qTranslate forks may require re-configuration of the languages and taxonomies names, unless you rename corresponding database entries directly.
51
+
52
+ == Frequently Asked Questions ==
53
+
54
+ = Is it possible to translate theme custom fields? =
55
+
56
+ Yes, some themes put additional text fields per page or per post. By default, those fields have no way to respond to language switching buttons in editors. However, you may enter "id" attribute of those fields into "Custom Fields" section of "Languages" configuration page in "Settings", and they will then respond to the language switching buttons allowing you to enter different text for each language. To lookup "id", right-click on the field in the post or the page editor, choose "Inspect Element", and look for an attribute of the field named "id".
57
+
58
+ The theme must pass those values through [translation](http://codex.wordpress.org/Function_Reference/_2) function '__()' before displaying on the output. Most themes do this by default, otherwise you may ask theme author to make this little modification for each field you need to be translatable.
59
+
60
+ Translatable fields, pre-configured by default:
61
+
62
+ - all input fields of class "wp-editor-area", which normally include all TinyMCE visual editors.
63
+ - fields with the following id: "title", "attachment_caption", "attachment_alt".
64
+
65
+ This applies to post, pages and media editors (/wp-admin/post*).
66
+
67
+ = How do I translate custom configuration fields, which are not handled by language switch buttons? =
68
+
69
+ Some themes have additional to the standard WP design fields, which need to be translated. In such a case, enter all translations in one field using syntax like this:
70
+
71
+ `<!--:en-->English Text<--:--><!--:de-->Deutsch<--:-->`
72
+
73
+ or like this
74
+
75
+ `[:en]English Text[:de]Deutsch`
76
+
77
+ If a theme uses `__()` [translate](http://codex.wordpress.org/Function_Reference/_2 "WP Function 'translate'") function before displaying those fields, then they will be shown correctly, otherwise suggest theme author to put `__()` calls in. Most themes do it this way.
78
+
79
+ The '`[:]`' syntax works well for one-line text fields, while '`<--:-->`' syntax is more suitable for text areas.
80
+
81
+ = What is wrong with the original qTranslate? =
82
+
83
+ qTranslate still works fine at frontend, except one known to me bug of incorrect date display in comments for some themes. However, its backend breaks tinyMCE content editor in post editing page. Many people have been reporting the problems, but the author keeps silence. qTranslate-X uses the same database backend, and updated admin interface with a slightly different design.
84
+
85
+ = Does qTranslate-X offer anything new besides bug fixes of qTranslate? =
86
+
87
+ Yes, there is a number of new features, mostly of a convenience significance, which includes, but not limited to:
88
+
89
+ * A different design of language switching via conveniently located buttons (same way as it is done on [zTranslate](https://wordpress.org/plugins/mqtranslate/ "zTranslate plugin"). No multiple lines for title fields anymore. This design simplifies backend programming and is less likely to be broken on future WP changes.
90
+ * "Language Switcher" menu item on WP menu editing screen.
91
+ * Category and tag names in the lists on editing pages also respond to language switching and will display the taxonomy names in the currently editing language.
92
+ * Theme custom fields can be made translatable in addition to the default translatable fields.
93
+
94
+ = How do I read the FAQ of the original qTranslate? =
95
+
96
+ One can find the original qTranslate FAQ [here](https://wordpress.org/plugins/qtranslate/faq) and support forum [here](https://wordpress.org/support/plugin/qtranslate).
97
+
98
+
99
+ == Upgrade Notice ==
100
+
101
+ * Upgrading from [qTranslate](https://wordpress.org/plugins/qtranslate/ "qTranslate original plugin") required no additional actions, qTranslate-X will continue to work from the database entries of qTranslate. One may also go back to qTranslate at any time.
102
+ * Upgrading from other qTranslate forks may require re-configuration of the languages and taxonomies names.
103
+ * Former page and post translations are untouched and preserved.
104
+ * Upgrading from other multilingual frameworks will require custom re-configuration. We suggest to search for a plugin, which may be already implemented to transfer the translations to qTranslate or to qTranslate-X. If a plugin works for one, it should work for other too, since qTranslate-X and qTranslate share the same database structures.
105
+
106
+ == Screenshots ==
107
+
108
+ 1. Editing screen showing the buttons to switch the languages. Pressing a button does not make a call to the server, the editing happens locally, until "Update" button is pressed, the same way as it is for one language.
109
+ 2. Language Management Interface
110
+ 3. qTranslate translation services
111
+
112
+ == Changelog ==
113
+
114
+ = 2.7.8 =
115
+ * user-friendly activation hook to deactivate/import/export other qTranslate forks.
116
+ * import/export settings from other forks
117
+
118
+ = 2.7.7 =
119
+ * improved automatic downloading of gettext databases from WP repository.
120
+ * translation of "Site Title" and "Tagline" in Settings->General (/wp-admin/options-general.php).
121
+
122
+ = 2.7.6 =
123
+ * Option "Custom Field": theme custom fields can be translatable.
124
+
125
+ = 2.7.5 =
126
+ * handling multiple tinyMCE editors, as some themes have it. It will now make all fields in page and post editors of class "wp-editor-area" translatable.
127
+
128
+ = 2.7.4 =
129
+ * fix permalink on edit pages
130
+ * disabled autosave script in editors, since it saves the active language only and sometimes hardly messes it up later.
131
+
132
+ = 2.7.3 =
133
+ * fixes for flag path, when WP is not in /. Permalink on edit pages is still broken, apparently has always been for this case.
134
+ * various minor improvements
135
+
136
+ = 2.7.2 =
137
+ * bug fixer
138
+
139
+ = 2.7.1 =
140
+ * enabled translation of image 'alt' attribute.
141
+ * corrected behaviour of category and tag editing pages when admin language is not the default one.
142
+ * hid 'Quick Edit' in category and tag editing pages since it does not work as user would expect. One has to use "Edit" link to edit category or tag name.
143
+
144
+ = 2.7 =
145
+ * enabled translations of image captions, titles and descriptions (but not 'alt').
146
+
147
+ = 2.6.4 =
148
+ * improved Description, FAQ and other documentation.
149
+
150
+ = 2.6.3 (2014-12) (initial changes after zTranslate) =
151
+
152
+ * added "Language Switcher" menu item to WP menu editing screen
153
+ * currently editing language is memorized in cookies and preserved from one post to another
154
+ * on the first page load, the default language is now activated instead of the last language
155
+ * full screen mode for tinyMCE integrated properly
156
+ * more translation on tag and category editor pages
157
+ * added 'post_title' filter to translate all titles fetched for display purpose
158
+ * fixed problem with comment date display in some themes
159
+
160
+ == Credentials ==
161
+
162
+ * The code of this plugin mostly originally based on [qTranslate](https://wordpress.org/plugins/qtranslate/ "qTranslate original plugin") and [zTranslate](https://wordpress.org/plugins/ztranslate/ "zTranslate fork").
163
+ * Most flags in flags directory are made by Luc Balemans and downloaded from [FOTW Flags Of The World website](http://flagspot.net/flags/ "FOTW Flags Of The World website")
164
+
165
+ == Desirable Unimplemented Features ==
166
+
167
+ * "Quick Edit" action in category or tag list pages will update the default language only.
168
+ * Full screen editor mode does not have language switch buttons
169
+ * If a language was switched on a page or post, but no edits were done, browser still complains about page changes, when leaving page.
170
+
171
+ == Known Bugs ==
172
+
173
+ * Message "The backup of this post in your browser is different from the version below" appears sometimes in the post editor. Clicking on "Restore the backup" may produce unexpected result, since backup has one language only,
174
+ the one which was active at the time of the last pressing of button "Update". The code which causes this is in /wp-includes/js/autosave.js.
screenshot-1.png ADDED
Binary file
screenshot-2.png ADDED
Binary file
screenshot-3.png ADDED
Binary file