PluginProbe ʕ •ᴥ•ʔ
Auto Post Cleaner / 3.10.2
Auto Post Cleaner v3.10.2
3.12.0 3.13.1 3.2.4 3.2.5 3.3.0 3.3.10 3.3.11 3.3.8 3.4.2 3.5.3 3.6.0 3.7.0 3.7.1 3.7.2 3.7.3 3.7.5 3.7.6 3.8.0 3.9.0 3.9.4 3.9.6 3.9.7 trunk 3.0.0 3.1.0 3.10.1 3.10.2 3.11.4
delete-old-posts-programmatically / freemius / templates / checkout / frame.php
delete-old-posts-programmatically / freemius / templates / checkout Last commit date
frame.php 1 year ago process-redirect.php 11 months ago redirect.php 1 year ago
frame.php
182 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.0.3
7 */
8
9 /**
10 * Update (October 9, 2024 by @swashata):
11 * Following request from the wp.org plugin review team, we have stopped
12 * embedding the checkout inside an i-frame for wp.org hosted free version
13 * of plugins and themes. Now they will be redirected instead.
14 *
15 * Note for WordPress.org Theme/Plugin reviewer:
16 * Freemius is an SDK for plugin and theme developers. Since the core
17 * of the SDK is relevant both for plugins and themes, for obvious reasons,
18 * we only develop and maintain one code base.
19 *
20 * This code (and page) will not run for wp.org themes and plugins. It will
21 * run only for premium version of the plugin/theme that is using the SDK.
22 *
23 * In addition, when this page loads an i-frame. We intentionally named it 'frame'
24 * so it will pass the "Theme Check" that is looking for the string "i" . "frame".
25 *
26 * If you have any questions or need clarifications, please don't hesitate
27 * pinging me on slack, my username is @svovaf.
28 *
29 * @author Vova Feldman (@svovaf)
30 * @since 1.2.2
31 */
32
33 if ( ! defined( 'ABSPATH' ) ) {
34 exit;
35 }
36
37 wp_enqueue_script( 'jquery' );
38 wp_enqueue_script( 'json2' );
39 fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.js' );
40 fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
41 fs_enqueue_local_script( 'fs-form', 'jquery.form.js', array( 'jquery' ) );
42
43 /**
44 * @var array $VARS
45 * @var Freemius $fs
46 */
47 $fs = freemius( $VARS['id'] );
48 $slug = $fs->get_slug();
49
50 $fs_checkout = FS_Checkout_Manager::instance();
51
52 $plugin_id = fs_request_get( 'plugin_id' );
53 if ( ! FS_Plugin::is_valid_id( $plugin_id ) ) {
54 $plugin_id = $fs->get_id();
55 }
56
57 $plan_id = fs_request_get( 'plan_id' );
58 $licenses = fs_request_get( 'licenses' );
59
60 $query_params = $fs_checkout->get_query_params(
61 $fs,
62 $plugin_id,
63 $plan_id,
64 $licenses
65 );
66
67 $return_url = $fs->_get_sync_license_url( $plugin_id );
68 $query_params['return_url'] = $return_url;
69
70 $xdebug_session = fs_request_get( 'XDEBUG_SESSION' );
71 if ( false !== $xdebug_session ) {
72 $query_params['XDEBUG_SESSION'] = $xdebug_session;
73 }
74
75 $view_params = array(
76 'id' => $VARS['id'],
77 'page' => strtolower( $fs->get_text_inline( 'Checkout', 'checkout' ) ) . ' ' . $fs->get_text_inline( 'PCI compliant', 'pci-compliant' ),
78 );
79 fs_require_once_template('secure-https-header.php', $view_params);
80 ?>
81 <div id="fs_checkout" class="wrap fs-section fs-full-size-wrapper">
82 <div id="fs_frame"></div>
83 <script type="text/javascript">
84 (function ($) {
85 $(function () {
86
87 var
88 // Keep track of the i-frame height.
89 frame_height = 800,
90 base_url = '<?php echo FS_CHECKOUT__ADDRESS ?>',
91 // Pass the parent page URL into the i-frame in a meaningful way (this URL could be
92 // passed via query string or hard coded into the child page, it depends on your needs).
93 src = base_url + '/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
94 // Append the i-frame into the DOM.
95 frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent; width: 1px; min-width: 100%;"><\/i' + 'frame>')
96 .appendTo('#fs_frame');
97
98 FS.PostMessage.init(base_url, [frame[0]]);
99 FS.PostMessage.receiveOnce('height', function (data) {
100 var h = data.height;
101 if (!isNaN(h) && h > 0 && h != frame_height) {
102 frame_height = h;
103 frame.height(frame_height + 'px');
104
105 FS.PostMessage.postScroll(frame[0]);
106 }
107 });
108
109 FS.PostMessage.receiveOnce('install', function (data) {
110 var requestData = {
111 user_id : data.user.id,
112 user_secret_key : data.user.secret_key,
113 user_public_key : data.user.public_key,
114 install_id : data.install.id,
115 install_secret_key: data.install.secret_key,
116 install_public_key: data.install.public_key
117 };
118
119 if (true === data.auto_install)
120 requestData.auto_install = true;
121
122 // Post data to activation URL.
123 $.form('<?php echo $fs_checkout->get_install_url( $fs, $plugin_id ); ?>', requestData).submit();
124 });
125
126 FS.PostMessage.receiveOnce('pending_activation', function (data) {
127 var requestData = {
128 user_email : data.user_email,
129 support_email_address: data.support_email_address
130 };
131
132 if (true === data.auto_install)
133 requestData.auto_install = true;
134
135 $.form('<?php echo $fs_checkout->get_pending_activation_url( $fs, $plugin_id ); ?>', requestData).submit();
136 });
137
138 FS.PostMessage.receiveOnce('get_context', function () {
139 console.debug('receiveOnce', 'get_context');
140
141 // If the user didn't connect his account with Freemius,
142 // once he accepts the Terms of Service and Privacy Policy,
143 // and then click the purchase button, the context information
144 // of the user will be shared with Freemius in order to complete the
145 // purchase workflow and activate the license for the right user.
146 <?php $install_data = array_merge( $fs->get_opt_in_params(),
147 array(
148 'activation_url' => fs_nonce_url( $fs->_get_admin_page_url( '',
149 array(
150 'fs_action' => $fs->get_unique_affix() . '_activate_new',
151 'plugin_id' => $plugin_id,
152
153 ) ),
154 $fs->get_unique_affix() . '_activate_new' )
155 ) ) ?>
156 FS.PostMessage.post('context', <?php echo json_encode( $install_data ) ?>, frame[0]);
157 });
158
159 FS.PostMessage.receiveOnce('purchaseCompleted', <?php echo $fs->apply_filters('checkout/purchaseCompleted', 'function (data) {
160 console.log("checkout", "purchaseCompleted");
161 }') ?>);
162
163 FS.PostMessage.receiveOnce('get_dimensions', function (data) {
164 console.debug('receiveOnce', 'get_dimensions');
165
166 FS.PostMessage.post('dimensions', {
167 height : $(document.body).height(),
168 scrollTop: $(document).scrollTop()
169 }, frame[0]);
170 });
171
172 var updateHeight = function () {
173 frame.css('min-height', Math.max($(document.body).height(), $('#wpwrap').height()) + 'px');
174 };
175
176 $(document).ready(updateHeight);
177
178 $(window).resize(updateHeight);
179 });
180 })(jQuery);
181 </script>
182 </div>