@@ -433,96 +433,96 @@ |
||
433 | 433 | $policy .= "base-uri 'none';"; |
434 | 434 | $policy .= "manifest-src 'self';"; |
435 | 435 | |
436 | - if(!empty($this->allowedScriptDomains) || $this->inlineScriptAllowed || $this->evalScriptAllowed) { |
|
436 | + if (!empty($this->allowedScriptDomains) || $this->inlineScriptAllowed || $this->evalScriptAllowed) { |
|
437 | 437 | $policy .= 'script-src '; |
438 | - if(is_string($this->useJsNonce)) { |
|
438 | + if (is_string($this->useJsNonce)) { |
|
439 | 439 | $policy .= '\'nonce-'.base64_encode($this->useJsNonce).'\''; |
440 | 440 | $allowedScriptDomains = array_flip($this->allowedScriptDomains); |
441 | 441 | unset($allowedScriptDomains['\'self\'']); |
442 | 442 | $this->allowedScriptDomains = array_flip($allowedScriptDomains); |
443 | - if(count($allowedScriptDomains) !== 0) { |
|
443 | + if (count($allowedScriptDomains) !== 0) { |
|
444 | 444 | $policy .= ' '; |
445 | 445 | } |
446 | 446 | } |
447 | - if(is_array($this->allowedScriptDomains)) { |
|
447 | + if (is_array($this->allowedScriptDomains)) { |
|
448 | 448 | $policy .= implode(' ', $this->allowedScriptDomains); |
449 | 449 | } |
450 | - if($this->inlineScriptAllowed) { |
|
450 | + if ($this->inlineScriptAllowed) { |
|
451 | 451 | $policy .= ' \'unsafe-inline\''; |
452 | 452 | } |
453 | - if($this->evalScriptAllowed) { |
|
453 | + if ($this->evalScriptAllowed) { |
|
454 | 454 | $policy .= ' \'unsafe-eval\''; |
455 | 455 | } |
456 | 456 | $policy .= ';'; |
457 | 457 | } |
458 | 458 | |
459 | - if(!empty($this->allowedStyleDomains) || $this->inlineStyleAllowed) { |
|
459 | + if (!empty($this->allowedStyleDomains) || $this->inlineStyleAllowed) { |
|
460 | 460 | $policy .= 'style-src '; |
461 | - if(is_array($this->allowedStyleDomains)) { |
|
461 | + if (is_array($this->allowedStyleDomains)) { |
|
462 | 462 | $policy .= implode(' ', $this->allowedStyleDomains); |
463 | 463 | } |
464 | - if($this->inlineStyleAllowed) { |
|
464 | + if ($this->inlineStyleAllowed) { |
|
465 | 465 | $policy .= ' \'unsafe-inline\''; |
466 | 466 | } |
467 | 467 | $policy .= ';'; |
468 | 468 | } |
469 | 469 | |
470 | - if(!empty($this->allowedImageDomains)) { |
|
471 | - $policy .= 'img-src ' . implode(' ', $this->allowedImageDomains); |
|
470 | + if (!empty($this->allowedImageDomains)) { |
|
471 | + $policy .= 'img-src '.implode(' ', $this->allowedImageDomains); |
|
472 | 472 | $policy .= ';'; |
473 | 473 | } |
474 | 474 | |
475 | - if(!empty($this->allowedFontDomains)) { |
|
476 | - $policy .= 'font-src ' . implode(' ', $this->allowedFontDomains); |
|
475 | + if (!empty($this->allowedFontDomains)) { |
|
476 | + $policy .= 'font-src '.implode(' ', $this->allowedFontDomains); |
|
477 | 477 | $policy .= ';'; |
478 | 478 | } |
479 | 479 | |
480 | - if(!empty($this->allowedConnectDomains)) { |
|
481 | - $policy .= 'connect-src ' . implode(' ', $this->allowedConnectDomains); |
|
480 | + if (!empty($this->allowedConnectDomains)) { |
|
481 | + $policy .= 'connect-src '.implode(' ', $this->allowedConnectDomains); |
|
482 | 482 | $policy .= ';'; |
483 | 483 | } |
484 | 484 | |
485 | - if(!empty($this->allowedMediaDomains)) { |
|
486 | - $policy .= 'media-src ' . implode(' ', $this->allowedMediaDomains); |
|
485 | + if (!empty($this->allowedMediaDomains)) { |
|
486 | + $policy .= 'media-src '.implode(' ', $this->allowedMediaDomains); |
|
487 | 487 | $policy .= ';'; |
488 | 488 | } |
489 | 489 | |
490 | - if(!empty($this->allowedObjectDomains)) { |
|
491 | - $policy .= 'object-src ' . implode(' ', $this->allowedObjectDomains); |
|
490 | + if (!empty($this->allowedObjectDomains)) { |
|
491 | + $policy .= 'object-src '.implode(' ', $this->allowedObjectDomains); |
|
492 | 492 | $policy .= ';'; |
493 | 493 | } |
494 | 494 | |
495 | - if(!empty($this->allowedFrameDomains)) { |
|
495 | + if (!empty($this->allowedFrameDomains)) { |
|
496 | 496 | $policy .= 'frame-src '; |
497 | - if(is_string($this->useJsNonce)) { |
|
498 | - $policy .= '\'nonce-' . base64_encode($this->useJsNonce) . '\' '; |
|
497 | + if (is_string($this->useJsNonce)) { |
|
498 | + $policy .= '\'nonce-'.base64_encode($this->useJsNonce).'\' '; |
|
499 | 499 | } |
500 | 500 | $policy .= implode(' ', $this->allowedFrameDomains); |
501 | 501 | $policy .= ';'; |
502 | 502 | } |
503 | 503 | |
504 | - if(!empty($this->allowedChildSrcDomains)) { |
|
505 | - $policy .= 'child-src ' . implode(' ', $this->allowedChildSrcDomains); |
|
504 | + if (!empty($this->allowedChildSrcDomains)) { |
|
505 | + $policy .= 'child-src '.implode(' ', $this->allowedChildSrcDomains); |
|
506 | 506 | $policy .= ';'; |
507 | 507 | } |
508 | 508 | |
509 | - if(!empty($this->allowedFrameAncestors)) { |
|
510 | - $policy .= 'frame-ancestors ' . implode(' ', $this->allowedFrameAncestors); |
|
509 | + if (!empty($this->allowedFrameAncestors)) { |
|
510 | + $policy .= 'frame-ancestors '.implode(' ', $this->allowedFrameAncestors); |
|
511 | 511 | $policy .= ';'; |
512 | 512 | } |
513 | 513 | |
514 | 514 | if (!empty($this->allowedWorkerSrcDomains)) { |
515 | - $policy .= 'worker-src ' . implode(' ', $this->allowedWorkerSrcDomains); |
|
515 | + $policy .= 'worker-src '.implode(' ', $this->allowedWorkerSrcDomains); |
|
516 | 516 | $policy .= ';'; |
517 | 517 | } |
518 | 518 | |
519 | 519 | if (!empty($this->allowedFormActionDomains)) { |
520 | - $policy .= 'form-action ' . implode(' ', $this->allowedFormActionDomains); |
|
520 | + $policy .= 'form-action '.implode(' ', $this->allowedFormActionDomains); |
|
521 | 521 | $policy .= ';'; |
522 | 522 | } |
523 | 523 | |
524 | 524 | if (!empty($this->reportTo)) { |
525 | - $policy .= 'report-uri ' . implode(' ', $this->reportTo); |
|
525 | + $policy .= 'report-uri '.implode(' ', $this->reportTo); |
|
526 | 526 | $policy .= ';'; |
527 | 527 | } |
528 | 528 |