當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。