PluginProbe ʕ •ᴥ•ʔ
Royal Addons for Elementor – Addons and Templates Kit for Elementor / 1.7.1064
Royal Addons for Elementor – Addons and Templates Kit for Elementor v1.7.1064
1.7.1064 1.7.1063 1.7.1062 1.7.1061 1.7.1060 1.7.1059 1.7.1058 trunk 1.0.0 1.1.0 1.2 1.3 1.3.1 1.3.2 1.3.21 1.3.22 1.3.23 1.3.24 1.3.25 1.3.26 1.3.27 1.3.28 1.3.29 1.3.30 1.3.31 1.3.32 1.3.33 1.3.34 1.3.35 1.3.36 1.3.37 1.3.38 1.3.39 1.3.40 1.3.41 1.3.42 1.3.43 1.3.44 1.3.45 1.3.46 1.3.47 1.3.48 1.3.49 1.3.50 1.3.51 1.3.52 1.3.53 1.3.54 1.3.55 1.3.56 1.3.57 1.3.58 1.3.59 1.3.60 1.3.61 1.3.62 1.3.63 1.3.64 1.3.65 1.3.66 1.3.67 1.3.68 1.3.69 1.3.70 1.3.71 1.3.72 1.3.73 1.3.74 1.3.75 1.3.76 1.3.77 1.3.78 1.3.79 1.3.80 1.3.81 1.3.82 1.3.83 1.3.84 1.3.85 1.3.86 1.3.87 1.3.88 1.3.89 1.3.90 1.3.91 1.3.92 1.3.93 1.3.94 1.3.95 1.3.96 1.3.97 1.3.971 1.3.972 1.3.973 1.3.974 1.3.975 1.3.976 1.3.977 1.3.978 1.3.979 1.3.980 1.3.981 1.3.982 1.3.983 1.3.984 1.3.985 1.3.986 1.3.987 1.7.1 1.7.1001 1.7.1002 1.7.1003 1.7.1004 1.7.1005 1.7.1006 1.7.1007 1.7.1008 1.7.1009 1.7.1010 1.7.1011 1.7.1012 1.7.1013 1.7.1014 1.7.1015 1.7.1016 1.7.1017 1.7.1018 1.7.1019 1.7.1020 1.7.1021 1.7.1022 1.7.1023 1.7.1024 1.7.1025 1.7.1026 1.7.1027 1.7.1028 1.7.1029 1.7.1030 1.7.1031 1.7.1032 1.7.1033 1.7.1034 1.7.1035 1.7.1036 1.7.1037 1.7.1038 1.7.1039 1.7.1040 1.7.1041 1.7.1042 1.7.1043 1.7.1044 1.7.1045 1.7.1046 1.7.1047 1.7.1048 1.7.1049 1.7.1050 1.7.1051 1.7.1052 1.7.1053 1.7.1054 1.7.1055 1.7.1056 1.7.1057
royal-elementor-addons / freemius / templates / forms / subscription-cancellation.php
royal-elementor-addons / freemius / templates / forms Last commit date
deactivation 5 days ago affiliation.php 5 days ago data-debug-mode.php 5 days ago email-address-update.php 5 days ago index.php 5 days ago license-activation.php 5 days ago optout.php 5 days ago premium-versions-upgrade-handler.php 5 days ago premium-versions-upgrade-metadata.php 5 days ago resend-key.php 5 days ago subscription-cancellation.php 5 days ago trial-start.php 5 days ago user-change.php 5 days ago
subscription-cancellation.php
277 lines
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 2.2.1
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 /**
14 * @var array $VARS
15 */
16 $fs = freemius( $VARS['id'] );
17 $slug = $fs->get_slug();
18
19 /**
20 * @var FS_Plugin_License $license
21 */
22 $license = $VARS['license'];
23
24 $has_trial = $VARS['has_trial'];
25
26 $subscription_cancellation_context = $has_trial ?
27 fs_text_inline( 'trial', 'trial', $slug ) :
28 fs_text_inline( 'subscription', 'subscription', $slug );
29
30 $plan = $fs->get_plan();
31 $module_label = $fs->get_module_label( true );
32
33 if ( $VARS['is_license_deactivation'] ) {
34 $subscription_cancellation_text = '';
35 } else {
36 $subscription_cancellation_text = sprintf(
37 fs_text_inline(
38 "Deactivating or uninstalling the %s will automatically disable the license, which you'll be able to use on another site.",
39 'deactivation-or-uninstall-message',
40 $slug
41 ),
42 $module_label
43 ) . ' ';
44 }
45
46 $subscription_cancellation_text .= sprintf(
47 fs_text_inline(
48 'In case you are NOT planning on using this %s on this site (or any other site) - would you like to cancel the %s as well?',
49 'cancel-subscription-message',
50 $slug
51 ),
52 ( $VARS['is_license_deactivation'] ? fs_text_inline( 'license', 'license', $slug ) : $module_label ),
53 $subscription_cancellation_context
54 );
55
56 $cancel_subscription_action_label = sprintf(
57 fs_esc_html_inline(
58 "Cancel %s - I no longer need any security & feature updates, nor support for %s because I'm not planning to use the %s on this, or any other site.",
59 'cancel-x',
60 $slug
61 ),
62 esc_html( $subscription_cancellation_context ),
63 sprintf( '<strong>%s</strong>', esc_html( $fs->get_plugin_title() ) ),
64 esc_html( $module_label )
65 );
66
67 $keep_subscription_active_action_label = esc_html( sprintf(
68 fs_text_inline(
69 "Don't cancel %s - I'm still interested in getting security & feature updates, as well as be able to contact support.",
70 'dont-cancel-x',
71 $slug
72 ),
73 $subscription_cancellation_context
74 ) );
75
76 $subscription_cancellation_text = esc_html( $subscription_cancellation_text );
77
78 $subscription_cancellation_html = <<< HTML
79 <div class="notice notice-error inline"><p></p></div><p>{$subscription_cancellation_text}</p>
80 <ul class="subscription-actions">
81 <li>
82 <label>
83 <input type="radio" name="cancel-subscription" value="false"/>
84 <span>{$keep_subscription_active_action_label}</span>
85 </label>
86 </li>
87 <li>
88 <label>
89 <input type="radio" name="cancel-subscription" value="true"/>
90 <span>{$cancel_subscription_action_label}</span>
91 </label>
92 </li>
93 </ul>
94 HTML;
95
96 $downgrading_plan_text = fs_text_inline( 'Downgrading your plan', 'downgrading-plan', $slug );
97 $cancelling_subscription_text = fs_text_inline( 'Cancelling the subscription', 'cancelling-subscription', $slug );
98 /* translators: %1$s: Either 'Downgrading your plan' or 'Cancelling the subscription' */
99 $downgrade_x_confirm_text = fs_text_inline( '%1$s will immediately stop all future recurring payments and your %2$s plan license will expire in %3$s.', 'downgrade-x-confirm', $slug );
100 $prices_increase_text = fs_text_inline( 'Please note that we will not be able to grandfather outdated pricing for renewals/new subscriptions after a cancellation. If you choose to renew the subscription manually in the future, after a price increase, which typically occurs once a year, you will be charged the updated price.', 'pricing-increase-warning', $slug );
101 $after_downgrade_non_blocking_text = fs_text_inline( 'You can still enjoy all %s features but you will not have access to %s security & feature updates, nor support.', 'after-downgrade-non-blocking', $slug );
102 $after_downgrade_blocking_text = fs_text_inline( 'Once your license expires you can still use the Free version but you will NOT have access to the %s features.', 'after-downgrade-blocking', $slug );
103 $after_downgrade_blocking_text_premium_only = fs_text_inline( 'Once your license expires you will no longer be able to use the %s, unless you activate it again with a valid premium license.', 'after-downgrade-blocking-premium-only', $slug );
104
105 $subscription_cancellation_confirmation_message = $has_trial ?
106 fs_text_inline( 'Cancelling the trial will immediately block access to all premium features. Are you sure?', 'cancel-trial-confirm', $slug ) :
107 sprintf(
108 '%s %s %s %s',
109 sprintf(
110 $downgrade_x_confirm_text,
111 ($fs->is_only_premium() ? $cancelling_subscription_text : $downgrading_plan_text ),
112 $plan->title,
113 human_time_diff( time(), strtotime( $license->expiration ) )
114 ),
115 (
116 $license->is_block_features ?
117 (
118 $fs->is_only_premium() ?
119 sprintf( $after_downgrade_blocking_text_premium_only, $module_label ) :
120 sprintf( $after_downgrade_blocking_text, $plan->title )
121 ) :
122 sprintf( $after_downgrade_non_blocking_text, $plan->title, $fs->get_module_label( true ) )
123 ),
124 $prices_increase_text,
125 fs_esc_attr_inline( 'Are you sure you want to proceed?', 'proceed-confirmation', $slug )
126 );
127
128 fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
129 ?>
130 <script type="text/javascript">
131 (function( $ ) {
132 var modalHtml =
133 '<div class="fs-modal fs-modal-subscription-cancellation fs-modal-subscription-cancellation-<?php echo $fs->get_id() ?>">'
134 + ' <div class="fs-modal-dialog">'
135 + ' <div class="fs-modal-header">'
136 + ' <h4><?php echo esc_html( sprintf( fs_text_inline( 'Cancel %s?', 'cancel-x', $slug ), ucfirst( $subscription_cancellation_context ) ) ) ?></h4>'
137 + ' </div>'
138 + ' <div class="fs-modal-body">'
139 + ' <div class="fs-modal-panel active">' + <?php echo json_encode( $subscription_cancellation_html ) ?> + '<p class="fs-price-increase-warning" style="display: none;">' + <?php echo json_encode( $prices_increase_text ) ?> + '</p></div>'
140 + ' </div>'
141 + ' <div class="fs-modal-footer">'
142 + ' <a href="#" class="button button-secondary button-close"><?php fs_esc_attr_echo_inline( 'Cancel', 'cancel', $slug ) ?></a>'
143 + ' <a href="#" class="button button-primary button-deactivate disabled"><?php fs_esc_attr_echo_inline( 'Proceed', 'proceed', $slug ) ?></a>'
144 + ' </div>'
145 + ' </div>'
146 + '</div>',
147 $modal = $(modalHtml);
148
149 $modal.appendTo($('body'));
150
151 registerEventHandlers();
152
153 function registerEventHandlers() {
154 $modal.on( 'showModal', function() {
155 showModal();
156 });
157
158 $modal.on( 'closeModal', function() {
159 closeModal();
160 });
161
162 $modal.on('click', '.fs-modal-footer .button', function (evt) {
163 evt.preventDefault();
164
165 if ($(this).hasClass('disabled')) {
166 return;
167 }
168
169 var _this = $(this),
170 subscriptionCancellationActionEventName = <?php echo json_encode( $fs->get_action_tag( 'subscription_cancellation_action' ) ) ?>;
171
172 if ( _this.hasClass( 'button-primary' ) ) {
173 if ( 'true' !== $modal.find( 'input[name="cancel-subscription"]:checked' ).val() ) {
174 $modal.trigger( subscriptionCancellationActionEventName, false );
175 } else {
176 if ( confirm( <?php echo json_encode( $subscription_cancellation_confirmation_message ) ?> ) ) {
177 $modal.trigger( subscriptionCancellationActionEventName, true );
178 }
179 }
180 }
181 });
182
183 $modal.on('click', 'input[type="radio"]', function () {
184 var
185 $selectedOption = $( this ),
186 $primaryButton = $modal.find( '.button-primary' ),
187 isSelected = ( 'true' === $selectedOption.val() );
188
189 if ( isSelected ) {
190 $primaryButton.html( <?php echo json_encode( sprintf(
191 fs_text_inline( 'Cancel %s & Proceed', 'cancel-x-and-proceed', $slug ),
192 ucfirst( $subscription_cancellation_context )
193 ) ) ?> );
194
195 $modal.find('.fs-price-increase-warning').show();
196 } else {
197 $primaryButton.html( <?php fs_json_encode_echo_inline( 'Proceed', 'proceed', $slug ) ?> );
198 $modal.find('.fs-price-increase-warning').hide();
199 }
200
201 $primaryButton.toggleClass( 'warn', isSelected );
202 $primaryButton.removeClass( 'disabled' );
203 });
204
205 // If the user has clicked outside the window, cancel it.
206 $modal.on('click', function (evt) {
207 var $target = $(evt.target);
208
209 // If the user has clicked anywhere in the modal dialog, just return.
210 if ($target.hasClass('fs-modal-body') || $target.hasClass('fs-modal-footer')) {
211 return;
212 }
213
214 // If the user has not clicked the close button and the clicked element is inside the modal dialog, just return.
215 if (
216 ( ! $target.hasClass( 'button-close' ) ) &&
217 ( $target.parents( '.fs-modal-body' ).length > 0 || $target.parents( '.fs-modal-footer' ).length > 0 )
218 ) {
219 return;
220 }
221
222 closeModal();
223
224 return false;
225 });
226 }
227
228 function showModal() {
229 resetModal();
230
231 // Display the dialog box.
232 $modal.addClass('active');
233
234 $('body').addClass('has-fs-modal');
235 }
236
237 function closeModal() {
238 var activeModalsCount = $( '.fs-modal.active' ).length;
239
240 $modal.removeClass('active');
241
242 // If child modal, do not remove the "has-fs-modal" class of the <body> element to keep its scrollbars hidden.
243 if ( activeModalsCount > 1 ) {
244 return;
245 }
246
247 $('body').removeClass('has-fs-modal');
248 }
249
250 function resetModal() {
251 updateButtonLabels();
252
253 if ( 0 === $modal.find( '.subscription-actions' ).length ) {
254 $modal.find('.button-deactivate').removeClass('disabled');
255 } else {
256 $modal.find('.button-deactivate').addClass('disabled');
257 }
258
259 $modal.find('.fs-price-increase-warning').hide();
260
261 // Uncheck all radio buttons.
262 $modal.find('input[type="radio"]').prop('checked', false);
263
264 $modal.find('.message').hide();
265 }
266
267 function showMessage(message) {
268 $modal.find('.message').text(message).show();
269 }
270
271 function updateButtonLabels() {
272 $modal.find('.button-primary').text( <?php fs_json_encode_echo_inline( 'Proceed', 'proceed', $slug ) ?> );
273
274 $modal.find('.button-secondary').text( <?php fs_json_encode_echo_inline( 'Cancel', 'cancel', $slug ) ?> );
275 }
276 })( jQuery );
277 </script>