PluginProbe ʕ •ᴥ•ʔ
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More / 2.6.7
Reviews Feed – Add Testimonials and Customer Reviews From Google Reviews, Yelp, TripAdvisor, and More v2.6.7
2.11.0 2.10.0 2.9.0 2.8.0 2.7.0 2.6.7 2.6.8 2.6.5 2.6.4 2.6.3 2.6.2 2.6.0 2.5.5 2.5.4 2.5.3 2.5.2 trunk 1.0 1.0.1 1.0.2 1.0.3 1.1 1.1.1 1.1.2 1.2.0 2.0 2.1.0 2.1.1 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.5.0 2.5.1
reviews-feed / class / Common / Admin / MenuService.php
reviews-feed / class / Common / Admin Last commit date
Blocks 2 months ago MenuService.php 2 months ago SBR_About_Builder.php 2 months ago SBR_Admin_Notice.php 2 months ago SBR_Collections_Builder.php 2 months ago SBR_New_User.php 2 months ago SBR_Notifications.php 2 months ago SBR_Plugin_Insltaller.php 2 months ago SBR_Support_Builder.php 2 months ago SBR_Support_Tool.php 2 months ago
MenuService.php
87 lines
1 <?php
2
3 /**
4 * Menu Service
5 */
6
7 namespace SmashBalloon\Reviews\Common\Admin;
8
9 if (! defined('ABSPATH')) {
10 exit;
11 }
12
13 use Smashballoon\Stubs\Services\ServiceProvider;
14
15 class MenuService extends ServiceProvider
16 {
17 public function register()
18 {
19 add_action('admin_menu', [$this, 'register_menus']);
20 add_action('in_admin_header', array( $this, 'remove_admin_notices' ));
21 }
22
23 public function register_menus()
24 {
25 $notice = '';
26 $is_notice = SBR_Admin_Notice::check_menu_notice_bubble();
27 if ($is_notice) {
28 $notice = ' <span class="sbr-notice-alert update-plugins"><span>!</span></span>';
29 }
30
31 $sbr_notifications = new SBR_Notifications();
32 $notifications = $sbr_notifications->get();
33
34 $notice_bubble = '';
35 if (empty($notice) && ! empty($notifications) && is_array($notifications)) {
36 $notice_bubble = ' <span class="sbr-notice-alert"><span>' . count($notifications) . '</span></span>';
37 }
38 $cap = current_user_can('manage_reviews_feed_options') ? 'manage_reviews_feed_options' : 'manage_options';
39 $cap = apply_filters('sbr_settings_pages_capability', $cap);
40
41
42 $menu_title = check_license_valid() ? __('All Feeds', 'reviews-feed') : __('Set up Plugin', 'reviews-feed');
43 $page = add_menu_page(
44 $menu_title,
45 __('Reviews Feed', 'reviews-feed') . $notice . $notice_bubble,
46 $cap,
47 SBR_MENU_SLUG
48 );
49
50 add_action('load-' . $page, [$this, 'enqueue_assets']);
51 add_action('admin_enqueue_scripts', [ $this, 'global_assets' ]);
52 }
53
54 public function enqueue_assets()
55 {
56 wp_register_script('sbr_settings', SBR_PLUGIN_URL . '/public/js/noop.js');
57 wp_localize_script('sbr_settings', 'sbr_settings', [
58 'supportedProviders' => apply_filters('sbr_supported_providers', [])
59 ]);
60
61 wp_enqueue_script('sbr_settings');
62 }
63
64 public function global_assets()
65 {
66 wp_enqueue_style('sbr-admin-global', SBR_PLUGIN_URL . '/public/admin-global.css', [], SBRVER);
67 }
68
69 public function remove_admin_notices()
70 {
71 $current_screen = get_current_screen();
72 $not_allowed_screens = array(
73 'instagram-feed_page_sbi-feed-builder',
74 'instagram-feed_page_sbi-settings',
75 'instagram-feed_page_sbi-oembeds-manager',
76 'instagram-feed_page_sbi-extensions-manager',
77 'instagram-feed_page_sbi-about-us',
78 'instagram-feed_page_sbi-support',
79 );
80
81 if (! empty($_GET['page']) && strpos($_GET['page'], 'sbr') === 0) {
82 remove_all_actions('admin_notices');
83 remove_all_actions('all_admin_notices');
84 }
85 }
86 }
87