Phpfox_Parse_Output

Description

Cleans text added to the database and already parsed/cleaned via Parse_Input.

This is the last attempt to clean out any invalid tags, usually fix invalid HTML tags. Anything that needs to be removed should have already been removed with Parse_Input to save on running such a heavy routine for each item. We also parse emoticons and naughty words here as this information needs to be checked each time in case new words/emoticons are added by an Admin.

  • author: Raymond Benc
  • version: $Id: output.class.php 1851 2010-09-23 13:22:05Z Raymond_Benc $
  • copyright: [PHPFOX_COPYRIGHT]
  • see: Parse_Bbcode
  • see: Parse_Input

Located in /include/library/phpfox/parse/output.class.php (line 22)


	
			
Variable Summary
Method Summary
 Phpfox_Parse_Output __construct ()
 string ajax (string $sTxt)
 string clean (string $sTxt, [bool $bHtmlChar = true])
 string htmlspecialchars (string $sTxt)
 string parse (string $sTxt)
 void setEmbedParser (array $aParams)
 void setImageParser (array $aParams)
 void shorten ( $html,  $maxLength, [ $sSuffix = null], [ $bHide = false])
 string split (string $sString, int $iCount, [bool $bBreak = false])
 string _embedWmode (array $aMatches)
 string _fixEmbedWidth (string $sInt, string $sType, [string $sEnd = null])
 string _fixImageWidth (array $aMatches)
 string _getPhrase (string $aMatches)
 string _replaceEmails (array $aMatches)
 string _replaceLinks (array $aMatches)
 string _urlToLink (array $aMatches)
Variables
array $_aEmbedParams = array() (line 47)

Parsing settings for video embeds.

  • access: private
array $_aImageParams = array() (line 40)

Parsing settings for images.

  • access: private
array $_aRegEx = array(
'url_to_link' => '~(?>[a-z+]{2,}://|www\.)(?:[a-z0-9]+(?:\.[a-z0-9]+)?@)?(?:(?:[a-z](?:[a-z0-9]|(?<!-)-)*[a-z0-9])(?:\.[a-z](?:[a-z0-9]|(?<!-)-)*[a-z0-9])+|(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))(?:/[^\\/:?*"<>|\n]*[a-z0-9])*/?(?:\?[a-z0-9_.%]+(?:=[a-z0-9_.%:/+-]*)?(?:&[a-z0-9_.%]+(?:=[a-z0-9_.%:/+-]*)?)*)?(?:#[a-z0-9_%.]+)?~is',
'email' => '/[-a-zA-Z0-9._]+@[-a-zA-Z0-9._]+(\.[-a-zA-Z0-9._]+)/is'
)
(line 30)

Regex used to convert URL and emails.

  • deprecated: 2.0.0rc1
  • access: private
Methods
Constructor __construct (line 53)

Class Constructor.

  • access: public
Phpfox_Parse_Output __construct ()
ajax (line 234)

Clean text when being sent back via AJAX.

Usually this is used to send back to an HTML <textarea>

  • return: Cleaned Text
  • access: public
string ajax (string $sTxt)
  • string $sTxt: is the text we need to clean
clean (line 172)

Clean input text, usually used within HTML <input>

  • return: Cleaned string
  • access: public
string clean (string $sTxt, [bool $bHtmlChar = true])
  • string $sTxt: is the string we need to clean
  • bool $bHtmlChar: TRUE to convert HTML characters or FALSE to not convert.
htmlspecialchars (line 208)

Our method of PHP htmlspecialchars().

string htmlspecialchars (string $sTxt)
  • string $sTxt: String to convert.
parse (line 63)

Text we need to parse, usually text added via a <textarea>.

  • return: Parsed string
  • access: public
string parse (string $sTxt)
  • string $sTxt: is the string we need to parse
setEmbedParser (line 153)

Set video embed settings.

  • access: public
void setEmbedParser (array $aParams)
  • array $aParams: ARRAY of settings.
setImageParser (line 136)

Set image parser settings.

  • access: public
void setImageParser (array $aParams)
  • array $aParams: ARRAY of settings.
shorten (line 242)
  • access: public
void shorten ( $html,  $maxLength, [ $sSuffix = null], [ $bHide = false])
  • $html
  • $maxLength
  • $sSuffix
  • $bHide
split (line 358)

Split a string at a specified location. This allows for browsers to automatically add breaks or wrap long text strings.

  • return: Converted string with splits included.
  • access: public
string split (string $sString, int $iCount, [bool $bBreak = false])
  • string $sString: Text string you want to split.
  • int $iCount: How many characters to wait until we need to perform the split.
  • bool $bBreak: FALSE will just add a space and TRUE will add an HTML
    .
_embedWmode (line 499)

Converts flash embedded videos to include "wmode".

  • return: Fixed flash embed code.
  • access: private
string _embedWmode (array $aMatches)
  • array $aMatches: ARRAY matchs from preg_match.
_fixEmbedWidth (line 531)

Fixes the width of embedded videos.

  • return: Fixed embed width/height attribute.
  • access: private
string _fixEmbedWidth (string $sInt, string $sType, [string $sEnd = null])
  • string $sInt: Width or height of the video.
  • string $sType: Define if we are dealing with the width or height of the video.
  • string $sEnd: Last string of the embed code to see if we should close the video embed code.
_fixImageWidth (line 563)

Fixes image widths.

  • return: Returns the image with max-width and max-height included.
  • access: private
string _fixImageWidth (array $aMatches)
  • array $aMatches: ARRAY of matches from a preg_match.
_getPhrase (line 552)

Gets a pharse from the language package.

  • return: Returns the phrase if we can find it.
  • access: private
string _getPhrase (string $aMatches)
  • string $aMatches: ARRAY matches from preg_match.
_replaceEmails (line 403)

Replace unwanted emails on the site. We also take into account emails that are added into the "white" list.

  • return: Returns replaced emails.
  • access: private
string _replaceEmails (array $aMatches)
  • array $aMatches: ARRAY matches from preg_match.
_replaceLinks (line 431)

Replace unwanted links on the site. We also take into account links that are added into the "white" list.

  • return: Returns replaced links.
  • access: private
string _replaceLinks (array $aMatches)
  • array $aMatches: ARRAY matches from preg_match.
_urlToLink (line 458)

Converts a URL into a HTML anchor.

  • return: Converted URL.
  • access: private
string _urlToLink (array $aMatches)
  • array $aMatches: ARRAY matches from preg_match.

Documentation generated on Tue, 28 Sep 2010 10:36:42 +0200 by phpDocumentor 1.4.0a2