PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.1.7.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.1.7.1
4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 4.1.7.3.2 4.2.0 All 139 releases
learnpress / inc / admin / views / updates / html-updating-message.php

html-updating-message.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.1.7.1, at inc/admin/views/updates/html-updating-message.php

80 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Template for displaying message when LP updating to latest version
4 *
5 * @author ThimPress
6 * @package LearnPress/Admin/Views
7 * @version 3.0.8
8 */
9
10 defined( 'ABSPATH' ) || exit;
11 ?>
12
13 <div class="notice notice-warning lp-notice-update-database do-updating">
14 <p>
15 <?php _e( '<strong>LearnPress update</strong> – We are running updater to upgrade your database to the latest version.', 'learnpress' ); ?>
16 </p>
17 </div>
18
19 <script>
20 (function( win, doc ) {
21 var t = null;
22 var $ = jQuery;
23
24 function parseJSON( data ) {
25 if ( typeof data !== 'string' ) {
26 return data;
27 }
28
29 var m = String.raw({raw: data}).match(/<-- LP_AJAX_START -->(.*)<-- LP_AJAX_END -->/s);
30
31 try {
32 if (m) {
33 data = $.parseJSON(m[1].replace(/(?:\r\n|\r|\n)/g, ''));
34 } else {
35 data = $.parseJSON(data);
36 }
37 } catch (e) {
38 data = {};
39 }
40 return data;
41 }
42
43 function sendRequest() {
44 t = setTimeout( function() {
45 var $ = jQuery;
46 $.ajax({
47 url: '',
48 data: {
49 'lp-ajax': 'check-updated'
50 },
51 success: function( response ) {
52 response = parseJSON( response );
53
54 if ( response.result === 'success' ) {
55 clearTimeout(t);
56 $('.lp-notice-update-database.do-updating').replaceWith( $( response.message ) );
57 window.onbeforeunload = null;
58 return;
59 }
60 sendRequest();
61 }
62 });
63 }, 1000 );
64
65 window.addEventListener( 'beforeunload', function( e ) {
66 e.preventDefault();
67
68 e.returnValue = 'Warning! Please don\'t close or reload this page.';
69 } );
70 }
71
72 if ( document.readyState === "complete" ) {
73 sendRequest.apply( win );
74 } else {
75 window.addEventListener( 'load', sendRequest );
76 }
77 })( window, document );
78
79 </script>
80