Version Description
- Added cached transient
- Added open image in new window
- Added widget shortcode and PHP function
Download this release
Release Info
Developer | zourbuth |
Plugin | Flickr Badges Widget |
Version | 1.3.0 |
Comparing to | |
See all releases |
Code changes from version 1.2.9 to 1.3.0
- css/widget.css +36 -8
- g-dialog.php +178 -0
- index.php +12 -8
- main.php +122 -22
- readme.txt +9 -2
- template.php +192 -0
- widget.php +139 -45
css/widget.css
CHANGED
@@ -1,19 +1,47 @@
|
|
1 |
-
.
|
2 |
-
.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
display: block;
|
4 |
overflow: hidden;
|
5 |
-
|
6 |
-
|
7 |
-
.zframe-flickr-wrap-rtl img {
|
8 |
-
margin-bottom: 10px;
|
9 |
}
|
10 |
|
11 |
.zframe-flickr-wrap-ltr img {
|
12 |
float: left;
|
13 |
-
margin-right: 10px;
|
14 |
}
|
15 |
|
16 |
.zframe-flickr-wrap-rtl img {
|
17 |
float: right;
|
18 |
-
margin-left: 10px;
|
19 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.flickr-badge-wrapper > ul:before,
|
2 |
+
.flickr-badge-wrapper > ul:after {
|
3 |
+
display: table;
|
4 |
+
content: " ";
|
5 |
+
}
|
6 |
+
.flickr-badge-wrapper > ul::after{
|
7 |
+
clear: both;
|
8 |
+
}
|
9 |
+
.flickr-badge-wrapper > ul{
|
10 |
+
margin: 0;
|
11 |
+
padding: 0;
|
12 |
+
}
|
13 |
+
|
14 |
+
|
15 |
+
.widget ul.zframe-flickr-wrap-ltr,
|
16 |
+
ul.zframe-flickr-wrap-ltr,
|
17 |
+
ul.zframe-flickr-wrap-rtl {
|
18 |
display: block;
|
19 |
overflow: hidden;
|
20 |
+
list-style-type: none;
|
21 |
+
margin: 0;
|
|
|
|
|
22 |
}
|
23 |
|
24 |
.zframe-flickr-wrap-ltr img {
|
25 |
float: left;
|
|
|
26 |
}
|
27 |
|
28 |
.zframe-flickr-wrap-rtl img {
|
29 |
float: right;
|
|
|
30 |
}
|
31 |
+
|
32 |
+
|
33 |
+
.ltr li.flickr_badge_image {
|
34 |
+
float: left;
|
35 |
+
}
|
36 |
+
.rtl li.flickr_badge_image {
|
37 |
+
float: right;
|
38 |
+
}
|
39 |
+
.ltr li.flickr_badge_image,
|
40 |
+
.rtl li.flickr_badge_image {
|
41 |
+
font-size: 0;
|
42 |
+
}
|
43 |
+
li.flickr_badge_image a,
|
44 |
+
li.flickr_badge_image img {
|
45 |
+
display: inline-block;
|
46 |
+
font-size: 0;
|
47 |
+
}
|
g-dialog.php
ADDED
@@ -0,0 +1,178 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Gumaraphous Dialog Class 0.0.1
|
4 |
+
|
5 |
+
Copyright 2017 zourbuth.com (email: zourbuth@gmail.com)
|
6 |
+
|
7 |
+
This program is free software; you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License, version 2, as
|
9 |
+
published by the Free Software Foundation.
|
10 |
+
|
11 |
+
This program is distributed in the hope that it will be useful,
|
12 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
GNU General Public License for more details.
|
15 |
+
|
16 |
+
You should have received a copy of the GNU General Public License
|
17 |
+
along with this program; if not, write to the Free Software
|
18 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19 |
+
*/
|
20 |
+
|
21 |
+
|
22 |
+
if ( ! defined( 'ABSPATH' ) ) // exit if is accessed directly
|
23 |
+
exit;
|
24 |
+
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Class constructor
|
28 |
+
*
|
29 |
+
* @since 0.0.1
|
30 |
+
*/
|
31 |
+
if ( ! class_exists( 'Gumaraphous_Dialog' )) { class Gumaraphous_Dialog {
|
32 |
+
|
33 |
+
var $textdomain;
|
34 |
+
|
35 |
+
/**
|
36 |
+
* Class constructor
|
37 |
+
*
|
38 |
+
* @since 0.0.1
|
39 |
+
*/
|
40 |
+
function __construct() {
|
41 |
+
$this->textdomain = '';
|
42 |
+
add_action( 'admin_enqueue_scripts', array( &$this,'admin_enqueue_scripts' ), 1 );
|
43 |
+
add_action( 'admin_footer-widgets.php', array( &$this,'footer_scripts' ), 2 );
|
44 |
+
}
|
45 |
+
|
46 |
+
|
47 |
+
function admin_enqueue_scripts( $hook_suffix ) {
|
48 |
+
wp_enqueue_style( 'wp-color-picker' );
|
49 |
+
wp_enqueue_script( 'jquery' );
|
50 |
+
wp_enqueue_script( 'wp-color-picker' );
|
51 |
+
}
|
52 |
+
|
53 |
+
|
54 |
+
function footer_scripts( $hook_suffix ) { ?>
|
55 |
+
<script type="text/javascript">
|
56 |
+
jQuery(document).ready( function($){
|
57 |
+
$('.gcolor-picker').wpColorPicker();
|
58 |
+
$(document).ajaxComplete( function() {
|
59 |
+
$('.gcolor-picker').wpColorPicker();
|
60 |
+
});
|
61 |
+
});
|
62 |
+
</script><?php
|
63 |
+
}
|
64 |
+
|
65 |
+
|
66 |
+
/**
|
67 |
+
* Add widget shortcode based on widget id
|
68 |
+
*
|
69 |
+
* @param $atts (array)
|
70 |
+
* @since 0.0.1
|
71 |
+
*/
|
72 |
+
public static function create_dialog( $args ) {
|
73 |
+
$html = ''; $array = array();
|
74 |
+
|
75 |
+
$args = wp_parse_args( (array) $args, array( // merge the user-selected arguments with the defaults.
|
76 |
+
'id' => '',
|
77 |
+
'name' => '',
|
78 |
+
'label' => '',
|
79 |
+
'type' => '',
|
80 |
+
'description' => '',
|
81 |
+
'rows' => '',
|
82 |
+
'size' => 3,
|
83 |
+
'options' => '',
|
84 |
+
'class' => '',
|
85 |
+
'value' => '',
|
86 |
+
));
|
87 |
+
|
88 |
+
extract( $args );
|
89 |
+
|
90 |
+
$description = $description ? "<span class='controlDesc'>$description</span>" : '';
|
91 |
+
$id = is_array( $id ) ? $id[0] : $id;
|
92 |
+
|
93 |
+
// Put label and its description, not for checkboxes
|
94 |
+
if( 'checkbox' != $type && $label )
|
95 |
+
$html .= "<label for='$id'>$label</label>$description";
|
96 |
+
|
97 |
+
// Check if dialog contain more than one options
|
98 |
+
if ( is_array( $name ) ) {
|
99 |
+
$new = $args;
|
100 |
+
foreach ( $name as $k => $n ) {
|
101 |
+
foreach ( array( 'id', 'name', 'default', 'value', 'type' ) as $a )
|
102 |
+
$new[$a] = $args[$a][$k];
|
103 |
+
|
104 |
+
$html .= self::create_element( $new );
|
105 |
+
}
|
106 |
+
|
107 |
+
} else {
|
108 |
+
$html .= self::create_element( $args );
|
109 |
+
}
|
110 |
+
|
111 |
+
echo "<li>$html</li>";
|
112 |
+
}
|
113 |
+
|
114 |
+
|
115 |
+
/**
|
116 |
+
* Add widget shortcode based on widget id
|
117 |
+
*
|
118 |
+
* @param $atts (array)
|
119 |
+
* @since 0.0.1
|
120 |
+
*/
|
121 |
+
static function create_element( $args ) {
|
122 |
+
$html = '';
|
123 |
+
|
124 |
+
$args = wp_parse_args( (array) $args, array( // merge the user-selected arguments with the defaults.
|
125 |
+
'id' => '',
|
126 |
+
'name' => '',
|
127 |
+
'label' => '',
|
128 |
+
'type' => '',
|
129 |
+
'description' => '',
|
130 |
+
'rows' => '',
|
131 |
+
'size' => 3,
|
132 |
+
'options' => '',
|
133 |
+
'class' => '',
|
134 |
+
'value' => '',
|
135 |
+
));
|
136 |
+
|
137 |
+
extract( $args );
|
138 |
+
|
139 |
+
switch( $type ) {
|
140 |
+
case 'text':
|
141 |
+
case 'number':
|
142 |
+
$class = $class ? $class : ( 'number' == $type ? 'column-last' : 'widefat' );
|
143 |
+
$html .= "<input class='$class' id='$id' name='$name' type='$type' value='$value' placeholder='$default' size='$size' />";
|
144 |
+
break;
|
145 |
+
|
146 |
+
case 'checkbox':
|
147 |
+
$checked = checked( $value, true, false );
|
148 |
+
$html .= "<label for='$id'>
|
149 |
+
<input $checked class='checkbox $class' id='$id' name='$name' type='checkbox' />$label</label>$description";
|
150 |
+
break;
|
151 |
+
|
152 |
+
case 'color':
|
153 |
+
$html .= "<input class='gcolor-picker' type='text' id='$id' name='$name' value='$value' />";
|
154 |
+
break;
|
155 |
+
|
156 |
+
case 'select':
|
157 |
+
$html .= "<select id='$id' name='$name'>";
|
158 |
+
foreach ( $options as $k => $option ) {
|
159 |
+
$selected = selected( $instance['type'], $k, false );
|
160 |
+
$option = esc_html( $option );
|
161 |
+
$html .= "<option value='$value' $selected>$option</option>";
|
162 |
+
}
|
163 |
+
$html .= "</select>";
|
164 |
+
break;
|
165 |
+
|
166 |
+
case 'textarea':
|
167 |
+
$class = $class ? $class : 'widefat';
|
168 |
+
$html = "<textarea class='$class' id='$id' rows='5' name='$name'>$value</textarea>";
|
169 |
+
|
170 |
+
case 'description':
|
171 |
+
$html = "";
|
172 |
+
break;
|
173 |
+
}
|
174 |
+
|
175 |
+
return $html;
|
176 |
+
}
|
177 |
+
|
178 |
+
} new Gumaraphous_Dialog(); };
|
index.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Flickr Badges Widget
|
4 |
Plugin URI: http://www.ground6.com/wordpress-plugins/flickr-badges-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.
|
7 |
Author: zourbuth
|
8 |
Author URI: http://zourbuth.com
|
9 |
License: Under GPL2
|
@@ -35,11 +35,12 @@ if ( ! defined( 'ABSPATH' ) )
|
|
35 |
|
36 |
/**
|
37 |
* Set constant path to the members plugin directory
|
38 |
-
* @since 1.0
|
39 |
*/
|
40 |
-
define( 'FLICKR_BADGES_WIDGET_VERSION', '1.
|
41 |
-
define( '
|
42 |
define( 'FLICKR_BADGES_WIDGET_URL', plugin_dir_url( __FILE__ ) );
|
|
|
43 |
|
44 |
|
45 |
/**
|
@@ -52,10 +53,13 @@ add_action( 'plugins_loaded', 'flickr_badges_widget_plugins_loaded' );
|
|
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 |
-
require_once(
|
|
|
|
|
|
|
59 |
add_action( 'widgets_init', 'flickr_badges_widget_init' );
|
60 |
}
|
61 |
|
@@ -63,10 +67,10 @@ function flickr_badges_widget_plugins_loaded() {
|
|
63 |
/**
|
64 |
* Register the extra widgets. Each widget is meant to replace or extend the current default
|
65 |
* Load widget file
|
66 |
-
* @since 1.0
|
67 |
*/
|
68 |
function flickr_badges_widget_init() {
|
69 |
-
require_once(
|
70 |
register_widget( 'Flickr_Badges_Widget' );
|
71 |
}
|
72 |
?>
|
3 |
Plugin Name: Flickr Badges Widget
|
4 |
Plugin URI: http://www.ground6.com/wordpress-plugins/flickr-badges-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.3.0
|
7 |
Author: zourbuth
|
8 |
Author URI: http://zourbuth.com
|
9 |
License: Under GPL2
|
35 |
|
36 |
/**
|
37 |
* Set constant path to the members plugin directory
|
38 |
+
* @since 1.0.0
|
39 |
*/
|
40 |
+
define( 'FLICKR_BADGES_WIDGET_VERSION', '1.3.0' );
|
41 |
+
define( 'FLICKR_BADGES_WIDGET_PATH', plugin_dir_path( __FILE__ ) );
|
42 |
define( 'FLICKR_BADGES_WIDGET_URL', plugin_dir_url( __FILE__ ) );
|
43 |
+
define( 'FLICKR_BADGES_WIDGET_DEBUG', true );
|
44 |
|
45 |
|
46 |
/**
|
53 |
/**
|
54 |
* Initializes the plugin and it's features
|
55 |
* Loads and registers the new widgets
|
56 |
+
* @since 1.0.0
|
57 |
*/
|
58 |
function flickr_badges_widget_plugins_loaded() {
|
59 |
+
require_once( FLICKR_BADGES_WIDGET_PATH . 'main.php' );
|
60 |
+
require_once( FLICKR_BADGES_WIDGET_PATH . 'g-dialog.php' );
|
61 |
+
require_once( FLICKR_BADGES_WIDGET_PATH . 'template.php' );
|
62 |
+
|
63 |
add_action( 'widgets_init', 'flickr_badges_widget_init' );
|
64 |
}
|
65 |
|
67 |
/**
|
68 |
* Register the extra widgets. Each widget is meant to replace or extend the current default
|
69 |
* Load widget file
|
70 |
+
* @since 1.0.0
|
71 |
*/
|
72 |
function flickr_badges_widget_init() {
|
73 |
+
require_once( FLICKR_BADGES_WIDGET_PATH . 'widget.php' );
|
74 |
register_widget( 'Flickr_Badges_Widget' );
|
75 |
}
|
76 |
?>
|
main.php
CHANGED
@@ -61,7 +61,7 @@ class Flickr_Badges_Widget_Main {
|
|
61 |
|
62 |
$args = wp_parse_args( (array) $instance, fbw_default_args() );
|
63 |
|
64 |
-
return
|
65 |
}
|
66 |
|
67 |
|
@@ -75,17 +75,23 @@ class Flickr_Badges_Widget_Main {
|
|
75 |
*/
|
76 |
function fbw_default_args() {
|
77 |
return array(
|
|
|
78 |
'title' => esc_attr__( 'Flickr Widget', 'flickr-badges-widget' ),
|
79 |
'type' => 'user',
|
80 |
'flickr_id' => '', // 71865026@N00
|
81 |
'count' => 9,
|
82 |
'display' => 'display',
|
83 |
'size' => 's',
|
|
|
|
|
|
|
|
|
|
|
84 |
'copyright' => true,
|
85 |
-
'tab' => array( 0 => true, 1 => false, 2 => false, 3 => false ),
|
86 |
'intro_text' => '',
|
87 |
'outro_text' => '',
|
88 |
-
'custom' => ''
|
89 |
);
|
90 |
}
|
91 |
|
@@ -93,39 +99,133 @@ function fbw_default_args() {
|
|
93 |
/**
|
94 |
* Default arguments
|
95 |
*
|
96 |
-
* @since
|
97 |
*/
|
98 |
-
function
|
|
|
99 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
$output = '';
|
101 |
|
102 |
-
|
103 |
-
if ( function_exists( 'is_rtl' ) )
|
104 |
$dir = is_rtl() ? 'rtl' : 'ltr';
|
105 |
-
|
106 |
-
// Wrap the widget
|
107 |
if ( ! empty( $args['intro_text'] ) )
|
108 |
$output .= '<p>' . do_shortcode( $args['intro_text'] ) . '</p>';
|
109 |
|
110 |
-
$output .= "<div class='flickr-badge-wrapper zframe-flickr-wrap-$dir'>";
|
111 |
-
|
112 |
$protocol = is_ssl() ? 'https' : 'http';
|
113 |
-
|
114 |
-
//
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
122 |
if ( ! empty( $args['outro_text'] ) )
|
123 |
$output .= '<p>' . do_shortcode( $args['outro_text'] ) . '</p>';
|
124 |
-
|
125 |
if ( $args['copyright'] )
|
126 |
$output .= '<a href="http://wordpress.org/extend/plugins/flickr-badges-widget/">
|
127 |
<span style="font-size: 11px;"><span style="color: #0063DC; font-weight: bold;">Flick</span><span style="color: #FF0084; font-weight: bold;">r</span> Badges Widget</span>
|
128 |
</a>';
|
129 |
-
|
130 |
return $output;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
131 |
}
|
61 |
|
62 |
$args = wp_parse_args( (array) $instance, fbw_default_args() );
|
63 |
|
64 |
+
return flickr_badges_widget( $args );
|
65 |
}
|
66 |
|
67 |
|
75 |
*/
|
76 |
function fbw_default_args() {
|
77 |
return array(
|
78 |
+
'id' => '',
|
79 |
'title' => esc_attr__( 'Flickr Widget', 'flickr-badges-widget' ),
|
80 |
'type' => 'user',
|
81 |
'flickr_id' => '', // 71865026@N00
|
82 |
'count' => 9,
|
83 |
'display' => 'display',
|
84 |
'size' => 's',
|
85 |
+
'target_blank' => true,
|
86 |
+
'template' => array(
|
87 |
+
'name' => 'default',
|
88 |
+
),
|
89 |
+
'cached' => 3600,
|
90 |
'copyright' => true,
|
91 |
+
'tab' => array( 0 => true, 1 => false, 2 => false, 3 => false , 4 => false, 5 => false ),
|
92 |
'intro_text' => '',
|
93 |
'outro_text' => '',
|
94 |
+
'custom' => '',
|
95 |
);
|
96 |
}
|
97 |
|
99 |
/**
|
100 |
* Default arguments
|
101 |
*
|
102 |
+
* @since 1.2.9
|
103 |
*/
|
104 |
+
function flickr_badges_widget_parse_args( $arr = array() ) {
|
105 |
+
$args = wp_parse_args( $arr, fbw_default_args() );
|
106 |
|
107 |
+
$template = flickr_badges_widget_template_args( $args ); // set default template argument if's not existed
|
108 |
+
|
109 |
+
foreach( $template as $k => $tpl )
|
110 |
+
$args['template'][$k] = isset( $arr['template'][$k] ) ? $arr['template'][$k] : $tpl['default'];
|
111 |
+
|
112 |
+
return $args;
|
113 |
+
}
|
114 |
+
|
115 |
+
|
116 |
+
/**
|
117 |
+
* Default template arguments
|
118 |
+
*
|
119 |
+
* @since 1.2.9
|
120 |
+
*/
|
121 |
+
function flickr_badges_widget_template_args( $args = array() ) {
|
122 |
+
$template = isset( $args['template'] ) ? $args['template'] : array();
|
123 |
+
return apply_filters( 'flickr_badges_widget_template_args', $template, $args );
|
124 |
+
}
|
125 |
+
|
126 |
+
|
127 |
+
/**
|
128 |
+
* Output flickrs images
|
129 |
+
*
|
130 |
+
* @params see fbw_default_args()
|
131 |
+
* @since 0.0.1
|
132 |
+
*/
|
133 |
+
function flickr_badges_widget( $args ) {
|
134 |
+
|
135 |
$output = '';
|
136 |
|
137 |
+
$dir = '';
|
138 |
+
if ( function_exists( 'is_rtl' ) ) // get the user direction, rtl or ltr
|
139 |
$dir = is_rtl() ? 'rtl' : 'ltr';
|
140 |
+
|
|
|
141 |
if ( ! empty( $args['intro_text'] ) )
|
142 |
$output .= '<p>' . do_shortcode( $args['intro_text'] ) . '</p>';
|
143 |
|
|
|
|
|
144 |
$protocol = is_ssl() ? 'https' : 'http';
|
145 |
+
|
146 |
+
if ( ! empty( $args['flickr_id'] ) ) { // if the widget have an ID, we can continue
|
147 |
+
|
148 |
+
if ( false === ( $cached = get_transient( $args['id'] ) ) ) {
|
149 |
+
|
150 |
+
$response = wp_remote_get( "$protocol://www.flickr.com/badge_code_v2.gne", array(
|
151 |
+
'body' => array(
|
152 |
+
'count' => $args['count'],
|
153 |
+
'display' => $args['display'],
|
154 |
+
'size' => $args['size'],
|
155 |
+
'layout' => 'x',
|
156 |
+
'source' => $args['type'],
|
157 |
+
$args['type'] => $args['flickr_id'],
|
158 |
+
),
|
159 |
+
) );
|
160 |
+
|
161 |
+
if ( is_wp_error( $response ) ) {
|
162 |
+
$output .= 'Error - '. $response->get_error_message();
|
163 |
+
} else {
|
164 |
+
$body = wp_remote_retrieve_body( $response );
|
165 |
+
|
166 |
+
$dom = new DOMDocument( '1.0', 'utf-8' );
|
167 |
+
@$dom->loadHTML( $body );
|
168 |
+
|
169 |
+
$divs = $dom->getElementsByTagName( 'div' );
|
170 |
+
$span = $dom->getElementsByTagName( 'span' );
|
171 |
+
|
172 |
+
$fdom = new DOMDocument();
|
173 |
+
|
174 |
+
$wrap = $fdom->createElement( 'div' );
|
175 |
+
$wrap->setAttribute( 'id', "fbw-{$args['id']}" );
|
176 |
+
$wrap->setAttribute( 'class', "flickr-badge-wrapper $dir zframe-flickr-wrap-$dir {$args['template']['name']}" );
|
177 |
+
|
178 |
+
$ul = $fdom->createElement( 'ul' );
|
179 |
+
|
180 |
+
foreach ( $divs as $div ) {
|
181 |
+
|
182 |
+
if ( $args['target_blank'] ) // open image in new window or tab
|
183 |
+
$div->firstChild->setAttribute( 'target', '_blank' );
|
184 |
+
|
185 |
+
$li = $fdom->createElement( 'li' );
|
186 |
+
$li->setAttribute( 'id', $div->getAttribute( 'id' ) );
|
187 |
+
$li->setAttribute( 'class', $div->getAttribute( 'class' ) );
|
188 |
+
$li->appendChild( $fdom->importNode( $div->firstChild, true ) );
|
189 |
+
|
190 |
+
$ul->appendChild( $li );
|
191 |
+
}
|
192 |
+
|
193 |
+
$wrap->appendChild( $ul );
|
194 |
+
$fdom->appendChild( $wrap );
|
195 |
+
$fdom->appendChild( $fdom->importNode( $span->item(0), true ) ) ; // this is a tracker from flickr.com
|
196 |
+
|
197 |
+
$fdom = apply_filters( 'flickr_badges_widget_dom', $fdom, $args );
|
198 |
+
$save = $fdom->SaveHTML();
|
199 |
+
set_transient( $args['id'], $save, $args['cached'] );
|
200 |
+
$output .= $save;
|
201 |
+
}
|
202 |
+
|
203 |
+
} else {
|
204 |
+
$output .= $cached;
|
205 |
+
}
|
206 |
+
|
207 |
+
} else {
|
208 |
+
$output .= '<p>' . __( 'Please provide an Flickr ID', 'flickr-badges-widget' ) . '</p>';
|
209 |
+
}
|
210 |
+
|
211 |
if ( ! empty( $args['outro_text'] ) )
|
212 |
$output .= '<p>' . do_shortcode( $args['outro_text'] ) . '</p>';
|
213 |
+
|
214 |
if ( $args['copyright'] )
|
215 |
$output .= '<a href="http://wordpress.org/extend/plugins/flickr-badges-widget/">
|
216 |
<span style="font-size: 11px;"><span style="color: #0063DC; font-weight: bold;">Flick</span><span style="color: #FF0084; font-weight: bold;">r</span> Badges Widget</span>
|
217 |
</a>';
|
218 |
+
|
219 |
return $output;
|
220 |
+
}
|
221 |
+
|
222 |
+
|
223 |
+
/**
|
224 |
+
* Debugging purpose
|
225 |
+
*
|
226 |
+
* @params $arr array()
|
227 |
+
* @since 1.3.0
|
228 |
+
*/
|
229 |
+
function fbw_debugr( $arr ) {
|
230 |
+
echo '<pre style="font-size:10px;line-height:10px;">'. print_r( $arr, true ) . '</pre>';
|
231 |
}
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ 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, picture, image-widget
|
5 |
Requires at least: 4.1.1
|
6 |
-
Tested up to: 4.
|
7 |
-
Stable tag: 1.
|
8 |
|
9 |
A fast plugin to display your Flickr photostream in a sidebar easily without any authentications.
|
10 |
|
@@ -23,6 +23,8 @@ Just put your Flickr ID and your widget will be ready to lunch.
|
|
23 |
<li>Get the image from recent or use random function.</li>
|
24 |
<li>Displays up to 10 images.</li>
|
25 |
<li>Optional image sizes.</li>
|
|
|
|
|
26 |
<li>Intro text for additional text before the widget content.</li>
|
27 |
<li>Outro text for additional text after the widget content.</li>
|
28 |
<li>Custom scripts and stylesheets for each widget.</li>
|
@@ -64,6 +66,11 @@ http://www.ground6.com/wordpress-plugins/flickr-badges-widget/screenshots/
|
|
64 |
|
65 |
== Changelog ==
|
66 |
|
|
|
|
|
|
|
|
|
|
|
67 |
= 1.2.9 =
|
68 |
* Added default widget paramaters
|
69 |
* Added widget shortcode and PHP function
|
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, picture, image-widget
|
5 |
Requires at least: 4.1.1
|
6 |
+
Tested up to: 4.7
|
7 |
+
Stable tag: 1.3.0
|
8 |
|
9 |
A fast plugin to display your Flickr photostream in a sidebar easily without any authentications.
|
10 |
|
23 |
<li>Get the image from recent or use random function.</li>
|
24 |
<li>Displays up to 10 images.</li>
|
25 |
<li>Optional image sizes.</li>
|
26 |
+
<li>Cached system.</li>
|
27 |
+
<li>Open image in new window.</li>
|
28 |
<li>Intro text for additional text before the widget content.</li>
|
29 |
<li>Outro text for additional text after the widget content.</li>
|
30 |
<li>Custom scripts and stylesheets for each widget.</li>
|
66 |
|
67 |
== Changelog ==
|
68 |
|
69 |
+
= 1.3.0 =
|
70 |
+
* Added cached transient
|
71 |
+
* Added open image in new window
|
72 |
+
* Added widget shortcode and PHP function
|
73 |
+
|
74 |
= 1.2.9 =
|
75 |
* Added default widget paramaters
|
76 |
* Added widget shortcode and PHP function
|
template.php
ADDED
@@ -0,0 +1,192 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Template Class 0.0.1
|
4 |
+
|
5 |
+
Copyright 2017 zourbuth.com (email: zourbuth@gmail.com)
|
6 |
+
|
7 |
+
This program is free software; you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License, version 2, as
|
9 |
+
published by the Free Software Foundation.
|
10 |
+
|
11 |
+
This program is distributed in the hope that it will be useful,
|
12 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
GNU General Public License for more details.
|
15 |
+
|
16 |
+
You should have received a copy of the GNU General Public License
|
17 |
+
along with this program; if not, write to the Free Software
|
18 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19 |
+
*/
|
20 |
+
|
21 |
+
|
22 |
+
if ( ! defined( 'ABSPATH' ) ) // exit if is accessed directly
|
23 |
+
exit;
|
24 |
+
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Flickr Badges Widget Template
|
28 |
+
*
|
29 |
+
* @filter flickr_badges_widget_templates
|
30 |
+
* @filter flickr_badges_widget_template_args
|
31 |
+
* @filter flickr_badges_widget_head
|
32 |
+
* @since 1.3.0
|
33 |
+
*/
|
34 |
+
class Flickr_Badges_Widget_Template {
|
35 |
+
|
36 |
+
var $textdomain;
|
37 |
+
|
38 |
+
/**
|
39 |
+
* Class constructor
|
40 |
+
*
|
41 |
+
* @since 0.0.1
|
42 |
+
*/
|
43 |
+
function __construct() {
|
44 |
+
add_filter( 'flickr_badges_widget_templates', array( &$this, 'register_templates' ), 1, 1 );
|
45 |
+
add_filter( 'flickr_badges_widget_template_args', array( &$this, 'template_args' ), 1, 2 );
|
46 |
+
add_action( 'flickr_badges_widget_head', array( &$this, 'template_styles' ), 1, 9 );
|
47 |
+
}
|
48 |
+
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Register pre-defined templates
|
52 |
+
*
|
53 |
+
* @param $templates (array)
|
54 |
+
* @since 0.0.1
|
55 |
+
*/
|
56 |
+
function register_templates( $templates ) {
|
57 |
+
return array(
|
58 |
+
'default' => __( 'Default', $this->textdomain ),
|
59 |
+
'bordered' => __( 'Bordered', $this->textdomain ),
|
60 |
+
'monochrome' => __( 'Monochrome', $this->textdomain ),
|
61 |
+
);
|
62 |
+
|
63 |
+
return $templates;
|
64 |
+
}
|
65 |
+
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Add widget shortcode based on widget id
|
69 |
+
*
|
70 |
+
* @param $atts (array)
|
71 |
+
* @since 0.0.1
|
72 |
+
*/
|
73 |
+
function template_args( $template, $args ) {
|
74 |
+
|
75 |
+
switch( $args['template']['name'] ) {
|
76 |
+
case 'default':
|
77 |
+
$template = array(
|
78 |
+
'margin' => array(
|
79 |
+
'default' => '0 5px 5px 0',
|
80 |
+
'type' => 'text',
|
81 |
+
'label' => __( 'Margin', 'flickr-badges-widget' ),
|
82 |
+
'description' => __( 'Margin top, right, bottom and left respectively in its unit for each image.', 'flickr-badges-widget' ),
|
83 |
+
),
|
84 |
+
);
|
85 |
+
break;
|
86 |
+
|
87 |
+
case 'monochrome':
|
88 |
+
$template = array(
|
89 |
+
'margin' => array(
|
90 |
+
'default' => '0 5px 5px 0',
|
91 |
+
'type' => 'text',
|
92 |
+
'label' => __( 'Margin', 'flickr-badges-widget' ),
|
93 |
+
'description' => __( 'Margin top, right, bottom and left respectively in its unit for each image.', 'flickr-badges-widget' ),
|
94 |
+
),
|
95 |
+
'fader' => array(
|
96 |
+
'default' => true,
|
97 |
+
'type' => 'checkbox',
|
98 |
+
'label' => __( 'Fade color transition', 'flickr-badges-widget' ),
|
99 |
+
),
|
100 |
+
);
|
101 |
+
break;
|
102 |
+
|
103 |
+
case 'bordered':
|
104 |
+
$template = array(
|
105 |
+
'border' => array(
|
106 |
+
'name' => array( 'color', 'hovercolor' ),
|
107 |
+
'default' => array( '#DDDDDD', '#AAAAAA' ),
|
108 |
+
'type' => array( 'color', 'color' ),
|
109 |
+
'label' => __( 'Border Color & Hover', 'flickr-badges-widget' ),
|
110 |
+
'description' => __( 'Border color for all image.', 'flickr-badges-widget' ),
|
111 |
+
),
|
112 |
+
'thickness' => array(
|
113 |
+
'default' => 1,
|
114 |
+
'type' => 'number',
|
115 |
+
'label' => __( 'Thickness', 'flickr-badges-widget' ),
|
116 |
+
'description' => __( 'Border thickness in pixels for each image.', 'flickr-badges-widget' ),
|
117 |
+
),
|
118 |
+
'padding' => array(
|
119 |
+
'default' => 5,
|
120 |
+
'type' => 'number',
|
121 |
+
'label' => __( 'Padding', 'flickr-badges-widget' ),
|
122 |
+
'description' => __( 'The space in pixels between image and border.', 'flickr-badges-widget' ),
|
123 |
+
),
|
124 |
+
'margin' => array(
|
125 |
+
'default' => '0 5px 5px 0',
|
126 |
+
'type' => 'text',
|
127 |
+
'label' => __( 'Margin', 'flickr-badges-widget' ),
|
128 |
+
'description' => __( 'Margin top, right, bottom and left respectively in its unit for each image.', 'flickr-badges-widget' ),
|
129 |
+
),
|
130 |
+
);
|
131 |
+
break;
|
132 |
+
}
|
133 |
+
|
134 |
+
return $template;
|
135 |
+
}
|
136 |
+
|
137 |
+
|
138 |
+
/**
|
139 |
+
* Template custom styles
|
140 |
+
*
|
141 |
+
* @param $atts (array)
|
142 |
+
* @since 0.0.1
|
143 |
+
*/
|
144 |
+
function template_styles( $args ) {
|
145 |
+
$styles = '';
|
146 |
+
$template = $args['template'];
|
147 |
+
|
148 |
+
$transition = "-webkit-transition: all .3s linear; -moz-transition: all .3s linear; -o-transition: all .3s linear; -ms-transition: all .3s linear; transition: all .3s linear;";
|
149 |
+
|
150 |
+
switch( $template['name'] ) {
|
151 |
+
case 'default':
|
152 |
+
$styles .= "#{$args['id']} ul li {margin:{$args['template']['margin']};}";
|
153 |
+
break;
|
154 |
+
|
155 |
+
case 'monochrome':
|
156 |
+
$transition = $template['fader'] ? $transition : "";
|
157 |
+
|
158 |
+
$styles .= "#{$args['id']} ul li {
|
159 |
+
margin:{$template['margin']};
|
160 |
+
}
|
161 |
+
#{$args['id']} ul li img {
|
162 |
+
filter: gray; /* IE6-9 */
|
163 |
+
-webkit-filter: grayscale(1); /* Google Chrome, Safari 6+ & Opera 15+ */
|
164 |
+
filter: grayscale(1); /* Microsoft Edge and Firefox 35+ */
|
165 |
+
$transition
|
166 |
+
}
|
167 |
+
|
168 |
+
#{$args['id']} ul li img:hover {
|
169 |
+
-webkit-filter: grayscale(0);
|
170 |
+
filter: none;
|
171 |
+
}";
|
172 |
+
break;
|
173 |
+
|
174 |
+
case 'bordered':
|
175 |
+
$styles .= "
|
176 |
+
#{$args['id']} ul li {
|
177 |
+
margin: {$args['template']['margin']};
|
178 |
+
border: {$args['template']['thickness']}px solid {$args['template']['color']};
|
179 |
+
padding: {$args['template']['padding']}px;
|
180 |
+
$transition
|
181 |
+
}
|
182 |
+
#{$args['id']} ul li:hover {
|
183 |
+
border-color: {$args['template']['hovercolor']};
|
184 |
+
}";
|
185 |
+
break;
|
186 |
+
}
|
187 |
+
|
188 |
+
echo "<style type='text/css'>$styles</style>";
|
189 |
+
}
|
190 |
+
|
191 |
+
|
192 |
+
} new Flickr_Badges_Widget_Template();
|
widget.php
CHANGED
@@ -1,17 +1,28 @@
|
|
1 |
<?php
|
2 |
/**
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
class Flickr_Badges_Widget extends WP_Widget {
|
12 |
|
13 |
var $prefix;
|
14 |
var $textdomain;
|
|
|
15 |
|
16 |
|
17 |
/**
|
@@ -22,7 +33,8 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
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(
|
@@ -30,7 +42,7 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
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 |
|
@@ -41,8 +53,8 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
41 |
add_action( 'load-widgets.php', array(&$this, 'widget_admin') );
|
42 |
|
43 |
// Load the widget stylesheet for the widgets screen.
|
44 |
-
if ( is_active_widget(false, false, $this->id_base,
|
45 |
-
wp_enqueue_style( '
|
46 |
add_action( 'wp_head', array( &$this, 'print_script' ) );
|
47 |
}
|
48 |
}
|
@@ -53,12 +65,13 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
53 |
* @since 1.2.1
|
54 |
**/
|
55 |
function print_script() {
|
56 |
-
|
57 |
-
|
58 |
-
|
|
|
59 |
echo $setting['custom'];
|
60 |
}
|
61 |
-
}
|
62 |
|
63 |
|
64 |
/**
|
@@ -106,18 +119,16 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
106 |
extract( $args );
|
107 |
|
108 |
// Set up the arguments for wp_list_categories().
|
109 |
-
$instance =
|
110 |
-
|
111 |
-
// print the before widget
|
112 |
-
echo $before_widget;
|
113 |
|
114 |
if ( $instance['title'] )
|
115 |
-
echo $before_title . $instance['title'] . $after_title;
|
116 |
-
|
117 |
-
echo
|
118 |
-
|
119 |
-
//
|
120 |
-
echo $after_widget;
|
121 |
}
|
122 |
|
123 |
|
@@ -127,18 +138,37 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
127 |
**/
|
128 |
function update( $new_instance, $old_instance ) {
|
129 |
$instance = $old_instance;
|
130 |
-
|
131 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
$instance['count'] = (int) $new_instance['count'];
|
133 |
-
$instance['
|
134 |
-
$instance['
|
135 |
-
$instance['
|
136 |
-
$instance['
|
|
|
|
|
137 |
$instance['tab'] = $new_instance['tab'];
|
138 |
$instance['intro_text'] = $new_instance['intro_text'];
|
139 |
$instance['outro_text'] = $new_instance['outro_text'];
|
140 |
$instance['custom'] = $new_instance['custom'];
|
141 |
-
|
142 |
return $instance;
|
143 |
}
|
144 |
|
@@ -148,13 +178,16 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
148 |
* @since 1.2.1
|
149 |
**/
|
150 |
function form( $instance ) {
|
151 |
-
|
152 |
-
$instance =
|
153 |
-
|
154 |
$types = array(
|
155 |
'user' => esc_attr__( 'user', $this->textdomain ),
|
156 |
'group' => esc_attr__( 'group', $this->textdomain )
|
157 |
);
|
|
|
|
|
|
|
158 |
$sizes = array(
|
159 |
's' => esc_attr__( 'Standard', $this->textdomain ),
|
160 |
't' => esc_attr__( 'Thumbnail', $this->textdomain ),
|
@@ -167,14 +200,17 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
167 |
|
168 |
$tabs = array(
|
169 |
__( 'General', $this->textdomain ),
|
|
|
|
|
170 |
__( 'Customs', $this->textdomain ),
|
171 |
__( 'Feeds', $this->textdomain ),
|
172 |
__( 'Supports', $this->textdomain )
|
173 |
);
|
174 |
-
|
175 |
?>
|
176 |
|
177 |
-
<div class="pluginName">Flickr Badges Widget
|
|
|
|
|
178 |
<script type="text/javascript">
|
179 |
// Tabs function
|
180 |
jQuery(document).ready(function($){
|
@@ -221,9 +257,9 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
221 |
</select>
|
222 |
</li>
|
223 |
<li>
|
224 |
-
<label for="<?php echo $this->get_field_id('flickr_id'); ?>"><?php _e('Flickr ID', $this->textdomain); ?></label>
|
225 |
-
<input id="<?php echo $this->get_field_id('flickr_id'); ?>" name="<?php echo $this->get_field_name('flickr_id'); ?>" type="text" value="<?php echo esc_attr( $instance['flickr_id'] ); ?>" />
|
226 |
<span class="controlDesc"><?php _e( 'Put the flickr ID here, go to <a href="http://goo.gl/PM6rZ" target="_blank">Flickr NSID Lookup</a> if you don\'t know your ID. Example: 71865026@N00', $this->textdomain ); ?></span>
|
|
|
227 |
</li>
|
228 |
<li>
|
229 |
<label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Number', $this->textdomain); ?></label>
|
@@ -247,16 +283,72 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
247 |
<option value="<?php echo $k; ?>" <?php selected( $instance['size'], $k ); ?>><?php echo $v; ?></option>
|
248 |
<?php } ?>
|
249 |
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
250 |
</li>
|
251 |
<li>
|
252 |
<label for="<?php echo $this->get_field_id( 'copyright' ); ?>">
|
253 |
<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>
|
254 |
<span class="controlDesc"><?php _e( 'Display the plugin name with link in the front end.', $this->textdomain ); ?></span>
|
255 |
-
</li>
|
256 |
</ul>
|
257 |
</li>
|
258 |
|
259 |
-
<li class="tab-pane <?php if ( $instance['tab'][
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
<ul>
|
261 |
<li>
|
262 |
<label><?php _e( 'Shortcode & Function', $this->textdomain ) ; ?></label>
|
@@ -286,7 +378,8 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
286 |
</li>
|
287 |
</ul>
|
288 |
</li>
|
289 |
-
|
|
|
290 |
<ul>
|
291 |
<li>
|
292 |
<h4><?php _e( 'Zourbuth Blog Feeds', $this->textdomain ) ; ?></h4>
|
@@ -294,7 +387,7 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
294 |
</li>
|
295 |
</ul>
|
296 |
</li>
|
297 |
-
<li class="tab-pane <?php if ( $instance['tab'][
|
298 |
<ul>
|
299 |
<li>
|
300 |
<p><strong>Our Premium Plugins</strong></p>
|
@@ -303,13 +396,14 @@ class Flickr_Badges_Widget extends WP_Widget {
|
|
303 |
<li>
|
304 |
<a href="http://www.ground6.com/wordpress-plugins/flickr-badges-widget/"><b>Have a questions? Please feel free to contact supports section</b></a><br /><br />
|
305 |
|
306 |
-
<a href="http://feedburner.google.com/fb/a/mailverify?uri=zourbuth&loc=en_US">Subscribe to zourbuth by Email</a><br />
|
307 |
<?php _e( 'Like my work? Please consider to ', $this->textdomain ); ?><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6D3WAJTVKAFC" title="Donate"><?php _e( 'donate', $this->textdomain ); ?></a>.<br /><br />
|
308 |
|
309 |
If you like this plugin, please <a href="http://wordpress.org/support/view/plugin-reviews/flickr-badges-widget">give a good rating</a>.<br /><br />
|
310 |
|
311 |
-
<span style="font-size: 11px;"><a href="http://wordpress.org/extend/plugins/flickr-badges-widget/"><span style="color: #0063DC; font-weight: bold;">Flick</span><span style="color: #FF0084; font-weight: bold;">r</span>
|
312 |
</li>
|
|
|
313 |
</ul>
|
314 |
</li>
|
315 |
|
1 |
<?php
|
2 |
/**
|
3 |
+
Widget - Flickr Badges Widget
|
4 |
+
|
5 |
+
For another improvement, you can drop email to zourbuth@gmail.com or visit http://zourbuth.com
|
6 |
+
|
7 |
+
This program is free software; you can redistribute it and/or modify
|
8 |
+
it under the terms of the GNU General Public License, version 2, as
|
9 |
+
published by the Free Software Foundation.
|
10 |
+
|
11 |
+
This program is distributed in the hope that it will be useful,
|
12 |
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
14 |
+
GNU General Public License for more details.
|
15 |
+
|
16 |
+
You should have received a copy of the GNU General Public License
|
17 |
+
along with this program; if not, write to the Free Software
|
18 |
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19 |
+
*/
|
20 |
|
21 |
class Flickr_Badges_Widget extends WP_Widget {
|
22 |
|
23 |
var $prefix;
|
24 |
var $textdomain;
|
25 |
+
var $transient;
|
26 |
|
27 |
|
28 |
/**
|
33 |
|
34 |
// Set default variable for the widget instances
|
35 |
$this->prefix = 'zflickr';
|
36 |
+
$this->textdomain = 'flickr-badges-widget';
|
37 |
+
$this->transient = "_fbw_transient_.{$this->number}";
|
38 |
|
39 |
// Set up the widget control options
|
40 |
$control_options = array(
|
42 |
'height' => 350,
|
43 |
'id_base' => $this->prefix
|
44 |
);
|
45 |
+
|
46 |
// Add some informations to the widget
|
47 |
$widget_options = array('classname' => 'widget_flickr', 'description' => __( '[+] Displays a Flickr photo stream from an ID', $this->textdomain ) );
|
48 |
|
53 |
add_action( 'load-widgets.php', array(&$this, 'widget_admin') );
|
54 |
|
55 |
// Load the widget stylesheet for the widgets screen.
|
56 |
+
if ( is_active_widget( false, false, $this->id_base, false ) && ! is_admin() ) {
|
57 |
+
wp_enqueue_style( 'fbw', FLICKR_BADGES_WIDGET_URL . 'css/widget.css', false, 0.7, 'screen' );
|
58 |
add_action( 'wp_head', array( &$this, 'print_script' ) );
|
59 |
}
|
60 |
}
|
65 |
* @since 1.2.1
|
66 |
**/
|
67 |
function print_script() {
|
68 |
+
foreach ( (array) $this->get_settings() as $key => $setting ) {
|
69 |
+
do_action( 'flickr_badges_widget_head', $setting );
|
70 |
+
|
71 |
+
if ( ! empty( $setting['custom'] ) )
|
72 |
echo $setting['custom'];
|
73 |
}
|
74 |
+
}
|
75 |
|
76 |
|
77 |
/**
|
119 |
extract( $args );
|
120 |
|
121 |
// Set up the arguments for wp_list_categories().
|
122 |
+
$instance = flickr_badges_widget_parse_args( (array) $instance );
|
123 |
+
|
124 |
+
echo $before_widget; // print the before widget
|
|
|
125 |
|
126 |
if ( $instance['title'] )
|
127 |
+
echo $before_title . $instance['title'] . $after_title;
|
128 |
+
|
129 |
+
echo flickr_badges_widget( $instance );
|
130 |
+
|
131 |
+
echo $after_widget; // print the after widget
|
|
|
132 |
}
|
133 |
|
134 |
|
138 |
**/
|
139 |
function update( $new_instance, $old_instance ) {
|
140 |
$instance = $old_instance;
|
141 |
+
|
142 |
+
delete_transient( $this->id ); // delete cached data
|
143 |
+
|
144 |
+
// Update template arguments if new template selected
|
145 |
+
$instance['template'] = $new_instance['template']; // maintain template name
|
146 |
+
|
147 |
+
foreach ( flickr_badges_widget_template_args( $new_instance ) as $k => $tpl ) {
|
148 |
+
if ( 'checkbox' == $tpl['type'] )
|
149 |
+
if ( $new_instance['template']['name'] == $old_instance['template']['name'] )
|
150 |
+
$instance['template'][$k] = isset( $new_instance['template'][$k] ) ? 1 : 0;
|
151 |
+
else
|
152 |
+
$instance['template'][$k] = $tpl['default'];
|
153 |
+
else
|
154 |
+
$instance['template'][$k] = isset( $new_instance['template'][$k] ) ? $new_instance['template'][$k] : $tpl['default'];
|
155 |
+
}
|
156 |
+
|
157 |
+
$instance['id'] = $this->id;
|
158 |
+
$instance['type'] = strip_tags( $new_instance['type'] );
|
159 |
+
$instance['flickr_id'] = strip_tags( $new_instance['flickr_id'] );
|
160 |
$instance['count'] = (int) $new_instance['count'];
|
161 |
+
$instance['cached'] = (int) $new_instance['cached'];
|
162 |
+
$instance['display'] = strip_tags( $new_instance['display'] );
|
163 |
+
$instance['size'] = strip_tags( $new_instance['size'] );
|
164 |
+
$instance['title'] = strip_tags( $new_instance['title'] );
|
165 |
+
$instance['target_blank'] = isset( $new_instance['target_blank'] ) ? 1 : 0;
|
166 |
+
$instance['copyright'] = isset( $new_instance['copyright'] ) ? 1 : 0;
|
167 |
$instance['tab'] = $new_instance['tab'];
|
168 |
$instance['intro_text'] = $new_instance['intro_text'];
|
169 |
$instance['outro_text'] = $new_instance['outro_text'];
|
170 |
$instance['custom'] = $new_instance['custom'];
|
171 |
+
|
172 |
return $instance;
|
173 |
}
|
174 |
|
178 |
* @since 1.2.1
|
179 |
**/
|
180 |
function form( $instance ) {
|
181 |
+
|
182 |
+
$instance = flickr_badges_widget_parse_args( $instance );
|
183 |
+
|
184 |
$types = array(
|
185 |
'user' => esc_attr__( 'user', $this->textdomain ),
|
186 |
'group' => esc_attr__( 'group', $this->textdomain )
|
187 |
);
|
188 |
+
|
189 |
+
$templates = apply_filters( 'flickr_badges_widget_templates', array() );
|
190 |
+
|
191 |
$sizes = array(
|
192 |
's' => esc_attr__( 'Standard', $this->textdomain ),
|
193 |
't' => esc_attr__( 'Thumbnail', $this->textdomain ),
|
200 |
|
201 |
$tabs = array(
|
202 |
__( 'General', $this->textdomain ),
|
203 |
+
__( 'Advanced', $this->textdomain ),
|
204 |
+
__( 'Template', $this->textdomain ),
|
205 |
__( 'Customs', $this->textdomain ),
|
206 |
__( 'Feeds', $this->textdomain ),
|
207 |
__( 'Supports', $this->textdomain )
|
208 |
);
|
|
|
209 |
?>
|
210 |
|
211 |
+
<div class="pluginName">Flickr Badges Widget
|
212 |
+
<span class="pluginVersion"><?php echo FLICKR_BADGES_WIDGET_VERSION; ?></span>
|
213 |
+
</div>
|
214 |
<script type="text/javascript">
|
215 |
// Tabs function
|
216 |
jQuery(document).ready(function($){
|
257 |
</select>
|
258 |
</li>
|
259 |
<li>
|
260 |
+
<label for="<?php echo $this->get_field_id('flickr_id'); ?>"><?php _e('Flickr ID', $this->textdomain); ?></label>
|
|
|
261 |
<span class="controlDesc"><?php _e( 'Put the flickr ID here, go to <a href="http://goo.gl/PM6rZ" target="_blank">Flickr NSID Lookup</a> if you don\'t know your ID. Example: 71865026@N00', $this->textdomain ); ?></span>
|
262 |
+
<input id="<?php echo $this->get_field_id('flickr_id'); ?>" name="<?php echo $this->get_field_name('flickr_id'); ?>" type="text" value="<?php echo esc_attr( $instance['flickr_id'] ); ?>" />
|
263 |
</li>
|
264 |
<li>
|
265 |
<label for="<?php echo $this->get_field_id('count'); ?>"><?php _e('Number', $this->textdomain); ?></label>
|
283 |
<option value="<?php echo $k; ?>" <?php selected( $instance['size'], $k ); ?>><?php echo $v; ?></option>
|
284 |
<?php } ?>
|
285 |
</select>
|
286 |
+
</li>
|
287 |
+
</ul>
|
288 |
+
</li>
|
289 |
+
|
290 |
+
<li class="tab-pane <?php if ( $instance['tab'][1] ) : ?>active<?php endif; ?>">
|
291 |
+
<ul>
|
292 |
+
<li>
|
293 |
+
<label for="<?php echo $this->get_field_id('cached'); ?>"><?php _e( 'Cached Transient', $this->textdomain); ?></label>
|
294 |
+
<span class="controlDesc"><?php _e( 'Total seconds to store the cached.', $this->textdomain ); ?></span>
|
295 |
+
<input class="column-last" id="<?php echo $this->get_field_id('cached'); ?>" name="<?php echo $this->get_field_name('cached'); ?>" type="number" value="<?php echo esc_attr( $instance['cached'] ); ?>" />
|
296 |
+
</li>
|
297 |
+
<li>
|
298 |
+
<label for="<?php echo $this->get_field_id( 'target_blank' ); ?>">
|
299 |
+
<input class="checkbox" type="checkbox" <?php checked( $instance['target_blank'], true ); ?> id="<?php echo $this->get_field_id( 'target_blank' ); ?>" name="<?php echo $this->get_field_name( 'target_blank' ); ?>" /><?php _e( 'Target blank', $this->textdomain ); ?></label>
|
300 |
+
<span class="controlDesc"><?php _e( 'Open image in a new window or tab.', $this->textdomain ); ?></span>
|
301 |
</li>
|
302 |
<li>
|
303 |
<label for="<?php echo $this->get_field_id( 'copyright' ); ?>">
|
304 |
<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>
|
305 |
<span class="controlDesc"><?php _e( 'Display the plugin name with link in the front end.', $this->textdomain ); ?></span>
|
306 |
+
</li>
|
307 |
</ul>
|
308 |
</li>
|
309 |
|
310 |
+
<li class="tab-pane <?php if ( $instance['tab'][2] ) : ?>active<?php endif; ?>">
|
311 |
+
<ul>
|
312 |
+
<li>
|
313 |
+
<label for="<?php echo $this->get_field_id('template'); ?>-name"><?php _e( 'Template', $this->textdomain ); ?></label>
|
314 |
+
<span class="controlDesc"><?php _e( 'Select a template from list below.<br /><a href="http://zourbuth.com/flickr-badges-widget-pro/"><b>Upgrade to PRO</b></a> for premium templates.', $this->textdomain ); ?></span>
|
315 |
+
<select onchange="wpWidgets.save(jQuery(this).closest('div.widget'),0,1,0);" id="<?php echo $this->get_field_id( 'template' ); ?>-name" name="<?php echo $this->get_field_name( 'template' ); ?>[name]">
|
316 |
+
<?php foreach ( $templates as $k => $v ) { ?>
|
317 |
+
<option value="<?php echo esc_attr( $k ); ?>" <?php selected( $instance['template']['name'], $k ); ?>><?php echo esc_html( $v ); ?></option>
|
318 |
+
<?php } ?>
|
319 |
+
</select>
|
320 |
+
<?php do_action( 'zg_purchase_button' ); ?>
|
321 |
+
</li>
|
322 |
+
<?php
|
323 |
+
// Template Parsing
|
324 |
+
$tmpl = flickr_badges_widget_template_args( $instance );
|
325 |
+
unset( $tmpl['name'] ); // avoid to create option for 'name'
|
326 |
+
|
327 |
+
// Get template dialog arguments and set the value
|
328 |
+
foreach ( (array) $tmpl as $k => $v ) {
|
329 |
+
$dlg = $v;
|
330 |
+
|
331 |
+
$dlg['id'] = $this->get_field_id( 'template' ) ."-$k";
|
332 |
+
$dlg['name'] = $this->get_field_name( 'template' ) ."[$k]";
|
333 |
+
$dlg['value'] = isset( $instance['template'][$k] ) ? $instance['template'][$k] : $v['default'];
|
334 |
+
|
335 |
+
// Overwrite if each dialog have multiple options
|
336 |
+
if ( isset( $v['name'] ) && is_array( $v['name'] ) ) {
|
337 |
+
$dlg['id'] = $dlg['name'] = $dlg['value'] = array();
|
338 |
+
foreach( $v['name'] as $i => $n ) {
|
339 |
+
$dlg['id'][$i] = $this->get_field_id( 'template' ) ."-$n";
|
340 |
+
$dlg['name'][$i] = $this->get_field_name( 'template' ) ."[$n]";
|
341 |
+
$dlg['value'][$i] = isset( $instance['template'][$n] ) ? $instance['template'][$n] : $v['default'][$i];
|
342 |
+
}
|
343 |
+
}
|
344 |
+
|
345 |
+
Gumaraphous_Dialog::create_dialog( $dlg );
|
346 |
+
}
|
347 |
+
?>
|
348 |
+
</ul>
|
349 |
+
</li>
|
350 |
+
|
351 |
+
<li class="tab-pane <?php if ( $instance['tab'][3] ) : ?>active<?php endif; ?>">
|
352 |
<ul>
|
353 |
<li>
|
354 |
<label><?php _e( 'Shortcode & Function', $this->textdomain ) ; ?></label>
|
378 |
</li>
|
379 |
</ul>
|
380 |
</li>
|
381 |
+
|
382 |
+
<li class="tab-pane <?php if ( $instance['tab'][4] ) : ?>active<?php endif; ?>">
|
383 |
<ul>
|
384 |
<li>
|
385 |
<h4><?php _e( 'Zourbuth Blog Feeds', $this->textdomain ) ; ?></h4>
|
387 |
</li>
|
388 |
</ul>
|
389 |
</li>
|
390 |
+
<li class="tab-pane <?php if ( $instance['tab'][5] ) : ?>active<?php endif; ?>">
|
391 |
<ul>
|
392 |
<li>
|
393 |
<p><strong>Our Premium Plugins</strong></p>
|
396 |
<li>
|
397 |
<a href="http://www.ground6.com/wordpress-plugins/flickr-badges-widget/"><b>Have a questions? Please feel free to contact supports section</b></a><br /><br />
|
398 |
|
399 |
+
<a target="_blank" href="http://feedburner.google.com/fb/a/mailverify?uri=zourbuth&loc=en_US">Subscribe to zourbuth by Email</a><br />
|
400 |
<?php _e( 'Like my work? Please consider to ', $this->textdomain ); ?><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=W6D3WAJTVKAFC" title="Donate"><?php _e( 'donate', $this->textdomain ); ?></a>.<br /><br />
|
401 |
|
402 |
If you like this plugin, please <a href="http://wordpress.org/support/view/plugin-reviews/flickr-badges-widget">give a good rating</a>.<br /><br />
|
403 |
|
404 |
+
<span style="font-size: 11px;"><a href="http://wordpress.org/extend/plugins/flickr-badges-widget/"><span style="color: #0063DC; font-weight: bold;">Flick</span><span style="color: #FF0084; font-weight: bold;">r</span> Badges Widget</a> © Copyright <a href="http://zourbuth.com">Zourbuth</a> <?php echo date("Y"); ?></span>.
|
405 |
</li>
|
406 |
+
<?php do_action( 'flickr_badges_widget_head' , $instance ); ?>
|
407 |
</ul>
|
408 |
</li>
|
409 |
|