[4031] | 1 | <?php |
---|
| 2 | /* |
---|
| 3 | Plugin Name: Public Piwigo WordPress Widget |
---|
[4055] | 4 | Plugin URI: http://piwigo.org/ext/extension_view.php?eid= |
---|
[4031] | 5 | Description: Public Piwigo WordPress Widget (PW^2) is a WordPress 2.8 widget, it links a public picture in your Piwigo gallery (<a href="http://piwigo.org/">Piwigo</a>). In other words, it's a WordPress Sidebar Widget with some available public pictures in your Piwigo gallery as a prereq. |
---|
[4055] | 6 | Version: 1.00 |
---|
[4031] | 7 | Author: VDigital |
---|
[4055] | 8 | Author URI: http://www.vdigital.org/sharing/ |
---|
[4031] | 9 | */ |
---|
[4055] | 10 | if (defined('PHPWG_ROOT_PATH')) return; /* Avoid Automatic install under Piwigo */ |
---|
| 11 | /* Copyright 2009 VDigital (email : vpiwigo[at]gmail[dot]com) |
---|
[4031] | 12 | |
---|
[4055] | 13 | This program is free software; you can redistribute it and/or modify |
---|
| 14 | it under the terms of the GNU General Public License as published by |
---|
| 15 | the Free Software Foundation; either version 2 of the License, or |
---|
| 16 | (at your option) any later version. |
---|
[4031] | 17 | |
---|
[4055] | 18 | This program is distributed in the hope that it will be useful, |
---|
| 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 21 | GNU General Public License for more details. |
---|
[4031] | 22 | |
---|
[4055] | 23 | You should have received a copy of the GNU General Public License |
---|
| 24 | along with this program; if not, write to the Free Software |
---|
| 25 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 26 | */ |
---|
| 27 | if (!defined('PPW_NAME')) define('PPW_NAME','Public Piwigo WordPress '); |
---|
| 28 | if (!defined('PPW_PFX')) define('PPW_PFX','Public_Piwigo_WordPress_'); |
---|
[4039] | 29 | |
---|
[4055] | 30 | class Public_Piwigo_WordPress_Widget extends WP_Widget |
---|
| 31 | { |
---|
| 32 | function Public_Piwigo_WordPress_Widget(){ |
---|
| 33 | $widget_ops = array('classname' => PPW_PFX . 'Widget', |
---|
| 34 | 'description' => __( "Adds a thumbnail and its link (to the picture) inside your blog sidebar.") ); |
---|
| 35 | $control_ops = array('width' => 300, 'height' => 300); |
---|
| 36 | $this->WP_Widget(PPW_PFX . 'Widget', PPW_NAME . 'Widget', $widget_ops, $control_ops); |
---|
| 37 | } |
---|
| 38 | // Code generator |
---|
| 39 | function widget($args, $gallery){ |
---|
| 40 | include 'Public_WP_Piwigo_code.php'; |
---|
| 41 | } |
---|
| 42 | function update($new_gallery, $old_gallery){ |
---|
| 43 | $gallery = $old_gallery; |
---|
| 44 | $gallery['title'] = strip_tags(stripslashes($new_gallery['title'])); |
---|
| 45 | $gallery['thumbnail'] = (strip_tags(stripslashes($new_gallery['thumbnail'])) == 'true') ? 'true':'false'; |
---|
| 46 | $gallery['piwigo'] = strip_tags(stripslashes($new_gallery['piwigo'])); |
---|
| 47 | $gallery['external'] = strip_tags(stripslashes($new_gallery['external'])); |
---|
| 48 | $gallery['number'] = intval(strip_tags(stripslashes($new_gallery['number']))); |
---|
| 49 | $gallery['category'] = intval(strip_tags(stripslashes($new_gallery['category']))); |
---|
| 50 | $gallery['from'] = intval(strip_tags(stripslashes($new_gallery['from']))); |
---|
| 51 | $gallery['divclass'] = strip_tags(stripslashes($new_gallery['divclass'])); |
---|
| 52 | $gallery['class'] = strip_tags(stripslashes($new_gallery['class'])); |
---|
| 53 | $gallery['most_visited'] = (strip_tags(stripslashes($new_gallery['most_visited'])) == 'true') ? 'true':'false'; |
---|
| 54 | $gallery['best_rated'] = (strip_tags(stripslashes($new_gallery['best_rated'])) == 'true') ? 'true':'false'; |
---|
| 55 | $gallery['most_commented'] = (strip_tags(stripslashes($new_gallery['most_commented'])) == 'true') ? 'true':'false'; |
---|
| 56 | $gallery['random'] = (strip_tags(stripslashes($new_gallery['random'])) == 'true') ? 'true':'false'; |
---|
| 57 | $gallery['recent_pics'] = (strip_tags(stripslashes($new_gallery['recent_pics'])) == 'true') ? 'true':'false'; |
---|
| 58 | $gallery['calendar'] = (strip_tags(stripslashes($new_gallery['calendar'])) == 'true') ? 'true':'false'; |
---|
| 59 | $gallery['tags'] = (strip_tags(stripslashes($new_gallery['tags'])) == 'true') ? 'true':'false'; |
---|
| 60 | $gallery['comments'] = (strip_tags(stripslashes($new_gallery['comments'])) == 'true') ? 'true':'false'; |
---|
| 61 | $gallery['mbcategories'] = (strip_tags(stripslashes($new_gallery['mbcategories'])) == 'true') ? 'true':'false'; |
---|
| 62 | return $gallery; |
---|
| 63 | } |
---|
| 64 | function form($gallery){ |
---|
| 65 | // Options |
---|
| 66 | include 'Public_WP_Piwigo_options.php'; |
---|
| 67 | } |
---|
| 68 | } |
---|
[4039] | 69 | |
---|
[4055] | 70 | // Register |
---|
| 71 | function Public_Piwigo_WordPress_Widget_Init() { |
---|
| 72 | register_widget(PPW_PFX . 'Widget'); |
---|
[4031] | 73 | } |
---|
[4055] | 74 | add_action('widgets_init', PPW_PFX . 'Widget_Init'); |
---|
| 75 | ?> |
---|