PluginProbe ʕ •ᴥ•ʔ
Responsive Lightbox & Gallery / 2.4.2
Responsive Lightbox & Gallery v2.4.2
2.7.8 trunk 1.0.0 1.0.1 1.0.1.1 1.0.2 1.0.3 1.0.4 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.4.0 1.4.0.1 1.4.1 1.4.11 1.4.12 1.4.13 1.4.14 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.6.0 1.6.1 1.6.10 1.6.11 1.6.12 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.3.1 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7
responsive-lightbox / includes / class-tour.php
responsive-lightbox / includes Last commit date
providers 3 years ago class-fast-image.php 8 years ago class-folders-walker.php 7 years ago class-folders.php 3 years ago class-frontend.php 3 years ago class-galleries.php 3 years ago class-multilang.php 3 years ago class-remote-library-api.php 3 years ago class-remote-library.php 3 years ago class-settings.php 3 years ago class-tour.php 3 years ago class-welcome.php 3 years ago class-widgets.php 3 years ago functions.php 3 years ago
class-tour.php
346 lines
1 <?php
2 // exit if accessed directly
3 if ( ! defined( 'ABSPATH' ) )
4 exit;
5
6 new Responsive_Lightbox_Tour();
7
8 /**
9 * Responsive_Lightbox_Tour class.
10 *
11 * @class Responsive_Lightbox_Tour
12 */
13 class Responsive_Lightbox_Tour {
14
15 /**
16 * Class constructor.
17 *
18 * @return void
19 */
20 public function __construct() {
21 // actions
22 add_action( 'admin_menu', array( $this, 'admin_menu' ) );
23 add_action( 'admin_init', array( $this, 'init_tour' ) );
24 add_action( 'wp_ajax_rl-ignore-tour', array( $this, 'ignore_tour' ) );
25 }
26
27 /**
28 * Initialize tour.
29 *
30 * @global string $pagenow
31 *
32 * @return void
33 */
34 public function init_tour() {
35 if ( ! current_user_can( apply_filters( 'rl_lightbox_settings_capability', 'manage_options' ) ) )
36 return;
37
38 global $pagenow;
39
40 if ( $pagenow === 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] === 'responsive-lightbox-tour' ) {
41 set_transient( 'rl_active_tour', 1, 0 );
42
43 if ( Responsive_Lightbox()->options['builder']['gallery_builder'] )
44 wp_redirect( admin_url( 'edit.php?post_type=rl_gallery' ) );
45 else
46 wp_redirect( admin_url( 'admin.php?page=responsive-lightbox-settings' ) );
47
48 exit;
49 }
50
51 if ( (int) get_transient( 'rl_active_tour' ) === 1 ) {
52 add_action( 'admin_enqueue_scripts', array( $this, 'tour_scripts_styles' ) );
53 add_action( 'admin_print_footer_scripts', array( $this, 'start_tour' ) );
54 }
55 }
56
57 /**
58 * Add temporary admin menu.
59 *
60 * @global string $pagenow
61 *
62 * @return void
63 */
64 public function admin_menu() {
65 global $pagenow;
66
67 if ( $pagenow === 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] === 'responsive-lightbox-tour' )
68 add_submenu_page( 'responsive-lightbox-settings', '', '', apply_filters( 'rl_lightbox_settings_capability', 'manage_options' ), 'responsive-lightbox-tour', array( $this, 'temporary_submenu' ) );
69 }
70
71 /**
72 *
73 */
74 function temporary_submenu() {}
75
76 /**
77 * Load pointer scripts.
78 *
79 * @return void
80 */
81 public function tour_scripts_styles() {
82 // enqueue styles
83 wp_enqueue_style( 'wp-pointer' );
84
85 // enqueue scripts
86 wp_enqueue_script( 'jquery-ui' );
87 wp_enqueue_script( 'wp-pointer' );
88 wp_enqueue_script( 'utils' );
89 }
90
91 /**
92 * Load the introduction tour.
93 *
94 * @global string $pagenow
95 *
96 * @return void
97 */
98 public function start_tour() {
99 global $pagenow;
100
101 $pointer = array();
102 $rl = Responsive_Lightbox();
103
104 // galleries
105 if ( $pagenow === 'edit.php' ) {
106 if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'rl_gallery' && $rl->options['builder']['gallery_builder'] ) {
107 $pointer = array(
108 'content' => '<h3>' . __( 'Gallery Builder', 'responsive-lightbox' ) . '</h3>' .
109 '<p>' . __( 'This is an advanced gallery builder. Here you can see a preview of all created galleries along with their settings, such as the name, type, source of images, author or date of publication. You can also add a new gallery, edit existing ones or quickly copy the code allowing its use on the site.', 'responsive-lightbox' ) . '</p>',
110 'button2' => __( 'Next', 'responsive-lightbox' ),
111 'id' => '#wpbody-content h1'
112 );
113
114 // next categories?
115 if ( $rl->options['builder']['categories'] )
116 $pointer['function'] = 'window.location="' . admin_url( 'edit-tags.php?taxonomy=rl_category&post_type=rl_gallery' ) . '";';
117 // next tags?
118 elseif ( $rl->options['builder']['tags'] )
119 $pointer['function'] = 'window.location="' . admin_url( 'edit-tags.php?taxonomy=rl_tag&post_type=rl_gallery' ) . '";';
120 // or settings?
121 else
122 $pointer['function'] = 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-settings' ) . '";';
123 }
124 // gallery taxonomies
125 } elseif ( $pagenow === 'edit-tags.php' ) {
126 if ( isset( $_GET['taxonomy'], $_GET['post_type'] ) && $_GET['post_type'] === 'rl_gallery' ) {
127 if ( $_GET['taxonomy'] === 'rl_category' ) {
128 $pointer = array(
129 'content' => '<h3>' . __( 'Gallery Categories', 'responsive-lightbox' ) . '</h3>' .
130 '<p>' . __( 'Gallery categories allow you to arrange galleries into individual groups that you can potentially use. Here you can create, name and edit them. However, assigning the gallery to the category takes place on the gallery editing screen.', 'responsive-lightbox' ) . '</p>',
131 'button2' => __( 'Next', 'responsive-lightbox' ),
132 'id' => '#wpbody-content h1'
133 );
134
135 // next tags?
136 if ( $rl->options['builder']['tags'] )
137 $pointer['function'] = 'window.location="' . admin_url( 'edit-tags.php?taxonomy=rl_tag&post_type=rl_gallery' ) . '";';
138 // or settings?
139 else
140 $pointer['function'] = 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-settings' ) . '";';
141 } elseif ( $_GET['taxonomy'] === 'rl_tag' ) {
142 $pointer = array(
143 'content' => '<h3>' . __( 'Gallery Tags', 'responsive-lightbox' ) . '</h3>' .
144 '<p>' . __( 'Gallery tags, like categories, allow you to arrange galleries into groups. You can think of them as keywords, which you can use to further specify your galleries. Here you can create, name and edit them.', 'responsive-lightbox' ) . '</p>',
145 'button2' => __( 'Next', 'responsive-lightbox' ),
146 'id' => '#wpbody-content h1',
147 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-settings' ) . '";'
148 );
149 }
150 }
151 // settings
152 } elseif ( $pagenow === 'admin.php' && isset( $_GET['page'] ) ) {
153
154 // general
155 if ( $_GET['page'] === 'responsive-lightbox-settings' ) {
156 $pointer = array(
157 'content' => '<h3>' . __( 'General Settings', 'responsive-lightbox' ) . '</h3>' .
158 '<p>' . __( "Here are the main settings for Responsive Lightbox & Gallery. They allow you to specify general rules of the plugin's operation and technical parameters of the lightbox effect and gallery. For example - you can choose your favorite lightbox effect, specify for which elements it will automatically launch and set its parameters. You can also choose the default gallery and its settings.", 'responsive-lightbox' ) . '</p>',
159 'button2' => __( 'Next', 'responsive-lightbox' ),
160 'id' => '#wpbody-content .wrap .nav-tab-active',
161 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-configuration' ) . '";'
162 );
163 // lightboxes
164 } elseif ( $_GET['page'] === 'responsive-lightbox-configuration' ) {
165 $pointer = array(
166 'content' => '<h3>' . __( 'Lightboxes Settings', 'responsive-lightbox' ) . '</h3>' .
167 '<p>' . __( 'Each lightbox has different look, possibilities and parameters. Here is a list of available lightbox effects along with their settings. After entering the tab you can see the settings of the currently selected lightbox, but you can also modify or restore the settings of the others.', 'responsive-lightbox' ) . '</p>',
168 'button2' => __( 'Next', 'responsive-lightbox' ),
169 'id' => '#wpbody-content .wrap .nav-tab-active',
170 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-gallery' ) . '";'
171 );
172 // galleries
173 } elseif ( $_GET['page'] === 'responsive-lightbox-gallery' ) {
174 $pointer = array(
175 'content' => '<h3>' . __( 'Gallery Settings', 'responsive-lightbox' ) . '</h3>' .
176 '<p>' . __( "This is the screen of the default gallery settings. As in the case of lightbox effects, there is a list of available galleries and their parameters. After entering the tab you can see the settings of the currently selected gallery. You can modify and adjust them to your needs or restore it's default settings.", 'responsive-lightbox' ) . '</p>',
177 'button2' => __( 'Next', 'responsive-lightbox' ),
178 'id' => '#wpbody-content .wrap .nav-tab-active',
179 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-builder' ) . '";'
180 );
181 // builder
182 } elseif ( $_GET['page'] === 'responsive-lightbox-builder' ) {
183 $pointer = array(
184 'content' => '<h3>' . __( 'Builder Settings', 'responsive-lightbox' ) . '</h3>' .
185 '<p>' . __( 'You can use the galleries in many ways - insert them into posts using the Add Gallery button, insert manually using shortcodes or add to the theme using functions. But you can also display them in archives just like other post types. Use these settings to specify the functionality of the gallery builder like categories, tags, archives and permalinks.', 'responsive-lightbox' ) . '</p>',
186 'button2' => __( 'Next', 'responsive-lightbox' ),
187 'id' => '#wpbody-content .wrap .nav-tab-active',
188 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-folders' ) . '";'
189 );
190 // media folders
191 } elseif ( $_GET['page'] === 'responsive-lightbox-folders' ) {
192 $pointer = array(
193 'content' => '<h3>' . __( 'Folders Settings', 'responsive-lightbox' ) . '</h3>' .
194 '<p>' . __( 'Responsive Lithbox & Gallery comes with an optional Media Folders feature that extends your WordPress Media Library with visual folders. It allows you to organize your attachments in a folder tree structure. Move, copy, rename and delete files and folders with a nice drag and drop interface.', 'responsive-lightbox' ) . '</p>',
195 'button2' => __( 'Next', 'responsive-lightbox' ),
196 'id' => '#wpbody-content .wrap .nav-tab-active',
197 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-capabilities' ) . '";'
198 );
199 // capabilities
200 } elseif ( $_GET['page'] === 'responsive-lightbox-capabilities' ) {
201 $pointer = array(
202 'content' => '<h3>' . __( 'Capabilities Settings', 'responsive-lightbox' ) . '</h3>' .
203 '<p>' . __( 'Capabilities give you the ability to control what users can and cannot do within the plugin. By default only the Administrator role allows a user to perform all possible capabilities. But you can fine tune these settings to match your specific requirements.', 'responsive-lightbox' ) . '</p>',
204 'button2' => __( 'Next', 'responsive-lightbox' ),
205 'id' => '#wpbody-content .wrap .nav-tab-active',
206 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-remote_library' ) . '";'
207 );
208 // remote library
209 } elseif ( $_GET['page'] === 'responsive-lightbox-remote_library' ) {
210 // get additional plugins based on tabs
211 $plugins = array_values( array_diff( array_keys( $rl->settings->tabs ), array( 'settings', 'configuration', 'gallery', 'builder', 'folders', 'remote_library', 'capabilities', 'licenses', 'addons' ) ) );
212
213 if ( ! empty( $plugins ) ) {
214 // get first plugin tab key
215 $plugin_key = $plugins[0];
216 } else
217 $plugin_key = 'addons';
218
219 $pointer = array(
220 'content' => '<h3>' . __( 'Remote Library Settings', 'responsive-lightbox' ) . '</h3>' .
221 '<p>' . __( 'Are you looking for free royalty free public domain and CC0-Licensed images for your website? Or you need to access your images stored in photo-sharing apps? Remote Library allows you to use images from multiple sources like Unsplash, Pixabay, Flickr or Instagram directly in your WordPress Media Manager. Now you can create galleries, browse, insert and import images as never before.', 'responsive-lightbox' ) . '</p>',
222 'button2' => __( 'Next', 'responsive-lightbox' ),
223 'id' => '#wpbody-content .wrap .nav-tab-active',
224 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-' . $plugin_key ) . '";'
225 );
226
227 // licenses
228 } elseif ( $_GET['page'] === 'responsive-lightbox-licenses' ) {
229 $pointer = array(
230 'content' => '<h3>' . __( 'License Settings', 'responsive-lightbox' ) . '</h3>' .
231 '<p>' . __( 'This section contains a list of currently installed premium extensions. Activate your licenses to have access to automatic updates from your site. To activate the license, copy and paste the license key for the extension and save the changes. Available license keys can be found on your account on our website.', 'responsive-lightbox' ) . '</p>',
232 'button2' => __( 'Next', 'responsive-lightbox' ),
233 'id' => '#wpbody-content .wrap .nav-tab-active',
234 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-addons' ) . '";'
235 );
236 // addons
237 } elseif ( $_GET['page'] === 'responsive-lightbox-addons' ) {
238 $pointer = array(
239 'content' => '<h3>' . __( 'Add-ons', 'responsive-lightbox' ) . '</h3>' .
240 '<p>' . __( 'Responsive Lightbox & Gallery is more than that. Do you need a beautiful lightbox effect, integration with social media, an attractive image gallery? Among our products you will surely find something for yourself. Boost your creativity and enhance your website with these beautiful, easy to use extensions, designed with Responsive Lightbox & Gallery integration in mind.', 'responsive-lightbox' ) . '</p>',
241 'button2' => '',
242 'id' => '#wpbody-content .wrap .nav-tab-active',
243 'function' => ''
244 );
245 // plugins related tabs
246 } else
247 $pointer = apply_filters( 'rl_tour_pointer', array(), esc_attr( $_GET['page'] ) );
248 }
249
250 // valid pointer?
251 if ( ! empty( $pointer ) ) {
252 $valid_pointer = array(
253 'content' => $pointer['content'],
254 'position' => array(
255 'edge' => 'top',
256 'align' => is_rtl() ? 'right' : 'left'
257 ),
258 'pointerWidth' => 400,
259 );
260
261 $this->print_scripts( $pointer['id'], $valid_pointer, __( 'Close', 'responsive-lightbox' ), $pointer['button2'], $pointer['function'] );
262 }
263 }
264
265 /**
266 * Ignore tour.
267 *
268 * @return void
269 */
270 public function ignore_tour() {
271 if ( isset( $_POST['rl_nonce'] ) && wp_verify_nonce( $_POST['rl_nonce'], 'rl-ignore-tour' ) !== false )
272 delete_transient( 'rl_active_tour' );
273
274 exit;
275 }
276
277 /**
278 * Prints the pointer script
279 *
280 * @return void
281 */
282 public function print_scripts( $selector, $options, $button1, $button2 = false, $button2_function = '', $button1_function = '' ) {
283 ?>
284 <script type="text/javascript">
285 //<![CDATA[
286 ( function( $ ) {
287 // ready event
288 $( function() {
289 var rl_pointer_options = <?php echo json_encode( $options ); ?>,
290 setup;
291
292 function rl_set_ignore( option, hide, nonce ) {
293 $.post( ajaxurl, {
294 action: 'rl-ignore-tour',
295 rl_nonce: nonce
296 }, function( data ) {
297 if ( data ) {
298 $( '#' + hide ).hide();
299 $( '#hidden_ignore_' + option ).val( 'ignore' );
300 }
301 }
302 );
303 }
304
305 rl_pointer_options = $.extend( rl_pointer_options, {
306 buttons: function( event, t ) {
307 var button = $( '<a id="rl-pointer-close" style="margin-left: 5px;" class="button-secondary">' + '<?php echo $button1; ?>' + '</a>' );
308
309 button.on( 'click.pointer', function() {
310 t.element.pointer( 'close' );
311 } );
312
313 return button;
314 },
315 close: function() {}
316 } );
317
318 setup = function() {
319 $( '<?php echo $selector; ?>' ).pointer( rl_pointer_options ).pointer( 'open' );
320
321 <?php if ( $button2 ) { ?>
322
323 $( '#rl-pointer-close' ).after( '<a id="pointer-primary" class="button-primary">' + '<?php echo $button2; ?>' + '</a>' );
324 $( '#pointer-primary' ).on( 'click', function() {
325 <?php echo $button2_function; ?>
326 } );
327
328 <?php } ?>
329
330 $( '#rl-pointer-close' ).on( 'click', function() {
331 rl_set_ignore( 'tour', 'wp-pointer-0', '<?php echo esc_js( wp_create_nonce( 'rl-ignore-tour' ) ); ?>' );
332 } );
333 };
334
335 if ( rl_pointer_options.position && rl_pointer_options.position.defer_loading )
336 $( window ).on( 'load.wp-pointers', setup );
337 else
338 $( document ).ready( setup );
339 } );
340 } )( jQuery );
341 //]]>
342 </script>
343 <?php
344 }
345 }
346