Function __global->_csp_extract_sources_list

Definitions

sources/csp.php

  • Extracts CSP sources from the given string, plus trusted sites.
  • Visibility: public
  • Is abstract?: No
  • Is static?: No
  • Is final?: No
  • Returns: array

Parameters

Name Type Passed by reference? Variadic? Default Set Range Description
$level integer No No required parameter 1 2 N/A Trusted sites level
$sources_csp string No No Blank (empty string) N/A N/A Comma-separated list of additional valid CSP 'sources' (blank: just trusted sites)
$include_self boolean No No True N/A N/A Include a self reference

Returns

  • CSP sources (null: allow all, only possible when $sources_csp is passed) (empty: disallow all except local)
  • Type: ?array
  • Set: N/A
  • Range: N/A

Preview

Code (PHP)

/**
 * Extracts CSP sources from the given string, plus trusted sites.
 *
 * @param  integer $level Trusted sites level
 * @set 1 2
 * @param  string $sources_csp Comma-separated list of additional valid CSP 'sources' (blank: just trusted sites)
 * @param  boolean $include_self Include a self reference
 * @return ?array CSP sources (null: allow all, only possible when $sources_csp is passed) (empty: disallow all except local)
 */

function _csp_extract_sources_list(int $level, string $sources_csp = '', bool $include_self = true) : ?array