1
|
|
|
<?php |
2
|
|
|
/* |
3
|
|
|
* Plugin Name: Meta Slider |
4
|
|
|
* Plugin URI: http://www.metaslider.com |
5
|
|
|
* Description: Easy to use slideshow plugin. Create SEO optimised responsive slideshows with Nivo Slider, Flex Slider, Coin Slider and Responsive Slides. |
6
|
|
|
* Version: 2.6.3 |
7
|
|
|
* Author: Matcha Labs |
8
|
|
|
* Author URI: http://www.matchalabs.com |
9
|
|
|
* License: GPLv2 or later |
10
|
|
|
* |
11
|
|
|
* This program is distributed in the hope that it will be useful, |
12
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
13
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14
|
|
|
* GNU General Public License for more details. |
15
|
|
|
*/ |
16
|
|
|
|
17
|
|
|
// disable direct access |
18
|
|
|
if (!defined('ABSPATH')) { |
19
|
|
|
exit; |
20
|
|
|
} |
21
|
|
|
|
22
|
|
|
define('METASLIDER_VERSION', '2.6.3'); |
23
|
|
|
define('METASLIDER_BASE_URL', plugins_url('ml-slider') . '/'); //plugin_dir_url(__FILE__) |
|
|
|
|
24
|
|
|
define('METASLIDER_ASSETS_URL', METASLIDER_BASE_URL . 'assets/'); |
25
|
|
|
define('METASLIDER_BASE_DIR_LONG', __DIR__); |
26
|
|
|
define('METASLIDER_INC_DIR', METASLIDER_BASE_DIR_LONG . '/inc/'); |
27
|
|
|
|
28
|
|
|
// include slider classes |
29
|
|
|
require_once METASLIDER_INC_DIR . 'slider/metaslider.class.php'; |
30
|
|
|
require_once METASLIDER_INC_DIR . 'slider/metaslider.coin.class.php'; |
31
|
|
|
require_once METASLIDER_INC_DIR . 'slider/metaslider.flex.class.php'; |
32
|
|
|
require_once METASLIDER_INC_DIR . 'slider/metaslider.nivo.class.php'; |
33
|
|
|
require_once METASLIDER_INC_DIR . 'slider/metaslider.responsive.class.php'; |
34
|
|
|
|
35
|
|
|
// include slide classes |
36
|
|
|
require_once METASLIDER_INC_DIR . 'slide/metaslide.class.php'; |
37
|
|
|
require_once METASLIDER_INC_DIR . 'slide/metaslide.image.class.php'; |
38
|
|
|
|
39
|
|
|
// include image helper |
40
|
|
|
require_once METASLIDER_INC_DIR . 'metaslider.imagehelper.class.php'; |
41
|
|
|
|
42
|
|
|
// include widget |
43
|
|
|
require_once METASLIDER_INC_DIR . 'metaslider.widget.class.php'; |
44
|
|
|
|
45
|
|
|
// include system check |
46
|
|
|
require_once METASLIDER_INC_DIR . 'metaslider.systemcheck.class.php'; |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Register the plugin. |
50
|
|
|
* |
51
|
|
|
* Display the administration panel, insert JavaScript etc. |
52
|
|
|
*/ |
53
|
|
|
class MetaSliderPlugin |
54
|
|
|
{ |
55
|
|
|
/** Current Slider **/ |
56
|
|
|
public $slider = null; |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Constructor |
60
|
|
|
*/ |
61
|
|
|
public function __construct() |
62
|
|
|
{ |
63
|
|
|
// create the admin menu/page |
64
|
|
|
add_action('admin_menu', [$this, 'register_admin_menu'], 9553); |
|
|
|
|
65
|
|
|
|
66
|
|
|
// register slider post type and taxonomy |
67
|
|
|
add_action('init', [$this, 'register_post_type']); |
68
|
|
|
add_action('init', [$this, 'register_taxonomy']); |
69
|
|
|
add_action('init', [$this, 'load_plugin_textdomain']); |
70
|
|
|
|
71
|
|
|
// register shortcodes |
72
|
|
|
add_shortcode('metaslider', [$this, 'register_shortcode']); |
|
|
|
|
73
|
|
|
add_shortcode('ml-slider', [$this, 'register_shortcode']); // backwards compatibility |
74
|
|
|
|
75
|
|
|
add_filter('media_upload_tabs', [$this, 'custom_media_upload_tab_name'], 998); |
|
|
|
|
76
|
|
|
add_filter('media_view_strings', [$this, 'custom_media_uploader_tabs'], 5); |
77
|
|
|
add_action('media_upload_vimeo', [$this, 'metaslider_pro_tab']); |
78
|
|
|
add_action('media_upload_youtube', [$this, 'metaslider_pro_tab']); |
79
|
|
|
add_action('media_upload_post_feed', [$this, 'metaslider_pro_tab']); |
80
|
|
|
add_action('media_upload_layer', [$this, 'metaslider_pro_tab']); |
81
|
|
|
|
82
|
|
|
add_filter('media_buttons_context', [$this, 'insert_metaslider_button']); |
83
|
|
|
add_action('admin_footer', [$this, 'admin_footer']); |
84
|
|
|
|
85
|
|
|
// add 'go pro' link to plugin options |
86
|
|
|
$plugin = plugin_basename(__FILE__); |
|
|
|
|
87
|
|
|
add_filter("plugin_action_links_{$plugin}", [$this, 'upgrade_to_pro']); |
88
|
|
|
|
89
|
|
|
$this->register_slide_types(); |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* Check our WordPress installation is compatible with Meta Slider |
94
|
|
|
*/ |
95
|
|
|
public function system_check() |
96
|
|
|
{ |
97
|
|
|
$systemCheck = new MetaSliderSystemCheck(); |
98
|
|
|
$systemCheck->check(); |
99
|
|
|
} |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* Add settings link on plugin page |
103
|
|
|
* @param $links |
104
|
|
|
* @return array |
105
|
|
|
*/ |
106
|
|
|
public function upgrade_to_pro($links) |
107
|
|
|
{ |
108
|
|
|
if (function_exists('is_plugin_active') && !is_plugin_active('ml-slider-pro/ml-slider-pro.php')) { |
109
|
|
|
$links[] = '<a href="http://www.metaslider.com/upgrade" target="_blank">' . __('Go Pro', 'metaslider') . '</a>'; |
|
|
|
|
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
return $links; |
113
|
|
|
} |
114
|
|
|
|
115
|
|
|
/** |
116
|
|
|
* Return the meta slider pro upgrade iFrame |
117
|
|
|
*/ |
118
|
|
|
public function metaslider_pro_tab() |
119
|
|
|
{ |
120
|
|
|
if (function_exists('is_plugin_active') && !is_plugin_active('ml-slider-pro/ml-slider-pro.php')) { |
121
|
|
|
return wp_iframe([$this, 'iframe']); |
|
|
|
|
122
|
|
|
} |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
/** |
126
|
|
|
* Media Manager iframe HTML |
127
|
|
|
*/ |
128
|
|
|
public function iframe() |
129
|
|
|
{ |
130
|
|
|
wp_enqueue_style('metaslider-admin-styles', METASLIDER_ASSETS_URL . 'metaslider/admin.css', false, METASLIDER_VERSION); |
|
|
|
|
131
|
|
|
wp_enqueue_script('google-font-api', 'http://fonts.googleapis.com/css?family=PT+Sans:400,700'); |
|
|
|
|
132
|
|
|
|
133
|
|
|
$link = apply_filters('metaslider_hoplink', 'http://www.metaslider.com/upgrade/'); |
|
|
|
|
134
|
|
|
$link .= '?utm_source=lite&utm_medium=more-slide-types&utm_campaign=pro'; |
135
|
|
|
|
136
|
|
|
echo "<div class='metaslider'>"; |
137
|
|
|
echo "<p style='text-align: center; font-size: 1.2em; margin-top: 50px;'>Get the Pro Addon pack to add support for: <b>Post Feed</b> Slides, <b>YouTube</b> Slides, <b>HTML</b> Slides & <b>Vimeo</b> Slides</p>"; |
138
|
|
|
echo "<p style='text-align: center; font-size: 1.2em;'><b>NEW: </b> Animated HTML <b>Layer</b> Slides (with an awesome Drag & Drop editor!)</p>"; |
139
|
|
|
echo "<p style='text-align: center; font-size: 1.2em;'><b></b> Live Theme Editor!</p>"; |
140
|
|
|
echo "<p style='text-align: center; font-size: 1.2em;'><b>NEW:</b> Thumbnail Navigation for Flex & Nivo Slider!</p>"; |
141
|
|
|
echo "<a class='probutton' href='{$link}' target='_blank'>Get <span class='logo'><strong>Meta</strong>Slider</span><span class='super'>Pro</span></a>"; |
142
|
|
|
echo "<span class='subtext'>Opens in a new window</span>"; |
143
|
|
|
echo '</div>'; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
/** |
147
|
|
|
* Register our slide types |
148
|
|
|
*/ |
149
|
|
|
private function register_slide_types() |
150
|
|
|
{ |
151
|
|
|
$image = new MetaImageSlide(); |
|
|
|
|
152
|
|
|
} |
153
|
|
|
|
154
|
|
|
/** |
155
|
|
|
* Initialise translations |
156
|
|
|
*/ |
157
|
|
|
public function load_plugin_textdomain() |
158
|
|
|
{ |
159
|
|
|
load_plugin_textdomain('metaslider', false, \dirname(plugin_basename(__FILE__)) . '/languages/'); |
|
|
|
|
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
/** |
163
|
|
|
* Update the tab options in the media manager |
164
|
|
|
* @param $strings |
165
|
|
|
* @return mixed |
166
|
|
|
*/ |
167
|
|
|
public function custom_media_uploader_tabs($strings) |
168
|
|
|
{ |
169
|
|
|
//update strings |
170
|
|
|
if (\Xmf\Request::hasVar('page', 'GET') && 'metaslider' == $_GET['page']) { |
171
|
|
|
$strings['insertMediaTitle'] = __('Image', 'metaslider'); |
|
|
|
|
172
|
|
|
$strings['insertIntoPost'] = __('Add to slider', 'metaslider'); |
173
|
|
|
// remove options |
174
|
|
|
if (isset($strings['createGalleryTitle'])) { |
175
|
|
|
unset($strings['createGalleryTitle']); |
176
|
|
|
} |
177
|
|
|
if (isset($strings['insertFromUrlTitle'])) { |
178
|
|
|
unset($strings['insertFromUrlTitle']); |
179
|
|
|
} |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
return $strings; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
/** |
186
|
|
|
* Add extra tabs to the default wordpress Media Manager iframe |
187
|
|
|
* |
188
|
|
|
* |
189
|
|
|
* @param mixed $tabs |
190
|
|
|
* @return array |
191
|
|
|
*/ |
192
|
|
|
public function custom_media_upload_tab_name($tabs) |
193
|
|
|
{ |
194
|
|
|
$metaslider_tabs = ['post_feed', 'layer', 'youtube', 'vimeo']; |
195
|
|
|
|
196
|
|
|
// restrict our tab changes to the meta slider plugin page |
197
|
|
|
if ((isset($_GET['page']) && 'metaslider' === $_GET['page']) || (isset($_GET['tab']) && in_array($_GET['tab'], $metaslider_tabs))) { |
198
|
|
|
$newtabs = []; |
199
|
|
|
|
200
|
|
|
if (function_exists('is_plugin_active') && !is_plugin_active('ml-slider-pro/ml-slider-pro.php')) { |
201
|
|
|
$newtabs = [ |
202
|
|
|
'post_feed' => __('Post Feed', 'metaslider'), |
|
|
|
|
203
|
|
|
'vimeo' => __('Vimeo', 'metaslider'), |
204
|
|
|
'youtube' => __('YouTube', 'metaslider'), |
205
|
|
|
'layer' => __('Layer Slide', 'metaslider'), |
206
|
|
|
]; |
207
|
|
|
} |
208
|
|
|
|
209
|
|
|
if (isset($tabs['nextgen'])) { |
210
|
|
|
unset($tabs['nextgen']); |
211
|
|
|
} |
212
|
|
|
|
213
|
|
|
return array_merge($tabs, $newtabs); |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
return $tabs; |
217
|
|
|
} |
218
|
|
|
|
219
|
|
|
/** |
220
|
|
|
* Rehister admin styles |
221
|
|
|
*/ |
222
|
|
|
public function register_admin_styles() |
223
|
|
|
{ |
224
|
|
|
wp_enqueue_style('metaslider-admin-styles', METASLIDER_ASSETS_URL . 'metaslider/admin.css', false, METASLIDER_VERSION); |
|
|
|
|
225
|
|
|
wp_enqueue_style('metaslider-colorbox-styles', METASLIDER_ASSETS_URL . 'colorbox/colorbox.css', false, METASLIDER_VERSION); |
226
|
|
|
wp_enqueue_style('metaslider-tipsy-styles', METASLIDER_ASSETS_URL . 'tipsy/tipsy.css', false, METASLIDER_VERSION); |
227
|
|
|
|
228
|
|
|
do_action('metaslider_register_admin_styles'); |
|
|
|
|
229
|
|
|
} |
230
|
|
|
|
231
|
|
|
/** |
232
|
|
|
* Register admin JavaScript |
233
|
|
|
*/ |
234
|
|
|
public function register_admin_scripts() |
235
|
|
|
{ |
236
|
|
|
if (wp_script_is('wp-auth-check', 'queue')) { |
|
|
|
|
237
|
|
|
// meta slider checks for active AJAX requests in order to show the spinner |
238
|
|
|
// .. but the auth-check runs an AJAX request every 15 seconds |
239
|
|
|
// deregister the script that displays the login panel if the user becomes logged |
240
|
|
|
// out at some point |
241
|
|
|
// todo: implement some more intelligent request checking |
242
|
|
|
wp_deregister_script('wp-auth-check'); |
|
|
|
|
243
|
|
|
wp_register_script('wp-auth-check', null); // fix php notice |
|
|
|
|
244
|
|
|
} |
245
|
|
|
|
246
|
|
|
// media library dependencies |
247
|
|
|
wp_enqueue_media(); |
|
|
|
|
248
|
|
|
|
249
|
|
|
// plugin dependencies |
250
|
|
|
wp_enqueue_script('jquery-ui-core', ['jquery']); |
|
|
|
|
251
|
|
|
wp_enqueue_script('jquery-ui-sortable', ['jquery', 'jquery-ui-core']); |
252
|
|
|
wp_enqueue_script('metaslider-colorbox', METASLIDER_ASSETS_URL . 'colorbox/jquery.colorbox-min.js', ['jquery'], METASLIDER_VERSION); |
253
|
|
|
wp_enqueue_script('metaslider-tipsy', METASLIDER_ASSETS_URL . 'tipsy/jquery.tipsy.js', ['jquery'], METASLIDER_VERSION); |
254
|
|
|
wp_enqueue_script('metaslider-admin-script', METASLIDER_ASSETS_URL . 'metaslider/admin.js', ['jquery', 'metaslider-tipsy', 'media-upload'], METASLIDER_VERSION); |
255
|
|
|
wp_enqueue_script('metaslider-admin-addslide', METASLIDER_ASSETS_URL . 'metaslider/image/image.js', ['metaslider-admin-script'], METASLIDER_VERSION); |
256
|
|
|
|
257
|
|
|
// localise the JS |
258
|
|
|
wp_localize_script('metaslider-admin-addslide', 'metaslider_image', [ |
|
|
|
|
259
|
|
|
'addslide_nonce' => wp_create_nonce('metaslider_addslide'), |
|
|
|
|
260
|
|
|
]); |
261
|
|
|
|
262
|
|
|
// localise the JS |
263
|
|
|
wp_localize_script('metaslider-admin-script', 'metaslider', [ |
264
|
|
|
'url' => __('URL', 'metaslider'), |
|
|
|
|
265
|
|
|
'caption' => __('Caption', 'metaslider'), |
266
|
|
|
'new_window' => __('New Window', 'metaslider'), |
267
|
|
|
'confirm' => __('Are you sure?', 'metaslider'), |
268
|
|
|
'ajaxurl' => admin_url('admin-ajax.php'), |
|
|
|
|
269
|
|
|
'resize_nonce' => wp_create_nonce('metaslider_resize'), |
270
|
|
|
'iframeurl' => METASLIDER_BASE_URL . 'preview.php', |
271
|
|
|
'useWithCaution' => __("Caution: This setting is for advanced developers only. If you're unsure, leave it checked.", 'metaslider'), |
272
|
|
|
]); |
273
|
|
|
|
274
|
|
|
do_action('metaslider_register_admin_scripts'); |
|
|
|
|
275
|
|
|
} |
276
|
|
|
|
277
|
|
|
/** |
278
|
|
|
* Add the menu page |
279
|
|
|
*/ |
280
|
|
|
public function register_admin_menu() |
281
|
|
|
{ |
282
|
|
|
$title = apply_filters('metaslider_menu_title', 'Meta Slider'); |
|
|
|
|
283
|
|
|
|
284
|
|
|
$page = add_menu_page($title, $title, 'edit_others_posts', 'metaslider', [ |
|
|
|
|
285
|
|
|
$this, |
286
|
|
|
'render_admin_page', |
287
|
|
|
], METASLIDER_ASSETS_URL . 'metaslider/matchalabs.png', 9501); |
288
|
|
|
|
289
|
|
|
// ensure our JavaScript is only loaded on the Meta Slider admin page |
290
|
|
|
add_action('admin_print_scripts-' . $page, [$this, 'register_admin_scripts']); |
|
|
|
|
291
|
|
|
add_action('admin_print_styles-' . $page, [$this, 'register_admin_styles']); |
292
|
|
|
add_action('load-' . $page, [$this, 'help_tab']); |
293
|
|
|
} |
294
|
|
|
|
295
|
|
|
/** |
296
|
|
|
* Upgrade CTA. |
297
|
|
|
*/ |
298
|
|
|
public function go_pro_cta() |
299
|
|
|
{ |
300
|
|
|
if (function_exists('is_plugin_active') && !is_plugin_active('ml-slider-pro/ml-slider-pro.php')) { |
301
|
|
|
$link = apply_filters('metaslider_hoplink', 'http://www.metaslider.com/upgrade/'); |
|
|
|
|
302
|
|
|
|
303
|
|
|
$link .= '?utm_source=lite&utm_medium=nag&utm_campaign=pro'; |
304
|
|
|
|
305
|
|
|
$goPro = "<div style='display: none;' id='screen-options-link-wrap'><a target='_blank' class='show-settings' href='{$link}'>Meta Slider v" . METASLIDER_VERSION . ' - ' . __('Upgrade to Pro $19', 'metaslider') . '</a></div>'; |
|
|
|
|
306
|
|
|
|
307
|
|
|
echo $goPro; |
308
|
|
|
} |
309
|
|
|
} |
310
|
|
|
|
311
|
|
|
public function help_tab() |
312
|
|
|
{ |
313
|
|
|
$screen = get_current_screen(); |
|
|
|
|
314
|
|
|
|
315
|
|
|
// documentation tab |
316
|
|
|
$screen->add_help_tab([ |
317
|
|
|
'id' => 'documentation', |
318
|
|
|
'title' => __('Documentation'), |
|
|
|
|
319
|
|
|
'content' => "<p><a href='http://www.metaslider.com/documentation/' target='blank'>Meta Slider Documentation</a></p>", |
320
|
|
|
]); |
321
|
|
|
} |
322
|
|
|
|
323
|
|
|
/** |
324
|
|
|
* Register ML Slider post type |
325
|
|
|
*/ |
326
|
|
|
public function register_post_type() |
327
|
|
|
{ |
328
|
|
|
register_post_type('ml-slider', [ |
|
|
|
|
329
|
|
|
'query_var' => false, |
330
|
|
|
'rewrite' => false, |
331
|
|
|
'public' => true, |
332
|
|
|
'show_ui' => false, |
333
|
|
|
'labels' => [ |
334
|
|
|
'name' => 'Meta Slider', |
335
|
|
|
], |
336
|
|
|
]); |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* Register taxonomy to store slider => slides relationship |
341
|
|
|
*/ |
342
|
|
|
public function register_taxonomy() |
343
|
|
|
{ |
344
|
|
|
register_taxonomy('ml-slider', 'attachment', [ |
|
|
|
|
345
|
|
|
'hierarchical' => true, |
346
|
|
|
'public' => false, |
347
|
|
|
'query_var' => false, |
348
|
|
|
'rewrite' => false, |
349
|
|
|
]); |
350
|
|
|
} |
351
|
|
|
|
352
|
|
|
/** |
353
|
|
|
* Shortcode used to display slideshow |
354
|
|
|
* |
355
|
|
|
* @param $atts |
356
|
|
|
* @return string HTML output of the shortcode |
357
|
|
|
*/ |
358
|
|
|
public function register_shortcode($atts) |
359
|
|
|
{ |
360
|
|
|
if (!isset($atts['id'])) { |
361
|
|
|
return false; |
|
|
|
|
362
|
|
|
} |
363
|
|
|
|
364
|
|
|
// we have an ID to work with |
365
|
|
|
$slider = get_post($atts['id']); |
|
|
|
|
366
|
|
|
|
367
|
|
|
// check the slider is published |
368
|
|
|
if ('publish' !== $slider->post_status) { |
369
|
|
|
return false; |
|
|
|
|
370
|
|
|
} |
371
|
|
|
|
372
|
|
|
// lets go |
373
|
|
|
$this->set_slider($atts['id'], $atts); |
374
|
|
|
$this->slider->enqueue_scripts(); |
375
|
|
|
|
376
|
|
|
return $this->slider->render_public_slides(); |
377
|
|
|
} |
378
|
|
|
|
379
|
|
|
/** |
380
|
|
|
* Set the current slider |
381
|
|
|
* @param $id |
382
|
|
|
* @param array $shortcode_settings |
383
|
|
|
*/ |
384
|
|
|
public function set_slider($id, $shortcode_settings = []) |
385
|
|
|
{ |
386
|
|
|
$type = 'flex'; |
387
|
|
|
|
388
|
|
|
$settings = array_merge(get_post_meta($id, 'ml-slider_settings', true), $shortcode_settings); |
|
|
|
|
389
|
|
|
|
390
|
|
|
if (isset($settings['type']) && in_array($settings['type'], ['flex', 'coin', 'nivo', 'responsive'])) { |
391
|
|
|
$type = $settings['type']; |
392
|
|
|
} |
393
|
|
|
|
394
|
|
|
$this->slider = $this->create_slider($type, $id, $shortcode_settings); |
395
|
|
|
} |
396
|
|
|
|
397
|
|
|
/** |
398
|
|
|
* Create a new slider based on the sliders type setting |
399
|
|
|
* @param $type |
400
|
|
|
* @param $id |
401
|
|
|
* @param $shortcode_settings |
402
|
|
|
* @return MetaFlexSlider|MetaNivoSlider|MetaResponsiveSlider |
403
|
|
|
*/ |
404
|
|
|
private function create_slider($type, $id, $shortcode_settings) |
405
|
|
|
{ |
406
|
|
|
switch ($type) { |
407
|
|
|
case ('coin'): |
408
|
|
|
|
409
|
|
|
return new MetaCoinSlider($id, $shortcode_settings); |
|
|
|
|
410
|
|
|
case ('flex'): |
411
|
|
|
|
412
|
|
|
return new MetaFlexSlider($id, $shortcode_settings); |
413
|
|
|
case ('nivo'): |
414
|
|
|
|
415
|
|
|
return new MetaNivoSlider($id, $shortcode_settings); |
416
|
|
|
case ('responsive'): |
417
|
|
|
|
418
|
|
|
return new MetaResponsiveSlider($id, $shortcode_settings); |
419
|
|
|
default: |
420
|
|
|
|
421
|
|
|
return new MetaFlexSlider($id, $shortcode_settings); |
422
|
|
|
} |
423
|
|
|
} |
424
|
|
|
|
425
|
|
|
/** |
426
|
|
|
* Handle slide uploads/changes. |
427
|
|
|
*/ |
428
|
|
|
public function admin_process() |
429
|
|
|
{ |
430
|
|
|
// this function should only ever be called from the Meta Slider admin page. |
431
|
|
|
if (!is_admin()) { |
|
|
|
|
432
|
|
|
return; |
433
|
|
|
} |
434
|
|
|
|
435
|
|
|
// default to the latest slider |
436
|
|
|
$slider_id = $this->find_slider('modified', 'DESC'); |
437
|
|
|
|
438
|
|
|
// delete a slider |
439
|
|
|
if (\Xmf\Request::hasVar('delete', 'GET')) { |
440
|
|
|
$slider_id = $this->delete_slider((int)$_GET['delete']); |
441
|
|
|
} |
442
|
|
|
|
443
|
|
|
// create a new slider |
444
|
|
|
if (\Xmf\Request::hasVar('add', 'GET')) { |
445
|
|
|
$slider_id = $this->add_slider(); |
446
|
|
|
} |
447
|
|
|
|
448
|
|
|
// load a slider by ID |
449
|
|
|
if (\Xmf\Request::hasVar('id', 'REQUEST')) { |
450
|
|
|
$temp_id = (int)$_REQUEST['id']; |
451
|
|
|
|
452
|
|
|
// check valid post ID |
453
|
|
|
if (get_post($temp_id)) { |
|
|
|
|
454
|
|
|
$slider_id = $temp_id; |
455
|
|
|
} |
456
|
|
|
} |
457
|
|
|
|
458
|
|
|
if ($slider_id > 0) { |
459
|
|
|
$this->set_slider($slider_id); |
460
|
|
|
} |
461
|
|
|
} |
462
|
|
|
|
463
|
|
|
/** |
464
|
|
|
* Create a new slider |
465
|
|
|
*/ |
466
|
|
|
private function add_slider() |
467
|
|
|
{ |
468
|
|
|
// check nonce |
469
|
|
|
check_admin_referer('metaslider_add_slider'); |
|
|
|
|
470
|
|
|
|
471
|
|
|
$defaults = []; |
472
|
|
|
|
473
|
|
|
// if possible, take a copy of the last edited slider settings in place of default settings |
474
|
|
|
$last_modified = $this->find_slider('modified', 'DESC'); |
475
|
|
|
if ($last_modified) { |
476
|
|
|
$defaults = get_post_meta($last_modified, 'ml-slider_settings', true); |
|
|
|
|
477
|
|
|
} |
478
|
|
|
|
479
|
|
|
// use the default settings if we can't find anything more suitable. |
480
|
|
|
if (empty($defaults)) { |
481
|
|
|
$slider = new MetaSlider($id, []); |
|
|
|
|
482
|
|
|
$defaults = $slider->get_default_parameters(); |
483
|
|
|
} |
484
|
|
|
|
485
|
|
|
// insert the post |
486
|
|
|
$id = wp_insert_post([ |
|
|
|
|
487
|
|
|
'post_title' => __('New Slider', 'metaslider'), |
|
|
|
|
488
|
|
|
'post_status' => 'publish', |
489
|
|
|
'post_type' => 'ml-slider', |
490
|
|
|
]); |
491
|
|
|
|
492
|
|
|
// insert the post meta |
493
|
|
|
add_post_meta($id, 'ml-slider_settings', $defaults, true); |
|
|
|
|
494
|
|
|
|
495
|
|
|
// create the taxonomy term, the term is the ID of the slider itself |
496
|
|
|
wp_insert_term($id, 'ml-slider'); |
|
|
|
|
497
|
|
|
|
498
|
|
|
return $id; |
499
|
|
|
} |
500
|
|
|
|
501
|
|
|
/** |
502
|
|
|
* Delete a slider (send it to trash) |
503
|
|
|
* |
504
|
|
|
* @param int $id |
505
|
|
|
* @return int |
506
|
|
|
*/ |
507
|
|
|
private function delete_slider($id) |
508
|
|
|
{ |
509
|
|
|
// check nonce |
510
|
|
|
check_admin_referer('metaslider_delete_slider'); |
|
|
|
|
511
|
|
|
|
512
|
|
|
// send the post to trash |
513
|
|
|
wp_update_post([ |
|
|
|
|
514
|
|
|
'ID' => $id, |
515
|
|
|
'post_status' => 'trash', |
516
|
|
|
]); |
517
|
|
|
|
518
|
|
|
return $this->find_slider('date', 'DESC'); |
519
|
|
|
} |
520
|
|
|
|
521
|
|
|
/** |
522
|
|
|
* Find a single slider ID. For example, last edited, or first published. |
523
|
|
|
* |
524
|
|
|
* @param string $orderby field to order. |
525
|
|
|
* @param string $order direction (ASC or DESC). |
526
|
|
|
* @return int slider ID. |
527
|
|
|
*/ |
528
|
|
|
private function find_slider($orderby, $order) |
529
|
|
|
{ |
530
|
|
|
$args = [ |
531
|
|
|
'force_no_custom_order' => true, |
532
|
|
|
'post_type' => 'ml-slider', |
533
|
|
|
'num_posts' => 1, |
534
|
|
|
'post_status' => 'publish', |
535
|
|
|
'suppress_filters' => 1, // wpml, ignore language filter |
536
|
|
|
'orderby' => $orderby, |
537
|
|
|
'order' => $order, |
538
|
|
|
]; |
539
|
|
|
|
540
|
|
|
$the_query = new WP_Query($args); |
|
|
|
|
541
|
|
|
|
542
|
|
|
while ($the_query->have_posts()) { |
543
|
|
|
$the_query->the_post(); |
544
|
|
|
|
545
|
|
|
return $the_query->post->ID; |
546
|
|
|
} |
547
|
|
|
|
548
|
|
|
wp_reset_query(); |
|
|
|
|
549
|
|
|
|
550
|
|
|
return false; |
|
|
|
|
551
|
|
|
} |
552
|
|
|
|
553
|
|
|
/** |
554
|
|
|
* Get sliders. Returns a nicely formatted array of currently |
555
|
|
|
* published sliders. |
556
|
|
|
* |
557
|
|
|
* @param string $sort_key |
558
|
|
|
* @return array all published sliders |
559
|
|
|
*/ |
560
|
|
|
private function all_meta_sliders($sort_key = 'date') |
561
|
|
|
{ |
562
|
|
|
$sliders = false; |
563
|
|
|
|
564
|
|
|
// list the tabs |
565
|
|
|
$args = [ |
566
|
|
|
'post_type' => 'ml-slider', |
567
|
|
|
'post_status' => 'publish', |
568
|
|
|
'orderby' => $sort_key, |
569
|
|
|
'suppress_filters' => 1, // wpml, ignore language filter |
570
|
|
|
'order' => 'ASC', |
571
|
|
|
'posts_per_page' => -1, |
572
|
|
|
]; |
573
|
|
|
|
574
|
|
|
$args = apply_filters('metaslider_all_meta_sliders_args', $args); |
|
|
|
|
575
|
|
|
|
576
|
|
|
$the_query = new WP_Query($args); |
577
|
|
|
|
578
|
|
|
while ($the_query->have_posts()) { |
579
|
|
|
$the_query->the_post(); |
580
|
|
|
$active = $this->slider && ($this->slider->id == $the_query->post->ID) ? true : false; |
581
|
|
|
|
582
|
|
|
$sliders[] = [ |
583
|
|
|
'active' => $active, |
584
|
|
|
'title' => get_the_title(), |
|
|
|
|
585
|
|
|
'id' => $the_query->post->ID, |
586
|
|
|
]; |
587
|
|
|
} |
588
|
|
|
|
589
|
|
|
wp_reset_query(); |
|
|
|
|
590
|
|
|
|
591
|
|
|
return $sliders; |
|
|
|
|
592
|
|
|
} |
593
|
|
|
|
594
|
|
|
/** |
595
|
|
|
* Compare array values |
596
|
|
|
* |
597
|
|
|
* @param array $elem1 |
598
|
|
|
* @param array $elem2 |
599
|
|
|
* @return bool |
600
|
|
|
*/ |
601
|
|
|
private function compare_elems($elem1, $elem2) |
602
|
|
|
{ |
603
|
|
|
return $elem1['priority'] > $elem2['priority']; |
604
|
|
|
} |
605
|
|
|
|
606
|
|
|
/** |
607
|
|
|
* @param array $aFields - array of field to render |
608
|
|
|
* @return string |
609
|
|
|
*/ |
610
|
|
|
public function build_settings_rows($aFields) |
611
|
|
|
{ |
612
|
|
|
// order the fields by priority |
613
|
|
|
uasort($aFields, [$this, 'compare_elems']); |
614
|
|
|
|
615
|
|
|
$return = ''; |
616
|
|
|
|
617
|
|
|
// loop through the array and build the settings HTML |
618
|
|
|
foreach ($aFields as $id => $row) { |
619
|
|
|
// checkbox input type |
620
|
|
|
if ('checkbox' === $row['type']) { |
621
|
|
|
$return .= "<tr><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='checkbox' name='settings[{$id}]' {$row['checked']} >"; |
622
|
|
|
|
623
|
|
|
if (isset($row['after'])) { |
624
|
|
|
$return .= "<span class='after'>{$row['after']}</span>"; |
625
|
|
|
} |
626
|
|
|
|
627
|
|
|
$return .= '</td></tr>'; |
628
|
|
|
} |
629
|
|
|
|
630
|
|
|
// navigation row |
631
|
|
|
if ('navigation' === $row['type']) { |
632
|
|
|
$navigation_row = "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><ul>"; |
633
|
|
|
|
634
|
|
|
foreach ($row['options'] as $k => $v) { |
635
|
|
|
$checked = checked($k, $row['value'], false); |
|
|
|
|
636
|
|
|
$disabled = 'thumbnails' === $k ? 'disabled' : ''; |
637
|
|
|
$navigation_row .= "<li><label><input type='radio' name='settings[{$id}]' value='{$k}' {$checked} {$disabled}>{$v['label']}</label></li>"; |
638
|
|
|
} |
639
|
|
|
|
640
|
|
|
$navigation_row .= '</ul></td></tr>'; |
641
|
|
|
|
642
|
|
|
$return .= apply_filters('metaslider_navigation_options', $navigation_row, $this->slider); |
|
|
|
|
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
// navigation row |
646
|
|
|
if ('radio' === $row['type']) { |
647
|
|
|
$navigation_row = "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><ul>"; |
648
|
|
|
|
649
|
|
|
foreach ($row['options'] as $k => $v) { |
650
|
|
|
$checked = checked($k, $row['value'], false); |
651
|
|
|
$class = isset($v['class']) ? $v['class'] : ''; |
652
|
|
|
$navigation_row .= "<li><label><input type='radio' name='settings[{$id}]' value='{$k}' {$checked} class='radio {$class}'>{$v['label']}</label></li>"; |
653
|
|
|
} |
654
|
|
|
|
655
|
|
|
$navigation_row .= '</ul></td></tr>'; |
656
|
|
|
|
657
|
|
|
$return .= apply_filters('metaslider_navigation_options', $navigation_row, $this->slider); |
658
|
|
|
} |
659
|
|
|
|
660
|
|
|
// header/divider row |
661
|
|
|
if ('divider' === $row['type']) { |
662
|
|
|
$return .= "<tr class='{$row['type']}'><td colspan='2' class='divider'><b>{$row['value']}</b></td></tr>"; |
663
|
|
|
} |
664
|
|
|
|
665
|
|
|
// slideshow select row |
666
|
|
|
if ('slider-lib' === $row['type']) { |
667
|
|
|
$return .= "<tr class='{$row['type']}'><td colspan='2' class='slider-lib-row'>"; |
668
|
|
|
|
669
|
|
|
foreach ($row['options'] as $k => $v) { |
670
|
|
|
$checked = checked($k, $row['value'], false); |
671
|
|
|
$return .= "<input class='select-slider' id='{$k}' rel='{$k}' type='radio' name='settings[type]' value='{$k}' {$checked} > |
672
|
|
|
<label for='{$k}'>{$v['label']}</label>"; |
673
|
|
|
} |
674
|
|
|
|
675
|
|
|
$return .= '</td></tr>'; |
676
|
|
|
} |
677
|
|
|
|
678
|
|
|
// number input type |
679
|
|
|
if ('number' === $row['type']) { |
680
|
|
|
$return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='number' min='{$row['min']}' max='{$row['max']}' step='{$row['step']}' name='settings[{$id}]' value='{$row['value']}' ><span class='after'>{$row['after']}</span></td></tr>"; |
681
|
|
|
} |
682
|
|
|
|
683
|
|
|
// select drop down |
684
|
|
|
if ('select' === $row['type']) { |
685
|
|
|
$return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><select class='option {$row['class']} {$id}' name='settings[{$id}]'>"; |
686
|
|
|
foreach ($row['options'] as $k => $v) { |
687
|
|
|
$selected = selected($k, $row['value'], false); |
|
|
|
|
688
|
|
|
$return .= "<option class='{$v['class']}' value='{$k}' {$selected}>{$v['label']}</option>"; |
689
|
|
|
} |
690
|
|
|
$return .= '</select></td></tr>'; |
691
|
|
|
} |
692
|
|
|
|
693
|
|
|
// theme drop down |
694
|
|
|
if ('theme' === $row['type']) { |
695
|
|
|
$return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><select class='option {$row['class']} {$id}' name='settings[{$id}]'>"; |
696
|
|
|
$themes = ''; |
697
|
|
|
|
698
|
|
|
foreach ($row['options'] as $k => $v) { |
699
|
|
|
$selected = selected($k, $row['value'], false); |
700
|
|
|
$themes .= "<option class='{$v['class']}' value='{$k}' {$selected}>{$v['label']}</option>"; |
701
|
|
|
} |
702
|
|
|
|
703
|
|
|
$return .= apply_filters('metaslider_get_available_themes', $themes, $this->slider->get_setting('theme')); |
704
|
|
|
|
705
|
|
|
$return .= '</select></td></tr>'; |
706
|
|
|
} |
707
|
|
|
|
708
|
|
|
// text input type |
709
|
|
|
if ('text' === $row['type']) { |
710
|
|
|
$return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='text' name='settings[{$id}]' value='{$row['value']}' ></td></tr>"; |
711
|
|
|
} |
712
|
|
|
|
713
|
|
|
// text input type |
714
|
|
|
if ('title' === $row['type']) { |
715
|
|
|
$return .= "<tr class='{$row['type']}'><td class='tipsy-tooltip' title=\"{$row['helptext']}\">{$row['label']}</td><td><input class='option {$row['class']} {$id}' type='text' name='{$id}' value='{$row['value']}' ></td></tr>"; |
716
|
|
|
} |
717
|
|
|
} |
718
|
|
|
|
719
|
|
|
return $return; |
720
|
|
|
} |
721
|
|
|
|
722
|
|
|
/** |
723
|
|
|
* Return an indexed array of all easing options |
724
|
|
|
* |
725
|
|
|
* @return array |
726
|
|
|
*/ |
727
|
|
|
private function get_easing_options() |
728
|
|
|
{ |
729
|
|
|
$options = [ |
730
|
|
|
'linear', |
731
|
|
|
'swing', |
732
|
|
|
'jswing', |
733
|
|
|
'easeInQuad', |
734
|
|
|
'easeOutQuad', |
735
|
|
|
'easeInOutQuad', |
736
|
|
|
'easeInCubic', |
737
|
|
|
'easeOutCubic', |
738
|
|
|
'easeInOutCubic', |
739
|
|
|
'easeInQuart', |
740
|
|
|
'easeOutQuart', |
741
|
|
|
'easeInOutQuart', |
742
|
|
|
'easeInQuint', |
743
|
|
|
'easeOutQuint', |
744
|
|
|
'easeInOutQuint', |
745
|
|
|
'easeInSine', |
746
|
|
|
'easeOutSine', |
747
|
|
|
'easeInOutSine', |
748
|
|
|
'easeInExpo', |
749
|
|
|
'easeOutExpo', |
750
|
|
|
'easeInOutExpo', |
751
|
|
|
'easeInCirc', |
752
|
|
|
'easeOutCirc', |
753
|
|
|
'easeInOutCirc', |
754
|
|
|
'easeInElastic', |
755
|
|
|
'easeOutElastic', |
756
|
|
|
'easeInOutElastic', |
757
|
|
|
'easeInBack', |
758
|
|
|
'easeOutBack', |
759
|
|
|
'easeInOutBack', |
760
|
|
|
'easeInBounce', |
761
|
|
|
'easeOutBounce', |
762
|
|
|
'easeInOutBounce', |
763
|
|
|
]; |
764
|
|
|
|
765
|
|
|
foreach ($options as $option) { |
766
|
|
|
$return[$option] = [ |
767
|
|
|
'label' => ucfirst(preg_replace('/(\w+)([A-Z])/U', '\\1 \\2', $option)), |
768
|
|
|
'class' => '', |
769
|
|
|
]; |
770
|
|
|
} |
771
|
|
|
|
772
|
|
|
return $return; |
|
|
|
|
773
|
|
|
} |
774
|
|
|
|
775
|
|
|
/** |
776
|
|
|
* Render the admin page (tabs, slides, settings) |
777
|
|
|
*/ |
778
|
|
|
public function render_admin_page() |
779
|
|
|
{ |
780
|
|
|
$this->admin_process(); |
781
|
|
|
$this->go_pro_cta(); |
782
|
|
|
$this->system_check(); |
783
|
|
|
$max_tabs = apply_filters('metaslider_max_tabs', 0); ?> |
|
|
|
|
784
|
|
|
|
785
|
|
|
<script type='text/javascript'> |
786
|
|
|
var metaslider_slider_id = <?php echo $this->slider->id; ?>; |
787
|
|
|
var metaslider_pro_active = <?php echo function_exists('is_plugin_active') && is_plugin_active('ml-slider-pro/ml-slider-pro.php') ? 'true' : 'false' ?>; |
788
|
|
|
</script> |
789
|
|
|
|
790
|
|
|
<div class="wrap metaslider"> |
791
|
|
|
<form accept-charset="UTF-8" action="?page=metaslider&id=<?php echo $this->slider->id ?>" method="post"> |
792
|
|
|
<?php |
793
|
|
|
if ($this->slider) { |
794
|
|
|
wp_nonce_field('metaslider_save_' . $this->slider->id); |
|
|
|
|
795
|
|
|
} |
796
|
|
|
|
797
|
|
|
$title = ''; |
798
|
|
|
$add_url = wp_nonce_url('?page=metaslider&add=true', 'metaslider_add_slider'); |
|
|
|
|
799
|
|
|
|
800
|
|
|
$tabs = $this->all_meta_sliders(); |
801
|
|
|
if ($tabs) { |
|
|
|
|
802
|
|
|
if ($max_tabs && count($tabs) > $max_tabs) { |
803
|
|
|
if (\Xmf\Request::hasVar('add', 'GET') && 'true' === $_GET['add']) { |
804
|
|
|
echo "<div id='message' class='updated'><p>" . __("New slideshow created. Click 'Add Slide' to get started!", 'metaslider') . '</p></div>'; |
|
|
|
|
805
|
|
|
} |
806
|
|
|
echo "<div style='margin-top: 20px;'><label for='select-slider'>Select Slider: </label>"; |
807
|
|
|
echo "<select name='select-slider' onchange='if (this.value) window.location.href=this.value'>"; |
808
|
|
|
|
809
|
|
|
$tabs = $this->all_meta_sliders('title'); |
810
|
|
|
|
811
|
|
|
foreach ($tabs as $tab) { |
812
|
|
|
$selected = $tab['active'] ? ' selected' : ''; |
813
|
|
|
|
814
|
|
|
if ($tab['active']) { |
815
|
|
|
$title = $tab['title']; |
816
|
|
|
} |
817
|
|
|
|
818
|
|
|
echo "<option value='?page=metaslider&id={$tab['id']}'{$selected}>{$tab['title']}</option>"; |
819
|
|
|
} |
820
|
|
|
echo '</select> ' . __('or', 'metaslider') . ' '; |
821
|
|
|
echo "<a href='{$add_url}'>" . __('Add New Slideshow', 'metaslider') . '</a></div>'; |
822
|
|
|
} else { |
823
|
|
|
echo "<h3 class='nav-tab-wrapper'>"; |
824
|
|
|
foreach ($tabs as $tab) { |
825
|
|
|
if ($tab['active']) { |
826
|
|
|
echo "<div class='nav-tab nav-tab-active'><input type='text' name='title' value='" . $tab['title'] . "' onfocus='this.style.width = ((this.value.length + 1) * 9) + \"px\"' ></div>"; |
827
|
|
|
} else { |
828
|
|
|
echo "<a href='?page=metaslider&id={$tab['id']}' class='nav-tab'>" . $tab['title'] . '</a>'; |
829
|
|
|
} |
830
|
|
|
} |
831
|
|
|
echo "<a href='{$add_url}' id='create_new_tab' class='nav-tab'>+</a>"; |
832
|
|
|
echo '</h3>'; |
833
|
|
|
} |
834
|
|
|
} else { |
835
|
|
|
echo "<h3 class='nav-tab-wrapper'>"; |
836
|
|
|
echo "<a href='{$add_url}' id='create_new_tab' class='nav-tab'>+</a>"; |
837
|
|
|
echo "<div class='bubble'>" . __('Create your first slideshow') . '</div>'; |
838
|
|
|
echo '</h3>'; |
839
|
|
|
} ?> |
840
|
|
|
|
841
|
|
|
<?php |
842
|
|
|
if (!$this->slider) { |
843
|
|
|
return; |
844
|
|
|
} ?> |
845
|
|
|
<div id='poststuff'> |
846
|
|
|
<div id='post-body' class='metabox-holder columns-2'> |
847
|
|
|
|
848
|
|
|
<div id='post-body-content'> |
849
|
|
|
<div class="left"> |
850
|
|
|
<table class="widefat sortable"> |
851
|
|
|
<thead> |
852
|
|
|
<tr> |
853
|
|
|
<th style="width: 100px;"> |
854
|
|
|
<h3><?php _e('Slides', 'metaslider') ?></h3> |
|
|
|
|
855
|
|
|
</th> |
856
|
|
|
<th> |
857
|
|
|
<a href='#' class='button alignright add-slide' data-editor='content' title='<?php _e('Add Slide', 'metaslider') ?>'> |
858
|
|
|
<span class='wp-media-buttons-icon'></span> <?php _e('Add Slide', 'metaslider') ?> |
859
|
|
|
</a> |
860
|
|
|
</th> |
861
|
|
|
</tr> |
862
|
|
|
</thead> |
863
|
|
|
|
864
|
|
|
<tbody> |
865
|
|
|
<?php |
866
|
|
|
$this->slider->render_admin_slides(); ?> |
867
|
|
|
</tbody> |
868
|
|
|
</table> |
869
|
|
|
</div> |
870
|
|
|
</div> |
871
|
|
|
|
872
|
|
|
<div id='postbox-container-1' class='postbox-container'> |
873
|
|
|
<div id="side-sortables" class="meta-box-sortables"> |
874
|
|
|
<div class='right'> |
875
|
|
|
<div class="postbox"> |
876
|
|
|
<h3 class='configuration'> |
877
|
|
|
<?php _e('Settings', 'metaslider') ?> |
878
|
|
|
<input class='alignright button button-primary' type='submit' name='save' id='ms-save' value='<?php _e('Save', 'metaslider') ?>'> |
879
|
|
|
<input class='alignright button button-primary' type='submit' name='preview' id='ms-preview' value='<?php _e('Save & Preview', 'metaslider') ?>' data-slider_id='<?php echo $this->slider->id ?>' |
880
|
|
|
data-slider_width='<?php echo $this->slider->get_setting('width') ?>' data-slider_height='<?php echo $this->slider->get_setting('height') ?>'> |
881
|
|
|
<span class="spinner"></span> |
882
|
|
|
</h3> |
883
|
|
|
<div class="inside"> |
884
|
|
|
<table class="widefat settings"> |
885
|
|
|
<tbody> |
886
|
|
|
<?php |
887
|
|
|
$aFields = [ |
888
|
|
|
'type' => [ |
889
|
|
|
'priority' => 0, |
890
|
|
|
'type' => 'slider-lib', |
891
|
|
|
'value' => $this->slider->get_setting('type'), |
892
|
|
|
'options' => [ |
893
|
|
|
'flex' => ['label' => __('Flex Slider', 'metaslider')], |
894
|
|
|
'responsive' => ['label' => __('Responsive', 'metaslider')], |
895
|
|
|
'nivo' => ['label' => __('Nivo Slider', 'metaslider')], |
896
|
|
|
'coin' => ['label' => __('Coin Slider', 'metaslider')], |
897
|
|
|
], |
898
|
|
|
], |
899
|
|
|
'width' => [ |
900
|
|
|
'priority' => 10, |
901
|
|
|
'type' => 'number', |
902
|
|
|
'size' => 3, |
903
|
|
|
'min' => 0, |
904
|
|
|
'max' => 9999, |
905
|
|
|
'step' => 1, |
906
|
|
|
'value' => $this->slider->get_setting('width'), |
907
|
|
|
'label' => __('Width', 'metaslider'), |
908
|
|
|
'class' => 'coin flex responsive nivo', |
909
|
|
|
'helptext' => __('Slideshow width', 'metaslider'), |
910
|
|
|
'after' => __('px', 'metaslider'), |
911
|
|
|
], |
912
|
|
|
'height' => [ |
913
|
|
|
'priority' => 20, |
914
|
|
|
'type' => 'number', |
915
|
|
|
'size' => 3, |
916
|
|
|
'min' => 0, |
917
|
|
|
'max' => 9999, |
918
|
|
|
'step' => 1, |
919
|
|
|
'value' => $this->slider->get_setting('height'), |
920
|
|
|
'label' => __('Height', 'metaslider'), |
921
|
|
|
'class' => 'coin flex responsive nivo', |
922
|
|
|
'helptext' => __('Slideshow height', 'metaslider'), |
923
|
|
|
'after' => __('px', 'metaslider'), |
924
|
|
|
], |
925
|
|
|
'effect' => [ |
926
|
|
|
'priority' => 30, |
927
|
|
|
'type' => 'select', |
928
|
|
|
'value' => $this->slider->get_setting('effect'), |
929
|
|
|
'label' => __('Effect', 'metaslider'), |
930
|
|
|
'class' => 'effect coin flex responsive nivo', |
931
|
|
|
'helptext' => __('Slide transition effect', 'metaslider'), |
932
|
|
|
'options' => [ |
933
|
|
|
'random' => ['class' => 'option coin nivo', 'label' => __('Random', 'metaslider')], |
934
|
|
|
'swirl' => ['class' => 'option coin', 'label' => __('Swirl', 'metaslider')], |
935
|
|
|
'rain' => ['class' => 'option coin', 'label' => __('Rain', 'metaslider')], |
936
|
|
|
'straight' => ['class' => 'option coin', 'label' => __('Straight', 'metaslider')], |
937
|
|
|
'sliceDown' => ['class' => 'option nivo', 'label' => __('Slide Down', 'metaslider')], |
938
|
|
|
'sliceUp' => ['class' => 'option nivo', 'label' => __('Slice Up', 'metaslider')], |
939
|
|
|
'sliceUpLeft' => ['class' => 'option nivo', 'label' => __('Slide Up Left', 'metaslider')], |
940
|
|
|
'sliceUpDown' => ['class' => 'option nivo', 'label' => __('Slice Up Down', 'metaslider')], |
941
|
|
|
'slideUpDownLeft' => ['class' => 'option nivo', 'label' => __('Slide Up Down Left', 'metaslider')], |
942
|
|
|
'fold' => ['class' => 'option nivo', 'label' => __('Fold', 'metaslider')], |
943
|
|
|
'fade' => ['class' => 'option nivo flex responsive', 'label' => __('Fade', 'metaslider')], |
944
|
|
|
'slideInRight' => ['class' => 'option nivo', 'label' => __('Slide In Right', 'metaslider')], |
945
|
|
|
'slideInLeft' => ['class' => 'option nivo', 'label' => __('Slide In Left', 'metaslider')], |
946
|
|
|
'boxRandom' => ['class' => 'option nivo', 'label' => __('Box Random', 'metaslider')], |
947
|
|
|
'boxRain' => ['class' => 'option nivo', 'label' => __('Box Rain', 'metaslider')], |
948
|
|
|
'boxRainReverse' => ['class' => 'option nivo', 'label' => __('Box Rain Reverse', 'metaslider')], |
949
|
|
|
'boxRainGrowReverse' => ['class' => 'option nivo', 'label' => __('Box Rain Grow Reverse', 'metaslider')], |
950
|
|
|
'slide' => ['class' => 'option flex', 'label' => __('Slide', 'metaslider')], |
951
|
|
|
], |
952
|
|
|
], |
953
|
|
|
'theme' => [ |
954
|
|
|
'priority' => 40, |
955
|
|
|
'type' => 'theme', |
956
|
|
|
'value' => $this->slider->get_setting('theme'), |
957
|
|
|
'label' => __('Theme', 'metaslider'), |
958
|
|
|
'class' => 'effect coin flex responsive nivo', |
959
|
|
|
'helptext' => __('Slideshow theme', 'metaslider'), |
960
|
|
|
'options' => [ |
961
|
|
|
'default' => ['class' => 'option nivo flex coin responsive', 'label' => __('Default', 'metaslider')], |
962
|
|
|
'dark' => ['class' => 'option nivo', 'label' => __('Dark (Nivo)', 'metaslider')], |
963
|
|
|
'light' => ['class' => 'option nivo', 'label' => __('Light (Nivo)', 'metaslider')], |
964
|
|
|
'bar' => ['class' => 'option nivo', 'label' => __('Bar (Nivo)', 'metaslider')], |
965
|
|
|
], |
966
|
|
|
], |
967
|
|
|
'links' => [ |
968
|
|
|
'priority' => 50, |
969
|
|
|
'type' => 'checkbox', |
970
|
|
|
'label' => __('Arrows', 'metaslider'), |
971
|
|
|
'class' => 'option coin flex nivo responsive', |
972
|
|
|
'checked' => 'true' === $this->slider->get_setting('links') ? 'checked' : '', |
973
|
|
|
'helptext' => __('Show the previous/next arrows', 'metaslider'), |
974
|
|
|
], |
975
|
|
|
'navigation' => [ |
976
|
|
|
'priority' => 60, |
977
|
|
|
'type' => 'navigation', |
978
|
|
|
'label' => __('Navigation', 'metaslider'), |
979
|
|
|
'class' => 'option coin flex nivo responsive', |
980
|
|
|
'value' => $this->slider->get_setting('navigation'), |
981
|
|
|
'helptext' => __('Show the slide navigation bullets', 'metaslider'), |
982
|
|
|
'options' => [ |
983
|
|
|
'false' => ['label' => __('Hidden', 'metaslider')], |
984
|
|
|
'true' => ['label' => __('Dots', 'metaslider')], |
985
|
|
|
'thumbnails' => ['label' => __('Thumbnails (Pro)', 'metaslider')], |
986
|
|
|
], |
987
|
|
|
], |
988
|
|
|
]; |
989
|
|
|
|
990
|
|
|
if ($max_tabs && count($this->all_meta_sliders()) > $max_tabs) { |
991
|
|
|
$aFields['title'] = [ |
992
|
|
|
'type' => 'title', |
993
|
|
|
'priority' => 5, |
994
|
|
|
'class' => 'option flex nivo responsive coin', |
995
|
|
|
'value' => $title, |
996
|
|
|
'label' => __('Title', 'metaslider'), |
997
|
|
|
'helptext' => __('Slideshow title', 'metaslider'), |
998
|
|
|
]; |
999
|
|
|
} |
1000
|
|
|
|
1001
|
|
|
$aFields = apply_filters('metaslider_basic_settings', $aFields, $this->slider); |
1002
|
|
|
|
1003
|
|
|
echo $this->build_settings_rows($aFields); ?> |
1004
|
|
|
</tbody> |
1005
|
|
|
</table> |
1006
|
|
|
</div> |
1007
|
|
|
</div> |
1008
|
|
|
|
1009
|
|
|
<div class="postbox ms-toggle closed"> |
1010
|
|
|
<div class="handlediv" title="Click to toggle"><br></div> |
1011
|
|
|
<h3 class="hndle"><span><?php _e('Advanced Settings', 'metaslider') ?></span></h3> |
1012
|
|
|
<div class="inside"> |
1013
|
|
|
<table> |
1014
|
|
|
<tbody> |
1015
|
|
|
<?php |
1016
|
|
|
$aFields = [ |
1017
|
|
|
'fullWidth' => [ |
1018
|
|
|
'priority' => 5, |
1019
|
|
|
'type' => 'checkbox', |
1020
|
|
|
'label' => __('Stretch', 'metaslider'), |
1021
|
|
|
'class' => 'option flex nivo responsive', |
1022
|
|
|
'after' => __('100% wide output', 'metaslider'), |
1023
|
|
|
'checked' => 'true' === $this->slider->get_setting('fullWidth') ? 'checked' : '', |
1024
|
|
|
'helptext' => __("Stretch the slideshow output to fill it's parent container", 'metaslider'), |
1025
|
|
|
], |
1026
|
|
|
'center' => [ |
1027
|
|
|
'priority' => 10, |
1028
|
|
|
'type' => 'checkbox', |
1029
|
|
|
'label' => __('Center align', 'metaslider'), |
1030
|
|
|
'class' => 'option coin flex nivo responsive', |
1031
|
|
|
'checked' => 'true' === $this->slider->get_setting('center') ? 'checked' : '', |
1032
|
|
|
'helptext' => __('Center align the slideshow', 'metaslider'), |
1033
|
|
|
], |
1034
|
|
|
'autoPlay' => [ |
1035
|
|
|
'priority' => 20, |
1036
|
|
|
'type' => 'checkbox', |
1037
|
|
|
'label' => __('Auto play', 'metaslider'), |
1038
|
|
|
'class' => 'option flex nivo responsive', |
1039
|
|
|
'checked' => 'true' === $this->slider->get_setting('autoPlay') ? 'checked' : '', |
1040
|
|
|
'helptext' => __('Transition between slides automatically', 'metaslider'), |
1041
|
|
|
], |
1042
|
|
|
'smartCrop' => [ |
1043
|
|
|
'priority' => 30, |
1044
|
|
|
'type' => 'checkbox', |
1045
|
|
|
'label' => __('Smart crop', 'metaslider'), |
1046
|
|
|
'class' => 'option coin flex nivo responsive', |
1047
|
|
|
'checked' => 'true' === $this->slider->get_setting('smartCrop') ? 'checked' : '', |
1048
|
|
|
'helptext' => __('Smart Crop ensures your responsive slides are cropped to a ratio that results in a consistent slideshow size', 'metaslider'), |
1049
|
|
|
], |
1050
|
|
|
'carouselMode' => [ |
1051
|
|
|
'priority' => 40, |
1052
|
|
|
'type' => 'checkbox', |
1053
|
|
|
'label' => __('Carousel mode', 'metaslider'), |
1054
|
|
|
'class' => 'option flex', |
1055
|
|
|
'checked' => 'true' === $this->slider->get_setting('carouselMode') ? 'checked' : '', |
1056
|
|
|
'helptext' => __('Display multiple slides at once. Slideshow output will be 100% wide.', 'metaslider'), |
1057
|
|
|
], |
1058
|
|
|
'random' => [ |
1059
|
|
|
'priority' => 50, |
1060
|
|
|
'type' => 'checkbox', |
1061
|
|
|
'label' => __('Random', 'metaslider'), |
1062
|
|
|
'class' => 'option coin flex nivo responsive', |
1063
|
|
|
'checked' => 'true' === $this->slider->get_setting('random') ? 'checked' : '', |
1064
|
|
|
'helptext' => __('Randomise the order of the slides', 'metaslider'), |
1065
|
|
|
], |
1066
|
|
|
'hoverPause' => [ |
1067
|
|
|
'priority' => 60, |
1068
|
|
|
'type' => 'checkbox', |
1069
|
|
|
'label' => __('Hover pause', 'metaslider'), |
1070
|
|
|
'class' => 'option coin flex nivo responsive', |
1071
|
|
|
'checked' => 'true' === $this->slider->get_setting('hoverPause') ? 'checked' : '', |
1072
|
|
|
'helptext' => __('Pause the slideshow when hovering over slider, then resume when no longer hovering.', 'metaslider'), |
1073
|
|
|
], |
1074
|
|
|
'reverse' => [ |
1075
|
|
|
'priority' => 70, |
1076
|
|
|
'type' => 'checkbox', |
1077
|
|
|
'label' => __('Reverse', 'metaslider'), |
1078
|
|
|
'class' => 'option flex', |
1079
|
|
|
'checked' => 'true' === $this->slider->get_setting('reverse') ? 'checked' : '', |
1080
|
|
|
'helptext' => __('Reverse the animation direction', 'metaslider'), |
1081
|
|
|
], |
1082
|
|
|
'delay' => [ |
1083
|
|
|
'priority' => 80, |
1084
|
|
|
'type' => 'number', |
1085
|
|
|
'size' => 3, |
1086
|
|
|
'min' => 500, |
1087
|
|
|
'max' => 10000, |
1088
|
|
|
'step' => 100, |
1089
|
|
|
'value' => $this->slider->get_setting('delay'), |
1090
|
|
|
'label' => __('Slide delay', 'metaslider'), |
1091
|
|
|
'class' => 'option coin flex responsive nivo', |
1092
|
|
|
'helptext' => __('How long to display each slide, in milliseconds', 'metaslider'), |
1093
|
|
|
'after' => __('ms', 'metaslider'), |
1094
|
|
|
], |
1095
|
|
|
'animationSpeed' => [ |
1096
|
|
|
'priority' => 90, |
1097
|
|
|
'type' => 'number', |
1098
|
|
|
'size' => 3, |
1099
|
|
|
'min' => 0, |
1100
|
|
|
'max' => 2000, |
1101
|
|
|
'step' => 100, |
1102
|
|
|
'value' => $this->slider->get_setting('animationSpeed'), |
1103
|
|
|
'label' => __('Animation speed', 'metaslider'), |
1104
|
|
|
'class' => 'option flex responsive nivo', |
1105
|
|
|
'helptext' => __('Set the speed of animations, in milliseconds', 'metaslider'), |
1106
|
|
|
'after' => __('ms', 'metaslider'), |
1107
|
|
|
], |
1108
|
|
|
'slices' => [ |
1109
|
|
|
'priority' => 100, |
1110
|
|
|
'type' => 'number', |
1111
|
|
|
'size' => 3, |
1112
|
|
|
'min' => 0, |
1113
|
|
|
'max' => 20, |
1114
|
|
|
'step' => 1, |
1115
|
|
|
'value' => $this->slider->get_setting('slices'), |
1116
|
|
|
'label' => __('Number of slices', 'metaslider'), |
1117
|
|
|
'class' => 'option nivo', |
1118
|
|
|
'helptext' => __('Number of slices', 'metaslider'), |
1119
|
|
|
'after' => __('ms', 'metaslider'), |
1120
|
|
|
], |
1121
|
|
|
'spw' => [ |
1122
|
|
|
'priority' => 110, |
1123
|
|
|
'type' => 'number', |
1124
|
|
|
'size' => 3, |
1125
|
|
|
'min' => 0, |
1126
|
|
|
'max' => 20, |
1127
|
|
|
'step' => 1, |
1128
|
|
|
'value' => $this->slider->get_setting('spw'), |
1129
|
|
|
'label' => __('Number of squares', 'metaslider') . ' (' . __('Width', 'metaslider') . ')', |
1130
|
|
|
'class' => 'option nivo', |
1131
|
|
|
'helptext' => __('Number of squares', 'metaslider'), |
1132
|
|
|
'after' => '', |
1133
|
|
|
], |
1134
|
|
|
'sph' => [ |
1135
|
|
|
'priority' => 120, |
1136
|
|
|
'type' => 'number', |
1137
|
|
|
'size' => 3, |
1138
|
|
|
'min' => 0, |
1139
|
|
|
'max' => 20, |
1140
|
|
|
'step' => 1, |
1141
|
|
|
'value' => $this->slider->get_setting('sph'), |
1142
|
|
|
'label' => __('Number of squares', 'metaslider') . ' (' . __('Height', 'metaslider') . ')', |
1143
|
|
|
'class' => 'option nivo', |
1144
|
|
|
'helptext' => __('Number of squares', 'metaslider'), |
1145
|
|
|
'after' => '', |
1146
|
|
|
], |
1147
|
|
|
'direction' => [ |
1148
|
|
|
'priority' => 130, |
1149
|
|
|
'type' => 'select', |
1150
|
|
|
'label' => __('Slide direction', 'metaslider'), |
1151
|
|
|
'class' => 'option flex', |
1152
|
|
|
'helptext' => __('Select the sliding direction', 'metaslider'), |
1153
|
|
|
'value' => $this->slider->get_setting('direction'), |
1154
|
|
|
'options' => [ |
1155
|
|
|
'horizontal' => ['label' => __('Horizontal', 'metaslider'), 'class' => ''], |
1156
|
|
|
'vertical' => ['label' => __('Vertical', 'metaslider'), 'class' => ''], |
1157
|
|
|
], |
1158
|
|
|
], |
1159
|
|
|
'easing' => [ |
1160
|
|
|
'priority' => 140, |
1161
|
|
|
'type' => 'select', |
1162
|
|
|
'label' => __('Easing', 'metaslider'), |
1163
|
|
|
'class' => 'option flex', |
1164
|
|
|
'helptext' => __('Animation easing effect', 'metaslider'), |
1165
|
|
|
'value' => $this->slider->get_setting('easing'), |
1166
|
|
|
'options' => $this->get_easing_options(), |
1167
|
|
|
], |
1168
|
|
|
'prevText' => [ |
1169
|
|
|
'priority' => 150, |
1170
|
|
|
'type' => 'text', |
1171
|
|
|
'label' => __('Previous text', 'metaslider'), |
1172
|
|
|
'class' => 'option coin flex responsive nivo', |
1173
|
|
|
'helptext' => __("Set the text for the 'previous' direction item", 'metaslider'), |
1174
|
|
|
'value' => 'false' === $this->slider->get_setting('prevText') ? '' : $this->slider->get_setting('prevText'), |
1175
|
|
|
], |
1176
|
|
|
'nextText' => [ |
1177
|
|
|
'priority' => 160, |
1178
|
|
|
'type' => 'text', |
1179
|
|
|
'label' => __('Next text', 'metaslider'), |
1180
|
|
|
'class' => 'option coin flex responsive nivo', |
1181
|
|
|
'helptext' => __("Set the text for the 'next' direction item", 'metaslider'), |
1182
|
|
|
'value' => 'false' === $this->slider->get_setting('nextText') ? '' : $this->slider->get_setting('nextText'), |
1183
|
|
|
], |
1184
|
|
|
'sDelay' => [ |
1185
|
|
|
'priority' => 170, |
1186
|
|
|
'type' => 'number', |
1187
|
|
|
'size' => 3, |
1188
|
|
|
'min' => 0, |
1189
|
|
|
'max' => 500, |
1190
|
|
|
'step' => 10, |
1191
|
|
|
'value' => $this->slider->get_setting('sDelay'), |
1192
|
|
|
'label' => __('Square delay', 'metaslider'), |
1193
|
|
|
'class' => 'option coin', |
1194
|
|
|
'helptext' => __('Delay between squares in ms', 'metaslider'), |
1195
|
|
|
'after' => __('ms', 'metaslider'), |
1196
|
|
|
], |
1197
|
|
|
'opacity' => [ |
1198
|
|
|
'priority' => 180, |
1199
|
|
|
'type' => 'number', |
1200
|
|
|
'size' => 3, |
1201
|
|
|
'min' => 0, |
1202
|
|
|
'max' => 1, |
1203
|
|
|
'step' => 0.1, |
1204
|
|
|
'value' => $this->slider->get_setting('opacity'), |
1205
|
|
|
'label' => __('Opacity', 'metaslider'), |
1206
|
|
|
'class' => 'option coin', |
1207
|
|
|
'helptext' => __('Opacity of title and navigation', 'metaslider'), |
1208
|
|
|
'after' => '', |
1209
|
|
|
], |
1210
|
|
|
'titleSpeed' => [ |
1211
|
|
|
'priority' => 190, |
1212
|
|
|
'type' => 'number', |
1213
|
|
|
'size' => 3, |
1214
|
|
|
'min' => 0, |
1215
|
|
|
'max' => 10000, |
1216
|
|
|
'step' => 100, |
1217
|
|
|
'value' => $this->slider->get_setting('titleSpeed'), |
1218
|
|
|
'label' => __('Caption speed', 'metaslider'), |
1219
|
|
|
'class' => 'option coin', |
1220
|
|
|
'helptext' => __('Set the fade in speed of the caption', 'metaslider'), |
1221
|
|
|
'after' => __('ms', 'metaslider'), |
1222
|
|
|
], |
1223
|
|
|
'developerOptions' => [ |
1224
|
|
|
'priority' => 195, |
1225
|
|
|
'type' => 'divider', |
1226
|
|
|
'class' => 'option coin flex responsive nivo', |
1227
|
|
|
'value' => __('Developer options', 'metaslider'), |
1228
|
|
|
], |
1229
|
|
|
'cssClass' => [ |
1230
|
|
|
'priority' => 200, |
1231
|
|
|
'type' => 'text', |
1232
|
|
|
'label' => __('CSS classes', 'metaslider'), |
1233
|
|
|
'class' => 'option coin flex responsive nivo', |
1234
|
|
|
'helptext' => __('Specify any custom CSS Classes you would like to be added to the slider wrapper', 'metaslider'), |
1235
|
|
|
'value' => 'false' === $this->slider->get_setting('cssClass') ? '' : $this->slider->get_setting('cssClass'), |
1236
|
|
|
], |
1237
|
|
|
'printCss' => [ |
1238
|
|
|
'priority' => 210, |
1239
|
|
|
'type' => 'checkbox', |
1240
|
|
|
'label' => __('Print CSS', 'metaslider'), |
1241
|
|
|
'class' => 'option coin flex responsive nivo useWithCaution', |
1242
|
|
|
'checked' => 'true' === $this->slider->get_setting('printCss') ? 'checked' : '', |
1243
|
|
|
'helptext' => __('Uncheck this is you would like to include your own CSS', 'metaslider'), |
1244
|
|
|
], |
1245
|
|
|
'printJs' => [ |
1246
|
|
|
'priority' => 220, |
1247
|
|
|
'type' => 'checkbox', |
1248
|
|
|
'label' => __('Print JS', 'metaslider'), |
1249
|
|
|
'class' => 'option coin flex responsive nivo useWithCaution', |
1250
|
|
|
'checked' => 'true' === $this->slider->get_setting('printJs') ? 'checked' : '', |
1251
|
|
|
'helptext' => __('Uncheck this is you would like to include your own Javascript', 'metaslider'), |
1252
|
|
|
], |
1253
|
|
|
'noConflict' => [ |
1254
|
|
|
'priority' => 230, |
1255
|
|
|
'type' => 'checkbox', |
1256
|
|
|
'label' => __('No conflict mode', 'metaslider'), |
1257
|
|
|
'class' => 'option flex', |
1258
|
|
|
'checked' => 'true' === $this->slider->get_setting('noConflict') ? 'checked' : '', |
1259
|
|
|
'helptext' => __('Delay adding the flexslider class to the slideshow', 'metaslider'), |
1260
|
|
|
], |
1261
|
|
|
]; |
1262
|
|
|
|
1263
|
|
|
$aFields = apply_filters('metaslider_advanced_settings', $aFields, $this->slider); |
1264
|
|
|
|
1265
|
|
|
echo $this->build_settings_rows($aFields); ?> |
1266
|
|
|
</tbody> |
1267
|
|
|
</table> |
1268
|
|
|
</div> |
1269
|
|
|
</div> |
1270
|
|
|
|
1271
|
|
|
<div class="postbox shortcode ms-toggle"> |
1272
|
|
|
<div class="handlediv" title="Click to toggle"><br></div> |
1273
|
|
|
<h3 class="hndle"><span><?php _e('Usage', 'metaslider') ?></span></h3> |
1274
|
|
|
<div class="inside"> |
1275
|
|
|
<ul class='tabs'> |
1276
|
|
|
<li rel='tab-1' class='selected'><?php _e('Shortcode', 'metaslider') ?></li> |
1277
|
|
|
<li rel='tab-2'><?php _e('Template Include', 'metaslider') ?></li> |
1278
|
|
|
</ul> |
1279
|
|
|
<div class='tabs-content'> |
1280
|
|
|
<div class='tab tab-1'> |
1281
|
|
|
<p><?php _e('Copy & paste the shortcode directly into any WordPress post or page.', 'metaslider'); ?></p> |
1282
|
|
|
<input readonly='readonly' type='text' value='[metaslider id=<?php echo $this->slider->id ?>]'></div> |
1283
|
|
|
<div class='tab tab-2' style='display: none'> |
1284
|
|
|
<p><?php _e('Copy & paste this code into a template file to include the slideshow within your theme.', 'metaslider'); ?></p> |
1285
|
|
|
<textarea readonly='readonly'><?php echo do_shortcode("[metaslider id=<?php echo $this->slider->id ?>]"); ?></textarea></div> |
1286
|
|
|
</div> |
1287
|
|
|
</div> |
1288
|
|
|
</div> |
1289
|
|
|
|
1290
|
|
|
<div class="postbox social"> |
1291
|
|
|
<div class="inside"> |
1292
|
|
|
<ul class='info'> |
1293
|
|
|
<li style='width: 33%;'> |
1294
|
|
|
<a href="https://twitter.com/share" class="twitter-share-button" data-url="http://www.metaslider.com" data-text="Check out Meta Slider, an easy to use slideshow plugin for WordPress" data-hashtags="metaslider, wordpress, slideshow">Tweet</a> |
1295
|
|
|
<script>!function (d, s, id) { |
1296
|
|
|
var js, fjs = d.getElementsByTagName(s)[0], p = /^http:/.test(d.location) ? 'http' : 'https'; |
1297
|
|
|
if (!d.getElementById(id)) { |
1298
|
|
|
js = d.createElement(s); |
1299
|
|
|
js.id = id; |
1300
|
|
|
js.src = p + '://platform.twitter.com/widgets.js'; |
1301
|
|
|
fjs.parentNode.insertBefore(js, fjs); |
1302
|
|
|
} |
1303
|
|
|
}(document, 'script', 'twitter-wjs');</script> |
1304
|
|
|
</li> |
1305
|
|
|
<li style='width: 34%;'> |
1306
|
|
|
<div class="g-plusone" data-size="medium" data-href="http://www.metaslider.com"></div> |
1307
|
|
|
<script type="text/javascript"> |
1308
|
|
|
(function () { |
1309
|
|
|
var po = document.createElement('script'); |
1310
|
|
|
po.type = 'text/javascript'; |
1311
|
|
|
po.async = true; |
1312
|
|
|
po.src = 'https://apis.google.com/js/plusone.js'; |
1313
|
|
|
var s = document.getElementsByTagName('script')[0]; |
1314
|
|
|
s.parentNode.insertBefore(po, s); |
1315
|
|
|
})(); |
1316
|
|
|
</script> |
1317
|
|
|
</li> |
1318
|
|
|
<li style='width: 33%;'> |
1319
|
|
|
<iframe style='border:none; overflow:hidden; width:80px; height:21px;' |
1320
|
|
|
src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.metaslider.com&send=false&layout=button_count&width=90&show_faces=false&font&colorscheme=light&action=like&height=21&appId=156668027835524" |
1321
|
|
|
scrolling="no" frameborder="0" allowTransparency="true"></iframe> |
1322
|
|
|
</li> |
1323
|
|
|
</ul> |
1324
|
|
|
</div> |
1325
|
|
|
</div> |
1326
|
|
|
<a class='delete-slider alignright button-secondary confirm' href='<?php echo wp_nonce_url("?page=metaslider&delete={$this->slider->id}", 'metaslider_delete_slider'); ?>'><?php _e('Delete Slider', 'metaslider') ?></a> |
1327
|
|
|
</div> |
1328
|
|
|
</div> |
1329
|
|
|
</div> |
1330
|
|
|
</div> |
1331
|
|
|
</div> |
1332
|
|
|
</form> |
1333
|
|
|
</div> |
1334
|
|
|
<?php |
1335
|
|
|
} |
1336
|
|
|
|
1337
|
|
|
/** |
1338
|
|
|
* Append the 'Add Slider' button to selected admin pages |
1339
|
|
|
* @param $context |
1340
|
|
|
* @return string |
1341
|
|
|
*/ |
1342
|
|
|
public function insert_metaslider_button($context) |
1343
|
|
|
{ |
1344
|
|
|
global $pagenow; |
1345
|
|
|
|
1346
|
|
|
if (in_array($pagenow, ['post.php', 'page.php', 'post-new.php', 'post-edit.php'])) { |
1347
|
|
|
$context .= '<a href="#TB_inline?&inlineId=choose-meta-slider" class="thickbox button" title="' |
1348
|
|
|
. __('Select slideshow to insert into post', 'metaslider') |
|
|
|
|
1349
|
|
|
. '"><span class="wp-media-buttons-icon" style="background: url(' |
1350
|
|
|
. METASLIDER_ASSETS_URL |
1351
|
|
|
. '/metaslider/matchalabs.png); background-repeat: no-repeat; background-position: left bottom;"></span> ' |
1352
|
|
|
. __('Add slider', 'metaslider') |
1353
|
|
|
. '</a>'; |
1354
|
|
|
} |
1355
|
|
|
|
1356
|
|
|
return $context; |
1357
|
|
|
} |
1358
|
|
|
|
1359
|
|
|
/** |
1360
|
|
|
* Append the 'Choose Meta Slider' thickbox content to the bottom of selected admin pages |
1361
|
|
|
*/ |
1362
|
|
|
public function admin_footer() |
1363
|
|
|
{ |
1364
|
|
|
global $pagenow; |
1365
|
|
|
|
1366
|
|
|
// Only run in post/page creation and edit screens |
1367
|
|
|
if (in_array($pagenow, ['post.php', 'page.php', 'post-new.php', 'post-edit.php'])) { |
1368
|
|
|
$sliders = $this->all_meta_sliders('title'); ?> |
1369
|
|
|
|
1370
|
|
|
<script type="text/javascript"> |
1371
|
|
|
jQuery(document).ready(function () { |
1372
|
|
|
jQuery('#insertMetaSlider').on('click', function () { |
1373
|
|
|
var id = jQuery('#metaslider-select option:selected').val(); |
1374
|
|
|
window.send_to_editor('[metaslider id="' + id + '"]'); |
1375
|
|
|
tb_remove(); |
1376
|
|
|
}) |
1377
|
|
|
}); |
1378
|
|
|
</script> |
1379
|
|
|
|
1380
|
|
|
<div id="choose-meta-slider" style="display: none;"> |
1381
|
|
|
<div class="wrap"> |
1382
|
|
|
<?php |
1383
|
|
|
if (count($sliders)) { |
1384
|
|
|
echo "<h3 style='margin-bottom: 20px;'>" . __('Insert Meta Slider', 'metaslider') . '</h3>'; |
|
|
|
|
1385
|
|
|
echo "<select id='metaslider-select'>"; |
1386
|
|
|
echo '<option disabled=disabled>' . __('Choose slideshow', 'metaslider') . '</option>'; |
1387
|
|
|
foreach ($sliders as $slider) { |
1388
|
|
|
echo "<option value='{$slider['id']}'>{$slider['title']}</option>"; |
1389
|
|
|
} |
1390
|
|
|
echo '</select>'; |
1391
|
|
|
echo "<button class='button primary' id='insertMetaSlider'>Insert Slideshow</button>"; |
1392
|
|
|
} else { |
1393
|
|
|
_e('No slideshows found', 'metaslider'); |
|
|
|
|
1394
|
|
|
} ?> |
1395
|
|
|
</div> |
1396
|
|
|
</div> |
1397
|
|
|
<?php |
1398
|
|
|
} |
1399
|
|
|
} |
1400
|
|
|
} |
1401
|
|
|
|
1402
|
|
|
$metaslider = new MetaSliderPlugin(); |
1403
|
|
|
|
1404
|
|
|
?> |
1405
|
|
|
|