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 / DashboardController.php

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

35 lines 880 B
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\Database\Cache;
6 use GeminiLabs\SiteReviews\Metaboxes\DashboardMetabox;
7
8 class DashboardController extends AbstractController
9 {
10 /**
11 * @action transition_post_status:5
12 */
13 public function flushMonthlyCountCache(string $newStatus, string $oldStatus, ?\WP_Post $post): void
14 {
15 if (is_null($post)) {
16 return; // This should never happen, but some plugins are bad actors so...
17 }
18 if (glsr()->post_type !== $post->post_type) {
19 return;
20 }
21 if ($newStatus === $oldStatus) {
22 return;
23 }
24 glsr(Cache::class)->delete('monthly', 'count');
25 }
26
27 /**
28 * @action wp_dashboard_setup
29 */
30 public function registerMetaBoxes(): void
31 {
32 glsr(DashboardMetabox::class)->register();
33 }
34 }
35