PluginProbe ʕ •ᴥ•ʔ
Responsive Lightbox & Gallery / 2.2.3.1
Responsive Lightbox & Gallery v2.2.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 6 years ago class-fast-image.php 8 years ago class-folders-walker.php 7 years ago class-folders.php 6 years ago class-frontend.php 6 years ago class-galleries.php 6 years ago class-multilang.php 6 years ago class-remote-library-api.php 6 years ago class-remote-library.php 6 years ago class-settings.php 6 years ago class-tour.php 6 years ago class-welcome.php 6 years ago class-widgets.php 6 years ago functions.php 6 years ago
class-tour.php
327 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 // general
148 if ( $_GET['page'] === 'responsive-lightbox-settings' ) {
149 $pointer = array(
150 'content' => '<h3>' . __( 'General Settings', 'responsive-lightbox' ) . '</h3>' .
151 '<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 with its settings.", 'responsive-lightbox' ) . '</p>',
152 'button2' => __( 'Next', 'responsive-lightbox' ),
153 'id' => '#wpbody-content .wrap h2:first',
154 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-configuration' ) . '";'
155 );
156 // lightboxes
157 } elseif ( $_GET['page'] === 'responsive-lightbox-configuration' ) {
158 // get additional plugins based on tabs
159 $plugins = array_values( array_diff( array_keys( $rl->settings->tabs ), array( 'settings', 'configuration', 'gallery', 'builder', 'folders', 'remote_library', 'licenses', 'addons' ) ) );
160
161 if ( ! empty( $plugins ) ) {
162 // get first plugin tab key
163 $plugin_key = $plugins[0];
164 } else
165 $plugin_key = 'gallery';
166
167 $pointer = array(
168 'content' => '<h3>' . __( 'Lightboxes Settings', 'responsive-lightbox' ) . '</h3>' .
169 '<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>',
170 'button2' => __( 'Next', 'responsive-lightbox' ),
171 'id' => '#wpbody-content .wrap h2:first',
172 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-' . $plugin_key ) . '";'
173 );
174 // galleries
175 } elseif ( $_GET['page'] === 'responsive-lightbox-gallery' ) {
176 $pointer = array(
177 'content' => '<h3>' . __( 'Gallery Settings', 'responsive-lightbox' ) . '</h3>' .
178 '<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>',
179 'button2' => __( 'Next', 'responsive-lightbox' ),
180 'id' => '#wpbody-content .wrap h2:first',
181 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-builder' ) . '";'
182 );
183 // builder
184 } elseif ( $_GET['page'] === 'responsive-lightbox-builder' ) {
185 $pointer = array(
186 'content' => '<h3>' . __( 'Builder Settings', 'responsive-lightbox' ) . '</h3>' .
187 '<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>',
188 'button2' => __( 'Next', 'responsive-lightbox' ),
189 'id' => '#wpbody-content .wrap h2:first',
190 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-folders' ) . '";'
191 );
192 // media folders
193 } elseif ( $_GET['page'] === 'responsive-lightbox-folders' ) {
194 $pointer = array(
195 'content' => '<h3>' . __( 'Folders Settings', 'responsive-lightbox' ) . '</h3>' .
196 '<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>',
197 'button2' => __( 'Next', 'responsive-lightbox' ),
198 'id' => '#wpbody-content .wrap h2:first',
199 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-remote_library' ) . '";'
200 );
201 // remote library
202 } elseif ( $_GET['page'] === 'responsive-lightbox-remote_library' ) {
203 $pointer = array(
204 'content' => '<h3>' . __( 'Remote Library Settings', 'responsive-lightbox' ) . '</h3>' .
205 '<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>',
206 'button2' => __( 'Next', 'responsive-lightbox' ),
207 'id' => '#wpbody-content .wrap h2:first',
208 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-' . ( ! empty( $rl->settings->tabs['licenses'] ) ? 'licenses' : 'addons' ) ) . '";'
209 );
210 // licenses
211 } elseif ( $_GET['page'] === 'responsive-lightbox-licenses' ) {
212 $pointer = array(
213 'content' => '<h3>' . __( 'License Settings', 'responsive-lightbox' ) . '</h3>' .
214 '<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>',
215 'button2' => __( 'Next', 'responsive-lightbox' ),
216 'id' => '#wpbody-content .wrap h2:first',
217 'function' => 'window.location="' . admin_url( 'admin.php?page=responsive-lightbox-addons' ) . '";'
218 );
219 // addons
220 } elseif ( $_GET['page'] === 'responsive-lightbox-addons' ) {
221 $pointer = array(
222 'content' => '<h3>' . __( 'Add-ons', 'responsive-lightbox' ) . '</h3>' .
223 '<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>',
224 'button2' => '',
225 'id' => '#wpbody-content .wrap h2:first',
226 'function' => ''
227 );
228 // plugins related tabs
229 } else
230 $pointer = apply_filters( 'rl_tour_pointer', array(), esc_attr( $_GET['page'] ) );
231 }
232
233 // valid pointer?
234 if ( ! empty( $pointer ) ) {
235 $valid_pointer = array(
236 'content' => $pointer['content'],
237 'position' => array(
238 'edge' => 'top',
239 'align' => is_rtl() ? 'right' : 'left'
240 ),
241 'pointerWidth' => 400,
242 );
243
244 $this->print_scripts( $pointer['id'], $valid_pointer, __( 'Close', 'responsive-lightbox' ), $pointer['button2'], $pointer['function'] );
245 }
246 }
247
248 /**
249 * Ignore tour.
250 *
251 * @return void
252 */
253 public function ignore_tour() {
254 if ( isset( $_POST['rl_nonce'] ) && wp_verify_nonce( $_POST['rl_nonce'], 'rl-ignore-tour' ) !== false )
255 delete_transient( 'rl_active_tour' );
256
257 exit;
258 }
259
260 /**
261 * Prints the pointer script
262 *
263 * @return void
264 */
265 public function print_scripts( $selector, $options, $button1, $button2 = false, $button2_function = '', $button1_function = '' ) {
266 ?>
267 <script type="text/javascript">
268 //<![CDATA[
269 ( function ( $ ) {
270 $( document ).ready( function ( $ ) {
271 var rl_pointer_options = <?php echo json_encode( $options ); ?>,
272 setup;
273
274 function rl_set_ignore( option, hide, nonce ) {
275 $.post( ajaxurl, {
276 action: 'rl-ignore-tour',
277 rl_nonce: nonce
278 }, function ( data ) {
279 if ( data ) {
280 $( '#' + hide ).hide();
281 $( '#hidden_ignore_' + option ).val( 'ignore' );
282 }
283 }
284 );
285 }
286
287 rl_pointer_options = $.extend( rl_pointer_options, {
288 buttons: function ( event, t ) {
289 var button = $( '<a id="rl-pointer-close" style="margin-left: 5px;" class="button-secondary">' + '<?php echo $button1; ?>' + '</a>' );
290
291 button.bind( 'click.pointer', function () {
292 t.element.pointer( 'close' );
293 } );
294
295 return button;
296 },
297 close: function () {}
298 } );
299
300 setup = function () {
301 $( '<?php echo $selector; ?>' ).pointer( rl_pointer_options ).pointer( 'open' );
302
303 <?php if ( $button2 ) { ?>
304
305 $( '#rl-pointer-close' ).after( '<a id="pointer-primary" class="button-primary">' + '<?php echo $button2; ?>' + '</a>' );
306 $( '#pointer-primary' ).click( function () {
307 <?php echo $button2_function; ?>
308 } );
309
310 <?php } ?>
311
312 $( '#rl-pointer-close' ).click( function () {
313 rl_set_ignore( 'tour', 'wp-pointer-0', '<?php echo esc_js( wp_create_nonce( 'rl-ignore-tour' ) ); ?>' );
314 } );
315 };
316
317 if ( rl_pointer_options.position && rl_pointer_options.position.defer_loading )
318 $( window ).bind( 'load.wp-pointers', setup );
319 else
320 $( document ).ready( setup );
321 } );
322 } )( jQuery );
323 //]]>
324 </script>
325 <?php
326 }
327 }