当前位置: 首页>>代码示例>>PHP>>正文


PHP StringUtil::normalize方法代码示例

本文整理汇总了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();
 }
开发者ID:rapila,项目名称:cms-base,代码行数:32,代码来源:TagDetailWidgetModule.php

示例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);
     }
 }
开发者ID:rapila,项目名称:cms-full,代码行数:11,代码来源:CategorySubpagesFilterModule.php

示例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;
             }
         }
     }
 }
开发者ID:rapila,项目名称:plugin-full_text_search,代码行数:19,代码来源:Synonyms.php

示例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;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:20,代码来源:TagInstancePeer.php

示例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;
 }
开发者ID:rapila,项目名称:cms-base,代码行数:29,代码来源:BasePage.php

示例6: normalize

 public function normalize($oTemplateIdentifier, &$iFlags)
 {
     $iFlags |= Template::NO_HTML_ESCAPE;
     return StringUtil::normalize($oTemplateIdentifier->getValue());
 }
开发者ID:rapila,项目名称:cms-base,代码行数:5,代码来源:SpecialTemplateIdentifierActions.php

示例7: setName

 public function setName($sNewName)
 {
     $sNewName = StringUtil::normalize($sNewName);
     parent::setName($sNewName);
 }
开发者ID:rapila,项目名称:cms-base,代码行数:5,代码来源:Tag.php

示例8: normalize

 private static function normalize($sFilePath)
 {
     return StringUtil::normalize($sFilePath, '_');
 }
开发者ID:rapila,项目名称:plugin-webdav,代码行数:4,代码来源:WebdavBackendModule.php

示例9: retrieveByName

 public static function retrieveByName($sTagName)
 {
     $oCriteria = new Criteria(self::DATABASE_NAME);
     $oCriteria->add(self::NAME, StringUtil::normalize($sTagName));
     return self::doSelectOne($oCriteria);
 }
开发者ID:rapila,项目名称:cms-base,代码行数:6,代码来源:TagPeer.php


注:本文中的StringUtil::normalize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。