Flickr Badges Widget - Version 1.2.5

Version Description

  • Image size added
Download this release

Release Info

Developer zourbuth
Plugin Icon 128x128 Flickr Badges Widget
Version 1.2.5
Comparing to
See all releases

Code changes from version 1.2.4 to 1.2.5

css/dialog.css CHANGED
@@ -19,7 +19,7 @@
19
  padding: 5px;
20
  }
21
  .gw-delete {
22
- background: url(../images/delete.png) no-repeat scroll -2px -3px transparent;
23
  width: 14px;
24
  height: 14px;
25
  position: absolute;
@@ -46,7 +46,7 @@
46
  #optionSection {
47
  height: auto !important;
48
  margin-bottom: 41px;
49
- background: url(../images/background.png) repeat-x scroll left top #F7F7F7;
50
  padding: 15px;
51
  position: relative;
52
  }
@@ -174,7 +174,7 @@
174
  display: block;
175
  }
176
  .totalControls .pickcolor span {
177
- background: url("../images/color.png") no-repeat scroll center center transparent;
178
  margin-left: 5px;
179
  padding: 2px 10px;
180
  }
@@ -228,7 +228,7 @@
228
  text-shadow: 1px 1px #FFFFFF;
229
  }
230
  .widget .ntotalWidgetBg {
231
- background: url("../images/background.png") no-repeat scroll left top transparent;
232
  border-top: 1px solid #E4E4E4;
233
  position: relative;
234
  }
@@ -265,12 +265,12 @@
265
  font-size: 11px;
266
  }
267
  .totalControls .template-date {
268
- background: url("../images/icons.png") no-repeat scroll 0 0 transparent;
269
  padding-left: 20px;
270
  margin-right: 10px;
271
  }
272
  .totalControls .template-comments {
273
- background: url("../images/comments.png") no-repeat scroll 0 0 transparent;
274
  margin-right: 10px;
275
  padding-left: 20px;
276
  }
@@ -385,5 +385,8 @@
385
  padding: 19px;
386
  background: none repeat scroll 0 0 rgba(255, 255, 255, 0.8);
387
  border-radius: 3px;
388
-
 
 
 
389
  }
19
  padding: 5px;
20
  }
21
  .gw-delete {
22
+ background: url(../img/delete.png) no-repeat scroll -2px -3px transparent;
23
  width: 14px;
24
  height: 14px;
25
  position: absolute;
46
  #optionSection {
47
  height: auto !important;
48
  margin-bottom: 41px;
49
+ background: url(../img/background.png) repeat-x scroll left top #F7F7F7;
50
  padding: 15px;
51
  position: relative;
52
  }
174
  display: block;
175
  }
176
  .totalControls .pickcolor span {
177
+ background: url("../img/color.png") no-repeat scroll center center transparent;
178
  margin-left: 5px;
179
  padding: 2px 10px;
180
  }
228
  text-shadow: 1px 1px #FFFFFF;
229
  }
230
  .widget .ntotalWidgetBg {
231
+ background: url("../img/background.png") no-repeat scroll left top transparent;
232
  border-top: 1px solid #E4E4E4;
233
  position: relative;
234
  }
265
  font-size: 11px;
266
  }
267
  .totalControls .template-date {
268
+ background: url("../img/icons.png") no-repeat scroll 0 0 transparent;
269
  padding-left: 20px;
270
  margin-right: 10px;
271
  }
272
  .totalControls .template-comments {
273
+ background: url("../img/comments.png") no-repeat scroll 0 0 transparent;
274
  margin-right: 10px;
275
  padding-left: 20px;
276
  }
385
  padding: 19px;
386
  background: none repeat scroll 0 0 rgba(255, 255, 255, 0.8);
387
  border-radius: 3px;
388
+ }
389
+ .total-loading {
390
+ padding-left: 20px;
391
+ background: url(../img/loading.gif) no-repeat scroll 0 0 transparent;
392
  }
{images → img}/background.png RENAMED
File without changes
img/loading.gif ADDED
Binary file
index.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Flickr Badges Widget
4
  Plugin URI: http://zourbuth.com/archives/500/flickr-badge-widget/
5
  Description: Display your Flickr latest photostream in widget area using javascript. Easy to customize, just put your Flickr id and your widget ready to lunch.
6
- Version: 1.2.4
7
  Author: zourbuth
8
  Author URI: http://zourbuth.com
9
  License: Under GPL2
10
 
11
- Copyright 2012 zourbuth (email : zourbuth@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
@@ -24,28 +24,48 @@
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
27
- /* Launch the plugin. */
28
- add_action( 'plugins_loaded', 'flickr_badges_widget_plugins_loaded' );
29
 
30
- /* Initializes the plugin and it's features. */
31
- function flickr_badges_widget_plugins_loaded() {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
 
33
- // Set constant path to the members plugin directory
34
- define( 'FLICKR_BADGES_WIDGET_VERSION', '1.2.4' );
35
- define( 'FLICKR_BADGES_WIDGET_DIR', plugin_dir_path( __FILE__ ) );
36
- define( 'FLICKR_BADGES_WIDGET_URL', plugin_dir_url( __FILE__ ) );
37
 
38
- // Loads and registers the new widgets
 
 
 
 
 
39
  add_action( 'widgets_init', 'flickr_badges_widget_init' );
40
  }
41
 
42
- /* Register the extra widgets. Each widget is meant to replace or extend the current default */
43
- function flickr_badges_widget_init() {
44
 
45
- /* Load widget file. */
46
- require_once( FLICKR_BADGES_WIDGET_DIR . 'flickr-badges-widget.php' );
47
-
48
- /* Register widget. */
 
 
 
49
  register_widget( 'Flickr_Badges_Widget' );
50
  }
51
  ?>
3
  Plugin Name: Flickr Badges Widget
4
  Plugin URI: http://zourbuth.com/archives/500/flickr-badge-widget/
5
  Description: Display your Flickr latest photostream in widget area using javascript. Easy to customize, just put your Flickr id and your widget ready to lunch.
6
+ Version: 1.2.5
7
  Author: zourbuth
8
  Author URI: http://zourbuth.com
9
  License: Under GPL2
10
 
11
+ Copyright 2013 zourbuth (email : zourbuth@gmail.com)
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License, version 2, as
24
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25
  */
26
 
 
 
27
 
28
+ /**
29
+ * Exit if accessed directly
30
+ * @since 1.2.5
31
+ */
32
+ if ( ! defined( 'ABSPATH' ) )
33
+ exit;
34
+
35
+
36
+ /**
37
+ * Set constant path to the members plugin directory
38
+ * @since 1.0
39
+ */
40
+ define( 'FLICKR_BADGES_WIDGET_VERSION', '1.2.5' );
41
+ define( 'FLICKR_BADGES_WIDGET_DIR', plugin_dir_path( __FILE__ ) );
42
+ define( 'FLICKR_BADGES_WIDGET_URL', plugin_dir_url( __FILE__ ) );
43
+
44
+
45
+ /**
46
+ * Launch the plugin
47
+ * @since 1.0
48
+ */
49
+ add_action( 'plugins_loaded', 'flickr_badges_widget_plugins_loaded' );
50
 
 
 
 
 
51
 
52
+ /**
53
+ * Initializes the plugin and it's features
54
+ * Loads and registers the new widgets
55
+ * @since 1.0
56
+ */
57
+ function flickr_badges_widget_plugins_loaded() {
58
  add_action( 'widgets_init', 'flickr_badges_widget_init' );
59
  }
60
 
 
 
61
 
62
+ /**
63
+ * Register the extra widgets. Each widget is meant to replace or extend the current default
64
+ * Load widget file
65
+ * @since 1.0
66
+ */
67
+ function flickr_badges_widget_init() {
68
+ require_once( FLICKR_BADGES_WIDGET_DIR . 'widget.php' );
69
  register_widget( 'Flickr_Badges_Widget' );
70
  }
71
  ?>
readme.txt CHANGED
@@ -2,9 +2,9 @@
2
  Contributors: zourbuth
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6D3WAJTVKAFC
4
  Tags: flickr, widget, badge, feed, photostream, javascript, sidebar, gallery, photo, photo gallery, photography, sidebar, user, group, image, images, recent, random
5
- Requires at least: 3.5
6
  Tested up to: 3.0
7
- Stable tag: 1.2.4
8
 
9
  Display your Flickr latest photostream in a sidebar widget area.
10
 
@@ -58,7 +58,8 @@ http://goo.gl/PM6rZ
58
 
59
  == Changelog ==
60
 
61
- = 1.2.4 =
 
62
 
63
  = 1.2.3 =
64
  * Widget prefix and localization added
2
  Contributors: zourbuth
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6D3WAJTVKAFC
4
  Tags: flickr, widget, badge, feed, photostream, javascript, sidebar, gallery, photo, photo gallery, photography, sidebar, user, group, image, images, recent, random
5
+ Requires at least: 3.6
6
  Tested up to: 3.0
7
+ Stable tag: 1.2.5
8
 
9
  Display your Flickr latest photostream in a sidebar widget area.
10
 
58
 
59
  == Changelog ==
60
 
61
+ = 1.2.5 =
62
+ * Image size added
63
 
64
  = 1.2.3 =
65
  * Widget prefix and localization added
flickr-badges-widget.php → widget.php RENAMED
@@ -2,9 +2,10 @@
2
  /**
3
  * Widget - Flickr Badge Widget
4
  *
5
- * @package zFrame
6
  * @subpackage Classes
7
  * For another improvement, you can drop email to zourbuth@gmail.com or visit http://zourbuth.com
 
8
  **/
9
 
10
  class Flickr_Badges_Widget extends WP_Widget {
@@ -12,32 +13,42 @@ class Flickr_Badges_Widget extends WP_Widget {
12
  var $prefix;
13
  var $textdomain;
14
 
15
- /** Set up the widget's unique name, ID, class, description, and other options. **/
 
 
 
 
16
  function __construct() {
 
 
17
  $this->prefix = 'zflickr';
18
  $this->textdomain = 'flickr-badges-widget';
19
 
20
- /* Set up the widget control options. */
21
  $control_options = array(
22
- 'width' => 500,
23
  'height' => 350,
24
  'id_base' => $this->prefix
25
  );
26
- /** Add some informations to the widget **/
 
27
  $widget_options = array('classname' => 'widget_flickr', 'description' => __( '[+] Displays a Flickr photo stream from an ID', $this->textdomain ) );
28
 
29
- /* Create the widget. */
30
  $this->WP_Widget($this->prefix, __('Flickr Badge', $this->textdomain), $widget_options, $control_options );
31
 
 
32
  add_action( 'load-widgets.php', array(&$this, 'widget_admin') );
 
33
 
34
- if ( is_active_widget(false, false, $this->id_base, true) && !is_admin() ) {
35
- /* load the widget stylesheet for the widgets screen. */
36
  wp_enqueue_style( 'z-flickr', FLICKR_BADGES_WIDGET_URL . 'css/widget.css', false, 0.7, 'screen' );
37
  add_action( 'wp_head', array( &$this, 'print_script' ) );
38
  }
39
  }
40
 
 
41
  /**
42
  * Push all script and style from the widget "Custom Style & Script" box.
43
  * @since 1.2.1
@@ -52,16 +63,57 @@ class Flickr_Badges_Widget extends WP_Widget {
52
 
53
 
54
  /**
55
- * Push the widget stylesheet widget.css into widget admin page
56
  * @since 1.2.1
57
  **/
58
  function widget_admin() {
59
  wp_enqueue_style( 'z-flickr-admin', FLICKR_BADGES_WIDGET_URL . 'css/dialog.css' );
60
  wp_enqueue_script( 'jquery' );
61
  wp_enqueue_script( 'z-flickr-admin', FLICKR_BADGES_WIDGET_URL . 'js/jquery.dialog.js' );
 
 
 
 
62
  }
63
 
64
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
  function widget( $args, $instance ) {
66
  extract( $args );
67
 
@@ -70,54 +122,63 @@ class Flickr_Badges_Widget extends WP_Widget {
70
  'title' => $instance['title'],
71
  'type' => empty( $instance['type'] ) ? 'user' : $instance['type'],
72
  'flickr_id' => $instance['flickr_id'],
73
- 'count' => (int)$instance['count'],
74
  'display' => empty( $instance['display'] ) ? 'latest' : $instance['display'],
75
- 'copyright' => !empty( $instance['copyright'] ) ? true : false
 
76
  );
77
 
78
  extract( $cur_arg );
79
-
80
- // If the photo is < 1, set it to 1
81
- if ( $count < 1 ) $count = 1;
82
 
 
 
 
 
 
 
 
 
 
 
 
 
 
83
  // If the widget have an ID, we can continue
84
- if ( !empty( $instance['flickr_id'] ) ) {
 
 
 
85
 
86
- // print the before widget
87
- echo $before_widget;
88
-
89
- if ( $title ) echo $before_title . $title . $after_title;
90
 
91
- // Get the user direction, rtl or ltr
92
- if ( function_exists( 'is_rtl' ) )
93
- $dir = is_rtl() ? 'rtl' : 'ltr';
94
-
95
- // Wrap the widget
96
- if (!empty( $instance['intro_text'] ) )
97
- echo '<p>' . do_shortcode( $instance['intro_text'] ) . '</p>';
98
-
99
- echo "<div class='zframe-flickr-wrap-$dir'>";
100
- echo "<script type='text/javascript' src='http://www.flickr.com/badge_code_v2.gne?count=$count&amp;display=$display&amp;size=s&amp;layout=x&amp;source=$type&amp;$type=$flickr_id'></script>";
101
- echo '</div>';
102
-
103
- if ( ! empty( $instance['outro_text'] ) )
104
- echo '<p>' . do_shortcode( $instance['outro_text'] ) . '</p>';
105
-
106
- if ( $copyright )
107
- echo '<a href="http://zourbuth.com/archives/500/flickr-badges-widget-free-wordpress-plugin/"><span style="font-size: 11px;"><span style="color: #0063DC; font-weight: bold;">Flick</span><span style="color: #FF0084; font-weight: bold;">r</span> Badge Widget</span></a>';
108
-
109
- // Print the after widget
110
- echo $after_widget;
111
- }
112
  }
113
 
114
 
 
 
 
 
 
115
  function update( $new_instance, $old_instance ) {
116
  $instance = $old_instance;
117
  $instance['type'] = strip_tags($new_instance['type']);
118
  $instance['flickr_id'] = strip_tags($new_instance['flickr_id']);
119
  $instance['count'] = (int) $new_instance['count'];
120
  $instance['display'] = strip_tags($new_instance['display']);
 
121
  $instance['title'] = strip_tags($new_instance['title']);
122
  $instance['copyright'] = ( isset( $new_instance['copyright'] ) ? 1 : 0 );
123
  $instance['tab'] = $new_instance['tab'];
@@ -129,6 +190,11 @@ class Flickr_Badges_Widget extends WP_Widget {
129
  }
130
 
131
 
 
 
 
 
 
132
  function form( $instance ) {
133
  // Set up the default form values.
134
  $defaults = array(
@@ -137,8 +203,9 @@ class Flickr_Badges_Widget extends WP_Widget {
137
  'flickr_id' => '', // 71865026@N00
138
  'count' => 9,
139
  'display' => 'display',
 
140
  'copyright' => true,
141
- 'tab' => array( 0 => true ),
142
  'intro_text' => '',
143
  'outro_text' => '',
144
  'custom' => ''
@@ -151,10 +218,23 @@ class Flickr_Badges_Widget extends WP_Widget {
151
  'user' => esc_attr__( 'user', $this->textdomain ),
152
  'group' => esc_attr__( 'group', $this->textdomain )
153
  );
 
 
 
 
 
154
  $displays = array(
155
  'latest' => esc_attr__( 'latest', $this->textdomain ),
156
  'random' => esc_attr__( 'random', $this->textdomain )
157
- );
 
 
 
 
 
 
 
 
158
  ?>
159
 
160
  <div class="pluginName">Flickr Badges Widget<span class="pluginVersion"><?php echo FLICKR_BADGES_WIDGET_VERSION; ?></span></div>
@@ -180,12 +260,11 @@ class Flickr_Badges_Widget extends WP_Widget {
180
  </script>
181
 
182
  <div id="fbw-<?php echo $this->id ; ?>" class="totalControls tabbable tabs-left">
183
- <!-- Tab List -->
184
  <ul class="nav nav-tabs">
185
- <li class="<?php if ( $instance['tab'][0] ) : ?>active<?php endif; ?>">General<input type="hidden" name="<?php echo $this->get_field_name( 'tab' ); ?>[]" value="<?php echo esc_attr( $instance['tab'][0] ); ?>" /></li>
186
- <li class="<?php if ( $instance['tab'][1] ) : ?>active<?php endif; ?>">Customs<input type="hidden" name="<?php echo $this->get_field_name( 'tab' ); ?>[]" value="<?php echo esc_attr( $instance['tab'][1] ); ?>" /></li>
187
- <li class="<?php if ( $instance['tab'][2] ) : ?>active<?php endif; ?>">Information<input type="hidden" name="<?php echo $this->get_field_name( 'tab' ); ?>[]" value="<?php echo esc_attr( $instance['tab'][2] ); ?>" /></li>
188
- </ul>
189
 
190
  <ul class="tab-content">
191
  <li class="tab-pane <?php if ( $instance['tab'][0] ) : ?>active<?php endif; ?>">
@@ -199,8 +278,8 @@ class Flickr_Badges_Widget extends WP_Widget {
199
  <label for="<?php echo $this->get_field_id('type'); ?>"><?php _e( 'Type', $this->textdomain ); ?></label>
200
  <span class="controlDesc"><?php _e( 'The type of images from user or group.', $this->textdomain ); ?></span>
201
  <select id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>">
202
- <?php foreach ( $types as $option_value => $option_label ) { ?>
203
- <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['type'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
204
  <?php } ?>
205
  </select>
206
  </li>
@@ -211,18 +290,27 @@ class Flickr_Badges_Widget extends WP_Widget {
211
  </li>
212
  <li>
213
  <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Number', $this->textdomain); ?></label>
214
- <span class="controlDesc"><?php _e( 'Number of photo to show.', $this->textdomain ); ?></span>
215
  <input class="column-last" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" type="text" value="<?php echo esc_attr( $instance['count'] ); ?>" size="3" />
216
  </li>
217
  <li>
218
  <label for="<?php echo $this->get_field_id('display'); ?>"><?php _e('Display Method', $this->textdomain); ?></label>
219
  <span class="controlDesc"><?php _e( 'Get the image from recent or use random function.', $this->textdomain ); ?></span>
220
  <select id="<?php echo $this->get_field_id( 'display' ); ?>" name="<?php echo $this->get_field_name( 'display' ); ?>">
221
- <?php foreach ( $displays as $option_value => $option_label ) { ?>
222
- <option value="<?php echo esc_attr( $option_value ); ?>" <?php selected( $instance['display'], $option_value ); ?>><?php echo esc_html( $option_label ); ?></option>
223
  <?php } ?>
224
  </select>
225
  </li>
 
 
 
 
 
 
 
 
 
226
  <li>
227
  <label for="<?php echo $this->get_field_id( 'copyright' ); ?>">
228
  <input class="checkbox" type="checkbox" <?php checked( $instance['copyright'], true ); ?> id="<?php echo $this->get_field_id( 'copyright' ); ?>" name="<?php echo $this->get_field_name( 'copyright' ); ?>" /><?php _e( 'Show Copyright', $this->textdomain ); ?></label>
@@ -255,9 +343,15 @@ class Flickr_Badges_Widget extends WP_Widget {
255
  <ul>
256
  <li>
257
  <h3><?php _e( 'Zourbuth Blog Feeds', $this->textdomain ) ; ?></h3>
258
- <?php
259
- wp_widget_rss_output( 'http://zourbuth.com/feed/', array( 'items' => 8 ) );
260
- ?>
 
 
 
 
 
 
261
  </li>
262
  <li>
263
  <a href="http://feedburner.google.com/fb/a/mailverify?uri=zourbuth&amp;loc=en_US">Subscribe to zourbuth by Email</a><br />
@@ -272,6 +366,23 @@ class Flickr_Badges_Widget extends WP_Widget {
272
 
273
  </ul>
274
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
275
  <?php
276
  }
277
  }
2
  /**
3
  * Widget - Flickr Badge Widget
4
  *
5
+ * @package Flickr Badge Widget
6
  * @subpackage Classes
7
  * For another improvement, you can drop email to zourbuth@gmail.com or visit http://zourbuth.com
8
+ *
9
  **/
10
 
11
  class Flickr_Badges_Widget extends WP_Widget {
13
  var $prefix;
14
  var $textdomain;
15
 
16
+
17
+ /**
18
+ * Set up the widget's unique name, ID, class, description, and other options
19
+ * @since 1.2.1
20
+ **/
21
  function __construct() {
22
+
23
+ // Set default variable for the widget instances
24
  $this->prefix = 'zflickr';
25
  $this->textdomain = 'flickr-badges-widget';
26
 
27
+ // Set up the widget control options
28
  $control_options = array(
29
+ 'width' => 444,
30
  'height' => 350,
31
  'id_base' => $this->prefix
32
  );
33
+
34
+ // Add some informations to the widget
35
  $widget_options = array('classname' => 'widget_flickr', 'description' => __( '[+] Displays a Flickr photo stream from an ID', $this->textdomain ) );
36
 
37
+ // Create the widget
38
  $this->WP_Widget($this->prefix, __('Flickr Badge', $this->textdomain), $widget_options, $control_options );
39
 
40
+ // Load additional scripts and styles file to the widget admin area
41
  add_action( 'load-widgets.php', array(&$this, 'widget_admin') );
42
+ add_action('wp_ajax_fes_load_utility', array(&$this, 'fes_load_utility') );
43
 
44
+ // Load the widget stylesheet for the widgets screen.
45
+ if ( is_active_widget(false, false, $this->id_base, true) && !is_admin() ) {
46
  wp_enqueue_style( 'z-flickr', FLICKR_BADGES_WIDGET_URL . 'css/widget.css', false, 0.7, 'screen' );
47
  add_action( 'wp_head', array( &$this, 'print_script' ) );
48
  }
49
  }
50
 
51
+
52
  /**
53
  * Push all script and style from the widget "Custom Style & Script" box.
54
  * @since 1.2.1
63
 
64
 
65
  /**
66
+ * Push additional script and style files to the widget admin area
67
  * @since 1.2.1
68
  **/
69
  function widget_admin() {
70
  wp_enqueue_style( 'z-flickr-admin', FLICKR_BADGES_WIDGET_URL . 'css/dialog.css' );
71
  wp_enqueue_script( 'jquery' );
72
  wp_enqueue_script( 'z-flickr-admin', FLICKR_BADGES_WIDGET_URL . 'js/jquery.dialog.js' );
73
+ wp_localize_script( 'z-flickr-admin', 'fes', array(
74
+ 'nonce' => wp_create_nonce( 'fes-nonce' ), // generate a nonce for further checking below
75
+ 'action' => 'fes_load_utility'
76
+ ));
77
  }
78
 
79
 
80
+
81
+
82
+ /**
83
+ * Outputs another item
84
+ * @since 1.2.2
85
+ */
86
+ function fes_load_utility() {
87
+ // Check the nonce and if not isset the id, just die.
88
+ $nonce = $_POST['nonce'];
89
+ if ( ! wp_verify_nonce( $nonce, 'fes-nonce' ) )
90
+ die();
91
+
92
+ $ch = curl_init('http://marketplace.envato.com/api/edge/new-files-from-user:zourbuth,codecanyon.json');
93
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
94
+ $data = curl_exec($ch);
95
+ curl_close($ch);
96
+ $data = json_decode($data);
97
+
98
+ $i = 0; $html = '';
99
+ if( $data ) {
100
+ $i = 0;
101
+ foreach( $data->{'new-files-from-user'} as $key => $value ) {
102
+ if( $i < 15 ) {
103
+ $html .= '<a href="'.$value->url.'?ref=zourbuth"><img src="'.$value->thumbnail.'"></a>&nbsp;';
104
+ $i++;
105
+ }
106
+ }
107
+ }
108
+ echo $html;
109
+ exit;
110
+ }
111
+
112
+
113
+ /**
114
+ * Push the widget stylesheet widget.css into widget admin page
115
+ * @since 1.2.1
116
+ **/
117
  function widget( $args, $instance ) {
118
  extract( $args );
119
 
122
  'title' => $instance['title'],
123
  'type' => empty( $instance['type'] ) ? 'user' : $instance['type'],
124
  'flickr_id' => $instance['flickr_id'],
125
+ 'count' => (int) $instance['count'],
126
  'display' => empty( $instance['display'] ) ? 'latest' : $instance['display'],
127
+ 'size' => isset( $instance['size'] ) ? $instance['size'] : 's',
128
+ 'copyright' => ! empty( $instance['copyright'] ) ? true : false
129
  );
130
 
131
  extract( $cur_arg );
132
+
133
+ // print the before widget
134
+ echo $before_widget;
135
 
136
+ if ( $title )
137
+ echo $before_title . $title . $after_title;
138
+
139
+ // Get the user direction, rtl or ltr
140
+ if ( function_exists( 'is_rtl' ) )
141
+ $dir = is_rtl() ? 'rtl' : 'ltr';
142
+
143
+ // Wrap the widget
144
+ if ( ! empty( $instance['intro_text'] ) )
145
+ echo '<p>' . do_shortcode( $instance['intro_text'] ) . '</p>';
146
+
147
+ echo "<div class='zframe-flickr-wrap-$dir'>";
148
+
149
  // If the widget have an ID, we can continue
150
+ if ( ! empty( $instance['flickr_id'] ) )
151
+ echo "<script type='text/javascript' src='http://www.flickr.com/badge_code_v2.gne?count=$count&amp;display=$display&amp;size=$size&amp;layout=x&amp;source=$type&amp;$type=$flickr_id'></script>";
152
+ else
153
+ echo '<p>' . __('Please provide an Flickr ID', $this->textdomain) . '</p>';
154
 
155
+ echo '</div>';
 
 
 
156
 
157
+ if ( ! empty( $instance['outro_text'] ) )
158
+ echo '<p>' . do_shortcode( $instance['outro_text'] ) . '</p>';
159
+
160
+ if ( $copyright )
161
+ echo '<a href="http://zourbuth.com/archives/500/flickr-badges-widget-free-wordpress-plugin/">
162
+ <span style="font-size: 11px;"><span style="color: #0063DC; font-weight: bold;">Flick</span><span style="color: #FF0084; font-weight: bold;">r</span> Badge Widget</span>
163
+ </a>';
164
+
165
+ // Print the after widget
166
+ echo $after_widget;
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
 
169
 
170
+
171
+ /**
172
+ * Widget update functino
173
+ * @since 1.2.1
174
+ **/
175
  function update( $new_instance, $old_instance ) {
176
  $instance = $old_instance;
177
  $instance['type'] = strip_tags($new_instance['type']);
178
  $instance['flickr_id'] = strip_tags($new_instance['flickr_id']);
179
  $instance['count'] = (int) $new_instance['count'];
180
  $instance['display'] = strip_tags($new_instance['display']);
181
+ $instance['size'] = strip_tags($new_instance['size']);
182
  $instance['title'] = strip_tags($new_instance['title']);
183
  $instance['copyright'] = ( isset( $new_instance['copyright'] ) ? 1 : 0 );
184
  $instance['tab'] = $new_instance['tab'];
190
  }
191
 
192
 
193
+
194
+ /**
195
+ * Widget form function
196
+ * @since 1.2.1
197
+ **/
198
  function form( $instance ) {
199
  // Set up the default form values.
200
  $defaults = array(
203
  'flickr_id' => '', // 71865026@N00
204
  'count' => 9,
205
  'display' => 'display',
206
+ 'size' => 's',
207
  'copyright' => true,
208
+ 'tab' => array( 0 => true, 1 => false, 2 => false, 3 => false ),
209
  'intro_text' => '',
210
  'outro_text' => '',
211
  'custom' => ''
218
  'user' => esc_attr__( 'user', $this->textdomain ),
219
  'group' => esc_attr__( 'group', $this->textdomain )
220
  );
221
+ $sizes = array(
222
+ 's' => esc_attr__( 'Standard', $this->textdomain ),
223
+ 't' => esc_attr__( 'Thumbnail', $this->textdomain ),
224
+ 'm' => esc_attr__( 'Medium', $this->textdomain )
225
+ );
226
  $displays = array(
227
  'latest' => esc_attr__( 'latest', $this->textdomain ),
228
  'random' => esc_attr__( 'random', $this->textdomain )
229
+ );
230
+
231
+ $tabs = array(
232
+ __( 'General', $this->textdomain ),
233
+ __( 'Customs', $this->textdomain ),
234
+ __( 'Feeds', $this->textdomain ),
235
+ __( 'Supports', $this->textdomain )
236
+ );
237
+
238
  ?>
239
 
240
  <div class="pluginName">Flickr Badges Widget<span class="pluginVersion"><?php echo FLICKR_BADGES_WIDGET_VERSION; ?></span></div>
260
  </script>
261
 
262
  <div id="fbw-<?php echo $this->id ; ?>" class="totalControls tabbable tabs-left">
 
263
  <ul class="nav nav-tabs">
264
+ <?php foreach ($tabs as $key => $tab ) : ?>
265
+ <li class="fes-<?php echo $key; ?> <?php echo $instance['tab'][$key] ? 'active' : '' ; ?>"><?php echo $tab; ?><input type="hidden" name="<?php echo $this->get_field_name( 'tab' ); ?>[]" value="<?php echo $instance['tab'][$key]; ?>" /></li>
266
+ <?php endforeach; ?>
267
+ </ul>
268
 
269
  <ul class="tab-content">
270
  <li class="tab-pane <?php if ( $instance['tab'][0] ) : ?>active<?php endif; ?>">
278
  <label for="<?php echo $this->get_field_id('type'); ?>"><?php _e( 'Type', $this->textdomain ); ?></label>
279
  <span class="controlDesc"><?php _e( 'The type of images from user or group.', $this->textdomain ); ?></span>
280
  <select id="<?php echo $this->get_field_id( 'type' ); ?>" name="<?php echo $this->get_field_name( 'type' ); ?>">
281
+ <?php foreach ( $types as $k => $v ) { ?>
282
+ <option value="<?php echo esc_attr( $k ); ?>" <?php selected( $instance['type'], $k ); ?>><?php echo esc_html( $v ); ?></option>
283
  <?php } ?>
284
  </select>
285
  </li>
290
  </li>
291
  <li>
292
  <label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Number', $this->textdomain); ?></label>
293
+ <span class="controlDesc"><?php _e( 'Number of images shown from 1 to 10', $this->textdomain ); ?></span>
294
  <input class="column-last" id="<?php echo $this->get_field_id('count'); ?>" name="<?php echo $this->get_field_name('count'); ?>" type="text" value="<?php echo esc_attr( $instance['count'] ); ?>" size="3" />
295
  </li>
296
  <li>
297
  <label for="<?php echo $this->get_field_id('display'); ?>"><?php _e('Display Method', $this->textdomain); ?></label>
298
  <span class="controlDesc"><?php _e( 'Get the image from recent or use random function.', $this->textdomain ); ?></span>
299
  <select id="<?php echo $this->get_field_id( 'display' ); ?>" name="<?php echo $this->get_field_name( 'display' ); ?>">
300
+ <?php foreach ( $displays as $k => $v ) { ?>
301
+ <option value="<?php echo esc_attr( $k ); ?>" <?php selected( $instance['display'], $k ); ?>><?php echo esc_html( $v ); ?></option>
302
  <?php } ?>
303
  </select>
304
  </li>
305
+ <li>
306
+ <label for="<?php echo $this->get_field_id('sizes'); ?>"><?php _e( 'Sizes', $this->textdomain ); ?></label>
307
+ <span class="controlDesc"><?php _e( 'Represents the size of the image', $this->textdomain ); ?></span>
308
+ <select id="<?php echo $this->get_field_id( 'size' ); ?>" name="<?php echo $this->get_field_name( 'size' ); ?>">
309
+ <?php foreach ( $sizes as $k => $v ) { ?>
310
+ <option value="<?php echo $k; ?>" <?php selected( $instance['size'], $k ); ?>><?php echo $v; ?></option>
311
+ <?php } ?>
312
+ </select>
313
+ </li>
314
  <li>
315
  <label for="<?php echo $this->get_field_id( 'copyright' ); ?>">
316
  <input class="checkbox" type="checkbox" <?php checked( $instance['copyright'], true ); ?> id="<?php echo $this->get_field_id( 'copyright' ); ?>" name="<?php echo $this->get_field_name( 'copyright' ); ?>" /><?php _e( 'Show Copyright', $this->textdomain ); ?></label>
343
  <ul>
344
  <li>
345
  <h3><?php _e( 'Zourbuth Blog Feeds', $this->textdomain ) ; ?></h3>
346
+ <?php wp_widget_rss_output( 'http://zourbuth.com/feed/', array( 'items' => 10 ) ); ?>
347
+ </li>
348
+ </ul>
349
+ </li>
350
+ <li class="tab-pane <?php if ( $instance['tab'][3] ) : ?>active<?php endif; ?>">
351
+ <ul>
352
+ <li>
353
+ <p><strong>Our Premium Plugins</strong></p>
354
+ <div class="fesem"></div>
355
  </li>
356
  <li>
357
  <a href="http://feedburner.google.com/fb/a/mailverify?uri=zourbuth&amp;loc=en_US">Subscribe to zourbuth by Email</a><br />
366
 
367
  </ul>
368
  </div>
369
+ <script type='text/javascript'>
370
+ jQuery(document).ready(function($){
371
+ $(document).on("click", ".fes-3", function(){
372
+ var c, t;
373
+ t = $(this);
374
+ c = t.parents(".totalControls").find(".fesem");
375
+
376
+ if ( c.is(':empty')) {
377
+ c.append("<span class='fes-loading total-loading'>Loading item...</span>");
378
+ $.post( ajaxurl, { action: fes.action, nonce : fes.nonce }, function(data){
379
+ $(".fes-loading").remove();
380
+ c.append(data);
381
+ });
382
+ }
383
+ });
384
+ });
385
+ </script>
386
  <?php
387
  }
388
  }