Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Class containing a lang string cleaned. More...
Public Member Functions | |
__construct (string $id, string $text='', int $timemodified=null, int $deleted=0, stdclass $extra=null) | |
Class constructor. | |
Static Public Member Functions | |
static | fix_syntax (string $text, int $format=2, ?int $from=null) |
Given a string text, returns it being formatted properly for storing in AMOS repository. | |
Class containing a lang string cleaned.
tool_customlang\local\mlang\langstring::__construct | ( | string | $id, |
string | $text = '', | ||
int | $timemodified = null, | ||
int | $deleted = 0, | ||
stdclass | $extra = null ) |
Class constructor.
string | $id | string identifier |
string | $text | string text |
int | $timemodified | |
int | $deleted | |
stdclass | $extra |
|
static |
Given a string text, returns it being formatted properly for storing in AMOS repository.
Note: This method is taken directly from local_amos as it is highly tested and robust. The Moodle 1.x part is keep on puspose to make it easier the copy paste from both codes. This could change in the future when AMOS stop suporting the 1.x langstrings.
We need to know for what branch the string should be prepared due to internal changes in format required by get_string()
Typical usages of this methods: $t = langstring\fix_syntax($t); // sanity new translations of 2.x strings $t = langstring\fix_syntax($t, 1); // sanity legacy 1.x strings $t = langstring\fix_syntax($t, 2, 1); // convert format of 1.x strings into 2.x
Backward converting 2.x format into 1.x is not supported
string | $text | string text to be fixed |
int | $format | target get_string() format version |
int | $from | which format version does the text come from, defaults to the same as $format |
string |