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 -222 1.33.6.0 View file →
@@ -1,222 +1,183 @@
1 -<?php
2 - /**
3 - * @package Freemius
4 - * @copyright Copyright (c) 2015, Freemius, Inc.
5 - * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
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 - $slug = $VARS['slug'];
18 - $fs = freemius( $slug );
19 -
20 - $action = $fs->is_tracking_allowed() ?
21 - 'stop_tracking' :
22 - 'allow_tracking';
23 -
24 - $plugin_title = "<strong>{$fs->get_plugin()->title}</strong>";
25 - $opt_out_button_text = fs_text( 'opt-out', $slug );
26 - // @todo Change 'plugin' with module type when migrating with 1.2.2 (themes version).
27 - $opt_out_message_appreciation = sprintf( fs_text( 'opt-out-message-appreciation', $slug ), 'plugin' );
28 - $opt_out_message_usage_tracking = sprintf( fs_text( 'opt-out-message-usage-tracking', $slug ), $plugin_title );
29 - $opt_out_message_clicking_opt_out = sprintf(
30 - fs_text( 'opt-out-message-clicking-opt-out', $slug ),
31 - $plugin_title,
32 - sprintf(
33 - '<a href="%s" target="_blank">%s</a>',
34 - 'https://freemius.com',
35 - 'freemius.com'
36 - )
37 - );
38 -
39 - $admin_notice_params = array(
40 - 'id' => '',
41 - 'slug' => $fs->get_id(),
42 - 'type' => 'success',
43 - 'sticky' => false,
44 - 'plugin' => $fs->get_plugin()->title,
45 - 'message' => $opt_out_message_appreciation
46 - );
47 -
48 - $admin_notice_html = fs_get_template( 'admin-notice.php', $admin_notice_params );
49 -
50 - $modal_content_html = <<< HTML
51 - <h2>{$opt_out_message_appreciation}</h2>
52 - <div class="notice notice-error inline opt-out-error-message"><p></p></div>
53 - <p>{$opt_out_message_usage_tracking}</p>
54 - <p>{$opt_out_message_clicking_opt_out}</p>
55 -HTML;
56 -
57 - fs_enqueue_local_style( 'dialog-boxes', '/admin/dialog-boxes.css' );
58 - fs_enqueue_local_style( 'fs_common', '/admin/common.css' );
59 -?>
60 -<script type="text/javascript">
61 -(function( $ ) {
62 - $( document ).ready(function() {
63 - var modalContentHtml = <?php echo json_encode( $modal_content_html ) ?>,
64 - modalHtml =
65 - '<div class="fs-modal fs-modal-opt-out">'
66 - + ' <div class="fs-modal-dialog">'
67 - + ' <div class="fs-modal-header">'
68 - + ' <h4><?php echo esc_js($opt_out_button_text) ?></h4>'
69 - + ' </div>'
70 - + ' <div class="fs-modal-body">'
71 - + ' <div class="fs-modal-panel active">' + modalContentHtml + '</div>'
72 - + ' </div>'
73 - + ' <div class="fs-modal-footer">'
74 - + ' <button class="button button-secondary button-opt-out" tabindex="1"><?php echo esc_js($opt_out_button_text) ?></button>'
75 - + ' <button class="button button-primary button-close" tabindex="2"><?php fs_esc_js_echo( 'opt-out-cancel', $slug ) ?></button>'
76 - + ' </div>'
77 - + ' </div>'
78 - + '</div>',
79 - $modal = $( modalHtml ),
80 - $adminNotice = $( <?php echo json_encode( $admin_notice_html ) ?> ),
81 - action = '<?php echo $action ?>',
82 - $actionLink = $( 'span.opt-in-or-opt-out.<?php echo $slug ?> a' ),
83 - $optOutButton = $modal.find( '.button-opt-out' ),
84 - $optOutErrorMessage = $modal.find( '.opt-out-error-message' ),
85 - pluginSlug = '<?php echo $slug ?>';
86 -
87 - $actionLink.attr( 'data-action', action );
88 - $modal.appendTo( $( 'body' ) );
89 -
90 - function registerEventHandlers() {
91 - $actionLink.click(function( evt ) {
92 - evt.preventDefault();
93 -
94 - if ( 'stop_tracking' == $actionLink.attr( 'data-action' ) ) {
95 - showModal();
96 - } else {
97 - optIn();
98 - }
99 - });
100 -
101 - $modal.on( 'click', '.button-opt-out', function( evt ) {
102 - evt.preventDefault();
103 -
104 - if ( $( this ).hasClass( 'disabled' ) ) {
105 - return;
106 - }
107 -
108 - disableOptOutButton();
109 - optOut();
110 - });
111 -
112 - // If the user has clicked outside the window, close the modal.
113 - $modal.on( 'click', '.fs-close, .button-close', function() {
114 - closeModal();
115 - return false;
116 - });
117 - }
118 -
119 - registerEventHandlers();
120 -
121 - function showModal() {
122 - resetModal();
123 -
124 - // Display the dialog box.
125 - $modal.addClass( 'active' );
126 - $( 'body' ).addClass( 'has-fs-modal' );
127 - }
128 -
129 - function closeModal() {
130 - $modal.removeClass( 'active' );
131 - $( 'body' ).removeClass( 'has-fs-modal' );
132 - }
133 -
134 - function resetOptOutButton() {
135 - enableOptOutButton();
136 - $optOutButton.text( <?php echo json_encode( $opt_out_button_text ) ?> );
137 - }
138 -
139 - function resetModal() {
140 - hideError();
141 - resetOptOutButton();
142 - }
143 -
144 - function optIn() {
145 - sendRequest();
146 - }
147 -
148 - function optOut() {
149 - sendRequest();
150 - }
151 -
152 - function sendRequest() {
153 - $.ajax({
154 - url: ajaxurl,
155 - method: 'POST',
156 - data: {
157 - action : ( 'stop_tracking' == action ?
158 - '<?php echo $fs->get_ajax_action( 'stop_tracking' ) ?>' :
159 - '<?php echo $fs->get_ajax_action( 'allow_tracking' ) ?>'
160 - ),
161 - security : ( 'stop_tracking' == action ?
162 - '<?php echo $fs->get_ajax_security( 'stop_tracking' ) ?>' :
163 - '<?php echo $fs->get_ajax_security( 'allow_tracking' ) ?>'
164 - ),
165 - slug : pluginSlug
166 - },
167 - beforeSend: function() {
168 - if ( 'opt-in' == action ) {
169 - $actionLink.text( <?php fs_json_encode_echo( 'opting-in', $slug ) ?> );
170 - } else {
171 - $optOutButton.text( <?php fs_json_encode_echo( 'opting-out', $slug ) ?> );
172 - }
173 - },
174 - success: function( resultObj ) {
175 - if ( resultObj.success ) {
176 - if ( 'allow_tracking' == action ) {
177 - action = 'stop_tracking';
178 - $actionLink.text( <?php fs_json_encode_echo( 'opt-out', $slug ) ?> );
179 - showOptInAppreciationMessageAndScrollToTop();
180 - } else {
181 - action = 'allow_tracking';
182 - $actionLink.text( <?php fs_json_encode_echo( 'opt-in', $slug ) ?> );
183 - closeModal();
184 -
185 - if ( $adminNotice.length > 0 ) {
186 - $adminNotice.remove();
187 - }
188 - }
189 -
190 - $actionLink.attr( 'data-action', action );
191 - } else {
192 - showError( resultObj.error );
193 - resetOptOutButton();
194 - }
195 - }
196 - });
197 - }
198 -
199 - function enableOptOutButton() {
200 - $optOutButton.removeClass( 'disabled' );
201 - }
202 -
203 - function disableOptOutButton() {
204 - $optOutButton.addClass( 'disabled' );
205 - }
206 -
207 - function hideError() {
208 - $optOutErrorMessage.hide();
209 - }
210 -
211 - function showOptInAppreciationMessageAndScrollToTop() {
212 - $adminNotice.insertAfter( $( '#wpbody-content' ).find( ' > .wrap > h1' ) );
213 - window.scrollTo(0, 0);
214 - }
215 -
216 - function showError( msg ) {
217 - $optOutErrorMessage.find( ' > p' ).html( msg );
218 - $optOutErrorMessage.show();
219 - }
220 - });
221 -})( jQuery );
222 -</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>