PluginProbe
Loading Page with Loading Screen / 1.0.85
Loading Page with Loading Screen v1.0.85
1.2.8 1.0.92 1.0.93 1.0.94 1.0.95 1.0.96 1.1.0 1.1.1 1.1.10 1.1.11 1.1.12 1.1.13 1.1.14 1.1.15 1.1.16 1.1.17 1.1.18 1.1.19 1.1.2 1.1.20 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 All 46 releases
loading-page / loading-page.php

loading-page.php in Loading Page with Loading Screen 1.0.85, at loading-page.php

1,091 lines 53.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 Plugin Name: Loading Page
4 Plugin URI: http://wordpress.dwbooster.com/content-tools/loading-page
5 Description: Loading Page plugin performs a pre-loading of images on your website and displays a loading progress screen with percentage of completion. Once everything is loaded, the screen disappears.
6 Version: 1.0.85
7 Author: CodePeople
8 Author URI: http://wordpress.dwbooster.com/content-tools/loading-page
9 License: GPLv2
10 Text Domain: loading-page
11 */
12
13 require_once 'banner.php';
14 $codepeople_promote_banner_plugins['codepeople-loading-page'] = array(
15 'plugin_name' => 'Loading Page',
16 'plugin_url' => 'https://wordpress.org/support/plugin/loading-page/reviews/#new-post',
17 );
18
19 // CONST.
20 define( 'LOADING_PAGE_PLUGIN_DIR', dirname( __FILE__ ) );
21 define( 'LOADING_PAGE_PLUGIN_URL', plugins_url( '', __FILE__ ) );
22 define( 'LOADING_PAGE_TD', 'loading-page' );
23
24 // Feedback system.
25 require_once 'feedback/cp-feedback.php';
26 new CP_FEEDBACK( plugin_basename( dirname( __FILE__ ) ), __FILE__, 'https://wordpress.dwbooster.com/contact-us' );
27
28 require LOADING_PAGE_PLUGIN_DIR . '/includes/admin_functions.php';
29
30 add_filter( 'option_sbp_settings', 'loading_page_troubleshoot' );
31 if ( ! function_exists( 'loading_page_troubleshoot' ) ) {
32 /**
33 * Troubleshoot
34 *
35 * @param array $option checks values entered by third-party plugins.
36 */
37 function loading_page_troubleshoot( $option ) {
38 if ( ! is_admin() ) {
39 // Solves a conflict caused by the "Speed Booster Pack" plugin.
40 if ( is_array( $option ) && isset( $option['jquery_to_footer'] ) ) {
41 unset( $option['jquery_to_footer'] );
42 }
43 if ( is_array( $option ) && isset( $option['defer_parsing'] ) ) {
44 unset( $option['defer_parsing'] );
45 }
46 }
47 return $option;
48 } // End loading_page_troubleshoot.
49 }
50
51 /**
52 * Plugin activation
53 */
54 register_activation_hook( __FILE__, 'loading_page_install' );
55 if ( ! function_exists( 'loading_page_install' ) ) {
56 /**
57 * Default options
58 */
59 function _loading_page_options() {
60 $loading_page_options = get_option( 'loading_page_options', array() );
61 if ( ! empty( $loading_page_options ) ) {
62 return;
63 }
64
65 // Set the default options here.
66 $loading_page_options = array(
67 'foregroundColor' => '#000000',
68 'backgroundColor' => '#ffffff',
69 'enabled_loading_screen' => true,
70 'close_btn' => true,
71 'remove_in_on_load' => false,
72 'loading_screen' => 'logo',
73 'lp_loading_screen_display_in' => 'all',
74 'once_per_session' => 'always',
75 'lp_loading_screen_display_in_pages' => '',
76 'lp_loading_screen_display_post_types' => '',
77 'lp_loading_screen_exclude_from_pages' => '',
78 'lp_loading_screen_exclude_from_post_types' => '',
79 'lp_loading_screen_exclude_from_urls' => array(),
80 'displayPercent' => true,
81 'backgroundImage' => '',
82 'backgroundImageRepeat' => 'repeat',
83 'fullscreen' => 0,
84 'pageEffect' => 'none',
85 'deepSearch' => true,
86 'modifyDisplayRule' => false,
87 // For the logo screen.
88 'lp_ls' => array( 'logo' => array( 'image' => plugins_url( 'loading-screens/logo/images/05.svg', __FILE__ ) ) ),
89 );
90
91 update_option( 'loading_page_options', $loading_page_options );
92 }
93
94 /**
95 * Install
96 *
97 * @param boolean $networkwide indicates if it is a multisite WordPress installation.
98 */
99 function loading_page_install( $networkwide ) {
100 global $wpdb;
101
102 if ( function_exists( 'is_multisite' ) && is_multisite() ) {
103 if ( $networkwide ) {
104 $old_blog = $wpdb->blogid;
105 // Get all blog ids.
106 $blogids = get_sites( array( 'fields' => 'ids' ) );
107 foreach ( $blogids as $blog_id ) {
108 switch_to_blog( $blog_id );
109 _loading_page_options();
110 }
111 switch_to_blog( $old_blog );
112 return;
113 }
114 }
115 _loading_page_options();
116 } // End loading_page_install.
117 } // End plugin activation.
118
119 /**
120 * Patch to solve the conflict with the previous version that was using animated gifs.
121 */
122 function loading_page_gifs_replacement_patch() {
123 $opt = get_option( 'loading_page_options', array() );
124 if (
125 ! empty( $opt ) &&
126 ! empty( $opt['lp_ls'] ) &&
127 ! empty( $opt['lp_ls']['logo'] ) &&
128 ! empty( $opt['lp_ls']['logo']['image'] )
129 ) {
130 $path = $opt['lp_ls']['logo']['image'];
131 // Only to solve an issue with the previous version of the plugin when where used .gif.
132 $path = preg_replace( '/\/loading\-screens\/logo\/gifs\/(\d+)\.gif/i', '/loading-screens/logo/images/$1.svg', $path );
133 $opt['lp_ls']['logo']['image'] = $path;
134 update_option( 'loading_page_options', $opt );
135 }
136 }
137
138 /**
139 * Replaces the animated gifts
140 *
141 * @param object $upgrader_object unused parameter.
142 * @param array $options plugins identifiers.
143 */
144 function loading_page_upgrade_completed_gifs_patch( $upgrader_object, $options ) {
145 $our_plugin = plugin_basename( __FILE__ );
146 if ( 'update' === $options['action'] && 'plugin' === $options['type'] && isset( $options['plugins'] ) ) {
147 foreach ( $options['plugins'] as $plugin ) {
148 if ( $plugin === $our_plugin ) {
149 loading_page_gifs_replacement_patch();
150 }
151 }
152 }
153 }
154 add_action( 'upgrader_process_complete', 'loading_page_upgrade_completed_gifs_patch', 10, 2 );
155 /**
156 * Calls the gifs replacement patch
157 *
158 * @param string $plugin plugin name.
159 * @param boolean $network_activation plugins activate into a WordPress multisite installation.
160 */
161 function loading_page_activated_gifs_patch( $plugin, $network_activation ) {
162 if ( plugin_basename( __FILE__ ) === $plugin ) {
163 loading_page_gifs_replacement_patch();
164 }
165 }
166 add_action( 'activated_plugin', 'loading_page_activated_gifs_patch', 10, 2 );
167
168 /**
169 * A new blog has been created in a multisite WordPress
170 */
171 add_action( 'wpmu_new_blog', 'loading_page_new_blog', 10, 6 );
172 /**
173 * New blog creation
174 *
175 * @param integer $blog_id blog id.
176 * @param integer $user_id user id.
177 * @param string $domain blog domain.
178 * @param string $path blog path.
179 * @param integer $site_id site id.
180 * @param array $meta metadata.
181 */
182 function loading_page_new_blog( $blog_id, $user_id, $domain, $path, $site_id, $meta ) {
183 global $wpdb;
184 $file = basename( __FILE__ );
185 $dir = basename( dirname( __FILE__ ) );
186 if ( is_plugin_active_for_network( $dir . '/' . $file ) ) {
187 $current_blog = $wpdb->blogid;
188 switch_to_blog( $blog_id );
189 _loading_page_options();
190 switch_to_blog( $current_blog );
191 }
192 } // End loading_page_new_blog.
193
194 // Redirecting the user to the settings page of the plugin.
195 add_action( 'activated_plugin', 'loading_page_redirect_to_settings', 10, 2 );
196 if ( ! function_exists( 'loading_page_redirect_to_settings' ) ) {
197 /**
198 * Redirects the user to the settings page
199 *
200 * @param string $plugin plugin name.
201 * @param boolean $network_activation multisite activation.
202 */
203 function loading_page_redirect_to_settings( $plugin, $network_activation ) {
204 if (
205 plugin_basename( __FILE__ ) === $plugin &&
206 ( ! isset( $_POST['action'] ) || 'activate-selected' !== $_POST['action'] ) &&
207 ( ! isset( $_POST['action2'] ) || 'activate-selected' !== $_POST['action2'] )
208 ) {
209 wp_safe_redirect( admin_url( 'options-general.php?page=loading-page.php' ) );
210 exit;
211 }
212 }
213 }
214
215 /*
216 * Plugin initializing
217 */
218 add_action( 'init', 'loading_page_init' );
219 if ( ! function_exists( 'loading_page_init' ) ) {
220 /**
221 * Enqueuen script if loading page is enabled
222 */
223 function loading_page_init() {
224 if ( ! is_admin() && empty( $_REQUEST['elementor-preview'] ) ) {
225 $op = get_option( 'loading_page_options' );
226 if ( $op && $op['enabled_loading_screen'] ) {
227 add_action( 'wp_enqueue_scripts', 'loading_page_enqueue_scripts', 1 );
228 }
229 }
230 } // End loading_page_init.
231 }
232
233 /*
234 * Admin initionalizing
235 */
236 add_action( 'admin_init', 'loading_page_admin_init' );
237 if ( ! function_exists( 'loading_page_admin_init' ) ) {
238 /**
239 * Initialize the plugin admin
240 */
241 function loading_page_admin_init() {
242 // Load the associated text domain.
243 load_plugin_textdomain( 'loading-page', false, LOADING_PAGE_PLUGIN_DIR . '/languages/' );
244
245 // Set plugin links.
246 $plugin = plugin_basename( __FILE__ );
247 add_filter( 'plugin_action_links_' . $plugin, 'loading_page_links' );
248
249 // Load resources.
250 add_action( 'admin_enqueue_scripts', 'loading_page_admin_resources' );
251 } // End loading_page_admin_init.
252 }
253
254 if ( ! function_exists( 'loading_page_links' ) ) {
255 /**
256 * Set plugins section links
257 *
258 * @param array $links links array.
259 */
260 function loading_page_links( $links ) {
261 // Custom link.
262 $custom_link = '<a href="http://wordpress.dwbooster.com/contact-us" target="_blank">' . __( 'Request custom changes', 'loading-page' ) . '</a>';
263 array_unshift( $links, $custom_link );
264
265 // Settings link.
266 $settings_link = '<a href="options-general.php?page=loading-page.php">' . __( 'Settings', 'loading-page' ) . '</a>';
267 array_unshift( $links, $settings_link );
268
269 return $links;
270 } // End loading_page_links.
271 }
272
273 add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), 'loading_page_customization_link' );
274 if ( ! function_exists( 'loading_page_customization_link' ) ) {
275 /**
276 * Redirects the user to the WordPress forum
277 *
278 * @param array $links links array.
279 */
280 function loading_page_customization_link( $links ) {
281 array_unshift( $links, '<a href="https://wordpress.org/support/plugin/loading-page/#new-post" target="_blank">' . __( 'Help', 'loading-page' ) . '</a>' );
282 return $links;
283 }
284 }
285
286 // Set the settings menu option.
287 add_action( 'admin_menu', 'loading_page_settings_menu' );
288 if ( ! function_exists( 'loading_page_settings_menu' ) ) {
289 /**
290 * WordPress menu option
291 */
292 function loading_page_settings_menu() {
293 /**
294 * Add to admin_menu
295 * - The capability has been modified, from "edit_posts" to "manage_options"
296 * - Now only the administrators can now edit the "Loading Page" settings.
297 */
298 add_options_page( 'Loading Page', 'Loading Page', 'manage_options', 'loading-page.php', 'loading_page_settings_page' );
299 } // End loading_page_settings_menu.
300 }
301
302 if ( ! function_exists( 'loading_page_add_code_block' ) ) {
303 /**
304 * Embed the code block on page
305 */
306 function loading_page_add_code_block() {
307 $codeblock = '';
308 $op = get_option( 'loading_page_options' );
309 if ( ! empty( $op ) && ! empty( $op['codeBlock'] ) ) {
310 $codeblock = '<div id="loading_page_codeBlock">' . $op['codeBlock'] . '</div>';
311 }
312 return $codeblock;
313 }
314 }
315
316 if ( ! function_exists( 'loading_page_admin_resources' ) ) {
317 /**
318 * Enqueue admin resources
319 *
320 * @param string $hook hook name.
321 */
322 function loading_page_admin_resources( $hook ) {
323 if ( strpos( $hook, 'loading-page' ) !== false ) {
324 wp_enqueue_media();
325 wp_enqueue_style( 'farbtastic' );
326 wp_enqueue_script( 'farbtastic' );
327 wp_enqueue_style( 'thickbox' );
328 wp_enqueue_script( 'thickbox' );
329
330 wp_enqueue_script( 'lp-admin-script', LOADING_PAGE_PLUGIN_URL . '/js/loading-page-admin.js', array( 'jquery', 'thickbox', 'farbtastic' ), 'free-1.0.85', true );
331 }
332 } // End loading_page_admin_resources.
333 }
334
335 if ( ! function_exists( 'loading_page_loading_screen' ) ) {
336 /**
337 * Deciding to include the loading screen
338 */
339 function loading_page_loading_screen() {
340 if ( ! defined( 'DOING_AJAX' ) && '' === session_id() ) {
341 @session_start();
342 }
343 global $post;
344 $op = get_option( 'loading_page_options' );
345 $loading_screen = 0;
346 if (
347 ! isset( $_SERVER['HTTP_USER_AGENT'] ) ||
348 preg_match( '/bot|crawl|slurp|spider/i', sanitize_text_field( wp_unslash( $_SERVER['HTTP_USER_AGENT'] ) ) )
349 ) {
350 return $loading_screen;
351 }
352
353 if (
354 ! empty( $op['enabled_loading_screen'] )
355 ) {
356 global $wp;
357 $current_url = home_url( add_query_arg( array(), $wp->request ) );
358 $_permalink = md5( $current_url );
359 if (
360 empty( $op['once_per_session'] ) ||
361 'always' === $op['once_per_session'] ||
362 empty( $_SESSION['loading_page_once_per_session'] ) ||
363 ( 'page' === $op['once_per_session'] &&
364 is_array( $_SESSION['loading_page_once_per_session'] ) &&
365 empty( $_SESSION['loading_page_once_per_session'][ $_permalink ] )
366 )
367 ) {
368 if ( empty( $_SESSION['loading_page_once_per_session'] ) || ! is_array( $_SESSION['loading_page_once_per_session'] ) ) {
369 $_SESSION['loading_page_once_per_session'] = array();
370 }
371 $_SESSION['loading_page_once_per_session'][ $_permalink ] = 1;
372
373 $pages = ( ! empty( $op['lp_loading_screen_display_in_pages'] ) ) ? $op['lp_loading_screen_display_in_pages'] : '';
374 $pages = str_replace( ' ', '', $pages );
375 $pages = explode( ',', $pages );
376
377 $post_types = ( ! empty( $op['lp_loading_screen_display_post_types'] ) ) ? $op['lp_loading_screen_display_post_types'] : '';
378 $post_types = str_replace( ' ', '', $post_types );
379 $post_types = explode( ',', $post_types );
380
381 $exclude_pages = ( ! empty( $op['lp_loading_screen_exclude_from_pages'] ) ) ? $op['lp_loading_screen_exclude_from_pages'] : '';
382 $exclude_pages = str_replace( ' ', '', $exclude_pages );
383 $exclude_pages = explode( ',', $exclude_pages );
384
385 $exclude_post_types = ( ! empty( $op['lp_loading_screen_exclude_from_post_types'] ) ) ? $op['lp_loading_screen_exclude_from_post_types'] : '';
386 $exclude_post_types = str_replace( ' ', '', $exclude_post_types );
387 $exclude_post_types = explode( ',', $exclude_post_types );
388
389 $exclude_pages_urls = ( ! empty( $op['lp_loading_screen_exclude_from_urls'] ) ) ? $op['lp_loading_screen_exclude_from_urls'] : array();
390
391 $exclude_elementor_maintenance = ( defined( 'ELEMENTOR_VERSION' ) &&
392 ! empty( $op['lp_loading_screen_exclude_from_elementor_maintenance'] ) &&
393 '' !== get_option( 'elementor_maintenance_mode_mode', '' )
394 ) ? true : false;
395
396 if (
397 ! $exclude_elementor_maintenance &&
398 ( empty( $op['lp_loading_screen_display_in'] ) ||
399 'all' === $op['lp_loading_screen_display_in'] ||
400 ( 'home' === $op['lp_loading_screen_display_in'] && ( is_home() || is_front_page() ) ) ||
401 ( 'pages' === $op['lp_loading_screen_display_in'] && is_singular() && isset( $post ) && in_array( $post->ID, $pages ) ) ||
402 ( 'post_type' === $op['lp_loading_screen_display_in'] && is_singular() && isset( $post ) && in_array( $post->post_type, $post_types, true ) )
403 ) &&
404 ( empty( $post ) ||
405 empty( $post->ID ) ||
406 (
407 ( empty( $exclude_pages ) ||
408 ! in_array( $post->ID, $exclude_pages )
409 )
410 &&
411 ( empty( $exclude_post_types ) ||
412 ! in_array( $post->post_type, $exclude_post_types, true )
413 )
414 )
415 )
416 ) {
417 if ( ! empty( $exclude_pages_urls ) ) {
418 $protocol = ( ( ! empty( $_SERVER['HTTPS'] ) && 'off' !== $_SERVER['HTTPS'] ) || ( isset( $_SERVER['SERVER_PORT'] ) && 443 === $_SERVER['SERVER_PORT'] ) ) ? 'https://' : 'http://';
419 $current_url = esc_url_raw( $protocol . ( isset( $_SERVER['HTTP_HOST'] ) ? wp_unslash( $_SERVER['HTTP_HOST'] ) : '' ) . ( isset( $_SERVER['REQUEST_URI'] ) ? wp_unslash( $_SERVER['REQUEST_URI'] ) : '' ) );
420 foreach ( $exclude_pages_urls as $exclude_page_url ) {
421 $exclude_page_url = preg_quote( $exclude_page_url, '/' );
422 $exclude_page_url = str_replace( '\*', '.*', $exclude_page_url );
423 if ( preg_match( '/' . $exclude_page_url . '/i', $current_url ) ) {
424 return;
425 }
426 }
427 }
428
429 $loading_screen = 1;
430 add_action( 'wp_head', 'loading_page_replace_the_header', 99 );
431 add_filter( 'autoptimize_filter_js_dontmove', 'loading_page_autoptimize_exclude', 10, 1 );
432 }
433 }
434 }
435 return $loading_screen;
436 }
437 }
438
439 if ( ! function_exists( 'loading_page_autoptimize_exclude' ) ) {
440 /**
441 * Excluding the plugin resources from Autoptimize
442 *
443 * @param array $to_exclude to exclude URLs.
444 */
445 function loading_page_autoptimize_exclude( $to_exclude ) {
446 $to_exclude[] = 'loading-page.min.js';
447 $to_exclude[] = '/loading-screens/';
448 return $to_exclude;
449 }
450 }
451
452 if ( ! function_exists( 'loading_page_replace_the_header' ) ) {
453 /**
454 * Including styles in the page header section
455 */
456 function loading_page_replace_the_header() {
457 $opt = get_option( 'loading_page_options', array() );
458 if ( empty( $opt ) || empty( $opt['modifyDisplayRule'] ) ) {
459 echo '<style>body{visibility:hidden;}</style><noscript><style>body{visibility:visible;}</style></noscript>';
460 } else {
461 echo '<style>body{display:none;}</style><noscript><style>body{display:block;}</style></noscript>';
462 }
463
464 if (
465 ! empty( $opt ) &&
466 ! empty( $opt['lp_ls'] ) &&
467 ! empty( $opt['lp_ls']['logo'] ) &&
468 ! empty( $opt['lp_ls']['logo']['image'] )
469 ) {
470 $path = $opt['lp_ls']['logo']['image'];
471 echo '<link rel="preload" href="' . esc_attr( $path ) . '" as="image" type="image/svg+xml">';
472 }
473 } // End loading_page_replace_the_header.
474 }
475
476 if ( ! function_exists( 'loading_page_hex2rgb' ) ) {
477 /**
478 * Transform colors code
479 *
480 * @param array/string $colour color code.
481 */
482 function loading_page_hex2rgb( $colour ) {
483 if ( '#' === $colour[0] ) {
484 $colour = substr( $colour, 1 );
485 }
486 if ( 6 === strlen( $colour ) ) {
487 list($r, $g, $b) = array( $colour[0] . $colour[1], $colour[2] . $colour[3], $colour[4] . $colour[5] );
488 } elseif ( 3 === strlen( $colour ) ) {
489 list($r, $g, $b) = array( $colour[0] . $colour[0], $colour[1] . $colour[1], $colour[2] . $colour[2] );
490 } else {
491 return $colour;
492 }
493 $r = hexdec( $r );
494 $g = hexdec( $g );
495 $b = hexdec( $b );
496 return 'rgba(' . $r . ',' . $g . ',' . $b . ',.8)';
497 }
498 }
499
500 if ( ! function_exists( 'loading_page_enqueue_scripts' ) ) {
501 /**
502 * Enqueue public scripts
503 */
504 function loading_page_enqueue_scripts() {
505 global $post;
506
507 $op = get_option( 'loading_page_options' );
508 $loading_screen = loading_page_loading_screen();
509 if ( $loading_screen && ! empty( $op['from_trigger'] ) ) {
510 wp_enqueue_script( 'codepeople-loading-page-link-script', LOADING_PAGE_PLUGIN_URL . '/js/links.min.js', array( 'jquery' ), 'free-1.0.85', false );
511 }
512
513 if ( $loading_screen ) {
514 $loading_page_settings = array(
515 'loadingScreen' => $loading_screen,
516 'closeBtn' => ( ! isset( $op['close_btn'] ) || $op['close_btn'] ) ? true : false,
517 'removeInOnLoad' => ( ! empty( $op['remove_in_on_load'] ) ) ? $op['remove_in_on_load'] : false,
518 'codeblock' => loading_page_add_code_block(),
519 'backgroundColor' => ( ! isset( $op['transparency'] ) || $op['transparency'] ) ? loading_page_hex2rgb( $op['backgroundColor'] ) : $op['backgroundColor'],
520 'foregroundColor' => $op['foregroundColor'],
521 'backgroundImage' => $op['backgroundImage'],
522 'additionalSeconds' => ( ! empty( $op['additionalSeconds'] ) ) ? $op['additionalSeconds'] : 0,
523 'pageEffect' => $op['pageEffect'],
524 'backgroundRepeat' => $op['backgroundImageRepeat'],
525 'fullscreen' => ( ( ! empty( $op['fullscreen'] ) ) ? 1 : 0 ),
526 'graphic' => $op['loading_screen'],
527 'text' => ( ( ! empty( $op['displayPercent'] ) ) ? $op['displayPercent'] : 0 ),
528 'lp_ls' => ( ( ! empty( $op['lp_ls'] ) ) ? $op['lp_ls'] : 0 ),
529 'screen_size' => ( ( ! empty( $op['screen_size'] ) ) ? $op['screen_size'] : 'all' ),
530 'screen_width' => ( ( ! empty( $op['screen_width'] ) ) ? $op['screen_width'] : 0 ),
531 'deepSearch' => ( ( empty( $op['deepSearch'] ) ) ? 0 : 1 ),
532 'modifyDisplayRule' => ( ( empty( $op['modifyDisplayRule'] ) ) ? 0 : 1 ),
533 );
534
535 $required = array( 'jquery' );
536 wp_enqueue_script( 'jquery' );
537 wp_enqueue_style( 'codepeople-loading-page-style', LOADING_PAGE_PLUGIN_URL . '/css/loading-page.css', array(), 'free-1.0.85', false );
538 wp_enqueue_style( 'codepeople-loading-page-style-effect', LOADING_PAGE_PLUGIN_URL . '/css/loading-page' . ( ( 'none' !== $op['pageEffect'] ) ? '-' . $op['pageEffect'] : '' ) . '.css', array(), 'free-1.0.85', false );
539
540 $s = loading_page_get_screen( $op['loading_screen'] );
541 if ( $s ) {
542 if ( ! empty( $s['style'] ) ) {
543 wp_enqueue_style( 'codepeople-loading-page-style-' . $s['id'], $s['style'], array(), 'free-1.0.85', false );
544 }
545
546 if ( ! empty( $s['script'] ) ) {
547 wp_enqueue_script( 'codepeople-loading-page-script-' . $s['id'], $s['script'], array( 'jquery' ), 'free-1.0.85', false );
548 $required[] = 'codepeople-loading-page-script-' . $s['id'];
549 }
550 }
551 wp_enqueue_script( 'codepeople-loading-page-script', LOADING_PAGE_PLUGIN_URL . '/js/loading-page.min.js', $required, 'free-1.0.85', false );
552 if ( function_exists( 'wp_add_inline_script' ) ) {
553 wp_add_inline_script( 'codepeople-loading-page-script', 'loading_page_settings=' . wp_json_encode( $loading_page_settings ) . ';', 'before' );
554 } else {
555 wp_localize_script( 'codepeople-loading-page-script', 'loading_page_settings', $loading_page_settings );
556 }
557 }
558 } // End loading_page_enqueue_scripts.
559 }
560
561 if ( ! function_exists( 'loading_page_sanitize_array' ) ) {
562 /**
563 * Sanitize mutilevel array
564 *
565 * @param array/string $array values to sanitize.
566 */
567 function loading_page_sanitize_array( $array ) {
568 if ( is_array( $array ) ) {
569 foreach ( $array as $key => $value ) {
570 if ( is_array( $value ) ) {
571 $array[ $key ] = loading_page_sanitize_array( $value );
572 } else {
573 $array[ $key ] = sanitize_text_field( wp_unslash( $value ) );
574 }
575 }
576 return $array;
577 } else {
578 return sanitize_text_field( wp_unslash( $array ) );
579 }
580 } // End loading_page_sanitize_array.
581 }
582
583 if ( ! function_exists( 'loading_page_settings_page' ) ) {
584 /**
585 * Plugin settings page
586 */
587 function loading_page_settings_page() {
588 if ( isset( $_POST['loading_page_nonce'] ) && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['loading_page_nonce'] ) ), __FILE__ ) ) {
589
590 $allowed_tags = wp_kses_allowed_html( 'post' );
591
592 $additional_seconds = isset( $_POST['lp_additionalSeconds'] ) && is_numeric( $_POST['lp_additionalSeconds'] ) ? intval( $_POST['lp_additionalSeconds'] ) : 0;
593 $code_block = isset( $_POST['lp_codeBlock'] ) ? wp_kses( wp_unslash( $_POST['lp_codeBlock'] ), $allowed_tags ) : '';
594
595 $lp_loading_screen_exclude_from_urls = isset( $_POST['lp_loading_screen_exclude_from_urls'] ) ? sanitize_textarea_field( wp_unslash( $_POST['lp_loading_screen_exclude_from_urls'] ) ) : '';
596 $lp_loading_screen_exclude_from_urls = explode( "\n", $lp_loading_screen_exclude_from_urls );
597 foreach ( $lp_loading_screen_exclude_from_urls as $key => $url ) {
598 $url = trim( $url );
599 if ( '' === $url ) {
600 unset( $lp_loading_screen_exclude_from_urls[ $key ] );
601 } else {
602 $lp_loading_screen_exclude_from_urls[ $key ] = $url;
603 }
604 }
605
606 $lp_screen_width = '';
607 if ( ! empty( $_POST['lp_screen_width'] ) ) {
608 $lp_screen_width = preg_replace( '/[^\\d\\.]/', '', sanitize_text_field( wp_unslash( $_POST['lp_screen_width'] ) ) );
609 }
610
611 // Set the default options here.
612 $loading_page_options = array(
613 'foregroundColor' => ( ! empty( $_POST['lp_foregroundColor'] ) ) ? sanitize_text_field( wp_unslash( $_POST['lp_foregroundColor'] ) ) : '#FFFFFF',
614 'backgroundColor' => ( ! empty( $_POST['lp_backgroundColor'] ) ) ? sanitize_text_field( wp_unslash( $_POST['lp_backgroundColor'] ) ) : '#000000',
615 'transparency' => ( ! empty( $_POST['lp_backgroundTransparency'] ) ) ? true : false,
616 'backgroundImage' => isset( $_POST['lp_backgroundImage'] ) ? esc_url_raw( wp_unslash( $_POST['lp_backgroundImage'] ) ) : '',
617 'backgroundImageRepeat' => ( isset( $_POST['lp_backgroundRepeat'] ) && in_array( $_POST['lp_backgroundRepeat'], array( 'repeat', 'no-repeat' ), true ) ) ? sanitize_text_field( wp_unslash( $_POST['lp_backgroundRepeat'] ) ) : 'repeat',
618 'additionalSeconds' => $additional_seconds,
619 'codeBlock' => wp_unslash( $code_block ),
620 'fullscreen' => ( isset( $_POST['lp_fullscreen'] ) ) ? 1 : 0,
621 'enabled_loading_screen' => ( isset( $_POST['lp_enabled_loading_screen'] ) ) ? true : false,
622 'from_trigger' => ( isset( $_POST['lp_from_trigger'] ) ) ? true : false,
623 'close_btn' => ( isset( $_POST['lp_close_btn'] ) ) ? true : false,
624 'remove_in_on_load' => ( isset( $_POST['lp_remove_in_on_load'] ) ) ? true : false,
625 'screen_size' => ( isset( $_POST['lp_screen_size'] ) && in_array( $_POST['lp_screen_size'], array( 'all', 'greater', 'lesser' ), true ) ) ? sanitize_text_field( wp_unslash( $_POST['lp_screen_size'] ) ) : 'all',
626 'screen_width' => is_numeric( $lp_screen_width ) ? $lp_screen_width : '',
627 'lp_loading_screen_display_in' => ( isset( $_POST['lp_loading_screen_display_in'] ) ) ? sanitize_text_field( wp_unslash( $_POST['lp_loading_screen_display_in'] ) ) : 'all',
628 'once_per_session' => ( ! isset( $_POST['once_per_session'] ) ||
629 ! in_array( $_POST['once_per_session'], array( 'always', 'site', 'page' ), true )
630 ) ? 'always' : sanitize_text_field( wp_unslash( $_POST['once_per_session'] ) ),
631 'lp_loading_screen_display_in_pages' => isset( $_POST['lp_loading_screen_display_in_pages'] ) ? sanitize_text_field( wp_unslash( $_POST['lp_loading_screen_display_in_pages'] ) ) : '',
632 'lp_loading_screen_display_post_types' => isset( $_POST['lp_loading_screen_display_post_types'] ) ? sanitize_text_field( wp_unslash( $_POST['lp_loading_screen_display_post_types'] ) ) : '',
633 'lp_loading_screen_exclude_from_pages' => isset( $_POST['lp_loading_screen_exclude_from_pages'] ) ? sanitize_text_field( wp_unslash( $_POST['lp_loading_screen_exclude_from_pages'] ) ) : '',
634 'lp_loading_screen_exclude_from_post_types' => isset( $_POST['lp_loading_screen_exclude_from_post_types'] ) ? sanitize_text_field( wp_unslash( $_POST['lp_loading_screen_exclude_from_post_types'] ) ) : '',
635 'lp_loading_screen_exclude_from_urls' => $lp_loading_screen_exclude_from_urls,
636 'lp_loading_screen_exclude_from_elementor_maintenance' => ( isset( $_POST['lp_loading_screen_exclude_from_elementor_maintenance'] ) ) ? true : false,
637 'deepSearch' => ( isset( $_POST['lp_deactivateDeepSearch'] ) ) ? false : true,
638 'modifyDisplayRule' => ( isset( $_POST['lp_modifyDisplayRule'] ) ) ? true : false,
639 'loading_screen' => isset( $_POST['lp_loading_screen'] ) ? sanitize_text_field( wp_unslash( $_POST['lp_loading_screen'] ) ) : '',
640 'displayPercent' => ( isset( $_POST['lp_displayPercent'] ) ) ? true : false,
641 'pageEffect' => isset( $_POST['lp_pageEffect'] ) ? sanitize_text_field( wp_unslash( $_POST['lp_pageEffect'] ) ) : '',
642 );
643
644 if ( isset( $_POST['lp_ls'] ) ) {
645 $loading_page_options['lp_ls'] = loading_page_sanitize_array( $_POST['lp_ls'] );
646 }
647
648 update_option( 'loading_page_video_tutorial', ( ! empty( $_POST['loading_page_video_tutorial'] ) && 'collapsed' === $_POST['loading_page_video_tutorial'] ) ? 'collapsed' : 'expanded' );
649
650 if ( update_option( 'loading_page_options', $loading_page_options ) ) {
651 print '<div class="updated">' . esc_html( __( 'The Loading Page has been stored successfully', 'loading-page' ) ) . '</div>';
652 } else {
653 print '<div class="error">' . esc_html( __( 'The Loading Page settings could not be stored', 'loading-page' ) ) . '</div>';
654 }
655 }
656
657 $loading_page_options = get_option( 'loading_page_options' );
658
659 $loading_page_video_tutorial = get_option( 'loading_page_video_tutorial', 'expanded' );
660 $loading_page_video_tutorial_open_close = ( 'expanded' === $loading_page_video_tutorial ) ? 'X' : '+';
661 $loading_page_video_tutorial_status = ( 'collapsed' === $loading_page_video_tutorial ) ? 'lp-video-collapsed' : '';
662
663 ?>
664 <style>
665 .lp-video-container {
666 overflow: hidden;
667 position: relative;
668 width: 100%;
669 }
670
671 .lp-video-container::after {
672 padding-top: 56.25%;
673 display: block;
674 content: '';
675 }
676
677 .lp-video-container iframe {
678 position: absolute;
679 top: 0;
680 left: 0;
681 width: 100%;
682 height: 100%;
683 }
684
685 .lp-video-collapsed {
686 display: none;
687 }
688 </style>
689 <div class="wrap">
690 <form method="post">
691 <input type="hidden" name="loading_page_nonce" value="<?php print( esc_attr( wp_create_nonce( __FILE__ ) ) ); ?>" />
692 <h2><?php esc_html_e( 'Loading Page Settings', 'loading-page' ); ?></h2>
693 <div class="postbox">
694 <h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Video Tutorial', 'loading-page' ); ?></span><a href="javascript:void(0);" onclick="loading_page_collapse_expand_video_tutorial(this);" style="float:right;font-size:1.3em;text-decoration:none;"><?php print esc_html( $loading_page_video_tutorial_open_close ); ?></a></h3>
695 <div class="inside lp-video-tutorial <?php echo esc_attr( $loading_page_video_tutorial_status ); ?>" style="position:relative;">
696 <input type="hidden" name="loading_page_video_tutorial" value="<?php echo esc_attr( $loading_page_video_tutorial ); ?>" />
697 <div class="lp-video-container">
698 <iframe title="<?php print esc_attr( __( 'Video tutorial', 'loading-page' ) ); ?>" src="https://www.youtube.com/embed/5x_LtjoCFUY" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
699 </div>
700 </div>
701 </div>
702 <div class="postbox">
703 <h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Loading Screen', 'loading-page' ); ?></span></h3>
704 <div class="inside">
705 <p style="border:1px solid #E6DB55;margin-bottom:10px;padding:5px;background-color: #FFFFE0;">If you want test the premium version of Loading Page go to the following links:<br /> <a href="https://demos.dwbooster.com/loading-page/wp-login.php" target="_blank">Administration area: Click to access the administration area demo</a><br />
706 <a href="https://demos.dwbooster.com/loading-page/" target="_blank">Public page: Click to access the Loading Page</a><br />
707 <a href="https://wordpress.org/support/plugin/loading-page/#new-post" target="_blank">If you need additional help</a>
708 </p>
709 <p>
710 <?php
711 esc_html_e(
712 'Displays a loading screen until the webpage is ready, the screen shows the loading percent.',
713 'loading-page'
714 );
715 ?>
716 </p>
717 <table class="form-table">
718 <tr>
719 <th><?php esc_html_e( 'Enable loading screen', 'loading-page' ); ?></th>
720 <td><input aria-label="<?php print esc_attr( __( 'Enable loading screen', 'loading-page' ) ); ?>" type="checkbox" name="lp_enabled_loading_screen" <?php echo ( ( ! empty( $loading_page_options['enabled_loading_screen'] ) ) ? 'CHECKED' : '' ); ?> /></td>
721 </tr>
722 <tr>
723 <th style="border-top:2px dashed green;border-left:2px dashed green;border-bottom:2px dashed green;padding-left:10px;"><?php esc_html_e( 'Show loading screen when clicking on link', 'loading-page' ); ?></th>
724 <td style="border-top:2px dashed green;border-right:2px dashed green;border-bottom:2px dashed green;padding-left:10px;"><input aria-label="<?php print esc_attr( __( 'Show loading screen when clicking on link', 'loading-page' ) ); ?>" type="checkbox" name="lp_from_trigger" <?php print ! empty( $loading_page_options['from_trigger'] ) ? 'CHECKED' : ''; ?> /> <i style="color:green;"><?php esc_html_e( 'Display the loading screen as soon as the link on the current page is clicked, and not only when the next page is loaded.', 'loading-page' ); ?></i></td>
725 </tr>
726 <tr>
727 <th><?php esc_html_e( 'Display a close screen button', 'loading-page' ); ?></th>
728 <td><input aria-label="<?php print esc_attr( __( 'Display a close screen button', 'loading-page' ) ); ?>" type="checkbox" name="lp_close_btn" <?php echo ( ( ! isset( $loading_page_options['close_btn'] ) || $loading_page_options['close_btn'] ) ? 'CHECKED' : '' ); ?> /></td>
729 </tr>
730 <tr>
731 <th><?php esc_html_e( 'Hide the loading screen in the window onload event', 'loading-page' ); ?></th>
732 <td><input aria-label="<?php print esc_attr( __( 'Hide the loading screen in the onload event', 'loading-page' ) ); ?>" type="checkbox" name="lp_remove_in_on_load" <?php echo ( ( ! empty( $loading_page_options['remove_in_on_load'] ) ) ? 'CHECKED' : '' ); ?> /> <i><?php esc_html_e( 'Hides the loading screen in the onload event of window - or - as soon as possible', 'loading-page' ); ?></i></td>
733 </tr>
734 <tr>
735 <th><?php esc_html_e( 'Display the loading screen on', 'loading-page' ); ?></th>
736 <td>
737 <select aria-label="<?php print esc_attr( __( 'Screen size', 'loading-page' ) ); ?>" name="lp_screen_size" style="float:left;">
738 <option value="all"
739 <?php
740 if (
741 isset( $loading_page_options['screen_size'] ) &&
742 'all' === $loading_page_options['screen_size']
743 ) {
744 print 'SELECTED';
745 }
746 ?>
747 ><?php esc_html_e( 'All Screens', 'loading-page' ); ?></option>
748 <option value="greater"
749 <?php
750 if (
751 isset( $loading_page_options['screen_size'] ) &&
752 'greater' === $loading_page_options['screen_size']
753 ) {
754 print 'SELECTED';
755 }
756 ?>
757 ><?php esc_html_e( 'Greater Than', 'loading-page' ); ?></option>
758 <option value="lesser"
759 <?php
760 if (
761 isset( $loading_page_options['screen_size'] ) &&
762 'lesser' === $loading_page_options['screen_size']
763 ) {
764 print 'SELECTED';
765 }
766 ?>
767 ><?php esc_html_e( 'Lesser Than', 'loading-page' ); ?></option>
768 </select>
769 <div id="lp_width_container" style="float:left; padding-left:10px;
770 <?php
771 if ( ! isset( $loading_page_options['screen_size'] ) || 'all' === $loading_page_options['screen_size'] ) {
772 echo 'display:none;';
773 } else {
774 echo 'display:block;';
775 }
776 ?>
777 ">
778 <?php esc_html_e( 'Width', 'loading-page' ); ?>:
779 <input aria-label="<?php print esc_attr( __( 'Screen width', 'loading-page' ) ); ?>" type="text" name="lp_screen_width" value="
780 <?php
781 if ( isset( $loading_page_options['screen_width'] ) ) {
782 echo esc_attr( $loading_page_options['screen_width'] );
783 }
784 ?>
785 " /> px
786 </div>
787 <script>
788 jQuery('[name="lp_screen_size"]').change(function() {
789 jQuery('#lp_width_container')[(this.value == 'all') ? 'hide' : 'show']();
790 })
791 </script>
792 </td>
793 </tr>
794 <tr>
795 <th><?php esc_html_e( 'Display the loading screen', 'loading-page' ); ?></th>
796 <td>
797 <?php
798 if (
799 ! isset( $loading_page_options['once_per_session'] ) ||
800 false === $loading_page_options['once_per_session']
801 ) {
802 $loading_page_options['once_per_session'] = 'always';
803 } elseif ( true === $loading_page_options['once_per_session'] ) {
804 $loading_page_options['once_per_session'] = 'site';
805 }
806 ?>
807 <input aria-label="<?php print esc_attr( __( 'Always', 'loading-page' ) ); ?>" type="radio" value="always" name="once_per_session" <?php echo ( ( 'always' === $loading_page_options['once_per_session'] ) ? 'CHECKED' : '' ); ?> /> <span><?php esc_html_e( 'always', 'loading-page' ); ?></span><br />
808 <input aria-label="<?php print esc_attr( __( 'Once per session', 'loading-page' ) ); ?>" type="radio" value="site" name="once_per_session" <?php echo ( ( 'site' === $loading_page_options['once_per_session'] ) ? 'CHECKED' : '' ); ?> /> <span><?php esc_html_e( 'once per session', 'loading-page' ); ?></span><br />
809 <input aria-label="<?php print esc_attr( __( 'Once per page', 'loading-page' ) ); ?>" type="radio" value="page" name="once_per_session" <?php echo ( ( 'page' === $loading_page_options['once_per_session'] ) ? 'CHECKED' : '' ); ?> /> <span><?php esc_html_e( 'once per page', 'loading-page' ); ?></span>
810
811 </td>
812 </tr>
813 <tr>
814 <th><?php esc_html_e( 'Display loading screen in', 'loading-page' ); ?></th>
815 <td>
816 <div><input aria-label="<?php print esc_attr( __( 'Homepage', 'loading-page' ) ); ?>" type="radio" name="lp_loading_screen_display_in" value="home" <?php echo ( ( isset( $loading_page_options['lp_loading_screen_display_in'] ) && 'home' === $loading_page_options['lp_loading_screen_display_in'] ) ? 'CHECKED' : '' ); ?> /> <?php esc_html_e( 'homepage only', 'loading-page' ); ?></div>
817
818 <div><input aria-label="<?php print esc_attr( __( 'All pages', 'loading-page' ) ); ?>" type="radio" name="lp_loading_screen_display_in" value="all" <?php echo ( ( isset( $loading_page_options['lp_loading_screen_display_in'] ) && 'all' === $loading_page_options['lp_loading_screen_display_in'] ) ? 'CHECKED' : '' ); ?> /> <?php esc_html_e( 'all pages', 'loading-page' ); ?></div>
819
820 <div><input aria-label="<?php print esc_attr( __( 'Specific pages', 'loading-page' ) ); ?>" type="radio" name="lp_loading_screen_display_in" value="pages" <?php echo ( ( isset( $loading_page_options['lp_loading_screen_display_in'] ) && 'pages' === $loading_page_options['lp_loading_screen_display_in'] ) ? 'CHECKED' : '' ); ?> /> <?php esc_html_e( 'specific pages', 'loading-page' ); ?>
821 <input aria-label="<?php print esc_attr( __( 'Pages/posts ids', 'loading-page' ) ); ?>" type="text" name="lp_loading_screen_display_in_pages" value="
822 <?php
823 if ( ! empty( $loading_page_options['lp_loading_screen_display_in_pages'] ) ) {
824 print esc_attr( $loading_page_options['lp_loading_screen_display_in_pages'] );}
825 ?>
826 " style="width:100%;margin:10px; 0 10px 20px;">
827 <i><?php esc_html_e( 'Type one, or more post/pages IDs, separated by commas ","', 'loading-page' ); ?></i>
828 </div>
829
830 <div><input aria-label="<?php print esc_attr( __( 'specific post types', 'loading-page' ) ); ?>" type="radio" name="lp_loading_screen_display_in" value="post_type" <?php echo ( ( isset( $loading_page_options['lp_loading_screen_display_in'] ) && 'post_type' === $loading_page_options['lp_loading_screen_display_in'] ) ? 'CHECKED' : '' ); ?> /> <?php esc_html_e( 'specific post types', 'loading-page' ); ?>
831 <input aria-label="<?php print esc_attr( __( 'Post types', 'loading-page' ) ); ?>" type="text" name="lp_loading_screen_display_post_types" value="
832 <?php
833 if ( ! empty( $loading_page_options['lp_loading_screen_display_post_types'] ) ) {
834 print esc_attr( $loading_page_options['lp_loading_screen_display_post_types'] );}
835 ?>
836 " style="width:100%;margin:10px; 0 10px 20px;">
837 <i><?php esc_html_e( 'Type one or more post types, separated by commas ","', 'loading-page' ); ?></i>
838 </div>
839 </td>
840 </tr>
841 <tr>
842 <td colspan="2">
843 <hr />
844 </td>
845 </tr>
846 <tr>
847 <th><?php esc_html_e( 'Exclude loading screen from', 'loading-page' ); ?></th>
848 <td><input aria-label="<?php print esc_attr( __( 'Pages/posts ids separated by comma', 'loading-page' ) ); ?>" type="text" name="lp_loading_screen_exclude_from_pages" value="
849 <?php
850 if ( ! empty( $loading_page_options['lp_loading_screen_exclude_from_pages'] ) ) {
851 print esc_attr( $loading_page_options['lp_loading_screen_exclude_from_pages'] );}
852 ?>
853 "> <i><?php esc_html_e( 'Type one, or more post/pages IDs, separated by commas ","', 'loading-page' ); ?></i></td>
854 </tr>
855 <tr>
856 <th><?php esc_html_e( 'Exclude loading screen from post types', 'loading-page' ); ?></th>
857 <td><input aria-label="<?php print esc_attr( __( 'Post types separated by comma', 'loading-page' ) ); ?>" type="text" name="lp_loading_screen_exclude_from_post_types" value="
858 <?php
859 if ( ! empty( $loading_page_options['lp_loading_screen_exclude_from_post_types'] ) ) {
860 print esc_attr( $loading_page_options['lp_loading_screen_exclude_from_post_types'] );}
861 ?>
862 "> <i><?php esc_html_e( 'Type one, or more post/pages types, separated by commas ","', 'loading-page' ); ?></i></td>
863 </tr>
864 <tr>
865 <th><?php esc_html_e( 'Exclude loading screen from pages with the URL', 'loading-page' ); ?></th>
866 <td><textarea aria-label="<?php print esc_attr( __( 'URLs of the pages to exclude', 'loading-page' ) ); ?>" name="lp_loading_screen_exclude_from_urls" style="width:100%" rows="6">
867 <?php
868 print esc_textarea(
869 ( ! empty( $loading_page_options['lp_loading_screen_exclude_from_urls'] ) )
870 ? implode( "\n", $loading_page_options['lp_loading_screen_exclude_from_urls'] ) : ''
871 );
872 ?>
873 </textarea>
874 <i>Enter an URL per row (use the * symbol as wildcard)</i>
875 </td>
876 </tr>
877 <tr>
878 <th colspan="2">
879 <?php esc_html_e( 'Exclude the loading screen if Elementor Maintenance or Coming Soon modes are enabled', 'loading-page' ); ?>
880 <input aria-label="<?php print esc_attr( __( 'Disable the loading screen from Coming Soon or Maintenance modes', 'loading-page' ) ); ?>" type="checkbox" name="lp_loading_screen_exclude_from_elementor_maintenance" <?php echo ( ( ! empty( $loading_page_options['lp_loading_screen_exclude_from_elementor_maintenance'] ) ) ? 'CHECKED' : '' ); ?> />
881 </th>
882 </tr>
883 <tr>
884 <td colspan="2">
885 <hr />
886 </td>
887 </tr>
888 <tr>
889 <?php $loading_screens = loading_page_get_screen_list(); ?>
890 <th><?php esc_html_e( 'Select the loading screen', 'loading-page' ); ?></th>
891 <td>
892 <select aria-label="<?php print esc_attr( __( 'Loading screen', 'loading-page' ) ); ?>" name="lp_loading_screen">
893 <?php
894 foreach ( $loading_screens as $screen ) {
895 print '<option value="' . esc_attr( $screen['id'] ) . '" ' . ( ( isset( $loading_page_options['loading_screen'] ) && $loading_page_options['loading_screen'] === $screen['id'] ) ? 'SELECTED' : '' ) . ' title="' . ( ( ! empty( $screen['tips'] ) ) ? esc_attr( $screen['tips'] ) : '' ) . '" >' . esc_html( $screen['name'] ) . '</option>';
896 }
897 ?>
898 </select>
899 <span style="color:#FF0000;">
900 The free version of the plugin includes the "Bar Screen" and "Logo Screen", however, if they are not sufficient to your website, the commercial version of the plugin includes other loading screens: <a href="http://wordpress.dwbooster.com/content-tools/loading-page" target="_blank">CLICK HERE</a>
901 </span>
902 </td>
903 </tr>
904 <?php
905 foreach ( $loading_screens as $screen ) {
906 if ( ! empty( $screen['adminsection'] ) ) {
907 include_once $screen['adminsection'];
908 }
909 if ( ! empty( $screen['adminscript'] ) ) {
910 wp_enqueue_script( $screen['adminscript'], $screen['adminscript'], array(), 'free-1.0.85', true );
911 }
912 }
913 ?>
914 <tr>
915 <th><?php esc_html_e( 'Select background color', 'loading-page' ); ?></th>
916 <td>
917 <input aria-label="<?php print esc_attr( __( 'Background color', 'loading-page' ) ); ?>" type="text" name="lp_backgroundColor" id="lp_backgroundColor" value="
918 <?php
919 if ( isset( $loading_page_options['backgroundColor'] ) ) {
920 print( esc_attr( $loading_page_options['backgroundColor'] ) );}
921 ?>
922 " />
923 <input aria-label="<?php print esc_attr( __( 'Apply transparency', 'loading-page' ) ); ?>" type="checkbox" name="lp_backgroundTransparency" <?php print ( ! isset( $loading_page_options['transparency'] ) || $loading_page_options['transparency'] ) ? 'CHECKED' : ''; ?> /><?php esc_html_e( 'Apply transparency', 'loading-page' ); ?>
924 <div id="lp_backgroundColor_picker"></div>
925 </td>
926 </tr>
927 <tr>
928 <th><?php esc_html_e( 'Select image as background', 'loading-page' ); ?></th>
929 <td>
930 <input aria-label="<?php print esc_attr( __( 'Background image', 'loading-page' ) ); ?>" type="text" name="lp_backgroundImage" id="lp_backgroundImage" value="
931 <?php
932 if ( isset( $loading_page_options['backgroundImage'] ) ) {
933 print( esc_attr( $loading_page_options['backgroundImage'] ) );}
934 ?>
935 " />
936 <input type="button" value="Browse" onclick="loading_page_selected_image('lp_backgroundImage');" />
937 <select aria-label="<?php print esc_attr( __( 'Background position', 'loading-page' ) ); ?>" id="lp_backgroundRepeat" name="lp_backgroundRepeat">
938 <option value="repeat"
939 <?php
940 if ( isset( $loading_page_options['backgroundImageRepeat'] ) && 'repeat' === $loading_page_options['backgroundImageRepeat'] ) {
941 echo 'SELECTED';}
942 ?>
943 >Tile</option>
944 <option value="no-repeat"
945 <?php
946 if ( isset( $loading_page_options['backgroundImageRepeat'] ) && 'no-repeat' === $loading_page_options['backgroundImageRepeat'] ) {
947 echo 'SELECTED';}
948 ?>
949 >Center</option>
950 </select>
951
952 </td>
953 </tr>
954 <tr>
955 <th><?php esc_html_e( 'Display image in fullscreen', 'loading-page' ); ?></th>
956 <td>
957 <input aria-label="<?php print esc_attr( __( 'Fullscreen', 'loading-page' ) ); ?>" type="checkbox" name="lp_fullscreen" id="lp_fullscreen" <?php echo ( ( isset( $loading_page_options['fullscreen'] ) && $loading_page_options['fullscreen'] ) ? 'CHECKED' : '' ); ?> />
958 <i><?php esc_html_e( '(The fullscreen attribute can fail in some browsers)', 'loading-page' ); ?></i>
959 </td>
960 </tr>
961 <tr>
962 <th><?php esc_html_e( 'Select foreground color', 'loading-page' ); ?></th>
963 <td><input aria-label="<?php print esc_attr( __( 'Foreground color', 'loading-page' ) ); ?>" type="text" name="lp_foregroundColor" id="lp_foregroundColor" value="
964 <?php
965 if ( isset( $loading_page_options['foregroundColor'] ) ) {
966 print( esc_attr( $loading_page_options['foregroundColor'] ) );}
967 ?>
968 " />
969 <div id="lp_foregroundColor_picker"></div>
970 </td>
971 </tr>
972 <tr>
973 <th><?php esc_html_e( 'Additional seconds', 'loading-page' ); ?></th>
974 <td>
975 <input aria-label="<?php print esc_attr( __( 'Additional seconds', 'loading-page' ) ); ?>" type="text" name="lp_additionalSeconds" id="lp_additionalSeconds" value="
976 <?php
977 if ( isset( $loading_page_options['additionalSeconds'] ) ) {
978 print( esc_attr( $loading_page_options['additionalSeconds'] ) );}
979 ?>
980 " />
981 <i><?php esc_html_e( 'Show the loading screen some few seconds after loading the page', 'loading-page' ); ?></i>
982 </td>
983 </tr>
984 <tr>
985 <th><?php esc_html_e( 'Include an ad, or your own block of code', 'loading-page' ); ?></th>
986 <td>
987 <textarea aria-label="<?php print esc_attr( __( 'Ad or block of code', 'loading-page' ) ); ?>" name="lp_codeBlock" id="lp_codeBlock" rows="6" style="width:80%;">
988 <?php
989 if ( isset( $loading_page_options['codeBlock'] ) ) {
990 print( esc_textarea( $loading_page_options['codeBlock'] ) );}
991 ?>
992 </textarea>
993 <p><i><b><?php esc_html_e( 'Trick', 'loading-page' ); ?></b>:
994 <?php esc_html_e( 'As the block of code you can insert a pair of &lt;style&gt;&lt;/style&gt; tags to customize the appearance of loading screen. For example: for changing the font-family of the loading text: <b>&lt;style&gt;.lp-screen-text{font-family:Georgia !important;}&lt;/style&gt;</b>', 'loading-page' ); ?></i></p>
995 </td>
996 </tr>
997 <tr>
998 <th><?php esc_html_e( 'Apply the effect on page', 'loading-page' ); ?></th>
999 <td>
1000 <select aria-label="<?php print esc_attr( __( 'Animation effect', 'loading-page' ) ); ?>" name="lp_pageEffect">
1001 <?php
1002 $page_effects = array( 'none', 'rotateInLeft' );
1003
1004 foreach ( $page_effects as $value ) {
1005 print '<option value="' . esc_attr( $value ) . '" ' . ( ( isset( $loading_page_options['pageEffect'] ) && $loading_page_options['pageEffect'] === $value ) ? 'SELECTED' : '' ) . '>' . esc_html( $value ) . '</option>';
1006 }
1007 ?>
1008
1009 </select>
1010 <div style="color:#FF0000;">The premium version of plugin add the following effects: collapseIn, risingFromBottom, expandIn, fadeIn, fallFromTop, rotateInLeft, rotateInRight, rotateInRightWithoutToKeyframe, slideInSkew, tumbleIn, whirlIn</div>
1011 </td>
1012 </tr>
1013 <tr>
1014 <th><?php esc_html_e( 'Display loading percent', 'loading-page' ); ?></th>
1015 <td><input aria-label="<?php print esc_attr( __( 'Display loading percent', 'loading-page' ) ); ?>" type="checkbox" name="lp_displayPercent" <?php echo ( ( ! empty( $loading_page_options['displayPercent'] ) ) ? 'CHECKED' : '' ); ?> /></td>
1016 </tr>
1017 </table>
1018 <div style="border: 1px solid #DADADA; padding:10px;">
1019 <h3><?php esc_html_e( 'Troubleshoot Area - Loading Screen', 'loading-page' ); ?></h3>
1020 <table class="form-table">
1021 <tr>
1022 <th><?php esc_html_e( 'Disable the search in deep', 'loading-page' ); ?></th>
1023 <td>
1024 <input aria-label="<?php print esc_attr( __( 'Disable search in deep', 'loading-page' ) ); ?>" type="checkbox" name="lp_deactivateDeepSearch" <?php echo ( ( empty( $loading_page_options['deepSearch'] ) ) ? 'CHECKED' : '' ); ?> /> <i><?php esc_html_e( 'If the loading screen stops in some percentage, tick the checkbox', 'loading-page' ); ?></i>
1025 </td>
1026 </tr>
1027 <tr>
1028 <th><?php esc_html_e( 'The pages\' background is visible', 'loading-page' ); ?></th>
1029 <td>
1030 <input aria-label="<?php print esc_attr( __( 'Tick if page visible', 'loading-page' ) ); ?>" type="checkbox" name="lp_modifyDisplayRule" <?php echo ( ( ! empty( $loading_page_options['modifyDisplayRule'] ) ) ? 'CHECKED' : '' ); ?> /> <i><?php esc_html_e( 'If website\'s background is visible before the loading screen, tick the checkbox', 'loading-page' ); ?></i>
1031 </td>
1032 </tr>
1033
1034 </table>
1035 </div>
1036 </div>
1037 </div>
1038 <div class="postbox">
1039 <h3 class='hndle' style="padding:5px;"><span><?php esc_html_e( 'Lazy Loading', 'loading-page' ); ?></span></h3>
1040 <div class="inside">
1041 <p>
1042 <?php
1043 esc_html_e(
1044 'To load only the images visible in the viewport to improve the loading rate of your website and reduce the bandwidth consumption.',
1045 'loading-page'
1046 );
1047 ?>
1048 </p>
1049 <p>
1050 <span style="color:#FF0000;">
1051 The lazy loading of images is available only in the commercial version of plugin <a href="http://wordpress.dwbooster.com/content-tools/loading-page" target="_blank">CLICK HERE</a>
1052 </span>
1053 </p>
1054 <p><img alt="<?php print esc_attr( __( 'Lazy loading chart', 'loading-page' ) ); ?>" src="<?php print( esc_attr( LOADING_PAGE_PLUGIN_URL . '/images/consumption_graph.png' ) ); ?>" style="max-width:100%;" /></p>
1055 <table class="form-table">
1056 <tr>
1057 <th><?php esc_html_e( 'Enable lazy loading', 'loading-page' ); ?></th>
1058 <td><input aria-label="<?php print esc_attr( __( 'Enable lazy loading', 'loading-page' ) ); ?>" type="checkbox" DISABLED /></td>
1059 </tr>
1060 <tr>
1061 <th><?php esc_html_e( 'Select the image to load by default', 'loading-page' ); ?></th>
1062 <td>
1063 <input aria-label="<?php print esc_attr( __( 'Image to load by default', 'loading-page' ) ); ?>" type="text" DISABLED /><input type="button" value="Browse" DISABLED />
1064 </td>
1065 </tr>
1066 <tr>
1067 <th><?php esc_html_e( 'Exclude lazy loading from', 'loading-page' ); ?></th>
1068 <td><input aria-label="<?php print esc_attr( __( 'Pages/posts ids separated by comma', 'loading-page' ) ); ?>" type="text" DISABLED /> <i><?php esc_html_e( 'Type one, or more post/pages IDs, separated by commas ","', 'loading-page' ); ?></i></td>
1069 </tr>
1070 </table>
1071 <div style="border: 1px solid #DADADA; padding:10px;">
1072 <h3><?php esc_html_e( 'Troubleshoot Area - Lazy Loading', 'loading-page' ); ?></h3>
1073 <table class="form-table">
1074 <tr>
1075 <th><?php esc_html_e( 'Exclude images whose tag includes the class or attribute', 'loading-page' ); ?></th>
1076 <td>
1077 <input aria-label="<?php print esc_attr( __( 'Class or attributes names', 'loading-page' ) ); ?>" type="text" style="width:100%;" disabled /><br />
1078 <p><i><?php esc_html_e( 'Don\'t apply the lazy loading to the images with the classes or attributes (separated by commas ",")', 'loading-page' ); ?></i></p>
1079 </td>
1080 </tr>
1081 </table>
1082 </div>
1083 </div>
1084 </div>
1085 <div><input type="submit" value="Update Settings" class="button-primary" /></div>
1086 </form>
1087 </div>
1088 <?php
1089 } // End loading_page_settings_page.
1090 }
1091