PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 4.0.5
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v4.0.5
4.2.5 4.2.4 trunk 3.7.10 3.7.11 3.7.12 3.7.13 3.7.14 3.7.2 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8 3.8.1 3.8.10 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.8.8 3.8.9 3.8.9.1 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.5.1 4.0.6 4.0.6.1 4.0.7 4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.1.3 4.2.0 4.2.1 4.2.2 4.2.3
widget-options / includes / admin / notices.php
widget-options / includes / admin Last commit date
settings 2 years ago globals.php 2 years ago import-export.php 2 years ago notices.php 2 years ago welcome.php 2 years ago
notices.php
121 lines
1 <?php
2
3 /**
4 * Handles additional widget tab options
5 * run on __construct function
6 */
7
8 // Exit if accessed directly
9 if (!defined('ABSPATH')) exit;
10
11
12 /**
13 * Admin Messages
14 * @return void
15 */
16 if (!function_exists('widgetopts_admin_notices')) :
17 function widgetopts_admin_notices()
18 {
19 if (!current_user_can('update_plugins'))
20 return;
21
22 //show rating notice to page that matters most
23 global $pagenow;
24 if (!in_array($pagenow, array('widgets.php', 'options-general.php'))) {
25 return;
26 }
27
28 if ($pagenow == 'options-general.php' && function_exists('get_current_screen')) {
29 $screen = get_current_screen();
30 if (isset($screen->base) && $screen->base != 'settings_page_widgetopts_plugin_settings') {
31 return;
32 }
33 }
34
35 $install_date = get_option('widgetopts_installDate');
36 $saved = get_option('widgetopts_RatingDiv');
37 $display_date = date('Y-m-d h:i:s');
38 $datetime1 = new DateTime($install_date);
39 $datetime2 = new DateTime($display_date);
40 $diff_intrval = round(($datetime2->format('U') - $datetime1->format('U')) / (60 * 60 * 24));
41 if ('yes' != $saved && $diff_intrval >= 7) {
42 echo '<div class="widgetopts_notice updated" style="box-shadow: 0 1px 1px 0 rgba(0,0,0,.1);">
43 <p>Well done! You have been enjoying <strong>Widget Options</strong> for more than a week.
44 <br>
45 Do you love it? Are you over the moon? Will you give us a <a href="https://wordpress.org/support/view/plugin-reviews/widget-options" class="thankyou" target="_blank" title="Ok, you deserved it" style="font-weight:bold;"><strong>5-star rating</strong></a> on WordPress?
46 </br>
47 Your review is essential to the Widget Options community and our ongoing succes.
48 <br><br>
49 Thank you so much! � Your Widget Options Team
50 <ul>
51 <li><a href="https://wordpress.org/support/view/plugin-reviews/widget-options" class="thankyou" target="_blank" title="Ok, you deserved it" style="font-weight:bold;">' . __('Definitely. Widget Options is the best!', 'widget-options') . '</a></li>
52 <li><a href="javascript:void(0);" class="widgetopts_bHideRating" title="I already did" style="font-weight:bold;">' . __('Already done!', 'widget-options') . '</a></li>
53 <li><a href="https://widget-options.com/contact/" class="thankyou" target="_blank" title="Ok, you deserved it" style="font-weight:bold;">' . __("Not convinced yet. Still think about it.", 'widget-options') . '</a></li>
54 <li><a href="javascript:void(0);" class="widgetopts_bHideRating" title="No, not good enough" style="font-weight:bold;">' . __("Dismiss", 'widget-options') . '</a></li>
55 </ul>
56 </div>
57 <script>
58 jQuery( document ).ready(function( $ ) {
59
60 jQuery(\'.widgetopts_bHideRating\').click(function(){
61 var data={\'action\':\'widgetopts_hideRating\'}
62 jQuery.ajax({
63
64 url: "' . admin_url('admin-ajax.php') . '",
65 type: "post",
66 data: data,
67 dataType: "json",
68 async: !0,
69 success: function(e) {
70 if (e=="success") {
71 jQuery(\'.widgetopts_notice\').slideUp(\'slow\');
72
73 }
74 }
75 });
76 })
77
78 });
79 </script>
80 ';
81 }
82 }
83 add_action('admin_notices', 'widgetopts_admin_notices');
84 endif;
85
86 if (!function_exists('widgetopts_display_update_admin_notice')) {
87 /**
88 * Show a notice to anyone who has just updated this plugin
89 * This notice shouldn't display to anyone who has just installed the plugin for the first time
90 */
91 function widgetopts_display_update_admin_notice()
92 {
93 $current = defined('WIDGETOPTS_VERSION') ? intval(str_pad(preg_replace('/\./i', '', WIDGETOPTS_VERSION), 3, '0', STR_PAD_RIGHT)) : 400;
94
95 if ($current >= 400) {
96 if (!get_option('widgetopts_upgrade')) {
97 add_option('widgetopts_upgrade', 1);
98 }
99
100 if (!get_option('widgetopts_version')) {
101 add_option('widgetopts_version', $current);
102 } else {
103 if (intval(get_option('widgetopts_version')) < $current) {
104 update_option('widgetopts_version', $current);
105 update_option('widgetopts_upgrade', 1);
106 }
107 }
108 }
109
110 $v = get_option('widgetopts_upgrade');
111 // Check the option to see if we've just updated the plugin
112 if (intval($v) == 1) {
113 echo '<div class="notice notice-success is-dismissible widgetopts-notice" style="border-left-color: #064466"><h3 style="margin-bottom: 0;">' . __('Exciting news! Widget Options is now a Gutenberg Block-Enabled plugin.', 'widget-options') . '</h3><p><strong>
114 ' . __('Explore the Gutenberg Widget Options in the Block Widget Editor and Posts/Pages Block for an elevated experience!', 'widget-options') . '</strong></p>
115 ' . wp_nonce_field('widgetopts-settings-nonce', 'widgetopts-settings-nonce') . '
116 <p><a href="https://widget-options.com/blog/widget-options-integrated-with-gutenberg-widgets-blocks/" target="_blank" class="button" style="background: #064466;border-color: #064466;color: #fff; text-decoration: none;text-shadow: none;">Learn More</a></p></div>';
117 }
118 }
119 add_action('admin_notices', 'widgetopts_display_update_admin_notice');
120 }
121