\Text

Copyright (c) 5/4/15 , dsphinx@plug.gr All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. All advertising materials mentioning features or use of this software must display the following acknowledgement: This product includes software developed by the dsphinx@plug.gr.
  4. Neither the name of the dsphinx@plug.gr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

    THIS SOFTWARE IS PROVIDED BY dsphinx@plug.gr ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL dsphinx BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

    Created : 9:38 PM - 5/4/15

Summary

Methods
Properties
Constants
stripWhitespace()
wordSelector()
textTruncate()
removeAccents()
shortenText()
strip_html_tags()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

stripWhitespace()

stripWhitespace(  $text) : mixed

Parameters

$text

Strip all whitespace to only one

Returns

mixed

wordSelector()

wordSelector(  $text,   $matches,   $replace) : mixed

Parameters

$text
$matches
$replace

Select $matches all words array with style i u l

Text::wordSelector($text, array("plug"),"u"); Text::wordSelector($text, array("plug"),"label");

Returns

mixed

textTruncate()

textTruncate(  $text,   $max,   $symbol = "...") : string

Parameters

$text
$max
$symbol

Truncate text fro $max characters

Returns

string

removeAccents()

removeAccents(  $text) : mixed

Parameters

$text

remove accents , last character from $from

Returns

mixed

shortenText()

shortenText(  $text,   $size,   $mark = "/-/-/") : string

Parameters

$text
$size
$mark

To shorten a URL (or other string)

echo shortenText($text, 60, "/-/-/");

Returns

string

strip_html_tags()

strip_html_tags(  $text) 

Remove HTML tags, including invisible text such as style and script code, and embedded objects. Add line breaks around block-level tags to prevent word joining after tag removal.

Read an HTML file, convert to UTF-8, strip out HTML tags and invisible content, and decode HTML entities into UTF-8:

$raw_text = file_get_contents( $filename );

Get the file's character encoding from a tag preg_match( '@<meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s+charset=([^\s"]+))?@i', $raw_Text, $matches ); $encoding = $matches[3];

/* Convert to UTF-8 before doing anything else $utf8_text = iconv( $encoding, "utf-8", $raw_text );

/* Strip HTML tags and invisible text $utf8_text = strip_html_tags( $utf8_text );

/* Decode HTML entities $utf8_text = html_entity_decode( $utf8_text, ENT_QUOTES, "UTF-8" ); Explanation

http://nadeausoftware.com/articles/2007/09/php_tip_how_strip_html_tags_web_page

Parameters

$text