Skip to content

icms_core_HTMLFilter

Raimondas Rimkevičius edited this page Mar 9, 2020 · 1 revision
Notice: Wiki was automatic generated from project sources as project API documentation. Do not edit manually!

icms_core_HTMLFilter

Class to Clean & Filter HTML for various uses.

Class uses external HTML Purifier for filtering.

Properties

$purifier

public mixed $purifier

variable used by HTML Filter Library

  • Visibility: public

$displaySmileys

public mixed $displaySmileys = array()
  • Visibility: public
  • This property is static.

$allSmileys

public mixed $allSmileys = array()
  • Visibility: public
  • This property is static.

Methods

__construct

mixed icms_core_DataFilter::__construct()

getInstance

object icms_core_HTMLFilter::getInstance()

Access the only instance of this class

  • Visibility: public
  • This method is static.

filterHTML

string icms_core_HTMLFilter::filterHTML(string html)

Gets the selected HTML Filter & filters the content

  • Visibility: public
  • This method is static.

Arguments

  • html string - <p>input to be cleaned</p>

getCustomFilterList

mixed icms_core_HTMLFilter::getCustomFilterList()
  • Visibility: private
  • This method is static.

getHTMLFilterConfig

array icms_core_HTMLFilter::getHTMLFilterConfig()

Gets Custom Purifier configurations ** this function will improve in time **

  • Visibility: protected
  • This method is static.

filterDebugInfo

mixed icms_core_DataFilter::filterDebugInfo(text, msg)

Arguments

  • text mixed
  • msg mixed

_filterImgUrl

string icms_core_DataFilter::_filterImgUrl(array matches)

Filters out invalid strings included in URL, if any

Arguments

  • matches array

checkUrlString

bool icms_core_DataFilter::checkUrlString(string text)

Checks if invalid strings are included in URL

Arguments

  • text string

nl2Br

string icms_core_DataFilter::nl2Br(string text)

Convert linebreaks to
tags

Arguments

  • text string

htmlSpecialChars

string icms_core_DataFilter::htmlSpecialChars(string text)

for displaying data in html textbox forms

Arguments

  • text string

undoHtmlSpecialChars

string icms_core_DataFilter::undoHtmlSpecialChars(string text)

Reverses htmlSpecialChars

Arguments

  • text string

htmlEntities

string|string[]|null icms_core_DataFilter::htmlEntities(string text)

Converts text string with HTML entities

Arguments

  • text string - <p>Text to add HTML entities</p>

addSlashes

string icms_core_DataFilter::addSlashes(string text)

Note: magic_quotes_gpc and magic_quotes_runtime are deprecated as of PHP5.3.0

Arguments

  • text string

stripSlashesGPC

string icms_core_DataFilter::stripSlashesGPC(string text)

Note: magic_quotes_gpc and magic_quotes_runtime are deprecated as of PHP5.3.0 does that mean we can remove this function once 5.3 is minimum req? if magic_quotes_gpc is on, strip back slashes

Arguments

  • text string

cleanArray

array icms_core_DataFilter::cleanArray(mixed arr)

Filters Multidimensional Array Recursively removing keys with empty values

Arguments

  • arr mixed

checkVar

mixed icms_core_DataFilter::checkVar(data, type, options1, options2)

Arguments

  • data mixed
  • type mixed
  • options1 mixed
  • options2 mixed

checkVarArray

array icms_core_DataFilter::checkVarArray(array input, array filters, bool strict)

Filter an array of variables, such as $_GET or $_POST, using a set of filters.

Any items in the input array not found in the filter array will be filtered as a string.

Arguments

  • input array - <p>items to be filtered</p>
  • filters array - <p>the keys of this array should match the keys in the input array and the values should be valid types for the checkVar method</p>
  • strict bool - <p>when TRUE (default), items not in the filter array will be discarded when FALSE, items not in the filter array will be filtered as strings and included</p>

filterTextareaInput

string icms_core_DataFilter::filterTextareaInput(string text)

Filters textarea form data for INPUt to DB (text only!!) For HTML please use icms_core_HTMLFilter::filterHTMLinput()

Arguments

  • text string

filterTextareaDisplay

string icms_core_DataFilter::filterTextareaDisplay(string text, bool smiley, bool icode, bool image, bool br)

Filters textarea for DISPLAY purposes (text only!!) For HTML please use icms_core_HTMLFilter::filterHTMLdisplay()

Arguments

  • text string
  • smiley bool - <p>allow smileys?</p>
  • icode bool - <p>allow icmscode?</p>
  • image bool - <p>allow inline images?</p>
  • br bool - <p>convert linebreaks?</p>

filterHTMLinput

string icms_core_DataFilter::filterHTMLinput(string html, bool smiley, bool icode, bool image, mixed br)

Filters HTML form data for INPUT to DB

Arguments

  • html string
  • smiley bool - <p>allow smileys?</p>
  • icode bool - <p>allow icmscode?</p>
  • image bool - <p>allow inline images?</p>
  • br mixed

filterHTMLdisplay

string icms_core_DataFilter::filterHTMLdisplay(string html, bool icode, mixed br)

Filters HTML form data for Display Only we don't really require the icmscode stuff, but we need to for content already in the DB before we start filtering on INPUT instead of OUTPUT!!

Arguments

  • html string
  • icode bool - <p>allow icmscode?</p>
  • br mixed

codeDecode

string icms_core_DataFilter::codeDecode(string text, bool allowimage)

Replace icmsCodes with their equivalent HTML formatting

Arguments

  • text string
  • allowimage bool - <p>Allow images in the text? On FALSE, uses links to images.</p>

makeClickable

string icms_core_DataFilter::makeClickable(string text)

Make links in the text clickable

Arguments

  • text string

smiley

mixed icms_core_DataFilter::smiley(message)

Arguments

  • message mixed

getSmileys

mixed icms_core_DataFilter::getSmileys(mixed all)

Arguments

  • all mixed

censorString

string icms_core_DataFilter::censorString(string text)

Replaces banned words in a string with their replacements

Arguments

  • text string

codePreConv

mixed icms_core_DataFilter::codePreConv(mixed text, mixed imcode)

Arguments

  • text mixed
  • imcode mixed

codeConv

string icms_core_DataFilter::codeConv(string text, int imcode, int image)

Converts text to imcode

Arguments

  • text string - <p>Text to convert</p>
  • imcode int - <p>Is the code Xcode?</p>
  • image int - <p>configuration for the purifier</p>

codeSanitizer

string icms_core_DataFilter::codeSanitizer(string str, string image)

Sanitizes decoded string

Arguments

  • str string - <p>String to sanitize</p>
  • image string - <p>Is the string an image</p>

codeDecode_extended

string icms_core_DataFilter::codeDecode_extended(string text, int allowimage)

This function gets allowed plugins from DB and loads them in the sanitizer

Arguments

  • text string - <p>Plugin name</p>
  • allowimage int - <p>Allow image?</p>

loadExtension

bool icms_core_DataFilter::loadExtension(string name)

loads the textsanitizer plugins

Arguments

  • name string - <p>Name of the extension to load</p>

executeExtension

string icms_core_DataFilter::executeExtension(string name, string text)

Executes file with a certain extension using call_user_func_array

Arguments

  • name string - <p>Name of the file to load</p>
  • text string - <p>Text to show if the function doesn't exist</p>

textsanitizer_syntaxhighlight

string icms_core_DataFilter::textsanitizer_syntaxhighlight(string text)

Syntaxhighlight the code

Arguments

  • text string - <p>purifies (lightly) and then syntax highlights the text</p>

textsanitizer_php_highlight

string icms_core_DataFilter::textsanitizer_php_highlight(string text)

Syntaxhighlight the code using PHP highlight

Arguments

  • text string - <p>Text to highlight</p>

textsanitizer_geshi_highlight

string icms_core_DataFilter::textsanitizer_geshi_highlight(string text)

Syntaxhighlight the code using Geshi highlight

Arguments

  • text string - <p>The text to highlight</p>

icms_trim

string icms_core_DataFilter::icms_trim(string text)

Trims certain text

Replaces include/functions.php :: xoops_trim()

Arguments

  • text string - <p>The Text to trim</p>

utf8_strrev

string icms_core_DataFilter::utf8_strrev(string str, string reverse)

Function to reverse given text with utf-8 character sets

credit for this function should goto lwc courtesy of php.net.

Arguments

  • str string - <p>The text to be reversed.</p>
  • reverse string - <p>TRUE will reverse everything including numbers, FALSE will reverse text only but numbers will be left intact. example: when TRUE: impresscms 2008 > 8002 smcsserpmi, FALSE: impresscms 2008 > 2008 smcsserpmi</p>

icms_substr

string icms_core_DataFilter::icms_substr(string str, int start, int length, string trimmarker)

Returns the portion of string specified by the start and length parameters.

If $trimmarker is supplied, it is appended to the return string. This function works fine with multi-byte characters if mb_* functions exist on the server.

Replaces legacy include/functions.php :: xoops_substr()

Arguments

  • str string
  • start int
  • length int
  • trimmarker string

priv_checkVar

mixed icms_core_DataFilter::priv_checkVar(mixed data, mixed type, mixed options1, mixed options2)

Private Function checks & Validates Data

Arguments

  • data mixed
  • type mixed
  • options1 mixed
  • options2 mixed

priv_smiley

string icms_core_DataFilter::priv_smiley(string message)

Replace emoticons in the message with smiley images

Arguments

  • message string

priv_getSmileys

array icms_core_DataFilter::priv_getSmileys(bool all)

Get the smileys

Arguments

  • all bool
Clone this wiki locally