PluginProbe ʕ •ᴥ•ʔ
Responsive Lightbox & Gallery / 2.3.1
Responsive Lightbox & Gallery v2.3.1
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 5 years ago class-fast-image.php 8 years ago class-folders-walker.php 7 years ago class-folders.php 5 years ago class-frontend.php 5 years ago class-galleries.php 5 years ago class-multilang.php 5 years ago class-remote-library-api.php 5 years ago class-remote-library.php 5 years ago class-settings.php 5 years ago class-tour.php 5 years ago class-welcome.php 5 years ago class-widgets.php 5 years ago functions.php 5 years ago
class-tour.php
340 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 * @return void
31 */
32 public function init_tour() {
33 if ( ! current_user_can( apply_filters( 'rl_lightbox_settings_capability', 'manage_options' ) ) )
34 return;
35
36 global $pagenow;
37
38 if ( $pagenow === 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] === 'responsive-lightbox-tour' ) {
39 set_transient( 'rl_active_tour', 1, 0 );
40
41 if ( Responsive_Lightbox()->options['builder']['gallery_builder'] )
42 wp_redirect( admin_url( 'edit.php?post_type=rl_gallery' ) );
43 else
44 wp_redirect( admin_url( 'admin.php?page=responsive-lightbox-settings' ) );
45
46 exit;
47 }
48
49 if ( (int) get_transient( 'rl_active_tour' ) === 1 ) {
50 add_action( 'admin_enqueue_scripts', array( $this, 'tour_scripts_styles' ) );
51 add_action( 'admin_print_footer_scripts', array( $this, 'start_tour' ) );
52 }
53 }
54
55 /**
56 * Add temporary admin menu.
57 *
58 * @return void
59 */
60 public function admin_menu() {
61 global $pagenow;
62
63 if ( $pagenow === 'admin.php' && isset( $_GET['page'] ) && $_GET['page'] === 'responsive-lightbox-tour' )
64 add_submenu_page( 'responsive-lightbox-settings', '', '', apply_filters( 'rl_lightbox_settings_capability', 'manage_options' ), 'responsive-lightbox-tour', array( $this, 'temporary_submenu' ) );
65 }
66
67 /**
68 *
69 */
70 function temporary_submenu() {}
71
72 /**
73 * Load pointer scripts.
74 *
75 * @return void
76 */
77 public function tour_scripts_styles() {
78 // enqueue styles
79 wp_enqueue_style( 'wp-pointer' );
80
81 // enqueue scripts
82 wp_enqueue_script( 'jquery-ui' );
83 wp_enqueue_script( 'wp-pointer' );
84 wp_enqueue_script( 'utils' );
85 }
86
87 /**
88 * Load the introduction tour.
89 *
90 * @return void
91 */
92 public function start_tour() {
93 global $pagenow;
94
95 $pointer = array();
96 $rl = Responsive_Lightbox();
97
98 // galleries
99 if ( $pagenow === 'edit.php' ) {
100 if ( isset( $_GET['post_type'] ) && $_GET['post_type'] === 'rl_gallery' && $rl->options['builder']['gallery_builder'] ) {
101 $pointer = array(
102 'content' => '<h3>' . __( 'Gallery Builder', 'responsive-lightbox' ) . '</h3>' .
103 '<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>',
104 'button2' => __( 'Next', 'responsive-lightbox' ),
105 'id' => '#wpbody-content h1'
106 );
107
108 // next categories?
109 if ( $rl->options['builder']['categories'] )
110 $pointer['function'] = 'window.location="' . admin_url( 'edit-tags.php?taxonomy=rl_category&post_type=rl_gallery' ) . '";';
111 // next tags?
112 elseif ( $rl->options['builder']['tags'] )
113 $pointer['function'] = 'window.location="' . admin_url( 'edit-tags.php?taxonomy=rl_tag&post_type=rl_gallery' ) . '";';
114 // or settings?
115 else
116 $pointer['function'] = 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-settings' ) . '";';
117 }
118 // gallery taxonomies
119 } elseif ( $pagenow === 'edit-tags.php' ) {
120 if ( isset( $_GET['taxonomy'], $_GET['post_type'] ) && $_GET['post_type'] === 'rl_gallery' ) {
121 if ( $_GET['taxonomy'] === 'rl_category' ) {
122 $pointer = array(
123 'content' => '<h3>' . __( 'Gallery Categories', 'responsive-lightbox' ) . '</h3>' .
124 '<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>',
125 'button2' => __( 'Next', 'responsive-lightbox' ),
126 'id' => '#wpbody-content h1'
127 );
128
129 // next tags?
130 if ( $rl->options['builder']['tags'] )
131 $pointer['function'] = 'window.location="' . admin_url( 'edit-tags.php?taxonomy=rl_tag&post_type=rl_gallery' ) . '";';
132 // or settings?
133 else
134 $pointer['function'] = 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-settings' ) . '";';
135 } elseif ( $_GET['taxonomy'] === 'rl_tag' ) {
136 $pointer = array(
137 'content' => '<h3>' . __( 'Gallery Tags', 'responsive-lightbox' ) . '</h3>' .
138 '<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>',
139 'button2' => __( 'Next', 'responsive-lightbox' ),
140 'id' => '#wpbody-content h1',
141 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-settings' ) . '";'
142 );
143 }
144 }
145 // settings
146 } elseif ( $pagenow === 'admin.php' && isset( $_GET['page'] ) ) {
147
148 // general
149 if ( $_GET['page'] === 'responsive-lightbox-settings' ) {
150 $pointer = array(
151 'content' => '<h3>' . __( 'General Settings', 'responsive-lightbox' ) . '</h3>' .
152 '<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>',
153 'button2' => __( 'Next', 'responsive-lightbox' ),
154 'id' => '#wpbody-content .wrap .nav-tab-active',
155 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-configuration' ) . '";'
156 );
157 // lightboxes
158 } elseif ( $_GET['page'] === 'responsive-lightbox-configuration' ) {
159 // get additional plugins based on tabs
160 $plugins = array_values( array_diff( array_keys( $rl->settings->tabs ), array( 'settings', 'configuration', 'gallery', 'builder', 'folders', 'remote_library', 'capabilities', 'licenses', 'addons' ) ) );
161
162 if ( ! empty( $plugins ) ) {
163 // get first plugin tab key
164 $plugin_key = $plugins[0];
165 } else
166 $plugin_key = 'gallery';
167
168 $pointer = array(
169 'content' => '<h3>' . __( 'Lightboxes Settings', 'responsive-lightbox' ) . '</h3>' .
170 '<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>',
171 'button2' => __( 'Next', 'responsive-lightbox' ),
172 'id' => '#wpbody-content .wrap .nav-tab-active',
173 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-' . $plugin_key ) . '";'
174 );
175 // galleries
176 } elseif ( $_GET['page'] === 'responsive-lightbox-gallery' ) {
177 $pointer = array(
178 'content' => '<h3>' . __( 'Gallery Settings', 'responsive-lightbox' ) . '</h3>' .
179 '<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>',
180 'button2' => __( 'Next', 'responsive-lightbox' ),
181 'id' => '#wpbody-content .wrap .nav-tab-active',
182 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-builder' ) . '";'
183 );
184 // builder
185 } elseif ( $_GET['page'] === 'responsive-lightbox-builder' ) {
186 $pointer = array(
187 'content' => '<h3>' . __( 'Builder Settings', 'responsive-lightbox' ) . '</h3>' .
188 '<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>',
189 'button2' => __( 'Next', 'responsive-lightbox' ),
190 'id' => '#wpbody-content .wrap .nav-tab-active',
191 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-folders' ) . '";'
192 );
193 // media folders
194 } elseif ( $_GET['page'] === 'responsive-lightbox-folders' ) {
195 $pointer = array(
196 'content' => '<h3>' . __( 'Folders Settings', 'responsive-lightbox' ) . '</h3>' .
197 '<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>',
198 'button2' => __( 'Next', 'responsive-lightbox' ),
199 'id' => '#wpbody-content .wrap .nav-tab-active',
200 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-capabilities' ) . '";'
201 );
202 // capabilities
203 } elseif ( $_GET['page'] === 'responsive-lightbox-capabilities' ) {
204 $pointer = array(
205 'content' => '<h3>' . __( 'Capabilities Settings', 'responsive-lightbox' ) . '</h3>' .
206 '<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>',
207 'button2' => __( 'Next', 'responsive-lightbox' ),
208 'id' => '#wpbody-content .wrap .nav-tab-active',
209 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-remote_library' ) . '";'
210 );
211 // remote library
212 } elseif ( $_GET['page'] === 'responsive-lightbox-remote_library' ) {
213 $pointer = array(
214 'content' => '<h3>' . __( 'Remote Library Settings', 'responsive-lightbox' ) . '</h3>' .
215 '<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>',
216 'button2' => __( 'Next', 'responsive-lightbox' ),
217 'id' => '#wpbody-content .wrap .nav-tab-active',
218 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-' . ( ! empty( $rl->settings->tabs['licenses'] ) ? 'licenses' : 'addons' ) ) . '";'
219 );
220
221 // licenses
222 } elseif ( $_GET['page'] === 'responsive-lightbox-licenses' ) {
223 $pointer = array(
224 'content' => '<h3>' . __( 'License Settings', 'responsive-lightbox' ) . '</h3>' .
225 '<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>',
226 'button2' => __( 'Next', 'responsive-lightbox' ),
227 'id' => '#wpbody-content .wrap .nav-tab-active',
228 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-addons' ) . '";'
229 );
230 // addons
231 } elseif ( $_GET['page'] === 'responsive-lightbox-addons' ) {
232 $pointer = array(
233 'content' => '<h3>' . __( 'Add-ons', 'responsive-lightbox' ) . '</h3>' .
234 '<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>',
235 'button2' => '',
236 'id' => '#wpbody-content .wrap .nav-tab-active',
237 'function' => ''
238 );
239 // plugins related tabs
240 } else
241 $pointer = apply_filters( 'rl_tour_pointer', array(), esc_attr( $_GET['page'] ) );
242 }
243
244 // valid pointer?
245 if ( ! empty( $pointer ) ) {
246 $valid_pointer = array(
247 'content' => $pointer['content'],
248 'position' => array(
249 'edge' => 'top',
250 'align' => is_rtl() ? 'right' : 'left'
251 ),
252 'pointerWidth' => 400,
253 );
254
255 $this->print_scripts( $pointer['id'], $valid_pointer, __( 'Close', 'responsive-lightbox' ), $pointer['button2'], $pointer['function'] );
256 }
257 }
258
259 /**
260 * Ignore tour.
261 *
262 * @return void
263 */
264 public function ignore_tour() {
265 if ( isset( $_POST['rl_nonce'] ) && wp_verify_nonce( $_POST['rl_nonce'], 'rl-ignore-tour' ) !== false )
266 delete_transient( 'rl_active_tour' );
267
268 exit;
269 }
270
271 /**
272 * Prints the pointer script
273 *
274 * @return void
275 */
276 public function print_scripts( $selector, $options, $button1, $button2 = false, $button2_function = '', $button1_function = '' ) {
277 ?>
278 <script type="text/javascript">
279 //<![CDATA[
280 ( function( $ ) {
281 // ready event
282 $( function() {
283 var rl_pointer_options = <?php echo json_encode( $options ); ?>,
284 setup;
285
286 function rl_set_ignore( option, hide, nonce ) {
287 $.post( ajaxurl, {
288 action: 'rl-ignore-tour',
289 rl_nonce: nonce
290 }, function( data ) {
291 if ( data ) {
292 $( '#' + hide ).hide();
293 $( '#hidden_ignore_' + option ).val( 'ignore' );
294 }
295 }
296 );
297 }
298
299 rl_pointer_options = $.extend( rl_pointer_options, {
300 buttons: function( event, t ) {
301 var button = $( '<a id="rl-pointer-close" style="margin-left: 5px;" class="button-secondary">' + '<?php echo $button1; ?>' + '</a>' );
302
303 button.on( 'click.pointer', function() {
304 t.element.pointer( 'close' );
305 } );
306
307 return button;
308 },
309 close: function() {}
310 } );
311
312 setup = function() {
313 $( '<?php echo $selector; ?>' ).pointer( rl_pointer_options ).pointer( 'open' );
314
315 <?php if ( $button2 ) { ?>
316
317 $( '#rl-pointer-close' ).after( '<a id="pointer-primary" class="button-primary">' + '<?php echo $button2; ?>' + '</a>' );
318 $( '#pointer-primary' ).on( 'click', function() {
319 <?php echo $button2_function; ?>
320 } );
321
322 <?php } ?>
323
324 $( '#rl-pointer-close' ).on( 'click', function() {
325 rl_set_ignore( 'tour', 'wp-pointer-0', '<?php echo esc_js( wp_create_nonce( 'rl-ignore-tour' ) ); ?>' );
326 } );
327 };
328
329 if ( rl_pointer_options.position && rl_pointer_options.position.defer_loading )
330 $( window ).on( 'load.wp-pointers', setup );
331 else
332 $( document ).ready( setup );
333 } );
334 } )( jQuery );
335 //]]>
336 </script>
337 <?php
338 }
339 }
340