Version Description
This version provides integration with google-sitemaps-xml and wp-super-cache
Download this release
Release Info
Developer | oferwald |
Plugin | Transposh WordPress Translation |
Version | 0.4.0 |
Comparing to | |
See all releases |
Code changes from version 0.3.9 to 0.4.0
- core/constants.php +2 -2
- core/globals.php +1 -1
- core/parser.php +95 -3
- core/utils.php +1 -1
- readme.txt +21 -2
- transposh.php +28 -3
- wp/transposh_admin.php +1 -1
- wp/transposh_ajax.php +26 -3
- wp/transposh_db.php +1 -1
- wp/transposh_options.php +1 -1
- wp/transposh_postpublish.php +1 -1
- wp/transposh_widget.php +1 -1
core/constants.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
@@ -96,7 +96,7 @@ $bing_languages = array("en", "ar", "bg", "zh", "zh-tw", "cs", "da", "nl", "fi",
|
|
96 |
//Define the new capability that will be assigned to roles - translator
|
97 |
define("TRANSLATOR", 'translator');
|
98 |
|
99 |
-
define("TRANSPOSH_PLUGIN_VER",'0.
|
100 |
|
101 |
//Define segment id prefix, will be included in span tag. also used as class identifier
|
102 |
define("SPAN_PREFIX", "tr_");
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
96 |
//Define the new capability that will be assigned to roles - translator
|
97 |
define("TRANSLATOR", 'translator');
|
98 |
|
99 |
+
define("TRANSPOSH_PLUGIN_VER",'0.4.0');
|
100 |
|
101 |
//Define segment id prefix, will be included in span tag. also used as class identifier
|
102 |
define("SPAN_PREFIX", "tr_");
|
core/globals.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
core/parser.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
@@ -19,6 +19,67 @@
|
|
19 |
require_once("shd/simple_html_dom.php");
|
20 |
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
/**
|
23 |
* Parser class - allows phrase marking and translation with callback functions
|
24 |
*/
|
@@ -26,9 +87,9 @@ class parser {
|
|
26 |
public $url_rewrite_func = null;
|
27 |
public $fetch_translate_func = null;
|
28 |
private $segment_id = 0;
|
29 |
-
/** @var simple_html_dom_node
|
30 |
private $currentnode;
|
31 |
-
/** @var simple_html_dom
|
32 |
private $html; // the document
|
33 |
public $dir_rtl;
|
34 |
public $lang;
|
@@ -39,6 +100,9 @@ class parser {
|
|
39 |
public $feed_fix;
|
40 |
//first three are html, later 3 come from feeds xml (link is problematic...)
|
41 |
protected $ignore_tags = array('script'=>1, 'style'=>1, 'code'=>1,'wfw:commentrss'=>1,'comments'=>1,'guid'=>1);
|
|
|
|
|
|
|
42 |
/**
|
43 |
* Determine if the current position in buffer is a white space.
|
44 |
* @param char $char
|
@@ -375,6 +439,8 @@ class parser {
|
|
375 |
* @return string Translated content is here
|
376 |
*/
|
377 |
function fix_html($string) {
|
|
|
|
|
378 |
// create our dom
|
379 |
$this->html = str_get_html($string);
|
380 |
// mark translateable elements
|
@@ -429,6 +495,12 @@ class parser {
|
|
429 |
$newtext = '';
|
430 |
foreach ($e->nodes as $ep) {
|
431 |
list ($translated_text, $source) = call_user_func_array($this->fetch_translate_func,array($ep->phrase, $this->lang));
|
|
|
|
|
|
|
|
|
|
|
|
|
432 |
if (($this->is_edit_mode || ($this->is_auto_translate && $translated_text == null))/* && $ep->inbody*/) {
|
433 |
$span = $this->create_edit_span($ep->phrase, $translated_text, $source);
|
434 |
$spanend = "</span>";
|
@@ -478,6 +550,14 @@ class parser {
|
|
478 |
foreach ($e->nodes as $ep) {
|
479 |
if ($ep->tag == 'phrase') {
|
480 |
list ($translated_text, $source) = call_user_func_array($this->fetch_translate_func,array($ep->phrase, $this->lang));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
481 |
if (($this->is_edit_mode || ($this->is_auto_translate && $translated_text == null)) && $ep->inbody) {
|
482 |
// prevent duplicate translation (title = text)
|
483 |
if (strpos($e->innertext,base64_url_encode($ep->phrase)) === false) {
|
@@ -517,8 +597,14 @@ class parser {
|
|
517 |
|
518 |
foreach ($e->nodes as $ep) {
|
519 |
if ($ep->tag == 'phrase') {
|
|
|
|
|
|
|
520 |
list ($translated_text, $source) = call_user_func_array($this->fetch_translate_func,array($ep->phrase, $this->lang));
|
521 |
if ($translated_text) {
|
|
|
|
|
|
|
522 |
list ($left, $right) = explode($ep->phrase, $e->content, 2);
|
523 |
$newtext .= $left.$translated_text;
|
524 |
$e->content = $right;
|
@@ -532,6 +618,12 @@ class parser {
|
|
532 |
|
533 |
}
|
534 |
|
|
|
|
|
|
|
|
|
|
|
|
|
535 |
// Changed because of places where tostring failed
|
536 |
//return $this->html;
|
537 |
return $this->html->outertext;
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
19 |
require_once("shd/simple_html_dom.php");
|
20 |
|
21 |
|
22 |
+
/**
|
23 |
+
* parserstats class - holds parser statistics
|
24 |
+
*/
|
25 |
+
class parserstats {
|
26 |
+
/** @var int Holds the total phrases the parser encountered */
|
27 |
+
public $total_phrases;
|
28 |
+
/** @var int Holds the number of phrases that had translation */
|
29 |
+
public $translated_phrases;
|
30 |
+
/** @var int Holds the number of phrases that had human translation */
|
31 |
+
public $human_translated_phrases;
|
32 |
+
|
33 |
+
/** @var int Holds the number of phrases that are hidden - yet still somewhat viewable (such as the title attribure) */
|
34 |
+
public $hidden_phrases;
|
35 |
+
/** @var int Holds the number of phrases that are hidden and translated */
|
36 |
+
public $hidden_translated_phrases;
|
37 |
+
|
38 |
+
/** @var int Holds the number of phrases that are hidden and probably won't be viewed - such as meta keys */
|
39 |
+
public $meta_phrases;
|
40 |
+
/** @var int Holds the number of translated phrases that are hidden and probably won't be viewed - such as meta keys */
|
41 |
+
public $meta_translated_phrases;
|
42 |
+
/** @var float Holds the time translation took */
|
43 |
+
public $time;
|
44 |
+
|
45 |
+
/** @var int Holds the time translation started */
|
46 |
+
private $start_time;
|
47 |
+
|
48 |
+
/**
|
49 |
+
* This function is when the object is initialized, which is a good time to start ticking.
|
50 |
+
*/
|
51 |
+
function parserstats() {
|
52 |
+
$this->start_time = microtime(true);
|
53 |
+
}
|
54 |
+
|
55 |
+
/**
|
56 |
+
* Calculated values - computer translated phrases
|
57 |
+
* @return int How many phrases were auto-translated
|
58 |
+
*/
|
59 |
+
function get_computer_translated_phrases() {
|
60 |
+
return $this->translated_phrases - $this->human_translated_phrases;
|
61 |
+
}
|
62 |
+
/**
|
63 |
+
* Calculated values - missing phrases
|
64 |
+
* @return int How many phrases are missing
|
65 |
+
*/
|
66 |
+
function get_missing_phrases() {
|
67 |
+
return $this->total_phrases - $this->translated_phrases;
|
68 |
+
}
|
69 |
+
/**
|
70 |
+
* Start the timer
|
71 |
+
*/
|
72 |
+
function start_timing() {
|
73 |
+
$this->start_time = microtime(true);
|
74 |
+
}
|
75 |
+
/**
|
76 |
+
* Stop timing, store time for reference
|
77 |
+
*/
|
78 |
+
function stop_timing() {
|
79 |
+
$this->time = number_format(microtime(true) - $this->start_time,3);
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
/**
|
84 |
* Parser class - allows phrase marking and translation with callback functions
|
85 |
*/
|
87 |
public $url_rewrite_func = null;
|
88 |
public $fetch_translate_func = null;
|
89 |
private $segment_id = 0;
|
90 |
+
/** @var simple_html_dom_node Contains the current node */
|
91 |
private $currentnode;
|
92 |
+
/** @var simple_html_dom Contains the document dom model */
|
93 |
private $html; // the document
|
94 |
public $dir_rtl;
|
95 |
public $lang;
|
100 |
public $feed_fix;
|
101 |
//first three are html, later 3 come from feeds xml (link is problematic...)
|
102 |
protected $ignore_tags = array('script'=>1, 'style'=>1, 'code'=>1,'wfw:commentrss'=>1,'comments'=>1,'guid'=>1);
|
103 |
+
/** @var parserstats Contains parsing statistics */
|
104 |
+
private $stats;
|
105 |
+
|
106 |
/**
|
107 |
* Determine if the current position in buffer is a white space.
|
108 |
* @param char $char
|
439 |
* @return string Translated content is here
|
440 |
*/
|
441 |
function fix_html($string) {
|
442 |
+
// ready our stats
|
443 |
+
$this->stats = new parserstats();
|
444 |
// create our dom
|
445 |
$this->html = str_get_html($string);
|
446 |
// mark translateable elements
|
495 |
$newtext = '';
|
496 |
foreach ($e->nodes as $ep) {
|
497 |
list ($translated_text, $source) = call_user_func_array($this->fetch_translate_func,array($ep->phrase, $this->lang));
|
498 |
+
//stats
|
499 |
+
$this->stats->total_phrases++;
|
500 |
+
if ($translated_text) {
|
501 |
+
$this->stats->translated_phrases++;
|
502 |
+
if ($source == 0) $this->stats->human_translated_phrases++;
|
503 |
+
}
|
504 |
if (($this->is_edit_mode || ($this->is_auto_translate && $translated_text == null))/* && $ep->inbody*/) {
|
505 |
$span = $this->create_edit_span($ep->phrase, $translated_text, $source);
|
506 |
$spanend = "</span>";
|
550 |
foreach ($e->nodes as $ep) {
|
551 |
if ($ep->tag == 'phrase') {
|
552 |
list ($translated_text, $source) = call_user_func_array($this->fetch_translate_func,array($ep->phrase, $this->lang));
|
553 |
+
// more stats
|
554 |
+
$this->stats->total_phrases++;
|
555 |
+
if ($ep->inbody) $this->stats->hidden_phrases++; else $this->stats->meta_phrases++;
|
556 |
+
if ($translated_text) {
|
557 |
+
$this->stats->translated_phrases++;
|
558 |
+
if ($ep->inbody) $this->stats->hidden_translated_phrases++; else $this->stats->meta_translated_phrases++;
|
559 |
+
if ($source == 0) $this->stats->human_translated_phrases++;
|
560 |
+
}
|
561 |
if (($this->is_edit_mode || ($this->is_auto_translate && $translated_text == null)) && $ep->inbody) {
|
562 |
// prevent duplicate translation (title = text)
|
563 |
if (strpos($e->innertext,base64_url_encode($ep->phrase)) === false) {
|
597 |
|
598 |
foreach ($e->nodes as $ep) {
|
599 |
if ($ep->tag == 'phrase') {
|
600 |
+
// even more stats
|
601 |
+
$this->stats->total_phrases++;
|
602 |
+
$this->stats->meta_phrases++;
|
603 |
list ($translated_text, $source) = call_user_func_array($this->fetch_translate_func,array($ep->phrase, $this->lang));
|
604 |
if ($translated_text) {
|
605 |
+
$this->stats->translated_phrases++;
|
606 |
+
$this->stats->meta_translated_phrases++;
|
607 |
+
if ($source == 0) $this->stats->human_translated_phrases++;
|
608 |
list ($left, $right) = explode($ep->phrase, $e->content, 2);
|
609 |
$newtext .= $left.$translated_text;
|
610 |
$e->content = $right;
|
618 |
|
619 |
}
|
620 |
|
621 |
+
// This adds a meta tag with our statistics json-encoded inside...
|
622 |
+
$this->stats->stop_timing();
|
623 |
+
$head = $this->html->find('head',0);
|
624 |
+
if ($head != null)
|
625 |
+
$head->lastChild()->outertext .= "\n<meta name=\"translation-stats\" content='".json_encode($this->stats)."'/>";
|
626 |
+
|
627 |
// Changed because of places where tostring failed
|
628 |
//return $this->html;
|
629 |
return $this->html->outertext;
|
core/utils.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://transposh.org/donate/
|
|
4 |
Tags: translation, widget, filter, bilingual, multilingual, transposh, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
|
5 |
Requires at least: 2.7
|
6 |
Tested up to: 2.9.0
|
7 |
-
Stable tag: 0.
|
8 |
|
9 |
Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
|
10 |
|
@@ -110,10 +110,22 @@ Just add the following line to your template:
|
|
110 |
|
111 |
`<?php if(function_exists("transposh_widget")) { transposh_widget(); }?>`
|
112 |
|
113 |
-
=
|
114 |
|
115 |
Users of php speedy will have to deactivate it, add “transposh.js” in the ignore list, click on “Test configuration” then reactivate it.
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
= I am getting weird errors =
|
118 |
|
119 |
Please make sure you are using PHP5 and up, PHP4 is not supported
|
@@ -140,10 +152,17 @@ You can wrap the element with the "no_translate" class, or add a span similar to
|
|
140 |
5. Widget style selection box, with three basic appearances, flags below (in Hebrew), language selection on the top right and language list on the bottom right.
|
141 |
|
142 |
== Upgrade Notice ==
|
|
|
|
|
143 |
= 0.3.9 =
|
144 |
This version allows sorting of languages within the widget
|
145 |
|
146 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
147 |
= 2009/12/26 - 0.3.9 =
|
148 |
* New languages interface, users can now sort languages on their widget
|
149 |
* anonymous translation is now on by default (for new installations)
|
4 |
Tags: translation, widget, filter, bilingual, multilingual, transposh, language, crowdsourcing, context, wiki, RTL, Hebrew, Spanish, French, Russian, English, Arabic, Portuguese
|
5 |
Requires at least: 2.7
|
6 |
Tested up to: 2.9.0
|
7 |
+
Stable tag: 0.4.0
|
8 |
|
9 |
Transposh filter allows in context quick translation of websites, it allows you to crowd-source the translation to your users
|
10 |
|
110 |
|
111 |
`<?php if(function_exists("transposh_widget")) { transposh_widget(); }?>`
|
112 |
|
113 |
+
= Plugin support: php speedy (http://aciddrop.com/php-speedy/) =
|
114 |
|
115 |
Users of php speedy will have to deactivate it, add “transposh.js” in the ignore list, click on “Test configuration” then reactivate it.
|
116 |
|
117 |
+
= Plugin support: Google-Sitemaps-XML =
|
118 |
+
|
119 |
+
Currently the plugin is able to add the multilingual urls to the sitemap, and you need to add the following line at the sitemap-core.php, add-url function (line 1509 at version 3.2.2)
|
120 |
+
`do_action('sm_addurl',$loc, &$page);`
|
121 |
+
We hope that future versions will include this by default, and for now you can get the patched file from our site.
|
122 |
+
After a change of languages used, you are welcomed to trigger a new sitemap buildup.
|
123 |
+
|
124 |
+
= Plugin support: WP-Super-Cache =
|
125 |
+
|
126 |
+
The support for wp-super-cache includes the invalidation of cached pages after a translation is made, which should reduce the issue with incorrect pages being displayed and
|
127 |
+
redundant calls to the machine translation agent. After a change in the widget layout or the language list you are still expected to invalidate your cache.
|
128 |
+
|
129 |
= I am getting weird errors =
|
130 |
|
131 |
Please make sure you are using PHP5 and up, PHP4 is not supported
|
152 |
5. Widget style selection box, with three basic appearances, flags below (in Hebrew), language selection on the top right and language list on the bottom right.
|
153 |
|
154 |
== Upgrade Notice ==
|
155 |
+
= 0.4.0 =
|
156 |
+
This version provides integration with google-sitemaps-xml and wp-super-cache
|
157 |
= 0.3.9 =
|
158 |
This version allows sorting of languages within the widget
|
159 |
|
160 |
== Changelog ==
|
161 |
+
= 2010/01/01 - 0.4.0 =
|
162 |
+
* Solve activation/deactivation bug
|
163 |
+
* Parser provides statistics in meta tag
|
164 |
+
* Integration with google-sitemaps-xml plugin (3.2.2)
|
165 |
+
* Integration with wp-super-cache (0.9.8)
|
166 |
= 2009/12/26 - 0.3.9 =
|
167 |
* New languages interface, users can now sort languages on their widget
|
168 |
* anonymous translation is now on by default (for new installations)
|
transposh.php
CHANGED
@@ -4,12 +4,12 @@
|
|
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.
|
8 |
Author URI: http://transposh.org/
|
9 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
10 |
*/
|
11 |
|
12 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
13 |
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License as published by
|
@@ -117,6 +117,7 @@ class transposh_plugin {
|
|
117 |
add_action('shutdown', array(&$this,'on_shutdown'));
|
118 |
add_action('wp_print_styles', array(&$this,'add_transposh_css'));
|
119 |
add_action('wp_print_scripts', array(&$this,'add_transposh_js'));
|
|
|
120 |
register_activation_hook(__FILE__, array(&$this,'plugin_activate'));
|
121 |
register_deactivation_hook(__FILE__,array(&$this,'plugin_deactivate'));
|
122 |
}
|
@@ -388,7 +389,7 @@ class transposh_plugin {
|
|
388 |
|
389 |
if (function_exists('deactivate_plugins') ) {
|
390 |
// FIXME :wtf?
|
391 |
-
deactivate_plugins(get_plugin_name
|
392 |
echo '<br> This plugin has been automatically deactivated.';
|
393 |
}
|
394 |
|
@@ -635,6 +636,30 @@ class transposh_plugin {
|
|
635 |
|
636 |
return $search.$where;
|
637 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
638 |
}
|
639 |
$my_transposh_plugin = new transposh_plugin();
|
640 |
|
4 |
Plugin URI: http://transposh.org/
|
5 |
Description: Translation filter for WordPress, After enabling please set languages at the <a href="options-general.php?page=transposh">the options page</a> Want to help? visit our development site at <a href="http://trac.transposh.org/">trac.transposh.org</a>.
|
6 |
Author: Team Transposh
|
7 |
+
Version: 0.4.0
|
8 |
Author URI: http://transposh.org/
|
9 |
License: GPL (http://www.gnu.org/licenses/gpl.txt)
|
10 |
*/
|
11 |
|
12 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
13 |
*
|
14 |
* This program is free software; you can redistribute it and/or modify
|
15 |
* it under the terms of the GNU General Public License as published by
|
117 |
add_action('shutdown', array(&$this,'on_shutdown'));
|
118 |
add_action('wp_print_styles', array(&$this,'add_transposh_css'));
|
119 |
add_action('wp_print_scripts', array(&$this,'add_transposh_js'));
|
120 |
+
add_action("sm_addurl",array(&$this,'add_sm_transposh_urls'));
|
121 |
register_activation_hook(__FILE__, array(&$this,'plugin_activate'));
|
122 |
register_deactivation_hook(__FILE__,array(&$this,'plugin_deactivate'));
|
123 |
}
|
389 |
|
390 |
if (function_exists('deactivate_plugins') ) {
|
391 |
// FIXME :wtf?
|
392 |
+
deactivate_plugins(array(&$this,'get_plugin_name'), "translate.php");
|
393 |
echo '<br> This plugin has been automatically deactivated.';
|
394 |
}
|
395 |
|
636 |
|
637 |
return $search.$where;
|
638 |
}
|
639 |
+
|
640 |
+
/**
|
641 |
+
* This function integrates with google sitemap generator, and adds for each viewable language, the rest of the languages url
|
642 |
+
* Also - priority is reduced by 0.2
|
643 |
+
* And this requires the following line at the sitemap-core.php, add-url function (line 1509 at version 3.2.2)
|
644 |
+
* do_action('sm_addurl',$loc, &$page);
|
645 |
+
* @param GoogleSitemapGeneratorPage $sm_page Object containing the page information
|
646 |
+
*/
|
647 |
+
function add_sm_transposh_urls(&$sm_page) {
|
648 |
+
|
649 |
+
// we need the generator object (we know it must exist...)
|
650 |
+
$generatorObject = &GoogleSitemapGenerator::GetInstance();
|
651 |
+
// we reduce the priorty by 0.2, but not below zero
|
652 |
+
$sm_page->SetProprity(max($sm_page->GetPriority() - 0.2, 0));
|
653 |
+
|
654 |
+
$viewable_langs = explode(",",$this->options->get_viewable_langs());
|
655 |
+
foreach ($viewable_langs as $lang) {
|
656 |
+
if (!$this->options->is_default_language($lang)) {
|
657 |
+
$newloc = rewrite_url_lang_param($sm_page->GetUrl(), $this->home_url, $this->enable_permalinks_rewrite, $lang, false);
|
658 |
+
$sm_page->SetUrl($newloc);
|
659 |
+
$generatorObject->AddElement($sm_page);
|
660 |
+
}
|
661 |
+
}
|
662 |
+
}
|
663 |
}
|
664 |
$my_transposh_plugin = new transposh_plugin();
|
665 |
|
wp/transposh_admin.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
wp/transposh_ajax.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
@@ -18,12 +18,31 @@
|
|
18 |
|
19 |
/*
|
20 |
* This file handles various AJAX needs of our plugin
|
21 |
-
|
22 |
// we need wordpress and us...
|
23 |
require_once('../../../../wp-load.php');
|
24 |
|
25 |
// the case of posted translation
|
26 |
if (isset($_POST['translation_posted'])) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
if ($_POST['translation_posted'] == 2) {
|
28 |
$my_transposh_plugin->database->update_translation_new();
|
29 |
}
|
@@ -47,6 +66,10 @@ elseif (isset($_GET['tr_cookie'])) {
|
|
47 |
// Set our cookie and return (if no js works - or we are in the default language)
|
48 |
elseif (isset($_GET['tr_cookie_bck'])) {
|
49 |
setcookie('TR_LNG',get_language_from_url($_SERVER['HTTP_REFERER'], $my_transposh_plugin->home_url),time()+90*24*60*60,COOKIEPATH,COOKIE_DOMAIN);
|
50 |
-
|
|
|
|
|
|
|
|
|
51 |
}
|
52 |
?>
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
18 |
|
19 |
/*
|
20 |
* This file handles various AJAX needs of our plugin
|
21 |
+
*/
|
22 |
// we need wordpress and us...
|
23 |
require_once('../../../../wp-load.php');
|
24 |
|
25 |
// the case of posted translation
|
26 |
if (isset($_POST['translation_posted'])) {
|
27 |
+
// supercache invalidation of pages - first lets find if supercache is here
|
28 |
+
if (function_exists('wp_super_cache_init')) {
|
29 |
+
//Now, we are actually using the referrer and not the request, with some precautions
|
30 |
+
$GLOBALS['wp_cache_request_uri'] = substr($_SERVER['HTTP_REFERER'],stripos($_SERVER['HTTP_REFERER'],$_SERVER['HTTP_HOST'])+strlen($_SERVER[''].$_SERVER['HTTP_HOST']));
|
31 |
+
$GLOBALS['wp_cache_request_uri'] = preg_replace('/[ <>\'\"\r\n\t\(\)]/', '', str_replace( '/index.php', '/', str_replace( '..', '', preg_replace("/(\?.*)?$/", '', $GLOBALS['wp_cache_request_uri'] ) ) ) );
|
32 |
+
// get some supercache variables
|
33 |
+
extract(wp_super_cache_init());
|
34 |
+
$dir = get_current_url_supercache_dir();
|
35 |
+
// delete possible files that we can figure out, not deleting files for other cookies for example, but will do the trick in most cases
|
36 |
+
$cache_fname = "{$dir}index.html";
|
37 |
+
|
38 |
+
@unlink( $cache_fname);
|
39 |
+
$cache_fname = "{$dir}index.html.gz";
|
40 |
+
|
41 |
+
@unlink( $cache_fname);
|
42 |
+
|
43 |
+
@unlink($cache_file);
|
44 |
+
}
|
45 |
+
|
46 |
if ($_POST['translation_posted'] == 2) {
|
47 |
$my_transposh_plugin->database->update_translation_new();
|
48 |
}
|
66 |
// Set our cookie and return (if no js works - or we are in the default language)
|
67 |
elseif (isset($_GET['tr_cookie_bck'])) {
|
68 |
setcookie('TR_LNG',get_language_from_url($_SERVER['HTTP_REFERER'], $my_transposh_plugin->home_url),time()+90*24*60*60,COOKIEPATH,COOKIE_DOMAIN);
|
69 |
+
if ($_SERVER['HTTP_REFERER']) {
|
70 |
+
wp_redirect($_SERVER['HTTP_REFERER']);
|
71 |
+
} else {
|
72 |
+
wp_redirect($my_transposh_plugin->home_url);
|
73 |
+
}
|
74 |
}
|
75 |
?>
|
wp/transposh_db.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
wp/transposh_options.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
wp/transposh_postpublish.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
wp/transposh_widget.php
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
<?php
|
2 |
-
/* Copyright © 2009 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|
1 |
<?php
|
2 |
+
/* Copyright © 2009-2010 Transposh Team (website : http://transposh.org)
|
3 |
*
|
4 |
* This program is free software; you can redistribute it and/or modify
|
5 |
* it under the terms of the GNU General Public License as published by
|