|
|
|
|
@ -424,7 +424,7 @@ function make_clickable($string) { |
|
|
|
|
/** |
|
|
|
|
* @desc This function does some parsing on the text that gets inputted. This parsing can be of any kind |
|
|
|
|
* LaTeX notation, Word Censoring, Glossary Terminology (extension will available soon), Musical Notations, ... |
|
|
|
|
* The inspiration for this filter function came from Moodle an phpBB who both use a similar approach |
|
|
|
|
* The inspiration for this filter function came from Moodle an phpBB who both use a similar approach. |
|
|
|
|
* @param $input string. some text |
|
|
|
|
* @return $output string. some text that contains the parsed elements. |
|
|
|
|
* @example [tex]\sqrt(2)[/tex] |
|
|
|
|
@ -513,7 +513,7 @@ function _text_parse_glossary($input) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* @desc this function makes a valid link to a different tool |
|
|
|
|
* @desc This function makes a valid link to a different tool. |
|
|
|
|
* This function should not be accessed directly but should be accesse through the text_filter function |
|
|
|
|
* @author Patrick Cool <patrick.cool@UGent.be> |
|
|
|
|
*/ |
|
|
|
|
@ -526,7 +526,7 @@ function _text_parse_tool($input) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* render LaTeX code into a gif or retrieve a cached version of the gif |
|
|
|
|
* Renders LaTeX code into a gif or retrieve a cached version of the gif. |
|
|
|
|
* @author Patrick Cool <patrick.cool@UGent.be> Ghent University |
|
|
|
|
*/ |
|
|
|
|
function latex_gif_renderer($latex_code) { |
|
|
|
|
@ -555,8 +555,8 @@ function latex_gif_renderer($latex_code) { |
|
|
|
|
/** |
|
|
|
|
* This functions cuts a paragraph |
|
|
|
|
* i.e cut('Merry Xmas from Lima',13) = "Merry Xmas fr..." |
|
|
|
|
* @param string the text to "cut" |
|
|
|
|
* @param int count of chars |
|
|
|
|
* @param string The text to "cut" |
|
|
|
|
* @param int Count of chars |
|
|
|
|
* @param bool Whether to embed in a <span title="...">...</span> |
|
|
|
|
* @return string |
|
|
|
|
* */ |
|
|
|
|
@ -565,7 +565,7 @@ function cut($text, $maxchar, $embed = false) { |
|
|
|
|
if ($embed) { |
|
|
|
|
return '<span title="'.$text.'">'.api_substr($text, 0, $maxchar).'...</span>'; |
|
|
|
|
} |
|
|
|
|
return api_substr($text, 0, $maxchar).'...' ; |
|
|
|
|
return api_substr($text, 0, $maxchar).'...'; |
|
|
|
|
} |
|
|
|
|
return $text; |
|
|
|
|
} |
|
|
|
|
@ -573,9 +573,9 @@ function cut($text, $maxchar, $embed = false) { |
|
|
|
|
/** |
|
|
|
|
* Show a number as only integers if no decimals, but will show 2 decimals if exist. |
|
|
|
|
* |
|
|
|
|
* @param mixed number to convert |
|
|
|
|
* @param int decimal points 0=never, 1=if needed, 2=always |
|
|
|
|
* @return mixed an integer or a float depends on the parameter |
|
|
|
|
* @param mixed Number to convert |
|
|
|
|
* @param int Decimal points 0=never, 1=if needed, 2=always |
|
|
|
|
* @return mixed An integer or a float depends on the parameter |
|
|
|
|
*/ |
|
|
|
|
function float_format($number, $flag = 1) { |
|
|
|
|
if (is_numeric($number)) { |
|
|
|
|
@ -595,7 +595,7 @@ function float_format($number, $flag = 1) { |
|
|
|
|
// TODO: To be checked for correct timezone management. |
|
|
|
|
/** |
|
|
|
|
* Function to obtain last week timestamps |
|
|
|
|
* @return array times for every day inside week |
|
|
|
|
* @return array Times for every day inside week |
|
|
|
|
*/ |
|
|
|
|
function get_last_week() { |
|
|
|
|
$week = date('W'); |
|
|
|
|
@ -616,8 +616,8 @@ function get_last_week() { |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* Gets the week from a day |
|
|
|
|
* @param string date in UTC (2010-01-01 12:12:12) |
|
|
|
|
* @return int int with the week number of the year |
|
|
|
|
* @param string Date in UTC (2010-01-01 12:12:12) |
|
|
|
|
* @return int Returns an integer with the week number of the year |
|
|
|
|
*/ |
|
|
|
|
function get_week_from_day($date) { |
|
|
|
|
if (!empty($date)) { |
|
|
|
|
|