Enhanced Text Widget - Version 1.5.5

Version Description

  • Added try it out module
Download this release

Release Info

Developer iclyde
Plugin Icon wp plugin Enhanced Text Widget
Version 1.5.5
Comparing to
See all releases

Code changes from version 1.5.3 to 1.5.5

analyst/src/helpers.php CHANGED
@@ -71,14 +71,3 @@ if (! function_exists('analyst_require_template')) {
71
  require analyst_templates_path($file);
72
  }
73
  }
74
-
75
- if (! function_exists('dd')) {
76
- /**
77
- * Dump some data
78
- */
79
- function dd ()
80
- {
81
- var_dump(func_get_args());
82
- die();
83
- }
84
- }
71
  require analyst_templates_path($file);
72
  }
73
  }
 
 
 
 
 
 
 
 
 
 
 
enhanced-text-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Enhanced Text Widget
4
  Plugin URI: http://wordpress.org/plugins/enhanced-text-widget/
5
  Description: An enhanced version of the default text widget where you may have Text, HTML, CSS, JavaScript, Flash, Shortcodes, and/or PHP as content with linkable widget title.
6
- Version: 1.5.3
7
  Author: Clever Widgets
8
  Author URI: https://themecheck.info
9
  Text Domain: enhanced-text-widget
@@ -266,3 +266,83 @@ function etw_hide_admin_notification_callback() {
266
  wp_send_json_success();
267
  die;
268
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Plugin Name: Enhanced Text Widget
4
  Plugin URI: http://wordpress.org/plugins/enhanced-text-widget/
5
  Description: An enhanced version of the default text widget where you may have Text, HTML, CSS, JavaScript, Flash, Shortcodes, and/or PHP as content with linkable widget title.
6
+ Version: 1.5.5
7
  Author: Clever Widgets
8
  Author URI: https://themecheck.info
9
  Text Domain: enhanced-text-widget
266
  wp_send_json_success();
267
  die;
268
  }
269
+
270
+ // Activation of tryOutPlugins module
271
+ add_action('plugins_loaded', function () {
272
+
273
+ if (!(class_exists('\Inisev\Subs\Inisev_Try_Out_Plugins') || class_exists('Inisev\Subs\Inisev_Try_Out_Plugins') || class_exists('Inisev_Try_Out_Plugins'))) {
274
+ require_once __DIR__ . '/modules/tryOutPlugins/tryOutPlugins.php';
275
+ $try_out_plugins = new \Inisev\Subs\Inisev_Try_Out_Plugins(__FILE__, __DIR__, 'Enhanced Text Widget', 'plugins.php?s=Enhanced%20Text%20Widget&plugin_status=all');
276
+ }
277
+
278
+ });
279
+
280
+ add_filter( 'plugin_action_links_' . plugin_basename(__FILE__), function ($links) {
281
+
282
+ $tifm_action = array('<a href="#!" id="etw_tifm_disable">' . __('Disable Plugin Test Feature', 'enhanced-text-widget') . '</a>');
283
+ if (get_option('_tifm_feature_enabled') === 'disabled') {
284
+ $tifm_action = array('<a href="#!" id="etw_tifm_enable">' . __('Enable Plugin Test Feature', 'enhanced-text-widget') . '</a>');
285
+ }
286
+
287
+ return array_merge($links, $tifm_action);
288
+
289
+ });
290
+
291
+ add_action('admin_footer', function () {
292
+
293
+ global $pagenow;
294
+ if ($pagenow === 'plugins.php') {
295
+ ?>
296
+ <script type="text/javascript">
297
+ jQuery('#etw_tifm_enable').on('click', (e) => {
298
+ e.preventDefault();
299
+ jQuery.post(ajaxurl, { action: 'tifm_save_decision', decision: 'true' }).done(() => {
300
+ window.location.reload();
301
+ }).fail(() => {
302
+ alert('There was an error and we could not update this option.');
303
+ });
304
+ });
305
+ jQuery('#etw_tifm_disable').on('click', (e) => {
306
+ e.preventDefault();
307
+ jQuery.post(ajaxurl, { action: 'tifm_save_decision', decision: 'false' }).done(() => {
308
+ window.location.reload();
309
+ }).fail(() => {
310
+ alert('There was an error and we could not update this option.');
311
+ });
312
+ });
313
+ </script>
314
+ <?php
315
+ }
316
+
317
+ });
318
+
319
+ if (!has_action('wp_ajax_tifm_save_decision')) {
320
+ add_action('wp_ajax_tifm_save_decision', function () {
321
+
322
+ if (isset($_POST['decision'])) {
323
+
324
+ if ($_POST['decision'] == 'true') {
325
+ update_option('_tifm_feature_enabled', 'enabled');
326
+ delete_option('_tifm_disable_feature_forever', true);
327
+ wp_send_json_success();
328
+ exit;
329
+ } else if ($_POST['decision'] == 'false') {
330
+ update_option('_tifm_feature_enabled', 'disabled');
331
+ update_option('_tifm_disable_feature_forever', true);
332
+ wp_send_json_success();
333
+ exit;
334
+ } else if ($_POST['decision'] == 'reset') {
335
+ delete_option('_tifm_feature_enabled');
336
+ delete_option('_tifm_hide_notice_forever');
337
+ delete_option('_tifm_disable_feature_forever');
338
+ wp_send_json_success();
339
+ exit;
340
+ }
341
+
342
+ wp_send_json_error();
343
+ exit;
344
+
345
+ }
346
+
347
+ });
348
+ }
modules/tryOutPlugins/tryOutPlugins.php ADDED
@@ -0,0 +1,289 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * File for our cool review ask in the header
5
+ *
6
+ * @category Child Plugin
7
+ * @version v0.1.0
8
+ * @since v0.1.0
9
+ * @author iClyde <kontakt@iclyde.pl>
10
+ */
11
+
12
+ // Namespace
13
+ namespace Inisev\Subs;
14
+
15
+ // Disallow direct access
16
+ if (defined('ABSPATH')) {
17
+
18
+ /**
19
+ * Main class for handling the Review
20
+ */
21
+ if (!class_exists('Inisev\Subs\Inisev_Try_Out_Plugins')) {
22
+ class Inisev_Try_Out_Plugins {
23
+
24
+ function __construct($plugin_file, $plugin_dir, $plugin_name, $plugin_menu_page) {
25
+
26
+ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
27
+ add_action('wp_ajax_tifm_notice_actions', [&$this, 'noticeAjax']);
28
+ }
29
+
30
+ global $pagenow;
31
+ if (!($pagenow == 'plugin-install.php' || $pagenow == 'admin-ajax.php')) return;
32
+ if (!is_admin() || !current_user_can('install_plugins')) return;
33
+ if (get_option('_tifm_disable_feature_forever', false) != false) return;
34
+
35
+ $this->pluginDir = $plugin_dir;
36
+ $this->pluginFile = $plugin_file;
37
+ $this->pluginName = $plugin_name;
38
+ $this->pluginPageURL = admin_url($plugin_menu_page) . '&scrollToSection=testPlugins';
39
+
40
+ $this->showInformativeNotice();
41
+ $this->insertActionButton();
42
+
43
+ }
44
+
45
+ public function showInformativeNotice() {
46
+
47
+ add_action('in_admin_footer', [&$this, 'tryItOutScript']);
48
+
49
+ if (get_option('_tifm_hide_notice_forever', false) != false) return;
50
+
51
+ add_action('admin_notices', [&$this, 'informativeAdminNoticeHandler']);
52
+ add_action('admin_head', [&$this, 'noticeStyles']);
53
+ add_action('in_admin_footer', [&$this, 'noticeScripts']);
54
+
55
+ }
56
+
57
+ public function noticeStyles() {
58
+ ?>
59
+
60
+ <style media="screen">
61
+ #tifm_paragraph_notice {
62
+ display: flex;
63
+ flex-direction: row;
64
+ justify-content: space-between;
65
+ }
66
+
67
+ #tifm_paragraph_notice span {
68
+ line-height: 30px;
69
+ }
70
+
71
+ #tifm_paragraph_notice .tifm_darker_a {
72
+ color: #555;
73
+ }
74
+
75
+ #tifm_paragraph_notice .tifm_darker_a_muted {
76
+ color: #999;
77
+ }
78
+
79
+ #tifm_paragraph_notice .tifm_brought_url {
80
+ color: #00a32a;
81
+ text-decoration: none;
82
+ }
83
+
84
+ #tifm_paragraph_notice .tifm-grow-1 {
85
+ flex-grow: 1;
86
+ }
87
+
88
+ #tifm_paragraph_notice .tifm-grow-5 {
89
+ flex-grow: 5;
90
+ }
91
+
92
+ @media screen and (max-width: 1400px) {
93
+ #tifm_paragraph_notice {
94
+ flex-direction: column;
95
+ }
96
+ }
97
+ </style>
98
+
99
+ <?php
100
+ }
101
+
102
+ public function noticeScripts() {
103
+ ?>
104
+ <script type="text/javascript">
105
+ jQuery(document).ready(function($) {
106
+
107
+ $('#tifm_new_feature_notice').on('click', '.notice-dismiss', hideAndDismissNotice);
108
+
109
+ $('#tifm_new_feature_notice').on('click', '.tifm_darker_a', hideAndDismissNotice);
110
+
111
+ $('#tifm_new_feature_notice').on('click', '.tifm_darker_a_muted', disableFeatureAndDismiss);
112
+
113
+ let nonce = "<?php echo wp_create_nonce('tifm_notice_nonce') ?>";
114
+
115
+ function hideAndDismissNotice(e) {
116
+
117
+ let dismiss = false;
118
+ if (typeof e != 'string') {
119
+ e.preventDefault();
120
+ } else if (e = 'dismiss') {
121
+ dismiss = true;
122
+ }
123
+
124
+ $('#tifm_new_feature_notice').hide(300);
125
+ setTimeout(function () {
126
+ $('#tifm_new_feature_notice').remove();
127
+ }, 350);
128
+
129
+ let method = 'dismiss_notice';
130
+ if (dismiss == true) {
131
+ method = 'dismiss_notice_and_disable';
132
+ }
133
+
134
+ $.post(ajaxurl, { action: 'tifm_notice_actions', nonce: nonce, method: method }).done(function () {
135
+ if (method == 'dismiss_notice_and_disable') {
136
+ window.location.reload();
137
+ }
138
+ }).fail(function (e) {
139
+ alert('Error occurred, please refresh and try again.' + JSON.stringify(e));
140
+ });
141
+
142
+ }
143
+
144
+ function disableFeatureAndDismiss(e) {
145
+
146
+ e.preventDefault();
147
+ hideAndDismissNotice('dismiss');
148
+
149
+ }
150
+
151
+ });
152
+ </script>
153
+ <?php
154
+ }
155
+
156
+ public function tryItOutScript() {
157
+ ?>
158
+ <script type="text/javascript">
159
+ jQuery(document).ready(function($) {
160
+ function makeButton(slug) {
161
+
162
+ let a = document.createElement('A');
163
+ a.classList.add('button');
164
+ a.classList.add('button-primary');
165
+ a.classList.add('tifm-btn-iframe');
166
+ a.classList.add('right');
167
+ a.style.color = '#fff';
168
+ a.style.background = '#2d9418';
169
+ a.style.borderColor = '#2d9418';
170
+ a.style.boxShadow = 'none';
171
+ a.style.marginRight = '15px';
172
+ a.setAttribute('href', 'https://tastewp.com/plugins/' + slug);
173
+ a.setAttribute('target', '_blank');
174
+ a.innerText = 'Try it first';
175
+
176
+ return a;
177
+
178
+ }
179
+
180
+ const observer = new MutationObserver(function (mutations_list) {
181
+ mutations_list.forEach(function (mutation) {
182
+ mutation.addedNodes.forEach(function (added_node) {
183
+ if (added_node.id == 'TB_window') {
184
+ $('#TB_window #TB_iframeContent')[0].onload = function () {
185
+ let iframe = $('#TB_iframeContent').contents();
186
+ let footer = iframe.find('#plugin-information-footer');
187
+ let slug = footer.find('#plugin_install_from_iframe').data('slug');
188
+ let btn = makeButton(slug);
189
+ footer.append(btn);
190
+ }
191
+ }
192
+ });
193
+ });
194
+ });
195
+
196
+ observer.observe(document.querySelector('body'), { subtree: false, childList: true });
197
+ });
198
+ </script>
199
+ <?php
200
+ }
201
+
202
+ public function informativeAdminNoticeHandler() {
203
+
204
+ ?>
205
+
206
+ <div class="notice notice-success is-dismissible" id="tifm_new_feature_notice">
207
+ <p id="tifm_paragraph_notice">
208
+ <span class="tifm-grow-1">
209
+ <b>New: </b> Click on the&nbsp;
210
+ <a class="button" style="color:#2d9418;border-color:#2d9418;text-align:center;width:88px" href="#!">Try it first</a>
211
+ &nbsp;button to first test a plugin on a new WP instance.
212
+ </span>
213
+
214
+ <span class="tifm-grow-5">
215
+ <a class="tifm_darker_a" href="#">Got it, close this notice</a>
216
+ </span>
217
+
218
+ <span class="tifm-grow-1">
219
+ <a class="tifm_darker_a_muted" href="#">Disable this feature</a>
220
+ </span>
221
+
222
+ <span>
223
+ Brought to you by <a class="tifm_brought_url" href="<?php echo esc_html($this->pluginPageURL); ?>"><?php echo esc_html($this->pluginName); ?></a>
224
+ </span>
225
+ </p>
226
+ </div>
227
+
228
+ <?php
229
+
230
+ }
231
+
232
+ public function insertActionButton() {
233
+
234
+ add_filter('plugin_install_action_links', [&$this, 'actionButtonHandler'], 10, 2);
235
+
236
+ }
237
+
238
+ public static function noticeAjax() {
239
+
240
+ // Nonce verification
241
+ if (!isset($_POST['nonce']) || !wp_verify_nonce(sanitize_text_field($_POST['nonce']), 'tifm_notice_nonce')) {
242
+ wp_send_json_error();
243
+ return;
244
+ }
245
+
246
+ $method = '';
247
+ if (isset($_POST['method'])) {
248
+
249
+ $method = sanitize_text_field($_POST['method']);
250
+
251
+ }
252
+
253
+ if ($method == 'dismiss_notice') {
254
+
255
+ update_option('_tifm_hide_notice_forever', true);
256
+ wp_send_json_success();
257
+ exit;
258
+
259
+ } else if ($method == 'dismiss_notice_and_disable') {
260
+
261
+ update_option('_tifm_hide_notice_forever', true);
262
+ update_option('_tifm_disable_feature_forever', true);
263
+ update_option('_tifm_feature_enabled', 'disabled');
264
+ wp_send_json_success();
265
+ exit;
266
+
267
+ } else {
268
+
269
+ wp_send_json_error();
270
+ exit;
271
+
272
+ }
273
+
274
+ }
275
+
276
+ public function actionButtonHandler($links, $plugin) {
277
+
278
+ $url = 'https://tastewp.com/plugins/' . $plugin['slug'] . '/?anchor=wpsite';
279
+ $button = ['<a class="button" style="color:#2d9418;border-color:#2d9418;text-align:center;width:88px" target="_blank" href="' . $url . '">Try it first</a>'];
280
+ array_splice($links, 1, 0, $button);
281
+
282
+ return $links;
283
+
284
+ }
285
+
286
+ }
287
+ }
288
+
289
+ }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: cl272
3
  Donate link: https://sellcodes.com/5U4SICyc
4
  Tags: widget, clickable, linkable, linked title, text, php, javascript, flash, linked title text, linked, text widget, php widget, link widget title, bare widget, widget shortcodes, enhanced text, better text widget, simple, html widget, css
5
  Requires at least: 3.6
6
- Tested up to: 6.0
7
- Stable tag: 1.5.3
8
  License: MIT
9
  License URI: http://opensource.org/licenses/MIT
10
 
@@ -12,7 +12,8 @@ An enhanced version of the text widget that supports Text, HTML, CSS, JavaScript
12
 
13
  == Description ==
14
 
15
- **Try it out on your free dummy site: Click here => [https://tastewp.com/plugins/enhanced-text-widget](https://tastewp.com/plugins/enhanced-text-widget)**
 
16
 
17
  Note: This is a **classic widget** type, in order for it to work on the latest version of WordPress you will need [Classic Widgets](https://wordpress.org/plugins/classic-widgets/) plugin installed on your site.
18
 
@@ -55,38 +56,14 @@ Nothing right now.
55
 
56
  1. Widget options
57
 
58
- == Upgrade Notice ==
59
-
60
- = 1.5.3 =
61
- * Added admin notice for new Widget editor
62
- * Fixed Some minor fixes
63
- * Tested up to WordPress 6.0-beta1
64
-
65
- = 1.5.2 =
66
- * Tested up to WordPress 5.7.1
67
- * Added support for PHP 8
68
- * Updated banner
69
-
70
- = 1.5.1 =
71
- * Tested with new version of WordPress
72
- * Updated Opt-in
73
-
74
- = 1.5 =
75
- * Fixed issue with not registered widget
76
-
77
- = 1.3.4 =
78
- This adds option to hide the title
79
-
80
- = 1.2 =
81
- This adds option to display bare text (no before/after widget/title elements are shown).
82
-
83
- = 1.1 =
84
- This adds a CSS class parameter to each widget.
85
-
86
- = 1.0 =
87
- This is the initial release.
88
-
89
  == Changelog ==
 
 
 
 
 
 
 
90
 
91
  = 1.5.3 =
92
  * Added admin notice for new Widget editor
@@ -161,3 +138,10 @@ This is the initial release.
161
 
162
  = 1.0 =
163
  * First release.
 
 
 
 
 
 
 
3
  Donate link: https://sellcodes.com/5U4SICyc
4
  Tags: widget, clickable, linkable, linked title, text, php, javascript, flash, linked title text, linked, text widget, php widget, link widget title, bare widget, widget shortcodes, enhanced text, better text widget, simple, html widget, css
5
  Requires at least: 3.6
6
+ Tested up to: 6.1
7
+ Stable tag: 1.5.5
8
  License: MIT
9
  License URI: http://opensource.org/licenses/MIT
10
 
12
 
13
  == Description ==
14
 
15
+ **Try it out on your free dummy site: Click here => [https://tastewp.com/plugins/enhanced-text-widget](https://demo.tastewp.com/enhanced-text-widget).**
16
+ (this trick works for all plugins in the WP repo - just replace "wordpress" with "tastewp" in the URL)
17
 
18
  Note: This is a **classic widget** type, in order for it to work on the latest version of WordPress you will need [Classic Widgets](https://wordpress.org/plugins/classic-widgets/) plugin installed on your site.
19
 
56
 
57
  1. Widget options
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  == Changelog ==
60
+ = 1.5.5 =
61
+ * Added try it out module
62
+
63
+ = 1.5.4 =
64
+ * Tested up to WordPress 6.1-RC5
65
+ * Updated try it out URL in readme to properly setup demo site
66
+ * Adjusted carrousel module
67
 
68
  = 1.5.3 =
69
  * Added admin notice for new Widget editor
138
 
139
  = 1.0 =
140
  * First release.
141
+
142
+ == Upgrade Notice ==
143
+ = 1.5.5 =
144
+ * Tested up to WordPress 6.1-RC5
145
+ * Updated try it out URL in readme
146
+ * Adjusted carrousel module
147
+ * Added try it out module