Instagram Slider Widget - Version 1.0.0

Version Description

Download this release

Release Info

Developer jetonr
Plugin Icon 128x128 Instagram Slider Widget
Version 1.0.0
Comparing to
See all releases

Code changes from version 1.0.3 to 1.0.0

assets/css/instag-slider.css DELETED
@@ -1,32 +0,0 @@
1
- /* Flexislider Default Settings */
2
- .pllexislider { margin: 0; padding: 0; }
3
- .pllexislider .slides > li {display: none; -webkit-backface-visibility: hidden;} /* Hide the slides before the JS is loaded. Avoids image jumping */
4
- .pllexislider .slides img {width: 100%; display: block;}
5
- .pllexislider .slides:after { display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
6
- .flex-pauseplay span { text-transform: capitalize; }
7
- .pllexislider, .pllexislider .slides li, .pllexislider .slides > li > a { height: 100%; }
8
-
9
- /* no list style */
10
- .instag .no-bullet, .pllexislider .no-bullet { list-style:none; padding: 0; margin:0; }
11
-
12
- /* Flexi Slider Template */
13
- .pllexislider { margin: 0; position: relative; }
14
- .flex-viewport { max-height: 2000px; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; transition: all 1s ease; }
15
- .loading .flex-viewport { max-height: 300px; }
16
- .pllexislider .slides { zoom: 1; }
17
-
18
- /* Thumbnails Template */
19
- .instag ul.thumbnails > li { margin:0 auto; display: inline-block; *display:inline; float: none; width:24% !important; }
20
- .instag ul.thumbnails img { width: 100%; }
21
-
22
- /* Control Nav */
23
- .pllexislider .flex-control-nav { z-index:2; position: absolute; top: 0.8em; right:0.8em; text-align: center; }
24
- .pllexislider .flex-control-nav li { margin: 0 3px; display: inline-block; zoom: 1; *display: inline; }
25
- .pllexislider .flex-control-paging li a { width: 13px; border: none; height: 13px; display: block; background: #fff; background: rgba(255,255,255,255,0.5); cursor: pointer; text-indent: -9999px; -webkit-border-radius: 20px; -moz-border-radius: 20px; -o-border-radius: 20px; border-radius: 20px; -webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.3); -moz-box-shadow: inset 0 0 2px rgba(0,0,0,0.3); -o-box-shadow: inset 0 0 2px rgba(0,0,0,0.3); box-shadow: inset 0 0 2px rgba(0,0,0,0.3); }
26
- .pllexislider .flex-control-paging li a:hover { background: #fff; background: rgba(255,255,255,0.7); }
27
- .pllexislider .flex-control-paging li a.flex-active { background: #fff; background: rgba(255,255,255,0.9); cursor: default; }
28
-
29
- /* Description and Time */
30
- .pllexislider ul li .instadescription p { margin-top:5px; margin-bottom: 5px; display: block; }
31
- .pllexislider ul li .instatime { margin-top:5px; width: 40%; float:right; text-align: right; }
32
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
css/instag-slider.css ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* Flexislider Default Settings */
2
+ .pllexislider { margin: 0; padding: 0; }
3
+ .pllexislider .slides > li {display: none; -webkit-backface-visibility: hidden;} /* Hide the slides before the JS is loaded. Avoids image jumping */
4
+ .pllexislider .slides img {width: 100%; display: block;}
5
+ .pllexislider .slides:after { display: block; clear: both; visibility: hidden; line-height: 0; height: 0;}
6
+ .flex-pauseplay span {text-transform: capitalize;}
7
+ .pllexislider, .pllexislider .slides li, .pllexislider .slides > li > a { height: 100%; }
8
+
9
+ /* no list style */
10
+ .no-bullet { list-style:none; margin:0; }
11
+
12
+ /* Flexi Slider Template */
13
+ .pllexislider { margin: 0; position: relative; }
14
+ .flex-viewport { max-height: 2000px; -webkit-transition: all 1s ease; -moz-transition: all 1s ease; -o-transition: all 1s ease; transition: all 1s ease; }
15
+ .loading .flex-viewport { max-height: 300px; }
16
+ .pllexislider .slides { zoom: 1; }
17
+
18
+ /* Thumbnails Template */
19
+ .thumbnails > li { margin:0 auto; display: inline-block; *display:inline; float: none; width:24%;}
20
+
21
+ /* Control Nav */
22
+ .pllexislider .flex-control-nav { z-index:2; position: absolute; top: 0.8em; right:0.8em; text-align: center;}
23
+ .pllexislider .flex-control-nav li {margin: 0 3px; display: inline-block; zoom: 1; *display: inline;}
24
+ .pllexislider .flex-control-paging li a {width: 13px; border: none; height: 13px; display: block; background: #fff; background: rgba(255,255,255,255,0.5); cursor: pointer; text-indent: -9999px; -webkit-border-radius: 20px; -moz-border-radius: 20px; -o-border-radius: 20px; border-radius: 20px; -webkit-box-shadow: inset 0 0 2px rgba(0,0,0,0.3); -moz-box-shadow: inset 0 0 2px rgba(0,0,0,0.3); -o-box-shadow: inset 0 0 2px rgba(0,0,0,0.3); box-shadow: inset 0 0 2px rgba(0,0,0,0.3); }
25
+ .pllexislider .flex-control-paging li a:hover { background: #fff; background: rgba(255,255,255,0.7); }
26
+ .pllexislider .flex-control-paging li a.flex-active { background: #fff; background: rgba(255,255,255,0.9); cursor: default; }
27
+
28
+ /* Description and Time */
29
+ .instadescription p { margin-top:5px; margin-bottom: 5px; display: block;}
30
+ .instatime { margin-top:5px; width: 40%; float:right; text-align: right; }
31
+
inc/functions.php ADDED
@@ -0,0 +1,180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
3
+
4
+ if ( ! function_exists( 'instag_images_data' ) ) :
5
+ /**
6
+ * Stores the fetched data from instagram in WordPress DB using transients
7
+ *
8
+ * @return array of localy saved instagram data
9
+ */
10
+ function instag_images_data( $username, $cache_hours, $nr_images ) {
11
+
12
+ $opt_name = 'jr_insta_'.md5( $username );
13
+ $instaData = get_transient( $opt_name );
14
+ $user_opt = get_option( $opt_name );
15
+
16
+ if (
17
+ false === $instaData
18
+ || $user_opt['username'] != $username
19
+ || $user_opt['cache_hours'] != $cache_hours
20
+ || $user_opt['nr_images'] != $nr_images
21
+ )
22
+ {
23
+ $instaData = array();
24
+ $insta_url = 'http://instagram.com/';
25
+ $user_profile = $insta_url.$username;
26
+ $json = wp_remote_get( $user_profile, array( 'sslverify' => false, 'timeout'=> 60 ) );
27
+ $user_options = compact('username', 'cache_hours', 'nr_images');
28
+ update_option($opt_name, $user_options);
29
+ if ( $json['response']['code'] == 200 ) {
30
+
31
+ $json = $json['body'];
32
+ $json = strstr( $json, '{"entry_data"' );
33
+ $json = strstr( $json, '</script>', true );
34
+ $json = rtrim( $json, ';' );
35
+ preg_match_all( "#(\"userMedia\"\:)(\[)(.*?)(\]\,\"prerelease\")#isU", $json, $matches );
36
+ $json = isset($matches[3][0]) ? $matches[3][0] : null;
37
+ $json = "[".$json."]";
38
+ ( $results = json_decode( $json, true ) ) && json_last_error() == JSON_ERROR_NONE;
39
+
40
+ if ( ( $results ) && is_array( $results ) ) {
41
+ foreach( $results as $current => $result ) {
42
+
43
+ if( $current <= $nr_images ) break;
44
+ $caption = $result['caption'];
45
+ $image = $result['images']['standard_resolution'];
46
+ $id = $result['id'];
47
+ $image = $image['url'];
48
+ $link = $result['link'];
49
+ $created_time = $caption['created_time'];
50
+ $text = utf8_4byte_to_3byte($caption['text']);
51
+
52
+ $filename_data= explode('.',$image);
53
+
54
+ if ( is_array( $filename_data ) ) {
55
+
56
+ $fileformat = end( $filename_data );
57
+
58
+ if ( $fileformat !== false ){
59
+
60
+ $image = download_insta_image( $image, md5( $id ) . '.' . $fileformat );
61
+ array_push( $instaData, array(
62
+ 'id' => $id,
63
+ 'user_name' => $username,
64
+ 'user_url' => $user_profile,
65
+ 'created_time'=> $created_time,
66
+ 'text' => $text,
67
+ 'image' => $image,
68
+ 'link' => $link
69
+ ));
70
+
71
+ } // end -> if $fileformat !== false
72
+
73
+ } // end -> is_array( $filename_data )
74
+
75
+ } // end -> foreach
76
+
77
+ } // end -> ( $results ) && is_array( $results ) )
78
+
79
+ } // end -> $json['response']['code'] === 200 )
80
+
81
+ if ( $instaData ) {
82
+ set_transient( $opt_name, $instaData, $cache_hours * 60 * 60 );
83
+ } // end -> true $instaData
84
+
85
+ } // end -> false === $instaData
86
+
87
+ return $instaData;
88
+ }
89
+ endif; // insta_images
90
+
91
+ if ( ! function_exists( 'download_insta_image' ) ) :
92
+ /**
93
+ * Save Instagram images to upload folder and ads to media.
94
+ * If the upload fails it returns the remote image url.
95
+ *
96
+ * @return url to image
97
+ */
98
+ function download_insta_image( $url , $file ){
99
+
100
+ $local_file = JR_INSTAGWP_UPLOAD_PATH . $file;
101
+
102
+ if ( file_exists( $local_file ) ) {
103
+ return JR_INSTAGWP_UPLODAD_URL . $file;
104
+ }
105
+
106
+ $get = wp_remote_get( $url, array( 'sslverify' => false ) );
107
+ $body = wp_remote_retrieve_body( $get );
108
+ $upload = wp_upload_bits( $file, '', $body );
109
+
110
+ if ( $upload ) {
111
+ return $upload['url'];
112
+ }
113
+
114
+ return $url;
115
+ }
116
+ endif; // download_insta_image
117
+
118
+ if ( ! function_exists( 'utf8_4byte_to_3byte' ) ) :
119
+ /**
120
+ * Sanitize 4-byte UTF8 chars; no full utf8mb4 support in drupal7+mysql stack.
121
+ * This solution runs in O(n) time BUT assumes that all incoming input is
122
+ * strictly UTF8.
123
+ *
124
+ * @return the sanitized input
125
+ */
126
+ function utf8_4byte_to_3byte($input) {
127
+
128
+ if (!empty($input)) {
129
+ $utf8_2byte = 0xC0 /*1100 0000*/; $utf8_2byte_bmask = 0xE0 /*1110 0000*/;
130
+ $utf8_3byte = 0xE0 /*1110 0000*/; $utf8_3byte_bmask = 0XF0 /*1111 0000*/;
131
+ $utf8_4byte = 0xF0 /*1111 0000*/; $utf8_4byte_bmask = 0xF8 /*1111 1000*/;
132
+
133
+ $sanitized = "";
134
+ $len = strlen($input);
135
+ for ($i = 0; $i < $len; ++$i) {
136
+ $mb_char = $input[$i]; // Potentially a multibyte sequence
137
+ $byte = ord($mb_char);
138
+ if (($byte & $utf8_2byte_bmask) == $utf8_2byte) {
139
+ $mb_char .= $input[++$i];
140
+ }
141
+ else if (($byte & $utf8_3byte_bmask) == $utf8_3byte) {
142
+ $mb_char .= $input[++$i];
143
+ $mb_char .= $input[++$i];
144
+ }
145
+ else if (($byte & $utf8_4byte_bmask) == $utf8_4byte) {
146
+ // Replace with ? to avoid MySQL exception
147
+ $mb_char = '?';
148
+ $i += 3;
149
+ }
150
+
151
+ $sanitized .= $mb_char;
152
+ }
153
+
154
+ $input= $sanitized;
155
+ }
156
+
157
+ return $input;
158
+ }
159
+ endif; // utf8_4byte_to_3byte
160
+
161
+ if ( ! function_exists( 'instag_templates' ) ) :
162
+ /**
163
+ * Helper Function to insert Templates for widget
164
+ *
165
+ * @include file templates
166
+ */
167
+ function instag_templates( $template, $data_arr ){
168
+
169
+ $filename = JR_INSTAGWP_PATH_TEMPLATE . $template . '.php';
170
+
171
+ if(file_exists( $filename )){
172
+
173
+ include $filename;
174
+
175
+ } else {
176
+
177
+ echo __( sprintf('Template not found<br>%s' , $filename), 'example' );
178
+ }
179
+ }
180
+ endif; // instag_templates
instaram_slider.php CHANGED
@@ -1,411 +1,141 @@
1
- <?php
2
- /*
3
- Plugin Name: Instagram Slider Widget
4
- Plugin URI: http://jrwebstudio.com/instagram-slider/
5
- Version: 1.0.3
6
- Description: Instagram Slider Widget is a responsive slider widget that shows 20 latest images from a public instagram user.
7
- Author: jetonr
8
- Author URI: http://jrwebstudio.com/
9
- License: GPLv2 or later
10
- */
11
-
12
- /**
13
- * After the plugins have loaded initalise a single instance of JR_InstagramSlider
14
- */
15
- add_action( 'plugins_loaded', array( 'JR_InstagramSlider', 'get_instance' ) );
16
-
17
- /**
18
- * JR_InstagramSlider Class
19
- */
20
- class JR_InstagramSlider extends WP_Widget {
21
-
22
- /**
23
- * Plugin version, used for cache-busting of style and script file references.
24
- *
25
- * @since 1.0.0
26
- *
27
- * @var string
28
- */
29
- const VERSION = '1.0.3';
30
-
31
- /**
32
- * Instance of this class.
33
- *
34
- * @var object
35
- */
36
- protected static $instance = null;
37
-
38
- /**
39
- * Initialize the plugin by registering widget and loading public scripts
40
- *
41
- */
42
- public function __construct() {
43
-
44
- // Register Widget On Widgets Init
45
- add_action( 'widgets_init', array( $this, 'register_widget' ) );
46
-
47
- // Enqueue Plugin Styles and scripts
48
- add_action( 'wp_enqueue_scripts', array( $this, 'public_enqueue' ) );
49
-
50
-
51
- $widget_options = array(
52
- 'classname' => 'jr-insta-slider',
53
- 'description' => __( 'A widget that displays a slider with instagram images ', 'jrinstaslider' )
54
- );
55
-
56
- parent::__construct( 'jr_insta_slider', __('Instagram Slider', 'jrinstaslider'), $widget_options );
57
- }
58
-
59
- /**
60
- * Return an instance of this class.
61
- *
62
- * @return object A single instance of this class.
63
- */
64
- public static function get_instance() {
65
-
66
- // If the single instance hasn't been set, set it now.
67
- if ( null == self::$instance ) {
68
- self::$instance = new self;
69
- }
70
-
71
- return self::$instance;
72
- }
73
-
74
- /**
75
- * Register widget on windgets init
76
- *
77
- * @return void
78
- */
79
- public function register_widget() {
80
- register_widget( __CLASS__ );
81
- }
82
-
83
- /**
84
- * Enqueue public-facing Scripts and style sheet.
85
- *
86
- * @return void
87
- */
88
- public function public_enqueue() {
89
-
90
- // Enqueue Styles
91
- wp_enqueue_style(
92
- 'instag-slider',
93
- plugins_url( 'assets/css/instag-slider.css', __FILE__ ),
94
- array(),
95
- self::VERSION
96
- );
97
-
98
- // Enqueue Scripts
99
- wp_enqueue_script(
100
- 'jquery-flexi-slider',
101
- plugins_url( 'assets/js/jquery.flexslider-min.js', __FILE__ ),
102
- array( 'jquery' ),
103
- '2.2',
104
- true
105
- );
106
- }
107
-
108
- /**
109
- * The Public view of the Widget
110
- *
111
- * @return mixed
112
- */
113
- public function widget( $args, $instance ) {
114
- extract( $args );
115
-
116
- //Our variables from the widget settings.
117
- $title = apply_filters('widget_title', $instance['title'] );
118
- $username = $instance['username'];
119
- $images_link = $instance['images_link'];
120
- $randomise = isset( $instance['randomise'] ) ? 'on' : 'off';
121
- $images_nr = $instance['images_number'];
122
- $refresh_hour = $instance['refresh_hour'];
123
- $template = $instance['template'];
124
-
125
- echo $before_widget;
126
-
127
- // Display the widget title
128
- if ( $title ) {
129
- echo $before_title . $title . $after_title;
130
- }
131
- // Get instagram data
132
- $insta_data = $this->instagram_data( $username, $refresh_hour, $images_nr );
133
-
134
- // Randomise Images
135
- if ( "on" == $randomise ) {
136
- shuffle( $insta_data );
137
- }
138
-
139
- //include the template based on user choice
140
- $this->template( $template, $insta_data, $images_link );
141
-
142
- echo $after_widget;
143
- }
144
-
145
- /**
146
- * Update the widget settings
147
- *
148
- * @param array $new_instance New instance values
149
- * @param array $old_instance Old instance values
150
- *
151
- * @return array
152
- */
153
- public function update( $new_instance, $old_instance ) {
154
- $instance = $old_instance;
155
-
156
- //Strip tags from title and name to remove HTML
157
- $instance['title'] = strip_tags( $new_instance['title'] );
158
- $instance['username'] = $new_instance['username'];
159
- $instance['template'] = $new_instance['template'];
160
- $instance['images_link'] = $new_instance['images_link'];
161
- $instance['randomise'] = $new_instance['randomise'];
162
- $instance['images_number'] = $new_instance['images_number'];
163
- $instance['refresh_hour'] = $new_instance['refresh_hour'];
164
-
165
- return $instance;
166
- }
167
-
168
- /**
169
- * Widget Settings Form
170
- *
171
- * @return mixed
172
- */
173
- public function form( $instance ) {
174
-
175
- //Set up some default widget settings.
176
- $defaults = array( 'title' => __('Instagram Slider', 'jrinstaslider'), 'username' => __('', 'jrinstaslider'), 'template' => 'slider', 'images_link' => 'image_url', 'images_number' => 5, 'refresh_hour' => 5 );
177
- $instance = wp_parse_args( (array) $instance, $defaults ); ?>
178
-
179
- <p>
180
- <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'jrinstaslider'); ?></label>
181
- <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
182
- </p>
183
- <p>
184
- <label for="<?php echo $this->get_field_id( 'username' ); ?>"><?php _e('Instagram Username:', 'jrinstaslider'); ?></label>
185
- <input class="widefat" id="<?php echo $this->get_field_id( 'username' ); ?>" name="<?php echo $this->get_field_name( 'username' ); ?>" value="<?php echo $instance['username']; ?>" />
186
- </p>
187
- <p>
188
- <label for="<?php echo $this->get_field_id( 'template' ); ?>"><?php _e( 'Images Layout', 'jrinstaslider' ); ?>
189
- <select class="widefat" name="<?php echo $this->get_field_name( 'template' ); ?>">
190
- <option value="slider" <?php echo ($instance['template'] == 'slider') ? ' selected="selected"' : ''; ?>><?php _e('Slider', 'jrinstaslider'); ?></option>
191
- <option value="thumbs" <?php echo ($instance['template'] == 'thumbs') ? ' selected="selected"' : ''; ?>><?php _e('Thumbnails', 'jrinstaslider'); ?></option>
192
- </select>
193
- </label>
194
- </p>
195
- <p>
196
- <?php _e('Link Images To:', 'jrinstaslider'); ?><br>
197
- <label><input type="radio" id="<?php echo $this->get_field_id( 'images_link' ); ?>" name="<?php echo $this->get_field_name( 'images_link' ); ?>" value="image_url" <?php checked( 'image_url', $instance['images_link'] ); ?> /> <?php _e('Instagram Image URL', 'jrinstaslider'); ?></label><br />
198
- <label><input type="radio" id="<?php echo $this->get_field_id( 'images_link' ); ?>" name="<?php echo $this->get_field_name( 'images_link' ); ?>" value="user_url" <?php checked( 'user_url', $instance['images_link'] ); ?> /> <?php _e('Instagram Profile URL', 'jrinstaslider'); ?></label><br />
199
- </p>
200
- <p>
201
- <label for="<?php echo $this->get_field_id( 'randomise' ); ?>"><?php _e( 'Randomise Images:', 'jrinstaslider' ); ?></label>
202
- <input class="widefat" id="<?php echo $this->get_field_id( 'randomise' ); ?>" name="<?php echo $this->get_field_name( 'randomise' ); ?>" type="checkbox" value="1" <?php checked( '1', $instance['randomise'] ); ?> />
203
- </p>
204
- <p>
205
- <label for="<?php echo $this->get_field_id( 'images_number' ); ?>"><?php _e('Number of Images to Show:', 'jrinstaslider'); ?>
206
- <input class="small-text" id="<?php echo $this->get_field_id( 'images_number' ); ?>" name="<?php echo $this->get_field_name( 'images_number' ); ?>" value="<?php echo $instance['images_number']; ?>" />
207
- <small><?php _e('( max 20 )', 'jrinstaslider'); ?></small>
208
- </label>
209
- </p>
210
- <p>
211
- <label for="<?php echo $this->get_field_id( 'refresh_hour' ); ?>"><?php _e('Check for new images every:', 'jrinstaslider'); ?>
212
- <input class="small-text" id="<?php echo $this->get_field_id( 'refresh_hour' ); ?>" name="<?php echo $this->get_field_name( 'refresh_hour' ); ?>" value="<?php echo $instance['refresh_hour']; ?>" />
213
- <small><?php _e('hours', 'jrinstaslider'); ?></small>
214
- </label>
215
- </p>
216
-
217
- <?php
218
- }
219
-
220
- /**
221
- * Stores the fetched data from instagram in WordPress DB using transients
222
- *
223
- * @param string $username Instagram Username to fetch images from
224
- * @param string $cache_hours Cache hours for transient
225
- * @param string $nr_images Nr of images to fetch from instagram
226
- *
227
- * @return array of localy saved instagram data
228
- */
229
- private function instagram_data( $username, $cache_hours, $nr_images ) {
230
-
231
- $opt_name = 'jr_insta_'.md5( $username );
232
- $instaData = get_transient( $opt_name );
233
- $user_opt = get_option( $opt_name );
234
-
235
- if (
236
- false === $instaData
237
- || $user_opt['username'] != $username
238
- || $user_opt['cache_hours'] != $cache_hours
239
- || $user_opt['nr_images'] != $nr_images
240
- )
241
- {
242
- $instaData = array();
243
- $insta_url = 'http://instagram.com/';
244
- $user_profile = $insta_url.$username;
245
- $json = wp_remote_get( $user_profile, array( 'sslverify' => false, 'timeout'=> 60 ) );
246
- $user_options = compact('username', 'cache_hours', 'nr_images');
247
- update_option($opt_name, $user_options);
248
- if ( $json['response']['code'] == 200 ) {
249
-
250
- $json = $json['body'];
251
- $json = strstr( $json, '{"entry_data"' );
252
-
253
- // Compatibility for version of php where strstr() doesnt accept third parameter
254
- if ( version_compare( phpversion(), '5.3.10', '<' ) ) {
255
- $json = substr( $json, 0, strpos($json, '</script>' ) );
256
- } else {
257
- $json = strstr( $json, '</script>', true );
258
- }
259
-
260
- $json = rtrim( $json, ';' );
261
- ( $results = json_decode( $json, true ) ) && json_last_error() == JSON_ERROR_NONE;
262
-
263
- if ( ( $results ) && is_array( $results ) ) {
264
- foreach( $results['entry_data']['UserProfile'][0]['userMedia'] as $current => $result ) {
265
-
266
- if( $current >= $nr_images ) break;
267
- $caption = $result['caption'];
268
- $image = $result['images']['standard_resolution'];
269
- $id = $result['id'];
270
- $image = $image['url'];
271
- $link = $result['link'];
272
- $created_time = $caption['created_time'];
273
- $text = $this->utf8_4byte_to_3byte($caption['text']);
274
-
275
- $filename_data= explode('.',$image);
276
-
277
- if ( is_array( $filename_data ) ) {
278
-
279
- $fileformat = end( $filename_data );
280
-
281
- if ( $fileformat !== false ){
282
-
283
- $image = $this->download_insta_image( $image, md5( $id ) . '.' . $fileformat );
284
- array_push( $instaData, array(
285
- 'id' => $id,
286
- 'user_name' => $username,
287
- 'user_url' => $user_profile,
288
- 'created_time'=> $created_time,
289
- 'text' => $text,
290
- 'image' => $image,
291
- 'link' => $link
292
- ));
293
-
294
- } // end -> if $fileformat !== false
295
-
296
- } // end -> is_array( $filename_data )
297
-
298
- } // end -> foreach
299
-
300
- } // end -> ( $results ) && is_array( $results ) )
301
-
302
- } // end -> $json['response']['code'] === 200 )
303
-
304
- if ( $instaData ) {
305
- set_transient( $opt_name, $instaData, $cache_hours * 60 * 60 );
306
- } // end -> true $instaData
307
-
308
- } // end -> false === $instaData
309
-
310
- return $instaData;
311
- }
312
-
313
-
314
- /**
315
- * Save Instagram images to upload folder and ads to media.
316
- * If the upload fails it returns the remote image url.
317
- *
318
- * @param string $url Url of image to download
319
- * @param string $file File path for image
320
- *
321
- * @return string Url to image
322
- */
323
- private function download_insta_image( $url , $file ){
324
-
325
- $upload_dir = wp_upload_dir();
326
- $local_file = $upload_dir['path'] . '/' . $file;
327
-
328
- if ( file_exists( $local_file ) ) {
329
- return $upload_dir['baseurl'] . $upload_dir['subdir'] . '/' . $file;
330
- }
331
-
332
- $get = wp_remote_get( $url, array( 'sslverify' => false ) );
333
- $body = wp_remote_retrieve_body( $get );
334
- $upload = wp_upload_bits( $file, '', $body );
335
-
336
- if ( $upload ) {
337
- return $upload['url'];
338
- }
339
-
340
- return $url;
341
- }
342
-
343
- /**
344
- * Sanitize 4-byte UTF8 chars; no full utf8mb4 support in drupal7+mysql stack.
345
- * This solution runs in O(n) time BUT assumes that all incoming input is
346
- * strictly UTF8.
347
- *
348
- * @param string $input The input to be sanitised
349
- *
350
- * @return the sanitized input
351
- */
352
- private function utf8_4byte_to_3byte( $input ) {
353
-
354
- if (!empty($input)) {
355
- $utf8_2byte = 0xC0 /*1100 0000*/; $utf8_2byte_bmask = 0xE0 /*1110 0000*/;
356
- $utf8_3byte = 0xE0 /*1110 0000*/; $utf8_3byte_bmask = 0XF0 /*1111 0000*/;
357
- $utf8_4byte = 0xF0 /*1111 0000*/; $utf8_4byte_bmask = 0xF8 /*1111 1000*/;
358
-
359
- $sanitized = "";
360
- $len = strlen($input);
361
- for ($i = 0; $i < $len; ++$i) {
362
- $mb_char = $input[$i]; // Potentially a multibyte sequence
363
- $byte = ord($mb_char);
364
- if (($byte & $utf8_2byte_bmask) == $utf8_2byte) {
365
- $mb_char .= $input[++$i];
366
- }
367
- else if (($byte & $utf8_3byte_bmask) == $utf8_3byte) {
368
- $mb_char .= $input[++$i];
369
- $mb_char .= $input[++$i];
370
- }
371
- else if (($byte & $utf8_4byte_bmask) == $utf8_4byte) {
372
- // Replace with ? to avoid MySQL exception
373
- $mb_char = '?';
374
- $i += 3;
375
- }
376
-
377
- $sanitized .= $mb_char;
378
- }
379
-
380
- $input= $sanitized;
381
- }
382
-
383
- return $input;
384
- }
385
-
386
- /**
387
- * Function to display Templates for widget
388
- *
389
- * @param string $template The input to be sanitised
390
- * @param array $data_arr The input to be sanitised
391
- * @param string $link_to The input to be sanitised
392
- *
393
- * @include file templates
394
- *
395
- * return void
396
- */
397
- private function template( $template, $data_arr, $link_to ){
398
-
399
- $filename = plugin_dir_path( __FILE__ ) . "views/" . $template . '.php';
400
-
401
- if( file_exists( $filename ) ){
402
-
403
- include $filename;
404
-
405
- } else {
406
-
407
- echo __( sprintf( 'Template not found<br>%s' , $filename), 'jrinstaslider' );
408
- }
409
- }
410
-
411
- } // end of class JR_InstagramSlider
1
+ <?php
2
+ /*
3
+ Plugin Name: Instagram Slider Widget
4
+ Plugin URI: http://jrwebstudio.com/instagram-slider/
5
+ Description: Instagram Slider Widget is a responsive slider widget that shows 20 latest images from a public instagram user.
6
+ Author: jetonr
7
+ Author URI: http://jrwebstudio.com/
8
+ License: GPLv2 or later
9
+ */
10
+
11
+ /* Define Constants for this widget */
12
+ define('JR_INSTAGWP_PATH_BASE' , dirname(__FILE__) . DIRECTORY_SEPARATOR);
13
+ define('JR_INSTAGWP_PATH_TEMPLATE' , JR_INSTAGWP_PATH_BASE . 'templates/');
14
+ define('JR_INSTAGWP_PATH_INC' , JR_INSTAGWP_PATH_BASE . 'inc/');
15
+ define('JR_INSTAGWP_URL' , plugins_url( '/' , __FILE__ ));
16
+ define('JR_INSTAGWP_WP_VERSION' , get_bloginfo('version'));
17
+ define('JR_INSTAGWP_WP_MIN_VERSION' , 3.5);
18
+
19
+ $upload_dir = wp_upload_dir();
20
+ define('JR_INSTAGWP_UPLOAD_PATH' , $upload_dir['path'] . '/');
21
+ define('JR_INSTAGWP_UPLODAD_URL' , $upload_dir['baseurl'] . $upload_dir['subdir'] . '/');
22
+
23
+ // Require functions need for this widget
24
+ require_once ( JR_INSTAGWP_PATH_INC . 'functions.php' );
25
+
26
+ /* Enqueue Frontend Plugin Styles & Scripts */
27
+ function jr_insta_slider_enqueue() {
28
+
29
+ // Register and enqueue Styles
30
+ wp_enqueue_style( 'instag-slider', JR_INSTAGWP_URL . 'css/instag-slider.css' );
31
+
32
+ // Register and enqueue Scripts
33
+ wp_enqueue_script(
34
+ 'jquery-flexi-slider',
35
+ JR_INSTAGWP_URL . 'js/jquery.flexslider-min.js',
36
+ array( 'jquery' ),
37
+ false,
38
+ true
39
+ );
40
+
41
+ }
42
+ add_action( 'wp_enqueue_scripts', 'jr_insta_slider_enqueue' );
43
+
44
+ /* Register widget on windgets init */
45
+ add_action( 'widgets_init', 'jr_insta_slider_register' );
46
+ function jr_insta_slider_register() {
47
+ register_widget( 'JR_InstagramSlider' );
48
+ }
49
+
50
+ class JR_InstagramSlider extends WP_Widget {
51
+
52
+ public function __construct() {
53
+ parent::__construct( 'jr_insta_slider', __( 'Instagram Slider', 'jrinstaslider' ), array(
54
+ 'classname' => 'jr-insta-slider',
55
+ 'description' => __( 'A widget that displays a slider with instagram images ', 'jrinstaslider', 'jrinstaslider' ),
56
+ ) );
57
+ }
58
+
59
+ function widget( $args, $instance ) {
60
+ extract( $args );
61
+
62
+ //Our variables from the widget settings.
63
+ $title = apply_filters('widget_title', $instance['title'] );
64
+ $username = $instance['username'];
65
+ $images_nr = $instance['images_number'];
66
+ $refresh_hour = $instance['refresh_hour'];
67
+ $template = $instance['template'];
68
+
69
+ echo $before_widget;
70
+
71
+ // Display the widget title
72
+ if ( $title ) {
73
+ echo $before_title . $title . $after_title;
74
+ }
75
+ // Get instagram data
76
+ $insta_data = instag_images_data($username, $refresh_hour, $images_nr );
77
+
78
+ //include the template based on user choice
79
+ instag_templates( $template, $insta_data );
80
+
81
+ echo $after_widget;
82
+ }
83
+
84
+ //Update the widget
85
+
86
+ function update( $new_instance, $old_instance ) {
87
+ $instance = $old_instance;
88
+
89
+ //Strip tags from title and name to remove HTML
90
+ $instance['title'] = strip_tags( $new_instance['title'] );
91
+ $instance['username'] = $new_instance['username'];
92
+ $instance['images_number'] = $new_instance['images_number'];
93
+ $instance['refresh_hour'] = $new_instance['refresh_hour'];
94
+ $instance['template'] = $new_instance['template'];
95
+
96
+ return $instance;
97
+ }
98
+
99
+
100
+ function form( $instance ) {
101
+
102
+ //Set up some default widget settings.
103
+ $defaults = array( 'title' => __('Instagram Slider', 'jrinstaslider'), 'username' => __('', 'jrinstaslider'), 'images_number' => 5, 'refresh_hour' => 5, 'template' => 'slider' );
104
+ $instance = wp_parse_args( (array) $instance, $defaults ); ?>
105
+
106
+ <p>
107
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'jrinstaslider'); ?></label>
108
+ <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" />
109
+ </p>
110
+
111
+ <p>
112
+ <label for="<?php echo $this->get_field_id( 'username' ); ?>"><?php _e('Instagram Username:', 'jrinstaslider'); ?></label>
113
+ <input class="widefat" id="<?php echo $this->get_field_id( 'username' ); ?>" name="<?php echo $this->get_field_name( 'username' ); ?>" value="<?php echo $instance['username']; ?>" />
114
+ </p>
115
+
116
+ <p>
117
+ <label for="<?php echo $this->get_field_id( 'template' ); ?>"><?php _e( 'Images Layout', 'jrinstaslider' ); ?>
118
+ <select class="widefat" name="<?php echo $this->get_field_name( 'template' ); ?>">
119
+ <option value="slider" <?php ($instance['template'] == 'slider') ? ' selected="selected"' : ''; ?>><?php _e('Slider', 'jrinstaslider'); ?></option>
120
+ <option value="thumbs" <?php ($instance['template'] == 'thumbs') ? ' selected="selected"' : ''; ?>><?php _e('Thumbnails', 'jrinstaslider'); ?></option>
121
+ </select>
122
+ </label>
123
+ </p>
124
+
125
+ <p>
126
+ <label for="<?php echo $this->get_field_id( 'images_number' ); ?>"><?php _e('Number of Images to Show:', 'jrinstaslider'); ?>
127
+ <input class="small-text" id="<?php echo $this->get_field_id( 'images_number' ); ?>" name="<?php echo $this->get_field_name( 'images_number' ); ?>" value="<?php echo $instance['images_number']; ?>" />
128
+ <small><?php _e('( max 20 )', 'jrinstaslider'); ?></small>
129
+ </label>
130
+ </p>
131
+
132
+ <p>
133
+ <label for="<?php echo $this->get_field_id( 'refresh_hour' ); ?>"><?php _e('Check for new images every:', 'jrinstaslider'); ?>
134
+ <input class="small-text" id="<?php echo $this->get_field_id( 'refresh_hour' ); ?>" name="<?php echo $this->get_field_name( 'refresh_hour' ); ?>" value="<?php echo $instance['refresh_hour']; ?>" />
135
+ <small><?php _e('hours', 'jrinstaslider'); ?></small>
136
+ </label>
137
+ </p>
138
+
139
+ <?php
140
+ }
141
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{assets/js → js}/jquery.flexslider-min.js RENAMED
@@ -1,6 +1,6 @@
1
- /*
2
- * jQuery FlexSlider v2.2
3
- * Copyright 2012 WooThemes
4
- * Contributing Author: Tyler Smith
5
- */
6
  (function(e){e.pllexislider=function(t,n){var r=e(t);r.vars=e.extend({},e.pllexislider.defaults,n);var i=r.vars.namespace,s=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,o=("ontouchstart"in window||s||window.DocumentTouch&&document instanceof DocumentTouch)&&r.vars.touch,u="click touchend MSPointerUp",a="",f,l=r.vars.direction==="vertical",c=r.vars.reverse,h=r.vars.itemWidth>0,p=r.vars.animation==="fade",d=r.vars.asNavFor!=="",v={},m=true;e.data(t,"pllexislider",r);v={init:function(){r.animating=false;r.currentSlide=parseInt(r.vars.startAt?r.vars.startAt:0);if(isNaN(r.currentSlide))r.currentSlide=0;r.animatingTo=r.currentSlide;r.atEnd=r.currentSlide===0||r.currentSlide===r.last;r.containerSelector=r.vars.selector.substr(0,r.vars.selector.search(" "));r.slides=e(r.vars.selector,r);r.container=e(r.containerSelector,r);r.count=r.slides.length;r.syncExists=e(r.vars.sync).length>0;if(r.vars.animation==="slide")r.vars.animation="swing";r.prop=l?"top":"marginLeft";r.args={};r.manualPause=false;r.stopped=false;r.started=false;r.startTimeout=null;r.transitions=!r.vars.video&&!p&&r.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var n in t){if(e.style[t[n]]!==undefined){r.pfx=t[n].replace("Perspective","").toLowerCase();r.prop="-"+r.pfx+"-transform";return true}}return false}();if(r.vars.controlsContainer!=="")r.controlsContainer=e(r.vars.controlsContainer).length>0&&e(r.vars.controlsContainer);if(r.vars.manualControls!=="")r.manualControls=e(r.vars.manualControls).length>0&&e(r.vars.manualControls);if(r.vars.randomize){r.slides.sort(function(){return Math.round(Math.random())-.5});r.container.empty().append(r.slides)}r.doMath();r.setup("init");if(r.vars.controlNav)v.controlNav.setup();if(r.vars.directionNav)v.directionNav.setup();if(r.vars.keyboard&&(e(r.containerSelector).length===1||r.vars.multipleKeyboard)){e(document).bind("keyup",function(e){var t=e.keyCode;if(!r.animating&&(t===39||t===37)){var n=t===39?r.getTarget("next"):t===37?r.getTarget("prev"):false;r.flexAnimate(n,r.vars.pauseOnAction)}})}if(r.vars.mousewheel){r.bind("mousewheel",function(e,t,n,i){e.preventDefault();var s=t<0?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(s,r.vars.pauseOnAction)})}if(r.vars.pausePlay)v.pausePlay.setup();if(r.vars.slideshow&&r.vars.pauseInvisible)v.pauseInvisible.init();if(r.vars.slideshow){if(r.vars.pauseOnHover){r.hover(function(){if(!r.manualPlay&&!r.manualPause)r.pause()},function(){if(!r.manualPause&&!r.manualPlay&&!r.stopped)r.play()})}if(!r.vars.pauseInvisible||!v.pauseInvisible.isHidden()){r.vars.initDelay>0?r.startTimeout=setTimeout(r.play,r.vars.initDelay):r.play()}}if(d)v.asNav.setup();if(o&&r.vars.touch)v.touch();if(!p||p&&r.vars.smoothHeight)e(window).bind("resize orientationchange focus",v.resize);r.find("img").attr("draggable","false");setTimeout(function(){r.vars.start(r)},200)},asNav:{setup:function(){r.asNav=true;r.animatingTo=Math.floor(r.currentSlide/r.move);r.currentItem=r.currentSlide;r.slides.removeClass(i+"active-slide").eq(r.currentItem).addClass(i+"active-slide");if(!s){r.slides.click(function(t){t.preventDefault();var n=e(this),s=n.index();var o=n.offset().left-e(r).scrollLeft();if(o<=0&&n.hasClass(i+"active-slide")){r.flexAnimate(r.getTarget("prev"),true)}else if(!e(r.vars.asNavFor).data("pllexislider").animating&&!n.hasClass(i+"active-slide")){r.direction=r.currentItem<s?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction,false,true,true)}})}else{t._slider=r;r.slides.each(function(){var t=this;t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",function(e){e.preventDefault();if(e.currentTarget._gesture)e.currentTarget._gesture.addPointer(e.pointerId)},false);t.addEventListener("MSGestureTap",function(t){t.preventDefault();var n=e(this),i=n.index();if(!e(r.vars.asNavFor).data("pllexislider").animating&&!n.hasClass("active")){r.direction=r.currentItem<i?"next":"prev";r.flexAnimate(i,r.vars.pauseOnAction,false,true,true)}})})}}},controlNav:{setup:function(){if(!r.manualControls){v.controlNav.setupPaging()}else{v.controlNav.setupManual()}},setupPaging:function(){var t=r.vars.controlNav==="thumbnails"?"control-thumbs":"control-paging",n=1,s,o;r.controlNavScaffold=e('<ol class="'+i+"control-nav "+i+t+'"></ol>');if(r.pagingCount>1){for(var f=0;f<r.pagingCount;f++){o=r.slides.eq(f);s=r.vars.controlNav==="thumbnails"?'<img src="'+o.attr("data-thumb")+'"/>':"<a>"+n+"</a>";if("thumbnails"===r.vars.controlNav&&true===r.vars.thumbCaptions){var l=o.attr("data-thumbcaption");if(""!=l&&undefined!=l)s+='<span class="'+i+'caption">'+l+"</span>"}r.controlNavScaffold.append("<li>"+s+"</li>");n++}}r.controlsContainer?e(r.controlsContainer).append(r.controlNavScaffold):r.append(r.controlNavScaffold);v.controlNav.set();v.controlNav.active();r.controlNavScaffold.delegate("a, img",u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){r.direction=s>r.currentSlide?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction)}}if(a===""){a=t.type}v.setToClearWatchedEvent()})},setupManual:function(){r.controlNav=r.manualControls;v.controlNav.active();r.controlNav.bind(u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){s>r.currentSlide?r.direction="next":r.direction="prev";r.flexAnimate(s,r.vars.pauseOnAction)}}if(a===""){a=t.type}v.setToClearWatchedEvent()})},set:function(){var t=r.vars.controlNav==="thumbnails"?"img":"a";r.controlNav=e("."+i+"control-nav li "+t,r.controlsContainer?r.controlsContainer:r)},active:function(){r.controlNav.removeClass(i+"active").eq(r.animatingTo).addClass(i+"active")},update:function(t,n){if(r.pagingCount>1&&t==="add"){r.controlNavScaffold.append(e("<li><a>"+r.count+"</a></li>"))}else if(r.pagingCount===1){r.controlNavScaffold.find("li").remove()}else{r.controlNav.eq(n).closest("li").remove()}v.controlNav.set();r.pagingCount>1&&r.pagingCount!==r.controlNav.length?r.update(n,t):v.controlNav.active()}},directionNav:{setup:function(){var t=e('<ul class="'+i+'direction-nav"><li><a class="'+i+'prev" href="#">'+r.vars.prevText+'</a></li><li><a class="'+i+'next" href="#">'+r.vars.nextText+"</a></li></ul>");if(r.controlsContainer){e(r.controlsContainer).append(t);r.directionNav=e("."+i+"direction-nav li a",r.controlsContainer)}else{r.append(t);r.directionNav=e("."+i+"direction-nav li a",r)}v.directionNav.update();r.directionNav.bind(u,function(t){t.preventDefault();var n;if(a===""||a===t.type){n=e(this).hasClass(i+"next")?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(n,r.vars.pauseOnAction)}if(a===""){a=t.type}v.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";if(r.pagingCount===1){r.directionNav.addClass(e).attr("tabindex","-1")}else if(!r.vars.animationLoop){if(r.animatingTo===0){r.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1")}else if(r.animatingTo===r.last){r.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1")}else{r.directionNav.removeClass(e).removeAttr("tabindex")}}else{r.directionNav.removeClass(e).removeAttr("tabindex")}}},pausePlay:{setup:function(){var t=e('<div class="'+i+'pauseplay"><a></a></div>');if(r.controlsContainer){r.controlsContainer.append(t);r.pausePlay=e("."+i+"pauseplay a",r.controlsContainer)}else{r.append(t);r.pausePlay=e("."+i+"pauseplay a",r)}v.pausePlay.update(r.vars.slideshow?i+"pause":i+"play");r.pausePlay.bind(u,function(t){t.preventDefault();if(a===""||a===t.type){if(e(this).hasClass(i+"pause")){r.manualPause=true;r.manualPlay=false;r.pause()}else{r.manualPause=false;r.manualPlay=true;r.play()}}if(a===""){a=t.type}v.setToClearWatchedEvent()})},update:function(e){e==="play"?r.pausePlay.removeClass(i+"pause").addClass(i+"play").html(r.vars.playText):r.pausePlay.removeClass(i+"play").addClass(i+"pause").html(r.vars.pauseText)}},touch:function(){var e,n,i,o,u,a,f=false,d=0,v=0,m=0;if(!s){t.addEventListener("touchstart",g,false);function g(s){if(r.animating){s.preventDefault()}else if(window.navigator.msPointerEnabled||s.touches.length===1){r.pause();o=l?r.h:r.w;a=Number(new Date);d=s.touches[0].pageX;v=s.touches[0].pageY;i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o;e=l?v:d;n=l?d:v;t.addEventListener("touchmove",y,false);t.addEventListener("touchend",b,false)}}function y(t){d=t.touches[0].pageX;v=t.touches[0].pageY;u=l?e-v:e-d;f=l?Math.abs(u)<Math.abs(d-n):Math.abs(u)<Math.abs(v-n);var s=500;if(!f||Number(new Date)-a>s){t.preventDefault();if(!p&&r.transitions){if(!r.vars.animationLoop){u=u/(r.currentSlide===0&&u<0||r.currentSlide===r.last&&u>0?Math.abs(u)/o+2:1)}r.setProps(i+u,"setTouch")}}}function b(s){t.removeEventListener("touchmove",y,false);if(r.animatingTo===r.currentSlide&&!f&&!(u===null)){var l=c?-u:u,h=l>0?r.getTarget("next"):r.getTarget("prev");if(r.canAdvance(h)&&(Number(new Date)-a<550&&Math.abs(l)>50||Math.abs(l)>o/2)){r.flexAnimate(h,r.vars.pauseOnAction)}else{if(!p)r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,true)}}t.removeEventListener("touchend",b,false);e=null;n=null;u=null;i=null}}else{t.style.msTouchAction="none";t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",w,false);t._slider=r;t.addEventListener("MSGestureChange",E,false);t.addEventListener("MSGestureEnd",S,false);function w(e){e.stopPropagation();if(r.animating){e.preventDefault()}else{r.pause();t._gesture.addPointer(e.pointerId);m=0;o=l?r.h:r.w;a=Number(new Date);i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o}}function E(e){e.stopPropagation();var n=e.target._slider;if(!n){return}var r=-e.translationX,s=-e.translationY;m=m+(l?s:r);u=m;f=l?Math.abs(m)<Math.abs(-r):Math.abs(m)<Math.abs(-s);if(e.detail===e.MSGESTURE_FLAG_INERTIA){setImmediate(function(){t._gesture.stop()});return}if(!f||Number(new Date)-a>500){e.preventDefault();if(!p&&n.transitions){if(!n.vars.animationLoop){u=m/(n.currentSlide===0&&m<0||n.currentSlide===n.last&&m>0?Math.abs(m)/o+2:1)}n.setProps(i+u,"setTouch")}}}function S(t){t.stopPropagation();var r=t.target._slider;if(!r){return}if(r.animatingTo===r.currentSlide&&!f&&!(u===null)){var s=c?-u:u,l=s>0?r.getTarget("next"):r.getTarget("prev");if(r.canAdvance(l)&&(Number(new Date)-a<550&&Math.abs(s)>50||Math.abs(s)>o/2)){r.flexAnimate(l,r.vars.pauseOnAction)}else{if(!p)r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,true)}}e=null;n=null;u=null;i=null;m=0}}},resize:function(){if(!r.animating&&r.is(":visible")){if(!h)r.doMath();if(p){v.smoothHeight()}else if(h){r.slides.width(r.computedW);r.update(r.pagingCount);r.setProps()}else if(l){r.viewport.height(r.h);r.setProps(r.h,"setTotal")}else{if(r.vars.smoothHeight)v.smoothHeight();r.newSlides.width(r.computedW);r.setProps(r.computedW,"setTotal")}}},smoothHeight:function(e){if(!l||p){var t=p?r:r.viewport;e?t.animate({height:r.slides.eq(r.animatingTo).height()},e):t.height(r.slides.eq(r.animatingTo).height())}},sync:function(t){var n=e(r.vars.sync).data("pllexislider"),i=r.animatingTo;switch(t){case"animate":n.flexAnimate(i,r.vars.pauseOnAction,false,true);break;case"play":if(!n.playing&&!n.asNav){n.play()}break;case"pause":n.pause();break}},pauseInvisible:{visProp:null,init:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++){if(e[t]+"Hidden"in document)v.pauseInvisible.visProp=e[t]+"Hidden"}if(v.pauseInvisible.visProp){var n=v.pauseInvisible.visProp.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(n,function(){if(v.pauseInvisible.isHidden()){if(r.startTimeout)clearTimeout(r.startTimeout);else r.pause()}else{if(r.started)r.play();else r.vars.initDelay>0?setTimeout(r.play,r.vars.initDelay):r.play()}})}},isHidden:function(){return document[v.pauseInvisible.visProp]||false}},setToClearWatchedEvent:function(){clearTimeout(f);f=setTimeout(function(){a=""},3e3)}};r.flexAnimate=function(t,n,s,u,a){if(!r.vars.animationLoop&&t!==r.currentSlide){r.direction=t>r.currentSlide?"next":"prev"}if(d&&r.pagingCount===1)r.direction=r.currentItem<t?"next":"prev";if(!r.animating&&(r.canAdvance(t,a)||s)&&r.is(":visible")){if(d&&u){var f=e(r.vars.asNavFor).data("pllexislider");r.atEnd=t===0||t===r.count-1;f.flexAnimate(t,true,false,true,a);r.direction=r.currentItem<t?"next":"prev";f.direction=r.direction;if(Math.ceil((t+1)/r.visible)-1!==r.currentSlide&&t!==0){r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");t=Math.floor(t/r.visible)}else{r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");return false}}r.animating=true;r.animatingTo=t;if(n)r.pause();r.vars.before(r);if(r.syncExists&&!a)v.sync("animate");if(r.vars.controlNav)v.controlNav.active();if(!h)r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");r.atEnd=t===0||t===r.last;if(r.vars.directionNav)v.directionNav.update();if(t===r.last){r.vars.end(r);if(!r.vars.animationLoop)r.pause()}if(!p){var m=l?r.slides.filter(":first").height():r.computedW,g,y,b;if(h){g=r.vars.itemMargin;b=(r.itemW+g)*r.move*r.animatingTo;y=b>r.limit&&r.visible!==1?r.limit:b}else if(r.currentSlide===0&&t===r.count-1&&r.vars.animationLoop&&r.direction!=="next"){y=c?(r.count+r.cloneOffset)*m:0}else if(r.currentSlide===r.last&&t===0&&r.vars.animationLoop&&r.direction!=="prev"){y=c?0:(r.count+1)*m}else{y=c?(r.count-1-t+r.cloneOffset)*m:(t+r.cloneOffset)*m}r.setProps(y,"",r.vars.animationSpeed);if(r.transitions){if(!r.vars.animationLoop||!r.atEnd){r.animating=false;r.currentSlide=r.animatingTo}r.container.unbind("webkitTransitionEnd transitionend");r.container.bind("webkitTransitionEnd transitionend",function(){r.wrapup(m)})}else{r.container.animate(r.args,r.vars.animationSpeed,r.vars.easing,function(){r.wrapup(m)})}}else{if(!o){r.slides.eq(r.currentSlide).css({zIndex:1}).animate({opacity:0},r.vars.animationSpeed,r.vars.easing);r.slides.eq(t).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing,r.wrapup)}else{r.slides.eq(r.currentSlide).css({opacity:0,zIndex:1});r.slides.eq(t).css({opacity:1,zIndex:2});r.wrapup(m)}}if(r.vars.smoothHeight)v.smoothHeight(r.vars.animationSpeed)}};r.wrapup=function(e){if(!p&&!h){if(r.currentSlide===0&&r.animatingTo===r.last&&r.vars.animationLoop){r.setProps(e,"jumpEnd")}else if(r.currentSlide===r.last&&r.animatingTo===0&&r.vars.animationLoop){r.setProps(e,"jumpStart")}}r.animating=false;r.currentSlide=r.animatingTo;r.vars.after(r)};r.animateSlides=function(){if(!r.animating&&m)r.flexAnimate(r.getTarget("next"))};r.pause=function(){clearInterval(r.animatedSlides);r.animatedSlides=null;r.playing=false;if(r.vars.pausePlay)v.pausePlay.update("play");if(r.syncExists)v.sync("pause")};r.play=function(){if(r.playing)clearInterval(r.animatedSlides);r.animatedSlides=r.animatedSlides||setInterval(r.animateSlides,r.vars.slideshowSpeed);r.started=r.playing=true;if(r.vars.pausePlay)v.pausePlay.update("pause");if(r.syncExists)v.sync("play")};r.stop=function(){r.pause();r.stopped=true};r.canAdvance=function(e,t){var n=d?r.pagingCount-1:r.last;return t?true:d&&r.currentItem===r.count-1&&e===0&&r.direction==="prev"?true:d&&r.currentItem===0&&e===r.pagingCount-1&&r.direction!=="next"?false:e===r.currentSlide&&!d?false:r.vars.animationLoop?true:r.atEnd&&r.currentSlide===0&&e===n&&r.direction!=="next"?false:r.atEnd&&r.currentSlide===n&&e===0&&r.direction==="next"?false:true};r.getTarget=function(e){r.direction=e;if(e==="next"){return r.currentSlide===r.last?0:r.currentSlide+1}else{return r.currentSlide===0?r.last:r.currentSlide-1}};r.setProps=function(e,t,n){var i=function(){var n=e?e:(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo,i=function(){if(h){return t==="setTouch"?e:c&&r.animatingTo===r.last?0:c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:r.animatingTo===r.last?r.limit:n}else{switch(t){case"setTotal":return c?(r.count-1-r.currentSlide+r.cloneOffset)*e:(r.currentSlide+r.cloneOffset)*e;case"setTouch":return c?e:e;case"jumpEnd":return c?e:r.count*e;case"jumpStart":return c?r.count*e:e;default:return e}}}();return i*-1+"px"}();if(r.transitions){i=l?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)";n=n!==undefined?n/1e3+"s":"0s";r.container.css("-"+r.pfx+"-transition-duration",n)}r.args[r.prop]=i;if(r.transitions||n===undefined)r.container.css(r.args)};r.setup=function(t){if(!p){var n,s;if(t==="init"){r.viewport=e('<div class="'+i+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(r).append(r.container);r.cloneCount=0;r.cloneOffset=0;if(c){s=e.makeArray(r.slides).reverse();r.slides=e(s);r.container.empty().append(r.slides)}}if(r.vars.animationLoop&&!h){r.cloneCount=2;r.cloneOffset=1;if(t!=="init")r.container.find(".clone").remove();r.container.append(r.slides.first().clone().addClass("clone").attr("aria-hidden","true")).prepend(r.slides.last().clone().addClass("clone").attr("aria-hidden","true"))}r.newSlides=e(r.vars.selector,r);n=c?r.count-1-r.currentSlide+r.cloneOffset:r.currentSlide+r.cloneOffset;if(l&&!h){r.container.height((r.count+r.cloneCount)*200+"%").css("position","absolute").width("100%");setTimeout(function(){r.newSlides.css({display:"block"});r.doMath();r.viewport.height(r.h);r.setProps(n*r.h,"init")},t==="init"?100:0)}else{r.container.width((r.count+r.cloneCount)*200+"%");r.setProps(n*r.computedW,"init");setTimeout(function(){r.doMath();r.newSlides.css({width:r.computedW,"float":"left",display:"block"});if(r.vars.smoothHeight)v.smoothHeight()},t==="init"?100:0)}}else{r.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"});if(t==="init"){if(!o){r.slides.css({opacity:0,display:"block",zIndex:1}).eq(r.currentSlide).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing)}else{r.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+r.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(r.currentSlide).css({opacity:1,zIndex:2})}}if(r.vars.smoothHeight)v.smoothHeight()}if(!h)r.slides.removeClass(i+"active-slide").eq(r.currentSlide).addClass(i+"active-slide")};r.doMath=function(){var e=r.slides.first(),t=r.vars.itemMargin,n=r.vars.minItems,i=r.vars.maxItems;r.w=r.viewport===undefined?r.width():r.viewport.width();r.h=e.height();r.boxPadding=e.outerWidth()-e.width();if(h){r.itemT=r.vars.itemWidth+t;r.minW=n?n*r.itemT:r.w;r.maxW=i?i*r.itemT-t:r.w;r.itemW=r.minW>r.w?(r.w-t*(n-1))/n:r.maxW<r.w?(r.w-t*(i-1))/i:r.vars.itemWidth>r.w?r.w:r.vars.itemWidth;r.visible=Math.floor(r.w/r.itemW);r.move=r.vars.move>0&&r.vars.move<r.visible?r.vars.move:r.visible;r.pagingCount=Math.ceil((r.count-r.visible)/r.move+1);r.last=r.pagingCount-1;r.limit=r.pagingCount===1?0:r.vars.itemWidth>r.w?r.itemW*(r.count-1)+t*(r.count-1):(r.itemW+t)*r.count-r.w-t}else{r.itemW=r.w;r.pagingCount=r.count;r.last=r.count-1}r.computedW=r.itemW-r.boxPadding};r.update=function(e,t){r.doMath();if(!h){if(e<r.currentSlide){r.currentSlide+=1}else if(e<=r.currentSlide&&e!==0){r.currentSlide-=1}r.animatingTo=r.currentSlide}if(r.vars.controlNav&&!r.manualControls){if(t==="add"&&!h||r.pagingCount>r.controlNav.length){v.controlNav.update("add")}else if(t==="remove"&&!h||r.pagingCount<r.controlNav.length){if(h&&r.currentSlide>r.last){r.currentSlide-=1;r.animatingTo-=1}v.controlNav.update("remove",r.last)}}if(r.vars.directionNav)v.directionNav.update()};r.addSlide=function(t,n){var i=e(t);r.count+=1;r.last=r.count-1;if(l&&c){n!==undefined?r.slides.eq(r.count-n).after(i):r.container.prepend(i)}else{n!==undefined?r.slides.eq(n).before(i):r.container.append(i)}r.update(n,"add");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.added(r)};r.removeSlide=function(t){var n=isNaN(t)?r.slides.index(e(t)):t;r.count-=1;r.last=r.count-1;if(isNaN(t)){e(t,r.slides).remove()}else{l&&c?r.slides.eq(r.last).remove():r.slides.eq(t).remove()}r.doMath();r.update(n,"remove");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.removed(r)};v.init()};e(window).blur(function(e){focused=false}).focus(function(e){focused=true});e.pllexislider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:false,animationLoop:true,smoothHeight:false,startAt:0,slideshow:true,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:false,thumbCaptions:false,pauseOnAction:true,pauseOnHover:false,pauseInvisible:true,useCSS:true,touch:true,video:false,controlNav:true,directionNav:true,prevText:"Previous",nextText:"Next",keyboard:true,multipleKeyboard:false,mousewheel:false,pausePlay:false,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:true,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){}};e.fn.pllexislider=function(t){if(t===undefined)t={};if(typeof t==="object"){return this.each(function(){var n=e(this),r=t.selector?t.selector:".slides > li",i=n.find(r);if(i.length===1&&t.allowOneSlide===true||i.length===0){i.fadeIn(400);if(t.start)t.start(n)}else if(n.data("pllexislider")===undefined){new e.pllexislider(this,t)}})}else{var n=e(this).data("pllexislider");switch(t){case"play":n.play();break;case"pause":n.pause();break;case"stop":n.stop();break;case"next":n.flexAnimate(n.getTarget("next"),true);break;case"prev":case"previous":n.flexAnimate(n.getTarget("prev"),true);break;default:if(typeof t==="number")n.flexAnimate(t,true)}}}})(jQuery)
1
+ /*
2
+ * jQuery FlexSlider v2.2
3
+ * Copyright 2012 WooThemes
4
+ * Contributing Author: Tyler Smith
5
+ */
6
  (function(e){e.pllexislider=function(t,n){var r=e(t);r.vars=e.extend({},e.pllexislider.defaults,n);var i=r.vars.namespace,s=window.navigator&&window.navigator.msPointerEnabled&&window.MSGesture,o=("ontouchstart"in window||s||window.DocumentTouch&&document instanceof DocumentTouch)&&r.vars.touch,u="click touchend MSPointerUp",a="",f,l=r.vars.direction==="vertical",c=r.vars.reverse,h=r.vars.itemWidth>0,p=r.vars.animation==="fade",d=r.vars.asNavFor!=="",v={},m=true;e.data(t,"pllexislider",r);v={init:function(){r.animating=false;r.currentSlide=parseInt(r.vars.startAt?r.vars.startAt:0);if(isNaN(r.currentSlide))r.currentSlide=0;r.animatingTo=r.currentSlide;r.atEnd=r.currentSlide===0||r.currentSlide===r.last;r.containerSelector=r.vars.selector.substr(0,r.vars.selector.search(" "));r.slides=e(r.vars.selector,r);r.container=e(r.containerSelector,r);r.count=r.slides.length;r.syncExists=e(r.vars.sync).length>0;if(r.vars.animation==="slide")r.vars.animation="swing";r.prop=l?"top":"marginLeft";r.args={};r.manualPause=false;r.stopped=false;r.started=false;r.startTimeout=null;r.transitions=!r.vars.video&&!p&&r.vars.useCSS&&function(){var e=document.createElement("div"),t=["perspectiveProperty","WebkitPerspective","MozPerspective","OPerspective","msPerspective"];for(var n in t){if(e.style[t[n]]!==undefined){r.pfx=t[n].replace("Perspective","").toLowerCase();r.prop="-"+r.pfx+"-transform";return true}}return false}();if(r.vars.controlsContainer!=="")r.controlsContainer=e(r.vars.controlsContainer).length>0&&e(r.vars.controlsContainer);if(r.vars.manualControls!=="")r.manualControls=e(r.vars.manualControls).length>0&&e(r.vars.manualControls);if(r.vars.randomize){r.slides.sort(function(){return Math.round(Math.random())-.5});r.container.empty().append(r.slides)}r.doMath();r.setup("init");if(r.vars.controlNav)v.controlNav.setup();if(r.vars.directionNav)v.directionNav.setup();if(r.vars.keyboard&&(e(r.containerSelector).length===1||r.vars.multipleKeyboard)){e(document).bind("keyup",function(e){var t=e.keyCode;if(!r.animating&&(t===39||t===37)){var n=t===39?r.getTarget("next"):t===37?r.getTarget("prev"):false;r.flexAnimate(n,r.vars.pauseOnAction)}})}if(r.vars.mousewheel){r.bind("mousewheel",function(e,t,n,i){e.preventDefault();var s=t<0?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(s,r.vars.pauseOnAction)})}if(r.vars.pausePlay)v.pausePlay.setup();if(r.vars.slideshow&&r.vars.pauseInvisible)v.pauseInvisible.init();if(r.vars.slideshow){if(r.vars.pauseOnHover){r.hover(function(){if(!r.manualPlay&&!r.manualPause)r.pause()},function(){if(!r.manualPause&&!r.manualPlay&&!r.stopped)r.play()})}if(!r.vars.pauseInvisible||!v.pauseInvisible.isHidden()){r.vars.initDelay>0?r.startTimeout=setTimeout(r.play,r.vars.initDelay):r.play()}}if(d)v.asNav.setup();if(o&&r.vars.touch)v.touch();if(!p||p&&r.vars.smoothHeight)e(window).bind("resize orientationchange focus",v.resize);r.find("img").attr("draggable","false");setTimeout(function(){r.vars.start(r)},200)},asNav:{setup:function(){r.asNav=true;r.animatingTo=Math.floor(r.currentSlide/r.move);r.currentItem=r.currentSlide;r.slides.removeClass(i+"active-slide").eq(r.currentItem).addClass(i+"active-slide");if(!s){r.slides.click(function(t){t.preventDefault();var n=e(this),s=n.index();var o=n.offset().left-e(r).scrollLeft();if(o<=0&&n.hasClass(i+"active-slide")){r.flexAnimate(r.getTarget("prev"),true)}else if(!e(r.vars.asNavFor).data("pllexislider").animating&&!n.hasClass(i+"active-slide")){r.direction=r.currentItem<s?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction,false,true,true)}})}else{t._slider=r;r.slides.each(function(){var t=this;t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",function(e){e.preventDefault();if(e.currentTarget._gesture)e.currentTarget._gesture.addPointer(e.pointerId)},false);t.addEventListener("MSGestureTap",function(t){t.preventDefault();var n=e(this),i=n.index();if(!e(r.vars.asNavFor).data("pllexislider").animating&&!n.hasClass("active")){r.direction=r.currentItem<i?"next":"prev";r.flexAnimate(i,r.vars.pauseOnAction,false,true,true)}})})}}},controlNav:{setup:function(){if(!r.manualControls){v.controlNav.setupPaging()}else{v.controlNav.setupManual()}},setupPaging:function(){var t=r.vars.controlNav==="thumbnails"?"control-thumbs":"control-paging",n=1,s,o;r.controlNavScaffold=e('<ol class="'+i+"control-nav "+i+t+'"></ol>');if(r.pagingCount>1){for(var f=0;f<r.pagingCount;f++){o=r.slides.eq(f);s=r.vars.controlNav==="thumbnails"?'<img src="'+o.attr("data-thumb")+'"/>':"<a>"+n+"</a>";if("thumbnails"===r.vars.controlNav&&true===r.vars.thumbCaptions){var l=o.attr("data-thumbcaption");if(""!=l&&undefined!=l)s+='<span class="'+i+'caption">'+l+"</span>"}r.controlNavScaffold.append("<li>"+s+"</li>");n++}}r.controlsContainer?e(r.controlsContainer).append(r.controlNavScaffold):r.append(r.controlNavScaffold);v.controlNav.set();v.controlNav.active();r.controlNavScaffold.delegate("a, img",u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){r.direction=s>r.currentSlide?"next":"prev";r.flexAnimate(s,r.vars.pauseOnAction)}}if(a===""){a=t.type}v.setToClearWatchedEvent()})},setupManual:function(){r.controlNav=r.manualControls;v.controlNav.active();r.controlNav.bind(u,function(t){t.preventDefault();if(a===""||a===t.type){var n=e(this),s=r.controlNav.index(n);if(!n.hasClass(i+"active")){s>r.currentSlide?r.direction="next":r.direction="prev";r.flexAnimate(s,r.vars.pauseOnAction)}}if(a===""){a=t.type}v.setToClearWatchedEvent()})},set:function(){var t=r.vars.controlNav==="thumbnails"?"img":"a";r.controlNav=e("."+i+"control-nav li "+t,r.controlsContainer?r.controlsContainer:r)},active:function(){r.controlNav.removeClass(i+"active").eq(r.animatingTo).addClass(i+"active")},update:function(t,n){if(r.pagingCount>1&&t==="add"){r.controlNavScaffold.append(e("<li><a>"+r.count+"</a></li>"))}else if(r.pagingCount===1){r.controlNavScaffold.find("li").remove()}else{r.controlNav.eq(n).closest("li").remove()}v.controlNav.set();r.pagingCount>1&&r.pagingCount!==r.controlNav.length?r.update(n,t):v.controlNav.active()}},directionNav:{setup:function(){var t=e('<ul class="'+i+'direction-nav"><li><a class="'+i+'prev" href="#">'+r.vars.prevText+'</a></li><li><a class="'+i+'next" href="#">'+r.vars.nextText+"</a></li></ul>");if(r.controlsContainer){e(r.controlsContainer).append(t);r.directionNav=e("."+i+"direction-nav li a",r.controlsContainer)}else{r.append(t);r.directionNav=e("."+i+"direction-nav li a",r)}v.directionNav.update();r.directionNav.bind(u,function(t){t.preventDefault();var n;if(a===""||a===t.type){n=e(this).hasClass(i+"next")?r.getTarget("next"):r.getTarget("prev");r.flexAnimate(n,r.vars.pauseOnAction)}if(a===""){a=t.type}v.setToClearWatchedEvent()})},update:function(){var e=i+"disabled";if(r.pagingCount===1){r.directionNav.addClass(e).attr("tabindex","-1")}else if(!r.vars.animationLoop){if(r.animatingTo===0){r.directionNav.removeClass(e).filter("."+i+"prev").addClass(e).attr("tabindex","-1")}else if(r.animatingTo===r.last){r.directionNav.removeClass(e).filter("."+i+"next").addClass(e).attr("tabindex","-1")}else{r.directionNav.removeClass(e).removeAttr("tabindex")}}else{r.directionNav.removeClass(e).removeAttr("tabindex")}}},pausePlay:{setup:function(){var t=e('<div class="'+i+'pauseplay"><a></a></div>');if(r.controlsContainer){r.controlsContainer.append(t);r.pausePlay=e("."+i+"pauseplay a",r.controlsContainer)}else{r.append(t);r.pausePlay=e("."+i+"pauseplay a",r)}v.pausePlay.update(r.vars.slideshow?i+"pause":i+"play");r.pausePlay.bind(u,function(t){t.preventDefault();if(a===""||a===t.type){if(e(this).hasClass(i+"pause")){r.manualPause=true;r.manualPlay=false;r.pause()}else{r.manualPause=false;r.manualPlay=true;r.play()}}if(a===""){a=t.type}v.setToClearWatchedEvent()})},update:function(e){e==="play"?r.pausePlay.removeClass(i+"pause").addClass(i+"play").html(r.vars.playText):r.pausePlay.removeClass(i+"play").addClass(i+"pause").html(r.vars.pauseText)}},touch:function(){var e,n,i,o,u,a,f=false,d=0,v=0,m=0;if(!s){t.addEventListener("touchstart",g,false);function g(s){if(r.animating){s.preventDefault()}else if(window.navigator.msPointerEnabled||s.touches.length===1){r.pause();o=l?r.h:r.w;a=Number(new Date);d=s.touches[0].pageX;v=s.touches[0].pageY;i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o;e=l?v:d;n=l?d:v;t.addEventListener("touchmove",y,false);t.addEventListener("touchend",b,false)}}function y(t){d=t.touches[0].pageX;v=t.touches[0].pageY;u=l?e-v:e-d;f=l?Math.abs(u)<Math.abs(d-n):Math.abs(u)<Math.abs(v-n);var s=500;if(!f||Number(new Date)-a>s){t.preventDefault();if(!p&&r.transitions){if(!r.vars.animationLoop){u=u/(r.currentSlide===0&&u<0||r.currentSlide===r.last&&u>0?Math.abs(u)/o+2:1)}r.setProps(i+u,"setTouch")}}}function b(s){t.removeEventListener("touchmove",y,false);if(r.animatingTo===r.currentSlide&&!f&&!(u===null)){var l=c?-u:u,h=l>0?r.getTarget("next"):r.getTarget("prev");if(r.canAdvance(h)&&(Number(new Date)-a<550&&Math.abs(l)>50||Math.abs(l)>o/2)){r.flexAnimate(h,r.vars.pauseOnAction)}else{if(!p)r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,true)}}t.removeEventListener("touchend",b,false);e=null;n=null;u=null;i=null}}else{t.style.msTouchAction="none";t._gesture=new MSGesture;t._gesture.target=t;t.addEventListener("MSPointerDown",w,false);t._slider=r;t.addEventListener("MSGestureChange",E,false);t.addEventListener("MSGestureEnd",S,false);function w(e){e.stopPropagation();if(r.animating){e.preventDefault()}else{r.pause();t._gesture.addPointer(e.pointerId);m=0;o=l?r.h:r.w;a=Number(new Date);i=h&&c&&r.animatingTo===r.last?0:h&&c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:h&&r.currentSlide===r.last?r.limit:h?(r.itemW+r.vars.itemMargin)*r.move*r.currentSlide:c?(r.last-r.currentSlide+r.cloneOffset)*o:(r.currentSlide+r.cloneOffset)*o}}function E(e){e.stopPropagation();var n=e.target._slider;if(!n){return}var r=-e.translationX,s=-e.translationY;m=m+(l?s:r);u=m;f=l?Math.abs(m)<Math.abs(-r):Math.abs(m)<Math.abs(-s);if(e.detail===e.MSGESTURE_FLAG_INERTIA){setImmediate(function(){t._gesture.stop()});return}if(!f||Number(new Date)-a>500){e.preventDefault();if(!p&&n.transitions){if(!n.vars.animationLoop){u=m/(n.currentSlide===0&&m<0||n.currentSlide===n.last&&m>0?Math.abs(m)/o+2:1)}n.setProps(i+u,"setTouch")}}}function S(t){t.stopPropagation();var r=t.target._slider;if(!r){return}if(r.animatingTo===r.currentSlide&&!f&&!(u===null)){var s=c?-u:u,l=s>0?r.getTarget("next"):r.getTarget("prev");if(r.canAdvance(l)&&(Number(new Date)-a<550&&Math.abs(s)>50||Math.abs(s)>o/2)){r.flexAnimate(l,r.vars.pauseOnAction)}else{if(!p)r.flexAnimate(r.currentSlide,r.vars.pauseOnAction,true)}}e=null;n=null;u=null;i=null;m=0}}},resize:function(){if(!r.animating&&r.is(":visible")){if(!h)r.doMath();if(p){v.smoothHeight()}else if(h){r.slides.width(r.computedW);r.update(r.pagingCount);r.setProps()}else if(l){r.viewport.height(r.h);r.setProps(r.h,"setTotal")}else{if(r.vars.smoothHeight)v.smoothHeight();r.newSlides.width(r.computedW);r.setProps(r.computedW,"setTotal")}}},smoothHeight:function(e){if(!l||p){var t=p?r:r.viewport;e?t.animate({height:r.slides.eq(r.animatingTo).height()},e):t.height(r.slides.eq(r.animatingTo).height())}},sync:function(t){var n=e(r.vars.sync).data("pllexislider"),i=r.animatingTo;switch(t){case"animate":n.flexAnimate(i,r.vars.pauseOnAction,false,true);break;case"play":if(!n.playing&&!n.asNav){n.play()}break;case"pause":n.pause();break}},pauseInvisible:{visProp:null,init:function(){var e=["webkit","moz","ms","o"];if("hidden"in document)return"hidden";for(var t=0;t<e.length;t++){if(e[t]+"Hidden"in document)v.pauseInvisible.visProp=e[t]+"Hidden"}if(v.pauseInvisible.visProp){var n=v.pauseInvisible.visProp.replace(/[H|h]idden/,"")+"visibilitychange";document.addEventListener(n,function(){if(v.pauseInvisible.isHidden()){if(r.startTimeout)clearTimeout(r.startTimeout);else r.pause()}else{if(r.started)r.play();else r.vars.initDelay>0?setTimeout(r.play,r.vars.initDelay):r.play()}})}},isHidden:function(){return document[v.pauseInvisible.visProp]||false}},setToClearWatchedEvent:function(){clearTimeout(f);f=setTimeout(function(){a=""},3e3)}};r.flexAnimate=function(t,n,s,u,a){if(!r.vars.animationLoop&&t!==r.currentSlide){r.direction=t>r.currentSlide?"next":"prev"}if(d&&r.pagingCount===1)r.direction=r.currentItem<t?"next":"prev";if(!r.animating&&(r.canAdvance(t,a)||s)&&r.is(":visible")){if(d&&u){var f=e(r.vars.asNavFor).data("pllexislider");r.atEnd=t===0||t===r.count-1;f.flexAnimate(t,true,false,true,a);r.direction=r.currentItem<t?"next":"prev";f.direction=r.direction;if(Math.ceil((t+1)/r.visible)-1!==r.currentSlide&&t!==0){r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");t=Math.floor(t/r.visible)}else{r.currentItem=t;r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");return false}}r.animating=true;r.animatingTo=t;if(n)r.pause();r.vars.before(r);if(r.syncExists&&!a)v.sync("animate");if(r.vars.controlNav)v.controlNav.active();if(!h)r.slides.removeClass(i+"active-slide").eq(t).addClass(i+"active-slide");r.atEnd=t===0||t===r.last;if(r.vars.directionNav)v.directionNav.update();if(t===r.last){r.vars.end(r);if(!r.vars.animationLoop)r.pause()}if(!p){var m=l?r.slides.filter(":first").height():r.computedW,g,y,b;if(h){g=r.vars.itemMargin;b=(r.itemW+g)*r.move*r.animatingTo;y=b>r.limit&&r.visible!==1?r.limit:b}else if(r.currentSlide===0&&t===r.count-1&&r.vars.animationLoop&&r.direction!=="next"){y=c?(r.count+r.cloneOffset)*m:0}else if(r.currentSlide===r.last&&t===0&&r.vars.animationLoop&&r.direction!=="prev"){y=c?0:(r.count+1)*m}else{y=c?(r.count-1-t+r.cloneOffset)*m:(t+r.cloneOffset)*m}r.setProps(y,"",r.vars.animationSpeed);if(r.transitions){if(!r.vars.animationLoop||!r.atEnd){r.animating=false;r.currentSlide=r.animatingTo}r.container.unbind("webkitTransitionEnd transitionend");r.container.bind("webkitTransitionEnd transitionend",function(){r.wrapup(m)})}else{r.container.animate(r.args,r.vars.animationSpeed,r.vars.easing,function(){r.wrapup(m)})}}else{if(!o){r.slides.eq(r.currentSlide).css({zIndex:1}).animate({opacity:0},r.vars.animationSpeed,r.vars.easing);r.slides.eq(t).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing,r.wrapup)}else{r.slides.eq(r.currentSlide).css({opacity:0,zIndex:1});r.slides.eq(t).css({opacity:1,zIndex:2});r.wrapup(m)}}if(r.vars.smoothHeight)v.smoothHeight(r.vars.animationSpeed)}};r.wrapup=function(e){if(!p&&!h){if(r.currentSlide===0&&r.animatingTo===r.last&&r.vars.animationLoop){r.setProps(e,"jumpEnd")}else if(r.currentSlide===r.last&&r.animatingTo===0&&r.vars.animationLoop){r.setProps(e,"jumpStart")}}r.animating=false;r.currentSlide=r.animatingTo;r.vars.after(r)};r.animateSlides=function(){if(!r.animating&&m)r.flexAnimate(r.getTarget("next"))};r.pause=function(){clearInterval(r.animatedSlides);r.animatedSlides=null;r.playing=false;if(r.vars.pausePlay)v.pausePlay.update("play");if(r.syncExists)v.sync("pause")};r.play=function(){if(r.playing)clearInterval(r.animatedSlides);r.animatedSlides=r.animatedSlides||setInterval(r.animateSlides,r.vars.slideshowSpeed);r.started=r.playing=true;if(r.vars.pausePlay)v.pausePlay.update("pause");if(r.syncExists)v.sync("play")};r.stop=function(){r.pause();r.stopped=true};r.canAdvance=function(e,t){var n=d?r.pagingCount-1:r.last;return t?true:d&&r.currentItem===r.count-1&&e===0&&r.direction==="prev"?true:d&&r.currentItem===0&&e===r.pagingCount-1&&r.direction!=="next"?false:e===r.currentSlide&&!d?false:r.vars.animationLoop?true:r.atEnd&&r.currentSlide===0&&e===n&&r.direction!=="next"?false:r.atEnd&&r.currentSlide===n&&e===0&&r.direction==="next"?false:true};r.getTarget=function(e){r.direction=e;if(e==="next"){return r.currentSlide===r.last?0:r.currentSlide+1}else{return r.currentSlide===0?r.last:r.currentSlide-1}};r.setProps=function(e,t,n){var i=function(){var n=e?e:(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo,i=function(){if(h){return t==="setTouch"?e:c&&r.animatingTo===r.last?0:c?r.limit-(r.itemW+r.vars.itemMargin)*r.move*r.animatingTo:r.animatingTo===r.last?r.limit:n}else{switch(t){case"setTotal":return c?(r.count-1-r.currentSlide+r.cloneOffset)*e:(r.currentSlide+r.cloneOffset)*e;case"setTouch":return c?e:e;case"jumpEnd":return c?e:r.count*e;case"jumpStart":return c?r.count*e:e;default:return e}}}();return i*-1+"px"}();if(r.transitions){i=l?"translate3d(0,"+i+",0)":"translate3d("+i+",0,0)";n=n!==undefined?n/1e3+"s":"0s";r.container.css("-"+r.pfx+"-transition-duration",n)}r.args[r.prop]=i;if(r.transitions||n===undefined)r.container.css(r.args)};r.setup=function(t){if(!p){var n,s;if(t==="init"){r.viewport=e('<div class="'+i+'viewport"></div>').css({overflow:"hidden",position:"relative"}).appendTo(r).append(r.container);r.cloneCount=0;r.cloneOffset=0;if(c){s=e.makeArray(r.slides).reverse();r.slides=e(s);r.container.empty().append(r.slides)}}if(r.vars.animationLoop&&!h){r.cloneCount=2;r.cloneOffset=1;if(t!=="init")r.container.find(".clone").remove();r.container.append(r.slides.first().clone().addClass("clone").attr("aria-hidden","true")).prepend(r.slides.last().clone().addClass("clone").attr("aria-hidden","true"))}r.newSlides=e(r.vars.selector,r);n=c?r.count-1-r.currentSlide+r.cloneOffset:r.currentSlide+r.cloneOffset;if(l&&!h){r.container.height((r.count+r.cloneCount)*200+"%").css("position","absolute").width("100%");setTimeout(function(){r.newSlides.css({display:"block"});r.doMath();r.viewport.height(r.h);r.setProps(n*r.h,"init")},t==="init"?100:0)}else{r.container.width((r.count+r.cloneCount)*200+"%");r.setProps(n*r.computedW,"init");setTimeout(function(){r.doMath();r.newSlides.css({width:r.computedW,"float":"left",display:"block"});if(r.vars.smoothHeight)v.smoothHeight()},t==="init"?100:0)}}else{r.slides.css({width:"100%","float":"left",marginRight:"-100%",position:"relative"});if(t==="init"){if(!o){r.slides.css({opacity:0,display:"block",zIndex:1}).eq(r.currentSlide).css({zIndex:2}).animate({opacity:1},r.vars.animationSpeed,r.vars.easing)}else{r.slides.css({opacity:0,display:"block",webkitTransition:"opacity "+r.vars.animationSpeed/1e3+"s ease",zIndex:1}).eq(r.currentSlide).css({opacity:1,zIndex:2})}}if(r.vars.smoothHeight)v.smoothHeight()}if(!h)r.slides.removeClass(i+"active-slide").eq(r.currentSlide).addClass(i+"active-slide")};r.doMath=function(){var e=r.slides.first(),t=r.vars.itemMargin,n=r.vars.minItems,i=r.vars.maxItems;r.w=r.viewport===undefined?r.width():r.viewport.width();r.h=e.height();r.boxPadding=e.outerWidth()-e.width();if(h){r.itemT=r.vars.itemWidth+t;r.minW=n?n*r.itemT:r.w;r.maxW=i?i*r.itemT-t:r.w;r.itemW=r.minW>r.w?(r.w-t*(n-1))/n:r.maxW<r.w?(r.w-t*(i-1))/i:r.vars.itemWidth>r.w?r.w:r.vars.itemWidth;r.visible=Math.floor(r.w/r.itemW);r.move=r.vars.move>0&&r.vars.move<r.visible?r.vars.move:r.visible;r.pagingCount=Math.ceil((r.count-r.visible)/r.move+1);r.last=r.pagingCount-1;r.limit=r.pagingCount===1?0:r.vars.itemWidth>r.w?r.itemW*(r.count-1)+t*(r.count-1):(r.itemW+t)*r.count-r.w-t}else{r.itemW=r.w;r.pagingCount=r.count;r.last=r.count-1}r.computedW=r.itemW-r.boxPadding};r.update=function(e,t){r.doMath();if(!h){if(e<r.currentSlide){r.currentSlide+=1}else if(e<=r.currentSlide&&e!==0){r.currentSlide-=1}r.animatingTo=r.currentSlide}if(r.vars.controlNav&&!r.manualControls){if(t==="add"&&!h||r.pagingCount>r.controlNav.length){v.controlNav.update("add")}else if(t==="remove"&&!h||r.pagingCount<r.controlNav.length){if(h&&r.currentSlide>r.last){r.currentSlide-=1;r.animatingTo-=1}v.controlNav.update("remove",r.last)}}if(r.vars.directionNav)v.directionNav.update()};r.addSlide=function(t,n){var i=e(t);r.count+=1;r.last=r.count-1;if(l&&c){n!==undefined?r.slides.eq(r.count-n).after(i):r.container.prepend(i)}else{n!==undefined?r.slides.eq(n).before(i):r.container.append(i)}r.update(n,"add");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.added(r)};r.removeSlide=function(t){var n=isNaN(t)?r.slides.index(e(t)):t;r.count-=1;r.last=r.count-1;if(isNaN(t)){e(t,r.slides).remove()}else{l&&c?r.slides.eq(r.last).remove():r.slides.eq(t).remove()}r.doMath();r.update(n,"remove");r.slides=e(r.vars.selector+":not(.clone)",r);r.setup();r.vars.removed(r)};v.init()};e(window).blur(function(e){focused=false}).focus(function(e){focused=true});e.pllexislider.defaults={namespace:"flex-",selector:".slides > li",animation:"fade",easing:"swing",direction:"horizontal",reverse:false,animationLoop:true,smoothHeight:false,startAt:0,slideshow:true,slideshowSpeed:7e3,animationSpeed:600,initDelay:0,randomize:false,thumbCaptions:false,pauseOnAction:true,pauseOnHover:false,pauseInvisible:true,useCSS:true,touch:true,video:false,controlNav:true,directionNav:true,prevText:"Previous",nextText:"Next",keyboard:true,multipleKeyboard:false,mousewheel:false,pausePlay:false,pauseText:"Pause",playText:"Play",controlsContainer:"",manualControls:"",sync:"",asNavFor:"",itemWidth:0,itemMargin:0,minItems:1,maxItems:0,move:0,allowOneSlide:true,start:function(){},before:function(){},after:function(){},end:function(){},added:function(){},removed:function(){}};e.fn.pllexislider=function(t){if(t===undefined)t={};if(typeof t==="object"){return this.each(function(){var n=e(this),r=t.selector?t.selector:".slides > li",i=n.find(r);if(i.length===1&&t.allowOneSlide===true||i.length===0){i.fadeIn(400);if(t.start)t.start(n)}else if(n.data("pllexislider")===undefined){new e.pllexislider(this,t)}})}else{var n=e(this).data("pllexislider");switch(t){case"play":n.play();break;case"pause":n.pause();break;case"stop":n.stop();break;case"next":n.flexAnimate(n.getTarget("next"),true);break;case"prev":case"previous":n.flexAnimate(n.getTarget("prev"),true);break;default:if(typeof t==="number")n.flexAnimate(t,true)}}}})(jQuery)
readme.txt CHANGED
@@ -1,52 +1,28 @@
1
- === Instagram Slider Widget ===
2
- Contributors: jetonr
3
- Tags: instagram, slider, widget, images
4
- Donate link: http://goo.gl/RZiu34
5
- Requires at least: 3.5
6
- Tested up to: 3.8.1
7
- License: GPLv2 or later
8
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
-
10
- Instagram Slider Widget is a responsive slider widget that shows 20 latest images from a public instagram user.
11
-
12
- == Description ==
13
- * Instagram Slider Widget is a responsive slider widget that shows 20 latest images from a public instagram user.
14
- = Features =
15
- * Images are stored in your wordpress upload folder.
16
- * Display Images in Slider or Thumbnails
17
- * No Api Key Needed
18
- * Link images to user profile or image url
19
- * Option to Randomise order of instagram images
20
- * For more info visit http://jrwebstudio.com/
21
-
22
- == Installation ==
23
- 1. Upload `instagram-slider-widget` to the `/wp-content/plugins/` directory
24
- 2. Activate the plugin through the \'Plugins\' menu in WordPress
25
- 3. Go to Appearance > Widgets and drag \'Instagram Slider Widget\' to your sidebar
26
- 4. Update the settings in the widget: Instagram Username, Images Layout, Number of Images to show, Check for new images hours
27
-
28
- == Screenshots ==
29
- 1. Frontend Widget Slider
30
- 2. Frontend Widget Thumbs
31
- 3. Backend Configuration
32
-
33
- == Changelog ==
34
- = 1.0.3 =
35
- * Added Option to link images to User Profile or Image Url
36
- * Code Cleanup
37
-
38
- = 1.0.2 =
39
- * Compatibility for php older than 5.3
40
- * Stlying fix for thumbnail layout
41
- * Added Option to Randomise Images
42
-
43
- = 1.0.1 =
44
- * Removed preg_match
45
- * Using exact array index
46
- * Bug Fixes
47
-
48
- = 1.0 =
49
- * First Realease
50
-
51
- == Rate the Plugin ==
52
- * If you liked this plugin. Please rate it
1
+ === Instagram Slider Widget ===
2
+ Contributors: jetonr
3
+ Tags: instagram, slider, widget, images
4
+ Donate link: http://goo.gl/RZiu34
5
+ Requires at least: 3.5
6
+ Tested up to: 3.8.1
7
+ License: GPLv2 or later
8
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
+
10
+ Instagram Slider Widget is a responsive slider widget that shows 20 latest images from a public instagram user.
11
+
12
+ == Description ==
13
+ Instagram Slider Widget is a responsive slider widget that shows 20 latest images from a public instagram user. The images are download into your upload folder. The widget can display images in slider and thumbnails.
14
+
15
+ == Installation ==
16
+ 1. Upload `instagram-slider-widget` to the `/wp-content/plugins/` directory
17
+ 2. Activate the plugin through the \'Plugins\' menu in WordPress
18
+ 3. Go to Appearance > Widgets and drag \'Instagram Slider Widget\' to your sidebar
19
+ 4. Update the settings in the widget: Instagram Username, Images Layout, Number of Images to show, Check for new images hours
20
+
21
+ == Screenshots ==
22
+ 1. Frontend Widget Slider
23
+ 2. Frontend Widget Thumbs
24
+ 3. Backend Configuration
25
+
26
+ == Changelog ==
27
+ = 1.0 =
28
+ First Realease
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
{views → templates}/slider.php RENAMED
@@ -1,39 +1,34 @@
1
- <script type="text/javascript">
2
- jQuery(document).ready(function($) {
3
- $('.pllexislider').pllexislider({
4
- animation: "slide",
5
- directionNav: false,
6
- });
7
- });
8
- </script>
9
- <div class="pllexislider">
10
- <ul class="no-bullet slides">
11
- <?php
12
- if ( isset($data_arr) && is_array($data_arr) ) {
13
- foreach ($data_arr as $data) {
14
- foreach ( $data as $k => $v) {
15
- $$k = $v;
16
- }
17
-
18
- if ( $link_to && ( 'user_url' == $link_to ) ) {
19
- $link = $user_url;
20
- }
21
-
22
- echo '<li>'. "\n";
23
- echo '<a target="_blank" href="'.$link.'"><img src="'.$image.'" alt="'.$text.'"></a>' . "\n";
24
- if ( $created_time ) {
25
- echo '<div class="instatime">'. human_time_diff( $created_time ) . ' ago</div>' . "\n";
26
- }
27
- echo '<div class="instadescription">' . "\n";
28
- echo '<p>by <a href="'. $user_url .'">'. $user_name .'</a></p>' . "\n";
29
- if ($text) {
30
- echo '<p>'.$text.'</p>' . "\n";
31
- }
32
- echo '</div>' . "\n";
33
- echo '</li>' . "\n";
34
-
35
- }
36
- }
37
- ?>
38
- </ul>
39
- </div>
1
+ <script type="text/javascript">
2
+ jQuery(document).ready(function($) {
3
+ $('.pllexislider').pllexislider({
4
+ animation: "slide",
5
+ directionNav: false,
6
+ });
7
+ });
8
+ </script>
9
+ <div class="pllexislider">
10
+ <ul class="no-bullet slides">
11
+ <?php
12
+ if ( isset($data_arr) && is_array($data_arr) ) {
13
+ foreach ($data_arr as $data) {
14
+ foreach ( $data as $k => $v) {
15
+ $$k = $v;
16
+ }
17
+ echo '<li>'. "\n";
18
+ echo '<a target="_blank" href="'.$link.'"><img src="'.$image.'" alt="'.$text.'"></a>' . "\n";
19
+ if ( $created_time ) {
20
+ echo '<div class="instatime">'. human_time_diff( $created_time ) . ' ago</div>' . "\n";
21
+ }
22
+ echo '<div class="instadescription">' . "\n";
23
+ echo '<p>by <a href="'. $user_url .'">'. $user_name .'</a></p>' . "\n";
24
+ if ($text) {
25
+ echo '<p>'.$text.'</p>' . "\n";
26
+ }
27
+ echo '</div>' . "\n";
28
+ echo '</li>' . "\n";
29
+
30
+ }
31
+ }
32
+ ?>
33
+ </ul>
34
+ </div>
 
 
 
 
 
{views → templates}/thumbs.php RENAMED
@@ -1,22 +1,17 @@
1
-
2
- <div class="instag">
3
- <ul class="thumbnails no-bullet">
4
- <?php
5
- if ( isset( $data_arr ) && is_array( $data_arr ) ) {
6
- foreach ( $data_arr as $data ) {
7
- foreach ( $data as $k => $v ) {
8
- $$k = $v;
9
- }
10
-
11
- if ( $link_to && 'user_url' == $link_to ) {
12
- $link = $user_url;
13
- }
14
-
15
- echo '<li>'. "\n";
16
- echo '<a target="_blank" href="'.$link.'"><img src="'.$image.'" alt="'.$text.'"></a>' . "\n";
17
- echo '</li>' . "\n";
18
- }
19
- }
20
- ?>
21
- </ul>
22
  </div>
1
+
2
+ <div class="instag">
3
+ <ul class="thumbnails no-bullet">
4
+ <?php
5
+ if ( isset($data_arr) && is_array($data_arr) ) {
6
+ foreach ($data_arr as $data) {
7
+ foreach ( $data as $k => $v) {
8
+ $$k = $v;
9
+ }
10
+ echo '<li>'. "\n";
11
+ echo '<a target="_blank" href="'.$link.'"><img src="'.$image.'" alt="'.$text.'"></a>' . "\n";
12
+ echo '</li>' . "\n";
13
+ }
14
+ }
15
+ ?>
16
+ </ul>
 
 
 
 
 
17
  </div>