Genesis Responsive Slider - Version 0.9.3

Version Description

Download this release

Release Info

Developer nathanrice
Plugin Icon 128x128 Genesis Responsive Slider
Version 0.9.3
Comparing to
See all releases

Code changes from version 0.9.2 to 0.9.3

genesis-responsive-slider.php CHANGED
@@ -6,7 +6,7 @@
6
  Author: StudioPress
7
  Author URI: http://www.studiopress.com
8
 
9
- Version: 0.9.2
10
 
11
  License: GNU General Public License v2.0 (or later)
12
  License URI: http://www.opensource.org/licenses/gpl-license.php
@@ -204,10 +204,10 @@ function genesis_responsive_slider_excerpt_more( $more ) {
204
  */
205
  class genesis_responsive_sliderWidget extends WP_Widget {
206
 
207
- function genesis_responsive_sliderWidget() {
208
  $widget_ops = array( 'classname' => 'genesis_responsive_slider', 'description' => __( 'Displays a slideshow inside a widget area', 'genesis-responsive-slider' ) );
209
  $control_ops = array( 'width' => 200, 'height' => 250, 'id_base' => 'genesisresponsiveslider-widget' );
210
- $this->WP_Widget( 'genesisresponsiveslider-widget', __( 'Genesis - Responsive Slider', 'genesis-responsive-slider' ), $widget_ops, $control_ops );
211
  }
212
 
213
  function save_settings( $settings ) {
6
  Author: StudioPress
7
  Author URI: http://www.studiopress.com
8
 
9
+ Version: 0.9.3
10
 
11
  License: GNU General Public License v2.0 (or later)
12
  License URI: http://www.opensource.org/licenses/gpl-license.php
204
  */
205
  class genesis_responsive_sliderWidget extends WP_Widget {
206
 
207
+ function __construct() {
208
  $widget_ops = array( 'classname' => 'genesis_responsive_slider', 'description' => __( 'Displays a slideshow inside a widget area', 'genesis-responsive-slider' ) );
209
  $control_ops = array( 'width' => 200, 'height' => 250, 'id_base' => 'genesisresponsiveslider-widget' );
210
+ parent::__construct( 'genesisresponsiveslider-widget', __( 'Genesis - Responsive Slider', 'genesis-responsive-slider' ), $widget_ops, $control_ops );
211
  }
212
 
213
  function save_settings( $settings ) {
genesis-responsive-slider.php.orig DELETED
@@ -1,430 +0,0 @@
1
- <?php
2
- /*
3
- Plugin Name: Genesis Responsive Slider
4
- Plugin URI: http://www.studiopress.com
5
- Description: A responsive featured slider for the Genesis Framework.
6
- Author: StudioPress
7
- Author URI: http://www.studiopress.com
8
-
9
- Version: 0.9.0
10
-
11
- License: GNU General Public License v2.0 (or later)
12
- License URI: http://www.opensource.org/licenses/gpl-license.php
13
- */
14
-
15
- /**
16
- * Props to Rafal Tomal, Nick Croft, Nathan Rice, Ron Rennick, Josh Byers and Brian Gardner for collaboratively writing this plugin.
17
- */
18
-
19
- /**
20
- * Thanks to Tyler Smith for creating the awesome jquery FlexSlider plugin - http://flex.madebymufffin.com/.
21
- */
22
-
23
- define( 'GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD', 'genesis_responsive_slider_settings' );
24
-
25
- add_action( 'after_setup_theme', 'GenesisResponsiveSliderInit', 15 );
26
- /**
27
- * Loads required files and adds image via Genesis Init Hook
28
- */
29
- function GenesisResponsiveSliderInit() {
30
-
31
- /** require Genesis */
32
- if( ! function_exists( 'genesis_get_option' ) )
33
- return;
34
-
35
- // translation support
36
- load_plugin_textdomain( 'genesis-responsive-slider', false, '/genesis-responsive-slider/languages/' );
37
-
38
- /** hook all frontend slider functions here to ensure Genesis is active **/
39
- add_action( 'wp_enqueue_scripts', 'genesis_responsive_slider_scripts' );
40
- add_action( 'wp_print_styles', 'genesis_responsive_slider_styles' );
41
- add_action( 'wp_head', 'genesis_responsive_slider_head', 1 );
42
- add_action( 'wp_footer', 'genesis_responsive_slider_flexslider_params' );
43
- add_action( 'widgets_init', 'genesis_responsive_sliderRegister' );
44
-
45
- /** Include Admin file */
46
- if ( is_admin() ) require_once( dirname( __FILE__ ) . '/admin.php' );
47
-
48
- /** Add new image size */
49
- add_image_size( 'slider', ( int ) genesis_get_responsive_slider_option( 'slideshow_width' ), ( int ) genesis_get_responsive_slider_option( 'slideshow_height' ), TRUE );
50
-
51
- }
52
-
53
- add_action( 'genesis_settings_sanitizer_init', 'genesis_responsive_slider_sanitization' );
54
- /**
55
- * Add settings to Genesis sanitization
56
- *
57
- */
58
- function genesis_responsive_slider_sanitization() {
59
- genesis_add_option_filter( 'one_zero', GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD,
60
- array(
61
- 'slideshow_arrows',
62
- 'slideshow_excerpt_show',
63
- 'slideshow_title_show',
64
- 'slideshow_loop',
65
- 'slideshow_hide_mobile',
66
- 'slideshow_pager'
67
- ) );
68
- genesis_add_option_filter( 'no_html', GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD,
69
- array(
70
- 'post_type',
71
- 'posts_term',
72
- 'exclude_terms',
73
- 'include_exclude',
74
- 'post_id',
75
- 'posts_num',
76
- 'posts_offset',
77
- 'orderby',
78
- 'slideshow_timer',
79
- 'slideshow_delay',
80
- 'slideshow_height',
81
- 'slideshow_width',
82
- 'slideshow_effect',
83
- 'slideshow_excerpt_content',
84
- 'slideshow_excerpt_content_limit',
85
- 'slideshow_more_text',
86
- 'slideshow_excerpt_width',
87
- 'location_vertical',
88
- 'location_horizontal',
89
- ) );
90
- }
91
-
92
- /**
93
- * Load the script files
94
- */
95
- function genesis_responsive_slider_scripts() {
96
-
97
- /** easySlider JavaScript code */
98
- wp_enqueue_script( 'flexslider', WP_PLUGIN_URL . '/genesis-responsive-slider/js/jquery.flexslider.js', array( 'jquery' ), '0.9.5', TRUE );
99
-
100
- }
101
-
102
- /**
103
- * Load the CSS files
104
- */
105
- function genesis_responsive_slider_styles() {
106
-
107
- /** standard slideshow styles */
108
- wp_register_style( 'slider_styles', WP_PLUGIN_URL . '/genesis-responsive-slider/style.css' );
109
- wp_enqueue_style( 'slider_styles' );
110
-
111
- }
112
-
113
- /**
114
- * Loads scripts and styles via wp_head hook.
115
- */
116
- function genesis_responsive_slider_head() {
117
-
118
- $height = ( int ) genesis_get_responsive_slider_option( 'slideshow_height' );
119
- $width = ( int ) genesis_get_responsive_slider_option( 'slideshow_width' );
120
-
121
- $slideInfoWidth = ( int ) genesis_get_responsive_slider_option( 'slideshow_excerpt_width' );
122
- $slideNavTop = ( int ) ( ($height - 60) * .5 );
123
-
124
- $vertical = genesis_get_responsive_slider_option( 'location_vertical' );
125
- $horizontal = genesis_get_responsive_slider_option( 'location_horizontal' );
126
- $display = ( genesis_get_responsive_slider_option( 'posts_num' ) >= 2 && genesis_get_responsive_slider_option( 'slideshow_arrows' ) ) ? 'top: ' . $slideNavTop . 'px' : 'display: none';
127
-
128
- $hide_mobile = genesis_get_responsive_slider_option( 'slideshow_hide_mobile' );
129
- $slideshow_pager = genesis_get_responsive_slider_option( 'slideshow_pager' );
130
-
131
- echo '
132
- <style type="text/css">
133
- .slide-excerpt { width: ' . $slideInfoWidth . '%; }
134
- .slide-excerpt { ' . $vertical . ': 0; }
135
- .slide-excerpt { '. $horizontal . ': 0; }
136
- .flexslider { max-width: ' . $width . 'px; max-height: ' . $height . 'px; }
137
- .slide-image { max-height: ' . $height . 'px; }
138
- </style>';
139
-
140
- if ( $hide_mobile == 1 ) {
141
- echo '
142
- <style type="text/css">
143
- @media only screen
144
- and (min-device-width : 320px)
145
- and (max-device-width : 480px) {
146
- .slide-excerpt { display: none !important; }
147
- }
148
- </style> ';
149
- }
150
- }
151
-
152
- /**
153
- * Outputs slider script on wp_footer hook.
154
- */
155
- function genesis_responsive_slider_flexslider_params() {
156
-
157
- $timer = ( int ) genesis_get_responsive_slider_option( 'slideshow_timer' );
158
- $duration = ( int ) genesis_get_responsive_slider_option( 'slideshow_delay' );
159
- $effect = genesis_get_responsive_slider_option( 'slideshow_effect' );
160
- $controlnav = genesis_get_responsive_slider_option( 'slideshow_pager' );
161
- $directionnav = genesis_get_responsive_slider_option( 'slideshow_arrows' );
162
-
163
- $output = 'jQuery(document).ready(function($) {
164
- $(".flexslider").flexslider({
165
- controlsContainer: "#genesis-responsive-slider",
166
- animation: "' . esc_js( $effect ) . '",
167
- directionNav: ' . $directionnav . ',
168
- controlNav: ' . $controlnav . ',
169
- animationDuration: ' . $duration . ',
170
- slideshowSpeed: ' . $timer . '
171
- });
172
- });';
173
-
174
- $output = str_replace( array( "\n", "\t", "\r" ), '', $output );
175
-
176
- echo '<script type=\'text/javascript\'>' . $output . '</script>';
177
- }
178
-
179
- /**
180
- * Registers the slider widget
181
- */
182
- function genesis_responsive_sliderRegister() {
183
- register_widget( 'genesis_responsive_sliderWidget' );
184
- }
185
-
186
- /** Creates read more link after excerpt */
187
- function genesis_responsive_slider_excerpt_more( $more ) {
188
- global $post;
189
- static $read_more = null;
190
-
191
- if ( $read_more === null )
192
- $read_more = genesis_get_responsive_slider_option( 'slideshow_more_text' );
193
-
194
- if ( !$read_more )
195
- return '';
196
-
197
- return '&hellip; <a href="'. get_permalink( $post->ID ) . '">' . __( $read_more, 'genesis-responsive-slider' ) . '</a>';
198
- }
199
-
200
- /**
201
- * Slideshow Widget Class
202
- */
203
- class genesis_responsive_sliderWidget extends WP_Widget {
204
-
205
- function genesis_responsive_sliderWidget() {
206
- $widget_ops = array( 'classname' => 'genesis_responsive_slider', 'description' => __( 'Displays a slideshow inside a widget area', 'genesis-responsive-slider' ) );
207
- $control_ops = array( 'width' => 200, 'height' => 250, 'id_base' => 'genesisresponsiveslider-widget' );
208
- $this->WP_Widget( 'genesisresponsiveslider-widget', __( 'Genesis - Responsive Slider', 'genesis-responsive-slider' ), $widget_ops, $control_ops );
209
- }
210
-
211
- function save_settings( $settings ) {
212
- $settings['_multiwidget'] = 0;
213
- update_option( $this->option_name, $settings );
214
- }
215
-
216
- // display widget
217
- function widget( $args, $instance ) {
218
- extract( $args );
219
-
220
- echo $before_widget;
221
-
222
- $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base );
223
- if ( $title )
224
- echo $before_title . $title . $after_title;
225
-
226
- $term_args = array( );
227
-
228
- if ( 'page' != genesis_get_responsive_slider_option( 'post_type' ) ) {
229
-
230
- if ( genesis_get_responsive_slider_option( 'posts_term' ) ) {
231
-
232
- $posts_term = explode( ',', genesis_get_responsive_slider_option( 'posts_term' ) );
233
-
234
- if ( 'category' == $posts_term['0'] )
235
- $posts_term['0'] = 'category_name';
236
-
237
- if ( 'post_tag' == $posts_term['0'] )
238
- $posts_term['0'] = 'tag';
239
-
240
- if ( isset( $posts_term['1'] ) )
241
- $term_args[$posts_term['0']] = $posts_term['1'];
242
-
243
- }
244
-
245
- if ( !empty( $posts_term['0'] ) ) {
246
-
247
- if ( 'category' == $posts_term['0'] )
248
- $taxonomy = 'category';
249
-
250
- elseif ( 'post_tag' == $posts_term['0'] )
251
- $taxonomy = 'post_tag';
252
-
253
- else
254
- $taxonomy = $posts_term['0'];
255
-
256
- } else {
257
-
258
- $taxonomy = 'category';
259
-
260
- }
261
-
262
- if ( genesis_get_responsive_slider_option( 'exclude_terms' ) ) {
263
-
264
- $exclude_terms = explode( ',', str_replace( ' ', '', genesis_get_responsive_slider_option( 'exclude_terms' ) ) );
265
- $term_args[$taxonomy . '__not_in'] = $exclude_terms;
266
-
267
- }
268
- }
269
-
270
- if ( genesis_get_responsive_slider_option( 'posts_offset' ) ) {
271
- $myOffset = genesis_get_responsive_slider_option( 'posts_offset' );
272
- $term_args['offset'] = $myOffset;
273
- }
274
-
275
- if ( genesis_get_responsive_slider_option( 'post_id' ) ) {
276
- $IDs = explode( ',', str_replace( ' ', '', genesis_get_responsive_slider_option( 'post_id' ) ) );
277
- if ( 'include' == genesis_get_responsive_slider_option( 'include_exclude' ) )
278
- $term_args['post__in'] = $IDs;
279
- else
280
- $term_args['post__not_in'] = $IDs;
281
- }
282
-
283
- $query_args = array_merge( $term_args, array(
284
- 'post_type' => genesis_get_responsive_slider_option( 'post_type' ),
285
- 'posts_per_page' => genesis_get_responsive_slider_option( 'posts_num' ),
286
- 'orderby' => genesis_get_responsive_slider_option( 'orderby' ),
287
- 'order' => genesis_get_responsive_slider_option( 'order' ),
288
- 'meta_key' => genesis_get_responsive_slider_option( 'meta_key' )
289
- ) );
290
-
291
- $query_args = apply_filters( 'genesis_responsive_slider_query_args', $query_args );
292
- add_filter( 'excerpt_more', 'genesis_responsive_slider_excerpt_more' );
293
-
294
- ?>
295
-
296
- <div id="genesis-responsive-slider">
297
- <div class="flexslider">
298
- <ul class="slides">
299
- <?php
300
- $slider_posts = new WP_Query( $query_args );
301
- if ( $slider_posts->have_posts() ) {
302
- $show_excerpt = genesis_get_responsive_slider_option( 'slideshow_excerpt_show' );
303
- $show_title = genesis_get_responsive_slider_option( 'slideshow_title_show' );
304
- $show_type = genesis_get_responsive_slider_option( 'slideshow_excerpt_content' );
305
- $show_limit = genesis_get_responsive_slider_option( 'slideshow_excerpt_content_limit' );
306
- $more_text = genesis_get_responsive_slider_option( 'slideshow_more_text' );
307
- }
308
- while ( $slider_posts->have_posts() ) : $slider_posts->the_post();
309
- ?>
310
- <li>
311
-
312
- <?php if ( $show_excerpt == 1 || $show_title == 1 ) { ?>
313
- <div class="slide-excerpt slide-<?php the_ID(); ?>">
314
- <div class="slide-background"></div><!-- end .slide-background -->
315
- <div class="slide-excerpt-border ">
316
- <?php
317
- if ( $show_title == 1 ) {
318
- ?>
319
- <h2><a href="<?php the_permalink() ?>" rel="bookmark"><?php the_title(); ?></a></h2>
320
- <?php
321
- }
322
- if ( $show_excerpt ) {
323
- if ( $show_type != 'full' )
324
- the_excerpt();
325
- elseif ( $show_limit )
326
- the_content_limit( (int)$show_limit, esc_html( $more_text ) );
327
- else
328
- the_content( esc_html( $more_text ) );
329
- }
330
- ?>
331
- </div><!-- end .slide-excerpt-border -->
332
- </div><!-- end .slide-excerpt -->
333
- <?php } ?>
334
-
335
- <div class="slide-image">
336
- <a href="<?php the_permalink() ?>" rel="bookmark"><img src="<?php genesis_image( "format=url&size=slider" ); ?>" /></a>
337
- </div><!-- end .slide-image -->
338
-
339
- </li>
340
- <?php endwhile; ?>
341
- </ul><!-- end ul.slides -->
342
- </div><!-- end .flexslider -->
343
- </div><!-- end #genesis-responsive-slider -->
344
-
345
- <?php
346
- echo $after_widget;
347
- wp_reset_query();
348
- remove_filter( 'excerpt_more', 'genesis_responsive_slider_excerpt_more' );
349
-
350
- }
351
-
352
- /** Widget options */
353
- function form( $instance ) {
354
- $instance = wp_parse_args( (array) $instance, array( 'title' => '') );
355
- $title = $instance['title'];
356
- ?>
357
- <p><label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'genesis-responsive-slider' ); ?> <input class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>" /></label></p>
358
- <?php
359
- echo '<p>';
360
- printf( __( 'To configure slider options, please go to the <a href="%s">Slider Settings</a> page.', 'genesis-responsive-slider' ), menu_page_url( 'genesis_responsive_slider', 0 ) );
361
- echo '</p>';
362
- }
363
-
364
- function update( $new_instance, $old_instance ) {
365
- $instance = $old_instance;
366
- $new_instance = wp_parse_args( (array) $new_instance, array( 'title' => '' ) );
367
- $instance['title'] = strip_tags( $new_instance['title'] );
368
- return $instance;
369
- }
370
-
371
- }
372
-
373
- /**
374
- * Used to exclude taxonomies and related terms from list of available terms/taxonomies in widget form().
375
- *
376
- * @since 0.9
377
- * @author Nick Croft
378
- *
379
- * @param string $taxonomy 'taxonomy' being tested
380
- * @return string
381
- */
382
- function genesis_responsive_slider_exclude_taxonomies( $taxonomy ) {
383
-
384
- $filters = array( '', 'nav_menu' );
385
- $filters = apply_filters( 'genesis_responsive_slider_exclude_taxonomies', $filters );
386
-
387
- return ( ! in_array( $taxonomy->name, $filters ) );
388
-
389
- }
390
-
391
- /**
392
- * Used to exclude post types from list of available post_types in widget form().
393
- *
394
- * @since 0.9
395
- * @author Nick Croft
396
- *
397
- * @param string $type 'post_type' being tested
398
- * @return string
399
- */
400
- function genesis_responsive_slider_exclude_post_types( $type ) {
401
-
402
- $filters = array( '', 'attachment' );
403
- $filters = apply_filters( 'genesis_responsive_slider_exclude_post_types', $filters );
404
-
405
- return ( ! in_array( $type, $filters ) );
406
-
407
- }
408
-
409
- /**
410
- * Returns Slider Option
411
- *
412
- * @param string $key key value for option
413
- * @return string
414
- */
415
- function genesis_get_responsive_slider_option( $key ) {
416
- return genesis_get_option( $key, GENESIS_RESPONSIVE_SLIDER_SETTINGS_FIELD );
417
- }
418
-
419
- /**
420
- * Echos Slider Option
421
- *
422
- * @param string $key key value for option
423
- */
424
- function genesis_responsive_slider_option( $key ) {
425
-
426
- if ( ! genesis_get_responsive_slider_option( $key ) )
427
- return false;
428
-
429
- echo genesis_get_responsive_slider_option( $key );
430
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: nathanrice, studiopress, wpmuguru
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: slider, slideshow, responsive, genesis, genesiswp, studiopress
5
  Requires at least: 3.2
6
- Tested up to: 4.0.1
7
- Stable tag: 0.9.2
8
 
9
  This plugin allows you to create a simple responsive slider that displays the featured image, along with the title and excerpt from each post.
10
 
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5553118
4
  Tags: slider, slideshow, responsive, genesis, genesiswp, studiopress
5
  Requires at least: 3.2
6
+ Tested up to: 4.2.2
7
+ Stable tag: 0.9.3
8
 
9
  This plugin allows you to create a simple responsive slider that displays the featured image, along with the title and excerpt from each post.
10