files-shared-code-tce-functions-tcecode

It appears that you are using AdBlocking software. The cost of running this website is covered by advertisements. If you like it please feel free to a small amount of money to secure the future of this website.

tce_functions_tcecode.php

Tags
file

Functions to translate TCExam proprietary code into XHTML. The TCExam code is compatible to the common BBCode.

author

Nicola Asuni

since
2002-01-09

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
$text_to_decode :

(string) text to convert

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
$str :

(string) text to process

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
$str :

(string) text to process return string

F_tcecodeToTitle()

Converts tcecode text to simple string for XHTML title attribute.

F_tcecodeToTitle( $str) : mixed
Parameters
$str :

(string) text to process return string

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

Parameters
$htmltext :

(string)

$min_length : = 100

(int) (default=100) the approximate length you want the concatenated text to be

$offset_length : = 20

(int) (default=20) the max variation in how long the text can be

On this page
 

© 2004-2024 – Nicola Asuni - Tecnick.com - All rights reserved.
about - disclaimer - privacy