PluginProbe ʕ •ᴥ•ʔ
Royal Addons for Elementor – Addons and Templates Kit for Elementor / 1.7.1064
Royal Addons for Elementor – Addons and Templates Kit for Elementor v1.7.1064
1.7.1064 1.7.1063 1.7.1062 1.7.1061 1.7.1060 1.7.1059 1.7.1058 trunk 1.0.0 1.1.0 1.2 1.3 1.3.1 1.3.2 1.3.21 1.3.22 1.3.23 1.3.24 1.3.25 1.3.26 1.3.27 1.3.28 1.3.29 1.3.30 1.3.31 1.3.32 1.3.33 1.3.34 1.3.35 1.3.36 1.3.37 1.3.38 1.3.39 1.3.40 1.3.41 1.3.42 1.3.43 1.3.44 1.3.45 1.3.46 1.3.47 1.3.48 1.3.49 1.3.50 1.3.51 1.3.52 1.3.53 1.3.54 1.3.55 1.3.56 1.3.57 1.3.58 1.3.59 1.3.60 1.3.61 1.3.62 1.3.63 1.3.64 1.3.65 1.3.66 1.3.67 1.3.68 1.3.69 1.3.70 1.3.71 1.3.72 1.3.73 1.3.74 1.3.75 1.3.76 1.3.77 1.3.78 1.3.79 1.3.80 1.3.81 1.3.82 1.3.83 1.3.84 1.3.85 1.3.86 1.3.87 1.3.88 1.3.89 1.3.90 1.3.91 1.3.92 1.3.93 1.3.94 1.3.95 1.3.96 1.3.97 1.3.971 1.3.972 1.3.973 1.3.974 1.3.975 1.3.976 1.3.977 1.3.978 1.3.979 1.3.980 1.3.981 1.3.982 1.3.983 1.3.984 1.3.985 1.3.986 1.3.987 1.7.1 1.7.1001 1.7.1002 1.7.1003 1.7.1004 1.7.1005 1.7.1006 1.7.1007 1.7.1008 1.7.1009 1.7.1010 1.7.1011 1.7.1012 1.7.1013 1.7.1014 1.7.1015 1.7.1016 1.7.1017 1.7.1018 1.7.1019 1.7.1020 1.7.1021 1.7.1022 1.7.1023 1.7.1024 1.7.1025 1.7.1026 1.7.1027 1.7.1028 1.7.1029 1.7.1030 1.7.1031 1.7.1032 1.7.1033 1.7.1034 1.7.1035 1.7.1036 1.7.1037 1.7.1038 1.7.1039 1.7.1040 1.7.1041 1.7.1042 1.7.1043 1.7.1044 1.7.1045 1.7.1046 1.7.1047 1.7.1048 1.7.1049 1.7.1050 1.7.1051 1.7.1052 1.7.1053 1.7.1054 1.7.1055 1.7.1056 1.7.1057
royal-elementor-addons / freemius / templates / auto-installation.php
royal-elementor-addons / freemius / templates Last commit date
account 5 days ago checkout 5 days ago connect 5 days ago debug 5 days ago forms 5 days ago js 5 days ago partials 5 days ago plugin-info 5 days ago account.php 5 days ago add-ons.php 5 days ago add-trial-to-pricing.php 5 days ago admin-notice.php 5 days ago ajax-loader.php 5 days ago api-connectivity-message-js.php 5 days ago auto-installation.php 5 days ago checkout.php 5 days ago clone-resolution-js.php 5 days ago connect.php 5 days ago contact.php 5 days ago debug.php 5 days ago email.php 5 days ago gdpr-optin-js.php 5 days ago index.php 5 days ago plugin-icon.php 5 days ago pricing.php 5 days ago secure-https-header.php 5 days ago sticky-admin-notice-js.php 5 days ago tabs-capture-js.php 5 days ago tabs.php 5 days ago
auto-installation.php
250 lines
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 * @since 1.2.1.5
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 * @var Freemius $fs
16 */
17 $slug = $VARS['slug'];
18 $plugin_id = $VARS['target_module_id'];
19
20 $fs = freemius( $VARS['id'] );
21
22 $action = $fs->is_tracking_allowed() ?
23 'stop_tracking' :
24 'allow_tracking';
25
26 $title = $fs->get_plugin_title();
27
28 if ( $plugin_id != $fs->get_id() ) {
29 $addon = $fs->get_addon( $plugin_id );
30
31 if ( is_object( $addon ) ) {
32 $title = $addon->title . ' ' . fs_text_inline( 'Add-On', 'addon', $slug );
33 }
34 }
35
36 $plugin_title = sprintf(
37 '<strong>%s</strong>',
38 esc_html( $title )
39 );
40
41 $sec_countdown = 30;
42 $countdown_html = sprintf(
43 esc_js(
44 /* translators: %s: Number of seconds */
45 fs_text_inline( '%s sec', 'x-sec', $slug )
46 ),
47 sprintf( '<span class="fs-countdown">%s</span>', $sec_countdown )
48 );
49
50 fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
51 fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
52
53 $params = array();
54 $loader_html = fs_get_template( 'ajax-loader.php', $params );
55
56 // Pass unique auto installation URL if WP_Filesystem is needed.
57 $install_url = $fs->_get_sync_license_url(
58 $plugin_id,
59 true,
60 array( 'auto_install' => 'true' )
61 );
62
63
64 ob_start();
65
66 $method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
67
68 $credentials = request_filesystem_credentials(
69 esc_url_raw( $install_url ),
70 $method,
71 false,
72 WP_PLUGIN_DIR,
73 array()
74 );
75
76 $credentials_form = ob_get_clean();
77
78 $require_credentials = ! empty( $credentials_form );
79 ?>
80 <div class="fs-modal fs-modal-auto-install">
81 <div class="fs-modal-dialog">
82 <div class="fs-modal-header">
83 <h4><?php echo esc_js( fs_text_inline( 'Automatic Installation', 'auto-installation', $slug ) ) ?></h4>
84 </div>
85 <div class="fs-modal-body">
86 <div class="fs-notice-error" style="display: none"><p></p></div>
87 <?php if ( $require_credentials ) : ?>
88 <div id="request-filesystem-credentials-dialog">
89 <?php echo $credentials_form ?>
90 </div>
91 <?php else : ?>
92 <p class="fs-installation-notice"><?php echo sprintf(
93 fs_esc_html_inline( 'An automated download and installation of %s (paid version) from %s will start in %s. If you would like to do it manually - click the cancellation button now.', 'installing-in-n', $slug ),
94 $plugin_title,
95 sprintf(
96 '<a href="%s" target="_blank" rel="noopener">%s</a>',
97 'https://freemius.com',
98 'freemius.com'
99 ),
100 $countdown_html
101 ) ?></p>
102 <?php endif ?>
103 <p class="fs-installing"
104 style="display: none"><?php echo sprintf( fs_esc_html_inline( 'The installation process has started and may take a few minutes to complete. Please wait until it is done - do not refresh this page.', 'installing-module-x', $slug ), $plugin_title ) ?></p>
105 </div>
106 <div class="fs-modal-footer">
107 <?php echo $loader_html ?>
108 <button
109 class="button button-secondary button-cancel"><?php fs_esc_html_echo_inline( 'Cancel Installation', 'cancel-installation', $slug ) ?><?php if ( ! $require_credentials ) : ?> (<?php echo $countdown_html ?>)<?php endif ?></button>
110 <button
111 class="button button-primary"><?php fs_esc_html_echo_inline( 'Install Now', 'install-now', $slug ) ?></button>
112 </div>
113 </div>
114 </div>'
115
116 <script type="text/javascript">
117 (function ($) {
118 $(document).ready(function () {
119 var $modal = $('.fs-modal-auto-install'),
120 $body = $('body'),
121 $countdown = $modal.find('.fs-countdown'),
122 requireCredentials = <?php echo json_encode( $require_credentials ) ?>,
123 $credentialsForm = $('#request-filesystem-credentials-dialog'),
124 $errorNotice = $modal.find('.fs-notice-error'),
125 installing = false;
126
127 $modal.appendTo($body);
128
129 var startAutoInstall = function () {
130 if (installing)
131 return;
132
133 installing = true;
134
135 // Start auto-install.
136 $modal.addClass('fs-warn');
137 if (requireCredentials) {
138 $credentialsForm.hide();
139 } else {
140 $modal.find('.fs-installation-notice').hide();
141 }
142
143 $errorNotice.hide();
144 $modal.find('.fs-installing').show();
145 $modal.find('button').hide();
146 $modal.find('.fs-ajax-loader').show();
147
148 var data = {
149 action : '<?php echo $fs->get_ajax_action( 'install_premium_version' ) ?>',
150 security : '<?php echo $fs->get_ajax_security( 'install_premium_version' ) ?>',
151 slug : '<?php echo $slug ?>',
152 module_id : '<?php echo $fs->get_id() ?>',
153 target_module_id: '<?php echo $plugin_id ?>'
154 };
155
156 if (requireCredentials) {
157 // Add filesystem credentials.
158 data.hostname = $('#hostname').val();
159 data.username = $('#username').val();
160 data.password = $('#password').val();
161 data.connection_type = $('input[name="connection_type"]:checked').val();
162 data.public_key = $('#public_key').val();
163 data.private_key = $('#private_key').val();
164 }
165
166 $.ajax({
167 url : <?php echo Freemius::ajax_url() ?>,
168 method : 'POST',
169 data : data,
170 success: function (resultObj) {
171 var reloadAccount = false;
172
173 if (resultObj.success) {
174 // Reload account page to show new data.
175 reloadAccount = true;
176 } else {
177 switch (resultObj.error.code) {
178 case 'invalid_module_id':
179 case 'premium_installed':
180 reloadAccount = true;
181 break;
182 case 'invalid_license':
183 case 'premium_version_missing':
184 case 'unable_to_connect_to_filesystem':
185 default:
186 $modal.removeClass('fs-warn');
187 $modal.find('.fs-installing').hide();
188 $modal.find('.fs-ajax-loader').hide();
189 $modal.find('.button-cancel').html(<?php fs_json_encode_echo_inline( 'Cancel Installation', 'cancel-installation', $slug ) ?>);
190 $modal.find('button').show();
191
192 $errorNotice.find('p').text(resultObj.error.message);
193 $errorNotice.addClass('notice notice-alt notice-error').show();
194 if (requireCredentials) {
195 $credentialsForm.show();
196 }
197 break;
198 }
199 }
200
201 if (reloadAccount) {
202 window.location = '<?php echo $fs->get_account_url() ?>';
203 }
204
205 installing = false;
206 }
207 });
208 };
209
210 var clearCountdown = function () {
211 clearInterval(countdownInterval);
212 countdownInterval = null;
213 };
214
215 var cancelAutoInstall = function () {
216 $modal.fadeOut(function () {
217 $modal.remove();
218 $body.removeClass('has-fs-modal');
219 });
220 };
221
222 var countdown = <?php echo $sec_countdown ?>,
223 countdownInterval = requireCredentials ? null : setInterval(function () {
224 $countdown.html(--countdown);
225 if (0 == countdown) {
226 clearCountdown();
227 startAutoInstall();
228 }
229 }, 1000);
230
231 $modal.addClass('active');
232 $body.addClass('has-fs-modal');
233
234 $modal.find('.button-primary').click(function () {
235 clearCountdown();
236 startAutoInstall();
237 });
238
239 $modal.find('.button-cancel').click(function () {
240 clearCountdown();
241 cancelAutoInstall();
242 });
243
244 if (requireCredentials) {
245
246 }
247 });
248 })(jQuery);
249 </script>
250