PluginProbe ʕ •ᴥ•ʔ
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets / 4.0.0
Widget Options – Advanced Conditional Visibility for Gutenberg Blocks & Classic Widgets v4.0.0
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
128 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_admin_notice_after_plugin_update')) {
87 /**
88 * This function runs when WordPress completes its upgrade process
89 * It iterates through each plugin updated to see if widgetopts is included
90 * @param $upgrader_object Array
91 * @param $options Array
92 */
93 function widgetopts_admin_notice_after_plugin_update($upgrader_object, $options)
94 {
95 // The path to our plugin's main file
96 $widgetopts_plugin = defined('WIDGETOPTS_PLUGIN_FILE') ? plugin_basename(WIDGETOPTS_PLUGIN_FILE) : "widget-options/plugin.php";
97 // If an update has taken place and the updated type is plugins and the plugins element exists
98 if ($options['action'] == 'update' && $options['type'] == 'plugin' && isset($options['plugins']) && isset($options['version']) && intval(str_pad(preg_replace('/\./i', '', $options['version']), 3, '0', STR_PAD_RIGHT)) >= 400) {
99 // Iterate through the plugins being updated and check if widgetopts is there
100 foreach ($options['plugins'] as $plugin) {
101 if ($plugin == $widgetopts_plugin) {
102 // Set a transient to record that our plugin has just been updated
103 set_transient('widgetopts_free_updated', 1);
104 }
105 }
106 }
107 }
108 add_action('upgrader_process_complete', 'widgetopts_admin_notice_after_plugin_update', 10, 2);
109 }
110
111 if (!function_exists('widgetopts_display_update_admin_notice')) {
112 /**
113 * Show a notice to anyone who has just updated this plugin
114 * This notice shouldn't display to anyone who has just installed the plugin for the first time
115 */
116 function widgetopts_display_update_admin_notice()
117 {
118 // Check the transient to see if we've just updated the plugin
119 if (get_transient('widgetopts_free_updated')) {
120 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>
121 ' . __('Explore the Gutenberg Widget Options in the Block Widget Editor and Posts/Pages Block for an elevated experience!', 'widget-options') . '</strong></p>
122 ' . wp_nonce_field('widgetopts-settings-nonce', 'widgetopts-settings-nonce') . '
123 <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>';
124 }
125 }
126 add_action('admin_notices', 'widgetopts_display_update_admin_notice');
127 }
128