English version just for user loged view
New plug in :
- xili-language
- xili-dictionary
- xili-tidy-tags
And theme modification
And widget modification
Binary file sql/iri_wp_dump_16_03_2010.bckp.bz2 has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/network-publisher/JSON.php Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,806 @@
+<?php
+/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
+
+/**
+ * Converts to and from JSON format.
+ *
+ * JSON (JavaScript Object Notation) is a lightweight data-interchange
+ * format. It is easy for humans to read and write. It is easy for machines
+ * to parse and generate. It is based on a subset of the JavaScript
+ * Programming Language, Standard ECMA-262 3rd Edition - December 1999.
+ * This feature can also be found in Python. JSON is a text format that is
+ * completely language independent but uses conventions that are familiar
+ * to programmers of the C-family of languages, including C, C++, C#, Java,
+ * JavaScript, Perl, TCL, and many others. These properties make JSON an
+ * ideal data-interchange language.
+ *
+ * This package provides a simple encoder and decoder for JSON notation. It
+ * is intended for use with client-side Javascript applications that make
+ * use of HTTPRequest to perform server communication functions - data can
+ * be encoded into JSON notation for use in a client-side javascript, or
+ * decoded from incoming Javascript requests. JSON format is native to
+ * Javascript, and can be directly eval()'ed with no further parsing
+ * overhead
+ *
+ * All strings should be in ASCII or UTF-8 format!
+ *
+ * LICENSE: Redistribution and use in source and binary forms, with or
+ * without modification, are permitted provided that the following
+ * conditions are met: Redistributions of source code must retain the
+ * above copyright notice, this list of conditions and the following
+ * disclaimer. Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
+ * NO EVENT SHALL CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+ * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
+ * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
+ * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
+ * USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * @category
+ * @package Services_JSON
+ * @author Michal Migurski <mike-json@teczno.com>
+ * @author Matt Knapp <mdknapp[at]gmail[dot]com>
+ * @author Brett Stimmerman <brettstimmerman[at]gmail[dot]com>
+ * @copyright 2005 Michal Migurski
+ * @version CVS: $Id: JSON.php,v 1.31 2006/06/28 05:54:17 migurski Exp $
+ * @license http://www.opensource.org/licenses/bsd-license.php
+ * @link http://pear.php.net/pepr/pepr-proposal-show.php?id=198
+ */
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_SLICE', 1);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_STR', 2);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_ARR', 3);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_OBJ', 4);
+
+/**
+ * Marker constant for Services_JSON::decode(), used to flag stack state
+ */
+define('SERVICES_JSON_IN_CMT', 5);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_LOOSE_TYPE', 16);
+
+/**
+ * Behavior switch for Services_JSON::decode()
+ */
+define('SERVICES_JSON_SUPPRESS_ERRORS', 32);
+
+/**
+ * Converts to and from JSON format.
+ *
+ * Brief example of use:
+ *
+ * <code>
+ * // create a new instance of Services_JSON
+ * $json = new Services_JSON();
+ *
+ * // convert a complexe value to JSON notation, and send it to the browser
+ * $value = array('foo', 'bar', array(1, 2, 'baz'), array(3, array(4)));
+ * $output = $json->encode($value);
+ *
+ * print($output);
+ * // prints: ["foo","bar",[1,2,"baz"],[3,[4]]]
+ *
+ * // accept incoming POST data, assumed to be in JSON notation
+ * $input = file_get_contents('php://input', 1000000);
+ * $value = $json->decode($input);
+ * </code>
+ */
+class Services_JSON
+{
+ /**
+ * constructs a new JSON instance
+ *
+ * @param int $use object behavior flags; combine with boolean-OR
+ *
+ * possible values:
+ * - SERVICES_JSON_LOOSE_TYPE: loose typing.
+ * "{...}" syntax creates associative arrays
+ * instead of objects in decode().
+ * - SERVICES_JSON_SUPPRESS_ERRORS: error suppression.
+ * Values which can't be encoded (e.g. resources)
+ * appear as NULL instead of throwing errors.
+ * By default, a deeply-nested resource will
+ * bubble up with an error, so all return values
+ * from encode() should be checked with isError()
+ */
+ function Services_JSON($use = 0)
+ {
+ $this->use = $use;
+ }
+
+ /**
+ * convert a string from one UTF-16 char to one UTF-8 char
+ *
+ * Normally should be handled by mb_convert_encoding, but
+ * provides a slower PHP-only method for installations
+ * that lack the multibye string extension.
+ *
+ * @param string $utf16 UTF-16 character
+ * @return string UTF-8 character
+ * @access private
+ */
+ function utf162utf8($utf16)
+ {
+ // oh please oh please oh please oh please oh please
+ if(function_exists('mb_convert_encoding')) {
+ return mb_convert_encoding($utf16, 'UTF-8', 'UTF-16');
+ }
+
+ $bytes = (ord($utf16{0}) << 8) | ord($utf16{1});
+
+ switch(true) {
+ case ((0x7F & $bytes) == $bytes):
+ // this case should never be reached, because we are in ASCII range
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0x7F & $bytes);
+
+ case (0x07FF & $bytes) == $bytes:
+ // return a 2-byte UTF-8 character
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0xC0 | (($bytes >> 6) & 0x1F))
+ . chr(0x80 | ($bytes & 0x3F));
+
+ case (0xFFFF & $bytes) == $bytes:
+ // return a 3-byte UTF-8 character
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0xE0 | (($bytes >> 12) & 0x0F))
+ . chr(0x80 | (($bytes >> 6) & 0x3F))
+ . chr(0x80 | ($bytes & 0x3F));
+ }
+
+ // ignoring UTF-32 for now, sorry
+ return '';
+ }
+
+ /**
+ * convert a string from one UTF-8 char to one UTF-16 char
+ *
+ * Normally should be handled by mb_convert_encoding, but
+ * provides a slower PHP-only method for installations
+ * that lack the multibye string extension.
+ *
+ * @param string $utf8 UTF-8 character
+ * @return string UTF-16 character
+ * @access private
+ */
+ function utf82utf16($utf8)
+ {
+ // oh please oh please oh please oh please oh please
+ if(function_exists('mb_convert_encoding')) {
+ return mb_convert_encoding($utf8, 'UTF-16', 'UTF-8');
+ }
+
+ switch(strlen($utf8)) {
+ case 1:
+ // this case should never be reached, because we are in ASCII range
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return $utf8;
+
+ case 2:
+ // return a UTF-16 character from a 2-byte UTF-8 char
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr(0x07 & (ord($utf8{0}) >> 2))
+ . chr((0xC0 & (ord($utf8{0}) << 6))
+ | (0x3F & ord($utf8{1})));
+
+ case 3:
+ // return a UTF-16 character from a 3-byte UTF-8 char
+ // see: http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ return chr((0xF0 & (ord($utf8{0}) << 4))
+ | (0x0F & (ord($utf8{1}) >> 2)))
+ . chr((0xC0 & (ord($utf8{1}) << 6))
+ | (0x7F & ord($utf8{2})));
+ }
+
+ // ignoring UTF-32 for now, sorry
+ return '';
+ }
+
+ /**
+ * encodes an arbitrary variable into JSON format
+ *
+ * @param mixed $var any number, boolean, string, array, or object to be encoded.
+ * see argument 1 to Services_JSON() above for array-parsing behavior.
+ * if var is a strng, note that encode() always expects it
+ * to be in ASCII or UTF-8 format!
+ *
+ * @return mixed JSON string representation of input var or an error if a problem occurs
+ * @access public
+ */
+ function encode($var)
+ {
+ switch (gettype($var)) {
+ case 'boolean':
+ return $var ? 'true' : 'false';
+
+ case 'NULL':
+ return 'null';
+
+ case 'integer':
+ return (int) $var;
+
+ case 'double':
+ case 'float':
+ return (float) $var;
+
+ case 'string':
+ // STRINGS ARE EXPECTED TO BE IN ASCII OR UTF-8 FORMAT
+ $ascii = '';
+ $strlen_var = strlen($var);
+
+ /*
+ * Iterate over every character in the string,
+ * escaping with a slash or encoding to UTF-8 where necessary
+ */
+ for ($c = 0; $c < $strlen_var; ++$c) {
+
+ $ord_var_c = ord($var{$c});
+
+ switch (true) {
+ case $ord_var_c == 0x08:
+ $ascii .= '\b';
+ break;
+ case $ord_var_c == 0x09:
+ $ascii .= '\t';
+ break;
+ case $ord_var_c == 0x0A:
+ $ascii .= '\n';
+ break;
+ case $ord_var_c == 0x0C:
+ $ascii .= '\f';
+ break;
+ case $ord_var_c == 0x0D:
+ $ascii .= '\r';
+ break;
+
+ case $ord_var_c == 0x22:
+ case $ord_var_c == 0x2F:
+ case $ord_var_c == 0x5C:
+ // double quote, slash, slosh
+ $ascii .= '\\'.$var{$c};
+ break;
+
+ case (($ord_var_c >= 0x20) && ($ord_var_c <= 0x7F)):
+ // characters U-00000000 - U-0000007F (same as ASCII)
+ $ascii .= $var{$c};
+ break;
+
+ case (($ord_var_c & 0xE0) == 0xC0):
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c, ord($var{$c + 1}));
+ $c += 1;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xF0) == 0xE0):
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}));
+ $c += 2;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xF8) == 0xF0):
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}));
+ $c += 3;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xFC) == 0xF8):
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}),
+ ord($var{$c + 4}));
+ $c += 4;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+
+ case (($ord_var_c & 0xFE) == 0xFC):
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $char = pack('C*', $ord_var_c,
+ ord($var{$c + 1}),
+ ord($var{$c + 2}),
+ ord($var{$c + 3}),
+ ord($var{$c + 4}),
+ ord($var{$c + 5}));
+ $c += 5;
+ $utf16 = $this->utf82utf16($char);
+ $ascii .= sprintf('\u%04s', bin2hex($utf16));
+ break;
+ }
+ }
+
+ return '"'.$ascii.'"';
+
+ case 'array':
+ /*
+ * As per JSON spec if any array key is not an integer
+ * we must treat the the whole array as an object. We
+ * also try to catch a sparsely populated associative
+ * array with numeric keys here because some JS engines
+ * will create an array with empty indexes up to
+ * max_index which can cause memory issues and because
+ * the keys, which may be relevant, will be remapped
+ * otherwise.
+ *
+ * As per the ECMA and JSON specification an object may
+ * have any string as a property. Unfortunately due to
+ * a hole in the ECMA specification if the key is a
+ * ECMA reserved word or starts with a digit the
+ * parameter is only accessible using ECMAScript's
+ * bracket notation.
+ */
+
+ // treat as a JSON object
+ if (is_array($var) && count($var) && (array_keys($var) !== range(0, sizeof($var) - 1))) {
+ $properties = array_map(array($this, 'name_value'),
+ array_keys($var),
+ array_values($var));
+
+ foreach($properties as $property) {
+ if(Services_JSON::isError($property)) {
+ return $property;
+ }
+ }
+
+ return '{' . join(',', $properties) . '}';
+ }
+
+ // treat it like a regular array
+ $elements = array_map(array($this, 'encode'), $var);
+
+ foreach($elements as $element) {
+ if(Services_JSON::isError($element)) {
+ return $element;
+ }
+ }
+
+ return '[' . join(',', $elements) . ']';
+
+ case 'object':
+ $vars = get_object_vars($var);
+
+ $properties = array_map(array($this, 'name_value'),
+ array_keys($vars),
+ array_values($vars));
+
+ foreach($properties as $property) {
+ if(Services_JSON::isError($property)) {
+ return $property;
+ }
+ }
+
+ return '{' . join(',', $properties) . '}';
+
+ default:
+ return ($this->use & SERVICES_JSON_SUPPRESS_ERRORS)
+ ? 'null'
+ : new Services_JSON_Error(gettype($var)." can not be encoded as JSON string");
+ }
+ }
+
+ /**
+ * array-walking function for use in generating JSON-formatted name-value pairs
+ *
+ * @param string $name name of key to use
+ * @param mixed $value reference to an array element to be encoded
+ *
+ * @return string JSON-formatted name-value pair, like '"name":value'
+ * @access private
+ */
+ function name_value($name, $value)
+ {
+ $encoded_value = $this->encode($value);
+
+ if(Services_JSON::isError($encoded_value)) {
+ return $encoded_value;
+ }
+
+ return $this->encode(strval($name)) . ':' . $encoded_value;
+ }
+
+ /**
+ * reduce a string by removing leading and trailing comments and whitespace
+ *
+ * @param $str string string value to strip of comments and whitespace
+ *
+ * @return string string value stripped of comments and whitespace
+ * @access private
+ */
+ function reduce_string($str)
+ {
+ $str = preg_replace(array(
+
+ // eliminate single line comments in '// ...' form
+ '#^\s*//(.+)$#m',
+
+ // eliminate multi-line comments in '/* ... */' form, at start of string
+ '#^\s*/\*(.+)\*/#Us',
+
+ // eliminate multi-line comments in '/* ... */' form, at end of string
+ '#/\*(.+)\*/\s*$#Us'
+
+ ), '', $str);
+
+ // eliminate extraneous space
+ return trim($str);
+ }
+
+ /**
+ * decodes a JSON string into appropriate variable
+ *
+ * @param string $str JSON-formatted string
+ *
+ * @return mixed number, boolean, string, array, or object
+ * corresponding to given JSON input string.
+ * See argument 1 to Services_JSON() above for object-output behavior.
+ * Note that decode() always returns strings
+ * in ASCII or UTF-8 format!
+ * @access public
+ */
+ function decode($str)
+ {
+ $str = $this->reduce_string($str);
+
+ switch (strtolower($str)) {
+ case 'true':
+ return true;
+
+ case 'false':
+ return false;
+
+ case 'null':
+ return null;
+
+ default:
+ $m = array();
+
+ if (is_numeric($str)) {
+ // Lookie-loo, it's a number
+
+ // This would work on its own, but I'm trying to be
+ // good about returning integers where appropriate:
+ // return (float)$str;
+
+ // Return float or int, as appropriate
+ return ((float)$str == (integer)$str)
+ ? (integer)$str
+ : (float)$str;
+
+ } elseif (preg_match('/^("|\').*(\1)$/s', $str, $m) && $m[1] == $m[2]) {
+ // STRINGS RETURNED IN UTF-8 FORMAT
+ $delim = substr($str, 0, 1);
+ $chrs = substr($str, 1, -1);
+ $utf8 = '';
+ $strlen_chrs = strlen($chrs);
+
+ for ($c = 0; $c < $strlen_chrs; ++$c) {
+
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
+ $ord_chrs_c = ord($chrs{$c});
+
+ switch (true) {
+ case $substr_chrs_c_2 == '\b':
+ $utf8 .= chr(0x08);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\t':
+ $utf8 .= chr(0x09);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\n':
+ $utf8 .= chr(0x0A);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\f':
+ $utf8 .= chr(0x0C);
+ ++$c;
+ break;
+ case $substr_chrs_c_2 == '\r':
+ $utf8 .= chr(0x0D);
+ ++$c;
+ break;
+
+ case $substr_chrs_c_2 == '\\"':
+ case $substr_chrs_c_2 == '\\\'':
+ case $substr_chrs_c_2 == '\\\\':
+ case $substr_chrs_c_2 == '\\/':
+ if (($delim == '"' && $substr_chrs_c_2 != '\\\'') ||
+ ($delim == "'" && $substr_chrs_c_2 != '\\"')) {
+ $utf8 .= $chrs{++$c};
+ }
+ break;
+
+ case preg_match('/\\\u[0-9A-F]{4}/i', substr($chrs, $c, 6)):
+ // single, escaped unicode character
+ $utf16 = chr(hexdec(substr($chrs, ($c + 2), 2)))
+ . chr(hexdec(substr($chrs, ($c + 4), 2)));
+ $utf8 .= $this->utf162utf8($utf16);
+ $c += 5;
+ break;
+
+ case ($ord_chrs_c >= 0x20) && ($ord_chrs_c <= 0x7F):
+ $utf8 .= $chrs{$c};
+ break;
+
+ case ($ord_chrs_c & 0xE0) == 0xC0:
+ // characters U-00000080 - U-000007FF, mask 110XXXXX
+ //see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 2);
+ ++$c;
+ break;
+
+ case ($ord_chrs_c & 0xF0) == 0xE0:
+ // characters U-00000800 - U-0000FFFF, mask 1110XXXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 3);
+ $c += 2;
+ break;
+
+ case ($ord_chrs_c & 0xF8) == 0xF0:
+ // characters U-00010000 - U-001FFFFF, mask 11110XXX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 4);
+ $c += 3;
+ break;
+
+ case ($ord_chrs_c & 0xFC) == 0xF8:
+ // characters U-00200000 - U-03FFFFFF, mask 111110XX
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 5);
+ $c += 4;
+ break;
+
+ case ($ord_chrs_c & 0xFE) == 0xFC:
+ // characters U-04000000 - U-7FFFFFFF, mask 1111110X
+ // see http://www.cl.cam.ac.uk/~mgk25/unicode.html#utf-8
+ $utf8 .= substr($chrs, $c, 6);
+ $c += 5;
+ break;
+
+ }
+
+ }
+
+ return $utf8;
+
+ } elseif (preg_match('/^\[.*\]$/s', $str) || preg_match('/^\{.*\}$/s', $str)) {
+ // array, or object notation
+
+ if ($str{0} == '[') {
+ $stk = array(SERVICES_JSON_IN_ARR);
+ $arr = array();
+ } else {
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+ $stk = array(SERVICES_JSON_IN_OBJ);
+ $obj = array();
+ } else {
+ $stk = array(SERVICES_JSON_IN_OBJ);
+ $obj = new stdClass();
+ }
+ }
+
+ array_push($stk, array('what' => SERVICES_JSON_SLICE,
+ 'where' => 0,
+ 'delim' => false));
+
+ $chrs = substr($str, 1, -1);
+ $chrs = $this->reduce_string($chrs);
+
+ if ($chrs == '') {
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
+ return $arr;
+
+ } else {
+ return $obj;
+
+ }
+ }
+
+ //print("\nparsing {$chrs}\n");
+
+ $strlen_chrs = strlen($chrs);
+
+ for ($c = 0; $c <= $strlen_chrs; ++$c) {
+
+ $top = end($stk);
+ $substr_chrs_c_2 = substr($chrs, $c, 2);
+
+ if (($c == $strlen_chrs) || (($chrs{$c} == ',') && ($top['what'] == SERVICES_JSON_SLICE))) {
+ // found a comma that is not inside a string, array, etc.,
+ // OR we've reached the end of the character list
+ $slice = substr($chrs, $top['where'], ($c - $top['where']));
+ array_push($stk, array('what' => SERVICES_JSON_SLICE, 'where' => ($c + 1), 'delim' => false));
+ //print("Found split at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
+ // we are in an array, so just push an element onto the stack
+ array_push($arr, $this->decode($slice));
+
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+ // we are in an object, so figure
+ // out the property name and set an
+ // element in an associative array,
+ // for now
+ $parts = array();
+
+ if (preg_match('/^\s*(["\'].*[^\\\]["\'])\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+ // "name":value pair
+ $key = $this->decode($parts[1]);
+ $val = $this->decode($parts[2]);
+
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+ $obj[$key] = $val;
+ } else {
+ $obj->$key = $val;
+ }
+ } elseif (preg_match('/^\s*(\w+)\s*:\s*(\S.*),?$/Uis', $slice, $parts)) {
+ // name:value pair, where name is unquoted
+ $key = $parts[1];
+ $val = $this->decode($parts[2]);
+
+ if ($this->use & SERVICES_JSON_LOOSE_TYPE) {
+ $obj[$key] = $val;
+ } else {
+ $obj->$key = $val;
+ }
+ }
+
+ }
+
+ } elseif ((($chrs{$c} == '"') || ($chrs{$c} == "'")) && ($top['what'] != SERVICES_JSON_IN_STR)) {
+ // found a quote, and we are not inside a string
+ array_push($stk, array('what' => SERVICES_JSON_IN_STR, 'where' => $c, 'delim' => $chrs{$c}));
+ //print("Found start of string at {$c}\n");
+
+ } elseif (($chrs{$c} == $top['delim']) &&
+ ($top['what'] == SERVICES_JSON_IN_STR) &&
+ ((strlen(substr($chrs, 0, $c)) - strlen(rtrim(substr($chrs, 0, $c), '\\'))) % 2 != 1)) {
+ // found a quote, we're in a string, and it's not escaped
+ // we know that it's not escaped becase there is _not_ an
+ // odd number of backslashes at the end of the string so far
+ array_pop($stk);
+ //print("Found end of string at {$c}: ".substr($chrs, $top['where'], (1 + 1 + $c - $top['where']))."\n");
+
+ } elseif (($chrs{$c} == '[') &&
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+ // found a left-bracket, and we are in an array, object, or slice
+ array_push($stk, array('what' => SERVICES_JSON_IN_ARR, 'where' => $c, 'delim' => false));
+ //print("Found start of array at {$c}\n");
+
+ } elseif (($chrs{$c} == ']') && ($top['what'] == SERVICES_JSON_IN_ARR)) {
+ // found a right-bracket, and we're in an array
+ array_pop($stk);
+ //print("Found end of array at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ } elseif (($chrs{$c} == '{') &&
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+ // found a left-brace, and we are in an array, object, or slice
+ array_push($stk, array('what' => SERVICES_JSON_IN_OBJ, 'where' => $c, 'delim' => false));
+ //print("Found start of object at {$c}\n");
+
+ } elseif (($chrs{$c} == '}') && ($top['what'] == SERVICES_JSON_IN_OBJ)) {
+ // found a right-brace, and we're in an object
+ array_pop($stk);
+ //print("Found end of object at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ } elseif (($substr_chrs_c_2 == '/*') &&
+ in_array($top['what'], array(SERVICES_JSON_SLICE, SERVICES_JSON_IN_ARR, SERVICES_JSON_IN_OBJ))) {
+ // found a comment start, and we are in an array, object, or slice
+ array_push($stk, array('what' => SERVICES_JSON_IN_CMT, 'where' => $c, 'delim' => false));
+ $c++;
+ //print("Found start of comment at {$c}\n");
+
+ } elseif (($substr_chrs_c_2 == '*/') && ($top['what'] == SERVICES_JSON_IN_CMT)) {
+ // found a comment end, and we're in one now
+ array_pop($stk);
+ $c++;
+
+ for ($i = $top['where']; $i <= $c; ++$i)
+ $chrs = substr_replace($chrs, ' ', $i, 1);
+
+ //print("Found end of comment at {$c}: ".substr($chrs, $top['where'], (1 + $c - $top['where']))."\n");
+
+ }
+
+ }
+
+ if (reset($stk) == SERVICES_JSON_IN_ARR) {
+ return $arr;
+
+ } elseif (reset($stk) == SERVICES_JSON_IN_OBJ) {
+ return $obj;
+
+ }
+
+ }
+ }
+ }
+
+ /**
+ * @todo Ultimately, this should just call PEAR::isError()
+ */
+ function isError($data, $code = null)
+ {
+ if (class_exists('pear')) {
+ return PEAR::isError($data, $code);
+ } elseif (is_object($data) && (get_class($data) == 'services_json_error' ||
+ is_subclass_of($data, 'services_json_error'))) {
+ return true;
+ }
+
+ return false;
+ }
+}
+
+if (class_exists('PEAR_Error')) {
+
+ class Services_JSON_Error extends PEAR_Error
+ {
+ function Services_JSON_Error($message = 'unknown error', $code = null,
+ $mode = null, $options = null, $userinfo = null)
+ {
+ parent::PEAR_Error($message, $code, $mode, $options, $userinfo);
+ }
+ }
+
+} else {
+
+ /**
+ * @todo Ultimately, this class shall be descended from PEAR_Error
+ */
+ class Services_JSON_Error
+ {
+ function Services_JSON_Error($message = 'unknown error', $code = null,
+ $mode = null, $options = null, $userinfo = null)
+ {
+
+ }
+ }
+
+}
+
+?>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/network-publisher/networkpub.css Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,21 @@
+table.networkpub_added {border-collapse:collapse}
+table.networkpub_added th {padding:3px 10px 3px 10px;border:1px solid #DFDFDF;background-color:#F0F0F0;font-weight:bold;}
+table.networkpub_added td {padding:3px 10px 3px 10px;border:1px solid #DFDFDF;}
+
+.rts_header {padding:20px 0px 20px 0px;}
+.rts_header2{padding:5px 0px 3px 10px;border-bottom:1px solid #BFBFBF;margin-bottom:20px;background-color:#eceff5}
+fieldset.rts_fieldset {padding:15px; border:1px solid #BFBFBF;width:100%;background-color:#FFF;}
+fieldset.rts_fieldset label {float:left;margin:0px;padding:0px;}
+.rts_tbl_main {padding:0px;margin:0px;border-collapse:collapse;width:100%}
+.rts_tbl_main td {vertical-align:top;}
+div.rts_error {text-align:center;background-color:#ffebe8;border:1px solid #dd3c10;padding:3px 10px 3px 10px;margin-top:10px;margin-right:20px;margin-left:20px;}
+div.rts_success {text-align:center;background-color:#F7F7F7;border:1px solid #7f93bc;padding:3px 10px 3px 10px;margin-top:10px;margin-right:20px;margin-left:20px;}
+
+div.rts_tweet_box {margin-bottom:3px;}
+div.rts_tweet_box div {margin:0px;padding:0px;}
+div.rts_tweet_box div table{border:0px;padding:0px;border-collapse:collapse;}
+div.rts_tweet_box div table td{vertical-align:top;padding:5px;background-color:#EFEFF7;}
+div.rts_tweet_box div table td img{height:35px;width:35px;border:2px solid #FFF;}
+
+div#rts_tweets_load_button {text-align:center;}
+#rts_tweets_load {background-color:#eceff5;border-top:1px solid #d8dfea;border-left:1px solid #d8dfea;border-bottom:1px solid #7f93bc;border-right:1px solid #7f93bc;}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/network-publisher/networkpub.js Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,13 @@
+jQuery(document).ready(function($){
+ $(".networkpubre").bind("click", function(e) {
+ var key = $(this).attr("id");
+ if(key) {
+ var blog_url = $("#networkpub_plugin_url").val();
+ $.post(blog_url+"/network-publisher/networkpub_ajax.php", {key:key}, function(data) {
+ var dr = data.split("_");
+ $("#r_key_"+dr[1]).remove();
+ });
+ }
+ return false;
+ });
+})
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/network-publisher/networkpub.php Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,236 @@
+<?php
+/*
+Plugin Name: Network Publisher
+Plugin URI: http://www.linksalpha.com/
+Description: Automatically posts your Articles to Social Networks - Facebook, Twitter, and LinkedIn
+Version: 1.0.4
+Author: Vivek Puri
+Author URI: http://vivekpuri.com
+*/
+
+define('WIDGET_NAME', 'Network Publisher');
+define('WIDGET_NAME_INTERNAL', 'networkpub');
+define('WIDGET_PREFIX', 'networkpub');
+define('NETWORKPUB', 'Automatically post your Articles to Social Networks - Facebook and Twitter');
+define('ERROR_INTERNAL', 'internal error');
+define('ERROR_INVALID_URL', 'invalid url');
+define('ERROR_INVALID_KEY', 'invalid key');
+if ( ! defined( 'WP_CONTENT_URL' ) )
+ define( 'WP_CONTENT_URL', get_option( 'siteurl' ) . '/wp-content' );
+if ( ! defined( 'WP_CONTENT_DIR' ) )
+ define( 'WP_CONTENT_DIR', ABSPATH . 'wp-content' );
+define('WP_PLUGIN_URL', WP_CONTENT_URL. '/plugins' );
+
+$networkpub_settings['api_key'] = array('label'=>'API Key:', 'type'=>'text', 'default'=>'');
+$networkpub_settings['id'] = array('label'=>'id', 'type'=>'text', 'default'=>'');
+$options = get_option(WIDGET_NAME_INTERNAL);
+
+function networkpub_init() {
+ wp_enqueue_script('jquery');
+ wp_register_script('networkpubjs', WP_PLUGIN_URL .'/network-publisher/networkpub.js');
+ wp_enqueue_script('networkpubjs');
+ wp_register_style('networkpubcss', WP_PLUGIN_URL . '/network-publisher/networkpub.css');
+ wp_enqueue_style('networkpubcss');
+ add_action('admin_menu', 'networkpub_pages');
+ add_action('{$new_status}_{$post->post_type}', 'networkping');
+ add_action('publish_post', 'networkping');
+}
+
+add_action('init', 'networkpub_init');
+add_action('init', 'networkpub_remove');
+
+function networkping($id) {
+ if(!$id) {
+ return FALSE;
+ }
+ $options = get_option(WIDGET_NAME_INTERNAL);
+ $link = 'http://www.linksalpha.com/a/ping?id='.$options['id'];
+ require_once(ABSPATH.WPINC.'/class-snoopy.php');
+ $snoop = new Snoopy;
+ $snoop->agent = WIDGET_NAME.' - '.get_option('siteurl');
+ $response = '';
+ if($snoop->fetchtext($link)){
+ if (strpos($snoop->response_code, '200')) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+function networkpub_pages() {
+ if ( function_exists('add_submenu_page') ) {
+ $page = add_submenu_page('plugins.php', WIDGET_NAME, WIDGET_NAME, 'manage_options', 'networkpub', 'networkpub_conf');
+ }
+}
+
+function networkpub_conf() {
+ global $networkpub_settings;
+
+ if ( isset($_POST['submit']) ) {
+ if ( function_exists('current_user_can') && !current_user_can('manage_options') ) {
+ die(__('Cheatin’ uh?'));
+ }
+ $field_name = sprintf('%s_%s', WIDGET_PREFIX, 'api_key');
+ $value = strip_tags(stripslashes($_POST[$field_name]));
+ if($value) {
+ $networkadd = networkpub_add($value);
+ }
+ }
+ $options = get_option(WIDGET_NAME_INTERNAL);
+ $html = '<div class="rts_header"><big><strong>'.WIDGET_NAME.'</strong></big></div>';
+ $html .= '<table style="width:800px;"><tr><td style="padding-bottom:40px;">';
+ $html .= '<div style="padding:0px 0px 10px 0px;">Network Publisher makes it easy and painless to Publish your Blog Posts to Social Networks. All you need to do is connect to your Social Networks at <a target="_blank" href="http://www.linksalpha.com/user/networks">LinksAlpha.com</a>, grab API Key for each enabled Network and enter it below. Once setup, your Blog posts content appears on the social networks as soon as you hit the Publish button.</div>';
+ $html .= '<div style="padding:0px 0px 20px 0px;"><a href="http://www.linksalpha.com/user/networks" style="font-weight:bold;" target="_blank">Click Here</a> to get API Keys for your Social Networks. You can <a href="http://help.linksalpha.com/wordpress-plugin-network-publisher" target="_blank">read more about this process at LinksAlpha.com.</a></div>';
+ $html .= '<div class="rts_header2"><big><strong>Setup</strong></big></div><div style="padding-left:10px;">';
+ $html .= '<div style="text-align:left;">';
+ $html .= '<form action="" method="post" id="networkpubadd" name="networkpubadd" style="width:90%;">';
+ $html .= '<fieldset class="rts_fieldset">';
+ $html .= '<legend>Additional API Key</legend>';
+
+ $curr_field = 'api_key';
+ $field_name = sprintf('%s_%s', WIDGET_PREFIX, $curr_field);
+ $html .= '<div><label for="'.$field_name.'">'.$networkpub_settings[$curr_field]['label'].' </label></div>';
+ $html .= '<div style="padding-bottom:10px"><input style="width:400px;" class="widefat" id="'.$field_name.'" name="'.$field_name.'" type="text" /></div>';
+
+ $html .= '</fieldset>';
+ $html .= '<div style="padding-top:20px;"><input type="submit" name="submit" value="Add API Key" /></div>';
+ $html .= '<input type="hidden" value="'.WP_PLUGIN_URL.'" id="networkpub_plugin_url" /></form></div></td></tr><tr><td style="padding:0px 0px 0px 0px;vertical-align:top;">';
+ $html .= '<div class="rts_header2"><big><strong>Currently Publishing</strong></big></div>';
+ $html .= '<div style="padding-left:10px;">'.networkpub_load().'</div>';
+ $html .= '</div></td></tr></table>';
+ echo $html;
+}
+
+function networkpub_add($api_key) {
+ if (!$api_key) {
+ return FALSE;
+ }
+ $url = get_option('siteurl');
+ $desc = get_bloginfo('description');
+ if (!$url) {
+ return FALSE;
+ }
+ $link = 'http://www.linksalpha.com/a/networkpubadd?url='.urlencode($url).'&key='.$api_key.'&desc='.urlencode($desc);
+ require_once(ABSPATH.WPINC.'/class-snoopy.php');
+ $snoop = new Snoopy;
+ $snoop->agent = WIDGET_NAME.' - '.get_option('siteurl');
+ $response = '';
+ if($snoop->fetchtext($link)){
+ if (strpos($snoop->response_code, '200')) {
+ $response_json = $snoop->results;
+ $response = networkpub_json_decode($response_json);
+ }
+ }
+ if (!$response) {
+ return FALSE;
+ }
+ if ($response->errorCode > 0) {
+ return FALSE;
+ }
+ $options = get_option(WIDGET_NAME_INTERNAL);
+ if(empty($options['api_key'])) {
+ $options['api_key'] = $api_key;
+ } else {
+ $options_array = explode(',', $options['api_key']);
+ if(!in_array($api_key, $options_array)) {
+ $options['api_key'] = $options['api_key'].','.$api_key;
+ }
+ }
+ $options['id'] = $response->results->id;
+ update_option(WIDGET_NAME_INTERNAL, $options);
+ return TRUE;
+}
+
+function networkpub_load() {
+ $options = get_option(WIDGET_NAME_INTERNAL);
+ if (empty($options['api_key'])) {
+ $html = '<div>You have not added any API Key</div>';
+ return $html;
+ }
+ $link = 'http://www.linksalpha.com/a/networkpubget?key='.$options['api_key'];
+ require_once(ABSPATH.WPINC.'/class-snoopy.php');
+ $snoop = new Snoopy;
+ $snoop->agent = WIDGET_NAME.' - '.get_option('siteurl');
+ $response = '';
+ if($snoop->fetchtext($link)){
+ if (strpos($snoop->response_code, '200')) {
+ $response_json = $snoop->results;
+ $response = networkpub_json_decode($response_json);
+ }
+ }
+ if (!$response) {
+ $html = '<div>Error occured while trying to load the API Keys. Please try again later.</div>';
+ return $html;
+ }
+ if($response->errorCode > 0) {
+ $html = '<div>Error occured while trying to load the API Keys. Please try again later.</div>';
+ return $html;
+ }
+ $html = '<div style="padding-bottom:10px;">You are currently Publishing your Blog to '.count($response->results).' Social Networks</div>';
+ $html .= '<table class="networkpub_added"><tr><th>API Key</th><th>Network</th><th>Option</th></tr>';
+ foreach($response->results as $row) {
+ $html .= '<tr id="r_key_'.$row->api_key.'">';
+ switch($row->type) {
+ case 'twitter':
+ $html .= '<td>'.$row->api_key.'</td><td>Twitter Account - <a target="_blank" href="http://twitter.com/'.$row->short_name.'">'.$row->name.'</a></td>';
+ break;
+ case 'fb_page':
+ $html .= '<td>'.$row->api_key.'</td><td>Facebook Page - <a target="_blank" href="'.$row->page_url.'">'.$row->name.'</a></td>';
+ break;
+ case 'fb_wall':
+ $html .= '<td>'.$row->api_key.'</td><td><a target="_blank" href="http://www.facebook.com/profile.php?id='.$row->id.'">'.$row->name.'</a></td>';
+ break;
+ case 'myspace':
+ $html .= '<td>'.$row->api_key.'</td><td>MySpace Account - <a target="_blank" href="'.$row->page_url.'">'.$row->name.'</a></td>';
+ break;
+ case 'linkedin':
+ $html .= '<td>'.$row->api_key.'</td><td>LinkedIn Account - <a target="_blank" href="'.$row->page_url.'">'.$row->name.'</a></td>';
+ break;
+ case 'yammer':
+ $html .= '<td>'.$row->api_key.'</td><td>Yammer Account - <a target="_blank" href="'.$row->page_url.'">'.$row->name.'</a></td>';
+ break;
+ }
+ $html .= '<td><a href="#" id="key_'.$row->api_key.'" class="networkpubre">Remove</a></td></tr>';
+ }
+ $html .= '</table>';
+ return $html;
+}
+
+function networkpub_remove() {
+ $options = get_option(WIDGET_NAME_INTERNAL);
+ if (!empty($_POST['key'])) {
+ $key_full = $_POST['key'];
+ $key_only = substr($key_full, 4);
+ $api_key = $options['api_key'];
+ $api_key_array = explode(',', $api_key);
+ $loc = array_search($key_only, $api_key_array);
+ if($loc !== FALSE) {
+ unset($api_key_array[$loc]);
+ }
+ $api_key = implode(",", $api_key_array);
+ $options['api_key'] = $api_key;
+ update_option(WIDGET_NAME_INTERNAL, $options);
+ $link = 'http://www.linksalpha.com/a/networkpubremove?id='.$options['id'].'&key='.$key_only;
+ require_once(ABSPATH.WPINC.'/class-snoopy.php');
+ $snoop = new Snoopy;
+ $snoop->agent = WIDGET_NAME.' - '.get_option('siteurl');
+ $response = '';
+ $snoop->fetchtext($link);
+ echo $key_full;
+ return;
+ }
+}
+
+function networkpub_json_decode($str) {
+ if (function_exists("json_decode")) {
+ return json_decode($str);
+ } else {
+ if (!class_exists('Services_JSON')) {
+ require_once("JSON.php");
+ }
+ $json = new Services_JSON();
+ return $json->decode($str);
+ }
+}
+
+?>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/network-publisher/networkpub_ajax.php Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,12 @@
+<?php
+
+if (!function_exists('add_action')){
+ @include_once($GLOBALS['HTTP_ENV_VARS']['DOCUMENT_ROOT'] . "/wp-config.php");
+ if (!function_exists('add_action')) {
+ include_once("../../../wp-config.php");
+ } else {
+ return false;
+ }
+}
+
+?>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/network-publisher/readme.txt Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,41 @@
+=== Plugin Name ===
+Contributors: Vivek Puri
+Tags: twitter, linkedin, facebook, facebook page, facebook profile, facebook wall, yammer, myspace, news, publish, distribute, status, update, status update
+Requires at least: 1.0.0
+Tested up to: 2.9
+Stable tag: 1.0.4
+
+== Description ==
+
+Get Support: support@linksalpha.com
+
+Plugin enables you to automatically publish your Blog Posts to Social Networks - Facebook, Twitter, and LinkedIn
+
+Currently Supported Networks include - Facebook Profile, Facebook Pages, Twitter accounts, LinkedIn, MySpace, and Yammer accounts
+
+== Installation ==
+
+1. Upload network-publisher.zip to '/wp-content/plugins/' directory and unzip it.
+1. Activate the "Network Publisher" Plugin from "Manage Plugins" window
+1. Setup: Add LinksALpha.com API Keys to start Publishing. Click on the following link for instructions on how to get API Keys from LinksAlpha.com - http://help.linksalpha.com/wordpress-plugin-network-publisher
+
+== Screenshots ==
+
+1. Networks enabled by a User at LinksAlpha.com
+2. Network Publisher Plugin Setup window
+
+== Changelog ==
+
+= 1.0.4 =
+* Fixed css and js url issue
+* Added Yammer support
+
+= 1.0.3 =
+* Fixed json decode bug
+* Added MySpace support
+
+= 1.0.2 =
+* Fixed ping url
+
+= 1.0.1 =
+* First release
\ No newline at end of file
Binary file web/wp-content/plugins/network-publisher/screenshot-1.png has changed
Binary file web/wp-content/plugins/network-publisher/screenshot-2.png has changed
--- a/web/wp-content/plugins/wp-cumulus/wp-cumulus.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/plugins/wp-cumulus/wp-cumulus.php Thu Mar 18 09:56:33 2010 +0000
@@ -117,7 +117,7 @@
// get categories
if( $options['mode'] != "tags" ){
ob_start();
- wp_list_categories('title_li=&show_count=1&hierarchical=0&style=none');
+ wp_list_categories('title_li=&show_count=1&hierarchical=0&style=none&setlang=0&lang=en_EN');
$cats = urlencode( ob_get_clean() );
}
// get some paths
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-dictionary/plural.js Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,83 @@
+// xili-dictionary plugin
+// used for plural add or edit meta-box
+// v 1.0.1 - © 20091105 - dev.xiligroup.com
+//
+var $j = jQuery;
+// init
+jQuery(document).ready(function($) {
+ $('#btnAdd').click(function() {
+ $aa = new Array ('');
+ addanelement ($aa,0);
+ calculateSum();
+ });
+
+ $('#btnDel').click(function() {
+ var num = $('.clonedInput').length;
+ $('#input' + num).remove();
+ $('#btnAdd').attr('disabled','');
+ if (num-1 == 1) {
+ $('#btnDel').attr('disabled','disabled');
+ if ($('#dictioline_lang').val() != "")
+ $('#areatitle1').html('Singular (msgstr)');
+ }
+ calculateSum();
+ $('#termnblines').val(num-1);
+ });
+ $('#btnDel').attr('disabled','disabled');
+ if ($("textarea#dictioline_description").length > 0) {
+ var descriptioncontent = $("textarea#dictioline_description").val();
+ var plurals = descriptioncontent.split('[XPLURAL]');
+ $('#dictioline_description1').val(plurals[0]);
+ if (plurals.length > 1) {
+ var howtoadd = plurals.length - 1;
+ for (var x = 1; x <= howtoadd; x++) {
+ addanelement (plurals,x);
+ }
+ calculateSum();
+ }
+
+ $(".plural").each(function() {
+ $(this).keyup(function(){
+ calculateSum();
+ });
+ });
+ }
+});
+
+function addanelement (plurals,x) {
+ var num = $j('.clonedInput').length;
+ var newNum = new Number(num + 1);
+ var newElem = $j('#input' + num).clone().attr('id', 'input' + newNum);
+ newElem.children('textarea').attr('id', 'dictioline_description' + newNum).attr('name', 'dictioline_description' + newNum).attr('class', 'plural').attr('value', plurals[x]);
+ newElem.children('p').attr('id', 'areatitle' + newNum).attr('name', 'areatitle' + newNum);
+ $j('#input' + num).after(newElem);
+ if ($j('#dictioline_lang').val() == "") {
+ $j('#areatitle' + newNum).html('Plural (msgid_plural)');
+ $j('#areatitle1').html('Singular (msgid)');
+ } else {
+ $j('#areatitle' + newNum).html('Plural (msgstr['+ (newNum-1) +'])');
+ $j('#areatitle1').html('Singular (msgstr[0])');
+ }
+ $j('#btnDel').attr('disabled','');
+ if (($j('#dictioline_lang').val() == "" && newNum == 2) || ($j('#dictioline_lang').val() != "" && newNum == 4))
+ $j('#btnAdd').attr('disabled','disabled');
+ $j(".plural").each(function() {
+ $j(this).keyup(function(){
+ calculateSum();
+ });
+ });
+ $j('#termnblines').val(newNum);
+}
+
+function calculateSum($) {
+ var sum = "";
+ $j(".plural").each(function($) {
+ if (sum == "") {
+ sum += this.value ;
+ } else {
+ sum += '[XPLURAL]' + this.value ;
+ }
+ });
+ $j("textarea#dictioline_description").val(sum);
+}
+
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-dictionary/plural.php Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,86 @@
+<?php /** * @since 1.0.2 insert var and constant */
+$xplural = $_GET['var'];
+?>
+// xili-dictionary plugin
+// used for plural add or edit meta-box
+// v 1.0.2 - © 20091108 - dev.xiligroup.com
+//
+var $j = jQuery;
+// init
+jQuery(document).ready(function($) {
+ $('#btnAdd').click(function() {
+ $aa = new Array ('');
+ addanelement ($aa,0);
+ calculateSum();
+ });
+
+ $('#btnDel').click(function() {
+ var num = $('.clonedInput').length;
+ $('#input' + num).remove();
+ $('#btnAdd').attr('disabled','');
+ if (num-1 == 1) {
+ $('#btnDel').attr('disabled','disabled');
+ if ($('#dictioline_lang').val() != "")
+ $('#areatitle1').html('Singular (msgstr)');
+ }
+ calculateSum();
+ $('#termnblines').val(num-1);
+ });
+ $('#btnDel').attr('disabled','disabled');
+ if ($("textarea#dictioline_description").length > 0) {
+ var descriptioncontent = $("textarea#dictioline_description").val();
+ var plurals = descriptioncontent.split('<?php echo $xplural ?>');
+ $('#dictioline_description1').val(plurals[0]);
+ if (plurals.length > 1) {
+ var howtoadd = plurals.length - 1;
+ for (var x = 1; x <= howtoadd; x++) {
+ addanelement (plurals,x);
+ }
+ calculateSum();
+ }
+
+ $(".plural").each(function() {
+ $(this).keyup(function(){
+ calculateSum();
+ });
+ });
+ }
+});
+
+function addanelement (plurals,x) {
+ var num = $j('.clonedInput').length;
+ var newNum = new Number(num + 1);
+ var newElem = $j('#input' + num).clone().attr('id', 'input' + newNum);
+ newElem.children('textarea').attr('id', 'dictioline_description' + newNum).attr('name', 'dictioline_description' + newNum).attr('class', 'plural').attr('value', plurals[x]);
+ newElem.children('p').attr('id', 'areatitle' + newNum).attr('name', 'areatitle' + newNum);
+ $j('#input' + num).after(newElem);
+ if ($j('#dictioline_lang').val() == "") {
+ $j('#areatitle' + newNum).html('Plural (msgid_plural)');
+ $j('#areatitle1').html('Singular (msgid)');
+ } else {
+ $j('#areatitle' + newNum).html('Plural (msgstr['+ (newNum-1) +'])');
+ $j('#areatitle1').html('Singular (msgstr[0])');
+ }
+ $j('#btnDel').attr('disabled','');
+ if (($j('#dictioline_lang').val() == "" && newNum == 2) || ($j('#dictioline_lang').val() != "" && newNum == 4))
+ $j('#btnAdd').attr('disabled','disabled');
+ $j(".plural").each(function() {
+ $j(this).keyup(function(){
+ calculateSum();
+ });
+ });
+ $j('#termnblines').val(newNum);
+}
+
+function calculateSum($) {
+ var sum = "";
+ $j(".plural").each(function($) {
+ if (sum == "") {
+ sum += this.value ;
+ } else {
+ sum += '<?php echo $xplural ?>' + this.value ;
+ }
+ });
+ $j("textarea#dictioline_description").val(sum);
+}
+<?php /* end plural javascript containing php vars */ ?>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-dictionary/readme.txt Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,133 @@
+=== xili-dictionary ===
+Contributors: MS xiligroup
+Donate link: http://dev.xiligroup.com/
+Tags: theme,post,plugin,posts, page, category, admin,multilingual,taxonomy,dictionary, .mo file, .po file, l10n, i18n, language, international
+Requires at least: 2.8.0
+Tested up to: 2.9.1
+Stable tag: 1.0.3
+
+xili-dictionary is a dictionary storable in taxonomy and terms to create and translate .po files or .mo files and more...
+
+== Description ==
+
+**xili-dictionary is a dictionary storable in taxonomy and terms to create, update and translate .po files or .mo files and more...**
+
+* xili-dictionary is a plugin (compatible with xili-language) to build a multilingual dictionary saved in the taxonomy tables of WordPress.
+* With this dictionary, collecting terms from categories (title, description), from current theme - international terms with ` _e(), __() or _n() ` functions - , it is possible to create and update .mo file in the current theme folder.
+* xili-dictionary is full compatible with [xili-language](http://wordpress.org/extend/plugins/xili-language/) plugin and [xili-tidy-tags](http://wordpress.org/extend/plugins/xili-tidy-tags/) plugin.
+
+= 1.0.3 =
+* fixes some directories issues in (rare) xamp servers and in theme's terms import.
+* Create .po with empty translations. Helpful if you send the .po file to a translator that uses app like poedit.
+
+**1.0.2 beta**
+* Create languages list, if xili-language plugin absent, for international themes - see [post](http://dev.xiligroup.com/?p=312 "xili-dictionary for international themes") - to manage or improve current translations.
+* JS and vars, lot of fixes.
+* Add a term UI now use dynamic input (with javascript included).
+* Now use POMO translations libraries included in WP since 2.8.
+* Add features to set and manage plural terms used by `_n()`
+
+**For previous WP versions (<2.8), please use 0.9.9 release.**
+
+**0.9.9**
+some fixes - better log display when importing from theme's files - tested on WP 2.9-rare
+
+**0.9.8**
+verified on official WP 2.8 - see Notes
+**0.9.7.1**
+grouping of terms by language now possible, - better import .po - enrich terms more possible (same terms with/without html tags (0.9.7.2 : some refreshing fixes)
+
+THESE VERSIONS 1.0.x ARE BETA VERSION (running on our sites and elsewhere) - WE NEED MORE FEEDBACK even if the first from world are good - coded as OOP and new admin UI WP 2.7 features (meta_box, js, screen options,...)
+
+Some features (importing themes words to fill msgid list) are not totally stable (if coding is crazy - too spacing !)...
+
+== Installation ==
+
+1. Upload the folder containing `xili-dictionary.php` and language files to the `/wp-content/plugins/` directory,
+2. Verify that your theme is international compatible - translatable terms like `_e('the term','mytheme')` and no text hardcoded -
+3. active and visit the dictionary page in tools menu ... more details soon... [here](http://dev.xiligroup.com/?cat=394&lang=en_us) -
+
+== Frequently Asked Questions ==
+
+= Is the term msgid may contain words enriched by html tags ? =
+like `<em> or <strong>`
+
+Yes, since version 0.9.7.
+
+`
+a <strong>good</strong> word
+`
+
+can be translated by
+
+`
+un mot <strong>exact</strong>
+`
+
+
+= Where can I see websites using this plugin ? =
+
+dev.xiligroup.com [here](http://dev.xiligroup.com/ "a multi-language site")
+and
+www.xiliphone.mobi [here](http://www.xiliphone.mobi "a theme for mobile") also usable with mobile as iPhone.
+
+= What is the difference with msgid and msgtr in .po file ? =
+The msgid line is equal to the term or sentence hardcoded in the theme functions like ` _e() or __() `. msgstr is the translation in the target language : by instance `fr_FR.po` for a french dictionary. (the compiled file is `fr_FR.mo` saved in the theme folder.
+The root language is in Wordpress currently `en_US`, but with xili-dictionary, it is possible to create a `en_US.mo` containing the only few terms that you want to adapt.
+
+= Is xili-dictionary usable without xili-language to edit .po or .mo file ? =
+
+With certain conditions, the language must in the default list and if the language files are not in the root of the current theme, you must add this line in functions.php file of this theme (normally set before xili-language is installed) :
+
+`define('THEME_LANGS_FOLDER','/nameoflangfolder'); // in Fusion: /lang`
+
+= What about plural translations ? =
+Today works with .mo or .po with simple twin msgid msgstr couple of lines and themes with functions like ` _e() or __() ` for localization AND `_n()` which manage singular and plural terms like `msgid, msgid_plural, msgstr[0],...`
+
+= What about future WP 2.9 ? =
+Today works...
+
+== Screenshots ==
+
+1. the admin settings UI and boxes for editing, sub-selection and create or import files (.mo or .po).
+2. Since 1.0.0, plural terms are allowed.
+3. MsgID with his singular and his plural line.
+4. MsgSTR with separators between occurrences of n plural terms `msgstr[n]` (soon more practical UI).
+
+== Upgrade Notice ==
+
+Upgrading can be easily procedeed through WP admin UI or through ftp.
+
+
+== More infos ==
+
+This first beta releases are for theme's creator or designer with some knowledges in i18n.
+
+The plugin post is frequently updated [dev.xiligroup.com](http://dev.xiligroup.com/?p=312 "Why xili-dictionary ?")
+
+See also the [Wordpress plugins forum](http://wordpress.org/tags/xili-language/).
+
+== Changelog ==
+= 1.0.3 beta =
+fixes some directories issues in (rare) xamp servers and in theme's terms import. Create .po with empty translations.
+= 1.0.2 beta =
+Use POMO libraries and classes only in WP > 2.8. Add plural translations. Add edit term dynamic UI
+= 0.9.9 =
+* fixes existing msgid terms -
+* better log display in importing theme's terms
+* more html tags in msg str or id
+= 0.9.8 =
+* verified on official WP 2.8.
+* fixes query error,
+* .1 fixe IIS error.
+
+= 0.9.7.2 = some fixes
+= 0.9.7.1 = list of msgid ID at end
+= 0.9.7 = grouping of terms by language now possible, and more...
+= 0.9.6 = W3C - recover compatibility with future wp 2.8
+= 0.9.5 = sub-selection of terms in UI, better UI (links as button)
+= 0.9.4.1 = subfolder for langs file - ` THEME_LANGS_FOLDER ` to define in functions.php with xili-language
+= 0.9.4 = second public release (beta) with OOP coding and new admin UI for WP 2.7
+= 0.9.3 = first public release (beta)
+
+© 100207 - MS - dev.xiligroup.com
Binary file web/wp-content/plugins/xili-dictionary/screenshot-1.png has changed
Binary file web/wp-content/plugins/xili-dictionary/screenshot-2.png has changed
Binary file web/wp-content/plugins/xili-dictionary/screenshot-3.png has changed
Binary file web/wp-content/plugins/xili-dictionary/screenshot-4.png has changed
Binary file web/wp-content/plugins/xili-dictionary/xili-dictionary-fr_FR.mo has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-dictionary/xili-dictionary-fr_FR.po Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,277 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: xili_dictionary\n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: 2009-11-08 08:59+0100\n"
+"Last-Translator: dev.xiligroup.com <contact@xiligroup.com>\n"
+"Language-Team: Michel SCRIBAN <michel@scriban.eu>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: __;_e\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-Language: French\n"
+"X-Poedit-Country: FRANCE\n"
+"X-Poedit-SearchPath-0: trunk\n"
+
+msgid "A new term was added."
+msgstr "Un nouveau terme a été ajouté."
+
+msgid "Term to update."
+msgstr "Terme à mettre à jour."
+
+msgid "A term was updated."
+msgstr "Un terme a été mis à jour."
+
+msgid "A term to delete. CLICK MENU DICTIONARY TO CANCEL !"
+msgstr "Terme à effacer. Cliquer le menu DICTIONNAIRE pour annuler !"
+
+msgid "A term was deleted."
+msgstr "Un terme a été supprimé."
+
+msgid "Find above the list of terms."
+msgstr "Voici ci-dessus la liste des termes."
+
+msgid "Dictionary"
+msgstr "Dictionnaire"
+
+msgid "Multilingual Terms"
+msgstr "Termes en plusieurs langues"
+
+msgid "Full name"
+msgstr "Nom complet"
+
+msgid "Slug"
+msgstr "Code"
+
+msgid "Alias of"
+msgstr "Alias de"
+
+msgid "Term group"
+msgstr "Code groupe"
+
+msgid "Note:"
+msgstr "Note et message :"
+
+msgid "Edit term"
+msgstr "Editer le terme"
+
+msgid "Delete term ?"
+msgstr "Supprimer le terme ?"
+
+msgid "xili-dictionary is a plugin (compatible with xili-language) to build a multilingual dictionary saved in the taxonomy tables of WordPress. With this dictionary, it is possible to create and update .mo file in the current theme folder. And more..."
+msgstr "L'extension xili-dictionary est destinée à créer et mettre à jour les fichiers .mo (et .po aussi) du thème courant. Elle est utile pour les thèmes internationaux ou les thèmes multilingues 'live' pilotés par xili-language."
+
+msgid "Add a term"
+msgstr "Ajouter un terme"
+
+msgid "Add »"
+msgstr "Ajouter…"
+
+msgid "Update »"
+msgstr "Mettre à jour…"
+
+msgid "Delete »"
+msgstr "Supprimer…"
+
+msgid "Category"
+msgstr "Catégorie"
+
+msgid "Import terms of categories"
+msgstr "Importer les noms et descriptions des catégories"
+
+msgid "Import category’s terms »"
+msgstr "Importer »"
+
+msgid "terms imported from WP: "
+msgstr "éléments importés : "
+
+msgid "To import terms (name and description) of categories into the dictionary before translation, click below. (to cancel, click Dictionary in dashboard menu)."
+msgstr "Cliquer le bouton ci-dessous pour importer les noms et descriptions des catégories du site dans le dictionnaire xili-dictionary."
+
+msgid "Export mo file"
+msgstr "Créer un fichier .mo"
+
+msgid "Export po file"
+msgstr "Créer un fichier .po"
+
+msgid "Export »"
+msgstr "Créer »"
+
+msgid "exported in mo file."
+msgstr "Fichier mo créé."
+
+msgid "exported in po file."
+msgstr "Fichier po créé."
+
+msgid "error during exporting in po file."
+msgstr "Erreur pendant la création du fichier po."
+
+msgid "Import po/mo file"
+msgstr "Import d'un fichier "
+
+msgid "Import »"
+msgstr "Importer »"
+
+msgid "line imported from po file: "
+msgstr "ligne(s) importée(s) du fichier .po"
+
+msgid "po file is not present."
+msgstr "Le fichier .po est absent."
+
+msgid "The files"
+msgstr "Les fichiers"
+
+msgid "The categories"
+msgstr "Les catégories du site."
+
+msgid "xili-language plugin is not activated !"
+msgstr "L'extension xili-language n'est pas activée."
+
+msgid "xili-language plugin is not present !"
+msgstr "L'extension xili-language n'est pas présente."
+
+msgid "Choose the original term (msgid) to translate"
+msgstr "Choisir le terme (msgid) à traduire"
+
+msgid "no parent (= msgid)"
+msgstr "terme de référence (=msgid)"
+
+msgid "Full msg (id or str)"
+msgstr "Le terme (id or str)"
+
+msgid "Language"
+msgstr "Langue"
+
+msgid "parent of: "
+msgstr "parent de : "
+
+msgid "Relationship (msgid)"
+msgstr "Terme référent (msgid)"
+
+msgid "Import all terms from current theme"
+msgstr "Importer les termes du thème courant"
+
+msgid "Erase all terms »"
+msgstr "Effacer le dictionnaire »"
+
+msgid "Erase all terms"
+msgstr "Effacer le dictionnaire »"
+
+msgid "Import & export"
+msgstr "Importer et exporter"
+
+msgid "Terms list management"
+msgstr "Gestion de l'affichage des termes"
+
+msgid "try another sub-selection !"
+msgstr "Sous-sélection sans résultat !"
+
+msgid "Sub list of terms"
+msgstr "Sélection des termes par"
+
+msgid "Starting with:"
+msgstr "Commençant par :"
+
+msgid "Containing:"
+msgstr "Incluant :"
+
+msgid "No select…"
+msgstr "Désélection"
+
+msgid "Sub select…"
+msgstr "Sous sélectionner…"
+
+msgid "Selection by language"
+msgstr "Sélection par langue"
+
+msgid "No sub-selection"
+msgstr "Sans sous-sélection"
+
+msgid "Only MsgID (en_US)"
+msgstr "Que le MsgID (en_US)"
+
+msgid "Only:"
+msgstr "Que la :"
+
+msgid "Create or Update mo file in current theme folder"
+msgstr "Crée ou met à jour le fichier .mo dans le dossier du thème actif"
+
+msgid "Create or Update po file in current theme folder"
+msgstr "Crée ou met à jour le fichier .po dans le dossier du thème actif"
+
+msgid "Import an existing .po file from current theme folder"
+msgstr "Importe un fichier .po existant dans le dossier du thème actif"
+
+msgid "Import name and description of categories"
+msgstr "Importe nom et description des catégories du blogue"
+
+msgid "To erase terms of the dictionary, click below. (before, create a .po if necessary!)"
+msgstr "Efface tous les termes du dictionnaire ! mais pas les fichiers .po et .mo"
+
+msgid "To import terms of the current theme, click below."
+msgstr "Pour importer les termes du thème courant, cliquer çi-dessous."
+
+msgid "Import all terms »"
+msgstr "Importer tous les termes »"
+
+msgid "No parent term defined"
+msgstr "Terme parent non défini !"
+
+msgid "List of found terms"
+msgstr "Liste des termes trouvés"
+
+msgid "List of scanned files:"
+msgstr "Liste des fichiers analysés :"
+
+msgid "Original or translation"
+msgstr "Original ou traduction"
+
+msgid "Full msgid (original)"
+msgstr "La ligne msgid (original)"
+
+msgid "Full msgstr (translation)"
+msgstr "La ligne msgstr (traduction)"
+
+msgid "translation of"
+msgstr "traduction de"
+
+msgid "translated as"
+msgstr "traduit en"
+
+msgid "Original"
+msgstr "Original"
+
+msgid "Translation"
+msgstr "Traduction"
+
+msgid "Use only plural terms if theme contains _n() functions"
+msgstr "N'utiliser les formes pluriels que si le thème contient des fonctions _n() !"
+
+msgid "Add a plural"
+msgstr "Ajouter un pluriel"
+
+msgid "Delete a plural"
+msgstr "Supprimer un pluriel"
+
+msgid "Only the languages list is here modified (but not the dictionary's contents)"
+msgstr "Seule la liste des languages est modifiée mais les contenus du dictionaire"
+
+msgid "Select..."
+msgstr "Choisir..."
+
+msgid "Delete a language"
+msgstr "Supprimer une langue"
+
+msgid "Language to add"
+msgstr "Langue à ajouter"
+
+msgid "ISO (xx_YY)"
+msgstr "Code (xx_YY)"
+
+msgid "Name (eng.)"
+msgstr "Nom (angl.)"
+
+msgid "Add a language"
+msgstr "Ajouter une langue"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-dictionary/xili-dictionary.php Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,1670 @@
+<?php
+/*
+Plugin Name: xili-dictionary
+Plugin URI: http://dev.xiligroup.com/xili-dictionary/
+Description: ONLY for >= WP 2.8. This plugin is a tool using wordpress's taxonomy for localized themes or multilingual themes managed by xili-language - a powerful tool to create .mo file(s) on the fly in the theme's folder and more... -
+Author: MS
+Version: 1.0.3
+Author URI: http://dev.xiligroup.com
+*/
+
+# beta 1.0.3 - fixes some directories issues in (rare) xamp servers and in theme's terms import. Create .po with empty translations.
+# beta 1.0.2 - JS and vars, create lang list, if xili-language absent, for international themes - lot of fixes
+# beta 1.0.1 - add scripts for form with plural msg (id or str)
+# beta 1.0.0 - use pomo libraries and classes - ONLY >= 2.8
+# beta 0.9.9 - fixes existing msgid terms - better log display when importing theme's terms
+# beta 0.9.8.2 - more html tags in msg str or id
+# beta 0.9.8.1 - some fixes for IIS server and PHP 5.2.1
+# beta 0.9.8 - WP 2.8 - fix query error
+# beta 0.9.7.3 <- to - see readme.txt - from 0.9.4
+# beta 0.9.3 - first published - 090131 MS
+
+
+# This plugin is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This plugin is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this plugin; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+define('XILIDICTIONARY_VER','1.0.3');
+
+include_once(ABSPATH . WPINC . '/pomo/po.php'); /* not included in wp-settings */
+
+class xili_dictionary {
+
+ var $subselect = ''; /* used to subselect by msgid or languages*/
+ var $xililanguage = ''; /* neveractive isactive wasactive */
+ var $tempoutput = "";
+ var $langfolder ='/'; /* where po or mo files */
+ var $xili_settings; /* saved in options */
+ var $ossep = "/"; /* for recursive file search in xamp */
+
+ function xili_dictionary($langsfolder = '/') {
+ /* activated when first activation of plug */
+ register_activation_hook(__FILE__,array(&$this,'xili_dictionary_activation'));
+ $this->ossep = strtoupper(substr(PHP_OS,0,3)=='WIN')?'\\':'/'; /* for rare xamp servers*/
+ /* get current settings - name of taxonomy - name of query-tag */
+ $this->xililanguage_state();
+ $this->xili_settings = get_option('xili_dictionary_settings');
+ if(empty($this->xili_settings)) {
+ $this->xili_dictionary_activation();
+ $this->xili_settings = get_option('xili_dictionary_settings');
+ }
+ define('DTAXONAME',$this->xili_settings['taxonomy']);
+ define('XDDICTLANGS','xl-'.DTAXONAME.'-langs');
+ /** * @since 1.0 */
+ define('XPLURAL','[XPLURAL]'); /* to separate singular and plural entries */
+
+
+ /* add new taxonomy in available taxonomies here dictionary terms */
+ register_taxonomy( DTAXONAME, 'post',array('hierarchical' => true, 'update_count_callback' => ''));
+ /* groups of terms by langs */
+ register_taxonomy( XDDICTLANGS, 'term',array('hierarchical' => false, 'update_count_callback' => ''));
+
+ /* test if version changed */
+ $version = $this->xili_settings['version'];
+ if ($version <= '0.2') {
+ /* update relationships for grouping existing dictionary terms */
+ $this->update_terms_langs_grouping();
+ $this->xili_settings['version'] = '1.0';
+ update_option('xili_dictionary_settings', $this->xili_settings);
+ }
+ $this->fill_default_languages_list();
+ /* Actions */
+ add_action('admin_menu', array(&$this,'xili_add_dict_pages'));
+ add_action('init', array(&$this, 'init_textdomain'));
+ add_filter('plugin_action_links', array(&$this,'xilidict_filter_plugin_actions'), 10, 2);
+ }
+
+ function xili_dictionary_activation() {
+ $this->xili_settings = get_option('xili_dictionary_settings');
+ if(empty($this->xili_settings)) {
+ $submitted_settings = array(
+ 'taxonomy' => 'dictionary',
+ 'langs_folder' => '',
+ 'version' => '1.0'
+ );
+ update_option('xili_dictionary_settings', $submitted_settings);
+ }
+ }
+
+ /** * add js in admin * @updated 1.0.2 */
+ function xili_add_js() {
+ wp_enqueue_script( 'xd-plural', '/'.PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)).'/plural.php?var='.XPLURAL, array('jquery'), XILIDICTIONARY_VER);
+ }
+
+ /** *add admin menu and associated page */
+ function xili_add_dict_pages() {
+ $this->thehook = add_management_page(__('Dictionary','xili-dictionary'), __('Dictionary','xili-dictionary'), 'import', 'dictionary_page', array(&$this,'xili_dictionary_settings'));
+ add_action('load-'.$this->thehook, array(&$this,'on_load_page'));
+ add_action( "admin_print_scripts-".$this->thehook, array(&$this,'xili_add_js'));
+ }
+
+ function on_load_page() {
+ wp_enqueue_script('common');
+ wp_enqueue_script('wp-lists');
+ wp_enqueue_script('postbox');
+
+ add_meta_box('xili-dictionary-sidebox-1', __('Message','xili-dictionary'), array(&$this,'on_sidebox_1_content'), $this->thehook , 'side', 'core');
+ add_meta_box('xili-dictionary-sidebox-2', __('Info','xili-dictionary'), array(&$this,'on_sidebox_2_content'), $this->thehook , 'side', 'core');
+
+
+ }
+
+ /**
+ * Add action link(s) to plugins page
+ *
+ * @since 0.9.3
+ * @author MS
+ * @copyright Dion Hulse, http://dd32.id.au/wordpress-plugins/?configure-link and scripts@schloebe.de
+ */
+ function xilidict_filter_plugin_actions($links, $file){
+ static $this_plugin;
+
+ if (!$this_plugin ) $this_plugin = plugin_basename(__FILE__);
+
+ if ($file == $this_plugin ) {
+ $settings_link = '<a href="tools.php?&page=dictionary_page">' . __('Settings') . '</a>';
+ $links = array_merge( array($settings_link), $links); // before other links
+ }
+ return $links;
+ }
+
+ function init_textdomain() {
+ /*multilingual for admin pages and menu*/
+ load_plugin_textdomain('xili-dictionary',PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)));
+
+ if (!defined('THEME_LANGS_FOLDER')) { /* set or detect at least a .mo or .po */
+ if ($this->xili_settings['langs_folder'] == "") {
+ $this->find_files(get_template_directory(), '/.[mp]o$/', array(&$this,'searchpath'));
+ update_option('xili_dictionary_settings', $this->xili_settings);
+ }
+ define('THEME_LANGS_FOLDER',$this->xili_settings['langs_folder']); // for bkwd compatibility with xili-dictionary
+ }
+ }
+ function searchpath($path, $filename) {
+ $this->xili_settings['langs_folder'] = str_replace(get_template_directory(),'',$path);
+ }
+
+ function xililanguage_state() {
+ /* test if xili-language is present or was present */
+ if (class_exists('xili_language')) {
+ $this->xililanguage = 'isactive';
+ } else {
+ /* test if language taxonomy relationships are present */
+ $xl_settings = get_option('xili_language_settings');
+ if (empty($xl_settings)) {
+ $this->xililanguage = 'neveractive';
+ } else {
+ $this->xililanguage = 'wasactive';
+ }
+ }
+ }
+ /** * @since 1.02 */
+ function fill_default_languages_list() {
+ if ($this->xililanguage == 'neveractive' || $this->xililanguage == 'wasactive') {
+
+ if (!$this->xili_settings[XDDICTLANGS]) {
+ $default_langs_array = array(
+ 'en_us' => array('en_US', 'english'),
+ 'fr_fr' => array('fr_FR', 'french'),
+ 'de_de' => array('de_DE', 'german'),
+ 'es_es' => array('es_ES', 'spanish'),
+ 'it_it' => array('it_IT', 'italian')
+ );
+ /* add wp admin lang */
+ if (defined ('WPLANG')) {
+ $lkey = strtolower(WPLANG);
+ if (!array_key_exists($lkey, $default_langs_array)) $default_langs_array[$lkey] = array (WPLANG, WPLANG);
+ }
+ $this->xili_settings[XDDICTLANGS] = $default_langs_array;
+ update_option('xili_dictionary_settings', $this->xili_settings);
+ }
+ }
+ }
+
+ /**
+ * private function to update grouping of terms if xili-language is active
+ *
+ *
+ *
+ */
+ function update_terms_langs_grouping() {
+ if ($this->xililanguage == 'isactive') {
+
+ $listdictiolines = get_terms(DTAXONAME, array('hide_empty' => false,'get'=>'all'));
+ if (!empty($listdictiolines)) {
+ foreach ($listdictiolines as $dictioline) {
+ /* check slug before creating relationship if parent = O select msgid */
+ if ($dictioline->parent != 0) {
+ $extend = substr($dictioline->slug,-5);
+ $lang = get_term_by('slug',$extend,TAXONAME,OBJECT);
+ if ($lang) {
+ $term = $lang->name;
+ } else {
+ $term = $extend;
+ }
+ $args = array( 'alias_of' => '', 'description' => 'Dictionary Group in '.$term, 'parent' => 0, 'slug' =>$extend);
+ $theids = wp_insert_term( $term, XDDICTLANGS, $args);
+ wp_set_object_terms((int) $dictioline->term_id, $extend, XDDICTLANGS,false);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * private functions for dictionary_settings
+ * @since 0.9.3
+ *
+ * fill the content of the boxes (right side and normal)
+ *
+ */
+
+ function on_sidebox_1_content($data) {
+ extract($data);
+ ?>
+ <h4><?php _e('Note:','xili-dictionary') ?></h4>
+ <p><?php echo $message;?></p>
+ <?php
+ }
+
+ function on_sidebox_2_content() { ?>
+
+ <p><?php _e('xili-dictionary is a plugin (compatible with xili-language) to build a multilingual dictionary saved in the taxonomy tables of WordPress. With this dictionary, it is possible to create and update .mo file in the current theme folder. And more...','xili-dictionary') ?></p>
+ <fieldset style="margin:2px; padding:12px 6px; border:1px solid #ccc;"><legend><?php echo __("Theme's informations:",'xili-dictionary').' ('.get_option("template").')'; ?></legend>
+ <p>
+ <?php $langfolder = (defined('THEME_LANGS_FOLDER')) ? THEME_LANGS_FOLDER : $this->xili_settings['langs_folder'];
+ echo __("Languages sub-folder:",'xili-dictionary').' '. $langfolder; ?><br />
+ <?php _e('Available MO files:','xili-dictionary'); echo '<br />';
+ $this->find_files(get_template_directory(), '/.mo$/', array(&$this,'available_mo_files')) ;?>
+ </p>
+ </fieldset>
+
+ <?php
+ }
+
+ function on_normal_1_content($data) {
+ extract($data);
+ $sortparent = (($this->subselect == '') ? '' : '&tagsgroup_parent_select='.$this->subselect );
+ ?>
+ <table class="widefat">
+ <thead>
+ <tr>
+ <th scope="col"><a href="?page=dictionary_page"><?php _e('ID') ?></a></th>
+ <th scope="col"><a href="?page=dictionary_page&orderby=name<?php echo $sortparent; ?>"><?php _e('Text') ?></a></th>
+
+ <th scope="col"><a href="?page=dictionary_page&orderby=slug<?php echo $sortparent; ?>"><?php _e('Slug','xili-dictionary') ?></a></th>
+ <th scope="col" ><?php _e('Group','xili-dictionary') ?></th>
+
+ <th colspan="2"><?php _e('Action') ?></th>
+ </tr>
+ </thead>
+ <tbody id="the-list">
+ <?php $this->xili_dict_row($orderby,$tagsnamelike,$tagsnamesearch); /* the lines */
+ ?>
+ </tbody>
+ </table>
+ <?php if ($action=='edit' || $action=='delete') :?>
+ <p>(<a href="?action=add&page=dictionary_page"><?php _e('Add a term','xili-dictionary') ?></a>)</p>
+ <?php endif;
+ }
+
+ function on_normal_2_content($data) {
+ extract($data);
+
+ /* the create - edit - delete form */ ?>
+ <div style="background:#f5f5fe;">
+ <p id="add_edit"><?php _e($formhow,'xili-dictionary') ?></p>
+ <?php
+ if ($action=='export' || $action=='importmo' || $action=='import' || $action=='exportpo' ) { ?>
+
+ <label for="language_file">
+ <select name="language_file" ><?php
+ $extend = WPLANG;
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ if (is_wp_error($listlanguages) || empty($listlanguages)) {
+ $langs_array = $this->xili_settings[XDDICTLANGS];
+ echo '<option value="" >...</option>';
+ foreach ($langs_array as $lkey => $reflanguage) {
+ echo '<option value="'.$reflanguage[0].'"';
+ if ($extend == $reflanguage[0]) {
+ echo ' selected="selected"';
+ }
+ echo ">".__($reflanguage[1],'xili-dictionary').'</option>';
+ }
+ } else {
+
+ foreach ($listlanguages as $reflanguage) {
+ echo '<option value="'.$reflanguage->name.'"';
+ if ($extend == $reflanguage->name) {
+ echo ' selected="selected"';
+ }
+ echo ">".__($reflanguage->description,'xili-dictionary').'</option>';
+
+ }
+ } ?>
+ </select></label>
+ <br /> <br />
+ <input class="button" type="submit" name="reset" value="<?php echo $cancel_text ?>" /> <input class="button-primary" type="submit" name="submit" value="<?php echo $submit_text ?>" /><br /></div>
+ <?php
+ } elseif ($action=='importcats' || $action=='erasedictionary' || $action=='importcurthemeterms') {
+ ?>
+
+ <br /> <br />
+ <input class="button" type="submit" name="reset" value="<?php echo $cancel_text ?>" />
+ <input class="button-primary" type="submit" name="submit" value="<?php echo $submit_text ?>" /><br /></div>
+ <?php
+
+
+ } else {
+ //print_r($dictioline);
+
+ /* rules for edit dictioline */
+ $noedit = "" ; $noedited = "" ;
+ if ($action=='edit' && $dictioline->parent == 0) {
+ $noedited = 'disabled="disabled"';
+ $extend = "";
+ } elseif ($action=='edit') {
+ /* search default */
+ $extend = substr($dictioline->slug,-5);
+ } elseif ($action=='delete' && $dictioline->parent == 0) {
+ $noedit = 'disabled="disabled"';
+ $extend = "";
+ } elseif ($action=='delete') {
+ $noedit = 'disabled="disabled"';
+ $extend = substr($dictioline->slug,-5);
+ }
+ ?>
+ <table class="editform" width="100%" cellspacing="2" cellpadding="5">
+ <tr>
+ <?php if ($action=='edit' || $action=='delete') {
+ $areacontent = $dictioline->description;
+ $textareas = explode(XPLURAL,$dictioline->description);
+ $firstcontent = $textareas[0]; /* also always before js splitting*/
+ } else {
+ $areacontent = "";
+ $firstcontent = "";
+ }
+ ?>
+ <th scope="row" valign="top" align="right" width="25%"><label for="dictioline_description1">
+ <?php
+ if ($action=='edit' && $dictioline->parent == 0) {
+ _e('Full msgid (original)','xili-dictionary');
+ } elseif ($action=='edit') {
+ _e('Full msgstr (translation)','xili-dictionary');
+ } else {
+ _e('Full msg (id or str)','xili-dictionary');
+ } ?> : </label>
+ <textarea style="visibility:hidden" name="dictioline_description" id="dictioline_description" cols="12" rows="3" disabled="disabled" ><?php echo $areacontent; ?></textarea>
+ </th>
+ <td align="left">
+
+ <input type="hidden" id="termnblines" name="termnblines" value="1" />
+
+ <div id="input1" style="margin-bottom:4px;" class="clonedInput">
+ <p id="areatitle1"><?php _e('Singular text','xili-dictionary'); ?></p>
+ <textarea style="visibility:visible" class="plural" name="dictioline_description1" id="dictioline_description1" cols="50" rows="3" <?php echo $noedit; ?> ><?php echo $firstcontent; ?></textarea>
+
+ </div>
+ <?php if ($action != 'delete') { ?>
+ <div>
+ <span style="display:block; float:right; width:60%"><small> <?php _e('Use only plural terms if theme contains _n() functions','xili-dictionary') ?></small></span>
+ <input type="button" id="btnAdd" value="<?php _e('Add a plural','xili-dictionary') ?>" />
+ <input type="button" id="btnDel" value="<?php _e('Delete a plural','xili-dictionary') ?>" />
+
+ </div>
+ <?php } ?>
+ </td>
+
+ </tr>
+ <tr class="form-field">
+ <th scope="row" valign="top" align="right"><label for="dictioline_lang"><?php _e('Language','xili-dictionary') ?></label> : </th>
+ <td>
+ <select name="dictioline_lang" id="dictioline_lang" <?php echo $noedit.$noedited;?> >
+ <option value="" <?php if ($extend == '') { ?> selected="selected"<?php } ?>>
+ <?php _e('default','xili-dictionary'); ?></option>
+ <?php $listlanguages = get_terms(TAXONAME, array('hide_empty' => false,'slug' => $curlang));
+ if (is_wp_error($listlanguages) || empty($listlanguages)) {
+ $langs_array = $this->xili_settings[XDDICTLANGS];
+ foreach ($langs_array as $lkey => $reflanguage) {
+ echo '<option value="'.$reflanguage[0].'"';
+ if ($extend == strtolower($reflanguage[0])) {
+ echo ' selected="selected"';
+ }
+ echo ">".__($reflanguage[1],'xili-dictionary').'</option>';
+ }
+
+ } else {
+ foreach ($listlanguages as $reflanguage) {
+ echo '<option value="'.$reflanguage->slug.'"';
+ if ($extend == $reflanguage->slug) {
+ echo ' selected="selected"';
+ }
+ echo ">".__($reflanguage->description,'xili-dictionary').'</option>';
+
+ }
+ }
+ ?>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row" valign="top" align="right"><label for="dictioline_slug"><?php _e('Term slug','xili-dictionary') ?></label> : </th>
+ <td><input name="dictioline_slug" id="dictioline_slug" type="text" readonly="readonly" value="<?php echo attribute_escape($dictioline->slug); ?>" size="40" <?php echo $noedit; ?> /></td>
+ </tr>
+ <tr class="form-field">
+ <th scope="row" valign="top" align="right"><label for="dictioline_parent"><?php _e('Relationship (msgid)','xili-dictionary') ?></label> : </th>
+ <td>
+ <fieldset style="margin:2px; padding:10px 5px; border:1px solid #ccc;"><legend><?php
+ if ($action=='edit' || $action=='delete') {
+ if ($dictioline->parent == 0) {
+ _e('Original','xili-dictionary');
+ } else {
+ _e('Translation','xili-dictionary');
+ }
+ } else {
+ _e('Original or translation','xili-dictionary');
+ }
+ ?></legend>
+ <?php $this->xili_select_row($term_id,$dictioline); /* choice of parent line */?>
+ </fielset>
+ </td>
+ </tr>
+ <tr>
+ <th scope="row" valign="top" align="right"><label for="alias_of"><?php _e('Alias of','xili-dictionary') ?></label> : </th>
+ <td><input name="alias_of" id="alias_of" type="text" value="" size="40" <?php echo $noedit; ?> /></td>
+ </tr>
+ <?php if ($action=='edit') { ?>
+ <tr>
+ <th scope="row" valign="top" align="right" style="color:#eee;"><label for="dictioline_name"><?php _e('Text') ?> : </label></th>
+ <td style="color:#eee;"><?php echo attribute_escape($dictioline->name); ?></td>
+ </tr>
+ <?php } ?>
+ <tr>
+ <th><input class="button-primary" type="submit" name="submit" value="<?php echo $submit_text ?>" /></th>
+ <td>
+ <p class="submit"><input class="button" type="submit" name="reset" value="<?php echo $cancel_text ?>" /></p>
+ </td>
+ </tr>
+ </table></div>
+ <?php
+ if ($action=='edit' || $action=='delete') { ?>
+ <input type="hidden" name="dictioline_term_id" value="<?php echo $dictioline->term_id ?>" />
+ <?php }
+ if ($action=='edit') { ?>
+ <input type="hidden" name="dictioline_name" id="dictioline_name" value="<?php echo attribute_escape($dictioline->name); ?>" />
+ <?php }
+ }
+ }
+ /** * @updated 1.0.2 * manage files */
+ function on_normal_3_content($data) { ?>
+ <h4 id="manage_file"><?php _e('The files','xili-dictionary') ;?></h4>
+ <?php
+ switch ($this->xililanguage) {
+ case 'neveractive';
+ echo '<p>'._e('xili-language plugin is not present !','xili-dictionary').'</p>';
+ break;
+ case 'wasactive';
+ echo '<p>'._e('xili-language plugin is not activated !','xili-dictionary').'</p><br />';
+ break;
+ }
+ $linkstyle = "text-decoration:none; text-align:center; display:block; width:70%; margin:0px 1px 1px 30px; padding:4px 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px;" ;
+ $linkstyle3 = "text-decoration:none; text-align:center; display:inline-block; width:16%; margin:0px 1px 1px 10px; padding:4px 3px; -moz-border-radius: 3px; -webkit-border-radius: 3px; border:1px #ccc solid;" ;
+ $linkstyle1 = $linkstyle." border:1px #33f solid;";
+ $linkstyle2 = $linkstyle." border:1px #ccc solid;";
+ ?>
+ <a style="<?php echo $linkstyle1 ; ?>" href="?action=export&page=dictionary_page" title="<?php _e('Create or Update mo file in current theme folder','xili-dictionary') ?>"><?php _e('Export mo file','xili-dictionary') ?></a>
+ <br /><?php _e('Import po/mo file','xili-dictionary') ?>:<a style="<?php echo $linkstyle3 ; ?>" href="?action=import&page=dictionary_page" title="<?php _e('Import an existing .po file from current theme folder','xili-dictionary') ?>">PO</a>
+ <a style="<?php echo $linkstyle3 ; ?>" href="?action=importmo&page=dictionary_page" title="<?php _e('Import an existing .mo file from current theme folder','xili-dictionary') ?>">MO</a><br />
+ <br /><a style="<?php echo $linkstyle2 ; ?>" href="?action=exportpo&page=dictionary_page" title="<?php _e('Create or Update po file in current theme folder','xili-dictionary') ?>"><?php _e('Export po file','xili-dictionary') ?></a>
+ <h4 id="manage_categories"><?php _e('The categories','xili-dictionary') ;?></h4>
+ <a style="<?php echo $linkstyle2 ; ?>" href="?action=importcats&page=dictionary_page" title="<?php _e('Import name and description of categories','xili-dictionary') ?>"><?php _e('Import terms of categories','xili-dictionary') ?></a>
+ <h4 id="manage_dictionary"><?php _e('Dictionary','xili-dictionary') ;?></h4>
+ <a style="<?php echo $linkstyle2 ; ?>" href="?action=erasedictionary&page=dictionary_page" title="<?php _e('Erase all terms of dictionary ! (but not .mo or .po files)','xili-dictionary') ?>"><?php _e('Erase all terms','xili-dictionary') ?></a>
+ <br /><a style="<?php echo $linkstyle2 ; ?>" href="?action=importcurthemeterms&page=dictionary_page" title="<?php _e('Import all terms from current theme files - alpha test -','xili-dictionary') ?>"><?php _e('Import all terms from current theme','xili-dictionary') ?></a>
+
+ <?php
+ }
+ /** * @since 090423 - */
+ function on_normal_4_content($data=array()) {
+ extract($data);
+ ?>
+ <fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"><legend><?php _e('Sub list of terms','xili-dictionary'); ?></legend>
+ <label for="tagsnamelike"><?php _e('Starting with:','xili-dictionary') ?></label>
+ <input name="tagsnamelike" id="tagsnamelike" type="text" value="<?php echo $tagsnamelike; ?>" /><br />
+ <label for="tagsnamesearch"><?php _e('Containing:','xili-dictionary') ?></label>
+ <input name="tagsnamesearch" id="tagsnamesearch" type="text" value="<?php echo $tagsnamesearch; ?>" />
+ <p class="submit"><input type="submit" id="tagssublist" name="tagssublist" value="<?php _e('Sub select…','xili-dictionary'); ?>" /> <input type="submit" id="notagssublist" name="notagssublist" value="<?php _e('No select…','xili-dictionary'); ?>" /></p>
+ </fieldset>
+
+ <fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"><legend><?php _e('Selection by language','xili-dictionary'); ?></legend>
+ <select name="tagsgroup_parent_select" id="tagsgroup_parent_select" style="width:100%;">
+ <option value="no_select" ><?php _e('No sub-selection','xili-dictionary'); ?></option>
+ <?php $checked = ($this->subselect == "msgid") ? 'selected="selected"' :'' ;
+ echo '<option value="msgid" '.$checked.' >'.__('Only MsgID (en_US)','xili-dictionary').'</option>';
+ echo $this->build_grouplist();
+ ?>
+ </select>
+ <br /> <p class="submit"><input type="submit" id="subselection" name="subselection" value="<?php _e('Sub select…','xili-dictionary'); ?>" /></p>
+ </fieldset>
+ <?php
+ }
+ /** * @since 1.0.2 * only if xili-language plugin is absent */
+ function on_normal_5_content($data=array()) {
+ extract($data);
+ ?>
+ <fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"><legend><?php _e('Language to delete','xili-dictionary'); ?></legend>
+ <p><?php _e('Only the languages list is here modified (but not the dictionary\'s contents)','xili-dictionary'); ?></p>
+ <select name="langs_list" id="langs_list" style="width:100%;">
+ <option value="no_select" ><?php _e('Select...','xili-dictionary'); ?></option>
+ <?php echo $this->build_grouplist('');
+ ?>
+ </select>
+ <br />
+ <p class="submit"><input type="submit" id="lang_delete" name="lang_delete" value="<?php _e('Delete a language','xili-dictionary'); ?>" /></p></fieldset><br />
+ <fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"><legend><?php _e('Language to add','xili-dictionary'); ?></legend>
+ <label for="lang_ISO"><?php _e('ISO (xx_YY)','xili-dictionary') ?></label>:
+ <input name="lang_ISO" id="lang_ISO" type="text" value="" size="5"/><br />
+ <label for="lang_name"><?php _e('Name (eng.)','xili-dictionary') ?></label>:
+ <input name="lang_name" id="lang_name" type="text" value="" size="20" />
+ <br />
+ <p class="submit"><input type="submit" id="lang_add" name="lang_add" value="<?php _e('Add a language','xili-dictionary'); ?>" /></p>
+ </fieldset>
+ <?php }
+ /**
+ * build the list of group of languages for dictionary
+ *
+ * @updated 1.0.2
+ *
+ */
+ function build_grouplist ($left_line = 'Only:') {
+ if ($this->xililanguage == 'isactive') {
+ $listdictlanguages = get_terms(XDDICTLANGS, array('hide_empty' => false));
+ foreach($listdictlanguages as $dictlanguage) {
+ $checked = ($this->subselect == $dictlanguage->slug) ? 'selected="selected"' :'' ;
+ $optionlist .= '<option value="'.$dictlanguage->slug.'" '.$checked.' >'.__('Only:','xili-dictionary').' '.$dictlanguage->name.'</option>';
+ }
+ } else {
+ $langs_array = $this->xili_settings[XDDICTLANGS];
+ foreach ($langs_array as $lkey => $dictlanguage) {
+ $checked = ($this->subselect == $lkey) ? 'selected="selected"' :'' ;
+ $optionlist .= '<option value="'.$lkey.'" '.$checked.' >'.__($left_line,'xili-dictionary').' '.$dictlanguage[0].'</option>';
+ }
+ }
+ return $optionlist;
+ }
+ /**
+ * @since 0.9.9
+ *
+ *
+ */
+ function test_and_create_slug($description, $slug, $lang='') {
+ $slug = sanitize_title(str_replace(' ','_',$slug));
+ //echo $slug;
+ $found = is_term($slug,DTAXONAME);
+ if ($found){
+ /* compare description*/
+ $found_term = get_term($found['term_id'],DTAXONAME);
+ if ($found_term->description == $description) {
+ return $slug;
+ } else {
+ if ( '' == $lang) {
+ //echo 'nul';
+ $slug = $slug.'z';
+ return $this->test_and_create_slug($description, $slug, $lang);
+ } else {
+ //echo $slug;
+ $theslug = str_replace('_'.$lang,'',$slug);
+ $theslug = $theslug.'z'.'_'.$lang; /* risk the parent term cannot be created after */
+ return $this->test_and_create_slug($description, $theslug, $lang);
+ }
+ }
+ } else {
+ //echo 'pas nul';
+ return $slug;
+ }
+ }
+ /** * @since 1.0.0 */
+ function xili_dic_update_term($term, $taxonomy, $args) {
+ remove_filter('pre_term_description', 'wp_filter_kses'); /* 0.9.8.2 to allow more tag in msg str or id */
+ $rterm_id = wp_update_term( $term, $taxonomy, $args);
+ add_filter('pre_term_description', 'wp_filter_kses');
+ return $rterm_id;
+ }
+ function xili_dic_insert_term($termname, $taxonomy, $args) {
+ remove_filter('pre_term_description', 'wp_filter_kses'); /* 0.9.8.2 to allow more tag in msg str or id */
+ $rterm_id = wp_insert_term( $termname, $taxonomy, $args);
+ add_filter('pre_term_description', 'wp_filter_kses');
+ return $rterm_id;
+ }
+
+ /* Dashboard - Manage - Dictionary */
+ function xili_dictionary_settings() {
+ $formtitle = __('Add a term','xili-dictionary');
+ $formhow = " ";
+ $submit_text = __('Add »','xili-dictionary');
+ $cancel_text = __('Cancel');
+ $this->langfolder = (defined('THEME_LANGS_FOLDER') && THEME_LANGS_FOLDER !='/') ? '/'.str_replace("/","",THEME_LANGS_FOLDER).'/' : "/";
+ $tagsnamelike = $_POST['tagsnamelike'];
+ if (isset($_GET['tagsnamelike']))
+ $tagsnamelike = $_GET['tagsnamelike']; /* if link from table */
+ $tagsnamesearch = $_POST['tagsnamesearch'];
+ if (isset($_GET['tagsnamesearch']))
+ $tagsnamesearch = $_GET['tagsnamesearch'];
+
+ if (isset($_POST['reset'])) {
+ $action=$_POST['reset'];
+
+ } elseif (isset($_POST['action'])) {
+ $action=$_POST['action'];
+ }
+
+ if (isset($_GET['action'])) {
+ $action=$_GET['action'];
+ $term_id = $_GET['term_id'];
+ }
+ /* language delete or add */
+ if (isset($_POST['lang_delete'])) {
+ $action='lang_delete';
+ }
+ if (isset($_POST['lang_add'])) {
+ $action='lang_add';
+ }
+ /* sub lists */
+ if (isset($_POST['notagssublist'])) {
+ $action='notagssublist';
+ }
+
+ if (isset($_POST['tagssublist'])) {
+ $action='tagssublist';
+ }
+ if (isset($_GET['orderby'])) :
+ $orderby = $_GET['orderby'] ;
+ else :
+ $orderby = 't.term_id'; /* 0.9.8 */
+ endif;
+ if(isset($_POST['tagsgroup_parent_select']) && $_POST['tagsgroup_parent_select'] != 'no_select') {
+ $this->subselect = $_POST['tagsgroup_parent_select'];
+ } else {
+ $this->subselect = '';
+ }
+ if (isset($_GET['tagsgroup_parent_select']))
+ $this->subselect = $_GET['tagsgroup_parent_select'];
+
+ if (isset($_POST['subselection'])) {
+ $action='subselection';
+ }
+
+ $message = $action." = " ;
+ switch($action) {
+
+ case 'lang_delete';
+ $reflang = $_POST['langs_list'];
+ $wp_lang = (defined('WPLANG')) ? strtolower(WPLANG) : 'en_us';
+ if ($reflang != 'no_select' && $reflang != 'en_us' && $reflang != $wp_lang) {
+ unset($this->xili_settings[XDDICTLANGS][$reflang]);
+ update_option('xili_dictionary_settings', $this->xili_settings);
+ $message .= ' '.$reflang.' deleted';
+ } else {
+ $message .= ' nothing to delete';
+ }
+
+ $actiontype = "add";
+ break;
+
+ case 'lang_add';
+ $reflang = ('' != $_POST['lang_ISO'] ) ? $_POST['lang_ISO'] : "???";
+ $reflangname = ('' !=$_POST['lang_name']) ? $_POST['lang_name'] : $reflang;
+ if ($reflang != '???' && strlen($reflang) == 5 && substr($reflang,2,1) == '_') {
+ $lkey = strtolower($reflang);
+ $reflang = strtolower(substr($reflang,0,3)).strtoupper(substr($reflang,-2));
+ $msg = (array_key_exists($lkey, $this->xili_settings[XDDICTLANGS])) ? ' updated' : ' added';
+ $this->xili_settings[XDDICTLANGS][$lkey] = array($reflang,$reflangname);
+ update_option('xili_dictionary_settings', $this->xili_settings);
+ $message .= ' '.$reflang.$msg;
+ } else {
+ $message .= ' error ('.$reflang.') ! no add';
+ }
+
+ $actiontype = "add";
+ break;
+
+ case 'subselection';
+ $tagsnamelike = $_POST['tagsnamelike'];
+ $tagsnamesearch = $_POST['tagsnamesearch'];
+ $message .= ' selection of '.$_POST['tagsgroup_parent_select'];
+ $actiontype = "add";
+ break;
+
+ case 'notagssublist';
+ $tagsnamelike = '';
+ $tagsnamesearch = '';
+ $message .= ' no sub list of terms';
+ $actiontype = "add";
+ break;
+
+ case 'tagssublist';
+ $message .= ' sub list of terms starting with '.$_POST['tagsnamelike'];
+ $actiontype = "add";
+ break;
+
+ case 'add':
+
+ $originalortrans = $_POST['dictioline_description1'];
+ $nblines = $_POST['termnblines']; /**/
+ if ( $nblines > 1 ) {
+ for ($i = 2; $i <= $nblines; $i++) {
+ $originalortrans .= XPLURAL.$_POST['dictioline_description'.$i];
+ }
+ }
+
+ /*create the slug with term and add prefix*/
+ $possible = true;
+ if (''!=$_POST['dictioline_lang']) {
+ if ('no_parent' != $_POST['dictioline_parent'] ) {
+ $parent_id = $_POST['dictioline_parent'];
+ $parent_term = get_term($parent_id,DTAXONAME,OBJECT,'edit');
+ $sslug = $parent_term->slug.'_'.$_POST['dictioline_lang'] ;
+
+ $lang = $_POST['dictioline_lang'];
+ } else {
+ $message .= __('No parent term defined','xili-dictionary');
+ $possible = false;
+ }
+ } else {
+ $lang = '';
+ /* is content plural */
+ if (false === strpos($originalortrans,XPLURAL)) {
+ $sslug = htmlentities($originalortrans);
+
+ } else {
+ $plurals = explode (XPLURAL,$originalortrans);
+ $sslug = htmlentities($plurals[0]); /* in term slug only first*/
+ }
+ }
+ $sslug = $this->test_and_create_slug($originalortrans, $sslug, $lang);
+
+ if ($possible) {
+ $aliasof = $_POST['alias_of'];
+ $args = array('alias_of' => $aliasof, 'description' => $originalortrans, 'parent' => $_POST['dictioline_parent'], 'slug' => $sslug);
+
+ $rterm_id = $this->xili_dic_insert_term( $originalortrans, DTAXONAME, $args);
+
+ if (''!=$_POST['dictioline_lang']) {
+ if (is_wp_error($rterm_id)) {$message .= ' ---- error ---- '; $possible = false ;} else {
+ wp_set_object_terms((int) $rterm_id['term_id'], $_POST['dictioline_lang'], XDDICTLANGS,false);
+ }
+ } else {
+ if (is_wp_error($rterm_id)) { $message .= ' ---- error ---- '; $possible = false ; } else { $message .= " (". $rterm_id['term_id'] .") "; }
+ }
+ }
+ $actiontype = "add";
+ if ($possible) $message .= " - ".__('A new term was added.','xili-dictionary');
+ break;
+
+ case 'edit';
+ $actiontype = "edited";
+
+ $dictioline = get_term($term_id,DTAXONAME,OBJECT,'edit');
+ $submit_text = __('Update »','xili-dictionary');
+ $formtitle = 'Edit term';
+ $message .= " - ".__('Term to update.','xili-dictionary');
+ break;
+
+ case 'edited';
+ $actiontype = "add";
+ $term = $_POST['dictioline_term_id'];
+ $termname = $_POST['dictioline_name'];
+ $sslug = $_POST['dictioline_slug'];
+ $originalortrans = $_POST['dictioline_description1'];
+ $nblines = $_POST['termnblines']; /**/
+ if ( $nblines > 1 ) {
+ for ($i = 2; $i <= $nblines; $i++) {
+ $originalortrans .= XPLURAL.$_POST['dictioline_description'.$i];
+ }
+ }
+
+ if (''!=$_POST['dictioline_lang']) {
+ $parent_id = $_POST['dictioline_parent'];
+ $parent_term = get_term($parent_id,DTAXONAME,OBJECT,'edit');
+ $sslug = $parent_term->slug.'_'.$_POST['dictioline_lang'] ;
+ }
+
+ $args = array('name'=>$termname, 'alias_of' => $_POST['alias_of'], 'description' => $originalortrans , 'parent' => $_POST['dictioline_parent'], 'slug' => $sslug);
+
+ $this->xili_dic_update_term($term, DTAXONAME, $args);
+
+ if (''!=$_POST['dictioline_lang']) {
+ if (is_wp_error($rterm_id)) {$message .= ' ---- error ---- ';} else {
+ wp_set_object_terms((int) $rterm_id['term_id'], $_POST['dictioline_lang'], XDDICTLANGS,false);
+ }
+ }
+ $message .= " - ".__('A term was updated.','xili-dictionary').' '.$_POST['dictioline_term_id'];
+ break;
+
+ case 'delete';
+ $actiontype = "deleting";
+ $submit_text = __('Delete »','xili-dictionary');
+ $formtitle = 'Delete term ?';
+ $dictioline = get_term($term_id,DTAXONAME,OBJECT,'edit');
+
+ $message .= " - ".__('A term to delete. CLICK MENU DICTIONARY TO CANCEL !','xili-dictionary');
+
+ break;
+
+ case 'deleting';
+ $actiontype = "add";
+ $term_id = $_POST['dictioline_term_id'];
+ wp_delete_object_term_relationships( $term_id, XDDICTLANGS );
+ wp_delete_term( $term_id, DTAXONAME, $args);
+ $message .= " - ".__('A term was deleted.','xili-dictionary');
+ $term_id = 0; /* 0.9.7.2 */
+ break;
+
+ case 'export';
+ $actiontype = "exporting";
+ $formtitle = __('Export mo file','xili-dictionary');
+ $formhow = __('To create a .mo file, choose language and click below.','xili-dictionary');
+ $submit_text = __('Export »','xili-dictionary');
+ break;
+ case 'exporting';
+ $actiontype = "add";
+ $selectlang = $_POST['language_file'];
+ if ("" != $selectlang){
+ //$this->xili_create_mo_file(strtolower($selectlang));
+ $mo = $this->from_twin_to_POMO ($selectlang);
+ if (false === $this->Save_MO_to_file ($selectlang , $mo )) {
+ $message .= ' '.sprintf(__('error during exporting in %1s.mo file.','xili-dictionary'),$selectlang);
+ } else {
+ $message .= ' '.sprintf(__('exported in %1s.mo file.','xili-dictionary'),$selectlang);
+ }
+ } else {
+ $message .= ' : error "'.$selectlang.'"';
+ }
+ break;
+
+ case 'exportpo';
+ $actiontype = "exportingpo";
+ $formtitle = __('Export po file','xili-dictionary');
+ $formhow = __('To export terms in a .po file, choose language and click below.','xili-dictionary');
+ $submit_text = __('Export »','xili-dictionary');
+ break;
+ case 'exportingpo';
+ $actiontype = "add";
+ $selectlang = $_POST['language_file'];
+ if ("" != $selectlang){
+ $po = $this->from_twin_to_POMO ($selectlang,'po');
+ //if ($this->xili_exportterms_inpo(strtolower($selectlang))) {
+ if (false === $this->Save_PO_to_file ($selectlang , $po )) {
+ $message .= ' '.sprintf(__('error during exporting in %1s.po file.','xili-dictionary'),$selectlang);
+ } else {
+ $message .= ' '.sprintf(__('exported in %1s.po file.','xili-dictionary'),$selectlang);
+ }
+ } else {
+ $message .= ' : error "'.$selectlang.'"';
+ }
+ break;
+
+ case 'import';
+ $actiontype = "importing";
+ $formtitle = __('Import po file','xili-dictionary');
+ $formhow = __('To import terms of the current .po, choose language and click below.','xili-dictionary');
+ $submit_text = __('Import »','xili-dictionary');
+ break;
+ case 'importmo';
+ $actiontype = "importingmo";
+ $formtitle = __('Import mo file','xili-dictionary');
+ $formhow = __('To import terms of the current .mo, choose language and click below.','xili-dictionary');
+ $submit_text = __('Import »','xili-dictionary');
+ break;
+
+ case 'importing';
+ $actiontype = "add";
+ $message .= ' '.__('line imported from po file: ','xili-dictionary');
+ $selectlang = $_POST['language_file'];
+
+ $po = $this->pomo_import_PO ($selectlang); //print_r($po);
+ if (false !== $po ) $twintexts = $this->from_PO_to_twin ($po);
+
+ if (is_array($twintexts)) {
+ $nblines = $this->xili_import_in_tables($twintexts,$selectlang);
+ $message .= __('id lines = ','xili-dictionary').$nblines[0].' & ' .__('str lines = ','xili-dictionary').$nblines[1].' & ' .__('str lines up = ','xili-dictionary').$nblines[2];
+ } else {
+
+ $readfile = get_template_directory().$this->langfolder.$selectlang.'.po';
+ $message .= ' '.$readfile.__('po file is not present.','xili-dictionary');
+ }
+ break;
+
+ case 'importingmo';
+ $actiontype = "add";
+ $message .= ' '.__('line imported from mo file: ','xili-dictionary');
+ $selectlang = $_POST['language_file'];
+ $mo = $this->pomo_import_MO ($selectlang);
+ if (false !== $mo ) $twintexts = $this->from_MO_to_twin ($mo);
+ if (is_array($twintexts)) {
+ $nblines = $this->xili_import_in_tables($twintexts,$selectlang);
+ $message .= __('id lines = ','xili-dictionary').$nblines[0].' & ' .__('str lines = ','xili-dictionary').$nblines[1].' & ' .__('str lines up = ','xili-dictionary').$nblines[2];
+ } else {
+ $readfile = get_template_directory().$this->langfolder.$selectlang.'.mo';
+ $message .= ' '.$readfile.__('mo file is not present.','xili-dictionary');
+ }
+ break;
+
+ case 'importcats';
+ $actiontype = "importingcats";
+ $formtitle = __('Import terms of categories','xili-dictionary');
+ $formhow = __('To import terms of the current categories, click below.','xili-dictionary');
+ $submit_text = __('Import category’s terms »','xili-dictionary');
+ break;
+
+ case 'importingcats';
+ $actiontype = "add";
+ $message .= ' '.__('terms imported from WP: ','xili-dictionary');
+
+ $catterms = $this->xili_read_catsterms();
+
+ if (is_array($catterms)) {
+ $nbterms = $this->xili_importcatsterms_in_tables($catterms);
+ $message .= __('names = ','xili-dictionary').$nbterms[0].' & ' .__('descs = ','xili-dictionary').$nbterms[1];
+ } else {
+ $message .= ' '.$readfile.__('category’terms pbs!','xili-dictionary');
+ }
+ break;
+ case 'erasedictionary';
+ $actiontype = "erasingdictionary";
+ $formtitle = __('Erase all terms','xili-dictionary');
+ $formhow = __('To erase terms of the dictionary, click below. (before, create a .po if necessary!)');
+ $submit_text = __('Erase all terms »','xili-dictionary');
+ break;
+ case 'erasingdictionary';
+ $actiontype = "add";
+ $message .= ' '.__('All terms erased !','xili-dictionary');
+ $listdictiolines = get_terms(DTAXONAME, array('hide_empty' => false));
+ if (!empty($listdictiolines)) {
+ foreach ($listdictiolines as $dictioline) {
+ wp_delete_object_term_relationships( $dictioline->term_id, XDDICTLANGS );
+ wp_delete_term($dictioline->term_id, DTAXONAME, $args);
+ }
+ $dictioline = null;
+ }
+ break;
+ case 'importcurthemeterms';
+ $actiontype = "importingcurthemeterms";
+ $formtitle = __('Import all terms from current theme','xili-dictionary');
+ $formhow = __('To import terms of the current theme, click below.','xili-dictionary');
+ $submit_text = __('Import all terms »','xili-dictionary');
+
+ $this->tempoutput = '<strong>'.__('List of scanned files:','xili-dictionary').'</strong><br />';
+ $themeterms = $this->scan_import_theme_terms(array(&$this,'build_scanned_files'),2);
+ $formhow = $this->tempoutput.'<br /><br /><strong>'.$formhow .'</strong>';
+
+ break;
+
+ case 'importingcurthemeterms';
+ $actiontype = "add";
+ $message .= ' '.__('All terms imported !','xili-dictionary');
+ $themeterms = $this->scan_import_theme_terms(array(&$this,'build_scanned_files'),0);
+ if (is_array($themeterms)) {
+ $nbterms = $this->xili_importthemeterms_in_tables($themeterms);
+ $message .= __('terms = ','xili-dictionary').$nbterms;
+ } else {
+ $message .= ' '.$readfile.__('theme’s terms pbs!','xili-dictionary');
+ }
+ break;
+ case 'reset';
+ $actiontype = "add";
+ break;
+ default:
+ $actiontype = "add";
+ $message .= ' '.__('Find above the list of terms.','xili-dictionary');
+
+ }
+ /* register the main boxes always available */
+
+ add_meta_box('xili-dictionary-sidebox-3', __('Import & export','xili-dictionary'), array(&$this,'on_normal_3_content'), $this->thehook , 'side', 'core'); /* files */
+ add_meta_box('xili-dictionary-sidebox-4', __('Terms list management','xili-dictionary'), array(&$this,'on_normal_4_content'), $this->thehook , 'side', 'core'); /* files */
+ if ($this->xililanguage != 'isactive')
+ add_meta_box('xili-dictionary-sidebox-5', __('Languages list management','xili-dictionary'), array(&$this,'on_normal_5_content'), $this->thehook , 'side', 'core'); /* Languages list when xili-language is absent */
+
+ add_meta_box('xili-dictionary-normal-2', __('Multilingual Terms','xili-dictionary'), array(&$this,'on_normal_1_content'), $this->thehook , 'normal', 'core'); /* list of terms*/
+ add_meta_box('xili-dictionary-normal-1', __($formtitle,'xili-dictionary'), array(&$this,'on_normal_2_content'), $this->thehook , 'normal', 'core'); /* input form */
+
+
+ /* form datas in array for do_meta_boxes() */
+ $data = array('message'=>$message,'messagepost'=>$messagepost,'action'=>$action, 'formtitle'=>$formtitle, 'dictioline'=>$dictioline,'submit_text'=>$submit_text,'cancel_text'=>$cancel_text, 'formhow'=>$formhow, 'orderby'=>$orderby,'term_id'=>$term_id, 'tagsnamesearch'=>$tagsnamesearch, 'tagsnamelike'=>$tagsnamelike);
+ ?>
+ <div id="xili-dictionary-settings" class="wrap" style="min-width:850px">
+ <?php screen_icon('tools'); ?>
+ <h2><?php _e('Dictionary','xili-dictionary') ?></h2>
+ <form name="add" id="add" method="post" action="tools.php?page=dictionary_page">
+ <input type="hidden" name="action" value="<?php echo $actiontype ?>" />
+ <?php wp_nonce_field('xili-dictionary-settings'); ?>
+ <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
+ <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false );
+ /* 0.9.6 add has-right-sidebar for next wp 2.8*/ ?>
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
+ <div id="side-info-column" class="inner-sidebar">
+ <?php do_meta_boxes($this->thehook, 'side', $data); ?>
+ </div>
+ <div id="post-body" class="has-sidebar has-right-sidebar">
+ <div id="post-body-content" class="has-sidebar-content" style="min-width:360px">
+
+ <?php do_meta_boxes($this->thehook, 'normal', $data); ?>
+ </div>
+
+ <h4><a href="http://dev.xiligroup.com/xili-dictionary" title="Plugin page and docs" target="_blank" style="text-decoration:none" ><img style="vertical-align:middle" src="<?php echo WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__)).'/xilidico-logo-32.gif'; ?>" alt="xili-dictionary logo"/> xili-dictionary</a> - © <a href="http://dev.xiligroup.com" target="_blank" title="<?php _e('Author'); ?>" >xiligroup.com</a>™ - msc 2007-9 - v. <?php echo XILIDICTIONARY_VER; ?></h4>
+
+ </div>
+ </div>
+ </form>
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+ jQuery(document).ready( function($) {
+ // close postboxes that should be closed
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
+ // postboxes setup
+ postboxes.add_postbox_toggles('<?php echo $this->thehook; ?>');
+ });
+ //]]>
+ </script>
+ <?php //end settings div
+ }
+
+ /** * private function for admin page : select of parents */
+ function xili_select_row($term_id=0,$editterm,$listby='name') {
+ // select all terms if current term is new
+ if ($term_id == 0) {
+ $listterms = get_terms(DTAXONAME, array('hide_empty' => false,'parent' => '0'));
+ echo '<small>'.__('Choose the original term (msgid) to translate','xili-dictionary').'<br /></small>'; ?>
+ <select name="dictioline_parent" id="dictioline_parent" style="width:100%;">
+ <option value="no_parent" ><?php _e('no parent (= msgid)','xili-dictionary'); ?></option>
+ <?php
+ foreach ($listterms as $curterm) {
+ echo '<option value="'.$curterm->term_id.'" >'.substr($curterm->slug,0,50).' ('.$curterm->term_id.') </option>';
+ }
+ ?>
+ </select>
+ <br />
+ <?php
+ } else {
+
+ if ($editterm->parent == 0) {
+ $listterms = get_terms(DTAXONAME, array('hide_empty' => false,'parent' => $term_id));
+ // display childs
+ if (!empty($listterms)) {
+ echo '<small>'.__('translated as','xili-dictionary').": </small>";
+ echo '<ul>';
+ foreach ($listterms as $curterm) {
+ $edit = "<a href='?action=edit&page=dictionary_page&term_id=".$curterm->term_id."' >".__( 'Edit' )."</a>";
+ echo '<li value="'.$curterm->term_id.'" >'.$this->display_singular_or_plural ($curterm->description, true).' <small>'.$edit.'</small></li>';
+ }
+ echo '</ul>';
+ } else {
+ echo __('not yet translated','xili-dictionary')."<br /><br />";
+ }
+ } else {
+ echo '<small>'.__('translation of','xili-dictionary').": </small>";
+ $edit = "<a href='?action=edit&page=dictionary_page&term_id=".$editterm->parent."' >".__( 'Edit' )."</a>";
+ $parent_term = get_term($editterm->parent,DTAXONAME,OBJECT,'edit');
+ echo $this->display_singular_or_plural ($parent_term->description, true).' <small>'.$edit.'</small>'; ?>
+ <input type="hidden" name="dictioline_parent" value="<?php echo $parent_term->term_id ?>" />
+ <?php }
+ }
+ }
+ /** * private function for admin page : one line of taxonomy */
+
+ function xili_dict_row($listby='name',$tagsnamelike='',$tagsnamesearch='') {
+ global $default_lang;
+ /*list of dictiolines*/
+
+ if ($this->subselect == 'msgid' || $this->subselect == '') {
+ $parentselect = '';
+ if ($this->subselect == 'msgid') $parentselect = '0';
+ $listdictiolines = get_terms(DTAXONAME, array('hide_empty' => false,'orderby' => $listby,'get'=>'all','name__like'=>$tagsnamelike,'search'=>$tagsnamesearch, 'parent'=>$parentselect));
+ } else {
+ /* */
+ $group = is_term($this->subselect,XDDICTLANGS);
+ $listdictiolines = get_terms_of_groups(array($group['term_id']),XDDICTLANGS,DTAXONAME, array('hide_empty' => false,'orderby' => $listby,'get'=>'all','name__like'=>$tagsnamelike,'search'=>$tagsnamesearch));
+ }
+ if (empty($listdictiolines) && $tagsnamelike=='' && $tagsnamesearch=='') : /*create a default line with the default language (as in config)*/
+ $term = 'term';
+ $args = array( 'alias_of' => '', 'description' => "term", 'parent' => 0, 'slug' =>'');
+ wp_insert_term( $term, DTAXONAME, $args);
+ $listdictiolines = get_terms(DTAXONAME, array('hide_empty' => false));
+ endif;
+ if (empty($listdictiolines)) {
+ echo '<p>'.__('try another sub-selection !','xili-dictionary').'</p>';
+ } else {
+ $subselect = (($tagsnamelike=='') ? '' : '&tagsnamelike='.$tagsnamelike);
+ $subselect .= (($tagsnamesearch=='') ? '' : '&tagsnamesearch='.$tagsnamesearch);
+
+ foreach ($listdictiolines as $dictioline) {
+
+ $class = (( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";
+
+ $dictioline->count = number_format_i18n( $dictioline->count );
+ $posts_count = ( $dictioline->count > 0 ) ? "<a href='edit.php?lang=$dictioline->term_id'>$dictioline->count</a>" : $dictioline->count;
+
+ $edit = "<a href='?action=edit&page=dictionary_page".$subselect."&term_id=".$dictioline->term_id."' >".__( 'Edit' )."</a></td>";
+ /* delete link */
+ $edit .= "<td><a href='?action=delete&page=dictionary_page".$subselect."&term_id=".$dictioline->term_id."' class='delete'>".__( 'Delete' )."</a>";
+ /* modify to allow all html tags in msg str or id - 0.9.8.2*/
+ $line="<tr id='cat-$dictioline->term_id'$class>
+ <th scope='row' style='text-align: center'>$dictioline->term_id</th>
+
+ <td>".$this->display_singular_or_plural($dictioline->description)."</td>
+
+ <td>".$dictioline->slug."</td>
+ <td align='center'>$dictioline->term_group</td>
+
+ <td>$edit</td>\n\t</tr>\n"; /*to complete*/
+ echo $line;
+ }
+ }
+ }
+ function display_singular_or_plural ($msg, $onlyfirst = false) {
+ if (false === strpos($msg,XPLURAL)) {
+ return wp_filter_kses($msg);
+ } else {
+ $list = explode (XPLURAL,$msg);
+ if ($onlyfirst === false) {
+ $list = array_map('wp_filter_kses',$list);
+ return implode('<br />',$list);
+ } else {
+ return wp_filter_kses($list[0]);
+ }
+ }
+ }
+ /**
+ * Import PO file in class PO
+ *
+ *
+ * @since 1.0 - only WP >= 2.8.4
+ */
+ function pomo_import_PO ($lang = "") {
+ $po = new PO();
+ $pofile = get_template_directory().$this->langfolder.$lang.'.po';
+ if ( !$po->import_from_file( $pofile ) ) {
+ return false;
+ } else {
+ return $po;
+ }
+ }
+ /**
+ * the PO object to twinlines (msgid - msgstr) for list
+ *
+ *
+ * @since 1.0 - only WP >= 2.8.4
+ */
+ function from_PO_to_twin ($po) {
+ $twinlines = array();
+ foreach ($po->entries as $pomsgid => $pomsgstr) {
+ if ($pomsgstr->is_plural == null) {
+ $twinlines[$pomsgid] = $pomsgstr->translations[0];
+ } else {
+ $keytwin = $pomsgstr->singular.XPLURAL.$pomsgstr->plural;
+ $twinlines[$keytwin] = implode (XPLURAL, $pomsgstr->translations);
+ }
+
+ }
+ //print_r($twinlines);
+ return $twinlines;
+ }
+ /**
+ * Import MO file in class PO
+ *
+ *
+ * @since 1.0.2 - only WP >= 2.8.4
+ */
+ function pomo_import_MO ($lang = "") {
+ $mo = new MO();
+ $mofile = get_template_directory().$this->langfolder.$lang.'.mo';
+ if ( !$mo->import_from_file( $mofile ) ) {
+ return false;
+ } else {
+ return $mo;
+ }
+ }
+ /**
+ * the MO object to twinlines (msgid - msgstr) for list
+ *
+ *
+ * @since 1.0.2 - only WP >= 2.8.4
+ */
+ function from_MO_to_twin ($mo) {
+ $twinlines = array();
+ foreach ($mo->entries as $pomsgid => $pomsgstr) {
+ if ($pomsgstr->is_plural == null) {
+ $twinlines[$pomsgid] = $pomsgstr->translations[0];
+ } else {
+ $keytwin = $pomsgstr->singular.XPLURAL.$pomsgstr->plural;
+ $twinlines[$keytwin] = implode (XPLURAL, $pomsgstr->translations);
+ }
+
+ }
+ //print_r($twinlines);
+ return $twinlines;
+ }
+
+ /**
+ * convert twinlines (msgid - msgstr) to MO
+ *
+ *
+ * @since 1.0 - only WP >= 2.8.4
+ */
+ function from_twin_to_POMO ($curlang, $obj='mo') {
+ global $user_identity,$user_url,$user_email;
+ if ($obj == 'mo') {
+ $mo = new MO(); /* par default */
+ } else {
+ $mo = new PO();
+ }
+ /* header */
+ $translation ='
+ Project-Id-Version: theme: '.get_option("template").'\n
+ Report-Msgid-Bugs-To: contact@xiligroup.com\n
+ POT-Creation-Date: '.date("c").'\n
+ PO-Revision-Date: '.date("c").'\n
+ Last-Translator: '.$user_identity.' <'.$user_email.'>\n
+ Language-Team: xili-dictionary WP plugin and '.$user_url.' <'.$user_email.'>\n
+ MIME-Version: 1.0\n
+ Content-Type: text/plain; charset=utf-8\n
+ Content-Transfer-Encoding: 8bit\n
+ Plural-Forms: '.$this->plural_forms_rule($curlang).'\n
+ X-Poedit-Language: '.$curlang.'\n
+ X-Poedit-Country: '.$curlang.'\n
+ X-Poedit-SourceCharset: utf-8\n';
+
+ $mo->set_headers($mo->make_headers($translation));
+ /* entries */
+ $listterms = get_terms(DTAXONAME, array('hide_empty' => false,'parent' => '')); //print_r($listterms);
+ foreach ($listterms as $curterm) {
+ if ($curterm->parent == 0) {
+ /* select child to create translated term */
+ $listchildterms = get_terms(DTAXONAME, array('hide_empty' => false,'parent' => $curterm->term_id));
+ $noentry = true; /* to create po with empty translation */
+ foreach ($listchildterms as $curchildterm) {
+ if (substr($curchildterm->slug,-5) == strtolower($curlang)) {
+ if ($obj == 'mo') {
+ if (false === strpos($curterm->description,XPLURAL)) {
+ $mo->add_entry($mo->make_entry($curterm->description, $curchildterm->description));
+ } else {
+ $msgidplural = explode(XPLURAL,$curterm->description);
+ $original = implode(chr(0),$msgidplural);
+ $msgstrplural = explode(XPLURAL,$curchildterm->description);
+ $translation = implode(chr(0),$msgstrplural);
+
+ $mo->add_entry($mo->make_entry($original, $translation));
+ }
+ } else { /* po */
+ if (false === strpos($curterm->description,XPLURAL)) {
+ $entry = & new Translation_Entry(array('singular'=>$curterm->description,'translations'=> explode(XPLURAL, $curchildterm->description)));
+ } else {
+ $msgidplural = explode(XPLURAL,$curterm->description);
+ $msgstrplural = explode(XPLURAL,$curchildterm->description);
+ $entry = & new Translation_Entry(array('singular' => $msgidplural[0],'plural' => $msgidplural[1], 'is_plural' =>1, 'translations' => $msgstrplural));
+ }
+ $mo->add_entry($entry);
+ $noentry = false;
+ }
+ }
+ }
+ /* to create po with empty translations */
+ if ($obj == 'po' && $noentry == true) {
+ $entry = & new Translation_Entry(array('singular'=>$curterm->description,'translations'=> ""));
+ $mo->add_entry($entry);
+ }
+ }
+ }
+ //print_r ($mo);
+ return $mo;
+ }
+
+ /**
+ * Save MO object to file
+ *
+ *
+ * @since 1.0 - only WP >= 2.8.4
+ */
+ function Save_MO_to_file ($curlang , $mo ) {
+ $filename = substr($curlang,0,3).strtoupper(substr($curlang,-2));
+ $filename .= '.mo';
+ $createfile = get_template_directory().$this->langfolder.$filename;
+ if (false === $mo->export_to_file($createfile)) return false;
+ }
+
+ /**
+ * Save PO object to file
+ *
+ *
+ * @since 1.0 - only WP >= 2.8.4
+ */
+ function Save_PO_to_file ($curlang , $po ) {
+ $filename = substr($curlang,0,3).strtoupper(substr($curlang,-2));
+ $filename .= '.po';
+ $createfile = get_template_directory().$this->langfolder.$filename;
+ //print_r($po);
+ if (false === $po->export_to_file($createfile)) return false;
+ }
+ /**
+ * thanks to http://urbangiraffe.com/articles/translating-wordpress-themes-and-plugins/2/#plural_forms
+ * @since 1.0 - only WP >= 2.8
+ */
+ function plural_forms_rule($curlang) {
+ $curlang = substr($curlang,0,3).strtoupper(substr($curlang,-2));
+ $rulesarrays = array(
+ 'nplurals=1; plural=0' => array('tr_TR','ja_JA'),
+ 'nplurals=2; plural=1' => array('zh_ZH'),
+ 'nplurals=2; plural=n != 1' => array('en_US','en_UK','es_ES','da_DA'),
+ 'nplurals=2; plural=n>1' => array('fr_FR','fr_CA','fr_BE','pt_BR'),
+ 'nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n != 0 ? 1 : 2' => array('lv_LV'),
+ 'nplurals=3; plural=n==1 ? 0 : n==2 ? 1 : 2' => array('gd_GD'),
+ 'nplurals=3; plural=n%10==1 && n%100!=11 ? 0 : n%10>=2 && (n%100<10 || n%100>=20) ? 1 : 2' => array('lt_LT'),
+ 'nplurals=3; plural=n%100/10==1 ? 2 : n%10==1 ? 0 : (n+9)%10>3 ? 2 : 1' => array('hr_HR','cs_CS','ru_RU','uk_UK'),
+ 'nplurals=3; plural=(n==1) ? 1 : (n>=2 && n<=4) ? 2 : 0' => array('sk_SK'),
+ 'nplurals=3; plural=n==1 ? 0 : n%10>=2 && n%10<=4 && (n%100<10 || n%100>=20) ? 1 : 2' => array('pl_PL'),
+ 'nplurals=4; plural=n%100==1 ? 0 : n%100==2 ? 1 : n%100==3 || n%100==4 ? 2 : 3' => array('sl_SL')
+ );
+ foreach ($rulesarrays as $rule => $langs) {
+ if (in_array($curlang, $langs)) return $rule;
+ }
+ return 'nplurals=2; plural=n != 1'; /* english and most... */
+ }
+
+ /*
+ * import array of twintexts in terms tables
+ *
+ * @since 0.9.0
+ * @updated 0.9.7 to set in langs group
+ * @updated 1.0.0 to manage plural
+ *
+ * @param array of msgid/msgstr, language (xx_XX)
+ *
+ */
+ function xili_import_in_tables($twintexts=Array(),$translang) {
+ $nbline = 0;
+ $nbtline = 0;
+ foreach ($twintexts as $key => $line) {
+
+ /* is content plural */
+ if (false === strpos($key,XPLURAL)) {
+ $thekey = htmlentities($key);
+ } else {
+ $plurals = explode (XPLURAL,$key);
+ $thekey = htmlentities($plurals[0]); /* in term slug only first*/
+ }
+
+ // verify if origin msgid term exist
+ $cur_id = is_term($thekey, DTAXONAME);
+ if ($cur_id == 0) {
+ // create term
+ $args = array('description' => $key, 'slug'=>sanitize_title($thekey));
+ $cur_id = is_term(sanitize_title($thekey),DTAXONAME);
+ if ($cur_id == 0) {
+ $result = $this->xili_dic_insert_term(htmlentities($thekey), DTAXONAME, $args);
+ $insertid = $result['term_id'];
+ $nbline++;
+ } else {
+ $insertid = $cur_id['term_id'];
+ }
+ $parent_term = get_term($insertid,DTAXONAME,OBJECT,'edit');
+
+ /* create the translated term */
+ $sslug = $parent_term->slug.'_'.strtolower($translang);
+ $args = array('parent' => $parent_term->term_id, 'slug' => $sslug,'description' => $line);
+ $existing = get_term_by('slug', $sslug, DTAXONAME, OBJECT);
+ if ($existing == null && !is_wp_error($existing)) { /* perhaps in another lang */
+ /* msgstr don't exist */
+ /* is content plural */
+ if (false === strpos($line,XPLURAL)) {
+ $theline = htmlentities($line);
+ } else {
+ $plurals = explode (XPLURAL,$line);
+ $theline = htmlentities($plurals[0]); /* in term slug only first*/
+ }
+
+ $result = $this->xili_dic_insert_term($theline, DTAXONAME, $args);
+ if (!is_wp_error($result)) wp_set_object_terms((int) $result['term_id'], strtolower($translang), XDDICTLANGS,false);
+ $nbtline++;
+ } else {
+ /* test slug of existing term */
+ if ($line != $existing->description) {
+ $this->xili_dic_update_term($existing->term_id, DTAXONAME, $args);
+ $nbuline++;
+ }
+ }
+ } else {
+ /* echo msgid exist */
+ $parent_term = get_term($cur_id['term_id'],DTAXONAME,OBJECT,'edit');
+
+ /* verify translated term msgstr */
+ if (''!=$line) {
+
+ $sslug = $parent_term->slug.'_'.strtolower($translang);
+ $args = array('parent' => $parent_term->term_id, 'slug' => $sslug, 'description' => $line);
+ $existing = get_term_by('slug', $sslug, DTAXONAME, OBJECT);
+ if ($existing == null && !is_wp_error($existing)) {
+ /* no term msgstr */
+ /* is content plural */
+ if (false === strpos($line,XPLURAL)) {
+ $theline = htmlentities($line);
+ } else {
+ $plurals = explode (XPLURAL,$line);
+ $theline = htmlentities($plurals[0]); /* in term slug only first*/
+ }
+ $result = $this->xili_dic_insert_term($theline, DTAXONAME, $args);
+ if (!is_wp_error($result))
+ wp_set_object_terms((int) $result['term_id'], strtolower($translang), XDDICTLANGS,false);
+ $nbtline++;
+ } else {
+ /* term exists */
+ if ($line != $existing->description) {
+ $this->xili_dic_update_term($existing->term_id, DTAXONAME, $args);
+ $nbuline++;
+ }
+ }
+ } /* empty line */
+ } /* parent exist */
+ } /* loop */
+ return array($nbline,$nbtline,$nbuline); //root id lines, translated lines and updated translated lines
+ }
+
+ /* cat's terms in array (name - slug - description)*/
+ function xili_read_catsterms(){
+ $listcategories = get_terms('category', array('hide_empty' => false));
+ foreach ($listcategories as $category) {
+ $catterms[] = Array($category->name,$category->description);
+ }
+ return $catterms;
+ }
+ /* array in tables */
+ function xili_importcatsterms_in_tables($catterms= Array()){
+ $nbname = 0;
+ $nbdesc = 0;
+ foreach ($catterms as $onecat) {
+
+ $cur_id = is_term($onecat[0], DTAXONAME);
+ if ($cur_id == 0) {
+
+ $args = array('description' => $onecat[0]);
+ $result = $this->xili_dic_insert_term( $onecat[0], DTAXONAME, $args);
+ $nbname++;
+ }
+ $cur_id = is_term(htmlentities($onecat[1]), DTAXONAME);
+ if ($cur_id == 0 && ""!=$onecat[1]) {
+
+ $args = array('description' => $onecat[1]);
+ $result = $this->xili_dic_insert_term(htmlentities($onecat[1]), DTAXONAME, $args);
+ $nbdesc++;
+ }
+ }
+ return array($nbname,$nbdesc);
+ }
+
+
+ function scan_import_theme_terms($callback,$display) {
+ $path = get_template_directory();
+ $themefiles = array();
+
+ $dir_handle = @opendir($path) or die("Unable to open $path");
+
+ while ($file = readdir($dir_handle)) {
+
+ if (substr($file,0,1) == "_" || substr($file,0,1) == "." || substr($file,-4) != ".php")
+ continue;
+
+ $themefiles[] = $file;
+ }
+
+
+ closedir($dir_handle);
+
+ $resultterms = array();
+ foreach ($themefiles as $themefile) {
+
+ if( ! is_file( $path.'/'.$themefile) )
+ {
+ $dualtexts = __('error');
+ } elseif ($themefile != 'functions.php'){
+ $lines = @file( $path.'/'.$themefile);
+ $t=0;
+ foreach ($lines as $line) {
+ $i = preg_match_all("/_[_e]\('(.*)', ?'/Ui", $line, $matches,PREG_PATTERN_ORDER);
+ if ($i > 0) {
+ $resultterms = array_merge ($resultterms, $matches[1]);
+ $t += $i;
+ }
+ }
+ if ($display >= 1)
+ call_user_func($callback, $themefile, $t);
+ }
+ }
+ if ($display == 2)
+ call_user_func($callback, $themefile, $t, $resultterms);
+
+ return $resultterms;
+ }
+ function build_scanned_files ($themefile, $t, $resultterms = array()) {
+ if ($resultterms == array()) {
+ $this->tempoutput .= "- ".$themefile." (".$t.") ";
+ } else {
+ $this->tempoutput .= "<br /><strong>".__('List of found terms','xili-dictionary').": </strong><br />";
+ $this->tempoutput .= implode (', ',$resultterms);
+ }
+ }
+ /*
+ * Import theme terms array in table
+ *
+ *
+ */
+ function xili_importthemeterms_in_tables($themeterms= Array()){
+ $nbname = 0;
+
+ foreach ($themeterms as $onecat) {
+
+ $cur_id = is_term($onecat, DTAXONAME);
+ if ($cur_id == 0) {
+
+ $args = array('description' => $onecat);
+ $result = $this->xili_dic_insert_term(htmlentities($onecat), DTAXONAME, $args);
+ $nbname++;
+ }
+ }
+ return $nbname;
+ }
+ /**
+ * Recursive search of files in a path
+ * @since 1.0
+ *
+ */
+ function find_files($path, $pattern, $callback) {
+ //$path = rtrim(str_replace("\\", "/", $path), '/') . '/';
+ $matches = Array();
+ $entries = Array();
+ $dir = dir($path);
+ while (false !== ($entry = $dir->read())) {
+ $entries[] = $entry;
+ }
+ $dir->close();
+ foreach ($entries as $entry) {
+ $fullname = $path .$this->ossep. $entry;
+ if ($entry != '.' && $entry != '..' && is_dir($fullname)) {
+ $this->find_files($fullname, $pattern, $callback);
+ } else if (is_file($fullname) && preg_match($pattern, $entry)) {
+ call_user_func($callback, $path , $entry);
+ }
+ }
+ }
+ /**
+ * display lines of files in special sidebox
+ * @since 1.0
+ */
+ function available_mo_files($path , $filename) {
+ //echo $filename . " in : " . "/".str_replace("/","",str_replace(get_template_directory(),'',$path)) . "<br />";
+ echo str_replace(".mo","",$filename ). " (".$this->ossep.str_replace($this->ossep,"",str_replace(get_template_directory(),'',$path)).")<br />";
+ }
+
+} /* end of class */
+
+/**** Functions that improve taxinomy.php ****/
+
+/**
+ * get terms and add order in term's series that are in a taxonomy
+ * (not in class for general use)
+ *
+ * @since 0.9.8.2 - provided here if xili-tidy-tags plugin is not used
+ *
+ */
+if (!function_exists('get_terms_of_groups')) {
+ function get_terms_of_groups ($group_ids, $taxonomy, $taxonomy_child, $order = '') {
+ global $wpdb;
+ if ( !is_array($group_ids) )
+ $group_ids = array($group_ids);
+ $group_ids = array_map('intval', $group_ids);
+ $group_ids = implode(', ', $group_ids);
+ $theorderby = '';
+ $where = '';
+ $defaults = array('orderby' => 'term_order', 'order' => 'ASC',
+ 'hide_empty' => true, 'exclude' => '', 'exclude_tree' => '', 'include' => '',
+ 'number' => '', 'slug' => '', 'parent' => '',
+ 'name__like' => '',
+ 'pad_counts' => false, 'offset' => '', 'search' => '');
+
+ if (is_array($order)) {
+
+ $r = &$order;
+ $r = array_merge($defaults, $r);
+ extract($r);
+
+ if ($order == 'ASC' || $order == 'DESC') {
+ if ('term_order'== $orderby) {
+ $theorderby = ' ORDER BY tr.'.$orderby.' '.$order ;
+ } elseif ('count'== $orderby || 'parent'== $orderby) {
+ $theorderby = ' ORDER BY tt2.'.$orderby.' '.$order ;
+ } elseif ('term_id'== $orderby || 'name'== $orderby) {
+ $theorderby = ' ORDER BY t.'.$orderby.' '.$order ;
+ }
+ }
+
+ if ( !empty($name__like) )
+ $where .= " AND t.name LIKE '{$name__like}%'";
+
+ if ( '' != $parent ) {
+ $parent = (int) $parent;
+ $where .= " AND tt2.parent = '$parent'";
+ }
+
+ if ( $hide_empty && !$hierarchical )
+ $where .= ' AND tt2.count > 0';
+
+ if ( !empty($number) && '' == $parent ) {
+ if( $offset )
+ $limit = ' LIMIT ' . $offset . ',' . $number;
+ else
+ $limit = ' LIMIT ' . $number;
+
+ } else {
+ $limit = '';
+ }
+
+ if ( !empty($search) ) {
+ $search = like_escape($search);
+ $where .= " AND (t.name LIKE '%$search%')";
+ }
+
+ } else {
+
+ if ($order == 'ASC' || $order == 'DESC') $theorderby = ' ORDER BY tr.term_order '.$order ;
+ }
+ $query = "SELECT t.*, tt2.term_taxonomy_id, tt2.description,tt2.parent, tt2.count, tt2.taxonomy, tr.term_order FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN $wpdb->terms AS t ON t.term_id = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt2 ON tt2.term_id = tr.object_id WHERE tt.taxonomy IN ('".$taxonomy."') AND tt2.taxonomy = '".$taxonomy_child."' AND tt.term_id IN (".$group_ids.") ".$where.$theorderby.$limit;
+ //echo $query;
+ $listterms = $wpdb->get_results($query);
+ if (!$listterms)
+ return array();
+ return $listterms;
+ }
+}
+
+/**
+ * instantiation when xili-language is loaded
+ */
+function dictionary_start () {
+ global $wp_version;
+ if ($wp_version >= '2.8') $xili_dictionary = new xili_dictionary(); /* instantiation php4 for last century servers replace by =& */
+}
+add_action('plugins_loaded','dictionary_start');
+
+/* © xiligroup dev 091108 10:00 */
+
+?>
\ No newline at end of file
Binary file web/wp-content/plugins/xili-dictionary/xilidico-logo-32.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-language/readme.txt Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,313 @@
+=== xili-language ===
+Contributors: MS dev.xiligroup.com
+Donate link: http://dev.xiligroup.com/
+Tags: theme,post,plugin,posts,page,category,admin,multilingual, bilingual, taxonomy,dictionary,.mo file,.po file,localization,widget,language,international, i18n, l10n
+Requires at least: 2.7
+Tested up to: 2.9.2
+Stable tag: 1.4.1
+
+xili-language provides for a multilingual website an automatic selection of language (.mo) in theme according to the language of current post(s).
+
+== Description ==
+
+**xili-language provides for a bilingual (or multilingual) website an automatic selection of language (.mo) in theme according to the language of current post(s).**
+
+* xili-language plugin provides an automatic selection of language in theme according to the language of displayed post, series of posts, page or articles. *If the post is in gaelic, the texts of the theme will be in gaelic if the author checks the post as gaelic and if the theme contains the right .mo file for this target language.*
+* xili-language select *on the fly* the .mo files present in the theme's folder.
+* Themes with *localization* can be easily transformed for realtime multilingual sites.
+* xili-language is dedicated for theme's creator or webmaster with knowledges in CMS and WP and having (or not) tools to create .mo language files. Through API (hook), the plugin add automatic tools (or links or filters) for sidebar or top menus. Categories or Archives lists are translated also.
+* xili-language provides also series of functions which can be *hooked* in the functions.php file of the theme that you create i.e. for a multilingual cms like website.
+* With **xili-tidy-tags** [plugin here](http://wordpress.org/extend/plugins/xili-tidy-tags/), it is now possible to display sub-selection (cloud) of **tags** according language. With [xili-dictionary](http://wordpress.org/extend/plugins/xili-dictionary/) plugin (beta), it is easier to create or update online, via admin UI, the files .mo of each language.
+* xili-language plugin **does not create addition tables in the database**. xili-language simply makes proper use of the taxonomy tables and postmeta table offered by WordPress to define language and link items between them. Because xili-language plugin does not modify deeply the post edit UI, it is possible to use **iPhone / iPod Touch** Wordpress app to prepare and draft the post.
+* **Documentation**: A new [table](http://dev.xiligroup.com/?p=1432) summarizes all the technical features (widgets, template tags, functions and hooks) of this powerful plugin for personalized CMS created by webmaster.
+* Check out the [screenshots](http://wordpress.org/extend/plugins/xili-language/screenshots/) to see it in action.
+
+= 1.4.1 =
+* Browser's window title now translated for categories (`wp_title()`). Option in post edit UI to auto-search linked posts in other languages - [see this post](http://dev.xiligroup.com/?p=1498).
+* New option to adapt the home query according rules defined by chief editor. If home page loop is filled by most recent posts (via index or home.php), formerly, by default xili-language is able to choose the theme's language but not to sub-select the loop (without php coding). Now when checking in Settings *'Modify home query'* - no need to be a php developer.
+* New widget for **recent posts** (able to choose language). This new widget solves conflicts or issues occuring when WP default widget is present (contains an *obscur* `wp_reset_query`). Also a choice of language of this list of recent posts is possible - not necessary the same of the current page. And you can install multiple widgets. **Replace WP Recent Posts widget by this one named** - *List of recent posts* -
+
+= 1.3.x =
+* New functions to change and restore loop's language query-tag (see functions [table](http://dev.xiligroup.com/?p=1432) ).
+* Better dashboard post UI to create linked post (and page): *from one post, it possible to create linked post in another language and the links are prefilled. Just need to save draft to save the links between root and translated posts filled by authors.* [See](http://dev.xiligroup.com/?p=1498)
+* fixes lost languages's link when trash or untrash (WP 2.9.1).
+
+
+= summary of main features improved in previous releases up to 1.2.1 =
+
+*(this chapter is rewritten for 1.4.1 - see readme in [previous versions](http://wordpress.org/extend/plugins/xili-language/download/) to read the chronology)*
+
+
+* xili-language "*translates*" template tags and permits some variations for webmasters:
+
+The most current template tags don't need special work: `wp_list_categories()`, `wp_title()`,...
+
+`wp_get_archives`
+Possible that very special permalinks need to use hook named `xiliml_get_archives_link`. -
+Sub selection of archives for `wp_get_archives()` with &lang= [see installation notes](http://wordpress.org/extend/plugins/xili-language/installation/).
+
+`wp_list_pages()` with optional query tag &lang=
+
+* xili-language "*provides*" new template tags (or widgets) to solve issues from WP core or add new features for CMS:
+
+`xili_language_list()` - outside loop (sidebar) display the languages of the site (used also by widget)
+
+`xiliml_the_category()` - replace the_category() template tag of WP Core
+
+
+improved `xiliml_the_others_posts()` function and theme tag to be used in multilingual category loop and by option (array) to return an array of linked posts in other languages (useful for CMS webmasters) (array of lang and id ) - the id is easily transformable in permalink with function `get_permalink()` when using this array.
+
+* widget for recent comments that can subselect those for current language. (a function `xiliml_recent_comments()` is also available if you want to create a template tag with resulting objects array).
+
+* ...
+* Automatic detection of `THEME_TEXT_DOMAIN` constant and languages (.mo) sub-folder in theme's folder. More infos in Settings UI Special sidebox.
+
+= Technical infos =
+
+
+**Prerequisite: **
+Verify that your theme is international compatible (translatable terms like `_e('the term','mytheme')` and no displayed texts 'hardcoded' (example in theme 'default-i18n' of WP).
+
+* Based on class and oop - New settings UI according to new rules and style of WP 2.7 (meta_boxes, js) - *ONLY USE WITH Wordpress 2.7 and more* - Hooks (Action, Filter) usable in your functions.php.
+* Optional improving hooking ways to be compatible with l10n cache of Johan's plugin see line 2200.
+
+**CMS:**
+
+* Contains features dedicated to multilingual theme's creators and webmasters.
+**Documentation**: A new [table](http://dev.xiligroup.com/?p=1432) summarizes all the technical features (widgets, template tags, functions and hooks) of this powerful plugin for personalized CMS created by webmaster.
+
+* Some new php functions, a folder to include functions shared by themes (not necessary to put functions in functions.php of the current theme); example with a shortcode to insert link inside content toward another post in a language. A post explaining these improvements can be found [here](http://dev.xiligroup.com/?cat=480&lang=en_us).
+* Provides infos about **text direction** *ltr* ou *rtl* of languages (arabic, hebraic,...) of theme and of each post in loop see note [direction in installation](http://wordpress.org/extend/plugins/xili-language/installation/)
+* unique id for category link hook [see expert's corner posts](http://dev.xiligroup.com/?p=1045)
+* fixes unexpected like tags metabox added by WP 28 ( see [trac #10437](http://core.trac.wordpress.org/ticket/10437) ).
+* hooks to define header metas or language attributes in html tag.
+
+**More infos and docs**
+… other texts and more descriptions [here](http://dev.xiligroup.com/xili-language/ "why xili-language ?")
+
+= Compatibility =
+
+xili-language is compatible with the plugin [xili-dictionary](http://dev.xiligroup.com/?p=312 "why xili-dictionary ?") which is able to deliver .mo files on the fly with the WP admin UI (and .po files translatable by other translators). [xili-dictionary](http://dev.xiligroup.com/xili-dictionary/ "xili-dictionary posts") used a specific taxonomy without adding tables in WP database.
+
+xili-language is full compatible with the plugin [xilitheme-select](http://wordpress.org/extend/plugins/xilitheme-select/ "xilitheme-select") to be used with iPhone, iPod Touch or other mobiles.
+
+xili-language is compatible with the plugin [xili-tidy-tags](http://dev.xiligroup.com/xili-tidy-tags/ ). xili-tidy-tags lets you create multiple group of tags. That way, you can have a tag cloud for tags in English, another cloud for French tags, another for Spanish ones, and so on. You can also use the plugin for more than multilingual blogs. Basically, you can create any group of tags you want.
+
+
+
+
+More informations on the site [dev.xiligroup.com](http://dev.xiligroup.com/ "xiligroup plugins")
+
+Check out the [screenshots](http://wordpress.org/extend/plugins/xili-language/screenshots/) to see it in action.
+
+== Installation ==
+
+1. Upload the folder containing `xili-language.php` and language files to the `/wp-content/plugins/` directory,
+2. Verify that your theme is international compatible - translatable terms like `_e('the term','mytheme')` and no text hardcoded -
+3. define domain name of your theme - see note at end list below,
+4. Activate the plugin through the *'Plugins'* menu in WordPress,
+5. Go to the dashboard settings tab - language - and adapt default values if necessary by adding your languages in the catalog. You can set the order (1,2,3...) of the series. (used in `language_attributes()` template_tag).
+6. Modify each post by setting (checking) the language flag in xili-language box at the right of the post editing window before publishing.
+7. If you are webmaster and want to add lot of personalizations in your theme, visit [expert's corner](http://dev.xiligroup.com/?cat=480&lang=en_us).
+
+= SPECIAL NOTE FOR VERSION >= 1.1.9 =
+
+With the cost of 50 lines more, plugin now detect automatically (if theme is good) `the theme_text_domain` and languages (.mo) sub-folder. It not mandatory to declare the two constants (but compatible with previous settings).
+Only encapsule the `load_theme_textdomain()` like in that example for a theme named fusion:
+
+`
+if (!class_exists('xili_language')) { // class in not (!) present...
+ load_theme_textdomain('fusion', get_template_directory() . '/lang');
+}
+`
+
+= NOTE =
+In the functions php file of the theme : replace by commenting `load_theme_textdomain` line `//load_theme_textdomain('mythemename'); ` by a *define* `define('THEME_TEXTDOMAIN','mythemename'); //second text must be used in theme texts with _e( , ) or __( , )` where 'mythemename' is `'kubrik'` in default international theme.
+
+Another example with fusion theme that offer localization :
+
+replace
+
+`function init_language(){
+ load_theme_textdomain('fusion', get_template_directory() . '/lang');
+}`
+
+by
+
+`function init_language(){
+ if (class_exists('xili_language')) {
+ define('THEME_TEXTDOMAIN','fusion');
+ define('THEME_LANGS_FOLDER','/lang');
+ } else {
+ load_theme_textdomain('fusion', get_template_directory() . '/lang');
+ }
+
+}`
+
+see the [recent post](http://dev.xiligroup.com/?p=427 "Transform a theme with localization").
+
+= Browser detection for visitors or authors =
+To change the language of the frontpage according to the language of the visitor's browser, check the popup in right small box in settings.
+To change the default language of a new post according to the language of the author's browser, check the popup in right small box in settings.
+
+= text direction, since 0.9.9 =
+
+Examples *for theme's designer* of functions to keep text **direction** of theme and of current post :
+
+`
+<?php
+ $themelangdir = ((class_exists('xili_language')) ? the_cur_lang_dir() : array ()) ; ?>
+<div class="inside <?php echo $themelangdir['direction'] ?>">
+...
+
+`
+example in loop :
+`
+<?php while (have_posts()) : the_post();
+$langdir = ((class_exists('xili_language')) ? get_cur_post_lang_dir($post->ID) : array());
+?>
+ <div class="story <?php echo $langdir['direction'] ?>" >
+
+`
+minimal example in css :
+`
+.rtl {direction: rtl; text-align:right !important; font-size:130% !important;}
+.ltr {direction: ltr; text-align:left !important;}
+
+`
+**Caution** : *multilingual theme with both ltr and rtl texts needs a rigourous structure of the css !*
+
+= Archives selection =
+
+Archives tags is a very complex template tag in his background and not very easy source hookable. So we decided to add few features : by adding query in vars of the function, it will be possible to display a monthly list of archives for a selected language - `wp_get_archives('..your.vars..&lang=fr_fr')` - or the current the theme language - `wp_get_archives('..your.vars..&lang=')` -. The displayed list of links will be translated and link restrited to display only archives of this language.
+
+
+= Wordpress 2.9.2 =
+Today, xili-language is 'compatible'.
+
+== Frequently Asked Questions ==
+
+= How to see post or page ID in dashbord ? =
+
+*Reveal IDs for WP Admin* is an efficient plugin [found](http://wordpress.org/extend/plugins/reveal-ids-for-wp-admin-25/) in WP repository.
+
+= Since 1.4.1, after the translated lines, the parenthesis containing root languages *disappear* in sidebar categories list ? =
+
+Yes, only translated cat name remains. But, if you want to recover the old behaviour, you can add **graceful to hooking features of xili_language** by adding this lines of codes inside the functions.php file of the current theme.
+`
+function my_rules_for_cat_language ($content, $category = null, $curlang='') {
+ if (!is_admin()) : /*to detect admin UI*/
+ $new_cat_name = __($category->name,THEME_TEXTDOMAIN);
+ if ($new_cat_name != $content) :
+ $new_cat_name .= " (". $content .") ";
+ endif
+ else :
+ $new_cat_name = $content;
+ endif;
+ return $new_cat_name;
+ }
+add_filter('xiliml_cat_language','my_rules_for_cat_language',2,3);
+
+`
+
+
+= Where can I see websites using this plugin ? =
+
+dev.xiligroup.com [here](http://dev.xiligroup.com/?p=187 "why xili-language ?")
+and
+www.xiliphone.mobi [here](http://www.xiliphone.mobi "a theme for mobile") also usable with mobile as iPhone.
+
+And as you can see in [stats](http://wordpress.org/extend/plugins/xili-language/stats/), hundreds of sites use xili-language.
+
+= For commercial websites, is it possible to buy support ? =
+Yes, use contact form [here](http://dev.xiligroup.com/?page_id=10).
+
+= What is gold functions ?, is it possible to buy them ? =
+Some gold functions (in xilidev-libraries) are explained [here](http://dev.xiligroup.com/?p=1111) and some belong to pro services for commercial websites.
+Yes, use contact form [here](http://dev.xiligroup.com/?page_id=10).
+
+= Support Forum or contact form ? =
+
+Effectively, prefer [forum](http://forum.dev.xiligroup.com/) to obtain some support.
+
+= Does xiligroup provide free themes ? =
+
+No yet, but a lot of well designed themes like fusion or Arclite are very easily adaptable ( or the author incorporates automatic detection of xili-language as presented [here](http://dev.xiligroup.com/?p=427) ). And [xili-dictionary](http://wordpress.org/extend/plugins/xili-dictionary/) avoids to use poEdit to update .mo files with contents of terms of your database (categories, ...)
+
+== Screenshots ==
+
+1. an example of wp-content/themes folder
+2. the admin settings UI
+3. the language setting in post writting UI
+4. coding extract with 'international' text in 'xiliphone' theme
+5. xili-dictionary: Admin Tools UI - list of translated terms
+6. xili-dictionary: Admin Tools UI - functionalities windows
+7. xili-language: Admin Tools UI - set homepage and author according his browser's language.
+8. xili-tidy-tags: Admin Tools UI - see this compatible plugin to group tags according languages
+9. xili-language widget: Admin widgets UI - since 0.9.9.6, "multiple" languages list widget
+10. xili-language: Special Admin UI sidebox - infos about theme's content for multilingual settings.
+11. xili-language: Post Edit UI - when clicking Add New, a new browser window is open and links input are prefilled.
+12. xili-language widgets: the new "multiple" widget to display list of recent posts in a choosen language.
+13. xili-language: Post Edit UI - Check option to auto search will be useful for editor when working on existing posts and with multiple authors.
+
+== Changelog ==
+= 1.4.1 = wp_title translation for categories, () suppressed in cats list display -see FAQ-, auto-search linked posts option
+= 1.4.0 = Option to modify home query according rules by chief editor. Fixes gold functions. New Recent Posts Widget.
+= 1.3.1 = Just to correct a minor omission - Add New works now for linked pages.
+= 1.3.0 = new functions for CMS usages. Better Post Edit UI. Fixes some issues when trash/untrash.
+= 1.2.1 = fixes some directories issues in (rare) xamp servers - Some improvements in post edit UI.
+= 1.1.8 - 1.1.9 = new features for theme's developers - see code lines - Fix title of `wp_get_archives` links with current permalinks.
+= 1.1 = improve `xiliml_the_others_posts` function optionally to return an array of linked posts
+= 1.0.2 = fix unexpected like tags metabox added by WP 28 in post edit UI - tracs #10437
+= 1.0 =
+* New ways to define default language of front-page,
+* also compatible with new recent WP 2.8.
+* Some fixes. Unique id for category link hook
+
+= 0.9.9.6 = ready for new multiple widgets - fixed filter by in class
+= 0.9.9.5 = php doc enhanced, link to modify linked posts
+= 0.9.9.4 = Recent commments, 'Get_archives' translatable, some fixes or improvements...
+= 0.9.9.3 = sub selection of pages for `wp_list_pages()` with `&lang=` , some fixes
+= 0.9.9 = give dir of lang ltr or rtl, fixes for cat popup in post edit admin UI, fixes quick-edit update (0.9.9.1 fixes internal `get_cur_language()` that now deliver array. 0.9.9.2 fixe class of metabox has-right-sidebar for 2.8, W3C)
+= 0.9.8.3 = (dashboard) for new post, pre-set default language of author according his browser's language.
+= 0.9.8.2 = better query (`get_terms_of_groups_lite`) - fixes W3C xml:lang
+= 0.9.8.1 = Counting only published posts and pages, add filter for widget's titles, in admin UI link to posts of one language, compatible with xili-tidy-tags plugin.
+= 0.9.8 = data model now include future sub-group and sorting of languages.
+= 0.9.7.6 = Add new hooks to define header metas or language attributes in html tag...
+= 0.9.7.5 = Add detection of browser language, fixes W3C errors, record undefined state of post,...
+= 0.9.7.4 = Add a box in post admin edit UI to easily set link to similar posts in other languages.
+= 0.9.7.1 = fixes, add subfolder for langs in theme - add new tag for theme : `the_xili_local_time()`
+= 0.9.7 = OOP and CLASS coding - New settings UI according to new rules and style of WP 2.7 (`meta_boxes`, js).
+
+= 0.9.6 = New settings UI according to new rules and style of WP 2.7 (meta_boxes, js)
+
+= 0.9.4 = fixes and hooks from plugin to functions defined in functions.php
+= 0.9.3 = third public release (beta) some fixes and display language in post/page lists
+= 0.9.2 = second public release (beta) ready to include xili-dictionary plugin (tools)
+= 0.9.0 = first public release (beta)
+
+© 20100221 - MS - dev.xiligroup.com
+
+== Upgrade Notice ==
+
+As usually, don' forgot to backup the database before major upgrade.
+Upgrading can be easily procedeed through WP admin UI or through ftp.
+
+
+== More infos ==
+
+= What about plugin settings UI localization ? =
+
+It is simple, if you have translated the settings UI of plugin in your mother language, you send us a message through the contact form that contains the link to your site where you have add the .po and .mo files. Don't forget to fill the header of the .po file with your name and email. If all is ok, the files will be added to the xili-language wp plugins repository. Because I am not able to verify the content, you remain responsible of your translation.
+
+
+= What happens if frontpage is a page ? =
+
+Since 0.9.9.4, the plugin incorporates now features that are formerly possible through the hookable functions of xili-language. The page frontpage must have her clones in each other languages. As for posts, if the user's browser is not in the default language, xili-language will display the page in the corresponding language if set by the editor. [home page of website dev.xiligroup.com](http://dev.xiligroup.com/) uses this feature.
+
+
+The plugin post is frequently updated [dev.xiligroup.com](http://dev.xiligroup.com/xili-language/ "Why xili-language ?")
+
+See also the [Wordpress plugins forum](http://wordpress.org/tags/xili-language/) and [dev.xiligroup Forum](http://forum.dev.xiligroup.com/).
+
+© 2008-2010 - MS - dev.xiligroup.com
Binary file web/wp-content/plugins/xili-language/screenshot-1.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-10.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-11.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-12.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-13.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-2.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-3.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-4.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-5.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-6.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-7.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-8.png has changed
Binary file web/wp-content/plugins/xili-language/screenshot-9.png has changed
Binary file web/wp-content/plugins/xili-language/xili-language-fr_FR.mo has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-language/xili-language-fr_FR.po Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,200 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: xili_language\n"
+"POT-Creation-Date: 2009-04-04 11:58+0100\n"
+"PO-Revision-Date: 2010-02-20 23:01+0100\n"
+"Last-Translator: dev.xiligroup.com <contact@xiligroup.com>\n"
+"Language-Team: dev.xiligroup.com <contact@xiligroup.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: __;_e\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-Language: French\n"
+"X-Poedit-Country: FRANCE\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Poedit-SearchPath-0: trunk\n"
+
+msgid "A new language was added."
+msgstr "Une nouvelle langue a été ajoutée."
+
+msgid "Language to update."
+msgstr "Langue à mettre à jour."
+
+msgid "A language was updated."
+msgstr "Une langue a été mise à jour."
+
+msgid "A language to delete."
+msgstr "Langue à effacer."
+
+msgid "A language was deleted."
+msgstr "Une langue a été supprimée."
+
+msgid "Find above the list of languages."
+msgstr "Voici la liste des langues."
+
+msgid "Language"
+msgstr "Langue"
+
+msgid "Languages"
+msgstr "Langues"
+
+msgid "List of languages"
+msgstr "Liste des langues"
+
+msgid "Full name"
+msgstr "Nom complet "
+
+msgid "Name"
+msgstr "Nom "
+
+msgid "Language slug"
+msgstr "Code "
+
+msgid "Order"
+msgstr "Ordre "
+
+msgid "Note:"
+msgstr "Note et message :"
+
+msgid "Update"
+msgstr "Mettre à jour "
+
+msgid "Edit language"
+msgstr "Editer la langue"
+
+msgid "Delete language ?"
+msgstr "Supprimer la langue ?"
+
+msgid "This plugin was developed with the taxonomies, terms tables and tags specifications. <br /> Here a new taxonomy was created and used for languages of posts and pages. <br /> New radiobuttons are available in Post (and Page) write and edit admin pages for selection by author. It is updated for WP 2.9 since 1.1"
+msgstr "Ce plugin a été développé sur la base des tables taxonomy et terms... <br />Ici, on règle la gestion des langues. <br />Dans la colonne droite des pages d'édition des pages et articles, il y a sur le côté droit un selecteur radio-bouton des langues à choisir. Il est mis à jour pour WP 2.9. depuis la version 1.1"
+
+msgid "Add a language"
+msgstr "Ajouter une langue"
+
+msgid "Add »"
+msgstr "Ajouter…"
+
+msgid "Delete »"
+msgstr "Supprimer…"
+
+msgid "Update »"
+msgstr "Mettre à jour…"
+
+msgid "Selected language"
+msgstr "Langue choisie"
+
+msgid "english"
+msgstr "anglais"
+
+msgid "belgium french"
+msgstr "belge"
+
+msgid "french"
+msgstr "français"
+
+msgid "german"
+msgstr "allemand"
+
+msgid "undefined"
+msgstr "non définie"
+
+msgid "Display"
+msgstr "Voir"
+
+msgid "Post ID"
+msgstr "N° du post"
+
+msgid "Page ID"
+msgstr "N° de page"
+
+msgid "Post's language"
+msgstr "Langue de l'article"
+
+msgid "Page's language"
+msgstr "Langue de la page"
+
+msgid "Linked posts"
+msgstr "Articles liés"
+
+msgid "Linked pages"
+msgstr "Pages liées"
+
+msgid "ID of posts in other languages:"
+msgstr "N° des articles en d'autres langues"
+
+msgid "ID of pages in other languages:"
+msgstr "N° des pages en d'autres langues"
+
+msgid "Check"
+msgstr "Cocher"
+
+msgid "to auto search linked posts. (read docs)"
+msgstr "pour auto-chercher les liens (lire la doc)"
+
+msgid "to auto search linked pages. (read docs)"
+msgstr "pour auto-chercher les liens (lire la doc)"
+
+msgid "Settings"
+msgstr "Réglages"
+
+msgid "Select by default browser language of visitor"
+msgstr "Choisir par défaut la langue du navigateur de l'internaute."
+
+msgid "For new post, pre-select by default: browser language of author"
+msgstr "Pour un nouvel article, choisir par défaut la langue du navigateur de l'auteur."
+
+msgid "Language of visitor's browser"
+msgstr "Langue du navigateur"
+
+msgid "Select language of the home page"
+msgstr "Choix de la langue de la page d'accueil"
+
+msgid "Software defined"
+msgstr "définie par logiciel"
+
+msgid "Enable gold functions"
+msgstr "Active les fonctions xilidev"
+
+msgid "Set undefined posts..."
+msgstr "Affecter une langue aux articles indéfinis..."
+
+msgid "Choose target language…"
+msgstr "Choisir la langue cible…"
+
+msgid "Error: other post not present !!!"
+msgstr "Erreur : l'article est absent !!!"
+
+msgid "Special"
+msgstr "Fonctions spéciales"
+
+msgid "Special Gold Actions"
+msgstr "Actions spéciales \"Or\""
+
+msgid "xili-language plugin : THEME_TEXTDOMAIN UNDEFINED"
+msgstr "Extension xili-language : Constante THEME_TEXTDOMAIN non définie"
+
+msgid "no theme domain in index.php"
+msgstr "pas de domaine theme détecté dans index.php"
+
+msgid "no index.php in theme, domain not set"
+msgstr "pas de fichier index.php dans le thème, domain non affecté"
+
+msgid "Theme's informations:"
+msgstr "Informations sur le thème :"
+
+msgid "theme_domain:"
+msgstr "domaine du thème :"
+
+msgid "as function like:"
+msgstr "tel qu'ici :"
+
+msgid "Theme domain NOT defined"
+msgstr "domaine du thème non défini"
+
+msgid "Languages sub-folder:"
+msgstr "Sous dossier des fichiers '.mo' :"
+
+msgid "Available MO files:"
+msgstr "Fichiers .mo disponibles :"
+
Binary file web/wp-content/plugins/xili-language/xili-language-ru_RU.mo has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-language/xili-language-ru_RU.po Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,137 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: xili_language\n"
+"POT-Creation-Date: 2009-04-04 11:58+0100\n"
+"PO-Revision-Date: 2010-01-03 10:27+0200\n"
+"Last-Translator: Fat Cow <zhr@tut.by>\n"
+"Language-Team: FatCow <zhr@tut.by>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: __;_e\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-Language: Russian\n"
+"X-Poedit-Country: RUSSIAN FEDERATION\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Poedit-SearchPath-0: trunk\n"
+
+msgid "A new language was added."
+msgstr "Новый язык добавлен."
+
+msgid "Language to update."
+msgstr "Язык обновлен."
+
+msgid "A language was updated."
+msgstr "Язык был обновлен."
+
+msgid "A language to delete."
+msgstr "Язык удален."
+
+msgid "A language was deleted."
+msgstr "Язык был удален."
+
+msgid "Find above the list of languages."
+msgstr "Найти в списке языков выше."
+
+msgid "Language"
+msgstr "Язык"
+
+msgid "List of languages"
+msgstr "Список языков"
+
+msgid "Full name"
+msgstr "Полное имя"
+
+msgid "Name"
+msgstr "Имя"
+
+msgid "Language slug"
+msgstr "Языковой слоган"
+
+msgid "Order"
+msgstr "Выбор"
+
+msgid "Note:"
+msgstr "Памятка:"
+
+msgid "Update"
+msgstr "Обновить"
+
+msgid "Edit language"
+msgstr "Редактировать язык"
+
+msgid "Delete language ?"
+msgstr "Удалить язык?"
+
+msgid "This plugin was developed with the taxonomies, terms tables and tags specifications. <br /> Here a new taxonomy was created and used for languages of posts. <br /> New radiobuttons are available in Post (and Page) write and edit pages for selection by author. It is updated for WP 2.8 since 1.0"
+msgstr "Этот плагин был разработан с таксономий, терминов и таблиц тегов спецификации. <br />Новая таксономия была создана и используется для языков постов. <br />Новые элементы доступны по выбору автора. Обновлен для WP 2.8 с 1.0 "
+
+msgid "Add a language"
+msgstr "Добавить язык"
+
+msgid "Add »"
+msgstr "Добавить…"
+
+msgid "Delete »"
+msgstr "Удалить…"
+
+msgid "Update »"
+msgstr "Обновить…"
+
+msgid "Selected language"
+msgstr "Выбранный язык"
+
+msgid "english"
+msgstr "английский"
+
+msgid "belgium french"
+msgstr "бельгийский французский"
+
+msgid "french"
+msgstr "французский"
+
+msgid "german"
+msgstr "немецкий"
+
+msgid "undefined"
+msgstr "не определен"
+
+msgid "Display"
+msgstr "отображать"
+
+msgid "Post ID"
+msgstr "ID поста"
+
+msgid "Post's language"
+msgstr "язык поста"
+
+msgid "Page's language"
+msgstr "Язык страницы"
+
+msgid "Linked posts"
+msgstr "Пост"
+
+msgid "Linked pages"
+msgstr "Страницы"
+
+msgid "Settings"
+msgstr "Настройки"
+
+msgid "Select by default browser language of visitor"
+msgstr "Выберите язык браузера посетителя по умолчанию"
+
+msgid "For new post, pre-select by default: browser language of author"
+msgstr "для нового поста, предварительно выбранный язык браузера посетителя по умолчанию"
+
+msgid "Language of visitor's browser"
+msgstr "Язык браузера посетителя"
+
+msgid "Select language of the home page"
+msgstr "Выберите язык домашнюю страницу"
+
+msgid "Software defined"
+msgstr "Программное обеспечение определено"
+
+msgid "Enable gold functions"
+msgstr "Включение золотой функции "
+
Binary file web/wp-content/plugins/xili-language/xili-language-widget-fr_FR.mo has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-language/xili-language-widget-fr_FR.po Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,62 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: xili_language_widget\n"
+"POT-Creation-Date: 2009-04-04 11:58+0100\n"
+"PO-Revision-Date: 2010-02-19 16:30+0100\n"
+"Last-Translator: dev.xiligroup.com <contact@xiligroup.com>\n"
+"Language-Team: dev.xiligroup.com <contact@xiligroup.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: __;_e\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-Language: French\n"
+"X-Poedit-Country: FRANCE\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Poedit-SearchPath-0: trunk\n"
+
+msgid "List of languages"
+msgstr "Liste des langues"
+
+msgid "List of available languages by xili-language plugin"
+msgstr "Liste des langues disponibles par l'extension xili-language"
+
+msgid "List of recent comments by xili-language plugin"
+msgstr "Liste des commentaires récents compatible xili-language"
+
+msgid "List of recent comments"
+msgstr "Liste des commentaires récents"
+
+msgid "List of recent posts"
+msgstr "Liste articles récents"
+
+msgid "The most recent posts on your blog by xili-language"
+msgstr "Liste des articles récents compatible xili-language"
+
+msgid "Language:"
+msgstr "Langue de la liste :"
+
+msgid "All languages"
+msgstr "Toutes langues"
+
+msgid "Current language"
+msgstr "La langue en cours"
+
+msgid "Type"
+msgstr "Type"
+
+msgid "HTML tags of list"
+msgstr "Balises HTML de la liste"
+
+msgid "before list"
+msgstr "Avant la liste "
+
+msgid "before line"
+msgstr "Avant chaque ligne "
+
+msgid "after line"
+msgstr "Après chaque ligne "
+
+msgid "after list"
+msgstr "Après la liste "
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-language/xili-language-widget.php Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,422 @@
+<?php
+/*
+Plugin Name: xili-language widget
+Plugin URI: http://dev.xiligroup.com/xili-language/
+Description: This plugin is a part of xili-language plugin. Add a optional widgets to display list of languages in the sidebar or recent comments and recents posts (since 2.8.0)
+Author: dev.xiligroup.com - MS
+Version: 1.4.1
+Author URI: http://dev.xiligroup.com
+*/
+
+# 100219 - add new widget recent posts if WP >= 2.8.0
+# 090606 - xili-language list widget is now multiple and more features
+# 090518 - new widget for recent comments
+# 090404 - new registering way.
+# 090325 - better options record.
+
+/* thanks to http://blog.zen-dreams.com/ tutorial
+
+ Copyright 2009-10 dev.xiligroup.com
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+/**
+ * Recent_Posts widget class
+ * rewritten from default WP widget to suppress wp_reset_query and add sub-selection by language (current or forced)
+ * @since 1.4.0
+ */
+class xili_Widget_Recent_Posts extends WP_Widget {
+
+ function xili_Widget_Recent_Posts() {
+ $widget_ops = array('classname' => 'xili_widget_recent_entries', 'description' => __( "The most recent posts on your blog by xili-language",'xili-language-widget') );
+ $this->WP_Widget('xili-recent-posts', __('List of recent posts','xili-language-widget'), $widget_ops);
+ $this->alt_option_name = 'xili_widget_recent_entries';
+
+ add_action( 'save_post', array(&$this, 'flush_widget_cache') );
+ add_action( 'deleted_post', array(&$this, 'flush_widget_cache') );
+ add_action( 'switch_theme', array(&$this, 'flush_widget_cache') );
+ }
+
+ function widget($args, $instance) {
+ $cache = wp_cache_get('xili_widget_recent_posts', 'widget');
+
+ if ( !is_array($cache) )
+ $cache = array();
+
+ if ( isset($cache[$args['widget_id']]) ) {
+ echo $cache[$args['widget_id']];
+ return;
+ }
+
+ ob_start();
+ extract($args);
+
+ $title = apply_filters('widget_title', empty($instance['title']) ? __('Recent Posts') : $instance['title']);
+ if ( !$number = (int) $instance['number'] )
+ $number = 10;
+ else if ( $number < 1 )
+ $number = 1;
+ else if ( $number > 15 )
+ $number = 15;
+
+ $the_lang = $instance['the_lang'];
+
+ if (class_exists('xili_language')) {
+ global $wp_query;
+ $tmp_query = $wp_query->query_vars[QUETAG] ; $wp_query->query_vars[QUETAG] = "";
+ if ($the_lang == '')
+ $thequery = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1);
+ else if ($the_lang == '*')
+ $thequery = array ('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1, QUETAG => the_curlang());
+ else
+ $thequery = array ('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1, QUETAG => $the_lang);
+
+ add_action('parse_query','xiliml_add_lang_to_parsed_query');
+ $r = new WP_Query($thequery);
+ remove_filter('parse_query','xiliml_add_lang_to_parsed_query');
+ $wp_query->query_vars[QUETAG] = $tmp_query;
+ } else {
+ $thequery = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'caller_get_posts' => 1);
+ $r = new WP_Query($thequery);
+ }
+
+ if ($r->have_posts()) :
+?>
+ <?php echo $before_widget; ?>
+ <?php if ( $title ) echo $before_title . $title . $after_title; ?>
+ <ul>
+ <?php while ($r->have_posts()) : $r->the_post(); ?>
+ <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?> </a></li>
+ <?php endwhile; ?>
+ </ul>
+ <?php echo $after_widget; ?>
+<?php
+ //wp_reset_query(); // Restore global post data stomped by the_post().
+ endif;
+
+ $cache[$args['widget_id']] = ob_get_flush();
+ wp_cache_add('xili_widget_recent_posts', $cache, 'widget');
+ }
+
+ function update( $new_instance, $old_instance ) {
+ $instance = $old_instance;
+ $instance['title'] = strip_tags($new_instance['title']);
+ $instance['the_lang'] = strtolower($new_instance['the_lang']);
+ $instance['number'] = (int) $new_instance['number'];
+ $this->flush_widget_cache();
+
+ $alloptions = wp_cache_get( 'alloptions', 'options' );
+ if ( isset($alloptions['xili_widget_recent_entries']) )
+ delete_option('xili_widget_recent_entries');
+
+ return $instance;
+ }
+
+ function flush_widget_cache() {
+ wp_cache_delete('xili_widget_recent_posts', 'widget');
+ }
+
+ function form( $instance ) {
+ $title = isset($instance['title']) ? esc_attr($instance['title']) : '';
+ $the_lang = isset($instance['the_lang']) ? strtolower($instance['the_lang']) : '';
+ if ( !isset($instance['number']) || !$number = (int) $instance['number'] )
+ $number = 5;
+?>
+ <p><label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?></label>
+ <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo $title; ?>" /></p>
+
+ <?php if (class_exists('xili_language')) { global $xili_language; ?>
+ <p>
+ <label for="<?php echo $this->get_field_id('the_lang'); ?>"><?php _e('Language:','xili-language-widget'); ?></label>
+ <select name="<?php echo $this->get_field_name('the_lang'); ?>" id="<?php echo $this->get_field_id('the_lang'); ?>" class="widefat">
+ <option value=""<?php selected( $instance['the_lang'], '' ); ?>><?php _e('All languages','xili-language-widget'); ?></option>
+ <option value="*"<?php selected( $instance['the_lang'], '*' ); ?>><?php _e('Current language','xili-language-widget'); ?></option>
+ <?php $listlanguages = get_terms_of_groups_lite ($xili_language->langs_group_id,TAXOLANGSGROUP,TAXONAME,'ASC');
+ foreach ($listlanguages as $language) { ?>
+ <option value="<?php echo $language->slug ?>"<?php selected( $instance['the_lang'], $language->slug ); ?>><?php _e($language->description,'xili-language-widget'); ?></option>
+
+ <?php } /* end */
+ ?>
+ </select>
+ </p>
+ <?php } ?>
+
+ <p><label for="<?php echo $this->get_field_id('number'); ?>"><?php _e('Number of posts to show:'); ?></label>
+ <input id="<?php echo $this->get_field_id('number'); ?>" name="<?php echo $this->get_field_name('number'); ?>" type="text" value="<?php echo $number; ?>" size="3" /><br />
+ <small><?php _e('(at most 15)'); ?></small></p>
+ <p><small>© xili-language</small></p>
+<?php
+ }
+}
+
+
+/*
+ * Adapted Recent Comments Widget (original in widget.php is not multilingual ready)
+ *
+ *@since 0.9.9.4
+ *
+ *
+ */
+
+class xili_recent_comments_Widget {
+
+ function xili_recent_comments_Widget() {
+ load_plugin_textdomain('xili-language-widget',PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)));
+ add_action('widgets_init', array(&$this, 'init_widget'));
+ }
+
+ function init_widget() {
+ if ( !function_exists('wp_register_sidebar_widget') || !function_exists('wp_register_widget_control') )
+ return;
+ $widget_ops = array('classname' => 'xili-language_recent_comments_Widget', 'description' => __( "List of recent comments by xili-language plugin",'xili-language-widget') );
+ wp_register_sidebar_widget('xili-language_recent_comments_Widget',__('List of recent comments','xili-language-widget'),array(&$this, 'widget'),$widget_ops);
+ wp_register_widget_control('xili-language_recent_comments_Widget',__('List of recent comments','xili-language-widget'),array(&$this, 'widget_options'),$widget_ops);
+
+ }
+
+ function widget($args) {
+ global $comments, $comment;
+ extract($args, EXTR_SKIP);
+ $options = get_option('xili_language_recent_comments');
+ $title = empty($options['title']) ? __('Recent Comments',THEME_TEXTDOMAIN) : apply_filters('widget_title', $options['title']);
+ if ( !$number = (int) $options['number'] )
+ $number = 5;
+ else if ( $number < 1 )
+ $number = 1;
+ else if ( $number > 15 )
+ $number = 15;
+ /* if xili-language plugin is activated */
+ if (function_exists('xiliml_recent_comments'))
+ $comments = xiliml_recent_comments($number);
+ /* */
+ echo $before_widget; ?>
+ <?php echo $before_title . $title . $after_title; ?>
+ <ul id="recentcomments"><?php
+ if ( $comments ) : foreach ( (array) $comments as $comment) :
+ echo '<li class="recentcomments">' . sprintf(__('%1$s on %2$s',THEME_TEXTDOMAIN), get_comment_author_link(), '<a href="' . clean_url( get_comment_link($comment->comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '</a>') . '</li>';
+ endforeach; endif;?></ul>
+ <?php echo $after_widget;
+ }
+
+ function widget_options() {
+ $options = $newoptions = get_option('xili_language_recent_comments');
+ if ( isset($_POST["xl_recent-comments-submit"]) ) {
+ $newoptions['title'] = strip_tags(stripslashes($_POST["xl_recent-comments-title"]));
+ $newoptions['number'] = (int) $_POST["xl_recent-comments-number"];
+ }
+ if ( $options != $newoptions ) {
+ $options = $newoptions;
+ update_option('xili_language_recent_comments', $options);
+ wp_delete_recent_comments_cache();
+ }
+ $title = attribute_escape($options['title']);
+ if ( !$number = (int) $options['number'] )
+ $number = 5;
+ ?>
+ <p><label for="xl_recent-comments-title"><?php _e('Title:'); ?> <input class="widefat" id="xl_recent-comments-title" name="xl_recent-comments-title" type="text" value="<?php echo $title; ?>" /></label></p>
+ <p>
+ <label for="xl_recent-comments-number"><?php _e('Number of comments to show:'); ?> <input style="width: 25px; text-align: center;" id="xl_recent-comments-number" name="xl_recent-comments-number" type="text" value="<?php echo $number; ?>" /></label>
+ <br />
+ <small><?php _e('(at most 15)'); ?></small>
+ </p>
+ <input type="hidden" id="xl_recent-comments-submit" name="xl_recent-comments-submit" value="1" />
+ <?php
+ }
+}
+
+/*
+ * class for multiple xili-language widgets
+ * @since 0.9.9.6
+ *
+ */
+class xili_language_Widgets {
+
+ function xili_language_Widgets () {
+ load_plugin_textdomain('xili-language-widget',PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)));
+ add_action('widgets_init', array(&$this, 'init_widget'));
+ }
+
+ function init_widget() {
+ if ( !function_exists('wp_register_sidebar_widget') || !function_exists('wp_register_widget_control') )
+ return;
+ if (!$options = get_option('xili_language_widgets_options'))
+ $options = array();
+ $widget_ops = array('classname' => 'xili-language_Widgets', 'description' => __( "List of available languages by xili-language plugin",'xili-language-widget') );
+ $control_ops = array('id_base' => 'xili_language_widgets');
+ $name = __('Languages list','xili-language-widget');
+
+ $id = false;
+ foreach ( (array) array_keys($options) as $o ) {
+ $id = "xili_language_widgets-$o"; // Never never never translate an id
+ wp_register_sidebar_widget($id, $name, array(&$this, 'widget'), $widget_ops, array( 'number' => $o ));
+ wp_register_widget_control($id, $name, array(&$this, 'widget_options'), $control_ops, array( 'number' => $o ));
+ }
+
+ // If there are none, we register the widget's existance with a generic template
+ if ( !$id ) {
+ wp_register_sidebar_widget( 'xili_language_widgets-1', $name, array(&$this, 'widget'), $widget_ops, array( 'number' => -1 ) );
+ wp_register_widget_control( 'xili_language_widgets-1', $name, array(&$this, 'widget_options'), $control_ops, array( 'number' => -1 ) );
+
+ }
+
+ }
+
+ function widget($args, $widget_args = 1) {
+ global $wpdb;
+
+ $options = get_option('xili_language_widgets_options');
+ extract($args);
+
+ if ( is_numeric($widget_args) )
+ $widget_args = array( 'number' => $widget_args );
+ $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
+ extract( $widget_args, EXTR_SKIP );
+
+ if ( !isset($options[$number]) )
+ return;
+ if ("" != $options[$number]['title']) {
+ echo $before_widget.$before_title.__($options[$number]['title'],THEME_TEXTDOMAIN).$after_title;
+ } else {
+ echo $before_widget.$before_title.$aftertitle;
+ }
+
+ if (isset($options[$number]['beforelist'])) {
+ $beforelist = stripslashes($options[$number]['beforelist']);
+ $afterlist = stripslashes($options[$number]['afterlist']);
+ } else {
+ $beforelist = "<ul class='xililanguagelist'>";
+ $afterlist = '</ul>';
+ }
+ if (isset($options[$number]['beforeline'])) {
+ $beforeline = stripslashes($options[$number]['beforeline']);
+ $afterline = stripslashes($options[$number]['afterline']);
+ } else {
+ $beforeline = '<li>';
+ $afterline = '</li>';
+ }
+ $theoption = $options[$number]['theoption'];
+
+ if (function_exists('xili_language_list')) {
+ echo $beforelist;
+ xili_language_list($beforeline, $afterline, $theoption);
+ echo $afterlist;
+ }
+ echo $after_widget;
+ }
+
+ function widget_options($widget_args) {
+ if ( is_numeric($widget_args) )
+ $widget_args = array( 'number' => $widget_args );
+ $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
+ extract( $widget_args, EXTR_SKIP );
+
+ $options = get_option('xili_language_widgets_options');
+ if (!is_array($options))
+ $options = array();
+
+ if ( !$updated && !empty($_POST['sidebar']) ) {
+ $sidebar = (string) $_POST['sidebar'];
+
+ $sidebars_widgets = wp_get_sidebars_widgets();
+ if ( isset($sidebars_widgets[$sidebar]) )
+ $this_sidebar =& $sidebars_widgets[$sidebar];
+ else
+ $this_sidebar = array();
+
+ foreach ( (array) $this_sidebar as $_widget_id ) {
+
+ if ( 'xili-language_widgets' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
+ $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
+ if ( !in_array( "xili-language_widgets-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed.
+ unset($options[$widget_number]);
+ }
+ }
+
+ foreach ( (array) $_POST['xili-language_Widgets'] as $widget_number => $widget_text ) {
+ if (isset($widget_text['submit'])) {
+ $options[$widget_number]['title'] = strip_tags(stripslashes($widget_text['title']));
+ $options[$widget_number]['beforelist'] = $widget_text['beforelist'] ;
+ $options[$widget_number]['beforeline'] = $widget_text['beforeline'] ;
+ $options[$widget_number]['afterline'] = $widget_text['afterline'] ;
+ $options[$widget_number]['afterlist'] = $widget_text['afterlist'] ;
+ $options[$widget_number]['theoption'] = strip_tags(stripslashes($widget_text['theoption'])) ;
+
+ }
+ }
+ update_option('xili_language_widgets_options',$options);
+ $updated = true;
+ }
+
+
+ $options = get_option('xili_language_widgets_options');
+
+ if ( -1 == $number ) {
+ $title = '';
+ $number = '%i%';
+
+ $beforelist = "<ul class='xililanguagelist'>";
+ $afterlist = '</ul>';
+ $beforeline = '<li>';
+ $afterline = '</li>';
+ $theoption = '';
+
+ } else {
+ $title = attribute_escape($options[$number]['title']);
+ $beforelist = htmlentities(stripslashes($options[$number]['beforelist']));
+ $beforeline = htmlentities(stripslashes($options[$number]['beforeline']));
+ $afterline = htmlentities(stripslashes($options[$number]['afterline']));
+ $afterlist = htmlentities(stripslashes($options[$number]['afterlist']));
+ $theoption = stripslashes($options[$number]['theoption']);
+ }
+
+ echo '<label for="xili_l_widget_title-'.$number.'">'.__('Title').': <input id="xili_l_widget_title-'.$number.'" name="xili-language_Widgets['.$number.'][title]" type="text" value="'.$title.'" /></label>';
+ // other option and list html tags
+ echo '<br /><label for="xili_l_widget_theoption-'.$number.'">'.__('Type','xili-language-widget').': <input id="xili_l_widget_theoption-'.$number.'" name="xili-language_Widgets['.$number.'][theoption]" type="text" value="'.$theoption.'" /></label>';
+
+ echo '<fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"><legend>'.__('HTML tags of list','xili-language-widget').'</legend>';
+
+ echo "<label for=\"xili_l_widget_beforelist-".$number."\">".__('before list','xili-language-widget').": <input id=\"xili_l_widget_beforelist-".$number."\" name=\"xili-language_Widgets[".$number."][beforelist]\" type=\"text\" value=\"".$beforelist."\" style=\"width:100%\" /></label><br />";
+ echo '<label for="xili_l_widget_beforeline-'.$number.'">'.__('before line','xili-language-widget').': <input id="xili_l_widget_beforeline-'.$number.'" name="xili-language_Widgets['.$number.'][beforeline]" type="text" value="'.$beforeline.'" style="width:100%" /></label><br />';
+ echo '<label for="xili_l_widget_afterline-'.$number.'">'.__('after line','xili-language-widget').': <input id="xili_l_widget_afterline-'.$number.'" name="xili-language_Widgets['.$number.'][afterline]" type="text" value="'.$afterline.'" style="width:100%" /></label><br />';
+ echo '<label for="xili_l_widget_afterlist-'.$number.'">'.__('after list','xili-language-widget').': <input id="xili_l_widget_afterlist-'.$number.'" name="xili-language_Widgets['.$number.'][afterlist]" type="text" value="'.$afterlist.'" style="width:100%" /></label>';
+
+ echo '</fieldset>';
+
+
+ //
+ echo '<input type="hidden" id="xili_l_widget_submit-'.$number.'" name="xili-language_Widgets['.$number.'][submit]" value="1" />';
+
+ } // end options (control)
+
+} // end class
+
+
+
+$xili_recent_comments_widget =& new xili_recent_comments_Widget ();
+
+/* since 0.9.9.6 - multiple widgets available */
+
+$xili_language_widgets =& new xili_language_Widgets ();
+
+/* since 1.3.2 - multiple recent posts widgets available */
+
+if ( $wp_version >= '2.8.0') {
+ function add_new_widgets() {
+ register_widget('xili_Widget_Recent_Posts');
+ }
+ add_action('widgets_init','add_new_widgets');
+}
+?>
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-language/xili-language.php Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,2406 @@
+<?php
+/*
+Plugin Name: xili-language
+Plugin URI: http://dev.xiligroup.com/xili-language/
+Description: This plugin modify on the fly the translation of the theme depending the language of the post or other blog elements - a way to create a real multilanguage site (cms or blog). It introduce a new taxonomy - here language - to describe posts and pages. To complete with tags, use also xili-tidy-tags plugin.
+Author: dev.xiligroup.com - MS
+Version: 1.4.1
+Author URI: http://dev.xiligroup.com
+*/
+# updated 100220 - 1.4.1 - wp_title translation for categories, () suppressed in cats list display, auto-search linked posts option
+# updated 100216 - 1.3.2 - Option to modify home query according rules by chief editor. fixes gold functions. New Recent Posts Widget.
+# updated 100216 - 1.3.1 - Just to correct a minor omission - Add New link works now for linked pages.
+# updated 100215 - 1.3.0 - new functions to change and restore loop's language query-tag. Better post UI to create linked post - fixes lost lang's link when trash or untrash.
+# updated 100207 - 1.2.1 - fixes some directories issues in (rare) xamp servers - Some improvements in post edit UI.
+# updated 100109 - 1.2.0 - tested with WP 2.9.1 - more localization for admin UI (RU)
+# updated 091104 - 1.1.9.1 - fixes special functions
+# updated 091103 - 1.1.9 - optional improve hooking ways to be compatible with l10n cache of Johan see line 2200 - fix title of wp_get_archive links with current permalinks.
+# updated 091019 - 1.1.8 - gold functions and shortcode for linked posts - first tests with WP 2.9
+# updated 091007 - 1.1.es - tests - gold functions active - update undefined posts functions in library
+# updated 090918 - 1.1 - xiliml_the_other_posts function improved and upgraded for CMS webmasters
+# updated 090719 - 1.0.2 - fix unexpected like tags metabox added by WP 28 tracs #10437
+# updated 090626 - 1.0.1 - fix filter unique id for category link hooks
+# updated 090615 - 1.0 - Via admin UI, new ways to choose default language of front-page (page, home,...)
+# updated 090606 - 0.9.9.6 - ready for 2.8 hooks - ready for multiple languages list widget
+# see readme text for these intermediate versions.
+# updated 090228 - Class and OOP - see 0.9.7 in comments of functions below - only for WP 2.7.x
+
+# This plugin is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This plugin is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this plugin; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+define('XILILANGUAGE_VER','1.4.1'); /* used in admin UI*/
+
+class xili_language {
+
+ var $default_lang; /* language of config.php*/
+ var $curlang;
+ var $langstate; /* undefined or not */
+ var $browseroption = '';
+ var $authorbrowseroption = '';
+ var $functions_enable = '';
+ var $default_dir = ''; /* undefined or not in WP config '' or rtl or ltr */
+ var $curlang_dir = ''; /* undefined or not according array */
+ var $rtllanglist = 'ar-he-fa-ur'; /*default-list - can be set after class instantiation*/
+ var $post_ajax = false; /* ajax used in meta box in post edit UI unstable yet */
+ var $is_metabox = false; /* meta box in post edit UI - if used don't use custom fields that are not refreshed */
+ var $xili_settings; /* saved in options */
+ var $langs_group_id; /* group ID and Term Taxo ID */
+ var $langs_group_tt_id;
+ var $get_archives_called = array(); /* if != '' - insert lang in link */
+ var $idx = array(); /* used to identify filter or action set from this class - since 0.9.9.6 */
+ var $theme_locale = false; /* to control locale hook */
+ var $ossep = "/"; /* for recursive file search in xamp */
+ var $current_lang_query_tag = ""; /* since 1.3.0 */
+ var $temp_lang_query_tag = "";
+
+ function xili_language($metabox = false, $post_ajax = false, $locale_method = false) {
+ $this->is_metabox = $metabox;
+ $this->post_ajax = $post_ajax;
+ $this->locale_method = $locale_method; /* added for compatibility with cache plugin from johan */
+ /*activated when first activation of plug*/
+ register_activation_hook(__FILE__,array(&$this,'xili_language_activate'));
+ $this->ossep = strtoupper(substr(PHP_OS,0,3)=='WIN')?'\\':'/';
+ /*get current settings - name of taxonomy - name of query-tag - 0.9.8 new taxonomy taxolangsgroup */
+ $this->xili_settings = get_option('xili_language_settings');
+ if(empty($this->xili_settings)) {
+ $submitted_settings = array(
+ 'taxonomy' => 'language',
+ 'version' => '0.4',
+ 'reqtag' => 'lang',
+ 'browseroption' => '',
+ 'authorbrowseroption' => '',
+ 'taxolangsgroup' => 'languages_group',
+ 'functions_enable' => '',
+ 'langs_folder' => '',
+ 'theme_domain' => '',
+ 'homelang' => ''
+ );
+ define('TAXONAME','language');
+ define('QUETAG','lang');
+ define('TAXOLANGSGROUP','languages_group');
+ update_option('xili_language_settings', $submitted_settings);
+ $this->xili_settings = get_option('xili_language_settings');
+ } else {
+ define('TAXONAME',$this->xili_settings['taxonomy']);
+ define('QUETAG',$this->xili_settings['reqtag']);
+ $this->browseroption = $this->xili_settings['browseroption'];
+ $this->authorbrowseroption = $this->xili_settings['authorbrowseroption'];
+ $this->functions_enable = $this->xili_settings['functions_enable'];
+ if ($this->xili_settings['version'] == '0.2' || $this->xili_settings['version'] == '0.3') { /* 1.3.2 */
+ $this->xili_settings['taxolangsgroup'] = 'languages_group';
+ $this->xili_settings['homelang'] = '';
+ $this->xili_settings['version'] = '0.4';
+ update_option('xili_language_settings', $this->xili_settings);
+ }
+ define('TAXOLANGSGROUP',$this->xili_settings['taxolangsgroup']);
+ }
+ define('XILIFUNCTIONSPATH',WP_PLUGIN_DIR.'/xilidev-libraries'); /* since 1.0 to add xili-libraries */
+
+ /** add new taxonomy in available taxonomies
+ * 1.0.2 - add label false as http://core.trac.wordpress.org/ticket/10437
+ * to avoid metabox as tag displayed
+ */
+ register_taxonomy( TAXONAME, 'post',array('hierarchical' => false, 'label'=>false, 'rewrite' => false, 'update_count_callback' => array(&$this,'_update_post_lang_count')));
+ register_taxonomy( TAXOLANGSGROUP, 'term',array('hierarchical' => false, 'update_count_callback' => ''));
+ $thegroup = get_terms(TAXOLANGSGROUP, array('hide_empty' => false,'slug' => 'the-langs-group'));
+ if (!$thegroup) { /* update langs group 0.9.8 */
+ $args = array( 'alias_of' => '', 'description' => 'the group of languages', 'parent' => 0, 'slug' =>'the-langs-group');
+ wp_insert_term( 'the-langs-group', TAXOLANGSGROUP, $args); /* create and link to existing langs */
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ foreach($listlanguages as $language) {
+ wp_set_object_terms($language->term_id, 'the-langs-group', TAXOLANGSGROUP);
+ }
+ $thegroup = get_terms(TAXOLANGSGROUP, array('hide_empty' => false,'slug' => 'the-langs-group'));
+ }
+ $this->langs_group_id = $thegroup[0]->term_id;
+ $this->langs_group_tt_id = $thegroup[0]->term_taxonomy_id;
+
+ /* default values */
+ if (''!= WPLANG && strlen(WPLANG)==5) :
+ $this->default_lang = WPLANG;
+ else:
+ $this->default_lang = 'en_US';
+ endif;
+ define('DEFAULTSLUG', $this->get_default_slug());
+ if ( $dir = get_bloginfo('text_direction') ) /* if present in blog options @since 0.9.9 */
+ $this->default_dir = $dir;
+
+ add_filter('query_vars', array(&$this,'keywords_addQueryVar'));
+ add_filter('posts_join', array(&$this,'with_lang'));
+ add_filter('posts_where', array(&$this,'where_lang'));
+
+ add_action('wp', array(&$this,'xiliml_language_wp'));
+ /* 'wp' = where theme's language is defined just after query */
+ if ($this->locale_method)
+ add_filter('locale', array(&$this,'xiliml_setlocale'), 10);
+ /* to be compatible with l10n cache from Johan since 1.1.9 */
+ add_filter('language_attributes', array(&$this,'head_language_attributes'));
+ add_action('wp_head', array(&$this,'head_insert_language_metas'),10,2);
+
+ add_filter('widget_title', array(&$this,'widget_texts')); /* added 0.9.8.1 */
+ add_filter('widget_text', array(&$this,'widget_texts'));
+ add_filter('list_cats', array(&$this,'xiliml_cat_language'),10,2); /* mode 2 : content = name */
+
+ add_filter('category_link', array(&$this,'xiliml_link_append_lang'));
+ $filter = 'category_link';
+ $function = 'xiliml_link_append_lang';
+ $this->idx['xiliml_link_append_lang'] = _wp_filter_build_unique_id($filter, array (&$this, $function == '' ? $filter : $function), 10); /* unique id of this filter from object fixed 1.0.1 */
+
+ add_filter('category_description',array(&$this,'xiliml_link_translate_desc'));
+ add_filter('single_cat_title',array(&$this,'xiliml_single_cat_title_translate')); /* 1.4.1 wp_title() */
+ add_filter('tag_link', array(&$this,'xiliml_taglink_append_lang' ));
+
+ add_action('pre_get_posts', array(&$this,'xiliml_modify_querytag'));
+ /* filters for archives since 0.9.9.4 */
+ add_filter('getarchives_join', array(&$this,'xiliml_getarchives_join'),10,2);
+ add_filter('getarchives_where', array(&$this,'xiliml_getarchives_where'),10,2);
+ add_filter('get_archives_link', array(&$this,'xiliml_get_archives_link'));
+ /* actions for post and page admin UI */
+ add_action('save_post', array(&$this,'xili_language_add'));
+ //add_action('publish_post', array(&$this,'xili_language_add')); /* only set when published !*/
+ add_action('save_page', array(&$this,'xili_language_add'));
+ //add_action('publish_page', array(&$this,'xili_language_add'));
+ if ($this->post_ajax) {
+ add_action( 'wp_ajax_oklinked', array(&$this,'ok_linked') );
+ add_action( 'wp_ajax_customrefresh', array(&$this,'custom_refresh') );
+ }
+ /* admin settings UI*/
+ add_action('init', array(&$this, 'init_textdomain'));
+ add_filter('plugin_action_links', array(&$this,'xililang_filter_plugin_actions'), 10, 2);
+
+ add_action('admin_menu', array(&$this,'myplugin_add_custom_box'));
+ add_action('admin_menu', array(&$this,'xili_add_pages'));
+ /* special to detect theme changing since 1.1.9 */
+ add_action('switch_theme', array(&$this,'theme_switched'));
+ /* inspired from custax */
+ add_action('manage_posts_custom_column', array(&$this,'xili_manage_column'), 10, 2);
+ add_filter('manage_edit_columns', array(&$this,'xili_manage_column_name'));
+
+ add_action('manage_pages_custom_column', array(&$this,'xili_manage_column'), 10, 2);
+ add_filter('manage_edit-pages_columns', array(&$this,'xili_manage_column_name'));
+
+ /* new actions for xili-language theme's templates tags */
+
+ $this->add_action('xili_language_list','xili_language_list',10,3); /* add third param 0.9.7.4*/
+ $this->add_action('xili_post_language','xili_post_language',10,2);
+
+ $this->add_action('xiliml_the_other_posts','xiliml_the_other_posts',10,4); /* add a param 1.1 */
+ $this->add_action('xiliml_the_category','xiliml_the_category',10,3);
+ $this->add_action('xiliml_langinsearchform','xiliml_langinsearchform',10,2);
+
+ }
+
+ function add_action ($action, $function = '', $priority = 10, $accepted_args = 1)
+ {
+ add_action ($action, array (&$this, $function == '' ? $action : $function), $priority, $accepted_args);
+ $this->idx[$action] = _wp_filter_build_unique_id($action, array (&$this, $function == '' ? $action : $function), $priority); /* unique id of this filter from object */
+ }
+
+ function add_filter ($filter, $function = '', $priority = 10, $accepted_args = 1)
+ {
+ add_filter ($filter, array (&$this, $function == '' ? $filter : $function), $priority, $accepted_args);
+ $this->idx[$filter] = _wp_filter_build_unique_id($filter, array (&$this, $function == '' ? $filter : $function), $priority); /* unique id of this filter from object fixed 1.0.1 */
+ }
+
+ /**
+ * More than one filter for the function.
+ *
+ * @since 0.9.7
+ *
+ * @param $the_function (string).
+ * @return true if more than one.
+ */
+ function this_has_filter($the_function) {
+ global $wp_filter;
+ $has = $wp_filter[$the_function];
+ //print_r($has);
+ $keys = array_keys($has);
+ //echo count($has[$keys[0]]);
+ if (count($has[$keys[0]]) >= 2) { /*one from class others from functions.php or elsewhere*/
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ function myplugin_add_custom_box() {
+ add_meta_box('xilil-2', __("Page's language",'xili-language'), array(&$this,'xili_language_checkboxes_n'), 'page', 'side','high');
+ add_meta_box('xilil-2', __("Post's language",'xili-language'), array(&$this,'xili_language_checkboxes_n'), 'post', 'side','high');
+ if ($this->is_metabox) {
+ add_meta_box('xilil-1', __('Linked posts','xili-language'), array(&$this,'xili_language_linked_posts'), 'post', 'side','high');
+ add_meta_box('xilil-1', __('Linked pages','xili-language'), array(&$this,'xili_language_linked_posts'), 'page', 'side','high');
+ }
+ }
+
+ /**
+ * Will update term count based on posts AND pages.
+ *
+ * @access private from register taxonomy etc...
+ * @since 0.9.8.1
+ * @uses $wpdb
+ *
+ * @param array $terms List of Term taxonomy IDs
+ */
+ function _update_post_lang_count( $terms ) {
+ global $wpdb;
+ foreach ( (array) $terms as $term ) {
+ $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND term_taxonomy_id = %d", $term ) );
+ $wpdb->update( $wpdb->term_taxonomy, compact( 'count' ), array( 'term_taxonomy_id' => $term ) );
+ }
+ }
+
+ /**
+ * set language when post or page is saved or changed
+ *
+ * @since 0.9.0
+ * @completed 0.9.7.1 to record postmeta of linked posts in other languages
+ * @updated 0.9.7.5 to delete relationship when undefined
+ * @updated 0.9.9 to avoid delete relationship when in quick_edit
+ * @updated 1.3.0 to avoid delete relationship when trashing - 1.4.1 - create post-meta xl-search-linked
+ * @param $post_ID
+ */
+ function xili_language_add($post_ID) {
+ if (!isset($_POST['_inline_edit'])) { /* to avoid delete relationship when in quick_edit (edit.php) */
+ $sellang = $_POST['xili_language_set'];
+ if ("" != $sellang) {
+ wp_set_object_terms($post_ID, $sellang, TAXONAME);
+ } else {
+ if ($_GET['action'] != 'trash' && $_GET['action'] != 'untrash')
+ wp_delete_object_term_relationships( $post_ID, TAXONAME );
+ }
+ if ($this->is_metabox) {
+ /* the linked posts set by author */
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ foreach ($listlanguages as $language) {
+ $inputid = 'xili_language_'.QUETAG.'-'.$language->slug ;
+ $recinputid = 'xili_language_rec_'.QUETAG.'-'.$language->slug ;
+ $linkid = $_POST[$inputid];
+ $reclinkid = $_POST[$recinputid]; /* hidden previous value */
+ $langslug = QUETAG.'-'.$language->slug ;
+
+ if ($reclinkid != $linkid) { /* only if changed value or created since 1.3.0 */
+ if ((is_numeric($linkid) && $linkid == 0) || '' == $linkid ) {
+ delete_post_meta($post_ID, $langslug);
+ } elseif (is_numeric($linkid) && $linkid > 0) {
+ update_post_meta($post_ID, $langslug, $linkid);
+ if ($reclinkid == "-1") update_post_meta($linkid, QUETAG.'-'.$sellang, $post_ID);
+ }
+ }
+ }
+ //if (isset($_POST['xili_language_search_lang'])) {
+ if ('' != $_POST['xili_language_search_lang']) {
+ update_post_meta($post_ID, '_xl-search-linked', $_POST['xili_language_search_lang']);
+ } else {
+ if ($_GET['action'] != 'trash' && $_GET['action'] != 'untrash')
+ delete_post_meta($post_ID, '_xl-search-linked');
+ }
+ //}
+
+ }
+ } /* quick edit */
+ }
+
+ /**
+ * Return language dir
+ *
+ * @since 0.9.9
+ * @param slug of lang
+ */
+ function get_dir_of_cur_language($lang_slug) {
+ $rtlarray = explode ('-',$this->rtllanglist);
+ $dir = (in_array(substr(strtolower($lang_slug),0,2),$rtlarray)) ? 'rtl' : 'ltr';
+ return $dir;
+ }
+
+ /**
+ * Return language of post.
+ *
+ * @since 0.9.0
+ * @updated 0.9.7.6, 0.9.9
+ *
+ * @param $post_ID.
+ * @return slug of language of post or false if var langstate is false.
+ */
+ function get_cur_language($post_ID) {
+ $ress = wp_get_object_terms($post_ID, TAXONAME);
+ if ($ress) {
+ if (is_a($ress, 'WP_Error')){
+ echo "Language table not created ! see plug-in admin";
+ $this->langstate = false;
+ } else {
+ $obj_term = $ress[0];
+ $this->langstate = true;
+ $postlang = $obj_term->slug;
+ $postlangdir = $this->get_dir_of_cur_language($postlang);
+ return array('lang'=>$postlang,'direction'=>$postlangdir);
+ }
+ } else {
+ $this->langstate = false; /* can be used in language attributes for header */
+ return false; /* undefined state */
+ }
+ }
+
+ /* first activation of plugin */
+ function xili_language_activate() {
+ $this->xili_settings = get_option('xili_language_settings');
+ if(empty($this->xili_settings)) {
+ $this->xili_settings = array(
+ 'taxonomy' => 'language',
+ 'version' => '0.4',
+ 'reqtag' => 'lang',
+ 'browseroption' => '',
+ 'authorbrowseroption' => '',
+ 'taxolangsgroup' => 'languages_group',
+ 'functions_enable' => '',
+ 'langs_folder' => '',
+ 'theme_domain' => '',
+ 'homelang' => ''
+ );
+ update_option('xili_language_settings', $this->xili_settings);
+ }
+ }
+
+ /*enable the new query tag associated with new taxonomy*/
+ function keywords_addQueryVar($vars) {
+ $vars[] = QUETAG;
+ return $vars ;
+ }
+
+ function get_default_slug() {
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ $default_slug = 'en_us';
+ foreach ($listlanguages as $language) {
+ if ($language->name == $this->default_lang ) return $language->slug;
+ }
+ return $default_slug ;
+ }
+
+ /**
+ * filters used when querytag is used -
+ * see below and functions.php where rules depend from theme
+ */
+ function with_lang($join) {
+ global $wp_query, $wpdb;
+ if ( '' != $wp_query->query_vars[QUETAG] ) {
+ $join .= " LEFT JOIN $wpdb->term_relationships as tr ON ($wpdb->posts.ID = tr.object_id) LEFT JOIN $wpdb->term_taxonomy as tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) ";
+ }
+
+ return $join;
+ }
+
+ /**
+ * Setup global post data.
+ *
+ * @since 0.9.0
+ * @updated 0.9.4 (OR added) lang=xx_xx,yy_yy,..
+ *
+ * @param object $where.
+ * @return $where.
+ */
+ function where_lang($where) {
+ global $wp_query , $wpdb;
+ $reqtags = array();
+ $thereqtags = array();
+ if ( '' != $wp_query->query_vars[QUETAG] ) {
+ /* one or more lang - no + because only one lang per post now */
+ if ( strpos($wp_query->query_vars[QUETAG], ',') !== false ) {
+ $langs = preg_split('/[,\s]+/', $wp_query->query_vars[QUETAG]);
+ foreach ( (array) $langs as $lang ) {
+ $lang = sanitize_term_field('slug', $lang, 0, 'post_tag', 'db');
+ $reqtags[]= $lang;
+ }
+
+ foreach ($reqtags as $reqtag){
+ $reqtagt = is_term( $reqtag, TAXONAME );
+ if ($reqtagt)
+ $thereqtags[] = $reqtagt['term_id'];
+ }
+
+ $wherereqtag = implode(", ", $thereqtags);
+ $where .= " AND tt.taxonomy = '".TAXONAME."' ";
+ $where .= " AND tt.term_id IN ( $wherereqtag )";
+
+ } else {
+ /* only one lang */
+ $wp_query->query_vars[QUETAG] = sanitize_term_field('slug', $wp_query->query_vars[QUETAG], 0, 'post_tag', 'db');
+ $reqtag = $wp_query->query_vars[QUETAG];
+ $reqtag = is_term( $reqtag, TAXONAME );
+ if (''!= $reqtag) {
+ $wherereqtag = $reqtag['term_id'];
+ } else {
+ $wherereqtag = 0;
+ }
+ $where .= " AND tt.taxonomy = '".TAXONAME."' ";
+ $where .= " AND tt.term_id = $wherereqtag ";
+ }
+
+ }
+ return $where;
+ }
+
+ /******** template theme live modifications ********/
+
+ /**
+ * wp action for theme at end of query
+ *
+ * @since 0.9.0
+ * @updated 1.1.9
+ * can be hooked in functions.php xiliml_cur_lang_head
+ * call by wp hook
+ *
+ */
+ function xiliml_language_wp() {
+ $this->curlang = $this->xiliml_cur_lang_head();
+ $this->curlang_dir = $this->get_dir_of_cur_language($this->curlang); /* general dir of the theme */
+ if (!defined('THEME_TEXTDOMAIN')) _e('xili-language plugin : THEME_TEXTDOMAIN UNDEFINED','xili-language'); /* here because not visible in admin UI */
+
+ if ($this->locale_method) {
+ $this->xiliml_load_theme_textdomain (THEME_TEXTDOMAIN); /* new method for cache compatibility - tests */
+ } else {
+ $this->set_mofile($this->curlang);
+ }
+ }
+
+ /**
+ * locale hook when load_theme_textdomain is present in functions.php
+ *
+ * @since 1.1.9
+ *
+ * call by locale hook
+ */
+ function xiliml_setlocale ($locale) {
+ if ($this->theme_locale === true) {
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false,'slug' => $this->curlang));
+ return $listlanguages[0]->name;
+ } else {
+ return $locale;
+ }
+ }
+
+ /**
+ * locale hook when load_theme_textdomain is present in functions.php
+ *
+ * @since 1.1.9
+ *
+ * call by locale hook
+ */
+ function xiliml_load_theme_textdomain ($domain) {
+ $this->theme_locale = true;
+ $langfolder = (defined('THEME_LANGS_FOLDER')) ? THEME_LANGS_FOLDER : $this->xili_settings['langs_folder'];
+ $langfolder = '/'.str_replace("/","",$langfolder); /* please no lang folder in sub-subfolder */
+ $langfolder = ($langfolder == "/") ? "" : $langfolder;
+ load_theme_textdomain($domain, get_template_directory() . $langfolder);
+ $this->theme_locale = false;
+ }
+
+ /**
+ * select .mo file
+ * @since 0.9.0
+ * @updated 0.9.7.1 - 1.1.9
+ * call by function xiliml_language_wp()
+ * @param $curlang .
+ */
+ function set_mofile($curlang) {
+ // load_theme_textdomain(THEME_TEXTDOMAIN); - replaced to be flexible -
+ if (defined('THEME_TEXTDOMAIN')) {$themetextdomain = THEME_TEXTDOMAIN; } else {$themetextdomain = 'ttd-not-defined'; }
+ $langfolder = (defined('THEME_LANGS_FOLDER')) ? THEME_LANGS_FOLDER : $this->xili_settings['langs_folder'];
+ $langfolder = '/'.str_replace("/","",$langfolder); /* please no lang folder in sub-subfolder */
+ $langfolder = ($langfolder == "/") ? "" : $langfolder;
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false,'slug' => $curlang));
+ $filename = $listlanguages[0]->name;
+ $filename .= '.mo';
+ if ('' != $filename) {
+ $mofile = get_template_directory() .$langfolder."/$filename";
+ load_textdomain($themetextdomain,$mofile);
+ }
+ }
+
+ /**
+ * default rules - set curlang in head according rules
+ *
+ * @since 0.9.7
+ * @updated 0.9.7.1 - if no posts 0.9.9.1 - 0.9.9.4
+ * @updated 1.3.2 - Option for home.php
+ *
+ * default filter of xiliml_cur_lang_head
+ * @return $curlang .
+ */
+ function xiliml_cur_lang_head () {
+ if (has_filter('xiliml_cur_lang_head')) return apply_filters('xiliml_cur_lang_head',''); /* '' warning on some server need one arg by default*/
+ /* default */
+ global $post,$wp_query, $query_string;
+ if (have_posts()) {
+ if(!is_front_page()) { /* every pages */
+ $curlangdir = $this->get_cur_language($post->ID);
+ $curlang = $curlangdir['lang']; /* the first post give the current lang*/
+ if ($curlangdir == false) $curlang = DEFAULTSLUG; /* can be changed if use hook */
+ if (is_page()) {
+ if (isset($_GET["loclang"])) {
+ $curlang=$_GET["loclang"];
+ /* get var to override the selected lang - ex. in bi-lingual contact*/
+ }
+ }
+ elseif (is_search() && isset($_GET["lang"])) {
+ $curlang=$_GET["lang"]; /*useful when no result*/
+ }
+ } else { /* front page */
+ if ( '' != $wp_query->query_vars[QUETAG] ) {
+ $curlang = $wp_query->query_vars[QUETAG]; /* home series type*/
+ } else {
+ $showpage = get_settings('show_on_front');
+ $page_front = get_settings('page_on_front');
+ $hcurlang = (isset($_GET["hlang"])) ? $_GET["hlang"] : $this->choice_of_browsing_language() ;
+ $target = get_post_meta($page_front, 'lang-'.$hcurlang, true);
+ if ($showpage == "page") {
+ if ($target && $target != $post->ID) { /* only if present and diff */
+ query_posts('page_id='.$target);
+ if (have_posts()) {
+ the_post();
+ $curlang = get_cur_language($post->ID);
+ rewind_posts();
+ } else {
+ query_posts('page_id='.$page_front); /* restore */
+ $curlang = get_cur_language($page_front);
+ }
+ } else {
+ $curlang = get_cur_language($post->ID);
+ }
+ } else { /* home.php - 1.3.2 */
+ $curlang = $this->choice_of_browsing_language();
+ if ($this->xili_settings['homelang'] == 'modify') query_posts($query_string."&lang=".$curlang);
+ }
+ }
+ }
+ } else { /*no posts for instance in category + lang */
+ if (isset($_GET["lang"])) {
+ $curlang=$_GET["lang"];
+ } else {
+ $curlang = $this->choice_of_browsing_language();//strtolower(WPLANG); /* select here the default language of the site */
+ }
+ }
+ return $curlang; /* as in external hook for filter*/
+ }
+
+ /**
+ * modify language_attributes() output
+ *
+ * @since 0.9.7.6
+ *
+ * The - language_attributes() - template tag is use in header of theme file in html tag
+ *
+ * @param $output
+ */
+ function head_language_attributes($output) {
+ /* hook head_language_attributes */
+ if (has_filter('head_language_attributes')) return apply_filters('head_language_attributes',$output);
+ $attributes = array();
+ $output = '';
+
+ if ( $dir = get_bloginfo('text_direction') ) /*use hook for future use */
+ $attributes[] = "dir=\"$dir\"";
+ if ($this->langstate == true) {
+ $lang = str_replace('_','-',substr($this->curlang,0,3).strtoupper(substr($this->curlang,-2)));
+ } else {
+ //use hook if you decide to display limited list of languages for use by instance in frontpage
+ $listlang = array();
+ //$listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ $listlanguages = get_terms_of_groups_lite ($this->langs_group_id,TAXOLANGSGROUP,TAXONAME,'ASC');
+ foreach ($listlanguages as $language) {
+ $listlang[] = str_replace('_','-',$language->name);
+ }
+ $lang = $listlang[0]; // implode(', ',$listlang); // not w3c compatible
+ }
+ if ( get_option('html_type') == 'text/html')
+ $attributes[] = "lang=\"$lang\"";
+
+ if ( get_option('html_type') != 'text/html')
+ $attributes[] = "xml:lang=\"$lang\"";
+
+ $output = implode(' ', $attributes);
+ return $output;
+ }
+
+ /**
+ * modify insert language metas in head (via wp_head)
+ *
+ * @since 0.9.7.6
+ * @updated 1.1.8
+ * @must be defined in functions.php according general theme design (wp_head)
+ *
+ * @param $curlang
+ */
+ function head_insert_language_metas($curlang,$undefined=true) {
+ $curlang = $this->curlang;
+ $undefined = $this->langstate;
+ echo "<!-- multilingual website powered with xili-language v. ".XILILANGUAGE_VER." WP plugin of dev.xiligroup.com -->\n";
+ if (has_filter('head_insert_language_metas')) return apply_filters('head_insert_language_metas',$curlang,$undefined);
+ }
+
+ /**
+ * Translate texts of widgets
+ *
+ * @since 0.9.8.1
+ * @ return
+ */
+ function widget_texts ($value){
+ return __($value,THEME_TEXTDOMAIN);
+ }
+
+ /**
+ * insert other language of wp_list_categories
+ *
+ * @since 0.9.0
+ * @updated 0.9.8.4 - 1.4.1 = no original term in ()
+ * can be hooked by filter add_filter('xiliml_cat_language','yourfunction',2,3) in functions.php
+ * call by do_filter list_cats
+ * @param $content, $category
+ */
+ function xiliml_cat_language ($content, $category = null) {
+ if (has_filter('xiliml_cat_language')) return apply_filters('xiliml_cat_language',$content, $category,$this->curlang);
+ $new_cat_name = (!is_admin()) ? __($category->name,THEME_TEXTDOMAIN) : $content ; /*to detect admin UI*/
+ return $new_cat_name;
+ }
+
+ /**
+ * add the language key in category links of current pages
+ *
+ * @since 0.9.0
+ * update 0.9.7
+ * can be hooked by filter add_filter('xiliml_link_append_lang','yourfunction',10,2) in functions.php
+ * call by do_filter
+ * @param $content,
+ */
+ function xiliml_link_append_lang( $link ) {
+ if (has_filter('xiliml_link_append_lang')) return apply_filters('xiliml_link_append_lang',$link,$this->curlang);
+ /*default*/
+ if ($this->curlang) :
+ $link .= '&'.QUETAG.'='.$this->curlang ;
+ endif;
+
+ return $link;
+ }
+
+ /**
+ * Setup global post data.
+ *
+ * @since 0.9.4
+ * update 0.9.7
+ * can be hooked by filter add_filter('xiliml_taglink_append_lang','yourfunction',2,3) in functions.php
+ *
+ * @param $taglink, $tag_id.
+ * @return $taglink.
+ */
+ function xiliml_taglink_append_lang ( $taglink, $tag_id=null ) {
+ if (has_filter('xiliml_taglink_append_lang')) return apply_filters('xiliml_taglink_append_lang',$taglink,$tag_id,$this->curlang);
+ /* no yet default */
+ /* global $curlang;
+
+ if ($curlang) :
+ $taglink .= '&'.QUETAG.'='.$curlang ;
+ endif;
+
+ */
+ return $taglink;
+ }
+
+ /**
+ * to cancel sub select by lang in cat 1 by default
+ *
+ * @since 0.9.2
+ * update 0.9.7
+ * can be hooked by filter add_filter('xiliml_modify_querytag','yourfunction') in functions.php
+ *
+ *
+ */
+ function xiliml_modify_querytag() {
+ if (has_filter('xiliml_modify_querytag')) {
+ apply_filters('xiliml_modify_querytag','');
+ } else {
+ /*default*/
+ global $wp_query;
+ if (!defined('XILI_CATS_ALL')) define('XILI_CATS_ALL','1'); /* change in functions.php or use hook in cat 1 by default*/
+ $excludecats = explode(",", XILI_CATS_ALL);
+ if (!empty($wp_query->query_vars['cat'])) {
+ if (in_array($wp_query->query_vars['cat'],$excludecats)) {
+ $wp_query->query_vars[QUETAG] = ""; /* to cancel sub select */
+ }
+ }
+ }
+ }
+ /**
+ * filters for wp_get_archives
+ *
+ * @since 0.9.2
+ * @params $join or $where and template params
+ *
+ */
+ function xiliml_getarchives_join($join,$r) {
+ global $wpdb;
+ if (has_filter('xiliml_getarchives_join')) return apply_filters('xiliml_getarchives_join',$join,$r,$this->curlang);
+ extract( $r, EXTR_SKIP );
+ $this->get_archives_called = $r;
+ if (isset($lang)) {
+ if ("" == $lang ) { /* used for link */
+ $this->get_archives_called['lang'] = $this->curlang;
+ } else {
+ $this->get_archives_called['lang'] = $lang;
+ }
+ $join = " INNER JOIN $wpdb->term_relationships as tr ON ($wpdb->posts.ID = tr.object_id) INNER JOIN $wpdb->term_taxonomy as tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) ";
+
+ }
+ return $join;
+
+ }
+
+ function xiliml_getarchives_where($where,$r) {
+ global $wpdb;
+ if (has_filter('xiliml_getarchives_where')) return apply_filters('xiliml_getarchives_where',$where,$r,$this->curlang);
+ extract( $r, EXTR_SKIP );
+ if (isset($lang)) {
+ if ("" == $lang ) {
+ $curlang = $this->curlang;
+ } else {
+ $curlang = $lang;
+ }
+ $reqtag = is_term( $curlang, TAXONAME );
+ if (''!= $reqtag) {
+ $wherereqtag = $reqtag['term_id'];
+ } else {
+ $wherereqtag = 0;
+ }
+ $where .= " AND tt.taxonomy = '".TAXONAME."' ";
+ $where .= " AND tt.term_id = $wherereqtag ";
+ }
+ return $where;
+ }
+
+ /* here basic translation - to improve depending theme features : use hook 'xiliml_get_archives_link' */
+ function xiliml_get_archives_link($link_html) {
+ if (has_filter('xiliml_link_translate_desc')) return apply_filters('xiliml_get_archives_link', $link_html,$this->get_archives_called, $this->curlang);
+ extract( $this->get_archives_called, EXTR_SKIP );
+ if ('' != $lang) {
+ $permalink = get_option('permalink_structure');
+ $sep = ('' == $permalink) ? "&lang=" : "?lang=";
+ if ($format != 'option' && $format != 'link' && $type != 'postbypost' && $type != 'alpha') {
+ /* text extract */
+ $i = preg_match_all("/'>(.*)<\/a>/Ui", $link_html, $matches,PREG_PATTERN_ORDER);
+ $line = $matches[1][0];
+ /* link extract */
+ $i = preg_match_all("/href='(.*)' title/Ui", $link_html, $matches,PREG_PATTERN_ORDER);
+ if ( '' == $type || 'monthly' == $type) {
+ if ('' == $permalink) {
+ $archivedate = str_replace(get_bloginfo('siteurl').'/?' , "" , $matches[1][0]);
+ $r = wp_parse_args( $archivedate, array());
+ extract($r, EXTR_SKIP );
+ $month = substr($m,-2);
+ $year = substr($m,0,4);
+ } else {
+ /* Due to prevents post ID and date permalinks from overlapping using /date/ v 1.1.9
+ * no / at end for "numeric" permalink giving /archives/date/2009/04
+ */
+ $thelink = $matches[1][0];
+ $i = preg_match_all("/\/([0-9]{4})\/([0-9]{2})/Ui", $thelink, $results,PREG_PATTERN_ORDER);
+ if ($i) { //print_r($results);
+ $month = $results[2][0];
+ $year = $results[1][0];
+ }
+ }
+ $time = strtotime($month.'/1/'.$year);
+ $line2print = the_xili_local_time('%B %Y',$time); /* use server local*/
+ $link_html = str_replace($line , $line2print , $link_html);
+ }
+ $link_html = str_replace("' titl" , $sep.$lang."' titl" , $link_html);
+ } elseif ($format == 'option') {
+ /* need improve with regex */
+ $link_html = str_replace("'>" , $sep.$lang."'>" , $link_html);
+ }
+ }
+ return $link_html;
+ }
+
+ /**
+ * translate description of categories
+ *
+ * @since 0.9.0
+ * update 0.9.7 - 0.9.9.4
+ * can be hooked by filter add_filter('xiliml_link_translate_desc','yourfunction',2,4) in functions.php
+ *
+ *
+ */
+ function xiliml_link_translate_desc( $description, $category=null,$context='') {
+ if (has_filter('xiliml_link_translate_desc')) return apply_filters('xiliml_link_translate_desc',$description,$category,$context,$this->curlang);
+ $translated_desc = ($this->curlang && ''!= $description) ? __($description,THEME_TEXTDOMAIN) : $description ;
+ return $translated_desc;
+ }
+
+ /**
+ * filters for wp_title() translation - single_cat_title -
+ * since 1.4.1
+ *
+ */
+ function xiliml_single_cat_title_translate ($cat_name) {
+ if (has_filter('xiliml_single_cat_title_translate')) return apply_filters('xiliml_single_cat_title_translate',$cat_name);
+ $translated = ($this->curlang && ''!= $cat_name) ? __($cat_name,THEME_TEXTDOMAIN) : $cat_name;
+ return $translated;
+ }
+
+ /**
+ * Return the list of preferred languages for displaying pages (see in firefox prefs)
+ * thanks to php.net comments HTTP_ACCEPT_LANGUAGE
+ * @since 0.9.7.5
+ *
+ * @return array (non sorted)
+ */
+ function the_preferred_languages() {
+ $preferred_languages = array();
+ if(preg_match_all("#([^;,]+)(;[^,0-9]*([0-9\.]+)[^,]*)?#i",$_SERVER["HTTP_ACCEPT_LANGUAGE"], $matches, PREG_SET_ORDER)) {
+ foreach($matches as $match) {
+ $preferred_languages[$match[1]] = floatval($match[3]);
+ if($match[3]==NULL) $preferred_languages[$match[1]] = 1.0;
+ }
+ return $preferred_languages;
+ } else {
+ return false;
+ }
+ }
+ /**
+ * Return the lang defined by admin UI if no browser
+ *
+ * @since 1.0
+ *
+ */
+ function choice_of_home_selected_lang() {
+ if ($this->browseroption == 'browser') {
+ return choice_of_browsing_language();
+ } elseif ($this->browseroption != '') { /* slug of the lang*/
+ return $this->browseroption;
+ } else {
+ return strtolower($this->default_lang);
+ }
+ }
+
+ /**
+ * Return the list of preferred languages for displaying pages (see in firefox prefs)
+ * thanks to php.net comments HTTP_ACCEPT_LANGUAGE
+ * @since 0.9.7.5
+ * @update 0.9.9.4
+ * @return array (non sorted)
+ */
+ function choice_of_browsing_language() {
+ if (has_filter('choice_of_browsing_language')) return apply_filters('choice_of_browsing_language');
+ if ($this->browseroption != 'browser') return $this->choice_of_home_selected_lang(); /* in settings UI - after filter to hook w/o UI */
+ $listofprefs = $this->the_preferred_languages();
+ if (is_array($listofprefs)) {
+ arsort($listofprefs, SORT_NUMERIC);
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ $sitelanguage = $this->match_languages ($listofprefs,$listlanguages);
+ if ($sitelanguage) return $sitelanguage->slug;
+ return strtolower($this->default_lang);
+ } else {
+ return strtolower($this->default_lang);
+ }
+ }
+
+ function match_languages ($listofprefs,$listlanguages) {
+
+ foreach($listofprefs as $browserlanguage => $priority) {
+ /* match root languages to give similar in site - first : five chars langs*/
+ foreach($listlanguages as $sitelanguage) {
+ if ($sitelanguage->slug == str_replace('-','_',$browserlanguage)) return $sitelanguage;
+ }
+ }
+ foreach($listofprefs as $browserlanguage => $priority) {
+ /* match root languages to give similar in site - second : two first chars langs*/
+ foreach($listlanguages as $sitelanguage) {
+ if (str_replace('-','_',$browserlanguage) == substr($sitelanguage->slug,0,2)) return $sitelanguage;
+ }
+ }
+ }
+
+ /********************************** ADMIN UI ***********************************/
+
+ /**
+ * add admin menu and associated pages of admin UI
+ *
+ * @since 0.9.0
+ * @updated 0.9.6 - only for WP 2.7.X - do registering of new meta boxes and JS
+ *
+ */
+ function xili_add_pages() {
+ $this->thehook = add_options_page(__('Languages','xili-language'), __('Languages','xili-language'), 'manage_options', 'language_page', array(&$this,'languages_settings'));
+ add_action('load-'.$this->thehook, array(&$this,'on_load_page'));
+ }
+
+ function on_load_page() {
+ wp_enqueue_script('common');
+ wp_enqueue_script('wp-lists');
+ wp_enqueue_script('postbox');
+ add_meta_box('xili-language-sidebox-1', __('Message','xili-language'), array(&$this,'on_sidebox_1_content'), $this->thehook , 'side', 'core');
+ add_meta_box('xili-language-sidebox-2', __('Info','xili-language'), array(&$this,'on_sidebox_2_content'), $this->thehook , 'side', 'core');
+ add_meta_box('xili-language-sidebox-4', __('Special','xili-language'), array(&$this,'on_sidebox_4_content'), $this->thehook , 'side', 'core');
+
+ }
+
+ /**
+ * Add action link(s) to plugins page
+ *
+ * @since 0.9.3
+ * @author MS
+ * @copyright Dion Hulse, http://dd32.id.au/wordpress-plugins/?configure-link and scripts@schloebe.de
+ */
+ function xililang_filter_plugin_actions($links, $file){
+ static $this_plugin;
+ if( !$this_plugin ) $this_plugin = plugin_basename(__FILE__);
+ if( $file == $this_plugin ){
+ $settings_link = '<a href="options-general.php?page=language_page">' . __('Settings') . '</a>';
+ $links = array_merge( array($settings_link), $links); // before other links
+ }
+ return $links;
+ }
+
+ /* UI added in sidebar of post admin (write , edit)
+ *
+ * @since 0.9.0
+ * @updated 0.9.5 : add a no-lang radio - again in top of sidebar admin post's UI
+ * @updated 0.9.8.3 : if new post and checked in settings : default language = author's browser's language !
+ * @updated 1.3.0
+ */
+ function xili_language_checkboxes_n() {
+ global $post_ID ;
+ //$listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ $listlanguages = get_terms_of_groups_lite ($this->langs_group_id,TAXOLANGSGROUP,TAXONAME,'ASC');
+ if ($this->authorbrowseroption == 'authorbrowser') { // setting = select language of author's browser
+ $listofprefs = $this->the_preferred_languages();
+ if (is_array($listofprefs)) {
+ arsort($listofprefs, SORT_NUMERIC);
+ $sitelanguage = $this->match_languages ($listofprefs,$listlanguages);
+ if ($sitelanguage) {
+ $defaultlanguage = $sitelanguage->name;
+ } else {
+ $defaultlanguage = "";
+ }
+ $mention = '('.__('Browser language', 'xili-language').')';
+ } else {
+ $defaultlanguage = ""; /* undefined */
+ }
+ } else {
+ $defaultlanguage = ""; /* undefined */
+ $mention = "";
+ }
+
+ if(0 != $post_ID){
+ $ress = wp_get_object_terms($post_ID, TAXONAME);
+
+ /*Array ( [0] => stdClass Object ( [term_id] => 18 [name] => [slug] => 18 [term_group] => 0 [term_taxonomy_id] => 19 [taxonomy] => language [description] => [parent] => 0 [count] => 1 ) )*/
+ $obj_term = $ress[0];
+ if ('' != $obj_term->name) :
+ $curlangname = $obj_term->name;
+ else :
+ $curlangname = ""; /* when created before plugin */
+ endif;
+
+ } else {
+ if (isset($_GET['xltgt_lang'])) {
+ $curlangname = $_GET['xltgt_lang']; /* since 1.3.0 */
+ $mention = '<br />('.__('From other post', 'xili-language').': '.$_GET['xlfrom_id'].' '.$_GET['xlfrom_lang'].')';
+ } else {
+ $curlangname = $defaultlanguage; /* new post */
+ }
+ }
+ echo __('Selected language', 'xili-language').' : <strong>'.$curlangname.'</strong> '.((0 == $post_ID) ? $mention : "").'<br /><br />' ; /*link to bottom of sidebar*/
+ foreach ($listlanguages as $language) { ?>
+ <label for="xili_language_check_<?php echo $language->slug ; ?>" class="selectit"><input id="xili_language_check_<?php echo $language->slug ; ?>" name="xili_language_set" type="radio" value="<?php echo $language->slug ; ?>" <?php if($curlangname==$language->name) echo 'checked="checked"' ?> /> <?php echo _e($language->description, 'xili-language'); ?></label>
+
+ <?php } /*link to top of sidebar*/?>
+ <label for="xili_language_check" class="selectit"><input id="xili_language_check" name="xili_language_set" type="radio" value="" <?php if($curlangname=="") echo 'checked="checked"' ?> /> <?php _e('undefined','xili-language') ?></label><br />
+ <br /><small>© xili-language</small>
+ <?php
+ }
+
+ /**
+ * to display the linked posts in post edit UI
+ *
+ * @since 0.9.8
+ * @updated 1.3.0
+ *
+ */
+ function xili_language_linked_posts() {
+ global $post_ID, $post;
+ $update_nonce = wp_create_nonce('oklinked');
+ $postlang = '';
+ if(0 != $post_ID){
+ $ress = wp_get_object_terms($post_ID, TAXONAME);
+ $obj_term = $ress[0];
+ $postlang = ('' != $obj_term->slug) ? $obj_term->slug : ""; /* when created before plugin */
+ } else {
+ $postlang = ""; /* new post */
+ }
+ //$listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ $listlanguages = get_terms_of_groups_lite ($this->langs_group_id,TAXOLANGSGROUP,TAXONAME,'ASC');
+ if ($post->post_type == 'post') { ?>
+ <p><em><?php _e('ID of posts in other languages:','xili-language'); ?></em></p>
+ <?php $theid = 'Post ID';
+ $autosearchmess = __('to auto search linked posts. (read docs)','xili-language');
+ $post_type = 'post';
+ } else {
+ ?> <p><em><?php _e('ID of pages in other languages:','xili-language'); ?></em></p>
+ <?php $theid = 'Page ID';
+ $autosearchmess = __('to auto search linked pages. (read docs)','xili-language');
+ $post_type = 'page';
+ }
+ ?>
+ <table width="100%" cellspacing="4" cellpadding="2">
+ <thead>
+ <tr ><th><?php _e('Language','xili-language'); ?></th><th align="left"><?php _e($theid,'xili-language'); ?></th><th align="left"><?php _e('Display','xili-language'); ?></th><th align="left"><?php _e('Edit'); ?></th></tr>
+ </thead>
+ <tbody id='the-linked' class='list:linked'>
+ <?php
+ if (0 != $post_ID) $autosearch = get_post_meta($post_ID,'_xl-search-linked',true);
+ foreach ($listlanguages as $language) {
+ $output = "";
+ $otherpost = "";
+ $line = true;
+ if ($language->slug == $postlang ) {
+ if ($post->post_status == 'publish' || $post->post_status == 'pending') {
+ $line = false;
+ } else {
+ $line = true;
+ }
+ }
+ if ($line) {
+ if (0 != $post_ID) {
+ $otherpost = get_post_meta($post_ID, QUETAG.'-'.$language->slug, true);
+ $otherpostr = $otherpost;
+ /* since 1.3.0 - 1.4.1 */
+ if ('' != $autosearch && "" != $postlang) {
+ $source_ID = $this->search_pinger_post($post_ID,QUETAG.'-'.$postlang,$language->term_id, $post_type);
+ if (0 != $source_ID) {
+ $otherpost = $source_ID;
+ $otherpostr = "-1"; /* to be refreshed */
+ }
+ }
+ } else { /* since 1.3.0 */
+ if (isset($_GET['xlfrom_id'])) {
+ if ($_GET['xlfrom_lang'] == $language->slug) {
+ $otherpost = $_GET['xlfrom_id'];
+ $otherpostr = "-1";
+ } else {
+ /* pre-fill linked posts from source post */
+ $otherpost = get_post_meta($_GET['xlfrom_id'], QUETAG.'-'.$language->slug, true);
+ $otherpostr = "-1";
+ }
+ }
+ }
+
+ ?>
+ <tr ><th>
+ <label for="xili_language_<?php echo QUETAG.'-'.$language->slug ; ?>"><?php _e($language->description,'xili-language') ; ?> </label></th><td align="left"><input id="xili_language_<?php echo QUETAG.'-'.$language->slug ; ?>" name="xili_language_<?php echo QUETAG.'-'.$language->slug ; ?>" value="<?php echo $otherpost; ?>" size="5" /><input type="hidden" name="xili_language_rec_<?php echo QUETAG.'-'.$language->slug ; ?>" value="<?php echo $otherpostr; ?>"/>
+
+ <?php
+ if ('' != $otherpost ) {
+ $output = "</td><td><a target='_blank' href='".get_permalink($otherpost)."' >"." ".__($language->description,'xili-language') ."</a></td><td><a target='_blank' href='post.php?action=edit&post=".$otherpost."' >"." ".__('Edit') ."</a></td></tr>";
+ } else {
+ $output = $this->newlinkedpost($postlang, $language->name); /* if possible */
+ }
+ }
+ echo $output;
+ }
+ /* since 1.4.1 */
+ if (0 != $post_ID && "" != $postlang) {
+ ?>
+ <tr ><th><?php _e('Check','xili-language'); ?></th><td><input id="xili_language_search_lang" name="xili_language_search_lang" type="checkbox" value="searchlinked" <?php if('' != $autosearch) echo 'checked="checked"' ?> /></td><td colspan = 2 ><small><?php echo$autosearchmess ; ?></small></td></tr>
+ <?php } ?>
+ </tbody></table>
+ <br /><small>© xili-language</small>
+ <?php if ($this->post_ajax) { ?>
+ <div id='formstatus'></div><span id='loading' class='hidden'><?php _e('Saving...','xili-language') ?></span><span id='loading2' class='hidden'><?php _e('Refreshing...','xili-language') ?></span><div class='submit'>
+ <input id='updatelink' name='updatelinked' type='submit' tabindex='6' value='Update' /><small>© xili-language</small></div><?php echo wp_nonce_field( 'oklinked', '_ajax_nonce', true, false );/**/ ?><?php /* echo wp_nonce_field( 'customrefresh', '_ajax_nonce', false, false );*/ ?>
+ <script type='text/javascript'>
+ <!--
+
+ jQuery(document).ready(function(){
+ jQuery('#updatelink').click(function() { //start function when Random button is clicked
+ jQuery.ajax({
+ type: "post",url: "admin-ajax.php",
+ data: {
+ action: 'oklinked',
+ <?php
+ foreach ($listlanguages as $language) {
+ echo "xili_language_".$language->slug.": "."escape( jQuery( '#"."xili_language_".QUETAG."-".$language->slug."' ).val()),";
+ }
+ echo "post_id: '".$post_ID."',";
+ ?>
+ _ajax_nonce: '<?php echo $update_nonce; ?>'
+ },
+ beforeSend: function() {jQuery("#loading").fadeIn('fast');jQuery("#formstatus").fadeIn("fast");}, //when link is clicked
+ success: function(html){ //so, if data is retrieved, store it in html
+ jQuery("#loading").fadeOut('slow');
+ jQuery("#formstatus").html( html );
+ jQuery.ajax({ // refresh custom fields list
+ type: "post",url: "admin-ajax.php",
+ data: {
+ action: 'customrefresh',
+ <?php
+ echo "post_id: '".$post_ID."',"; ?>
+ _ajax_nonce: '<?php echo $update_nonce; ?>'
+ },
+ beforeSend: function() {jQuery("#loading2").fadeIn('fast');},
+ success: function(html){
+ jQuery("#the-list").html( html );
+ jQuery("#loading2").fadeOut('slow');
+ }
+ });
+ }
+ }); //close jQuery.ajax
+ return false;
+ })
+ })
+ -->
+ </script><?php }
+ }
+ /**
+ * to create a linked post in target language
+ *
+ * @since 1.3.0
+ * @updated 1.3.1 - Add New specific for pages
+ *
+ */
+ function newlinkedpost($postlang = "" , $targetlang = "") {
+ global $post;
+ $whatnew = ($post->post_type == 'post') ? 'post' : 'page';
+ if ($post->post_status == 'publish' || $post->post_status == 'pending' || $post->post_status == 'draft') {
+ if ($postlang != strtolower($targetlang)) {
+ return "</td><td><small>".__('*','xili-language')."</small></td><td><a href='".$whatnew."-new.php?xlfrom_id=".$post->ID."&xlfrom_lang=".$postlang."&xltgt_lang=".$targetlang."' target='_blank' >".__('Add New')."</a></td><tr>";
+ }
+ } else {
+ return "</td></tr>";
+ }
+ }
+
+ /**
+ * to research post linking current post in the language
+ * @since 1.4.1
+ * @params ID of post, lang of this post as meta_key, lang of searched pinger post, type of post (page)
+ *
+ */
+ function search_pinger_post ($targetID,$langmeta,$pingerlang,$posttype) {
+ global $wpdb;
+
+ $query = "SELECT ID FROM $wpdb->posts as pp LEFT JOIN $wpdb->postmeta as pm ON (pp.ID = pm.post_id) LEFT JOIN $wpdb->term_relationships as tr ON (pp.ID = tr.object_id) LEFT JOIN $wpdb->term_taxonomy as tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) WHERE 1=1 AND pm.meta_key = '$langmeta' AND pm.meta_value = '$targetID' AND pp.post_type = '$posttype' AND (pp.post_status IN ('publish','private','draft','pending')) AND tt.taxonomy = 'language' AND tt.term_id = $pingerlang ORDER BY pp.post_date DESC LIMIT 0, 1";
+ //echo $query;
+ $r = @$wpdb->get_col($query);
+ //print_r($r);
+ if (!empty($r)) {
+ $id = $r[0]; /* if multiple take the most recent */
+ } else {
+ $id = 0;
+ }
+//echo '->'.$id.$langmeta.$targetID.'</br>';
+ return $id;
+ }
+ /* obsolete */
+ function custom_refresh() {
+ check_ajax_referer( "oklinked" );
+ $post_ID = $_POST['post_id'];
+ $count = 0;
+ $metadata = has_meta($post_ID);
+ $list ="";
+ $output = '';//<tr><td>Refreshed by xili-language</td></tr>';
+ if ($metadata)
+ foreach ( $metadata as $entry ) { $list .= _list_meta_row( $entry, $count );}
+ $output .= $list;
+ echo $output."<!--- end updated by xili-language -->";
+ die();
+ }
+
+ function ok_linked() {
+ check_ajax_referer( "oklinked" );
+
+ $post_ID = $_POST['post_id'];
+
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ $linked = array ();
+ foreach ($listlanguages as $language) {
+ $key = $language->slug;
+ $linked[$key] = $_POST['xili_language_'.$key];
+ $linkid = $linked[$key];
+ //$reclinkid = $_POST[$recinputid]; /* hidden previous value */
+ $langslug = QUETAG.'-'.$key ;
+ //if ($reclinkid != $linkid) { /* only if changed value */
+ if ((is_numeric($linkid) && $linkid == 0) || '' == $linkid ) {
+ delete_post_meta($post_ID, $langslug);
+ } elseif (is_numeric($linkid) && $linkid > 0) {
+ update_post_meta($post_ID, $langslug, $linkid);
+ $mess .= " ".$key;
+ }
+ }
+ echo '<p>All is OK '.$post_id.' ('.$mess.')</p>'; // voir bannière //
+ die();
+
+ }
+
+ /**
+ * to display the languages settings admin UI
+ *
+ * @since 0.9.0
+ * @updated 0.9.6 - only for WP 2.7.X - do new meta boxes and JS
+ *
+ */
+ function languages_settings() {
+ $formtitle = 'Add a language'; /* translated in form */
+ $submit_text = __('Add »','xili-language');
+ $cancel_text = __('Cancel');
+
+ if (isset($_POST['reset'])) {
+ $action=$_POST['reset'];
+ } elseif (isset($_POST['updateoptions'])) {
+ $action='updateoptions';
+ } elseif (isset($_POST['updateundefined'])) {
+ $action='updateundefined';
+
+ } elseif (isset($_POST['action'])) {
+ $action=$_POST['action'];
+ }
+
+ if (isset($_GET['action'])) :
+ $action=$_GET['action'];
+ $term_id = $_GET['term_id'];
+ endif;
+ $message = $action ;
+ switch($action) {
+ case 'updateundefined';
+ $targetlang = $_POST['xili_language_toset'];
+ $fromcats = $_POST['from_categories'];
+ if (""!= $targetlang) {
+ $q = xiliml_setlang_of_undefined_posts ($targetlang, $fromcats, 50);
+ $message .= " _ $q ".__('posts are set in:','xili-language')." ".$targetlang." ".__("category")." =[$fromcats]";
+ } else {
+ $q = xiliml_setlang_of_undefined_posts ($targetlang, $fromcats, 50);
+ $message .= " _ around $q ".__('posts are undefined in','xili-language')." ".__("category")." = [$fromcats]";
+ }
+ $actiontype = "reset";
+ break;
+ case 'updateoptions';
+ $this->browseroption = $_POST['xili_language_check_option'];
+ $this->authorbrowseroption = $_POST['xili_language_check_option_author'];
+ $this->functions_enable = $_POST['xili_language_check_functions_enable'];
+ $this->xili_settings['browseroption'] = $this->browseroption;
+ $this->xili_settings['authorbrowseroption'] = $this->authorbrowseroption;
+ $this->xili_settings['functions_enable'] = $this->functions_enable;
+
+ $this->xili_settings['homelang'] = $_POST['xili_language_home_lang']; // 1.3.2
+
+ update_option('xili_language_settings', $this->xili_settings);
+ $message .= " - ".__('Option is updated.','xili-language')." (=> ".$this->browseroption.") (".$this->authorbrowseroption.") (".$this->functions_enable.")";
+ $this->insert_gold_functions ();
+ $actiontype = "reset";
+ break;
+
+ case 'add':
+ $term = $_POST['language_name'];
+ $args = array( 'alias_of' => '', 'description' => $_POST['language_description'], 'parent' => 0, 'slug' =>$_POST['language_nicename']);
+ $theids = wp_insert_term( $term, TAXONAME, $args);
+ wp_set_object_terms($theids['term_id'], 'the-langs-group', TAXOLANGSGROUP);
+ update_term_order ($theids['term_id'],$this->langs_group_tt_id,$_POST['language_order']);
+ $actiontype = "add";
+ $message .= " - ".__('A new language was added.','xili-language');
+ break;
+
+ case 'edit';
+ $actiontype = "edited";
+ //echo $term_id;
+ //$language = get_term($term_id,TAXONAME,OBJECT,'edit');
+ $language = get_term_and_order ($term_id,$this->langs_group_tt_id,TAXONAME);
+ $submit_text = __('Update »');
+ $formtitle = 'Edit language';
+ $message .= " - ".__('Language to update.','xili-language');
+ break;
+
+ case 'edited';
+ $actiontype = "add";
+ $term = $_POST['language_term_id'];
+
+ $args = array( 'alias_of' => '', 'description' => $_POST['language_description'], 'parent' => 0, 'slug' =>$_POST['language_nicename']);
+ $theids = wp_update_term( $term, TAXONAME, $args);
+ wp_set_object_terms($theids['term_id'], 'the-langs-group', TAXOLANGSGROUP);
+ update_term_order ($theids['term_id'],$this->langs_group_tt_id,$_POST['language_order']);
+ $message .= " - ".__('A language was updated.','xili-language');
+
+ break;
+
+ case 'delete';
+ $actiontype = "deleting";
+ $submit_text = __('Delete »','xili-language');
+ $formtitle = 'Delete language ?';
+ //$language = get_term($term_id,TAXONAME,OBJECT,'edit');
+ $language = get_term_and_order ($term_id,$this->langs_group_tt_id,TAXONAME);
+ $message .= " - ".__('A language to delete.','xili-language');
+
+ break;
+
+ case 'deleting';
+ $actiontype = "add";
+ $term = $_POST['language_term_id'];
+ wp_delete_object_term_relationships( $term, TAXOLANGSGROUP );
+ wp_delete_term( $term, TAXONAME, $args);
+ $message .= " - ".__('A language was deleted.','xili-language');
+ break;
+ case 'reset';
+ $actiontype = "add";
+ break;
+ default :
+ $actiontype = "add";
+ $message .= __('Find above the list of languages.','xili-language');
+
+
+ }
+ /* register the main boxes always available */
+ add_meta_box('xili-language-normal-1', __('List of languages','xili-language'), array(&$this,'on_normal_1_content'), $this->thehook , 'normal', 'core');
+ add_meta_box('xili-language-normal-2', __('Language','xili-language'), array(&$this,'on_normal_2_content'), $this->thehook , 'normal', 'core');
+ add_meta_box('xili-language-sidebox-3', __('Settings','xili-language'), array(&$this,'on_sidebox_3_content'), $this->thehook , 'side', 'core');
+
+ /* form datas in array for do_meta_boxes() */
+ $data = array('message'=>$message,'messagepost'=>$messagepost,'action'=>$action, 'formtitle'=>$formtitle, 'language'=>$language,'submit_text'=>$submit_text,'cancel_text'=>$cancel_text,'browseroption'=>$this->browseroption, 'authorbrowseroption'=>$this->authorbrowseroption , 'functions_enable'=>$this->functions_enable);
+ ?>
+
+ <div id="xili-language-settings" class="wrap" style="min-width:750px">
+ <?php screen_icon('options-general'); ?>
+ <h2><?php _e('Languages','xili-language') ?></h2>
+ <form name="add" id="add" method="post" action="options-general.php?page=language_page">
+ <input type="hidden" name="action" value="<?php echo $actiontype ?>" />
+ <?php wp_nonce_field('xili-language-settings'); ?>
+ <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
+ <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false );
+ /* 0.9.9.2 add has-right-sidebar for next wp 2.8*/ ?>
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
+ <div id="side-info-column" class="inner-sidebar">
+ <?php do_meta_boxes($this->thehook, 'side', $data); ?>
+ </div>
+
+ <div id="post-body" class="has-sidebar has-right-sidebar">
+ <div id="post-body-content" class="has-sidebar-content" style="min-width:360px">
+
+ <?php do_meta_boxes($this->thehook, 'normal', $data); ?>
+ </div>
+ <h4><a href="http://dev.xiligroup.com/xili-language" title="Plugin page and docs" target="_blank" style="text-decoration:none" ><img style="vertical-align:middle" src="<?php echo WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__)).'/xililang-logo-32.gif'; ?>" alt="xili-language logo"/> xili-language</a> - © <a href="http://dev.xiligroup.com" target="_blank" title="<?php _e('Author'); ?>" >xiligroup.com</a>™ - msc 2007-9 - v. <?php echo XILILANGUAGE_VER; ?></h4>
+ </div>
+ </div>
+ </form>
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+ jQuery(document).ready( function($) {
+ // close postboxes that should be closed
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
+ // postboxes setup
+ postboxes.add_postbox_toggles('<?php echo $this->thehook; ?>');
+ });
+ //]]>
+ </script>
+ <?php //end settings div
+ }
+
+ //* display xililanguage in lists *//
+ function xili_manage_column($name, $id) {
+ if($name != TAXONAME)
+ return;
+ $terms = wp_get_object_terms($id, TAXONAME);
+ $first = true;
+ foreach($terms AS $term) {
+ if($first)
+ $first = false;
+ else
+ echo ', ';
+ echo '<a href="' . 'options-general.php?page=language_page'.'">'; /* see more precise link ?*/
+ echo $term->name;
+ echo '</a>';
+ }
+ }
+ function xili_manage_column_name($cols) {
+ $ends = array('comments', 'date', 'rel', 'visible');
+ $end = array();
+ foreach($cols AS $k=>$v) {
+ if(in_array($k, $ends)) {
+ $end[$k] = $v;
+ unset($cols[$k]);
+ }
+ }
+ $cols[TAXONAME] = __('Language','xili-language');
+ $cols = array_merge($cols, $end);
+ return $cols;
+ }
+
+ /**
+ * Set language plugin
+ *
+ *
+ * @updated 1.1.9
+ * also include automatic search of domain and lang subfolder in current theme
+ */
+ function init_textdomain() {
+ /*multilingual for admin pages and menu*/
+ load_plugin_textdomain('xili-language',PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)));
+ if (!defined('THEME_TEXTDOMAIN')) {
+ if ($this->xili_settings['theme_domain'] != "") {
+ define('THEME_TEXTDOMAIN',$this->xili_settings['theme_domain']);
+
+ } else { /* search it inside theme folder index.php */
+ if( is_file( get_template_directory().'/index.php') ) {
+ $lines = @file( get_template_directory().'/index.php');
+ foreach ($lines as $line) {
+ $i = preg_match_all("/_[_e]\('(.*)', ?'(.*)'/Ui", $line, $matches,PREG_PATTERN_ORDER);
+ if ($i > 0) {
+ $resultterms = array_merge ($resultterms, $matches[1]);
+ //print_r($matches[1]);
+ //print_r($matches[2]);
+ $domain = $matches[2][0];
+ $this->xili_settings['theme_domain'] = $domain;
+ update_option('xili_language_settings', $this->xili_settings);
+ define('THEME_TEXTDOMAIN',$this->xili_settings['theme_domain']);
+ break;
+ }
+ }
+ if ($domain == "")
+ _e('no theme domain in index.php','xili-language');
+ } else {
+ _e('no index.php in theme, domain not set','xili-language');
+ }
+ }
+ }
+ if (!defined('THEME_LANGS_FOLDER')) { /* set or detect */
+ if ($this->xili_settings['langs_folder'] == "") {
+ $this->find_files(get_template_directory(), '/.mo$/', array(&$this,'searchpath'));
+ update_option('xili_language_settings', $this->xili_settings);
+ }
+
+ define('THEME_LANGS_FOLDER',$this->xili_settings['langs_folder']); // for bkwd compatibility with xili-dictionary
+ }
+ }
+ function searchpath($path, $filename) {
+ $this->xili_settings['langs_folder'] = str_replace(get_template_directory(),'',$path);
+ }
+ /**
+ * Reset values when theme was changed... updated by previous function
+ * @since 1.1.9
+ */
+ function theme_switched ($theme) {
+ $this->xili_settings['langs_folder'] ="";
+ $this->xili_settings['theme_domain'] =""; /* to force future search in new theme */
+ update_option('xili_language_settings', $this->xili_settings);
+ }
+
+ /**
+ * private functions for languages_settings
+ * @since 0.9.6
+ *
+ * fill the content of the boxes (right side and normal)
+ *
+ */
+ function on_sidebox_1_content($data) {
+ extract($data);
+ ?>
+ <h4><?php _e('Note:','xili-language') ?></h4>
+ <p><?php echo $message;?></p>
+ <?php
+ }
+
+ function on_sidebox_2_content() { ?>
+
+ <p><?php _e("This plugin was developed with the taxonomies, terms tables and tags specifications. <br /> Here a new taxonomy was created and used for languages of posts and pages. <br /> New radiobuttons are available in Post (and Page) write and edit admin pages for selection by author. It is updated for WP 2.9 since 1.1",'xili-language') ?></p>
+ <?php
+ }
+
+ function on_sidebox_3_content($data) { /* where to choose if browser language preferences is tested or not */
+ extract($data);
+ $update_nonce = wp_create_nonce('xilimloptions');
+ /* 1.0 browser - default - languages */
+ ?>
+ <fieldset style="margin:2px; padding:12px 6px; border:1px solid #ccc;"><legend><?php echo _e('Select language of the home page', 'xili-language'); ?></legend>
+ <select name="xili_language_check_option" id="xili_language_check_option" style="width:100%;">
+ <?php if ($browseroption == 'browser')
+ $checked = 'selected = "selected"';
+ else
+ $checked = '';
+ ?>
+ <option value="" ><?php _e('Software defined','xili-language'); ?></option>
+ <option value="browser" <?php echo $checked; ?> ><?php _e("Language of visitor's browser",'xili-language'); ?></option>
+ <?php $listlanguages = get_terms_of_groups_lite ($this->langs_group_id,TAXOLANGSGROUP,TAXONAME,'ASC');
+ foreach ($listlanguages as $language) {
+ if ($browseroption == $language->slug)
+ $checked = 'selected = "selected"';
+ else
+ $checked = '';
+ echo '<option value="'.$language->slug.'" '.$checked.' >'.__($language->description,'xili-language').'</option>';
+ }
+ ?>
+ </select>
+ <?php if ('page' != get_settings('show_on_front')) { ?>
+ <br /> <label for="xili_language_home_lang"><?php _e('Modify home query','xili-language') ?> <input id="xili_language_home_lang" name="xili_language_home_lang" type="checkbox" value="modify" <?php if($this->xili_settings['homelang'] == 'modify') echo 'checked="checked"' ?> /></label>
+ <?php } ?>
+
+
+ </fieldset>
+ <br /><br />
+ <label for="xili_language_check_option_author" class="selectit"><input id="xili_language_check_option_author" name="xili_language_check_option_author" type="checkbox" value="authorbrowser" <?php if($authorbrowseroption=='authorbrowser') echo 'checked="checked"' ?> /> <?php echo _e('For new post, pre-select by default: browser language of author', 'xili-language'); ?></label>
+ <br /><br />
+ <?php if (file_exists(XILIFUNCTIONSPATH)) { /* test if folder exists - ready to add functions.php inside - since 1.0 */?>
+ <label for="xili_language_check_functions_enable" class="selectit"><input id="xili_language_check_functions_enable" name="xili_language_check_functions_enable" type="checkbox" value="enable" <?php if($functions_enable =='enable') echo 'checked="checked"' ?> /> <?php echo _e('Enable gold functions', 'xili-language'); ?></label>
+ <?php } else {
+ echo '<input type="hidden" name="xili_language_check_functions_enable" value="'.$functions_enable.'" />';
+ } ?>
+ <div id='formstatus'></div><span id='loading' class='hidden'><?php _e('Updating...','xili-language') ?></span><div class='submit'>
+ <input id='updateoptions' name='updateoptions' type='submit' tabindex='6' value="<?php _e('Update','xili-language') ?>" /></div>
+ <?php echo wp_nonce_field( 'xilimloptions', '_ajax_nonce', true, false );/**/ ?>
+ <div style="clear:both; height:1px"></div><?php
+ }
+
+ function on_sidebox_4_content() {
+ $update_nonce = wp_create_nonce('xilimloptions');
+ ?>
+ <fieldset style="margin:2px; padding:12px 6px; border:1px solid #ccc;"><legend><?php echo __("Theme's informations:",'xili-language').' ('.get_option("template").')'; ?></legend>
+ <p><?php
+ if (defined('THEME_TEXTDOMAIN')) {
+ echo __('theme_domain:','xili-language').' '.THEME_TEXTDOMAIN.'<br />'.__('as function like:','xili-language').'<i> _e(\'-->\',\''.THEME_TEXTDOMAIN.'\');</i>'; }
+ else {
+ _e('Theme domain NOT defined','xili-language');
+ } ?><br />
+ <?php echo __("Languages sub-folder:",'xili-language').' '.$this->xili_settings['langs_folder']; ?><br />
+ <?php _e('Available MO files:','xili-language'); echo '<br />';
+ $this->find_files(get_template_directory(), "/.mo$/", array(&$this,"available_mo_files")) ;?>
+ </p>
+ </fieldset>
+ <p><?php _e("Special Gold Actions",'xili-language') ?></p>
+
+ <?php
+ //echo '---'.$this->functions_enable;
+ if ($this->functions_enable !='' && function_exists('xiliml_setlang_of_undefined_posts')) {
+ xiliml_special_UI_undefined_posts ($this->langs_group_id);
+ }
+ }
+
+ function on_normal_1_content($data) {
+ extract($data); ?>
+ <?php //if (!isset($action) || $action=='add' || $action=='edited' || $action=='deleting') :?>
+ <table class="widefat">
+ <thead>
+ <tr>
+ <th scope="col" style="text-align: center"><?php _e('ID') ?></th>
+ <th scope="col"><?php _e('Name','xili-language') ?></th>
+ <th scope="col"><?php _e('Full name','xili-language') ?></th>
+ <th scope="col"><?php _e('Language slug','xili-language') ?></th>
+ <th scope="col"><?php _e('Order','xili-language') ?></th>
+ <th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th>
+ <th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
+ </tr>
+ </thead>
+ <tbody id="the-list">
+ <?php $this->xili_lang_row(); /* the lines */?>
+ </tbody>
+ </table>
+ <?php if ($action=='edit' || $action=='delete') :?>
+ <p>(<a href="?action=add&page=language_page"><?php _e('Add a language','xili-language') ?></a>)</p>
+ <?php endif; ?>
+ <?php
+ }
+
+ function on_normal_2_content($data) {
+ extract($data);
+ /* the create - edit - delete form */ ?>
+
+ <h2 id="addlang" <?php if ($action=='delete') echo 'style="color:#FF1111;"'; ?>><?php _e($formtitle,'xili-language') ?></h2>
+ <?php if ($action=='edit' || $action=='delete') :?>
+ <input type="hidden" name="language_term_id" value="<?php echo $language->term_id ?>" />
+ <?php endif; ?>
+ <table class="editform" width="100%" cellspacing="2" cellpadding="5">
+ <tr>
+ <th width="33%" scope="row" valign="top" align="right"><label for="language_name"><?php _e('Name') ?></label>: </th>
+ <td width="67%"><input name="language_name" id="language_name" type="text" value="<?php echo attribute_escape($language->name); ?>" size="40" <?php if($action=='delete') echo 'disabled="disabled"' ?> /></td>
+ </tr>
+ <tr>
+ <th scope="row" valign="top" align="right"><label for="language_nicename"><?php _e('Language slug','xili-language') ?></label>: </th>
+ <td><input name="language_nicename" id="language_nicename" type="text" value="<?php echo attribute_escape($language->slug); ?>" size="40" <?php if($action=='delete') echo 'disabled="disabled"' ?> /></td>
+ </tr>
+ <tr>
+ <th scope="row" valign="top" align="right"><label for="language_description"><?php _e('Full name','xili-language') ?></label>: </th>
+ <td><input name="language_description" id="language_description" size="40" value="<?php echo $language->description; ?>" <?php if($action=='delete') echo 'disabled="disabled"' ?> /></td>
+
+ </tr>
+ <tr>
+ <th scope="row" valign="top" align="right"><label for="language_order"><?php _e('Order','xili-language') ?></label>: </th>
+ <td><input name="language_order" id="language_order" size="3" value="<?php echo $language->term_order; ?>" <?php if($action=='delete') echo 'disabled="disabled"' ?> /></td>
+
+ </tr>
+ <tr>
+ <th><p class="submit"><input type="submit" name="reset" value="<?php echo $cancel_text ?>" /></p></th>
+ <td>
+ <p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
+ </td>
+ </tr>
+ </table>
+ <?php
+ }
+
+ /**
+ * private functions for admin page : the language list
+ * @since 0.9.0
+ *
+ * @update 0.9.5 : two default languages if taxonomy languages is empty
+ *
+ */
+ function xili_lang_row() {
+ /*list of languages*/
+ //$listlanguages = get_terms_with_order($this->langs_group_id,TAXOLANGSGROUP,TAXONAME,'ASC');
+ $listlanguages = get_terms_of_groups_lite ($this->langs_group_id,TAXOLANGSGROUP,TAXONAME,'ASC');
+
+ if (empty($listlanguages)) : /*create two default lines with the default language (as in config)*/
+ /* language of WP */
+ $term = 'en_US';
+ $args = array( 'alias_of' => '', 'description' => 'english', 'parent' => 0, 'slug' =>'');
+ $theids = wp_insert_term( $term, TAXONAME, $args);
+ wp_set_object_terms($theids['term_id'], 'the-langs-group', TAXOLANGSGROUP);
+ $term = $this->default_lang;
+ $desc = $this->default_lang;
+ if (!defined('WPLANG') || $this->default_lang == 'en_US' ) {$term = 'fr_FR'; $desc = 'french';}
+ $args = array( 'alias_of' => '', 'description' => $desc, 'parent' => 0, 'slug' =>'');
+ $theids = wp_insert_term( $term, TAXONAME, $args);
+ wp_set_object_terms($theids['term_id'], 'the-langs-group', TAXOLANGSGROUP); /* create the group */
+ $listlanguages = get_terms_of_groups_lite ($this->langs_group_id,TAXOLANGSGROUP,TAXONAME,'ASC');
+ endif;
+ foreach ($listlanguages as $language) {
+ $class = ((defined('DOING_AJAX') && DOING_AJAX) || " class='alternate'" == $class ) ? '' : " class='alternate'";
+ $language->count = number_format_i18n( $language->count );
+ $posts_count = ( $language->count > 0 ) ? "<a href='edit.php?lang=$language->slug'>$language->count</a>" : $language->count;
+
+ $edit = "<a href='?action=edit&page=language_page&term_id=".$language->term_id."' >".__( 'Edit' )."</a></td>";
+ /* delete link*/
+ $edit .= "<td><a href='?action=delete&page=language_page&term_id=".$language->term_id."' class='delete'>".__( 'Delete' )."</a>";
+
+ $line="<tr id='cat-$language->term_id'$class>
+ <th scope='row' style='text-align: center'>$language->term_id</th>
+ <td>" .$language->name. "</td>
+ <td>$language->description</td>
+ <td>$language->slug</td>
+ <td>$language->term_order</td>
+ <td align='center'>$posts_count</td>
+ <td>$edit</td>\n\t</tr>\n"; /*to complete - 0.9.8.1 count to post*/
+ echo $line;
+ //print_r($language);
+ }
+ }
+
+ //********************************************//
+ // Functions for themes (hookable by add_action() in functions.php - 0.9.7
+ //********************************************//
+
+ /**
+ * List of available languages.
+ *
+ * @since 0.9.0
+ * @updated 0.9.7.4 - 0.9.8.3 - 0.9.9.6
+ * can be hooked by add_action in functions.php
+ * with : add_action('xili_language_list','my_infunc_language_list',10,3);
+ *
+ * for multiple widgets since 0.9.9.6 : incorporate top option (without flag) but with example rules
+ *
+ * @param $before = '<li>', $after ='</li>'.
+ * @return list of languages of site for sidebar list.
+ */
+ function xili_language_list($before = '<li>', $after ='</li>',$option='') {
+ $listlanguages = get_terms_of_groups_lite ($this->langs_group_id,TAXOLANGSGROUP,TAXONAME,'ASC');
+ if ($option == 'typeone') {
+ /* the rules : don't display the current lang if set and add link of category if is_category()*/
+ if (is_category()) {
+ $catcur = xiliml_get_category_link();
+ $currenturl = $catcur.'&';
+ } else {
+ $currenturl = get_bloginfo('siteurl').'/?';
+ }
+ foreach ($listlanguages as $language) {
+ if ($language->slug != $this->curlang ) {
+ $a .= $before ."<a href='".$currenturl.QUETAG."=".$language->slug."' title='".__('Posts selected',THEME_TEXTDOMAIN)." ".__('in '.$language->description,THEME_TEXTDOMAIN)."'>". __('in '.$language->description,THEME_TEXTDOMAIN) ."</a>".$after;
+ }
+ }
+ echo $a;
+ } else { /* current list */
+ foreach ($listlanguages as $language) {
+ $a .= $before ."<a href='".get_bloginfo('siteurl')."/?".QUETAG."=".$language->slug."' title='".__('Posts selected',THEME_TEXTDOMAIN)." ".__('in '.$language->description,THEME_TEXTDOMAIN)."'>". __('in '.$language->description,THEME_TEXTDOMAIN) ."</a>".$after;
+ }
+ echo $a;
+ }
+ }
+
+ /**
+ * language of current post used in loop
+ * @since 0.9.0
+ *
+ *
+ * @param $before = '<span class"xili-lang">(', $after =')</span>'.
+ * @return language of post.
+ */
+ function xili_post_language($before = '<span class="xili-lang">(', $after =')</span>') {
+ global $post;
+ $ress = wp_get_object_terms($post->ID, TAXONAME);
+ $obj_term = $ress[0];
+ if ('' != $obj_term->name) :
+ $curlangname = $obj_term->name;
+ else :
+ $curlangname = __('undefined',THEME_TEXTDOMAIN);
+ endif;
+ $a = $before . $curlangname .$after.'';
+ echo $a;
+ }
+
+ /**
+ * for one post create a link list of the corresponding posts in other languages
+ *
+ * @since 0.9.0
+ * @updated 0.9.9.2 / 3 $separator replace $after, $before contains pre-text to echo a better list.
+ * @updated 1.1 - see hookable same name function outside class
+ * can be hooked by add_action in functions.php
+ *
+ *
+ */
+ function xiliml_the_other_posts ($post_ID, $before = "This post in", $separator = ", ", $type = "display") {
+ /* default here*/
+ $outputarr = array();
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ $langpost = $this->get_cur_language($post_ID); // to be used in multilingual loop since 1.1
+ $post_lang = $langpost['lang'];
+ foreach ($listlanguages as $language) {
+ $otherpost = get_post_meta($post_ID, 'lang-'.$language->slug, true);
+
+ if ($type == "display") {
+ if ('' != $otherpost && $language->slug != $post_lang ) {
+ $outputarr[] = "<a href='".get_permalink($otherpost)."' >".__($language->description,THEME_TEXTDOMAIN) ."</a>";
+ }
+ } elseif ($type == "array") { // here don't exclude cur lang
+ if ('' != $otherpost)
+ $outputarr[$language->slug] = $otherpost;
+ }
+ }
+ if ($type == "display") {
+ if (!empty($outputarr))
+ $output = (($before !="") ? __($before,THEME_TEXTDOMAIN)." " : "" ).implode ($separator, $outputarr);
+ if ('' != $output) { echo $output;}
+ } elseif ($type == "array") {
+ if (!empty($outputarr)) {
+ $outputarr[$post_ID] = $post_lang;
+ // add a key with curid to give his lang (empty if undefined)
+ return $outputarr;
+ } else {
+ return false;
+ }
+ }
+ }
+
+ /**
+ * the_category() rewritten to keep new features of multilingual (and amp & pbs in link)
+ *
+ * @since 0.9.0
+ * @updated 0.9.9.4
+ * can be hooked by add_action xiliml_the_category in functions.php
+ *
+ */
+ function xiliml_the_category($post_ID, $separator = ', ' ,$echo = true) {
+ /* default here*/
+ $the_cats_list = wp_get_object_terms($post_ID, 'category');
+ $i = 0;
+ foreach ($the_cats_list as $the_cat) {
+ if ( 0 < $i )
+ $thelist .= $separator . ' ';
+ $desc4title = trim(attribute_escape(apply_filters( 'category_description', $the_cat->description, $the_cat->term_id )));
+
+ $title = ('' == $desc4title) ? __($the_cat->name,THEME_TEXTDOMAIN) : $desc4title;
+ $the_catlink = '<a href="' . get_category_link($the_cat->term_id) . '" title="' . $title . '" ' . $rel . '>';
+ //if ($curlang != DEFAULTSLUG) :
+ $the_catlink .= __($the_cat->name,THEME_TEXTDOMAIN).'</a>';;
+ //else :
+ //$the_catlink .= $the_cat->name.'</a>';;
+ //endif;
+ $thelist .= $the_catlink;
+ ++$i;
+ }
+ if ($echo) :
+ echo $thelist;
+ return true;
+ else :
+ return $thelist;
+ endif;
+ }
+
+ /**
+ * Add list of languages in radio input - for search form.
+ *
+ * @since 0.9.7
+ * can be hooked by add_action in functions.php
+ *
+ * @updated 0.9.9.5
+ *
+ * $before, $after each line of radio input
+ *
+ * @param $before, $after.
+ * @return echo the form.
+ */
+ function xiliml_langinsearchform ($before='',$after='') {
+ /* default here*/
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ foreach ($listlanguages as $language) {
+ $a = $before.'<input type="radio" name="'.QUETAG.'" value="'.$language->slug.'" id="'.$language->slug.'" /> '.__($language->description,THEME_TEXTDOMAIN).' '.$after;
+ echo $a;
+ }
+ echo $before.'<input type="radio" name="alllang" value="yes" /> '.__('All',THEME_TEXTDOMAIN).' '.$after; // this query alllang is unused -
+ }
+
+ /**
+ * Select latest comments in current lang.
+ *
+ * @since 0.9.9.4
+ * used by widget xili-recent-comments
+ *
+ * $before, $after each line of radio input
+ *
+ * @param $before, $after.
+ * @return echo the form.
+ */
+ function xiliml_recent_comments ($number = 5) {
+ global $comments, $wpdb ;
+ if ( !$comments = wp_cache_get( 'xili_language_recent_comments', 'widget' ) ) {
+ $join = "";
+ $where = "";
+ $reqtag = is_term( $this->curlang, TAXONAME );
+ if (''!= $reqtag) {
+ $wherereqtag = $reqtag['term_id'];
+ $join = " LEFT JOIN $wpdb->term_relationships as tr ON ($wpdb->comments.comment_post_ID = tr.object_id) LEFT JOIN $wpdb->term_taxonomy as tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id) ";
+ $where = " AND tt.taxonomy = '".TAXONAME."' ";
+ $where .= " AND tt.term_id = $wherereqtag ";
+ }
+ $query = "SELECT * FROM $wpdb->comments".$join." WHERE comment_approved = '1' ".$where." ORDER BY comment_date_gmt DESC LIMIT $number";
+ echo $query;
+ $comments = $wpdb->get_results($query);
+ wp_cache_add( 'xili_language_recent_comments', $comments, 'widget' );
+ }
+ return $comments;
+ }
+
+ /**
+ * Recursive search of files in a path
+ * @since 1.1.9
+ * @update 1.2.1
+ *
+ */
+ function find_files($path, $pattern, $callback) {
+ //$path = rtrim(str_replace("\\", "/", $path), '/') . '/';
+ $matches = Array();
+ $entries = Array();
+ $dir = dir($path);
+
+ while (false !== ($entry = $dir->read())) {
+ $entries[] = $entry;
+ }
+ $dir->close();
+ foreach ($entries as $entry) {
+ $fullname = $path .$this->ossep. $entry;
+ if ($entry != '.' && $entry != '..' && is_dir($fullname)) {
+ $this->find_files($fullname, $pattern, $callback);
+ } else if (is_file($fullname) && preg_match($pattern, $entry)) {
+ call_user_func($callback, $path , $entry);
+ }
+ }
+ }
+ /**
+ * display lines of files in special sidebox
+ * @since 1.1.9
+ */
+ function available_mo_files($path , $filename) {
+ //echo $filename . " in : " . "/".str_replace("/","",str_replace(get_template_directory(),'',$path)) . "<br />";
+ echo str_replace(".mo","",$filename ). " (".$this->ossep.str_replace($this->ossep,"",str_replace(get_template_directory(),'',$path)).")<br />";
+ }
+
+ /**
+ * Enable to add functions and filters that are not in theme's functions.php
+ * These filters are common even if you change default theme...
+ * Place your functions.php in folder plugins/xilidev-libraries/
+ * if you have a filter in this file, avoid to have similar one in functions.php of the theme !!!
+ *
+ */
+ function insert_gold_functions () {
+ if ($this->functions_enable !='' && file_exists(XILIFUNCTIONSPATH . '/functions.php') )
+ include_once (XILIFUNCTIONSPATH . '/functions.php');
+ }
+
+
+} /* end of xili-language class */
+
+
+/**** Functions that improve taxinomy.php ****/
+
+/**
+ * get terms and add order in term's series that are in a taxonomy
+ * (not in class for general use)
+ *
+ * @since 0.9.8.2 - full version is in xili-tidy-tags
+ * @uses $wpdb
+ */
+function get_terms_of_groups_lite ($group_ids, $taxonomy, $taxonomy_child, $order = '') {
+ global $wpdb;
+ if ( !is_array($group_ids) )
+ $group_ids = array($group_ids);
+ $group_ids = array_map('intval', $group_ids);
+ $group_ids = implode(', ', $group_ids);
+ $theorderby = '';
+
+ // lite release
+ if ($order == 'ASC' || $order == 'DESC') $theorderby = ' ORDER BY tr.term_order '.$order ;
+
+ $query = "SELECT t.*, tt2.term_taxonomy_id, tt2.description,tt2.parent, tt2.count, tt2.taxonomy, tr.term_order FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN $wpdb->terms AS t ON t.term_id = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt2 ON tt2.term_id = tr.object_id WHERE tt.taxonomy IN ('".$taxonomy."') AND tt2.taxonomy = '".$taxonomy_child."' AND tt.term_id IN (".$group_ids.") ".$theorderby;
+
+ $listterms = $wpdb->get_results($query);
+ if ( ! $listterms )
+ return array();
+
+ return $listterms;
+}
+/* for backward compatibility - soon obsolete - please modify your theme's function.php */
+function get_terms_with_order ($group_ids, $taxonomy, $taxonomy_child, $order = 'ASC') {
+ return get_terms_of_groups_lite ($group_ids, $taxonomy, $taxonomy_child, $order);
+}
+
+/**
+ * function that improve taxinomy.php
+ * @since 0.9.8
+ *
+ * update term order in relationships (for terms of langs group defined by his taxonomy_id)
+ *
+ * @param $object_id, $taxonomy_id, $term_order
+ *
+ */
+function update_term_order ($object_id,$term_taxonomy_id,$term_order) {
+ global $wpdb;
+ $wpdb->update( $wpdb->term_relationships, compact( 'term_order' ), array( 'term_taxonomy_id' => $term_taxonomy_id,'object_id' => $object_id ) );
+}
+
+/**
+ * function that improve taxinomy.php
+ * @since 0.9.8
+ *
+ * get one term and order of it in relationships
+ *
+ * @param term_id and $group_ttid (taxonomy id of group)
+ * @return object with term_order
+ */
+function get_term_and_order ($term_id,$group_ttid,$taxonomy) {
+ global $wpdb;
+ $term = get_term($term_id,$taxonomy,OBJECT,'edit');
+ $term->term_order = $wpdb->get_var("SELECT term_order FROM $wpdb->term_relationships WHERE object_id = $term_id AND term_taxonomy_id = $group_ttid ");
+ return $term;
+}
+
+/**** Functions using the class ****/
+/**
+ * Return the current language of theme.
+ *
+ * @since 0.9.7
+ * use for other function elsewhere
+ *
+ * @return the slug of language (used in query).
+ */
+function the_curlang() {
+ global $xili_language;
+ return $xili_language->curlang;
+}
+
+/**
+ * Return the current language and dir of theme.
+ *
+ * @since 0.9.9
+ * use for other function elsewhere
+ *
+ * @return array with slug of language (used in query) and dir (ltr or rtl).
+ */
+function the_cur_lang_dir() {
+ global $xili_language;
+ return array('lang'=>$xili_language->curlang, 'direction'=>$xili_language->curlang_dir);
+}
+
+/**
+ * Return the current group of languages
+ *
+ * @since 0.9.8.3
+ */
+function the_cur_langs_group_id() {
+ global $xili_language;
+ return $xili_language->langs_group_id;
+}
+
+/**
+ * Return the current date or a date formatted with strftime.
+ *
+ * @since 0.9.7.1
+ * can be used in theme for multilingual date
+ * @param format and time (if no time = current date-time)
+ * @return the formatted date.
+ */
+function the_xili_local_time($format='%B %d, %Y',$time = null) {
+ global $xili_language;
+ if ($time == null ) $time = time();
+ $curlang = $xili_language->curlang;
+ $curlang = substr($curlang,0,3).strtoupper(substr($curlang,-2));
+ setlocale(LC_TIME, $curlang); /* work if server is ready */
+ return htmlentities(strftime(__($format,THEME_TEXTDOMAIN),$time),ENT_COMPAT); /* ,'UTF-8' entities for some server */
+}
+
+/**
+ * Return the language of current post in loop.
+ *
+ * @since 0.9.7.0
+ * @updated 0.9.9
+ * useful for functions in functions.php or other plugins
+ *
+ * @param ID of the post
+ * @return the name of language as ISO code (en_US).
+ */
+function get_cur_language($post_ID) {
+ global $xili_language;
+ $langpost = $xili_language->get_cur_language($post_ID);
+ return $langpost['lang'];
+}
+
+/**
+ * Return the lang and dir of language of current post in loop.
+ *
+ * @since 0.9.9
+ * useful for functions in functions.php or other plugins
+ *
+ * @param ID of the post
+ * @return array two params : lang and direction of lang (ltr or rtl).
+ */
+function get_cur_post_lang_dir($post_ID) {
+ global $xili_language;
+ return $xili_language->get_cur_language($post_ID);
+}
+
+/**
+ * Return language object of a post.
+ *
+ * @since 1.1.8
+ * useful for functions in functions.php or other plugins
+ *
+ * @param ID of the post
+ * @return false or object with params as in current term (->description = full name of lang, ->count = number of posts in this language,...
+ */
+function xiliml_get_lang_object_of_post($post_ID) {
+
+ $ress = wp_get_object_terms($post_ID, TAXONAME); /* lang of target post */
+ if ($ress == array()) {
+ return false;
+ } else {
+ //print_r($ress[0]);
+ return $ress[0];
+ }
+}
+
+/**
+ * Return the language of current browser.
+ *
+ * @since 0.9.7.6
+ * @updated 0.9.9
+ * useful for functions in functions.php or other plugins
+ *
+ * @param no
+ * @return the best choice.
+ */
+function choice_of_browsing_language() {
+ global $xili_language;
+ return $xili_language->choice_of_browsing_language();
+}
+
+/**
+ * Return the lang and dir of current browser.
+ *
+ * @since 0.9.9
+ * useful for functions in functions.php or other plugins
+ *
+ * @param no
+ * @return array of the best choice lang and his dir.
+ */
+function choice_of_browsing_lang_dir() {
+ global $xili_language;
+ $lang = $xili_language->choice_of_browsing_language();
+ $dir = $xili_language->get_dir_of_cur_language($lang);
+ return array('lang'=>$lang,'direction'=>$dir);
+}
+
+/**
+ * Activate hooks of plugin in class.
+ *
+ * @since 0.9.7.4
+ * can be used in functions.php for special action
+ *
+ * @param filter name and function
+ *
+ */
+function add_again_filter($filtername,$filterfunction) {
+ global $xili_language;
+ $xili_language->add_filter($filtername,$filterfunction);
+}
+
+/**
+ * Replace get_category_link to bypass hook from xili_language
+ *
+ * @since 0.9.7.4
+ * @updated 1.0.1
+ * can be used in functions.php for special action needing permalink
+
+ * @param category ID
+ * @return the permalink of passed cat_id.
+ */
+function xiliml_get_category_link($catid = 0) {
+ global $xili_language;
+ if ($catid == 0) {
+ global $wp_query;
+ $catid = $wp_query->query_vars['cat'];
+ }
+ remove_filter('category_link', $xili_language->idx['xiliml_link_append_lang']);
+ $catcur = get_category_link($catid);
+ add_again_filter('category_link', 'xiliml_link_append_lang');
+ return $catcur;
+}
+/* used by xili widget - usable if you need to create your own template tag
+ *
+ * @since 0.9.9.4
+ * @param quantity of comments
+ *
+ * @return comments objects...
+ */
+function xiliml_recent_comments($number = 5) {
+ global $xili_language;
+ return $xili_language->xiliml_recent_comments($number);
+}
+
+/**
+ * Return full object of a language
+ * @since 1.1.8
+ * @param name (fr_FR) or slug (fr_fr)
+ * @return false or full language object (example ->description = full as set in admin UI)
+ */
+function xiliml_get_language($lang_nameorslug="") {
+ $language = is_term( $lang_nameorslug, TAXONAME );
+ if ($language) {
+ return get_term($language['term_id'],TAXONAME,OBJECT,'edit');
+ } else {
+ return false;
+ }
+}
+
+ /*
+ **
+ * Template Tags for themes (with current do_action tool some are hookable functions)
+ **
+ */
+
+/**
+ * Template Tag insertable in search form for sub-selection of a language
+ *
+ * @since 0.9.7
+ * can be used in theme template
+ * example: if(class_exists('xili_language')) xiliml_langinsearchform()
+ *
+ * hook: add_action('xiliml_langinsearchform','your_xiliml_langinsearchform',10,2) to change its behaviour elsewhere
+ * @param html tags
+ * @return echo the list as radio-button
+ */
+function xiliml_langinsearchform ($before='',$after='') { /* list of radio buttons for search form*/
+ global $xili_language;
+ if ($xili_language->this_has_filter('xiliml_langinsearchform')){
+ remove_filter('xiliml_langinsearchform',$xili_language->idx['xiliml_langinsearchform']); /*no default from class*/
+ }
+ do_action('xiliml_langinsearchform',$before,$after);
+}
+
+/**
+ * Template Tag - replace the_category() tag of WP Core
+ *
+ * @since 0.9.0
+ * can be used in theme template in each post in loop
+ * example: if(class_exists('xili_language')) xiliml_the_category($post->ID)
+ *
+ * hook: add_action('xiliml_the_category','your_xiliml_the_category',10,3) to change its behaviour elsewhere
+ * @param post_id separator echo (true by default)
+ * @return echo (by default) the list of cats with comma separated...
+ */
+function xiliml_the_category($post_ID, $separator = ', ' ,$echo = true) { /* replace the_category() */
+ global $xili_language;
+ if ($xili_language->this_has_filter('xiliml_the_category')){
+ remove_filter('xiliml_the_category',$xili_language->idx['xiliml_the_category']); /*no default from class*/
+ }
+ do_action('xiliml_the_category',$post_ID,$separator,$echo);
+}
+
+/**
+ * Template Tag - in loop display the link of other posts defined as in other languages
+ *
+ * @since 0.9.0
+ * @updated 0.9.9.2, 1.1 (can return an array of lang + id)
+ * can be used in theme template in single.php under the title
+ * example: if(class_exists('xili_language')) xiliml_the_other_posts($post->ID)
+ *
+ * hook: add_action('xiliml_the_other_posts','your_xiliml_the_other_posts',10,3) to change its behaviour elsewhere
+ * @param post_id before separator type (echo, array)
+ * @return echo (by default) the list
+ */
+function xiliml_the_other_posts ($post_ID,$before = "This post in", $separator = ", ", $type = "display") { /* display the other posts defined as in other lang */
+ global $xili_language;
+ if ($xili_language->this_has_filter('xiliml_the_other_posts')){
+ remove_filter('xiliml_the_other_posts',$xili_language->idx['xiliml_the_other_posts']); /*no default from class*/
+ }
+ return apply_filters('xiliml_the_other_posts',$post_ID, $before, $separator,$type);
+}
+
+/**
+ * Template Tag - in loop display the language of the post
+ *
+ * @since 0.9.0
+ * can be used in theme template in loop under the title
+ * example: if(class_exists('xili_language')) xili_post_language()
+ *
+ * hook: add_action('xili_post_language','your_xili_post_language',10,2) to change its behaviour elsewhere
+ * @param before after
+ * @return echo (by default) the language
+ */
+function xili_post_language($before = '<span class="xili-lang">(', $after =')</span>') { /* post language in loop*/
+ do_action('xili_post_language',$before, $after);
+}
+
+/**
+ * Template Tag - outside loop (sidebar) display the languages of the site (used also by widget)
+ *
+ * @since 0.9.0
+ * @updated 0.9.7.4
+ * can be used in theme template in sidebar menu or header menu
+ * example: if(class_exists('xili_language')) xili_language_list()
+ * theoption param is used to define type of display according places (sidebar / header) in theme (see dev.xiligroup.com)
+ *
+ * hook: add_action('xili_language_list','your_xili_language_list',10,3) to change its behaviour elsewhere
+ * @param before after theoption
+ * @return echo the list of languages
+ */
+function xili_language_list($before = '<li>', $after ='</li>', $theoption='') { /* list of languages i.e. in sidebar */
+ global $xili_language;
+ if ($xili_language->this_has_filter('xili_language_list')){
+ remove_filter('xili_language_list',$xili_language->idx['xili_language_list']); /*no default from class*/
+ }
+ do_action('xili_language_list',$before,$after,$theoption);
+}
+
+/*
+ * sub selection of pages for wp_list_pages()
+ * @ since 090504 - exemple of new function add here or addable in functions.php
+ * © xiligroup.dev
+ *
+ * only called if xili-language plugin is active and query tag 'lang' is in wp_list_pages template tag
+ *
+ * example 1 : wp_list_pages('title_li=&lang='.the_curlang() ); will display only pages of current lang
+ *
+ * example 2 : wp_list_pages('title_li=&setlang=0&lang='.the_curlang() ); will display pages of current lang AND pages with lang undefined (polyglot pages).
+ *
+ */
+function ex_pages_by_lang ($pages, $r) {
+ if (isset($r['lang']) && !empty($pages) && function_exists('get_cur_post_lang_dir')) {
+ $keepundefined = null;
+ if (isset($r['setlang'])) {
+ if ($r['setlang'] == 0 || $r['setlang'] == 'false') $keepundefined = false;
+ if ($r['setlang'] == 1 || $r['setlang'] == 'true') $keepundefined = true;
+ }
+ $resultingpages = array();
+ foreach ($pages as $page) {
+ $post_lang_dir = get_cur_post_lang_dir($page->ID);
+ if ($post_lang_dir === $keepundefined) {
+ $resultingpages[] = $page;
+ } elseif ($post_lang_dir['lang'] == $r['lang'] ) {
+ $resultingpages[] = $page;
+ }
+ }
+ return $resultingpages;
+ } else {
+ return $pages;
+ }
+}
+add_filter('get_pages','ex_pages_by_lang',10,2);
+
+/**
+ * functions to change and restore loop's query tag
+ * (useful for sidebar widget - see functions table)
+ * @since 1.3.0
+ * @param lang to modify query_tag -
+ *
+ */
+
+function xiliml_force_loop_lang ($lang_query_tag){
+ global $xili_language, $wp_query;
+ $xili_language->temp_lang_query_tag = $wp_query->query_vars[QUETAG];
+ $wp_query->query_vars[QUETAG] = $lang_query_tag;
+ $xili_language->current_lang_query_tag = $wp_query->query_vars[QUETAG];
+}
+
+function xiliml_restore_loop_lang (){
+ global $xili_language, $wp_query;
+ $wp_query->query_vars[QUETAG] = $xili_language->temp_lang_query_tag;
+ $xili_language->current_lang_query_tag = $wp_query->query_vars[QUETAG];
+}
+/**
+ * functions to permit lang query tag
+ * (useful for WP_Query)
+ * @since 1.3.2
+ * example: add_action('parse_query','xiliml_add_lang_to_parsed_query');
+ * $r = new WP_Query($thequery);
+ * remove_filter('parse_query','xiliml_add_lang_to_parsed_query');
+ * used by class xili_Widget_Recent_Posts
+ */
+function xiliml_add_lang_to_parsed_query ($theclass = array()) {
+ global $wp_query;
+ $query = $theclass->query;
+ if (is_array($query)) {
+ $r = $query;
+ } else {
+ parse_str($query, $r);
+ }
+ if (array_key_exists(QUETAG,$r)) $wp_query->query_vars[QUETAG] = $r[QUETAG];
+}
+
+
+
+/**
+ * instantiation of xili_language class
+ *
+ * @since 0.9.7 - 0.9.9.4 =& for vintage server with php4 !!!! - 1.1.9
+ *
+ * @param 1st metabox (for other posts in post edit UI - to replace custom fields - beta tests)
+ * @param 2nd ajax ( true if ajax is activated for post edit admin UI - alpha tests )
+ * 1.1.9
+ * @param 3rd locale_method (true for cache compatibility... in current tests with johan.eenfeldt@kostdoktorn.se)
+ */
+$xili_language =& new xili_language(true,false,false);
+
+/**
+ * Enable to add functions and filters that are not in theme's functions.php
+ * These filters are common even if you change default theme...
+ * Place your functions.php in folder plugins/xilidev-libraries/
+ * if you have a filter in this file, avoid to have similar one in functions.php of the theme !!!
+ *
+ * (for tests, check / uncheck 'enable gold functions' in settings UI)
+ * @since 1.0
+ * @updated 1.4.0
+ */
+$xili_language->insert_gold_functions ();
+?>
\ No newline at end of file
Binary file web/wp-content/plugins/xili-language/xililang-logo-32.gif has changed
Binary file web/wp-content/plugins/xili-language/xililang-logo.ico has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-tidy-tags/readme.txt Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,185 @@
+=== xili-tidy-tags ===
+Contributors: MS xiligroup
+Donate link: http://dev.xiligroup.com/
+Tags: tag,tags,theme,post,plugin,posts, page, category, admin,multilingual,taxonomy,dictionary,widget,CMS
+Requires at least: 2.7.0
+Tested up to: 2.9
+Stable tag: 1.3.0
+
+xili-tidy-tags is a tool for grouping tags by semantic groups or by language and for creating tidy tag clouds.
+
+== Description ==
+
+= on monolingual website (blog or CMS) =
+xili-tidy-tags is a tool for grouping tags by semantic groups and sub-groups.
+This tags aggregator can also, by instance, be used to group tags according two or more main parts of the CMS website. It is also possible to create group of tags in parallel of category and display a ‘sub’ tag cloud only depending of the displayed category.
+
+= on multilingual website =
+xili-tidy-tags is a tool for grouping tags by language with xili-language plugin for multilingual site and for creating tidy tag clouds. By instance to present only tags in english when the theme is in english because the post or the current category present texts in english. Technically, as xili-language, this plugin don't create tables in wordpress db. He only use (rich) taxonomy features. So, with or without the plugin, the base structure is not modified.
+
+
+**Template tags** are provided to enrich the theme and display sub-selection of tags.
+Through the settings admin UI, it is possible to assign to a tag one or more groups (by instance a french tag to the french language group. A trademark term like WordPress to a group named "trademark". You can choose different storage policies.
+
+= 1.3.0 =
+* Add sub-selection by tags belonging to a group - or not belonging to this group (suggestion of David). With this way, it is possible to see tags selected in one group and the others there are not. The sub-selection by starting or containing letters remains. The columns of group are now sorted and grouped.
+* Now uses Walker class to sort groups in UI.
+
+**1.2.1**
+
+* now quick-edit tag is allowed (keep terms groups)...
+* fix default sorting and order in sub-selection by group for `xili_tidy_tag_cloud()` (thanks to Zarban)
+
+**1.1**
+In loop, the template tag `the_tags()` named `xili_the_tags` is now available to sub-select tags for the current post from sub-groups. Example of code :
+`
+xili_the_tags('',' • ','',array('sub_groups'=>array('trademark', 'software')));
+`
+With these parameters, only tags from subgroups 'trademark' & 'software' are displayed in loop with each post (use slug of terms). The first three parameters are used like in `the_tags()`. The fourth is an array with an key added to a lot of keys as in taxonomy function `wp_get_object_terms` - see source .
+
+**1.0** add shortcode to include a cloud of a group of tags inside a post, also compatible with new recent WP 2.8.
+**Example of shortcode :** `[xili-tidy-tags params="tagsgroup=trademark&largest=10&smallest=10" glue=" | "]`
+In this cas, the group of tags named 'trademark' will be display inside a paragraph of a post. The params are defined as in `xili_tidy_tag_cloud()` and as in `wp_tag_cloud()`. The glue is chars inserted between the tags (if omitted default is a space).
+
+**0.9.5**
+Add capability management for editors role grouping - and setting -. Set by administrator role.
+**0.9.4**
+When creating tags in post edit UI - this new tag is grouped to default post's lang if xili-language is active and if this tag is not already grouped.
+**0.9.2**
+add features to modify kindship of tags group, now allows multiple cloud widgets - see note in [installation](http://wordpress.org/extend/plugins/xili-tidy-tags/installation/).
+**0.9.1**
+With big tags list in admin UI, select tags starting or containing char(s) or word(s) - possible to split cloud in sub clouds via &offset= et &number= in the var passed to the `xili_tidy_tag_cloud` - .po file completed.
+**0.9.0**
+The tidy tags cloud widget is available.
+And the template tags `xili_tidy_tag_cloud` (useful for theme's creator) is now more powerful with more args as in `tag_cloud or get_terms`.
+Some fixes and translation.
+It is also possible to create tag's group according category in three clicks - see second example in installation and [screenshots](http://wordpress.org/extend/plugins/xili-tidy-tags/screenshots/).
+
+
+== Installation ==
+
+1. Upload the folder containing `xili-tidy-tags.php` and others files to the `/wp-content/plugins/` directory,
+2. If xili-language plugin is activated, groups of languages are automatically created. If not, you can also use xili-tidy-tags to group your tags in semantic group like technical, trademark...
+3. in theme, a new template tag is available : `xili_tidy_tag_cloud` Same passed values as tag_cloud but two new : tagsgroup and tagsallgroup . tagsallgroup can be the parent group slug, tagsgroup is one of the child group slug. If one or both are included, the cloud is built with sub-selected tags in this (theses) group(s).
+
+
+**Exemples of script in sidebar.php :**
+
+= with xili-language plugin activated in multilingual website =
+`
+<div>
+<h2><?php _e('Tags cloud','xilidev');?></h2>
+<?php if (function_exists('xili_tidy_tag_cloud') && class_exists('xili_language')) xili_tidy_tag_cloud('tagsgroup='.the_curlang().'&tagsallgroup=tidy-languages-group&largest=18'); ?>
+</div>
+
+`
+
+= with semantic group named as category and a group containing trademarks named trademark =
+`
+<h2><?php _e('Tags cloud','xilidev');?></h2>
+
+<?php
+if (function_exists('xili_tidy_tag_cloud')) xili_tidy_tag_cloud('tagsgroup='.single_cat_title('',false).'&tagsallgroup=trademark&largest=18'); ?>
+</div>
+
+`
+= example of a splitted tag cloud of authors group (here separated by hr) - change html tags if you want to build a table with 3 columns =
+`
+<div>
+<h2><?php _e('Tags clouds','xilidev');?></h2>
+<?php if (function_exists('xili_tidy_tag_cloud')) xili_tidy_tag_cloud('tagsgroup=authors&largest=18&&number=15'); ?>
+<hr />
+<?php if (function_exists('xili_tidy_tag_cloud')) xili_tidy_tag_cloud('tagsgroup=authors&largest=18&&offset=15&number=15'); ?>
+<hr />
+<?php if (function_exists('xili_tidy_tag_cloud')) xili_tidy_tag_cloud('tagsgroup=authors&largest=18&&offset=30&number=150'); ?>
+</div>
+`
+= note about template tag =
+
+If the two args tagsgroup and tagsallgroup are empty, the content is all the tags as in current tag cloud but with more features for selecting or look as soon documented.
+
+= note about widget =
+If you create the single widget since 0.9.0, with 0.9.2 (which allows more than one), you need to recreate one, two or more widget(s) in theme admin UI.
+
+
+== Frequently Asked Questions ==
+
+= Where can I see websites using this plugin ? =
+
+dev.xiligroup.com [here](http://dev.xiligroup.com/ "a multi-language site")
+
+and
+
+www.xiliphone.mobi [here](http://www.xiliphone.mobi "a theme for mobile") also usable with mobile as iPhone.
+
+and the first from China since plugin version 0.8.0
+
+layabozi.com [here](http://layabozi.com) to sub select music maker name and other tags sub-groups.
+
+and a wonderful website
+
+[Frases de cine](http://www.frasesdecine.es) with more than 200 tags.
+
+= Compatibility with other plugins ? =
+
+In xiligroup plugins series, xili-tidy-tags is compatible with [xili-language](http://wordpress.org/extend/plugins/xili-language/), [xili-dictionary](http://wordpress.org/extend/plugins/xili-dictionary/), [xilitheme-select](http://wordpress.org/extend/plugins/xilitheme-select/) , a set of plugins to create powerful multilingual CMS website.
+
+= Compatibility with WP 2.8 ? =
+
+Today, with current release, xili-tidy-tags is compatible with 2.8 version.
+
+== Screenshots ==
+
+1. the admin settings UI : tidy tags groups.
+2. the admin assign UI : table and checkboxes to set group of tags.
+3. the admin settings UI : table and checkboxes to set group of tags : sub-selection of groups.
+4. widget UI : example where cloud of tags is dynamic and according categories and include group trademark.
+5. widget UI : (xili-language plugin activated) example where cloud of tags is dynamic and according language.
+6. widget UI : display a sub-group of tags named philosophy.
+7. the admin assign UI : with big tags list, it is now possible to select tags starting or containing char(s) or word(s).
+8. the admin assign UI : here only the group “software” - a parent group - is selected and all tags of his childs are shown.
+9. the admin assign UI : here only the group “software” - a parent group - is selected and only tags of this group are shown (No childs checked).
+
+== Changelog ==
+
+= 1.3.0 = add sub-selection by tags belonging to a group. Now uses Walker class to sort groups in settings UI.
+= 1.2.1 = fix quick-edit tag function.
+= 1.2 = fix `xili_tidy_tag_cloud` sort and order.
+= 1.1 = In loop, the template tag `the_tags` named `xili_the_tags` is now able to show only tags of sub-group(s).
+= 1.0.1 = some fixes in php code on some servers (Thanks to Giannis)
+= 1.0 =
+* add shortcode to include a cloud of a group of tags inside a post,
+* compatible with WP 2.8.
+= 0.9.5 = Capabilities and roles, better admin menu
+= 0.9.4 = when creating tags in post UI - group new tag to default lang if xili-language is active
+= 0.9.3 = W3C, recover compatibility with future WP 2.8
+= 0.9.2 = changing kindship, now allows multiple cloud widgets.
+= 0.9.1 = with big tags list, select tags starting or containing char(s) or word(s). &offset= et &number= in `xili_tidy_tag_cloud`
+= 0.9.0 = widget for compatible themes and UI actions to include group according a chosen category
+= 0.8.2 = fixes php warning when tagsgroup args are empty in tidy_tag_cloud()
+= 0.8.1 = some fixes - improved query - better tag_cloud()
+= 0.8.0 = first public beta release.
+
+© 2010-02-18 dev.xiligroup.com
+
+== Upgrade Notice ==
+
+As recommanded, don't forget to make a backup of the database.
+Upgrading can be easily procedeed through WP admin UI or through ftp.
+
+== More infos ==
+
+= Capabilities and roles : =
+
+0.9.5 : Administrator role can create grouping or setting capabilities for editor role. 'Grouping' permits to editor to group tags in group (lang and/or semantic). 'Setting' permits to editor to create, modify or delete semantic groups. Only administrator has access to languages groups.
+
+
+This first beta releases are for multilingual or cms website's creator or designer.
+
+The plugin post is frequently documented [dev.xiligroup.com](http://dev.xiligroup.com/)
+and updated [Wordpress repository](http://wordpress.org/extend/plugins/xili-tidy-tags/).
+
+See also the [Wordpress plugins forum](http://wordpress.org/tags/xili-tidy-tags/).
+
+
+© 100218 - MS - dev.xiligroup.com
Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-1.png has changed
Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-2.png has changed
Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-3.png has changed
Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-4.png has changed
Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-5.png has changed
Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-6.png has changed
Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-7.png has changed
Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-8.png has changed
Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-9.png has changed
Binary file web/wp-content/plugins/xili-tidy-tags/xili-favicon.ico has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-tidy-tags/xili-tidy-tags.php Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,1765 @@
+<?php
+/*
+Plugin Name: xili-tidy-tags
+Plugin URI: http://dev.xiligroup.com/xili-tidy-tags/
+Description: xili-tidy-tags is a tool for grouping tags by language or semantic group. Initially developed to enrich xili-language plugin and usable in all sites (CMS).
+Author: dev.xiligroup.com - MS
+Version: 1.3.0
+Author URI: http://dev.xiligroup.com
+*/
+# 1.3.0 - 100218 - add sub-selection by tags belonging to a group (suggestion of David) - Now uses Walker class to sort groups in UI.
+# 1.2.1 - 091129 - fix quick-edit tag error (thanks to zarban)
+# 1.2 - 091122 - fix subselection sort in get_terms_of_groups (thanks to zarban)
+# 1.1 - 091012 - new xili_the_tags() for the loop
+# 1.0.1 - 090718 - new icon in admin menu - some fixes in php code for some servers (Thanks to Giannis)
+# 1.0 - 090611 - add shortcode to include a cloud of a group of tags inside a post - compatible with WP 2.8
+# 0.9.6 - 090602 <- # 0.8.1 - 090331 - see history in readme.txt -
+# first public release 090329 - 0.8.0 - beta version
+
+# This plugin is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This plugin is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this plugin; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+define('XILITIDYTAGS_VER','1.3.0'); /* used in admin UI */
+
+class xili_tidy_tags {
+
+ var $is_metabox = false; /* for tests of special box in post */
+ var $is_post_ajax = false; /* for tests using ajax in UI */
+ var $langgroupid = 0; /* group of langs*/
+
+ var $subselect = 0; /* selected parent group */
+ var $fromgroupselect = 0; /* group in which belong tags */
+ var $groupexclude = false; /* exclude group from the query */
+ var $onlyparent = false; /* when a group is parent, show all tags of childs of the group */
+
+ function xili_tidy_tags($metabox = false, $post_ajax = false) {
+ $this->is_metabox = $metabox;
+ $this->is_post_ajax = $post_ajax;
+
+ /* activated when first activation of plug or automatic upgrade */
+ register_activation_hook(__FILE__,array(&$this,'xili_tidy_tags_activate'));
+
+ /*get current settings - name of taxonomy - name of query-tag - 0.9.8 new taxonomy taxolangsgroup */
+ $this->xili_tidy_tags_activate();
+ if ($this->xili_settings['version'] != '0.5') { /* updating value by default 0.9.5 */
+ $this->xili_settings['version'] = '0.5';
+ update_option('xili_tidy_tags_settings', $this->xili_settings);
+ }
+
+ define('TAXOTIDYTAGS',$this->xili_settings['taxonomy']);
+ define('LANGSTAGSGROUPSLUG',$this->xili_settings['tidylangsgroup']);
+ define('LANGSTAGSGROUPNAME',$this->xili_settings['tidylangsgroupname']);
+ $res = is_term (LANGSTAGSGROUPNAME,TAXOTIDYTAGS);
+ if ($res) $this->langgroupid = $res ['term_id'];
+
+ /* add new taxonomy in available taxonomies */
+ register_taxonomy( TAXOTIDYTAGS, 'term',array('hierarchical' => true, 'update_count_callback' => ''));
+
+ /* since 0.9.5 new default caps for admnistrator */
+ if (is_admin()) {
+ $wp_roles = new WP_Roles(); /* here because not present before */
+ $role = $wp_roles->get_role('administrator');
+ if (!$role->has_cap( 'xili_tidy_editor_set' )) $role->add_cap('xili_tidy_editor_set');
+ if (!$role->has_cap( 'xili_tidy_editor_group' )) $role->add_cap('xili_tidy_editor_group');
+ }
+
+ /* hooks */
+ /* admin settings UI*/
+ add_action('init', array(&$this, 'init_plugin')); /* text domain and caps of admin*/
+ add_filter('plugin_action_links', array(&$this,'xili_filter_plugin_actions'), 10, 2);
+
+ add_action('admin_menu', array(&$this,'xili_add_pages'));
+
+ add_action('add_tag_form', array(&$this,'xili_add_tag_form')); /* to choose a group for a new tag */
+ add_action('edit_tag_form', array(&$this,'xili_edit_tag_form'));
+
+ add_action('created_term', array(&$this,'xili_created_term'),10,2); /* a new term was created */
+ add_action('edited_term', array(&$this,'xili_created_term'),10,2);
+
+ /* actions for post and page admin UI */
+ add_action('save_post', array(&$this,'xili_tags_grouping'),50); /* to affect tags to lang of saved post */
+
+ }
+
+ function xili_tidy_tags_activate() {
+ /* admin has ever tidy roles */
+ $this->xili_settings = get_option('xili_tidy_tags_settings');
+ if (empty($this->xili_settings )) {
+ $this->xili_settings = array(
+ 'taxonomy' => 'xili_tidy_tags',
+ 'tidylangsgroup' => 'tidy-languages-group',
+ 'tidylangsgroupname' => 'All lang.',
+ 'version' => '0.5'
+ );
+ update_option('xili_tidy_tags_settings', $this->xili_settings);
+ }
+ }
+ function init_plugin() {
+ /*multilingual for admin pages and menu*/
+ load_plugin_textdomain('xili_tidy_tags',PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)),dirname(plugin_basename(__FILE__)));
+ }
+
+ /**
+ * Add action link(s) to plugins page
+ *
+ * @since 0.8.0
+ * @author MS
+ * @copyright Dion Hulse, http://dd32.id.au/wordpress-plugins/?configure-link and scripts@schloebe.de
+ */
+ function xili_filter_plugin_actions($links, $file){
+ static $this_plugin;
+
+ if( !$this_plugin ) $this_plugin = plugin_basename(__FILE__);
+
+ if( $file == $this_plugin ){
+ $settings_link = '<a href="admin.php?page=xili_tidy_tags_settings">' . __('Settings') . '</a>';
+ $links = array_merge( array($settings_link), $links); // before other links
+ }
+ return $links;
+ }
+
+ /**
+ * add in new tag form to choose a group for a new tag
+ *
+ * @since 0.8.0
+ *
+ *
+ */
+ function xili_add_tag_form() {
+ $listgroups = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'get'=>'all'));
+ $checkline ='';
+ foreach ($listgroups as $group) {
+ $checkline .= '<input type="checkbox" id="group-'.$group->term_id.'" name="group-'.$group->term_id.'" value="'.$group->term_id.'" />'.$group->name.' - ';
+ }
+ $checkline .='<br /><br /><small>'.__('© by xili-tidy-tags.','xili_tidy_tags').'</small>';
+ echo '<div style="margin:2px; padding:3px; border:1px solid #ccc;"><label>'.__('Tags groups','xili_tidy_tags').':</label><br />'.$checkline.'</div>';
+ }
+
+ /**
+ * add in edit tag form to choose a group for a edited tag
+ *
+ * @since 0.8.0
+ *
+ *
+ */
+ function xili_edit_tag_form($tag) {
+ $listgroups = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'get'=>'all'));
+ $checkline ='';
+ foreach ($listgroups as $group) {
+ /* add checked="checked" */
+ if (is_object_in_term($tag->term_id,TAXOTIDYTAGS,(int) $group->term_id)) {
+ $checked = 'checked="checked"';
+ } else {
+ $checked = '';
+ }
+ $checkline .= '<input type="checkbox" name="group-'.$group->term_id.'" id="group-'.$group->term_id.'" value="'.$group->term_id.'" '.$checked.' />'.$group->name.' - ';
+ }
+ $checkline .='<br /><br /><small>'.__('© by xili-tidy-tags.','xili_tidy_tags').'</small>';
+ echo '<div style="margin:2px; padding:3px; border:1px solid #ccc;"><label>'.__('Tags groups','xili_tidy_tags').':<br /></label><br />'.$checkline.'</div>';
+ }
+
+ /**
+ * a new term was created
+ *
+ * @since 0.8.0
+ * @updated 1.2.1
+ *
+ */
+ function xili_created_term ($term_id, $tt_id) {
+ /* check if it is a term from 'post_tag' */
+ if (!isset($_POST['_inline_edit'])) { /* to avoid delete relationship when in quick_edit (edit-tags.php) */
+ $term = get_term($term_id,'post_tag');
+ if ($term) {
+ $listgroups = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'get'=>'all'));
+ $groupids = array();
+ foreach ($listgroups as $group) {
+ $idcheck = 'group-'.$group->term_id;
+ if (isset($_POST[$idcheck])) {
+
+ $groupids[]= (int) $group->term_id;
+ }
+ }
+ wp_set_object_terms($term_id, $groupids, TAXOTIDYTAGS,false);
+ }
+ }
+ }
+
+ /**
+ * in post edit UI if new term was created - give it a group
+ *
+ * @since 0.9.4
+ *
+ *
+ */
+ function xili_tags_grouping ($post_ID) {
+ if (!class_exists('xili_language')) return ; /* only used if present */
+ $list_tags = wp_get_object_terms($post_ID, 'post_tag');
+ if ( !$list_tags )
+ return ; /* no tag*/
+ $post_curlang = get_cur_language($post_ID);
+ //$res = is_term (LANGSTAGSGROUPNAME,TAXOTIDYTAGS);
+ //if ($res) $langgroupid = $res ['term_id'];
+ $listlanggroups = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'parent' => $this->langgroupid));
+ if ($listlanggroups) {
+ foreach ($listlanggroups as $curgroup) {
+ $langsgroup[] = $curgroup->term_id;
+ }
+ $langsgroup[] = $this->langgroupid; /* add group parent */
+ foreach ( $list_tags as $tag ) { /* test if the tag is owned by a group */
+ $nbchecked = false;
+ foreach ($langsgroup as $onelanggroup) {
+ if (is_object_in_term($tag->term_id,TAXOTIDYTAGS,$onelanggroup)) {
+ $nbchecked = true ;
+ }
+ }
+ if ($nbchecked == false) {
+ if ($post_curlang == false) { /* add to group parent */
+ wp_set_object_terms((int) $tag->term_id, (int) $this->langgroupid, TAXOTIDYTAGS,false);
+ } else {
+ $res = is_term ($post_curlang,TAXOTIDYTAGS);
+ wp_set_object_terms((int) $tag->term_id, (int) $res ['term_id'], TAXOTIDYTAGS,false);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * add admin menu and associated pages of admin UI tools page
+ *
+ * @since 0.8.0
+ * @updated 0.9.5 - menu without repeat of main title, levels with new caps set by plugin array(&$this,'top_tidy_menu_title')
+ * @updated 1.0.1 - favicon.ico for menu title
+ */
+ function xili_add_pages() {
+
+ $this->thehook0 = add_object_page(__('Tags groups','xili_tidy_tags'), __('Tidy Tags','xili_tidy_tags'), -1, __FILE__,'', WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__)).'/xili-favicon.ico');
+ $this->thehook = add_submenu_page(__FILE__, __('Tags groups','xili_tidy_tags'),__('Tidy tags settings','xili_tidy_tags'), 'xili_tidy_editor_set', 'xili_tidy_tags_settings', array(&$this,'xili_tidy_tags_settings'));
+ add_action('load-'.$this->thehook, array(&$this,'on_load_page'));
+ /* sub-page */
+ $this->thehook2 = add_submenu_page(__FILE__, __('Tidy tags','xili_tidy_tags'), __('Tidy tags assign','xili_tidy_tags'), 'xili_tidy_editor_group', 'xili_tidy_tags_assign', array(&$this,'xili_tidy_tags_assign'));
+ add_action('load-'.$this->thehook2, array(&$this,'on_load_page2'));
+ }
+ function top_tidy_menu_title () {
+ echo 'lili';
+ }
+
+ function on_load_page() {
+ wp_enqueue_script('common');
+ wp_enqueue_script('wp-lists');
+ wp_enqueue_script('postbox');
+ add_meta_box('xili_tidy_tags-sidebox-1', __('Message','xili_tidy_tags'), array(&$this,'on_sidebox_1_content'), $this->thehook , 'side', 'core');
+ add_meta_box('xili_tidy_tags-sidebox-3', __('Info','xili_tidy_tags'), array(&$this,'on_sidebox_2_content'), $this->thehook , 'side', 'core');
+ if (current_user_can( 'administrator'))
+ add_meta_box('xili_tidy_tags-sidebox-4', __('Capabilities','xili_tidy_tags'), array(&$this,'on_sidebox_4_content'), $this->thehook , 'side', 'core');
+
+ }
+
+ function on_load_page2() {
+ wp_enqueue_script('common');
+ wp_enqueue_script('wp-lists');
+ wp_enqueue_script('postbox');
+ add_meta_box('xili_tidy_tags-sidebox-1', __('Message','xili_tidy_tags'), array(&$this,'on_sidebox_1_content'), $this->thehook2 , 'side', 'core');
+ add_meta_box('xili_tidy_tags-sidebox-3', __('Info','xili_tidy_tags'), array(&$this,'on_sidebox_2_content'), $this->thehook2 , 'side', 'core');
+ }
+
+
+ /**
+ * private functions for dictionary_settings
+ *
+ * @since 0.8.0
+ *
+ * fill the content of the boxes (right side and normal)
+ *
+ */
+
+ function on_sidebox_1_content($data=array()) {
+ extract($data);
+ ?>
+ <h4><?php _e('Note:','xili_tidy_tags') ?></h4>
+ <p><?php echo $message;?></p>
+ <?php
+ }
+
+ function on_sidebox_2_content($data=array()) {
+ extract($data);
+ if ($xili_tidy_tags_page == 'settings') {
+ echo '<p style="margin:2px; padding:3px; border:1px solid #ccc;">'.__('On this page, the tags groups are defined. The special groups for xili-language plugin are importable.<br /> For debug, some technical infos are displayed in the tables or boxes.<br />','xili_tidy_tags').'</p>';
+ } elseif ($xili_tidy_tags_page == 'assign') {
+ echo '<p style="margin:2px; padding:3px; border:1px solid #ccc;">'.__('On this page, in a oneshot way, it is possible to assign the tags to one or more groups defined on the other page of <i>xili-tidy-tags</i> plugin.','xili_tidy_tags').'</p>';
+ } ?>
+ <p><?php _e('<b>xili-tidy-tags</b> is a tool for grouping tags by language or semantic group. Initially developed to enrich multilingual website powered by xili-language plugin.','xili_tidy_tags') ?></p>
+ <?php
+ }
+ /*
+ * Admin capabilities setting box
+ * @since 0.9.5
+ * Only visible if admin (cap : update_plugins)
+ */
+ function on_sidebox_4_content($data=array()) {
+ global $wp_roles;
+ $role = $wp_roles->get_role('editor');
+ $editor_set = $role->has_cap ('xili_tidy_editor_set') ;
+ $editor_group = $role->has_cap ('xili_tidy_editor_group') ;
+ if ($editor_set && $editor_group)
+ {
+ $selected3 = ' selected = "selected"';
+ } elseif ( $editor_group ) {
+ $selected2 = ' selected = "selected"';
+ }
+
+ ?>
+ <div style="margin:2px; padding:3px; border:1px solid #ccc;">
+ <p><?php _e('Here, as admin, set capabilities of the editor:','xili_tidy_tags') ?></p>
+ <select name="editor_caps" id="editor_caps" style="width:80%;">
+ <option value="no_caps" ><?php _e('no capability','xili_tidy_tags'); ?></option>
+ <option value="caps_grouping" <?php echo $selected2;?>><?php _e('Grouping','xili_tidy_tags'); ?></option>
+ <option value="caps_setting_grouping" <?php echo $selected3;?>><?php _e('Setting and grouping','xili_tidy_tags');?></option>
+ </select>
+ <?php
+ echo'<p class="submit"><input type="submit" name="editor_caps_submit" value="'.__('Set »','xili_tidy_tags').'" /></p></div>';
+ }
+
+ /*
+ * Action's box
+ */
+ function on_sidebox_3_content($data=array()) {
+ extract($data);
+ echo '<div style="margin:2px; padding:3px; border:1px solid #ccc;">';
+ echo '<p>'.__('Add a tag\'s group for a chosen category','xili_tidy_tags').'</p>';
+ /* build the selector of available categories */
+ $categories = get_categories(array('get'=>'all')); /* even if cat is empty */
+ echo '<select name="catsforgroup" id="catsforgroup" style="width:100%;">';
+ echo '<option value="no" >'.__('choose a category','xili_tidy_tags').'</option>';
+ foreach ($categories as $cat) {
+ $catinside = is_term ($cat->slug,TAXOTIDYTAGS);
+ if ($catinside == 0 && $cat->term_id != 1)
+ echo '<option value="'.$cat->term_id.'" >'.$cat->name.'</option>';
+ }
+ echo '</select>';
+ echo '<p>'.__('Choose a parent tag\'s group','xili_tidy_tags').'</p>';
+ $listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false));
+ ?>
+ <select name="tags_parent" id="tags_parent" style="width:100%;">
+ <option value="no_parent" ><?php _e('no parent','xili_tidy_tags'); ?></option>
+ <?php
+ //$res = is_term (LANGSTAGSGROUPNAME,TAXOTIDYTAGS);
+ //if ($res) $langgroupid = $res ['term_id'];
+ foreach ($listterms as $curterm) {
+ if ($curterm->parent == 0 && $curterm->term_id != $this->langgroupid)
+ echo '<option value="'.$curterm->term_id.'" >'.$curterm->name.'</option>';
+ } ?>
+ </select>
+ <br />
+ <?php
+ echo '<p class="submit"><input type="submit" name="importacat" value="'.__('Add »','xili_tidy_tags').'" /></p>';
+ echo '<p>'.__('See docs to set xili_tidy_tag_cloud function or widget to implement in theme…','xili_tidy_tags').'</p>';
+ echo '</div>';
+ echo '<div style="margin:2px; padding:3px; border:1px solid #ccc;">';
+ if (!defined('TAXONAME')) { ?>
+ <p class="submit"><?php _e('xili-language plugin is not activated.','xili_tidy_tags') ?> </p>
+ <?php
+ } else {
+ $res = is_term (LANGSTAGSGROUPNAME,TAXOTIDYTAGS);
+ if ($res) $childterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'parent' => $res['term_id']));
+ if ($res && !empty($childterms)) {
+ ?>
+ <p><?php _e('The group of languages is set for use with xili-language plugin.','xili_tidy_tags') ?> </p>
+ <?php
+ } else { /* since 0.9.5 */
+ if (current_user_can( 'administrator')) {
+ $countt = wp_count_terms(TAXONAME); /* count a minima one language */
+ if ( $countt > 0 ) {
+ echo '<p class="submit">'.__('It is possible to import the group of languages.','xili_tidy_tags').'</p>';
+ echo '<p class="submit"><input type="submit" name="importxililanguages" value="'.__('Import…','xili_tidy_tags').'" /></p>';
+ } else {
+ echo '<p class="submit">'.__('Go to settings of xili-language plugin and add languages','xili_tidy_tags').'</p>';
+ }
+ } else {
+ echo '<p class="submit">'.__('See administrator for language settings.','xili_tidy_tags').'</p>';
+ }
+ }
+ }
+ echo '</div>';
+
+ }
+
+ function on_normal_1_content($data=array()) {
+ extract($data); ?>
+ <?php /**/ ?>
+ <table class="widefat">
+ <thead>
+ <tr>
+ <th scope="col" style="text-align: center"><?php _e('ID','xili_tidy_tags') ?></th>
+ <th scope="col"><?php _e('Name','xili_tidy_tags') ?></th>
+ <th scope="col"><?php _e('Description','xili_tidy_tags') ?></th>
+ <th scope="col"><?php _e('Group slug','xili_tidy_tags') ?></th>
+ <th scope="col"><?php _e('Group taxo ID','xili_tidy_tags') ?></th>
+ <th scope="col"><?php _e('Parent','xili_tidy_tags') ?></th>
+ <th scope="col" width="90" style="text-align: center"><?php _e('Tags') ?></th>
+ <th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
+ </tr>
+ </thead>
+ <tbody id="the-list">
+ <?php $this->xili_tags_group_row(); /* the lines */?>
+ </tbody>
+ </table>
+
+ <?php
+ }
+
+ function on_normal_2_content($data=array()) {
+ extract($data); /* form to add or edit group */
+ ?>
+
+ <h2 id="addgroup" <?php if ($action=='delete') echo 'style="color:#FF1111;"'; ?>><?php _e($formtitle,'xili_tidy_tags') ?></h2>
+ <?php if ($action=='edit' || $action=='delete') :?>
+ <input type="hidden" name="tagsgroup_term_id" value="<?php echo $tagsgroup->term_id ?>" />
+ <input type="hidden" name="tagsgroup_parent" value="<?php echo $tagsgroup->parent ?>" />
+ <?php endif; ?>
+ <table class="editform" width="100%" cellspacing="2" cellpadding="5">
+ <tr>
+ <th width="33%" scope="row" valign="top" align="right"><label for="tagsgroup_name"><?php _e('Name','xili_tidy_tags') ?></label>: </th>
+ <td width="67%"><input name="tagsgroup_name" id="tagsgroup_name" type="text" value="<?php echo attribute_escape($tagsgroup->name); ?>" size="40" <?php if($action=='delete') echo 'disabled="disabled"' ?> /></td>
+ </tr>
+ <tr>
+ <th scope="row" valign="top" align="right"><label for="tagsgroup_nicename"><?php _e('tags group slug','xili_tidy_tags') ?></label>: </th>
+ <td><input name="tagsgroup_nicename" id="tagsgroup_nicename" type="text" value="<?php echo attribute_escape($tagsgroup->slug); ?>" size="40" <?php if($action=='delete') echo 'disabled="disabled"' ?> /></td>
+ </tr>
+ <tr>
+ <th scope="row" valign="top" align="right"><label for="tagsgroup_description"><?php _e('Description','xili_tidy_tags') ?></label>: </th>
+ <td><input name="tagsgroup_description" id="tagsgroup_description" size="40" value="<?php echo $tagsgroup->description; ?>" <?php if($action=='delete') echo 'disabled="disabled"' ?> /></td>
+
+ </tr>
+ <tr class="form-field">
+ <th scope="row" valign="top" align="right"><label for="tagsgroup_parent"><?php _e('kinship','xili_tidy_tags') ?></label> : </th>
+ <td>
+ <?php $this->xili_selectparent_row($tagsgroup->term_id,$tagsgroup,$action); /* choice of parent line*/?>
+ </td>
+ </tr>
+ <tr>
+ <th><p class="submit"><input type="submit" name="reset" value="<?php echo $cancel_text ?>" /></p></th>
+ <td>
+ <p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
+ </td>
+ </tr>
+ </table>
+ <?php
+ }
+
+ function xili_selectparent_row($term_id=0,$tagsgroup,$action) {
+ if ($term_id == 0) {
+ $listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false));
+ ?>
+ <select name="tagsgroup_parent" id="tagsgroup_parent" style="width:100%;">
+ <option value="no_parent" ><?php _e('no parent','xili_tidy_tags'); ?></option>
+ <?php
+ foreach ($listterms as $curterm) {
+ if ($curterm->parent == 0) {
+ if (current_user_can( 'administrator')) {
+ $possible = true;
+ } elseif ($curterm->term_id == $this->langgroupid) {
+ $possible = false;
+ } else {
+ $possible = true;
+ }
+ if ($possible)
+ echo '<option value="'.$curterm->term_id.'" >'.$curterm->name.'</option>';
+ }
+ } ?>
+ </select>
+ <br />
+ <?php _e('Select the parent if necessary','xili_tidy_tags');
+ } else {
+ if ($tagsgroup->parent == 0) {
+ $listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'parent' => $term_id));
+ // display childs
+ if (!empty($listterms)) {
+ echo __('parent of: ','xili_tidy_tags');
+ echo '<ul>';
+ foreach ($listterms as $curterm) {
+ echo '<li value="'.$curterm->term_id.'" >'.$curterm->name.'</li>';
+ }
+ echo '</ul>';
+ } else {
+ echo __('no child now','xili_tidy_tags')."<br /><br />";
+ }
+ /* if modify*/
+ if($action=='edit') {
+ $listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false));
+ ?>
+ <select name="tagsgroup_parent" id="tagsgroup_parent" style="width:100%;">
+ <option value="no_parent" ><?php _e('no parent','xili_tidy_tags'); ?></option>
+ <?php
+ foreach ($listterms as $curterm) {
+ if ($curterm->parent == 0 && $curterm->term_id != $term_id)
+ echo '<option value="'.$curterm->term_id.'" >'.$curterm->name.'</option>';
+ } ?>
+ </select>
+ <br />
+ <?php _e('Select the parent if necessary','xili_tidy_tags');
+
+ }
+
+ } else {
+ /* if modify*/
+ $parent_term = get_term($tagsgroup->parent,TAXOTIDYTAGS,OBJECT,'edit');
+ if($action=='delete') {
+ echo __('child of: ','xili_tidy_tags');
+ echo $parent_term->name; ?>
+ <input type="hidden" name="tagsgroup_parent" value="<?php echo $parent_term->term_id ?>" />
+ <?php } else {
+ $listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false));
+ ?>
+ <select name="tagsgroup_parent" id="tagsgroup_parent" style="width:100%;">
+ <option value="no_parent" ><?php _e('no parent','xili_tidy_tags'); ?></option>
+ <?php
+ foreach ($listterms as $curterm) {
+ if ($curterm->parent == 0 && $curterm->term_id != $term_id) {
+ $checked = ($parent_term->term_id == $curterm->term_id) ? 'selected="selected"' :'' ;
+ echo '<option value="'.$curterm->term_id.'" '.$checked.' >'.$curterm->name.'</option>';
+ }
+ } ?>
+ </select>
+ <br />
+ <?php _e('Modify the parent if necessary','xili_tidy_tags');
+ }
+ }
+ }
+ }
+
+ /* Dashboard - Manage - Tidy tags */
+ function xili_tidy_tags_settings() {
+ $xili_tidy_tags_page = 'settings';
+ $formtitle = 'Add a group'; /* translated in form */
+ $submit_text = __('Add »','xili_tidy_tags');
+ $cancel_text = __('Cancel');
+ if (isset($_POST['reset'])) {
+ $action=$_POST['reset'];
+ } elseif (isset($_POST['updateoptions'])) {
+ $action='updateoptions';
+ } elseif (isset($_POST['importxililanguages'])) {
+ $action='importxililanguages';
+ } elseif (isset($_POST['importacat'])) {
+ $action='importacat';
+ } elseif (isset($_POST['editor_caps_submit'])) { /* 0.9.5 capabilities */
+ $action='editor_caps_submit';
+ } elseif (isset($_POST['action'])) {
+ $action=$_POST['action'];
+ }
+
+ if (isset($_GET['action'])) :
+ $action=$_GET['action'];
+ $term_id = $_GET['term_id'];
+ endif;
+ $message = $action ;
+ switch($action) {
+ case 'editor_caps_submit';
+ $new_cap = $_POST['editor_caps'];
+ global $wp_roles;
+ $role = $wp_roles->get_role('editor');
+ switch ($new_cap) {
+ case 'no_caps';
+ $wp_roles -> remove_cap('editor','xili_tidy_editor_set');
+ $wp_roles -> remove_cap('editor','xili_tidy_editor_group');
+ break;
+ case 'caps_grouping';
+ $role -> add_cap('xili_tidy_editor_group');
+ $wp_roles -> remove_cap('editor','xili_tidy_editor_set');
+ break;
+ case 'caps_setting_grouping';
+ $role -> add_cap('xili_tidy_editor_set');
+ $role -> add_cap('xili_tidy_editor_group');
+ break;
+ }
+
+ $actiontype = "add";
+ $message .= " - ".__('Editor Capabilities changed to: ','xili_tidy_tags')." (".$new_cap.") ";
+ break;
+ case 'importacat';
+ $chosencatid = $_POST['catsforgroup'];
+ $chosenparent = $_POST['tags_parent'];
+ $chosencat = get_category($chosencatid);
+ $desc = __('Group for: ','xili_tidy_tags').$chosencat->name .' '. __('category','xili_tidy_tags');
+ $args = array( 'alias_of' => '', 'description' => $desc, 'parent' => (int) $_POST['tags_parent']);
+ $theids = wp_insert_term( $chosencat->name, TAXOTIDYTAGS, $args);
+ if ( !is_wp_error($theids) )
+ wp_set_object_terms($theids['term_id'], (int)$_POST['tags_parent'], TAXOTIDYTAGS);
+
+ $actiontype = "add";
+ $message .= " - ".__('This group was added: ','xili_tidy_tags')." (".$chosencatid.") parent = ".$chosenparent;
+ break;
+
+ case 'importxililanguages';
+ $this->xili_langs_import_terms ();
+ $actiontype = "add";
+ $message .= " - ".__('The languages groups was added.','xili_tidy_tags');
+ break;
+
+ case 'add';
+ $term = $_POST['tagsgroup_name'];
+ if ('' != $term) {
+ $args = array( 'alias_of' => '', 'description' => $_POST['tagsgroup_description'], 'parent' => (int) $_POST['tagsgroup_parent'], 'slug' => $_POST['tagsgroup_nicename']);
+ $theids = wp_insert_term( $term, TAXOTIDYTAGS, $args);
+ if (!is_wp_error($theids))
+ wp_set_object_terms($theids['term_id'], (int)$_POST['tagsgroup_parent'], TAXOTIDYTAGS);
+ $actiontype = "add";
+ $message .= " - ".__('A new group was added.','xili_tidy_tags');
+ } else {
+ $actiontype = "add";
+ $message .= " - ".__('NO new group was added.','xili_tidy_tags');
+ }
+ break;
+
+ case 'edit';
+ $actiontype = "edited";
+ $tagsgroup = get_term($term_id,TAXOTIDYTAGS,OBJECT,'edit');
+ $submit_text = __('Update »','xili_tidy_tags');
+ $formtitle = 'Edit Group';
+ $message .= " - ".__('Group to update.','xili_tidy_tags');
+ break;
+
+ case 'edited';
+ $actiontype = "add";
+ $term = $_POST['tagsgroup_term_id'];
+ $args = array( 'alias_of' => '', 'description' => $_POST['tagsgroup_description'], 'parent' => (int)$_POST['tagsgroup_parent'], 'slug' =>$_POST['tagsgroup_nicename']);
+ $theids = wp_update_term( $term, TAXOTIDYTAGS, $args);
+ $message .= " - ".__('A group was updated.','xili_tidy_tags');
+ break;
+
+ case 'delete';
+ $actiontype = "deleting";
+ $submit_text = __('Delete »','xili_tidy_tags');
+ $formtitle = 'Delete group';
+ $tagsgroup = get_term($term_id,TAXOTIDYTAGS,OBJECT,'edit');
+ $message .= " - ".__('A group to delete.','xili_tidy_tags');
+ break;
+
+ case 'deleting';
+ $actiontype = "add";
+ $term = $_POST['tagsgroup_term_id'];
+ wp_delete_term( $term, TAXOTIDYTAGS, $args);
+ $message .= " - ".__('A group was deleted.','xili_tidy_tags');
+ break;
+
+ case 'reset';
+ $actiontype = "add";
+ break;
+
+ default :
+ $actiontype = "add";
+ $message .= __('Find the list of groups.','xili_tidy_tags');
+ }
+
+ /* register the main boxes always available */
+ add_meta_box('xili_tidy_tags-sidebox-2', __('Actions','xili_tidy_tags'), array(&$this,'on_sidebox_3_content'), $this->thehook , 'side', 'core'); /* Actions */
+ add_meta_box('xili_tidy_tags-normal-1', __('Groups of Tags','xili_tidy_tags'), array(&$this,'on_normal_1_content'), $this->thehook , 'normal', 'core'); /* list of groups*/
+ add_meta_box('xili_tidy_tags-normal-2', __('The group','xili_tidy_tags'), array(&$this,'on_normal_2_content'), $this->thehook , 'normal', 'core'); /* the group*/
+
+ /* form datas in array for do_meta_boxes() */
+ $data = array('xili_tidy_tags_page' => $xili_tidy_tags_page,'message'=>$message,'messagepost'=>$messagepost,'action'=>$action, 'formtitle'=>$formtitle, 'tagsgroup'=>$tagsgroup,'submit_text'=>$submit_text,'cancel_text'=>$cancel_text, 'formhow'=>$formhow, 'orderby'=>$orderby,'term_id'=>$term_id);
+ ?>
+ <div id="xili-tidy-tags-settings" class="wrap" style="min-width:880px">
+ <?php screen_icon('tools'); ?>
+ <h2><?php _e('Tidy tags groups','xili_tidy_tags') ?></h2>
+ <form name="add" id="add" method="post" action="admin.php?page=xili_tidy_tags_settings">
+ <input type="hidden" name="action" value="<?php echo $actiontype ?>" />
+ <?php wp_nonce_field('xili-tidy-tags-settings'); ?>
+ <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
+ <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false );
+ /* 0.9.3 add has-right-sidebar for next wp 2.8*/ ?>
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
+ <div id="side-info-column" class="inner-sidebar">
+ <?php do_meta_boxes($this->thehook, 'side', $data); ?>
+ </div>
+ <div id="post-body" class="has-sidebar has-right-sidebar">
+ <div id="post-body-content" class="has-sidebar-content" style="min-width:580px">
+
+ <?php do_meta_boxes($this->thehook, 'normal', $data); ?>
+ </div>
+
+ <h4><a href="http://dev.xiligroup.com/xili-tidy-tags" title="Plugin page and docs" target="_blank" style="text-decoration:none" ><img style="vertical-align:middle" src="<?php echo WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__)).'/xilitidy-logo-32.gif'; ?>" alt="xili-tidy-tags logo"/> xili-tidy-tags</a> - © <a href="http://dev.xiligroup.com" target="_blank" title="<?php _e('Author'); ?>" >xiligroup.com</a>™ - msc 2009-10 - v. <?php echo XILITIDYTAGS_VER; ?></h4>
+
+ </div>
+ </div>
+ </form>
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+ jQuery(document).ready( function($) {
+ // close postboxes that should be closed
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
+ // postboxes setup
+ postboxes.add_postbox_toggles('<?php echo $this->thehook; ?>');
+ });
+ //]]>
+ </script>
+
+ <?php
+ }
+ /*
+ * Import the terms (languages) set by xili-language *
+ *
+ */
+ function xili_langs_import_terms () {
+ $term = LANGSTAGSGROUPNAME;
+ $args = array( 'alias_of' => '', 'description' => 'default lang group', 'parent' => 0, 'slug' =>LANGSTAGSGROUPSLUG);
+ $resgroup = wp_insert_term( $term, TAXOTIDYTAGS, $args);
+
+ $listlanguages = get_terms(TAXONAME, array('hide_empty' => false));
+ foreach ($listlanguages as $language) {
+ $args = array( 'alias_of' => '', 'description' => $language->description, 'parent' => $resgroup['term_id']); $res = wp_insert_term($language->name, TAXOTIDYTAGS, $args);
+ }
+ }
+
+ /*
+ * Display the rows of group of tags
+ *
+ * @updated since 1.3.0 - use now walker class to sort Tag's groups
+ */
+ function xili_tags_group_row() {
+ $listtagsgroups = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'get'=>'all'));
+ if (empty($listtagsgroups)) {
+ /* import */
+ if (defined('TAXONAME')) { /* xili-language is present */
+ $this->xili_langs_import_terms ();
+ } else {
+ /*create a default line with the default group*/
+ $term = 'tidy group';
+ $args = array( 'alias_of' => '', 'description' => 'default xili tidy tags group', 'parent' => 0);
+ $resgroup = wp_insert_term( $term, TAXOTIDYTAGS, $args);
+ }
+ $listtagsgroups = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'get'=>'all'));
+ }
+ //print_r($listtagsgroups);
+ $listtagsgroupssorted = walk_TagGroupList_sorted($listtagsgroups,3);
+ foreach ($listtagsgroupssorted as $tagsgroup) {
+ $class = ((defined('DOING_AJAX') && DOING_AJAX) || " class='alternate'" == $class ) ? '' : " class='alternate'";
+
+ $tagsgroup->count = number_format_i18n( $tagsgroup->count );
+ $posts_count = ( $tagsgroup->count > 0 ) ? "<a href='edit.php?lang=$tagsgroup->term_id'>$tagsgroup->count</a>" : $tagsgroup->count;
+ /* since 0.9.5 */
+ if (current_user_can( 'administrator')) { /* all admin only */
+ $possible = true;
+ } elseif (current_user_can( 'xili_tidy_editor_set')) { /* editor if set */
+ if ($tagsgroup->term_id == $this->langgroupid || $tagsgroup->parent == $this->langgroupid) {
+ $possible = false;
+ } else {
+ $possible = true;
+ }
+ } else {
+ $possible = false;
+ }
+
+ if (true === $possible ) {
+ $edit = "<a href='?page=xili_tidy_tags_settings&action=edit&term_id=".$tagsgroup->term_id."' >".__( 'Edit' )."</a></td>";
+ /* delete link &action=edit&term_id=".$tagsgroup->term_id."*/
+ $edit .= "<td><a href='?page=xili_tidy_tags_settings&action=delete&term_id=".$tagsgroup->term_id."' class='delete'>".__( 'Delete' )."</a>";
+ } else {
+ $edit = __('no capability','xili_tidy_tags').'</td><td>';
+ }
+
+ $line="<tr id='cat-$tagsgroup->term_id'$class>
+ <th scope='row' style='text-align: center'>$tagsgroup->term_id</th>
+ <td> ";
+ $tabb = ($tagsgroup->parent != 0) ? " –" : "" ;
+ $tagsgroupname = ($tagsgroup->parent == 0) ? "<strong>".$tagsgroup->name."</strong>": $tagsgroup->name;
+ $line .= "$tabb $tagsgroupname</td>
+ <td>$tagsgroup->description</td>
+ <td>$tagsgroup->slug</td>
+ <td>$tagsgroup->term_taxonomy_id</td>
+ <td>$tagsgroup->parent</td>
+ <td align='center'>$tagsgroup->count</td>
+ <td>$edit</td>\n\t</tr>\n"; /*to complete*/
+ echo $line;
+ }
+
+ }
+
+ function on_sub_normal_1_content ($data=array()) {
+ extract($data); ?>
+ <?php /**/ ?>
+ <table class="widefat">
+ <thead>
+ <tr>
+ <th scope="col" style="text-align: center"><?php _e('ID','xili_tidy_tags') ?></th>
+ <th scope="col"><?php _e('Name','xili_tidy_tags') ?></th>
+ <th scope="col" width="90" style="text-align: center"><?php _e('Posts') ?></th>
+ <th colspan="2" style="text-align: center"><?php _e('Group(s) to choose','xili_tidy_tags') ?></th>
+ </tr>
+ </thead>
+ <tbody id="the-list">
+ <?php $this->xili_tags_row($tagsnamelike,$tagsnamesearch); /* the lines */?>
+ </tbody>
+ </table>
+
+ <?php
+
+ }
+
+ function on_sub_sidebox_3_content($data=array()) {
+ extract($data);?>
+ <p><?php _e('After checking or unchecking do not forget to click update button !','xili_tidy_tags'); ?></p>
+ <p class="submit"><input type="submit" class="button-primary" id="update" name="update" value="<?php echo $submit_text ?>" /> <input type="submit" name="reset" value="<?php echo $cancel_text ?>" /></p>
+
+ <fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"><legend><?php _e('Sub list of tags','xili_tidy_tags'); ?></legend>
+ <label for="tagsnamelike"><?php _e('Starting with:','xili_tidy_tags') ?></label>
+ <input name="tagsnamelike" id="tagsnamelike" type="text" value="<?php echo $tagsnamelike; ?>" /><br />
+ <label for="tagsnamesearch"><?php _e('Containing:','xili_tidy_tags') ?></label>
+ <input name="tagsnamesearch" id="tagsnamesearch" type="text" value="<?php echo $tagsnamesearch; ?>" /><br /><br />
+ <label for="tagsfromgroup"><?php _e('Belonging to group:','xili_tidy_tags') ?></label>
+ <?php $listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false));
+ $listtagsgroupssorted = walk_TagGroupList_sorted($listterms,3);
+ ?>
+ <select name="tagsgroup_from_select" id="tagsgroup_from_select" style="width:45%;">
+ <option value="no_select" ><?php _e('every','xili_tidy_tags'); ?></option>
+ <?php
+ $show = false;
+ foreach ($listtagsgroupssorted as $curterm) {
+ $ttab = ($curterm->parent == 0) ? '' : '– ' ;
+ $checked = ($this->fromgroupselect == $curterm->term_id) ? 'selected="selected"' :'' ;
+ echo '<option value="'.$curterm->term_id.'" '.$checked.' >'.$ttab.$curterm->name.'</option>';
+ if ($this->fromgroupselect == $curterm->term_id && $curterm->parent == 0) $show = true ;
+ } ?>
+ </select>
+ <label for="xili_group_not_select"><?php _e('Exclude this group','xili_tidy_tags') ?> <input id="xili_group_not_select" name="xili_group_not_select" type="checkbox" value="not" <?php if($this->groupexclude == true) echo 'checked="checked"' ?> /></label>
+ <?php if ($show) { ?>
+ – <label for="xili_group_only_parent"><?php _e('No childs','xili_tidy_tags') ?> <input id="xili_group_only_parent" name="xili_group_only_parent" type="checkbox" value="onlyparent" <?php if($this->onlyparent == true) echo 'checked="checked"' ?> /></label>
+ <?php } ?>
+ <br />
+ <p class="submit"><input type="submit" id="tagssublist" name="tagssublist" value="<?php _e('Sub select…','xili_tidy_tags'); ?>" /> <input type="submit" id="notagssublist" name="notagssublist" value="<?php _e('No select…','xili_tidy_tags'); ?>" /></p>
+ </fieldset>
+ <?php /* only show one group to select */ ?>
+ <fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"><legend><?php _e('Columns: Group selection','xili_tidy_tags'); ?></legend>
+ <?php //$listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false)); ?>
+ <select name="tagsgroup_parent_select" id="tagsgroup_parent_select" style="width:100%;">
+ <option value="no_select" ><?php _e('No sub-selection','xili_tidy_tags'); ?></option>
+ <?php
+ foreach ($listterms as $curterm) {
+ if ($curterm->parent == 0) {
+ $checked = ($this->subselect == $curterm->term_id) ? 'selected="selected"' :'' ;
+ echo '<option value="'.$curterm->term_id.'" '.$checked.' >'.$curterm->name.'</option>';
+ }
+ } ?>
+ </select>
+ <br /> <p class="submit"><input type="submit" id="subselection" name="subselection" value="<?php _e('Sub select…','xili_tidy_tags'); ?>" /></p></fieldset><?php
+ }
+ /**
+ * The rows of the tags and checkboxes to assign group(s)
+ *
+ * @since 0.8.0
+ * @updated 1.3.0 - Call walker instantiation
+ * @uses
+ * @param
+ * @return the rows for admin ui
+ */
+ function xili_tags_row($tagsnamelike='',$tagsnamesearch='') {
+ $listgroups = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'get'=>'all'));
+ $hiddenline = array ();
+ $edit =''; $i=0;
+ $listgroupids = array();
+ $sub_listgroups = array();
+ $subselectgroups = array();
+ if ($this->subselect > 0) {
+ $subselectgroups[] = $this->subselect; /* the parent group and */
+ /*childs of */
+ $listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'parent' => $this->subselect));
+ if (!empty($listterms)) {
+ foreach ($listterms as $curterm) {
+ $subselectgroups[] = $curterm->term_id;
+ }
+ }
+ }
+ if (!empty($subselectgroups)) { /* columns sub-selection */
+ foreach ($listgroups as $group) {
+ $listgroupids[] = $group->term_id;
+ if (in_array ($group->term_id,$subselectgroups)) {
+ $sub_listgroups[] = $group;
+ } else {
+ $hiddenline[] = $group->term_id ; /* keep line values */
+ }
+ }
+ $editformat = walk_TagGroupList_tree_row( $sub_listgroups,3);
+ } else {
+ foreach ($listgroups as $group) {
+ $listgroupids[] = $group->term_id;
+ }
+ $editformat = walk_TagGroupList_tree_row( $listgroups,3);
+ }
+
+ if ($this->fromgroupselect == 0) {
+ $listtags = get_terms('post_tag', array('hide_empty' => false,'get'=>'all','name__like'=>$tagsnamelike,'search'=>$tagsnamesearch ));
+ } else { /* since 1.3.0 */
+ $group_id[] = $this->fromgroupselect;
+ if ($this->onlyparent === false) {
+ $childterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'parent' => $this->fromgroupselect));
+ if (!empty($childterms)) {
+ foreach ($childterms as $childterm) { /* if group is a parent, add all childs */
+ $group_id[] = $childterm->term_id;
+ }
+ }
+ }
+ $listtags = get_terms_of_groups_new ($group_id,TAXOTIDYTAGS,'post_tag', array('hide_empty' => false,'get'=>'all','name__like'=>$tagsnamelike,'search'=>$tagsnamesearch,'orderby'=>'name'),$this->groupexclude);
+ }
+
+ foreach ($listtags as $tag) {
+ $class = ((defined('DOING_AJAX') && DOING_AJAX) || " class='alternate'" == $class ) ? '' : " class='alternate'";
+ $tag->count = number_format_i18n( $tag->count );
+ $posts_count = ( $tag->count > 0 ) ? "<a href='edit.php?tag=$tag->name'>$tag->count</a>" : $tag->count;
+ $edit = sprintf($editformat,$tag->term_id);
+ $hiddenlines = "";
+ foreach ($listgroupids as $groupid) {
+ if (is_object_in_term($tag->term_id,TAXOTIDYTAGS,$groupid)) {
+ $edit = str_replace('checked'.$groupid,'checked="checked"',$edit);
+ if (in_array($groupid,$hiddenline))
+ $hiddenlines .= '<input type="hidden" name="line-'.$tag->term_id.'-'.$groupid.'" value="'.$tag->term_id.'" />';
+ } else {
+ $edit = str_replace('checked'.$groupid,'',$edit);
+ }
+ }
+ $line="<tr id='cat-$tag->term_id'$class>
+ <th scope='row' style='text-align: center'>$tag->term_id</th>
+ <td> <a href='edit-tags.php?action=edit&tag_ID=".$tag->term_id."'>".$tag->name."</a> </td>
+ <td align='center'>$posts_count</td>
+ <td>$edit\n$hiddenlines</td>\n\t</tr>\n"; /*to complete*/
+ echo $line;
+ }
+ }
+
+ /* page for tags assign to (a) group(s) */
+ function xili_tidy_tags_assign () {
+ $xili_tidy_tags_page = 'assign';
+ $submit_text = __('Update','xili_tidy_tags');
+ $cancel_text = __('Cancel');
+ $tagsnamelike = $_POST['tagsnamelike'];
+ $tagsnamesearch = $_POST['tagsnamesearch'];
+ if (isset($_POST['update'])) {
+ $action='update';
+ }
+ /* since 1.3.0 */
+ if (isset($_POST['tagsgroup_from_select']) && $_POST['tagsgroup_from_select'] != 'no_select') {
+ $this->fromgroupselect = (int) $_POST['tagsgroup_from_select'];
+ } else {
+ $this->fromgroupselect = 0;
+ }
+ $this->onlyparent = (isset($_POST['xili_group_only_parent']) && $_POST['xili_group_only_parent'] == 'onlyparent') ? true : false ;
+ $this->groupexclude = (isset($_POST['xili_group_not_select']) && $_POST['xili_group_not_select'] == 'not') ? true : false ;
+ $subselectgroups = array();
+ if (isset($_POST['tagsgroup_parent_select']) && $_POST['tagsgroup_parent_select'] != 'no_select') {
+ $this->subselect = (int) $_POST['tagsgroup_parent_select'];
+ } else {
+ $this->subselect = 0;
+ }
+ if (isset($_POST['subselection'])) {
+ $action='subselection';
+ }
+ if (isset($_POST['notagssublist'])) {
+ $action='notagssublist';
+ }
+ if (isset($_POST['tagssublist'])) {
+ $action='tagssublist';
+ }
+ if (isset($_GET['action'])) :
+ $action = $_GET['action'];
+ $term_id = $_GET['term_id'];
+ endif;
+ $message = $action ;
+ switch($action) {
+
+ case 'notagssublist';
+ $tagsnamelike = '';
+ $tagsnamesearch = '';
+ $this->fromgroupselect = 0; /* since 1.3.0 */
+ $this->groupexclude = false;
+ $message .= ' no sub list of tags';
+ $actiontype = "add";
+ break;
+
+ case 'tagssublist';
+ $message .= ' sub list of tags starting with '.$_POST['tagsnamelike'];
+ $message .= '. From group '.$_POST['tagsgroup_from_select'];
+ $actiontype = "add";
+ break;
+
+ case 'subselection';
+ $tagsnamelike = $_POST['tagsnamelike'];
+ $tagsnamesearch = $_POST['tagsnamesearch'];
+ $message .= ' selection of '.$_POST['tagsgroup_parent_select'];
+
+ $actiontype = "add";
+ break;
+
+ case 'update';
+ $message .= ' ok: datas are saved... ';
+ $message .= $this->checkboxes_update_them($tagsnamelike,$tagsnamesearch);
+ $actiontype = "add";
+ break;
+
+ case 'reset';
+ $actiontype = "add";
+ break;
+
+ default :
+ $actiontype = "add";
+ $message .= __('Find the list of tags.','xili_tidy_tags');
+ }
+ /* form datas in array for do_meta_boxes() */
+ $data = array('xili_tidy_tags_page' => $xili_tidy_tags_page,'message'=>$message,'messagepost'=>$messagepost,'action'=>$action,'submit_text'=>$submit_text,'cancel_text'=>$cancel_text,'term_id'=>$term_id, 'tagsnamesearch'=>$tagsnamesearch, 'tagsnamelike'=>$tagsnamelike);
+
+ /* register the main boxes always available */
+ add_meta_box('xili_tidy_tags-sidebox-2', __('Actions','xili_tidy_tags'), array(&$this,'on_sub_sidebox_3_content'), $this->thehook2 , 'side', 'core'); /* Actions */
+ add_meta_box('xili_tidy_tags-normal-1', __('Tidy Tags','xili_tidy_tags'), array(&$this,'on_sub_normal_1_content'), $this->thehook2 , 'normal', 'core'); /* list of tags*/
+
+ ?>
+ <div id="xili-tidy-tags-assign" class="wrap" style="min-width:880px">
+ <?php screen_icon('post'); ?>
+ <h2><?php _e('Tags in group','xili_tidy_tags') ?></h2>
+ <form name="add" id="add" method="post" action="admin.php?page=xili_tidy_tags_assign">
+ <input type="hidden" name="action" value="<?php echo $actiontype ?>" />
+ <?php wp_nonce_field('xili-tidy-tags-settings'); ?>
+ <?php wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false ); ?>
+ <?php wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false );
+ /* 0.9.3 add has-right-sidebar for next wp 2.8*/ ?>
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
+ <div id="side-info-column" class="inner-sidebar">
+ <?php do_meta_boxes($this->thehook2, 'side', $data); ?>
+ </div>
+ <div id="post-body" class="has-sidebar has-right-sidebar">
+ <div id="post-body-content" class="has-sidebar-content" style="min-width:580px">
+
+ <?php do_meta_boxes($this->thehook2, 'normal', $data); ?>
+ </div>
+
+ <h4><a href="http://dev.xiligroup.com/xili-tidy-tags" title="Plugin page and docs" target="_blank" style="text-decoration:none" ><img style="vertical-align:middle" src="<?php echo WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__)).'/xilitidy-logo-32.gif'; ?>" alt="xili-tidy-tags logo"/> xili-tidy-tags</a> - © <a href="http://dev.xiligroup.com" target="_blank" title="<?php _e('Author'); ?>" >xiligroup.com</a>™ - msc 2009-10 - v. <?php echo XILITIDYTAGS_VER; ?></h4>
+
+ </div>
+ </div>
+ </form>
+ </div>
+ <script type="text/javascript">
+ //<![CDATA[
+ jQuery(document).ready( function($) {
+ // close postboxes that should be closed
+ $('.if-js-closed').removeClass('if-js-closed').addClass('closed');
+ // postboxes setup
+ postboxes.add_postbox_toggles('<?php echo $this->thehook2; ?>');
+ });
+ //]]>
+ </script>
+ <?php
+ }
+ /*
+ * Update the relationships according CheckBoxes array
+ *
+ */
+ function checkboxes_update_them($tagsnamelike='',$tagsnamesearch='') {
+
+ $listgroups = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'get'=>'all'));
+ if ($this->fromgroupselect == 0) {
+ $listtags = get_terms('post_tag', array('hide_empty' => false,'get'=>'all','name__like'=>$tagsnamelike,'search'=>$tagsnamesearch));
+ } else {/* since 1.3.0 */
+ $group_id[] = $this->fromgroupselect;
+ if ($this->onlyparent === false) {
+ $childterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false,'parent' => $this->fromgroupselect));
+ if (!empty($childterms)) {
+ foreach ($childterms as $childterm) { /* if group is a parent, add all childs */
+ $group_id[] = $childterm->term_id;
+ }
+ }
+ }
+ $listtags = get_terms_of_groups_new ($group_id,TAXOTIDYTAGS,'post_tag', array('hide_empty' => false,'get'=>'all','name__like'=>$tagsnamelike,'search'=>$tagsnamesearch, 'orderby'=>'name'),$this->groupexclude);
+ }
+
+ foreach ($listtags as $tag) {
+ $groupids = array();
+ foreach ($listgroups as $group){
+ $idcheck = 'line-'.$tag->term_id.'-'.$group->term_id;
+ //$hiddencheck = 'hidd-'.$tag->term_id.'-'.$group->term_id;
+ /*if (isset($_POST[$hiddencheck])) {
+ if (!isset($_POST[$idcheck])) {
+ //$box2reset[$group->term_id][]=$tag->term_id;
+ } else {
+ $groupids[]= (int) $group->term_id;
+ }
+ } else {*/
+ if (isset($_POST[$idcheck])) {
+ //$box2update[$group->term_id][]=$tag->term_id;
+ $groupids[]= (int) $group->term_id;
+ }
+ //}
+
+ }
+ wp_set_object_terms((int) $tag->term_id, $groupids, TAXOTIDYTAGS,false);
+ }
+
+ return ;//$box2update;
+ }
+
+} /* end class */
+
+/**
+ * Display tidy tag cloud. (adapted form wp_tag_cloud - category-template)
+ *
+ * The text size is set by the 'smallest' and 'largest' arguments, which will
+ * use the 'unit' argument value for the CSS text size unit. The 'format'
+ * argument can be 'flat' (default), 'list', or 'array'. The flat value for the
+ * 'format' argument will separate tags with spaces. The list value for the
+ * 'format' argument will format the tags in a UL HTML list. The array value for
+ * the 'format' argument will return in PHP array type format.
+ *
+ * The 'orderby' argument will accept 'name' or 'count' and defaults to 'name'.
+ * The 'order' is the direction to sort, defaults to 'ASC' and can be 'DESC'.
+ *
+ * The 'number' argument is how many tags to return. By default, the limit will
+ * be to return the top 45 tags in the tag cloud list.
+ *
+ * The 'topic_count_text_callback' argument is a function, which, given the count
+ * of the posts with that tag, returns a text for the tooltip of the tag link.
+ *
+ * The 'exclude' and 'include' arguments are used for the {@link get_tags()}
+ * function. Only one should be used, because only one will be used and the
+ * other ignored, if they are both set.
+ *
+ * @since 0.8.0
+ * @updated 0.8.2, 1.2
+ *
+ * @param array|string $args Optional. Override default arguments.
+ * @return array Generated tag cloud, only if no failures and 'array' is set for the 'format' argument.
+ */
+function xili_tidy_tag_cloud( $args = '' ) {
+ if ( is_array($args) )
+ $r = &$args;
+ else
+ parse_str($args, $r);
+ $defaults = array(
+ 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45,
+ 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC',
+ 'exclude' => '', 'include' => '', 'link' => 'view', 'tagsgroup' => '', 'tagsallgroup' => ''
+ );
+ $r = array_merge($defaults, $r);
+ extract($r); /* above changed because new args */
+ if (($tagsgroup == '' && $tagsallgroup == '' ) || !function_exists('get_terms_of_groups_new')) {
+ $tags = get_tags( array_merge( $r, array( 'orderby' => 'count', 'order' => 'DESC' ) ) ); // Always query top tags
+ } else {
+ if ($tagsgroup !='') {
+ $groupterm = is_term($tagsgroup,TAXOTIDYTAGS);
+ $group_id[] = $groupterm['term_id'];
+ }
+ if ($tagsallgroup !='') {
+ $groupterm = is_term($tagsallgroup,TAXOTIDYTAGS);
+ $group_id[] = $groupterm['term_id'];
+ }
+
+ $tags = get_terms_of_groups_new ($group_id, TAXOTIDYTAGS,'post_tag',array_merge( $r, array( 'orderby' => 'count', 'order' => 'DESC' )));
+ // Always query top tags - v 1.2
+ /* arg $r for sub selection */
+
+ }
+
+ if ( empty( $tags ) )
+ return;
+
+ foreach ( $tags as $key => $tag ) {
+ if ( 'edit' == $r['link'] )
+ $link = get_edit_tag_link( $tag->term_id );
+ else
+ $link = get_tag_link( $tag->term_id );
+ if ( is_wp_error( $link ) )
+ return false;
+
+ $tags[ $key ]->link = $link;
+ $tags[ $key ]->id = $tag->term_id;
+ }
+
+ $return = wp_generate_tag_cloud( $tags, $r ); // Here's where those top tags get sorted according to $args
+
+ //$return = apply_filters( 'wp_tag_cloud', $return, $r );
+
+ if ( 'array' == $r['format'] )
+ return $return;
+
+ echo $return;
+}
+
+/**
+ * the tags for each post in loop
+ * (not in class for general use)
+ *
+ * @since 1.1 -
+ * @same params as the default the_tags() and and array as fourth param (see [xili_] get_object_terms for details)
+ */
+function xili_the_tags( $before = null, $sep = ', ', $after = '',$args = array() ) {
+ if ( null === $before )
+ $before = __('Tags: ');
+ if ($args == array()) {
+ echo get_the_tag_list($before, $sep, $after);
+ } else {
+ echo xili_get_the_term_list($before, $sep, $after, $args); /* no filter tag_list*/
+ }
+}
+/**
+ * get_the tag_list for each post in loop $xili_tidy_tags
+ * (not in class for general use)
+ *
+ * @since 1.1 -
+ * @same params as the default the_tags() and and array as fourth param
+ */
+function xili_get_the_term_list($before, $sep, $after, $args) {
+ global $post;
+ $id = (int) $post->ID;
+ $taxonomy = 'post_tag';
+ /* args analysis */
+ $defaults = array(
+ 'sub_groups' => ''
+ );
+ $r = array_merge($defaults, $args);
+ extract($r);
+ if ($sub_groups == '') {
+ $terms = get_the_terms( $id, $taxonomy );
+ } else {
+ if (!is_array($sub_groups)) $sub_groups = explode(',',$sub_groups);
+ /* xili - search terms in sub groups */
+ $terms = get_object_term_cache( $id, $taxonomy.implode('-',$sub_groups));
+ if ( false === $terms )
+ $terms = get_subgroup_terms_in_post ( $id, $taxonomy, $sub_groups );
+
+ }
+ if ( is_wp_error( $terms ) )
+ return $terms;
+
+ if ( empty( $terms ) )
+ return false;
+
+ foreach ( $terms as $term ) {
+ $link = get_term_link( $term, $taxonomy );
+ if ( is_wp_error( $link ) )
+ return $link;
+ $term_links[] = '<a href="' . $link . '" rel="tag">' . $term->name . '</a>';
+ }
+
+ $term_links = apply_filters( "term_links-$taxonomy", $term_links );
+
+ return $before . join( $sep, $term_links ) . $after;
+}
+
+function get_subgroup_terms_in_post ( $id, $taxonomy, $sub_groups ) {
+ return xili_get_object_terms ($id,$taxonomy,array('tidy_tags_group'=>TAXOTIDYTAGS, 'sub_groups' => $sub_groups));
+}
+
+/**** Functions that improve taxinomy.php ****/
+
+/**
+ * get the terms of subgroups of the series objects
+ * (not in class for general use)
+ *
+ * @since 1.1 -
+ *
+ */
+
+function xili_get_object_terms($object_ids, $taxonomies, $args = array()) {
+
+ global $wpdb;
+
+ if ( !is_array($taxonomies) )
+ $taxonomies = array($taxonomies);
+
+ foreach ( (array) $taxonomies as $taxonomy ) {
+ if ( ! is_taxonomy($taxonomy) )
+ return new WP_Error('invalid_taxonomy', __('Invalid Taxonomy'));
+ }
+
+ if ( !is_array($object_ids) )
+ $object_ids = array($object_ids);
+ $object_ids = array_map('intval', $object_ids);
+
+ $defaults = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all','tidy_tags_group' => '');
+ $args = array_merge ( $defaults, $args );
+ extract ($args);
+ //echo "--- "; print_r($sub_groups);
+
+ if (!is_array($sub_groups)) $sub_groups = array($sub_groups);
+ foreach ($sub_groups as $tagsgroup) {
+ if ($tagsgroup !='') {
+ $groupterm = is_term($tagsgroup, $tidy_tags_group); //echo '----'.$tagsgroup;
+ $group_ids[] = $groupterm['term_id'];
+ }
+ }
+ $group_ids = array_map('intval', $group_ids);
+ $group_ids = implode(', ', $group_ids); /* the terms ID of subgroups are now in list */
+
+ $terms = array();
+ if ( count($taxonomies) > 1 ) {
+ foreach ( $taxonomies as $index => $taxonomy ) {
+ $t = get_taxonomy($taxonomy);
+ if ( isset($t->args) && is_array($t->args) && $args != array_merge($args, $t->args) ) {
+ unset($taxonomies[$index]);
+ $terms = array_merge($terms, wp_get_object_terms($object_ids, $taxonomy, array_merge($args, $t->args)));
+ }
+ }
+ } else {
+ $t = get_taxonomy($taxonomies[0]);
+ if ( isset($t->args) && is_array($t->args) )
+ $args = array_merge($args, $t->args);
+ }
+
+ extract($args, EXTR_SKIP);
+
+ if ( 'count' == $orderby )
+ $orderby = 'tt.count';
+ else if ( 'name' == $orderby )
+ $orderby = 't.name';
+ else if ( 'slug' == $orderby )
+ $orderby = 't.slug';
+ else if ( 'term_group' == $orderby )
+ $orderby = 't.term_group';
+ else if ( 'term_order' == $orderby )
+ $orderby = 'tr.term_order';
+ else if ( 'none' == $orderby ) {
+ $orderby = '';
+ $order = '';
+ } else {
+ $orderby = 't.term_id';
+ }
+
+ // tt_ids queries can only be none or tr.term_taxonomy_id
+ if ( ('tt_ids' == $fields) && !empty($orderby) )
+ $orderby = 'tr.term_taxonomy_id';
+
+ if ( !empty($orderby) )
+ $orderby = "ORDER BY $orderby";
+
+ $taxonomies = "'" . implode("', '", $taxonomies) . "'";
+ $object_ids = implode(', ', $object_ids);
+
+ $select_this = '';
+ if ( 'all' == $fields )
+ $select_this = 't.*, tt.*';
+ else if ( 'ids' == $fields )
+ $select_this = 't.term_id';
+ else if ( 'names' == $fields )
+ $select_this = 't.name';
+ else if ( 'all_with_object_id' == $fields )
+ $select_this = 't.*, tt.*, tr.object_id';
+
+ $subselect = "SELECT st.term_id FROM $wpdb->term_relationships AS str INNER JOIN $wpdb->term_taxonomy AS stt ON str.term_taxonomy_id = stt.term_taxonomy_id INNER JOIN $wpdb->terms AS st ON st.term_id = str.object_id INNER JOIN $wpdb->term_taxonomy AS stt2 ON stt2.term_id = str.object_id WHERE stt.taxonomy IN ('".TAXOTIDYTAGS."') AND stt2.taxonomy = ".$taxonomies." AND stt.term_id IN (".$group_ids.") ";
+ //echo $subselect;
+ $query = "SELECT $select_this FROM $wpdb->terms AS t INNER JOIN $wpdb->term_taxonomy AS tt ON tt.term_id = t.term_id INNER JOIN $wpdb->term_relationships AS tr ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tt.taxonomy IN ($taxonomies) AND tr.object_id IN ($object_ids) AND t.term_id IN ($subselect) $orderby $order"; //echo $query;
+
+ if ( 'all' == $fields || 'all_with_object_id' == $fields ) {
+ $terms = array_merge($terms, $wpdb->get_results($query));
+ update_term_cache($terms);
+ } else if ( 'ids' == $fields || 'names' == $fields ) {
+ $terms = array_merge($terms, $wpdb->get_col($query));
+ } else if ( 'tt_ids' == $fields ) {
+ $terms = $wpdb->get_col("SELECT tr.term_taxonomy_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id WHERE tr.object_id IN ($object_ids) AND tt.taxonomy IN ($taxonomies) $orderby $order");
+ }
+
+ if ( ! $terms )
+ $terms = array();
+
+ return $terms;
+}
+
+function get_terms_of_groups_new ($group_ids, $taxonomy, $taxonomy_child, $order = '', $not=false) {
+ global $wpdb;
+ if ( !is_array($group_ids) )
+ $group_ids = array($group_ids);
+ $group_ids = array_map('intval', $group_ids);
+ $group_ids = implode(', ', $group_ids);
+ $theorderby = '';
+ $where = '';
+ $defaults = array('orderby' => 'term_order', 'order' => 'ASC',
+ 'hide_empty' => true, 'exclude' => '', 'exclude_tree' => '', 'include' => '',
+ 'number' => '', 'slug' => '', 'parent' => '',
+ 'name__like' => '',
+ 'pad_counts' => false, 'offset' => '', 'search' => '');
+
+ if (is_array($order)) { // for back compatibility
+ $r = &$order;
+ $r = array_merge($defaults, $r);
+ extract($r);
+
+ if ($order == 'ASC' || $order == 'DESC') {
+ if ('term_order'== $orderby) {
+ $theorderby = ' ORDER BY tr.'.$orderby.' '.$order ;
+ } elseif ('count'== $orderby || 'parent'== $orderby) {
+ $theorderby = ' ORDER BY tt2.'.$orderby.' '.$order ;
+ } elseif ('term_id'== $orderby || 'name'== $orderby) {
+ $theorderby = ' ORDER BY t.'.$orderby.' '.$order ;
+ }
+ }
+
+ if ( !empty($name__like) )
+ $where .= " AND t.name LIKE '{$name__like}%'";
+
+ if ( '' != $parent ) {
+ $parent = (int) $parent;
+ $where .= " AND tt2.parent = '$parent'";
+ }
+
+ if ( $hide_empty && !$hierarchical )
+ $where .= ' AND tt2.count > 0';
+ // don't limit the query results when we have to descend the family tree
+ if ( ! empty($number) && '' == $parent ) {
+ if( $offset )
+ $limit = ' LIMIT ' . $offset . ',' . $number;
+ else
+ $limit = ' LIMIT ' . $number;
+
+ } else {
+ $limit = '';
+ }
+
+ if ( !empty($search) ) {
+ $search = like_escape($search);
+ $where .= " AND (t.name LIKE '%$search%')";
+ }
+
+ } else { // for back compatibility
+ if ($order == 'ASC' || $order == 'DESC') $theorderby = ' ORDER BY tr.term_order '.$order ;
+ }
+ //$not = true;
+ if ($not === false ) {
+ $query = "SELECT t.*, tt2.term_taxonomy_id, tt2.description,tt2.parent, tt2.count, tt2.taxonomy, tr.term_order FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN $wpdb->terms AS t ON t.term_id = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt2 ON tt2.term_id = tr.object_id WHERE tt.taxonomy IN ('".$taxonomy."') AND tt2.taxonomy = '".$taxonomy_child."' AND tt.term_id IN (".$group_ids.") ".$where.$theorderby.$limit;
+ } else {
+ $query = "SELECT DISTINCT t.*, tt2.term_taxonomy_id, tt2.description,tt2.parent, tt2.count, tt2.taxonomy, tr.term_order FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN $wpdb->terms AS t ON t.term_id = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt2 ON tt2.term_id = tr.object_id WHERE tt.taxonomy IN ('".$taxonomy."') AND tt2.taxonomy = '".$taxonomy_child."' AND (t.term_ID) NOT IN ("."SELECT t.term_id FROM $wpdb->term_relationships AS tr INNER JOIN $wpdb->term_taxonomy AS tt ON tr.term_taxonomy_id = tt.term_taxonomy_id INNER JOIN $wpdb->terms AS t ON t.term_id = tr.object_id INNER JOIN $wpdb->term_taxonomy AS tt2 ON tt2.term_id = tr.object_id WHERE tt.taxonomy IN ('".$taxonomy."') AND tt2.taxonomy = '".$taxonomy_child."' AND tt.term_id IN (".$group_ids.") ".") ".$where.$theorderby.$limit;
+ }
+ //echo $query;
+ $listterms = $wpdb->get_results($query);
+ if ( ! $listterms )
+ return array();
+
+ return $listterms;
+ }
+
+
+/**
+ * Create HTML check row (select) content for Tidy Tag Group List.
+ *
+ * @package xili-tidy-tags
+ * @since 1.3.0
+ * @uses Walker
+ */
+class Walker_TagGroupList_row extends Walker {
+ /**
+ * @see Walker::$tree_type
+ * @since 1.3.0
+ * @var string
+ */
+ var $tree_type = 'tidytaggroup';
+
+ /**
+ * @see Walker::$db_fields
+ * @since 1.3.0
+ * @todo Decouple this
+ * @var array
+ */
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
+
+ /**
+ * @see Walker::start_el()
+ * @since 1.3.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param object $term term data object.
+ * @param int $depth Depth of category. Used for padding.
+ */
+ function start_el(&$output, $term, $depth) {
+ /*$pad = str_repeat(' ', $depth * 3);*/
+ if ($depth > 0) {
+ $pad = str_repeat('– ', $depth);
+ $term_name = $term->name;
+ } else {
+ $term_name = '<strong>'.$term->name.'</strong>';
+ }
+
+ $output .= '<input type="checkbox" id="line-%1$s-'.$term->term_id.'" name="line-%1$s-'.$term->term_id.'" value="'.$term->term_id.'" checked'.$term->term_id.' />'.$pad.$term_name.' ';
+ }
+ /**
+ * @see Walker::end_lvl()
+ * @since 1.3.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param int $depth Depth of category. Used for tab indentation.
+ */
+ function end_lvl(&$output, $depth) {
+ $output .= "<br />";
+ }
+}
+
+/**
+ * Retrieve HTML check row (select) content for Tag Group List.
+ *
+ * @uses Walker_TagGroupList_row to create HTML content line.
+ * @since 1.3.0
+ * @see Walker_TagGroupList_row::walk() for parameters and return description.
+ */
+function walk_TagGroupList_tree_row() {
+ $args = func_get_args();
+ // the user's options are the third parameter
+ if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') ) {
+ $walker = new Walker_TagGroupList_row;
+ } else {
+ $walker = $args[2]['walker'];
+ }
+ return call_user_func_array(array( &$walker, 'walk' ), $args );
+}
+
+/**
+ * Create Sorted array of Tags from Group List.
+ *
+ * @since 1.3.0
+ *
+ */
+class Walker_TagGroupList_sorted extends Walker {
+ /**
+ * @see Walker::$tree_type
+ * @since 1.3.0
+ * @var string
+ */
+ var $tree_type = 'tidytaggroup';
+
+ /**
+ * @see Walker::$db_fields
+ * @since 1.3.0
+ * @todo Decouple this
+ * @var array
+ */
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
+
+ /**
+ * @see Walker::start_el()
+ * @since 1.3.0
+ *
+ * @param string $output Passed by reference. Used to append additional content.
+ * @param object $term term data object.
+ * @param int $depth Depth of category. Used for padding.
+ */
+ function start_el(&$output, $term, $depth) {
+ /*$pad = str_repeat(' ', $depth * 3);*/
+ $output[] = $term;
+ }
+}
+/**
+ * Retrieve Sorted array of Tags from Group List.
+ *
+ * @uses Walker_TagGroupList_sorted to sort.
+ * @since 1.3.0
+ * @see Walker_TagGroupList_sorted::walk() for parameters and return description.
+ */
+function walk_TagGroupList_sorted() {
+ $args = func_get_args();
+ // the user's options are the third parameter
+ if ( empty($args[2]['walker']) || !is_a($args[2]['walker'], 'Walker') ) {
+ $walker = new Walker_TagGroupList_sorted;
+ } else {
+ $walker = $args[2]['walker'];
+ }
+ return call_user_func_array(array( &$walker, 'walk' ), $args );
+}
+
+/**
+ * class for multiple tidy tags cloud widgets
+ * @since 0.9.2
+ *
+ */
+class xili_tidy_tags_cloud_multiple_widgets {
+
+ function xili_tidy_tags_cloud_multiple_widgets () {
+ load_plugin_textdomain('xili_tidy_tags', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)),dirname(plugin_basename(__FILE__))); /* to share the .mo file*/
+ add_action('widgets_init', array(&$this, 'init_widget'));
+ }
+
+ function init_widget() {
+ if ( !function_exists('wp_register_sidebar_widget') || !function_exists('wp_register_widget_control') )
+ return;
+ if ( !$options = get_option('xili_tidy_tags_cloud_widgets_options') )
+ $options = array();
+ $widget_ops = array('classname' => 'xili_tdtc_widget', 'description' => __( "Cloud of grouped tags by xili-tidy-tags plugin",'xili_tidy_tags') );
+ $control_ops = array('id_base' => 'xili_tidy_tags_cloud_widget');
+ $name = __('Tidy tags cloud','xili_tidy_tags');
+
+ $id = false;
+ foreach ( (array) array_keys($options) as $o ) {
+ $id = "xili_tidy_tags_cloud_widget-$o"; // Never never never translate an id
+ wp_register_sidebar_widget($id, $name, array(&$this, 'widget'), $widget_ops, array( 'number' => $o ));
+ wp_register_widget_control($id, $name, array(&$this, 'widget_options'), $control_ops, array( 'number' => $o ));
+ }
+
+ // If there are none, we register the widget's existance with a generic template
+ if ( !$id ) {
+ wp_register_sidebar_widget( 'xili_tidy_tags_cloud_widget-1', $name, array(&$this, 'widget'), $widget_ops, array( 'number' => -1 ) );
+ wp_register_widget_control( 'xili_tidy_tags_cloud_widget-1', $name, array(&$this, 'widget_options'), $control_ops, array( 'number' => -1 ) );
+
+ }
+ }
+
+ function widget($args, $widget_args = 1) {
+ global $wpdb;
+
+ $options = get_option('xili_tidy_tags_cloud_widgets_options');
+ extract($args);
+
+ if ( is_numeric($widget_args) )
+ $widget_args = array( 'number' => $widget_args );
+ $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
+ extract( $widget_args, EXTR_SKIP );
+
+ if ( !isset($options[$number]) )
+ return;
+
+ $cloudsargs = array();
+ echo $before_widget.$before_title.__($options[$number]['title'],THEME_TEXTDOMAIN).$after_title;
+ if ('the_curlang' == $options[$number]['tagsgroup']) {
+ $cloudsargs[] = 'tagsgroup='.the_curlang();
+ } elseif ('the_category' == $options[$number]['tagsgroup']) {
+ $cloudsargs[] = 'tagsgroup='.single_cat_title('',false);
+ } else {
+ $cloudsargs[] = 'tagsgroup='.$options[$number]['tagsgroup'];
+ }
+ $cloudsargs[] = 'tagsallgroup='.$options[$number]['tagsallgroup'];
+
+ if (abs((int) $options[$number]['smallest']>0)) $cloudsargs[] = 'smallest='.abs((int) $options[$number]['smallest']);
+ if (abs((int) $options[$number]['largest']>0)) $cloudsargs[] = 'largest='.abs((int) $options[$number]['largest']);
+ if (abs((int) $options[$number]['quantity']>0)) $cloudsargs[] = 'quantity='.abs((int) $options[$number]['quantity']);
+
+ if ('no' != $options[$number]['orderby'] ) $cloudsargs[] = 'orderby='.$options[$number]['orderby'];
+ if ('no' != $options[$number]['order'] ) $cloudsargs[] = 'order='.$options[$number]['order'];
+
+ if (function_exists('xili_tidy_tag_cloud')) {
+ echo '<div class="xilitidytagscloud">';
+ xili_tidy_tag_cloud(implode("&",$cloudsargs));
+ echo '</div>';
+ }
+ echo $after_widget;
+ }
+
+ function widget_options($widget_args) {
+ if ( is_numeric($widget_args) )
+ $widget_args = array( 'number' => $widget_args );
+ $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) );
+ extract( $widget_args, EXTR_SKIP );
+
+ $options = get_option('xili_tidy_tags_cloud_widgets_options');
+ if ( !is_array($options) )
+ $options = array();
+
+ if ( !$updated && !empty($_POST['sidebar']) ) {
+ $sidebar = (string) $_POST['sidebar'];
+
+ $sidebars_widgets = wp_get_sidebars_widgets();
+ if ( isset($sidebars_widgets[$sidebar]) )
+ $this_sidebar =& $sidebars_widgets[$sidebar];
+ else
+ $this_sidebar = array();
+
+ foreach ( (array) $this_sidebar as $_widget_id ) {
+ if ( 'xili_tdtc_widget' == $wp_registered_widgets[$_widget_id]['callback'] && isset($wp_registered_widgets[$_widget_id]['params'][0]['number']) ) {
+ $widget_number = $wp_registered_widgets[$_widget_id]['params'][0]['number'];
+ if ( !in_array( "xili_tdtc_widget-$widget_number", $_POST['widget-id'] ) ) // the widget has been removed.
+ unset($options[$widget_number]);
+ }
+ }
+
+ foreach ( (array) $_POST['xili_tdtc_widget'] as $widget_number => $widget_text ) {
+ if (isset($widget_text['submit'])) {
+ $options[$widget_number]['title'] = strip_tags(stripslashes($widget_text['title']));
+ $options[$widget_number]['tagsgroup'] = strip_tags(stripslashes($widget_text['tagsgroup']));
+ $options[$widget_number]['tagsallgroup'] = strip_tags(stripslashes($widget_text['tagsallgroup']));
+ $options[$widget_number]['smallest'] = strip_tags(stripslashes($widget_text['smallest']));
+ $options[$widget_number]['largest'] = strip_tags(stripslashes($widget_text['largest']));
+ $options[$widget_number]['quantity'] = strip_tags(stripslashes($widget_text['quantity']));
+ $options[$widget_number]['orderby'] = strip_tags(stripslashes($widget_text['orderby']));
+ $options[$widget_number]['order'] = strip_tags(stripslashes($widget_text['order']));
+ }
+ }
+ update_option('xili_tidy_tags_cloud_widgets_options',$options);
+ $updated = true;
+ }
+
+
+ $options = get_option('xili_tidy_tags_cloud_widgets_options');
+
+ if ( -1 == $number ) {
+ $title = '';
+ $number = '%i%';
+ $orderby = "name";
+ $order = "ASC";
+ } else {
+ $title = attribute_escape($options[$number]['title']);
+ $tagsgroup = attribute_escape($options[$number]['tagsgroup']);
+ $tagsallgroup = attribute_escape($options[$number]['tagsallgroup']);
+ $smallest = attribute_escape($options[$number]['smallest']);
+ $largest = attribute_escape($options[$number]['largest']);
+ $quantity = attribute_escape($options[$number]['quantity']);
+ $orderby = $options[$number]['orderby'];
+ $order = $options[$number]['order'];
+ }
+
+ echo '<label for="xili_tdtc_widget_title-'.$number.'">'.__('Title').': <input id="xili_tdtc_widget_title-'.$number.'" name="xili_tdtc_widget['.$number.'][title]" type="text" value="'.$title.'" /></label>';
+ // other options min max number group 1 and 2 tagsallgroup
+ echo '<label for="xili_tdtc_widget_tagsgroup-'.$number.'">'.__('Groups','xili_tidy_tags').': <input id="xili_tdtc_widget_tagsgroup-'.$number.'" name="xili_tdtc_widget['.$number.'][tagsgroup]" type="text" value="'.$tagsgroup.'" /></label>';
+ echo '<label for="xili_tdtc_widget_tagsallgroup-'.$number.'">'.__('Group #2','xili_tidy_tags').': <input id="xili_tdtc_widget_tagsallgroup-'.$number.'" name="xili_tdtc_widget['.$number.'][tagsallgroup]" type="text" value="'.$tagsallgroup.'" /></label>';
+
+ echo '<br /><label for="xili_tdtc_widget_smallest-'.$number.'">'.__('Smallest size','xili_tidy_tags').': <input id="xili_tdtc_widget_smallest-'.$number.'" name="xili_tdtc_widget['.$number.'][smallest]" type="text" size="3" value="'.$smallest.'" /></label>';
+ echo '<label for="xili_tdtc_widget_largest-'.$number.'">'.__('Largest size','xili_tidy_tags').': <input id="xili_tdtc_widget_largest-'.$number.'" name="xili_tdtc_widget['.$number.'][largest]" type="text" size="3" value="'.$largest.'" /></label>';
+ echo '<br /><label for="xili_tdtc_widget_quantity-'.$number.'">'.__('Number','xili_tidy_tags').': <input id="xili_tdtc_widget_quantity-'.$number.'" name="xili_tdtc_widget['.$number.'][quantity]" type="text" size="3" value="'.$quantity.'" /></label>';
+
+
+ echo '<fieldset style="margin:2px; padding:3px; border:1px solid #ccc;"><legend>'.__('Order and sorting infos','xili_tidy_tags').'</legend>';
+ echo '<br /><select name="xili_tdtc_widget['.$number.'][orderby]" id="xili_tdtc_widget_orderby-'.$number.'" style="width:100%;"><option value="no" >'.__('no orderby','xili_tidy_tags').'</option>';
+ echo '<option value="count" '.(($orderby == "count") ? 'selected="selected"' :'').' >'.__('count','xili_tidy_tags').'</option>';
+ echo '<option value="name" '.(($orderby == "name") ? 'selected="selected"' :'').' >'.__('name','xili_tidy_tags').'</option></select>';
+
+ echo '<select name="xili_tdtc_widget['.$number.'][order]" id="xili_tdtc_widget_order-'.$number.'" style="width:100%;"><option value="no" >'.__('no order','xili_tidy_tags').'</option>';
+ echo '<option value="ASC" '.(($order == "ASC") ? 'selected="selected"' :'').' >'.__('ASC','xili_tidy_tags').'</option>';
+ echo '<option value="DESC" '.(($order == "DESC") ? 'selected="selected"' :'').' >'.__('DESC','xili_tidy_tags').'</option></select>';
+ echo '</fieldset>';
+ //
+ echo '<input type="hidden" id="xili_tdtc_widget_submit-'.$number.'" name="xili_tdtc_widget['.$number.'][submit]" value="1" />';
+
+ } // end options (control)
+
+} // end widgets class
+
+/**
+ * Shortcode to insert a cloud of a group of tags inside a post.
+ *
+ * Example of shortcode : [xili-tidy-tags params="tagsgroup=trademark&largest=10&smallest=10" glue=" | "]
+ *
+ *@since 1.0
+ */
+function xili_tidy_tags_shortcode ($atts) {
+ $arr_result = shortcode_atts(array('params'=>'', 'glue'=> ' ' ), $atts);
+ extract($arr_result);
+ return implode($glue, xili_tidy_tag_cloud(html_entity_decode($params)."&format=array")); /* don't use param echo only in 2.8 */
+}
+add_shortcode('xili-tidy-tags', 'xili_tidy_tags_shortcode');
+
+/**
+ * instantiation of xili_tidy_tags class
+ *
+ * @since 0.8.0 - 0.9.5 =& for instantiation
+ *
+ * @param metabox (for other posts in post edit UI - beta tests)
+ * @param ajax ( true if ajax is activated for post edit admin UI - alpha tests )
+ */
+
+$xili_tidy_tags =& new xili_tidy_tags (false, false);
+
+// comment below line if you don't use widget(s)
+
+$xili_tidy_tags_cloud_widgets =& new xili_tidy_tags_cloud_multiple_widgets ();
+
+?>
\ No newline at end of file
Binary file web/wp-content/plugins/xili-tidy-tags/xili_tidy_tags-fr_FR.mo has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xili-tidy-tags/xili_tidy_tags-fr_FR.po Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,385 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: xili_tidy_tags\n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: 2010-02-18 19:26+0100\n"
+"Last-Translator: dev.xiligroup.com <contact@xiligroup.com>\n"
+"Language-Team: dev.xiligroup.com <contact@xiligroup.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-KeywordsList: __;_e\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-Language: French\n"
+"X-Poedit-Country: FRANCE\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Poedit-SearchPath-0: trunk\n"
+
+#: xili-tidy-tags.php:98
+msgid "Settings"
+msgstr "Réglages"
+
+#: xili-tidy-tags.php:117
+#: xili-tidy-tags.php:140
+msgid "© by xili-tidy-tags."
+msgstr "© par xili-tidy-tags."
+
+#: xili-tidy-tags.php:118
+#: xili-tidy-tags.php:141
+#: xili-tidy-tags.php:177
+msgid "Tags groups"
+msgstr "Groupes de mots clés"
+
+#: xili-tidy-tags.php:177
+#: xili-tidy-tags.php:180
+msgid "Tidy tags"
+msgstr "Tidy tags"
+
+msgid "Tidy tags settings"
+msgstr "Réglages Tidy Tags"
+
+#: xili-tidy-tags.php:180
+msgid "Tidy tags assign"
+msgstr "Groupage mots clés"
+
+#: xili-tidy-tags.php:188
+#: xili-tidy-tags.php:196
+msgid "Message"
+msgstr "Message"
+
+#: xili-tidy-tags.php:189
+#: xili-tidy-tags.php:197
+msgid "Info"
+msgstr "Info"
+
+#: xili-tidy-tags.php:213
+msgid "Note:"
+msgstr "Note :"
+
+#: xili-tidy-tags.php:221
+msgid "On this page, the tags groups are defined. The special groups for xili-language plugin are importable.<br /> For debug, some technical infos are displayed in the tables or boxes.<br />"
+msgstr "Sur cette page, on définit les groupes de mots clés. Les groupes de langues créés par l'extension xili-language sont importables.<br /> Il y a des infos techniques dans les tables et boites pour le debogguage.<br />"
+
+#: xili-tidy-tags.php:223
+msgid "On this page, in a oneshot way, it is possible to assign the tags to one or more groups defined on the other page of <i>xili-tidy-tags</i> plugin."
+msgstr "Sur cette page, d'un seul coup, il est possible d'affecter un mot clé à un ou plusieurs groupes définis sur l'autre page de l'extension <i>xili-tidy-tags</i>."
+
+#: xili-tidy-tags.php:225
+msgid "<b>xili-tidy-tags</b> is a tool for grouping tags by language or semantic group. Initially developed to enrich multilingual website powered by xili-language plugin."
+msgstr "<b>xili-tidy-tags</b> est un outil pour regrouper les mots clés par langue ou par groupe sémantique. Cette extension a été developpée initialement pour enrichir des sites multilingues motorisés avec l'extension xili-language."
+
+#: xili-tidy-tags.php:232
+msgid "xili-language plugin is not activated."
+msgstr "L'extension xili-language n'est pas active."
+
+#: xili-tidy-tags.php:238
+msgid "The group of languages is set for use with xili-language plugin."
+msgstr "Les groupes de langues sont en place."
+
+#: xili-tidy-tags.php:241
+msgid "It is possible to import the group of languages."
+msgstr "Il est possible d'importer les groupes de langues."
+
+#: xili-tidy-tags.php:242
+msgid "Import…"
+msgstr "Importer…"
+
+#: xili-tidy-tags.php:253
+#: xili-tidy-tags.php:537
+msgid "ID"
+msgstr "N°"
+
+#: xili-tidy-tags.php:254
+#: xili-tidy-tags.php:282
+#: xili-tidy-tags.php:538
+msgid "Name"
+msgstr "Nom"
+
+msgid "Group(s) to choose"
+msgstr "Choisir le(s) groupe(s)"
+
+#: xili-tidy-tags.php:255
+#: xili-tidy-tags.php:290
+msgid "Description"
+msgstr "Description"
+
+#: xili-tidy-tags.php:256
+msgid "Group slug"
+msgstr "Slug"
+
+#: xili-tidy-tags.php:257
+msgid "Group taxo ID"
+msgstr "N° taxinomie"
+
+#: xili-tidy-tags.php:258
+msgid "Parent"
+msgstr "Parent"
+
+#: xili-tidy-tags.php:259
+msgid "Tags"
+msgstr "Mots clés"
+
+#: xili-tidy-tags.php:260
+#: xili-tidy-tags.php:540
+msgid "Action"
+msgstr "Action"
+
+#: xili-tidy-tags.php:286
+msgid "tags group slug"
+msgstr "Slug du groupe"
+
+#: xili-tidy-tags.php:295
+msgid "kinship"
+msgstr "Parenté"
+
+#: xili-tidy-tags.php:315
+msgid "no parent"
+msgstr "pas de parent"
+
+#: xili-tidy-tags.php:323
+msgid "Select the parent if necessary"
+msgstr "Si nécessaire, sélectionner le groupe parent"
+
+#: xili-tidy-tags.php:330
+msgid "parent of: "
+msgstr "groupe contenant : "
+
+#: xili-tidy-tags.php:337
+msgid "no child now"
+msgstr "pas de mot clé dans ce groupe"
+
+#: xili-tidy-tags.php:340
+msgid "child of: "
+msgstr "appartient au groupe : "
+
+#: xili-tidy-tags.php:352
+msgid "Add »"
+msgstr "Ajouter »"
+
+msgid "Add a group"
+msgstr "Ajouter un groupe"
+
+msgid "Edit Group"
+msgstr "Modifier le groupe"
+
+msgid "Delete group"
+msgstr "Supprimer le groupe"
+
+#: xili-tidy-tags.php:353
+#: xili-tidy-tags.php:648
+msgid "Cancel"
+msgstr "Annuler"
+
+#: xili-tidy-tags.php:373
+msgid "The languages groups was added."
+msgstr "Les groupes de langues ont été ajoutés."
+
+#: xili-tidy-tags.php:382
+msgid "A new group was added."
+msgstr "Un nouveau groupe a été ajouté."
+
+#: xili-tidy-tags.php:388
+msgid "Update »"
+msgstr "Mise à jour »"
+
+#: xili-tidy-tags.php:390
+msgid "Group to update."
+msgstr "Groupe à mettre à jour."
+
+#: xili-tidy-tags.php:398
+msgid "A group was updated."
+msgstr "Un groupe a été mis à jour."
+
+#: xili-tidy-tags.php:403
+msgid "Delete »"
+msgstr "Effacer »"
+
+#: xili-tidy-tags.php:406
+msgid "A group to delete."
+msgstr "Groupe à effacer."
+
+#: xili-tidy-tags.php:413
+msgid "A group was deleted."
+msgstr "Le groupe a été effacé."
+
+#: xili-tidy-tags.php:422
+msgid "Find the list of groups."
+msgstr "Voici la liste des groupes."
+
+#: xili-tidy-tags.php:426
+#: xili-tidy-tags.php:692
+msgid "Actions"
+msgstr "Actions"
+
+#: xili-tidy-tags.php:427
+msgid "Groups of Tags"
+msgstr "Groupes des mots clés"
+
+#: xili-tidy-tags.php:428
+msgid "The group"
+msgstr "Le groupe"
+
+#: xili-tidy-tags.php:435
+msgid "Tidy tags groups"
+msgstr "Les groupes de mots clés"
+
+#: xili-tidy-tags.php:452
+#: xili-tidy-tags.php:715
+msgid "Author"
+msgstr "Auteur"
+
+#: xili-tidy-tags.php:511
+msgid "Edit"
+msgstr "Modifier"
+
+#: xili-tidy-tags.php:513
+msgid "Delete"
+msgstr "Effacer"
+
+#: xili-tidy-tags.php:539
+msgid "Posts"
+msgstr "Articles"
+
+#: xili-tidy-tags.php:554
+msgid "After checking or unchecking do not forget to click update button !"
+msgstr "Après avoir coché ou décoché, n'oubliez pas de cliquer sur le bouton \"mettre à jour…\""
+
+#: xili-tidy-tags.php:563
+msgid "No sub-selection"
+msgstr "Pas de sous-sélection"
+
+#: xili-tidy-tags.php:572
+msgid "Sub select…"
+msgstr "Sélectionner…"
+
+#: xili-tidy-tags.php:647
+msgid "Update"
+msgstr "Mettre à jour"
+
+#: xili-tidy-tags.php:686
+msgid "Find the list of tags."
+msgstr "Voici la liste des mots clés."
+
+#: xili-tidy-tags.php:693
+msgid "Tidy Tags"
+msgstr "Tidy Tags"
+
+#: xili-tidy-tags.php:698
+msgid "Tags in group"
+msgstr "Mots clés : affectation aux groupes"
+
+msgid "Cloud of grouped tags by xili-tidy-tags plugin"
+msgstr "Nuage de groupe(s) de mots clés par l'extension xili-tidy-tags "
+
+msgid "Tidy tags cloud"
+msgstr "Nuage de groupe de mots"
+
+msgid "Add a tag's group for a chosen category"
+msgstr "Ajouter un groupe correspondant à une catégorie"
+
+msgid "choose a category"
+msgstr "choisir une catégorie"
+
+msgid "See docs to set xili_tidy_tag_cloud function or widget to implement in theme…"
+msgstr "Voir la documentation pour les réglages du nuage de mots en mode fonction (xili_tidy_tag_cloud) ou en widget"
+
+msgid "Choose a parent tag's group"
+msgstr "Choisir le groupe parent"
+
+msgid "Go to settings of xili-language plugin and add languages"
+msgstr "Allez sur la page de réglages de l'extension xili-language et ajouter des langues"
+
+#: widget
+msgid "Group for: "
+msgstr "Groupe pour : "
+
+msgid "Group #2"
+msgstr "Group n°2"
+
+msgid "Groups"
+msgstr "Groupes"
+
+msgid "category"
+msgstr "catégorie"
+
+msgid "Smallest size"
+msgstr "taille mini"
+
+msgid "Largest size"
+msgstr "taille maxi"
+
+msgid "Number"
+msgstr "Nombre"
+
+msgid "Order and sorting infos"
+msgstr "Info de tri et d'ordre"
+
+msgid "ASC"
+msgstr "croissant"
+
+msgid "DESC"
+msgstr "décroissant"
+
+msgid "count"
+msgstr "par quantité"
+
+msgid "name"
+msgstr "par nom"
+
+msgid "no order"
+msgstr "indifférent"
+
+msgid "no orderby"
+msgstr "pas de critère"
+
+msgid "Sub list of tags"
+msgstr "Sélection des mots clés par"
+
+msgid "Starting with:"
+msgstr "Commençant par :"
+
+msgid "Containing:"
+msgstr "Incluant :"
+
+msgid "Belonging to group:"
+msgstr "Coché dans le groupe :"
+
+msgid "Exclude this group"
+msgstr "Ce groupe exclu"
+
+msgid "No childs"
+msgstr "Ce groupe seul"
+
+msgid "No select…"
+msgstr "Désélection"
+
+msgid "Groups selection"
+msgstr "Sous-sélection des groupes"
+
+msgid "Columns: Group selection"
+msgstr "Colonnes : Sous-sélection d'un groupe"
+
+msgid "Capabilities"
+msgstr "Profil et droits"
+
+msgid "Here, as admin, set capabilities of the editor:"
+msgstr "Ici, en administrateur, réglez les accès des éditeurs :"
+
+msgid "no capability"
+msgstr "aucun accès"
+
+msgid "Grouping"
+msgstr "Accès au groupage"
+
+msgid "Setting and grouping"
+msgstr "Accès aux réglages et groupages"
+
+msgid "Set »"
+msgstr "Régler »"
+
+msgid "Editor Capabilities changed to: "
+msgstr "Accès des éditeurs changés en : "
+
+msgid "See administrator for language settings."
+msgstr "Voir l'administrateur pour le réglage multilingue."
+
Binary file web/wp-content/plugins/xili-tidy-tags/xilitidy-logo-32.gif has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xilitheme-select/readme.txt Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,120 @@
+=== Xilitheme select ===
+Contributors: MS xiligroup
+Donate link: http://dev.xiligroup.com/
+Tags: theme,ipod touch,iphone,Post,plugin,posts,admin,opera mini,windows mobile, multilingual,bilingual
+Requires at least: 2.6.0
+Tested up to: 2.9.2
+Stable tag: 1.0.1
+
+Xilitheme select provides an automatic selection of themes : one for current browsers and another for iphone/ipod touch browser (and more).
+
+== Description ==
+
+*Xilitheme select provides an automatic selection of themes : one for current browsers and another for iphone/ipod touch browser (and more non "Apple touch" mobiles).*
+
+The plugin xilitheme-select don't content itself themes. The themes remain in Themes folder and are selected by the current browser and the rulers defined by webmaster. Webmaster is totally free to define (the look of) the theme on each side (deskop or iPhone). There is no automatic look transformation.
+
+If the themes are "international", xilitheme select don't interfere and so is compatible with [xili-language](http://wordpress.org/extend/plugins/xili-language/ "xili-language").
+
+The xilitheme select plugin is the companion of the iTouchShop Module (in GoldCart extension of WP ecommerce from instinct.nz) : [iTouchShop](http://www.instinct.co.nz/wordpress-touchshop/ "iTouchShop module")
+
+= New 1.0.1 =
+* More descriptions for non "Apple touch" mobiles/
+* A demo theme with more features - see [here](http://wordpress.org/extend/plugins/xilitheme-select/faq/) -
+
+*this first release can be used by users/webmasters with knowledges about WP themes - see php code.*
+
+**prerequisite:**
+By default:
+In addition of your current selected theme add in the themes folder a theme folder named as the current with extension *'_4touch'* dedicaced for iphone browser.
+
+**Caution:** - Before use *xilitheme select*: uninstall plugins like *'iwphone'* or *'Wordpress PDA & iPhone'* which do theme's redirections as this.
+
+**Note about theme with template_page:**
+Both themes (the current and the one for iphone / ipodtouch) must contain the same template (name) - the contents can differ obviously -
+
+**admin dashboard UI:**
+The interface provide ways to change default extension or choose a specific fullname (for the "iphone" theme)
+
+
+**Options:**
+See the source of the plugin to discover other type of instantiation of the class *xilithemeselector*. One provide a way to have or not a admin dashboard interface to set the specs with only php coding.
+see `$wp_ismobile = new xilithemeselector(true);` at end of code
+
+More informations on the site [dev.xiligroup.com](http://dev.xiligroup.com/ "Xilitheme select")
+
+Check out the [screenshots](http://wordpress.org/extend/plugins/xilitheme-select/screenshots/) to see it in action.
+
+== Installation ==
+
+1. Upload the folder containing `xilithemeselect.php` and language files to the `/wp-content/plugins/` directory,
+2. Upload a **specific theme** for iPhone with a folder named as current theme *+ extension* "_4touch" but don't activate it as usual. A newer demo theme default_4touch is available [here](http://dev.xiligroup.com/?p=123#loadlinks "Xilitheme select links")
+
+3. Activate the plugin through the *'Plugins'* menu in WordPress,
+4. Go to the dashboard settings tab - Xilitheme select - and adapt default values if necessary.
+
+== Frequently Asked Questions ==
+
+= When I visit the site with iPhone or iPhone simulator, I don't see the specific theme =
+
+Verify that the folder of this theme has a right name with right extension.
+
+= Why the option full name or extension ? =
+
+It is an easiness to choose a theme with a folder without the proposed file extension.
+
+= Do you provide a theme for these mobile device as iPhone or iTouch ? =
+
+A lite release of a theme is [here](http://dev.xiligroup.com/?p=123#loadlinks "Xilitheme select links").
+*(this theme now contains accordion features for categories list and is ready for multilingual website with plugin xili-language)*
+
+= Where can I see a running example =
+
+dev.xiligroup.com [here](http://dev.xiligroup.com/ "dev.xiligroup site")
+and
+www.xiliphone.mobi [here](http://www.xiliphone.mobi "a theme for mobile") usable with mobile as iPhone or Safari with options developer activated and agent set to iPhone.
+
+
+== Screenshots ==
+
+1. an example of wp-content/themes folder
+2. the admin settings UI
+
+== Upgrade Notice ==
+
+* Easy to upgrade through Plugins admin UI or via FTP.
+* If you changed some values inside source - backup it before upgrade -
+* Don't forget to proceed DB backup before.
+
+== More infos ==
+
+= coding info =
+* Add Android as selector - see line #50. - and select a theme named as current with _4touch as end (webkit).
+* a newer demo theme default_4touch is available [here](http://dev.xiligroup.com/?p=123#loadlinks "Xilitheme select links").
+* readme updated 090218 - see also php code
+* The plugin post is frequently updated [dev.xiligroup.com](http://dev.xiligroup.com/xilitheme-select/ "Xilitheme select")
+* See also the [Wordpress plugins forum](http://wordpress.org/tags/xilitheme-select/).
+* For wordpress theme's developers, now give specific info if mobile (not apple) use *opera mini* browser.
+[see Opera doc](http://dev.opera.com/articles/view/designing-with-opera-mini-in-mind/)
+= display current theme view =
+If `$wp_ismobile->cookienable` is set to 1, the theme can include a tag to refresh theme as viewing on a desktop browser. See tag example in php code.
+
+© 2010-02-27 MSC dev.xiligroup.com
+
+== Changelog ==
+
+= 1.0.1 =
+* Add Android as selector - see line #50. - a newer demo theme default_4touch is available in [here](http://dev.xiligroup.com/?p=123#loadlinks "Xilitheme select links").
+
+= 1.0 =
+* Admin settings improvments for latest 2.8 Wordpress.
+
+= 0.9.2 =
+* option: now able to detect opera mini browser.
+
+= 0.9.1 =
+* option: now able to display current theme view on iPhone / iPod.
+
+© 2010-02-27 dev.xiligroup.com
+
+
Binary file web/wp-content/plugins/xilitheme-select/screenshot-1.png has changed
Binary file web/wp-content/plugins/xilitheme-select/screenshot-2.png has changed
Binary file web/wp-content/plugins/xilitheme-select/xilitheme-logo-32.gif has changed
Binary file web/wp-content/plugins/xilitheme-select/xilithemeselect-fr_FR.mo has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xilitheme-select/xilithemeselect-fr_FR.po Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,56 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: xilitheme select\n"
+"POT-Creation-Date: \n"
+"PO-Revision-Date: 2009-06-16 20:05+0100\n"
+"Last-Translator: dev.xiligroup.com <contact@xiligroup.com>\n"
+"Language-Team: Michel, xiligroup <contact@xiligroup.com>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=utf-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Poedit-Language: French\n"
+"X-Poedit-Country: FRANCE\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Poedit-KeywordsList: __;_e\n"
+"X-Poedit-Basepath: .\n"
+"X-Poedit-SearchPath-0: \n"
+
+msgid "Plugin<strong> xilithemeselect</strong> settings saved."
+msgstr "Réglages xilitheme-select sauvegardés."
+
+msgid "Xilitheme select settings"
+msgstr "Réglages xilitheme select"
+
+msgid "provides an automatic selection of the theme for iphone's user when visiting your site.<br />Don't forget to upload a specific theme for ipod touch / iphone with a right folder's name in the wp-content/themes folder.<br /> If an error occur, the current theme is displayed in ipod touch / iphone browser."
+msgstr "est un plugin qui choisit automatiquement le thème qui sera affiché aux utilisateurs d'iPhone / iPod Touch. <br /> Tout d'abord, ne pas oublier de télécharger dans le dossier themes un dossier contenant un thème spécial ‘itouch’ avec un nom adéquat (incluant l'extension ‘_4touch’).<br /> Si une erreur survient, le thème pour tout navigateur sera diffusé à l'iPhone / iPod Touch."
+
+msgid "the current theme is"
+msgstr "Le thème courant est "
+
+msgid "itouch theme's folder"
+msgstr "Le dossier du thème itouch "
+
+msgid "is available"
+msgstr "est en place"
+
+msgid "is NOT available"
+msgstr "n'est PAS en place"
+
+msgid "in the current wp-content/themes folder."
+msgstr "dans le dossier habituel ‘wp-content/themes’."
+
+msgid "itouch theme's folder extension:"
+msgstr "Extension du dossier du thème itouch :"
+
+msgid "Option: extension or full name:"
+msgstr "Option: extension ou nom complet :"
+
+msgid "extension"
+msgstr "extension"
+
+msgid "full name"
+msgstr "nom complet"
+
+msgid "itouch theme's folder full name:"
+msgstr "Nom complet du dossier du thème itouch :"
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/plugins/xilitheme-select/xilithemeselect.php Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,419 @@
+<?php
+/*
+Plugin Name: xili-theme-select
+Plugin URI: http://dev.xiligroup.com/xilitheme-select/
+Description: A plugin for WordPress that automatically redirects your blog's theme for optimized viewing on Apple's <a href="http://www.apple.com/iphone/">iPhone</a> and <a href="http://www.apple.com/ipodtouch/">iPod touch</a>.
+Author: MS xiligroup dev
+Version: 1.0.1
+Author URI: http://dev.xiligroup.com
+
+# inspired initially from iwphone from Robot Content - 2007 - (http://www.contentrobot.com)
+# 2008-10 : optimized rewritting with class and optional dashboard settings
+# the "iphone / itouch" theme folder must have the same name with an extension ('_4touch') declared in instantiation
+# examples of instantiations :
+# $wp_ismobile = new xilithemeselector(true); //true if dashboard part
+# $wp_ismobile = new xilithemeselector(false); // false w/o dashboard (default extension = '_4touch')
+# $wp_ismobile = new xilithemeselector(false,'_yourext'); //- false w/o dashboard and your extension
+#
+# USE var $wp_ismobile->iphone if necessary in your functions... (see code below at line > 105)
+
+# This plugin is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This plugin is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this plugin; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+*/
+
+define('XILITHEME_VER','1.0.1');
+
+class xilithemeselector{
+
+ var $themextend = ""; /*no extension = no touch theme*/
+ var $iphone = false;
+ var $currentthemefolder; /*the normal theme used by default*/
+ var $newfolder;
+ var $listofdevices = array("iPhone","iPod"); /* if present selector is activated - can be upgraded !*/
+ var $xitype; /*type of the selected device*/
+ var $xiversion; /*release of the selected device*/
+ /**/
+ var $testnoappledevices = true; /* if true call a function to check no apple devices*/
+ var $othermobile = false;
+ var $listnonappledevices = array(array("Opera","_4opera"),array("opera mini","_4touch"),array("Windows CE","_4touch"),array("Blackberry",""),array("Android","_4touch"));
+ var $othermobiletype = ""; /* filled when $othermobile == true */
+ /**/
+ var $cookienable = 0; /*disable by default see after instantiation*/
+ var $mode = 'mobilebrowser'; /*as usual*/
+
+ function xilithemeselector($dashboard = true, $extend = "_4touch"){
+ if ($extend != "" && $dashboard == false) $this->themextend = $extend;
+
+ add_action('plugins_loaded',array(&$this,'detectiPhone'));
+ add_filter('stylesheet',array(&$this,'get_stylesheet'));
+ add_filter('template',array(&$this,'get_template'));
+ //add_filter('template_directory', array(&$this,'change_template_path')); // add for pages (template)
+
+
+ /*admin part - if not : use extension only */
+ if ($dashboard == true) :
+
+ add_action('admin_menu', array(&$this, 'add_admin_pages'));
+ add_action('init', array(&$this, 'init_textdomain'));
+ add_filter('plugin_action_links', array(&$this, 'xilisel_filter_plugin_actions'), 10, 2); /*0.9.3*/
+
+ $options = get_option('xilithemeselect_options');
+ if (!is_array($options))
+ {
+ $options['xilithemeextension'] = "_4touch";
+ $options['isxilithemefullname'] = 'extension';
+ $options['xilithemefullname'] = "default_4touch";
+ }
+ if (!isset($options['xilithemeextension']))
+ $options['xilithemeextension'] = "_4touch";
+ if ('' == $options['xilithemefullname'])
+ $options['xilithemefullname'] = "default_4touch";
+ foreach ($options as $option_name => $option_value)
+ $this-> {$option_name} = $option_value;
+ $this->themextend = $this->xilithemeextension;
+ $this->isfullname = false;
+ if ($this->isxilithemefullname == 'full')
+ $this->isfullname = true;
+
+ endif;
+
+ }
+
+ function init_textdomain () {
+ load_plugin_textdomain('xilithemeselect', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)));
+ }
+
+ /**
+ * Add action link(s) to plugins page
+ *
+ * @since 0.9.3
+ * @author MS
+ * @copyright Dion Hulse, http://dd32.id.au/wordpress-plugins/?configure-link and scripts@schloebe.de
+ */
+ function xilisel_filter_plugin_actions($links, $file){
+ static $this_plugin;
+
+ if( !$this_plugin ) $this_plugin = plugin_basename(__FILE__);
+
+ if( $file == $this_plugin ){
+ $settings_link = '<a href="options-general.php?page=xilithemeselect">' . __('Settings') . '</a>';
+ $links = array_merge( array($settings_link), $links); // before other links
+ }
+ return $links;
+}
+
+
+
+ function detectiPhone($query){
+ /* prepare target theme folders according options and test them */
+ $this->currentthemefolder = str_replace(get_theme_root()."/","",get_template_directory());
+ if($this->isfullname) :
+ /*test if theme with fullname exist*/
+ $curpath = get_theme_root()."/".$this->xilithemefullname;
+ if (file_exists($curpath)) :
+ $this->newfolder = $this->xilithemefullname;
+ else :
+ //echo "CAUTION: THE ".$this->xilithemefullname." THEME FOLDER IS NOT PRESENT";
+ $this->newfolder = $this->currentthemefolder; /*display the theme for current browsers*/
+ endif;
+ else :
+ /*test if theme with extension exist*/
+ $curpath = get_theme_root()."/".$this->currentthemefolder.$this->themextend;
+ if (file_exists($curpath)) :
+ $this->newfolder = $this->currentthemefolder.$this->themextend;
+ else :
+ //echo "CAUTION: THE ".$this->currentthemefolder." THEME FOLDER WITH EXTENSION ".$this->themextend." IS NOT PRESENT";
+ $this->newfolder = $this->currentthemefolder; /*display the theme for current browsers*/
+ endif;
+ endif;
+ /* analyse type of browsers */
+ $container = $_SERVER['HTTP_USER_AGENT'];
+ //print_r($container); //this prints out the user agent array. uncomment to see it shown on page.
+ $userdevices = $this->listofdevices;
+
+ foreach ( $userdevices as $userdevice ) {
+ if (eregi($userdevice,$container)){
+ $this->iphone = true;
+ $this->xitype = $userdevice;
+ /* version for future uses - like 3D css 2.1 in theme*/
+ $this->xiversion = preg_replace('#((.+)(Version/)(.+) M(.+))#i','$4' ,$container);
+ //print_r(preg_grep("#i#",array('a'=>'opo','b'=>'uiop')));
+ //echo " ---";
+ break;
+ }
+ }
+
+ if ($this->testnoappledevices == true && $this->iphone == false) {
+ $this->checknoappledevices();
+
+ }
+ }
+
+ function checknoappledevices() {
+
+ $container = $_SERVER['HTTP_USER_AGENT'];
+ $userdevices = $this->listnonappledevices;
+
+ foreach ( $userdevices as $userdevice ) {
+
+ if (ereg($userdevice[0],$container)){
+ $this->othermobile = true;
+ $this->othermobiletype = $userdevice[0];
+ $this->otherthemextend = $userdevice[1];
+ $curpath = get_theme_root()."/".$this->currentthemefolder.$this->otherthemextend;
+ if (file_exists($curpath)) {
+ $this->newfolder = $this->currentthemefolder.$this->otherthemextend;
+ } else {
+ echo "<br />CAUTION: THE ".$this->currentthemefolder." THEME FOLDER WITH EXTENSION ".$this->otherthemextend." IS NOT PRESENT";
+ $this->newfolder = $this->currentthemefolder; /*display the theme for current browsers*/
+ }
+ break;
+ }
+ }
+ }
+
+ /* theme's selection according mobile */
+ function get_stylesheet($stylesheet) {
+ if($this->iphone && $this->mode=='mobilebrowser'){
+ return $this->newfolder;
+ } elseif ($this->othermobile){
+ return $this->newfolder;
+ } else {
+ return $stylesheet;
+ }
+ }
+
+ function get_template($template) {
+ if($this->cookienable == 1) $this->set_xilitheme_cookie();
+
+ if($this->iphone && $this->mode=='mobilebrowser'){
+ return $this->newfolder;
+ } elseif ($this->othermobile){
+ return $this->newfolder;
+ } else {
+ return $template;
+ }
+ }
+
+ function change_template_path($template_dir) {
+ if($this->iphone && $this->mode=='mobilebrowser'){
+ //because use TEMPLATEPATH absolute so find page.php or the template page...
+ // major add on inspired iwphone
+ $template_dir = get_theme_root() . "/".$this->newfolder;
+ } elseif ($this->othermobile) {
+ $template_dir = get_theme_root() . "/".$this->newfolder;
+ }
+ //echo "----".$template_dir;
+ return $template_dir;
+ }
+
+ /* cookie part for theme selection if iphone of ipod */
+ function set_xilitheme_cookie() {
+ $expire = time() + 30000000;
+ if (!empty($_GET["xilitheme"])):
+ setcookie("xilitheme" . COOKIEHASH,
+ stripslashes($_GET["xilitheme"]),
+ $expire,
+ COOKIEPATH
+ );
+ $this->mode = $_GET["xilitheme"];
+
+ $refreshinglink = $this->build_thelink();
+
+ if (function_exists('wp_redirect'))
+ wp_redirect($refreshinglink);
+ else
+ header("Location: ". $refreshinglink);
+
+ exit;/**/
+ endif;
+ if ($this->get_xilitheme_cookie()==''):
+ $this->mode = "mobilebrowser";
+ else:
+ $this->mode = $this->get_xilitheme_cookie();
+ endif;
+ }
+
+ function get_xilitheme_cookie() {
+ if (!empty($_COOKIE["xilitheme" . COOKIEHASH])) :
+ return $_COOKIE["xilitheme" . COOKIEHASH];
+ else:
+ return '';
+ endif;
+ }
+
+ function build_thelink($type4refresh=true,$modelink="browser") {
+ $querystring = "";
+ /*restore the _GET*/
+ $permalink = get_option('permalink_structure');
+ if ( '' != $permalink) :
+ $q = "?";
+ $querystring = str_replace(preg_replace('|/[^/]+?$|', '/', $_SERVER['PHP_SELF']),'',$_SERVER['REQUEST_URI']);
+
+ if ($type4refresh):
+ //ignore this ?xilitheme $_GET value
+ $querystring = preg_replace('#\?xilitheme(.+)browser#isU', '',$querystring );
+ endif;
+ else:
+ $q = "&";
+ $i=0;
+ foreach ($_GET as $key => $value) {
+ if ($key != "xilitheme") { // ignore this particular $_GET value
+ if ($i == 0) $querystring = "?";
+ if ($i > 0) $querystring .= "&";
+ $querystring .= $key."=".$value;
+ $i++;
+ }
+ }
+ endif;
+ if ($type4refresh):
+ return get_option('siteurl').'/'.$querystring;
+ else:
+ if ($querystring == "")
+ return get_option('siteurl').'/?xilitheme='.$modelink;
+ else
+ return get_option('siteurl').'/'.$querystring.$q.'xilitheme='.$modelink;
+ endif;
+ }
+ function display_themetype($displayhtml = array('before'=>'<span class="xilithemelink">','after'=>'</span>','bro'=>'browser','mobbro'=>'iTouch')){
+ /* return the link display in current theme or in mobile theme */
+ if ($this->iphone == true && $this->cookienable == 1) :
+
+ if (($this->get_xilitheme_cookie() == 'browser')) {
+ $output = stripslashes($displayhtml['before']).'<a href="'
+ .$this->build_thelink(false,"mobilebrowser").'">'
+ .stripslashes($displayhtml['mobbro']).'</a>'.stripslashes($displayhtml['after']);
+ } else {
+ $output = stripslashes($displayhtml['before']).'<a href="'
+ .$this->build_thelink(false,"browser").'">'
+ .stripslashes($displayhtml['bro']).'</a>'.stripslashes($displayhtml['after']);
+ }
+ return $output;
+ endif;
+
+ }
+
+
+
+
+
+ /* admin part */
+
+ function add_admin_pages()
+ {
+ add_options_page('Xilitheme select', 'Xilitheme select', 8, 'xilithemeselect', array(&$this, 'option_page'));
+ }
+ function option_page()
+ {
+ if ( isset($_POST['submitted']) ) {
+ $options = array();
+ $options['xilithemeextension'] = $_POST['xilithemeextension'];
+ $options['isxilithemefullname'] = $_POST['isxilithemefullname'];
+ $options['xilithemefullname'] = $_POST['xilithemefullname'];
+
+ update_option('xilithemeselect_options', $options);
+ foreach ($options as $option_name => $option_value)
+ $this-> {$option_name} = $option_value;
+ echo '<div id="message" class="updated fade"><p>'.__("Plugin<strong> xilithemeselect</strong> settings saved.","xilithemeselect").'</p></div>';
+ }
+
+ ?>
+ <div class='wrap'>
+ <h2><?php _e("Xilitheme select settings","xilithemeselect"); ?></h2>
+ <p><cite><a href='http://www.xiliphone.mobi' target='_blank'>Xilitheme select</a></cite> <?php _e("provides an automatic selection of the theme for iphone's user when visiting your site.<br />Don't forget to upload a specific theme for ipod touch / iphone with a right folder's name in the wp-content/themes folder.<br /> If an error occur, the current theme is displayed in ipod touch / iphone browser.","xilithemeselect"); ?></p>
+ <p><?php _e("the current theme is","xilithemeselect"); echo ": <em>".$this->currentthemefolder ?>. </em><strong><br />
+ <?php _e("itouch theme's folder","xilithemeselect"); echo ": <em>".$this->currentthemefolder.$this->xilithemeextension."</em> ";
+ $curpath = get_theme_root()."/".$this->currentthemefolder.$this->xilithemeextension;
+ if (file_exists($curpath)) :
+ _e("is available","xilithemeselect");
+ else :
+ _e("is NOT available","xilithemeselect");
+ endif;
+ ?>, </strong>
+ <br /><strong>
+ <?php _e("itouch theme's folder","xilithemeselect"); echo ": <em>".$this->xilithemefullname."</em> ";
+ $curpath = get_theme_root()."/".$this->xilithemefullname;
+ if (file_exists($curpath)) :
+ _e("is available","xilithemeselect");
+ else :
+ _e("is NOT available","xilithemeselect");
+ endif;
+ ?> </strong>
+ <br /><?php _e("in the current wp-content/themes folder.","xilithemeselect");?></p>
+ <form name="xiliphone" action="<?php echo $action_url; ?>" method="post">
+ <input type="hidden" name="submitted" value="1" />
+
+ <fieldset class="options">
+ <ul>
+ <li>
+ <label for="xilithemeextension">
+ <?php _e("itouch theme's folder extension:","xilithemeselect"); ?>
+ <input type="text" id="xilithemeextension" name="xilithemeextension"
+ size="7" maxlength="8"
+ value="<?php echo $this->xilithemeextension; ?>" />
+ </label>
+ </li>
+ <li>
+ <label for="isxilithemefullname">
+ <?php _e("Option: extension or full name:","xilithemeselect"); ?>
+ <select name="isxilithemefullname">
+ <option value="full"<?php if ($this->isxilithemefullname == 'full') { ?> selected="selected"<?php } ?> ><?php _e('full name','xilithemeselect'); ?></option>
+ <option value="extension"<?php if ($this->isxilithemefullname == 'extension') { ?> selected="selected"<?php } ?> ><?php _e('extension','xilithemeselect'); ?></option>
+ </select>
+ </label>
+ </li>
+ <li>
+ <label for="xilithemefullname">
+ <?php _e("itouch theme's folder full name:","xilithemeselect"); ?>
+ <input type="text" id="xilithemefullname" name="xilithemefullname"
+ size="20" maxlength="30"
+ value="<?php echo $this->xilithemefullname; ?>" />
+ </label>
+ </li>
+
+ </ul>
+ </fieldset>
+ <p class="submit"><input type="submit" name="Submit" value="<?php _e('Save Changes'); ?> »" /></p>
+ </form>
+ <h4><a href="http://dev.xiligroup.com/xilitheme-select/" title="Plugin page and docs" target="_blank" style="text-decoration:none" ><img style="vertical-align:middle" src="<?php echo WP_PLUGIN_URL.'/'.dirname(plugin_basename(__FILE__)).'/xilitheme-logo-32.gif'; ?>" alt="xilitheme-select logo"/> xilitheme-select</a> - © <a href="http://dev.xiligroup.com" target="_blank" title="<?php _e('Author'); ?>" >xiligroup.com</a>™ - msc 2007-9 - v. <?php echo XILITHEME_VER; ?></h4>
+ </div>
+ <?php
+ }
+
+}
+
+global $wp_ismobile;
+$wp_ismobile = new xilithemeselector(true); //true if dashboard part - false w/o dashboard - see doc on top
+$wp_ismobile->cookienable = 1; /*0 to disable*/
+
+/**** tag insertable in the theme's footer or elsewhere ****/
+/* example 1 (in browser): if (function_exists('the_xilithemelink')) the_xilithemelink('mobbro=<img src="'.get_bloginfo("template_directory").'/images/mobilelink.gif" alt=""/>');
+*/
+/* example 2 (in mobilebrowser): if (function_exists('the_xilithemelink')) the_xilithemelink('bro=naviguer en mode normal');
+*/
+function the_xilithemelink($args = ''){
+
+ if ( is_array($args) )
+ $r = &$args;
+ else
+ parse_str($args, $r);
+
+ $defaults = array('before'=>'<span class="xilithemelink">','after'=>'</span>','bro'=>'browser','mobbro'=>'iTouch');
+ $r = array_merge($defaults, $r);
+
+ global $wp_ismobile;
+ echo $wp_ismobile->display_themetype($r);
+}
+?>
\ No newline at end of file
Binary file web/wp-content/plugins/zdmultilang/flags/ar.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/be_BY.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/bg_BG.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/bn_BD.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/ca.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/cy.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/cz_CZ.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/da_DK.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/de_DE.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/el.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/en_GB.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/en_US.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/eo.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/es_ES.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/et.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/eu.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/fi_FI.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/fo.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/fr_FR.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/gl_ES.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/he_IL.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/hr.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/hu_HU.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/id_ID.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/is_IS.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/it_IT.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/ja.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/km_KH.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/ko_KR.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/ku.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/lt.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/lv.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/mg_MG.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/mk_MK.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/ms_MY.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/nb_NO.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/nl_NL.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/pl_PL.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/pt_BR.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/pt_PT.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/ro.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/ru_RU.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/si_LK.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/sk.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/sl_SI.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/sr_RS.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/sv_SE.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/th.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/tr.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/ua_UA.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/uz_UZ.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/vi_VN.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/zh_CN.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/zh_HK.png has changed
Binary file web/wp-content/plugins/zdmultilang/flags/zh_TW.png has changed
Binary file web/wp-content/plugins/zdmultilang/images/add.png has changed
Binary file web/wp-content/plugins/zdmultilang/images/edit.png has changed
Binary file web/wp-content/plugins/zdmultilang/lang/zd_multilang-es_ES.mo has changed
--- a/web/wp-content/plugins/zdmultilang/lang/zd_multilang-es_ES.po Tue Mar 16 14:14:44 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,174 +0,0 @@
-#
-#
-# Nina Morawietz < <mailto:info@kageko.de>>, 2008.
-msgid ""
-msgstr ""
-"Project-Id-Version: ZdMultilang\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2008-05-02 14:06+0200\n"
-"PO-Revision-Date: 2008-08-01 23:35+0100\n"
-"Last-Translator: Guillermo Lpez <guillermolopez@guillermolopez.eu>\n"
-"Language-Team: en_US <kde-i18n-doc@lists.kde.org>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=iso-8859-1\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: nplurals=2; plural=(n != 1);\n"
-
-#: zd_multilang.php:205
-msgid "Languages"
-msgstr "Idiomas"
-
-#: zd_multilang.php:toto
-msgid "Posts & Pages"
-msgstr "Posts & Pginas"
-
-msgid "Translations"
-msgstr "Traducciones"
-
-msgid "General Options"
-msgstr "Opciones generales"
-
-msgid "Options"
-msgstr "Opciones"
-
-msgid "Options updated"
-msgstr "Opciones actualizadas"
-
-msgid "Default Language"
-msgstr "Idioma por defecto"
-
-msgid "Show Language Switcher in post"
-msgstr "Mostrar es selector de idioma en los posts"
-
-msgid "Show"
-msgstr "Mostrar"
-
-msgid "Hide"
-msgstr "Ocultar"
-
-msgid "Language Switcher Position"
-msgstr "Posicin del selector de idioma"
-
-msgid "Top"
-msgstr "Arriba"
-
-msgid "Bottom"
-msgstr "Abajo"
-
-msgid "Show Language names in switcher"
-msgstr "Mostrar los nombres de los idiomas en el selector"
-
-msgid "Show Flags in switcher"
-msgstr "Mostrar las banderas en el selector"
-
-msgid "Language Switcher CSS class"
-msgstr "Clase CSS del selector de idiomas"
-
-msgid "Update options"
-msgstr "Actualizar opciones"
-
-msgid "Language Edited"
-msgstr "Idioma modificado"
-
-msgid "Edit Language"
-msgstr "Editar Idioma"
-
-msgid "Language Name"
-msgstr "Nombre del Idioma"
-
-msgid "Language Permalink"
-msgstr "Enlace permanente del idioma"
-
-msgid "Language Added"
-msgstr "Idioma aadido"
-
-msgid "Action"
-msgstr "Accin"
-
-msgid "Language Code"
-msgstr "Codigo del Idioma"
-
-msgid "Permalink"
-msgstr "Enlace permanente"
-
-msgid "Default"
-msgstr "por defecto"
-
-msgid "Edit"
-msgstr "Editar"
-
-msgid "Delete"
-msgstr "Suprimir"
-
-msgid "Add Language"
-msgstr "Aadir Idioma"
-
-msgid "Language deleted"
-msgstr "Idioma suprimido"
-
-msgid "No languages defined, please define some first"
-msgstr "Ningn idoma definido, por favor define uno"
-
-msgid "Post or Page updated"
-msgstr "Posts o pginas actualizados"
-
-msgid "Title"
-msgstr "Ttulo"
-
-msgid "Update"
-msgstr "Actualizar"
-
-msgid "Original title"
-msgstr "Ttulo original"
-
-msgid "Published date"
-msgstr "Fecha de publicacion"
-
-msgid "%d posts or pages are translated"
-msgstr "%d de posts o pginas estan traducidos"
-
-msgid "Categories"
-msgstr "Categorias"
-
-msgid "Tags"
-msgstr "Tags"
-
-msgid "Link Categories"
-msgstr "Categorias de los enlaces"
-
-msgid "Original Term"
-msgstr "Termino original"
-
-msgid "Update Translation"
-msgstr "Actualizar traduccin"
-
-msgid "Translate"
-msgstr "Traducir"
-
-msgid "Only use this option if you want to switch old default language with new one. This will exchange translations between them"
-msgstr "Solamente husa esta opcion si quieres cambiar tu idioma por defecto por uno nuevo. Esto las intercambiara entre ellas"
-
-msgid "Exchange Languages"
-msgstr "Intercambiar los idiomas"
-
-msgid "Default Languages Exchanged"
-msgstr "Idiomas por defecto intercambiados"
-
-msgid "Yes"
-msgstr "Si"
-
-msgid "No"
-msgstr "No"
-
-msgid "Generate permalink for Default language"
-msgstr "Generar los enlaces permanentes para el idioma por defecto"
-
-msgid "Language Switcher"
-msgstr "Selector de idiomas"
-
-msgid "Display untranslated posts"
-msgstr "Mostrar posts sin traducir"
-
-msgid "If Yes, display link \"Translate Original post with Google Translate\""
-msgstr "Activar si para mostrar el enlace \"Traducir el post con Google Translate\""
-
Binary file web/wp-content/plugins/zdmultilang/lang/zd_multilang-fr_FR.mo has changed
--- a/web/wp-content/plugins/zdmultilang/lang/zd_multilang-fr_FR.po Tue Mar 16 14:14:44 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,263 +0,0 @@
-msgid ""
-msgstr ""
-"Project-Id-Version: ZdMultilang\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: \n"
-"Last-Translator: Nina Morawietz < <mailto:info@kageko.de>>\n"
-"Language-Team: Zen-Dreams <anthony@zen-dreams.com>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"X-Poedit-Language: French\n"
-"X-Poedit-Country: FRANCE\n"
-
-msgid "Translate"
-msgstr "Traduire"
-
-msgid "Translations"
-msgstr "Traductions"
-
-msgid "Posts"
-msgstr "Articles"
-
-msgid "Pages"
-msgstr "Pages"
-
-msgid "Categories"
-msgstr "Catégories"
-
-msgid "Tags"
-msgstr "Etiquettes"
-
-msgid "Links"
-msgstr "Liens"
-
-msgid "Link Categories"
-msgstr "Catégories de liens"
-
-msgid "Languages"
-msgstr "Langues"
-
-msgid "Options"
-msgstr "Options"
-
-msgid "Language Dashboard"
-msgstr "Panneau d'administration des traductions"
-
-msgid "Translate posts"
-msgstr "Traduire les articles"
-
-msgid "Translate pages"
-msgstr "Traduire les pages"
-
-msgid "Translate categories"
-msgstr "Traduire les catégories"
-
-msgid "Translate tags"
-msgstr "Traduire les étiquettes"
-
-msgid "Translate links"
-msgstr "Traduire les liens"
-
-msgid "Translate link categories"
-msgstr "Traduire les catégories de liens"
-
-msgid "Define languages"
-msgstr "Définir les langues"
-
-msgid "Manage options"
-msgstr "Gérer les options"
-
-msgid "Default Languages Exchanged"
-msgstr "Langues par défaut échangées"
-
-msgid "Options updated"
-msgstr "Options mises à jour"
-
-msgid "General Options"
-msgstr "Options générales"
-
-msgid "Default Language"
-msgstr "Langue par défaut"
-
-msgid "Exchange Languages"
-msgstr "Echange des Langues"
-
-msgid "Only use this option if you want to switch old default language with new one. This will exchange translations between them"
-msgstr "N'utilisez cette option que si vous voulez exchanger l'ancienne langue par defaut avec celle-ci. Cela permuttera les traductions entre les langues."
-
-msgid "Generate permalink for Default language"
-msgstr "Générer les permaliens pour la langue par défaut"
-
-msgid "Yes"
-msgstr "Oui"
-
-msgid "No"
-msgstr "Non"
-
-msgid "Display untranslated posts"
-msgstr "Afficher les articles non traduits"
-
-msgid "Show"
-msgstr "Affiché"
-
-msgid "Hide"
-msgstr "Masqué"
-
-msgid "If Yes, display link \"Translate Original post with Google Translate\""
-msgstr "Si Oui, afficher un lien \"Traduire l'article original avec Google Translate\""
-
-msgid "Language Switcher"
-msgstr "Selecteur de langues"
-
-msgid "Show Language Switcher in post"
-msgstr "Affiche le selecteur de langue dans les articles"
-
-msgid "Language Switcher Position"
-msgstr "Position du selecteur de langue"
-
-msgid "Top"
-msgstr "Haut"
-
-msgid "Bottom"
-msgstr "Bas"
-
-msgid "Show Language names in switcher"
-msgstr "Affiche les noms de langues dans le selecteur"
-
-msgid "Show Flags in switcher"
-msgstr "Affiche les drapeaux dans le selecteur"
-
-msgid "Language Switcher CSS class"
-msgstr "Classe CSS du selecteur de langue"
-
-msgid "Update options"
-msgstr "Mets à jour les options"
-
-msgid "Language Edited"
-msgstr "Langue modifiée"
-
-msgid "Language Name"
-msgstr "Nom de la langue"
-
-msgid "Language Permalink"
-msgstr "Permalien de la langue"
-
-msgid "Blog name"
-msgstr "Nom du blog"
-
-msgid "Blog description"
-msgstr "Description du blog"
-
-msgid "Edit Language"
-msgstr "Editer Langue"
-
-msgid "Language Added"
-msgstr "Langue ajoutée"
-
-msgid "Action"
-msgstr "Action"
-
-msgid "Language Code"
-msgstr "Code de Langue"
-
-msgid "Permalink"
-msgstr "Permalien"
-
-msgid "Default"
-msgstr "par défaut"
-
-msgid "Edit"
-msgstr "Editer"
-
-msgid "Delete"
-msgstr "Supprimer"
-
-msgid "Add Language"
-msgstr "Ajouter une Langue"
-
-msgid "Show/Hide Available default codes"
-msgstr "Afficher/masquer les définitions de langues"
-
-msgid "Language deleted"
-msgstr "Langue supprimée"
-
-msgid "Posts & Pages"
-msgstr "Articles & Pages"
-
-msgid "No languages defined, please define some first"
-msgstr "Aucune langue n'est définie, veuillez en créer avant de continuer"
-
-msgid "Post or Page updated"
-msgstr "Articles ou Pages mise à jour"
-
-msgid "Translation Status"
-msgstr "Etat de la traduction"
-
-msgid "Actions"
-msgstr "Actions"
-
-msgid "See Original post"
-msgstr "Afifche l'article original"
-
-msgid "Import translation from Google Translate (may not work)"
-msgstr "Importer depuis Google Translate (peut ne pas fonctionner)"
-
-msgid "See translation in Google Translate (if previous link do not work)"
-msgstr "Afficher la traduction dans Google Translate (si le lien ci-dessus ne fonctionne pas)"
-
-msgid "Title"
-msgstr "Titre"
-
-msgid "Excerpt"
-msgstr "Extrait"
-
-msgid "Original title"
-msgstr "Titre original"
-
-msgid "%d posts or pages are translated"
-msgstr "%d articles ou pages ont été traduites"
-
-msgid "Name"
-msgstr "Nom"
-
-msgid "URL"
-msgstr "URL"
-
-msgid "Description"
-msgstr "Description"
-
-msgid "Original Link"
-msgstr "Lien original"
-
-msgid "Original Term"
-msgstr "Term original"
-
-msgid "Update Translation"
-msgstr "Modifie la traduction"
-
-msgid "Language"
-msgstr "Langues"
-
-msgid "Display Languages Name"
-msgstr "Affiche les noms de langues"
-
-msgid "Published date"
-msgstr "Date de publication"
-
-msgid "Published"
-msgstr "Publié"
-
-msgid "Draft"
-msgstr "Brouillon"
-
-msgid "published"
-msgstr "publié"
-
-msgid "draft"
-msgstr "brouillon"
-
-#~ msgid "Update"
-#~ msgstr "Mets à jour"
-
Binary file web/wp-content/plugins/zdmultilang/lang/zd_multilang-pt_BR.mo has changed
--- a/web/wp-content/plugins/zdmultilang/lang/zd_multilang-pt_BR.po Tue Mar 16 14:14:44 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,264 +0,0 @@
-msgid ""
-msgstr ""
-"Project-Id-Version: zdMultilang\n"
-"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: \n"
-"PO-Revision-Date: \n"
-"Last-Translator: Dionizio Bonfim Bach <djio.com.br@gmail.com>\n"
-"Language-Team: Dionizio Bonfim Bach <djio.com.br@gmail.com>\n"
-"MIME-Version: 1.0\n"
-"Content-Type: text/plain; charset=UTF-8\n"
-"Content-Transfer-Encoding: 8bit\n"
-"Plural-Forms: s\n"
-"X-Poedit-Language: Portuguese\n"
-"X-Poedit-Country: BRAZIL\n"
-
-msgid "Translate"
-msgstr "Traduzir"
-
-msgid "Translations"
-msgstr "Traduções"
-
-msgid "Posts"
-msgstr "Posts"
-
-msgid "Pages"
-msgstr "Páginas"
-
-msgid "Categories"
-msgstr "Categorias"
-
-msgid "Tags"
-msgstr "Tags"
-
-msgid "Links"
-msgstr "Links"
-
-msgid "Link Categories"
-msgstr "Categorias de Links"
-
-msgid "Languages"
-msgstr "Idiomas"
-
-msgid "Options"
-msgstr "Opções"
-
-msgid "Language Dashboard"
-msgstr "Painel do Idioma"
-
-msgid "Translate posts"
-msgstr "Traduzir posts"
-
-msgid "Translate pages"
-msgstr "Traduzir páginas"
-
-msgid "Translate categories"
-msgstr "Traduzir categorias"
-
-msgid "Translate tags"
-msgstr "Traduzir tags"
-
-msgid "Translate links"
-msgstr "Traduzir links"
-
-msgid "Translate link categories"
-msgstr "Traduzir categorias de link"
-
-msgid "Define languages"
-msgstr "Definir idiomas"
-
-msgid "Manage options"
-msgstr "Gerenciar opções"
-
-msgid "Default Languages Exchanged"
-msgstr "Idiomas Padrão foram trocados"
-
-msgid "Options updated"
-msgstr "Opções atualizadas"
-
-msgid "General Options"
-msgstr "Opções Gerais"
-
-msgid "Default Language"
-msgstr "Idioma Padrão"
-
-msgid "Exchange Languages"
-msgstr "Trocar Idiomas"
-
-msgid "Only use this option if you want to switch old default language with new one. This will exchange translations between them"
-msgstr "Somente use esta opção se você deseja alterar o idioma padrão antigo por este novo. Isto trocará as traduções entre eles"
-
-msgid "Generate permalink for Default language"
-msgstr "Gerar Link Permanente para o Idioma Padrão"
-
-msgid "Yes"
-msgstr "Sim"
-
-msgid "No"
-msgstr "Não"
-
-msgid "Display untranslated posts"
-msgstr "Exibir artigos sem tradução"
-
-msgid "Show"
-msgstr "Mostrar"
-
-msgid "Hide"
-msgstr "Esconder"
-
-msgid "If Yes, display link \"Translate Original post with Google Translate\""
-msgstr "Se Sim, mostrar link \"Traduzir artigo original usando o Tradutor do Google\""
-
-msgid "Language Switcher"
-msgstr "Troca de Idioma"
-
-msgid "Show Language Switcher in post"
-msgstr "Mostrar Troca de Idioma no artigo"
-
-msgid "Language Switcher Position"
-msgstr "Posição da Troca de Idioma"
-
-msgid "Top"
-msgstr "No topo"
-
-msgid "Bottom"
-msgstr "Abaixo"
-
-msgid "Show Language names in switcher"
-msgstr "Mostrar nomes na Troca de Idioma"
-
-msgid "Show Flags in switcher"
-msgstr "Mostrar bandeiras na Troca de Idioma"
-
-msgid "Language Switcher CSS class"
-msgstr "Classe CSS da Troca de Idioma"
-
-msgid "Update options"
-msgstr "Atualizar opções"
-
-msgid "Language Edited"
-msgstr "Idioma Editado"
-
-msgid "Language Name"
-msgstr "Nome do Idioma"
-
-msgid "Language Permalink"
-msgstr "Link Permanente do Idioma"
-
-msgid "Blog name"
-msgstr "Nome do Site"
-
-msgid "Blog description"
-msgstr "Descrição do Site"
-
-msgid "Edit Language"
-msgstr "Editar Idioma"
-
-msgid "Language Added"
-msgstr "Idioma Adicionado"
-
-msgid "Action"
-msgstr "Ação"
-
-msgid "Language Code"
-msgstr "Código do Idioma"
-
-msgid "Permalink"
-msgstr "Link Permanente"
-
-msgid "Default"
-msgstr "Padrão"
-
-msgid "Edit"
-msgstr "Editar"
-
-msgid "Delete"
-msgstr "Remover"
-
-msgid "Add Language"
-msgstr "Adicionar Idioma"
-
-msgid "Show/Hide Available default codes"
-msgstr "Mostrar/Ocultar códigos disponíveis"
-
-msgid "Language deleted"
-msgstr "Idioma removido"
-
-msgid "Posts & Pages"
-msgstr "Artigos & Páginas"
-
-msgid "No languages defined, please define some first"
-msgstr "Nenhum Idioma definido, favor definir alguns antes de prossegir"
-
-msgid "Post or Page updated"
-msgstr "Artigo ou Página atualizado(a)"
-
-msgid "Translation Status"
-msgstr "Estado das traduções"
-
-msgid "Actions"
-msgstr "Ações"
-
-msgid "See Original post"
-msgstr "Ver Post original"
-
-msgid "Import translation from Google Translate (may not work)"
-msgstr "Importar tradução do Google Translate (pode não funcionar)"
-
-msgid "See translation in Google Translate (if previous link do not work)"
-msgstr "Ver tradução no Google Translate (se o link anterior não funcionar)"
-
-msgid "Title"
-msgstr "Título"
-
-msgid "Excerpt"
-msgstr "Resumo"
-
-msgid "Original title"
-msgstr "Título original"
-
-msgid "%d posts or pages are translated"
-msgstr "%d artigos ou páginas estão traduzidos"
-
-msgid "Name"
-msgstr "Nome"
-
-msgid "URL"
-msgstr "URL"
-
-msgid "Description"
-msgstr "Descrição"
-
-msgid "Original Link"
-msgstr "Link Original"
-
-msgid "Original Term"
-msgstr "Termo Original"
-
-msgid "Update Translation"
-msgstr "Atualizar Tradução"
-
-msgid "Language"
-msgstr "Idioma"
-
-msgid "Display Languages Name"
-msgstr "Mostrar Nome dos Idiomas"
-
-msgid "Published date"
-msgstr "Data de publicação"
-
-msgid "Published"
-msgstr "Publicado"
-
-msgid "Draft"
-msgstr "Rascunho"
-
-msgid "published"
-msgstr "publicado"
-
-msgid "draft"
-msgstr "rascunho"
-
-#~ msgid "Update"
-#~ msgstr "Atualizar"
-
--- a/web/wp-content/plugins/zdmultilang/lang/zd_multilang.pot Tue Mar 16 14:14:44 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,257 +0,0 @@
-"Project-Id-Version: ZdMultilanguage"
-"Report-Msgid-Bugs-To: "
-"POT-Creation-Date: 2008-05-02 14:06+0200"
-"PO-Revision-Date: "
-"Last-Translator: Anthony <anthony@zen-dreams.com>"
-"Language-Team: "
-"MIME-Version: 1.0"
-"Content-Type: text/plain; charset=UTF-8"
-"Content-Transfer-Encoding: 8bit"
-"X-Poedit-KeywordsList: __;_e"
-"X-Poedit-Basepath: ."
-"X-Poedit-SearchPath-0: ."
-msgid "Translate"
-msgstr ""
-
-msgid "Translations"
-msgstr ""
-
-msgid "Posts"
-msgstr ""
-
-msgid "Pages"
-msgstr ""
-
-msgid "Categories"
-msgstr ""
-
-msgid "Tags"
-msgstr ""
-
-msgid "Links"
-msgstr ""
-
-msgid "Link Categories"
-msgstr ""
-
-msgid "Languages"
-msgstr ""
-
-msgid "Options"
-msgstr ""
-
-msgid "Language Dashboard"
-msgstr ""
-
-msgid "Translate posts"
-msgstr ""
-
-msgid "Translate pages"
-msgstr ""
-
-msgid "Translate categories"
-msgstr ""
-
-msgid "Translate tags"
-msgstr ""
-
-msgid "Translate links"
-msgstr ""
-
-msgid "Translate link categories"
-msgstr ""
-
-msgid "Define languages"
-msgstr ""
-
-msgid "Manage options"
-msgstr ""
-
-msgid "Default Languages Exchanged"
-msgstr ""
-
-msgid "Options updated"
-msgstr ""
-
-msgid "General Options"
-msgstr ""
-
-msgid "Default Language"
-msgstr ""
-
-msgid "Exchange Languages"
-msgstr ""
-
-msgid "Only use this option if you want to switch old default language with new one. This will exchange translations between them"
-msgstr ""
-
-msgid "Generate permalink for Default language"
-msgstr ""
-
-msgid "Yes"
-msgstr ""
-
-msgid "No"
-msgstr ""
-
-msgid "Display untranslated posts"
-msgstr ""
-
-msgid "Show"
-msgstr ""
-
-msgid "Hide"
-msgstr ""
-
-msgid "If Yes, display link \"Translate Original post with Google Translate\""
-msgstr ""
-
-msgid "Language Switcher"
-msgstr ""
-
-msgid "Show Language Switcher in post"
-msgstr ""
-
-msgid "Language Switcher Position"
-msgstr ""
-
-msgid "Top"
-msgstr ""
-
-msgid "Bottom"
-msgstr ""
-
-msgid "Show Language names in switcher"
-msgstr ""
-
-msgid "Show Flags in switcher"
-msgstr ""
-
-msgid "Language Switcher CSS class"
-msgstr ""
-
-msgid "Update options"
-msgstr ""
-
-msgid "Language Edited"
-msgstr ""
-
-msgid "Language Name"
-msgstr ""
-
-msgid "Language Permalink"
-msgstr ""
-
-msgid "Blog name"
-msgstr ""
-
-msgid "Blog description"
-msgstr ""
-
-msgid "Edit Language"
-msgstr ""
-
-msgid "Language Added"
-msgstr ""
-
-msgid "Action"
-msgstr ""
-
-msgid "Language Code"
-msgstr ""
-
-msgid "Permalink"
-msgstr ""
-
-msgid "Default"
-msgstr ""
-
-msgid "Edit"
-msgstr ""
-
-msgid "Delete"
-msgstr ""
-
-msgid "Add Language"
-msgstr ""
-
-msgid "Show/Hide Available default codes"
-msgstr ""
-
-msgid "Language deleted"
-msgstr ""
-
-msgid "Posts & Pages"
-msgstr ""
-
-msgid "No languages defined, please define some first"
-msgstr ""
-
-msgid "Post or Page updated"
-msgstr ""
-
-msgid "Translation Status"
-msgstr ""
-
-msgid "Actions"
-msgstr ""
-
-msgid "See Original post"
-msgstr ""
-
-msgid "Import translation from Google Translate (may not work)"
-msgstr ""
-
-msgid "See translation in Google Translate (if previous link do not work)"
-msgstr ""
-
-msgid "Title"
-msgstr ""
-
-msgid "Excerpt"
-msgstr ""
-
-msgid "Original title"
-msgstr ""
-
-msgid "%d posts or pages are translated"
-msgstr ""
-
-msgid "Name"
-msgstr ""
-
-msgid "URL"
-msgstr ""
-
-msgid "Description"
-msgstr ""
-
-msgid "Original Link"
-msgstr ""
-
-msgid "Original Term"
-msgstr ""
-
-msgid "Update Translation"
-msgstr ""
-
-msgid "Language"
-msgstr ""
-
-msgid "Display Languages Name"
-msgstr ""
-
-msgid "Published date"
-msgstr ""
-
-msgid "Published"
-msgstr ""
-
-msgid "Draft"
-msgstr ""
-
-msgid "published"
-msgstr ""
-
-msgid "draft"
-msgstr ""
\ No newline at end of file
--- a/web/wp-content/plugins/zdmultilang/readme.txt Tue Mar 16 14:14:44 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,97 +0,0 @@
-=== ZdMultiLang ===
-Contributors: ZenDreams, PauSanchez
-Donate link: http://blog.zen-dreams.com/en/wordpress/zdmultilang/#donate
-Tags: Multi language, Wordpress, Zen-Dreams
-Requires at least: 2.5.0
-Tested up to: 2.8.6
-Stable tag: 1.2.5
-
-ZdMultiLang is a multilingual plugin for wordpress
-
-== Description ==
-
-ZdMultiLang is a wordpress plugin allowing you to blog in multiple languages.
-
-Here is a list of functions :
-
-* Translate posts ang pages
-* Translate categories and tags
-* Switch blog language
-* Widget to change currently viewed language
-
-== Changelog ==
-
-v1.2.5:
-
-* The most expected feature is now working. You can have static pages as a frontpage !
-* Updated a bug with translation icon in the page while the page has never been saved
-* Added options to hide the flag in the widget
-* function zd_multilang_menu now takes two paramaters : zd_multilang_menu (show_language_name, show_language_flag) by default these are true
-* Added an option to display original post while translating
-* Added a donate button if you want to support development of the plugin
-* Added an option to select who can translate things
-* Added an option to keep comments separated - work by <a href="http://www.codigomanso.com/">Pau Sanchez</a>
-* Added an autosave feature, can be enabled/disabled from the option page. It will autosave every 5 minutes unless the status is published
-
-v1.2.4:
-
-* Update for Wordpress 2.8 : Media Upload fix + Save button fix
-
-v1.2.1:
-
-* Updated a variable used to make translations, a bug prevented to translate posts/pages. This has been corrected.
-
-v1.2.0:
-
-* Completely redesigned the editor page
-* Added import from google feature
-* Won't display flags for current language
-* Added draft feature for translations
-* Added term descriptions
-* Added link descriptions and translations, Blog name, Blog description
-* Better definition of Languages
-* Compatible with Wordpress 2.7
-
-v1.1.1:
-
-* Added the media bar in the html editor
-* Found the reason why the editor didn't work : csforms2 is breaking the tiny_mce editor, to fix it, just disable the WP Editor Button support in your general settings.
-
-v1.1.0:
-
-* Added the possibility to switch default languages (meaning: exchange original posts/tags/cats with translated ones)
-* Added translate links directly into the manage pages & into the Media zone of page/posts edition
-* Added an option to generate permalinks for default language (ex-default behavior was always yes)
-* Changed default character set as UTF-8
-* Added an option to add "Translate with Google Translate" to untranslated posts
-* Added an option to hide untranslated posts if they exists (ex-default : show all posts)
-
-v1.0.1:
-
-* Updated all database queries, reduced the numbers of queries executed per page (about 200 queries less) via caching methods. The plugin should now require something like 9 queries per page (which is huge i Know, but to translate a blog, this is "necessary").
-
-== Installation ==
-
-1. Setup is very simple, just unzip the archive in your wp-content/plugins folder
-2. You can now activate the plugin and change the options.
-3. Setup languages and start to translate stuffs
-
-More on [Official Zdmultilang Page](http://blog.zen-dreams.com/en/zdmultilang "Official Zdmultilang Page")
-
-== Frequently Asked Questions ==
-See [Official FAQ](http://blog.zen-dreams.com/en/zdmultilang "Official FAQ")
-
-= I would like to have separated comments for each language. =
-In order to have comments tracked separatly for each language, you will have to change your comments.php template file like this:
-From this:
-
-action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php"
-
-to this:
-
-action="<?php echo get\_option('siteurl'); ?>/wp-comments-post.php?lang=<?php echo zd_multilang\_get\_locale(); ?>"
-
-
-
-== Screenshots ==
-You can check [this page](http://blog.zen-dreams.com/en/zdmultilang "ZdMultilang Screencast")
--- a/web/wp-content/plugins/zdmultilang/zd_multilang.php Tue Mar 16 14:14:44 2010 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1835 +0,0 @@
-<?php
-/*
-Plugin Name: ZdMultiLang
-Plugin URI: http://blog.zen-dreams.com/en/zdmultilang
-Description: This plugin adds multilingual capabilities to wordpress
-Version: 1.2.5
-Author: Anthony PETITBOIS, Pau Sanchez
-Author URI: http://www.zen-dreams.com/
-
-Copyright 2008 Anthony PETITBOIS (email : anthony@zen-dreams.com)
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-*/
-
-$ZdmlCache=array();
-$BaseURL=$_SERVER['PHP_SELF'].'?page='.plugin_basename (__FILE__);
-$default_language_option="zd_multilang_defaultlanguage";
-$insert_lang_switch_option="zd_multilang_lang_switcher";
-$show_flags_option="zd_multilang_show_flags";
-$show_languages_option="zd_multilang_langnames";
-$lang_switcher_class_option="zd_multilang_switcher_class";
-$permalink_default="zd_multilang_permalink_def";
-$display_untranslated="zd_multilang_display_untranslated";
-$display_google_translate="zd_multilang_display_glink";
-$display_original_option="zd_multilang_display_original";
-$keep_separate_comments="zd_multilang_keep_separate_comments";
-$Allowed_Access="zd_multilang_access";
-$Autosave_Option="zdmultilang_autosave";
-$CurrentLanguagePermalink="";
-$PluginDIR = '../'.PLUGINDIR . '/' . dirname(plugin_basename (__FILE__));
-
-load_plugin_textdomain('zd_multilang',PLUGINDIR . '/' . dirname(plugin_basename (__FILE__)) . '/lang');
-register_activation_hook(__FILE__,'zd_multilang_install');
-add_action('admin_menu', 'zd_multilang_add_pages');
-add_filter('get_term', 'zd_multilang_translate_term',2); // Translate single terms
-add_filter('admin_head','zd_multilang_tinymce');
-add_filter('the_category','zd_multilang_translate_link_cat'); // Categories for posts
-add_filter('get_pages','zd_multilang_translate_post'); // Translation of Pages
-add_filter('get_tags','zd_multilang_translate_tags'); // Translation of tags
-add_filter('list_cats','zd_multilang_translate_cat'); // Categories for lists (widget)
-add_filter('get_bookmarks','zd_multilang_translate_bookmarks');
-add_filter('wp_list_bookmarks','zd_multilang_translate_list_bookmarks');
-add_filter('wp_tag_cloud','zd_multilang_translate_link_cat');
-add_filter('category_description','zd_multilang_cat_desc',10,2);
-add_filter('get_categories','zd_multilang_cat');
-add_filter('the_posts','zd_multilang_translate_post',10,1);
-add_filter('query_vars', 'zd_multilang_queryvars');
-add_filter('rewrite_rules_array', 'zd_multilang_rewrite');
-add_filter('next_post_link','zd_multilang_postlink');
-add_filter('previous_post_link','zd_multilang_postlink');
-add_filter('post_link','zd_multilang_permalink',1);
-add_filter('page_link','zd_multilang_permalink',1);
-add_filter('category_link','zd_multilang_permalink',1);
-add_filter('get_category','zd_multilang_cat',1);
-add_filter('tag_link','zd_multilang_permalink',1);
-add_filter('year_link','zd_multilang_permalink',1);
-add_filter('month_link','zd_multilang_permalink',1);
-add_filter('day_link','zd_multilang_permalink',1);
-add_filter('feed_link','zd_multilang_permalink',1);
-add_filter('author_link','zd_multilang_permalink',1);
-add_filter('wp','zd_multilang_set_locale');
-add_filter('manage_posts_columns', 'zd_multilang_manage_col_def');
-add_filter('manage_pages_columns', 'zd_multilang_manage_col_def');
-add_filter('posts_where','zd_multilang_where_filter');
-add_filter('get_next_post_where','zd_multilang_np_where_filter');
-add_filter('get_previous_post_where','zd_multilang_np_where_filter');
-/* Filters for comments */
-add_action ('wp_insert_comment', 'zd_multilang_insert_comment', 10, 2);
-add_action ('delete_comment', 'zd_multilang_delete_comment');
-add_filter ('comments_array','zd_multilang_comments_array', 10, 2);
-add_filter ('get_comments_number', 'zd_multilang_get_comments_number');
-
-/* Options short circuit */
-add_filter('option_blogname','zd_multilang_blogname');
-add_filter('option_blogdescription','zd_multilang_blogdescription');
-/* Options short circuit */
-
-add_action('manage_posts_custom_column', 'zd_multilang_manage_col', 10, 2);
-add_action('manage_pages_custom_column', 'zd_multilang_manage_col', 10, 2);
-add_action('media_buttons', 'zd_media_button', 30);
-
-/** Action handler for autosave feature **/
-add_action('wp_ajax_zdmultilang_autosave', 'zd_multilang_autosave');
-//add_action('wp_ajax_nopriv_my_special_action', 'my_action_callback');
-
-zd_multilang_set_locale("");
-
-function zd_multilang_tinymce() {
- if (($_GET['fct']=="posts")||($_POST['fct']=="posts")) {
- wp_enqueue_script( 'common' );
- wp_enqueue_script( 'jquery-color' );
- wp_print_scripts('editor');
- if (function_exists('add_thickbox')) add_thickbox();
- wp_print_scripts('media-upload');
- if (function_exists('wp_tiny_mce')) wp_tiny_mce();
- wp_admin_css();
- wp_enqueue_script('utils');
- do_action("admin_print_styles-post-php");
- do_action('admin_print_styles');
- }
-}
-
-function zd_multilang_queryvars( $qvars ) {
- $qvars[] = 'lang';
- return $qvars;
-}
-
-function zd_multilang_manage_col_def ($cols) {
- $cols['translate']=__('Translate','zd_multilang');
- return $cols;
-}
-
-function zd_multilang_manage_col($column_name, $id) {
- global $ZdmlCache, $PluginDIR;
- $BaseURL='admin.php?page='.plugin_basename (__FILE__);
- if( $column_name == 'translate' ) {
- if ($ZdmlCache['Languages']) foreach ($ZdmlCache['Languages'] as $Permalink => $LanguageID) {
- if ($LanguageID!=$ZdmlCache['DefLang']) echo '<a href="'.$BaseURL.'&fct=posts&id='.$id.'.'.$LanguageID.'"><img src="'.$PluginDIR.'/flags/'.$LanguageID.'.png" alt="'.$LanguageID.'" title="'.$LanguageID.'"></a> ';
- }
- }
-}
-
-function zd_media_button() {
- global $ZdmlCache, $PluginDIR;
- $id=$_GET['post'];
- if ($id) {
- $BaseURL='admin.php?page='.plugin_basename (__FILE__);
- if ($ZdmlCache['Languages']) foreach ($ZdmlCache['Languages'] as $Permalink => $LanguageID) {
- if ($LanguageID!=$ZdmlCache['DefLang']) echo '<a href="'.$BaseURL.'&fct=posts&id='.$id.'.'.$LanguageID.'" target="_blank" title="'.__('Translate','zd_multilang').'"><img src="'.$PluginDIR.'/flags/'.$LanguageID.'.png" alt="'.$LanguageID.'" title="'.$LanguageID.'"></a>';
- }
- }
-}
-
-function zd_multilang_where_filter($filter) {
- global $ZdmlCache, $locale,$display_untranslated, $wpdb, $wp_query;
-
- if ((get_option('show_on_front')=='page')&&(is_array($wp_query->query))&&(count($wp_query->query)<=1)&&(isset($wp_query->query['lang']))) {
- $lang=$WP->query['lang'];
- $filter=" AND ".$wpdb->posts.".ID = ".get_option('page_on_front');
- $wp_query->is_page=1;
- $wp_query->is_home=0;
- }
-
- if ($locale==$ZdmlCache['DefLang']) return $filter;
- if (get_option($display_untranslated)=="hide") {
- $filter.=" AND ".$wpdb->posts.".ID in (".$ZdmlCache['TranslatedPosts'][$locale].')';
- }
- return $filter;
-}
-
-function zd_multilang_np_where_filter($filter) {
- global $ZdmlCache, $locale,$display_untranslated, $wpdb;
- if ($locale==$ZdmlCache['DefLang']) return $filter;
- if (get_option($display_untranslated)=="hide") {
- $filter.=" AND p.ID in (".$ZdmlCache['TranslatedPosts'][$locale].')';
- }
- return $filter;
-}
-
-function zd_multilang_set_locale($WP) {
- global $wp_query,$wpdb, $wp_rewrite,$default_language_option,$locale,$CurrentLanguagePermalink,$CurrentLang;
- global $ZdmlCache;
-
- $language_table=$wpdb->prefix.'zd_ml_langs';
- $termtrans=$wpdb->prefix.'zd_ml_termtrans';
- $posttrans=$wpdb->prefix.'zd_ml_trans';
- $linktrans=$wpdb->prefix.'zd_ml_linktrans';
-
- $ZdmlCache['DefLang']=get_option("zd_multilang_defaultlanguage");
- $ZdmlCache['InsertInPosts']=get_option("zd_multilang_lang_switcher");
- $ZdmlCache['ShowLanguages']=get_option("zd_multilang_langnames");
- $ZdmlCache['ShowFlags']=get_option("zd_multilang_show_flags");
- $ZdmlCache['SwitcherPosition']=get_option('zd_multilang_position');
- $ZdmlCache['Lang_Switch_Class']=(get_option("zd_multilang_switcher_class")!="") ? get_option("zd_multilang_switcher_class") : "lang_switch";
-
- $TheLocale=$ZdmlCache['DefLang'];
-
- if (!isset($ZdmlCache['Languages'])) {
- $query="SELECT * FROM $language_table ORDER BY LanguageName";
- $results=$wpdb->get_results($query, ARRAY_A);
- if ($results) {
- foreach ($results as $ID => $V) {
- $ZdmlCache['Languages'][$V['LangPermalink']]=$V['LanguageID'];
- $ZdmlCache['LanguageNames'][$V['LangPermalink']]=$V['LanguageName'];
- $ZdmlCache['Options'][$V['LanguageID']]['blogname']=$V['BlogName'];
- $ZdmlCache['Options'][$V['LanguageID']]['blogdescription']=$V['BlogDescription'];
- }
- }
- }
- else {
- foreach ($ZdmlCache['Languages'] as $Permalink => $LangID) {
- $results[$i]['LangPermalink']=$Permalink;
- $results[$i]['LanguageID']=$LangID;
- $i++;
- }
- }
-
- if ($_SERVER['HTTPS']) $QUERY="https://".$_SERVER['HTTP_HOST'];
- else $QUERY="http://".$_SERVER['HTTP_HOST'];
- $QUERY.=$_SERVER['REQUEST_URI'];
-
- if ($results) {
- foreach ($results as $ID => $Lang) {
- $regexp.=$Lang['LangPermalink']."|";
- }
- $regexp=substr($regexp, 0, -1);
- }
- if (strstr($QUERY,"?")) $RegularExpression="`".get_bloginfo('url')."\/.*lang=($regexp)(.*)?`U";
- else $RegularExpression="`".get_bloginfo('url')."\/($regexp)\/(.*)?`U";
-
- if (preg_match($RegularExpression,$QUERY,$res)==TRUE) {
- $Lang=$res[1];
- $CurrentLanguagePermalink=$res[1];
- foreach ($ZdmlCache['Languages'] as $Permalink => $LangFound) {
- if ($Permalink==$Lang) {
- $Language= $LangFound;
- break;
- }
- }
- $CurrentLang=$Language;
- if ($Language) $TheLocale=$Language;
- }
- $locale=$TheLocale;
-
- if (!isset($ZdmlCache['Terms'])) {
- $query="SELECT tt.LanguageID, tt.name as t_name, tt.description as description, t.* FROM $termtrans tt RIGHT JOIN ".$wpdb->prefix."terms t on (tt.term_id=t.term_id)";
- $term=$wpdb->get_results($query, ARRAY_A);
- foreach ($term as $ID => $Value) {
- if ($Value['t_name']!=NULL) $ZdmlCache['Terms'][$Value['term_id']][$Value['LanguageID']]['name']=$Value['t_name'];
- else $ZdmlCache['Terms'][$Value['term_id']][$Value['LanguageID']]['name']=$Value['name'];
- $ZdmlCache['Terms'][$Value['term_id']][$Value['LanguageID']]['o_name']=$Value['name'];
- $ZdmlCache['Terms'][$Value['term_id']][$Value['LanguageID']]['description']=$Value['description'];
- }
- }
-
- if (!isset($ZdmlCache['Links'])) {
- $query="SELECT * from $linktrans";
- $links=$wpdb->get_results($query);
- foreach ($links as $id => $Values) {
- $ZdmlCache['Links'][$Values->link_id][$Values->LanguageID]['name']=$Values->link_name;
- $ZdmlCache['Links'][$Values->link_id][$Values->LanguageID]['url']=$Values->link_url;
- $ZdmlCache['Links'][$Values->link_id][$Values->LanguageID]['description']=$Values->link_description;
- }
- }
-
- if (!isset($ZdmlCache['TranslatedPosts'])) {
- if ($ZdmlCache['Languages']) foreach ($ZdmlCache['Languages'] as $Permalink => $LangID) {
- if ($LangID!=$ZdmlCache['DefLang']) {
- $query="SELECT ID from $posttrans WHERE LanguageID='$LangID' and post_status='published'";
- $res=$wpdb->get_results($query, ARRAY_A);
- if ($res) {
- $ZdmlCache['TranslatedPosts'][$LangID]="";
- foreach ($res as $key => $V) {
- $ZdmlCache['TranslatedPosts'][$LangID].=$V['ID'].",";
- }
- $ZdmlCache['TranslatedPosts'][$LangID]=substr($ZdmlCache['TranslatedPosts'][$LangID],0,-1);
- }
- }
- }
- }
-
- return $WP;
-}
-
-function zd_multilang_permalink($permalink) {
- global $wpdb, $wp_rewrite,$default_language_option, $CurrentLanguagePermalink,$CurrentLang,$permalink_default, $locale, $wp_query;
- global $ZdmlCache;
- $langstable=$wpdb->prefix.'zd_ml_langs';
-
- $Lang=$CurrentLanguagePermalink;
- if ($Lang=="") {
- $CurrentLang=$ZdmlCache['DefLang'];
- $query="SELECT LangPermalink FROM $langstable where LanguageID='$CurrentLang'";
- $CurrentLanguagePermalink=$wpdb->get_var($query);
- $Lang=$CurrentLanguagePermalink;
- }
- $link=$permalink;
-
- $PermalinkDef=get_option($permalink_default);
- if (($PermalinkDef=="no")&&($ZdmlCache['DefLang']==$locale)) return $link;
-
- if ($wp_rewrite->using_permalinks()) {
- $url=get_bloginfo('url');
- $end=substr($link,strlen($url));
- if ($Lang=="") $link=$url.$end;
- else $link=$url.'/'.$Lang.$end;
- } else if ($Lang) $link.= ((!strpos($link,'?'))? '?': '') ."&lang=".$Lang;
-
- return $link;
-}
-
-function zd_multilang_rewrite($permalink_structure) {
- global $ZdmlCache;
- global $wpdb, $wp_rewrite;
- $langs=$wpdb->prefix.'zd_ml_langs';
-
- $query="SELECT * FROM $langs order by LanguageID";
- $Lines=$wpdb->get_results($query, ARRAY_A);
- if ($Lines) {
- $regexp='(';
- foreach ($Lines as $Value) {
- $regexp.=$Value['LangPermalink'].'|';
- }
- $regexp=substr($regexp,0,-1);
- $regexp.=')';
-
- if ($permalink_structure) foreach ($permalink_structure as $Rule => $Definition) {
- $def=explode('?',$Definition);
- $rule=$Definition;
- if (preg_match_all('/(.*matches)\[([0-9]+)\]/U',$rule,$res)) {
- $rule="";
- foreach ($res[1] as $index => $text) {
- $rule.=$text.'['.($index+2).']';
- }
- }
- $rule.='&lang=$matches[1]';
- $new_rules[$regexp.'/'.$Rule]=$rule;
- }
- $new_rules2[$regexp.'/?']='index.php?lang=$matches[1]';
- if ($permalink_structure) $permalink_structure = $new_rules+ $new_rules2 + $permalink_structure;
- }
- return $permalink_structure;
-}
-
-function zd_multilang_is_translated($id, $lang) {
- global $ZdmlCache, $locale;
- if ($lang==$ZdmlCache['DefLang']) return TRUE;
- $Posts=explode(',',$ZdmlCache['TranslatedPosts'][$lang]);
- foreach ($Posts as $key => $ID) {
- if ($ID==$id) {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-function zd_multilang_install() {
- global $ZdmlCache;
- global $wpdb;
- $termtrans=$wpdb->prefix.'zd_ml_termtrans';
- $langs=$wpdb->prefix.'zd_ml_langs';
- $posttrans=$wpdb->prefix.'zd_ml_trans';
- $linktrans=$wpdb->prefix.'zd_ml_linktrans';
- $commenttrans=$wpdb->prefix.'zd_ml_comments';
-
- $dbversion=get_option('zd_multilang_dbschema');
- if ($dbversion<"125") {
- $sql="CREATE TABLE $langs (
- LanguageID varchar(5) NOT NULL,
- LanguageName varchar(100) character set utf8 NOT NULL,
- LangPermalink varchar(50) NOT NULL UNIQUE,
- BlogName longtext,
- BlogDescription longtext,
- primary key (LanguageID)
- );";
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
- dbDelta($sql);
-
- $sql="CREATE TABLE $termtrans (
- term_id varchar(5) NOT NULL,
- LanguageID varchar(5) NOT NULL,
- name varchar(255) character set utf8 NOT NULL,
- description longtext NOT NULL,
- primary key (term_id,LanguageID)
- );";
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
- dbDelta($sql);
-
- $sql="CREATE TABLE $posttrans (
- ID BIGINT(20) NOT NULL,
- LanguageID varchar(5),
- post_content longtext character set utf8,
- post_excerpt text character set utf8,
- post_title text character set utf8 NOT NULL,
- post_status varchar(10),
- primary key (ID, LanguageID)
- );";
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
- dbDelta($sql);
-
- $sql="CREATE TABLE $linktrans (
- link_id BIGINT(20) NOT NULL,
- LanguageID varchar(5),
- link_url varchar(255),
- link_name varchar(255) character set utf8,
- link_description varchar(255) character set utf8,
- primary key (link_id, LanguageID)
- );";
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
- dbDelta($sql);
-
- $sql="UPDATE $posttrans set post_status='published' where post_status is NULL";
- $wpdb->query($sql);
-
- // Comment translations only should keep track of the language where a single comment has been submitted
- $sql="CREATE TABLE $commenttrans (
- comment_id BIGINT(20) UNSIGNED NOT NULL,
- post_id BIGINT(20) UNSIGNED NOT NULL,
- LanguageID varchar(5),
- primary key (comment_id)
- );";
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
- dbDelta($sql);
-
- update_option('zd_multilang_dbschema',125);
- update_option('zd_multilang_access',10);
- }
-}
-
-function zd_multilang_add_pages() {
- global $Allowed_Access;
- $Allowed_Access_Level=get_option($Allowed_Access);
- add_menu_page('Zd_MultiLang', __('Translations','zd_multilang'), $Allowed_Access_Level, __FILE__, 'zd_multilang_page');
- add_submenu_page(__FILE__,__('Posts','zd_multilang'),__('Posts','zd_multilang'),$Allowed_Access_Level,__FILE__.'&fct=posts&tr=posts','zd_multilang_page');
- add_submenu_page(__FILE__,__('Pages','zd_multilang'),__('Pages','zd_multilang'),$Allowed_Access_Level,__FILE__.'&fct=posts&tr=pages','zd_multilang_page');
- add_submenu_page(__FILE__,__('Categories','zd_multilang'),__('Categories','zd_multilang'),$Allowed_Access_Level,__FILE__.'&fct=translations&tr=cat','zd_multilang_page');
- add_submenu_page(__FILE__,__('Tags','zd_multilang'),__('Tags','zd_multilang'),$Allowed_Access_Level,__FILE__.'&fct=translations&tr=tags','zd_multilang_page');
- add_submenu_page(__FILE__,__('Links','zd_multilang'),__('Links','zd_multilang'),$Allowed_Access_Level,__FILE__.'&fct=links','zd_multilang_page');
- add_submenu_page(__FILE__,__('Link Categories','zd_multilang'),__('Link Categories','zd_multilang'),$Allowed_Access_Level,__FILE__.'&fct=translations&tr=linkcat','zd_multilang_page');
- add_submenu_page(__FILE__,__('Languages','zd_multilang'),__('Languages','zd_multilang'),'manage_options',__FILE__.'&fct=languages','zd_multilang_page');
- add_submenu_page(__FILE__,__('Options','zd_multilang'),__('Options','zd_multilang'),'manage_options',__FILE__.'&fct=options','zd_multilang_page');
-}
-
-function zd_multilang_page() {
- global $BaseURL, $current_user;
- get_currentuserinfo();
- echo "\n".'<div class="wrap">';
- if ($_POST['fct']) $_GET['fct']=$_POST['fct'];
- switch ($_GET['fct']) {
- case 'options':
- if ($current_user->allcaps['manage_options']==1)
- zd_multilang_options();
- else {
- echo '<div id="message" class="error"><p>Only the administrator can edit the options</p></div>';
- zd_multilang_dashboard();
- }
- break;
- case 'edit':
- if ($current_user->allcaps['manage_options']==1)
- zd_multilang_edit_language();
- else {
- echo '<div id="message" class="error"><p>Only the administrator can edit the options</p></div>';
- zd_multilang_dashboard();
- }
- break;
- case 'delete':
- if ($current_user->allcaps['manage_options']==1)
- zd_multilang_delete_language();
- else {
- echo '<div id="message" class="error"><p>Only the administrator can edit the options</p></div>';
- zd_multilang_dashboard();
- }
- break;
- case 'posts':
- zd_multilang_post_translations();
- break;
- case 'translations';
- zd_multilang_term_translations();
- break;
- case 'languages':
- if ($current_user->allcaps['manage_options']==1)
- zd_multilang_languages();
- else {
- echo '<div id="message" class="error"><p>Only the administrator can edit the options</p></div>';
- zd_multilang_dashboard();
- }
- break;
- case 'links':
- zd_multilang_link_translations();
- break;
- default:
- zd_multilang_dashboard();
- break;
- }
- echo "\n</div>";
-}
-
-function zd_multilang_dashboard() {
- global $BaseURL, $current_user;
- get_currentuserinfo();;
- echo '<h2>'.__('Language Dashboard','zd_multilang').'</h2>';
- echo '<ul>';
- echo '<li><a href="'.$BaseURL.'&fct=posts&tr=posts">'.__('Translate posts','zd_multilang').'</a></li>';
- echo '<li><a href="'.$BaseURL.'&fct=posts&tr=pages">'.__('Translate pages','zd_multilang').'</a></li>';
- echo '<li><a href="'.$BaseURL.'&fct=translations&tr=cat">'.__('Translate categories','zd_multilang').'</a></li>';
- echo '<li><a href="'.$BaseURL.'&fct=translations&tr=tags">'.__('Translate tags','zd_multilang').'</a></li>';
- echo '<li><a href="'.$BaseURL.'&fct=links">'.__('Translate links','zd_multilang').'</a></li>';
- echo '<li><a href="'.$BaseURL.'&fct=translations&tr=linkcat">'.__('Translate link categories','zd_multilang').'</a></li>';
- if ($current_user->allcaps['manage_options']==1) echo '<li><a href="'.$BaseURL.'&fct=languages">'.__('Define languages','zd_multilang').'</a></li>';
- if ($current_user->allcaps['manage_options']==1) echo '<li><a href="'.$BaseURL.'&fct=options">'.__('Manage options','zd_multilang').'</a></li>';
- echo '</ul>';
- echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
-<input type="hidden" name="cmd" value="_s-xclick">
-<input type="hidden" name="hosted_button_id" value="8262513">
-<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
-<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
-</form>';
-}
-
-function zd_multilang_options() {
- global $wpdb, $BaseURL,$default_language_option,$insert_lang_switch_option,$show_flags_option,$display_google_translate;
- global $show_languages_option,$lang_switcher_class_option,$permalink_default,$display_untranslated, $display_original_option,$keep_separate_comments, $Allowed_Access,$Autosave_Option;
- global $ZdmlCache;
-
- $language_table=$wpdb->prefix.'zd_ml_langs';
- $termtrans=$wpdb->prefix.'zd_ml_termtrans';
- $posttrans=$wpdb->prefix.'zd_ml_trans';
- $hidden_field="zd_multilang_update_options";
- $language_table= $wpdb->prefix.'zd_ml_langs';
-
- echo '<form action="https://www.paypal.com/cgi-bin/webscr" method="post">
-<input type="hidden" name="cmd" value="_s-xclick">
-<input type="hidden" name="hosted_button_id" value="8262513">
-<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
-<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
-</form>';
-
- if ($_POST[$hidden_field]) {
- $OldLang=get_option($default_language_option);
- $DefLang=$_POST['def_lang'];
- $DisplayOriginal=$_POST['display_original'];
- $InsertInPosts=$_POST['show_language_switcher'];
- $Show_Languages=$_POST['show_languages'];
- $Show_Flags=$_POST['show_flags'];
- $Lang_Switch_Class=$_POST['lang_switch_class'];
- $SwitcherPosition=$_POST['language_switcher_position'];
- $KeepSeparateComments=$_POST['keep_separate_comments'];
- $PermalinkDef=$_POST['permalink_for_default'];
- $Exchange=$_POST['exchange_lang'];
- $DisplayUntranslated=$_POST['display_untranslated'];
- $DisplayGLink=$_POST['display_glink'];
- $Allowed_Access_Level=$_POST['access_level'];
- $Autosave=$_POST['autosave'];
-
- update_option('zd_multilang_position',$SwitcherPosition);
- update_option($default_language_option,$DefLang);
- update_option($display_original_option, $DisplayOriginal);
- update_option($insert_lang_switch_option,$InsertInPosts);
- update_option($show_languages_option,$Show_Languages);
- update_option($show_flags_option,$Show_Flags);
- update_option($lang_switcher_class_option,$Lang_Switch_Class);
- update_option($permalink_default, $PermalinkDef);
- update_option($display_untranslated,$DisplayUntranslated);
- update_option($display_google_translate,$DisplayGLink);
- update_option($keep_separate_comments, $KeepSeparateComments);
- update_option($Allowed_Access,$Allowed_Access_Level);
- update_option($Autosave_Option,$Autosave);
-
- echo '<div id="message" class="updated fade">';
- if ($Exchange=="on") {
- $query="SELECT * FROM $posttrans where LanguageID='$DefLang'";
- $TrPosts=$wpdb->get_results($query, ARRAY_A);
- $query="SELECT * FROM $termtrans where LanguageID='$DefLang'";
- $TrTerms=$wpdb->get_results($query, ARRAY_A);
-
- if ($TrPosts) foreach ($TrPosts as $key => $V) {
- $query="SELECT * from ".$wpdb->posts." WHERE ID=".$V['ID'];
- $res=$wpdb->get_row($query);
- $OriginalTitle=$res->post_title;
- $OriginalContent=$wpdb->escape($res->post_content);
- $NewContent=$wpdb->escape($V['post_content']);
- $NewTitle=$V['post_title'];
- $q1="UPDATE ".$wpdb->posts." set post_title='$NewTitle', post_content='$NewContent' WHERE ID=".$V['ID'];
- $wpdb->query($q1);
- $q1="UPDATE $posttrans set post_title='$OriginalTitle', post_content='$OriginalContent', LanguageID='$OldLang' WHERE ID=".$V['ID']." and LanguageID='$DefLang'";
- $wpdb->query($q1);
- }
- if ($TrTerms) foreach ($TrTerms as $key => $V) {
- $query="SELECT * from ".$wpdb->terms." WHERE term_id=".$V['term_id'];
- $res=$wpdb->get_row($query);
- $OriginalTerm=$res->name;
- $NewTerm=$V['name'];
- $q1="UPDATE ".$wpdb->terms." SET name='$NewTerm' WHERE term_id=".$V['term_id'];
- $wpdb->query($q1);
- $q1="UPDATE $termtrans SET name='$OriginalTerm', LanguageID='$OldLang' WHERE LanguageID='$DefLang' and term_id=".$V['term_id'];
-
- $wpdb->query($q1);
- }
- echo '<p>'.__('Default Languages Exchanged','zd_multilang').'</p>';
- }
- echo '<p>'.__('Options updated','zd_multilang').'</p>';
- echo '</div>';
- }
- $query="SELECT * FROM $language_table order by LanguageName";
- $Languages=$wpdb->get_results($query, ARRAY_A);
- $DefaultLanguage=get_option($default_language_option);
- $InsertInPosts=get_option($insert_lang_switch_option);
- $ShowLanguages=get_option($show_languages_option);
- $ShowFlags=get_option($show_flags_option);
- $SwitcherPosition=get_option('zd_multilang_position');
- $DisplayUntranslated=get_option($display_untranslated);
- $DisplayGlink=get_option($display_google_translate);
- $DisplayOriginal=get_option($display_original_option);
- $Lang_Switch_Class=(get_option($lang_switcher_class_option)!="") ? get_option($lang_switcher_class_option) : "lang_switch";
- $Allowed_Access_Level=get_option($Allowed_Access);
- $Autosave=get_option($Autosave_Option);
-
- echo '<style>
- td select { width: 150px;}
- td input { width: 150px;}
- </style>';
-
- echo "\n\t<h2>".__('General Options','zd_multilang')."</h2>";
- echo "\n\t".'<form action="'.$BaseURL.'" method="post">';
- echo "\n\t".'<input type="hidden" name="'.$hidden_field.'" value="update" />';
- echo "\n\t".'<input type="hidden" name="fct" value="options" />';
- echo "\n\t".'<table class="form-table">';
- echo "\n\t\t<tr><td width=\"400\">".__('Level required to translate items','zd_multilang')."</td><td>";
- echo '<select name="access_level">';
- echo '<option value="0"';if ($Allowed_Access_Level=="0") echo ' selected="selected"';echo '>'.__('Subscriber').'</option>';
- echo '<option value="1"';if ($Allowed_Access_Level=="1") echo ' selected="selected"';echo '>'.__('Contributor').'</option>';
- echo '<option value="2"';if ($Allowed_Access_Level=="2") echo ' selected="selected"';echo '>'.__('Author').'</option>';
- echo '<option value="7"';if ($Allowed_Access_Level=="7") echo ' selected="selected"';echo '>'.__('Editor').'</option>';
- echo '<option value="10"';if ($Allowed_Access_Level=="10") echo ' selected="selected"';echo '>'.__('Administrator').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Default Language','zd_multilang')."</td><td>";
- echo '<select name="def_lang" onchange="getElementById(\'hidden_option\').style.display=\'table-row\';">';
- if ($Languages) foreach ($Languages as $Index => $Values) {
- echo '<option value="'.$Values['LanguageID'].'"';
- if ($DefaultLanguage==$Values['LanguageID']) echo ' selected="selected"';
- echo '>'.$Values['LanguageName'].'</option>';
- }
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr id=\"hidden_option\" style=\"display: none;\"><td>".__('Exchange Languages','zd_multilang')."<br /><small>".__('Only use this option if you want to switch old default language with new one. This will exchange translations between them','zd_multilang')."</small></td><td>";
- echo '<input type="checkbox" name="exchange_lang">';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Display Original post while translating','zd_multilang')."</td><td>";
- echo '<select name="display_original">';
- echo '<option value="yes"';if ($DisplayOriginal=="yes") echo ' selected="selected"';echo '>'.__('Yes','zd_multilang').'</option>';
- echo '<option value="no"';if ($DisplayOriginal=="no") echo ' selected="selected"';echo '>'.__('No','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Automatically save translation every 5 minutes','zd_multilang')."</td><td>";
- echo '<select name="autosave">';
- echo '<option value="yes"';if ($Autosave=="yes") echo ' selected="selected"';echo '>'.__('Yes','zd_multilang').'</option>';
- echo '<option value="no"';if ($Autosave=="no") echo ' selected="selected"';echo '>'.__('No','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Generate permalink for Default language','zd_multilang')."</td><td>";
- echo '<select name="permalink_for_default">';
- echo '<option value="yes"';if ($PermalinkDef=="yes") echo ' selected="selected"';echo '>'.__('Yes','zd_multilang').'</option>';
- echo '<option value="no"';if ($PermalinkDef=="no") echo ' selected="selected"';echo '>'.__('No','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Keep separate comments for each language','zd_multilang')."</td><td>";
- echo '<select name="keep_separate_comments">';
- echo '<option value="yes"';if ($KeepSeparateComments=="yes") echo ' selected="selected"';echo '>'.__('Yes','zd_multilang').'</option>';
- echo '<option value="no"';if ($KeepSeparateComments=="no") echo ' selected="selected"';echo '>'.__('No','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Display untranslated posts','zd_multilang')."</td><td>";
- echo '<select name="display_untranslated">';
- echo '<option value="show"';if ($DisplayUntranslated=="show") echo ' selected="selected"';echo '>'.__('Show','zd_multilang').'</option>';
- echo '<option value="hide"';if ($DisplayUntranslated=="hide") echo ' selected="selected"';echo '>'.__('Hide','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('If Yes, display link "Translate Original post with Google Translate"','zd_multilang')."</td><td>";
- echo '<select name="display_glink">';
- echo '<option value="show"';if ($DisplayGlink=="show") echo ' selected="selected"';echo '>'.__('Show','zd_multilang').'</option>';
- echo '<option value="hide"';if ($DisplayGlink=="hide") echo ' selected="selected"';echo '>'.__('Hide','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo '</table>';
- echo '<br /><h2>'.__('Language Switcher','zd_multilang').'</h2>';
- echo "\n\t".'<table class="form-table">';
- echo "\n\t\t<tr><td width=\"400\">".__('Show Language Switcher in post','zd_multilang')."</td><td>";
- echo '<select name="show_language_switcher">';
- echo '<option value="show"';if ($InsertInPosts=="show") echo ' selected="selected"';echo '>'.__('Show','zd_multilang').'</option>';
- echo '<option value="hide"';if ($InsertInPosts=="hide") echo ' selected="selected"';echo '>'.__('Hide','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Language Switcher Position','zd_multilang')."</td><td>";
- echo '<select name="language_switcher_position">';
- echo '<option value="top"';if ($SwitcherPosition=="top") echo ' selected="selected"';echo '>'.__('Top','zd_multilang').'</option>';
- echo '<option value="footer"';if ($SwitcherPosition=="footer") echo ' selected="selected"';echo '>'.__('Bottom','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Show Language names in switcher','zd_multilang')."</td><td>";
- echo '<select name="show_languages">';
- echo '<option value="show"';if ($ShowLanguages=="show") echo ' selected="selected"';echo '>'.__('Show','zd_multilang').'</option>';
- echo '<option value="hide"';if ($ShowLanguages=="hide") echo ' selected="selected"';echo '>'.__('Hide','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Show Flags in switcher','zd_multilang')."</td><td>";
- echo '<select name="show_flags">';
- echo '<option value="show"';if ($ShowFlags=="show") echo ' selected="selected"';echo '>'.__('Show','zd_multilang').'</option>';
- echo '<option value="hide"';if ($ShowFlags=="hide") echo ' selected="selected"';echo '>'.__('Hide','zd_multilang').'</option>';
- echo '</select>';
- echo "</td></tr>"; echo "\n\t\t<tr><td>".__('Language Switcher CSS class','zd_multilang')."</td><td>";
- echo '<input name="lang_switch_class" value="'.$Lang_Switch_Class.'">';
- echo "</td></tr>";
- echo "\n\t".'</table>';
- echo "\n\t".'<p class="submit"><input class="button" type="submit" value="'.__('Update options','zd_multilang').'" name="submit"/></p>';
- echo "\n".'</form>';
-}
-
-function zd_multilang_edit_language() {
- global $wpdb, $BaseURL,$default_language_option, $BaseURL, $PluginDIR, $wp_rewrite;
- global $ZdmlCache;
- $language_table= $wpdb->prefix.'zd_ml_langs';
- $hidden_field="zd_multilang_edit_language";
-
-
- if ($_POST[$hidden_field]) {
- $Action=$_POST[$hidden_field];
- $LangCode=$_POST['lang_code'];
- $LangName=$_POST['lang_name'];
- $LangPermalink=$_POST['lang_permalink'];
- $BlogName=$_POST['blog_name'];
- $BlogDesc=$_POST['blog_description'];
- echo '<div id="message" class="updated fade"><p>';
- if ($Action=="edit") {
- $query="UPDATE $language_table set LanguageName='$LangName',LangPermalink='$LangPermalink', BlogName='$BlogName', BlogDescription='$BlogDesc' WHERE LanguageID='$LangCode'";
- $wpdb->query($query);
- if ($_POST['def_lang']=="on") update_option($default_language_option,$LangCode);
- echo __('Language Edited','zd_multilang');
- }
- echo '</p></div>';
- zd_multilang_languages();
- return;
- }
- $DefaultLanguage=$ZdmlCache['DefLang'];
- $Code=$_GET['lang'];
- $query="SELECT * FROM $language_table where LanguageID='$Code'";
- $row=$wpdb->get_row($query, ARRAY_A);
-
- echo "<h2>".__('Languages','zd_multilang').'</h2><br />';
- echo "<h3>".__('Edit Language','zd_multi').' <em>'.$_GET['lang'].'</em></h3>';
- echo "\n\t".'<form action="'.$BaseURL.'" method="post">';
- echo "\n\t".'<input type="hidden" name="lang_code" value="'.$Code.'" />';
- echo "\n\t".'<input type="hidden" name="'.$hidden_field.'" value="edit" />';
- echo "\n\t".'<input type="hidden" name="fct" value="edit" />';
- echo "\n\t".'<table>';
- echo "\n\t\t<tr><td>".__('Language Name','zd_multilang')."</td><td>";
- echo '<input type="text" name="lang_name" value="'.$row['LanguageName'].'">';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Language Permalink','zd_multilang')."</td><td>";
- echo '<input type="text" name="lang_permalink" value="'.$row['LangPermalink'].'">';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Blog name','zd_multilang')."</td><td>";
- echo '<input type="text" name="blog_name" value="'.$row['BlogName'].'">';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Blog description','zd_multilang')."</td><td>";
- echo '<input type="text" name="blog_description" value="'.$row['BlogDescription'].'">';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Default Language','zd_multilang')." ?</td><td>";
- if ($row['LanguageID']==$DefaultLanguage) $selected='checked="on"';
- else $selected="";
- echo '<input type="checkbox" name="def_lang" '.$selected.'>';
- echo "</td></tr>";
- echo "\n\t".'</table>';
- echo "\n\t".'<p class="submit"><input class="button" type="submit" value="'.__('Edit Language','zd_multilang').'" name="submit"/></p>';
- echo "\n\t</form>";
-}
-
-function zd_multilang_languages() {
- global $ZdmlCache;
- global $wpdb, $BaseURL,$default_language_option, $BaseURL, $PluginDIR, $wp_rewrite;
- $language_table= $wpdb->prefix.'zd_ml_langs';
-
- $hidden_field="zd_multilang_add_language";
-
- echo "<h2>".__('Languages','zd_multilang').'</h2><br />';
-
- if ($_POST[$hidden_field]) {
- $Action=$_POST[$hidden_field];
- $LangCode=$_POST['lang_code'];
- $LangName=$_POST['lang_name'];
- $LangPermalink=$_POST['lang_permalink'];
- echo '<div id="message" class="updated fade"><p>';
- if ($Action=="add") {
- $query="INSERT INTO $language_table VALUES ('$LangCode','$LangName','$LangPermalink',NULL,NULL)";
- $wpdb->query($query);
- if ($_POST['def_lang']=="on") update_option($default_language_option,$LangCode);
- echo __('Language Added','zd_multilang');
- }
- echo '</p></div><br />';
- }
-
- $DefaultLanguage=$ZdmlCache['DefLang'];
- $query="SELECT * FROM $language_table order by LanguageName";
- $Languages=$wpdb->get_results($query, ARRAY_A);
- if ($Languages) {
- echo '<table class="widefat">';
- echo '<tr style="background: #E4F2FD";><th>'.__('Action','zd_multilang').'</th><th>'.__('Language Name','zd_multilang').'</th><th>'.__('Language Code','zd_multilang').'</th><th>'.__('Permalink','zd_multilang').'</th><th>'.__('Default','zd_multilang').'</th></tr>';
- foreach ($Languages as $Index => $Values) {
- echo '<tr>';
- echo '<td><span class="edit_language"><a href="'.$BaseURL.'&fct=edit&lang='.$Values['LanguageID'].'">'.__('Edit','zd_multilang').'</a> - <a href="'.$BaseURL.'&fct=delete&lang='.$Values['LanguageID'].'">'.__('Delete','zd_multilang').'</a></span></td>';
- echo '<td><img src="'.$PluginDIR.'/flags/'.$Values['LanguageID'].'.png"> '.$Values['LanguageName'].'</td>';
- echo '<td>'.$Values['LanguageID'].'</td>';
- echo '<td>'.$Values['LangPermalink'].'</td>';
- echo '<td> ';
- if ($Values['LanguageID']==$DefaultLanguage) echo "<strong>".__('Default Language', 'zd_multilang')."</strong>";
- echo '</td>';
- echo '</tr>';
- }
- echo '</table>';
- }
-
- echo "<div id=\"form\" style=\"float: left; margin-right: 30px;\"><h3>".__('Add Language','zd_multilang').'</h3>';
- echo "\n\t".'<form action="'.$BaseURL.'" method="post">';
- echo "\n\t".'<input type="hidden" name="'.$hidden_field.'" value="add" />';
- echo "\n\t".'<input type="hidden" name="fct" value="languages" />';
- echo "\n\t".'<table>';
- echo "\n\t\t<tr><td>".__('Language Name','zd_multilang')."</td><td>";
- echo '<input type="text" name="lang_name" id="lang_name">';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Language Code','zd_multilang')."</td><td>";
- echo '<input type="text" name="lang_code" id="lang_code">';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Language Permalink','zd_multilang')."</td><td>";
- echo '<input type="text" name="lang_permalink" id="lang_permalink">';
- echo "</td></tr>";
- echo "\n\t\t<tr><td>".__('Default Language','zd_multilang')." ?</td><td>";
- echo '<input type="checkbox" name="def_lang">';
- echo "</td></tr>";
- echo "\n\t".'</table>';
- echo "\n\t".'<p class="submit"><input class="button" type="submit" value="'.__('Add Language','zd_multilang').'" name="submit"/></p>';
- echo "\n\t</form></div><p><a href=\"#\" onclick=\"jQuery('div#help').toggle();\">".__('Show/Hide Available default codes','zd_multilang')."</a></p>";
-
- $DefaultLanguagesCodes=array (
- 'ar' => array ('Arabian', 'ar'),'bn_BD' => array ('Bengali','bn'),'be_BY' => array ('Belarusian','be'),
- 'bg_BG' => array ('Bulgarian','bg'),'ca' => array ('Catalan','ca'),'zh_CN' => array ('Chinese','cn'),
- 'zh_HK' => array ('Hong Kong','hk'),'zh_TW' => array ('Taiwan','tw'),'hr' => array ('Croatian','hr'),
- 'cz_CZ' => array ('Czech','cz'),'da_DK' => array ('Danish','dk'),'nl_NL' => array ('Dutch','nl'),
- 'en_US' => array ('English','en'),'eu' => array ('Euskadi','eu'),'eo' => array ('Esperanto','eo'),
- 'et' => array ('Estonian','et'),'fo' => array ('Faroe','fo'),'fi_FI' => array ('Finnish','fi'),
- 'fr_FR' => array ('French','fr'),'gl_ES' => array ('Galician','gl'),'de_DE' => array ('German','de'),
- 'el' => array ('Greek','gr'),'he_IL' => array ('Hebrew','il'),'hu_HU' => array ('Hungarian','hu'),
- 'is_IS' => array ('Icelandic','is'),'id_ID' => array ('Indonesian','id'),'it_IT' => array ('Italian','it'),
- 'ja' => array ('Japanese','jp'),'km_KH' => array ('Khmer','km'),'ko_KR' => array ('Korean','ko'),
- 'ku' => array ('Kurdish','ku'),'lv' => array ('Latvian','lv'),'lt' => array ('Lithuanian','lt'),
- 'mk_MK' => array ('Macedonian','mk'),'mg_MG' => array ('Malgasy','mg'),'ms_MY' => array ('Malay','my'),
- 'nb_NO' => array ('Norwegian','no'),'pl_PL' => array ('Polish','pl'),'pt_BR' => array ('Brazilian Portuguese','br'),
- 'pt_PT' => array ('European Portuguese','pt'),'ro' => array ('Romanian','ro'),'ru_RU' => array ('Russian','ru'),
- 'sr_RS' => array ('Serbian','sr'),'si_LK' => array ('Sinhala','lk'),'sl_SI' => array ('Slovenian','sl'),
- 'sk' => array ('Slovak','sk'),'es_ES' => array ('Spanish','es'),'sv_SE' => array ('Swedish','se'),
- 'th' => array ('Thai','th'),'tr' => array ('Turkish','tr'),'ua_UA' => array ('Ukrainian','ua'),
- 'uz_UZ' => array ('Uzbek','uz'),'vi_VN' => array ('Vietnamse','vn'),'cy' => array ('Welsh','cy')
- );
-
- echo '<div id="help" style="height: 300px; overflow: auto !important; display: none;">
- <table>
- <tr><th width="16">Flag</th><th width="200">'.__('Language Name','zd_multilang').'</th><th>'.__('Language Permalink','zd_multilang').'</th><th>'.__('Language Code','zd_multilang').'</th></tr>';
- foreach ($DefaultLanguagesCodes as $lang_code => $v) {
- echo '<tr><td><img src="'.$PluginDIR.'/flags/'.$lang_code.'.png" alt="'.$v[0].'" title="'.$v[0].'" onclick="zdml_fillInfos(\''.$v[0].'\',\''.$lang_code.'\',\''.$v[1].'\');"/></td><td><a href="javascript:zdml_fillInfos(\''.$v[0].'\',\''.$lang_code.'\',\''.$v[1].'\')">'.$v[0].'</a></td><td>'.$v[1].'</td><td>'.$lang_code.'</td></tr>';
- }
- echo ' </table>
-</div>
-<script type="text/javascript">
- function zdml_fillInfos(name, code, permalink) {
- document.getElementById("lang_name").value=name;
- document.getElementById("lang_code").value=code;
- document.getElementById("lang_permalink").value=permalink;
- }
-</script>';
-
- $wp_rewrite->flush_rules();
-}
-
-function zd_multilang_delete_language() {
- global $ZdmlCache;
- global $BaseURL, $wpdb,$default_language_option;
- $DefaultLanguage=$ZdmlCache['DefLang'];
-
- $language_table= $wpdb->prefix.'zd_ml_langs';$termtrans_table = $wpdb->prefix.'zd_ml_termtrans';
- $LangCode=$_GET['lang'];
- $query="DELETE FROM $language_table WHERE LanguageID='$LangCode'";
- $wpdb->query($query);
- $query="DELETE FROM $termtrans_table WHERE LanguageID='$LangCode'";
- $wpdb->query($query);
-
- echo '<br /><div id="message" class="updated fade"><p>';
- echo __('Language deleted','zd_multilang');
- echo '</p></div>';
- zd_multilang_languages();
-}
-
-function zd_multilang_post_translations() {
- global $ZdmlCache;
- global $BaseURL, $wpdb,$default_language_option,$PluginDIR, $display_original_option;
- $language_table= $wpdb->prefix.'zd_ml_langs';
- $termtrans_table = $wpdb->prefix.'zd_ml_termtrans';
- $posttrans=$wpdb->prefix.'zd_ml_trans';
- $hidden_field="zd_multilang_edit_translation";
-
- $Autosave=get_option('zdmultilang_autosave');
-
- echo "<h2>".__('Posts & Pages','zd_multilang').'</h2>';
-
- $query="SELECT * FROM $language_table order by LanguageName";
- $Languages=$wpdb->get_results($query, ARRAY_A);
- if (!$Languages) {
- echo '<p>'.__('No languages defined, please define some first','zd_multilang').'</p>';
- return;
- }
- $DefaultLanguage=$ZdmlCache['DefLang'];
-
- if ($_POST['id']) {
- list($ID, $Lang) = split("\.",$_POST['id']);
- $Content=$_POST['content'];
- $Title=$_POST['post_title'];
- $Status=$_POST['post_status'];
- $Excerpt=$_POST['post_excerpt'];
- $var=$wpdb->get_var("SELECT ID from $posttrans WHERE ID='$ID' and LanguageID='$Lang'");
- if ($var==$ID) {
- $query="UPDATE $posttrans set post_content='$Content', post_title='$Title', post_status='$Status', post_excerpt='$Excerpt' WHERE ID='$ID' and LanguageID='$Lang'";
- } else $query="INSERT INTO $posttrans (`ID`, `LanguageID`, `post_content`, `post_title`, `post_status`, `post_excerpt`) values ('$ID', '$Lang', '$Content', '$Title','$Status', '$Excerpt')";
- $wpdb->query($query);
- echo '<div id="message" class="updated fade"><p>';
- echo __('Post or Page updated','zd_multilang');
- echo '</p></div><br />';
- $_GET['id']=$_POST['id'];
- }
- if ($_GET['id']) {
- list($ID, $Lang) = split('\.', $_GET['id']);
- $query='SELECT * FROM '.$wpdb->prefix.'posts WHERE ID='.$ID;
- $res=$wpdb->get_results($query);
- $OriginalText=str_replace(array("\r","\n"),array ("",""), strip_tags($res[0]->post_content));
- $OriginalPost=$res[0]->post_content;
- echo '<div id="poststuff">';
- $query="SELECT * FROM $posttrans WHERE LanguageID='$Lang' and ID=".$ID;
- $res=$wpdb->get_results($query, ARRAY_A);
-
- if ($res[0]['post_status']==NULL) $res[0]['post_status']='draft';
-
- $From=array_search($DefaultLanguage,$ZdmlCache['Languages']);
- $To=array_search($Lang,$ZdmlCache['Languages']);
-
- echo '<form action="'.$BaseURL.'" method="post">';
- echo '<input type="hidden" name="fct" value="posts" />';
- echo '<input type="hidden" name="id" value="'.$_GET['id'].'" />';
- echo '<div id="poststuff" class="metabox-holder has-right-sidebar">';
- echo '<div id="side-info-column" class="inner-sidebar submitbox">
- <div id="side-sortables" class="meta-box-sortables ui-sortable" style="position: relative;">
- <div id="submitpost" class="postbox inside">
- <p><strong><label for="post_status">'.__('Translation Status','zd_multilang').'</label></strong></p>
- <p>
- <select tabindex="4" id="post_status" name="post_status">
- <option value="published"';if ($res[0]['post_status']=="published") echo ' selected="selected"';echo '>'.__('Published','zd_multilang').'</option>
- <option value="draft"';if ($res[0]['post_status']=="draft") echo ' selected="selected"';echo '>'.__('Draft','zd_multilang').'</option>
- </select>
- </p>
- <p id="autosave_status" style="display: none;"><strong>Post autosaved</strong></p>
- </div>
- <p class="submit">
- <input type="submit" class="button button-highlighted" tabindex="4" value="Save" id="save-post" name="save"/>
- <br class="clear"/>
- </p>
- <div class="side-info">
- <h5>'.__('Actions','zd_multilang').'</h5>
- <ul>
- <li><a href="post.php?action=edit&post='.$ID.'" target="_blank">'.__('See Original post','zd_multilang').'</a></li>
- <li><a href="http://translate.google.com/translate_t#'.$From.'|'.$To.'|'.addslashes(htmlentities($OriginalText,ENT_COMPAT,'UTF-8')).'" target="_blank">'.__('See translation in Google Translate','zd_multilang').'</a></li>
- </ul>
- <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
-<input type="hidden" name="cmd" value="_s-xclick">
-<input type="hidden" name="hosted_button_id" value="8262513">
-<input type="image" src="https://www.paypal.com/en_US/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
-<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
-</form>
- </div>
- </div>';
- echo '</div>';
-
- echo '<div id="post-body" class="has-sidebar">';
- echo '<div id="post-body-content" class="has-sidebar-content">';
- echo '<div id="titlediv"><h3>'.__('Title','zd_multilang').'</h3>';
- echo '<div id="titlewrap"><input id="title" type="text" autocomplete="off" tabindex="1" size="30" name="post_title" value="'.$res[0]['post_title'].'"></div>';
- echo '</div>';
- echo '<div id="';echo user_can_richedit() ? 'postdivrich' : 'postdiv';echo '" class="postarea">';
- echo '<h3>'.__('Translations','zd_multilang').'</h3>';
- echo '<input type="hidden" id="user-id" name="user_ID" value="'.$user_ID.'" />';
- the_editor($res[0]['post_content']);
- echo '</div>';
- echo '<div id="titlediv" style="margin-bottom: 0px;"><h3>'.__('Excerpt','zd_multilang').'</h3></div>
- <div id="tr_excerpt" class="postarea">
- <textarea id="post_excerpt" name="post_excerpt" style="width: 98%; height: 150px;">'.$res[0]['post_excerpt'].'</textarea>
- </div>';
- $DisplayOriginal=get_option($display_original_option);
- if ($DisplayOriginal=='yes') {
- $OriginalPost = apply_filters('the_content', $OriginalPost);
- $OriginalPost = str_replace(']]>', ']]>', $OriginalPost);
- echo '<div id="titlediv" style="margin-bottom: 0px;"><h3>'.__('Original post','zd_multilang').'</h3></div>
- <div style="border:1px solid #CCCCCC; padding: 5px;overflow: auto; height: 300px;">'.$OriginalPost.'</div>';
- }
- echo '</div>';
- echo '</div>';
- if ($Autosave=='yes') {
- wp_print_scripts('sack');
- echo '<script type="text/javascript">
- setTimeout(\'zdml_autosave();\',300000);
- function zdml_autosave() {
- content=tinyMCE.activeEditor.getContent();
- var mysack = new sack("'.get_bloginfo( 'wpurl' ).'/wp-admin/admin-ajax.php" );
- if (jQuery(\'#post_status\').val()=="published") return;
- mysack.execute = 1;
- mysack.method = \'POST\';
- mysack.setVar( "id", \''.$_GET['id'].'\' );
- mysack.setVar( "content", content );
- mysack.setVar( "action", "zdmultilang_autosave" );
- mysack.setVar( "post_title", jQuery(\'#title\').val() );
- mysack.setVar( "post_status", jQuery(\'#post_status\').val() );
- mysack.setVar( "post_excerpt", jQuery(\'#post_excerpt\').val() );
- mysack.onError = function() { alert(\'Ajax error in outlink collection\' )};
- mysack.runAJAX();
- setTimeout(\'zdml_autosave();\',300000);
- }
- </script>';
- }
- echo '<br class="clear" />
- </div>';
- echo '</form>';
- } else if ($_GET['tr']) {
- switch ($_GET['tr']) {
- case 'posts':
- $query='SELECT * FROM '.$wpdb->prefix.'posts WHERE post_type="post" order by post_status, post_date desc';
- break;
- case 'pages':
- $query='SELECT * FROM '.$wpdb->prefix.'posts WHERE post_type="page" order by post_status, post_date desc';
- break;
- default:
- $query="";
- break;
- }
-
- $q="SELECT * from $posttrans order by ID";
- $Translated=$wpdb->get_results($q, ARRAY_A);
- if ($Translated) foreach ($Translated as $Idx => $Row) {
- $Posts[$Row['ID']][$Row['LanguageID']]=$Row['post_status'];
- }
-
- $results=$wpdb->get_results($query, ARRAY_A);
- if ($results) {
- echo '<table class="widefat">';
- echo '<tr style="background: rgb(228, 242, 253);"><th>'.__('Original title','zd_multilang').'</th><th>'.__('Published date', 'zd_multilang').'</th>';
- foreach ($Languages as $Lang) {
- if ($Lang['LanguageID']!=$DefaultLanguage) echo '<td><img src="'.$PluginDIR.'/flags/'.$Lang['LanguageID'].'.png" alt="'.$Lang['LanguageName'].'"></td>';
- }
- echo '</tr>';
- foreach ($results as $ID => $row) {
- echo '<tr>';
- echo '<td><a href="post.php?action=edit&post='.$row['ID'].'">'.$row['post_title'].'</a></td>';
- echo '<td>'.date_i18n(get_option('date_format').' - '.get_option('time_format'),strtotime($row['post_date'])).'</td>';
- foreach ($Languages as $Lang) {
- if ($Lang['LanguageID']!=$DefaultLanguage) {
- echo '<td><a href="'.$BaseURL.'&fct=posts&id='.$row['ID'].'.'.$Lang['LanguageID'].'">';
- if ($Posts[$row['ID']][$Lang['LanguageID']]) echo '<img src="'.$PluginDIR.'/images/edit.png" style="vertical-align: middle;" /> '.__($Posts[$row['ID']][$Lang['LanguageID']],'zd_multilang');
- else echo '<img src="'.$PluginDIR.'/images/add.png" style="vertical-align: middle;" /> '.__('Translate','zd_multilang');
- echo '</a></td>';
- }
- }
- echo '</tr>';
- }
- echo '</table>';
- }
- } else {
- $query="SELECT distinct(ID) from $posttrans";
- $res=$wpdb->get_results($query);
- foreach ($res as $Line) {
- $count++;
- }
- printf(__('%d posts or pages are translated','zd_multilang'),$count);
- }
-}
-
-function zd_multilang_autosave() {
- global $wpdb;
- $posttrans=$wpdb->prefix.'zd_ml_trans';
- list($ID, $Lang) = split("\.",$_POST['id']);
- $Content=$_POST['content'];
- $Title=$_POST['post_title'];
- $Status=$_POST['post_status'];
- $Excerpt=$_POST['post_excerpt'];
- $var=$wpdb->get_var("SELECT ID from $posttrans WHERE ID='$ID' and LanguageID='$Lang'");
- if ($var==$ID) {
- $query="UPDATE $posttrans set post_content='$Content', post_title='$Title', post_status='$Status', post_excerpt='$Excerpt' WHERE ID='$ID' and LanguageID='$Lang'";
- } else $query="INSERT INTO $posttrans (`ID`, `LanguageID`, `post_content`, `post_title`, `post_status`, `post_excerpt`) values ('$ID', '$Lang', '$Content', '$Title','$Status', '$Excerpt')";
- $wpdb->query($query);
- die ('jQuery(\'#autosave_status\').html("<strong>Transaltion has been automatically saved at '.strftime("%H:%M on %Y/%m/%d").'</strong>");
- jQuery(\'#autosave_status\').show();');
-}
-
-function zd_multilang_link_translations() {
- global $ZdmlCache, $locale;
- global $BaseURL, $wpdb,$default_language_option,$PluginDIR;
- $language_table= $wpdb->prefix.'zd_ml_langs';
- $termtrans_table = $wpdb->prefix.'zd_ml_termtrans';
- $linktrans=$wpdb->prefix.'zd_ml_linktrans';
- $hidden_field="zd_multilang_edit_link";
-
- echo "<h2>".__('Links','zd_multilang').'</h2>';
- $DefLang=get_option($default_language_option);
- if (isset($_POST['link_id'])) {
- $_GET['link_id']=$_POST['link_id'];
- $url=$_POST['link_url'];
- $name=$_POST['link_name'];
- $description=$_POST['link_description'];
- $Language=$_POST['lng'];
- $link_id=$_POST['link_id'];
- $check="SELECT count(*) from $linktrans where link_id=$link_id and LanguageID='$Language'";
- $res=$wpdb->get_var($check);
- if ($res) $query="UPDATE $linktrans set link_name='$name', link_url='$url', link_description='$description' WHERE link_id=$link_id and LanguageID='$Language'";
- else $query="INSERT INTO $linktrans VALUES ($link_id, '$Language', '$url', '$name', '$description')";
- $wpdb->query($query);
- }
- if (isset($_GET['link_id'])) {
- $Language=$_GET['lng'];
- $link_id=$_GET['link_id'];
- $query="SELECT l.link_id, lt.link_url, lt.link_name, lt.link_description, lt.LanguageID, l.link_url o_url, l.link_name o_name, l.link_description o_desc FROM $linktrans lt RIGHT JOIN $wpdb->links l on (l.link_id=lt.link_id) where l.link_id=$link_id";
- $results=$wpdb->get_results($query);
- $found=0;
- if ($results) {
- foreach ($results as $Link) {
- if ($Link->LanguageID==$Language) {
- $found=1;
- break;
- }
- }
- if (!$found) {
- $Link->link_name="";
- $Link->link_url="";
- $Link->link_description="";
- }
- echo '<table class="widefat">
- <tr>
- <td><img src="'.$PluginDIR.'/flags/'.$DefLang.'.png" /></td>
- <td>'.$Link->o_name.'</td>
- <td>'.$Link->o_url.'</td>
- <td>'.$Link->o_desc.'</td>
- </tr>
- </table>';
- echo '<form action="" method="post">
- <input type="hidden" name="link_id" value="'.$link_id.'" />
- <input type="hidden" name="lng" value="'.$Language.'" />
- <label for="link_name"><img src="'.$PluginDIR.'/flags/'.$Language.'.png" /> '.__('Name','zd_multilang').'</label><input type="text" id="link_name" name="link_name" value="'.$Link->link_name.'" />
- <label for="link_url"><img src="'.$PluginDIR.'/flags/'.$Language.'.png" /> '.__('URL','zd_multilang').'</label><input type="text" id="link_url" name="link_url" value="'.$Link->link_url.'" />
- <label for="link_description"><img src="'.$PluginDIR.'/flags/'.$Language.'.png" /> '.__('Description','zd_multilang').'</label><input type="text" id="link_description" name="link_description" value="'.$Link->link_description.'" />
- <p style="text-align: right;"><input type="submit" class="button" value="'.__('Translate','zd_multilang').'" /></p>
- </form>';
- }
- } else {
- $query="SELECT l.link_id, lt.LanguageID, lt.link_name, l.link_url o_url, l.link_name o_name FROM $linktrans lt RIGHT JOIN $wpdb->links l on (l.link_id=lt.link_id)";
- $results=$wpdb->get_results($query);
- if ($results)
- foreach ($results as $row) {
- $Link[$row->link_id]['name_'.$row->LanguageID]=$row->link_name;
- $Link[$row->link_id]['o_name']=$row->o_name;
- $Link[$row->link_id]['o_url']=$row->o_url;
- }
-
- echo '<table class="widefat">';
- echo '<tr><th><img src="'.$PluginDIR.'/flags/'.$DefLang.'.png" /> '.__('Original Link','zd_multilang').'</th>';
- foreach ($ZdmlCache['Languages'] as $LanguageID => $Lang) {
- if ($Lang!=$DefLang) echo '<th><img src="'.$PluginDIR.'/flags/'.$Lang.'.png" /> '.$ZdmlCache['LanguageNames'][$LanguageID].'</th>';
- }
- echo '</tr>';
- if ($Link)
- foreach ($Link as $link_id => $L) {
- echo '<tr>';
- echo '<td><a href="'.$L['o_url'].'" title="'.$L['o_url'].'">'.$L['o_name'].'</a></td>';
- foreach ($ZdmlCache['Languages'] as $LanguageID => $Lang) {
- if ($Lang!=$DefLang) echo '<td><a href="'.$BaseURL.'&fct=links&link_id='.$link_id.'&lng='.$Lang.'"><img src="'.$PluginDIR.'/images/edit.png" style="vertical-align: middle;"/> '.__('Translate','zd_multilang').'</a></td>';
- }
- echo '</tr>';
- }
- echo '</table>';
- }
-}
-
-function zd_multilang_term_translations() {
- global $ZdmlCache;
- global $BaseURL, $wpdb,$default_language_option,$PluginDIR;
- $language_table= $wpdb->prefix.'zd_ml_langs';
- $termtrans_table = $wpdb->prefix.'zd_ml_termtrans';
- $hidden_field="zd_multilang_edit_translation";
-
- echo "<h2>".__('Translations','zd_multilang').'</h2>';
- $Option=$_GET['tr'];
- $DefaultLanguage=$ZdmlCache['DefLang'];
-
- $query="SELECT * FROM $language_table order by LanguageName";
- $Languages=$wpdb->get_results($query, ARRAY_A);
- if (!$Languages) {
- echo '<p>'.__('No languages defined, please define some first','zd_multilang').'</p>';
- return;
- }
-
- if ($_POST[$hidden_field]=="update") {
- $termid=$_POST['term_id'];
- $Option=$_POST['tr'];
- foreach ($Languages as $Lang) {
- if ($Lang['LanguageID']!=$DefaultLanguage) {
- $LangID=$Lang['LanguageID'];
- $Translation=$_POST[$termid."_".$LangID];
- $Desc=$_POST['desc_'.$termid."_".$LangID];
- $query="SELECT name FROM $termtrans_table WHERE LanguageID='$LangID' and term_id='$termid' ";
- $oldvalue=$wpdb->get_var($query);
- if ($oldvalue) {
- $query="UPDATE $termtrans_table set name='$Translation', description='$Desc' where term_id=$termid and LanguageID='$LangID'";
- } else {
- if ($Translation) $query="INSERT INTO $termtrans_table VALUES ('$termid','$LangID','$Translation', '$Desc')";
- }
- $wpdb->query($query);
- $_GET['id']=$termid;
- }
- }
- }
-
- if ($_GET['id']) {
- $term_id=$_GET['id'];
- $query="SELECT t.name, tt.term_id, tt.description FROM ".$wpdb->prefix."term_taxonomy tt, ".$wpdb->prefix."terms t WHERE t.term_id=tt.term_id and t.term_id=".$term_id." order by name";
- $res=$wpdb->get_row($query, ARRAY_A);
-
- $query="SELECT * FROM $termtrans_table WHERE term_id=$term_id";
- $Trans=$wpdb->get_results($query, ARRAY_A);
- if ($Trans) foreach ($Trans as $Values) {
- $Translations[$Values['LanguageID']]['term']=$Values['name'];
- $Translations[$Values['LanguageID']]['desc']=$Values['description'];
- }
-
- echo '<form action="'.$BaseURL.'" method="post">';
- echo "\n\t".'<input type="hidden" name="'.$hidden_field.'" value="update" />';
- echo "\n\t".'<input type="hidden" name="fct" value="translations" />';
- echo "\n\t".'<input type="hidden" name="tr" value="'.$_GET['tr'].'" />';
- echo "\n\t".'<input type="hidden" name="term_id" value="'.$term_id.'" />';
-
- echo "\n\t".'<table style="width:100%">';
- echo '<tr><td><strong>'.__('Original Term','zd_multilang').'</strong></td><td><strong>'.$res['name'].'</strong></td><td><strong>'.$res['description'].'</strong></td></tr>';
- foreach ($Languages as $Lang) {
- if ($Lang['LanguageID']!=$DefaultLanguage) {
- echo '<tr>';
- echo '<td>'.$Lang['LanguageName'].'</td>';
- echo '<td><input type="text" name="'.$term_id.'_'.$Lang['LanguageID'].'" size="50" value="'.$Translations[$Lang['LanguageID']]['term'].'" /></td>';
- echo '<td><textarea name="desc_'.$term_id.'_'.$Lang['LanguageID'].'" rows="4" cols="50">'.$Translations[$Lang['LanguageID']]['desc'].'</textarea></td>';
- echo '</tr>';
- }
- }
- echo '</table>';
- echo "\n\t".'<p class="submit"><input class="button" type="submit" value="'.__('Update Translation','zd_multilang').'" name="submit"/></p>';
- echo "</form>";
- } else {
- switch ($Option) {
- default:
- $Option="cat";
- case 'cat':
- $query="SELECT t.name, tt.term_id FROM ".$wpdb->prefix."term_taxonomy tt, ".$wpdb->prefix."terms t WHERE t.term_id=tt.term_id and taxonomy='category' order by name";
- $Results=$wpdb->get_results($query, ARRAY_A);
- break;
- case 'tags':
- $query="SELECT t.name, tt.term_id FROM ".$wpdb->prefix."term_taxonomy tt, ".$wpdb->prefix."terms t WHERE t.term_id=tt.term_id and taxonomy='post_tag' order by name";
- $Results=$wpdb->get_results($query, ARRAY_A);
- break;
- case 'linkcat':
- $query="SELECT t.name, tt.term_id FROM ".$wpdb->prefix."term_taxonomy tt, ".$wpdb->prefix."terms t WHERE t.term_id=tt.term_id and taxonomy='link_category' order by name";
- $Results=$wpdb->get_results($query, ARRAY_A);
- break;
- }
- if ($Results) {
- foreach ($Results as $Line) {
- $in.=$Line['term_id'].",";
- }
- $in=substr($in, 0, -1);
- $query="SELECT * FROM $termtrans_table WHERE term_id in ($in)";
- $Trans=$wpdb->get_results($query, ARRAY_A);
- if ($Trans) foreach ($Trans as $Values) {
- $Translations[$Values["term_id"]][$Values['LanguageID']]=$Values['name'];
- }
- echo '<table class="widefat">';
- echo '<tr style="background: #E4F2FD";><td><img src="'.$PluginDIR.'/flags/'.$DefaultLanguage.'.png"> '.__('Original Term','zd_multilang').'</td>';
- foreach ($Languages as $Lang) {
- if ($Lang['LanguageID']!=$DefaultLanguage) echo '<td><img src="'.$PluginDIR.'/flags/'.$Lang['LanguageID'].'.png"> '.$Lang['LanguageName'].'</td>';
- }
- echo '</tr>';
- foreach ($Results as $Id => $Value) {
- $term_id=$Value['term_id'];
- echo '<tr><td><a href="'.$BaseURL.'&fct=translations&tr='.$Option.'&id='.$term_id.'">'.$Value['name'].'</a></td>';
- foreach ($Languages as $Lang) {
- if ($Lang['LanguageID']!=$DefaultLanguage) echo '<td>'.$Translations[$term_id][$Lang['LanguageID']].'</td>';
- }
- echo '</tr>';
- }
- echo '</table>';
- }
- }
-}
-
-function zd_multilang_translate_term($args="", $taxonomy="") {
- global $ZdmlCache, $locale;
- global $BaseURL, $wpdb,$default_language_option,$PluginDIR,$CurrentLanguagePermalink,$CurrentLang;
-
- if ($ZdmlCache['DefLang']==$locale) return $args;
-
- if ($ZdmlCache['Terms']) {
- if ($ZdmlCache['Terms'][$args->term_id][$locale]) {
- $args->cat_name=$ZdmlCache['Terms'][$args->term_id][$locale]['name'];
- $args->name=$ZdmlCache['Terms'][$args->term_id][$locale]['name'];
- $args->description=$ZdmlCache['Terms'][$args->term_id][$locale]['description'];
- }
- }
- return $args;
-}
-
-function zd_multilang_translate_link_cat($terms="") {
- global $ZdmlCache, $locale;
- global $BaseURL, $wpdb,$default_language_option,$PluginDIR,$CurrentLanguagePermalink,$CurrentLang;
- $language_table= $wpdb->prefix.'zd_ml_langs';
- $termtrans_table = $wpdb->prefix.'zd_ml_termtrans';
- $DefaultLanguage=$ZdmlCache['DefLang'];
-
- if ($ZdmlCache['DefLang']==$locale) return $terms;
-
- $termes=explode("\n",$terms);
- $term_list="";
- foreach ($termes as $ID => $term) {
- preg_match_all("|(.*<a.*>)(.*)(</a>.*)|i", $term,$res);
- $t="";
- foreach ($ZdmlCache['Terms'] as $termid => $Values) {
- foreach ($Values as $LangID => $V) {
- if (($t=="")&&($LangID==$locale)&&($V['o_name']==$res[2][0])) {
- $t=$V['name'];
- }
- }
- }
- if ($t=="") $term_list.=$res[0][0]."\n";
- else $term_list.=$res[1][0].$t.$res[3][0]."\n";
- echo $res[3][0];
- }
- return $term_list."\n";
-}
-
-function zd_multilang_postlink($arg) {
- global $locale, $ZdmlCache, $wpdb;
- $posttrans=$wpdb->prefix.'zd_ml_trans';
-
- preg_match_all("|(.*<a.*>)(.*)(</a>.*)|ms",$arg,$res);
- $postname=$res[2][0];
-
- $query="SELECT pt.post_title FROM $posttrans pt, $wpdb->posts p WHERE pt.ID=p.ID and LanguageID='".$locale."' AND p.post_title='$postname' and pt.post_status='published'";
- $title=$wpdb->get_var($query);
- $link=$res[1][0];
- if ($title) return $link.$title.$res[3][0];
- return $arg;
-}
-
-function zd_multilang_translate_cat($term="") {
- global $ZdmlCache, $locale;
- global $BaseURL, $wpdb,$default_language_option,$PluginDIR,$CurrentLanguagePermalink,$CurrentLang;
- $language_table= $wpdb->prefix.'zd_ml_langs';
- $termtrans_table = $wpdb->prefix.'zd_ml_termtrans';
- $DefaultLanguage=$ZdmlCache['DefLang'];
-
- if ($ZdmlCache['DefLang']==$locale) return $term;
-
- if ($ZdmlCache['Terms']) {
- foreach ($ZdmlCache['Terms'] as $TermID => $V) {
- foreach ($ZdmlCache['Terms'][$TermID] as $Language => $V) {
- if (($Language==$locale)&&($V['o_name']==$term)) {
- return $V['name'];
- }
- }
- }
- }
- return $term;
-}
-
-function zd_multilang_cat($arg) {
- global $ZdmlCache, $locale;
- $termid=$arg->term_id;
-
- if (isset($ZdmlCache['Terms'][$termid][$locale])) {
- $arg->name=$ZdmlCache['Terms'][$termid][$locale]['name'];
- $arg->description=$ZdmlCache['Terms'][$termid][$locale]['description'];
- $arg->category_description=$ZdmlCache['Terms'][$termid][$locale]['description'];
- }
- return $arg;
-}
-
-function zd_multilang_cat_desc($arg, $arg2) {
- if (is_object($arg2)) {
- $cat=zd_multilang_cat($arg2);
- return $cat->description;
- }
- return $arg;
-}
-
-function zd_multilang_translate_bookmarks($links) {
- global $ZdmlCache, $locale;
- if (!is_admin()) {
- foreach ($links as $Idx => $Datas) {
- $termid=$Datas->term_taxonomy_id;
- $linkid=$Datas->link_id;
- if ($ZdmlCache['Terms'][$termid][$locale]['description']) $links[$Idx]->description=$ZdmlCache['Terms'][$termid][$locale]['description'];
- if ($ZdmlCache['Links'][$linkid][$locale]['description']) $links[$Idx]->link_description=$ZdmlCache['Links'][$linkid][$locale]['description'];
- if ($ZdmlCache['Links'][$linkid][$locale]['name']) $links[$Idx]->link_name=$ZdmlCache['Links'][$linkid][$locale]['name'];
- if ($ZdmlCache['Links'][$linkid][$locale]['url']) $links[$Idx]->link_url=$ZdmlCache['Links'][$linkid][$locale]['url'];
- }
- }
- return $links;
-}
-
-function zd_multilang_translate_list_bookmarks($bm) {
- global $ZdmlCache, $locale;
- $bookmarks=explode("\n",$bm);
- $bm_return=array();
- foreach ($bookmarks as $line) {
- if (preg_match_all('|(<h[0-9].*>)(.*)(</h[0-9]>)|U',$line,$res)) {
- $bm_return[]=$res[1][0].zd_multilang_translate_cat($res[2][0]).$res[3][0];
- } else {
- $bm_return[]=$line;
- }
- }
- return implode("\n",$bm_return);
-}
-
-function zd_multilang_translate_post($posts) {
- global $ZdmlCache;
- global $BaseURL, $wpdb,$default_language_option, $wp_query, $wp_rewrite,$insert_lang_switch_option,$CurrentLanguagePermalink,$CurrentLang;
- global $locale, $display_google_translate;
- $language_table= $wpdb->prefix.'zd_ml_langs';
- $termtrans_table = $wpdb->prefix.'zd_ml_termtrans';
- $posttrans=$wpdb->prefix.'zd_ml_trans';
-
- $Lang = $CurrentLanguagePermalink;
- if ($Lang=="") $Language=$ZdmlCache['DefLang'];
- $Language=$CurrentLang;
-
- if ($ZdmlCache['DefLang']!=$CurrentLang) {
- foreach ($posts as $Idc => $Post) {
- $post_list.=$Post->ID.',';
- }
- $post_list=substr($post_list,0, -1);
- $query="SELECT post_content, post_title, ID, post_excerpt FROM $posttrans WHERE LanguageID='".$Language."' AND ID in (".$post_list.") AND post_status='published'";
- $rows=$wpdb->get_results($query, ARRAY_A);
- if ($rows) foreach ($rows as $Id => $P) {
- $row[$P['ID']]->post_content=$P['post_content'];
- $row[$P['ID']]->post_title=$P['post_title'];
- $row[$P['ID']]->post_excerpt=$P['post_excerpt'];
- }
- }
-
- foreach ($posts as $Idx => $Post) {
- $postid=$Post->ID;
- if ($row[$Post->ID]) {
- $posts[$Idx]->post_content=$row[$Post->ID]->post_content;
- $posts[$Idx]->post_excerpt=$row[$Post->ID]->post_excerpt;
- if ($ZdmlCache['SwitcherPosition']=="footer") $posts[$Idx]->post_content.=zd_multilang_lang_switcher($posts[$Idx]->ID);
- else $posts[$Idx]->post_content=zd_multilang_lang_switcher($posts[$Idx]->ID).$posts[$Idx]->post_content;
- $posts[$Idx]->post_title=$row[$Post->ID]->post_title;
- } else {
- if ((!zd_multilang_is_translated($postid,$Language))&&($ZdmlCache['DefLang']!=$locale)&&(get_option($display_google_translate)=="show")) {
- $posts[$Idx]->post_content="<p><a href=\"http://translate.google.com/translate?u=".urlencode(get_permalink($postid))."&hl=en&ie=UTF8&sl=".$ZdmlCache['DefLang']."&tl=".$CurrentLang."\">".__('Translate original post with Google Translate',"zd_multilang").'</a></p>'
- .$posts[$Idx]->post_content;
- }
- if ($ZdmlCache['SwitcherPosition']=="footer") $posts[$Idx]->post_content.=zd_multilang_lang_switcher($posts[$Idx]->ID);
- else $posts[$Idx]->post_content=zd_multilang_lang_switcher($posts[$Idx]->ID).$posts[$Idx]->post_content;
- }
- // always get the appropriate number of comments (otherwise it won't work with default language)
- $comment_count = zd_multilang_get_comment_count ($Post->ID, $Post);
- if ($comment_count !== false)
- $posts[$Idx]->comment_count = $comment_count;
- }
- return $posts;
-}
-
-function zd_multilang_translate_tags($Tags) {
- global $ZdmlCache;
- global $BaseURL, $wpdb,$default_language_option,$PluginDIR,$CurrentLanguagePermalink,$CurrentLang;
- $language_table= $wpdb->prefix.'zd_ml_langs';
- $termtrans_table = $wpdb->prefix.'zd_ml_termtrans';
-
- $Lang = $CurrentLanguagePermalink;
- if ($Lang=="") $Language=$ZdmlCache['DefLang'];
- $Language=$CurrentLang;
-
- if ($ZdmlCache['DefLang']==$CurrentLang) return $Tags;
-
- foreach ($Tags as $ID => $args) {
- if ($ZdmlCache['Terms']) {
- foreach ($ZdmlCache['Terms'] as $TermID => $V) {
- if (($TermID==$args->term_id) and ($V['LanguageID']==$Language))
- $Tags[$ID]->name=$V['name'];
- }
- }
- }
- return $Tags;
-}
-
-function zd_multilang_lang_switcher($post_id) {
- global $ZdmlCache;
- global $wpdb,$wp_rewrite,$display_untranslated;
- global $insert_lang_switch_option,$insert_lang_switch_option,$show_flags_option,$show_languages_option,$lang_switcher_class_option,$permalink_default, $locale;
-
- if (get_option($insert_lang_switch_option)=="show") {
- $PluginDIR = get_bloginfo('wpurl').'/'.PLUGINDIR . '/' . dirname(plugin_basename (__FILE__));
- $language_table= $wpdb->prefix.'zd_ml_langs';
-
- $langswitch_class=get_option($lang_switcher_class_option);
- if ($langswitch_class) $class=' class="'.$langswitch_class.'"';
- $retour="<ul$class>";
-
- if (!isset($ZdmlCache['Languages'])) {
- $query="SELECT * FROM $language_table ORDER BY LanguageName";
- $results=$wpdb->get_results($query, ARRAY_A);
- if ($results) {
- foreach ($results as $ID => $V)
- $ZdmlCache['Languages'][$V['LangPermalink']]=$V['LanguageID'];
- }
- }
- else {
- foreach ($ZdmlCache['Languages'] as $Permalink => $LangID) {
- $results[$i]['LangPermalink']=$Permalink;
- $results[$i]['LanguageID']=$LangID;
- $i++;
- }
- }
- if ($results) {
- foreach ($results as $ID => $Lang) {
- $regexp.=$Lang['LangPermalink']."|";
- }
- $regexp=substr($regexp, 0, -1);
- }
- $QUERY=get_permalink($post_id);
- if ($results) foreach ($results as $ID => $row) {
- if (get_option($permalink_default)=="no") {
- $regexp="";
- if ($results) {
- foreach ($results as $ID => $Lang) {
- if ($Lang['LanguageID']!=$ZdmlCache['DefLang']) $regexp.=$Lang['LangPermalink']."|";
- }
- $regexp=substr($regexp, 0, -1);
- }
- if ($wp_rewrite->using_permalinks()) {
- if ($ZdmlCache['DefLang']==$row['LanguageID']) $QUERY=preg_replace("`".get_bloginfo('url')."\/($regexp)\/(.*)`U",get_bloginfo('url')."/${3}",$QUERY);
- else {
- if ($locale==$ZdmlCache['DefLang']) {
- $QUERY=preg_replace("`".get_bloginfo('url')."\/(.*)`U",get_bloginfo('url').'/'.$row['LangPermalink']."/${2}",$QUERY);
- } else $QUERY=preg_replace("`".get_bloginfo('url')."\/($regexp)\/(.*)`U",get_bloginfo('url').'/'.$row['LangPermalink']."/${3}",$QUERY);
- }
- } else {
- if ($ZdmlCache['DefLang']==$row['LanguageID']) $QUERY=preg_replace("`(".get_bloginfo('url')."\/.*)&lang=($regexp)(.*)`U",'${1}'."${3}",$QUERY);
- else {
- if ($locale==$ZdmlCache['DefLang']) {
- $QUERY=preg_replace("`(".get_bloginfo('url')."\/.*)$`U",'${1}&lang='.$row['LangPermalink'],$QUERY);
- } else $QUERY=preg_replace("`(".get_bloginfo('url')."\/.*lang=)($regexp)(.*)`U",'${1}'.$row['LangPermalink']."${3}",$QUERY);
- }
- }
- } else {
- if ($wp_rewrite->using_permalinks()) {
- if ($QUERY!=get_bloginfo('url').'/') $QUERY=preg_replace("`".get_bloginfo('url')."\/($regexp)\/(.*)`U",get_bloginfo('url').'/'.$row['LangPermalink']."/${3}",$QUERY);
- else $QUERY.=$row['LangPermalink'].'/';
- } else {
- $QUERY=preg_replace("`(".get_bloginfo('url')."\/.*lang=)($regexp)(.*)`U",'${1}'.$row['LangPermalink']."${3}",$QUERY);
- }
- }
- if ((zd_multilang_is_translated($post_id,$row['LanguageID']))&&($locale!=$row['LanguageID'])) {
- $retour.="<li$class>";
- $retour.='<a href="'.$QUERY.'">';
- if (get_option($show_flags_option)=="show") $retour.='<img src="'.$PluginDIR.'/flags/'.$row['LanguageID'].'.png" alt="'.$ZdmlCache['LanguageNames'][$row['LangPermalink']].'" title="'.$ZdmlCache['LanguageNames'][$row['LangPermalink']].'" border="0">';
- if (get_option($show_languages_option)=="show") $retour.=$ZdmlCache['LanguageNames'][$row['LangPermalink']];
- $retour.='</a>';
- $retour.='</li>';
- }
- }
- $retour.='</ul>';
- return $retour;
- }
- return "";
-}
-
-/******** Short Circuit Options ********/
-function zd_multilang_blogname($value) {
- $v=zd_multilang_option("blogname");
- if ($v) return $v;
- return $value;
-}
-function zd_multilang_blogdescription($value) {
- $v=zd_multilang_option("blogdescription");
- if ($v) return $v;
- return $value;
-}
-
-function zd_multilang_option($optionname) {
- global $locale, $ZdmlCache;
- return $ZdmlCache['Options'][$locale][$optionname];
-}
-
-
-/******* Widgets *******/
-
-function zd_multilang_menu($show_name=true, $show_flags=true) {
- global $wpdb,$wp_rewrite,$locale; // ... MG - Oct. 27, 2008 - need locale for check below ...
- $PluginDIR = get_bloginfo('wpurl').'/'.PLUGINDIR . '/' . dirname(plugin_basename (__FILE__));
- $language_table= $wpdb->prefix.'zd_ml_langs';
-
- $query="SELECT * FROM $language_table ORDER BY LanguageName";
- $results=$wpdb->get_results($query, ARRAY_A);
-
- if ($results) {
- foreach ($results as $ID => $Lang) {
- $regexp.=$Lang['LangPermalink']."|";
- }
- $regexp=substr($regexp, 0, -1);
- }
- $retour="";
- if ($results) foreach ($results as $ID => $row) {
- if ($wp_rewrite->using_permalinks()) { // ... MG - Oct. 27, 2008 - not on the home page when switching language - deal with it ...
- if ( is_front_page() && !is_paged() ) $QUERY=get_bloginfo('url').'/'.$row['LangPermalink'].'/';
- else $QUERY=str_replace('/'.substr($locale,0,2).'/', '/'.$row['LangPermalink'].'/', $_SERVER['REQUEST_URI']);
- } else {
- if ( is_front_page() && !is_paged() ) $QUERY=get_bloginfo('url').'/?lang='.$row['LangPermalink'];
- else $QUERY=str_replace('lang='.substr($locale,0,2), 'lang='.$row['LangPermalink'], $_SERVER['REQUEST_URI']);
- }
- if ( $locale != $row['LanguageID'] ) {// ... MG - Oct. 27, 2008 - no need to display the flag for active language ...
- $retour.='<li><a href="'.$QUERY.'">';
- if ($show_flags) $retour.='<img src="'.$PluginDIR.'/flags/'.$row['LanguageID'].'.png" border="0">';
- if ($show_name) $retour.=' '.$row['LanguageName'];
- $retour.='</a></li>';
- }
- }
- return $retour;
-}
-
-function zd_multilang_widget($args) {
- global $ZdmlCache;
- global $wpdb,$wp_rewrite;
- global $insert_lang_switch_option,$insert_lang_switch_option,$show_flags_option,$show_languages_option,$lang_switcher_class_option,$permalink_default, $locale;
- $PluginDIR = get_bloginfo('wpurl').'/'.PLUGINDIR . '/' . dirname(plugin_basename (__FILE__));
- $language_table= $wpdb->prefix.'zd_ml_langs';
-
- extract($args);
- $WidgetTitle=get_option('zdml_widget_title');
- $WidgetOptions=get_option('zdml_widget_options');
- if (!$WidgetTitle) echo $before_widget.$before_title.__('Language','zd_multilang').$after_title;
- else echo $before_widget.$before_title.$WidgetTitle.$after_title;
-
- echo '<ul class="zd_multilang_list">';
- echo zd_multilang_menu($WidgetOptions,get_option('zdml_widget_options_flag'));
- echo '</ul>';
-
- echo $after_widget;
-}
-
-function zd_multilang_widget_options() {
- global $ZdmlCache;
- global $wpdb;
- if ((isset($_POST['zdml_widget_title']))||(isset($_POST['zdml_sname']))) {
- update_option('zdml_widget_title',$_POST['zdml_widget_title']);
- $Options=($_POST['zdml_sname']=='on') ? '1' : '0';
- update_option('zdml_widget_options',$Options);
- $Options=($_POST['zdml_sflag']=='on') ? '1' : '0';
- update_option('zdml_widget_options_flag',$Options);
- }
- $WidgetTitle=get_option('zdml_widget_title');
- $WidgetOptions=(get_option('zdml_widget_options')==1)? 'checked="checked"': '';
- $WidgetFlagOptions=(get_option('zdml_widget_options_flag')==1)? 'checked="checked"': '';
- echo '<p><label for="zds_widget_title">'.__('Title').':<br /><input type="text" name="zdml_widget_title" value="'.$WidgetTitle.'" /></label></p>';
- echo '<p><label for="zdml_sname"><input type="checkbox" name="zdml_sname" id="zdml_sname" '.$WidgetOptions.' /> '.__('Display Languages Name','zd_multilang').'</label></p>';
- echo '<p><label for="zdml_sflag"><input type="checkbox" name="zdml_sflag" id="zdml_sflag" '.$WidgetFlagOptions.' /> '.__('Display Flag','zd_multilang').'</label></p>';
-}
-
-
-/** comments */
-/** Author of this section Pau Sanchez **/
-
- /**
- * When a new comment is created, we should add it to the database, no matter if it has been approved or not
- */
- function zd_multilang_insert_comment ($comment_id, $comment) {
- global $locale, $wpdb;
- $commenttrans=$wpdb->prefix.'zd_ml_comments';
-
- // escape comment pulled from DB
- $post_id = $comment->comment_post_ID;
-
- $wpdb->query( $wpdb->prepare("INSERT INTO $commenttrans (comment_id, post_id, LanguageID) VALUES (%d, %d, %s)", $comment_id, $post_id, $locale) );
- return true;
- }
-
- /**
- * When the post is deleted, we should delete it from the database
- */
- function zd_multilang_delete_comment ($comment_id) {
- global $locale, $wpdb;
- $commenttrans=$wpdb->prefix.'zd_ml_comments';
- $wpdb->query( $wpdb->prepare("DELETE FROM $commenttrans WHERE comment_ID = %d LIMIT 1", $comment_id) );
- return true;
- }
-
- /**
- * Filter comments for the wp-content themes only (for the current language), not for the admin
- */
- function zd_multilang_comments_array ($comments, $post_id)
- {
- global $locale, $wpdb, $keep_separate_comments;
-
- if (empty ($comments) || !is_array ($comments) || (get_option($keep_separate_comments) != 'yes'))
- return $comments;
-
- $commenttrans=$wpdb->prefix.'zd_ml_comments';
-
- // get ALL comments for current post, no matter the language
- // this is to allow compability with old posts before installing the plugin
- $query=$wpdb->prepare ("SELECT * FROM $commenttrans WHERE post_id = %d", $post_id);
- $results=$wpdb->get_results($query, ARRAY_A);
-
- // no i18n comments?
- if ($results === NULL)
- return $comments;
-
- // create a map of comment IDs written in current language
- // and another list of comments written in any other language (it will make sense later)
- $commentsInLocale = array();
- $commentsNotInLocale = array();
- foreach ($results as $row) {
- if (strcasecmp ($row['LanguageID'], $locale) == 0)
- $commentsInLocale[] = $row ['comment_id'];
- else
- $commentsNotInLocale[] = $row ['comment_id'];
- }
-
- // now generate the new list of commets (please note that comments is an array of objects)
- $oldComments = $comments;
- $comments = array ();
-
- foreach ($oldComments as $comment)
- {
- // if the comment is written in the current $locale OR we have no information
- // about which language was used (not in our table), display comment
- if (
- in_array ($comment->comment_ID, $commentsInLocale) ||
- !in_array ($comment->comment_ID, $commentsNotInLocale) // this makes the plugin compatible with old comments
- )
- {
- $comments [] = $comment;
- }
- }
-
- // intersect posts in current language with comments provided
- return $comments;
- }
-
- /**
- * This is an internal function, be careful to avoid calling this function if it's not needed
- * Returns the number of comments in current locale or FALSE if it could not retrieve the number of comments
- * (only when keep_separate_comments = false and no $Post is passed)
- */
- function zd_multilang_get_comment_count ($post_id, $Post = NULL)
- {
- global $locale, $wpdb, $keep_separate_comments;
-
- // do not keep separate comments
- if (get_option($keep_separate_comments) != 'yes') {
- if ($Post !== NULL) {
- return $Post->comment_count;
- }
-
- // in theory this should never happen
- return false;
- }
-
- $commenttrans = $wpdb->prefix.'zd_ml_comments';
-
- // check if it's the admin interface => in the admin interface show the actual number of comments (no matter the language)
- $isAdminInterface = (strpos ($_SERVER['PHP_SELF'], '/wp-admin/') !== false);
- if ($isAdminInterface) {
- if ($Post === NULL) {
- $Post = get_post ($post_id);
- if ($Post === NULL)
- return 0;
- }
- return $Post->comment_count;
- }
-
- // this is a bit tricky, it could be optimized, but will be clearer if left seprate
- $comment_count = 0;
-
- // 1st sum all comments in current language
- $query=$wpdb->prepare ("SELECT COUNT(*) AS total FROM $commenttrans WHERE post_id = %d AND LanguageID = %s", $post_id, $locale);
- $results=$wpdb->get_results($query, ARRAY_A);
- if ($results !== NULL)
- $comment_count += $results[0]['total'];
-
- // 2nd sum all comments that are not available in any language
- $query=$wpdb->prepare (
- "SELECT COUNT(*) AS total FROM wp_comments AS c1 WHERE (comment_post_ID = %d) AND NOT EXISTS (SELECT * FROM wp_zd_ml_comments AS c2 WHERE c1.comment_ID = c2.comment_id)",
- $post_id
- );
- $results=$wpdb->get_results($query, ARRAY_A);
- if ($results !== NULL)
- $comment_count += $results[0]['total'];
-
- return $comment_count;
- }
-
- // filter that returns the appropriate number of comments (themes usually use comments_number function)
- function zd_multilang_get_comments_number($count)
- {
- global $id;
- $comment_count = zd_multilang_get_comment_count($id);
- return ($comment_count === false ? $count : $comment_count);
- }
-
- /** misc */
-
- // function to return the current locale (to avoid using global variables)
- function zd_multilang_get_locale () {
- global $locale;
- return $locale;
- }
-
-function zd_multilang_initwidget() {
- global $ZdmlCache;
- if ( !function_exists('register_sidebar_widget') || !function_exists('register_widget_control') )
- return;
- register_sidebar_widget(array('Zd Multilang','widgets'),'zd_multilang_widget');
- register_widget_control(array('Zd Multilang', 'widgets'), 'zd_multilang_widget_options');
-}
-add_action('widgets_init', 'zd_multilang_initwidget');
-
-?>
--- a/web/wp-content/themes/IRI-Theme/404.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/404.php Thu Mar 18 09:56:33 2010 +0000
@@ -19,6 +19,7 @@
$newoptions['mode'] = 'tags';
$newoptions['width'] = '590';
$newoptions['height'] = '410';
+ //$newoptions['lang'] = 'en_EN';
echo wp_cumulus_insert($newoptions);
--- a/web/wp-content/themes/IRI-Theme/archive.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/archive.php Thu Mar 18 09:56:33 2010 +0000
@@ -3,11 +3,14 @@
<div class="content">
<?php if (have_posts()) : ?>
+
<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
<?php /* If this is a category archive */ if (is_category()) { ?>
- <?php if( function_exists(page2cat_output)){ page2cat_output($cat);} ?>
+ <?php if( function_exists(xilimlSam_page2cat_output_Hook)){ xilimlSam_page2cat_output_Hook($cat);}
+
+ ?>
<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
@@ -23,14 +26,14 @@
<?php /* If this is a tag archive */ if (is_tag()) { ?>
<div id="p2c-header">
- <h2 >Mot-clef : <?php single_tag_title(); ?></h2>
+ <h2 ><?php _e("Tag : ",'IriTheme'); single_tag_title(); ?></h2>
</div>
<?php echo(tag_description()); ?>
<?php } ?>
<div class="navigation">
- <div class="alignleft"><?php next_posts_link('« Précédent') ?></div>
- <div class="alignright"><?php previous_posts_link('Suivant »') ?></div>
+ <div class="alignleft"><?php next_posts_link(__('« Précédent','IriTheme')) ?></div>
+ <div class="alignright"><?php previous_posts_link(__('Suivant »','IriTheme')) ?></div>
</div>
<div> </div
@@ -39,11 +42,11 @@
<?php endwhile; ?>
<div class="navigation">
- <div class="alignleft"><?php next_posts_link('« Précédent') ?></div>
- <div class="alignright"><?php previous_posts_link('Suivant »') ?></div>
+ <div class="alignleft"><?php next_posts_link(__('« Précédent','IriTheme')) ?></div>
+ <div class="alignright"><?php previous_posts_link(__('Suivant »','IriTheme')) ?></div>
</div>
<?php else : ?>
- <h2 class="center">Not Found</h2>
+ <h2 class="center"><?php _e('Not Found','IriTheme') ?></h2>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php endif; ?>
</div>
--- a/web/wp-content/themes/IRI-Theme/functions.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/functions.php Thu Mar 18 09:56:33 2010 +0000
@@ -1,5 +1,19 @@
<?php
+function theme_init(){
+ if (class_exists('xili_language')) {
+ define('THEME_TEXTDOMAIN','IriTheme');
+ define('THEME_LANGS_FOLDER','/language');
+ } else {
+ load_theme_textdomain('IriTheme', get_template_directory() . '/languages');
+ }
+}
+add_action ('init', 'theme_init');
+
+
+//
+define('THEME_TEXTDOMAIN','IriTheme');
+define('THEME_LANGS_FOLDER','/language');
require( "lib/zip.lib.php" ) ; //indiquez le chemin d'accès à la lib
//error_reporting(E_ALL);
@@ -12,8 +26,7 @@
include('searchform.php');
}
-if ( function_exists('register_sidebar') )
-{
+if ( function_exists('register_sidebar') ){
register_sidebar
( array
(
@@ -66,9 +79,287 @@
);
}
+// Need the tag Cloud Plug In
+// piece together the flash code
+function xilimlSam_wp_cumulus_createflashcode( $widget=false, $atts=NULL ){
+
+
+ // get the options
+ if( $widget == true ){
+ $options = get_option('wpcumulus_widget');
+ $soname = "widget_so";
+ $divname = "wpcumuluswidgetcontent";
+ // get compatibility mode variable from the main options
+ $mainoptions = get_option('wpcumulus_options');
+ $options['compmode'] = $mainoptions['compmode'];
+ $options['showwptags'] = $mainoptions['showwptags'];
+ } else if( $atts != NULL ){
+ $options = shortcode_atts( get_option('wpcumulus_options'), $atts );
+ $soname = "shortcode_so";
+ $divname = "wpcumuluscontent";
+ } else {
+ $options = get_option('wpcumulus_options');
+ $soname = "so";
+ $divname = "wpcumuluscontent";
+ }
+ // get the tag cloud...
+ if( $options['mode'] != "cats" ){
+ ob_start();
+ //wp_tag_cloud( $options['args'] );
+ xili_tidy_tag_cloud('tagsgroup='.the_curlang());
+ $tagcloud = urlencode( str_replace( " ", " ", ob_get_clean() ) );
+ }
+ // get categories
+ if( $options['mode'] != "tags" ){
+ ob_start();
+ xili_tidy_tag_cloud('tagsgroup='.the_curlang());//
+ $cats = urlencode( ob_get_clean() );
+ }
+ // get some paths
+ if( function_exists('plugins_url') ){
+ // 2.6 or better
+ $movie = plugins_url('wp-cumulus/tagcloud.swf');
+ $path = plugins_url('wp-cumulus/');
+ } else {
+ // pre 2.6
+ $movie = get_bloginfo('wpurl') . "/wp-content/plugins/wp-cumulus/tagcloud.swf";
+ $path = get_bloginfo('wpurl')."/wp-content/plugins/wp-cumulus/";
+ }
+ // add random seeds to so name and movie url to avoid collisions and force reloading (needed for IE)
+ $soname .= rand(0,9999999);
+ $movie .= '?r=' . rand(0,9999999);
+ $divname .= rand(0,9999999);
+ // write flash tag
+ if( $options['compmode']!='true' ){
+ $flashtag = '<!-- SWFObject embed by Geoff Stearns geoff@deconcept.com http://blog.deconcept.com/swfobject/ -->';
+ $flashtag .= '<script type="text/javascript" src="'.$path.'swfobject.js"></script>';
+ // ------------------------------------------------------------------------------------
+ $flashtag .= '<div id="'.$divname.'" style="position:absolute;z-index:0;">';
+ if( $options['showwptags'] == 'true' ){ $flashtag .= '<p>'; } else { $flashtag .= '<p style="display:none;">'; };
+ // alternate content
+ if( $options['mode'] != "cats" ){ $flashtag .= urldecode($tagcloud); }
+ if( $options['mode'] != "tags" ){ $flashtag .= urldecode($cats); }
+ $flashtag .= '</p><!-- WP Cumulus Flash tag cloud by <a href="http://www.roytanck.com">Roy Tanck</a> and <a href="http://lukemorton.co.uk/">Luke Morton</a> requires <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> 9 or better. --></div>';
+ $flashtag .= '<script type="text/javascript">';
+ $flashtag .= 'var '.$soname.' = new SWFObject("'.$movie.'", "tagcloudflash", "'.$options['width'].'", "'.$options['height'].'", "9", "#'.$options['bgcolor'].'");';
+ if( $options['trans'] == 'true' ){
+ $flashtag .= $soname.'.addParam("wmode", "transparent");';
+ }
+ $flashtag .= $soname.'.addParam("allowScriptAccess", "always");';
+ $flashtag .= $soname.'.addVariable("tcolor", "0x'.$options['tcolor'].'");';
+ $flashtag .= $soname.'.addVariable("tcolor2", "0x' . ($options['tcolor2'] == "" ? $options['tcolor'] : $options['tcolor2']) . '");';
+ $flashtag .= $soname.'.addVariable("hicolor", "0x' . ($options['hicolor'] == "" ? $options['tcolor'] : $options['hicolor']) . '");';
+ $flashtag .= $soname.'.addVariable("tspeed", "'.$options['speed'].'");';
+ $flashtag .= $soname.'.addVariable("distr", "'.$options['distr'].'");';
+ $flashtag .= $soname.'.addVariable("mode", "'.$options['mode'].'");';
+ // put tags in flashvar
+ if( $options['mode'] != "cats" ){
+ $flashtag .= $soname.'.addVariable("tagcloud", "'.urlencode('<tags>') . $tagcloud . urlencode('</tags>').'");';
+ }
+ // put categories in flashvar
+ if( $options['mode'] != "tags" ){
+ $flashtag .= $soname.'.addVariable("categories", "' . $cats . '");';
+ }
+ $flashtag .= $soname.'.write("'.$divname.'");';
+ $flashtag .= '</script>';
+ } else {
+ $flashtag = '<object type="application/x-shockwave-flash" data="'.$movie.'" width="'.$options['width'].'" height="'.$options['height'].'" wmode="opaque">';
+ $flashtag .= '<param name="movie" value="'.$movie.'" />';
+ $flashtag .= '<param name="bgcolor" value="#'.$options['bgcolor'].'" />';
+ $flashtag .= '<param name="AllowScriptAccess" value="always" />';
+ $flashtag .= '<param name="wmode" value="opaque" />';
+ if( $options['trans'] == 'true' ){
+ $flashtag .= '<param name="wmode" value="transparent" />';
+ }
+ $flashtag .= '<param name="flashvars" value="';
+ $flashtag .= 'tcolor=0x'.$options['tcolor'];
+ $flashtag .= '&tcolor2=0x'.$options['tcolor2'];
+ $flashtag .= '&hicolor=0x'.$options['hicolor'];
+ $flashtag .= '&tspeed='.$options['speed'];
+ $flashtag .= '&distr='.$options['distr'];
+ $flashtag .= '&mode='.$options['mode'];
+ // put tags in flashvar
+ if( $options['mode'] != "cats" ){
+ $flashtag .= '&tagcloud='.urlencode('<tags>') . $tagcloud . urlencode('</tags>');
+ }
+ // put categories in flashvar
+ if( $options['mode'] != "tags" ){
+ $flashtag .= '&categories=' . $cats;
+ }
+ $flashtag .= '" />';
+ // alternate content
+ if( $options['mode'] != "cats" ){ $flashtag .= '<p>'.urldecode($tagcloud).'</p>'; }
+ if( $options['mode'] != "tags" ){ $flashtag .= '<p>'.urldecode($cats).'</p>'; }
+ $flashtag .= '<!-- WP-Cumulus by <a href="http://www.roytanck.com/">Roy Tanck</a> and <a href="http://lukemorton.co.uk/">Luke Morton</a> requires <a href="http://www.macromedia.com/go/getflashplayer">Flash Player</a> 9 or better. -->';
+ $flashtag .= '</object>';
+ }
+ return $flashtag;
+}
+
+// Copy of the current category widget plugin adapted to xiliml
+function xilimlSam_post_of_current_category (){
+ global $wpdb;
+
+ $defaults = array(
+ 'limit' => 30,
+ 'AscDesc' => "DSC",
+ 'OrderBy' =>'ID',
+ );
+
+ $args = $defaults;
+ $lang = the_curlang();//echo ($lang);
+ extract($args);
+
+ $limit = (int) abs($limit);
+
+ if(is_category()){
+ $curCategoryID = get_query_var('cat');
+ }
+
+ if (is_single()) {
+ $curCategoryID = '';
+
+ foreach (get_the_category() as $catt) {
+ $curCategoryID .= $catt->cat_ID.' ';
+ }
+
+ $curCategoryID = str_replace(" ", ",", trim($curCategoryID));
+ }
+
+ if (!intval($curCategoryID)) $curCategoryID='';
+ $query = "&category=$curCategoryID&showposts=$limit&orderby=$OrderBy&order=$AscDesc";
+ $posts = get_posts($query); //get posts
+ $postlist = '';
+
+ foreach ($posts as $post) {
+
+ $CurLang = get_cur_post_lang_dir ($post->ID);//echo ($post->ID."-> ".$CurLang["lang"]." <br/>");
+ if($CurLang["lang"]==$lang){
+ $post_title_s = htmlspecialchars(stripslashes(cache_cutter($post->post_title)));
+ $post_title_l = htmlspecialchars(stripslashes(text_cutter($post->post_title,200)));
+ $postlist .= '<li> <a href="' . get_permalink($post->ID) . '" title="'. $post_title_s .'" >' . $post_title_l . ' </a> </li>';
+ }
+ }
+
+ echo '<ul class="advanced-recent-posts">';
+ echo $postlist;
+ echo '</ul>';
+
+}
+
+#
+function xilimlSam_page2cat_output_Hook($cat){
+
+ if( function_exists(page2cat_output) and function_exists(xiliml_the_other_posts) ){
+
+ global $wpdb;
+ $mypage = $wpdb->get_row("SELECT * FROM {$wpdb->page2cat} WHERE cat_ID = '".$cat."';",OBJECT);
+ $pageid = $mypage->page_ID;
+ $pageInOtherLang = xiliml_the_other_posts ($pageid,'','','array');
+
+ if($pageInOtherLang[the_curlang()]!=null){
+ $pageid=$pageInOtherLang[the_curlang()];
+ }
+
+ if($pageid != ""):
+
+ switch($style):
+
+ case 'inline':
+ default:
+ ?>
+ <div id="category-page-header">
+ <?php
+ $pagina = "SELECT * FROM {$wpdb->posts} WHERE ID='".$pageid."' AND post_type = 'page';";
+ $mine = $wpdb->get_results($pagina);
+ if($mine[0]->post_title!=""){
+ ?>
+ <div id="p2c-header">
+ <h2><?php echo $mine[0]->post_title; ?></h2>
+ <p><?php echo wptexturize($mine[0]->post_content,1); ?></p>
+ </div>
+ <div class="category-page-cleaner"></div>
+ </div>
+ <?php
+ }
+ break;
+
+
+ endswitch;
+ endif;
+ }
+
+ /*
+ $current_lang = the_cur_lang_dir();
+ page2cat_output($cat);
+
+ $MyPost = xiliml_the_other_posts($post_ID,"","","array");
+ //var_dump($MyPost);
+ //echo($current_lang['lang']." -> ".$MyPost[$current_lang['lang']]);
+
+ if (in_array($current_lang['lang'],$MyPost)){
+ return ($post_ID);
+ } else {
+ return ($MyPost[$current_lang['lang']]);
+
+ }
+ */
+}
+
+#
+function xilimlSam_other_posts($post_ID){
+
+ if (class_exists('xili_language')) {
+
+ $current_lang = the_cur_lang_dir();
+
+ $MyPost = xiliml_the_other_posts($post_ID,"","","array");
+ //var_dump($MyPost);
+ //echo($current_lang['lang']." -> ".$MyPost[$current_lang['lang']]);
+
+ if (in_array($current_lang['lang'],$MyPost)){
+ return ($post_ID);
+ } else {
+ return ($MyPost[$current_lang['lang']]);
+
+ }
+
+ } else {
+ return ($post_ID);
+ }
+
+}
+
+#
+function xilimlSam_other_pages($post_ID){
+
+ if (class_exists('xili_language')) {
+
+ $current_lang = the_cur_lang_dir();
+
+ $MyPost = xiliml_the_other_posts($post_ID,"","","array");
+ //var_dump($MyPost);
+ //echo($current_lang['lang']." -> ".$MyPost[$current_lang['lang']]);
+
+ if (in_array($current_lang['lang'],$MyPost)){
+ return ($post_ID);
+ } else {
+ return ($MyPost[$current_lang['lang']]);
+
+ }
+
+ } else {
+ return ($post_ID);
+ }
+}
+
# Displays a list of categories
function dp_list_categories($Eparam='') {
+ if (class_exists('xili_language')) {
+ $current_lang = the_cur_lang_dir();
+ }
+
$categories = get_categories('hide_empty=1'.$Eparam);
$first = true;
$count = 0;
@@ -78,18 +369,60 @@
if ($category->parent<1) {
echo ('<li class="menu-h-li">');
- echo ('<a href="'.get_category_link($category->cat_ID).'">'.$category->name.' </a>');
+
+ if (class_exists('xili_language')) {
+ echo ('<a href="'.xiliml_get_category_link($category->cat_ID).'?lang='.$current_lang['lang'].'">'.__($category->name,'IriTheme').' </a>');
+ } else {
+ echo ('<a href="'.get_category_link($category->cat_ID).'">'.__($category->name,'IriTheme').' </a>');
+ }
echo '<ul>';
-
- $category_posts = get_posts('numberposts=15&category='.$category->cat_ID);
+ $category_posts = get_posts('numberposts=15&order=ASC&orderby=parent&category='.$category->cat_ID);
$count2 = 0;
- //echo("<!-- ".sizeof($category_posts)." -->");
+ /*$categoryN2 = get_category_link($category->cat_ID);
+
+ foreach($categoryN2 as $catN2) {
+
+ //$category_posts = get_posts('numberposts=15&order=ASC&orderby=parent&category='.$category->cat_ID);
+ echo ('<li class="menu-h-li2"><a href="'.get_category_link($catN2->cat_ID).'"> XX '.$catN2->name.' </a></li>');
+ }*/
+
+ //echo("<!-- ".sizeof($category_posts)." -->");
foreach($category_posts as $post) {
- echo '<li class="menu-h-li2" title="'.cache_cutter($post->post_title).'"><a href="'.$post->guid.'">'.text_cutter($post->post_title,200).'</a></li>';
- //echo '<li class="menu-h-li2" title="'.$count2.'"><a href="'.$post->guid.'">'.$post->post_title.'</a></li>';
- $count2++; //if ($count2>6) break;
+
+ if (class_exists('xili_language')) {
+ // Affiche les posts de la langue courante + les indéfinis
+ //if (get_cur_language($post->ID)==$current_lang['lang'] or get_cur_language($post->ID)==""){
+ // Affiche seulement les posts de la langue courante + les indéfinis
+ if (get_cur_language($post->ID)==$current_lang['lang']){
+
+ // gestion des niv 2 ajout de class si nécessaire
+ $MyCategoryPost = get_the_category($post->ID);
+ //var_dump($MyCategoryPost);
+
+ $MoreStyle="";
+ $title ="";
+ if (count($MyCategoryPost)>1){
+ foreach($MyCategoryPost as $MyCategory) {
+ $MoreStyle.= " ".$MyCategory->category_nicename;
+ $title.= " ".$MyCategory->category_nicename;
+ //category_parent!=0
+ }
+ } else {
+ $MoreStyle ="menu-h-li2";
+ }
+
+ echo '<li class="'.$MoreStyle.'" title="'.cache_cutter($post->post_title)." : ".$MoreStyle.'"><a href="'.get_permalink($post->ID).'">'.text_cutter($post->post_title,200).'</a></li>';
+ $count2++; //if ($count2>6) break;
+ }
+
+ } else {
+
+ echo '<li class="menu-h-li2" title="'.cache_cutter($post->post_title).'"><a href="'.get_permalink($post->ID).'">'.text_cutter($post->post_title,200).'</a></li>';
+ $count2++; //if ($count2>6) break;
+ }
+
};
@@ -287,14 +620,23 @@
return (str_replace( "<!-- cut -->", "", $text));
}
-
+# Créer le menu du footer
function dp_list_posts($Eparam='') {
- $category_posts = get_posts($Eparam);
-
+ $category_posts = get_posts($Eparam);
+
+ if (class_exists('xili_language')) {
+ $current_lang = the_cur_lang_dir();
foreach($category_posts as $post) {
- echo '<li><a href="'.$post->guid.'">'.$post->post_title.'</a></li>';
+ if (get_cur_language($post->ID)==$current_lang['lang']){
+ echo '<li><a href="'.get_permalink($post->ID).'">'.__($post->post_title,'IriTheme').'</a></li>';
+ }
};
+ } else {
+ foreach($category_posts as $post) {
+ echo '<li><a href="'.get_permalink($post->ID).'">'.__($post->post_title,'IriTheme').'</a></li>';
+ };
+ }
}
@@ -448,4 +790,5 @@
endif;
return $img_arr;
}
+
?>
\ No newline at end of file
--- a/web/wp-content/themes/IRI-Theme/header.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/header.php Thu Mar 18 09:56:33 2010 +0000
@@ -31,11 +31,11 @@
if ( is_home() ) {
$cssSearch = "searchHome";
$cssSkinselect = "-Home";
- $engines = array(__("sur ce site"),__("sur les sites IRI"),__("sur ENMI"),__("sur Séminaires"));//__("Avancée"));
+ $engines = array(__("on this site",'IriTheme'),__("on IRI sites",'IriTheme'),__("on ENMI",'IriTheme'),__("on Seminars",'IriTheme'));//__("Avancée"));
} else {
$cssSearch = "searchPage";
$cssSkinselect = "-Page";
- $engines = array(__("ce site"),__("sites IRI"),__("ENMI"),__("séminaires"));//__("Avancée"));
+ $engines = array(__("this site",'IriTheme'),__("sites IRI",'IriTheme'),__("ENMI",'IriTheme'),__("Seminars",'IriTheme'));//__("Avancée"));
}
?>
@@ -125,60 +125,82 @@
<!-- FIN DE LA HEAD -->
</head>
+<?php
+ if ( function_exists('xili_language_list')) {
+ $current_lang = the_cur_lang_dir();
+ $LANG_LINK = '?lang='.$current_lang['lang']; }
+?>
<body>
<!-- DEBUT DU HEADER -->
<?php /*echo("debug = ".wp_title('')." lang = ".language_attributes() ); */?>
<div class="container">
<!-- Header -->
- <div class="column span-24" id="header">
- <a href="<?php echo get_option('home'); ?>/" class="logo"><img alt="<?php bloginfo('name'); ?>" src="<?php bloginfo('stylesheet_directory'); ?>/images/logo-iri-petit.png" /></a>
+ <div class="column" id="header">
+ <div class="column">
+ <a href="<?php echo (get_option('home').$LANG_LINK); ?>/" class="logo">
+ <img alt="<?php bloginfo('name'); ?>" src="<?php bloginfo('stylesheet_directory'); ?>/images/logo-iri-petit.png" />
+ </a>
+ </div>
+ <div class="column lang">
+ <ul>
+ <?php if (function_exists('xili_language_list') && is_user_logged_in() ) {
+ xili_language_list();
+ } ?>
+ </ul>
+ </div>
+
</div>
-
+
<!-- Navigation -->
<div class="column span-24 large" id="nav">
<div class="content">
+
<ul id="navmenu-h">
- <li><a href="<?php echo get_settings('home'); ?>/">Accueil</a></li>
+ <li><a href="<?php echo (get_settings('home').$LANG_LINK); ?>/"><?php _e('Home','IriTheme'); ?></a></li>
<?php dp_list_categories('&exclude=1,8,16,17,38,171,169,170&'); ?>
- <li class="alignright"><a href="<?php bloginfo('rss2_url'); ?>" style="padding: 2px 8px 2px 8px;"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/rss.png" style="padding:4px;" alt="rss icon" /></a></li>
+ <li class="alignright"><a href="<?php bloginfo('rss2_url'); echo("?lang=".$current_lang['lang']); ?>" title="<?php _e('Click here to follow us !','IriTheme') ?>" style="padding: 2px 8px 2px 8px;"><img src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/rss.png" style="padding:4px;" alt="rss icon" /></a></li>
<li class="alignright" >
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<?php
- if ( isset($_GET['s']) ) {
+ if (isset($_GET['s']) ) {
$search_text= utf8_decode(stripslashes($_GET['s']));
} else {
- $search_text= "Rechercher";
+ $search_text= __('Search','IriTheme');
}
?>
<div id="<?php echo($cssSearch); ?>" >
+
<input type="text" name="s" id="s"
- value="<?php echo wp_specialchars($search_text, 1); ?>"
- onfocus="clearInput('s', '<?php echo wp_specialchars($search_text, 1); ?>')"
- onblur="clearInput('s', '<?php echo wp_specialchars($search_text, 1); ?>')"
+ value = "<?php echo wp_specialchars($search_text, 1); ?>"
+ onfocus = "clearInput('s', '<?php echo wp_specialchars($search_text, 1); ?>')"
+ onblur = "clearInput('s', '<?php echo wp_specialchars($search_text, 1); ?>')"
/>
-
+
<div class="my-skinnable-select">
<select name="engine" id="engine">
<?php
foreach ($engines as $i => $value) {
- echo("<option value='".$i."'>".$value."</option>");
+ echo("<option value='".$i."'>".__($value,'IriTheme')."</option>");
}
?>
</select>
</div>
- <input id="bt" name="bt" type="submit" value="" title="Rechercher" tabindex="0" />
+ <input id="bt" name="bt" type="submit" value="" title="<?php echo($search_text); ?>" tabindex="0" />
+ <input type="hidden" name="lang" id="lang" value="<?php echo($current_lang['lang']); ?>" />
</div>
</form>
</li>
</ul>
-</div>
+
+ <?php do_action('icl_navigation_menu'); ?>
+ </div>
</div>
<!-- FIN DU HEADER -->
\ No newline at end of file
--- a/web/wp-content/themes/IRI-Theme/home.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/home.php Thu Mar 18 09:56:33 2010 +0000
@@ -2,13 +2,16 @@
<!--START LEFT SIDE-->
<div id="feature" class="column span-15 colborder">
<!--BEGIN FEATURED POST-->
- <?php query_posts('name=home'); ?>
+ <?php
+ $PostHomeId = xilimlSam_other_posts(3);
+ query_posts("p=".$PostHomeId);
+ ?>
<?php while (have_posts()) : the_post(); ?>
<div id="maincontent" class="column span-15 colborder first">
<div class="contentHome">
<div class="category-page-header">
<div id="p2c-header">
- <?php the_content(); ?>
+ <?php the_content(); ?>
</div>
</div>
</div>
@@ -32,7 +35,7 @@
<!-- ACTU BOX -->
<div>
- <h3><?php _e("Prochains évènements"); ?></h3>
+ <h3><?php _e("Next Events",'IriTheme'); ?></h3>
<?php ec3_get_events_home(1); ?>
<!-- -->
@@ -49,7 +52,7 @@
<hr></hr>
<!-- AGENDA BOX -->
- <h3><?php _e("Agenda "); ?>
+ <h3><?php _e("Calendar",'IriTheme'); ?>
<?php
// iCalendar link.
$webcal = get_option('home') . "/?ec3_ical";
@@ -58,7 +61,7 @@
if(strstr($_SERVER['HTTP_USER_AGENT'],'Mac OS X'))
$webcal = preg_replace('/^http:/','webcal:',$webcal);
echo "\t <a id='ec3_publish' href='$webcal'"
- . " title='Cliquer ici pour vous abonner au Icalendar de l"Institut de recherche et d"innovation.'>\n"
+ . " title='".__('Cliquer ici pour vous abonner au Icalendar de l"Institut de recherche et d"innovation.','IriTheme').">\n"
. "\t <img src='".get_option('home')."/wp-content/plugins/event-calendar/publish.gif' alt='iCalendar' />\n"
. "\t </a>\n";
?>
@@ -71,13 +74,13 @@
<!-- SOCIAL AREA -->
<div id="social">
- <?php _e("Réseaux :"); ?>
+ <?php _e("Networks",'IriTheme'); ?> :
<ul class="addtoany_list">
- <li><a target="_blank" rel="nofollow" href="http://twitter.com/IRILive" title="Cliquez ici pour accéder au compte Twitter de l Institut de recherche et d innovation (IRI) "><img width="16" height="16" alt="Twitter" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/twitter.png"/></a> </li>
- <li><a target="_blank" rel="nofollow" href="http://www.facebook.com/home.php?#/pages/Institut-de-recherche-et-dinnovation-IRI/259317533466" title="Cliquez ici pour souscrire a la page Facebook de l Institut de recherche et d innovation (IRI) "><img width="16" height="16" alt="Facebook" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/facebook.png"/></a></li>
- <li><a target="_blank" rel="nofollow" href="http://delicious.com/iri_institute" title="Cliquez ici pour accéder au compte Delicious de l Institut de recherche et d innovation (IRI) "><img width="16" height="16" alt="Delicous" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/delicious.png"/></a></li>
- <li><a target="_blank" rel="nofollow" href="http://www.flickr.com/photos/iri_institute/" title="Cliquez ici pour accéder au compte flick R de l Institut de recherche et d innovation (IRI) "><img width="16" height="16" alt="FlickR" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/flickr.gif"/></a></li>
- <li><a target="_blank" rel="nofollow" href="http://www.linkedin.com/groups?home=&gid=2718850" title="Cliquez ici pour accéder au groupe linkedin de l Institut de recherche et d innovation (IRI) "><img width="16" height="16" alt="FlickR" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/linkedin.png"/></a></li>
+ <li><a target="_blank" rel="nofollow" href="http://twitter.com/IRILive" title="<?php __("Click here to access IRI's Twitter account",'IriTheme')?>"><img width="16" height="16" alt="Twitter" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/twitter.png"/></a> </li>
+ <li><a target="_blank" rel="nofollow" href="http://www.facebook.com/home.php?#/pages/Institut-de-recherche-et-dinnovation-IRI/259317533466" title="<?php _e("Click here to access IRI's Facebook account",'IriTheme'); ?>"><img width="16" height="16" alt="Facebook" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/facebook.png"/></a></li>
+ <li><a target="_blank" rel="nofollow" href="http://delicious.com/iri_institute" title="<?php __("Click here to access IRI's Delicious account",'IriTheme')?>"><img width="16" height="16" alt="Delicous" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/delicious.png"/></a></li>
+ <li><a target="_blank" rel="nofollow" href="http://www.flickr.com/photos/iri_institute/" title="<?php __("Click here to access IRI's FlickR account",'IriTheme')?>"><img width="16" height="16" alt="FlickR" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/flickr.gif"/></a></li>
+ <li><a target="_blank" rel="nofollow" href="http://www.linkedin.com/groups?home=&gid=2718850" title="<?php __("Click here to access IRI's LinkedIn account",'IriTheme')?>"><img width="16" height="16" alt="FlickR" src="<?php bloginfo('stylesheet_directory'); ?>/images/icons/linkedin.png"/></a></li>
<ul>
</div>
<!--END OF THIS AREA -->
Binary file web/wp-content/themes/IRI-Theme/images/Thumbs.db has changed
Binary file web/wp-content/themes/IRI-Theme/images/icons/Thumbs.db has changed
Binary file web/wp-content/themes/IRI-Theme/images/partenaires/Thumbs.db has changed
Binary file web/wp-content/themes/IRI-Theme/language/fr_FR.mo has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/web/wp-content/themes/IRI-Theme/language/fr_FR.po Thu Mar 18 09:56:33 2010 +0000
@@ -0,0 +1,197 @@
+msgid ""
+msgstr ""
+"Project-Id-Version: WordPress 2.9.1 IriTheme\n"
+"Report-Msgid-Bugs-To: samuel.huron@centrepompidou.fr\n"
+"POT-Creation-Date: 2010-03-14 04:57+0000\n"
+"PO-Revision-Date: 2010-03-16 15:19+0100\n"
+"Last-Translator: Samuel Huron <cybunk.com>\n"
+"Language-Team: IRI\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"X-Rosetta-Version: 0.1\n"
+"X-Poedit-Country: FRANCE\n"
+"X-Poedit-SourceCharset: utf-8\n"
+"X-Poedit-KeywordsList: _e;_c;__\n"
+"X-Poedit-Basepath: .\n"
+"Plural-Forms: nplurals=2; plural=n>1\n"
+"X-Poedit-Language: French\n"
+
+#: header.php
+msgid "Home"
+msgstr "Accueil"
+
+msgid "Research"
+msgstr "Recherches"
+
+msgid "Search"
+msgstr "Rechercher"
+
+msgid "Seminars"
+msgstr "Séminaires"
+
+msgid "Workshops"
+msgstr "Ateliers"
+
+msgid "Projects"
+msgstr "Projets"
+
+msgid "Experimentations"
+msgstr "Expérimentations"
+
+msgid "Tools"
+msgstr "Outils"
+
+msgid "_"
+msgstr "_"
+
+msgid "Last Publications"
+msgstr "Dernières publications"
+
+msgid "News"
+msgstr "Actualités"
+
+msgid "Cloud of Tags"
+msgstr "Nuage de tags"
+
+msgid "Networks"
+msgstr "Réseaux"
+
+msgid "Calendar"
+msgstr "Agenda"
+
+msgid "Next Events"
+msgstr "Prochains évènements"
+
+msgid "Contact"
+msgstr "Contact"
+
+msgid "Team"
+msgstr "Crédits"
+
+msgid "this site"
+msgstr "ce site"
+
+msgid "IRI's sites"
+msgstr "sites IRI"
+
+msgid "ENMI"
+msgstr "ENMI"
+
+msgid "Advanced"
+msgstr "Avancée"
+
+msgid "on this site"
+msgstr "sur ce site"
+
+msgid "on IRI sites"
+msgstr "sur les sites IRI"
+
+msgid "on ENMI"
+msgstr "sur ENMI"
+
+msgid "on Seminars"
+msgstr "sur Séminaires"
+
+msgid "In the same category"
+msgstr "Dans la même catégorie"
+
+msgid "Search in ENMI's annotations “%s”"
+msgstr "Rechercher dans les annotations des ENMI “%s”"
+
+msgid "Search in Seminars'annotations"
+msgstr "Rechercher dans les annotations des séminaires “%s”"
+
+msgid "Search results for “%s”"
+msgstr "Résultat de la recherche pour “%s”"
+
+msgid "Click here for subscribing to IRI's calendar"
+msgstr "Cliquer ici pour vous abonner au Icalendar de l"Institut de recherche et d"innovation."
+
+msgid "Click here to access IRI's Twitter account"
+msgstr "Cliquez ici pour accéder au compte Twitter de l"Institut de recherche et d"innovation (IRI)"
+
+msgid "Click here to access IRI's Facebook account"
+msgstr "Cliquez ici pour souscrire a la page Facebook de l"Institut de recherche et d"innovation (IRI)"
+
+msgid "Click here to access IRI's Delicious account"
+msgstr "Cliquez ici pour accéder au compte Delicious de l"Institut de recherche et d"innovation (IRI)"
+
+msgid "Click here to access IRI's FlickR account"
+msgstr "Cliquez ici pour accéder au compte flick R de l"Institut de recherche et d"innovation (IRI)"
+
+msgid "Click here to access IRI's LinkedIn account"
+msgstr "Cliquez ici pour accéder au groupe linkedin de l"Institut de recherche et d"innovation (IRI)"
+
+msgid "Not Found"
+msgstr "Non trouvé"
+
+msgid "No results found."
+msgstr "Aucun résultat"
+
+msgid "Sorry, no such page."
+msgstr "Désolé, cette page n'existe pas"
+
+msgid "Next »"
+msgstr "Suivant »"
+
+msgid "Read this post"
+msgstr "Lire la suite de l'article"
+
+msgid "« Precedent"
+msgstr "« Précédent"
+
+msgid "Published"
+msgstr "Publié"
+
+msgid "Pages"
+msgstr "Pages"
+
+msgid "This post in"
+msgstr "_"
+
+msgid "Tags : "
+msgstr "Tags : "
+
+msgid "Tag Cloud"
+msgstr "Nuage de tag"
+
+msgid "Error 404 - Not Found"
+msgstr "Erreur 404 - Page non trouvée"
+
+msgid "__x_"
+msgstr "Oups... Il y a une erreur ! La page que vous avez demandé n'éxiste pas, ou plus. Vous pouvez utiliser le moteur de recherche, ou le nuage de tag pour retrouver ce que vous chercher."
+
+msgid "___x_"
+msgstr "Il n‘y a aucun résultat sur cette requcète avec le moteur de recherche interne, vous aurrez peut être plus de chance en cherchant sur les autres sites IRI grace au formulaire ci dessous : "
+
+msgid "Credits"
+msgstr "Crédits"
+
+msgid "About"
+msgstr "A propos"
+
+msgid "_x_x_x_"
+msgstr "Recherche interséminaire dans ligne de temps :"
+
+msgid "Permanent Link to"
+msgstr "Lien permanent vers"
+
+msgid "all"
+msgstr "tous"
+
+msgid "title"
+msgstr "titre"
+
+msgid "resum"
+msgstr "résumé"
+
+msgid "Contribution"
+msgstr "Contribution"
+
+msgid "content"
+msgstr "contenu"
+
+msgid "Click here to follow us !"
+msgstr "Cliquez ici pour suivre le flux RSS"
+
--- a/web/wp-content/themes/IRI-Theme/post.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/post.php Thu Mar 18 09:56:33 2010 +0000
@@ -3,7 +3,7 @@
<h2><a href="<?php the_permalink() ?>" rel="bookmark" ><?php the_title(); ?></a></h2>
<p class="small">
<?php the_time('j, F Y') ?> |
- <?php echo(__("Published")." : "); ?>
+ <?php echo(__("Published",'IriTheme')." : "); ?>
<?php
the_category(', ');
@@ -15,9 +15,14 @@
edit_post_link('Edit', ' | ', '');
?>
+ <?php
+ //echo ("ici");
+ $langdir = ((class_exists('xili_language')) ? get_cur_post_lang_dir($post->ID) : array());
+ echo ($langdir['direction']);
+ ?>
</p>
<div class="entry">
<p><?php the_excerpt_rss(); ?></p>
- <a class="more" href="<?php the_permalink() ?>" title="<?php the_title(); ?>">Lire la suite de l'article</a>
+ <a class="more" href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php _e("Read this post",'IriTheme'); ?></a>
</div>
</div>
--- a/web/wp-content/themes/IRI-Theme/search.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/search.php Thu Mar 18 09:56:33 2010 +0000
@@ -6,6 +6,7 @@
$search_text = utf8_decode(stripslashes($_GET['s']));
if (isset($_GET['engine'])){
+
$engine = $_GET['engine'];
if ($engine=="0") {
@@ -13,7 +14,7 @@
} else if ($engine=="1") {
- $title = str_replace("%s", $search_text,__("Search results for “%s”"));
+ $title = str_replace("%s", $search_text,__("Search results for “%s”",'IriTheme'));
echo ("
<h2 class='pagetitle'>".$title ."</h2><br/>
@@ -48,7 +49,7 @@
<!-- LIGNE DE TEMPS / ENMI :: RESEARCH -->
<?php if ($engine=="2") : ?>
- <h2 class='pagetitle'><?php echo(str_replace("%s", $search_text,__("Rechercher dans les annotations des ENMI “%s”"))); ?></h2>
+ <h2 class='pagetitle'><?php echo(str_replace("%s", $search_text,__("Rechercher dans les annotations des ENMI “%s”",'IriTheme'))); ?></h2>
<script src="http://amateur.iri.centrepompidou.fr/nouveaumonde/static/js/jquery.DOMWindow.js" type="text/javascript">
</script>
<script type="text/javascript">// <![CDATA[
@@ -87,22 +88,22 @@
<div>
<div id="search">
- <h6>Rechercher dans les anotations des Entretiens du nouveau monde industriel :<h6>
+ <h6><?php _e("Rechercher dans les anotations des Entretiens du nouveau monde industriel :",'IriTheme'); ?><h6>
<form id="search_form" action="http://amateur.iri.centrepompidou.fr/nouveaumonde/enmi/ldt/search/" method="post">
<input name="edition" type="hidden" value="all" /> <input id="search_ts" name="ts" type="hidden" />
<input id="s" name="search" type="text" value="<?php echo($search_text); ?>" style="width:250px;"/>
<select id="id_type" name="type" style="width:100px;">
- <option value="all">tous</option>
- <option value="project">Contribution</option>
- <option value="content">contenu</option>
+ <option value="all"><?php _e("tous",'IriTheme'); ?></option>
+ <option value="project"><?php _e("Contribution",'IriTheme'); ?></option>
+ <option value="content"><?php _e("content",'IriTheme'); ?></option>
</select>
<select id="id_field" name="field" style="width:100px;">
- <option value="all">tous</option>
- <option value="title">titre</option>
- <option value="abstract">résumé</option>
- <option value="tags">tags</option>
+ <option value="all"><?php _e("all",'IriTheme'); ?></option>
+ <option value="title"><?php _e("title",'IriTheme'); ?></option>
+ <option value="abstract"><?php _e("resum",'IriTheme'); ?></option>
+ <option value="tags"><?php _e("tags",'IriTheme'); ?></option>
</select>
<input type="submit" value="recherche" />
@@ -112,7 +113,7 @@
<br/><br/>
<hr/>
<div id="msg">
- Retrouvez l'ensemble des contenus et annotations et participez à l'annotation collaborative sur le site des Entretien à l'adresse suivante :<br/>
+ <?php _e("Retrouvez l'ensemble des contenus et annotations et participez à l'annotation collaborative sur le site des Entretien à l'adresse suivante :",'IriTheme'); ?><br/>
<a href="http://amateur.iri.centrepompidou.fr/nouveaumonde/enmi/conf/program/2009_2" target="_blank">http://amateur.iri.centrepompidou.fr/nouveaumonde/enmi/conf/program/2009_2</a>
</div>
<div class="cleaner"> </div>
@@ -122,7 +123,7 @@
<!-- LIGNE DE TEMPS / AMATEURS :: SEMINAIRES -->
<?php if ($engine=="3") : ?>
- <h2 class='pagetitle'><?php echo(str_replace("%s", $search_text,__("Rechercher dans les annotations des séminaires “%s”"))); ?></h2>
+ <h2 class='pagetitle'><?php echo(str_replace("%s", $search_text,__("Rechercher dans les annotations des séminaires “%s”",'IriTheme'))); ?></h2>
<script src="http://amateur.iri.centrepompidou.fr/nouveaumonde/static/js/jquery.DOMWindow.js" type="text/javascript">
</script>
<script type="text/javascript">// <![CDATA[
@@ -161,7 +162,7 @@
<div>
<div id="search">
<form action="http://web.iri.centrepompidou.fr/fonds/ldt/index/seminaire/__post__" method="post" id="search_form" >
- <h6>Recherche interséminaire dans ligne de temps : <h6>
+ <h6><?php _e("Recherche interséminaire dans ligne de temps :",'IriTheme'); ?> <h6>
<input id="s" type="text" name="value" value="<?php echo($search_text); ?>" />
<input type="submit" value="rechercher" />
</form>
@@ -175,7 +176,7 @@
<!-- WORDPRESS / RESEARCH -->
<?php if (have_posts() and $engine=="0") : ?>
- <h2 class="pagetitle"><?php echo(str_replace("%s", $search_text,__("Search results for “%s”"))); ?></h2>
+ <h2 class="pagetitle"><?php echo(str_replace("%s", $search_text,__("Search results for “%s”",'IriTheme'))); ?></h2>
<?php getSearch(); ?>
@@ -191,7 +192,7 @@
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
- <p class="large nomargin"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></p>
+ <p class="large nomargin"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e("Permanent Link to",'IriTheme'); the_title(); ?>"><?php the_title(); ?></a></p>
<?php
// Support for "Search Excerpt" plugin
// http://fucoder.com/code/search-excerpt/
@@ -220,7 +221,7 @@
</div>
<?php elseif($engine=="0") : ?>
- <h2 class="center"><?php _e("No results found."); ?></h2>
+ <h2 class="center"><?php _e("No results found.",'IriTheme'); ?></h2>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php // <!-- Tag Element if no result-->
--- a/web/wp-content/themes/IRI-Theme/searchform.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/searchform.php Thu Mar 18 09:56:33 2010 +0000
@@ -2,28 +2,28 @@
if ( isset($_GET['s']) ) {
$search_text= utf8_decode(stripslashes($_GET['s']));
} else {
- $search_text= "Rechercher";
+ $search_text= __('Research','IriTheme');
}
?>
<div class="box">
<div>
- <h6><?php _e("Search");?></h6>
+ <h6><?php _e('Search','IriTheme');?></h6>
<div id="search">
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<div>
+ <input type="hidden" name="lang" id="lang" value="<?php echo($current_lang['lang']); ?>" />
<input type="text" name="s" id="s"
value="<?php echo wp_specialchars($search_text, 1); ?>"
onfocus="clearInput('s', '<?php echo wp_specialchars($search_text, 1); ?>')"
onblur="clearInput('s', '<?php echo wp_specialchars($search_text, 1); ?>')"
/>
- <input type="submit" name="envoi" value="<?php _e("Search");?>" />
+ <input type="submit" name="envoi" value="<?php _e('Search','IriTheme');?>" />
<?php if (!have_posts() and isset($_GET['s'])) {
echo ("
<div id='msg' >
- Il n‘y a aucun résultat sur cette requète avec le moteur de recherche interne, vous aurrez peut être
- plus de chance en cherchant sur les autres sites IRI grace au formulaire ci dessous :
+ ".__("Il n‘y a aucun résultat sur cette requète avec le moteur de recherche interne, vous aurrez peut être plus de chance en cherchant sur les autres sites IRI grace au formulaire ci dessous :",'IriTheme')."
</div>
");
--- a/web/wp-content/themes/IRI-Theme/single.php Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/single.php Thu Mar 18 09:56:33 2010 +0000
@@ -12,7 +12,7 @@
<p class="small">
<?php the_time('j, F Y') ?> |
<?php /* the_author(); */ ?>
- <?php echo(__("Published")." : "); ?>
+ <?php echo(__("Published",'IriTheme')." : "); ?>
<?php
the_category(', ');
if($post->comment_count > 0) {
@@ -25,20 +25,22 @@
}
edit_post_link('Edit', ' | ', '');
?>
+ |
+ <?php if (class_exists('xili_language') && is_user_logged_in()) { xiliml_the_other_posts($post->ID,__("This post in",'IriTheme')," | "); } ?>
</p>
<div class="entry">
<?php the_content('<p class="serif">Read the rest of this entry »</p>'); ?>
- <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
+ <?php wp_link_pages(array('before' => '<p><strong>'.__("Pages",'IriTheme').':</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
</div>
<div class="tag">
- <?php the_tags('<strong>Mots clefs : </strong>',' | ','<br/> '); ?>
+ <?php the_tags('<strong>'.__("Tags :",'IriTheme').'</strong>',' | ','<br/> '); ?>
</div>
</div>
<?php comments_template(); ?>
<?php endwhile; else: ?>
- <p><?php _e("Sorry, no such page."); ?></p>
+ <p><?php _e("Sorry, no such page.",'IriTheme'); ?></p>
<?php endif; ?>
<!-- ADD TO ANY -->
<?php
--- a/web/wp-content/themes/IRI-Theme/style.css Tue Mar 16 14:14:44 2010 +0000
+++ b/web/wp-content/themes/IRI-Theme/style.css Thu Mar 18 09:56:33 2010 +0000
@@ -151,33 +151,16 @@
}
#maincontent .contentHome{ padding: 25px 30px 10px 48px; }
#maincontent .content { padding: 0px 30px 20px 48px; }
-#feature h3 {
- margin-bottom: 0;
- padding: 0;
-}
+#feature h3 { margin-bottom: 0; padding: 0;}
#feature p img { margin: 7px 0 2em 0; }
.feature_text { margin-top: 2em; }
#home_right { padding: 0; }
#home_right .entry { padding: 0 0 2em 0; }
-.author
-{
- padding: 1.5em;
- margin-bottom: 1.5em;
- background: #eee;
-}
-.author img
-{
- float: left;
- padding: 0 1em 1em 0;
-}
-.author p { margin-left: 8em; }
-.author h6
-{
- margin-left: 7em;
- border-bottom: 1px #000 dotted;
-}
-.navigation,
-.navigation a { color: #AAA; width:100%; }
+.author { padding: 1.5em; margin-bottom: 1.5em; background: #eee;}
+.author img { float: left; padding: 0 1em 1em 0;}
+.author p { margin-left: 8em;}
+.author h6 { margin-left: 7em; border-bottom: 1px #000 dotted;}
+.navigation, .navigation a { color: #AAA; width:100%; }
.alignright { float: right; }
.alignleft { float: left; }
.post { margin-bottom: 10px; }
@@ -964,4 +947,17 @@
padding-right:10px;
}
+.design-du-nouveau-monde-industriel {
+ background-color:#00ff1e;
+}
+.figures-de-lamateur{
+ background-color:#ff2a00;
+}
+.ecologie-de-lattention{
+ background-color:#eaff00;
+}
+.lang{
+ padding-left:650px;
+}
+