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/forms/optout.php +183 -267 1.4.23.6.0 View file →
@@ -1,267 +1,183 @@
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.1.5
7 - */
8 -
9 - if ( ! defined( 'ABSPATH' ) ) {
10 - exit;
11 - }
12 -
13 - /**
14 - * @var array $VARS
15 - * @var Freemius $fs
16 - */
17 - $fs = freemius( $VARS['id'] );
18 - $slug = $fs->get_slug();
19 -
20 - $action = $fs->is_tracking_allowed() ?
21 - 'stop_tracking' :
22 - 'allow_tracking';
23 -
24 - $reconnect_url = $fs->get_activation_url( array(
25 - 'nonce' => wp_create_nonce( $fs->get_unique_affix() . '_reconnect' ),
26 - 'fs_action' => ( $fs->get_unique_affix() . '_reconnect' ),
27 - ) );
28 -
29 - $plugin_title = "<strong>{$fs->get_plugin()->title}</strong>";
30 - $opt_out_text = fs_text_x_inline( 'Opt Out', 'verb', 'opt-out', $slug );
31 - $opt_in_text = fs_text_x_inline( 'Opt In', 'verb', 'opt-in', $slug );
32 - $opt_out_message_appreciation = sprintf( fs_text_inline( 'We appreciate your help in making the %s better by letting us track some usage data.', 'opt-out-message-appreciation', $slug ), $fs->get_module_type() );
33 - $opt_out_message_usage_tracking = sprintf( fs_text_inline( "Usage tracking is done in the name of making %s better. Making a better user experience, prioritizing new features, and more good things. We'd really appreciate if you'll reconsider letting us continue with the tracking.", 'opt-out-message-usage-tracking', $slug ), $plugin_title );
34 - $opt_out_message_clicking_opt_out = sprintf(
35 - fs_text_inline( 'By clicking "Opt Out", we will no longer be sending any data from %s to %s.', 'opt-out-message-clicking-opt-out', $slug ),
36 - $plugin_title,
37 - sprintf(
38 - '<a href="%s" target="_blank">%s</a>',
39 - 'https://freemius.com',
40 - 'freemius.com'
41 - )
42 - );
43 -
44 - $admin_notice_params = array(
45 - 'id' => '',
46 - 'slug' => $fs->get_id(),
47 - 'type' => 'success',
48 - 'sticky' => false,
49 - 'plugin' => $fs->get_plugin()->title,
50 - 'message' => $opt_out_message_appreciation
51 - );
52 -
53 - $admin_notice_html = fs_get_template( 'admin-notice.php', $admin_notice_params );
54 -
55 - $modal_content_html = <<< HTML
56 - <h2>{$opt_out_message_appreciation}</h2>
57 - <div class="notice notice-error inline opt-out-error-message"><p></p></div>
58 - <p>{$opt_out_message_usage_tracking}</p>
59 - <p>{$opt_out_message_clicking_opt_out}</p>
60 -HTML;
61 -
62 - fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
63 - fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
64 -?>
65 -<script type="text/javascript">
66 - (function( $ ) {
67 - $( document ).ready(function() {
68 - var modalContentHtml = <?php echo json_encode( $modal_content_html ) ?>,
69 - modalHtml =
70 - '<div class="fs-modal fs-modal-opt-out">'
71 - + ' <div class="fs-modal-dialog">'
72 - + ' <div class="fs-modal-header">'
73 - + ' <h4><?php echo esc_js( $opt_out_text ) ?></h4>'
74 - + ' </div>'
75 - + ' <div class="fs-modal-body">'
76 - + ' <div class="fs-modal-panel active">' + modalContentHtml + '</div>'
77 - + ' </div>'
78 - + ' <div class="fs-modal-footer">'
79 - + ' <button class="button button-secondary button-opt-out" tabindex="1"><?php echo esc_js( $opt_out_text ) ?></button>'
80 - + ' <button class="button button-primary button-close" tabindex="2"><?php fs_esc_js_echo_inline( 'On second thought - I want to continue helping', 'opt-out-cancel', $slug ) ?></button>'
81 - + ' </div>'
82 - + ' </div>'
83 - + '</div>',
84 - $modal = $( modalHtml ),
85 - $adminNotice = $( <?php echo json_encode( $admin_notice_html ) ?> ),
86 - action = '<?php echo $action ?>',
87 - $actionLink = $( 'span.opt-in-or-opt-out.<?php echo $slug ?> a' ),
88 - $optOutButton = $modal.find( '.button-opt-out' ),
89 - $optOutErrorMessage = $modal.find( '.opt-out-error-message' ),
90 - moduleID = '<?php echo $fs->get_id() ?>';
91 -
92 - $actionLink.attr( 'data-action', action );
93 - $modal.appendTo( $( 'body' ) );
94 -
95 - function registerActionLinkClick() {
96 - $actionLink.click(function( evt ) {
97 - evt.preventDefault();
98 -
99 - if ( 'stop_tracking' == $actionLink.attr( 'data-action' ) ) {
100 - showModal();
101 - } else {
102 - optIn();
103 - }
104 -
105 - return false;
106 - });
107 - }
108 -
109 - function registerEventHandlers() {
110 - registerActionLinkClick();
111 -
112 - $modal.on( 'click', '.button-opt-out', function( evt ) {
113 - evt.preventDefault();
114 -
115 - if ( $( this ).hasClass( 'disabled' ) ) {
116 - return;
117 - }
118 -
119 - disableOptOutButton();
120 - optOut();
121 - });
122 -
123 - // If the user has clicked outside the window, close the modal.
124 - $modal.on( 'click', '.fs-close, .button-close', function() {
125 - closeModal();
126 - return false;
127 - });
128 - }
129 -
130 - registerEventHandlers();
131 -
132 - function showModal() {
133 - resetModal();
134 -
135 - // Display the dialog box.
136 - $modal.addClass( 'active' );
137 - $( 'body' ).addClass( 'has-fs-modal' );
138 - }
139 -
140 - function closeModal() {
141 - $modal.removeClass( 'active' );
142 - $( 'body' ).removeClass( 'has-fs-modal' );
143 - }
144 -
145 - function resetOptOutButton() {
146 - enableOptOutButton();
147 - $optOutButton.text( <?php echo json_encode( $opt_out_text ) ?> );
148 - }
149 -
150 - function resetModal() {
151 - hideError();
152 - resetOptOutButton();
153 - }
154 -
155 - function optIn() {
156 - sendRequest();
157 - }
158 -
159 - function optOut() {
160 - sendRequest();
161 - }
162 -
163 - function sendRequest() {
164 - $.ajax({
165 - url: ajaxurl,
166 - method: 'POST',
167 - data: {
168 - action : ( 'stop_tracking' == action ?
169 - '<?php echo $fs->get_ajax_action( 'stop_tracking' ) ?>' :
170 - '<?php echo $fs->get_ajax_action( 'allow_tracking' ) ?>'
171 - ),
172 - security : ( 'stop_tracking' == action ?
173 - '<?php echo $fs->get_ajax_security( 'stop_tracking' ) ?>' :
174 - '<?php echo $fs->get_ajax_security( 'allow_tracking' ) ?>'
175 - ),
176 - module_id: moduleID
177 - },
178 - beforeSend: function() {
179 - if ( 'opt-in' == action ) {
180 - $actionLink.text( '<?php fs_esc_js_echo_inline( 'Opting in', 'opting-in', $slug ) ?>...' );
181 - } else {
182 - $optOutButton.text( '<?php fs_esc_js_echo_inline( 'Opting out', 'opting-out', $slug ) ?>...' );
183 - }
184 - },
185 - success: function( resultObj ) {
186 - if ( resultObj.success ) {
187 - if ( 'allow_tracking' == action ) {
188 - action = 'stop_tracking';
189 - $actionLink.text( '<?php echo esc_js( $opt_out_text ) ?>' );
190 - showOptInAppreciationMessageAndScrollToTop();
191 - } else {
192 - action = 'allow_tracking';
193 - $actionLink.text( '<?php echo esc_js( $opt_in_text ) ?>' );
194 - closeModal();
195 -
196 - if ( $adminNotice.length > 0 ) {
197 - $adminNotice.remove();
198 - }
199 - }
200 -
201 - $actionLink.attr( 'data-action', action );
202 - } else {
203 - showError( resultObj.error );
204 - resetOptOutButton();
205 - }
206 - }
207 - });
208 - }
209 -
210 - function enableOptOutButton() {
211 - $optOutButton.removeClass( 'disabled' );
212 - }
213 -
214 - function disableOptOutButton() {
215 - $optOutButton.addClass( 'disabled' );
216 - }
217 -
218 - function hideError() {
219 - $optOutErrorMessage.hide();
220 - }
221 -
222 - function showOptInAppreciationMessageAndScrollToTop() {
223 - $adminNotice.insertAfter( $( '#wpbody-content' ).find( ' > .wrap > h1' ) );
224 - window.scrollTo(0, 0);
225 - }
226 -
227 - function showError( msg ) {
228 - $optOutErrorMessage.find( ' > p' ).html( msg );
229 - $optOutErrorMessage.show();
230 - }
231 -
232 - <?php if ( $fs->is_theme() ) : ?>
233 - /**
234 - * Add opt-in/out button to the active theme's buttons collection
235 - * in the theme's extended details overlay.
236 - *
237 - * @author Vova Feldman (@svovaf)
238 - * @since 1.2.2.7
239 - */
240 - $('.theme-overlay').contentChange(function () {
241 - if (!$(this).find('.theme-overlay').hasClass('active')) {
242 - // Add opt-in/out button only to the currently active theme.
243 - return;
244 - }
245 -
246 - if ($('#fs_theme_opt_in_out').length > 0){
247 - // Button already there.
248 - return;
249 - }
250 -
251 - var label = (('stop_tracking' == action) ?
252 - '<?php echo esc_js( $opt_out_text ) ?>' :
253 - '<?php echo esc_js( $opt_in_text ) ?>'),
254 - href = (('stop_tracking' != action) ?
255 - '<?php echo esc_js( $reconnect_url ) ?>' :
256 - '');
257 -
258 - $actionLink = $('<a id="fs_theme_opt_in_out" href="' + encodeURI(href) + '" class="button" data-action="' + action + '">' + label + '</a>');
259 -
260 - $('.theme-wrap .theme-actions .active-theme').append($actionLink);
261 -
262 - registerActionLinkClick();
263 - });
264 - <?php endif ?>
265 - });
266 - })( jQuery );
267 -</script>
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.1.5
7 + */
8 +
9 + if ( ! defined( 'ABSPATH' ) ) {
10 + exit;
11 + }
12 +
13 + /**
14 + * @var array $VARS
15 + * @var Freemius $fs
16 + */
17 + $fs = freemius( $VARS['id'] );
18 + $slug = $fs->get_slug();
19 +
20 + $reconnect_url = $fs->get_activation_url( array(
21 + 'nonce' => wp_create_nonce( $fs->get_unique_affix() . '_reconnect' ),
22 + 'fs_action' => ( $fs->get_unique_affix() . '_reconnect' ),
23 + ) );
24 +
25 + $plugin_title = "<strong>" . esc_html( $fs->get_plugin()->title ) . "</strong>";
26 + $opt_out_text = fs_text_x_inline( 'Opt Out', 'verb', 'opt-out', $slug );
27 +
28 + $permission_manager = FS_Permission_Manager::instance( $fs );
29 +
30 + fs_enqueue_local_style( 'fs_dialog_boxes', '/admin/dialog-boxes.css' );
31 + fs_enqueue_local_style( 'fs_optout', '/admin/optout.css' );
32 + fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
33 +
34 + if ( ! $permission_manager->is_premium_context() ) {
35 + $optional_permissions = array( $permission_manager->get_extensions_permission( false,
36 + false,
37 + true
38 + ) );
39 +
40 + $permission_groups = array(
41 + array(
42 + 'id' => 'communication',
43 + 'type' => 'required',
44 + 'title' => $fs->get_text_inline( 'Communication', 'communication' ),
45 + 'desc' => '',
46 + 'permissions' => $permission_manager->get_opt_in_required_permissions( true ),
47 + 'is_enabled' => $fs->is_registered(),
48 + 'prompt' => array(
49 + $fs->esc_html_inline( "Sharing your name and email allows us to keep you in the loop about new features and important updates, warn you about security issues before they become public knowledge, and send you special offers.", 'opt-out-message_user' ),
50 + sprintf(
51 + $fs->esc_html_inline( 'By clicking "Opt Out", %s will no longer be able to view your name and email.',
52 + 'opt-out-message-clicking-opt-out' ),
53 + $plugin_title
54 + ),
55 + ),
56 + 'prompt_cancel_label' => $fs->get_text_inline( 'Stay Connected', 'stay-connected' )
57 + ),
58 + array(
59 + 'id' => 'diagnostic',
60 + 'type' => 'required',
61 + 'title' => $fs->get_text_inline( 'Diagnostic Info', 'diagnostic-info' ),
62 + 'desc' => '',
63 + 'permissions' => $permission_manager->get_opt_in_diagnostic_permissions( true ),
64 + 'is_enabled' => $fs->is_tracking_allowed(),
65 + 'prompt' => array(
66 + sprintf(
67 + $fs->esc_html_inline( 'Sharing diagnostic data helps to provide additional functionality that\'s relevant to your website, avoid WordPress or PHP version incompatibilities that can break the website, and recognize which languages & regions the %s should be translated and tailored to.',
68 + 'opt-out-message-clicking-opt-out' ),
69 + $fs->get_module_type()
70 + ),
71 + sprintf(
72 + $fs->esc_html_inline( 'By clicking "Opt Out", diagnostic data will no longer be sent to %s.',
73 + 'opt-out-message-clicking-opt-out' ),
74 + $plugin_title
75 + ),
76 + ),
77 + 'prompt_cancel_label' => $fs->get_text_inline( 'Keep Sharing', 'keep-sharing' )
78 + ),
79 + array(
80 + 'id' => 'extensions',
81 + 'type' => 'optional',
82 + 'title' => $fs->get_text_inline( 'Extensions', 'extensions' ),
83 + 'desc' => '',
84 + 'permissions' => $optional_permissions,
85 + ),
86 + );
87 + } else {
88 + $optional_permissions = $permission_manager->get_license_optional_permissions( false, true );
89 +
90 + $permission_groups = array(
91 + array(
92 + 'id' => 'essentials',
93 + 'type' => 'required',
94 + 'title' => $fs->esc_html_inline( 'Required', 'required' ),
95 + 'desc' => sprintf( $fs->esc_html_inline( 'For automatic delivery of security & feature updates, and license management & protection, %s needs to:',
96 + 'license-sync-disclaimer' ),
97 + '<b>' . esc_html( $fs->get_plugin_title() ) . '</b>' ),
98 + 'permissions' => $permission_manager->get_license_required_permissions( true ),
99 + 'is_enabled' => $permission_manager->is_essentials_tracking_allowed(),
100 + 'prompt' => array(
101 + sprintf( $fs->esc_html_inline( 'To ensure that security & feature updates are automatically delivered directly to your WordPress Admin Dashboard while protecting your license from unauthorized abuse, %2$s needs to view the website’s homepage URL, %1$s version, SDK version, and whether the %1$s is active.', 'premium-opt-out-message-usage-tracking' ), $fs->get_module_type(), $plugin_title ),
102 + sprintf( $fs->esc_html_inline( 'By opting out from sharing this information with the updates server, you’ll have to check for new %1$s releases and manually download & install them. Not just a hassle, but missing an update can put your site at risk and cause undue compatibility issues, so we highly recommend keeping these essential permissions on.', 'opt-out-message-clicking-opt-out' ), $fs->get_module_type(), $plugin_title ),
103 + ),
104 + 'prompt_cancel_label' => $fs->get_text_inline( 'Keep automatic updates', 'premium-opt-out-cancel' )
105 + ),
106 + array(
107 + 'id' => 'optional',
108 + 'type' => 'optional',
109 + 'title' => $fs->esc_html_inline( 'Optional', 'optional' ),
110 + 'desc' => sprintf( $fs->esc_html_inline( 'For ongoing compatibility with your website, you can optionally allow %s to:',
111 + 'optional-permissions-disclaimer' ), $plugin_title ),
112 + 'permissions' => $optional_permissions,
113 + ),
114 + );
115 + }
116 +
117 + $ajax_action = 'toggle_permission_tracking';
118 +
119 + $form_id = "fs_opt_out_{$fs->get_id()}";
120 +?>
121 +<div id="<?php echo esc_attr( $form_id ) ?>"
122 + class="fs-modal fs-modal-opt-out"
123 + data-plugin-id="<?php echo esc_attr( $fs->get_id() ) ?>"
124 + data-action="<?php echo esc_attr( $fs->get_ajax_action( $ajax_action ) ) ?>"
125 + data-security="<?php echo esc_attr( $fs->get_ajax_security( $ajax_action ) ) ?>"
126 + style="display: none">
127 + <div class="fs-modal-dialog">
128 + <div class="fs-modal-header">
129 + <h4><?php echo esc_html( $opt_out_text ) ?></h4>
130 + <a href="!#" class="fs-close"><i class="dashicons dashicons-no" title="Dismiss"></i></a>
131 + </div>
132 + <div class="fs-opt-out-permissions">
133 + <div class="fs-modal-body">
134 + <div class="notice notice-error inline opt-out-error-message"><p></p></div>
135 + <div class="fs-permissions fs-open">
136 + <?php foreach ( $permission_groups as $i => $permission_group ) : ?>
137 + <?php $permission_manager->render_permissions_group( $permission_group ) ?>
138 + <?php if ( $i < count( $permission_groups ) - 1 ) : ?><hr><?php endif ?>
139 + <?php endforeach ?>
140 + </div>
141 + </div>
142 + <div class="fs-modal-footer">
143 + <button class="button button-primary button-close" tabindex="1"><?php echo $fs->esc_html_inline( 'Done', 'done' ) ?></button>
144 + </div>
145 + </div>
146 + <?php foreach ( $permission_groups as $i => $permission_group ) : ?>
147 + <?php if ( ! empty( $permission_group[ 'prompt' ] ) ) : ?>
148 + <div class="fs-<?php echo esc_attr( $permission_group[ 'id' ] ) ?>-opt-out fs-opt-out-disclaimer" data-group-id="<?php echo esc_attr( $permission_group[ 'id' ] ) ?>" style="display: none">
149 + <div class="fs-modal-body">
150 + <div class="fs-modal-panel active">
151 + <div class="notice notice-error inline opt-out-error-message"><p></p></div>
152 + <?php foreach ( $permission_group[ 'prompt' ] as $p ) : ?>
153 + <?php // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
154 + <p><?php echo $p ?></p>
155 + <?php endforeach ?>
156 + </div>
157 + </div>
158 + <div class="fs-modal-footer">
159 + <a class="fs-opt-out-button" tabindex="2" href="#"><?php echo esc_html( $opt_out_text ) ?></a>
160 + <button class="button button-primary fs-opt-out-cancel-button" tabindex="1"><?php echo esc_html( $permission_group[ 'prompt_cancel_label' ] ) ?></button>
161 + </div>
162 + </div>
163 + <?php endif ?>
164 + <?php endforeach ?>
165 + </div>
166 +</div>
167 +
168 +<?php $permission_manager->require_permissions_js( false ) ?>
169 +
170 +<script type="text/javascript">
171 + (function( $ ) {
172 + $( document ).ready(function() {
173 + FS.OptOut(
174 + <?php echo wp_json_encode( $fs->get_id() ) ?>,
175 + <?php echo wp_json_encode( $slug ) ?>,
176 + <?php echo wp_json_encode( $fs->get_module_type() ) ?>,
177 + <?php echo $fs->is_registered( true ) ? 'true' : 'false' ?>,
178 + <?php echo $fs->is_tracking_allowed() ? 'true' : 'false' ?>,
179 + <?php echo wp_json_encode( $reconnect_url ) ?>
180 + );
181 + });
182 + })( jQuery );
183 +</script>