Version Description
Download this release
Release Info
Developer | averta |
Plugin | Master Slider – Responsive Touch Slider |
Version | 2.6.0 |
Comparing to | |
See all releases |
Code changes from version 2.5.1 to 2.6.0
- README.txt +5 -3
- includes/classes/class-msp-db.php +74 -72
- includes/init/define.php +1 -1
- master-slider.php +1 -1
README.txt
CHANGED
@@ -6,7 +6,7 @@ License URI: http://www.gnu.org/licenses/gpl.html
|
|
6 |
Tags: banner rotator, carousel, content slider, gallery, image slider, responsive slider, showcase, slideshow, swipe, touch slider, video gallery, SEO, vertical slide, HTML5 slider, hardware accelerate, best slider, animation, mobile slider, iOS, android, video slider, youtube slider, horizontal slider, vertical slider, fullwidth slider, fullscreen slider, post slider, photo slider, online album, mobile slider, WordPress slider,wpml, ,ultisite, wistia, woocommerce, product slider, woocommerce slider, portfolio, gallery
|
7 |
Requires at least: 4.0
|
8 |
Tested up to: 4.2.2
|
9 |
-
Stable tag: 2.
|
10 |
|
11 |
The most advanced responsive and HTML5 WordPress slider plugin with touch swipe navigation that works smoothly on desktop and devices.
|
12 |
|
@@ -225,6 +225,8 @@ Bugs can be reported in our [support forums](http://wordpress.org/tags/master-sl
|
|
225 |
11. Flexible slider controls
|
226 |
|
227 |
|
|
|
|
|
228 |
|
229 |
= Version 2.5.1 / (12.7.2015) =
|
230 |
- [New]: Plugin thumbnail changed.
|
@@ -383,5 +385,5 @@ Bugs can be reported in our [support forums](http://wordpress.org/tags/master-sl
|
|
383 |
|
384 |
== Upgrade Notice ==
|
385 |
|
386 |
-
= 2.
|
387 |
-
- [
|
6 |
Tags: banner rotator, carousel, content slider, gallery, image slider, responsive slider, showcase, slideshow, swipe, touch slider, video gallery, SEO, vertical slide, HTML5 slider, hardware accelerate, best slider, animation, mobile slider, iOS, android, video slider, youtube slider, horizontal slider, vertical slider, fullwidth slider, fullscreen slider, post slider, photo slider, online album, mobile slider, WordPress slider,wpml, ,ultisite, wistia, woocommerce, product slider, woocommerce slider, portfolio, gallery
|
7 |
Requires at least: 4.0
|
8 |
Tested up to: 4.2.2
|
9 |
+
Stable tag: 2.6.0
|
10 |
|
11 |
The most advanced responsive and HTML5 WordPress slider plugin with touch swipe navigation that works smoothly on desktop and devices.
|
12 |
|
225 |
11. Flexible slider controls
|
226 |
|
227 |
|
228 |
+
= Version 2.6.0 / (23.8.2015) =
|
229 |
+
- [Fix]: Security improvement.
|
230 |
|
231 |
= Version 2.5.1 / (12.7.2015) =
|
232 |
- [New]: Plugin thumbnail changed.
|
385 |
|
386 |
== Upgrade Notice ==
|
387 |
|
388 |
+
= 2.6.0 =
|
389 |
+
- [Fix]: Security improvement.
|
includes/classes/class-msp-db.php
CHANGED
@@ -45,7 +45,7 @@ class MSP_DB {
|
|
45 |
*/
|
46 |
var $last_query;
|
47 |
|
48 |
-
|
49 |
/**
|
50 |
* Results of the last query made
|
51 |
*
|
@@ -88,7 +88,7 @@ class MSP_DB {
|
|
88 |
|
89 |
|
90 |
/**
|
91 |
-
*
|
92 |
*/
|
93 |
public function __construct() {
|
94 |
|
@@ -97,12 +97,12 @@ class MSP_DB {
|
|
97 |
$this->update_tables();
|
98 |
add_filter( 'wpmu_drop_tables', array( $this, 'wpmu_drop_tables' ), 11, 2 );
|
99 |
}
|
100 |
-
|
101 |
}
|
102 |
|
103 |
/**
|
104 |
* Get known properties
|
105 |
-
*
|
106 |
* @param string property name
|
107 |
* @return string property value
|
108 |
*/
|
@@ -119,7 +119,7 @@ class MSP_DB {
|
|
119 |
|
120 |
foreach ( $this->tabel_names as $table_name )
|
121 |
$tables[ $table_name ] = $wpdb->prefix . 'masterslider_' . $table_name;
|
122 |
-
|
123 |
return $tables;
|
124 |
|
125 |
} else {
|
@@ -129,7 +129,7 @@ class MSP_DB {
|
|
129 |
|
130 |
/**
|
131 |
* Create master slider sliders table
|
132 |
-
*
|
133 |
* @since 1.0
|
134 |
* @return null
|
135 |
*/
|
@@ -149,7 +149,7 @@ class MSP_DB {
|
|
149 |
PRIMARY KEY (ID),
|
150 |
KEY date_created (date_created)
|
151 |
) {$this->charset_collate};";
|
152 |
-
|
153 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
154 |
dbDelta( $sql_create_table );
|
155 |
}
|
@@ -157,7 +157,7 @@ class MSP_DB {
|
|
157 |
|
158 |
/**
|
159 |
* Create master slider options table
|
160 |
-
*
|
161 |
* @since 1.0
|
162 |
* @return null
|
163 |
*/
|
@@ -170,7 +170,7 @@ class MSP_DB {
|
|
170 |
PRIMARY KEY (ID),
|
171 |
UNIQUE KEY option_name (option_name)
|
172 |
) $this->charset_collate; ";
|
173 |
-
|
174 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
175 |
dbDelta( $sql_create_table );
|
176 |
}
|
@@ -180,7 +180,7 @@ class MSP_DB {
|
|
180 |
* Create master slider tables
|
181 |
*
|
182 |
* Should be invoked on plugin activation
|
183 |
-
*
|
184 |
* @since 1.0
|
185 |
* @return null
|
186 |
*/
|
@@ -209,7 +209,7 @@ class MSP_DB {
|
|
209 |
|
210 |
/**
|
211 |
* Updates masterslider tables if update is required
|
212 |
-
*
|
213 |
* @since 1.0
|
214 |
* @return bool is any update required for tabels?
|
215 |
*/
|
@@ -217,7 +217,7 @@ class MSP_DB {
|
|
217 |
// check if the tables need update
|
218 |
if( get_option( 'masterslider_db_version', '0' ) == self::DB_VERSION )
|
219 |
return false;
|
220 |
-
|
221 |
$this->create_tables();
|
222 |
|
223 |
do_action( 'masterslider_tables_updated', $this->tables );
|
@@ -227,7 +227,7 @@ class MSP_DB {
|
|
227 |
|
228 |
/**
|
229 |
* Drop all master slider tables
|
230 |
-
*
|
231 |
* @since 1.0
|
232 |
* @return null
|
233 |
*/
|
@@ -242,7 +242,7 @@ class MSP_DB {
|
|
242 |
|
243 |
/**
|
244 |
* Filter Masterslider tables to drop when the blog is deleted
|
245 |
-
*
|
246 |
* @since 1.8
|
247 |
* @return null
|
248 |
*/
|
@@ -259,20 +259,20 @@ class MSP_DB {
|
|
259 |
|
260 |
/**
|
261 |
* Adds new slider in sliders table
|
262 |
-
*
|
263 |
-
* @param array $fields array of fields for sliders table
|
264 |
-
* @example array( 'title' => '', 'type' => '', 'skin' => '', 'template' => '',
|
265 |
-
* 'common_params' => array(), 'special_params' => array(),
|
266 |
* 'panel_data' => '', 'is_active' => 1 );
|
267 |
-
*
|
268 |
* @return int|false ID number for new inserted row or false if the row could not be inserted.
|
269 |
*/
|
270 |
public function add_slider($fields = array() ) {
|
271 |
global $wpdb;
|
272 |
|
273 |
// default fields in sliders table
|
274 |
-
$defaults = array(
|
275 |
-
'title' => 'Untitled Slider',
|
276 |
'type' => '', // custom, flickr, instagram, facebook, post
|
277 |
'slides_num' => 0,
|
278 |
'date_created' => '',
|
@@ -312,13 +312,13 @@ class MSP_DB {
|
|
312 |
|
313 |
/**
|
314 |
* Updates a slider data in sliders table
|
315 |
-
*
|
316 |
* @param int $slider_id the slider id that is going to be updated
|
317 |
* @param array $fields array of fields in sliders table that needs to be updated
|
318 |
* @param array|string (optional) An array of formats to be mapped to each of the values in $fields
|
319 |
-
* @example array( 'title' => '', 'type' => '', 'custom_styles' => array(), 'custom_fonts' => array(),
|
320 |
* 'params' => '', 'status' => 'published' );
|
321 |
-
*
|
322 |
* @return int|false The number of rows updated, or false on error.
|
323 |
*/
|
324 |
public function update_slider($slider_id, $fields, $format = null ) {
|
@@ -333,7 +333,7 @@ class MSP_DB {
|
|
333 |
}
|
334 |
|
335 |
// default required field while updating
|
336 |
-
$defaults = array(
|
337 |
'date_modified' => ''
|
338 |
);
|
339 |
|
@@ -360,7 +360,7 @@ class MSP_DB {
|
|
360 |
|
361 |
/**
|
362 |
* Remove a specific slider data from sliders table
|
363 |
-
*
|
364 |
* @param int $slider_id The ID of the slider you'd like to be removed
|
365 |
* @return bool returns true on success or false on error
|
366 |
*/
|
@@ -371,8 +371,8 @@ class MSP_DB {
|
|
371 |
return false;
|
372 |
}
|
373 |
|
374 |
-
return $wpdb->delete(
|
375 |
-
$this->sliders,
|
376 |
array( 'ID' => (int)$slider_id ),
|
377 |
array( '%d' )
|
378 |
);
|
@@ -381,7 +381,7 @@ class MSP_DB {
|
|
381 |
|
382 |
/**
|
383 |
* Get slider data by slider id from slider table (for single )
|
384 |
-
*
|
385 |
* @param int $slider_id The ID of the slider you'd like to get the content
|
386 |
* @return array|null slider data in array or null if no result found
|
387 |
*/
|
@@ -401,16 +401,16 @@ class MSP_DB {
|
|
401 |
|
402 |
/**
|
403 |
* Duplicate a slider in new row
|
404 |
-
*
|
405 |
* @param int $slider_id The ID of the slider you'd like to duplicate
|
406 |
* @return bool true on success and false on failure
|
407 |
*/
|
408 |
public function duplicate_slider( $slider_id ) {
|
409 |
-
|
410 |
if( ! $fields = $this->get_slider($slider_id) )
|
411 |
return false;
|
412 |
|
413 |
-
$fields['title'] = $this->duplicate_title( $fields['title'] );
|
414 |
|
415 |
return (bool) $this->add_slider($fields);
|
416 |
}
|
@@ -418,25 +418,25 @@ class MSP_DB {
|
|
418 |
|
419 |
/**
|
420 |
* Add new slider with preset data
|
421 |
-
*
|
422 |
* @param string $slider_params The slider panel data
|
423 |
* @param string $slider_title The slider title
|
424 |
* @return int|false ID number for new inserted row or false if the row could not be inserted.
|
425 |
*/
|
426 |
public function import_slider( $fields = array() ) {
|
427 |
-
|
428 |
if( ! isset( $fields['title'] ) || empty( $fields['title'] ) )
|
429 |
-
$fields['title'] = 'Untitled Slider';
|
430 |
-
|
431 |
$fields['title'] = $this->duplicate_title( $fields['title'] );
|
432 |
-
|
433 |
return $this->add_slider( $fields );
|
434 |
}
|
435 |
|
436 |
|
437 |
/**
|
438 |
* Get the value of a single field for a spesific slider
|
439 |
-
*
|
440 |
* @param int $slider_id The ID of the slider you'd like to get value of its field
|
441 |
* @param string $field_name The field name in slider table to get value from
|
442 |
* @return string|null field value or null if no result found
|
@@ -456,9 +456,9 @@ class MSP_DB {
|
|
456 |
|
457 |
|
458 |
/**
|
459 |
-
* Get an array containing row results (serialized) from sliders table
|
460 |
-
*
|
461 |
-
* @param int $args The query args
|
462 |
* @return array|null Sliders data in an array or null if no result found
|
463 |
*/
|
464 |
public function ms_query( $args = array() ) {
|
@@ -483,36 +483,38 @@ class MSP_DB {
|
|
483 |
$offset_num = (int) $args['offset'];
|
484 |
|
485 |
// remove limit if limit number is set to 0
|
486 |
-
$limit = ( 1 > $limit_num ) ? '' : 'LIMIT '. $limit_num;
|
487 |
|
488 |
// remove offect if offset number is set to 0
|
489 |
-
$offset = ( 0 == $offset_num )? '' : 'OFFSET '. $offset_num;
|
490 |
|
491 |
// add LIKE if defined
|
492 |
-
$like = empty( $args['like'] ) ? '' : 'LIKE '. $args['like'];
|
493 |
|
494 |
-
$where = empty( $args['where'] ) ? '' : 'WHERE '. $args['where'];
|
495 |
|
496 |
// sanitize sort type
|
497 |
$order = strtolower( $args['order'] ) === 'desc' ? 'DESC' : 'ASC';
|
498 |
-
$
|
|
|
|
|
499 |
|
500 |
$sql = "
|
501 |
SELECT *
|
502 |
FROM {$this->sliders}
|
503 |
$where
|
504 |
-
ORDER BY $
|
505 |
-
$limit
|
506 |
$offset
|
507 |
";
|
508 |
-
|
509 |
return $wpdb->get_results( $sql, ARRAY_A );
|
510 |
}
|
511 |
|
512 |
|
513 |
/**
|
514 |
-
* Get an array containing row results (serialized) from sliders table
|
515 |
-
*
|
516 |
* @param int $perpage Maximum number of rows to return - 0 means no limit
|
517 |
* @param int $offset The offset of the first row to return
|
518 |
* @param string $orderby The field name to order results by
|
@@ -530,15 +532,15 @@ class MSP_DB {
|
|
530 |
'order' => $order,
|
531 |
'where' => $where
|
532 |
);
|
533 |
-
|
534 |
return $this->ms_query( $args );
|
535 |
}
|
536 |
|
537 |
-
|
538 |
|
539 |
/**
|
540 |
* Get an array containing row results (unserialized) from sliders table (with all slider table fields)
|
541 |
-
*
|
542 |
* @param int $perpage Maximum number of rows to return
|
543 |
* @param int $offset The offset of the first row to return
|
544 |
* @param string $orderby The field name to order results by
|
@@ -547,7 +549,7 @@ class MSP_DB {
|
|
547 |
* @return array|null Slider data in array or null if no result found
|
548 |
*/
|
549 |
public function get_sliders( $perpage = 0, $offset = 0, $orderby = 'ID', $sort = 'DESC', $where = "status='published'" ) {
|
550 |
-
|
551 |
// pull mulitple row results from sliders table
|
552 |
if( ! $results = $this->get_sliders_list( $perpage, $offset, $orderby, $sort, $where ) ){
|
553 |
return;
|
@@ -564,12 +566,12 @@ class MSP_DB {
|
|
564 |
|
565 |
/**
|
566 |
* Get total number of sliders from sliders table
|
567 |
-
*
|
568 |
* @return int|null total number of sliders or null on failure
|
569 |
*/
|
570 |
public function get_total_sliders_count( $where = "status='published'" ) {
|
571 |
global $wpdb;
|
572 |
-
|
573 |
$result = $wpdb->get_results( "SELECT count(ID) AS total FROM {$this->sliders} WHERE {$where} ", ARRAY_A );
|
574 |
return $result ? (int)$result[0]['total'] : null;
|
575 |
}
|
@@ -582,10 +584,10 @@ class MSP_DB {
|
|
582 |
|
583 |
/**
|
584 |
* Insert option data in new record in options table
|
585 |
-
*
|
586 |
* @param string $option_name a unique name for option
|
587 |
* @param string $option_value the option value
|
588 |
-
*
|
589 |
* @return bool False if option was not added and true if option was added.
|
590 |
*/
|
591 |
public function add_option( $option_name, $option_value = '' ) {
|
@@ -603,7 +605,7 @@ class MSP_DB {
|
|
603 |
// serialize the option value
|
604 |
$option_value = maybe_serialize( $option_value );
|
605 |
|
606 |
-
$fields = array(
|
607 |
'option_name' => $option_name,
|
608 |
'option_value' => $option_value
|
609 |
);
|
@@ -632,7 +634,7 @@ class MSP_DB {
|
|
632 |
|
633 |
/**
|
634 |
* Get option value
|
635 |
-
*
|
636 |
* @param string $option_name a unique name for option
|
637 |
* @param string $default_value a value to return by function if option_value not found
|
638 |
* @return string option_value or default_value
|
@@ -659,7 +661,7 @@ class MSP_DB {
|
|
659 |
$serialized_value = maybe_serialize( $value );
|
660 |
wp_cache_set( $option_name, $serialized_value, 'masterslider' );
|
661 |
}
|
662 |
-
|
663 |
return maybe_unserialize( $value );
|
664 |
}
|
665 |
|
@@ -667,10 +669,10 @@ class MSP_DB {
|
|
667 |
|
668 |
/**
|
669 |
* Update option value in options table, if option_name does not exist then insert new option
|
670 |
-
*
|
671 |
* @param string $option_name a unique name for option
|
672 |
* @param string $option_value the option value
|
673 |
-
*
|
674 |
* @return int|false ID number for new inserted row or false if the option can not be updated.
|
675 |
*/
|
676 |
public function update_option( $option_name, $option_value = '' ) {
|
@@ -688,13 +690,13 @@ class MSP_DB {
|
|
688 |
$old_value = $this->get_option( $option_name );
|
689 |
|
690 |
$option_value = apply_filters( 'msp_pre_update_option_' . $option_name, $option_value, $old_value );
|
691 |
-
|
692 |
// If the new and old values are the same, no need to update.
|
693 |
if ( $option_value === $old_value )
|
694 |
return false; // 'has same value';
|
695 |
-
|
696 |
$option_value = maybe_serialize( $option_value );
|
697 |
-
|
698 |
|
699 |
$result = $wpdb->update( $this->options, array( 'option_value' => $option_value ), array( 'option_name' => $option_name ) );
|
700 |
if ( ! $result ) {
|
@@ -709,7 +711,7 @@ class MSP_DB {
|
|
709 |
|
710 |
/**
|
711 |
* Remove a specific option name from options table
|
712 |
-
*
|
713 |
* @param string $option_name a unique name for option
|
714 |
* @return bool True, if option is successfully deleted. False on failure.
|
715 |
*/
|
@@ -721,8 +723,8 @@ class MSP_DB {
|
|
721 |
return false;
|
722 |
}
|
723 |
|
724 |
-
$result = $wpdb->delete(
|
725 |
-
$this->options,
|
726 |
array( 'option_name' => $option_name ),
|
727 |
array( '%s' )
|
728 |
);
|
@@ -769,7 +771,7 @@ class MSP_DB {
|
|
769 |
* Insert a row into a table.
|
770 |
* @param array $fields array of fields and values to insert
|
771 |
* @param array $defaults array of default fields value to insert if field value is not set
|
772 |
-
*
|
773 |
* @return int|false ID number for new inserted row or false if the row could not be inserted.
|
774 |
*/
|
775 |
public function insert( $table_name, $fields = array(), $defaults = array(), $format = NULL ) {
|
@@ -817,4 +819,4 @@ class MSP_DB {
|
|
817 |
}
|
818 |
|
819 |
global $mspdb;
|
820 |
-
if( is_null( $mspdb ) ) $mspdb = new MSP_DB();
|
45 |
*/
|
46 |
var $last_query;
|
47 |
|
48 |
+
|
49 |
/**
|
50 |
* Results of the last query made
|
51 |
*
|
88 |
|
89 |
|
90 |
/**
|
91 |
+
*
|
92 |
*/
|
93 |
public function __construct() {
|
94 |
|
97 |
$this->update_tables();
|
98 |
add_filter( 'wpmu_drop_tables', array( $this, 'wpmu_drop_tables' ), 11, 2 );
|
99 |
}
|
100 |
+
|
101 |
}
|
102 |
|
103 |
/**
|
104 |
* Get known properties
|
105 |
+
*
|
106 |
* @param string property name
|
107 |
* @return string property value
|
108 |
*/
|
119 |
|
120 |
foreach ( $this->tabel_names as $table_name )
|
121 |
$tables[ $table_name ] = $wpdb->prefix . 'masterslider_' . $table_name;
|
122 |
+
|
123 |
return $tables;
|
124 |
|
125 |
} else {
|
129 |
|
130 |
/**
|
131 |
* Create master slider sliders table
|
132 |
+
*
|
133 |
* @since 1.0
|
134 |
* @return null
|
135 |
*/
|
149 |
PRIMARY KEY (ID),
|
150 |
KEY date_created (date_created)
|
151 |
) {$this->charset_collate};";
|
152 |
+
|
153 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
154 |
dbDelta( $sql_create_table );
|
155 |
}
|
157 |
|
158 |
/**
|
159 |
* Create master slider options table
|
160 |
+
*
|
161 |
* @since 1.0
|
162 |
* @return null
|
163 |
*/
|
170 |
PRIMARY KEY (ID),
|
171 |
UNIQUE KEY option_name (option_name)
|
172 |
) $this->charset_collate; ";
|
173 |
+
|
174 |
require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
|
175 |
dbDelta( $sql_create_table );
|
176 |
}
|
180 |
* Create master slider tables
|
181 |
*
|
182 |
* Should be invoked on plugin activation
|
183 |
+
*
|
184 |
* @since 1.0
|
185 |
* @return null
|
186 |
*/
|
209 |
|
210 |
/**
|
211 |
* Updates masterslider tables if update is required
|
212 |
+
*
|
213 |
* @since 1.0
|
214 |
* @return bool is any update required for tabels?
|
215 |
*/
|
217 |
// check if the tables need update
|
218 |
if( get_option( 'masterslider_db_version', '0' ) == self::DB_VERSION )
|
219 |
return false;
|
220 |
+
|
221 |
$this->create_tables();
|
222 |
|
223 |
do_action( 'masterslider_tables_updated', $this->tables );
|
227 |
|
228 |
/**
|
229 |
* Drop all master slider tables
|
230 |
+
*
|
231 |
* @since 1.0
|
232 |
* @return null
|
233 |
*/
|
242 |
|
243 |
/**
|
244 |
* Filter Masterslider tables to drop when the blog is deleted
|
245 |
+
*
|
246 |
* @since 1.8
|
247 |
* @return null
|
248 |
*/
|
259 |
|
260 |
/**
|
261 |
* Adds new slider in sliders table
|
262 |
+
*
|
263 |
+
* @param array $fields array of fields for sliders table
|
264 |
+
* @example array( 'title' => '', 'type' => '', 'skin' => '', 'template' => '',
|
265 |
+
* 'common_params' => array(), 'special_params' => array(),
|
266 |
* 'panel_data' => '', 'is_active' => 1 );
|
267 |
+
*
|
268 |
* @return int|false ID number for new inserted row or false if the row could not be inserted.
|
269 |
*/
|
270 |
public function add_slider($fields = array() ) {
|
271 |
global $wpdb;
|
272 |
|
273 |
// default fields in sliders table
|
274 |
+
$defaults = array(
|
275 |
+
'title' => 'Untitled Slider',
|
276 |
'type' => '', // custom, flickr, instagram, facebook, post
|
277 |
'slides_num' => 0,
|
278 |
'date_created' => '',
|
312 |
|
313 |
/**
|
314 |
* Updates a slider data in sliders table
|
315 |
+
*
|
316 |
* @param int $slider_id the slider id that is going to be updated
|
317 |
* @param array $fields array of fields in sliders table that needs to be updated
|
318 |
* @param array|string (optional) An array of formats to be mapped to each of the values in $fields
|
319 |
+
* @example array( 'title' => '', 'type' => '', 'custom_styles' => array(), 'custom_fonts' => array(),
|
320 |
* 'params' => '', 'status' => 'published' );
|
321 |
+
*
|
322 |
* @return int|false The number of rows updated, or false on error.
|
323 |
*/
|
324 |
public function update_slider($slider_id, $fields, $format = null ) {
|
333 |
}
|
334 |
|
335 |
// default required field while updating
|
336 |
+
$defaults = array(
|
337 |
'date_modified' => ''
|
338 |
);
|
339 |
|
360 |
|
361 |
/**
|
362 |
* Remove a specific slider data from sliders table
|
363 |
+
*
|
364 |
* @param int $slider_id The ID of the slider you'd like to be removed
|
365 |
* @return bool returns true on success or false on error
|
366 |
*/
|
371 |
return false;
|
372 |
}
|
373 |
|
374 |
+
return $wpdb->delete(
|
375 |
+
$this->sliders,
|
376 |
array( 'ID' => (int)$slider_id ),
|
377 |
array( '%d' )
|
378 |
);
|
381 |
|
382 |
/**
|
383 |
* Get slider data by slider id from slider table (for single )
|
384 |
+
*
|
385 |
* @param int $slider_id The ID of the slider you'd like to get the content
|
386 |
* @return array|null slider data in array or null if no result found
|
387 |
*/
|
401 |
|
402 |
/**
|
403 |
* Duplicate a slider in new row
|
404 |
+
*
|
405 |
* @param int $slider_id The ID of the slider you'd like to duplicate
|
406 |
* @return bool true on success and false on failure
|
407 |
*/
|
408 |
public function duplicate_slider( $slider_id ) {
|
409 |
+
|
410 |
if( ! $fields = $this->get_slider($slider_id) )
|
411 |
return false;
|
412 |
|
413 |
+
$fields['title'] = $this->duplicate_title( $fields['title'] );
|
414 |
|
415 |
return (bool) $this->add_slider($fields);
|
416 |
}
|
418 |
|
419 |
/**
|
420 |
* Add new slider with preset data
|
421 |
+
*
|
422 |
* @param string $slider_params The slider panel data
|
423 |
* @param string $slider_title The slider title
|
424 |
* @return int|false ID number for new inserted row or false if the row could not be inserted.
|
425 |
*/
|
426 |
public function import_slider( $fields = array() ) {
|
427 |
+
|
428 |
if( ! isset( $fields['title'] ) || empty( $fields['title'] ) )
|
429 |
+
$fields['title'] = 'Untitled Slider';
|
430 |
+
|
431 |
$fields['title'] = $this->duplicate_title( $fields['title'] );
|
432 |
+
|
433 |
return $this->add_slider( $fields );
|
434 |
}
|
435 |
|
436 |
|
437 |
/**
|
438 |
* Get the value of a single field for a spesific slider
|
439 |
+
*
|
440 |
* @param int $slider_id The ID of the slider you'd like to get value of its field
|
441 |
* @param string $field_name The field name in slider table to get value from
|
442 |
* @return string|null field value or null if no result found
|
456 |
|
457 |
|
458 |
/**
|
459 |
+
* Get an array containing row results (serialized) from sliders table
|
460 |
+
*
|
461 |
+
* @param int $args The query args
|
462 |
* @return array|null Sliders data in an array or null if no result found
|
463 |
*/
|
464 |
public function ms_query( $args = array() ) {
|
483 |
$offset_num = (int) $args['offset'];
|
484 |
|
485 |
// remove limit if limit number is set to 0
|
486 |
+
$limit = ( 1 > $limit_num ) ? '' : 'LIMIT '. $limit_num;
|
487 |
|
488 |
// remove offect if offset number is set to 0
|
489 |
+
$offset = ( 0 == $offset_num )? '' : 'OFFSET '. $offset_num;
|
490 |
|
491 |
// add LIKE if defined
|
492 |
+
$like = empty( $args['like'] ) ? '' : 'LIKE '. $args['like'];
|
493 |
|
494 |
+
$where = empty( $args['where'] ) ? '' : 'WHERE '. $args['where'];
|
495 |
|
496 |
// sanitize sort type
|
497 |
$order = strtolower( $args['order'] ) === 'desc' ? 'DESC' : 'ASC';
|
498 |
+
$orderby_clause = $args['orderby'] .' '. $order;
|
499 |
+
|
500 |
+
$orderby_clause = sanitize_sql_orderby( $orderby_clause );
|
501 |
|
502 |
$sql = "
|
503 |
SELECT *
|
504 |
FROM {$this->sliders}
|
505 |
$where
|
506 |
+
ORDER BY $orderby_clause
|
507 |
+
$limit
|
508 |
$offset
|
509 |
";
|
510 |
+
|
511 |
return $wpdb->get_results( $sql, ARRAY_A );
|
512 |
}
|
513 |
|
514 |
|
515 |
/**
|
516 |
+
* Get an array containing row results (serialized) from sliders table
|
517 |
+
*
|
518 |
* @param int $perpage Maximum number of rows to return - 0 means no limit
|
519 |
* @param int $offset The offset of the first row to return
|
520 |
* @param string $orderby The field name to order results by
|
532 |
'order' => $order,
|
533 |
'where' => $where
|
534 |
);
|
535 |
+
|
536 |
return $this->ms_query( $args );
|
537 |
}
|
538 |
|
539 |
+
|
540 |
|
541 |
/**
|
542 |
* Get an array containing row results (unserialized) from sliders table (with all slider table fields)
|
543 |
+
*
|
544 |
* @param int $perpage Maximum number of rows to return
|
545 |
* @param int $offset The offset of the first row to return
|
546 |
* @param string $orderby The field name to order results by
|
549 |
* @return array|null Slider data in array or null if no result found
|
550 |
*/
|
551 |
public function get_sliders( $perpage = 0, $offset = 0, $orderby = 'ID', $sort = 'DESC', $where = "status='published'" ) {
|
552 |
+
|
553 |
// pull mulitple row results from sliders table
|
554 |
if( ! $results = $this->get_sliders_list( $perpage, $offset, $orderby, $sort, $where ) ){
|
555 |
return;
|
566 |
|
567 |
/**
|
568 |
* Get total number of sliders from sliders table
|
569 |
+
*
|
570 |
* @return int|null total number of sliders or null on failure
|
571 |
*/
|
572 |
public function get_total_sliders_count( $where = "status='published'" ) {
|
573 |
global $wpdb;
|
574 |
+
|
575 |
$result = $wpdb->get_results( "SELECT count(ID) AS total FROM {$this->sliders} WHERE {$where} ", ARRAY_A );
|
576 |
return $result ? (int)$result[0]['total'] : null;
|
577 |
}
|
584 |
|
585 |
/**
|
586 |
* Insert option data in new record in options table
|
587 |
+
*
|
588 |
* @param string $option_name a unique name for option
|
589 |
* @param string $option_value the option value
|
590 |
+
*
|
591 |
* @return bool False if option was not added and true if option was added.
|
592 |
*/
|
593 |
public function add_option( $option_name, $option_value = '' ) {
|
605 |
// serialize the option value
|
606 |
$option_value = maybe_serialize( $option_value );
|
607 |
|
608 |
+
$fields = array(
|
609 |
'option_name' => $option_name,
|
610 |
'option_value' => $option_value
|
611 |
);
|
634 |
|
635 |
/**
|
636 |
* Get option value
|
637 |
+
*
|
638 |
* @param string $option_name a unique name for option
|
639 |
* @param string $default_value a value to return by function if option_value not found
|
640 |
* @return string option_value or default_value
|
661 |
$serialized_value = maybe_serialize( $value );
|
662 |
wp_cache_set( $option_name, $serialized_value, 'masterslider' );
|
663 |
}
|
664 |
+
|
665 |
return maybe_unserialize( $value );
|
666 |
}
|
667 |
|
669 |
|
670 |
/**
|
671 |
* Update option value in options table, if option_name does not exist then insert new option
|
672 |
+
*
|
673 |
* @param string $option_name a unique name for option
|
674 |
* @param string $option_value the option value
|
675 |
+
*
|
676 |
* @return int|false ID number for new inserted row or false if the option can not be updated.
|
677 |
*/
|
678 |
public function update_option( $option_name, $option_value = '' ) {
|
690 |
$old_value = $this->get_option( $option_name );
|
691 |
|
692 |
$option_value = apply_filters( 'msp_pre_update_option_' . $option_name, $option_value, $old_value );
|
693 |
+
|
694 |
// If the new and old values are the same, no need to update.
|
695 |
if ( $option_value === $old_value )
|
696 |
return false; // 'has same value';
|
697 |
+
|
698 |
$option_value = maybe_serialize( $option_value );
|
699 |
+
|
700 |
|
701 |
$result = $wpdb->update( $this->options, array( 'option_value' => $option_value ), array( 'option_name' => $option_name ) );
|
702 |
if ( ! $result ) {
|
711 |
|
712 |
/**
|
713 |
* Remove a specific option name from options table
|
714 |
+
*
|
715 |
* @param string $option_name a unique name for option
|
716 |
* @return bool True, if option is successfully deleted. False on failure.
|
717 |
*/
|
723 |
return false;
|
724 |
}
|
725 |
|
726 |
+
$result = $wpdb->delete(
|
727 |
+
$this->options,
|
728 |
array( 'option_name' => $option_name ),
|
729 |
array( '%s' )
|
730 |
);
|
771 |
* Insert a row into a table.
|
772 |
* @param array $fields array of fields and values to insert
|
773 |
* @param array $defaults array of default fields value to insert if field value is not set
|
774 |
+
*
|
775 |
* @return int|false ID number for new inserted row or false if the row could not be inserted.
|
776 |
*/
|
777 |
public function insert( $table_name, $fields = array(), $defaults = array(), $format = NULL ) {
|
819 |
}
|
820 |
|
821 |
global $mspdb;
|
822 |
+
if( is_null( $mspdb ) ) $mspdb = new MSP_DB();
|
includes/init/define.php
CHANGED
@@ -5,7 +5,7 @@ if ( ! defined('ABSPATH') ) {
|
|
5 |
die();
|
6 |
}
|
7 |
|
8 |
-
define( 'MSWP_AVERTA_VERSION' , '2.
|
9 |
|
10 |
define( 'MSWP_SLUG' , 'master-slider' );
|
11 |
define( 'MSWP_TEXT_DOMAIN' , 'masterslider' );
|
5 |
die();
|
6 |
}
|
7 |
|
8 |
+
define( 'MSWP_AVERTA_VERSION' , '2.6.0' );
|
9 |
|
10 |
define( 'MSWP_SLUG' , 'master-slider' );
|
11 |
define( 'MSWP_TEXT_DOMAIN' , 'masterslider' );
|
master-slider.php
CHANGED
@@ -11,7 +11,7 @@
|
|
11 |
* Plugin Name: Master Slider
|
12 |
* Plugin URI: https://wordpress.org/plugins/master-slider/
|
13 |
* Description: Master Slider is the most advanced responsive HTML5 WordPress slider plugin with touch swipe navigation that works smoothly on devices too.
|
14 |
-
* Version: 2.
|
15 |
* Author: averta
|
16 |
* Author URI: http://averta.net
|
17 |
* Text Domain: master-slider
|
11 |
* Plugin Name: Master Slider
|
12 |
* Plugin URI: https://wordpress.org/plugins/master-slider/
|
13 |
* Description: Master Slider is the most advanced responsive HTML5 WordPress slider plugin with touch swipe navigation that works smoothly on devices too.
|
14 |
+
* Version: 2.6.0
|
15 |
* Author: averta
|
16 |
* Author URI: http://averta.net
|
17 |
* Text Domain: master-slider
|