|
dmBridge PHP API
|
A collection of static string validation & manipulation methods. More...
A collection of static string validation & manipulation methods.
Definition at line 15 of file DMString.php.
| static DMString::camelCaseToUnderscore | ( | $ | str | ) | [static] |
| static DMString::clean | ( | $ | str | ) | [static] |
Cleans a string of invalid UTF-8 characters using a strategy informed by http://www.phpwact.org/php/i18n/charsets.
This may strip out a lot more than just invalid UTF-8 characters; see the inline comments.
| string | str |
Definition at line 36 of file DMString.php.
| static DMString::highlight | ( | $ | term, |
| $ | str, | ||
| $ | class = "dmHighlightedTerm" |
||
| ) | [static] |
"Highlights" all occurrences of $term in $str by enclosing them in <span> elements with class $class.
| string | term Term to match |
| string | str String in which to search |
| string | class |
Definition at line 83 of file DMString.php.
Referenced by DMObjectTemplateHelper::getHtmlHighlightedFullText(), and DMObjectResultsTemplateHelper::getHtmlResults().
| static DMString::hyperlink | ( | $ | str, |
| DOMDocument $ | dxml = null |
||
| ) | [static] |
Searches through text strings and adds HTML anchor tags around any words beginning with http://, https://, ftp://, or gopher://.
| string | str |
| DOMDocument | dxml |
Definition at line 99 of file DMString.php.
Referenced by DMObjectTemplateHelper::getHtmlMetadataAsDL().
| static DMString::isUTF8 | ( | $ | str | ) | [static] |
| string | str |
Definition at line 156 of file DMString.php.
| static DMString::isValidHostname | ( | $ | str | ) | [static] |
Adapted from EmailAddressValidator::check_domain_portion() by Dave Child.
Supposedly RFC2822-compliant.
| str |
Definition at line 174 of file DMString.php.
Referenced by DMMailer::isValidEmail().
| static DMString::isValidIPv4Address | ( | $ | str, |
| $ | allow_ranges = false |
||
| ) | [static] |
| string | str |
| Boolean | allow_ranges |
Definition at line 213 of file DMString.php.
Referenced by DMLogger::setClientIP().
| static DMString::isValidPathname | ( | $ | str, |
| $ | check_exists = false |
||
| ) | [static] |
| string | str |
| Boolean | check_exists |
Definition at line 233 of file DMString.php.
| static DMString::paranoid | ( | $ | str, |
| $ | allowed = array() |
||
| ) | [static] |
Strips all non-alphanumerics from a string, optionally sparing any characters in the $allowed array.
This should be an indexed array with one character per element. This method inspired by and partially stolen from CakePHP's paranoid().
| string | str |
| string | allowed |
Definition at line 64 of file DMString.php.
Referenced by DMJSONPRepresentationTransformerV1::__construct(), DMAPIVocabularyController::frequency(), DMResultsTemplateHelper::getHtmlFacetsAsUL(), DMObjectTemplateHelper::getHtmlHighlightedFullText(), DMTemplateSet::getPath(), DMCollection::getSanitizedAlias(), isValidPathname(), and DMAPIVocabularyController::suggest().
| static DMString::truncate | ( | $ | str, |
| $ | max_words | ||
| ) | [static] |
Truncates a text string to the desired word length, appending an ellipsis (...) at the end.
| string | str |
| int | max_words |
Definition at line 142 of file DMString.php.
Referenced by DMControlPanelTemplateHelper::getHtmlNews(), DMResultsTemplateHelper::getHtmlResultsAsGrid(), DMResultsTemplateHelper::getHtmlResultsAsList(), DMResultsTemplateHelper::getHtmlResultsAsTiles(), UNLVRandomAddForm::init(), and UNLVHighlightAddForm::init().
| static DMString::underscoreToCamelCase | ( | $ | str, |
| $ | capitalize_first_char = false |
||
| ) | [static] |
| string | str |
| capitalize_first_char |
Definition at line 250 of file DMString.php.
Referenced by DMRoute::setMethod().
| static DMString::websafe | ( | $ | str, |
| $ | encoding = "UTF-8" |
||
| ) | [static] |
Strips all HTML tags from a string and HTML-escapes it.
| string | str String to escape |
| string | encoding An encoding accepted by PHP's htmlspecialchars() function |
Definition at line 273 of file DMString.php.
Referenced by DMInternalView::getFlash(), DMObjectTemplateHelper::getHtmlAddFavoriteButton(), DMObjectTemplateHelper::getHtmlChildLinksAsList(), DMObjectTemplateHelper::getHtmlChildLinksAsPulldown(), DMGenericTemplateHelper::getHtmlCollectionsAsPulldown(), DMObjectTemplateHelper::getHtmlCommentsSection(), DMObjectTemplateHelper::getHtmlCompoundObjectPageNumbersInSearchResultsAsString(), DMObjectTemplateHelper::getHtmlCompoundObjectSearchForm(), DMObjectTemplateHelper::getHtmlCompoundPageFlipLinks(), DMObjectTemplateHelper::getHtmlDownloadImageLink(), DMControlPanelTemplateHelper::getHtmlEditableCommentsAsTable(), DMSystemErrorTemplateHelper::getHtmlException(), DMResultsTemplateHelper::getHtmlFacetsAsUL(), DMSearchTemplateHelper::getHtmlFieldSearch(), DMGenericTemplateHelper::getHtmlFormattedFlash(), DMObjectTemplateHelper::getHtmlHighlightedFullText(), DMGenericTemplateHelper::getHtmlLoginPageLink(), DMObjectTemplateHelper::getHtmlMetadataAsDL(), DMObjectTemplateHelper::getHtmlMetadataAsMetaTags(), DMObjectTemplateHelper::getHtmlPreviousNextLinks(), DMSearchTemplateHelper::getHtmlProximitySearch(), DMObjectResultsTemplateHelper::getHtmlResults(), DMResultsTemplateHelper::getHtmlResultsAsGrid(), DMResultsTemplateHelper::getHtmlResultsAsList(), DMResultsTemplateHelper::getHtmlResultsAsTiles(), DMResultsTemplateHelper::getHtmlSearchTerms(), DMResultsTemplateHelper::getHtmlSortLinksAsUL(), SampleCustomViewer::getHTMLTag(), DMTextareaField::getHTMLTag(), DMRadioField::getHTMLTag(), DMQuickTimeViewer::getHTMLTag(), DMHiddenField::getHTMLTag(), DMGenericPDFViewer::getHTMLTag(), DMGenericObjectViewer::getHTMLTag(), DMGenericImageViewer::getHTMLTag(), DMFileLinkViewer::getHTMLTag(), DMCheckboxField::getHTMLTag(), DMObjectTemplateHelper::getHtmlTaggingSection(), DMGenericTemplateHelper::getHtmlTagsAsCloud(), DMGenericTemplateHelper::getHtmlVocabularyAsCloud(), DMGenericTemplateHelper::getHtmlVocabularyAsList(), DMGenericTemplateHelper::getHtmlVocabularyForSelect(), DMCPFeedSettingsForm::init(), DMMailer::sendNotificationOfNewComment(), and DMEmailMessage::setEmailSenderName().
| static DMString::xmlentities | ( | $ | str | ) | [static] |
| string | str |
Definition at line 282 of file DMString.php.
Referenced by UNLVSpatialTemplateHelper::getHtmlIndexerSummary(), DMResultsTemplateHelper::getHtmlSortLinksAsUL(), DMSelectField::getHTMLTag(), DMConfigXML::loadTemplateSet(), DMConfigXML::saveCollection(), DMConfigXML::saveTemplateSet(), DMXMLRepresentationTransformerV1::transformCollection(), DMXMLRepresentationTransformerV1::transformCollections(), DMXMLRepresentationTransformerV1::transformComment(), DMXMLRepresentationTransformerV1::transformException(), DMXMLRepresentationTransformerV1::transformObject(), DMAtomRepresentationTransformer::transformObject(), DMXMLRepresentationTransformerV1::transformObjectComments(), DMAtomRepresentationTransformer::transformObjectComments(), DMXMLRepresentationTransformerV1::transformObjectTags(), DMXMLRepresentationTransformerV1::transformResults(), DMSitemapRepresentationTransformer::transformResults(), DMAtomRepresentationTransformer::transformResults(), DMXMLRepresentationTransformerV1::transformStatus(), DMXMLRepresentationTransformerV1::transformTag(), DMXMLRepresentationTransformerV1::transformTagCounts(), DMXMLRepresentationTransformerV1::transformVocabularyFrequencies(), and DMXMLRepresentationTransformerV1::transformVocabularySuggestions().