Smooth Slider - Version 2.7

Version Description

If you have Smooth Slider 2.6 or plus, kindly update to 2.6.3 for proper height calcualtion for responsiveness.

= Before Upgrading =

  • Note the Title and Content fonts on your old Smooth Slider.
  • Go to 'Settings' panel and 'Save Changes'.
  • Recheck the Slider Title, Post Title and the Slider Content fonts on the Settings Panel.

Get older versions

Download this release

Release Info

Developer internet techies
Plugin Icon 128x128 Smooth Slider
Version 2.7
Comparing to
See all releases

Code changes from version 2.6.5 to 2.7

css/skins/default/functions.php CHANGED
@@ -188,7 +188,7 @@ function smooth_slider_get_default($slider_handle,$r_array,$slider_id='',$echo='
188
  $smooth_sldr_j = $r_array[0];
189
  $smooth_slider_css = smooth_get_inline_css();
190
  $html='';
191
-
192
  wp_enqueue_script( 'smooth', smooth_slider_plugin_url( 'js/smooth.js' ),array('jquery'), SMOOTH_SLIDER_VER, false);
193
  wp_enqueue_script( 'smooth-dim', smooth_slider_plugin_url( 'js/dim.js' ),array('jquery'), SMOOTH_SLIDER_VER, false);
194
  /* Changed fouc code start 2.6 - Bug fix in 2.6.2.1 */
@@ -286,6 +286,7 @@ function smooth_slider_get_default($slider_handle,$r_array,$slider_id='',$echo='
286
  $html.='<script type="text/javascript">'.$fouc_dom.'</script>';
287
  if($echo == '1') {echo $html; }
288
  else { return $html; }
 
289
  }
290
  function smooth_data_processor_default($slides, $smooth_slider,$out_echo){
291
  $skin='default';
188
  $smooth_sldr_j = $r_array[0];
189
  $smooth_slider_css = smooth_get_inline_css();
190
  $html='';
191
+ if(isset($smooth_sldr_j) && $smooth_sldr_j >= 1) : //is slider empty?
192
  wp_enqueue_script( 'smooth', smooth_slider_plugin_url( 'js/smooth.js' ),array('jquery'), SMOOTH_SLIDER_VER, false);
193
  wp_enqueue_script( 'smooth-dim', smooth_slider_plugin_url( 'js/dim.js' ),array('jquery'), SMOOTH_SLIDER_VER, false);
194
  /* Changed fouc code start 2.6 - Bug fix in 2.6.2.1 */
286
  $html.='<script type="text/javascript">'.$fouc_dom.'</script>';
287
  if($echo == '1') {echo $html; }
288
  else { return $html; }
289
+ endif; //is slider empty?
290
  }
291
  function smooth_data_processor_default($slides, $smooth_slider,$out_echo){
292
  $skin='default';
includes/media-images.php CHANGED
@@ -89,14 +89,21 @@ if (current_user_can( $smooth_slider['user_level'] )) {
89
  if(isset($attachment['slider']) and !isset($attachment['slider_name'])) {
90
  $slider_id = '1';
91
  if(is_post_on_any_slider($post_id)){
92
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
93
- $wpdb->query($sql);
94
  }
95
 
96
  if(isset($attachment['slider']) and $attachment['slider'] == "slider" and !slider($post_id,$slider_id)) {
97
  $dt = date('Y-m-d H:i:s');
98
- $sql = "INSERT INTO $table_name (post_id, date, slider_id) VALUES ('$post_id', '$dt', '$slider_id')";
99
- $wpdb->query($sql);
 
 
 
 
 
 
 
 
100
  }
101
  }
102
  if(isset($attachment['slider']) and $attachment['slider'] == "slider" and isset($attachment['slider_name'])){
@@ -105,16 +112,23 @@ if (current_user_can( $smooth_slider['user_level'] )) {
105
 
106
  foreach($post_sliders_data as $post_slider_data){
107
  if(!in_array($post_slider_data['slider_id'],$slider_id_arr)) {
108
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
109
- $wpdb->query($sql);
110
  }
111
  }
112
 
113
  foreach($slider_id_arr as $slider_id) {
114
  if(!slider($post_id,$slider_id)) {
115
  $dt = date('Y-m-d H:i:s');
116
- $sql = "INSERT INTO $table_name (post_id, date, slider_id) VALUES ('$post_id', '$dt', '$slider_id')";
117
- $wpdb->query($sql);
 
 
 
 
 
 
 
 
118
  }
119
  }
120
  }
89
  if(isset($attachment['slider']) and !isset($attachment['slider_name'])) {
90
  $slider_id = '1';
91
  if(is_post_on_any_slider($post_id)){
92
+ $wpdb->delete( $table_name, array( 'post_id' => $post_id ), array( '%d' ) );
 
93
  }
94
 
95
  if(isset($attachment['slider']) and $attachment['slider'] == "slider" and !slider($post_id,$slider_id)) {
96
  $dt = date('Y-m-d H:i:s');
97
+ $wpdb->query(
98
+ $wpdb->prepare(
99
+ "INSERT INTO $table_name
100
+ (post_id, date, slider_id)
101
+ VALUES ( %d, %s, %d )",
102
+ $post_id,
103
+ $dt,
104
+ $slider_id
105
+ )
106
+ );
107
  }
108
  }
109
  if(isset($attachment['slider']) and $attachment['slider'] == "slider" and isset($attachment['slider_name'])){
112
 
113
  foreach($post_sliders_data as $post_slider_data){
114
  if(!in_array($post_slider_data['slider_id'],$slider_id_arr)) {
115
+ $wpdb->delete( $table_name, array( 'post_id' => $post_id ), array( '%d' ) );
 
116
  }
117
  }
118
 
119
  foreach($slider_id_arr as $slider_id) {
120
  if(!slider($post_id,$slider_id)) {
121
  $dt = date('Y-m-d H:i:s');
122
+ $wpdb->query(
123
+ $wpdb->prepare(
124
+ "INSERT INTO $table_name
125
+ (post_id, date, slider_id)
126
+ VALUES ( %d, %s, %d )",
127
+ $post_id,
128
+ $dt,
129
+ $slider_id
130
+ )
131
+ );
132
  }
133
  }
134
  }
includes/smooth-slider-functions.php CHANGED
@@ -7,50 +7,43 @@ function ss_get_sliders(){
7
  return $sliders;
8
  }
9
  function get_slider_posts_in_order($slider_id) {
10
- global $wpdb, $table_prefix;
11
  $table_name = $table_prefix.SLIDER_TABLE;
12
- $slider_posts = $wpdb->get_results("SELECT * FROM $table_name WHERE slider_id = '$slider_id' ORDER BY slide_order ASC, date DESC", OBJECT);
13
  return $slider_posts;
14
  }
15
  function get_smooth_slider_name($slider_id) {
16
- global $wpdb, $table_prefix;
17
-
18
  $table_name = $table_prefix.SLIDER_META;
19
- $slider_obj = $wpdb->get_results("SELECT * FROM $table_name WHERE slider_id = '$slider_id'", OBJECT);
20
  if (isset ($slider_obj[0]))$slider_name = $slider_obj[0]->slider_name;
21
  return $slider_name;
22
  }
23
  function ss_get_post_sliders($post_id){
24
- global $wpdb,$table_prefix;
25
  $slider_table = $table_prefix.SLIDER_TABLE;
26
- $sql = "SELECT * FROM $slider_table
27
- WHERE post_id = '$post_id';";
28
- $post_sliders = $wpdb->get_results($sql, ARRAY_A);
29
  return $post_sliders;
30
  }
31
  function ss_get_prev_slider(){
32
- global $wpdb,$table_prefix;
33
  $slider_table = $table_prefix.PREV_SLIDER_TABLE;
34
  $sql = "SELECT * FROM $slider_table";
35
  $prev_slider_data = $wpdb->get_results($sql, ARRAY_A);
36
  return $prev_slider_data;
37
  }
38
  function ss_post_on_slider($post_id,$slider_id){
39
- global $wpdb,$table_prefix;
40
  $slider_postmeta = $table_prefix.SLIDER_POST_META;
41
- $sql = "SELECT * FROM $slider_postmeta
42
- WHERE post_id = '$post_id'
43
- AND slider_id = '$slider_id';";
44
- $result = $wpdb->query($sql);
45
  if($result == 1) { return TRUE; }
46
  else { return FALSE; }
47
  }
48
  function ss_slider_on_this_post($post_id){
49
- global $wpdb,$table_prefix;
50
  $slider_postmeta = $table_prefix.SLIDER_POST_META;
51
- $sql = "SELECT * FROM $slider_postmeta
52
- WHERE post_id = '$post_id';";
53
- $result = $wpdb->query($sql);
54
  if($result == 1) { return TRUE; }
55
  else { return FALSE; }
56
  }
@@ -58,48 +51,42 @@ function ss_slider_on_this_post($post_id){
58
  function slider($post_id,$slider_id = '1') {
59
  global $wpdb, $table_prefix;
60
  $table_name = $table_prefix.SLIDER_TABLE;
61
- $check = "SELECT id FROM $table_name WHERE post_id = '$post_id' AND slider_id = '$slider_id';";
62
- $result = $wpdb->query($check);
63
  if($result == 1) { return TRUE; }
64
  else { return FALSE; }
65
  }
66
  function is_post_on_any_slider($post_id) {
67
  global $wpdb, $table_prefix;
68
  $table_name = $table_prefix.SLIDER_TABLE;
69
- $check = "SELECT post_id FROM $table_name WHERE post_id = '$post_id' LIMIT 1;";
70
- $result = $wpdb->query($check);
71
  if($result == 1) { return TRUE; }
72
  else { return FALSE; }
73
  }
74
  function is_slider_on_slider_table($slider_id) {
75
  global $wpdb, $table_prefix;
76
  $table_name = $table_prefix.SLIDER_TABLE;
77
- $check = "SELECT * FROM $table_name WHERE slider_id = '$slider_id' LIMIT 1;";
78
- $result = $wpdb->query($check);
79
  if($result == 1) { return TRUE; }
80
  else { return FALSE; }
81
  }
82
  function is_slider_on_meta_table($slider_id) {
83
  global $wpdb, $table_prefix;
84
  $table_name = $table_prefix.SLIDER_META;
85
- $check = "SELECT * FROM $table_name WHERE slider_id = '$slider_id' LIMIT 1;";
86
- $result = $wpdb->query($check);
87
  if($result == 1) { return TRUE; }
88
  else { return FALSE; }
89
  }
90
  function is_slider_on_postmeta_table($slider_id) {
91
  global $wpdb, $table_prefix;
92
  $table_name = $table_prefix.SLIDER_POST_META;
93
- $check = "SELECT * FROM $table_name WHERE slider_id = '$slider_id' LIMIT 1;";
94
- $result = $wpdb->query($check);
95
  if($result == 1) { return TRUE; }
96
  else { return FALSE; }
97
  }
98
  function get_slider_for_the_post($post_id) {
99
- global $wpdb, $table_prefix;
100
  $table_name = $table_prefix.SLIDER_POST_META;
101
- $sql = "SELECT slider_id FROM $table_name WHERE post_id = '$post_id' LIMIT 1;";
102
- $slider_postmeta = $wpdb->get_row($sql, ARRAY_A);
103
  $slider_id = $slider_postmeta['slider_id'];
104
  return $slider_id;
105
  }
@@ -149,22 +136,22 @@ function smooth_slider_table_exists($table, $db) {
149
  return FALSE;
150
  }
151
  function add_cf5_column_if_not_exist($table_name, $column_name, $create_ddl) {
152
- global $wpdb, $debug;
153
- foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
154
- if ($debug) echo("checking $column == $column_name<br />");
155
- if ($column == $column_name) {
156
- return true;
157
- }
158
- }
159
- //didn't find it try to create it.
160
- $q = $wpdb->query($create_ddl);
161
- // we cannot directly tell that whether this succeeded!
162
- foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
163
- if ($column == $column_name) {
164
- return true;
165
- }
166
- }
167
- return false;
168
  }
169
 
170
  ?>
7
  return $sliders;
8
  }
9
  function get_slider_posts_in_order($slider_id) {
10
+ global $wpdb, $table_prefix;
11
  $table_name = $table_prefix.SLIDER_TABLE;
12
+ $slider_posts = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $table_name WHERE slider_id = %d ORDER BY slide_order ASC, date DESC",$slider_id ), OBJECT);
13
  return $slider_posts;
14
  }
15
  function get_smooth_slider_name($slider_id) {
16
+ global $wpdb, $table_prefix;
17
+ $slider_name = '';
18
  $table_name = $table_prefix.SLIDER_META;
19
+ $slider_obj = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $table_name WHERE slider_id = %d",$slider_id ), OBJECT);
20
  if (isset ($slider_obj[0]))$slider_name = $slider_obj[0]->slider_name;
21
  return $slider_name;
22
  }
23
  function ss_get_post_sliders($post_id){
24
+ global $wpdb,$table_prefix;
25
  $slider_table = $table_prefix.SLIDER_TABLE;
26
+ $post_sliders =$wpdb->get_results($wpdb->prepare( "SELECT * FROM $slider_table WHERE post_id = %d",$post_id ), ARRAY_A);
 
 
27
  return $post_sliders;
28
  }
29
  function ss_get_prev_slider(){
30
+ global $wpdb,$table_prefix;
31
  $slider_table = $table_prefix.PREV_SLIDER_TABLE;
32
  $sql = "SELECT * FROM $slider_table";
33
  $prev_slider_data = $wpdb->get_results($sql, ARRAY_A);
34
  return $prev_slider_data;
35
  }
36
  function ss_post_on_slider($post_id,$slider_id){
37
+ global $wpdb,$table_prefix;
38
  $slider_postmeta = $table_prefix.SLIDER_POST_META;
39
+ $result = $wpdb->query($wpdb->prepare( "SELECT * FROM $slider_postmeta WHERE post_id = %d AND slider_id = %d",$post_id,$slider_id ));
 
 
 
40
  if($result == 1) { return TRUE; }
41
  else { return FALSE; }
42
  }
43
  function ss_slider_on_this_post($post_id){
44
+ global $wpdb,$table_prefix;
45
  $slider_postmeta = $table_prefix.SLIDER_POST_META;
46
+ $result = $wpdb->query($wpdb->prepare( "SELECT * FROM $slider_postmeta WHERE post_id = %d",$post_id ));
 
 
47
  if($result == 1) { return TRUE; }
48
  else { return FALSE; }
49
  }
51
  function slider($post_id,$slider_id = '1') {
52
  global $wpdb, $table_prefix;
53
  $table_name = $table_prefix.SLIDER_TABLE;
54
+ $result = $wpdb->query($wpdb->prepare( "SELECT id FROM $table_name WHERE post_id = %d AND slider_id = %d",$post_id, $slider_id ));
 
55
  if($result == 1) { return TRUE; }
56
  else { return FALSE; }
57
  }
58
  function is_post_on_any_slider($post_id) {
59
  global $wpdb, $table_prefix;
60
  $table_name = $table_prefix.SLIDER_TABLE;
61
+ $result = $wpdb->query($wpdb->prepare( "SELECT * FROM $table_name WHERE post_id = %d LIMIT 1",$post_id ));
 
62
  if($result == 1) { return TRUE; }
63
  else { return FALSE; }
64
  }
65
  function is_slider_on_slider_table($slider_id) {
66
  global $wpdb, $table_prefix;
67
  $table_name = $table_prefix.SLIDER_TABLE;
68
+ $result = $wpdb->query($wpdb->prepare( "SELECT * FROM $table_name WHERE slider_id = %d LIMIT 1",$slider_id ));
 
69
  if($result == 1) { return TRUE; }
70
  else { return FALSE; }
71
  }
72
  function is_slider_on_meta_table($slider_id) {
73
  global $wpdb, $table_prefix;
74
  $table_name = $table_prefix.SLIDER_META;
75
+ $result = $wpdb->query($wpdb->prepare( "SELECT * FROM $table_name WHERE slider_id = %d LIMIT 1",$slider_id ));
 
76
  if($result == 1) { return TRUE; }
77
  else { return FALSE; }
78
  }
79
  function is_slider_on_postmeta_table($slider_id) {
80
  global $wpdb, $table_prefix;
81
  $table_name = $table_prefix.SLIDER_POST_META;
82
+ $result = $wpdb->query($wpdb->prepare( "SELECT * FROM $table_name WHERE slider_id = %d LIMIT 1",$slider_id ));
 
83
  if($result == 1) { return TRUE; }
84
  else { return FALSE; }
85
  }
86
  function get_slider_for_the_post($post_id) {
87
+ global $wpdb, $table_prefix;
88
  $table_name = $table_prefix.SLIDER_POST_META;
89
+ $slider_postmeta = $wpdb->get_row($wpdb->prepare( "SELECT slider_id FROM $table_name WHERE post_id = %d LIMIT 1",$post_id ), ARRAY_A);
 
90
  $slider_id = $slider_postmeta['slider_id'];
91
  return $slider_id;
92
  }
136
  return FALSE;
137
  }
138
  function add_cf5_column_if_not_exist($table_name, $column_name, $create_ddl) {
139
+ global $wpdb, $debug;
140
+ foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
141
+ if ($debug) echo("checking $column == $column_name<br />");
142
+ if ($column == $column_name) {
143
+ return true;
144
+ }
145
+ }
146
+ //didn't find it try to create it.
147
+ $q = $wpdb->query($create_ddl);
148
+ // we cannot directly tell that whether this succeeded!
149
+ foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
150
+ if ($column == $column_name) {
151
+ return true;
152
+ }
153
+ }
154
+ return false;
155
  }
156
 
157
  ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: internet techies, slidervilla
3
  Tags: slider, slideshow, wordpress slider, content slider, posts slider,image slider, responsive slideshow, image Rotator, jquery slider, Photo Slider, nivo slider, slider plugin, javascript slider, coin slider, responsive slider, featured-content-slider, Horizontal slider, carousel slider, wp slider, vertical slider, best slider plugin, content slideshow, javascript slideshow, slideshow manager, slideshow plugin, image slideshow, jquery slideshow, wordpress slideshow, vertical slides, responsive, nivoslider, flex slider, coinslider, carousel, post, posts, plugin, slider widget, widget slider, widget slideshow, widget, widgets, seo, wordpress seo, media, page, slide, slides
4
  Donate link: http://www.clickonf5.org/go/smooth-slider/
5
  Requires at least: 3.0
6
- Tested up to: 4.2
7
- Stable tag: 2.6.5
8
  License: GPLv2 or later
9
 
10
  Most Popular Responsive WordPress Slider for Featured Content, Videos and Media Images
@@ -152,6 +152,10 @@ Check the other FAQs on Smooth [Slider Documetation on SliderVilla](http://guide
152
 
153
  == Changelog ==
154
 
 
 
 
 
155
  Version 2.6.5 (09/19/2014)
156
 
157
  1. Fix: Conflict with Pointelle Slider
3
  Tags: slider, slideshow, wordpress slider, content slider, posts slider,image slider, responsive slideshow, image Rotator, jquery slider, Photo Slider, nivo slider, slider plugin, javascript slider, coin slider, responsive slider, featured-content-slider, Horizontal slider, carousel slider, wp slider, vertical slider, best slider plugin, content slideshow, javascript slideshow, slideshow manager, slideshow plugin, image slideshow, jquery slideshow, wordpress slideshow, vertical slides, responsive, nivoslider, flex slider, coinslider, carousel, post, posts, plugin, slider widget, widget slider, widget slideshow, widget, widgets, seo, wordpress seo, media, page, slide, slides
4
  Donate link: http://www.clickonf5.org/go/smooth-slider/
5
  Requires at least: 3.0
6
+ Tested up to: 4.2.2
7
+ Stable tag: 2.7
8
  License: GPLv2 or later
9
 
10
  Most Popular Responsive WordPress Slider for Featured Content, Videos and Media Images
152
 
153
  == Changelog ==
154
 
155
+ Version 2.7 (07/18/2014)
156
+
157
+ 1. Fix: SQL query fixes and debug notices
158
+
159
  Version 2.6.5 (09/19/2014)
160
 
161
  1. Fix: Conflict with Pointelle Slider
settings/settings.php CHANGED
@@ -108,7 +108,6 @@ $new_settings_msg='';
108
  //Import Settings
109
  if (isset ($_POST['import'])) {
110
  if ($_POST['import']=='Import') {
111
- global $wpdb;
112
  $imported_settings_message='';
113
  $csv_mimetypes = array('text/csv','text/x-csv','text/plain','application/csv','text/comma-separated-values','application/excel','application/vnd.ms-excel','application/vnd.msexcel','text/anytext','application/octet-stream','application/txt');
114
  if ($_FILES['settings_file']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['settings_file']['tmp_name']) && in_array($_FILES['settings_file']['type'], $csv_mimetypes) ) {
@@ -550,7 +549,7 @@ if ($handle = opendir($directory)) {
550
  <td><select name="smooth_slider_options[img_align]" id="smooth_slider_img_align" >
551
  <option value="left" <?php if ($smooth_slider['img_align'] == "left"){ echo "selected";}?> ><?php _e('Left','smooth-slider'); ?></option>
552
  <option value="right" <?php if ($smooth_slider['img_align'] == "right"){ echo "selected";}?> ><?php _e('Right','smooth-slider'); ?></option>
553
- <option value="none" <?php if ($smooth_slider['img_align'] == "none"){ echo "selected";}?> ><?php _e('Center','smooth-slider'); ?></option>
554
  </select>
555
  </td>
556
  </tr>
108
  //Import Settings
109
  if (isset ($_POST['import'])) {
110
  if ($_POST['import']=='Import') {
 
111
  $imported_settings_message='';
112
  $csv_mimetypes = array('text/csv','text/x-csv','text/plain','application/csv','text/comma-separated-values','application/excel','application/vnd.ms-excel','application/vnd.msexcel','text/anytext','application/octet-stream','application/txt');
113
  if ($_FILES['settings_file']['error'] == UPLOAD_ERR_OK && is_uploaded_file($_FILES['settings_file']['tmp_name']) && in_array($_FILES['settings_file']['type'], $csv_mimetypes) ) {
549
  <td><select name="smooth_slider_options[img_align]" id="smooth_slider_img_align" >
550
  <option value="left" <?php if ($smooth_slider['img_align'] == "left"){ echo "selected";}?> ><?php _e('Left','smooth-slider'); ?></option>
551
  <option value="right" <?php if ($smooth_slider['img_align'] == "right"){ echo "selected";}?> ><?php _e('Right','smooth-slider'); ?></option>
552
+ <option value="none" <?php if ($smooth_slider['img_align'] == "none"){ echo "selected";}?> ><?php _e('None','smooth-slider'); ?></option>
553
  </select>
554
  </td>
555
  </tr>
settings/sliders.php CHANGED
@@ -9,72 +9,105 @@ if (isset($_POST['remove_posts_slider'])) {
9
  if (isset($_POST['slider_posts']) ) {
10
  global $wpdb, $table_prefix;
11
  $table_name = $table_prefix.SLIDER_TABLE;
12
- $current_slider = $_POST['current_slider_id'];
 
13
  foreach ( $_POST['slider_posts'] as $post_id=>$val ) {
14
- $sql = "DELETE FROM $table_name WHERE post_id = '$post_id' AND slider_id = '$current_slider' LIMIT 1";
15
- $wpdb->query($sql);
 
 
 
 
 
 
 
 
16
  }
17
  }
18
  if (isset ($_POST['remove_all'])) {
19
  if ($_POST['remove_all'] == __('Remove All at Once','smooth-slider')) {
20
  global $wpdb, $table_prefix;
21
  $table_name = $table_prefix.SLIDER_TABLE;
22
- $current_slider = $_POST['current_slider_id'];
 
23
  if(is_slider_on_slider_table($current_slider)) {
24
- $sql = "DELETE FROM $table_name WHERE slider_id = '$current_slider';";
25
- $wpdb->query($sql);
26
  }
27
  }
28
  }
29
  if (isset ($_POST['remove_all'])) {
30
  if ($_POST['remove_all'] == __('Delete Slider','smooth-slider')) {
31
- $slider_id = $_POST['current_slider_id'];
 
 
32
  global $wpdb, $table_prefix;
33
  $slider_table = $table_prefix.SLIDER_TABLE;
34
  $slider_meta = $table_prefix.SLIDER_META;
35
  $slider_postmeta = $table_prefix.SLIDER_POST_META;
36
  if(is_slider_on_slider_table($slider_id)) {
37
- $sql = "DELETE FROM $slider_table WHERE slider_id = '$slider_id';";
38
- $wpdb->query($sql);
39
  }
40
  if(is_slider_on_meta_table($slider_id)) {
41
- $sql = "DELETE FROM $slider_meta WHERE slider_id = '$slider_id';";
42
- $wpdb->query($sql);
43
  }
44
  if(is_slider_on_postmeta_table($slider_id)) {
45
- $sql = "DELETE FROM $slider_postmeta WHERE slider_id = '$slider_id';";
46
- $wpdb->query($sql);
47
  }
48
  }
49
  }
50
  }
51
  if (isset($_POST['create_new_slider'])) {
52
- $slider_name = $_POST['new_slider_name'];
53
- global $wpdb,$table_prefix;
54
- $slider_meta = $table_prefix.SLIDER_META;
55
- $sql = "INSERT INTO $slider_meta (slider_name) VALUES('$slider_name');";
56
- $result = $wpdb->query($sql);
 
 
 
 
 
 
57
  }
58
  if (isset($_POST['reorder_posts_slider'])) {
59
  $i=1;
60
  global $wpdb, $table_prefix;
61
  $table_name = $table_prefix.SLIDER_TABLE;
62
  foreach ($_POST['order'] as $slide_order) {
63
- $slide_order = intval($slide_order);
64
- $sql = 'UPDATE '.$table_name.' SET slide_order='.$i.' WHERE post_id='.$slide_order.'';
65
- $wpdb->query($sql);
66
- $i++;
 
 
 
 
 
 
 
 
 
67
  }
68
  }
69
  /*Added for rename slider-2.6-start*/
70
  if ((isset ($_POST['rename_slider'])) and ($_POST['rename_slider'] == __('Rename','smooth-slider'))) {
71
  $slider_name = $_POST['rename_slider_to'];
72
- $slider_id=$_POST['current_slider_id'];
 
73
  if( !empty($slider_name) ) {
74
  global $wpdb,$table_prefix;
75
  $slider_meta = $table_prefix.SLIDER_META;
76
- $sql = 'UPDATE '.$slider_meta.' SET slider_name="'.$slider_name.'" WHERE slider_id='.$slider_id;
77
- $wpdb->query($sql);
 
 
 
 
 
 
 
 
 
78
  }
79
  }
80
  /*Added for rename slider-2.6-end*/
@@ -82,7 +115,8 @@ if ((isset ($_POST['rename_slider'])) and ($_POST['rename_slider'] == __('Rename
82
  /* Added for upload media save-2.6 */
83
  if ( isset($_POST['addSave']) and ($_POST['addSave']=='Save') ) {
84
  $images=(isset($_POST['imgID']))?$_POST['imgID']:array();
85
- $slider_id=$_POST['current_slider_id'];
 
86
  $ids=array_reverse($images);
87
  global $wpdb,$table_prefix;
88
  foreach($ids as $id){
@@ -100,8 +134,17 @@ if ( isset($_POST['addSave']) and ($_POST['addSave']=='Save') ) {
100
  update_post_meta($id, 'smooth_sslider_nolink', $nolink);
101
  if(!slider($id,$slider_id)) {
102
  $dt = date('Y-m-d H:i:s');
103
- $sql = "INSERT INTO ".$table_prefix.SLIDER_TABLE." (post_id, date, slider_id) VALUES ('$id', '$dt', '$slider_id')";
104
- $wpdb->query($sql);
 
 
 
 
 
 
 
 
 
105
  }
106
  }
107
  }
@@ -205,11 +248,8 @@ wp_enqueue_script( 'media-uploader', smooth_slider_plugin_url( 'js/media-uploade
205
  <p><em><?php _e('Click on and drag the post/page title to a new spot within the list, and the other items will adjust to fit.','smooth-slider'); ?> </em></p>
206
  <ul id="sslider_sortable_<?php echo $slider['slider_id'];?>" style="color:#326078;overflow: auto;">
207
  <?php
208
- /*global $wpdb, $table_prefix;
209
- $table_name = $table_prefix.SLIDER_TABLE;*/
210
- $slider_id = $slider['slider_id'];
211
- //$slider_posts = $wpdb->get_results("SELECT post_id FROM $table_name WHERE slider_id = '$slider_id'", OBJECT);
212
- $slider_posts=get_slider_posts_in_order($slider_id);?>
213
 
214
  <input type="hidden" name="current_slider_id" value="<?php echo $slider_id;?>" />
215
 
9
  if (isset($_POST['slider_posts']) ) {
10
  global $wpdb, $table_prefix;
11
  $table_name = $table_prefix.SLIDER_TABLE;
12
+ $current_slider = isset($_POST['current_slider_id'])?$_POST['current_slider_id']:'';
13
+ $current_slider = intval($current_slider);
14
  foreach ( $_POST['slider_posts'] as $post_id=>$val ) {
15
+ $wpdb->query(
16
+ $wpdb->prepare(
17
+ "
18
+ DELETE FROM $table_name
19
+ WHERE post_id = %d
20
+ AND slider_id = %d
21
+ ",
22
+ $post_id, $current_slider
23
+ )
24
+ );
25
  }
26
  }
27
  if (isset ($_POST['remove_all'])) {
28
  if ($_POST['remove_all'] == __('Remove All at Once','smooth-slider')) {
29
  global $wpdb, $table_prefix;
30
  $table_name = $table_prefix.SLIDER_TABLE;
31
+ $current_slider = isset($_POST['current_slider_id'])?$_POST['current_slider_id']:'';
32
+ $current_slider = intval($current_slider);
33
  if(is_slider_on_slider_table($current_slider)) {
34
+ $wpdb->delete( $table_name, array( 'slider_id' => $current_slider ), array( '%d' ) );
 
35
  }
36
  }
37
  }
38
  if (isset ($_POST['remove_all'])) {
39
  if ($_POST['remove_all'] == __('Delete Slider','smooth-slider')) {
40
+ $slider_id = isset($_POST['current_slider_id'])?$_POST['current_slider_id']:'';
41
+ $slider_id = intval($slider_id);
42
+
43
  global $wpdb, $table_prefix;
44
  $slider_table = $table_prefix.SLIDER_TABLE;
45
  $slider_meta = $table_prefix.SLIDER_META;
46
  $slider_postmeta = $table_prefix.SLIDER_POST_META;
47
  if(is_slider_on_slider_table($slider_id)) {
48
+ $wpdb->delete( $slider_table, array( 'slider_id' => $slider_id ), array( '%d' ) );
 
49
  }
50
  if(is_slider_on_meta_table($slider_id)) {
51
+ $wpdb->delete( $slider_meta, array( 'slider_id' => $slider_id ), array( '%d' ) );
 
52
  }
53
  if(is_slider_on_postmeta_table($slider_id)) {
54
+ $wpdb->delete( $slider_postmeta, array( 'slider_id' => $slider_id ), array( '%d' ) );
 
55
  }
56
  }
57
  }
58
  }
59
  if (isset($_POST['create_new_slider'])) {
60
+ $slider_name = $_POST['new_slider_name'];
61
+ global $wpdb,$table_prefix;
62
+ $slider_meta = $table_prefix.SLIDER_META;
63
+ $wpdb->query(
64
+ $wpdb->prepare(
65
+ "INSERT INTO $slider_meta
66
+ (slider_name)
67
+ VALUES ( %s )",
68
+ $slider_name
69
+ )
70
+ );
71
  }
72
  if (isset($_POST['reorder_posts_slider'])) {
73
  $i=1;
74
  global $wpdb, $table_prefix;
75
  $table_name = $table_prefix.SLIDER_TABLE;
76
  foreach ($_POST['order'] as $slide_order) {
77
+ $slide_order = intval($slide_order);
78
+ $wpdb->update(
79
+ $table_name,
80
+ array(
81
+ 'slide_order' => $i
82
+ ),
83
+ array( 'post_id' => $slide_order ),
84
+ array(
85
+ '%d'
86
+ ),
87
+ array( '%d' )
88
+ );
89
+ $i++;
90
  }
91
  }
92
  /*Added for rename slider-2.6-start*/
93
  if ((isset ($_POST['rename_slider'])) and ($_POST['rename_slider'] == __('Rename','smooth-slider'))) {
94
  $slider_name = $_POST['rename_slider_to'];
95
+ $slider_id = isset($_POST['current_slider_id'])?$_POST['current_slider_id']:'';
96
+ $slider_id = intval($slider_id);
97
  if( !empty($slider_name) ) {
98
  global $wpdb,$table_prefix;
99
  $slider_meta = $table_prefix.SLIDER_META;
100
+ $wpdb->update(
101
+ $slider_meta,
102
+ array(
103
+ 'slider_name' => $slider_name
104
+ ),
105
+ array( 'slider_id' => $slider_id ),
106
+ array(
107
+ '%s'
108
+ ),
109
+ array( '%d' )
110
+ );
111
  }
112
  }
113
  /*Added for rename slider-2.6-end*/
115
  /* Added for upload media save-2.6 */
116
  if ( isset($_POST['addSave']) and ($_POST['addSave']=='Save') ) {
117
  $images=(isset($_POST['imgID']))?$_POST['imgID']:array();
118
+ $slider_id = isset($_POST['current_slider_id'])?$_POST['current_slider_id']:'';
119
+ $slider_id = intval($slider_id);
120
  $ids=array_reverse($images);
121
  global $wpdb,$table_prefix;
122
  foreach($ids as $id){
134
  update_post_meta($id, 'smooth_sslider_nolink', $nolink);
135
  if(!slider($id,$slider_id)) {
136
  $dt = date('Y-m-d H:i:s');
137
+ $table_name=$table_prefix.SLIDER_TABLE;
138
+ $wpdb->query(
139
+ $wpdb->prepare(
140
+ "INSERT INTO $table_name
141
+ (post_id, date, slider_id)
142
+ VALUES ( %d, %s, %d )",
143
+ $id,
144
+ $dt,
145
+ $slider_id
146
+ )
147
+ );
148
  }
149
  }
150
  }
248
  <p><em><?php _e('Click on and drag the post/page title to a new spot within the list, and the other items will adjust to fit.','smooth-slider'); ?> </em></p>
249
  <ul id="sslider_sortable_<?php echo $slider['slider_id'];?>" style="color:#326078;overflow: auto;">
250
  <?php
251
+ $slider_id = $slider['slider_id'];
252
+ $slider_posts=get_slider_posts_in_order($slider_id);?>
 
 
 
253
 
254
  <input type="hidden" name="current_slider_id" value="<?php echo $slider_id;?>" />
255
 
slider_versions/smooth_1.php CHANGED
@@ -84,10 +84,9 @@ function carousel_posts_on_slider($max_posts, $offset=0, $slider_id = '1',$out_e
84
  $orderby = 'a.slide_order ASC, a.date DESC';
85
  }
86
  $posts = $wpdb->get_results("SELECT b.* FROM
87
- $table_name a LEFT OUTER JOIN $post_table b
88
- ON a.post_id = b.ID
89
- WHERE (b.post_status = 'publish' OR (b.post_type='attachment' AND b.post_status = 'inherit')) AND a.slider_id = '$slider_id'
90
- ORDER BY ".$orderby." LIMIT $offset, $max_posts", OBJECT);
91
 
92
  $r_array=smooth_global_posts_processor( $posts, $smooth_slider, $out_echo, $set, $data );
93
  return $r_array;
84
  $orderby = 'a.slide_order ASC, a.date DESC';
85
  }
86
  $posts = $wpdb->get_results("SELECT b.* FROM
87
+ $table_name a LEFT OUTER JOIN $post_table b
88
+ ON a.post_id = b.ID
89
+ WHERE (b.post_status = 'publish' OR (b.post_type='attachment' AND b.post_status = 'inherit')) AND a.slider_id = '$slider_id' ORDER BY ".$orderby." LIMIT $offset, $max_posts", OBJECT);
 
90
 
91
  $r_array=smooth_global_posts_processor( $posts, $smooth_slider, $out_echo, $set, $data );
92
  return $r_array;
smooth-slider.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Smooth Slider
4
  Plugin URI: http://slidervilla.com/smooth-slider/
5
  Description: Smooth slider adds a responsive featured content on image slider using shortcode, widget and template tags. Create and embed featured content slider, recent post slider, category slider in less than 60 seconds.
6
- Version: 2.6.5
7
  Author: SliderVilla
8
  Author URI: http://slidervilla.com/
9
  Wordpress version supported: 2.9 and above
@@ -30,12 +30,12 @@ Wordpress version supported: 2.9 and above
30
  //defined global variables and constants here
31
  global $smooth_slider,$default_slider,$smooth_db_version,$default_smooth_slider_settings;
32
  $smooth_slider = get_option('smooth_slider_options');
33
- $smooth_db_version='2.6.5'; //current version of smooth slider database
34
  define('SLIDER_TABLE','smooth_slider'); //Slider TABLE NAME
35
  define('PREV_SLIDER_TABLE','slider'); //Slider TABLE NAME
36
  define('SLIDER_META','smooth_slider_meta'); //Meta TABLE NAME
37
  define('SLIDER_POST_META','smooth_slider_postmeta'); //Meta TABLE NAME
38
- define("SMOOTH_SLIDER_VER","2.6.5",false);//Current Version of Smooth Slider
39
  if ( ! defined( 'SMOOTH_SLIDER_PLUGIN_BASENAME' ) )
40
  define( 'SMOOTH_SLIDER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
41
  if ( ! defined( 'SMOOTH_SLIDER_CSS_DIR' ) ){
@@ -46,66 +46,66 @@ if ( ! defined( 'SMOOTH_SLIDER_CSS_DIR' ) ){
46
  // Need to delete the previously created options in old versions and create only one option field for Smooth Slider
47
  $default_smooth_slider_settings=$default_slider = array();
48
  $default_smooth_slider_settings=$default_slider = array('speed'=>'7',
49
- 'no_posts'=>'5',
50
- 'bg_color'=>'#ffffff',
51
- 'height'=>'250',
52
- 'width'=>'450',
53
- 'border'=>'0',
54
- 'brcolor'=>'#dddddd',
55
- 'prev_next'=>'0',
56
- 'goto_slide'=>'1',
57
- 'title_text'=>'Featured Posts',
58
- 'title_from'=>'0',
59
- 'title_font'=>'Georgia',
60
- 'title_fsize'=>'20',
61
- 'title_fstyle'=>'bold',
62
- 'title_fcolor'=>'#000000',
63
- 'ptitle_font'=>'Trebuchet MS',
64
- 'ptitle_fsize'=>'14',
65
- 'ptitle_fstyle'=>'bold',
66
- 'ptitle_fcolor'=>'#000000',
67
- 'img_align'=>'left',
68
- 'img_height'=>'120',
69
- 'img_width'=>'165',
70
- 'img_border'=>'1',
71
- 'img_brcolor'=>'#000000',
72
- 'content_font'=>'Verdana',
73
- 'content_fsize'=>'12',
74
- 'content_fstyle'=>'normal',
75
- 'content_fcolor'=>'#333333',
76
- 'content_from'=>'content',
77
- 'content_chars'=>'300',
78
- 'bg'=>'0',
79
- 'image_only'=>'0',
80
- 'allowable_tags'=>'',
81
- 'more'=>'Read More',
82
- 'img_size'=>'1',
83
- 'img_pick'=>array('1','slider_thumbnail','1','1','1','1'), //use custom field/key, name of the key, use post featured image, pick the image attachment, attachment order,scan images
84
- 'user_level'=>'edit_others_posts',
85
- 'custom_nav'=>'',
86
- 'crop'=>'0',
87
- 'transition'=>'5',
88
- 'autostep'=>'1',
89
- 'multiple_sliders'=>'1',
90
- 'navimg_w'=>'8',
91
- 'navimg_ht'=>'8',
92
- 'content_limit'=>'20',
93
- 'stylesheet'=>'default',
94
- 'shortcode'=>'1',
95
- 'rand'=>'0',
96
- 'ver'=>'j',
97
- 'fouc'=>'0',
98
- 'fx'=>'scrollHorz',
99
- 'css'=>'',
100
- 'active_tab'=>'0',
101
- 'disable_preview'=>'0',
102
- 'preview'=>'2',
103
- 'slider_id'=>'1',
104
- 'catg_slug'=>'',
105
- 'popup'=>'1',
106
- 'readmorecolor'=>'#0092E4',
107
- 'noscript'=>''
108
- );
109
  // Create Text Domain For Translations
110
  load_plugin_textdomain('smooth-slider', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
111
 
@@ -132,8 +132,16 @@ function install_smooth_slider() {
132
  $prev_post_id = $prev_slider_row['id'];
133
  $prev_date_time = $prev_slider_row['date'];
134
  if ($prev_post_id) {
135
- $sql = "INSERT INTO $table_name (post_id,date) VALUES('$prev_post_id','$prev_date_time');";
136
- $result = $wpdb->query($sql);
 
 
 
 
 
 
 
 
137
  }
138
  }
139
  }
@@ -143,14 +151,21 @@ function install_smooth_slider() {
143
  $meta_table_name = $table_prefix.SLIDER_META;
144
  if($wpdb->get_var("show tables like '$meta_table_name'") != $meta_table_name) {
145
  $sql = "CREATE TABLE $meta_table_name (
146
- slider_id int(5) NOT NULL AUTO_INCREMENT,
147
- slider_name varchar(100) NOT NULL default '',
148
- UNIQUE KEY slider_id(slider_id)
149
- );";
150
  $rs2 = $wpdb->query($sql);
151
 
152
- $sql = "INSERT INTO $meta_table_name (slider_id,slider_name) VALUES('1','Smooth Slider');";
153
- $rs3 = $wpdb->query($sql);
 
 
 
 
 
 
 
154
  }
155
 
156
  $slider_postmeta = $table_prefix.SLIDER_POST_META;
@@ -163,7 +178,7 @@ function install_smooth_slider() {
163
  $rs4 = $wpdb->query($sql);
164
  }
165
 
166
- global $default_slider;
167
 
168
  $smooth_slider = get_option('smooth_slider_options');
169
 
@@ -189,10 +204,6 @@ function install_smooth_slider() {
189
  }
190
  }
191
 
192
- /* if(is_array($img_pick) and (count($img_pick)<6 or count($img_pick)>6)) {
193
- $smooth_slider['img_pick'] = array('1',$cskey,'1','1','1','1');
194
- }
195
- */
196
  if(!$smooth_slider) {
197
  $smooth_slider = array();
198
  }
@@ -252,14 +263,21 @@ global $smooth_slider;
252
  if(isset($_POST['slider']) and !isset($_POST['slider_name'])) {
253
  $slider_id = '1';
254
  if(is_post_on_any_slider($post_id)){
255
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
256
- $wpdb->query($sql);
257
  }
258
 
259
  if(isset($_POST['slider']) and $_POST['slider'] == "slider" and !slider($post_id,$slider_id)) {
260
  $dt = date('Y-m-d H:i:s');
261
- $sql = "INSERT INTO $table_name (post_id, date, slider_id) VALUES ('$post_id', '$dt', '$slider_id')";
262
- $wpdb->query($sql);
 
 
 
 
 
 
 
 
263
  }
264
  }
265
  if(isset($_POST['slider']) and $_POST['slider'] == "slider" and isset($_POST['slider_name'])){
@@ -268,19 +286,22 @@ global $smooth_slider;
268
 
269
  foreach($post_sliders_data as $post_slider_data){
270
  if(!in_array($post_slider_data['slider_id'],$slider_id_arr)) {
271
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
272
- $wpdb->query($sql);
273
  }
274
  }
275
- /*if(is_post_on_any_slider($post_id)){
276
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
277
- $wpdb->query($sql);
278
- }*/
279
- foreach($slider_id_arr as $slider_id) {
280
  if(!slider($post_id,$slider_id)) {
281
  $dt = date('Y-m-d H:i:s');
282
- $sql = "INSERT INTO $table_name (post_id, date, slider_id) VALUES ('$post_id', '$dt', '$slider_id')";
283
- $wpdb->query($sql);
 
 
 
 
 
 
 
 
284
  }
285
  }
286
  }
@@ -294,23 +315,29 @@ global $smooth_slider;
294
  }
295
  if(isset($_POST['display_slider'])){
296
  if(!ss_post_on_slider($post_id,$slider_id)) {
297
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
298
- $wpdb->query($sql);
299
- $sql = "INSERT INTO $table_name (post_id, slider_id) VALUES ('$post_id', '$slider_id')";
300
- $wpdb->query($sql);
 
 
 
 
 
 
301
  }
302
  }
303
 
304
 
305
  $thumbnail_key = $smooth_slider['img_pick'][1];
306
  $sslider_thumbnail = get_post_meta($post_id,$thumbnail_key,true);
307
- $post_slider_thumbnail=$_POST['sslider_thumbnail'];
308
  if($sslider_thumbnail != $post_slider_thumbnail) {
309
- update_post_meta($post_id, $thumbnail_key, $_POST['sslider_thumbnail']);
310
  }
311
 
312
  $sslider_link = get_post_meta($post_id,'slide_redirect_url',true);
313
- $link=$_POST['sslider_link'];
314
  //$sldr_post=get_post($post_id);
315
  //if((!isset($link) or empty($link)) and $sldr_post->post_status == 'publish' ){$link=get_permalink($post_id);}//from 2.3.3
316
  if($sslider_link != $link) {
@@ -318,25 +345,25 @@ global $smooth_slider;
318
  }
319
 
320
  $sslider_nolink = get_post_meta($post_id,'sslider_nolink',true);
321
- $post_sslider_nolink = $_POST['sslider_nolink'];
322
  if($sslider_nolink != $post_sslider_nolink) {
323
- update_post_meta($post_id, 'sslider_nolink', $_POST['sslider_nolink']);
324
  }
325
  /* Added for embed shortcode - start */
326
  $disable_image = get_post_meta($post_id,'_disable_image',true);
327
- $post_disable_image = $_POST['disable_image'];
328
  if($disable_image != $post_disable_image ) {
329
  update_post_meta($post_id, '_disable_image', $post_disable_image );
330
  }
331
  $smooth_sslider_eshortcode = get_post_meta($post_id,'_smooth_embed_shortcode',true);
332
- $post_smooth_sslider_eshortcode = $_POST['smooth_sslider_eshortcode'];
333
  if($smooth_sslider_eshortcode != $post_smooth_sslider_eshortcode) {
334
  update_post_meta($post_id, '_smooth_embed_shortcode', $post_smooth_sslider_eshortcode);
335
  }
336
  $slider_style = get_post_meta($post_id,'_smooth_slider_style',true);
337
- $post_slider_style=$_POST['_smooth_slider_style'];
338
  if($slider_style != $post_slider_style) {
339
- update_post_meta($post_id, '_smooth_slider_style', $_POST['_smooth_slider_style']);
340
  }
341
  /* Added for embed shortcode -end */
342
 
@@ -345,40 +372,38 @@ global $smooth_slider;
345
 
346
  //Removes the post from the slider, if you uncheck the checkbox from the edit post screen
347
  function remove_from_slider($post_id) {
348
- global $wpdb, $table_prefix;
349
- $table_name = $table_prefix.SLIDER_TABLE;
 
350
 
351
- // authorization
352
- if (!current_user_can('edit_post', $post_id))
353
- return $post_id;
354
- // origination and intention
355
- if (!wp_verify_nonce($_POST['sldr-verify'], 'SmoothSlider'))
356
- return $post_id;
357
 
358
- if(empty($_POST['slider']) and is_post_on_any_slider($post_id)) {
359
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
360
- $wpdb->query($sql);
361
- }
362
 
363
- $display_slider = $_POST['display_slider'];
364
- $table_name = $table_prefix.SLIDER_POST_META;
365
- if(empty($display_slider) and ss_slider_on_this_post($post_id)){
366
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
367
- $wpdb->query($sql);
368
  }
369
  }
370
 
371
  function delete_from_slider_table($post_id){
372
- global $wpdb, $table_prefix;
373
  $table_name = $table_prefix.SLIDER_TABLE;
374
- if(is_post_on_any_slider($post_id)) {
375
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
376
- $wpdb->query($sql);
377
  }
378
  $table_name = $table_prefix.SLIDER_POST_META;
379
- if(ss_slider_on_this_post($post_id)) {
380
- $sql = "DELETE FROM $table_name where post_id = '$post_id'";
381
- $wpdb->query($sql);
382
  }
383
  }
384
 
@@ -449,7 +474,7 @@ function add_to_slider_checkbox() {
449
  $sslider_link= get_post_meta($post_id, 'slide_redirect_url', true);
450
  $sslider_nolink=get_post_meta($post_id, 'sslider_nolink', true);
451
  $thumbnail_key = $smooth_slider['img_pick'][1];
452
- $sslider_thumbnail= get_post_meta($post_id, $thumbnail_key, true);
453
  $sslider_disable_image=get_post_meta($post_id, '_disable_image', true);
454
  $smooth_embed_shortcode=get_post_meta($post_id, '_smooth_embed_shortcode', true);
455
  ?>
3
  Plugin Name: Smooth Slider
4
  Plugin URI: http://slidervilla.com/smooth-slider/
5
  Description: Smooth slider adds a responsive featured content on image slider using shortcode, widget and template tags. Create and embed featured content slider, recent post slider, category slider in less than 60 seconds.
6
+ Version: 2.7
7
  Author: SliderVilla
8
  Author URI: http://slidervilla.com/
9
  Wordpress version supported: 2.9 and above
30
  //defined global variables and constants here
31
  global $smooth_slider,$default_slider,$smooth_db_version,$default_smooth_slider_settings;
32
  $smooth_slider = get_option('smooth_slider_options');
33
+ $smooth_db_version='2.7'; //current version of smooth slider database
34
  define('SLIDER_TABLE','smooth_slider'); //Slider TABLE NAME
35
  define('PREV_SLIDER_TABLE','slider'); //Slider TABLE NAME
36
  define('SLIDER_META','smooth_slider_meta'); //Meta TABLE NAME
37
  define('SLIDER_POST_META','smooth_slider_postmeta'); //Meta TABLE NAME
38
+ define("SMOOTH_SLIDER_VER","2.7",false);//Current Version of Smooth Slider
39
  if ( ! defined( 'SMOOTH_SLIDER_PLUGIN_BASENAME' ) )
40
  define( 'SMOOTH_SLIDER_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
41
  if ( ! defined( 'SMOOTH_SLIDER_CSS_DIR' ) ){
46
  // Need to delete the previously created options in old versions and create only one option field for Smooth Slider
47
  $default_smooth_slider_settings=$default_slider = array();
48
  $default_smooth_slider_settings=$default_slider = array('speed'=>'7',
49
+ 'no_posts'=>'5',
50
+ 'bg_color'=>'#ffffff',
51
+ 'height'=>'250',
52
+ 'width'=>'450',
53
+ 'border'=>'0',
54
+ 'brcolor'=>'#dddddd',
55
+ 'prev_next'=>'0',
56
+ 'goto_slide'=>'1',
57
+ 'title_text'=>'Featured Posts',
58
+ 'title_from'=>'0',
59
+ 'title_font'=>'Georgia',
60
+ 'title_fsize'=>'20',
61
+ 'title_fstyle'=>'bold',
62
+ 'title_fcolor'=>'#000000',
63
+ 'ptitle_font'=>'Trebuchet MS',
64
+ 'ptitle_fsize'=>'14',
65
+ 'ptitle_fstyle'=>'bold',
66
+ 'ptitle_fcolor'=>'#000000',
67
+ 'img_align'=>'left',
68
+ 'img_height'=>'120',
69
+ 'img_width'=>'165',
70
+ 'img_border'=>'1',
71
+ 'img_brcolor'=>'#000000',
72
+ 'content_font'=>'Verdana',
73
+ 'content_fsize'=>'12',
74
+ 'content_fstyle'=>'normal',
75
+ 'content_fcolor'=>'#333333',
76
+ 'content_from'=>'content',
77
+ 'content_chars'=>'300',
78
+ 'bg'=>'0',
79
+ 'image_only'=>'0',
80
+ 'allowable_tags'=>'',
81
+ 'more'=>'Read More',
82
+ 'img_size'=>'1',
83
+ 'img_pick'=>array('1','slider_thumbnail','1','1','1','1'), //use custom field/key, name of the key, use post featured image, pick the image attachment, attachment order,scan images
84
+ 'user_level'=>'edit_others_posts',
85
+ 'custom_nav'=>'',
86
+ 'crop'=>'0',
87
+ 'transition'=>'5',
88
+ 'autostep'=>'1',
89
+ 'multiple_sliders'=>'1',
90
+ 'navimg_w'=>'8',
91
+ 'navimg_ht'=>'8',
92
+ 'content_limit'=>'20',
93
+ 'stylesheet'=>'default',
94
+ 'shortcode'=>'1',
95
+ 'rand'=>'0',
96
+ 'ver'=>'j',
97
+ 'fouc'=>'0',
98
+ 'fx'=>'scrollHorz',
99
+ 'css'=>'',
100
+ 'active_tab'=>'0',
101
+ 'disable_preview'=>'0',
102
+ 'preview'=>'2',
103
+ 'slider_id'=>'1',
104
+ 'catg_slug'=>'',
105
+ 'popup'=>'1',
106
+ 'readmorecolor'=>'#0092E4',
107
+ 'noscript'=>''
108
+ );
109
  // Create Text Domain For Translations
110
  load_plugin_textdomain('smooth-slider', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/');
111
 
132
  $prev_post_id = $prev_slider_row['id'];
133
  $prev_date_time = $prev_slider_row['date'];
134
  if ($prev_post_id) {
135
+ $wpdb->query(
136
+ $wpdb->prepare(
137
+ "INSERT INTO $table_name
138
+ (post_id,date)
139
+ VALUES ( %d, %s )
140
+ ",
141
+ $prev_post_id,
142
+ $prev_date_time
143
+ )
144
+ );
145
  }
146
  }
147
  }
151
  $meta_table_name = $table_prefix.SLIDER_META;
152
  if($wpdb->get_var("show tables like '$meta_table_name'") != $meta_table_name) {
153
  $sql = "CREATE TABLE $meta_table_name (
154
+ slider_id int(5) NOT NULL AUTO_INCREMENT,
155
+ slider_name varchar(100) NOT NULL default '',
156
+ UNIQUE KEY slider_id(slider_id)
157
+ );";
158
  $rs2 = $wpdb->query($sql);
159
 
160
+ $wpdb->query(
161
+ $wpdb->prepare(
162
+ "INSERT INTO $meta_table_name
163
+ (slider_id,slider_name)
164
+ VALUES ( %d, %s )",
165
+ 1,
166
+ 'Smooth Slider'
167
+ )
168
+ );
169
  }
170
 
171
  $slider_postmeta = $table_prefix.SLIDER_POST_META;
178
  $rs4 = $wpdb->query($sql);
179
  }
180
 
181
+ global $default_slider;
182
 
183
  $smooth_slider = get_option('smooth_slider_options');
184
 
204
  }
205
  }
206
 
 
 
 
 
207
  if(!$smooth_slider) {
208
  $smooth_slider = array();
209
  }
263
  if(isset($_POST['slider']) and !isset($_POST['slider_name'])) {
264
  $slider_id = '1';
265
  if(is_post_on_any_slider($post_id)){
266
+ $wpdb->delete( $table_name, array( 'post_id' => $post_id ), array( '%d' ) );
 
267
  }
268
 
269
  if(isset($_POST['slider']) and $_POST['slider'] == "slider" and !slider($post_id,$slider_id)) {
270
  $dt = date('Y-m-d H:i:s');
271
+ $wpdb->query(
272
+ $wpdb->prepare(
273
+ "INSERT INTO $table_name
274
+ (post_id, date, slider_id)
275
+ VALUES ( %d, %s, %d )",
276
+ $post_id,
277
+ $dt,
278
+ $slider_id
279
+ )
280
+ );
281
  }
282
  }
283
  if(isset($_POST['slider']) and $_POST['slider'] == "slider" and isset($_POST['slider_name'])){
286
 
287
  foreach($post_sliders_data as $post_slider_data){
288
  if(!in_array($post_slider_data['slider_id'],$slider_id_arr)) {
289
+ $wpdb->delete( $table_name, array( 'post_id' => $post_id ), array( '%d' ) );
 
290
  }
291
  }
292
+ foreach($slider_id_arr as $slider_id) {
 
 
 
 
293
  if(!slider($post_id,$slider_id)) {
294
  $dt = date('Y-m-d H:i:s');
295
+ $wpdb->query(
296
+ $wpdb->prepare(
297
+ "INSERT INTO $table_name
298
+ (post_id, date, slider_id)
299
+ VALUES ( %d, %s, %d )",
300
+ $post_id,
301
+ $dt,
302
+ $slider_id
303
+ )
304
+ );
305
  }
306
  }
307
  }
315
  }
316
  if(isset($_POST['display_slider'])){
317
  if(!ss_post_on_slider($post_id,$slider_id)) {
318
+ $wpdb->delete( $table_name, array( 'post_id' => $post_id ), array( '%d' ) );
319
+ $wpdb->query(
320
+ $wpdb->prepare(
321
+ "INSERT INTO $table_name
322
+ (post_id, slider_id)
323
+ VALUES ( %d, %d )",
324
+ $post_id,
325
+ $slider_id
326
+ )
327
+ );
328
  }
329
  }
330
 
331
 
332
  $thumbnail_key = $smooth_slider['img_pick'][1];
333
  $sslider_thumbnail = get_post_meta($post_id,$thumbnail_key,true);
334
+ $post_slider_thumbnail=isset($_POST['sslider_thumbnail'])?$_POST['sslider_thumbnail']:'';
335
  if($sslider_thumbnail != $post_slider_thumbnail) {
336
+ update_post_meta($post_id, $thumbnail_key, $post_slider_thumbnail);
337
  }
338
 
339
  $sslider_link = get_post_meta($post_id,'slide_redirect_url',true);
340
+ $link=isset($_POST['sslider_link'])?$_POST['sslider_link']:'';
341
  //$sldr_post=get_post($post_id);
342
  //if((!isset($link) or empty($link)) and $sldr_post->post_status == 'publish' ){$link=get_permalink($post_id);}//from 2.3.3
343
  if($sslider_link != $link) {
345
  }
346
 
347
  $sslider_nolink = get_post_meta($post_id,'sslider_nolink',true);
348
+ $post_sslider_nolink = isset($_POST['sslider_nolink'])?$_POST['sslider_nolink']:'';
349
  if($sslider_nolink != $post_sslider_nolink) {
350
+ update_post_meta($post_id, 'sslider_nolink', $post_sslider_nolink);
351
  }
352
  /* Added for embed shortcode - start */
353
  $disable_image = get_post_meta($post_id,'_disable_image',true);
354
+ $post_disable_image = isset($_POST['disable_image'])?$_POST['disable_image']:'';
355
  if($disable_image != $post_disable_image ) {
356
  update_post_meta($post_id, '_disable_image', $post_disable_image );
357
  }
358
  $smooth_sslider_eshortcode = get_post_meta($post_id,'_smooth_embed_shortcode',true);
359
+ $post_smooth_sslider_eshortcode = isset($_POST['smooth_sslider_eshortcode'])?$_POST['smooth_sslider_eshortcode']:'';
360
  if($smooth_sslider_eshortcode != $post_smooth_sslider_eshortcode) {
361
  update_post_meta($post_id, '_smooth_embed_shortcode', $post_smooth_sslider_eshortcode);
362
  }
363
  $slider_style = get_post_meta($post_id,'_smooth_slider_style',true);
364
+ $post_slider_style=isset($_POST['_smooth_slider_style'])?$_POST['_smooth_slider_style']:'';
365
  if($slider_style != $post_slider_style) {
366
+ update_post_meta($post_id, '_smooth_slider_style', $post_slider_style);
367
  }
368
  /* Added for embed shortcode -end */
369
 
372
 
373
  //Removes the post from the slider, if you uncheck the checkbox from the edit post screen
374
  function remove_from_slider($post_id) {
375
+ if(isset($_POST['sldr-verify'])) {
376
+ global $wpdb, $table_prefix;
377
+ $table_name = $table_prefix.SLIDER_TABLE;
378
 
379
+ // authorization
380
+ if (!current_user_can('edit_post', $post_id))
381
+ return $post_id;
382
+ // origination and intention
383
+ if (!wp_verify_nonce($_POST['sldr-verify'], 'SmoothSlider'))
384
+ return $post_id;
385
 
386
+ if(isset($_POST['slider']) and empty($_POST['slider']) and is_post_on_any_slider($post_id)) {
387
+ $wpdb->delete( $table_name, array( 'post_id' => $post_id ), array( '%d' ) );
388
+ }
 
389
 
390
+ $display_slider = isset($_POST['display_slider'])?$_POST['display_slider']:'';
391
+ $table_name = $table_prefix.SLIDER_POST_META;
392
+ if(empty($display_slider) and ss_slider_on_this_post($post_id)){
393
+ $wpdb->delete( $table_name, array( 'post_id' => $post_id ), array( '%d' ) );
394
+ }
395
  }
396
  }
397
 
398
  function delete_from_slider_table($post_id){
399
+ global $wpdb, $table_prefix;
400
  $table_name = $table_prefix.SLIDER_TABLE;
401
+ if(is_post_on_any_slider($post_id)) {
402
+ $wpdb->delete( $table_name, array( 'post_id' => $post_id ), array( '%d' ) );
 
403
  }
404
  $table_name = $table_prefix.SLIDER_POST_META;
405
+ if(ss_slider_on_this_post($post_id)) {
406
+ $wpdb->delete( $table_name, array( 'post_id' => $post_id ), array( '%d' ) );
 
407
  }
408
  }
409
 
474
  $sslider_link= get_post_meta($post_id, 'slide_redirect_url', true);
475
  $sslider_nolink=get_post_meta($post_id, 'sslider_nolink', true);
476
  $thumbnail_key = $smooth_slider['img_pick'][1];
477
+ $sslider_thumbnail= get_post_meta($post_id, $thumbnail_key, true);
478
  $sslider_disable_image=get_post_meta($post_id, '_disable_image', true);
479
  $smooth_embed_shortcode=get_post_meta($post_id, '_smooth_embed_shortcode', true);
480
  ?>