# HG changeset patch # User hurons@caf4f556-3d62-0410-8435-a86758001935 # Date 1268906193 0 # Node ID 8e3a5a6fc63e9e60a67eaa5191dde21e9ff9963d # Parent 2d410dc8c1f39fdd42bfd6ae57fc2d111a28a99d English version just for user loged view New plug in : - xili-language - xili-dictionary - xili-tidy-tags And theme modification And widget modification diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e sql/iri_wp_dump_16_03_2010.bckp.bz2 Binary file sql/iri_wp_dump_16_03_2010.bckp.bz2 has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/network-publisher/JSON.php --- /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 @@ + + * @author Matt Knapp + * @author Brett Stimmerman + * @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: + * + * + * // 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); + * + */ +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) + { + + } + } + +} + +?> diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/network-publisher/networkpub.css --- /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;} diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/network-publisher/networkpub.js --- /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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/network-publisher/networkpub.php --- /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 @@ +'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 = '
'.WIDGET_NAME.'
'; + $html .= '
'; + $html .= '
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 LinksAlpha.com, 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.
'; + $html .= '
Click Here to get API Keys for your Social Networks. You can read more about this process at LinksAlpha.com.
'; + $html .= '
Setup
'; + $html .= '
'; + $html .= '
'; + $html .= '
'; + $html .= 'Additional API Key'; + + $curr_field = 'api_key'; + $field_name = sprintf('%s_%s', WIDGET_PREFIX, $curr_field); + $html .= '
'; + $html .= '
'; + + $html .= '
'; + $html .= '
'; + $html .= '
'; + $html .= '
Currently Publishing
'; + $html .= '
'.networkpub_load().'
'; + $html .= '
'; + 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 = '
You have not added any API Key
'; + 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 = '
Error occured while trying to load the API Keys. Please try again later.
'; + return $html; + } + if($response->errorCode > 0) { + $html = '
Error occured while trying to load the API Keys. Please try again later.
'; + return $html; + } + $html = '
You are currently Publishing your Blog to '.count($response->results).' Social Networks
'; + $html .= ''; + foreach($response->results as $row) { + $html .= ''; + switch($row->type) { + case 'twitter': + $html .= ''; + break; + case 'fb_page': + $html .= ''; + break; + case 'fb_wall': + $html .= ''; + break; + case 'myspace': + $html .= ''; + break; + case 'linkedin': + $html .= ''; + break; + case 'yammer': + $html .= ''; + break; + } + $html .= ''; + } + $html .= '
API KeyNetworkOption
'.$row->api_key.'Twitter Account - '.$row->name.''.$row->api_key.'Facebook Page - '.$row->name.''.$row->api_key.''.$row->name.''.$row->api_key.'MySpace Account - '.$row->name.''.$row->api_key.'LinkedIn Account - '.$row->name.''.$row->api_key.'Yammer Account - '.$row->name.'Remove
'; + 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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/network-publisher/networkpub_ajax.php --- /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 @@ + \ No newline at end of file diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/network-publisher/readme.txt --- /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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/network-publisher/screenshot-1.png Binary file web/wp-content/plugins/network-publisher/screenshot-1.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/network-publisher/screenshot-2.png Binary file web/wp-content/plugins/network-publisher/screenshot-2.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/wp-cumulus/wp-cumulus.php --- 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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/plural.js --- /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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/plural.php --- /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 @@ + +// 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(''); + $('#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 += '' + this.value ; + } + }); + $j("textarea#dictioline_description").val(sum); +} + \ No newline at end of file diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/readme.txt --- /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 ` or ` + +Yes, since version 0.9.7. + +` +a good word +` + +can be translated by + +` +un mot exact +` + + += 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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/screenshot-1.png Binary file web/wp-content/plugins/xili-dictionary/screenshot-1.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/screenshot-2.png Binary file web/wp-content/plugins/xili-dictionary/screenshot-2.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/screenshot-3.png Binary file web/wp-content/plugins/xili-dictionary/screenshot-3.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/screenshot-4.png Binary file web/wp-content/plugins/xili-dictionary/screenshot-4.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/xili-dictionary-fr_FR.mo Binary file web/wp-content/plugins/xili-dictionary/xili-dictionary-fr_FR.mo has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/xili-dictionary-fr_FR.po --- /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 \n" +"Language-Team: Michel SCRIBAN \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" + diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/xili-dictionary.php --- /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 @@ += 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 = '' . __('Settings') . ''; + $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); + ?> +

+

+ + +

+
+

+ xili_settings['langs_folder']; + echo __("Languages sub-folder:",'xili-dictionary').' '. $langfolder; ?>
+ '; + $this->find_files(get_template_directory(), '/.mo$/', array(&$this,'available_mo_files')) ;?> +

+
+ + subselect == '') ? '' : '&tagsgroup_parent_select='.$this->subselect ); + ?> + + + + + + + + + + + + + + xili_dict_row($orderby,$tagsnamelike,$tagsnamesearch); /* the lines */ + ?> + +
+ +

()

+ +
+

+ + + +
 
+     
+ + +
 
+      +
+ 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); + } + ?> + + + description; + $textareas = explode(XPLURAL,$dictioline->description); + $firstcontent = $textareas[0]; /* also always before js splitting*/ + } else { + $areacontent = ""; + $firstcontent = ""; + } + ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

+ + +
+ +
+   + + + +
+ +
+ +
/>
+
parent == 0) { + _e('Original','xili-dictionary'); + } else { + _e('Translation','xili-dictionary'); + } + } else { + _e('Original or translation','xili-dictionary'); + } + ?> + xili_select_row($term_id,$dictioline); /* choice of parent line */?> + +
/>
name); ?>
+

+
+ + + + + +

+ xililanguage) { + case 'neveractive'; + echo '

'._e('xili-language plugin is not present !','xili-dictionary').'

'; + break; + case 'wasactive'; + echo '

'._e('xili-language plugin is not activated !','xili-dictionary').'


'; + 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;"; + ?> + +  
:PO + MO
+  
+

+ +

+ +  
+ + +
+ +
+ + +

       

+
+ +
+ +

+
+ +
+

+ +
+


+
+ :  +
+ :  + +
+

+
+ xililanguage == 'isactive') { + $listdictlanguages = get_terms(XDDICTLANGS, array('hide_empty' => false)); + foreach($listdictlanguages as $dictlanguage) { + $checked = ($this->subselect == $dictlanguage->slug) ? 'selected="selected"' :'' ; + $optionlist .= ''; + } + } else { + $langs_array = $this->xili_settings[XDDICTLANGS]; + foreach ($langs_array as $lkey => $dictlanguage) { + $checked = ($this->subselect == $lkey) ? 'selected="selected"' :'' ; + $optionlist .= ''; + } + } + 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 = ''.__('List of scanned files:','xili-dictionary').'
'; + $themeterms = $this->scan_import_theme_terms(array(&$this,'build_scanned_files'),2); + $formhow = $this->tempoutput.'

'.$formhow .''; + + 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); + ?> +
+ +

+
+ + + + +
+
+ thehook, 'side', $data); ?> +
+
+
+ + thehook, 'normal', $data); ?> +
+ +

xili-dictionary logo xili-dictionary - © xiligroup.com™ - msc 2007-9 - v.

+ +
+
+
+
+ + false,'parent' => '0')); + echo ''.__('Choose the original term (msgid) to translate','xili-dictionary').'
'; ?> + +
+ parent == 0) { + $listterms = get_terms(DTAXONAME, array('hide_empty' => false,'parent' => $term_id)); + // display childs + if (!empty($listterms)) { + echo ''.__('translated as','xili-dictionary').": "; + echo '
    '; + foreach ($listterms as $curterm) { + $edit = "".__( 'Edit' ).""; + echo '
  • '.$this->display_singular_or_plural ($curterm->description, true).' '.$edit.'
  • '; + } + echo '
'; + } else { + echo __('not yet translated','xili-dictionary')."

"; + } + } else { + echo ''.__('translation of','xili-dictionary').": "; + $edit = "".__( 'Edit' ).""; + $parent_term = get_term($editterm->parent,DTAXONAME,OBJECT,'edit'); + echo $this->display_singular_or_plural ($parent_term->description, true).' '.$edit.''; ?> + + 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 '

'.__('try another sub-selection !','xili-dictionary').'

'; + } 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 ) ? "$dictioline->count" : $dictioline->count; + + $edit = "".__( 'Edit' ).""; + /* delete link */ + $edit .= "".__( 'Delete' ).""; + /* modify to allow all html tags in msg str or id - 0.9.8.2*/ + $line=" + $dictioline->term_id + + ".$this->display_singular_or_plural($dictioline->description)." + + ".$dictioline->slug." + $dictioline->term_group + + $edit\n\t\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('
',$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 .= "
".__('List of found terms','xili-dictionary').":
"; + $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)) . "
"; + echo str_replace(".mo","",$filename ). " (".$this->ossep.str_replace($this->ossep,"",str_replace(get_template_directory(),'',$path)).")
"; + } + +} /* 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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-dictionary/xilidico-logo-32.gif Binary file web/wp-content/plugins/xili-dictionary/xilidico-logo-32.gif has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/readme.txt --- /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 : + +` + +
+... + +` +example in loop : +` +ID) : array()); +?> +
+ +` +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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-1.png Binary file web/wp-content/plugins/xili-language/screenshot-1.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-10.png Binary file web/wp-content/plugins/xili-language/screenshot-10.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-11.png Binary file web/wp-content/plugins/xili-language/screenshot-11.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-12.png Binary file web/wp-content/plugins/xili-language/screenshot-12.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-13.png Binary file web/wp-content/plugins/xili-language/screenshot-13.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-2.png Binary file web/wp-content/plugins/xili-language/screenshot-2.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-3.png Binary file web/wp-content/plugins/xili-language/screenshot-3.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-4.png Binary file web/wp-content/plugins/xili-language/screenshot-4.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-5.png Binary file web/wp-content/plugins/xili-language/screenshot-5.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-6.png Binary file web/wp-content/plugins/xili-language/screenshot-6.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-7.png Binary file web/wp-content/plugins/xili-language/screenshot-7.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-8.png Binary file web/wp-content/plugins/xili-language/screenshot-8.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/screenshot-9.png Binary file web/wp-content/plugins/xili-language/screenshot-9.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xili-language-fr_FR.mo Binary file web/wp-content/plugins/xili-language/xili-language-fr_FR.mo has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xili-language-fr_FR.po --- /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 \n" +"Language-Team: dev.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.
Here a new taxonomy was created and used for languages of posts and pages.
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...
Ici, on règle la gestion des langues.
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 :" + diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xili-language-ru_RU.mo Binary file web/wp-content/plugins/xili-language/xili-language-ru_RU.mo has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xili-language-ru_RU.po --- /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 \n" +"Language-Team: FatCow \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.
Here a new taxonomy was created and used for languages of posts.
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 "Этот плагин был разработан с таксономий, терминов и таблиц тегов спецификации.
Новая таксономия была создана и используется для языков постов.
Новые элементы доступны по выбору автора. Обновлен для 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 "Включение золотой функции " + diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xili-language-widget-fr_FR.mo Binary file web/wp-content/plugins/xili-language/xili-language-widget-fr_FR.mo has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xili-language-widget-fr_FR.po --- /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 \n" +"Language-Team: dev.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 " + diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xili-language-widget.php --- /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 @@ += 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()) : +?> + + +
    + have_posts()) : $r->the_post(); ?> +
  • + +
+ +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; +?> +

+

+ + +

+ + +

+ + +

+
+

+

© xili-language

+ '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; ?> + + + +

+

+ +
+ +

+ + '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 = "
    "; + $afterlist = '
'; + } + if (isset($options[$number]['beforeline'])) { + $beforeline = stripslashes($options[$number]['beforeline']); + $afterline = stripslashes($options[$number]['afterline']); + } else { + $beforeline = '
  • '; + $afterline = '
  • '; + } + $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 = "
      "; + $afterlist = '
    '; + $beforeline = '
  • '; + $afterline = '
  • '; + $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 ''; + // other option and list html tags + echo '
    '; + + echo '
    '.__('HTML tags of list','xili-language-widget').''; + + echo "
    "; + echo '
    '; + echo '
    '; + echo ''; + + echo '
    '; + + + // + echo ''; + + } // 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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xili-language.php --- /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 @@ +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 "\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 = '' . __('Settings') . ''; + $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 = '
    ('.__('From other post', 'xili-language').': '.$_GET['xlfrom_id'].' '.$_GET['xlfrom_lang'].')'; + } else { + $curlangname = $defaultlanguage; /* new post */ + } + } + echo __('Selected language', 'xili-language').' : '.$curlangname.' '.((0 == $post_ID) ? $mention : "").'

    ' ; /*link to bottom of sidebar*/ + foreach ($listlanguages as $language) { ?> + + + +
    +
    © xili-language + 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') { ?> +

    +

    + + + + + + + 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"; + } + } + } + + ?> + "; + } else { + $output = $this->newlinkedpost($postlang, $language->name); /* if possible */ + } + } + echo $output; + } + /* since 1.4.1 */ + if (0 != $post_ID && "" != $postlang) { + ?> + + +
    + + + "." ".__($language->description,'xili-language') .""." ".__('Edit') ."
    />
    +
    © xili-language + post_ajax) { ?> +
    + © xili-language
    + post_type == 'post') ? 'post' : 'page'; + if ($post->post_status == 'publish' || $post->post_status == 'pending' || $post->post_status == 'draft') { + if ($postlang != strtolower($targetlang)) { + return "".__('*','xili-language')."".__('Add New').""; + } + } else { + return ""; + } + } + + /** + * 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.'
    '; + return $id; + } + /* obsolete */ + function custom_refresh() { + check_ajax_referer( "oklinked" ); + $post_ID = $_POST['post_id']; + $count = 0; + $metadata = has_meta($post_ID); + $list =""; + $output = '';//Refreshed by xili-language'; + if ($metadata) + foreach ( $metadata as $entry ) { $list .= _list_meta_row( $entry, $count );} + $output .= $list; + echo $output.""; + 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 '

    All is OK '.$post_id.' ('.$mess.')

    '; // 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); + ?> + +
    + +

    +
    + + + + +
    +
    + thehook, 'side', $data); ?> +
    + +
    +
    + + thehook, 'normal', $data); ?> +
    +

    xili-language logo xili-language - © xiligroup.com™ - msc 2007-9 - v.

    +
    +
    +
    +
    + + '; /* see more precise link ?*/ + echo $term->name; + echo ''; + } + } + 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); + ?> +

    +

    + + +

    Here a new taxonomy was created and used for languages of posts and pages.
    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') ?>

    + +
    + + +
       + + + +
    +

    + +

    + + + '; + } ?> +
    +
    + +
    +
    +

    '.__('as function like:','xili-language').' _e(\'-->\',\''.THEME_TEXTDOMAIN.'\');'; } + else { + _e('Theme domain NOT defined','xili-language'); + } ?>
    + xili_settings['langs_folder']; ?>
    + '; + $this->find_files(get_template_directory(), "/.mo$/", array(&$this,"available_mo_files")) ;?> +

    +
    +

    + + 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); ?> + + + + + + + + + + + + + + + xili_lang_row(); /* the lines */?> + +
    + +

    ()

    + + + +

    >

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    />
    />
    />
    />

    +

    +
    + 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 ) ? "$language->count" : $language->count; + + $edit = "".__( 'Edit' ).""; + /* delete link*/ + $edit .= "".__( 'Delete' ).""; + + $line=" + $language->term_id + " .$language->name. " + $language->description + $language->slug + $language->term_order + $posts_count + $edit\n\t\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 = '
  • ', $after ='
  • '. + * @return list of languages of site for sidebar list. + */ + function xili_language_list($before = '
  • ', $after ='
  • ',$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 ."description,THEME_TEXTDOMAIN)."'>". __('in '.$language->description,THEME_TEXTDOMAIN) ."".$after; + } + } + echo $a; + } else { /* current list */ + foreach ($listlanguages as $language) { + $a .= $before ."description,THEME_TEXTDOMAIN)."'>". __('in '.$language->description,THEME_TEXTDOMAIN) ."".$after; + } + echo $a; + } + } + + /** + * language of current post used in loop + * @since 0.9.0 + * + * + * @param $before = '(', $after =')'. + * @return language of post. + */ + function xili_post_language($before = '(', $after =')') { + 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[] = "".__($language->description,THEME_TEXTDOMAIN) .""; + } + } 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 = ''; + //if ($curlang != DEFAULTSLUG) : + $the_catlink .= __($the_cat->name,THEME_TEXTDOMAIN).'';; + //else : + //$the_catlink .= $the_cat->name.'';; + //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.' '.__($language->description,THEME_TEXTDOMAIN).' '.$after; + echo $a; + } + echo $before.' '.__('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)) . "
    "; + echo str_replace(".mo","",$filename ). " (".$this->ossep.str_replace($this->ossep,"",str_replace(get_template_directory(),'',$path)).")
    "; + } + + /** + * 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 = '(', $after =')') { /* 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 = '
  • ', $after ='
  • ', $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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xililang-logo-32.gif Binary file web/wp-content/plugins/xili-language/xililang-logo-32.gif has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-language/xililang-logo.ico Binary file web/wp-content/plugins/xili-language/xililang-logo.ico has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/readme.txt --- /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 = +` +
    +

    + +
    + +` + += with semantic group named as category and a group containing trademarks named trademark = +` +

    + + +
    + +` += 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 = +` +
    +

    + +
    + +
    + +
    +` += 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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/screenshot-1.png Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-1.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/screenshot-2.png Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-2.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/screenshot-3.png Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-3.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/screenshot-4.png Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-4.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/screenshot-5.png Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-5.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/screenshot-6.png Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-6.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/screenshot-7.png Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-7.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/screenshot-8.png Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-8.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/screenshot-9.png Binary file web/wp-content/plugins/xili-tidy-tags/screenshot-9.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/xili-favicon.ico Binary file web/wp-content/plugins/xili-tidy-tags/xili-favicon.ico has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/xili-tidy-tags.php --- /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 @@ +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 = '' . __('Settings') . ''; + $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 .= ''.$group->name.' - '; + } + $checkline .='

    '.__('© by xili-tidy-tags.','xili_tidy_tags').''; + echo '

    '.$checkline.'
    '; + } + + /** + * 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 .= ''.$group->name.' - '; + } + $checkline .='

    '.__('© by xili-tidy-tags.','xili_tidy_tags').''; + echo '

    '.$checkline.'
    '; + } + + /** + * 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); + ?> +

    +

    + '.__('On this page, the tags groups are defined. The special groups for xili-language plugin are importable.
    For debug, some technical infos are displayed in the tables or boxes.
    ','xili_tidy_tags').'

    '; + } elseif ($xili_tidy_tags_page == 'assign') { + echo '

    '.__('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 xili-tidy-tags plugin.','xili_tidy_tags').'

    '; + } ?> +

    xili-tidy-tags 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') ?>

    + 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"'; + } + + ?> +
    +

    + +

    '; + } + + /* + * Action's box + */ + function on_sidebox_3_content($data=array()) { + extract($data); + echo '
    '; + echo '

    '.__('Add a tag\'s group for a chosen category','xili_tidy_tags').'

    '; + /* build the selector of available categories */ + $categories = get_categories(array('get'=>'all')); /* even if cat is empty */ + echo ''; + echo '

    '.__('Choose a parent tag\'s group','xili_tidy_tags').'

    '; + $listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false)); + ?> + +
    +

    '; + echo '

    '.__('See docs to set xili_tidy_tag_cloud function or widget to implement in theme…','xili_tidy_tags').'

    '; + echo '
    '; + echo '
    '; + if (!defined('TAXONAME')) { ?> +

    + false,'parent' => $res['term_id'])); + if ($res && !empty($childterms)) { + ?> +

    + 0 ) { + echo '

    '.__('It is possible to import the group of languages.','xili_tidy_tags').'

    '; + echo '

    '; + } else { + echo '

    '.__('Go to settings of xili-language plugin and add languages','xili_tidy_tags').'

    '; + } + } else { + echo '

    '.__('See administrator for language settings.','xili_tidy_tags').'

    '; + } + } + } + echo '
    '; + + } + + function on_normal_1_content($data=array()) { + extract($data); ?> + + + + + + + + + + + + + + + + xili_tags_group_row(); /* the lines */?> + +
    + + + +

    >

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    />
    />
    />
    + xili_selectparent_row($tagsgroup->term_id,$tagsgroup,$action); /* choice of parent line*/?> +

    +

    +
    + false)); + ?> + +
    + 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 '
      '; + foreach ($listterms as $curterm) { + echo '
    • '.$curterm->name.'
    • '; + } + echo '
    '; + } else { + echo __('no child now','xili_tidy_tags')."

    "; + } + /* if modify*/ + if($action=='edit') { + $listterms = get_terms(TAXOTIDYTAGS, array('hide_empty' => false)); + ?> + +
    + parent,TAXOTIDYTAGS,OBJECT,'edit'); + if($action=='delete') { + echo __('child of: ','xili_tidy_tags'); + echo $parent_term->name; ?> + + false)); + ?> + +
    + 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); + ?> +
    + +

    +
    + + + + +
    +
    + thehook, 'side', $data); ?> +
    +
    +
    + + thehook, 'normal', $data); ?> +
    + +

    xili-tidy-tags logo xili-tidy-tags - © xiligroup.com™ - msc 2009-10 - v.

    + +
    +
    +
    +
    + + + '', '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 ) ? "$tagsgroup->count" : $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 = "".__( 'Edit' ).""; + /* delete link &action=edit&term_id=".$tagsgroup->term_id."*/ + $edit .= "".__( 'Delete' ).""; + } else { + $edit = __('no capability','xili_tidy_tags').''; + } + + $line=" + $tagsgroup->term_id + "; + $tabb = ($tagsgroup->parent != 0) ? " –" : "" ; + $tagsgroupname = ($tagsgroup->parent == 0) ? "".$tagsgroup->name."": $tagsgroup->name; + $line .= "$tabb $tagsgroupname + $tagsgroup->description + $tagsgroup->slug + $tagsgroup->term_taxonomy_id + $tagsgroup->parent + $tagsgroup->count + $edit\n\t\n"; /*to complete*/ + echo $line; + } + + } + + function on_sub_normal_1_content ($data=array()) { + extract($data); ?> + + + + + + + + + + + + xili_tags_row($tagsnamelike,$tagsnamesearch); /* the lines */?> + +
    + + +

    +

           

    + +
    + +
    + +

    + + false)); + $listtagsgroupssorted = walk_TagGroupList_sorted($listterms,3); + ?> + + + +  –  + +
    +

           

    +
    + +
    + false)); ?> + +

    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 ) ? "$tag->count" : $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 .= ''; + } else { + $edit = str_replace('checked'.$groupid,'',$edit); + } + } + $line=" + $tag->term_id + ".$tag->name." + $posts_count + $edit\n$hiddenlines\n\t\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*/ + + ?> +
    + +

    +
    + + + + +
    +
    + thehook2, 'side', $data); ?> +
    +
    +
    + + thehook2, 'normal', $data); ?> +
    + +

    xili-tidy-tags logo xili-tidy-tags - © xiligroup.com™ - msc 2009-10 - v.

    + +
    +
    +
    +
    + + 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[] = ''; + } + + $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 = ''.$term->name.''; + } + + $output .= '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 .= "
    "; + } +} + +/** + * 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 '
    '; + xili_tidy_tag_cloud(implode("&",$cloudsargs)); + echo '
    '; + } + 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 ''; + // other options min max number group 1 and 2 tagsallgroup + echo ''; + echo ''; + + echo '
    '; + echo ''; + echo '
    '; + + + echo '
    '.__('Order and sorting infos','xili_tidy_tags').''; + echo '
    '; + + echo ''; + echo '
    '; + // + echo ''; + + } // 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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/xili_tidy_tags-fr_FR.mo Binary file web/wp-content/plugins/xili-tidy-tags/xili_tidy_tags-fr_FR.mo has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/xili_tidy_tags-fr_FR.po --- /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 \n" +"Language-Team: dev.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.
    For debug, some technical infos are displayed in the tables or boxes.
    " +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.
    Il y a des infos techniques dans les tables et boites pour le debogguage.
    " + +#: 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 xili-tidy-tags 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 xili-tidy-tags." + +#: xili-tidy-tags.php:225 +msgid "xili-tidy-tags is a tool for grouping tags by language or semantic group. Initially developed to enrich multilingual website powered by xili-language plugin." +msgstr "xili-tidy-tags 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." + diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xili-tidy-tags/xilitidy-logo-32.gif Binary file web/wp-content/plugins/xili-tidy-tags/xilitidy-logo-32.gif has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xilitheme-select/readme.txt --- /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 + + diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xilitheme-select/screenshot-1.png Binary file web/wp-content/plugins/xilitheme-select/screenshot-1.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xilitheme-select/screenshot-2.png Binary file web/wp-content/plugins/xilitheme-select/screenshot-2.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xilitheme-select/xilitheme-logo-32.gif Binary file web/wp-content/plugins/xilitheme-select/xilitheme-logo-32.gif has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xilitheme-select/xilithemeselect-fr_FR.mo Binary file web/wp-content/plugins/xilitheme-select/xilithemeselect-fr_FR.mo has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xilitheme-select/xilithemeselect-fr_FR.po --- /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 \n" +"Language-Team: Michel, xiligroup \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 xilithemeselect 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.
    Don't forget to upload a specific theme for ipod touch / iphone with a right folder's name in the wp-content/themes folder.
    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.
    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’).
    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 :" + diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/xilitheme-select/xilithemeselect.php --- /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 @@ +iPhone and iPod touch. +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 = '' . __('Settings') . ''; + $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 "
    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'=>'','after'=>'','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']).'' + .stripslashes($displayhtml['mobbro']).''.stripslashes($displayhtml['after']); + } else { + $output = stripslashes($displayhtml['before']).'' + .stripslashes($displayhtml['bro']).''.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 '

    '.__("Plugin xilithemeselect settings saved.","xilithemeselect").'

    '; + } + + ?> +
    +

    +

    Xilitheme select Don't forget to upload a specific theme for ipod touch / iphone with a right folder's name in the wp-content/themes folder.
    If an error occur, the current theme is displayed in ipod touch / iphone browser.","xilithemeselect"); ?>

    +

    ".$this->currentthemefolder ?>.
    + ".$this->currentthemefolder.$this->xilithemeextension." "; + $curpath = get_theme_root()."/".$this->currentthemefolder.$this->xilithemeextension; + if (file_exists($curpath)) : + _e("is available","xilithemeselect"); + else : + _e("is NOT available","xilithemeselect"); + endif; + ?>,
    +
    + ".$this->xilithemefullname." "; + $curpath = get_theme_root()."/".$this->xilithemefullname; + if (file_exists($curpath)) : + _e("is available","xilithemeselect"); + else : + _e("is NOT available","xilithemeselect"); + endif; + ?> +

    +
    + + +
    +
      +
    • + +
    • +
    • + +
    • +
    • + +
    • + +
    +
    +

    +
    +

    xilitheme-select logo xilitheme-select - © xiligroup.com™ - msc 2007-9 - v.

    +
    + 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='); +*/ +/* 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'=>'','after'=>'','bro'=>'browser','mobbro'=>'iTouch'); + $r = array_merge($defaults, $r); + + global $wp_ismobile; + echo $wp_ismobile->display_themetype($r); +} +?> \ No newline at end of file diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/ar.png Binary file web/wp-content/plugins/zdmultilang/flags/ar.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/be_BY.png Binary file web/wp-content/plugins/zdmultilang/flags/be_BY.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/bg_BG.png Binary file web/wp-content/plugins/zdmultilang/flags/bg_BG.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/bn_BD.png Binary file web/wp-content/plugins/zdmultilang/flags/bn_BD.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/ca.png Binary file web/wp-content/plugins/zdmultilang/flags/ca.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/cy.png Binary file web/wp-content/plugins/zdmultilang/flags/cy.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/cz_CZ.png Binary file web/wp-content/plugins/zdmultilang/flags/cz_CZ.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/da_DK.png Binary file web/wp-content/plugins/zdmultilang/flags/da_DK.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/de_DE.png Binary file web/wp-content/plugins/zdmultilang/flags/de_DE.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/el.png Binary file web/wp-content/plugins/zdmultilang/flags/el.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/en_GB.png Binary file web/wp-content/plugins/zdmultilang/flags/en_GB.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/en_US.png Binary file web/wp-content/plugins/zdmultilang/flags/en_US.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/eo.png Binary file web/wp-content/plugins/zdmultilang/flags/eo.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/es_ES.png Binary file web/wp-content/plugins/zdmultilang/flags/es_ES.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/et.png Binary file web/wp-content/plugins/zdmultilang/flags/et.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/eu.png Binary file web/wp-content/plugins/zdmultilang/flags/eu.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/fi_FI.png Binary file web/wp-content/plugins/zdmultilang/flags/fi_FI.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/fo.png Binary file web/wp-content/plugins/zdmultilang/flags/fo.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/fr_FR.png Binary file web/wp-content/plugins/zdmultilang/flags/fr_FR.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/gl_ES.png Binary file web/wp-content/plugins/zdmultilang/flags/gl_ES.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/he_IL.png Binary file web/wp-content/plugins/zdmultilang/flags/he_IL.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/hr.png Binary file web/wp-content/plugins/zdmultilang/flags/hr.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/hu_HU.png Binary file web/wp-content/plugins/zdmultilang/flags/hu_HU.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/id_ID.png Binary file web/wp-content/plugins/zdmultilang/flags/id_ID.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/is_IS.png Binary file web/wp-content/plugins/zdmultilang/flags/is_IS.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/it_IT.png Binary file web/wp-content/plugins/zdmultilang/flags/it_IT.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/ja.png Binary file web/wp-content/plugins/zdmultilang/flags/ja.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/km_KH.png Binary file web/wp-content/plugins/zdmultilang/flags/km_KH.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/ko_KR.png Binary file web/wp-content/plugins/zdmultilang/flags/ko_KR.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/ku.png Binary file web/wp-content/plugins/zdmultilang/flags/ku.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/lt.png Binary file web/wp-content/plugins/zdmultilang/flags/lt.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/lv.png Binary file web/wp-content/plugins/zdmultilang/flags/lv.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/mg_MG.png Binary file web/wp-content/plugins/zdmultilang/flags/mg_MG.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/mk_MK.png Binary file web/wp-content/plugins/zdmultilang/flags/mk_MK.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/ms_MY.png Binary file web/wp-content/plugins/zdmultilang/flags/ms_MY.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/nb_NO.png Binary file web/wp-content/plugins/zdmultilang/flags/nb_NO.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/nl_NL.png Binary file web/wp-content/plugins/zdmultilang/flags/nl_NL.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/pl_PL.png Binary file web/wp-content/plugins/zdmultilang/flags/pl_PL.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/pt_BR.png Binary file web/wp-content/plugins/zdmultilang/flags/pt_BR.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/pt_PT.png Binary file web/wp-content/plugins/zdmultilang/flags/pt_PT.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/ro.png Binary file web/wp-content/plugins/zdmultilang/flags/ro.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/ru_RU.png Binary file web/wp-content/plugins/zdmultilang/flags/ru_RU.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/si_LK.png Binary file web/wp-content/plugins/zdmultilang/flags/si_LK.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/sk.png Binary file web/wp-content/plugins/zdmultilang/flags/sk.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/sl_SI.png Binary file web/wp-content/plugins/zdmultilang/flags/sl_SI.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/sr_RS.png Binary file web/wp-content/plugins/zdmultilang/flags/sr_RS.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/sv_SE.png Binary file web/wp-content/plugins/zdmultilang/flags/sv_SE.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/th.png Binary file web/wp-content/plugins/zdmultilang/flags/th.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/tr.png Binary file web/wp-content/plugins/zdmultilang/flags/tr.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/ua_UA.png Binary file web/wp-content/plugins/zdmultilang/flags/ua_UA.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/uz_UZ.png Binary file web/wp-content/plugins/zdmultilang/flags/uz_UZ.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/vi_VN.png Binary file web/wp-content/plugins/zdmultilang/flags/vi_VN.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/zh_CN.png Binary file web/wp-content/plugins/zdmultilang/flags/zh_CN.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/zh_HK.png Binary file web/wp-content/plugins/zdmultilang/flags/zh_HK.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/flags/zh_TW.png Binary file web/wp-content/plugins/zdmultilang/flags/zh_TW.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/images/add.png Binary file web/wp-content/plugins/zdmultilang/images/add.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/images/edit.png Binary file web/wp-content/plugins/zdmultilang/images/edit.png has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/lang/zd_multilang-es_ES.mo Binary file web/wp-content/plugins/zdmultilang/lang/zd_multilang-es_ES.mo has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/lang/zd_multilang-es_ES.po --- 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 < >, 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 \n" -"Language-Team: en_US \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\"" - diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/lang/zd_multilang-fr_FR.mo Binary file web/wp-content/plugins/zdmultilang/lang/zd_multilang-fr_FR.mo has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/lang/zd_multilang-fr_FR.po --- 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 < >\n" -"Language-Team: Zen-Dreams \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" - diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/lang/zd_multilang-pt_BR.mo Binary file web/wp-content/plugins/zdmultilang/lang/zd_multilang-pt_BR.mo has changed diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/lang/zd_multilang-pt_BR.po --- 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 \n" -"Language-Team: Dionizio Bonfim Bach \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" - diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/lang/zd_multilang.pot --- 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 " -"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 diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/readme.txt --- 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 Pau Sanchez -* 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") diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/plugins/zdmultilang/zd_multilang.php --- 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 @@ - $LanguageID) { - if ($LanguageID!=$ZdmlCache['DefLang']) echo ''.$LanguageID.' '; - } - } -} - -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 ''.$LanguageID.''; - } - } -} - -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".'
    '; - if ($_POST['fct']) $_GET['fct']=$_POST['fct']; - switch ($_GET['fct']) { - case 'options': - if ($current_user->allcaps['manage_options']==1) - zd_multilang_options(); - else { - echo '

    Only the administrator can edit the options

    '; - zd_multilang_dashboard(); - } - break; - case 'edit': - if ($current_user->allcaps['manage_options']==1) - zd_multilang_edit_language(); - else { - echo '

    Only the administrator can edit the options

    '; - zd_multilang_dashboard(); - } - break; - case 'delete': - if ($current_user->allcaps['manage_options']==1) - zd_multilang_delete_language(); - else { - echo '

    Only the administrator can edit the options

    '; - 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 '

    Only the administrator can edit the options

    '; - zd_multilang_dashboard(); - } - break; - case 'links': - zd_multilang_link_translations(); - break; - default: - zd_multilang_dashboard(); - break; - } - echo "\n
    "; -} - -function zd_multilang_dashboard() { - global $BaseURL, $current_user; - get_currentuserinfo();; - echo '

    '.__('Language Dashboard','zd_multilang').'

    '; - echo ''; - echo '
    - - - - -
    '; -} - -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 '
    - - - - -
    '; - - 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 '
    '; - 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 '

    '.__('Default Languages Exchanged','zd_multilang').'

    '; - } - echo '

    '.__('Options updated','zd_multilang').'

    '; - echo '
    '; - } - $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 ''; - - echo "\n\t

    ".__('General Options','zd_multilang')."

    "; - echo "\n\t".'
    '; - echo "\n\t".''; - echo "\n\t".''; - echo "\n\t".''; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo '
    ".__('Level required to translate items','zd_multilang').""; - echo ''; - echo "
    ".__('Default Language','zd_multilang').""; - echo ''; - echo "
    ".__('Exchange Languages','zd_multilang')."
    ".__('Only use this option if you want to switch old default language with new one. This will exchange translations between them','zd_multilang')."
    "; - echo ''; - echo "
    ".__('Display Original post while translating','zd_multilang').""; - echo ''; - echo "
    ".__('Automatically save translation every 5 minutes','zd_multilang').""; - echo ''; - echo "
    ".__('Generate permalink for Default language','zd_multilang').""; - echo ''; - echo "
    ".__('Keep separate comments for each language','zd_multilang').""; - echo ''; - echo "
    ".__('Display untranslated posts','zd_multilang').""; - echo ''; - echo "
    ".__('If Yes, display link "Translate Original post with Google Translate"','zd_multilang').""; - echo ''; - echo "
    '; - echo '

    '.__('Language Switcher','zd_multilang').'

    '; - echo "\n\t".''; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; echo "\n\t\t"; - echo "\n\t".'
    ".__('Show Language Switcher in post','zd_multilang').""; - echo ''; - echo "
    ".__('Language Switcher Position','zd_multilang').""; - echo ''; - echo "
    ".__('Show Language names in switcher','zd_multilang').""; - echo ''; - echo "
    ".__('Show Flags in switcher','zd_multilang').""; - echo ''; - echo "
    ".__('Language Switcher CSS class','zd_multilang').""; - echo ''; - echo "
    '; - echo "\n\t".'

    '; - echo "\n".'
    '; -} - -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 '

    '; - 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 '

    '; - 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 "

    ".__('Languages','zd_multilang').'


    '; - echo "

    ".__('Edit Language','zd_multi').' '.$_GET['lang'].'

    '; - echo "\n\t".'
    '; - echo "\n\t".''; - echo "\n\t".''; - echo "\n\t".''; - echo "\n\t".''; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t".'
    ".__('Language Name','zd_multilang').""; - echo ''; - echo "
    ".__('Language Permalink','zd_multilang').""; - echo ''; - echo "
    ".__('Blog name','zd_multilang').""; - echo ''; - echo "
    ".__('Blog description','zd_multilang').""; - echo ''; - echo "
    ".__('Default Language','zd_multilang')." ?"; - if ($row['LanguageID']==$DefaultLanguage) $selected='checked="on"'; - else $selected=""; - echo ''; - echo "
    '; - echo "\n\t".'

    '; - echo "\n\t
    "; -} - -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 "

    ".__('Languages','zd_multilang').'


    '; - - if ($_POST[$hidden_field]) { - $Action=$_POST[$hidden_field]; - $LangCode=$_POST['lang_code']; - $LangName=$_POST['lang_name']; - $LangPermalink=$_POST['lang_permalink']; - echo '

    '; - 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 '


    '; - } - - $DefaultLanguage=$ZdmlCache['DefLang']; - $query="SELECT * FROM $language_table order by LanguageName"; - $Languages=$wpdb->get_results($query, ARRAY_A); - if ($Languages) { - echo ''; - echo ''; - foreach ($Languages as $Index => $Values) { - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - } - echo '
    '.__('Action','zd_multilang').''.__('Language Name','zd_multilang').''.__('Language Code','zd_multilang').''.__('Permalink','zd_multilang').''.__('Default','zd_multilang').'
    '.__('Edit','zd_multilang').' - '.__('Delete','zd_multilang').' '.$Values['LanguageName'].''.$Values['LanguageID'].''.$Values['LangPermalink'].' '; - if ($Values['LanguageID']==$DefaultLanguage) echo "".__('Default Language', 'zd_multilang').""; - echo '
    '; - } - - echo "

    ".__('Add Language','zd_multilang').'

    '; - echo "\n\t".'
    '; - echo "\n\t".''; - echo "\n\t".''; - echo "\n\t".''; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t\t"; - echo "\n\t".'
    ".__('Language Name','zd_multilang').""; - echo ''; - echo "
    ".__('Language Code','zd_multilang').""; - echo ''; - echo "
    ".__('Language Permalink','zd_multilang').""; - echo ''; - echo "
    ".__('Default Language','zd_multilang')." ?"; - echo ''; - echo "
    '; - echo "\n\t".'

    '; - echo "\n\t

    ".__('Show/Hide Available default codes','zd_multilang')."

    "; - - $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 ' -'; - - $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 '

    '; - echo __('Language deleted','zd_multilang'); - echo '

    '; - 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 "

    ".__('Posts & Pages','zd_multilang').'

    '; - - $query="SELECT * FROM $language_table order by LanguageName"; - $Languages=$wpdb->get_results($query, ARRAY_A); - if (!$Languages) { - echo '

    '.__('No languages defined, please define some first','zd_multilang').'

    '; - 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 '

    '; - echo __('Post or Page updated','zd_multilang'); - echo '


    '; - $_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 '
    '; - $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 '
    '; - echo ''; - echo ''; - echo '
    '; - echo '
    -
    -
    -

    -

    - -

    - -
    -

    - -
    -

    - -
    '; - echo '
    '; - - echo '
    '; - echo '
    '; - echo '

    '.__('Title','zd_multilang').'

    '; - echo '
    '; - echo '
    '; - echo '
    '; - echo '

    '.__('Translations','zd_multilang').'

    '; - echo ''; - the_editor($res[0]['post_content']); - echo '
    '; - echo '

    '.__('Excerpt','zd_multilang').'

    -
    - -
    '; - $DisplayOriginal=get_option($display_original_option); - if ($DisplayOriginal=='yes') { - $OriginalPost = apply_filters('the_content', $OriginalPost); - $OriginalPost = str_replace(']]>', ']]>', $OriginalPost); - echo '

    '.__('Original post','zd_multilang').'

    -
    '.$OriginalPost.'
    '; - } - echo '
    '; - echo '
    '; - if ($Autosave=='yes') { - wp_print_scripts('sack'); - echo ''; - } - echo '
    -
    '; - echo ''; - } 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 ''; - echo ''; - foreach ($Languages as $Lang) { - if ($Lang['LanguageID']!=$DefaultLanguage) echo ''; - } - echo ''; - foreach ($results as $ID => $row) { - echo ''; - echo ''; - echo ''; - foreach ($Languages as $Lang) { - if ($Lang['LanguageID']!=$DefaultLanguage) { - echo ''; - } - } - echo ''; - } - echo '
    '.__('Original title','zd_multilang').''.__('Published date', 'zd_multilang').''.$Lang['LanguageName'].'
    '.$row['post_title'].''.date_i18n(get_option('date_format').' - '.get_option('time_format'),strtotime($row['post_date'])).''; - if ($Posts[$row['ID']][$Lang['LanguageID']]) echo ' '.__($Posts[$row['ID']][$Lang['LanguageID']],'zd_multilang'); - else echo ' '.__('Translate','zd_multilang'); - echo '
    '; - } - } 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("Transaltion has been automatically saved at '.strftime("%H:%M on %Y/%m/%d").'"); - 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 "

    ".__('Links','zd_multilang').'

    '; - $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 ' - - - - - - -
    '.$Link->o_name.''.$Link->o_url.''.$Link->o_desc.'
    '; - echo '
    - - - - - -

    -
    '; - } - } 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 ''; - echo ''; - foreach ($ZdmlCache['Languages'] as $LanguageID => $Lang) { - if ($Lang!=$DefLang) echo ''; - } - echo ''; - if ($Link) - foreach ($Link as $link_id => $L) { - echo ''; - echo ''; - foreach ($ZdmlCache['Languages'] as $LanguageID => $Lang) { - if ($Lang!=$DefLang) echo ''; - } - echo ''; - } - echo '
    '.__('Original Link','zd_multilang').' '.$ZdmlCache['LanguageNames'][$LanguageID].'
    '.$L['o_name'].' '.__('Translate','zd_multilang').'
    '; - } -} - -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 "

    ".__('Translations','zd_multilang').'

    '; - $Option=$_GET['tr']; - $DefaultLanguage=$ZdmlCache['DefLang']; - - $query="SELECT * FROM $language_table order by LanguageName"; - $Languages=$wpdb->get_results($query, ARRAY_A); - if (!$Languages) { - echo '

    '.__('No languages defined, please define some first','zd_multilang').'

    '; - 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 '
    '; - echo "\n\t".''; - echo "\n\t".''; - echo "\n\t".''; - echo "\n\t".''; - - echo "\n\t".''; - echo ''; - foreach ($Languages as $Lang) { - if ($Lang['LanguageID']!=$DefaultLanguage) { - echo ''; - echo ''; - echo ''; - echo ''; - echo ''; - } - } - echo '
    '.__('Original Term','zd_multilang').''.$res['name'].''.$res['description'].'
    '.$Lang['LanguageName'].'
    '; - echo "\n\t".'

    '; - echo "
    "; - } 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 ''; - echo ''; - foreach ($Languages as $Lang) { - if ($Lang['LanguageID']!=$DefaultLanguage) echo ''; - } - echo ''; - foreach ($Results as $Id => $Value) { - $term_id=$Value['term_id']; - echo ''; - foreach ($Languages as $Lang) { - if ($Lang['LanguageID']!=$DefaultLanguage) echo ''; - } - echo ''; - } - echo '
     '.__('Original Term','zd_multilang').' '.$Lang['LanguageName'].'
    '.$Value['name'].''.$Translations[$term_id][$Lang['LanguageID']].'
    '; - } - } -} - -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("|(.*)(.*)(.*)|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("|(.*)(.*)(.*)|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('|()(.*)()|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="

    ".__('Translate original post with Google Translate',"zd_multilang").'

    ' - .$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=""; - - 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.=""; - $retour.=''; - if (get_option($show_flags_option)=="show") $retour.=''.$ZdmlCache['LanguageNames'][$row['LangPermalink']].''; - if (get_option($show_languages_option)=="show") $retour.=$ZdmlCache['LanguageNames'][$row['LangPermalink']]; - $retour.=''; - $retour.=''; - } - } - $retour.=''; - 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.='
  • '; - if ($show_flags) $retour.=''; - if ($show_name) $retour.=' '.$row['LanguageName']; - $retour.='
  • '; - } - } - 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 '
      '; - echo zd_multilang_menu($WidgetOptions,get_option('zdml_widget_options_flag')); - echo '
    '; - - 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 '

    '; - echo '

    '; - echo '

    '; -} - - -/** 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'); - -?> diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/themes/IRI-Theme/404.php --- 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); diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/themes/IRI-Theme/archive.php --- 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 @@
    + - +

    Archive for

    @@ -23,14 +26,14 @@
    -

    Mot-clef :

    +

     
    -

    Not Found

    +

    diff -r 2d410dc8c1f3 -r 8e3a5a6fc63e web/wp-content/themes/IRI-Theme/functions.php --- 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 @@ '; + $flashtag .= ''; + // ------------------------------------------------------------------------------------ + $flashtag .= '
    '; + if( $options['showwptags'] == 'true' ){ $flashtag .= '

    '; } else { $flashtag .= '

    '; }; + // alternate content + if( $options['mode'] != "cats" ){ $flashtag .= urldecode($tagcloud); } + if( $options['mode'] != "tags" ){ $flashtag .= urldecode($cats); } + $flashtag .= '

    '; + $flashtag .= ''; + } else { + $flashtag = ''; + $flashtag .= ''; + $flashtag .= ''; + $flashtag .= ''; + $flashtag .= ''; + if( $options['trans'] == 'true' ){ + $flashtag .= ''; + } + $flashtag .= '') . $tagcloud . urlencode(''); + } + // put categories in flashvar + if( $options['mode'] != "tags" ){ + $flashtag .= '&categories=' . $cats; + } + $flashtag .= '" />'; + // alternate content + if( $options['mode'] != "cats" ){ $flashtag .= '

    '.urldecode($tagcloud).'

    '; } + if( $options['mode'] != "tags" ){ $flashtag .= '

    '.urldecode($cats).'

    '; } + $flashtag .= ''; + $flashtag .= '
    '; + } + 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"]."
    "); + 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 .= '
  • ' . $post_title_l . '
  • '; + } + } + + echo '
      '; + echo $postlist; + echo '
    '; + +} + +# +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: + ?> +
    + posts} WHERE ID='".$pageid."' AND post_type = 'page';"; + $mine = $wpdb->get_results($pagina); + if($mine[0]->post_title!=""){ + ?> +
    +

    post_title; ?>

    +

    post_content,1); ?>

    +
    +
    +
    + ".$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 ('