$hook
$hook :
__construct(\TriTan\Interfaces\Hooks\ActionFilterHookInterface $hook)
\TriTan\Interfaces\Hooks\ActionFilterHookInterface | $hook |
parseStr(string $string, array $array)
Parses a string into variables to be stored in an array.
Uses parse_str()
string | $string | The string to be parsed. |
array | $array | Variables will be stored in this array. |
parseArgs(string|array $args, array $defaults = '') : array
Merge user defined arguments into defaults array.
This method is used throughout TriTan CMS to allow for both string or array to be merged into another array.
string|array | $args | Value to merge with $defaults |
array | $defaults | Optional. Array that serves as the defaults. Default empty. |
Merged user defined values with defaults.
stripTags(string $string, boolean $remove_breaks = false, string $tags = '', boolean $invert = false) : string
Properly strip all HTML tags including script and style (default).
This differs from PHP's native strip_tags() function because this function removes the contents of
the <script>
and <style>
tags. E.g. strip_tags( '<script>something</script>' )
will return 'something'
. By default, $this->stripTags() will return ''
.
Example Usage:
$string = '<b>sample</b> text with <div>tags</div>';
$this->stripTags($string); //returns 'text with'
$this->stripTags($string, false, '<b>'); //returns '<b>sample</b> text with'
$this->stripTags($string, false, '<b>', true); //returns 'text with <div>tags</div>'
string | $string | String containing HTML tags |
boolean | $remove_breaks | Optional. Whether to remove left over line breaks and white space chars |
string | $tags | Tags that should be removed. |
boolean | $invert | Instead of removing tags, this option checks for which tags to not remove. Default: false; |
The processed string.