Serious Slider - Version 0.6.5

Version Description

  • Added 'shortcode' column in sliders list
  • Fixed animation hiccup on some versions of Safari
  • Fixed slider bullets alignment
  • Fixed unclosed label in widget HTML markup
  • Changed class initialization hook to 'setup_theme'
Download this release

Release Info

Developer Cryout Creations
Plugin Icon 128x128 Serious Slider
Version 0.6.5
Comparing to
See all releases

Code changes from version 0.6.4 to 0.6.5

cryout-serious-slider.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Cryout Serious Slider
4
  Plugin URI: http://www.cryoutcreations.eu/serious-slider
5
  Description: Responsive slider, built on Bootstrap Carousel, uses core WordPress functionality, easy to use, seriously.
6
- Version: 0.6.4
7
  Author: Cryout Creations
8
  Author URI: http://www.cryoutcreations.eu
9
  Text Domain: cryout-serious-slider
@@ -12,12 +12,12 @@
12
  */
13
 
14
  class Cryout_Serious_Slider {
15
-
16
- public $version = "0.6.4";
17
  public $options = array();
18
  public $shortcode_tag = 'serious-slider';
19
  public $mce_tag = 'serious_slider';
20
-
21
  public $slug = 'cryout-serious-slider';
22
  public $posttype = 'cryout_serious_slide'; // 20 chars!
23
  public $taxonomy = 'cryout_serious_slider_category';
@@ -42,40 +42,43 @@ class Cryout_Serious_Slider {
42
  public function __construct(){
43
  require_once( plugin_dir_path( __FILE__ ) . 'inc/shortcodes.php' );
44
  require_once( plugin_dir_path( __FILE__ ) . 'inc/widgets.php' );
45
- add_action( 'init', array( $this, 'register' ) );
46
  add_action( 'init', array( $this, 'register_post_types' ) );
47
- add_action( 'init', array( $this, 'register_taxonomies' ), 0 );
48
- add_action( 'setup_theme', array( $this, 'register_taxonomies' ), 0 );
49
  } // __construct()
50
 
51
-
52
  /**********************
53
  * main class registration function
54
  ***********************/
55
  public function register(){
56
-
57
  $this->title = __( 'Serious Slider', 'cryout-serious-slider' );
58
  $this->aboutpage = 'edit.php?post_type=' . $this->posttype . '&page=' . $this->slug . '-about';
59
  $this->addnewpage = 'post-new.php?post_type=' . $this->posttype;
60
-
61
- //$this->options = $this->get_settings();
62
-
63
  if (! is_admin() ) {
64
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
65
- add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
66
  } // if (! is_admin())
67
-
68
  if (is_admin() ) {
69
 
70
  //add_action( 'admin_init', array( $this, 'register_settings' ) );
71
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'actions_links' ), -10 );
72
  add_filter( 'plugin_row_meta', array( $this, 'meta_links' ), 10, 2 );
73
  add_action( 'admin_menu', array( $this, 'settings_menu' ) );
74
-
75
  // slides list page columns customizations
76
  add_filter( 'manage_edit-'.$this->posttype.'_columns', array($this, 'columns_edit' ) );
77
  add_action( 'manage_'.$this->posttype.'_posts_custom_column', array($this, 'columns_content'), 10, 2 );
78
  add_filter( 'manage_edit-'.$this->posttype.'_sortable_columns', array($this, 'order_column_register_sortable') );
 
 
 
79
  //add_action( 'admin_head-edit.php', array($this, 'custom_list_css') );
80
  //add_action( 'admin_head-edit-tags.php', array($this, 'custom_list_css') );
81
  //add_action( 'admin_head-post-new.php', array($this, 'custom_list_css') );
@@ -85,7 +88,7 @@ class Cryout_Serious_Slider {
85
  // shortcode button
86
  add_action( 'admin_head', array( $this, 'admin_head') );
87
  add_action( 'admin_enqueue_scripts', array($this , 'admin_enqueue_scripts' ) );
88
-
89
  $localized_mce_strings = array(
90
  'text_retrieving_sliders' => __('Retrieving sliders...', 'cryout-serious-slider'),
91
  'text_retrieving_sliders_error' => __('Error retrieving sliders', 'cryout-serious-slider'),
@@ -96,31 +99,31 @@ class Cryout_Serious_Slider {
96
  'text_select_slider' => __('Select Slider', 'cryout-serious-slider'),
97
  'text_add_slider' => __('Add Slider', 'cryout-serious-slider'),
98
  );
99
-
100
  // ajax handling for slider parameters in shortcode button generator
101
  wp_enqueue_script( 'cryout-serious-slider-ajax', plugins_url( 'resources/backend.js', __FILE__ ), NULL, $this->version );
102
  wp_localize_script( 'cryout-serious-slider-ajax', 'cryout_serious_slider_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
103
  wp_localize_script( 'cryout-serious-slider-ajax', 'CRYOUT_MCE_LOCALIZED', $localized_mce_strings );
104
  add_action( 'wp_ajax_cryout_serious_slider_ajax', array( $this, 'get_sliders_json' ) ); // auth users
105
  add_action( 'wp_ajax_nopriv_cryout_serious_slider_ajax', array( $this, 'get_sliders_json' ) ); // no auth users
106
-
107
  //add_action( 'admin_notices', array( $this, 'admin_notice' ) );
108
-
109
  } // if (is_admin())
110
-
111
  add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
112
-
113
  } // register()
114
-
115
 
116
  /**********************
117
  * translation domain
118
  ***********************/
119
  function load_textdomain() {
120
- load_plugin_textdomain( 'cryout-serious-slider', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
121
  }
122
 
123
-
124
  /**********************
125
  * enqueues
126
  ***********************/
@@ -128,15 +131,15 @@ class Cryout_Serious_Slider {
128
  wp_enqueue_script( 'cryout-serious-slider-jquerymobile', plugins_url( 'resources/jquery.mobile.custom.min.js', __FILE__ ), array('jquery'), $this->version );
129
  wp_enqueue_script( 'cryout-serious-slider-script', plugins_url( 'resources/slider.js', __FILE__ ), NULL, $this->version );
130
  } // enqueue_scripts()
131
-
132
  public function enqueue_styles() {
133
  wp_register_style( 'cryout-serious-slider-style', plugins_url( 'resources/style.css', __FILE__ ), NULL, $this->version );
134
- wp_enqueue_style( 'cryout-serious-slider-style' );
135
  } // enqueue_styles()
136
-
137
  /**********************
138
  * notification
139
- ***********************/
140
  /*public static function admin_notice() {
141
  ?>
142
  <div class="notice notice-success is-dismissible">
@@ -144,30 +147,30 @@ class Cryout_Serious_Slider {
144
  </div>
145
  <?php
146
  } // admin_notice_on_activation()
147
-
148
  public static function admin_notice_on_activation() {
149
  add_action('init', array('Cryout_Serious_Slider', 'admin_notice') );
150
  }*/
151
-
152
  /**********************
153
  * settings
154
  ***********************/
155
  /* // register plugin settings
156
  public function register_settings() {
157
- register_setting( 'cryout_serious_slider_group', 'cryout_serious_slider' );
158
  } // register_settings()*/
159
-
160
  // register settings page to dashboard menu
161
  public function settings_menu() {
162
- $this->thepage = add_submenu_page( 'edit.php?post_type='.$this->posttype, __('About', 'cryout-serious-slider'), __('About', 'cryout-serious-slider'), 'manage_options', $this->slug . '-about', array( $this, 'settings_page' ) );
163
  } // settings_menu()
164
-
165
  public function settings_page() {
166
- if (!empty($_GET['add_sample_content']))
167
  include_once( plugin_dir_path( __FILE__ ) . 'demo/demo-content.php' );
168
  require_once( plugin_dir_path( __FILE__ ) . 'inc/settings.php' );
169
  } // settings_page()
170
-
171
  // add plugin actions links
172
  public function actions_links( $links ) {
173
  array_unshift( $links, '<a href="' . $this->aboutpage . '">' . __( 'About Plugin', 'cryout-serious-slider' ) . '</a>' );
@@ -185,7 +188,7 @@ class Cryout_Serious_Slider {
185
  }
186
  return $links;
187
  }
188
-
189
  /* settings handlers */
190
  /* public function get_settings() {
191
  $options = get_option('cryout_serious_slider');
@@ -193,11 +196,11 @@ class Cryout_Serious_Slider {
193
  $this->options = $options;
194
  return $options;
195
  } // get_settings()
196
-
197
  public function save_settings() {
198
  if ( isset( $_POST['settings_submit'] ) && check_admin_referer( 'cryout_serious_slider', '_wpnonce' ) ):
199
  $saved_options = $_POST['cryout_serious_slider'];
200
-
201
  foreach ($saved_options as $option => $value):
202
  $saved_options[$option] = wp_kses_data($value);
203
  endforeach;
@@ -206,12 +209,12 @@ class Cryout_Serious_Slider {
206
  wp_redirect( 'edit.php?post_type='.$this->posttype.'&page='.$this->slug.'-settings'.'&updated=true' );
207
  endif;
208
  } // save_settings() */
209
-
210
-
211
  /**********************
212
  * helpers
213
  ***********************/
214
-
215
  /* return taxonomy id for slide id */
216
  public function get_slide_slider( $slide_ID, $taxonomy = '') {
217
  if (empty($taxonomy)) $taxonomy = $this->taxonomy;
@@ -221,38 +224,38 @@ class Cryout_Serious_Slider {
221
  else
222
  return 0;
223
  } // get_slide_slider()
224
-
225
  /* return sliders list for mce insert window */
226
  public function get_sliders_json() {
227
  $sliders = $this->get_sliders();
228
  echo json_encode($sliders);
229
  wp_die();
230
  } // get_sliders_json()
231
-
232
  public function get_sliders() {
233
  $data = get_terms( $this->taxonomy, array( 'hide_empty' => false ) );
234
-
235
  $sliders = array();
236
  foreach ($data as $slider) {
237
  $sliders[] = array('text'=>$slider->name, 'value'=>$slider->term_id);
238
  }
239
-
240
  if (count($sliders)<1) $sliders = array( array('text' => __('No sliders available. Create a slider first...', 'cryout-serious-slider'), 'value' => 0) );
241
-
242
  return $sliders;
243
  } // get_sliders()
244
-
245
- // theme compatibility function
246
  public function get_sliders_list() {
247
  $data = get_terms( $this->taxonomy, array( 'hide_empty' => false ) );
248
-
249
  $sliders = array();
250
  foreach ($data as $slider) {
251
  if (!empty($slider->term_id)) $sliders[$slider->term_id] = $slider->name;
252
  }
253
  return $sliders;
254
  } // get_sliders_list()
255
-
256
  /* customize taxonomy selection box in add slide window */
257
  function custom_category_picker( $post, $box ) {
258
  $defaults = array( 'taxonomy' => 'category' );
@@ -270,7 +273,7 @@ class Cryout_Serious_Slider {
270
  $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
271
  ?>
272
  <ul id="<?php echo $tax_name; ?>_selector" data-wp-lists="list:<?php echo $tax_name; ?>" class="form-no-clear">
273
- <?php
274
  $cat_dropdown_args = array(
275
  'taxonomy' => $tax_name,
276
  'hide_empty' => 0,
@@ -281,7 +284,7 @@ class Cryout_Serious_Slider {
281
  'show_option_none' => '&mdash; ' . __('Select slider', 'cryout-serious-slider') . ' &mdash;',
282
  );
283
 
284
- wp_dropdown_categories( $cat_dropdown_args );
285
  ?>
286
  </ul>
287
  <a class="taxonomy-add-new" href="edit-tags.php?taxonomy=<?php echo $this->taxonomy ?>&post_type=<?php echo $this->posttype; ?>" id=""><?php _e(
@@ -289,8 +292,8 @@ class Cryout_Serious_Slider {
289
  </div>
290
  <?php
291
  } // slide_custom_category()
292
-
293
-
294
  /**********************
295
  * custom post types
296
  ***********************/
@@ -301,12 +304,13 @@ class Cryout_Serious_Slider {
301
  'public' => false,
302
  'show_ui' => true,
303
  'show_admin_column' => true,
 
304
  'query_var' => true,
305
  'description' => __( 'Description.', 'cryout-serious-slider' ),
306
  'show_in_nav_menus' => false,
307
  'menu_position' => 21,
308
  'menu_icon' => plugins_url('/resources/images/serious-slider-icon.png',__FILE__),
309
- 'capability_type' => 'post',
310
  'supports' => array(
311
  'title',
312
  'editor',
@@ -314,11 +318,11 @@ class Cryout_Serious_Slider {
314
  'thumbnail',
315
  'page-attributes',
316
  ),
317
- 'labels' => array(
318
  'name' => _x( 'Slides', 'post type general name', 'cryout-serious-slider' ),
319
  'singular_name' => _x( 'Slide', 'post type singular name', 'cryout-serious-slider' ),
320
  'menu_name' => _x( 'Serious Slider', 'admin menu', 'cryout-serious-slider' ),
321
- 'name_admin_bar' => _x( 'Slide', 'add new on admin bar', 'cryout-serious-slider' ),
322
  'add_new' => _x( 'Add New Slide', 'and new in menu', 'cryout-serious-slider' ),
323
  'add_new_item' => __( 'Add New Slide', 'cryout-serious-slider' ),
324
  'new_item' => __( 'New Slide', 'cryout-serious-slider' ),
@@ -330,17 +334,17 @@ class Cryout_Serious_Slider {
330
  'not_found' => sprintf( __( 'No slides found. Go ahead and add <a href="%1$s">add some</a> or <a href="%2$s">load sample content</a>.', 'cryout-serious-slider' ), $this->addnewpage, $this->aboutpage ),
331
  'not_found_in_trash' => __( 'No slides found in Trash.', 'cryout-serious-slider' )
332
  ),
333
- 'taxonomies' => array(
334
  $this->taxonomy,
335
  ),
336
- 'register_meta_box_cb' => array( $this, 'metabox_register' ),
337
  );
338
 
339
  /* Register the post type. */
340
  register_post_type( $this->posttype, $args );
341
-
342
  } // register_post_types()
343
-
344
  /* Set up custom taxonomies for the custom post type */
345
  public function register_taxonomies() {
346
 
@@ -363,7 +367,7 @@ class Cryout_Serious_Slider {
363
  'show_ui' => true,
364
  'show_admin_column' => true,
365
  'query_var' => true,
366
-
367
  'meta_box_cb' => array( $this, 'custom_category_picker' ), // customize taxonomy box selector
368
  );
369
 
@@ -371,14 +375,14 @@ class Cryout_Serious_Slider {
371
  add_action( $this->taxonomy . '_add_form_fields', array($this, 'metatax_main_add'), 10, 2 );
372
  add_action( $this->taxonomy . '_edit_form_fields', array($this, 'metatax_main_edit'), 10, 2 );
373
  add_action( $this->taxonomy . '_edit_form', array($this, 'right_column'), 10, 2 ); // _pre_edit_form // _edit_form
374
-
375
- add_action( 'edited_' . $this->taxonomy, array($this, 'save_taxonomy_custom_meta'), 10, 2 );
376
  add_action( 'create_' . $this->taxonomy, array($this, 'save_taxonomy_custom_meta'), 10, 2 );
377
  add_action( 'delete_' . $this->taxonomy, array($this, 'delete_taxonomy_custom_meta'), 10, 2 );
378
 
379
  } // register_taxonomies()
380
-
381
-
382
  /**********************
383
  * dashboard layout customization
384
  ***********************/
@@ -394,14 +398,14 @@ class Cryout_Serious_Slider {
394
  );
395
  return $columns;
396
  } // columns_edit()
397
-
398
  // Show the featured image & taxonomy in posts list
399
  public function columns_content($column_name, $post_ID) {
400
  global $post;
401
-
402
  switch ($column_name) {
403
- case 'featured_image':
404
-
405
  $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_ID ), 'medium' );
406
  $featured_image = $featured_image[0];
407
  if ($featured_image) {
@@ -409,11 +413,11 @@ class Cryout_Serious_Slider {
409
  } else {
410
  _e('No featured image set.', 'cryout-serious-slider');
411
  }
412
-
413
  break;
414
-
415
- case $this->taxonomy:
416
-
417
  $terms = get_the_terms( $post->ID, $this->taxonomy );
418
  if ( !empty( $terms ) ) {
419
 
@@ -425,47 +429,65 @@ class Cryout_Serious_Slider {
425
  esc_url( add_query_arg( array( 'action' => 'edit', 'taxonomy' => $this->taxonomy, 'tag_ID' => $term->term_id, 'post_type' => $post->post_type ), 'edit-tags.php' ) ),
426
  __('Edit slider', 'cryout-serious-slider')
427
  );
428
-
429
  }
430
  echo join( ', ', $out );
431
-
432
  }
433
 
434
  else {
435
  _e( 'No Slider', 'cryout-serious-slider' );
436
  }
437
-
438
  break;
439
-
440
  case 'menu_order':
441
-
442
  $order = $post->menu_order;
443
  echo $order;
444
-
445
  break;
446
  }
447
  } // columns_content()
448
-
449
  /* Add sort by columns support */
450
  public function order_column_register_sortable($columns){
451
  $columns['menu_order'] = 'menu_order';
452
  $columns[$this->taxonomy] = $this->taxonomy;
453
  return $columns;
454
  } // order_column_register_sortable()
455
-
456
- /*
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
457
  public function custom_list_css() {
458
-
459
  } // custom_list_css() */
460
-
461
  function add_taxonomy_filters() {
462
  global $typenow;
463
-
464
  $taxonomies = array( $this->taxonomy );
465
-
466
  // must set this to the post type you want the filter(s) displayed on
467
  if( $typenow == $this->posttype ){
468
-
469
  foreach ($taxonomies as $tax_slug) {
470
  $tax_obj = get_taxonomy($tax_slug);
471
  $tax_name = $tax_obj->labels->name;
@@ -474,27 +496,27 @@ class Cryout_Serious_Slider {
474
  if(count($terms) > 0) {
475
  echo "<select name='$tax_slug' id='filter_$tax_slug' class='postform'>";
476
  printf( "<option value=''>%s</option>", sprintf( _x('Select %s', 'select terms', 'cryout-serious-slider'), $tax_name ) );
477
- foreach ($terms as $term) {
478
- echo '<option value='. $term->slug, $filtered_tax == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>';
479
  }
480
  echo "</select>";
481
  }
482
  }
483
  }
484
  } // add_taxonomy_filters()
485
-
486
  // add right column content (with shortcode hint) on edit slider page */
487
  function right_column( $tag, $taxonomy ) {
488
  $term_ID = $tag->term_id;
489
  include_once( plugin_dir_path( __FILE__ ) . 'inc/right-column.php' );
490
  } // right_column()
491
-
492
  /*public function custom_js() {
493
  global $post_type;
494
  //
495
  } // custom_js()*/
496
-
497
-
498
  /**********************
499
  * slide meta
500
  ***********************/
@@ -502,16 +524,16 @@ class Cryout_Serious_Slider {
502
  function metabox_register() {
503
  add_meta_box('serious_slider_metaboxes', __( 'Slide Link', 'cryout-serious-slider' ), array($this, 'metabox_main'), $this->posttype, 'normal', 'high');
504
  } // metabox_register()
505
-
506
  function metabox_main() {
507
-
508
  global $post;
509
  $values = get_post_custom( $post->ID );
510
  $text = isset( $values['cryout_serious_slider_link'] ) ? $values['cryout_serious_slider_link'][0] : '';
511
  $check = isset( $values['cryout_serious_slider_target'] ) ? esc_attr( $values['cryout_serious_slider_target'][0] ) : '';
512
-
513
  wp_nonce_field( 'cryout_serious_slider_meta_nonce', 'cryout_serious_slider_meta_nonce' ); ?>
514
-
515
  <p>
516
  <label for="cryout_serious_slider_link"><?php _e('Link URL', 'cryout-serious-slider') ?></label>
517
  <input type="text" size="40" name="cryout_serious_slider_link" id="cryout_serious_slider_link" value="<?php echo $text; ?>" />
@@ -519,37 +541,37 @@ class Cryout_Serious_Slider {
519
  <input type="checkbox" id="cryout_serious_slider_target" name="cryout_serious_slider_target" <?php checked( $check ); ?> />
520
  <label for="cryout_serious_slider_target"><?php _e('Open In New Window', 'cryout-serious-slider') ?></label>
521
  <br><em><?php _e('Leave empty to disable link.', 'cryout-serious-slider') ?></em></p>
522
- <?php
523
-
524
  } // metabox_main()
525
-
526
  function metabox_save( $post_id ) {
527
 
528
  if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
529
  if( !isset( $_POST['cryout_serious_slider_meta_nonce'] ) || !wp_verify_nonce( $_POST['cryout_serious_slider_meta_nonce'], 'cryout_serious_slider_meta_nonce' ) ) return;
530
  if( !current_user_can( 'edit_post' ) ) return;
531
  $allowed = '';
532
-
533
  if( isset( $_POST['cryout_serious_slider_link'] ) )
534
  update_post_meta( $post_id, 'cryout_serious_slider_link', esc_url_raw( $_POST['cryout_serious_slider_link'], $allowed ) );
535
  $chk = isset( $_POST['cryout_serious_slider_target'] );
536
  update_post_meta( $post_id, 'cryout_serious_slider_target', $chk );
537
-
538
  } // metabox_save()
539
-
540
-
541
  /**********************
542
  * slider/taxonomy meta
543
  ***********************/
544
  public function metatax_main_add() {
545
-
546
  $the_meta = $this->defaults;
547
  require_once( plugin_dir_path( __FILE__ ) . 'inc/taxmeta.php' );
548
-
549
  } // metabox_main_add()
550
-
551
  public function metatax_main_edit($term) {
552
-
553
  $tid = $term->term_id;
554
  $the_meta = get_option( "cryout_serious_slider_${tid}_meta" );
555
  if ( empty($the_meta) ) $the_meta = $this->defaults; ?>
@@ -557,29 +579,29 @@ class Cryout_Serious_Slider {
557
  <td colspan="2">
558
  <?php require_once( plugin_dir_path( __FILE__ ) . 'inc/taxmeta.php' );?>
559
  </td>
560
- </tr><?php
561
-
562
  } // metatax_main_edit()
563
-
564
  function save_taxonomy_custom_meta( $tid ) {
565
  if ( isset( $_POST['term_meta'] ) ) {
566
  $term_meta = get_option( "cryout_serious_slider_${tid}_meta" );
567
  $cat_keys = array_keys( $_POST['term_meta'] );
568
  foreach ( $cat_keys as $key ) {
569
  if ( isset ( $_POST['term_meta'][$key] ) ) {
570
- $term_meta[$key] = sanitize_text_field($_POST['term_meta'][$key]);
571
  }
572
  }
573
  // Save the option array.
574
  update_option( "cryout_serious_slider_${tid}_meta", $term_meta );
575
  }
576
  } // save_taxonomy_custom_meta()
577
-
578
  function delete_taxonomy_custom_meta( $term_id ) {
579
  delete_option( "cryout_serious_slider_${term_id}_meta" );
580
  } // delete_taxonomy_custom_meta()
581
 
582
-
583
  /**********************
584
  * mce extension
585
  ***********************/
@@ -587,13 +609,13 @@ class Cryout_Serious_Slider {
587
  global $post_type;
588
  global $pagenow;
589
 
590
- // don't allow slider shortcode inside slide posts
591
  if( $this->posttype != $post_type && in_array( $pagenow, array( 'edit.php', 'post-new.php', 'post.php' ) ) ) {
592
  // check user permissions
593
  if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
594
  return;
595
  }
596
-
597
  // check if WYSIWYG is enabled
598
  if ( 'true' == get_user_option( 'rich_editing' ) ) {
599
  add_filter( 'mce_external_plugins', array( $this ,'register_mce_external_plugins' ) );
@@ -601,7 +623,7 @@ class Cryout_Serious_Slider {
601
  }
602
  }
603
  } // admin_head()
604
-
605
  function register_mce_external_plugins( $plugin_array ) {
606
  $plugin_array[$this->mce_tag] = plugins_url( 'resources/mce-button.js' , __FILE__ );
607
  return $plugin_array;
@@ -614,7 +636,7 @@ class Cryout_Serious_Slider {
614
 
615
  function admin_enqueue_scripts($hook){
616
  global $post_type;
617
- global $pagenow;
618
  if ( in_array( $pagenow, array( 'edit.php', 'post-new.php', 'post.php' ) ) ) {
619
  wp_enqueue_style('serious-slider-shortcode', plugins_url( 'resources/mce-button.css' , __FILE__ ) );
620
  };
@@ -622,13 +644,13 @@ class Cryout_Serious_Slider {
622
  wp_enqueue_style('serious-slider-admincss', plugins_url( 'resources/backend.css' , __FILE__ ) );
623
  };
624
  } // admin_enqueue_scripts()
625
-
626
-
627
  /**********************
628
  * form helpers
629
  ***********************/
630
  function inputfield( $id, $current, $title='', $desc='', $class='', $extra='', $extra2='' ) {
631
- /* wordpress/wp-admin/js/tags.js empties all text input elements with
632
  $('input[type="text"]:visible, textarea:visible', form).val('');
633
  as of 4.4.2; using type="number" as workaround */
634
  ?>
@@ -636,7 +658,7 @@ class Cryout_Serious_Slider {
636
  <td><input id="<?php echo $id ?>" name="<?php echo $id ?>" class="<?php echo $class ?>" type="number" value="<?php echo $current ?>" <?php echo $extra2 ?>> <?php echo $extra ?>
637
  <p class="description"><?php echo $desc ?></p>
638
  </td>
639
- </tr>
640
  <?php
641
  } // inputfield()
642
  function selectfield( $id, $options=array(), $current, $title='', $desc='', $class='', $extra='' ) {
@@ -650,12 +672,12 @@ class Cryout_Serious_Slider {
650
  <p class="description"><?php echo $desc ?></p>
651
  </td>
652
  </tr>
653
- <?php
654
  } // selectfield()
655
-
656
  } // class Cryout_Serious_Slider
657
 
658
  /* * * * get things going * * * */
659
  $cryout_serious_slider = new Cryout_Serious_Slider;
660
 
661
- // EOF
3
  Plugin Name: Cryout Serious Slider
4
  Plugin URI: http://www.cryoutcreations.eu/serious-slider
5
  Description: Responsive slider, built on Bootstrap Carousel, uses core WordPress functionality, easy to use, seriously.
6
+ Version: 0.6.5
7
  Author: Cryout Creations
8
  Author URI: http://www.cryoutcreations.eu
9
  Text Domain: cryout-serious-slider
12
  */
13
 
14
  class Cryout_Serious_Slider {
15
+
16
+ public $version = "0.6.5";
17
  public $options = array();
18
  public $shortcode_tag = 'serious-slider';
19
  public $mce_tag = 'serious_slider';
20
+
21
  public $slug = 'cryout-serious-slider';
22
  public $posttype = 'cryout_serious_slide'; // 20 chars!
23
  public $taxonomy = 'cryout_serious_slider_category';
42
  public function __construct(){
43
  require_once( plugin_dir_path( __FILE__ ) . 'inc/shortcodes.php' );
44
  require_once( plugin_dir_path( __FILE__ ) . 'inc/widgets.php' );
45
+ add_action( 'init', array( $this, 'register' ) );
46
  add_action( 'init', array( $this, 'register_post_types' ) );
47
+ //add_action( 'init', array( $this, 'register_taxonomies' ), 0 );
48
+ add_action( 'setup_theme', array( $this, 'register_taxonomies' ) );
49
  } // __construct()
50
 
51
+
52
  /**********************
53
  * main class registration function
54
  ***********************/
55
  public function register(){
56
+
57
  $this->title = __( 'Serious Slider', 'cryout-serious-slider' );
58
  $this->aboutpage = 'edit.php?post_type=' . $this->posttype . '&page=' . $this->slug . '-about';
59
  $this->addnewpage = 'post-new.php?post_type=' . $this->posttype;
60
+
61
+ //$this->options = $this->get_settings();
62
+
63
  if (! is_admin() ) {
64
  add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_styles' ) );
65
+ add_action( 'wp_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
66
  } // if (! is_admin())
67
+
68
  if (is_admin() ) {
69
 
70
  //add_action( 'admin_init', array( $this, 'register_settings' ) );
71
  add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $this, 'actions_links' ), -10 );
72
  add_filter( 'plugin_row_meta', array( $this, 'meta_links' ), 10, 2 );
73
  add_action( 'admin_menu', array( $this, 'settings_menu' ) );
74
+
75
  // slides list page columns customizations
76
  add_filter( 'manage_edit-'.$this->posttype.'_columns', array($this, 'columns_edit' ) );
77
  add_action( 'manage_'.$this->posttype.'_posts_custom_column', array($this, 'columns_content'), 10, 2 );
78
  add_filter( 'manage_edit-'.$this->posttype.'_sortable_columns', array($this, 'order_column_register_sortable') );
79
+ // taxonomy list columns customizations
80
+ add_filter( 'manage_edit-'.$this->taxonomy.'_columns', array($this, 'columns_edit_taxonomy' ) );
81
+ add_action( 'manage_'.$this->taxonomy.'_custom_column', array($this, 'custom_content_taxonomy' ), 10, 3);
82
  //add_action( 'admin_head-edit.php', array($this, 'custom_list_css') );
83
  //add_action( 'admin_head-edit-tags.php', array($this, 'custom_list_css') );
84
  //add_action( 'admin_head-post-new.php', array($this, 'custom_list_css') );
88
  // shortcode button
89
  add_action( 'admin_head', array( $this, 'admin_head') );
90
  add_action( 'admin_enqueue_scripts', array($this , 'admin_enqueue_scripts' ) );
91
+
92
  $localized_mce_strings = array(
93
  'text_retrieving_sliders' => __('Retrieving sliders...', 'cryout-serious-slider'),
94
  'text_retrieving_sliders_error' => __('Error retrieving sliders', 'cryout-serious-slider'),
99
  'text_select_slider' => __('Select Slider', 'cryout-serious-slider'),
100
  'text_add_slider' => __('Add Slider', 'cryout-serious-slider'),
101
  );
102
+
103
  // ajax handling for slider parameters in shortcode button generator
104
  wp_enqueue_script( 'cryout-serious-slider-ajax', plugins_url( 'resources/backend.js', __FILE__ ), NULL, $this->version );
105
  wp_localize_script( 'cryout-serious-slider-ajax', 'cryout_serious_slider_ajax', array( 'ajaxurl' => admin_url( 'admin-ajax.php' ) ) );
106
  wp_localize_script( 'cryout-serious-slider-ajax', 'CRYOUT_MCE_LOCALIZED', $localized_mce_strings );
107
  add_action( 'wp_ajax_cryout_serious_slider_ajax', array( $this, 'get_sliders_json' ) ); // auth users
108
  add_action( 'wp_ajax_nopriv_cryout_serious_slider_ajax', array( $this, 'get_sliders_json' ) ); // no auth users
109
+
110
  //add_action( 'admin_notices', array( $this, 'admin_notice' ) );
111
+
112
  } // if (is_admin())
113
+
114
  add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
115
+
116
  } // register()
117
+
118
 
119
  /**********************
120
  * translation domain
121
  ***********************/
122
  function load_textdomain() {
123
+ load_plugin_textdomain( 'cryout-serious-slider', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
124
  }
125
 
126
+
127
  /**********************
128
  * enqueues
129
  ***********************/
131
  wp_enqueue_script( 'cryout-serious-slider-jquerymobile', plugins_url( 'resources/jquery.mobile.custom.min.js', __FILE__ ), array('jquery'), $this->version );
132
  wp_enqueue_script( 'cryout-serious-slider-script', plugins_url( 'resources/slider.js', __FILE__ ), NULL, $this->version );
133
  } // enqueue_scripts()
134
+
135
  public function enqueue_styles() {
136
  wp_register_style( 'cryout-serious-slider-style', plugins_url( 'resources/style.css', __FILE__ ), NULL, $this->version );
137
+ wp_enqueue_style( 'cryout-serious-slider-style' );
138
  } // enqueue_styles()
139
+
140
  /**********************
141
  * notification
142
+ ***********************/
143
  /*public static function admin_notice() {
144
  ?>
145
  <div class="notice notice-success is-dismissible">
147
  </div>
148
  <?php
149
  } // admin_notice_on_activation()
150
+
151
  public static function admin_notice_on_activation() {
152
  add_action('init', array('Cryout_Serious_Slider', 'admin_notice') );
153
  }*/
154
+
155
  /**********************
156
  * settings
157
  ***********************/
158
  /* // register plugin settings
159
  public function register_settings() {
160
+ register_setting( 'cryout_serious_slider_group', 'cryout_serious_slider' );
161
  } // register_settings()*/
162
+
163
  // register settings page to dashboard menu
164
  public function settings_menu() {
165
+ $this->thepage = add_submenu_page( 'edit.php?post_type='.$this->posttype, __('About', 'cryout-serious-slider'), __('About', 'cryout-serious-slider'), 'edit_others_posts', $this->slug . '-about', array( $this, 'settings_page' ) );
166
  } // settings_menu()
167
+
168
  public function settings_page() {
169
+ if (!empty($_GET['add_sample_content'])&&current_user_can('edit_others_posts'))
170
  include_once( plugin_dir_path( __FILE__ ) . 'demo/demo-content.php' );
171
  require_once( plugin_dir_path( __FILE__ ) . 'inc/settings.php' );
172
  } // settings_page()
173
+
174
  // add plugin actions links
175
  public function actions_links( $links ) {
176
  array_unshift( $links, '<a href="' . $this->aboutpage . '">' . __( 'About Plugin', 'cryout-serious-slider' ) . '</a>' );
188
  }
189
  return $links;
190
  }
191
+
192
  /* settings handlers */
193
  /* public function get_settings() {
194
  $options = get_option('cryout_serious_slider');
196
  $this->options = $options;
197
  return $options;
198
  } // get_settings()
199
+
200
  public function save_settings() {
201
  if ( isset( $_POST['settings_submit'] ) && check_admin_referer( 'cryout_serious_slider', '_wpnonce' ) ):
202
  $saved_options = $_POST['cryout_serious_slider'];
203
+
204
  foreach ($saved_options as $option => $value):
205
  $saved_options[$option] = wp_kses_data($value);
206
  endforeach;
209
  wp_redirect( 'edit.php?post_type='.$this->posttype.'&page='.$this->slug.'-settings'.'&updated=true' );
210
  endif;
211
  } // save_settings() */
212
+
213
+
214
  /**********************
215
  * helpers
216
  ***********************/
217
+
218
  /* return taxonomy id for slide id */
219
  public function get_slide_slider( $slide_ID, $taxonomy = '') {
220
  if (empty($taxonomy)) $taxonomy = $this->taxonomy;
224
  else
225
  return 0;
226
  } // get_slide_slider()
227
+
228
  /* return sliders list for mce insert window */
229
  public function get_sliders_json() {
230
  $sliders = $this->get_sliders();
231
  echo json_encode($sliders);
232
  wp_die();
233
  } // get_sliders_json()
234
+
235
  public function get_sliders() {
236
  $data = get_terms( $this->taxonomy, array( 'hide_empty' => false ) );
237
+
238
  $sliders = array();
239
  foreach ($data as $slider) {
240
  $sliders[] = array('text'=>$slider->name, 'value'=>$slider->term_id);
241
  }
242
+
243
  if (count($sliders)<1) $sliders = array( array('text' => __('No sliders available. Create a slider first...', 'cryout-serious-slider'), 'value' => 0) );
244
+
245
  return $sliders;
246
  } // get_sliders()
247
+
248
+ /* theme compatibility function */
249
  public function get_sliders_list() {
250
  $data = get_terms( $this->taxonomy, array( 'hide_empty' => false ) );
251
+
252
  $sliders = array();
253
  foreach ($data as $slider) {
254
  if (!empty($slider->term_id)) $sliders[$slider->term_id] = $slider->name;
255
  }
256
  return $sliders;
257
  } // get_sliders_list()
258
+
259
  /* customize taxonomy selection box in add slide window */
260
  function custom_category_picker( $post, $box ) {
261
  $defaults = array( 'taxonomy' => 'category' );
273
  $name = ( $tax_name == 'category' ) ? 'post_category' : 'tax_input[' . $tax_name . ']';
274
  ?>
275
  <ul id="<?php echo $tax_name; ?>_selector" data-wp-lists="list:<?php echo $tax_name; ?>" class="form-no-clear">
276
+ <?php
277
  $cat_dropdown_args = array(
278
  'taxonomy' => $tax_name,
279
  'hide_empty' => 0,
284
  'show_option_none' => '&mdash; ' . __('Select slider', 'cryout-serious-slider') . ' &mdash;',
285
  );
286
 
287
+ wp_dropdown_categories( $cat_dropdown_args );
288
  ?>
289
  </ul>
290
  <a class="taxonomy-add-new" href="edit-tags.php?taxonomy=<?php echo $this->taxonomy ?>&post_type=<?php echo $this->posttype; ?>" id=""><?php _e(
292
  </div>
293
  <?php
294
  } // slide_custom_category()
295
+
296
+
297
  /**********************
298
  * custom post types
299
  ***********************/
304
  'public' => false,
305
  'show_ui' => true,
306
  'show_admin_column' => true,
307
+ 'show_in_admin_bar' => true,
308
  'query_var' => true,
309
  'description' => __( 'Description.', 'cryout-serious-slider' ),
310
  'show_in_nav_menus' => false,
311
  'menu_position' => 21,
312
  'menu_icon' => plugins_url('/resources/images/serious-slider-icon.png',__FILE__),
313
+ 'capability_type' => 'page',
314
  'supports' => array(
315
  'title',
316
  'editor',
318
  'thumbnail',
319
  'page-attributes',
320
  ),
321
+ 'labels' => array(
322
  'name' => _x( 'Slides', 'post type general name', 'cryout-serious-slider' ),
323
  'singular_name' => _x( 'Slide', 'post type singular name', 'cryout-serious-slider' ),
324
  'menu_name' => _x( 'Serious Slider', 'admin menu', 'cryout-serious-slider' ),
325
+ 'name_admin_bar' => _x( 'Serious Slide', 'add new on admin bar', 'cryout-serious-slider' ),
326
  'add_new' => _x( 'Add New Slide', 'and new in menu', 'cryout-serious-slider' ),
327
  'add_new_item' => __( 'Add New Slide', 'cryout-serious-slider' ),
328
  'new_item' => __( 'New Slide', 'cryout-serious-slider' ),
334
  'not_found' => sprintf( __( 'No slides found. Go ahead and add <a href="%1$s">add some</a> or <a href="%2$s">load sample content</a>.', 'cryout-serious-slider' ), $this->addnewpage, $this->aboutpage ),
335
  'not_found_in_trash' => __( 'No slides found in Trash.', 'cryout-serious-slider' )
336
  ),
337
+ 'taxonomies' => array(
338
  $this->taxonomy,
339
  ),
340
+ 'register_meta_box_cb' => array( $this, 'metabox_register' ),
341
  );
342
 
343
  /* Register the post type. */
344
  register_post_type( $this->posttype, $args );
345
+
346
  } // register_post_types()
347
+
348
  /* Set up custom taxonomies for the custom post type */
349
  public function register_taxonomies() {
350
 
367
  'show_ui' => true,
368
  'show_admin_column' => true,
369
  'query_var' => true,
370
+
371
  'meta_box_cb' => array( $this, 'custom_category_picker' ), // customize taxonomy box selector
372
  );
373
 
375
  add_action( $this->taxonomy . '_add_form_fields', array($this, 'metatax_main_add'), 10, 2 );
376
  add_action( $this->taxonomy . '_edit_form_fields', array($this, 'metatax_main_edit'), 10, 2 );
377
  add_action( $this->taxonomy . '_edit_form', array($this, 'right_column'), 10, 2 ); // _pre_edit_form // _edit_form
378
+
379
+ add_action( 'edited_' . $this->taxonomy, array($this, 'save_taxonomy_custom_meta'), 10, 2 );
380
  add_action( 'create_' . $this->taxonomy, array($this, 'save_taxonomy_custom_meta'), 10, 2 );
381
  add_action( 'delete_' . $this->taxonomy, array($this, 'delete_taxonomy_custom_meta'), 10, 2 );
382
 
383
  } // register_taxonomies()
384
+
385
+
386
  /**********************
387
  * dashboard layout customization
388
  ***********************/
398
  );
399
  return $columns;
400
  } // columns_edit()
401
+
402
  // Show the featured image & taxonomy in posts list
403
  public function columns_content($column_name, $post_ID) {
404
  global $post;
405
+
406
  switch ($column_name) {
407
+ case 'featured_image':
408
+
409
  $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_ID ), 'medium' );
410
  $featured_image = $featured_image[0];
411
  if ($featured_image) {
413
  } else {
414
  _e('No featured image set.', 'cryout-serious-slider');
415
  }
416
+
417
  break;
418
+
419
+ case $this->taxonomy:
420
+
421
  $terms = get_the_terms( $post->ID, $this->taxonomy );
422
  if ( !empty( $terms ) ) {
423
 
429
  esc_url( add_query_arg( array( 'action' => 'edit', 'taxonomy' => $this->taxonomy, 'tag_ID' => $term->term_id, 'post_type' => $post->post_type ), 'edit-tags.php' ) ),
430
  __('Edit slider', 'cryout-serious-slider')
431
  );
432
+
433
  }
434
  echo join( ', ', $out );
435
+
436
  }
437
 
438
  else {
439
  _e( 'No Slider', 'cryout-serious-slider' );
440
  }
441
+
442
  break;
443
+
444
  case 'menu_order':
445
+
446
  $order = $post->menu_order;
447
  echo $order;
448
+
449
  break;
450
  }
451
  } // columns_content()
452
+
453
  /* Add sort by columns support */
454
  public function order_column_register_sortable($columns){
455
  $columns['menu_order'] = 'menu_order';
456
  $columns[$this->taxonomy] = $this->taxonomy;
457
  return $columns;
458
  } // order_column_register_sortable()
459
+
460
+ /* Add shortcode column in taxonomy screen */
461
+ public function columns_edit_taxonomy( $columns ){
462
+ return array_merge(
463
+ array_splice( $columns, 0, count($columns)-1 ),
464
+ array( 'shortcode' => __('Shortcode', 'cryout-serious-slider') ),
465
+ array_splice( $columns, count($columns)-1, 1 )
466
+ );
467
+ } // columns_edit_taxonomy()
468
+ public function custom_content_taxonomy( $empty, $column, $id ) {
469
+ switch ($column) {
470
+ case 'shortcode':
471
+ echo '[serious-slider id="' . $id . '"]';
472
+ break;
473
+ default:
474
+ break;
475
+ } // end switch
476
+ } // custom_content_taxonomy()
477
+
478
+ /*
479
  public function custom_list_css() {
480
+
481
  } // custom_list_css() */
482
+
483
  function add_taxonomy_filters() {
484
  global $typenow;
485
+
486
  $taxonomies = array( $this->taxonomy );
487
+
488
  // must set this to the post type you want the filter(s) displayed on
489
  if( $typenow == $this->posttype ){
490
+
491
  foreach ($taxonomies as $tax_slug) {
492
  $tax_obj = get_taxonomy($tax_slug);
493
  $tax_name = $tax_obj->labels->name;
496
  if(count($terms) > 0) {
497
  echo "<select name='$tax_slug' id='filter_$tax_slug' class='postform'>";
498
  printf( "<option value=''>%s</option>", sprintf( _x('Select %s', 'select terms', 'cryout-serious-slider'), $tax_name ) );
499
+ foreach ($terms as $term) {
500
+ echo '<option value='. $term->slug, $filtered_tax == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>';
501
  }
502
  echo "</select>";
503
  }
504
  }
505
  }
506
  } // add_taxonomy_filters()
507
+
508
  // add right column content (with shortcode hint) on edit slider page */
509
  function right_column( $tag, $taxonomy ) {
510
  $term_ID = $tag->term_id;
511
  include_once( plugin_dir_path( __FILE__ ) . 'inc/right-column.php' );
512
  } // right_column()
513
+
514
  /*public function custom_js() {
515
  global $post_type;
516
  //
517
  } // custom_js()*/
518
+
519
+
520
  /**********************
521
  * slide meta
522
  ***********************/
524
  function metabox_register() {
525
  add_meta_box('serious_slider_metaboxes', __( 'Slide Link', 'cryout-serious-slider' ), array($this, 'metabox_main'), $this->posttype, 'normal', 'high');
526
  } // metabox_register()
527
+
528
  function metabox_main() {
529
+
530
  global $post;
531
  $values = get_post_custom( $post->ID );
532
  $text = isset( $values['cryout_serious_slider_link'] ) ? $values['cryout_serious_slider_link'][0] : '';
533
  $check = isset( $values['cryout_serious_slider_target'] ) ? esc_attr( $values['cryout_serious_slider_target'][0] ) : '';
534
+
535
  wp_nonce_field( 'cryout_serious_slider_meta_nonce', 'cryout_serious_slider_meta_nonce' ); ?>
536
+
537
  <p>
538
  <label for="cryout_serious_slider_link"><?php _e('Link URL', 'cryout-serious-slider') ?></label>
539
  <input type="text" size="40" name="cryout_serious_slider_link" id="cryout_serious_slider_link" value="<?php echo $text; ?>" />
541
  <input type="checkbox" id="cryout_serious_slider_target" name="cryout_serious_slider_target" <?php checked( $check ); ?> />
542
  <label for="cryout_serious_slider_target"><?php _e('Open In New Window', 'cryout-serious-slider') ?></label>
543
  <br><em><?php _e('Leave empty to disable link.', 'cryout-serious-slider') ?></em></p>
544
+ <?php
545
+
546
  } // metabox_main()
547
+
548
  function metabox_save( $post_id ) {
549
 
550
  if( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
551
  if( !isset( $_POST['cryout_serious_slider_meta_nonce'] ) || !wp_verify_nonce( $_POST['cryout_serious_slider_meta_nonce'], 'cryout_serious_slider_meta_nonce' ) ) return;
552
  if( !current_user_can( 'edit_post' ) ) return;
553
  $allowed = '';
554
+
555
  if( isset( $_POST['cryout_serious_slider_link'] ) )
556
  update_post_meta( $post_id, 'cryout_serious_slider_link', esc_url_raw( $_POST['cryout_serious_slider_link'], $allowed ) );
557
  $chk = isset( $_POST['cryout_serious_slider_target'] );
558
  update_post_meta( $post_id, 'cryout_serious_slider_target', $chk );
559
+
560
  } // metabox_save()
561
+
562
+
563
  /**********************
564
  * slider/taxonomy meta
565
  ***********************/
566
  public function metatax_main_add() {
567
+
568
  $the_meta = $this->defaults;
569
  require_once( plugin_dir_path( __FILE__ ) . 'inc/taxmeta.php' );
570
+
571
  } // metabox_main_add()
572
+
573
  public function metatax_main_edit($term) {
574
+
575
  $tid = $term->term_id;
576
  $the_meta = get_option( "cryout_serious_slider_${tid}_meta" );
577
  if ( empty($the_meta) ) $the_meta = $this->defaults; ?>
579
  <td colspan="2">
580
  <?php require_once( plugin_dir_path( __FILE__ ) . 'inc/taxmeta.php' );?>
581
  </td>
582
+ </tr><?php
583
+
584
  } // metatax_main_edit()
585
+
586
  function save_taxonomy_custom_meta( $tid ) {
587
  if ( isset( $_POST['term_meta'] ) ) {
588
  $term_meta = get_option( "cryout_serious_slider_${tid}_meta" );
589
  $cat_keys = array_keys( $_POST['term_meta'] );
590
  foreach ( $cat_keys as $key ) {
591
  if ( isset ( $_POST['term_meta'][$key] ) ) {
592
+ $term_meta[$key] = sanitize_text_field($_POST['term_meta'][$key]);
593
  }
594
  }
595
  // Save the option array.
596
  update_option( "cryout_serious_slider_${tid}_meta", $term_meta );
597
  }
598
  } // save_taxonomy_custom_meta()
599
+
600
  function delete_taxonomy_custom_meta( $term_id ) {
601
  delete_option( "cryout_serious_slider_${term_id}_meta" );
602
  } // delete_taxonomy_custom_meta()
603
 
604
+
605
  /**********************
606
  * mce extension
607
  ***********************/
609
  global $post_type;
610
  global $pagenow;
611
 
612
+ // don't allow slider shortcode inside slide posts
613
  if( $this->posttype != $post_type && in_array( $pagenow, array( 'edit.php', 'post-new.php', 'post.php' ) ) ) {
614
  // check user permissions
615
  if ( !current_user_can( 'edit_posts' ) && !current_user_can( 'edit_pages' ) ) {
616
  return;
617
  }
618
+
619
  // check if WYSIWYG is enabled
620
  if ( 'true' == get_user_option( 'rich_editing' ) ) {
621
  add_filter( 'mce_external_plugins', array( $this ,'register_mce_external_plugins' ) );
623
  }
624
  }
625
  } // admin_head()
626
+
627
  function register_mce_external_plugins( $plugin_array ) {
628
  $plugin_array[$this->mce_tag] = plugins_url( 'resources/mce-button.js' , __FILE__ );
629
  return $plugin_array;
636
 
637
  function admin_enqueue_scripts($hook){
638
  global $post_type;
639
+ global $pagenow;
640
  if ( in_array( $pagenow, array( 'edit.php', 'post-new.php', 'post.php' ) ) ) {
641
  wp_enqueue_style('serious-slider-shortcode', plugins_url( 'resources/mce-button.css' , __FILE__ ) );
642
  };
644
  wp_enqueue_style('serious-slider-admincss', plugins_url( 'resources/backend.css' , __FILE__ ) );
645
  };
646
  } // admin_enqueue_scripts()
647
+
648
+
649
  /**********************
650
  * form helpers
651
  ***********************/
652
  function inputfield( $id, $current, $title='', $desc='', $class='', $extra='', $extra2='' ) {
653
+ /* wordpress/wp-admin/js/tags.js empties all text input elements with
654
  $('input[type="text"]:visible, textarea:visible', form).val('');
655
  as of 4.4.2; using type="number" as workaround */
656
  ?>
658
  <td><input id="<?php echo $id ?>" name="<?php echo $id ?>" class="<?php echo $class ?>" type="number" value="<?php echo $current ?>" <?php echo $extra2 ?>> <?php echo $extra ?>
659
  <p class="description"><?php echo $desc ?></p>
660
  </td>
661
+ </tr>
662
  <?php
663
  } // inputfield()
664
  function selectfield( $id, $options=array(), $current, $title='', $desc='', $class='', $extra='' ) {
672
  <p class="description"><?php echo $desc ?></p>
673
  </td>
674
  </tr>
675
+ <?php
676
  } // selectfield()
677
+
678
  } // class Cryout_Serious_Slider
679
 
680
  /* * * * get things going * * * */
681
  $cryout_serious_slider = new Cryout_Serious_Slider;
682
 
683
+ // EOF
inc/settings.php CHANGED
@@ -10,13 +10,19 @@
10
  $_REQUEST['add_sample_content'] = false;
11
 
12
  if ( $_REQUEST['add_sample_content'] ) {
 
13
  /* because wp doesn't auto display saved notice on non-options pages */ ?>
14
  <div class="updated settings-error notice is-dismissible" id="setting-error-settings_updated">
15
  <p><strong><?php _e('Sample slider created.', 'cryout-serious-slider');?></strong><br>
16
  <?php _e('Navigate to Slider and Slides sections to see the sample content.') ?></p>
17
  <button class="notice-dismiss" type="button"><span class="screen-reader-text"><?php _e('Dismiss this notice.', 'cryout-serious-slider' ) ?></span></button>
18
  </div>
19
- <?php } ?>
 
 
 
 
 
20
 
21
  <div id="poststuff">
22
  <div id="post-body" class="metabox-holder columns-2">
10
  $_REQUEST['add_sample_content'] = false;
11
 
12
  if ( $_REQUEST['add_sample_content'] ) {
13
+ if (current_user_can('edit_others_posts')) {
14
  /* because wp doesn't auto display saved notice on non-options pages */ ?>
15
  <div class="updated settings-error notice is-dismissible" id="setting-error-settings_updated">
16
  <p><strong><?php _e('Sample slider created.', 'cryout-serious-slider');?></strong><br>
17
  <?php _e('Navigate to Slider and Slides sections to see the sample content.') ?></p>
18
  <button class="notice-dismiss" type="button"><span class="screen-reader-text"><?php _e('Dismiss this notice.', 'cryout-serious-slider' ) ?></span></button>
19
  </div>
20
+ <?php } else { ?>
21
+ <div class="notice notice-warning is-dismissible">
22
+ <p><?php _e('You do not have sufficient permissions to create sample content.') ?></p>
23
+ <button class="notice-dismiss" type="button"><span class="screen-reader-text"><?php _e('Dismiss this notice.', 'cryout-serious-slider' ) ?></span></button>
24
+ </div>
25
+ <?php } } ?>
26
 
27
  <div id="poststuff">
28
  <div id="post-body" class="metabox-holder columns-2">
inc/widgets.php CHANGED
@@ -23,7 +23,7 @@ class Cryout_Serious_Slider_Widget extends WP_Widget {
23
  $sliders = $cryout_serious_slider->get_sliders();
24
  ?>
25
  <div>
26
- <p><label for="<?php echo $this->get_field_id('sid'); ?>"><?php _e('Displayed Slider', 'cryout-serious-slider') ?>:
27
  <select class="widefat" id="<?php echo $this->get_field_id('sid'); ?>" name="<?php echo $this->get_field_name('sid'); ?>">
28
  <?php foreach ($sliders as $slider) { ?>
29
  <option value="<?php echo $slider['value'] ?>" <?php selected($slider['value'],$sid) ?>><?php echo $slider['text'] ?></option>
23
  $sliders = $cryout_serious_slider->get_sliders();
24
  ?>
25
  <div>
26
+ <p><label for="<?php echo $this->get_field_id('sid'); ?>"><?php _e('Displayed Slider', 'cryout-serious-slider') ?>:</label>
27
  <select class="widefat" id="<?php echo $this->get_field_id('sid'); ?>" name="<?php echo $this->get_field_name('sid'); ?>">
28
  <?php foreach ($sliders as $slider) { ?>
29
  <option value="<?php echo $slider['value'] ?>" <?php selected($slider['value'],$sid) ?>><?php echo $slider['text'] ?></option>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: Cryout Creations
3
  Donate link: https://www.cryoutcreations.eu/donate/
4
  Tags: slider, carousel, shortcode, bootstrap, responsive, responsive slider
5
  Requires at least: 4.0
6
- Tested up to: 4.7.4
7
- Stable tag: 0.6.4
8
  Text Domain: cryout-serious-slider
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
@@ -45,6 +45,13 @@ Responsive slider, built on Bootstrap Carousel, uses core WordPress functionalit
45
 
46
  == Changelog ==
47
 
 
 
 
 
 
 
 
48
  = 0.6.4 =
49
  * Added check to hide caption titles and text when they are not defined
50
  * Fixed widget slider no longer displaying slider output buffering shortcode in 0.6.1
3
  Donate link: https://www.cryoutcreations.eu/donate/
4
  Tags: slider, carousel, shortcode, bootstrap, responsive, responsive slider
5
  Requires at least: 4.0
6
+ Tested up to: 4.8.0
7
+ Stable tag: 0.6.5
8
  Text Domain: cryout-serious-slider
9
  License: GPLv3
10
  License URI: http://www.gnu.org/licenses/gpl.html
45
 
46
  == Changelog ==
47
 
48
+ = 0.6.5 =
49
+ * Added 'shortcode' column in sliders list
50
+ * Fixed animation hiccup on some versions of Safari
51
+ * Fixed slider bullets alignment
52
+ * Fixed unclosed label in widget HTML markup
53
+ * Changed class initialization hook to 'setup_theme'
54
+
55
  = 0.6.4 =
56
  * Added check to hide caption titles and text when they are not defined
57
  * Fixed widget slider no longer displaying slider output buffering shortcode in 0.6.1
resources/style.css CHANGED
@@ -123,6 +123,10 @@
123
  }
124
 
125
 
 
 
 
 
126
  .seriousslider-inner > .active,
127
  .seriousslider-inner > .next,
128
  .seriousslider-inner > .prev {
@@ -135,7 +139,6 @@
135
  .seriousslider-inner > .prev {
136
  position: absolute;
137
  top: 0;
138
- width: 100%;
139
  }
140
  .seriousslider-inner > .next {
141
  left: 100%;
@@ -476,8 +479,7 @@
476
  padding-left: 0;
477
  text-align: center;
478
  list-style: none;
479
- margin-top: 0;
480
- margin-bottom: 0;
481
  }
482
 
483
  ol.seriousslider-indicators li {
123
  }
124
 
125
 
126
+ .seriousslider-inner > .item {
127
+ width: 100%;
128
+ }
129
+
130
  .seriousslider-inner > .active,
131
  .seriousslider-inner > .next,
132
  .seriousslider-inner > .prev {
139
  .seriousslider-inner > .prev {
140
  position: absolute;
141
  top: 0;
 
142
  }
143
  .seriousslider-inner > .next {
144
  left: 100%;
479
  padding-left: 0;
480
  text-align: center;
481
  list-style: none;
482
+ margin: 0 auto;
 
483
  }
484
 
485
  ol.seriousslider-indicators li {