Table of contents
Source: shared/code/tce_functions_tcecode.php
Functions to translate TCExam proprietary code into XHTML. The TCExam code is compatible to the common BBCode.
Functions
F_bbcode_to_tcecode()
Convert some BBCode-style to TCECode.
function F_bbcode_to_tcecode(mixed $text): string
Parameters:
$text(mixed)
Returns: string
Source: shared/code/tce_functions_tcecode.php:109
F_decode_tcecode()
Returns XHTML code from text marked-up with TCExam Code Tags
function F_decode_tcecode(mixed $text_to_decode): string
Parameters:
$text_to_decode(mixed): (string) text to convert
Returns: string: XHTML code
Source: shared/code/tce_functions_tcecode.php:31
F_is_valid_object_path()
Returns true if the object path is a relative path inside the cache directory.
Rejects empty paths, absolute paths, schemes, backslashes, control characters, hidden or parent path segments, and extensions that are not alphanumeric.
function F_is_valid_object_path(string $name, string $extension): bool
Parameters:
$name(string): Object path excluded extension.$extension(string): Object extension.
Returns: bool: True if the path is valid.
Source: shared/code/tce_functions_tcecode.php:422
F_latex_callback()
Callback function for preg_replace_callback (LaTeX replacement).
Returns replacement image for LaTeX code.
function F_latex_callback(mixed $matches): string
Parameters:
$matches(mixed): (string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in ‘(…)’ (the LaTeX code)
Returns: string: replacement HTML code string to include the equivalent LaTeX image.
Source: shared/code/tce_functions_tcecode.php:236
F_mathml_callback()
Callback function for preg_replace_callback (MathML replacement).
Returns replacement code for MathML code.
function F_mathml_callback(mixed $matches): string
Parameters:
$matches(mixed): (string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in ‘(…)’ (the MathML code)
Returns: string: MathML code.
Source: shared/code/tce_functions_tcecode.php:364
F_objects_callback()
Callback function for preg_replace_callback.
Returns replacement code by MIME type.
function F_objects_callback(mixed $matches): string
Parameters:
$matches(mixed): (string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in ‘(…)’ and so on
Returns: string: replacement string by file extension
Source: shared/code/tce_functions_tcecode.php:389
F_objects_replacement()
Returns the HTML code needed to display a cache file by type.
Raster and SVG images are displayed with <img>, audio and video files with <audio> and <video>, all other known types with a download link. Uploaded files are never embedded as documents.
function F_objects_replacement(
mixed $name,
mixed $extension,
mixed $width = 0,
mixed $height = 0,
mixed $alt = '',
mixed &$maxwidth = 0,
mixed &$maxheight = 0
): string
Parameters:
$name(mixed): (string) object path excluded extension$extension(mixed): (string) object extension (e.g.: gif, jpg, mp3, …)$width(mixed): (int) object width$height(mixed): (int) object height$alt(mixed): (string) alternative content$maxwidth(mixed): (int) object max or default width$maxheight(mixed): (int) object max or default height
Returns: string: replacement string
Source: shared/code/tce_functions_tcecode.php:454
F_remove_tcecode()
Returns specified string without tcecode mark-up tags
function F_remove_tcecode(mixed $str): string
Parameters:
$str(mixed): (string) text to process
Returns: string: without tcecode markup tags
Source: shared/code/tce_functions_tcecode.php:587
F_substrHTML()
Return a substring of XHTML code while making sure no html tags are chopped.
It also prevents chopping while a tag is still open. this function is based on a public-domain script posted on www.php.net by fox@conskript.server and mr@bbp.biz
function F_substrHTML(mixed $htmltext, mixed $min_length = 100, mixed $offset_length = 20)
Parameters:
$htmltext(mixed): (string)$min_length(mixed): (int) (default=100) the approximate length you want the concatenated text to be$offset_length(mixed): (int) (default=20) the max variation in how long the text can be
Source: shared/code/tce_functions_tcecode.php:660
F_tcecode_tag()
Convert TCECode simple tags to XHTML tags.
function F_tcecode_tag(mixed $text): string
Parameters:
$text(mixed)
Returns: string
Source: shared/code/tce_functions_tcecode.php:162
F_tcecode_tag_arg()
Convert TCECode tags with arguments to XHTML tags.
function F_tcecode_tag_arg(mixed $text): string
Parameters:
$text(mixed)
Returns: string
Source: shared/code/tce_functions_tcecode.php:199
F_tcecode_url()
Convert [url]…[/url] and [url=…]…[/url] to HTML anchor tags.
function F_tcecode_url(mixed $text): string
Parameters:
$text(mixed)
Returns: string
Source: shared/code/tce_functions_tcecode.php:124
F_tcecodeToLine()
Converts tcecode text to a single XHTML string removing some objects.
function F_tcecodeToLine(mixed $str)
Parameters:
$str(mixed): (string) text to process return string
Source: shared/code/tce_functions_tcecode.php:617
F_tcecodeToTitle()
Converts tcecode text to simple string for XHTML title attribute.
function F_tcecodeToTitle(mixed $str)
Parameters:
$str(mixed): (string) text to process return string