Contentserv PHP API

CSStringUtils
in package

Collection of various convenience methods around string operation

This class offers a set of methods that will be helpful to work with strings in PHP

Tags
since
5.0.4

Table of Contents

CRYPT_TYPE_LOOSE  = 1
CRYPT_TYPE_PKEY  = 4
CRYPT_TYPE_PRKEY  = 6
CRYPT_TYPE_SERVER  = 5
CRYPT_TYPE_SESSION  = 2
CRYPT_TYPE_TICKET  = 3
DOMCONV_MODE_NOHTMLENT  = 4
DOMCONV_MODE_PLAINJSON  = 1
DOMCONV_MODE_RAWDATA  = 0
DOMCONV_MODE_TAGGEDJSON  = 2
DOMCONV_PREFIX_JSON  = '@@JSON@@'
Array <-> DOM attribute string conversion flags/markers
PATTERN_URL  = '/^((ht|f)tp(s?)\:\/\/)?[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\:\'\/\\\\+=&amp;%\$#_]*)?$/'
A regex pattern for Website URLs
addslashes()  : string
This function returns a string with added slashes before some special characeters (see php function addslashes)
charNumberToUtf()  : string
Transforms unicode to character string
convertColor()  : array<string|int, mixed>
Converts a color string in the hex, rgb, rgba or cmyk format to an array of rgba values
convertFromUTF8()  : string
Decode a string using PHP mb_convert_encoding PHP utf8_decode is deprecated
convertToUTF8()  : string
Encode a string using PHP mb_convert_encoding PHP utf8_encode is deprecated
crypt()  : string
Crypts a string with CONTENTSERV methods
cutAtFirstDot()  : string
This function trims a string after the first dot
decrypt()  : string
Decrypts a string crypted with the CSStringUtils-method crypt
dumpVar()  : string
Returns dump information about one or more variable(s).
endsWith()  : bool
This function return true, if a given string ends with a specific needle
escapeshellarg()  : string
Escapes a string to be used as a shell argument
explode()  : array<string|int, mixed>
Splits a string into array parts formed by splitting it on boundaries formed by the string separator
formatByteSize()  : string
This function returns a formatted (file) byte size, respecting the number format that has been set in the user's language. Unit scales are based on the binary factor of 1024 and postfixed with proper IEC units.
formatDate()  : string
This function returns a formatted date string
formatDuration()  : string
This function returns a formatted time string
formatFileSize()  : string
Formats a (file) byte size using a plain number with SI units.
formatNumber()  : string
This function returns a formatted number
formatTelephoneNumber()  : string
This function returns a formatted telephone number
formatTime()  : string
This function returns a formatted time string
getArrayFromAttrString()  : string
Converts a string in DOM notation (attr="value") into an (associative) array.
getAttrStringFromArray()  : string
Converts an array into a string representation as used in DOM notation (attr="value").
getIdArrayFromString()  : array<string|int, mixed>
Converts a string containing a (comma-)separated ID list into its corresponding array representation.
getPHPAnnotations()  : array<string|int, mixed>
Parses the method annotations of a class
iconv()  : string
In this method we are converting string using iconv method.
iconv_wordwrap()  : string
Word wrap
insertTextAfter()  : string
Inserts the given text into a string after the given needle
insertTextBefore()  : string
Inserts the given text into a string before the given needle
intToLetters()  : string
Converts a given integer number into an uppercase letters-only representation.
intToRoman()  : string
Converts a given integer number to its Roman number representation.
makeTagHtml401()  : string
Generates an HTML 4.01 compatible tag string.
open()  : string
Opens data that was previously sealed with CSStringUtils::seal method with a matching private key.
replaceInvalidCharacters()  : mixed|string
Replaces invalid filesystem characters in a file/folder name string.
replaceInvalidPathCharacters()  : mixed|string
Replaces invalid filesystem characters in a path string.
replaceURLParameter()  : string
Adds or replaces a query component in an url
romanToInt()  : int
Converts a roman numeral to a number
seal()  : string
Seals the provided data with the public keys provded as second parameters. This method can be used to encrypt data that can be decrypted by multiple recipients if at least one of them has the matching private key.
shortenText()  : string
This function abbreviates a text by appending ... at the end
sign()  : string
Creates a signature for the data passed in $sData based on a private key.
startsWith()  : bool
This function returns true, if a string starts with a specific needle
strcasecmp()  : int
Case insensitive string comparisons using a "german sort order" algorithm
stripHtmlTags()  : string
This function removes all html tags and additionally considers if a tag is actually closed or not
stripTags()  : string
This function removes all tags as well as style and script ranges from an html formatted text
textAfter()  : string
This function returns the text in a string after a needle
textBefore()  : string
This function returns the text in a string before a needle
trim()  : mixed
Additionally to the standard php function this method also supports arrays as parameter
ucFirst()  : string
Makes the first character of the string uppercase and rest of the string lowercase
urlencode()  : string
Enter description here.
verify()  : bool
Validates a signature for the data passed in $sData based on a public key.

Constants

DOMCONV_MODE_NOHTMLENT

public mixed DOMCONV_MODE_NOHTMLENT = 4
Tags

DOMCONV_MODE_PLAINJSON

public mixed DOMCONV_MODE_PLAINJSON = 1
Tags

DOMCONV_MODE_RAWDATA

public mixed DOMCONV_MODE_RAWDATA = 0
Tags

DOMCONV_MODE_TAGGEDJSON

public mixed DOMCONV_MODE_TAGGEDJSON = 2
Tags

DOMCONV_PREFIX_JSON

Array <-> DOM attribute string conversion flags/markers

public mixed DOMCONV_PREFIX_JSON = '@@JSON@@'
Tags

PATTERN_URL

A regex pattern for Website URLs

public mixed PATTERN_URL = '/^((ht|f)tp(s?)\:\/\/)?[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\:\'\/\\\\+=&amp;%\$#_]*)?$/'
Tags

Methods

addslashes()

This function returns a string with added slashes before some special characeters (see php function addslashes)

public static addslashes(string $string) : string
Parameters
$string : string

the string the slashes should be added to

Tags
access

public

Return values
string

slashed string

charNumberToUtf()

Transforms unicode to character string

public static charNumberToUtf(string $iNum) : string
Parameters
$iNum : string

the unicode to transform

Tags
Return values
string

the string representation of the unicode

convertColor()

Converts a color string in the hex, rgb, rgba or cmyk format to an array of rgba values

public static convertColor(string $sColor) : array<string|int, mixed>
Parameters
$sColor : string

the color to convert

Tags
access

public

Return values
array<string|int, mixed>

with the four values [R, G, B, A]

convertFromUTF8()

Decode a string using PHP mb_convert_encoding PHP utf8_decode is deprecated

public static convertFromUTF8(string $sString) : string
Parameters
$sString : string

String to be decoded from UTF8

Tags
Return values
string

Decoded string

convertToUTF8()

Encode a string using PHP mb_convert_encoding PHP utf8_encode is deprecated

public static convertToUTF8(string $sString) : string
Parameters
$sString : string

String to be encoded to UTF8

Tags
Return values
string

Encoded string

crypt()

Crypts a string with CONTENTSERV methods

public static crypt(string $sData[, int $iType = self::CRYPT_TYPE_LOOSE ]) : string
Parameters
$sData : string

the string to crypt

$iType : int = self::CRYPT_TYPE_LOOSE

The crypting type as one of the CRYPT_TYPE_*-constants

CRYPT_TYPE_LOOSE: old way of encrypting strings, not very safe. Should not be used any more. CRYPT_TYPE_SESSION: Session based ssl encryption. Crypt key is the current session id. Data cannot be decrypted in other sessions. CRYPT_TYPE_TICKET: Ticket based ssl encryption. Crypt key is the current ticket id. Data cannot be decrypted when another ticket is used. CRYPT_TYPE_PKEY: encrypts data based on the public/private key combination of the current system. CRYPT_TYPE_PRKEY: encrypts data based on the private/public key combination of the current system. CRYPT_TYPE_SERVER: encrypts data based on the server id

Tags
access

public

Return values
string

crypted representation of the string

cutAtFirstDot()

This function trims a string after the first dot

public static cutAtFirstDot(string $text) : string
Parameters
$text : string

the text to be trimmed after the first dot

Tags
access

public

Return values
string

the trimmed text

decrypt()

Decrypts a string crypted with the CSStringUtils-method crypt

public static decrypt(string $sEncryptedData[, int $iType = self::CRYPT_TYPE_LOOSE ]) : string
Parameters
$sEncryptedData : string
$iType : int = self::CRYPT_TYPE_LOOSE

The crypting type as one of the CRYPT_TYPE_*-constants. Must be the same value that was passed when data was crypted with "CSStringUtils::crypt".

Tags
throws
CSUtilsException
access

public

Return values
string

the decrypted string

dumpVar()

Returns dump information about one or more variable(s).

public static dumpVar(mixed $mExpression) : string

This method is a wrapper to the PHP "var_dump()" function, except for its output not being dumped to the client directly, but instead being returned as a string.

Parameters
$mExpression : mixed

The variable or expression to dump. Multiple arguments may be specified; see for further details.

Tags
access

public

Return values
string

Returns structured information about one or more expressions that includes its type and value. Arrays and objects are explored recursively with values indented to visualize its structure.

endsWith()

This function return true, if a given string ends with a specific needle

public static endsWith(string $string, string $needle) : bool
Parameters
$string : string

the string to be checked

$needle : string

the string that is expected at the end of the first parameter

Tags
access

public

Return values
bool

true, if the string ends with the needle

escapeshellarg()

Escapes a string to be used as a shell argument

public static escapeshellarg(string $string) : string
Parameters
$string : string
Tags
Return values
string

explode()

Splits a string into array parts formed by splitting it on boundaries formed by the string separator

public static explode(string $sSeparator, string $sString[, int|null $iLimit = null ][, int|null $iFillLength = null ][, mixed|null $mFillValue = null ]) : array<string|int, mixed>
Parameters
$sSeparator : string

Separator

$sString : string

String to be splitted

$iLimit : int|null = null

Array elements limit

$iFillLength : int|null = null

New array size

$mFillValue : mixed|null = null

Value to fill if array is less than length

Tags
Return values
array<string|int, mixed>

The splited parts

formatByteSize()

This function returns a formatted (file) byte size, respecting the number format that has been set in the user's language. Unit scales are based on the binary factor of 1024 and postfixed with proper IEC units.

public static formatByteSize(int $iBytes[, bool $bPlainBytes = FALSE ][, bool $bUseIecStandard = true ]) : string
Parameters
$iBytes : int

The (file) size in bytes.

$bPlainBytes : bool = FALSE

If set to FALSE (default), large values are scaled down to the proper unit. Otherwise, the numeric file size is formatted according to the user's language settings and postfixed with 'Byte', i.e. no scaling takes place.

$bUseIecStandard : bool = true

Toggle to define whether the IEC or the SI standard should be used

Tags
access

public

Return values
string

The formatted byte size consisting of a value and the unit.

formatDate()

This function returns a formatted date string

public static formatDate(mixed $date[, string $format = NULL ]) : string
Parameters
$date : mixed

the date as formatted string or seconds since 1970

$format : string = NULL

the format that should used for the resulting date. If it is not passed the users languages DateFormat is used.

Tags
access

public

Return values
string

the formatted date

formatDuration()

This function returns a formatted time string

public static formatDuration(mixed $duration[, bool $returnDuration = TRUE ][, bool $fullFormat = FALSE ]) : string
Parameters
$duration : mixed

the duration in seconds as int or the time in the format Hours:Minutes[:Seconds]

$returnDuration : bool = TRUE

whether the duration should be returned as string (true) or as integer of seconds (false)

$fullFormat : bool = FALSE

whether the duration may be shortend trimming trailing 0 or removing seconds if equals to :00 (false) or whether the time is always returned in the format 00:00:00 (true)

Tags
access

public

Return values
string

the formatted duration in the format Hours:Minutes[:Seconds]

formatFileSize()

Formats a (file) byte size using a plain number with SI units.

public static formatFileSize(int $size) : string

Unit scaling is performed with a factor of 1024.

Use formatByteSize() for proper IEC units and CSLanguage-specific formatting.

Parameters
$size : int

The (file) size in bytes.

Tags
see
formatByteSize
access

public

Return values
string

The formatted byte size consisting of a value and the unit.

formatNumber()

This function returns a formatted number

public static formatNumber(float $number[, int $digitsBefore = 1 ][, int $digitsAfter = 2 ][, string $separator = '.' ]) : string
Parameters
$number : float

the number that should be formatted

$digitsBefore : int = 1

the number of digits before the decimal separator

$digitsAfter : int = 2

the number of digits after the decimal separator

$separator : string = '.'

the decimal separator

Tags
access

public

Return values
string

the formatted number

formatTelephoneNumber()

This function returns a formatted telephone number

public static formatTelephoneNumber(string $number) : string
Parameters
$number : string

the telephone number that should be formatted

Tags
access

public

Return values
string

the formatted telephone number

formatTime()

This function returns a formatted time string

public static formatTime(mixed $time[, string $format = NULL ]) : string
Parameters
$time : mixed
$format : string = NULL

the format that should used for the resulting time. If it is not passed the users languages TimeFormat is used.

Tags
access

public

Return values
string

the formatted time

getArrayFromAttrString()

Converts a string in DOM notation (attr="value") into an (associative) array.

public static getArrayFromAttrString(array<string|int, mixed> $sDomString[, string $cEncapsChar = '"' ][, string $sCharset = 'UTF-8' ][, int $iConvMode = self::DOMCONV_MODE_TAGGEDJSON ]) : string
Parameters
$sDomString : array<string|int, mixed>

The string that should be converted.

$cEncapsChar : string = '"'

A one-character string used for encapsulating if the value (typically, this is either a single or double quote character). Anything exceeding the first character will be truncated. By default, the double quote character is used.

$sCharset : string = 'UTF-8'

The character set of both the $sDomString and the $cEncapsChar. This will be taken into account when performing HTML entity decoding.

$iConvMode : int = self::DOMCONV_MODE_TAGGEDJSON

A combination of CSStringUtils::DOMCONV_MODE_* constants which provides further value processing instructions. Usually, the method will try to decode attribute values in JSON back into the corresponding PHP data type. Also, pure string attribute values will be processed by the PHP html_entity_decode() function. The RAWDATA mode skips all of these conversions. PLAINJSON mode converts all(!) JSON-compliant strings (tagged AND untagged), while TAGGEDJSON mode (the default) only converts JSON strings that have been tagged by the (inverse) method.

Tags
access

public

Return values
string

An array containing the attribute names as the element keys and the (possibly parsed/converted) attribute values as the element values.

getAttrStringFromArray()

Converts an array into a string representation as used in DOM notation (attr="value").

public static getAttrStringFromArray(array<string|int, mixed> $amInput[, string $cEncapsChar = '"' ][, int $iConvMode = self::DOMCONV_MODE_TAGGEDJSON ]) : string
Parameters
$amInput : array<string|int, mixed>

The array that should be converted, where the array's keys are mapped to the DOM attributes names and the values are mapped to the attributes values.

$cEncapsChar : string = '"'

A one-character string used for encapsulating if the value (typically, this is either a single or double quote character). Anything exceeding the first character will be truncated. By default, the double quote character is used.

$iConvMode : int = self::DOMCONV_MODE_TAGGEDJSON

A combination of CSStringUtils::DOMCONV_MODE_* constants which provides further value processing instructions. Currently, only the TAGGEDJSON mode is respected, which adds a special marker to JSON strings that have been obtained from array-typed values. If unset, plain JSON will be generated.

Tags
throws
CSUtilsException

Thrown if $amInput is not an array.

access

public

Return values
string

The array's string representation as used in DOM notation. Array elements containing a sub-array will be encoded in JSON, string elements will be converted using .

getIdArrayFromString()

Converts a string containing a (comma-)separated ID list into its corresponding array representation.

public static getIdArrayFromString(string $sIdListString[, string $sIdSeparator = ',' ][, bool $bPreserveZero = false ]) : array<string|int, mixed>
Parameters
$sIdListString : string

The string representation of an ID list, e.g. "14,7, 89 ,, 9,9".

$sIdSeparator : string = ','

The separator character or string that is used to split the individual IDs.

$bPreserveZero : bool = false

If set to true Integer Zero values (0) will not be removed

Tags
Return values
array<string|int, mixed>

An array containing the individual IDs. Any whitespace will be trimmed from the IDs and empty ID entries will be removed from the list. Duplicate IDs will not be stripped from the list. The order of the IDs will not be changed during the extraction process. No type casting will be performed on the elements, so the result ID array will contain pure string elements, The above sample in the $sIdListString would e.g. result in "array('14', '7', '89', '9', '9')".

getPHPAnnotations()

Parses the method annotations of a class

public static getPHPAnnotations(string $className) : array<string|int, mixed>
Parameters
$className : string

the name of the class to be parsed

Tags
Return values
array<string|int, mixed>

with class and methods annotations

iconv()

In this method we are converting string using iconv method.

public static iconv(string $sInputEncoding, string $sOutputEncoding, string $sValue) : string

If it doesn't convert to expected form in normal way then adding suffix '//TRANSLIT' to $sOutputEncoding. If still string is not converted then it will be converted by mb_convert_encoding.

Parameters
$sInputEncoding : string

form of source string.

$sOutputEncoding : string

convert to that form.

$sValue : string

Value whcih need to be converted.

Tags
Return values
string

iconv_wordwrap()

Word wrap

public static iconv_wordwrap(string $string[, int $width = 75 ][, string $break = " " ][, bool $cut = FALSE ][, string $charset = 'utf-8' ][, bool $bCutOnlyWords = TRUE ]) : string
Parameters
$string : string
$width : int = 75
$break : string = " "
$cut : bool = FALSE
$charset : string = 'utf-8'
$bCutOnlyWords : bool = TRUE
Tags
Return values
string

insertTextAfter()

Inserts the given text into a string after the given needle

public static insertTextAfter(string $sString, string $sNeedle, string $sAddString) : string
Parameters
$sString : string
$sNeedle : string
$sAddString : string
Tags
Return values
string

insertTextBefore()

Inserts the given text into a string before the given needle

public static insertTextBefore(string $sString, string $sNeedle, string $sAddString) : string
Parameters
$sString : string
$sNeedle : string
$sAddString : string
Tags
Return values
string

intToLetters()

Converts a given integer number into an uppercase letters-only representation.

public static intToLetters(int $iNumber) : string

As counting is started at number one, any zero or negative values are represented by an empty string. This representation (A..Z, AA..AZ, BA..BZ, etc.) is the same one as in the numbering of MS Excel spreadsheet columns or Adobe InDesign uppercase letters page names.

Parameters
$iNumber : int

The number to convert. Any non-integer types are eventually truncated due to a typecast.

Tags
access

public

Return values
string

A string containing the uppercase letters-only representation of the input.

intToRoman()

Converts a given integer number to its Roman number representation.

public static intToRoman(int $iNumber) : string

As Roman numbers start counting from number one, any zero or negative values are represented by an empty string.

Parameters
$iNumber : int

The number to convert. Any non-integer types are eventually truncated due to a typecast.

Tags
access

public

Return values
string

A string containing the Roman number representation of the input.

makeTagHtml401()

Generates an HTML 4.01 compatible tag string.

public static makeTagHtml401(string $sTagName[, array<string|int, mixed> $asAttributes = array() ][, string $sTagContent = '' ]) : string
Parameters
$sTagName : string

The name of the tag to create.

$asAttributes : array<string|int, mixed> = array()

An associative array of key/value pairs to use as the tag's attributes. Attribute data containing special characters are NOT automatically converted into their respective HTML entities for versatility reasons.

$sTagContent : string = ''

Arbitrary character data to emit between the opening and the closing tag. Just like attribute data, you have to care for HTML entity conversion on your own.

Tags
throws
CSUtilsException

Thrown if $amInput is not an array.

access

public

Return values
string

The generated HTML tag. Be aware that some tags in the HTML 4.01 DTD must not contain any tag content. These tags will be closed in an XHTML-compliant manner ("").

open()

Opens data that was previously sealed with CSStringUtils::seal method with a matching private key.

public static open(string $sEncryptedData[, array<string|int, mixed> $sPrivateKey = '' ]) : string

If no private key has been provided as argument the method uses the project side private key. Only in case that a private key has been provided in the admin directory (not there by default), all other private keys are ignored (except if one has been passed as argument).

Parameters
$sEncryptedData : string
$sPrivateKey : array<string|int, mixed> = ''

the private key to open the data with. If this key does not match an exception is thrown.

Tags
throws
CSUtilsException
access

public

Return values
string

the opened data

replaceInvalidCharacters()

Replaces invalid filesystem characters in a file/folder name string.

public static replaceInvalidCharacters(string $sSubject[, string $sReplaceCharacter = '-' ]) : mixed|string
Parameters
$sSubject : string

String to be checked for invalid characters

$sReplaceCharacter : string = '-'

Character to be used on replaced characters

Tags
Return values
mixed|string

replaceInvalidPathCharacters()

Replaces invalid filesystem characters in a path string.

public static replaceInvalidPathCharacters(string $sPath[, string $sReplaceCharacter = '-' ]) : mixed|string
Parameters
$sPath : string
$sReplaceCharacter : string = '-'
Tags
Return values
mixed|string

replaceURLParameter()

Adds or replaces a query component in an url

public static replaceURLParameter(string $url, string $key, mixed $newValue[, string $bInsert = true ]) : string
Parameters
$url : string

the url where the new query argument should be added

$key : string

the name of the new argument

$newValue : mixed
$bInsert : string = true

whether the specified parameter should be added when originally missing

Tags
access

public

Return values
string

the composed url

romanToInt()

Converts a roman numeral to a number

public static romanToInt(string $roman) : int
Parameters
$roman : string

The roman numeral to convert lower cased numerals are converted into uppercase

Tags
access

public

Return values
int

$num The number corresponding to the given roman numeral

seal()

Seals the provided data with the public keys provded as second parameters. This method can be used to encrypt data that can be decrypted by multiple recipients if at least one of them has the matching private key.

public static seal(string $sData[, array<string|int, mixed> $aPublicKeys = array() ]) : string
Parameters
$sData : string

the data to be sealed

$aPublicKeys : array<string|int, mixed> = array()

the list of public keys the data should be sealed with. Every matching private key can decrypt the sealed data.

Tags
throws
CSUtilsException
access

public

Return values
string

the sealed data

shortenText()

This function abbreviates a text by appending ... at the end

public static shortenText(string $text[, int $max = 20 ][, mixed $suf = '...' ][, mixed $splitCharacter = '' ][, mixed $shortenMiddle = FALSE ]) : string
Parameters
$text : string

the text to be abbreviated

$max : int = 20

the maximum number of characters allowed

$suf : mixed = '...'
$splitCharacter : mixed = ''
$shortenMiddle : mixed = FALSE
Tags
access

public

Return values
string

the abbreviated text

sign()

Creates a signature for the data passed in $sData based on a private key.

public static sign(string $sData[, string $sPrivateKey = '' ]) : string

This signature can be used to make sure data has not been manipulated on its way.

Parameters
$sData : string

The data for which the signature should be created.

$sPrivateKey : string = ''

An alternative private key that should be used to create the signature.

Tags
access

public

Return values
string

The created signature for the data.

startsWith()

This function returns true, if a string starts with a specific needle

public static startsWith(string $string, string $needle) : bool
Parameters
$string : string

the string to be checked

$needle : string

the string that is expected at the beginning of the first parameter

Tags
access

public

Return values
bool

true if the needle is found at the beginning of the string, false otherwise

strcasecmp()

Case insensitive string comparisons using a "german sort order" algorithm

public static strcasecmp(string $str1, string $str2) : int
Parameters
$str1 : string

The first string.

$str2 : string

The second string.

Tags
Return values
int

Similar to other string comparison functions, this one returns < 0 if str1 is less than str2 > 0 if str1 is greater than str2, and 0 if they are equal.

stripHtmlTags()

This function removes all html tags and additionally considers if a tag is actually closed or not

public static stripHtmlTags(string $html) : string
Parameters
$html : string

the text to be cleaned

Tags
access

public

Return values
string

the cleaned text

stripTags()

This function removes all tags as well as style and script ranges from an html formatted text

public static stripTags(string $html[, string $tagSeparator = " " ]) : string
Parameters
$html : string

the text to be cleaned

$tagSeparator : string = " "

after the end of any tag this separator is embedded to make sure words remain separated

Tags
access

public

Return values
string

the cleaned text

textAfter()

This function returns the text in a string after a needle

public static textAfter(string $string, string $needle) : string
Parameters
$string : string

the string to be checked

$needle : string

the string that is expected somewhere in the first parameter

Tags
access

public

Return values
string

the text after the needle if found, false otherwise

textBefore()

This function returns the text in a string before a needle

public static textBefore(string $string, string $needle) : string
Parameters
$string : string

the string to be checked

$needle : string

the string that is expected somewhere in the first parameter

Tags
access

public

Return values
string

the text before the needle if found, false otherwise

trim()

Additionally to the standard php function this method also supports arrays as parameter

public static trim(mixed $elements) : mixed
Parameters
$elements : mixed
Tags
access

public

Return values
mixed

trimmed element

ucFirst()

Makes the first character of the string uppercase and rest of the string lowercase

public static ucFirst(string $sString[, bool $bStrictMode = false ]) : string
Parameters
$sString : string

String to be processed

$bStrictMode : bool = false

When set to TRUE: makes other chars in string lowercase - default behavior. FALSE: default ucfirst behavior from native PHP function of the same name.

Tags
Return values
string

string with first character of the string uppercase and rest of the string lowercase

urlencode()

Enter description here.

public static urlencode(string $string[, array<string|int, mixed> $chars = FALSE ]) : string

..

Parameters
$string : string
$chars : array<string|int, mixed> = FALSE

= array( '?' => '%3F' )

Tags
access

public

Return values
string

verify()

Validates a signature for the data passed in $sData based on a public key.

public static verify(string $sData, string $sSignature[, string $sPublicKey = '' ]) : bool
Parameters
$sData : string

The data for which the signature should be validated.

$sSignature : string
$sPublicKey : string = ''

An alternative public key that should be used to validate the signature.

Tags
access

public

Return values
bool

True, if the signature is valid for the passed data, otherwise false


        

Search results