PluginProbe
Passster – Password Protect Pages and Content / 4.3.17
Passster – Password Protect Pages and Content v4.3.17
4.3.17 4.3.16 4.3.15 4.3.14 4.3.12 4.3.13 4.3.11 4.3.10 4.3.9 4.3.8 4.3.7 4.3.6 4.3.5 trunk 3.5.4 3.5.5.2 3.5.5.8 3.5.5.9 4.0 4.1.4 4.2.10 4.2.11 4.2.12 4.2.13 4.2.14 All 49 releases
← All changes | inc/freemius/templates/checkout/frame.php +180 -181 4.2.13 → 4.3.17 View file →
@@ -1,182 +1,181 @@
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>
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>
182 181 </div>