PluginProbe
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder / 1.5
Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder v1.5
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
buttonizer-multifunctional-button / freemius / templates / add-ons.php

add-ons.php in Buttonizer – Floating Menus, Sticky Buttons, & Popup Builder 1.5, at freemius/templates/add-ons.php

193 lines 6.2 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 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 * @var Freemius
16 */
17 $fs = freemius( $VARS['id'] );
18
19 $slug = $fs->get_slug();
20
21 $open_addon_slug = fs_request_get( 'slug' );
22
23 $open_addon = false;
24
25 /**
26 * @var FS_Plugin[]
27 */
28 $addons = $fs->get_addons();
29
30 $has_addons = ( is_array( $addons ) && 0 < count( $addons ) );
31
32 $has_tabs = $fs->_add_tabs_before_content();
33 ?>
34 <div id="fs_addons" class="wrap fs-section">
35 <?php if ( ! $has_tabs ) : ?>
36 <h2><?php echo esc_html( sprintf( fs_text_inline( 'Add Ons for %s', 'add-ons-for-x', $slug ), $fs->get_plugin_name() ) ) ?></h2>
37 <?php endif ?>
38
39 <div id="poststuff">
40 <?php if ( ! $has_addons ) : ?>
41 <h3><?php echo esc_html( sprintf(
42 '%s... %s',
43 fs_text_x_inline( 'Oops', 'exclamation', 'oops', $slug ),
44 fs_text_inline( 'We could\'nt load the add-ons list. It\'s probably an issue on our side, please try to come back in few minutes.', 'add-ons-missing', $slug )
45 ) ) ?></h3>
46 <?php endif ?>
47 <ul class="fs-cards-list">
48 <?php if ( $has_addons ) : ?>
49 <?php foreach ( $addons as $addon ) : ?>
50 <?php
51 $open_addon = ( $open_addon || ( $open_addon_slug === $addon->slug ) );
52
53 $price = 0;
54 $has_trial = false;
55 $has_free_plan = false;
56 $has_paid_plan = false;
57
58 $result = $fs->get_api_plugin_scope()->get( "/addons/{$addon->id}/pricing.json?type=visible" );
59 if ( ! isset( $result->error ) ) {
60 $plans = $result->plans;
61
62 if ( is_array( $plans ) && 0 < count( $plans ) ) {
63 foreach ( $plans as $plan ) {
64 if ( ! isset( $plan->pricing ) ||
65 ! is_array( $plan->pricing ) ||
66 0 == count( $plan->pricing )
67 ) {
68 // No pricing means a free plan.
69 $has_free_plan = true;
70 continue;
71 }
72
73
74 $has_paid_plan = true;
75 $has_trial = $has_trial || ( is_numeric( $plan->trial_period ) && ( $plan->trial_period > 0 ) );
76
77 $min_price = 999999;
78 foreach ( $plan->pricing as $pricing ) {
79 if ( ! is_null( $pricing->annual_price ) && $pricing->annual_price > 0 ) {
80 $min_price = min( $min_price, $pricing->annual_price );
81 } else if ( ! is_null( $pricing->monthly_price ) && $pricing->monthly_price > 0 ) {
82 $min_price = min( $min_price, 12 * $pricing->monthly_price );
83 }
84 }
85
86 if ( $min_price < 999999 ) {
87 $price = $min_price;
88 }
89
90 }
91 }
92 }
93 ?>
94 <li class="fs-card fs-addon" data-slug="<?php echo $addon->slug ?>">
95 <?php
96 echo sprintf( '<a href="%s" class="thickbox fs-overlay" aria-label="%s" data-title="%s"></a>',
97 esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&parent_plugin_id=' . $fs->get_id() . '&plugin=' . $addon->slug .
98 '&TB_iframe=true&width=600&height=550' ) ),
99 esc_attr( sprintf( fs_text_inline( 'More information about %s', 'more-information-about-x', $slug ), $addon->title ) ),
100 esc_attr( $addon->title )
101 );
102 ?>
103 <?php
104 if ( is_null( $addon->info ) ) {
105 $addon->info = new stdClass();
106 }
107 if ( ! isset( $addon->info->card_banner_url ) ) {
108 $addon->info->card_banner_url = '//dashboard.freemius.com/assets/img/marketing/blueprint-300x100.jpg';
109 }
110 if ( ! isset( $addon->info->short_description ) ) {
111 $addon->info->short_description = 'What\'s the one thing your add-on does really, really well?';
112 }
113 ?>
114 <div class="fs-inner">
115 <ul>
116 <li class="fs-card-banner"
117 style="background-image: url('<?php echo $addon->info->card_banner_url ?>');"></li>
118 <!-- <li class="fs-tag"></li> -->
119 <li class="fs-title"><?php echo $addon->title ?></li>
120 <li class="fs-offer">
121 <span
122 class="fs-price"><?php
123 $descriptors = array();
124
125 if ($has_free_plan)
126 $descriptors[] = fs_text_inline( 'Free', 'free', $slug );
127 if ($has_paid_plan && $price > 0)
128 $descriptors[] = '$' . number_format( $price, 2 );
129 if ($has_trial)
130 $descriptors[] = fs_text_x_inline( 'Trial', 'trial period', 'trial', $slug );
131
132 echo implode(' - ', $descriptors) ?></span>
133 </li>
134 <li class="fs-description"><?php echo ! empty( $addon->info->short_description ) ? $addon->info->short_description : 'SHORT DESCRIPTION' ?></li>
135 <li class="fs-cta"><a class="button"><?php fs_esc_html_echo_inline( 'View details', 'view-details', $slug ) ?></a></li>
136 </ul>
137 </div>
138 </li>
139 <?php endforeach ?>
140 <?php endif ?>
141 </ul>
142 </div>
143 </div>
144 <script type="text/javascript">
145 (function ($) {
146 <?php if ( $open_addon ) : ?>
147
148 var interval = setInterval(function () {
149 // Open add-on information page.
150 <?php
151 /**
152 * @author Vova Feldman
153 *
154 * This code does NOT expose an XSS vulnerability because:
155 * 1. This page only renders for admins, so if an attacker manage to get
156 * admin access, they can do more harm.
157 * 2. This code won't be rendered unless $open_addon_slug matches any of
158 * the plugin's add-ons slugs.
159 */
160 ?>
161 $('.fs-card[data-slug=<?php echo $open_addon_slug ?>] a').click();
162 if ($('#TB_iframeContent').length > 0) {
163 clearInterval(interval);
164 interval = null;
165 }
166 }, 200);
167
168 <?php else : ?>
169
170
171 $('.fs-card.fs-addon')
172 .mouseover(function () {
173 $(this).find('.fs-cta .button').addClass('button-primary');
174 }).mouseout(function () {
175 $(this).find('.fs-cta .button').removeClass('button-primary');
176 });
177
178 <?php endif ?>
179 })(jQuery);
180 </script>
181 <?php
182 if ( $has_tabs ) {
183 $fs->_add_tabs_after_content();
184 }
185
186 $params = array(
187 'page' => 'addons',
188 'module_id' => $fs->get_id(),
189 'module_type' => $fs->get_module_type(),
190 'module_slug' => $slug,
191 'module_version' => $fs->get_plugin_version(),
192 );
193 fs_require_template( 'powered-by.php', $params );