@@ -408,91 +408,91 @@ |
||
408 | 408 | $policy .= "base-uri 'none';"; |
409 | 409 | $policy .= "manifest-src 'self';"; |
410 | 410 | |
411 | - if(!empty($this->allowedScriptDomains) || $this->inlineScriptAllowed || $this->evalScriptAllowed) { |
|
411 | + if (!empty($this->allowedScriptDomains) || $this->inlineScriptAllowed || $this->evalScriptAllowed) { |
|
412 | 412 | $policy .= 'script-src '; |
413 | - if(is_string($this->useJsNonce)) { |
|
413 | + if (is_string($this->useJsNonce)) { |
|
414 | 414 | $policy .= '\'nonce-'.base64_encode($this->useJsNonce).'\''; |
415 | 415 | $allowedScriptDomains = array_flip($this->allowedScriptDomains); |
416 | 416 | unset($allowedScriptDomains['\'self\'']); |
417 | 417 | $this->allowedScriptDomains = array_flip($allowedScriptDomains); |
418 | - if(count($allowedScriptDomains) !== 0) { |
|
418 | + if (count($allowedScriptDomains) !== 0) { |
|
419 | 419 | $policy .= ' '; |
420 | 420 | } |
421 | 421 | } |
422 | - if(is_array($this->allowedScriptDomains)) { |
|
422 | + if (is_array($this->allowedScriptDomains)) { |
|
423 | 423 | $policy .= implode(' ', $this->allowedScriptDomains); |
424 | 424 | } |
425 | - if($this->inlineScriptAllowed) { |
|
425 | + if ($this->inlineScriptAllowed) { |
|
426 | 426 | $policy .= ' \'unsafe-inline\''; |
427 | 427 | } |
428 | - if($this->evalScriptAllowed) { |
|
428 | + if ($this->evalScriptAllowed) { |
|
429 | 429 | $policy .= ' \'unsafe-eval\''; |
430 | 430 | } |
431 | 431 | $policy .= ';'; |
432 | 432 | } |
433 | 433 | |
434 | - if(!empty($this->allowedStyleDomains) || $this->inlineStyleAllowed) { |
|
434 | + if (!empty($this->allowedStyleDomains) || $this->inlineStyleAllowed) { |
|
435 | 435 | $policy .= 'style-src '; |
436 | - if(is_array($this->allowedStyleDomains)) { |
|
436 | + if (is_array($this->allowedStyleDomains)) { |
|
437 | 437 | $policy .= implode(' ', $this->allowedStyleDomains); |
438 | 438 | } |
439 | - if($this->inlineStyleAllowed) { |
|
439 | + if ($this->inlineStyleAllowed) { |
|
440 | 440 | $policy .= ' \'unsafe-inline\''; |
441 | 441 | } |
442 | 442 | $policy .= ';'; |
443 | 443 | } |
444 | 444 | |
445 | - if(!empty($this->allowedImageDomains)) { |
|
446 | - $policy .= 'img-src ' . implode(' ', $this->allowedImageDomains); |
|
445 | + if (!empty($this->allowedImageDomains)) { |
|
446 | + $policy .= 'img-src '.implode(' ', $this->allowedImageDomains); |
|
447 | 447 | $policy .= ';'; |
448 | 448 | } |
449 | 449 | |
450 | - if(!empty($this->allowedFontDomains)) { |
|
451 | - $policy .= 'font-src ' . implode(' ', $this->allowedFontDomains); |
|
450 | + if (!empty($this->allowedFontDomains)) { |
|
451 | + $policy .= 'font-src '.implode(' ', $this->allowedFontDomains); |
|
452 | 452 | $policy .= ';'; |
453 | 453 | } |
454 | 454 | |
455 | - if(!empty($this->allowedConnectDomains)) { |
|
456 | - $policy .= 'connect-src ' . implode(' ', $this->allowedConnectDomains); |
|
455 | + if (!empty($this->allowedConnectDomains)) { |
|
456 | + $policy .= 'connect-src '.implode(' ', $this->allowedConnectDomains); |
|
457 | 457 | $policy .= ';'; |
458 | 458 | } |
459 | 459 | |
460 | - if(!empty($this->allowedMediaDomains)) { |
|
461 | - $policy .= 'media-src ' . implode(' ', $this->allowedMediaDomains); |
|
460 | + if (!empty($this->allowedMediaDomains)) { |
|
461 | + $policy .= 'media-src '.implode(' ', $this->allowedMediaDomains); |
|
462 | 462 | $policy .= ';'; |
463 | 463 | } |
464 | 464 | |
465 | - if(!empty($this->allowedObjectDomains)) { |
|
466 | - $policy .= 'object-src ' . implode(' ', $this->allowedObjectDomains); |
|
465 | + if (!empty($this->allowedObjectDomains)) { |
|
466 | + $policy .= 'object-src '.implode(' ', $this->allowedObjectDomains); |
|
467 | 467 | $policy .= ';'; |
468 | 468 | } |
469 | 469 | |
470 | - if(!empty($this->allowedFrameDomains)) { |
|
470 | + if (!empty($this->allowedFrameDomains)) { |
|
471 | 471 | $policy .= 'frame-src '; |
472 | - if(is_string($this->useJsNonce)) { |
|
473 | - $policy .= '\'nonce-' . base64_encode($this->useJsNonce) . '\' '; |
|
472 | + if (is_string($this->useJsNonce)) { |
|
473 | + $policy .= '\'nonce-'.base64_encode($this->useJsNonce).'\' '; |
|
474 | 474 | } |
475 | 475 | $policy .= implode(' ', $this->allowedFrameDomains); |
476 | 476 | $policy .= ';'; |
477 | 477 | } |
478 | 478 | |
479 | - if(!empty($this->allowedChildSrcDomains)) { |
|
480 | - $policy .= 'child-src ' . implode(' ', $this->allowedChildSrcDomains); |
|
479 | + if (!empty($this->allowedChildSrcDomains)) { |
|
480 | + $policy .= 'child-src '.implode(' ', $this->allowedChildSrcDomains); |
|
481 | 481 | $policy .= ';'; |
482 | 482 | } |
483 | 483 | |
484 | - if(!empty($this->allowedFrameAncestors)) { |
|
485 | - $policy .= 'frame-ancestors ' . implode(' ', $this->allowedFrameAncestors); |
|
484 | + if (!empty($this->allowedFrameAncestors)) { |
|
485 | + $policy .= 'frame-ancestors '.implode(' ', $this->allowedFrameAncestors); |
|
486 | 486 | $policy .= ';'; |
487 | 487 | } |
488 | 488 | |
489 | 489 | if (!empty($this->allowedWorkerSrcDomains)) { |
490 | - $policy .= 'worker-src ' . implode(' ', $this->allowedWorkerSrcDomains); |
|
490 | + $policy .= 'worker-src '.implode(' ', $this->allowedWorkerSrcDomains); |
|
491 | 491 | $policy .= ';'; |
492 | 492 | } |
493 | 493 | |
494 | 494 | if (!empty($this->reportTo)) { |
495 | - $policy .= 'report-uri ' . implode(' ', $this->reportTo); |
|
495 | + $policy .= 'report-uri '.implode(' ', $this->reportTo); |
|
496 | 496 | $policy .= ';'; |
497 | 497 | } |
498 | 498 |