PluginProbe
ElasticPress / 4.6.1
ElasticPress v4.6.1
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
elasticpress / includes / classes / StatusReport / Features.php

Features.php in ElasticPress 4.6.1, at includes/classes/StatusReport/Features.php

69 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Feature report class
4 *
5 * @since 4.4.0
6 * @package elasticpress
7 */
8
9 namespace ElasticPress\StatusReport;
10
11 use \ElasticPress\Features as EP_Features;
12
13 defined( 'ABSPATH' ) || exit;
14
15 /**
16 * Feature report class
17 *
18 * @package ElasticPress
19 */
20 class Features extends Report {
21
22 /**
23 * Return the report title
24 *
25 * @return string
26 */
27 public function get_title() : string {
28 return __( 'Feature Settings', 'elasticpress' );
29 }
30
31 /**
32 * Return the report fields
33 *
34 * @return array
35 */
36 public function get_groups() : array {
37 $features_settings = \ElasticPress\Utils\get_option( 'ep_feature_settings', [] );
38
39 $features = array_filter(
40 EP_Features::factory()->registered_features,
41 function( $feature ) {
42 return $feature->is_active();
43 }
44 );
45 $features = wp_list_sort( $features, 'title' );
46
47 $groups = [];
48 foreach ( $features as $feature ) {
49 $feature_settings = $features_settings[ $feature->slug ] ?? [];
50
51 $fields = [];
52 foreach ( $feature_settings as $feature_setting => $value ) {
53 $fields[ $feature_setting ] = [
54 'label' => $feature_setting,
55 'value' => $value,
56 ];
57 }
58 ksort( $fields );
59
60 $groups[] = [
61 'title' => $feature->get_short_title(),
62 'fields' => $fields,
63 ];
64 }
65
66 return $groups;
67 }
68 }
69