PluginProbe ʕ •ᴥ•ʔ
Auto Post Cleaner / 3.13.1
Auto Post Cleaner v3.13.1
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 2 months ago process-redirect.php 2 months ago redirect.php 1 year ago
frame.php
181 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 fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.js' );
39 fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
40 fs_enqueue_local_script( 'fs-form', 'jquery.form.js', array( 'jquery' ) );
41
42 /**
43 * @var array $VARS
44 * @var Freemius $fs
45 */
46 $fs = freemius( $VARS['id'] );
47 $slug = $fs->get_slug();
48
49 $fs_checkout = FS_Checkout_Manager::instance();
50
51 $plugin_id = fs_request_get( 'plugin_id' );
52 if ( ! FS_Plugin::is_valid_id( $plugin_id ) ) {
53 $plugin_id = $fs->get_id();
54 }
55
56 $plan_id = fs_request_get( 'plan_id' );
57 $licenses = fs_request_get( 'licenses' );
58
59 $query_params = $fs_checkout->get_query_params(
60 $fs,
61 $plugin_id,
62 $plan_id,
63 $licenses
64 );
65
66 $return_url = $fs->_get_sync_license_url( $plugin_id );
67 $query_params['return_url'] = $return_url;
68
69 $xdebug_session = fs_request_get( 'XDEBUG_SESSION' );
70 if ( false !== $xdebug_session ) {
71 $query_params['XDEBUG_SESSION'] = $xdebug_session;
72 }
73
74 $view_params = array(
75 'id' => $VARS['id'],
76 'page' => strtolower( $fs->get_text_inline( 'Checkout', 'checkout' ) ) . ' ' . $fs->get_text_inline( 'PCI compliant', 'pci-compliant' ),
77 );
78 fs_require_once_template('secure-https-header.php', $view_params);
79 ?>
80 <div id="fs_checkout" class="wrap fs-section fs-full-size-wrapper">
81 <div id="fs_frame"></div>
82 <script type="text/javascript">
83 (function ($) {
84 $(function () {
85
86 var
87 // Keep track of the i-frame height.
88 frame_height = 800,
89 base_url = '<?php echo FS_CHECKOUT__ADDRESS ?>',
90 // Pass the parent page URL into the i-frame in a meaningful way (this URL could be
91 // passed via query string or hard coded into the child page, it depends on your needs).
92 src = base_url + '/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
93 // Append the i-frame into the DOM.
94 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>')
95 .appendTo('#fs_frame');
96
97 FS.PostMessage.init(base_url, [frame[0]]);
98 FS.PostMessage.receiveOnce('height', function (data) {
99 var h = data.height;
100 if (!isNaN(h) && h > 0 && h != frame_height) {
101 frame_height = h;
102 frame.height(frame_height + 'px');
103
104 FS.PostMessage.postScroll(frame[0]);
105 }
106 });
107
108 FS.PostMessage.receiveOnce('install', function (data) {
109 var requestData = {
110 user_id : data.user.id,
111 user_secret_key : data.user.secret_key,
112 user_public_key : data.user.public_key,
113 install_id : data.install.id,
114 install_secret_key: data.install.secret_key,
115 install_public_key: data.install.public_key
116 };
117
118 if (true === data.auto_install)
119 requestData.auto_install = true;
120
121 // Post data to activation URL.
122 $.form('<?php echo $fs_checkout->get_install_url( $fs, $plugin_id ); ?>', requestData).submit();
123 });
124
125 FS.PostMessage.receiveOnce('pending_activation', function (data) {
126 var requestData = {
127 user_email : data.user_email,
128 support_email_address: data.support_email_address
129 };
130
131 if (true === data.auto_install)
132 requestData.auto_install = true;
133
134 $.form('<?php echo $fs_checkout->get_pending_activation_url( $fs, $plugin_id ); ?>', requestData).submit();
135 });
136
137 FS.PostMessage.receiveOnce('get_context', function () {
138 console.debug('receiveOnce', 'get_context');
139
140 // If the user didn't connect his account with Freemius,
141 // once he accepts the Terms of Service and Privacy Policy,
142 // and then click the purchase button, the context information
143 // of the user will be shared with Freemius in order to complete the
144 // purchase workflow and activate the license for the right user.
145 <?php $install_data = array_merge( $fs->get_opt_in_params(),
146 array(
147 'activation_url' => fs_nonce_url( $fs->_get_admin_page_url( '',
148 array(
149 'fs_action' => $fs->get_unique_affix() . '_activate_new',
150 'plugin_id' => $plugin_id,
151
152 ) ),
153 $fs->get_unique_affix() . '_activate_new' )
154 ) ) ?>
155 FS.PostMessage.post('context', <?php echo json_encode( $install_data ) ?>, frame[0]);
156 });
157
158 FS.PostMessage.receiveOnce('purchaseCompleted', <?php echo $fs->apply_filters('checkout/purchaseCompleted', 'function (data) {
159 console.log("checkout", "purchaseCompleted");
160 }') ?>);
161
162 FS.PostMessage.receiveOnce('get_dimensions', function (data) {
163 console.debug('receiveOnce', 'get_dimensions');
164
165 FS.PostMessage.post('dimensions', {
166 height : $(document.body).height(),
167 scrollTop: $(document).scrollTop()
168 }, frame[0]);
169 });
170
171 var updateHeight = function () {
172 frame.css('min-height', Math.max($(document.body).height(), $('#wpwrap').height()) + 'px');
173 };
174
175 $(document).ready(updateHeight);
176
177 $(window).resize(updateHeight);
178 });
179 })(jQuery);
180 </script>
181 </div>