Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Run time overrides for Html2Text This allows us to monkey patch the mb_* functions used in Html2Text to use Moodle's core_text functionality.

Copyright: 2016 Andrew Nicols <andrew@nicols.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 133 lines (5 kb)
Included or required: 1 time
Referenced: 0 times
Includes or requires: 0 files

Defines 5 functions


Functions that are not part of a class:

mb_internal_encoding($encoding = null)   X-Ref
Set the encoding to be used by our monkey patched mb_ functions.

When called with $encoding !== null, we set  the static $intenalencoding
variable, which is used for subsequent calls.

When called with no value for $encoding, we return the previously defined
$internalencoding.

This is necessary as we need to maintain the state of mb_internal_encoding
across calls to other mb_* functions. Check how it is used in the other mb_*
functions defined here - if no encoding is provided we fallback to what was
set here, otherwise we used the given encoding.

param: string $encoding When given, sets $internalencoding
return: mixed

mb_substr($str, $start, $length = null, $encoding = null)   X-Ref
Performs a multi-byte safe substr() operation based on number of characters.
Position is counted from the beginning of str. First character's position is
0. Second character position is 1, and so on.

param: string $str      The string to extract the substring from.
param: int    $start    If start is non-negative, the returned string will
param: int    $length   Maximum number of characters to use from str. If
param: string $encoding The encoding parameter is the character encoding.
return: string The portion of str specified by the start and length parameters.

mb_strlen($str, $encoding = null)   X-Ref
Gets the length of a string.

param: string $str      The string being checked for length.
param: string $encoding The encoding parameter is the character encoding.
return: int The number of characters in str having character encoding $encoding.

mb_strtolower($str, $encoding = null)   X-Ref
Returns $str with all alphabetic chatacters converted to lowercase.

param: string $str      The string being lowercased.
param: string $encoding The encoding parameter is the character encoding.
return: string The string with all alphabetic characters converted to lowercase.

mb_strtoupper($str, $encoding = null)   X-Ref

param: string The string being uppercased
param: string $encoding The encoding parameter is the character encoding.
return: string The string with all alphabetic characters converted to uppercase.