XOOPS RMCommon Utilities  2.1.8.91RC
 All Classes Namespaces Files Functions Variables
TextCleaner Class Reference

Public Member Functions

 addslashes ($text)
 
 bad_protocol_once2 ($matches)
 
 call_code_modifiers ($code, $lang)
 
 clean_disabled_tags ($text)
 
 clean_pre ($matches)
 
 clean_url ($url, $protocols=null, $context= 'display')
 
 codeConv ($text, $exmcode=1)
 
 codeDecode ($text, $allowimage=1)
 
 codePreConv ($text)
 
 decode_entities ($string)
 
 decode_entities_chr ($match)
 
 decode_entities_chr_hexdec ($match)
 
 decrypt ($string, $encode64=true)
 
 double_br ($string, $br=1)
 
 encrypt ($string, $encode64=true)
 
 ftp_clickable ($matches)
 
 get_emotions ()
 
 mail_clickable ($matches)
 
 make_clickable ($string)
 
 nl2Br ($text)
 
 no_null ($string)
 
 nofollow ($text)
 
 popuplinks ($text)
 
 replace ($search, $subject)
 
 smiley ($message)
 
 specialchars ($string, $quote_style=ENT_NOQUOTES, $charset= 'UTF-8')
 
 specialchars_decode ($string, $quote_style=ENT_NOQUOTES)
 
 stripslashes ($text)
 
 sweetstring ($value, $lower=true)
 
 to_display ($text, $dbr=true, $clean_tags=true, $paragraph=true)
 
 truncate ($text, $len)
 
 url_clickable ($matches)
 

Static Public Member Functions

static getInstance ()
 

Private Member Functions

 bad_protocol ($string, $allowed_protocols)
 
 bad_protocol_once ($string, $allowed_protocols)
 

Private Attributes

 $disable_tags
 
 $emots = array()
 
 $protocols = array()
 

Detailed Description

Handles many methods for formatting output.

Definition at line 16 of file textcleaner.php.

Member Function Documentation

TextCleaner::addslashes (   $text)

Add slashes to the text if magic_quotes_gpc is turned off.

Parameters
string$text
Returns
string

Definition at line 416 of file textcleaner.php.

References stripslashes().

Here is the call graph for this function:

TextCleaner::bad_protocol (   $string,
  $allowed_protocols 
)
private

Definition at line 214 of file textcleaner.php.

References bad_protocol_once(), and no_null().

Referenced by clean_url().

Here is the call graph for this function:

Here is the caller graph for this function:

TextCleaner::bad_protocol_once (   $string,
  $allowed_protocols 
)
private

Definition at line 226 of file textcleaner.php.

References bad_protocol_once2().

Referenced by bad_protocol().

Here is the call graph for this function:

Here is the caller graph for this function:

TextCleaner::bad_protocol_once2 (   $matches)

Definition at line 237 of file textcleaner.php.

References $aprotocols, decode_entities(), and no_null().

Referenced by bad_protocol_once(), and bad_protocol_once2().

Here is the call graph for this function:

Here is the caller graph for this function:

TextCleaner::call_code_modifiers (   $code,
  $lang 
)

This function is only a holder for event exmevent_format_code

Parameters
stringCode to format
stringLanguage name
Returns
srtring

Definition at line 670 of file textcleaner.php.

References $lang, and RMEvents\get().

Here is the call graph for this function:

TextCleaner::clean_disabled_tags (   $text)

Definition at line 632 of file textcleaner.php.

References RMEvents\get().

Referenced by to_display().

Here is the call graph for this function:

Here is the caller graph for this function:

TextCleaner::clean_pre (   $matches)

Accepts matches array from preg_replace_callback in wpautop() or a string.

Ensures that the contents of a <

>...<

> HTML block are not converted into paragraphs or line-breaks.

From Wordpress

Parameters
array | string$matchesThe array or string
Returns
string The pre block without paragraph/line-break conversion.

Definition at line 686 of file textcleaner.php.

TextCleaner::clean_url (   $url,
  $protocols = null,
  $context = 'display' 
)

Checks and Clean a URL

Taked from Wordpress

Parameters
string$urlThe URL to be cleaned.
array$protocolsOptional. An array of acceptable protocols. Defaults to 'http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet' if not set.
string$contextOptional. How the URL will be used. Default is 'display'.
Returns
string The cleaned $url after the 'cleaned_url' filter is applied.

Definition at line 179 of file textcleaner.php.

References $aprotocols, $protocols, $url, bad_protocol(), RMEvents\get(), and replace().

Here is the call graph for this function:

TextCleaner::codeConv (   $text,
  $exmcode = 1 
)

Definition at line 652 of file textcleaner.php.

Referenced by to_display().

Here is the caller graph for this function:

TextCleaner::codeDecode (   $text,
  $allowimage = 1 
)

Replace EXMCodes with their equivalent HTML formatting

Parameters
string$text
bool$allowimageAllow images in the text? On FALSE, uses links to images.
Returns
string

Definition at line 327 of file textcleaner.php.

References RMEvents\get().

Referenced by to_display().

Here is the call graph for this function:

Here is the caller graph for this function:

TextCleaner::codePreConv (   $text)

Sanitizing of [code] tag from Xoops

Definition at line 645 of file textcleaner.php.

Referenced by to_display().

Here is the caller graph for this function:

TextCleaner::decode_entities (   $string)

Definition at line 268 of file textcleaner.php.

Referenced by bad_protocol_once2().

Here is the caller graph for this function:

TextCleaner::decode_entities_chr (   $match)

Definition at line 275 of file textcleaner.php.

Referenced by decode_entities_chr().

Here is the caller graph for this function:

TextCleaner::decode_entities_chr_hexdec (   $match)

Definition at line 279 of file textcleaner.php.

Referenced by decode_entities_chr_hexdec().

Here is the caller graph for this function:

TextCleaner::decrypt (   $string,
  $encode64 = true 
)

Decrypt a string

Parameters
strignText to decrypt
boolApply base64_decode? default true

Definition at line 722 of file textcleaner.php.

References $rmc_config, RMFunctions\configs(), and Crypt\MODE_HEX.

Referenced by resize_images().

Here is the call graph for this function:

Here is the caller graph for this function:

TextCleaner::double_br (   $string,
  $br = 1 
)

Replaces double line-breaks with paragraph elements.

A group of regex replaces used to identify text formatted with newlines and replace double line-breaks with HTML paragraph tags. The remaining line-breaks after conversion become <
> tags, unless $br is set to '0' or 'false'.

Taked from Wordpress

GPL 2

Parameters
string$stringThe text which has to be formatted.
int | bool$brOptional. If set, this will convert all remaining line-breaks after paragraphing. Default true.
Returns
string Text which has been converted into correct paragraph tags.

Definition at line 543 of file textcleaner.php.

Referenced by to_display().

Here is the caller graph for this function:

TextCleaner::encrypt (   $string,
  $encode64 = true 
)

Encrypt a string

Parameters
stringText to crypt
boolApply base64_encode?
Returns
string

Definition at line 706 of file textcleaner.php.

References $rmc_config, RMFunctions\get(), and Crypt\MODE_HEX.

Here is the call graph for this function:

TextCleaner::ftp_clickable (   $matches)

Definition at line 149 of file textcleaner.php.

References $ret.

Referenced by ftp_clickable().

Here is the caller graph for this function:

TextCleaner::get_emotions ( )

Get all emotions icons, including plugins with this capability

Returns
array

Definition at line 49 of file textcleaner.php.

References $emots, $rmc_config, $url, RMFunctions\get(), RMEvents\get(), and RMCURL.

Referenced by smiley().

Here is the call graph for this function:

Here is the caller graph for this function:

TextCleaner::mail_clickable (   $matches)

Definition at line 163 of file textcleaner.php.

Referenced by mail_clickable().

Here is the caller graph for this function:

TextCleaner::make_clickable (   $string)

Make links in the text clickable

Parameters
string$text
Returns
string

Definition at line 109 of file textcleaner.php.

Referenced by to_display().

Here is the caller graph for this function:

TextCleaner::nl2Br (   $text)
Convert linebreaks to <br /> tags
Parameters
string$text
Returns
string

Definition at line 405 of file textcleaner.php.

Referenced by to_display().

Here is the caller graph for this function:

TextCleaner::no_null (   $string)

Definition at line 283 of file textcleaner.php.

Referenced by bad_protocol(), and bad_protocol_once2().

Here is the caller graph for this function:

TextCleaner::nofollow (   $text)

Definition at line 121 of file textcleaner.php.

References stripslashes().

Here is the call graph for this function:

TextCleaner::popuplinks (   $text)

Definition at line 129 of file textcleaner.php.

TextCleaner::replace (   $search,
  $subject 
)

Definition at line 290 of file textcleaner.php.

Referenced by clean_url().

Here is the caller graph for this function:

TextCleaner::smiley (   $message)

Replace emots codes for ther image

Parameters
string$message
Returns
string

Definition at line 88 of file textcleaner.php.

References $emots, and get_emotions().

Referenced by to_display().

Here is the call graph for this function:

Here is the caller graph for this function:

TextCleaner::specialchars (   $string,
  $quote_style = ENT_NOQUOTES,
  $charset = 'UTF-8' 
)

Definition at line 445 of file textcleaner.php.

References elseif().

Referenced by to_display().

Here is the call graph for this function:

Here is the caller graph for this function:

TextCleaner::specialchars_decode (   $string,
  $quote_style = ENT_NOQUOTES 
)

Reverses htmlSpecialChars()

Parameters
string$text
Returns
string

Definition at line 484 of file textcleaner.php.

References elseif().

Here is the call graph for this function:

TextCleaner::stripslashes (   $text)

Definition at line 430 of file textcleaner.php.

Referenced by addslashes(), RMObject\cleanVars(), and nofollow().

Here is the caller graph for this function:

TextCleaner::sweetstring (   $value,
  $lower = true 
)

Clean an string by deleting all blank spaces and other chars

Definition at line 737 of file textcleaner.php.

References $rtn, and $url.

Referenced by RMFileUploader\_copyFile().

Here is the caller graph for this function:

TextCleaner::to_display (   $text,
  $dbr = true,
  $clean_tags = true,
  $paragraph = true 
)
Filters textarea form data in DB for display

based on Xoops displayTarea
Parameters
string$text
bool$dbrDisbale replace of breaklines when html is enabled
boolClean disabled tags?
Returns
string

Definition at line 596 of file textcleaner.php.

References $rmc_config, $rmCodes, clean_disabled_tags(), codeConv(), codeDecode(), codePreConv(), double_br(), RMFunctions\get(), RMEvents\get(), make_clickable(), nl2Br(), smiley(), and specialchars().

Here is the call graph for this function:

TextCleaner::truncate (   $text,
  $len 
)

MyTextSanitizer::truncate()

Parameters
mixed$text
Returns

Definition at line 311 of file textcleaner.php.

References $ret.

Referenced by rmc_bkcomments_show().

Here is the caller graph for this function:

TextCleaner::url_clickable (   $matches)

Next set of three functions are a set of callbacks to manege url and uri matches

Parameters
arrayMatches
Returns
string

Definition at line 140 of file textcleaner.php.

References $url.

Referenced by url_clickable().

Here is the caller graph for this function:

Member Data Documentation

TextCleaner::$disable_tags
private
Initial value:
= array(
'@<iframe[^>]*?>.*?</iframe>@si',
'@<script[^>]*?>.*?</script>@si',
'@<style[^>]*?>.*?</style>@si',
'@<html[^>]*?>.*?</html>@si',
'@<body[^>]*?>.*?</body>@si',
'@<meta[^>]*?>.*?</meta>@si'
)

Tags that will be disbled when dohtml is activated

Definition at line 26 of file textcleaner.php.

TextCleaner::$emots = array()
private

Stores all the emoticons used on system

Definition at line 22 of file textcleaner.php.

Referenced by get_emotions(), and smiley().

TextCleaner::$protocols = array()
private

Definition at line 18 of file textcleaner.php.

Referenced by clean_url().


The documentation for this class was generated from the following file: