Properties

$secure_dir

$secure_dir : array

This is the list of template directories that are considered secure.

$template_dir is in this list implicitly.

Type

array

$trusted_uri

$trusted_uri : array

List of regular expressions (PCRE) that include trusted URIs

Type

array

$static_classes

$static_classes : array

This is an array of trusted static classes.

If empty access to all static classes is allowed. If set to 'none' none is allowed.

Type

array

$php_functions

$php_functions : array<mixed,string>|null

This is an array of trusted PHP functions.

If empty all functions are allowed. If null, no functions are allowed.

Type

array<mixed,string>|null

$php_modifiers

$php_modifiers : array<mixed,string>|null

This is an array of trusted PHP modifiers.

If empty all modifiers are allowed. If null, no modifiers are allowed.

Type

array<mixed,string>|null

$allowed_tags

$allowed_tags : array<mixed,string>

This is an array of allowed tags.

If empty no restriction by allowed_tags.

Type

array<mixed,string>

$disabled_tags

$disabled_tags : array<mixed,string>

This is an array of disabled tags.

If empty no restriction by disabled_tags.

Type

array<mixed,string>

$allowed_modifiers

$allowed_modifiers : array<mixed,string>

This is an array of allowed modifier plugins.

If empty no restriction by allowed_modifiers.

Type

array<mixed,string>

$disabled_modifiers

$disabled_modifiers : array<mixed,string>

This is an array of disabled modifier plugins.

If empty no restriction by disabled_modifiers.

Type

array<mixed,string>

$streams

$streams : array<mixed,string>

This is an array of trusted streams.

If empty all streams are allowed. IF null, no streams are allowed

Type

array<mixed,string>

$allow_constants

$allow_constants : boolean

When true, constants can be accessed from templates

Type

boolean

$allow_super_globals

$allow_super_globals : boolean

When true, superglobals can be accessed from templates

Type

boolean

Methods

__construct()

__construct(\Smarty  $smarty) 

Constructs a new security policy

Parameters

\Smarty $smarty

An instance of Brainy

isTrustedPhpFunction()

isTrustedPhpFunction(string  $function_name, object  $compiler) : boolean

Check if PHP function is trusted.

Parameters

string $function_name

The name of the PHP function

object $compiler

compiler object

Throws

\SmartyCompilerException

if php function is not trusted

Returns

boolean —

true if function is trusted

isTrustedStaticClass()

isTrustedStaticClass(string  $class_name, object  $compiler) : boolean

Check if static class is trusted.

Parameters

string $class_name

The name of the static class

object $compiler

compiler object

Throws

\SmartyCompilerException

if static class is not trusted

Returns

boolean —

true if class is trusted

isTrustedPhpModifier()

isTrustedPhpModifier(string  $modifier_name, object  $compiler) : boolean

Check if PHP modifier is trusted.

Parameters

string $modifier_name

The name of the PHP function

object $compiler

compiler object

Throws

\SmartyCompilerException

if modifier is not trusted

Returns

boolean —

true if modifier is trusted

isTrustedTag()

isTrustedTag(string  $tag_name, object  $compiler) : boolean

Check if tag is trusted.

Parameters

string $tag_name

The name of the tag

object $compiler

compiler object

Throws

\SmartyCompilerException

if modifier is not trusted

Returns

boolean —

true if tag is trusted

isTrustedModifier()

isTrustedModifier(string  $modifier_name, object  $compiler) : boolean

Check if modifier plugin is trusted.

Parameters

string $modifier_name

The name of the modifier

object $compiler

compiler object

Throws

\SmartyCompilerException

if modifier is not trusted

Returns

boolean —

true if tag is trusted

isTrustedStream()

isTrustedStream(string  $stream_name) : boolean

Check if stream is trusted.

Parameters

string $stream_name

The name of the stream

Throws

\SmartyException

if stream is not trusted

Returns

boolean —

true if stream is trusted

isTrustedResourceDir()

isTrustedResourceDir(string  $filepath) : boolean

Check if directory of file resource is trusted.

Parameters

string $filepath

The file path to test

Throws

\SmartyException

if directory is not trusted

Returns

boolean —

true if directory is trusted