PluginProbe
ElasticPress / 5.3.5
ElasticPress v5.3.5
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
← All changes | includes/classes/StatusReport/Features.php +37 -4 4.6.15.3.5 View file →
@@ -7,9 +7,10 @@
7 7 */
8 8
9 9 namespace ElasticPress\StatusReport;
10 10
11 -use \ElasticPress\Features as EP_Features;
11 +use ElasticPress\Features as EP_Features;
12 +use ElasticPress\Feature\Search\Search;
12 13
13 14 defined( 'ABSPATH' ) || exit;
14 15
15 16 /**
@@ -23,9 +24,9 @@
23 24 * Return the report title
24 25 *
25 26 * @return string
26 27 */
27 - public function get_title() : string {
28 + public function get_title(): string {
28 29 return __( 'Feature Settings', 'elasticpress' );
29 30 }
30 31
31 32 /**
@@ -32,14 +33,14 @@
32 33 * Return the report fields
33 34 *
34 35 * @return array
35 36 */
36 - public function get_groups() : array {
37 + public function get_groups(): array {
37 38 $features_settings = \ElasticPress\Utils\get_option( 'ep_feature_settings', [] );
38 39
39 40 $features = array_filter(
40 41 EP_Features::factory()->registered_features,
41 - function( $feature ) {
42 + function ( $feature ) {
42 43 return $feature->is_active();
43 44 }
44 45 );
45 46 $features = wp_list_sort( $features, 'title' );
@@ -56,8 +57,12 @@
56 57 ];
57 58 }
58 59 ksort( $fields );
59 60
61 + if ( method_exists( $this, "get_{$feature->slug}_extra_fields" ) ) {
62 + $fields = call_user_func( [ $this, "get_{$feature->slug}_extra_fields" ], $fields, $feature );
63 + }
64 +
60 65 $groups[] = [
61 66 'title' => $feature->get_short_title(),
62 67 'fields' => $fields,
63 68 ];
@@ -63,6 +68,34 @@
63 68 ];
64 69 }
65 70
66 71 return $groups;
72 + }
73 +
74 + /**
75 + * Extra fields for the Search feature
76 + *
77 + * @since 4.7.1
78 + * @param array $fields Current fields
79 + * @param Search $feature Feature object
80 + * @return array New fields
81 + */
82 + protected function get_search_extra_fields( array $fields, Search $feature ): array {
83 + if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
84 + return $fields;
85 + }
86 +
87 + return array_merge(
88 + $fields,
89 + [
90 + 'synonyms' => [
91 + 'label' => __( 'Synonyms', 'elasticpress' ),
92 + 'value' => '<pre>' . $feature->synonyms->get_synonyms_raw() . '</pre>',
93 + ],
94 + 'weighting' => [
95 + 'label' => __( 'Search Fields & Weighting', 'elasticpress' ),
96 + 'value' => $feature->weighting->get_weighting_configuration(),
97 + ],
98 + ]
99 + );
67 100 }
68 101 }