PluginProbe
Site Reviews / trunk
Site Reviews vtrunk
8.3.1 8.3.0 8.2.2 8.2.1 8.2.0 8.1.0 8.0.13 8.0.12 8.0.11 trunk 1.2.2 2.17.1 3.5.4 4.7.0 5.25.1 6.11.8 7.0.10 7.0.11 7.0.12 7.0.13 7.0.14 7.0.15 7.0.16 7.0.17 7.0.18 All 54 releases
site-reviews / plugin / Controllers / FlyoutController.php

FlyoutController.php in Site Reviews trunk, at plugin/Controllers/FlyoutController.php

81 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace GeminiLabs\SiteReviews\Controllers;
4
5 use GeminiLabs\SiteReviews\Defaults\FlyoutItemDefaults;
6 use GeminiLabs\SiteReviews\License;
7
8 class FlyoutController extends AbstractController
9 {
10 /**
11 * @action admin_footer
12 */
13 public function renderFlyout(): void
14 {
15 $screen = glsr_current_screen();
16 if ('post' === $screen->base) {
17 return;
18 }
19 if (!str_starts_with($screen->post_type, glsr()->post_type)) {
20 return;
21 }
22 if (!glsr()->filterBool('flyoutmenu/enabled', true)) {
23 return;
24 }
25 glsr()->render('views/partials/flyoutmenu', [
26 'items' => $this->menuItems(),
27 ]);
28 }
29
30 protected function menuItems(): array
31 {
32 $items = [
33 [
34 'class' => 'glsr-flyout-premium',
35 'icon' => 'dashicons-star-filled',
36 'title' => _x('Upgrade to Premium', 'admin-text', 'site-reviews'),
37 'url' => glsr_premium_url('site-reviews-premium'),
38 ],
39 [
40 'icon' => 'dashicons-wordpress-alt',
41 'title' => _x('Ask for Help', 'admin-text', 'site-reviews'),
42 'url' => 'https://wordpress.org/support/plugin/site-reviews/',
43 ],
44 [
45 'icon' => 'dashicons-youtube',
46 'title' => _x('Watch the Tutorial', 'admin-text', 'site-reviews'),
47 'url' => 'https://youtu.be/H5HdMCXvuq8',
48 ],
49 [
50 'icon' => 'dashicons-editor-help',
51 'title' => _x('Read the Documentation', 'admin-text', 'site-reviews'),
52 'url' => glsr_admin_url('documentation'),
53 ],
54 [
55 'icon' => 'dashicons-book',
56 'title' => _x('Read a Quick Guide to Site Reviews', 'admin-text', 'site-reviews'),
57 'url' => glsr_admin_url('welcome'),
58 ],
59 [
60 'class' => 'glsr-flyout-write-review',
61 'icon' => 'dashicons-testimonial',
62 'title' => _x('Rate Site Reviews �
63
64
65
66
67 on Wordpress', 'admin-text', 'site-reviews'),
68 'url' => 'https://wordpress.org/support/plugin/site-reviews/reviews/#new-post',
69 ],
70 ];
71 if (glsr(License::class)->isPremium()) {
72 array_shift($items);
73 }
74 $items = glsr()->filterArray('flyoutmenu/items', $items);
75 array_walk($items, function (&$item) {
76 $item = glsr(FlyoutItemDefaults::class)->restrict($item);
77 });
78 return $items;
79 }
80 }
81