Joomla CMS  3.10.11 (avec JPlatform 13.1 inclus)
Documentation des API du CMS Joomla en version 3.10.11 et du framework Joomla Platform intégré
Référence de la classe Text

Fonctions membres publiques statiques

static _ ($string, $jsSafe=false, $interpretBackSlashes=true, $script=false)
 
static alt ($string, $alt, $jsSafe=false, $interpretBackSlashes=true, $script=false)
 
static plural ($string, $n)
 
static sprintf ($string)
 
static printf ($string)
 
static script ($string=null, $jsSafe=false, $interpretBackSlashes=true)
 
static getScriptStrings ()
 

Attributs protégés statiques

static $strings = array()
 

Fonctions membres privées statiques

static passSprintf (&$string, $jsSafe=false, $interpretBackSlashes=true, $script=false)
 

Description détaillée

Text handling class.

Depuis
1.7.0

Documentation des fonctions membres

◆ _()

static _ (   $string,
  $jsSafe = false,
  $interpretBackSlashes = true,
  $script = false 
)
static

Translates a string into the current language.

Examples: ‘<script>alert(Joomla.JText._(’<?php echo Text::_("JDEFAULT", array("script"=>true)); ?>'));</script>‘ will generate an alert message containing 'Default’ <?php echo Text::_("JDEFAULT"); ?> will generate a 'Default' string

Paramètres
string$stringThe string to translate.
mixed$jsSafeBoolean: Make the result javascript safe.
boolean$interpretBackSlashesTo interpret backslashes (\=\,
=carriage return, =tabulation)
boolean$scriptTo indicate that the string will be push in the javascript language store
Renvoie
string The translated string or the key if $script is true
Depuis
1.7.0

Références Language\$lang, $script, et Factory\getLanguage().

Référencé par Stream\chmod(), Stream\close(), Folder\create(), Folder\delete(), Stream\eof(), Stream\filesize(), Stream\get_meta_data(), Stream\gets(), ToolbarHelper\modal(), File\move(), Folder\move(), PlgContentConfirmConsent\onContentPrepareForm(), Stream\open(), Stream\read(), ExceptionHandler\render(), Stream\seek(), Stream\tell(), ToolbarHelper\title(), File\upload(), Stream\upload(), ToolbarHelper\versions(), et Stream\write().

◆ alt()

static alt (   $string,
  $alt,
  $jsSafe = false,
  $interpretBackSlashes = true,
  $script = false 
)
static

Translates a string into the current language.

Examples: ‘<?php echo Text::alt('JALL’, 'language'); ?>‘ will generate a 'All’ string in English but a "Toutes" string in French ‘<?php echo Text::alt('JALL’, 'module'); ?>‘ will generate a 'All’ string in English but a "Tous" string in French

Paramètres
string$stringThe string to translate.
string$altThe alternate option for global string
mixed$jsSafeBoolean: Make the result javascript safe.
boolean$interpretBackSlashesTo interpret backslashes (\=\,
=carriage return, =tabulation)
boolean$scriptTo indicate that the string will be pushed in the javascript language store
Renvoie
string The translated string or the key if $script is true
Depuis
1.7.0

Références $alt, $script, Factory\getLanguage(), et Language\hasKey().

◆ getScriptStrings()

static getScriptStrings ( )
static

Get the strings that have been loaded to the JavaScript language store.

Renvoie
array
Depuis
3.7.0

◆ passSprintf()

static passSprintf ( $string,
  $jsSafe = false,
  $interpretBackSlashes = true,
  $script = false 
)
staticprivate

Checks the string if it should be interpreted as sprintf and runs sprintf over it.

Paramètres
string&$stringThe string to translate.
mixed$jsSafeBoolean: Make the result javascript safe.
boolean$interpretBackSlashesTo interpret backslashes (\=\,
=carriage return, =tabulation)
boolean$scriptTo indicate that the string will be push in the javascript language store
Renvoie
boolean Whether the string be interpreted as sprintf
Depuis
3.4.4

Références $i, Language\$lang, $script, et Factory\getLanguage().

◆ plural()

static plural (   $string,
  $n 
)
static

Like Text::sprintf but tries to pluralise the string.

Note that this method can take a mixed number of arguments as for the sprintf function.

The last argument can take an array of options:

array('jsSafe'=>boolean, 'interpretBackSlashes'=>boolean, 'script'=>boolean)

where:

jsSafe is a boolean to generate a javascript safe strings. interpretBackSlashes is a boolean to interpret backslashes \->\,
->new line, ->tabulation. script is a boolean to indicate that the string will be push in the javascript language store.

Examples: ‘<script>alert(Joomla.JText._(’<?php echo Text::plural("COM_PLUGINS_N_ITEMS_UNPUBLISHED", 1, array("script"=>true)); ?>'));</script>‘ will generate an alert message containing '1 plugin successfully disabled’ ‘<?php echo Text::plural('COM_PLUGINS_N_ITEMS_UNPUBLISHED’, 1); ?>‘ will generate a '1 plugin successfully disabled’ string

Paramètres
string$stringThe format string.
integer$nThe number of items
Renvoie
string The translated strings or the key if 'script' is true in the array of options
Depuis
1.7.0

Références $count, $key, Language\$lang, $n, $suffix, et Factory\getLanguage().

◆ printf()

static printf (   $string)
static

Passes a string thru an printf.

Note that this method can take a mixed number of arguments as for the sprintf function.

Paramètres
string$stringThe format string.
Renvoie
mixed
Depuis
1.7.0

Références $count, Language\$lang, et Factory\getLanguage().

◆ script()

static script (   $string = null,
  $jsSafe = false,
  $interpretBackSlashes = true 
)
static

Translate a string into the current language and stores it in the JavaScript language store.

Paramètres
string$stringThe Text key.
boolean$jsSafeEnsure the output is JavaScript safe.
boolean$interpretBackSlashesInterpret and
.
Renvoie
string
Depuis
1.7.0

Références HTMLHelper\_(), Log\add(), Factory\getDocument(), Factory\getLanguage(), null, et Log\WARNING.

◆ sprintf()

static sprintf (   $string)
static

Passes a string thru a sprintf.

Note that this method can take a mixed number of arguments as for the sprintf function.

The last argument can take an array of options:

array('jsSafe'=>boolean, 'interpretBackSlashes'=>boolean, 'script'=>boolean)

where:

jsSafe is a boolean to generate a javascript safe strings. interpretBackSlashes is a boolean to interpret backslashes \->\,
->new line, ->tabulation. script is a boolean to indicate that the string will be push in the javascript language store.

Paramètres
string$stringThe format string.
Renvoie
string The translated strings or the key if 'script' is true in the array of options.
Depuis
1.7.0

Références $count, Language\$lang, et Factory\getLanguage().

Référencé par File\append(), Patcher\applyHunk(), File\copy(), File\delete(), Folder\delete(), Folder\files(), Folder\folders(), File\move(), Folder\move(), File\read(), File\upload(), et File\write().

Documentation des champs

◆ $strings

$strings = array()
staticprotected

La documentation de cette classe a été générée à partir du fichier suivant :