PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents / 2.0.0
EmbedPress – PDF Embedder, 3D PDF FlipBook, Google Reviews, YouTube Videos, Upload & Embed PDF documents v2.0.0
4.6.0 4.5.6 4.5.5 4.5.4 4.5.3 4.5.2 trunk 1.0.0 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.5.0 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 2.0.0 2.0.1 2.0.2 2.0.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.3.0 2.3.1 2.3.2 2.3.3 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.6.0 2.6.1 2.6.2 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.2.0 3.2.1 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.4.0 3.4.1 3.4.2 3.4.3 3.5.0 3.5.1 3.5.2 3.5.3 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.7.0 3.7.1 3.7.2 3.7.3 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.9.0 3.9.1 3.9.10 3.9.11 3.9.12 3.9.13 3.9.14 3.9.15 3.9.16 3.9.17 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.14 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.10 4.1.2 4.1.3 4.1.4 4.1.5 4.1.6 4.1.7 4.1.8 4.1.9 4.2.0 4.2.1 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.2.7 4.2.8 4.2.9 4.3.0 4.3.1 4.4.0 4.4.1 4.4.10 4.4.11 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9 4.5.0 4.5.1
embedpress / freemius / templates / auto-installation.php
embedpress / freemius / templates Last commit date
debug 9 years ago forms 9 years ago plugin-info 9 years ago account.php 9 years ago add-ons.php 9 years ago add-trial-to-pricing.php 9 years ago admin-notice.php 9 years ago ajax-loader.php 9 years ago all-admin-notice.php 9 years ago auto-installation.php 9 years ago billing.php 9 years ago checkout-legacy.php 9 years ago checkout.php 9 years ago connect.php 9 years ago contact.php 9 years ago debug.php 9 years ago email.php 9 years ago firewall-issues-js.php 9 years ago index.php 9 years ago plugin-icon.php 9 years ago powered-by.php 9 years ago pricing.php 9 years ago sticky-admin-notice-js.php 9 years ago
auto-installation.php
245 lines
1 <?php
2 /**
3 * @package Freemius
4 * @copyright Copyright (c) 2015, Freemius, Inc.
5 * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
6 * @since 1.2.1.5
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 */
16 $slug = $VARS['slug'];
17 $plugin_id = $VARS['id'];
18
19 $fs = freemius( $slug );
20
21 $action = $fs->is_tracking_allowed() ?
22 'stop_tracking' :
23 'allow_tracking';
24
25 $title = $fs->get_plugin_title();
26
27 if ( $plugin_id != $fs->get_id() ) {
28 $addon = $fs->get_addon( $plugin_id );
29
30 if ( is_object( $addon ) ) {
31 $title = $addon->title . ' ' . fs_text( 'addon', $slug );
32 }
33 }
34
35 $plugin_title = sprintf(
36 '<strong>%s</strong>',
37 esc_html( $title )
38 );
39
40 $sec_countdown = 30;
41 $countdown_html = sprintf(
42 esc_js( fs_text( 'x-sec', $slug ) ),
43 sprintf( '<span class="fs-countdown">%s</span>', $sec_countdown )
44 );
45
46 fs_enqueue_local_style( 'dialog-boxes', '/admin/dialog-boxes.css' );
47 fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
48
49 $params = array();
50 $loader_html = fs_get_template( 'ajax-loader.php', $params );
51
52 // Pass unique auto installation URL if WP_Filesystem is needed.
53 $install_url = $fs->_get_sync_license_url(
54 $plugin_id,
55 true,
56 array( 'auto_install' => 'true' )
57 );
58
59
60 ob_start();
61
62 $method = ''; // Leave blank so WP_Filesystem can populate it as necessary.
63
64 $credentials = request_filesystem_credentials(
65 esc_url_raw( $install_url ),
66 $method,
67 false,
68 WP_PLUGIN_DIR,
69 array()
70 );
71
72 $credentials_form = ob_get_clean();
73
74 $require_credentials = ! empty( $credentials_form );
75 ?>
76 <div class="fs-modal fs-modal-auto-install">
77 <div class="fs-modal-dialog">
78 <div class="fs-modal-header">
79 <h4><?php echo esc_js( fs_text( 'auto-installation', $slug ) ) ?></h4>
80 </div>
81 <div class="fs-modal-body">
82 <div class="fs-notice-error" style="display: none"><p></p></div>
83 <?php if ( $require_credentials ) : ?>
84 <div id="request-filesystem-credentials-dialog">
85 <?php echo $credentials_form ?>
86 </div>
87 <?php else : ?>
88 <p class="fs-installation-notice"><?php echo sprintf(
89 fs_esc_html( 'installing-in-n', $slug ),
90 $plugin_title,
91 sprintf(
92 '<a href="%s" target="_blank">%s</a>',
93 'https://freemius.com',
94 'freemius.com'
95 ),
96 $countdown_html
97 ) ?></p>
98 <?php endif ?>
99 <p class="fs-installing"
100 style="display: none"><?php echo sprintf( fs_esc_html( 'installing-module-x', $slug ), $plugin_title ) ?></p>
101 </div>
102 <div class="fs-modal-footer">
103 <?php echo $loader_html ?>
104 <button
105 class="button button-secondary button-cancel"><?php fs_esc_html_echo( 'cancel-installation', $slug ) ?><?php if ( ! $require_credentials ) : ?> (<?php echo $countdown_html ?>)<?php endif ?></button>
106 <button
107 class="button button-primary"<?php //disabled($require_credentials) ?>><?php echo esc_js( fs_text( 'install-now', $slug ) ) ?></button>
108 </div>
109 </div>
110 </div>'
111
112 <script type="text/javascript">
113 (function ($) {
114 $(document).ready(function () {
115 var $modal = $('.fs-modal-auto-install'),
116 $body = $('body'),
117 $countdown = $modal.find('.fs-countdown'),
118 requireCredentials = <?php echo json_encode( $require_credentials ) ?>,
119 $credentialsForm = $('#request-filesystem-credentials-dialog'),
120 $errorNotice = $modal.find('.fs-notice-error'),
121 installing = false;
122
123 $modal.appendTo($body);
124
125 var startAutoInstall = function () {
126 if (installing)
127 return;
128
129 installing = true;
130
131 // Start auto-install.
132 $modal.addClass('fs-warn');
133 if (requireCredentials) {
134 $credentialsForm.hide();
135 } else {
136 $modal.find('.fs-installation-notice').hide();
137 }
138
139 $errorNotice.hide();
140 $modal.find('.fs-installing').show();
141 $modal.find('button').hide();
142 $modal.find('.fs-ajax-loader').show();
143
144 var data = {
145 action : '<?php echo $fs->get_ajax_action( 'install_premium_version' ) ?>',
146 security : '<?php echo $fs->get_ajax_security( 'install_premium_version' ) ?>',
147 slug : '<?php echo $slug ?>',
148 module_id: '<?php echo $plugin_id ?>'
149 };
150
151 if (requireCredentials) {
152 // Add filesystem credentials.
153 data.hostname = $('#hostname').val();
154 data.username = $('#username').val();
155 data.password = $('#password').val();
156 data.connection_type = $('input[name="connection_type"]:checked').val();
157 data.public_key = $('#public_key').val();
158 data.private_key = $('#private_key').val();
159 }
160
161 $.ajax({
162 url : ajaxurl,
163 method : 'POST',
164 data : data,
165 success: function (resultObj) {
166 var reloadAccount = false;
167
168 if (resultObj.success) {
169 // Reload account page to show new data.
170 reloadAccount = true;
171 } else {
172 switch (resultObj.error.code) {
173 case 'invalid_module_id':
174 case 'premium_installed':
175 reloadAccount = true;
176 break;
177 case 'invalid_license':
178 case 'premium_version_missing':
179 case 'unable_to_connect_to_filesystem':
180 default:
181 $modal.removeClass('fs-warn');
182 $modal.find('.fs-installing').hide();
183 $modal.find('.fs-ajax-loader').hide();
184 $modal.find('.button-cancel').html(<?php fs_json_encode_echo( 'cancel-installation', $slug ) ?>);
185 $modal.find('button').show();
186
187 $errorNotice.find('p').text(resultObj.error.message);
188 $errorNotice.addClass('notice notice-alt notice-error').show();
189 if (requireCredentials) {
190 $credentialsForm.show();
191 }
192 break;
193 }
194 }
195
196 if (reloadAccount) {
197 window.location = '<?php echo $fs->get_account_url() ?>';
198 }
199
200 installing = false;
201 }
202 });
203 };
204
205 var clearCountdown = function () {
206 clearInterval(countdownInterval);
207 countdownInterval = null;
208 };
209
210 var cancelAutoInstall = function () {
211 $modal.fadeOut(function () {
212 $modal.remove();
213 $body.removeClass('has-fs-modal');
214 });
215 };
216
217 var countdown = <?php echo $sec_countdown ?>,
218 countdownInterval = requireCredentials ? null : setInterval(function () {
219 $countdown.html(--countdown);
220 if (0 == countdown) {
221 clearCountdown();
222 startAutoInstall();
223 }
224 }, 1000);
225
226 $modal.addClass('active');
227 $body.addClass('has-fs-modal');
228
229 $modal.find('.button-primary').click(function () {
230 clearCountdown();
231 startAutoInstall();
232 });
233
234 $modal.find('.button-cancel').click(function () {
235 clearCountdown();
236 cancelAutoInstall();
237 });
238
239 if (requireCredentials) {
240
241 }
242 });
243 })(jQuery);
244 </script>
245