Crelly Slider - Version 0.7.0

Version Description

  • Fixed "Error saving elements" if there are no elements
Download this release

Release Info

Developer fabiorino
Plugin Icon 128x128 Crelly Slider
Version 0.7.0
Comparing to
See all releases

Code changes from version 0.6.9 to 0.7.0

crellyslider.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Crelly Slider
5
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
6
  * Description: The first free WordPress slider with elements animations.
7
- * Version: 0.6.9
8
  * Author: fabiorino
9
  * Author URI: http://fabiorino1.altervista.org
10
  * License: GPL2
@@ -14,7 +14,7 @@
14
  /** GLOBALS **/
15
  /*************/
16
 
17
- define('CS_VERSION', '0.6.9');
18
  define('CS_PATH', plugin_dir_path(__FILE__));
19
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
20
 
4
  * Plugin Name: Crelly Slider
5
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
6
  * Description: The first free WordPress slider with elements animations.
7
+ * Version: 0.7.0
8
  * Author: fabiorino
9
  * Author URI: http://fabiorino1.altervista.org
10
  * License: GPL2
14
  /** GLOBALS **/
15
  /*************/
16
 
17
+ define('CS_VERSION', '0.7.0');
18
  define('CS_PATH', plugin_dir_path(__FILE__));
19
  define('CS_PLUGIN_URL', plugins_url() . '/crelly-slider');
20
 
js/jquery.crellyslider.js CHANGED
@@ -2,7 +2,7 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
4
  * Description: The first free WordPress slider with elements animations.
5
- * Version: 0.6.9
6
  * Author: fabiorino
7
  * Author URI: http://fabiorino1.altervista.org
8
  * License: GPL2
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
4
  * Description: The first free WordPress slider with elements animations.
5
+ * Version: 0.7.0
6
  * Author: fabiorino
7
  * Author URI: http://fabiorino1.altervista.org
8
  * License: GPL2
js/jquery.crellyslider.min.js CHANGED
@@ -2,7 +2,7 @@
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
4
  * Description: The first free WordPress slider with elements animations.
5
- * Version: 0.6.9
6
  * Author: fabiorino
7
  * Author URI: http://fabiorino1.altervista.org
8
  * License: GPL2
2
  * Plugin Name: Crelly Slider
3
  * Plugin URI: http://fabiorino1.altervista.org/projects/crellyslider
4
  * Description: The first free WordPress slider with elements animations.
5
+ * Version: 0.7.0
6
  * Author: fabiorino
7
  * Author URI: http://fabiorino1.altervista.org
8
  * License: GPL2
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://fabiorino1.altervista.org/projects/crellyslider/contribute-a
4
  Tags: slider, slides, animations, drag & drop, drag and drop, layers, elements
5
  Requires at least: 3.6.0
6
  Tested up to: 4.0
7
- Stable tag: 0.6.9
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -51,9 +51,13 @@ You can find the documentation <a href="http://fabiorino1.altervista.org/project
51
 
52
  1. An example of a slide you can create
53
  2. The slider back-end interface
 
54
 
55
  == Changelog ==
56
 
 
 
 
57
  = 0.6.9 =
58
  * Added the possibility to insert links in images and texts
59
  * Added slider preloader (with a gif image)
4
  Tags: slider, slides, animations, drag & drop, drag and drop, layers, elements
5
  Requires at least: 3.6.0
6
  Tested up to: 4.0
7
+ Stable tag: 0.7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
51
 
52
  1. An example of a slide you can create
53
  2. The slider back-end interface
54
+ 3. Unlimited sliders
55
 
56
  == Changelog ==
57
 
58
+ = 0.7.0 =
59
+ * Fixed "Error saving elements" if there are no elements
60
+
61
  = 0.6.9 =
62
  * Added the possibility to insert links in images and texts
63
  * Added slider preloader (with a gif image)
wordpress/admin.php CHANGED
@@ -240,6 +240,7 @@ class CrellySliderAdmin {
240
  $crellyslider_translations = array(
241
  'slide' => __('Slide', 'crellyslider'),
242
  'slide_delete_confirm' => __('The slide will be deleted. Are you sure?', 'crellyslider'),
 
243
  'slider_delete_confirm' => __('The slider will be deleted. Are you sure?', 'crellyslider'),
244
  'text_element_default_html' => __('Text element', 'crellyslider'),
245
  'slide_live_preview' => __('Live preview', 'crellyslider'),
240
  $crellyslider_translations = array(
241
  'slide' => __('Slide', 'crellyslider'),
242
  'slide_delete_confirm' => __('The slide will be deleted. Are you sure?', 'crellyslider'),
243
+ 'slide_delete_just_one' => __('You can delete this. You must have at least one slide', 'crellyslider'),
244
  'slider_delete_confirm' => __('The slider will be deleted. Are you sure?', 'crellyslider'),
245
  'text_element_default_html' => __('Text element', 'crellyslider'),
246
  'slide_live_preview' => __('Live preview', 'crellyslider'),
wordpress/ajax.php CHANGED
@@ -169,68 +169,79 @@ function crellyslider_editElements_callback() {
169
  $options = $_POST['datas'];
170
  $table_name = $wpdb->prefix . 'crellyslider_elements';
171
 
172
- // Remove all the old elements
173
- $wpdb->delete($table_name, array('slider_parent' => $options[0]['slider_parent']), array('%d'));
174
-
175
- // Insert row per row
176
  $output = true;
177
- foreach($options as $option) {
178
- $output = $wpdb->insert(
179
- $table_name,
180
- array(
181
- 'slider_parent' => $option['slider_parent'],
182
- 'slide_parent' => $option['slide_parent'],
183
- 'position' => $option['position'],
184
- 'type' => $option['type'],
185
- 'inner_html' => $option['inner_html'],
186
- 'image_src' => $option['image_src'],
187
- 'image_alt' => $option['image_alt'],
188
- 'data_left' => $option['data_left'],
189
- 'data_top' => $option['data_top'],
190
- 'z_index' => $option['z_index'],
191
- 'data_delay' => $option['data_delay'],
192
- 'data_time' => $option['data_time'],
193
- 'data_in' => $option['data_in'],
194
- 'data_out' => $option['data_out'],
195
- 'data_easeIn' => $option['data_easeIn'],
196
- 'data_easeOut' => $option['data_easeOut'],
197
- 'custom_css' => $option['custom_css'],
198
- 'link' => $option['link'],
199
- 'link_new_tab' => $option['link_new_tab'],
200
- ),
201
- array(
202
- '%d',
203
- '%d',
204
- '%d',
205
- '%s',
206
- '%s',
207
- '%s',
208
- '%s',
209
- '%d',
210
- '%d',
211
- '%d',
212
- '%d',
213
- '%s',
214
- '%s',
215
- '%s',
216
- '%d',
217
- '%d',
218
- '%s',
219
- '%s',
220
- '%d',
221
- )
222
- );
223
-
224
- if($output === false) {
225
- break;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  }
227
  }
228
 
229
- // Returning
230
- $output = json_encode($output);
231
- if(is_array($output)) print_r($output);
232
- else echo $output;
233
-
234
  die();
235
  }
236
 
169
  $options = $_POST['datas'];
170
  $table_name = $wpdb->prefix . 'crellyslider_elements';
171
 
 
 
 
 
172
  $output = true;
173
+
174
+ // Remove all the old elements
175
+ $output = $wpdb->delete($table_name, array('slider_parent' => $options['slider_parent']), array('%d'));
176
+ if($output === false) {
177
+ echo json_encode(false);
178
+ }
179
+ else {
180
+ // No elements
181
+ if($options['elements'] == 0) {
182
+ echo json_encode(true);
183
+ }
184
+ else {
185
+ // Insert row per row
186
+ foreach($options['options'] as $option) {
187
+ $output = $wpdb->insert(
188
+ $table_name,
189
+ array(
190
+ 'slider_parent' => $options['slider_parent'],
191
+ 'slide_parent' => $option['slide_parent'],
192
+ 'position' => $option['position'],
193
+ 'type' => $option['type'],
194
+ 'inner_html' => $option['inner_html'],
195
+ 'image_src' => $option['image_src'],
196
+ 'image_alt' => $option['image_alt'],
197
+ 'data_left' => $option['data_left'],
198
+ 'data_top' => $option['data_top'],
199
+ 'z_index' => $option['z_index'],
200
+ 'data_delay' => $option['data_delay'],
201
+ 'data_time' => $option['data_time'],
202
+ 'data_in' => $option['data_in'],
203
+ 'data_out' => $option['data_out'],
204
+ 'data_easeIn' => $option['data_easeIn'],
205
+ 'data_easeOut' => $option['data_easeOut'],
206
+ 'custom_css' => $option['custom_css'],
207
+ 'link' => $option['link'],
208
+ 'link_new_tab' => $option['link_new_tab'],
209
+ ),
210
+ array(
211
+ '%d',
212
+ '%d',
213
+ '%d',
214
+ '%s',
215
+ '%s',
216
+ '%s',
217
+ '%s',
218
+ '%d',
219
+ '%d',
220
+ '%d',
221
+ '%d',
222
+ '%s',
223
+ '%s',
224
+ '%s',
225
+ '%d',
226
+ '%d',
227
+ '%s',
228
+ '%s',
229
+ '%d',
230
+ )
231
+ );
232
+
233
+ if($output === false) {
234
+ break;
235
+ }
236
+ }
237
+
238
+ // Returning
239
+ $output = json_encode($output);
240
+ if(is_array($output)) print_r($output);
241
+ else echo $output;
242
  }
243
  }
244
 
 
 
 
 
 
245
  die();
246
  }
247
 
wordpress/js/admin.js CHANGED
@@ -196,6 +196,11 @@
196
 
197
  // Delete
198
  $('.cs-admin #cs-slides .cs-slide-tabs ul li .cs-close').live('click', function() {
 
 
 
 
 
199
  var confirm = window.confirm(crellyslider_translations.slide_delete_confirm);
200
  if(!confirm) {
201
  return;
@@ -1027,8 +1032,9 @@
1027
  function crellyslider_saveElements() {
1028
  var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1029
  var i = 0, j = 0;
1030
- var final_options = new Array();
1031
 
 
1032
  slides.each(function() {
1033
  var slide = $(this);
1034
  var elements = slide.find('.cs-elements .cs-element-settings');
@@ -1042,7 +1048,6 @@
1042
  }
1043
 
1044
  var options = {
1045
- slider_parent : parseInt($('.cs-admin .cs-save-settings').data('id')),
1046
  slide_parent : i,
1047
  position : element.index(),
1048
  type : element.hasClass('cs-text-element-settings') ? 'text' : element.hasClass('cs-image-element-settings') ? 'image' : '',
@@ -1064,9 +1069,7 @@
1064
  link_new_tab : element.find('.cs-element-link_new_tab').prop('checked') ? 1 : 0,
1065
  };
1066
 
1067
- final_options[j] = options;
1068
-
1069
- //console.log(final_options[j]);
1070
 
1071
  j++;
1072
  });
@@ -1074,6 +1077,14 @@
1074
  i++;
1075
  });
1076
 
 
 
 
 
 
 
 
 
1077
  // Do the ajax call
1078
  jQuery.ajax({
1079
  type : 'POST',
196
 
197
  // Delete
198
  $('.cs-admin #cs-slides .cs-slide-tabs ul li .cs-close').live('click', function() {
199
+ if($('.cs-admin #cs-slides .cs-slide-tabs ul li').length <= 2) {
200
+ alert(crellyslider_translations.slide_delete_just_one);
201
+ return;
202
+ }
203
+
204
  var confirm = window.confirm(crellyslider_translations.slide_delete_confirm);
205
  if(!confirm) {
206
  return;
1032
  function crellyslider_saveElements() {
1033
  var slides = $('.cs-admin .cs-slider #cs-slides .cs-slide');
1034
  var i = 0, j = 0;
1035
+ var final_options = {};
1036
 
1037
+ final_options['options'] = new Array();
1038
  slides.each(function() {
1039
  var slide = $(this);
1040
  var elements = slide.find('.cs-elements .cs-element-settings');
1048
  }
1049
 
1050
  var options = {
 
1051
  slide_parent : i,
1052
  position : element.index(),
1053
  type : element.hasClass('cs-text-element-settings') ? 'text' : element.hasClass('cs-image-element-settings') ? 'image' : '',
1069
  link_new_tab : element.find('.cs-element-link_new_tab').prop('checked') ? 1 : 0,
1070
  };
1071
 
1072
+ final_options['options'][j] = options;
 
 
1073
 
1074
  j++;
1075
  });
1077
  i++;
1078
  });
1079
 
1080
+ // Proceed?
1081
+ final_options['elements'] = 1;
1082
+ if(final_options['options'].length == 0) {
1083
+ final_options['elements'] = 0;
1084
+ }
1085
+
1086
+ final_options['slider_parent'] = parseInt($('.cs-admin .cs-save-settings').data('id'));
1087
+
1088
  // Do the ajax call
1089
  jQuery.ajax({
1090
  type : 'POST',