Open Monograph Press  1.1
 All Classes Namespaces Functions Variables Groups Pages
String Class Reference

Static Public Member Functions

static camelize ($string, $type=CAMEL_CASE_HEAD_UP)
 
static concatTitleFields ($fields)
 
static diff ($originalString, $editedString)
 
static encode_mime_header ($string)
 
static enumerateAlphabetically ($steps)
 
static getHTMLEntities ()
 
static hasMBString ()
 
static hasPCREUTF8 ()
 
static html2text ($html)
 
static init ()
 
static iterativeExplode ($delimiters, $input)
 
static mime_content_type ($filename)
 
static regexp_grep ($pattern, $input)
 
static regexp_match ($pattern, $subject)
 
static regexp_match_all ($pattern, $subject, &$matches)
 
static regexp_match_get ($pattern, $subject, &$matches)
 
static regexp_quote ($string, $delimiter= '/')
 
static regexp_replace ($pattern, $replacement, $subject, $limit=-1)
 
static regexp_replace_callback ($pattern, $callback, $subject, $limit=-1)
 
static regexp_split ($pattern, $subject, $limit=-1)
 
static stripUnsafeHtml ($input)
 
static strlen ($string)
 
static strpos ($haystack, $needle, $offset=0)
 
static strrpos ($haystack, $needle)
 
static strtolower ($string)
 
static strtoupper ($string)
 
static substr ($string, $start, $length=false)
 
static substr_count ($haystack, $needle)
 
static substr_replace ($string, $replacement, $start, $length=null)
 
static titleCase ($title)
 
static trimPunctuation ($string)
 
static ucfirst ($string)
 
static uncamelize ($string)
 
static utf8_bad_find ($str)
 
static utf8_bad_replace ($str, $replace= '?')
 
static utf8_bad_strip ($str)
 
static utf8_compliant ($str)
 
static utf8_is_valid ($str)
 
static utf8_normalize ($str)
 
static utf8_strip_ascii_ctrl ($str)
 
static utf8_to_ascii ($str)
 

Detailed Description

String manipulation wrapper class.

Definition at line 54 of file String.inc.php.

Member Function Documentation

static String::camelize (   $string,
  $type = CAMEL_CASE_HEAD_UP 
)
static

Transform "handler-class" to "HandlerClass" and "my-op" to "myOp".

Parameters
$stringinput string
$typewhich kind of camel case?
Returns
string the string in camel case

Definition at line 766 of file String.inc.php.

static String::concatTitleFields (   $fields)
static

Joins two title string fragments (in $fields) either with a space or a colon.

Parameters
$fieldsarray
Returns
string the joined string

Definition at line 717 of file String.inc.php.

Referenced by Series\getLocalizedFullTitle(), Chapter\getLocalizedFullTitle(), and Submission\getLocalizedFullTitle().

static String::diff (   $originalString,
  $editedString 
)
static

Calculate the differences between two strings and produce an array with three types of entries: added substrings, deleted substrings and unchanged substrings.

The calculation is optimized to identify the common largest substring.

The return value is an array of the following format:

array( array( diff-type => substring ), array(...) )

whereby diff-type can be one of: -1 = deletion 0 = common substring 1 = addition

Parameters
$originalStringstring
$editedStringstring
Returns
array

Definition at line 824 of file String.inc.php.

Referenced by StringTest\testDiff().

static String::encode_mime_header (   $string)
static
See Also
http://ca.php.net/manual/en/function.encode_mime_header.php
Parameters
$stringstring Input MIME header to encode.
Returns
string Encoded MIME header.

Definition at line 299 of file String.inc.php.

static String::enumerateAlphabetically (   $steps)
static

Get a letter $steps places after 'A'

Parameters
$stepsint
Returns
string Letter

Definition at line 953 of file String.inc.php.

static String::getHTMLEntities ( )
static

Return an associative array of named->numeric HTML entities Required to support HTML functions without objects in PHP4/PHP5 From php.net: function.get-html-translation-table.php

Returns
string

Definition at line 587 of file String.inc.php.

static String::hasMBString ( )
static

Check if server has the mbstring library. Currently requires PHP >= 4.3.0 (for mb_strtolower, mb_strtoupper, and mb_substr_count)

Returns
boolean Returns true iff the server supports mbstring functions.

Definition at line 88 of file String.inc.php.

static String::hasPCREUTF8 ( )
static

Check if server supports the PCRE_UTF8 modifier.

Returns
boolean True iff the server supports the PCRE_UTF8 modifier.

Definition at line 117 of file String.inc.php.

static String::html2text (   $html)
static

Convert limited HTML into a string.

Parameters
$htmlstring
Returns
string

Definition at line 460 of file String.inc.php.

static String::init ( )
static

Perform initialization required for the string wrapper library.

Returns
null

Definition at line 59 of file String.inc.php.

static String::iterativeExplode (   $delimiters,
  $input 
)
static

Iterate over an array of delimiters and see whether it exists in the given input string. If so, then use it to explode the string into an array.

Parameters
$delimitersarray
$inputstring
Returns
array

Definition at line 743 of file String.inc.php.

Referenced by ParaciteRawCitationNlm30CitationSchemaFilter\process().

static String::mime_content_type (   $filename)
static
See Also
http://ca.php.net/manual/en/function.mime_content_type.php
Parameters
$filenamestring Filename to test.
Returns
string Detected MIME type

Definition at line 412 of file String.inc.php.

Referenced by FileManager\downloadFile(), and FileManager\getUploadedFileType().

static String::regexp_grep (   $pattern,
  $input 
)
static
See Also
http://ca.php.net/manual/en/function.regexp_grep.php
Parameters
$patternstring Regular expression
$inputstring Input string
Returns
array

Definition at line 328 of file String.inc.php.

static String::regexp_match (   $pattern,
  $subject 
)
static
static String::regexp_match_all (   $pattern,
  $subject,
$matches 
)
static
See Also
http://ca.php.net/manual/en/function.regexp_match_all.php
Parameters
$patternstring Regular expression
$subjectstring String to apply regular expression to
$matchesarray Reference to receive matches
Returns
int|boolean Returns number of full matches of given subject, or FALSE if an error occurred.

Definition at line 364 of file String.inc.php.

Referenced by PKPLocale\getParameterNames(), and WorldcatNlm30CitationSchemaFilter\process().

static String::regexp_match_get (   $pattern,
  $subject,
$matches 
)
static
See Also
http://ca.php.net/manual/en/function.regexp_match_get.php
Parameters
$patternstring Regular expression
$subjectstring String to apply regular expression to
$matchesarray Reference to receive matches
Returns
int|boolean Returns 1 if the pattern matches given subject, 0 if it does not, or FALSE if an error occurred.

Definition at line 351 of file String.inc.php.

Referenced by PubmedNlm30CitationSchemaFilter\_lookup(), FunctionalImportExportBaseTestCase\getXmlOnExport(), DateStringNormalizerFilter\process(), RegexRawCitationNlm30CitationSchemaFilter\process(), and ValidatorRegExp\ValidatorRegExp().

static String::regexp_quote (   $string,
  $delimiter = '/' 
)
static
See Also
http://ca.php.net/manual/en/function.regexp_quote.php
Parameters
$stringstring String to quote
$delimiterstring Delimiter for regular expression
Returns
string Quoted equivalent of $string

Definition at line 318 of file String.inc.php.

static String::regexp_replace (   $pattern,
  $replacement,
  $subject,
  $limit = -1 
)
static
static String::regexp_replace_callback (   $pattern,
  $callback,
  $subject,
  $limit = -1 
)
static
See Also
http://ca.php.net/manual/en/function.regexp_replace_callback.php
Parameters
$patternstring Regular expression
$callbackcallback PHP callback to generate content to replace matches with
$subjectstring String to apply regular expression to
$limitint Number of replacements to perform, maximum, or -1 for no limit.
Returns
mixed

Definition at line 390 of file String.inc.php.

static String::regexp_split (   $pattern,
  $subject,
  $limit = -1 
)
static
See Also
http://ca.php.net/manual/en/function.regexp_split.php
Parameters
$patternstring Regular expression
$subjectstring String to apply regular expression to
$limitint Number of times to match; -1 for unlimited
Returns
array Resulting string segments

Definition at line 402 of file String.inc.php.

Referenced by SubmissionSearchIndex\filterKeywords().

static String::stripUnsafeHtml (   $input)
static

Strip unsafe HTML from the input text. Covers XSS attacks like scripts, onclick(...) attributes, javascript: urls, and special characters.

Parameters
$inputstring input string
Returns
string

Definition at line 440 of file String.inc.php.

Referenced by AddThisStatisticsGridCellProvider\getTemplateVarsFromRowColumn(), and FooterGridCellProvider\getTemplateVarsFromRowColumn().

static String::strpos (   $haystack,
  $needle,
  $offset = 0 
)
static
See Also
http://ca.php.net/manual/en/function.strpos.php
Parameters
$haystackstring Input haystack to search
$needlestring Input needle to search for
$offsetint Offset at which to begin searching
Returns
int Position of needle within haystack

Definition at line 154 of file String.inc.php.

Referenced by PubmedNlm30CitationSchemaFilter\_lookup().

static String::strrpos (   $haystack,
  $needle 
)
static
See Also
http://ca.php.net/manual/en/function.strrpos.php
Parameters
$haystackstring Haystack to search
$needlestring Needle to search haystack for
Returns
int String position of needle in haystack (starting from end of haystack)

Definition at line 170 of file String.inc.php.

static String::strtolower (   $string)
static
static String::strtoupper (   $string)
static
See Also
http://ca.php.net/manual/en/function.strtoupper.php
Parameters
$stringstring Input string
Returns
string Upper case version of input string

Definition at line 253 of file String.inc.php.

static String::substr (   $string,
  $start,
  $length = false 
)
static
static String::substr_count (   $haystack,
  $needle 
)
static
See Also
http://ca.php.net/manual/en/function.substr_count.php
Parameters
$haystackstring Input string to search
$needlestring String to search within $haystack for
Returns
int Count of number of times $needle appeared in $haystack

Definition at line 286 of file String.inc.php.

static String::substr_replace (   $string,
  $replacement,
  $start,
  $length = null 
)
static
See Also
http://ca.php.net/manual/en/function.substr_replace.php
Parameters
$stringstring Source string to perform replacement upon
$replacementstring Replacement to move into $string
$startint Start location for replacement
$lengthint Number of characters to replace in source string with $replacement
Returns
string String resulting from replacement

Definition at line 208 of file String.inc.php.

static String::titleCase (   $title)
static

Convert a string to proper title case

Parameters
$titlestring
Returns
string

Definition at line 694 of file String.inc.php.

Referenced by ParaciteRawCitationNlm30CitationSchemaFilter\process(), and StringTest\testTitleCase().

static String::trimPunctuation (   $string)
static

Trim punctuation from a string

Parameters
$stringstring input string
Returns
string the trimmed string

Definition at line 685 of file String.inc.php.

Referenced by PubmedNlm30CitationSchemaFilter\_lookup(), RegexRawCitationNlm30CitationSchemaFilter\process(), IsbndbIsbnNlm30CitationSchemaFilter\process(), ParaciteRawCitationNlm30CitationSchemaFilter\process(), and StringTest\testTrimPunctuation().

static String::ucfirst (   $string)
static
See Also
http://ca.php.net/manual/en/function.ucfirst.php
Parameters
$stringstring Input string
Returns
string ucfirst version of input string

Definition at line 268 of file String.inc.php.

static String::uncamelize (   $string)
static

Transform "HandlerClass" to "handler-class" and "myOp" to "my-op".

Parameters
$string
Returns
string

Definition at line 787 of file String.inc.php.

static String::utf8_bad_find (   $str)
static

Locates the first bad byte in a UTF-8 string returning it's byte index in the string

Parameters
$strstring input string
Returns
string

Definition at line 500 of file String.inc.php.

static String::utf8_bad_replace (   $str,
  $replace = '?' 
)
static

Replace bad bytes with an alternative character - ASCII character

Parameters
$strstring input string
$replacestring optional
Returns
string

Definition at line 521 of file String.inc.php.

static String::utf8_bad_strip (   $str)
static

Strips out any bad bytes from a UTF-8 string and returns the rest

Parameters
$strstring input string
Returns
string

Definition at line 510 of file String.inc.php.

static String::utf8_compliant (   $str)
static

Tests whether a string complies as UTF-8; faster and less strict than utf8_is_valid see lib/phputf8/utils/validation.php for more details

Parameters
$strstring input string
Returns
boolean

Definition at line 490 of file String.inc.php.

Referenced by ParaciteRawCitationNlm30CitationSchemaFilter\process().

static String::utf8_is_valid (   $str)
static

Detect whether a string contains non-ascii multibyte sequences in the UTF-8 range

Parameters
$strstring input string
Returns
boolean

Definition at line 479 of file String.inc.php.

static String::utf8_normalize (   $str)
static

Normalize a string in an unknown (non-UTF8) encoding into a valid UTF-8 sequence

Parameters
$strstring input string
Returns
string

Definition at line 541 of file String.inc.php.

Referenced by ParaciteRawCitationNlm30CitationSchemaFilter\process().

static String::utf8_strip_ascii_ctrl (   $str)
static

Replace bad bytes with an alternative character - ASCII character

Parameters
$strstring input string
Returns
string

Definition at line 531 of file String.inc.php.

static String::utf8_to_ascii (   $str)
static

US-ASCII transliterations of Unicode text

Parameters
$strstring input string
Returns
string

Definition at line 576 of file String.inc.php.

Referenced by ParaciteRawCitationNlm30CitationSchemaFilter\process().


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