File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -199,7 +199,7 @@ private function makeExtraHttpHeaderKeySetting()
199
199
'Cookie ' => Piwik::translate ('PerformanceAudit_Settings_ExtraHttpHeaderKey_Cookie ' ),
200
200
];
201
201
$ field ->validate = function ($ value ) use ($ self , $ field ) {
202
- if ($ self ->getSetting ( ' has_extra_http_header ' )-> getValue ()) {
202
+ if ($ self ->hasExtraHttpHeader ()) {
203
203
if (empty ($ value )) {
204
204
throw new ValidatorException (Piwik::translate ('General_ValidatorErrorEmptyValue ' ));
205
205
}
@@ -227,7 +227,7 @@ private function makeExtraHttpHeaderValueSetting()
227
227
$ field ->condition = 'is_enabled && has_extra_http_header ' ;
228
228
$ field ->uiControl = FieldConfig::UI_CONTROL_TEXT ;
229
229
$ field ->validate = function ($ value ) use ($ self , $ field ) {
230
- if ($ self ->getSetting ( ' has_extra_http_header ' )-> getValue ()) {
230
+ if ($ self ->hasExtraHttpHeader ()) {
231
231
if (empty ($ value )) {
232
232
throw new ValidatorException (Piwik::translate ('General_ValidatorErrorEmptyValue ' ));
233
233
}
@@ -288,4 +288,14 @@ public function hasGroupedUrls()
288
288
{
289
289
return $ this ->getSetting ('has_grouped_urls ' )->getValue ();
290
290
}
291
+
292
+ /**
293
+ * Returns if site has extra HTTP header for site.
294
+ *
295
+ * @return bool
296
+ */
297
+ public function hasExtraHttpHeader ()
298
+ {
299
+ return $ this ->getSetting ('has_extra_http_header ' )->getValue ();
300
+ }
291
301
}
Original file line number Diff line number Diff line change @@ -279,7 +279,7 @@ private static function getLighthouse(int $idSite)
279
279
if ($ siteSettings ->hasExtendedTimeout ()) {
280
280
self ::$ lighthouse [$ idSite ]->setTimeout (300 );
281
281
}
282
- if ($ siteSettings ->getSetting ( ' has_extra_http_header ' )-> getValue ()) {
282
+ if ($ siteSettings ->hasExtraHttpHeader ()) {
283
283
self ::$ lighthouse [$ idSite ]->setHeaders ([
284
284
$ siteSettings ->getSetting ('extra_http_header_key ' )->getValue () => $ siteSettings ->getSetting ('extra_http_header_value ' )->getValue ()
285
285
]);
You can’t perform that action at this time.
0 commit comments