Skip to content

Commit c95d2b8

Browse files
authored
Merge pull request #7 from wp-media/new_post_meta_exclusions
"Post meta excluions" is now an array of option names
2 parents fce2845 + 1e53ce8 commit c95d2b8

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "wpr-diagnoser",
3-
"version": "2.0.1",
3+
"version": "3.0.0",
44
"description": "WP Rocket Diagnoser, plugin used by the Support team",
55
"type": "module",
66
"scripts": {
77
"build:release": "node ./build-release.js"
88
},
99
"author": "",
1010
"license": "PRIVATE"
11-
}
11+
}

src/inc/WPRDiagnoserOptions.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ class WPRDiagnoserOptions
88
{
99
private $option_pre_filter_prefix = 'pre_get_rocket_option_';
1010
private $option_post_filter_prefix = 'get_rocket_option_';
11+
private $post_meta_options = ['remove_unused_css', 'delay_js', 'defer_all_js', 'async_css', 'lazyload', 'lazyload_iframes', 'lazyload_css_bg_img', 'minify_css', 'minify_js', 'cdn'];
1112
/**
1213
* Contains the list of WP Rocket options and their related filters and options to be processed
1314
*
@@ -56,7 +57,8 @@ class WPRDiagnoserOptions
5657
'delay_js' => [
5758
'name' => 'Delay JavaScript Execution',
5859
'get_rocket_option' => [
59-
'delay_js_exclusions', 'delay_js_exclusions_selected_exclusions'
60+
'delay_js_exclusions',
61+
'delay_js_exclusions_selected_exclusions'
6062
],
6163
'filters' => [
6264
['rocket_delay_js_exclusions', []]
@@ -210,13 +212,14 @@ public function fill_options(string $option_name, array $option_list)
210212
}
211213
private function fill_rocket_post_meta_options()
212214
{
213-
$result = [];
215+
$excluded_options = [];
214216
foreach ($this->options as $option_name => $value) {
215-
if (isset($value['is_post_option']) && $value['is_post_option']) {
216-
$result[$option_name] = (bool) is_rocket_post_excluded_option($option_name);
217+
if (in_array($option_name, $this->post_meta_options, true)) {
218+
$is_excluded = (bool) is_rocket_post_excluded_option($option_name);
219+
if ($is_excluded) $excluded_options[] = $option_name;
217220
}
218221
}
219-
$this->result['post_meta_excluded_options'] = $result;
222+
$this->result['post_meta_excluded_options'] = $excluded_options;
220223
}
221224
public function get_list()
222225
{

0 commit comments

Comments
 (0)