PluginProbe ʕ •ᴥ•ʔ
Rich Showcase for Google Reviews / 6.4
Rich Showcase for Google Reviews v6.4
6.9.8 6.9.7 6.9.6 trunk 1.4 1.42 1.43 1.44 1.45 1.46 1.47 1.48 1.49 1.5 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.7 1.6.8 1.6.9 1.7 1.7.1 1.7.2 1.7.3 1.7.4 1.7.5 1.7.6 1.7.7 1.7.8 1.7.9 1.8 1.8.1 1.8.2 1.8.3 1.8.4 1.8.5 1.8.6 1.8.7 1.8.8 1.8.9 1.9 1.9.1 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.4 2.4.1 2.4.2 2.5 2.5.1 2.6 2.6.1 2.6.2 2.7 2.8 2.9 3.0 3.1 3.2 3.3 3.4 3.5 3.6 3.6.1 3.7 3.8 3.9 4.0 4.1 4.2 4.3 4.4 4.5 4.6 4.7 4.8 4.8.1 4.8.2 5.0 5.1 5.2 5.3 5.4 5.5 5.6 5.7 5.7.1 5.8 5.9 5.9.1 5.9.2 5.9.3 5.9.7 6.0 6.1 6.2 6.3 6.4 6.4.1 6.5 6.6 6.6.1 6.6.2 6.7 6.8 6.8.1 6.8.2 6.9 6.9.1 6.9.2 6.9.3 6.9.4 6.9.4.1 6.9.4.2 6.9.4.3 6.9.4.4 6.9.5
widget-google-reviews / includes / admin / class-admin-notice.php
widget-google-reviews / includes / admin Last commit date
class-admin-feed-columns.php 10 months ago class-admin-menu.php 2 years ago class-admin-notice.php 1 year ago class-admin-page.php 3 years ago class-admin-rateus-ajax.php 1 year ago class-admin-rev.php 1 year ago class-admin-tophead.php 1 year ago
class-admin-notice.php
82 lines
1 <?php
2
3 namespace WP_Rplg_Google_Reviews\Includes\Admin;
4
5 class Admin_Notice {
6
7 private $notice_id;
8
9 private static $plugin_notices = array(
10 'settings_active_0' => 'Plugin disabled successfully.',
11 'settings_active_1' => 'Plugin enabled successfully.',
12 'settings_save' => 'Settings saved successfully.',
13 'settings_create_db' => 'Database re-created successfully.',
14 'settings_reset' => 'Settings deleted successfully.',
15 'settings_install' => 'Plugin installed from scratch successfully.',
16 'settings_reset_all' => 'All data including settings and reviews deleted successfully.',
17 'settings_debug_mode_0' => 'Debug mode disabled successfully.',
18 'settings_debug_mode_1' => 'Debug mode enabled successfully.',
19 'settings_update_db' => 'Database updated successfully.',
20 'settings_revupd_cron_0' => 'Reviews update daily schedule disabled successfully.',
21 'settings_revupd_cron_1' => 'Reviews update daily schedule enabled successfully.',
22 'settings_del_dup_revs' => 'Duplicate reviews removed',
23 );
24
25 public function register() {
26 add_filter('removable_query_args', array($this, 'remove_query_args'));
27 add_action('admin_notices', array($this, 'parse_notices_from_url'));
28 add_action('admin_notices', array($this, 'render_notices'));
29 }
30
31 public function remove_query_args($args) {
32 return array_merge($args, array('grw_notice'));
33 }
34
35 public function parse_notices_from_url() {
36 if (!isset($_GET['grw_notice'])) {
37 return;
38 }
39
40 $this->notice_id = sanitize_text_field(wp_unslash($_GET['grw_notice']));
41 }
42
43 public function render_notices() {
44 if (empty($this->notice_id) || !$this->is_valid_screen()) {
45 return;
46 }
47
48 if (doing_action('admin_notices') && $this->needs_repositioned()) {
49 add_action('grw_admin_notices', array($this, 'render_notices'));
50 return;
51 }
52
53 ?>
54 <div class="notice notice-<?php echo get_option('grw_notice_type'); ?> is-dismissible">
55 <p><?php echo $this->notice_id != 'custom_msg' ? self::$plugin_notices[$this->notice_id] : get_option('grw_notice_msg'); ?></p>
56 </div>
57 <?php
58
59 $this->notice_id = '';
60 }
61
62 protected function is_valid_screen($screen_id = '') {
63 if ($screen_id === '') {
64 $screen = get_current_screen();
65 $screen_id = $screen->id;
66 }
67
68 return ($screen_id === 'dashboard' || $screen_id === 'plugins' || strpos($screen_id, 'grw') !== false) ? true : false;
69 }
70
71 protected function needs_repositioned($screen_id = '') {
72 if ($screen_id === '') {
73 $screen = get_current_screen();
74 $screen_id = $screen->id;
75 }
76
77 $screen_ids = array('google-reviews_page_grw-settings');
78 return in_array($screen_id, $screen_ids) ? true : false;
79 }
80
81 }
82