PluginProbe
Tiered Pricing Table for WooCommerce / 2.1
Tiered Pricing Table for WooCommerce v2.1
7.1.7 7.1.5 7.1.4 7.1.1 6.5.0 6.4.0 6.1.0 trunk 1.0 1.1 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.2.0 2.2.1 2.2.2 2.2.3 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 All 90 releases
tier-pricing-table / freemius / templates / pricing.php

pricing.php in Tiered Pricing Table for WooCommerce 2.1, at freemius/templates/pricing.php

171 lines 5.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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 * 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 if ( ! defined( 'ABSPATH' ) ) {
37 exit;
38 }
39
40 wp_enqueue_script( 'jquery' );
41 wp_enqueue_script( 'json2' );
42 fs_enqueue_local_script( 'postmessage', 'nojquery.ba-postmessage.min.js' );
43 fs_enqueue_local_script( 'fs-postmessage', 'postmessage.js' );
44 fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
45
46 /**
47 * @var array $VARS
48 * @var Freemius $fs
49 */
50 $fs = freemius( $VARS['id'] );
51 $slug = $fs->get_slug();
52 $timestamp = time();
53
54 $context_params = array(
55 'plugin_id' => $fs->get_id(),
56 'plugin_public_key' => $fs->get_public_key(),
57 'plugin_version' => $fs->get_plugin_version(),
58 );
59
60 // Get site context secure params.
61 if ( $fs->is_registered() ) {
62 $context_params = array_merge( $context_params, FS_Security::instance()->get_context_params(
63 $fs->get_site(),
64 $timestamp,
65 'upgrade'
66 ) );
67 } else {
68 $context_params['home_url'] = home_url();
69 }
70
71 if ( $fs->is_payments_sandbox() ) // Append plugin secure token for sandbox mode authentication.)
72 {
73 $context_params['sandbox'] = FS_Security::instance()->get_secure_token(
74 $fs->get_plugin(),
75 $timestamp,
76 'checkout'
77 );
78 }
79
80 $query_params = array_merge( $context_params, $_GET, array(
81 'next' => $fs->_get_sync_license_url( false, false ),
82 'plugin_version' => $fs->get_plugin_version(),
83 // Billing cycle.
84 'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
85 'is_network_admin' => fs_is_network_admin() ? 'true' : 'false',
86 ) );
87
88 if ( ! $fs->is_registered() ) {
89 $template_data = array(
90 'id' => $fs->get_id(),
91 );
92 fs_require_template( 'forms/trial-start.php', $template_data);
93 }
94
95 $view_params = array(
96 'id' => $VARS['id'],
97 'page' => strtolower( $fs->get_text_x_inline( 'Pricing', 'noun', 'pricing' ) ),
98 );
99 fs_require_once_template('secure-https-header.php', $view_params);
100
101 $has_tabs = $fs->_add_tabs_before_content();
102
103 if ( $has_tabs ) {
104 $query_params['tabs'] = 'true';
105 }
106 ?>
107 <div id="fs_pricing" class="wrap fs-section fs-full-size-wrapper">
108 <div id="fs_frame"></div>
109 <form action="" method="POST">
110 <input type="hidden" name="user_id"/>
111 <input type="hidden" name="user_email"/>
112 <input type="hidden" name="site_id"/>
113 <input type="hidden" name="public_key"/>
114 <input type="hidden" name="secret_key"/>
115 <input type="hidden" name="action" value="account"/>
116 </form>
117
118 <script type="text/javascript">
119 (function ($, undef) {
120 $(function () {
121 var
122 // Keep track of the i-frame height.
123 frame_height = 800,
124 base_url = '<?php echo WP_FS__ADDRESS ?>',
125 // Pass the parent page URL into the i-frame in a meaningful way (this URL could be
126 // passed via query string or hard coded into the child page, it depends on your needs).
127 src = base_url + '/pricing/?<?php echo http_build_query( $query_params ) ?>#' + encodeURIComponent(document.location.href),
128
129 // Append the I-frame into the DOM.
130 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>')
131 .appendTo('#fs_frame');
132
133 FS.PostMessage.init(base_url, [frame[0]]);
134
135 FS.PostMessage.receive('height', function (data) {
136 var h = data.height;
137 if (!isNaN(h) && h > 0 && h != frame_height) {
138 frame_height = h;
139 frame.height(frame_height + 'px');
140
141 FS.PostMessage.postScroll(frame[0]);
142 }
143 });
144
145 FS.PostMessage.receive('get_dimensions', function (data) {
146 FS.PostMessage.post('dimensions', {
147 height : $(document.body).height(),
148 scrollTop: $(document).scrollTop()
149 }, frame[0]);
150 });
151
152 FS.PostMessage.receive('start_trial', function (data) {
153 openTrialConfirmationModal(data);
154 });
155 });
156 })(jQuery);
157 </script>
158 </div>
159 <?php
160 if ( $has_tabs ) {
161 $fs->_add_tabs_after_content();
162 }
163
164 $params = array(
165 'page' => 'pricing',
166 'module_id' => $fs->get_id(),
167 'module_type' => $fs->get_module_type(),
168 'module_slug' => $slug,
169 'module_version' => $fs->get_plugin_version(),
170 );
171 fs_require_template( 'powered-by.php', $params );