XOOPS  2.6.0
MyTextSanitizer Class Reference
Inheritance diagram for MyTextSanitizer:
Inheritance graph

Public Member Functions

 __construct ()
 
 addSlashes ($text)
 
 censorString (&$text)
 
 codeConv ($text, $xcode=1)
 
 codeConvCallback ($match)
 
 codePreConv ($text, $xcode=1)
 
 displayTarea ($text, $html=0, $smiley=1, $xcode=1, $image=1, $br=1)
 
 executeExtension ($name)
 
 executeExtensions ()
 
 filterXss ($text)
 
 getSmileys ($isAll=true)
 
 htmlSpecialChars ($text, $quote_style=ENT_QUOTES, $charset=null, $double_encode=true)
 
 loadConfig ($name=null)
 
 loadExtension ($name)
 
 makeClickable (&$text)
 
 makeClickableCallback01 ($match)
 
 makeClickableCallback02 ($match)
 
 makeClickableCallback03 ($match)
 
 makeClickableCallback04 ($match)
 
 mergeConfig ($config_default, $config_custom)
 
 nl2Br ($text)
 
 previewTarea ($text, $html=0, $smiley=1, $xcode=1, $image=1, $br=1)
 
 quoteConv ($text)
 
 smiley ($message)
 
 stripSlashesGPC ($text)
 
 textFilter ($text, $force=false)
 
 undoHtmlSpecialChars ($text)
 
 xoopsCodeDecode (&$text, $allowimage=1)
 

Static Public Member Functions

static getInstance ()
 
static truncate ($text)
 

Public Attributes

 $callbackPatterns = array()
 
 $callbacks = array()
 
 $censorConf
 
 $config = array()
 
 $path_basic
 
 $path_plugin
 
 $patterns = array()
 
 $replacements = array()
 
 $smileys = array()
 
 $text = ""
 

Detailed Description

Definition at line 157 of file module.textsanitizer.php.

Constructor & Destructor Documentation

MyTextSanitizer::__construct ( )

Definition at line 204 of file module.textsanitizer.php.

References $xoops_root_path, XoopsBaseConfig\get(), and loadConfig().

Here is the call graph for this function:

Member Function Documentation

MyTextSanitizer::addSlashes (   $text)

Add slashes to the text if magic_quotes_gpc is turned off.

Parameters
string$text
Returns
string

Definition at line 505 of file module.textsanitizer.php.

References $text.

MyTextSanitizer::censorString ( $text)

Replaces banned words in a string with their replacements

Parameters
string$text
Returns
string

Definition at line 624 of file module.textsanitizer.php.

References $text, and executeExtension().

Here is the call graph for this function:

MyTextSanitizer::codeConv (   $text,
  $xcode = 1 
)

MyTextSanitizer::codeConv()

Parameters
string$text
int$xcode
Returns
string

Definition at line 670 of file module.textsanitizer.php.

References $patterns, and $text.

Referenced by displayTarea().

Here is the caller graph for this function:

MyTextSanitizer::codeConvCallback (   $match)

Definition at line 657 of file module.textsanitizer.php.

References executeExtension().

Here is the call graph for this function:

MyTextSanitizer::codePreConv (   $text,
  $xcode = 1 
)

MyTextSanitizer::codePreConv()

Parameters
string$text
int$xcode
Returns
string

Definition at line 640 of file module.textsanitizer.php.

References $patterns, and $text.

Referenced by displayTarea().

Here is the caller graph for this function:

MyTextSanitizer::displayTarea (   $text,
  $html = 0,
  $smiley = 1,
  $xcode = 1,
  $image = 1,
  $br = 1 
)

Filters textarea form data in DB for display

Parameters
string$text
int$htmlallow html?
int$smileyallow smileys?
int$xcodeallow xoopscode?
int$imageallow inline images?
int$brconvert linebreaks?
Returns
string

Definition at line 568 of file module.textsanitizer.php.

References $html, $image, $text, codeConv(), codePreConv(), filterXss(), htmlSpecialChars(), makeClickable(), nl2Br(), smiley(), and xoopsCodeDecode().

Referenced by previewTarea().

Here is the call graph for this function:

Here is the caller graph for this function:

MyTextSanitizer::executeExtension (   $name)

MyTextSanitizer::executeExtension()

Parameters
string$name
Returns
mixed

Definition at line 730 of file module.textsanitizer.php.

References $name, and loadExtension().

Referenced by censorString(), codeConvCallback(), executeExtensions(), and textFilter().

Here is the call graph for this function:

Here is the caller graph for this function:

MyTextSanitizer::executeExtensions ( )

MyTextSanitizer::executeExtensions()

Returns
bool

Definition at line 687 of file module.textsanitizer.php.

References executeExtension().

Referenced by xoopsCodeDecode().

Here is the call graph for this function:

Here is the caller graph for this function:

MyTextSanitizer::filterXss (   $text)

A quick solution for filtering XSS scripts

Todo:
: To be improved
Parameters
string$text
Returns
mixed

Definition at line 472 of file module.textsanitizer.php.

References $patterns, $replacements, and $text.

Referenced by displayTarea(), and MytsTextfilter\load().

Here is the caller graph for this function:

MyTextSanitizer::getSmileys (   $isAll = true)

Get the smileys

Parameters
bool$isAllTRUE for all smileys, FALSE for smileys with display = 1
Returns
array return array

Definition at line 270 of file module.textsanitizer.php.

References $smileys, and Xoops\Core\Events\getInstance().

Here is the call graph for this function:

MyTextSanitizer::htmlSpecialChars (   $text,
  $quote_style = ENT_QUOTES,
  $charset = null,
  $double_encode = true 
)

Convert special characters to HTML entities

Parameters
string$textstring being converted
int$quote_style
string$charsetcharacter set used in conversion
bool$double_encode
Returns
string

Definition at line 536 of file module.textsanitizer.php.

References $text, and Xoops_Locale_Abstract\getCharset().

Referenced by displayTarea().

Here is the call graph for this function:

Here is the caller graph for this function:

MyTextSanitizer::loadConfig (   $name = null)
Parameters
string$name
Returns
array

Definition at line 216 of file module.textsanitizer.php.

References $file, $name, XoopsLoad\fileExists(), MyTextSanitizerExtension\loadConfig(), and mergeConfig().

Referenced by __construct().

Here is the call graph for this function:

Here is the caller graph for this function:

MyTextSanitizer::loadExtension (   $name)

MyTextSanitizer::loadExtension()

Parameters
string$name
Returns
MyTextSanitizerExtension|false

Definition at line 705 of file module.textsanitizer.php.

References $file, $name, and XoopsLoad\fileExists().

Referenced by executeExtension().

Here is the call graph for this function:

Here is the caller graph for this function:

MyTextSanitizer::makeClickable ( $text)

Make links in the text clickable

Parameters
string$text
Returns
string

Definition at line 318 of file module.textsanitizer.php.

References $text.

Referenced by displayTarea().

Here is the caller graph for this function:

MyTextSanitizer::makeClickableCallback01 (   $match)

Definition at line 291 of file module.textsanitizer.php.

References truncate().

Here is the call graph for this function:

MyTextSanitizer::makeClickableCallback02 (   $match)

Definition at line 296 of file module.textsanitizer.php.

MyTextSanitizer::makeClickableCallback03 (   $match)

Definition at line 301 of file module.textsanitizer.php.

References truncate().

Here is the call graph for this function:

MyTextSanitizer::makeClickableCallback04 (   $match)

Definition at line 306 of file module.textsanitizer.php.

MyTextSanitizer::mergeConfig (   $config_default,
  $config_custom 
)
Parameters
array$config_default
array$config_custom
Returns
array

Definition at line 234 of file module.textsanitizer.php.

Referenced by loadConfig().

Here is the caller graph for this function:

MyTextSanitizer::nl2Br (   $text)

Convert linebreaks to
tags

Parameters
string$text
Returns
string

Definition at line 494 of file module.textsanitizer.php.

References $text.

Referenced by displayTarea().

Here is the caller graph for this function:

MyTextSanitizer::previewTarea (   $text,
  $html = 0,
  $smiley = 1,
  $xcode = 1,
  $image = 1,
  $br = 1 
)

Filters textarea form data submitted for preview

Parameters
string$text
int$htmlallow html?
int$smileyallow smileys?
int$xcodeallow xoopscode?
int$imageallow inline images?
int$brconvert linebreaks?
Returns
string

Definition at line 611 of file module.textsanitizer.php.

References $html, $image, $text, displayTarea(), and stripSlashesGPC().

Here is the call graph for this function:

MyTextSanitizer::quoteConv (   $text)

Convert quote tags

Parameters
string$text
Returns
string

Definition at line 449 of file module.textsanitizer.php.

References $count, $text, and XoopsLocaleEn_US\C_QUOTE.

Referenced by xoopsCodeDecode().

Here is the caller graph for this function:

MyTextSanitizer::smiley (   $message)

Replace emoticons in the message with smiley images

Parameters
string$message
Returns
string

Definition at line 283 of file module.textsanitizer.php.

References Xoops\Core\Events\getInstance().

Referenced by displayTarea().

Here is the call graph for this function:

Here is the caller graph for this function:

MyTextSanitizer::stripSlashesGPC (   $text)

if magic_quotes_gpc is on, stirip back slashes

Parameters
string$text
Returns
string

Definition at line 519 of file module.textsanitizer.php.

References $text.

Referenced by previewTarea().

Here is the caller graph for this function:

MyTextSanitizer::textFilter (   $text,
  $force = false 
)

Filter out possible malicious text kses project at SF could be a good solution to check

Parameters
string$texttext to filter
bool$forceforce filtering
Returns
string filtered text

Definition at line 746 of file module.textsanitizer.php.

References $text, and executeExtension().

Here is the call graph for this function:

static MyTextSanitizer::truncate (   $text)
static

MyTextSanitizer::truncate()

Parameters
mixed$text
Returns
string

Definition at line 365 of file module.textsanitizer.php.

References $text, and getInstance().

Referenced by makeClickableCallback01(), and makeClickableCallback03().

Here is the call graph for this function:

Here is the caller graph for this function:

MyTextSanitizer::undoHtmlSpecialChars (   $text)

Reverses htmlSpecialChars()

Parameters
string$text
Returns
string

Definition at line 552 of file module.textsanitizer.php.

References $text.

Referenced by MytsSyntaxhighlight\load().

Here is the caller graph for this function:

MyTextSanitizer::xoopsCodeDecode ( $text,
  $allowimage = 1 
)

Replace XoopsCodes with their equivalent HTML formatting

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

Definition at line 387 of file module.textsanitizer.php.

References $callbackPatterns, $count, $i, $patterns, $replacements, $text, $xoops_url, executeExtensions(), XoopsBaseConfig\get(), and quoteConv().

Referenced by displayTarea().

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

MyTextSanitizer::$callbackPatterns = array()

Definition at line 185 of file module.textsanitizer.php.

Referenced by xoopsCodeDecode().

MyTextSanitizer::$callbacks = array()

Definition at line 186 of file module.textsanitizer.php.

MyTextSanitizer::$censorConf

Definition at line 167 of file module.textsanitizer.php.

MyTextSanitizer::$config = array()

Definition at line 202 of file module.textsanitizer.php.

MyTextSanitizer::$path_basic

Definition at line 192 of file module.textsanitizer.php.

MyTextSanitizer::$path_plugin

Definition at line 197 of file module.textsanitizer.php.

MyTextSanitizer::$patterns = array()

Definition at line 177 of file module.textsanitizer.php.

Referenced by codeConv(), codePreConv(), filterXss(), and xoopsCodeDecode().

MyTextSanitizer::$replacements = array()

Definition at line 182 of file module.textsanitizer.php.

Referenced by filterXss(), and xoopsCodeDecode().

MyTextSanitizer::$smileys = array()

Definition at line 162 of file module.textsanitizer.php.

Referenced by getSmileys().


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