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()) :
+?>
+
+
+