Transposh WordPress Translation - Version 0.2.9

Version Description

Download this release

Release Info

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

Code changes from version 0.2.8 to 0.2.9

core/parser.php CHANGED
@@ -478,7 +478,9 @@ class parser {
478
 
479
  }
480
 
481
- return $this->html;
 
 
482
  }
483
  }
484
  ?>
478
 
479
  }
480
 
481
+ // Changed because of places where tostring failed
482
+ //return $this->html;
483
+ return $this->html->outertext;
484
  }
485
  }
486
  ?>
core/utils.php CHANGED
@@ -32,7 +32,7 @@ require_once("constants.php");
32
  function cleanup_url($url, $remove_host = false) {
33
  global $languages, $home_url;
34
 
35
- $parsedurl = parse_url($url);
36
  //cleanup previous lang & edit parameter from url
37
 
38
  if (isset($parsedurl['query'])) {
@@ -65,9 +65,9 @@ function cleanup_url($url, $remove_host = false) {
65
  if (isset ($languages[$prevlang])) {
66
 
67
  $parsedurl['path'] = substr($parsedurl['path'],$secondslashpos);
68
- if ($gluebackhome) $parsedurl['path'] = $home_path.$parsedurl['path'];
69
  }
70
  }
 
71
  if ($remove_host) {
72
  unset ($parsedurl['scheme']);
73
  unset ($parsedurl['host']);
@@ -161,9 +161,9 @@ function rewrite_url_lang_param($url, $lang, $is_edit, $use_params_only=FALSE) {
161
  }
162
 
163
  /**
164
- *
165
- * @param <type> $parsed
166
- * @return <type>
167
  */
168
  function glue_url($parsed) {
169
  if (!is_array($parsed)) {
@@ -200,12 +200,18 @@ function base64_url_decode($input) {
200
  return base64_decode(strtr($input, '-_,', '+/='));
201
  }
202
 
203
- function display_flag ($path, $flag, $language, $css = false, $blank_gif = "") {
 
 
 
 
 
 
 
 
204
  if (!$css) {
205
  return "<img src=\"$path/$flag.png\" title=\"$language\" alt=\"$language\"/>";
206
  } else {
207
- //return "<img size=\"16x11\" title=\"$language\" alt=\"$language\" src=\"$blank_gif\" class=\"trf trf-{$flag}\"/>";
208
- //return "<a href=\"\" title=\"$language\" class=\"trf trf-{$flag}\"/>";
209
  return "<span title=\"$language\" class=\"trf trf-{$flag}\"></span>";
210
  }
211
  }
32
  function cleanup_url($url, $remove_host = false) {
33
  global $languages, $home_url;
34
 
35
+ $parsedurl = @parse_url($url);
36
  //cleanup previous lang & edit parameter from url
37
 
38
  if (isset($parsedurl['query'])) {
65
  if (isset ($languages[$prevlang])) {
66
 
67
  $parsedurl['path'] = substr($parsedurl['path'],$secondslashpos);
 
68
  }
69
  }
70
+ if ($gluebackhome) $parsedurl['path'] = $home_path.$parsedurl['path'];
71
  if ($remove_host) {
72
  unset ($parsedurl['scheme']);
73
  unset ($parsedurl['host']);
161
  }
162
 
163
  /**
164
+ * glue a parse_url array back to a url
165
+ * @param array $parsed url_parse style array
166
+ * @return combined url
167
  */
168
  function glue_url($parsed) {
169
  if (!is_array($parsed)) {
200
  return base64_decode(strtr($input, '-_,', '+/='));
201
  }
202
 
203
+ /**
204
+ * Function to display a flag
205
+ * @param string $path path to flag images
206
+ * @param string $flag the flag (normally iso code)
207
+ * @param string $language the name of the lanaguage
208
+ * @param boolean $css using css code?
209
+ * @return string Html with flag
210
+ */
211
+ function display_flag ($path, $flag, $language, $css = false) {
212
  if (!$css) {
213
  return "<img src=\"$path/$flag.png\" title=\"$language\" alt=\"$language\"/>";
214
  } else {
 
 
215
  return "<span title=\"$language\" class=\"trf trf-{$flag}\"></span>";
216
  }
217
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: oferwald, amirperlman
3
  Donate link: http://transposh.org/
4
  Tags: translation, widget, filter, bilingual, multilingual, transposh, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
5
  Requires at least: 2.7
6
- Tested up to: 2.8.1
7
- Stable tag: 0.2.8
8
 
9
  Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
10
 
@@ -110,6 +110,10 @@ change the .css from transparent background to your page background color. And l
110
  5. Widget style selection
111
 
112
  == Release notes ==
 
 
 
 
113
  * 2009/07/19 - 0.2.8
114
  * Don't touch XML RPC
115
  * Allow usage of CSS sprites when available
3
  Donate link: http://transposh.org/
4
  Tags: translation, widget, filter, bilingual, multilingual, transposh, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
5
  Requires at least: 2.7
6
+ Tested up to: 2.8.2
7
+ Stable tag: 0.2.9
8
 
9
  Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
10
 
110
  5. Widget style selection
111
 
112
  == Release notes ==
113
+ * 2009/07/21 - 0.2.9
114
+ * Supress warning on parse_url (thanks [Mike](http://www.nostate.com/))
115
+ * Fix the urls generated for the widget with subdir blogs (thanks [Peter](http://www.algarve-abc.de/ferienhaus-westalgarve))
116
+ * Fix issue when object->tostring didn't work correctly (thanks [Anthony](http://gratiswork.com))
117
  * 2009/07/19 - 0.2.8
118
  * Don't touch XML RPC
119
  * Allow usage of CSS sprites when available
transposh.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin URI: http://transposh.org/
5
  Description: Translation filter for WordPress, After enabling please set languages at the <a href="options-general.php?page=transposh">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>.
6
  Author: Team Transposh
7
- Version: 0.2.8
8
  Author URI: http://transposh.org/
9
  License: GPL (http://www.gnu.org/licenses/gpl.txt)
10
  */
@@ -256,7 +256,10 @@ function plugin_activate() {
256
  add_filter('rewrite_rules_array', 'update_rewrite_rules');
257
  $wp_rewrite->flush_rules();
258
 
259
-
 
 
 
260
  }
261
 
262
  /*
@@ -348,7 +351,7 @@ function add_transposh_css() {
348
  return;
349
  }
350
  //include the transposh.css
351
- wp_enqueue_style("transposh","$tr_plugin_url/css/transposh.css",array(),'0.2.8');
352
  wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css",array(),'1.0');
353
 
354
  }
@@ -389,7 +392,7 @@ function add_transposh_js() {
389
  // jQuery pushing below might cause issues
390
  //wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2', get_option(ENABLE_FOOTER_SCRIPTS));
391
  wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1',get_option(ENABLE_FOOTER_SCRIPTS));
392
- wp_enqueue_script("transposh","$tr_plugin_url/js/transposh.js?post_url=$post_url{$edit_mode}&lang={$GLOBALS['lang']}&prefix=".SPAN_PREFIX,array("jquery"),'0.2.8',get_option(ENABLE_FOOTER_SCRIPTS));
393
  }
394
  }
395
 
4
  Plugin URI: http://transposh.org/
5
  Description: Translation filter for WordPress, After enabling please set languages at the <a href="options-general.php?page=transposh">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>.
6
  Author: Team Transposh
7
+ Version: 0.2.9
8
  Author URI: http://transposh.org/
9
  License: GPL (http://www.gnu.org/licenses/gpl.txt)
10
  */
256
  add_filter('rewrite_rules_array', 'update_rewrite_rules');
257
  $wp_rewrite->flush_rules();
258
 
259
+
260
+
261
+
262
+ //activate_plugin($plugin);
263
  }
264
 
265
  /*
351
  return;
352
  }
353
  //include the transposh.css
354
+ wp_enqueue_style("transposh","$tr_plugin_url/css/transposh.css",array(),'0.2.9');
355
  wp_enqueue_style("jquery","http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.1/themes/ui-lightness/jquery-ui.css",array(),'1.0');
356
 
357
  }
392
  // jQuery pushing below might cause issues
393
  //wp_enqueue_script("jquery","http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js",array(),'1.3.2', get_option(ENABLE_FOOTER_SCRIPTS));
394
  wp_enqueue_script("google","http://www.google.com/jsapi",array(),'1',get_option(ENABLE_FOOTER_SCRIPTS));
395
+ wp_enqueue_script("transposh","$tr_plugin_url/js/transposh.js?post_url=$post_url{$edit_mode}&lang={$GLOBALS['lang']}&prefix=".SPAN_PREFIX,array("jquery"),'0.2.9',get_option(ENABLE_FOOTER_SCRIPTS));
396
  }
397
  }
398
 
transposh_admin.php CHANGED
@@ -70,7 +70,7 @@ function insert_supported_langs() {
70
  if(!($i % $columns)) echo '<tr'.(!($i/2 % $columns) ? ' class="alternate"':'').'>';
71
  $i++;
72
 
73
- echo "<td>".display_flag("$tr_plugin_url/img/flags/", $flag, $language,get_option(ENABLE_CSS_FLAGS),$GLOBALS['blank_gif'])."&nbsp;$language</td>";
74
  echo '<td align="center"><input type="checkbox" id="' . $code .'_view" name="' .
75
  $code . '_view" onchange="chbx_change(\'' . $code . '\')" ' . is_viewable($code) . '/></td>';
76
  echo '<td class="tr_editable"'.$extrastyle.' align="center"><input type="checkbox" id="' . $code . '_edit" name="' .
@@ -264,7 +264,7 @@ class transposh_plugin {
264
  //constructor of class, PHP4 compatible construction for backward compatibility
265
  function transposh_plugin() {
266
  if (get_option(ENABLE_CSS_FLAGS))
267
- wp_enqueue_style("transposh-flags",plugins_url('', __FILE__)."/css/transposh_flags.css",array(),'0.2.8');
268
  //add filter for WordPress 2.8 changed backend box system !
269
  add_filter('screen_layout_columns', array(&$this, 'on_screen_layout_columns'), 10, 2);
270
  //add some help
70
  if(!($i % $columns)) echo '<tr'.(!($i/2 % $columns) ? ' class="alternate"':'').'>';
71
  $i++;
72
 
73
+ echo "<td>".display_flag("$tr_plugin_url/img/flags/", $flag, $language,get_option(ENABLE_CSS_FLAGS))."&nbsp;$language</td>";
74
  echo '<td align="center"><input type="checkbox" id="' . $code .'_view" name="' .
75
  $code . '_view" onchange="chbx_change(\'' . $code . '\')" ' . is_viewable($code) . '/></td>';
76
  echo '<td class="tr_editable"'.$extrastyle.' align="center"><input type="checkbox" id="' . $code . '_edit" name="' .
264
  //constructor of class, PHP4 compatible construction for backward compatibility
265
  function transposh_plugin() {
266
  if (get_option(ENABLE_CSS_FLAGS))
267
+ wp_enqueue_style("transposh-flags",plugins_url('', __FILE__)."/css/transposh_flags.css",array(),'0.2.9');
268
  //add filter for WordPress 2.8 changed backend box system !
269
  add_filter('screen_layout_columns', array(&$this, 'on_screen_layout_columns'), 10, 2);
270
  //add some help
transposh_db.php CHANGED
@@ -129,7 +129,7 @@ function update_translation() {
129
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
130
 
131
  //add our own custom header - so we will know that we got here
132
- header("Transposh: ver-0.2.8 db_version-". DB_VERSION);
133
 
134
  list($translated_text, $old_source) = fetch_translation($original, $lang);
135
  if ($translated_text) {
@@ -227,7 +227,7 @@ function get_translation_history($token, $lang) {
227
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
228
 
229
  //add our own custom header - so we will know that we got here
230
- header("Transposh: ver-0.2.8 db_version-". DB_VERSION);
231
 
232
  $query = "SELECT translated, translated_by, timestamp, source, user_login ".
233
  "FROM $table_name ".
129
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
130
 
131
  //add our own custom header - so we will know that we got here
132
+ header("Transposh: ver-0.2.9 db_version-". DB_VERSION);
133
 
134
  list($translated_text, $old_source) = fetch_translation($original, $lang);
135
  if ($translated_text) {
227
  $original = $wpdb->escape(html_entity_decode($original, ENT_NOQUOTES, 'UTF-8'));
228
 
229
  //add our own custom header - so we will know that we got here
230
+ header("Transposh: ver-0.2.9 db_version-". DB_VERSION);
231
 
232
  $query = "SELECT translated, translated_by, timestamp, source, user_login ".
233
  "FROM $table_name ".
transposh_widget.php CHANGED
@@ -85,11 +85,11 @@ function add_transposh_widget_css() {
85
  // TODO: user generated version
86
  $options = get_option(WIDGET_TRANSPOSH);
87
  if ($options['style'] == 1 || $options['style'] == 2) {
88
- wp_enqueue_style("transposh_widget","{$GLOBALS['tr_plugin_url']}/css/transposh_widget.css",array(),'0.2.8');
89
  if (get_option(ENABLE_CSS_FLAGS)) {
90
- wp_enqueue_style("transposh_flags", "{$GLOBALS['tr_plugin_url']}/css/transposh_flags.css",array(),'0.2.8');
91
  if (file_exists("{$GLOBALS['tr_plugin_url']}/css/transposh_flags_u.css"))
92
- wp_enqueue_style("transposh_flags", "{$GLOBALS['tr_plugin_url']}/css/transposh_flags_u.css",array(),'0.2.8');
93
  }
94
  }
95
 
@@ -140,7 +140,7 @@ function transposh_widget($args) {
140
 
141
 
142
  echo "<a href=\"" . $page_url . "\">".
143
- display_flag("$plugpath/img/flags/", $flag, $language,get_option(ENABLE_CSS_FLAGS),$GLOBALS['blank_gif']).
144
  "</a>";
145
  if ($options['style'] != 1) {
146
  echo "$language<br/>";
85
  // TODO: user generated version
86
  $options = get_option(WIDGET_TRANSPOSH);
87
  if ($options['style'] == 1 || $options['style'] == 2) {
88
+ wp_enqueue_style("transposh_widget","{$GLOBALS['tr_plugin_url']}/css/transposh_widget.css",array(),'0.2.9');
89
  if (get_option(ENABLE_CSS_FLAGS)) {
90
+ wp_enqueue_style("transposh_flags", "{$GLOBALS['tr_plugin_url']}/css/transposh_flags.css",array(),'0.2.9');
91
  if (file_exists("{$GLOBALS['tr_plugin_url']}/css/transposh_flags_u.css"))
92
+ wp_enqueue_style("transposh_flags", "{$GLOBALS['tr_plugin_url']}/css/transposh_flags_u.css",array(),'0.2.9');
93
  }
94
  }
95
 
140
 
141
 
142
  echo "<a href=\"" . $page_url . "\">".
143
+ display_flag("$plugpath/img/flags/", $flag, $language,get_option(ENABLE_CSS_FLAGS)).
144
  "</a>";
145
  if ($options['style'] != 1) {
146
  echo "$language<br/>";