wCMF  3.6
 All Classes Namespaces Files Functions Variables Groups Pages
StringUtil Class Reference

Public Member Functions

 getDump ($var)
 
 cropString ($text, $length=100, $ending='...', $exact=false, $considerHtml=true)
 
 removeTrailingComma ($string)
 
 getUrls ($string)
 
 quotesplit ($s)
 
 splitQuoted ($str, $delim='//', $quoteChr='"', $preserve=false)
 
 excerpt ($text, $phrase, $radius=100)
 

Detailed Description

StringUtil provides support for string manipulation.

wCMF - wemove Content Management Framework Copyright (C) 2005-2014 wemove digital solutions GmbH

Licensed under the terms of any of the following licenses at your choice:

See the license.txt file distributed with this work for additional information.

Id:
class.StringUtil.php 1462 2014-02-04 23:52:27Z iherwig
Author
ingo herwig ingo@.nosp@m.wemo.nosp@m.ve.co.nosp@m.m

Definition at line 27 of file class.StringUtil.php.

Member Function Documentation

StringUtil::getDump (   $var)

Get the dump of a variable as string.

Parameters
varThe variable to dump.
Returns
String

Definition at line 34 of file class.StringUtil.php.

Referenced by MultipleActionController\executeKernel(), and Node\filter().

StringUtil::cropString (   $text,
  $length = 100,
  $ending = '...',
  $exact = false,
  $considerHtml = true 
)

Truncate a string up to a number of characters while preserving whole words and HTML tags code from: http://alanwhipple.com/2011/05/25/php-truncate-string-preserving-html-tags-words/

Parameters
textString to truncate.
lengthLength of returned string, including ellipsis.
endingEnding to be appended to the trimmed string.
exactIf false, $text will not be cut mid-word
considerHtmlIf true, HTML tags would be handled correctly
Returns
String

Definition at line 52 of file class.StringUtil.php.

StringUtil::removeTrailingComma (   $string)
StringUtil::getUrls (   $string)

Extraxt urls from a string.

Parameters
stringThe string to search in
Returns
An array with urls
Note
This method searches for occurences of <a..href="xxx"..>, <img..src="xxx"..>, <input..src="xxx"..> or <form..action="xxx"..> and extracts xxx.

Definition at line 158 of file class.StringUtil.php.

Referenced by LinkConverter\convertApplicationToStorage(), LinkConverter\convertStorageToApplication(), and NodeUtil\makeValueUrlsRelative().

StringUtil::quotesplit (   $s)

Split a quoted string code from: http://php3.de/manual/de/function.split.php

$string = '"hello, world", "say \"hello\"", 123, unquotedtext';
$result = quotsplit($string);
// results in:
// ['hello, world'] [say "hello"] [123] [unquotedtext]
Parameters
sThe string to split
Returns
An array of strings

Definition at line 192 of file class.StringUtil.php.

Referenced by InifileParser\processValue().

StringUtil::splitQuoted (   $str,
  $delim = '/ /',
  $quoteChr = '"',
  $preserve = false 
)

Split string preserving quoted strings code based on: http://www.php.net/manual/en/function.explode.php#94024

Parameters
strString to split
delimRegexp to use in preg_split
quoteChrQuote character
preserveBoolean whether to preserve the quote character or not
Returns
Array

Definition at line 251 of file class.StringUtil.php.

Referenced by StringQuery\buildQuery().

StringUtil::excerpt (   $text,
  $phrase,
  $radius = 100 
)

Create an excerpt from the given text around the given phrase code based on: http://stackoverflow.com/questions/1292121/how-to-generate-the-snippet-like-generated-by-google-with-php-and-mysql

Definition at line 271 of file class.StringUtil.php.

Referenced by SearchUtil\find().


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