*/
function break_up_long_words($string, $maxsize=20, $cutchar=' ') {
-/// First of all, save all the tags inside the text to skip them
+ // First of all, save all the tags inside the text to skip them.
$tags = array();
- filter_save_tags($string,$tags);
+ filter_save_tags($string, $tags);
-/// Process the string adding the cut when necessary
+ // Process the string adding the cut when necessary.
$output = '';
- $length = textlib::strlen($string);
+ $length = core_text::strlen($string);
$wordlength = 0;
for ($i=0; $i<$length; $i++) {
break;
case FORMAT_WIKI:
- // there should not be any of these any more!
+ // There should not be any of these any more!
$text = wikify_links($text);
- return textlib::entities_to_utf8(strip_tags($text), true);
+ return core_text::entities_to_utf8(strip_tags($text), true);
break;
case FORMAT_HTML:
* @return string The obfuscated text
*/
function obfuscate_text($plaintext) {
- $i = 0;
- $length = textlib::strlen($plaintext);
- $obfuscated = '';
-
+ $i=0;
+ $length = core_text::strlen($plaintext);
+ $obfuscated='';
- $prev_obfuscated = false;
+ $prevobfuscated = false;
while ($i < $length) {
- $char = textlib::substr($plaintext, $i, 1);
- $ord = textlib::utf8ord($char);
+ $char = core_text::substr($plaintext, $i, 1);
+ $ord = core_text::utf8ord($char);
$numerical = ($ord >= ord('0')) && ($ord <= ord('9'));
- if ($prev_obfuscated and $numerical ) {
+ if ($prevobfuscated and $numerical ) {
$obfuscated.='&#'.$ord.';';
- } else if (rand(0,2)) {
+ } else if (rand(0, 2)) {
$obfuscated.='&#'.$ord.';';
- $prev_obfuscated = true;
+ $prevobfuscated = true;
} else {
$obfuscated.=$char;
- $prev_obfuscated = false;
+ $prevobfuscated = false;
}
- $i++;
+ $i++;
}
return $obfuscated;
}