PluginProbe
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs / 5.0.1
BlockSpare – Gutenberg Blocks, AI Content Generator & Site Builder for News, Magazine & Blogs v5.0.1
5.0.1 4.1.0 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.2.2 1.2.3 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 2.1.2 2.5.0 2.5.3 All 39 releases
← All changes | freemius/templates/pricing.php +20 -117 1.3.0 → 5.0.1 View file →
@@ -5,42 +5,14 @@
5 5 * @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3
6 6 * @since 1.0.3
7 7 */
8 8
9 - /**
10 - * Note for WordPress.org Theme/Plugin reviewer:
11 - * Freemius is an SDK for plugin and theme developers. Since the core
12 - * of the SDK is relevant both for plugins and themes, for obvious reasons,
13 - * we only develop and maintain one code base.
14 - *
15 - * This code (and page) will not run for wp.org themes (only plugins).
16 - *
17 - * In addition, this page loads an i-frame. We intentionally named it 'frame'
18 - * so it will pass the "Theme Check" that is looking for the string "i" . "frame".
19 - *
20 - * UPDATE:
21 - * After ongoing conversations with the WordPress.org TRT we received
22 - * an official approval for including i-frames in the theme's WP Admin setting's
23 - * page tab (the SDK will never add any i-frames on the sitefront). i-frames
24 - * were never against the guidelines, but we wanted to get the team's blessings
25 - * before we move forward. For the record, I got the final approval from
26 - * Ulrich Pogson (@grapplerulrich), a team lead at the TRT during WordCamp
27 - * Europe 2017 (June 16th, 2017).
28 - *
29 - * If you have any questions or need clarifications, please don't hesitate
30 - * pinging me on slack, my username is @svovaf.
31 - *
32 - * @author Vova Feldman (@svovaf)
33 - * @since 1.2.2
34 - */
35 -
36 9 if ( ! defined( 'ABSPATH' ) ) {
37 10 exit;
38 11 }
39 12
40 13 wp_enqueue_script( 'jquery' );
41 - wp_enqueue_script( 'json2' );
42 - fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
14 + fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.js' );
43 15 fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
44 16 fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
45 17
46 18 /**
@@ -87,29 +59,19 @@
87 59 'plugin_version' => $fs->get_plugin_version(),
88 60 // Billing cycle.
89 61 'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
90 62 'is_network_admin' => fs_is_network_admin() ? 'true' : 'false',
91 - 'currency' => $fs->apply_filters( 'default_currency', 'usd' ),
63 + 'currency' => $fs->apply_filters( 'default_currency', 'usd' ),
64 + 'discounts_model' => $fs->apply_filters( 'pricing/discounts_model', 'absolute' ),
92 65 ) );
93 66
94 - $use_external_pricing = $fs->should_use_external_pricing();
67 + $pricing_js_url = fs_asset_url( $fs->get_pricing_js_path() );
95 68
96 - if ( ! $use_external_pricing ) {
97 - $pricing_js_url = fs_asset_url( $fs->get_pricing_js_path() );
98 - wp_enqueue_script( 'freemius-pricing', $pricing_js_url );
99 - } else {
100 - if ( ! $fs->is_registered() ) {
101 - $template_data = array(
102 - 'id' => $fs->get_id(),
103 - );
104 - fs_require_template( 'forms/trial-start.php', $template_data);
105 - }
69 + wp_enqueue_script( 'freemius-pricing', $pricing_js_url );
106 70
107 - $view_params = array(
108 - 'id' => $VARS['id'],
109 - 'page' => strtolower( $fs->get_text_x_inline( 'Pricing', 'noun', 'pricing' ) ),
110 - );
111 - fs_require_once_template('secure-https-header.php', $view_params);
71 + $pricing_css_path = $fs->apply_filters( 'pricing/css_path', null );
72 + if ( is_string( $pricing_css_path ) ) {
73 + wp_enqueue_style( 'freemius-pricing', fs_asset_url( $pricing_css_path ) );
112 74 }
113 75
114 76 $has_tabs = $fs->_add_tabs_before_content();
115 77
@@ -117,19 +79,17 @@
117 79 $query_params['tabs'] = 'true';
118 80 }
119 81 ?>
120 82 <div id="fs_pricing" class="wrap fs-section fs-full-size-wrapper">
121 - <?php if ( ! $use_external_pricing ) : ?>
122 83 <div id="fs_pricing_wrapper" data-public-url="<?php echo trailingslashit( dirname( $pricing_js_url ) ) ?>"></div>
123 84 <?php
124 85 $pricing_config = array_merge( array(
125 - 'contact_url' => $fs->contact_url(),
126 - 'is_network_admin' => fs_is_network_admin(),
127 - 'is_production' => ( defined( 'WP_FS__IS_PRODUCTION_MODE' ) ? WP_FS__IS_PRODUCTION_MODE : null ),
128 - 'menu_slug' => $fs->get_menu_slug(),
129 - 'mode' => 'dashboard',
130 - 'fs_wp_endpoint_url' => WP_FS__ADDRESS,
131 - 'request_handler_url' => admin_url(
86 + 'contact_url' => $fs->contact_url(),
87 + 'is_production' => ( defined( 'WP_FS__IS_PRODUCTION_MODE' ) ? WP_FS__IS_PRODUCTION_MODE : null ),
88 + 'menu_slug' => $fs->get_menu_slug(),
89 + 'mode' => 'dashboard',
90 + 'fs_wp_endpoint_url' => WP_FS__ADDRESS,
91 + 'request_handler_url' => admin_url(
132 92 'admin-ajax.php?' . http_build_query( array(
133 93 'module_id' => $fs->get_id(),
134 94 'action' => $fs->get_ajax_action( 'pricing_ajax_action' ),
135 95 'security' => $fs->get_ajax_security( 'pricing_ajax_action' )
@@ -134,76 +94,19 @@
134 94 'action' => $fs->get_ajax_action( 'pricing_ajax_action' ),
135 95 'security' => $fs->get_ajax_security( 'pricing_ajax_action' )
136 96 ) )
137 97 ),
138 - 'selector' => '#fs_pricing_wrapper',
139 - 'unique_affix' => $fs->get_unique_affix(),
98 + 'selector' => '#fs_pricing_wrapper',
99 + 'unique_affix' => $fs->get_unique_affix(),
100 + 'show_annual_in_monthly' => $fs->apply_filters( 'pricing/show_annual_in_monthly', true ),
101 + 'license' => $fs->has_active_valid_license() ? $fs->_get_license() : null,
102 + 'plugin_icon' => $fs->get_local_icon_url(),
103 + 'disable_single_package' => $fs->apply_filters( 'pricing/disable_single_package', false ),
140 104 ), $query_params );
141 105
142 106 wp_add_inline_script( 'freemius-pricing', 'Freemius.pricing.new( ' . json_encode( $pricing_config ) . ' )' );
143 107 ?>
144 - <?php else : ?>
145 - <div id="fs_frame"></div>
146 - <form action="" method="POST">
147 - <input type="hidden" name="user_id"/>
148 - <input type="hidden" name="user_email"/>
149 - <input type="hidden" name="site_id"/>
150 - <input type="hidden" name="public_key"/>
151 - <input type="hidden" name="secret_key"/>
152 - <input type="hidden" name="action" value="account"/>
153 - </form>
154 -
155 - <script type="text/javascript">
156 - (function ($, undef) {
157 - $(function () {
158 - var
159 - // Keep track of the i-frame height.
160 - frame_height = 800,
161 - base_url = '<?php echo WP_FS__ADDRESS ?>',
162 - // Pass the parent page URL into the i-frame in a meaningful way (this URL could be
163 - // passed via query string or hard coded into the child page, it depends on your needs).
164 - src = base_url + '/pricing/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
165 -
166 - // Append the I-frame into the DOM.
167 - 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>')
168 - .appendTo('#fs_frame');
169 -
170 - FS.PostMessage.init(base_url, [frame[0]]);
171 -
172 - FS.PostMessage.receive('height', function (data) {
173 - var h = data.height;
174 - if (!isNaN(h) && h > 0 && h != frame_height) {
175 - frame_height = h;
176 - frame.height(frame_height + 'px');
177 -
178 - FS.PostMessage.postScroll(frame[0]);
179 - }
180 - });
181 -
182 - FS.PostMessage.receive('get_dimensions', function (data) {
183 - FS.PostMessage.post('dimensions', {
184 - height : $(document.body).height(),
185 - scrollTop: $(document).scrollTop()
186 - }, frame[0]);
187 - });
188 -
189 - FS.PostMessage.receive('start_trial', function (data) {
190 - openTrialConfirmationModal(data);
191 - });
192 - });
193 - })(jQuery);
194 - </script>
195 - <?php endif ?>
196 108 </div>
197 109 <?php
198 110 if ( $has_tabs ) {
199 111 $fs->_add_tabs_after_content();
200 112 }
201 -
202 - $params = array(
203 - 'page' => 'pricing',
204 - 'module_id' => $fs->get_id(),
205 - 'module_type' => $fs->get_module_type(),
206 - 'module_slug' => $slug,
207 - 'module_version' => $fs->get_plugin_version(),
208 - );
209 - fs_require_template( 'powered-by.php', $params );