Open Journal Systems  3.3.0
PKPString Class Reference

Static Public Member Functions

static camelize ($string, $type=CAMEL_CASE_HEAD_UP)
 
static concatTitleFields ($fields)
 
static dateformatPHP2JQueryDatepicker ($phpFormat)
 
static encode_mime_header ($string)
 
static enumerateAlphabetically ($steps)
 
static generateUUID ()
 
static hasMBString ()
 
static hasPCREUTF8 ()
 
static html2text ($html)
 
static init ()
 
static mime_content_type ($filename, $suggestedExtension='')
 
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=null)
 
static substr_count ($haystack, $needle)
 
static ucfirst ($string)
 
static uncamelize ($string)
 

Detailed Description

String manipulation wrapper class.

Definition at line 46 of file PKPString.inc.php.

Member Function Documentation

◆ camelize()

static PKPString::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 435 of file PKPString.inc.php.

References strtolower_codesafe(), and substr().

Referenced by MetadataProperty\getId(), PKPComponentRouter\getRequestedComponent(), and PKPComponentRouter\getRequestedOp().

◆ concatTitleFields()

static PKPString::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 410 of file PKPString.inc.php.

References substr().

Referenced by PKPPublication\getLocalizedFullTitle().

◆ dateformatPHP2JQueryDatepicker()

static PKPString::dateformatPHP2JQueryDatepicker (   $phpFormat)
static

Matches each symbol of PHP strftime format string to jQuery Datepicker widget date format.

Parameters
$phpFormatstring
Returns
string

Definition at line 499 of file PKPString.inc.php.

References strlen().

◆ encode_mime_header()

static PKPString::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 206 of file PKPString.inc.php.

Referenced by Mail\encodeDisplayName().

◆ enumerateAlphabetically()

static PKPString::enumerateAlphabetically (   $steps)
static

Get a letter $steps places after 'A'

Parameters
$stepsint
Returns
string Letter

Definition at line 473 of file PKPString.inc.php.

Referenced by EditorDecisionWithEmailForm\_sendReviewMailToAuthor(), and PKPEditorDecisionHandler\importPeerReviews().

◆ generateUUID()

static PKPString::generateUUID ( )
static

Create a new UUID (version 4)

Returns
string

Definition at line 481 of file PKPString.inc.php.

References strtoupper(), and substr().

Referenced by CounterReport\createXML(), and PLNPlugin\newUUID().

◆ hasMBString()

static PKPString::hasMBString ( )
static

Check if server has the mbstring library.

Returns
boolean Returns true iff the server supports mbstring functions.

Definition at line 80 of file PKPString.inc.php.

Referenced by InstallForm\display().

◆ hasPCREUTF8()

static PKPString::hasPCREUTF8 ( )
static

Check if server supports the PCRE_UTF8 modifier.

Returns
boolean True iff the server supports the PCRE_UTF8 modifier.

Definition at line 109 of file PKPString.inc.php.

◆ html2text()

◆ init()

static PKPString::init ( )
static

Perform initialization required for the string wrapper library.

Returns
null

Definition at line 51 of file PKPString.inc.php.

References Config\getVar(), and strtolower_codesafe().

Referenced by PKPApplication\__construct().

◆ mime_content_type()

static PKPString::mime_content_type (   $filename,
  $suggestedExtension = '' 
)
static
See also
http://ca.php.net/manual/en/function.mime_content_type.php
Parameters
$filenamestring Filename to test.
$suggestedExtensionstring Suggested file extension (used for common misconfigurations)
Returns
string Detected MIME type

Definition at line 312 of file PKPString.inc.php.

References Registry\get(), Config\getVar(), strpos(), strtolower(), and substr().

Referenced by SubmissionFileManager\_handleCopy(), Mail\addAttachment(), PLNHandler\deposits(), FileManager\downloadByPath(), FileManager\getUploadedFileType(), TemporaryFileManager\handleUpload(), and PKPUploadPublicFileHandler\uploadFile().

◆ regexp_grep()

static PKPString::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 235 of file PKPString.inc.php.

◆ regexp_match()

◆ regexp_match_all()

static PKPString::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 267 of file PKPString.inc.php.

Referenced by SubmissionSearch\_parseQuery(), PKPLocale\getParameterNames(), and uncamelize().

◆ regexp_match_get()

static PKPString::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 256 of file PKPString.inc.php.

Referenced by MedraWebservice\_doRequest(), MarkupConversionHelper\buildSubmissionMetadata(), PluginHelper\extractPlugin(), and ResolverPlugin\fetch().

◆ regexp_quote()

static PKPString::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 225 of file PKPString.inc.php.

◆ regexp_replace()

◆ regexp_replace_callback()

static PKPString::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 291 of file PKPString.inc.php.

◆ regexp_split()

static PKPString::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 302 of file PKPString.inc.php.

Referenced by UserInstitutionalSubscriptionForm\execute(), SubmissionSearchIndex\filterKeywords(), and UserInstitutionalSubscriptionForm\readInputData().

◆ stripUnsafeHtml()

static PKPString::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 377 of file PKPString.inc.php.

References Config\getVar().

Referenced by SubmissionEventLogGridHandler\_formatEmail(), SubmissionMailTemplate\assignParams(), NotificationsGridCellProvider\getCellActions(), and PKPEditorDecisionHandler\importPeerReviews().

◆ strlen()

◆ strpos()

static PKPString::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 139 of file PKPString.inc.php.

Referenced by PKPLibraryFileManager\generateFileName(), PluginGalleryDAO\getNewestCompatible(), and mime_content_type().

◆ strrpos()

static PKPString::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 Last index of Needle in Haystack

Definition at line 149 of file PKPString.inc.php.

◆ strtolower()

◆ strtoupper()

static PKPString::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 178 of file PKPString.inc.php.

Referenced by generateUUID().

◆ substr()

static PKPString::substr (   $string,
  $start,
  $length = null 
)
static
See also
http://ca.php.net/manual/en/function.substr.php
Parameters
$stringstring Subject to extract substring from
$startint Position to start from
$lengthint Length to extract, or false for entire string from start position
Returns
string Substring of $string

Definition at line 160 of file PKPString.inc.php.

Referenced by camelize(), concatTitleFields(), SubmissionSearchIndex\filterKeywords(), PKPLibraryFileManager\generateFileName(), generateUUID(), QuickSubmitForm\initData(), PKPHandler\initialize(), mime_content_type(), PKPSubmissionSubmitStep1Form\setPublicationData(), Validation\suggestUsername(), and FileManager\truncateFileName().

◆ substr_count()

static PKPString::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 197 of file PKPString.inc.php.

◆ ucfirst()

static PKPString::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 187 of file PKPString.inc.php.

◆ uncamelize()

static PKPString::uncamelize (   $string)
static

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

Parameters
$string
Returns
string

Definition at line 455 of file PKPString.inc.php.

References regexp_match_all(), strlen(), strtolower_codesafe(), and ucfirst_codesafe().

Referenced by PKPComponentRouter\url().


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