Documentation

FormattingFunctionsHelper

FinalYes

Helper functions and function lists for checking whether a function is a formatting function.

Tags
since
3.0.0

The property in this class was previously contained in the WordPressCS\WordPress\Sniff class and has been moved here.

Table of Contents

Properties

$formattingFunctions  : array<string, bool>
Functions that format strings.

Methods

is_formatting_function()  : bool
Check if a particular function is regarded as a formatting function.

Properties

$formattingFunctions

Functions that format strings.

private static array<string, bool> $formattingFunctions = array('antispambot' => true, 'array_fill' => true, 'ent2ncr' => true, 'implode' => true, 'join' => true, 'nl2br' => true, 'sprintf' => true, 'vsprintf' => true, 'wp_sprintf' => true)

These functions are often used for formatting values just before output, and it is common practice to escape the individual parameters passed to them as needed instead of escaping the entire result. This is especially true when the string being formatted contains HTML, which makes escaping the full result more difficult.

Tags
since
0.5.0
since
0.11.0

Changed from public static to protected non-static.

since
3.0.0
  • Moved from the Sniff class to this class.
  • Visibility changed from protected to private and property made static.

Methods

is_formatting_function()

Check if a particular function is regarded as a formatting function.

public static is_formatting_function(string $functionName) : bool
Parameters
$functionName : string

The name of the function to check.

Tags
since
3.0.0
Return values
bool

        
On this page

Search results