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/includes/customizer/class-fs-customizer-upsell-control.php +159 -160 4.2.13 → 4.3.17 View file →
@@ -1,161 +1,160 @@
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.2.2.7
7 - */
8 -
9 - if ( ! defined( 'ABSPATH' ) ) {
10 - exit;
11 - }
12 -
13 - /**
14 - * Class FS_Customizer_Upsell_Control
15 - */
16 - class FS_Customizer_Upsell_Control extends WP_Customize_Control {
17 -
18 - /**
19 - * Control type
20 - *
21 - * @var string control type
22 - */
23 - public $type = 'freemius-upsell-control';
24 -
25 - /**
26 - * @var Freemius
27 - */
28 - public $fs = null;
29 -
30 - /**
31 - * @param WP_Customize_Manager $manager the customize manager class.
32 - * @param string $id id.
33 - * @param array $args customizer manager parameters.
34 - */
35 - public function __construct( WP_Customize_Manager $manager, $id, array $args ) {
36 - $manager->register_control_type( 'FS_Customizer_Upsell_Control' );
37 -
38 - parent::__construct( $manager, $id, $args );
39 - }
40 -
41 - /**
42 - * Enqueue resources for the control.
43 - */
44 - public function enqueue() {
45 - fs_enqueue_local_style( 'fs_customizer', 'customizer.css' );
46 - }
47 -
48 - /**
49 - * Json conversion
50 - */
51 - public function to_json() {
52 - $pricing_cta = esc_html( $this->fs->get_pricing_cta_label() ) . '&nbsp;&nbsp;' . ( is_rtl() ? '&#x2190;' : '&#x27a4;' );
53 -
54 - parent::to_json();
55 -
56 - $this->json['button_text'] = $pricing_cta;
57 - $this->json['button_url'] = $this->fs->is_in_trial_promotion() ?
58 - $this->fs->get_trial_url() :
59 - $this->fs->get_upgrade_url();
60 -
61 - $api = FS_Plugin::is_valid_id( $this->fs->get_bundle_id() ) ?
62 - $this->fs->get_api_bundle_scope() :
63 - $this->fs->get_api_plugin_scope();
64 -
65 - // Load features.
66 - $pricing = $api->get( $this->fs->add_show_pending( "pricing.json" ) );
67 -
68 - if ( $this->fs->is_api_result_object( $pricing, 'plans' ) ) {
69 - // Add support features.
70 - if ( is_array( $pricing->plans ) && 0 < count( $pricing->plans ) ) {
71 - $support_features = array(
72 - 'kb' => 'Help Center',
73 - 'forum' => 'Support Forum',
74 - 'email' => 'Priority Email Support',
75 - 'phone' => 'Phone Support',
76 - 'skype' => 'Skype Support',
77 - 'is_success_manager' => 'Personal Success Manager',
78 - );
79 -
80 - for ( $i = 0, $len = count( $pricing->plans ); $i < $len; $i ++ ) {
81 - if ( 'free' == $pricing->plans[$i]->name ) {
82 - continue;
83 - }
84 -
85 - if ( ! isset( $pricing->plans[ $i ]->features ) ||
86 - ! is_array( $pricing->plans[ $i ]->features ) ) {
87 - $pricing->plans[$i]->features = array();
88 - }
89 -
90 - foreach ( $support_features as $key => $label ) {
91 - $key = ( 'is_success_manager' !== $key ) ?
92 - "support_{$key}" :
93 - $key;
94 -
95 - if ( ! empty( $pricing->plans[ $i ]->{$key} ) ) {
96 -
97 - $support_feature = new stdClass();
98 - $support_feature->title = $label;
99 -
100 - $pricing->plans[ $i ]->features[] = $support_feature;
101 - }
102 - }
103 - }
104 -
105 - $this->json['plans'] = $pricing->plans;
106 - }
107 - }
108 -
109 - $this->json['strings'] = array(
110 - 'plan' => $this->fs->get_text_x_inline( 'Plan', 'as product pricing plan', 'plan' ),
111 - );
112 - }
113 -
114 - /**
115 - * Control content
116 - */
117 - public function content_template() {
118 - ?>
119 - <div id="fs_customizer_upsell">
120 - <# if ( data.plans ) { #>
121 - <ul class="fs-customizer-plans">
122 - <# for (i in data.plans) { #>
123 - <# if ( 'free' != data.plans[i].name && (null != data.plans[i].features && 0 < data.plans[i].features.length) ) { #>
124 - <li class="fs-customizer-plan">
125 - <div class="fs-accordion-section-open">
126 - <h2 class="fs-accordion-section-title menu-item">
127 - <span>{{ data.plans[i].title }}</span>
128 - <button type="button" class="button-link item-edit" aria-expanded="true">
129 - <span class="screen-reader-text">Toggle section: {{ data.plans[i].title }} {{ data.strings.plan }}</span>
130 - <span class="toggle-indicator" aria-hidden="true"></span>
131 - </button>
132 - </h2>
133 - <div class="fs-accordion-section-content">
134 - <# if ( data.plans[i].description ) { #>
135 - <h3>{{ data.plans[i].description }}</h3>
136 - <# } #>
137 - <# if ( data.plans[i].features ) { #>
138 - <ul>
139 - <# for ( j in data.plans[i].features ) { #>
140 - <li><div class="fs-feature">
141 - <span class="dashicons dashicons-yes"></span><span><# if ( data.plans[i].features[j].value ) { #>{{ data.plans[i].features[j].value }} <# } #>{{ data.plans[i].features[j].title }}</span>
142 - <# if ( data.plans[i].features[j].description ) { #>
143 - <span class="dashicons dashicons-editor-help"><span class="fs-feature-desc">{{ data.plans[i].features[j].description }}</span></span>
144 - <# } #>
145 - </div></li>
146 - <# } #>
147 - </ul>
148 - <# } #>
149 - <# if ( 'free' != data.plans[i].name ) { #>
150 - <a href="{{ data.button_url }}" class="button button-primary" target="_blank">{{{ data.button_text }}}</a>
151 - <# } #>
152 - </div>
153 - </div>
154 - </li>
155 - <# } #>
156 - <# } #>
157 - </ul>
158 - <# } #>
159 - </div>
160 - <?php }
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.2.2.7
7 + */
8 +
9 + if ( ! defined( 'ABSPATH' ) ) {
10 + exit;
11 + }
12 +
13 + /**
14 + * Class FS_Customizer_Upsell_Control
15 + */
16 + class FS_Customizer_Upsell_Control extends WP_Customize_Control {
17 +
18 + /**
19 + * Control type
20 + *
21 + * @var string control type
22 + */
23 + public $type = 'freemius-upsell-control';
24 +
25 + /**
26 + * @var Freemius
27 + */
28 + public $fs = null;
29 +
30 + /**
31 + * @param WP_Customize_Manager $manager the customize manager class.
32 + * @param string $id id.
33 + * @param array $args customizer manager parameters.
34 + */
35 + public function __construct( WP_Customize_Manager $manager, $id, array $args ) {
36 + $manager->register_control_type( 'FS_Customizer_Upsell_Control' );
37 +
38 + parent::__construct( $manager, $id, $args );
39 + }
40 +
41 + /**
42 + * Enqueue resources for the control.
43 + */
44 + public function enqueue() {
45 + fs_enqueue_local_style( 'fs_customizer', 'customizer.css' );
46 + }
47 +
48 + /**
49 + * Json conversion
50 + */
51 + public function to_json() {
52 + $pricing_cta = esc_html( $this->fs->get_pricing_cta_label() ) . '&nbsp;&nbsp;' . ( is_rtl() ? '&#x2190;' : '&#x27a4;' );
53 +
54 + parent::to_json();
55 +
56 + $this->json['button_text'] = $pricing_cta;
57 + $this->json['button_url'] = $this->fs->is_in_trial_promotion() ?
58 + $this->fs->get_trial_url() :
59 + $this->fs->get_upgrade_url();
60 +
61 + $api = FS_Plugin::is_valid_id( $this->fs->get_bundle_id() ) ?
62 + $this->fs->get_api_bundle_scope() :
63 + $this->fs->get_api_plugin_scope();
64 +
65 + // Load features.
66 + $pricing = $api->get( $this->fs->add_show_pending( "pricing.json" ) );
67 +
68 + if ( $this->fs->is_api_result_object( $pricing, 'plans' ) ) {
69 + // Add support features.
70 + if ( is_array( $pricing->plans ) && 0 < count( $pricing->plans ) ) {
71 + $support_features = array(
72 + 'kb' => 'Help Center',
73 + 'forum' => 'Support Forum',
74 + 'email' => 'Priority Email Support',
75 + 'phone' => 'Phone Support',
76 + 'is_success_manager' => 'Personal Success Manager',
77 + );
78 +
79 + for ( $i = 0, $len = count( $pricing->plans ); $i < $len; $i ++ ) {
80 + if ( 'free' == $pricing->plans[$i]->name ) {
81 + continue;
82 + }
83 +
84 + if ( ! isset( $pricing->plans[ $i ]->features ) ||
85 + ! is_array( $pricing->plans[ $i ]->features ) ) {
86 + $pricing->plans[$i]->features = array();
87 + }
88 +
89 + foreach ( $support_features as $key => $label ) {
90 + $key = ( 'is_success_manager' !== $key ) ?
91 + "support_{$key}" :
92 + $key;
93 +
94 + if ( ! empty( $pricing->plans[ $i ]->{$key} ) ) {
95 +
96 + $support_feature = new stdClass();
97 + $support_feature->title = $label;
98 +
99 + $pricing->plans[ $i ]->features[] = $support_feature;
100 + }
101 + }
102 + }
103 +
104 + $this->json['plans'] = $pricing->plans;
105 + }
106 + }
107 +
108 + $this->json['strings'] = array(
109 + 'plan' => $this->fs->get_text_x_inline( 'Plan', 'as product pricing plan', 'plan' ),
110 + );
111 + }
112 +
113 + /**
114 + * Control content
115 + */
116 + public function content_template() {
117 + ?>
118 + <div id="fs_customizer_upsell">
119 + <# if ( data.plans ) { #>
120 + <ul class="fs-customizer-plans">
121 + <# for (i in data.plans) { #>
122 + <# if ( 'free' != data.plans[i].name && (null != data.plans[i].features && 0 < data.plans[i].features.length) ) { #>
123 + <li class="fs-customizer-plan">
124 + <div class="fs-accordion-section-open">
125 + <h2 class="fs-accordion-section-title menu-item">
126 + <span>{{ data.plans[i].title }}</span>
127 + <button type="button" class="button-link item-edit" aria-expanded="true">
128 + <span class="screen-reader-text">Toggle section: {{ data.plans[i].title }} {{ data.strings.plan }}</span>
129 + <span class="toggle-indicator" aria-hidden="true"></span>
130 + </button>
131 + </h2>
132 + <div class="fs-accordion-section-content">
133 + <# if ( data.plans[i].description ) { #>
134 + <h3>{{ data.plans[i].description }}</h3>
135 + <# } #>
136 + <# if ( data.plans[i].features ) { #>
137 + <ul>
138 + <# for ( j in data.plans[i].features ) { #>
139 + <li><div class="fs-feature">
140 + <span class="dashicons dashicons-yes"></span><span><# if ( data.plans[i].features[j].value ) { #>{{ data.plans[i].features[j].value }} <# } #>{{ data.plans[i].features[j].title }}</span>
141 + <# if ( data.plans[i].features[j].description ) { #>
142 + <span class="dashicons dashicons-editor-help"><span class="fs-feature-desc">{{ data.plans[i].features[j].description }}</span></span>
143 + <# } #>
144 + </div></li>
145 + <# } #>
146 + </ul>
147 + <# } #>
148 + <# if ( 'free' != data.plans[i].name ) { #>
149 + <a href="{{ data.button_url }}" class="button button-primary" target="_blank">{{{ data.button_text }}}</a>
150 + <# } #>
151 + </div>
152 + </div>
153 + </li>
154 + <# } #>
155 + <# } #>
156 + </ul>
157 + <# } #>
158 + </div>
159 + <?php }
161 160 }