Master Slider – Responsive Touch Slider - Version 2.8.0

Version Description

Download this release

Release Info

Developer averta
Plugin Icon 128x128 Master Slider – Responsive Touch Slider
Version 2.8.0
Comparing to
See all releases

Code changes from version 2.7.1 to 2.8.0

README.txt CHANGED
@@ -5,8 +5,8 @@ License: GPLv3
5
  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.3.1
9
- Stable tag: 2.7.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.7.1 / (4.10.2015) =
230
  - [Fix]: Minor issue with an undefined variable fixed
@@ -401,5 +403,5 @@ Bugs can be reported in our [support forums](http://wordpress.org/tags/master-sl
401
 
402
  == Upgrade Notice ==
403
 
404
- = 2.7.1 =
405
- - [Fix]: Minor issue with an undefined variable fixed
5
  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.5.3
9
+ Stable tag: 2.8.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.8.1 / (11.7.2016) =
229
+ - [Improvement]: Security improvement
230
 
231
  = Version 2.7.1 / (4.10.2015) =
232
  - [Fix]: Minor issue with an undefined variable fixed
403
 
404
  == Upgrade Notice ==
405
 
406
+ = 2.8.0 =
407
+ - [Improvement]: Security improvement
admin/includes/classes/class-msp-list-table.php CHANGED
@@ -4,27 +4,27 @@ class MSP_List_Table extends Axiom_List_Table {
4
 
5
 
6
  function __construct(){
7
-
8
  //Set parent defaults
9
  parent::__construct( array(
10
  'singular' => 'slider', // singular name of the listed records
11
  'plural' => 'sliders', // plural name of the listed records
12
  'ajax' => false // does this table support ajax?
13
  ) );
14
-
15
  }
16
 
17
 
18
  function get_columns(){
19
  $columns = array(
20
- 'ID' => __('ID' , 'master-slider' ),
21
- 'title' => __('Name' , 'master-slider' ),
22
  'shortcode' => __('Shortcode', 'master-slider' ),
23
- 'slides_num' => __('Slides', 'master-slider' ),
24
- 'type' => __('Type', 'master-slider' ),
25
  'date_modified' => __('Last Modify', 'master-slider' ),
26
  'date_created' => __('Date Created', 'master-slider' ),
27
- 'action' => __('Action', 'master-slider' )
28
  );
29
  return $columns;
30
  }
@@ -42,44 +42,91 @@ class MSP_List_Table extends Axiom_List_Table {
42
 
43
 
44
 
45
- function column_title($item) {
46
- return sprintf('<a href="?page=%s&action=%s&slider_id=%s">%s</a>',$_REQUEST['page'],'edit', $item['ID'], $item['title'] );
47
- }
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
  function column_action( $item ) {
50
  $paged = $this->get_pagenum();
51
- $paged_arg = (int)$paged > 1 ? '&paged=' . $paged : '';
52
 
53
  $buttons = '';
54
 
55
- if( current_user_can( 'duplicate_masterslider' ) || apply_filters( 'masterslider_admin_display_duplicate_btn', 0 ) )
56
- $buttons .= sprintf( '<a class="action-duplicate msp-ac-btn msp-btn-gray msp-iconic" href="?page=%s&action=%s&slider_id=%s%s"><span></span>%s</a>',$_REQUEST['page'],'duplicate' ,$item['ID'], $paged_arg, __('duplicate') );
57
-
58
- if( current_user_can( 'delete_masterslider' ) || apply_filters( 'masterslider_admin_display_delete_btn', 0 ) ) {
59
- $buttons .= sprintf( '<a class="action-delete msp-ac-btn msp-btn-red msp-iconic" href="?page=%s&action=%s&slider_id=%s%s" onClick="return confirm(\'%s\');" ><span></span>%s</a>', $_REQUEST['page'],'delete' ,$item['ID'],
60
- $paged_arg, wp_slash( apply_filters( 'masterslider_admin_delete_btn_alert_message', __( 'Are you sure you want to delete this slider?' , 'master-slider' ) ) ),
61
- __('delete')
62
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  }
64
-
65
- $buttons .= sprintf( '<a class="action-preview msp-ac-btn msp-btn-blue msp-iconic" href="?page=%s&action=%s&slider_id=%s" onClick="lunchMastersliderPreviewBySliderID(%s);return false;" ><span></span>%s</a>',$_REQUEST['page'],'preview' ,$item['ID'], $item['ID'], __('preview') );
66
-
67
- return $buttons;
68
- }
69
 
70
 
71
 
72
  function process_bulk_action() {
73
-
74
  $slider_id = isset( $_REQUEST['slider_id'] ) ? $_REQUEST['slider_id'] : '';
75
 
76
  // check if a delete request recieved
77
  if( current_user_can( 'delete_masterslider' ) && 'delete' === $this->current_action() ) {
78
-
79
  global $mspdb;
80
  $mspdb->delete_slider($slider_id);
81
  // echo "Slider id ($slider_id) Removed";
82
-
83
  } else {
84
  add_action( 'admin_notices', array( $this, 'delete_error_notice' ) );
85
  }
@@ -90,24 +137,24 @@ class MSP_List_Table extends Axiom_List_Table {
90
  global $mspdb;
91
  $mspdb->duplicate_slider($slider_id);
92
  // echo "Slider id ($slider_id) duplicated";
93
-
94
  } else {
95
  add_action( 'admin_notices', array( $this, 'duplicate_error_notice' ) );
96
  }
97
-
98
  }
99
 
100
 
101
  function delete_error_notice () {
102
- printf( '<div class="error" style="display:block;" ><p>%s</p></div>',
103
- apply_filters( 'masterslider_delete_insufficient_permissions_notice', __( "Sorry, You don't have enough permission to delete slider.", 'master-slider' ) )
104
  );
105
  }
106
 
107
 
108
  function duplicate_error_notice () {
109
- printf( '<div class="error" style="display:block;" ><p>%s</p></div>',
110
- apply_filters( 'masterslider_duplicate_insufficient_permissions_notice', __( "Sorry, You don't have enough permission to duplicate slider.", 'master-slider' ) )
111
  );
112
  }
113
 
@@ -119,7 +166,7 @@ class MSP_List_Table extends Axiom_List_Table {
119
 
120
  function column_default( $item, $column_name ) {
121
  global $mspdb;
122
-
123
  switch( $column_name ) {
124
  case 'shortcode':
125
  return sprintf('[masterslider id="%s"]', $item['ID']);
@@ -149,11 +196,11 @@ class MSP_List_Table extends Axiom_List_Table {
149
 
150
  function get_records( $perpage = 20, $paged = 1, $orderby = 'ID', $order = 'DESC', $where = "status='published'" ){
151
  global $mspdb;
152
-
153
  $offset = ( (int)$paged - 1 ) * $perpage;
154
  $orderby = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : 'ID';
155
  $order = isset( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'ASC';
156
-
157
  $search = isset( $_REQUEST['s'] ) ? " AND title LIKE '%%" . $_REQUEST['s'] . "%%'" : '';
158
 
159
  return $mspdb->get_sliders( $perpage, $offset, $orderby, $order, $where.$search );
@@ -162,7 +209,7 @@ class MSP_List_Table extends Axiom_List_Table {
162
 
163
  function get_total_count(){
164
  global $mspdb;
165
-
166
  $all_items = $this->get_records( 0 );
167
  return count( $all_items );
168
  }
@@ -174,9 +221,9 @@ class MSP_List_Table extends Axiom_List_Table {
174
  $columns = $this->get_columns();
175
  $hidden = array();
176
  $sortable = $this->get_sortable_columns();
177
-
178
  $this->_column_headers = array( $columns, $hidden, $sortable );
179
-
180
  $this->process_bulk_action();
181
 
182
  $perpage = (int) apply_filters( 'masterslider_admin_sliders_per_page', 10 );
@@ -201,5 +248,5 @@ class MSP_List_Table extends Axiom_List_Table {
201
 
202
  // global $master_list_table;
203
  // $master_list_table = new Master_List_Table();
204
- // $master_list_table->prepare_items();
205
 
4
 
5
 
6
  function __construct(){
7
+
8
  //Set parent defaults
9
  parent::__construct( array(
10
  'singular' => 'slider', // singular name of the listed records
11
  'plural' => 'sliders', // plural name of the listed records
12
  'ajax' => false // does this table support ajax?
13
  ) );
14
+
15
  }
16
 
17
 
18
  function get_columns(){
19
  $columns = array(
20
+ 'ID' => __('ID' , 'master-slider' ),
21
+ 'title' => __('Name' , 'master-slider' ),
22
  'shortcode' => __('Shortcode', 'master-slider' ),
23
+ 'slides_num' => __('Slides', 'master-slider' ),
24
+ 'type' => __('Type', 'master-slider' ),
25
  'date_modified' => __('Last Modify', 'master-slider' ),
26
  'date_created' => __('Date Created', 'master-slider' ),
27
+ 'action' => __('Action', 'master-slider' )
28
  );
29
  return $columns;
30
  }
42
 
43
 
44
 
45
+ function column_title( $item ) {
46
+
47
+ return sprintf(
48
+ '<a href="%s">%s</a>',
49
+ esc_url( add_query_arg(
50
+ array(
51
+ 'page' => $_GET['page'],
52
+ 'action' => 'edit',
53
+ 'slider_id' => $item['ID' ]
54
+ )
55
+ )),
56
+ $item['title']
57
+ );
58
+
59
+ }
60
 
61
  function column_action( $item ) {
62
  $paged = $this->get_pagenum();
63
+ $paged = (int)$paged > 1 ? $paged : '';
64
 
65
  $buttons = '';
66
 
67
+ if( current_user_can( 'duplicate_masterslider' ) || apply_filters( 'masterslider_admin_display_duplicate_btn', 0 ) ){
68
+
69
+ $buttons .= sprintf(
70
+ '<a class="action-duplicate msp-ac-btn msp-btn-gray msp-iconic" href="%s"><span></span>%s</a>',
71
+ esc_url( add_query_arg(
72
+ array(
73
+ 'page' => $_GET['page'],
74
+ 'action' => 'duplicate',
75
+ 'slider_id' => $item['ID'],
76
+ 'paged' => $paged
77
+ )
78
+ )),
79
+ __('duplicate')
80
+ );
81
+ }
82
+
83
+ if( current_user_can( 'delete_masterslider' ) || apply_filters( 'masterslider_admin_display_delete_btn', 0 ) ) {
84
+ $buttons .= sprintf(
85
+ '<a class="action-delete msp-ac-btn msp-btn-red msp-iconic" href="%s" onClick="return confirm(\'%s\');" ><span></span>%s</a>',
86
+ esc_url( add_query_arg(
87
+ array(
88
+ 'page' => $_GET['page'],
89
+ 'action' => 'delete',
90
+ 'slider_id' => $item['ID'],
91
+ 'paged' => $paged
92
+ )
93
+ )),
94
+ wp_slash(
95
+ apply_filters( 'masterslider_admin_delete_btn_alert_message', __( 'Are you sure you want to delete this slider?' , 'master-slider' ) )
96
+ ),
97
+ __('delete')
98
+ );
99
+ }
100
+
101
+ $buttons .= sprintf(
102
+ '<a class="action-preview msp-ac-btn msp-btn-blue msp-iconic" href="%s" onClick="lunchMastersliderPreviewBySliderID(%s);return false;" ><span></span>%s</a>',
103
+ esc_url( add_query_arg(
104
+ array(
105
+ 'page' => $_GET['page'],
106
+ 'action' => 'preview',
107
+ 'slider_id' => $item['ID']
108
+ )
109
+ )),
110
+ $item['ID'],
111
+ __('preview')
112
+ );
113
+
114
+ return $buttons;
115
  }
 
 
 
 
 
116
 
117
 
118
 
119
  function process_bulk_action() {
120
+
121
  $slider_id = isset( $_REQUEST['slider_id'] ) ? $_REQUEST['slider_id'] : '';
122
 
123
  // check if a delete request recieved
124
  if( current_user_can( 'delete_masterslider' ) && 'delete' === $this->current_action() ) {
125
+
126
  global $mspdb;
127
  $mspdb->delete_slider($slider_id);
128
  // echo "Slider id ($slider_id) Removed";
129
+
130
  } else {
131
  add_action( 'admin_notices', array( $this, 'delete_error_notice' ) );
132
  }
137
  global $mspdb;
138
  $mspdb->duplicate_slider($slider_id);
139
  // echo "Slider id ($slider_id) duplicated";
140
+
141
  } else {
142
  add_action( 'admin_notices', array( $this, 'duplicate_error_notice' ) );
143
  }
144
+
145
  }
146
 
147
 
148
  function delete_error_notice () {
149
+ printf( '<div class="error" style="display:block;" ><p>%s</p></div>',
150
+ apply_filters( 'masterslider_delete_insufficient_permissions_notice', __( "Sorry, You don't have enough permission to delete slider.", 'master-slider' ) )
151
  );
152
  }
153
 
154
 
155
  function duplicate_error_notice () {
156
+ printf( '<div class="error" style="display:block;" ><p>%s</p></div>',
157
+ apply_filters( 'masterslider_duplicate_insufficient_permissions_notice', __( "Sorry, You don't have enough permission to duplicate slider.", 'master-slider' ) )
158
  );
159
  }
160
 
166
 
167
  function column_default( $item, $column_name ) {
168
  global $mspdb;
169
+
170
  switch( $column_name ) {
171
  case 'shortcode':
172
  return sprintf('[masterslider id="%s"]', $item['ID']);
196
 
197
  function get_records( $perpage = 20, $paged = 1, $orderby = 'ID', $order = 'DESC', $where = "status='published'" ){
198
  global $mspdb;
199
+
200
  $offset = ( (int)$paged - 1 ) * $perpage;
201
  $orderby = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : 'ID';
202
  $order = isset( $_REQUEST['order'] ) ? $_REQUEST['order'] : 'ASC';
203
+
204
  $search = isset( $_REQUEST['s'] ) ? " AND title LIKE '%%" . $_REQUEST['s'] . "%%'" : '';
205
 
206
  return $mspdb->get_sliders( $perpage, $offset, $orderby, $order, $where.$search );
209
 
210
  function get_total_count(){
211
  global $mspdb;
212
+
213
  $all_items = $this->get_records( 0 );
214
  return count( $all_items );
215
  }
221
  $columns = $this->get_columns();
222
  $hidden = array();
223
  $sortable = $this->get_sortable_columns();
224
+
225
  $this->_column_headers = array( $columns, $hidden, $sortable );
226
+
227
  $this->process_bulk_action();
228
 
229
  $perpage = (int) apply_filters( 'masterslider_admin_sliders_per_page', 10 );
248
 
249
  // global $master_list_table;
250
  // $master_list_table = new Master_List_Table();
251
+ // $master_list_table->prepare_items();
252
 
includes/init/define.php CHANGED
@@ -5,7 +5,7 @@ if ( ! defined('ABSPATH') ) {
5
  die();
6
  }
7
 
8
- define( 'MSWP_AVERTA_VERSION' , '2.7.1' );
9
 
10
  define( 'MSWP_SLUG' , 'master-slider' );
11
  define( 'MSWP_TEXT_DOMAIN' , 'masterslider' );
5
  die();
6
  }
7
 
8
+ define( 'MSWP_AVERTA_VERSION' , '2.8.0' );
9
 
10
  define( 'MSWP_SLUG' , 'master-slider' );
11
  define( 'MSWP_TEXT_DOMAIN' , 'masterslider' );
includes/msp-functions.php CHANGED
@@ -1,4 +1,4 @@
1
- <?php
2
  /**
3
  *
4
  * @package MasterSlider
@@ -12,7 +12,7 @@
12
 
13
  /**
14
  * Displays master slider markup for specific slider ID
15
- *
16
  * @param int $slider_id the slider id
17
  * @return void
18
  */
@@ -27,7 +27,7 @@ if( ! function_exists( 'masterslider' ) ) {
27
 
28
  /**
29
  * Get master slider markup for specific slider ID
30
- *
31
  * @param int $slider_id the slider id
32
  * @return string the slider markup
33
  */
@@ -35,9 +35,9 @@ if( ! function_exists( 'get_masterslider' ) ) {
35
 
36
  function get_masterslider( $slider_id, $args = NULL ){
37
  global $msp_instances;
38
-
39
  // through an error if slider id is not valid number
40
- if( ! is_numeric( $slider_id ) )
41
  return __( 'Invalid slider id. Master Slider ID must be a valid number.', 'master-slider' );
42
 
43
  // load masterslider script
@@ -45,14 +45,14 @@ if( ! function_exists( 'get_masterslider' ) ) {
45
  wp_enqueue_script( 'masterslider-core');
46
 
47
  $is_cache_enabled = ( 'on' == msp_get_setting( '_enable_cache', 'msp_general_setting', 'off' ) );
48
-
49
  // try to get cached copy of slider transient output
50
  if( ! $is_cache_enabled || false === ( $slider_output = msp_get_slider_transient( $slider_id ) ) || empty( $slider_output ) ) {
51
  $slider_output = msp_generate_slider_output( $slider_id, $is_cache_enabled );
52
-
53
  } elseif( $is_cache_enabled ) {
54
  $msp_instances = is_array( $msp_instances ) ? $msp_instances : array();
55
- $msp_instances[ $slider_id ][] = $slider_id;
56
  // if there was same slider on one page generate new ones
57
  if( count( $msp_instances[ $slider_id ] ) > 1 ){
58
  $slider_output = msp_generate_slider_output( $slider_id );
@@ -66,17 +66,17 @@ if( ! function_exists( 'get_masterslider' ) ) {
66
 
67
  /**
68
  * Convert panel data to ms_slider shortcode and return it
69
- *
70
  * @param string $panel_data a serialized string containing panel data object
71
  * @return string ms_slider shortcode or empty string
72
  */
73
  function msp_panel_data_2_ms_slider_shortcode( $panel_data, $slider_id = null ){
74
- if ( ! $panel_data )
75
  return '';
76
 
77
  $parser = msp_get_parser();
78
  $parser->set_data( $panel_data, $slider_id );
79
- $results = $parser->get_results();
80
 
81
  // shortcode generation
82
  $sf = msp_get_shortcode_factory();
@@ -88,7 +88,7 @@ function msp_panel_data_2_ms_slider_shortcode( $panel_data, $slider_id = null ){
88
 
89
  /**
90
  * Convert panel data to ms_slider shortcode and return it
91
- *
92
  * @param int $slider_id The ID of the slider you'd like to get its shortcode
93
  * @return string ms_slider shortcode or empty string
94
  */
@@ -103,7 +103,7 @@ function msp_get_ms_slider_shortcode_by_slider_id( $slider_id ){
103
 
104
  /**
105
  * Convert panel data to ms_slider shortcode and return it
106
- *
107
  * @param int $slider_id The ID of the slider you'd like to get its output
108
  * @param bool $cache_output Whether to store output in cache or not
109
  * @return string The slider output
@@ -120,12 +120,12 @@ function msp_generate_slider_output( $slider_id, $cache_output = false ){
120
 
121
  /**
122
  * Flush and re-cache slider output if slider cache is enabled
123
- *
124
  * @param int $slider_id The ID of the slider you'd like to flush the cache
125
  * @return bool True if the cache is flushed and false otherwise
126
  */
127
  function msp_flush_slider_cache( $slider_id ){
128
-
129
  $is_cache_enabled = ( 'on' == msp_get_setting( '_enable_cache', 'msp_general_setting', 'off' ) );
130
  if( $is_cache_enabled ){
131
  msp_generate_slider_output( $slider_id, true );
@@ -137,11 +137,11 @@ function msp_flush_slider_cache( $slider_id ){
137
 
138
  /**
139
  * Flush and re-cache all slideres if slider cache is enabled
140
- *
141
  * @return bool True if the cache is flushed and false otherwise
142
  */
143
  function msp_flush_all_sliders_cache(){
144
-
145
  $is_cache_enabled = ( 'on' == msp_get_setting( '_enable_cache', 'msp_general_setting', 'off' ) );
146
  if( ! $is_cache_enabled ){ return false; }
147
 
@@ -149,7 +149,7 @@ function msp_flush_all_sliders_cache(){
149
  foreach ( $all_sliders as $slider_id => $slider_name ) {
150
  msp_generate_slider_output( $slider_id, true );
151
  }
152
-
153
  return true;
154
  }
155
 
@@ -157,7 +157,7 @@ function msp_flush_all_sliders_cache(){
157
  /**
158
  * Takes a slider ID and returns slider's parsed data in an array
159
  * You can use this function to access slider data (setting, slides, layers, styles)
160
- *
161
  * @param int $slider_id The ID of the slider you'd like to get its parsed data
162
  * @return array array containing slider's parsed data
163
  */
@@ -166,7 +166,7 @@ function get_masterslider_parsed_data( $slider_id ){
166
  global $mspdb;
167
  $panel_data = $mspdb->get_slider_field_val( $slider_id, 'params' );
168
 
169
- if ( ! $panel_data )
170
  return array();
171
 
172
  $parser = msp_get_parser();
@@ -177,72 +177,72 @@ function get_masterslider_parsed_data( $slider_id ){
177
 
178
  /**
179
  * Load and init parser class on demand
180
- *
181
  * @return Object instance of MSP_Parser class
182
  */
183
  function msp_get_parser() {
184
  include_once( MSWP_AVERTA_ADMIN_DIR . '/includes/classes/class-msp-parser.php' );
185
-
186
  global $msp_parser;
187
  if ( is_null( $msp_parser ) )
188
  $msp_parser = new MSP_Parser();
189
-
190
  return $msp_parser;
191
  }
192
 
193
 
194
  /**
195
  * Load and init shortcode_factory class on demand
196
- *
197
  * @return Object instance of MSP_Shortcode_Factory class
198
  */
199
  function msp_get_shortcode_factory () {
200
  include_once( MSWP_AVERTA_ADMIN_DIR . '/includes/classes/class-msp-shortcode-factory.php' );
201
-
202
  global $mspsf;
203
  if ( is_null( $mspsf ) )
204
  $mspsf = new MSP_Shortcode_Factory();
205
-
206
  return $mspsf;
207
  }
208
 
209
 
210
  /**
211
  * Load and init post_slider class on demand
212
- *
213
  * @return Object instance of MSP_Post_Slider class
214
  */
215
  function msp_get_post_slider_class() {
216
  include_once( MSWP_AVERTA_ADMIN_DIR . '/includes/classes/class-msp-post-sliders.php' );
217
-
218
  global $msp_post_slider;
219
  if ( is_null( $msp_post_slider ) )
220
  $msp_post_slider = new MSP_Post_Slider();
221
-
222
  return $msp_post_slider;
223
  }
224
 
225
 
226
  /**
227
  * Load and init wc_product_slider class on demand
228
- *
229
  * @return Object instance of MSP_WC_Product_Slider class
230
  */
231
  function msp_get_wc_slider_class() {
232
  include_once( MSWP_AVERTA_ADMIN_DIR . '/includes/classes/class-msp-wc-product-slider.php' );
233
-
234
  global $msp_wc_slider;
235
  if ( is_null( $msp_wc_slider ) )
236
  $msp_wc_slider = new MSP_WC_Product_Slider();
237
-
238
  return $msp_wc_slider;
239
  }
240
 
241
 
242
  /**
243
  * Update custom_css, custom_fonts and slide num fields in sliders table
244
- *
245
- * @param int $slider_id the slider id that is going to be updated
246
  * @return int|false The number of rows updated, or false on error.
247
  */
248
  function msp_update_slider_custom_css_and_fonts( $slider_id ) {
@@ -261,7 +261,7 @@ function msp_update_slider_custom_css_and_fonts( $slider_id ) {
261
  // load and get parser and start parsing data
262
  $parser = msp_get_parser();
263
  $parser->set_data( $slider_params, $slider_id );
264
-
265
  // get required parsed data
266
  $slider_setting = $parser->get_slider_setting();
267
  $slides = $parser->get_slides();
@@ -272,7 +272,7 @@ function msp_update_slider_custom_css_and_fonts( $slider_id ) {
272
  'custom_styles' => $slider_custom_styles,
273
  'custom_fonts' => $slider_setting[ 'gfonts' ]
274
  );
275
-
276
  msp_save_custom_styles();
277
 
278
  $mspdb->update_slider( $slider_id, $fields );
@@ -281,7 +281,7 @@ function msp_update_slider_custom_css_and_fonts( $slider_id ) {
281
 
282
  /**
283
  * Set/update the value of a slider output transient.
284
- *
285
  * @param int $slider_id The slider id
286
  * @param mixed $value Slider transient output
287
  * @param int $cache_period Time until expiration in hours, default 12
@@ -295,7 +295,7 @@ function msp_set_slider_transient( $slider_id, $value, $cache_period = null ) {
295
 
296
  /**
297
  * Get the value of a slider output transient.
298
- *
299
  * @param int $slider_id The slider id
300
  * @return mixed Value of transient or False If the transient does not exist or does not have a value
301
  */
@@ -306,7 +306,7 @@ function msp_get_slider_transient( $slider_id ) {
306
 
307
  /**
308
  * Whether it's absolute url or not
309
- *
310
  * @param string $url The URL
311
  * @return bool TRUE if the URL is absolute
312
  */
@@ -317,7 +317,7 @@ function msp_is_absolute_url( $url ){
317
 
318
  /**
319
  * Whether the URL contains upload directory path or not
320
- *
321
  * @param string $url The URL
322
  * @return bool TRUE if the URL is absolute
323
  */
@@ -329,7 +329,7 @@ function msp_contains_upload_dir( $url ){
329
 
330
  /**
331
  * Print absolute URL for media file event if the URL is relative
332
- *
333
  * @param string $url The link to media file
334
  * @return void
335
  */
@@ -339,7 +339,7 @@ function msp_the_absolute_media_url( $url ){
339
 
340
  /**
341
  * Get absolute URL for media file event if the URL is relative
342
- *
343
  * @param string $url The link to media file
344
  * @return string The absolute URL to media file
345
  */
@@ -347,9 +347,9 @@ function msp_the_absolute_media_url( $url ){
347
 
348
  function msp_get_the_absolute_media_url( $url ){
349
  if( ! isset( $url ) || empty( $url ) ) return '';
350
-
351
  if( msp_is_absolute_url( $url ) || msp_contains_upload_dir( $url ) ) return $url;
352
-
353
  $uploads = wp_upload_dir();
354
  return set_url_scheme( $uploads['baseurl'] . $url );
355
  }
@@ -359,7 +359,7 @@ function msp_the_absolute_media_url( $url ){
359
 
360
  /**
361
  * Print relative URL for media file event if the URL is absolute
362
- *
363
  * @param string $url The link to media file
364
  * @return void
365
  */
@@ -369,7 +369,7 @@ function msp_the_relative_media_url( $url ){
369
 
370
  /**
371
  * Get relative URL for media file event if the URL is absolute
372
- *
373
  * @param string $url The link to media file
374
  * @return string The absolute URL to media file
375
  */
@@ -377,10 +377,10 @@ function msp_the_relative_media_url( $url ){
377
 
378
  function msp_get_the_relative_media_url($url){
379
  if( ! isset( $url ) || empty( $url ) ) return '';
380
-
381
- // if it's not internal absolute url
382
  if( ! msp_contains_upload_dir( $url ) ) return $url;
383
-
384
  $uploads_dir = wp_upload_dir();
385
  return str_replace( $uploads_dir['baseurl'], '', $url );
386
  }
@@ -389,7 +389,7 @@ function msp_the_relative_media_url( $url ){
389
 
390
 
391
  /*-----------------------------------------------------------------------------------*/
392
- /* Custom functions for resizing images
393
  /*-----------------------------------------------------------------------------------*/
394
 
395
 
@@ -399,13 +399,13 @@ function msp_the_relative_media_url( $url ){
399
  function msp_the_resized_image( $img_url = "", $width = null , $height = null, $crop = null , $quality = 100 ) {
400
  echo msp_get_the_resized_image( $img_url , $width , $height , $crop , $quality );
401
  }
402
-
403
  function msp_get_the_resized_image( $img_url = "", $width = null , $height = null, $crop = null , $quality = 100 ) {
404
  return '<img src="'.msp_aq_resize( $img_url, $width, $height, $crop, $quality ).'" alt="" />';
405
  }
406
  /**
407
  * Get resized image by image URL
408
- *
409
  * @param string $img_url The original image URL
410
  * @param integer $width New image Width
411
  * @param integer $height New image height
@@ -417,7 +417,7 @@ function msp_the_resized_image( $img_url = "", $width = null , $height = null, $
417
 
418
  function msp_get_the_resized_image_src( $img_url = "", $width = null , $height = null, $crop = null , $quality = 100 ) {
419
  $resized_img_url = msp_aq_resize( $img_url, $width, $height, $crop, $quality );
420
- if( empty( $resized_img_url ) )
421
  $resized_img_url = $img_url;
422
  return apply_filters( 'msp_get_the_resized_image_src', $resized_img_url, $img_url );
423
  }
@@ -436,13 +436,13 @@ function msp_the_resized_attachment( $attach_id = null, $width = null , $height
436
  // return resized image tag
437
  function msp_get_the_resized_attachment( $attach_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
438
  $image_src = msp_get_the_resized_attachment_src( $attach_id, $width , $height, $crop, $quality );
439
-
440
  return $image_src ? '<img src="'.$image_src.'" alt="" />': '';
441
  }
442
 
443
  /**
444
  * Get resized image by attachment id
445
- *
446
  * @param string $attach_id The attachment id
447
  * @param integer $width New image Width
448
  * @param integer $height New image height
@@ -451,11 +451,11 @@ function msp_the_resized_attachment( $attach_id = null, $width = null , $height
451
  * @return string new image src
452
  */
453
  if( ! function_exists( 'msp_get_the_resized_attachment_src' ) ){
454
-
455
  function msp_get_the_resized_attachment_src( $attach_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
456
  if( is_null( $attach_id ) ) return '';
457
-
458
- $img_url = wp_get_attachment_url( $attach_id ,'full'); //get img URL
459
  return ! empty( $img_url ) ? msp_aq_resize( $img_url, $width, $height, $crop, $quality ) : false;
460
  }
461
 
@@ -468,7 +468,7 @@ function msp_the_resized_attachment( $attach_id = null, $width = null , $height
468
  function msp_the_post_thumbnail( $post_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
469
  echo msp_get_the_post_thumbnail( $post_id, $width , $height, $crop, $quality);
470
  }
471
-
472
  // return resized image tag
473
  function msp_get_the_post_thumbnail( $post_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
474
  $image_src = msp_get_the_post_thumbnail_src( $post_id, $width , $height, $crop, $quality);
@@ -477,7 +477,7 @@ function msp_the_post_thumbnail( $post_id = null, $width = null , $height = null
477
 
478
  /**
479
  * Get resized image by post id
480
- *
481
  * @param string $post_id The post id
482
  * @param integer $width New image Width
483
  * @param integer $height New image height
@@ -486,18 +486,18 @@ function msp_the_post_thumbnail( $post_id = null, $width = null , $height = null
486
  * @return string new image src
487
  */
488
  if( ! function_exists( 'msp_get_the_post_thumbnail_src' ) ){
489
-
490
  function msp_get_the_post_thumbnail_src( $post_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
491
  $post_id = is_null( $post_id ) ? get_the_ID() : $post_id;
492
  $post_thumbnail_id = get_post_thumbnail_id( $post_id );
493
-
494
- $img_url = wp_get_attachment_url( $post_thumbnail_id, 'full' ); //get img URL
495
-
496
  $resized_img = $post_thumbnail_id ? aq_resize( $img_url, $width, $height, $crop, $quality ) : false;
497
 
498
  return apply_filters( 'msp_get_the_post_thumbnail_src', $resized_img, $img_url, $width, $height, $crop, $quality );
499
  }
500
-
501
  }
502
 
503
  /**
@@ -507,14 +507,14 @@ function msp_the_post_thumbnail( $post_id = null, $width = null , $height = null
507
  * @return string Returns a full URI for featured image or false on failure.
508
  */
509
  if( ! function_exists( 'msp_get_the_post_thumbnail_full_src' ) ){
510
-
511
  function msp_get_the_post_thumbnail_full_src( $post_id = null ) {
512
  $post_id = is_null( $post_id ) ? get_the_ID() : $post_id;
513
  $post_thumbnail_id = get_post_thumbnail_id( $post_id );
514
-
515
- return wp_get_attachment_url( $post_thumbnail_id, 'full' );
516
  }
517
-
518
  }
519
 
520
  /**
@@ -522,11 +522,11 @@ function msp_the_post_thumbnail( $post_id = null, $width = null , $height = null
522
  *
523
  * @param integer $post_id The post id to get post image of
524
  * @param string $image_from where to look for post image. possible values are : auto, featured, first. Default to 'auto'
525
- *
526
  * @return string Returns a full URI for post image or empty string on failure.
527
  */
528
  if( ! function_exists( 'msp_get_auto_post_thumbnail_src' ) ){
529
-
530
  function msp_get_auto_post_thumbnail_src( $post_id = null, $image_from = 'auto' ) {
531
 
532
  $post = get_post( $post_id );
@@ -550,10 +550,10 @@ function msp_the_post_thumbnail( $post_id = null, $width = null , $height = null
550
  $content = get_the_content();
551
  $img_src = msp_get_first_image_src_from_string( $content );
552
  }
553
-
554
  return $img_src;
555
  }
556
-
557
  }
558
 
559
 
@@ -561,7 +561,7 @@ function msp_the_post_thumbnail( $post_id = null, $width = null , $height = null
561
 
562
  /**
563
  * Get first image tag from string
564
- *
565
  * @param string $content The content to extract image from
566
  * @return string First image tag on success and empty string if nothing found
567
  */
@@ -572,7 +572,7 @@ function msp_get_first_image_from_string( $content ){
572
 
573
  /**
574
  * Get first image src from content
575
- *
576
  * @param string $content The content to extract image from
577
  * @return string First image URL on success and empty string if nothing found
578
  */
@@ -580,20 +580,20 @@ function msp_get_first_image_src_from_string( $content ){
580
  $images = msp_extract_string_images( $content );
581
  return ( $images && count( $images[1]) ) ? $images[1][0] : '';
582
  }
583
-
584
  /**
585
  * Extract all images from content
586
- *
587
  * @param string $content The content to extract images from
588
  * @return array List of images in array
589
  */
590
  if( ! function_exists( 'msp_extract_string_images' ) ){
591
-
592
  function msp_extract_string_images( $content ){
593
  preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', $content, $matches );
594
  return isset( $matches ) && count( $matches[0] ) ? $matches : false;
595
  }
596
-
597
  }
598
 
599
 
@@ -602,25 +602,25 @@ function msp_get_first_image_src_from_string( $content ){
602
 
603
  /**
604
  * Get list of created slider IDs and names in an array
605
- *
606
  * @param bool $id_as_key If <code>true</code> returns slider ID as array key and slider name as value , reverse on <code>false</code>
607
  * @param int $limit Maximum number of sliders to return - 0 means no limit
608
  * @param int $offset The offset of the first row to return
609
  * @param string $orderby The field name to order results by
610
  * @param string $sort The sort type. 'DESC' or 'DESC'
611
- *
612
  * @return array An array containing sliders ID as array key and slider name as value
613
  *
614
  * @example $id_as_key = true :
615
  * array(
616
- * '12' => 'Slider sample title 1',
617
  * '13' => 'Slider sample title 2'
618
  * )
619
  *
620
  * $id_as_key = false :
621
  * array(
622
- * 'Slider sample title 1' => '12',
623
- * 'Slider sample title 2' => '13'
624
  * )
625
  */
626
  function get_masterslider_names( $id_as_key = true, $limit = 0, $offset = 0, $orderby = 'ID', $sort = 'DESC' ){
@@ -647,7 +647,7 @@ function get_masterslider_names( $id_as_key = true, $limit = 0, $offset = 0, $o
647
 
648
  /**
649
  * Get an array containing row results (unserialized) from sliders table (with all slider table fields)
650
- *
651
  * @param int $limit Maximum number of records to return
652
  * @param int $offset The offset of the first row to return
653
  * @param string $orderby The field name to order results by
@@ -665,7 +665,7 @@ function get_mastersliders( $limit = 0, $offset = 0, $orderby = 'ID', $sort = 'D
665
 
666
  /**
667
  * Get option value
668
- *
669
  * @param string $option_name a unique name for option
670
  * @param string $default_value a value to return by function if option_value not found
671
  * @return string option_value or default_value
@@ -678,10 +678,10 @@ function msp_get_option( $option_name, $default_value = '' ) {
678
 
679
  /**
680
  * Update option value in options table, if option_name does not exist then insert new option
681
- *
682
  * @param string $option_name a unique name for option
683
  * @param string $option_value the option value
684
- *
685
  * @return int|false ID number for new inserted row or false if the option can not be updated.
686
  */
687
  function msp_update_option( $option_name, $option_value = '' ) {
@@ -692,7 +692,7 @@ function msp_update_option( $option_name, $option_value = '' ) {
692
 
693
  /**
694
  * Remove a specific option name from options table
695
- *
696
  * @param string $option_name a unique name for option
697
  * @return bool True, if option is successfully deleted. False on failure.
698
  */
@@ -728,7 +728,7 @@ function msp_get_setting( $option, $section, $default = '' ) {
728
  function msp_the_trimmed_string( $string, $max_length = 1000, $more = ' ...' ){
729
  echo msp_get_trimmed_string( $string, $max_length, $more );
730
  }
731
-
732
  /**
733
  * Trim string by character length
734
  *
@@ -754,13 +754,13 @@ function msp_the_trim_excerpt( $post_id = null, $char_length = null, $exclude_st
754
  }
755
 
756
  if( ! function_exists( 'msp_get_the_trim_excerpt' ) ){
757
-
758
  // make shortcodes executable in excerpt
759
  function msp_get_the_trim_excerpt( $post_id = null, $char_length = null, $exclude_strip_shortcode_tags = null ) {
760
  $post = get_post( $post_id );
761
  if( ! isset( $post ) ) return "";
762
-
763
-
764
  $excerpt = $post->post_content;
765
  $raw_excerpt = $excerpt;
766
  $excerpt = apply_filters( 'the_content', $excerpt );
@@ -773,7 +773,7 @@ function msp_the_trim_excerpt( $post_id = null, $char_length = null, $exclude_st
773
 
774
  return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
775
  }
776
-
777
  }
778
 
779
  /*-----------------------------------------------------------------------------------*/
@@ -782,13 +782,13 @@ function msp_the_trim_excerpt( $post_id = null, $char_length = null, $exclude_st
782
 
783
  function msp_strip_shortcodes( $content, $exclude_strip_shortcode_tags = null ) {
784
  if( ! $content ) return $content;
785
-
786
  if( ! $exclude_strip_shortcode_tags )
787
  $exclude_strip_shortcode_tags = msp_exclude_strip_shortcode_tags();
788
-
789
  if( empty( $exclude_strip_shortcode_tags ) || !is_array( $exclude_strip_shortcode_tags ) )
790
  return preg_replace( '/\[[^\]]*\]/', '', $content );
791
-
792
  $exclude_codes = join( '|', $exclude_strip_shortcode_tags );
793
  return preg_replace( "~(?:\[/?)(?!(?:$exclude_codes))[^/\]]+/?\]~s", '', $content );
794
  }
@@ -813,7 +813,7 @@ function msp_get_custom_post_types(){
813
 
814
 
815
  /**
816
- * Whether a plugin is active or not
817
  * @param string $plugin_basename plugin directory name and mail file address
818
  * @return bool True if plugin is active and FALSE otherwise
819
  */
@@ -826,7 +826,7 @@ function msp_is_plugin_active( $plugin_basename ){
826
  function msp_get_template_tag_value( $tag_name, $post = null, $args = null ){
827
  $post = get_post( $post );
828
  $value = '{{' . $tag_name . '}}';
829
-
830
  switch ( $tag_name ) {
831
 
832
  case 'title':
@@ -1023,7 +1023,7 @@ function msp_maybe_base64_encode ( $data ) {
1023
 
1024
 
1025
  function msp_escape_tag( $tag_name ){
1026
- return tag_escape( $tag_name );
1027
  }
1028
 
1029
 
@@ -1043,4 +1043,4 @@ function msp_is_key_true( $array, $key, $default = 'true' ) {
1043
  } else {
1044
  return $default;
1045
  }
1046
- }
1
+ <?php
2
  /**
3
  *
4
  * @package MasterSlider
12
 
13
  /**
14
  * Displays master slider markup for specific slider ID
15
+ *
16
  * @param int $slider_id the slider id
17
  * @return void
18
  */
27
 
28
  /**
29
  * Get master slider markup for specific slider ID
30
+ *
31
  * @param int $slider_id the slider id
32
  * @return string the slider markup
33
  */
35
 
36
  function get_masterslider( $slider_id, $args = NULL ){
37
  global $msp_instances;
38
+
39
  // through an error if slider id is not valid number
40
+ if( ! is_numeric( $slider_id ) )
41
  return __( 'Invalid slider id. Master Slider ID must be a valid number.', 'master-slider' );
42
 
43
  // load masterslider script
45
  wp_enqueue_script( 'masterslider-core');
46
 
47
  $is_cache_enabled = ( 'on' == msp_get_setting( '_enable_cache', 'msp_general_setting', 'off' ) );
48
+
49
  // try to get cached copy of slider transient output
50
  if( ! $is_cache_enabled || false === ( $slider_output = msp_get_slider_transient( $slider_id ) ) || empty( $slider_output ) ) {
51
  $slider_output = msp_generate_slider_output( $slider_id, $is_cache_enabled );
52
+
53
  } elseif( $is_cache_enabled ) {
54
  $msp_instances = is_array( $msp_instances ) ? $msp_instances : array();
55
+ $msp_instances[ $slider_id ][] = $slider_id;
56
  // if there was same slider on one page generate new ones
57
  if( count( $msp_instances[ $slider_id ] ) > 1 ){
58
  $slider_output = msp_generate_slider_output( $slider_id );
66
 
67
  /**
68
  * Convert panel data to ms_slider shortcode and return it
69
+ *
70
  * @param string $panel_data a serialized string containing panel data object
71
  * @return string ms_slider shortcode or empty string
72
  */
73
  function msp_panel_data_2_ms_slider_shortcode( $panel_data, $slider_id = null ){
74
+ if ( ! $panel_data )
75
  return '';
76
 
77
  $parser = msp_get_parser();
78
  $parser->set_data( $panel_data, $slider_id );
79
+ $results = $parser->get_results();
80
 
81
  // shortcode generation
82
  $sf = msp_get_shortcode_factory();
88
 
89
  /**
90
  * Convert panel data to ms_slider shortcode and return it
91
+ *
92
  * @param int $slider_id The ID of the slider you'd like to get its shortcode
93
  * @return string ms_slider shortcode or empty string
94
  */
103
 
104
  /**
105
  * Convert panel data to ms_slider shortcode and return it
106
+ *
107
  * @param int $slider_id The ID of the slider you'd like to get its output
108
  * @param bool $cache_output Whether to store output in cache or not
109
  * @return string The slider output
120
 
121
  /**
122
  * Flush and re-cache slider output if slider cache is enabled
123
+ *
124
  * @param int $slider_id The ID of the slider you'd like to flush the cache
125
  * @return bool True if the cache is flushed and false otherwise
126
  */
127
  function msp_flush_slider_cache( $slider_id ){
128
+
129
  $is_cache_enabled = ( 'on' == msp_get_setting( '_enable_cache', 'msp_general_setting', 'off' ) );
130
  if( $is_cache_enabled ){
131
  msp_generate_slider_output( $slider_id, true );
137
 
138
  /**
139
  * Flush and re-cache all slideres if slider cache is enabled
140
+ *
141
  * @return bool True if the cache is flushed and false otherwise
142
  */
143
  function msp_flush_all_sliders_cache(){
144
+
145
  $is_cache_enabled = ( 'on' == msp_get_setting( '_enable_cache', 'msp_general_setting', 'off' ) );
146
  if( ! $is_cache_enabled ){ return false; }
147
 
149
  foreach ( $all_sliders as $slider_id => $slider_name ) {
150
  msp_generate_slider_output( $slider_id, true );
151
  }
152
+
153
  return true;
154
  }
155
 
157
  /**
158
  * Takes a slider ID and returns slider's parsed data in an array
159
  * You can use this function to access slider data (setting, slides, layers, styles)
160
+ *
161
  * @param int $slider_id The ID of the slider you'd like to get its parsed data
162
  * @return array array containing slider's parsed data
163
  */
166
  global $mspdb;
167
  $panel_data = $mspdb->get_slider_field_val( $slider_id, 'params' );
168
 
169
+ if ( ! $panel_data )
170
  return array();
171
 
172
  $parser = msp_get_parser();
177
 
178
  /**
179
  * Load and init parser class on demand
180
+ *
181
  * @return Object instance of MSP_Parser class
182
  */
183
  function msp_get_parser() {
184
  include_once( MSWP_AVERTA_ADMIN_DIR . '/includes/classes/class-msp-parser.php' );
185
+
186
  global $msp_parser;
187
  if ( is_null( $msp_parser ) )
188
  $msp_parser = new MSP_Parser();
189
+
190
  return $msp_parser;
191
  }
192
 
193
 
194
  /**
195
  * Load and init shortcode_factory class on demand
196
+ *
197
  * @return Object instance of MSP_Shortcode_Factory class
198
  */
199
  function msp_get_shortcode_factory () {
200
  include_once( MSWP_AVERTA_ADMIN_DIR . '/includes/classes/class-msp-shortcode-factory.php' );
201
+
202
  global $mspsf;
203
  if ( is_null( $mspsf ) )
204
  $mspsf = new MSP_Shortcode_Factory();
205
+
206
  return $mspsf;
207
  }
208
 
209
 
210
  /**
211
  * Load and init post_slider class on demand
212
+ *
213
  * @return Object instance of MSP_Post_Slider class
214
  */
215
  function msp_get_post_slider_class() {
216
  include_once( MSWP_AVERTA_ADMIN_DIR . '/includes/classes/class-msp-post-sliders.php' );
217
+
218
  global $msp_post_slider;
219
  if ( is_null( $msp_post_slider ) )
220
  $msp_post_slider = new MSP_Post_Slider();
221
+
222
  return $msp_post_slider;
223
  }
224
 
225
 
226
  /**
227
  * Load and init wc_product_slider class on demand
228
+ *
229
  * @return Object instance of MSP_WC_Product_Slider class
230
  */
231
  function msp_get_wc_slider_class() {
232
  include_once( MSWP_AVERTA_ADMIN_DIR . '/includes/classes/class-msp-wc-product-slider.php' );
233
+
234
  global $msp_wc_slider;
235
  if ( is_null( $msp_wc_slider ) )
236
  $msp_wc_slider = new MSP_WC_Product_Slider();
237
+
238
  return $msp_wc_slider;
239
  }
240
 
241
 
242
  /**
243
  * Update custom_css, custom_fonts and slide num fields in sliders table
244
+ *
245
+ * @param int $slider_id the slider id that is going to be updated
246
  * @return int|false The number of rows updated, or false on error.
247
  */
248
  function msp_update_slider_custom_css_and_fonts( $slider_id ) {
261
  // load and get parser and start parsing data
262
  $parser = msp_get_parser();
263
  $parser->set_data( $slider_params, $slider_id );
264
+
265
  // get required parsed data
266
  $slider_setting = $parser->get_slider_setting();
267
  $slides = $parser->get_slides();
272
  'custom_styles' => $slider_custom_styles,
273
  'custom_fonts' => $slider_setting[ 'gfonts' ]
274
  );
275
+
276
  msp_save_custom_styles();
277
 
278
  $mspdb->update_slider( $slider_id, $fields );
281
 
282
  /**
283
  * Set/update the value of a slider output transient.
284
+ *
285
  * @param int $slider_id The slider id
286
  * @param mixed $value Slider transient output
287
  * @param int $cache_period Time until expiration in hours, default 12
295
 
296
  /**
297
  * Get the value of a slider output transient.
298
+ *
299
  * @param int $slider_id The slider id
300
  * @return mixed Value of transient or False If the transient does not exist or does not have a value
301
  */
306
 
307
  /**
308
  * Whether it's absolute url or not
309
+ *
310
  * @param string $url The URL
311
  * @return bool TRUE if the URL is absolute
312
  */
317
 
318
  /**
319
  * Whether the URL contains upload directory path or not
320
+ *
321
  * @param string $url The URL
322
  * @return bool TRUE if the URL is absolute
323
  */
329
 
330
  /**
331
  * Print absolute URL for media file event if the URL is relative
332
+ *
333
  * @param string $url The link to media file
334
  * @return void
335
  */
339
 
340
  /**
341
  * Get absolute URL for media file event if the URL is relative
342
+ *
343
  * @param string $url The link to media file
344
  * @return string The absolute URL to media file
345
  */
347
 
348
  function msp_get_the_absolute_media_url( $url ){
349
  if( ! isset( $url ) || empty( $url ) ) return '';
350
+
351
  if( msp_is_absolute_url( $url ) || msp_contains_upload_dir( $url ) ) return $url;
352
+
353
  $uploads = wp_upload_dir();
354
  return set_url_scheme( $uploads['baseurl'] . $url );
355
  }
359
 
360
  /**
361
  * Print relative URL for media file event if the URL is absolute
362
+ *
363
  * @param string $url The link to media file
364
  * @return void
365
  */
369
 
370
  /**
371
  * Get relative URL for media file event if the URL is absolute
372
+ *
373
  * @param string $url The link to media file
374
  * @return string The absolute URL to media file
375
  */
377
 
378
  function msp_get_the_relative_media_url($url){
379
  if( ! isset( $url ) || empty( $url ) ) return '';
380
+
381
+ // if it's not internal absolute url
382
  if( ! msp_contains_upload_dir( $url ) ) return $url;
383
+
384
  $uploads_dir = wp_upload_dir();
385
  return str_replace( $uploads_dir['baseurl'], '', $url );
386
  }
389
 
390
 
391
  /*-----------------------------------------------------------------------------------*/
392
+ /* Custom functions for resizing images
393
  /*-----------------------------------------------------------------------------------*/
394
 
395
 
399
  function msp_the_resized_image( $img_url = "", $width = null , $height = null, $crop = null , $quality = 100 ) {
400
  echo msp_get_the_resized_image( $img_url , $width , $height , $crop , $quality );
401
  }
402
+
403
  function msp_get_the_resized_image( $img_url = "", $width = null , $height = null, $crop = null , $quality = 100 ) {
404
  return '<img src="'.msp_aq_resize( $img_url, $width, $height, $crop, $quality ).'" alt="" />';
405
  }
406
  /**
407
  * Get resized image by image URL
408
+ *
409
  * @param string $img_url The original image URL
410
  * @param integer $width New image Width
411
  * @param integer $height New image height
417
 
418
  function msp_get_the_resized_image_src( $img_url = "", $width = null , $height = null, $crop = null , $quality = 100 ) {
419
  $resized_img_url = msp_aq_resize( $img_url, $width, $height, $crop, $quality );
420
+ if( empty( $resized_img_url ) )
421
  $resized_img_url = $img_url;
422
  return apply_filters( 'msp_get_the_resized_image_src', $resized_img_url, $img_url );
423
  }
436
  // return resized image tag
437
  function msp_get_the_resized_attachment( $attach_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
438
  $image_src = msp_get_the_resized_attachment_src( $attach_id, $width , $height, $crop, $quality );
439
+
440
  return $image_src ? '<img src="'.$image_src.'" alt="" />': '';
441
  }
442
 
443
  /**
444
  * Get resized image by attachment id
445
+ *
446
  * @param string $attach_id The attachment id
447
  * @param integer $width New image Width
448
  * @param integer $height New image height
451
  * @return string new image src
452
  */
453
  if( ! function_exists( 'msp_get_the_resized_attachment_src' ) ){
454
+
455
  function msp_get_the_resized_attachment_src( $attach_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
456
  if( is_null( $attach_id ) ) return '';
457
+
458
+ $img_url = wp_get_attachment_url( $attach_id ); //get img URL
459
  return ! empty( $img_url ) ? msp_aq_resize( $img_url, $width, $height, $crop, $quality ) : false;
460
  }
461
 
468
  function msp_the_post_thumbnail( $post_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
469
  echo msp_get_the_post_thumbnail( $post_id, $width , $height, $crop, $quality);
470
  }
471
+
472
  // return resized image tag
473
  function msp_get_the_post_thumbnail( $post_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
474
  $image_src = msp_get_the_post_thumbnail_src( $post_id, $width , $height, $crop, $quality);
477
 
478
  /**
479
  * Get resized image by post id
480
+ *
481
  * @param string $post_id The post id
482
  * @param integer $width New image Width
483
  * @param integer $height New image height
486
  * @return string new image src
487
  */
488
  if( ! function_exists( 'msp_get_the_post_thumbnail_src' ) ){
489
+
490
  function msp_get_the_post_thumbnail_src( $post_id = null, $width = null , $height = null, $crop = null , $quality = 100 ) {
491
  $post_id = is_null( $post_id ) ? get_the_ID() : $post_id;
492
  $post_thumbnail_id = get_post_thumbnail_id( $post_id );
493
+
494
+ $img_url = wp_get_attachment_url( $post_thumbnail_id ); //get img URL
495
+
496
  $resized_img = $post_thumbnail_id ? aq_resize( $img_url, $width, $height, $crop, $quality ) : false;
497
 
498
  return apply_filters( 'msp_get_the_post_thumbnail_src', $resized_img, $img_url, $width, $height, $crop, $quality );
499
  }
500
+
501
  }
502
 
503
  /**
507
  * @return string Returns a full URI for featured image or false on failure.
508
  */
509
  if( ! function_exists( 'msp_get_the_post_thumbnail_full_src' ) ){
510
+
511
  function msp_get_the_post_thumbnail_full_src( $post_id = null ) {
512
  $post_id = is_null( $post_id ) ? get_the_ID() : $post_id;
513
  $post_thumbnail_id = get_post_thumbnail_id( $post_id );
514
+
515
+ return wp_get_attachment_url( $post_thumbnail_id );
516
  }
517
+
518
  }
519
 
520
  /**
522
  *
523
  * @param integer $post_id The post id to get post image of
524
  * @param string $image_from where to look for post image. possible values are : auto, featured, first. Default to 'auto'
525
+ *
526
  * @return string Returns a full URI for post image or empty string on failure.
527
  */
528
  if( ! function_exists( 'msp_get_auto_post_thumbnail_src' ) ){
529
+
530
  function msp_get_auto_post_thumbnail_src( $post_id = null, $image_from = 'auto' ) {
531
 
532
  $post = get_post( $post_id );
550
  $content = get_the_content();
551
  $img_src = msp_get_first_image_src_from_string( $content );
552
  }
553
+
554
  return $img_src;
555
  }
556
+
557
  }
558
 
559
 
561
 
562
  /**
563
  * Get first image tag from string
564
+ *
565
  * @param string $content The content to extract image from
566
  * @return string First image tag on success and empty string if nothing found
567
  */
572
 
573
  /**
574
  * Get first image src from content
575
+ *
576
  * @param string $content The content to extract image from
577
  * @return string First image URL on success and empty string if nothing found
578
  */
580
  $images = msp_extract_string_images( $content );
581
  return ( $images && count( $images[1]) ) ? $images[1][0] : '';
582
  }
583
+
584
  /**
585
  * Extract all images from content
586
+ *
587
  * @param string $content The content to extract images from
588
  * @return array List of images in array
589
  */
590
  if( ! function_exists( 'msp_extract_string_images' ) ){
591
+
592
  function msp_extract_string_images( $content ){
593
  preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', $content, $matches );
594
  return isset( $matches ) && count( $matches[0] ) ? $matches : false;
595
  }
596
+
597
  }
598
 
599
 
602
 
603
  /**
604
  * Get list of created slider IDs and names in an array
605
+ *
606
  * @param bool $id_as_key If <code>true</code> returns slider ID as array key and slider name as value , reverse on <code>false</code>
607
  * @param int $limit Maximum number of sliders to return - 0 means no limit
608
  * @param int $offset The offset of the first row to return
609
  * @param string $orderby The field name to order results by
610
  * @param string $sort The sort type. 'DESC' or 'DESC'
611
+ *
612
  * @return array An array containing sliders ID as array key and slider name as value
613
  *
614
  * @example $id_as_key = true :
615
  * array(
616
+ * '12' => 'Slider sample title 1',
617
  * '13' => 'Slider sample title 2'
618
  * )
619
  *
620
  * $id_as_key = false :
621
  * array(
622
+ * 'Slider sample title 1' => '12',
623
+ * 'Slider sample title 2' => '13'
624
  * )
625
  */
626
  function get_masterslider_names( $id_as_key = true, $limit = 0, $offset = 0, $orderby = 'ID', $sort = 'DESC' ){
647
 
648
  /**
649
  * Get an array containing row results (unserialized) from sliders table (with all slider table fields)
650
+ *
651
  * @param int $limit Maximum number of records to return
652
  * @param int $offset The offset of the first row to return
653
  * @param string $orderby The field name to order results by
665
 
666
  /**
667
  * Get option value
668
+ *
669
  * @param string $option_name a unique name for option
670
  * @param string $default_value a value to return by function if option_value not found
671
  * @return string option_value or default_value
678
 
679
  /**
680
  * Update option value in options table, if option_name does not exist then insert new option
681
+ *
682
  * @param string $option_name a unique name for option
683
  * @param string $option_value the option value
684
+ *
685
  * @return int|false ID number for new inserted row or false if the option can not be updated.
686
  */
687
  function msp_update_option( $option_name, $option_value = '' ) {
692
 
693
  /**
694
  * Remove a specific option name from options table
695
+ *
696
  * @param string $option_name a unique name for option
697
  * @return bool True, if option is successfully deleted. False on failure.
698
  */
728
  function msp_the_trimmed_string( $string, $max_length = 1000, $more = ' ...' ){
729
  echo msp_get_trimmed_string( $string, $max_length, $more );
730
  }
731
+
732
  /**
733
  * Trim string by character length
734
  *
754
  }
755
 
756
  if( ! function_exists( 'msp_get_the_trim_excerpt' ) ){
757
+
758
  // make shortcodes executable in excerpt
759
  function msp_get_the_trim_excerpt( $post_id = null, $char_length = null, $exclude_strip_shortcode_tags = null ) {
760
  $post = get_post( $post_id );
761
  if( ! isset( $post ) ) return "";
762
+
763
+
764
  $excerpt = $post->post_content;
765
  $raw_excerpt = $excerpt;
766
  $excerpt = apply_filters( 'the_content', $excerpt );
773
 
774
  return apply_filters( 'wp_trim_excerpt', $text, $raw_excerpt );
775
  }
776
+
777
  }
778
 
779
  /*-----------------------------------------------------------------------------------*/
782
 
783
  function msp_strip_shortcodes( $content, $exclude_strip_shortcode_tags = null ) {
784
  if( ! $content ) return $content;
785
+
786
  if( ! $exclude_strip_shortcode_tags )
787
  $exclude_strip_shortcode_tags = msp_exclude_strip_shortcode_tags();
788
+
789
  if( empty( $exclude_strip_shortcode_tags ) || !is_array( $exclude_strip_shortcode_tags ) )
790
  return preg_replace( '/\[[^\]]*\]/', '', $content );
791
+
792
  $exclude_codes = join( '|', $exclude_strip_shortcode_tags );
793
  return preg_replace( "~(?:\[/?)(?!(?:$exclude_codes))[^/\]]+/?\]~s", '', $content );
794
  }
813
 
814
 
815
  /**
816
+ * Whether a plugin is active or not
817
  * @param string $plugin_basename plugin directory name and mail file address
818
  * @return bool True if plugin is active and FALSE otherwise
819
  */
826
  function msp_get_template_tag_value( $tag_name, $post = null, $args = null ){
827
  $post = get_post( $post );
828
  $value = '{{' . $tag_name . '}}';
829
+
830
  switch ( $tag_name ) {
831
 
832
  case 'title':
1023
 
1024
 
1025
  function msp_escape_tag( $tag_name ){
1026
+ return tag_escape( $tag_name );
1027
  }
1028
 
1029
 
1043
  } else {
1044
  return $default;
1045
  }
1046
+ }
master-slider.php CHANGED
@@ -11,13 +11,13 @@
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.7.1
15
  * Author: averta
16
  * Author URI: http://averta.net
17
  * Text Domain: master-slider
18
  * License URI: license.txt
19
  * Domain Path: /languages
20
- * Tested up to: 4.3.1
21
  */
22
 
23
  // If this file is called directly, abort.
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.8.0
15
  * Author: averta
16
  * Author URI: http://averta.net
17
  * Text Domain: master-slider
18
  * License URI: license.txt
19
  * Domain Path: /languages
20
+ * Tested up to: 4.5.3
21
  */
22
 
23
  // If this file is called directly, abort.