tce_functions_tcecode.php
Tags
Table of Contents
Functions
- F_decode_tcecode() : string
- Returns XHTML code from text marked-up with TCExam Code Tags
- F_latex_callback() : string
- Callback function for preg_replace_callback (LaTeX replacement).
- F_mathml_callback() : string
- Callback function for preg_replace_callback (MathML replacement).
- F_objects_callback() : string
- Callback function for preg_replace_callback.
- F_objects_replacement() : string
- Returns the xhtml code needed to display the object by MIME type.
- F_remove_tcecode() : string
- Returns specified string without tcecode mark-up tags
- F_tcecodeToLine() : mixed
- Converts tcecode text to a single XHTML string removing some objects.
- F_tcecodeToTitle() : mixed
- Converts tcecode text to simple string for XHTML title attribute.
- F_substrHTML() : mixed
- Return a substring of XHTML code while making sure no html tags are chopped.
Functions
F_decode_tcecode()
Returns XHTML code from text marked-up with TCExam Code Tags
F_decode_tcecode( $text_to_decode)
: string
Parameters
Return values
string —XHTML code
F_latex_callback()
Callback function for preg_replace_callback (LaTeX replacement).
F_latex_callback( $matches)
: string
Returns replacement image for LaTeX code.
Parameters
- $matches :
-
(string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in '(...)' (the LaTeX code)
Return values
string —replacement HTML code string to include the equivalent LaTeX image.
F_mathml_callback()
Callback function for preg_replace_callback (MathML replacement).
F_mathml_callback( $matches)
: string
Returns replacement code for MathML code.
Parameters
- $matches :
-
(string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in '(...)' (the MathML code)
Return values
string —MathML code.
F_objects_callback()
Callback function for preg_replace_callback.
F_objects_callback( $matches)
: string
Returns replacement code by MIME type.
Parameters
- $matches :
-
(string) array containing matches: $matches[0] is the complete match, $matches[1] the match for the first subpattern enclosed in '(...)' and so on
Return values
string —replacement string by file extension
F_objects_replacement()
Returns the xhtml code needed to display the object by MIME type.
F_objects_replacement( $name,
$extension[,
$width
= 0
][,
$height
= 0
][,
$alt
= ''
][,
&$maxwidth
= 0
][,
&$maxheight
= 0
]) : string
Parameters
- $name :
-
(string) object path excluded extension
- $extension :
-
(string) object extension (e.g.: gif, jpg, swf, ...)
- $width : = 0
-
(int) object width
- $height : = 0
-
(int) object height
- $alt : = ''
-
(string) alternative content
- $maxwidth : = 0
-
(int) object max or default width
- $maxheight : = 0
-
(int) object max or default height
Return values
string —replacement string
F_remove_tcecode()
Returns specified string without tcecode mark-up tags
F_remove_tcecode( $str)
: string
Parameters
Return values
string —without tcecode markup tags
F_tcecodeToLine()
Converts tcecode text to a single XHTML string removing some objects.
F_tcecodeToLine( $str)
: mixed
Parameters
F_tcecodeToTitle()
Converts tcecode text to simple string for XHTML title attribute.
F_tcecodeToTitle( $str)
: mixed
Parameters
F_substrHTML()
Return a substring of XHTML code while making sure no html tags are chopped.
F_substrHTML( $htmltext[,
$min_length
= 100
][,
$offset_length
= 20
]) : mixed
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