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