PluginProbe ʕ •ᴥ•ʔ
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more / 2.0.1
EmbedPress – PDF Embedder, Embed PDF viewer, YouTube Videos, 3D FlipBook, Social feeds & more v2.0.1
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 / forms / trial-start.php
embedpress / freemius / templates / forms Last commit date
deactivation 9 years ago index.php 9 years ago license-activation.php 9 years ago optout.php 9 years ago resend-key.php 9 years ago trial-start.php 9 years ago
trial-start.php
179 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.0
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 */
16 $slug = $VARS['slug'];
17 $fs = freemius( $slug );
18
19 $message_header = sprintf(
20 fs_text( 'start-trial-prompt-header', $slug ),
21 '<span class="var-trial_period"></span>',
22 '<span class="var-plan_title"></span>'
23 );
24 $message_content = sprintf(
25 fs_text( 'start-trial-prompt-message', $slug ),
26 sprintf(
27 '<a href="%s" target="_blank">%s</a>',
28 'https://freemius.com',
29 'freemius.com'
30 )
31 );
32
33 $modal_content_html = <<< HTML
34 <div class="notice notice-error inline"><p></p></div>
35 <h3>{$message_header}</h3>
36 <p>{$message_content}</p>
37 HTML;
38
39 fs_enqueue_local_style( 'dialog-boxes', '/admin/dialog-boxes.css' );
40 ?>
41 <script type="text/javascript">
42 (function ($) {
43 $(document).ready(function () {
44 var modalContentHtml = <?php echo json_encode( $modal_content_html ); ?>,
45 modalHtml =
46 '<div class="fs-modal fs-modal-license-key-resend">'
47 + ' <div class="fs-modal-dialog">'
48 + ' <div class="fs-modal-header">'
49 + ' <h4><?php fs_esc_js_echo( 'start-free-trial', $slug ) ?></h4>'
50 + ' </div>'
51 + ' <div class="fs-modal-body">' + modalContentHtml + '</div>'
52 + ' <div class="fs-modal-footer">'
53 + ' <button class="button button-secondary button-close">' + <?php fs_json_encode_echo( 'cancel', $slug ) ?> +'</button>'
54 + ' <button class="button button-primary button-connect">' + <?php fs_json_encode_echo( 'approve-start-trial', $slug ) ?> +'</button>'
55 + ' </div>'
56 + ' </div>'
57 + '</div>',
58 $modal = $(modalHtml),
59 moduleSlug = '<?php echo $slug; ?>',
60 trialData;
61
62 $modal.appendTo($('body'));
63
64 var $errorNotice = $modal.find('.notice-error');
65
66 registerEventHandlers();
67
68 function registerEventHandlers() {
69 $modal.on('click', '.button-close', function () {
70 closeModal();
71 return false;
72 });
73
74 $modal.on('click', '.button-connect', function (evt) {
75 evt.preventDefault();
76
77 var $button = $(this);
78
79 $.ajax({
80 url : ajaxurl,
81 method : 'POST',
82 data : {
83 action : '<?php echo $fs->get_ajax_action( 'start_trial' ) ?>',
84 security: '<?php echo $fs->get_ajax_security( 'start_trial' ) ?>',
85 slug : moduleSlug,
86 trial : trialData
87 },
88 beforeSend: function () {
89 // Disable all buttons during trial activation.
90 $modal.find('.button').prop('disabled', true);
91
92 $button.text(<?php fs_json_encode_echo( 'starting-trial', $slug ) ?> + '...');
93
94 setLoadingMode();
95 },
96 success : function (resultObj) {
97 if (resultObj.success) {
98 $button.text(<?php fs_json_encode_echo( 'please-wait', $slug ) ?> + '...');
99
100 // Redirect to the "Account" page and sync the license.
101 window.location.href = resultObj.data.next_page;
102 } else {
103 $button.text(<?php fs_json_encode_echo( 'approve-start-trial', $slug ) ?>);
104
105 resetLoadingMode();
106 showError(resultObj.error);
107 }
108 }
109 });
110 });
111 }
112
113 window.openTrialConfirmationModal = function showModal(data) {
114 resetModal();
115
116 // Display the dialog box.
117 $modal.addClass('active');
118
119 trialData = data;
120
121 var $modalBody = $modal.find('.fs-modal-body'),
122 $var;
123
124 for (var key in data) {
125 if (data.hasOwnProperty(key)) {
126 $var = $modalBody.find('.var-' + key);
127
128 if ($var.length > 0)
129 $var.html(data[key]);
130 }
131 }
132
133 $('body').addClass('has-fs-modal');
134 };
135
136 function closeModal() {
137 $modal.removeClass('active');
138
139 $('body').removeClass('has-fs-modal');
140 }
141
142 function resetModal() {
143 hideError();
144 }
145
146 function hideError() {
147 $errorNotice.hide();
148 }
149
150 function setLoadingMode() {
151 $modal.find('.button')
152 // Re-enable all buttons.
153 .prop('disabled', trialData)
154 // Stop loading cursor.
155 .css({'cursor': 'wait'});
156
157 // Stop loading cursor.
158 $(document.body).css({'cursor': 'wait'});
159 }
160
161 function resetLoadingMode() {
162 $modal.find('.button')
163 // Re-enable all buttons.
164 .prop('disabled', false)
165 // Stop loading cursor.
166 .css({'cursor': 'initial'});
167
168 // Stop loading cursor.
169 $(document.body).css({'cursor': 'initial'});
170 }
171
172 function showError(msg) {
173 $errorNotice.find(' > p').html(msg);
174 $errorNotice.show();
175 }
176 });
177 })(jQuery);
178 </script>
179