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 / checkout-legacy.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
checkout-legacy.php
243 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.0.3
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 wp_enqueue_script( 'jquery' );
14 wp_enqueue_script( 'json2' );
15 fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
16 fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
17 fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
18
19 /**
20 * @var array $VARS
21 */
22 $slug = $VARS['slug'];
23 $fs = freemius( $slug );
24
25 $timestamp = time();
26
27 $context_params = array(
28 'plugin_id' => $fs->get_id(),
29 'plugin_public_key' => $fs->get_public_key(),
30 'plugin_version' => $fs->get_plugin_version(),
31 );
32
33 // Get site context secure params.
34 if ( $fs->is_registered() ) {
35 $site = $fs->get_site();
36 $plugin_id = fs_request_get( 'plugin_id', $fs->get_id() );
37
38 if ( $plugin_id != $fs->get_id() ) {
39 if ( $fs->is_addon_activated( $plugin_id ) ) {
40 $fs_addon = Freemius::get_instance_by_id( $plugin_id );
41 $site = $fs_addon->get_site();
42 }
43 }
44
45 $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
46 $site,
47 $timestamp,
48 'checkout'
49 ) );
50 } else {
51 $current_user = Freemius::_get_current_wp_user();
52
53 // Add site and user info to the request, this information
54 // is NOT being stored unless the user complete the purchase
55 // and agrees to the TOS.
56 $context_params = array_merge( $context_params, array(
57 'user_firstname' => $current_user->user_firstname,
58 'user_lastname' => $current_user->user_lastname,
59 'user_email' => $current_user->user_email,
60 'home_url' => home_url(),
61 ) );
62
63 $fs_user = Freemius::_get_user_by_email( $current_user->user_email );
64
65 if ( is_object( $fs_user ) ) {
66 $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
67 $fs_user,
68 $timestamp,
69 'checkout'
70 ) );
71 }
72 }
73
74 if ( $fs->is_payments_sandbox() ) {
75 // Append plugin secure token for sandbox mode authentication.
76 $context_params['sandbox'] = FS_Security::instance()->get_secure_token(
77 $fs->get_plugin(),
78 $timestamp,
79 'checkout'
80 );
81
82 /**
83 * @since 1.1.7.3 Add security timestamp for sandbox even for anonymous user.
84 */
85 if ( empty( $context_params['s_ctx_ts'] ) ) {
86 $context_params['s_ctx_ts'] = $timestamp;
87 }
88 }
89
90 $return_url = $fs->_get_sync_license_url( isset( $_GET['plugin_id'] ) ? $_GET['plugin_id'] : $fs->get_id() );
91
92 $query_params = array_merge( $context_params, $_GET, array(
93 // Current plugin version.
94 'plugin_version' => $fs->get_plugin_version(),
95 'sdk_version' => WP_FS__SDK_VERSION,
96 'return_url' => $return_url,
97 // Admin CSS URL for style/design competability.
98 // 'wp_admin_css' => get_bloginfo('wpurl') . "/wp-admin/load-styles.php?c=1&load=buttons,wp-admin,dashicons",
99 ) );
100 ?>
101 <div id="fs_checkout" class="wrap" style="margin: 0 0 -65px -20px;">
102 <div id="iframe"></div>
103 <script type="text/javascript">
104 // http://stackoverflow.com/questions/4583703/jquery-post-request-not-ajax
105 jQuery(function ($) {
106 $.extend({
107 form: function (url, data, method) {
108 if (method == null) method = 'POST';
109 if (data == null) data = {};
110
111 var form = $('<form>').attr({
112 method: method,
113 action: url
114 }).css({
115 display: 'none'
116 });
117
118 var addData = function (name, data) {
119 if ($.isArray(data)) {
120 for (var i = 0; i < data.length; i++) {
121 var value = data[i];
122 addData(name + '[]', value);
123 }
124 } else if (typeof data === 'object') {
125 for (var key in data) {
126 if (data.hasOwnProperty(key)) {
127 addData(name + '[' + key + ']', data[key]);
128 }
129 }
130 } else if (data != null) {
131 form.append($('<input>').attr({
132 type : 'hidden',
133 name : String(name),
134 value: String(data)
135 }));
136 }
137 };
138
139 for (var key in data) {
140 if (data.hasOwnProperty(key)) {
141 addData(key, data[key]);
142 }
143 }
144
145 return form.appendTo('body');
146 }
147 });
148 });
149
150 (function ($) {
151 $(function () {
152
153 var
154 // Keep track of the iframe height.
155 iframe_height = 800,
156 base_url = '<?php echo WP_FS__ADDRESS ?>',
157 // Pass the parent page URL into the Iframe in a meaningful way (this URL could be
158 // passed via query string or hard coded into the child page, it depends on your needs).
159 src = base_url + '/checkout/?<?php echo ( isset( $_REQUEST['XDEBUG_SESSION'] ) ? 'XDEBUG_SESSION=' . $_REQUEST['XDEBUG_SESSION'] . '&' : '' ) . http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
160
161 // Append the Iframe into the DOM.
162 iframe = $('<iframe " src="' + src + '" width="100%" height="' + iframe_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/iframe>')
163 .appendTo('#iframe');
164
165 FS.PostMessage.init(base_url, [iframe[0]]);
166 FS.PostMessage.receiveOnce('height', function (data) {
167 var h = data.height;
168 if (!isNaN(h) && h > 0 && h != iframe_height) {
169 iframe_height = h;
170 iframe.height(iframe_height + 'px');
171
172 FS.PostMessage.postScroll(iframe[0]);
173 }
174 });
175
176 FS.PostMessage.receiveOnce('install', function (data) {
177 // Post data to activation URL.
178 $.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
179 'fs_action' => $slug . '_activate_new',
180 'plugin_id' => isset( $_GET['plugin_id'] ) ? $_GET['plugin_id'] : $fs->get_id()
181 ) ), $slug . '_activate_new' ) ?>', {
182 user_id : data.user.id,
183 user_secret_key : data.user.secret_key,
184 user_public_key : data.user.public_key,
185 install_id : data.install.id,
186 install_secret_key: data.install.secret_key,
187 install_public_key: data.install.public_key
188 }).submit();
189 });
190
191 FS.PostMessage.receiveOnce('pending_activation', function (data) {
192 $.form('<?php echo fs_nonce_url( $fs->_get_admin_page_url( 'account', array(
193 'fs_action' => $slug . '_activate_new',
194 'plugin_id' => fs_request_get( 'plugin_id', $fs->get_id() ),
195 'pending_activation' => true,
196 ) ), $slug . '_activate_new' ) ?>', {
197 user_email: data.user_email
198 }).submit();
199 });
200
201 FS.PostMessage.receiveOnce('get_context', function () {
202 console.debug('receiveOnce', 'get_context');
203
204 // If the user didn't connect his account with Freemius,
205 // once he accepts the Terms of Service and Privacy Policy,
206 // and then click the purchase button, the context information
207 // of the user will be shared with Freemius in order to complete the
208 // purchase workflow and activate the license for the right user.
209 <?php $install_data = array_merge( $fs->get_opt_in_params(),
210 array(
211 'activation_url' => fs_nonce_url( $fs->_get_admin_page_url( '',
212 array(
213 'fs_action' => $slug . '_activate_new',
214 'plugin_id' => fs_request_get( 'plugin_id', $fs->get_id() ),
215
216 ) ),
217 $slug . '_activate_new' )
218 ) ) ?>
219 FS.PostMessage.post('context', <?php echo json_encode( $install_data ) ?>, iframe[0]);
220 });
221
222 FS.PostMessage.receiveOnce('get_dimensions', function (data) {
223 console.debug('receiveOnce', 'get_dimensions');
224
225 FS.PostMessage.post('dimensions', {
226 height : $(document.body).height(),
227 scrollTop: $(document).scrollTop()
228 }, iframe[0]);
229 });
230 });
231 })(jQuery);
232 </script>
233 </div>
234 <?php
235 $params = array(
236 'page' => 'checkout',
237 'module_id' => $fs->get_id(),
238 'module_slug' => $slug,
239 'module_version' => $fs->get_plugin_version(),
240 );
241 fs_require_template( 'powered-by.php', $params );
242 ?>
243