Development Guides Home >> Guide to Locales >> Bracket Notation
Guide to Locales - The Bracket Notation Whitelist
Introduction
To use a custom bracket notation method, you must add it to the bracket notation method whitelist. To prevent the execution of arbitrary or malicious code when the locale system processes a localized string, cPanel & WHM only allows specific bracket notation methods by default.
You can create custom output
methods. For more information, read CPAN's Locale::Maketext::Utils
documentation.
The locale system automatically blacklists methods that begin with the underscore character (_
) and methods that include Perl namespace separator characters.
Default whitelist
cPanel & WHM ships with the following bracket notation method whitelist:
-
asis
-
boolean
-
comment
-
current_year
-
datetime
-
format_bytes
-
get_locale_name
-
get_user_locale_name
-
is_defined
-
is_future
-
join
-
list_and
-
list_and_quoted
-
list_or
-
list_or_quoted
-
numerate
-
numf
-
output
-
quant
For more information about these methods, read our Guide to Locales - Bracket Notation Methods documentation.
Add methods
To add a new bracket notation method to the whitelist, perform the following steps:
-
Create the
/var/cpanel/maketext_whitelist
file with0644
permissions. - In your preferred text editor, add each new bracket notation method to the file, with one method name per line.
For example, to add the get_language_tag
and convert
methods to the whitelist, create a /var/cpanel/maketext_whitelist
file with the following contents:
get_language_tag
convert