本文整理汇总了PHP中StringUtil::normalize方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::normalize方法的具体用法?PHP StringUtil::normalize怎么用?PHP StringUtil::normalize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类StringUtil
的用法示例。
在下文中一共展示了StringUtil::normalize方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveData
public function saveData($aTagData)
{
$aTagData['name'] = StringUtil::normalize($aTagData['name']);
if ($this->iTagId === null) {
$oTag = new Tag();
} else {
$oTag = TagQuery::create()->findPk($this->iTagId);
}
$this->validate($aTagData);
if (!Flash::noErrors()) {
throw new ValidationException();
}
$sStringName = "tag.{$aTagData['name']}";
if ($oTag->getName() !== $aTagData['name']) {
//Rename Strings for the tag
$sOldStringName = "tag.{$oTag->getName()}";
foreach (TranslationQuery::create()->filterByStringKey($sOldStringName)->find() as $oString) {
$sLanguageId = $oString->getLanguageId();
//You can’t technically rename strings because string_key is the PKEY so we delete it and re-generate
$oString->delete();
$oString = new Translation();
$oString->setStringKey($sStringName);
$oString->setLanguageId($sLanguageId);
$oString->save();
}
$oTag->setName($aTagData['name']);
}
foreach ($aTagData['edited_languages'] as $iIndex => $sLanguageId) {
TranslationPeer::addOrUpdateString($sStringName, $aTagData['text'][$iIndex], $sLanguageId);
}
$oTag->save();
}
示例2: onNavigationItemChildrenRequested
public function onNavigationItemChildrenRequested($oNavigationItem)
{
if (!($oNavigationItem instanceof PageNavigationItem && $oNavigationItem->getIdentifier() === 'photos')) {
return;
}
$aDocumentCategories = DocumentCategoryQuery::create()->filterByDocumentKind('image')->find();
foreach ($aDocumentCategories as $oDocumentCategory) {
$oNavItem = new VirtualNavigationItem(get_class(), StringUtil::normalize($oDocumentCategory->getName()), $oDocumentCategory->getName(), null, $oDocumentCategory->getId());
$oNavigationItem->addChild($oNavItem);
}
}
示例3: init
private static function init()
{
if (self::$SYNONYMS === null) {
self::$SYNONYMS = array();
self::$ROOT_WORDS = array();
$sSynonyms = Settings::getInstance('synonyms')->getSettingsArray();
foreach ($sSynonyms as $sLanguageId => $aSynonymList) {
self::$SYNONYMS[$sLanguageId] = array();
self::$ROOT_WORDS[$sLanguageId] = array();
foreach ($aSynonymList as $sRootWord => $aSynonyms) {
$sRootWord = StringUtil::normalize($sRootWord);
foreach ($aSynonyms as $iKey => $sSynonym) {
self::$SYNONYMS[$sLanguageId][StringUtil::normalize($sSynonym)] = $sRootWord;
}
self::$ROOT_WORDS[$sLanguageId][$sRootWord] = true;
}
}
}
}
示例4: newTagInstance
public static function newTagInstance($sTagName, $sModelName, $iTaggedItemId)
{
$sTagName = StringUtil::normalize($sTagName);
$oTag = TagPeer::retrieveByName($sTagName);
if ($oTag === null) {
$oTag = new Tag();
$oTag->setName($sTagName);
$oTag->save();
}
$oTagInstance = self::retrieveByPK($oTag->getId(), $iTaggedItemId, $sModelName);
if ($oTagInstance !== null) {
throw new Exception("Instance of this tag does already exist");
}
$oTagInstance = new TagInstance();
$oTagInstance->setTag($oTag);
$oTagInstance->setModelName($sModelName);
$oTagInstance->setTaggedItemId($iTaggedItemId);
$oTagInstance->save();
return $oTagInstance;
}
示例5: addTagTo
/**
* Add a tag to the Page given by the id
*/
public static function addTagTo($sPageId, $mTag)
{
if ($mTag instanceof TagInstance) {
$mTag = $mTag->getTag();
}
if ($mTag instanceof Tag) {
$mTag = $mTag->getName();
}
$sTagName = StringUtil::normalize($mTag);
$oTag = TagQuery::create()->findOneByName($sTagName);
if ($oTag === null) {
$oTag = new Tag();
$oTag->setName($sTagName);
$oTag->save();
}
$oTagInstance = TagInstanceQuery::create()->findPk(array($oTag->getId(), $sPageId, "Page"));
if ($oTagInstance !== null) {
return $oTagInstance;
}
$oTagInstance = new TagInstance();
$oTagInstance->setTag($oTag);
$oTagInstance->setModelName("Page");
$oTagInstance->setTaggedItemId($sPageId);
$oTagInstance->save();
return $oTagInstance;
}
示例6: normalize
public function normalize($oTemplateIdentifier, &$iFlags)
{
$iFlags |= Template::NO_HTML_ESCAPE;
return StringUtil::normalize($oTemplateIdentifier->getValue());
}
示例7: setName
public function setName($sNewName)
{
$sNewName = StringUtil::normalize($sNewName);
parent::setName($sNewName);
}
示例8: normalize
private static function normalize($sFilePath)
{
return StringUtil::normalize($sFilePath, '_');
}
示例9: retrieveByName
public static function retrieveByName($sTagName)
{
$oCriteria = new Criteria(self::DATABASE_NAME);
$oCriteria->add(self::NAME, StringUtil::normalize($sTagName));
return self::doSelectOne($oCriteria);
}