Plugin Directory

source: elasticpress/trunk/includes/classes/StatusReport/AjaxReport.php

Last change on this file was 3270484, checked in by 10up, 5 weeks ago

Update to version 5.2.0 from

File size: 1.0 KB
Line 
1<?php
2/**
3 * AjaxReport abstract class
4 *
5 * @package elasticpress
6 *
7 * @since 5.2.0
8 */
9
10namespace ElasticPress\StatusReport;
11
12defined( 'ABSPATH' ) || exit;
13
14/**
15 * AjaxReport class
16 *
17 * @package ElasticPress
18 */
19abstract class AjaxReport extends Report {
20        /**
21         * Groups must return empty array in Ajax context. Always
22         *
23         * @return array
24         */
25        final public function get_groups(): array {
26                return [];
27        }
28
29        /**
30         * Return the report messages.
31         *
32         * @return array
33         */
34        public function get_messages(): array {
35                if ( isset( $_POST['action'] ) && 'ep_load_groups' === $_POST['action'] ) { // phpcs:ignore WordPress.Security.NonceVerification
36                        return [];
37                }
38
39                $messages = [
40                        [
41                                'type'    => 'warning',
42                                'message' => sprintf(
43                                        __( 'To see this report, please generate a full report first by clicking the "Generate Full Status Report" button.', 'elasticpress' ),
44                                ),
45                        ],
46                ];
47
48                return $messages;
49        }
50
51        /**
52         * Return the report groups in an AJAX context
53         *
54         * @return string
55         */
56        abstract public function get_groups_ajax(): array;
57}
Note: See TracBrowser for help on using the repository browser.