PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / 3.6.0
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder v3.6.0
3.6.0 3.5.0 trunk 1.0.10 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.6.1 1.0.7 1.0.8 1.0.9 1.1 1.1.1 1.2 1.3 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.5 1.5.1 All 110 releases
← All changes | freemius/templates/pricing.php +47 -98 1.4.23.6.0 View file →
@@ -5,35 +5,8 @@
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
@@ -38,11 +11,16 @@
38 11 }
39 12
40 13 wp_enqueue_script( 'jquery' );
41 14 wp_enqueue_script( 'json2' );
42 - fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
15 + fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.js' );
43 16 fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
17 + fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
44 18
19 + /**
20 + * @var array $VARS
21 + * @var Freemius $fs
22 + */
45 23 $fs = freemius( $VARS['id'] );
46 24 $slug = $fs->get_slug();
47 25 $timestamp = time();
48 26
@@ -51,8 +29,13 @@
51 29 'plugin_public_key' => $fs->get_public_key(),
52 30 'plugin_version' => $fs->get_plugin_version(),
53 31 );
54 32
33 + $bundle_id = $fs->get_bundle_id();
34 + if ( ! is_null( $bundle_id ) ) {
35 + $context_params['bundle_id'] = $bundle_id;
36 + }
37 +
55 38 // Get site context secure params.
56 39 if ( $fs->is_registered() ) {
57 40 $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
58 41 $fs->get_site(),
@@ -72,27 +55,25 @@
72 55 );
73 56 }
74 57
75 58 $query_params = array_merge( $context_params, $_GET, array(
76 - 'next' => $fs->_get_sync_license_url( false, false ),
77 - 'plugin_version' => $fs->get_plugin_version(),
59 + 'next' => $fs->_get_sync_license_url( false, false ),
60 + 'plugin_version' => $fs->get_plugin_version(),
78 61 // Billing cycle.
79 - 'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
62 + 'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
63 + 'is_network_admin' => fs_is_network_admin() ? 'true' : 'false',
64 + 'currency' => $fs->apply_filters( 'default_currency', 'usd' ),
65 + 'discounts_model' => $fs->apply_filters( 'pricing/discounts_model', 'absolute' ),
80 66 ) );
81 67
68 + $pricing_js_url = fs_asset_url( $fs->get_pricing_js_path() );
82 69
83 - if ( ! $fs->is_registered() ) {
84 - $template_data = array(
85 - 'id' => $fs->get_id(),
86 - );
87 - fs_require_template( 'forms/trial-start.php', $template_data);
88 - }
70 + wp_enqueue_script( 'freemius-pricing', $pricing_js_url );
89 71
90 - $view_params = array(
91 - 'id' => $VARS['id'],
92 - 'page' => strtolower( $fs->get_text_x_inline( 'Pricing', 'noun', 'pricing' ) ),
93 - );
94 - fs_require_once_template('secure-https-header.php', $view_params);
72 + $pricing_css_path = $fs->apply_filters( 'pricing/css_path', null );
73 + if ( is_string( $pricing_css_path ) ) {
74 + wp_enqueue_style( 'freemius-pricing', fs_asset_url( $pricing_css_path ) );
75 + }
95 76
96 77 $has_tabs = $fs->_add_tabs_before_content();
97 78
98 79 if ( $has_tabs ) {
@@ -99,66 +80,34 @@
99 80 $query_params['tabs'] = 'true';
100 81 }
101 82 ?>
102 83 <div id="fs_pricing" class="wrap fs-section fs-full-size-wrapper">
103 - <div id="frame"></div>
104 - <form action="" method="POST">
105 - <input type="hidden" name="user_id"/>
106 - <input type="hidden" name="user_email"/>
107 - <input type="hidden" name="site_id"/>
108 - <input type="hidden" name="public_key"/>
109 - <input type="hidden" name="secret_key"/>
110 - <input type="hidden" name="action" value="account"/>
111 - </form>
84 + <div id="fs_pricing_wrapper" data-public-url="<?php echo trailingslashit( dirname( $pricing_js_url ) ) ?>"></div>
85 + <?php
86 + $pricing_config = array_merge( array(
87 + 'contact_url' => $fs->contact_url(),
88 + 'is_production' => ( defined( 'WP_FS__IS_PRODUCTION_MODE' ) ? WP_FS__IS_PRODUCTION_MODE : null ),
89 + 'menu_slug' => $fs->get_menu_slug(),
90 + 'mode' => 'dashboard',
91 + 'fs_wp_endpoint_url' => WP_FS__ADDRESS,
92 + 'request_handler_url' => admin_url(
93 + 'admin-ajax.php?' . http_build_query( array(
94 + 'module_id' => $fs->get_id(),
95 + 'action' => $fs->get_ajax_action( 'pricing_ajax_action' ),
96 + 'security' => $fs->get_ajax_security( 'pricing_ajax_action' )
97 + ) )
98 + ),
99 + 'selector' => '#fs_pricing_wrapper',
100 + 'unique_affix' => $fs->get_unique_affix(),
101 + 'show_annual_in_monthly' => $fs->apply_filters( 'pricing/show_annual_in_monthly', true ),
102 + 'license' => $fs->has_active_valid_license() ? $fs->_get_license() : null,
103 + 'plugin_icon' => $fs->get_local_icon_url(),
104 + 'disable_single_package' => $fs->apply_filters( 'pricing/disable_single_package', false ),
105 + ), $query_params );
112 106
113 - <script type="text/javascript">
114 - (function ($, undef) {
115 - $(function () {
116 - var
117 - // Keep track of the i-frame height.
118 - frame_height = 800,
119 - base_url = '<?php echo WP_FS__ADDRESS ?>',
120 - // Pass the parent page URL into the i-frame in a meaningful way (this URL could be
121 - // passed via query string or hard coded into the child page, it depends on your needs).
122 - src = base_url + '/pricing/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
123 -
124 - // Append the I-frame into the DOM.
125 - frame = $('<i' + 'frame " src="' + src + '" width="100%" height="' + frame_height + 'px" scrolling="no" frameborder="0" style="background: transparent;"><\/i' + 'frame>')
126 - .appendTo('#frame');
127 -
128 - FS.PostMessage.init(base_url);
129 -
130 - FS.PostMessage.receive('height', function (data) {
131 - var h = data.height;
132 - if (!isNaN(h) && h > 0 && h != frame_height) {
133 - frame_height = h;
134 - $('#frame i' + 'frame').height(frame_height + 'px');
135 - }
136 - });
137 -
138 - FS.PostMessage.receive('get_dimensions', function (data) {
139 - FS.PostMessage.post('dimensions', {
140 - height : $(document.body).height(),
141 - scrollTop: $(document).scrollTop()
142 - }, frame[0]);
143 - });
144 -
145 - FS.PostMessage.receive('start_trial', function (data) {
146 - openTrialConfirmationModal(data);
147 - });
148 - });
149 - })(jQuery);
150 - </script>
107 + wp_add_inline_script( 'freemius-pricing', 'Freemius.pricing.new( ' . json_encode( $pricing_config ) . ' )' );
108 + ?>
151 109 </div>
152 110 <?php
153 111 if ( $has_tabs ) {
154 112 $fs->_add_tabs_after_content();
155 113 }
156 -
157 - $params = array(
158 - 'page' => 'pricing',
159 - 'module_id' => $fs->get_id(),
160 - 'module_type' => $fs->get_module_type(),
161 - 'module_slug' => $slug,
162 - 'module_version' => $fs->get_plugin_version(),
163 - );
164 - fs_require_template( 'powered-by.php', $params );