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


PHP util\ArrayUtil类代码示例

本文整理汇总了PHP中wcf\util\ArrayUtil的典型用法代码示例。如果您正苦于以下问题:PHP ArrayUtil类的具体用法?PHP ArrayUtil怎么用?PHP ArrayUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了ArrayUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: parseKeywords

 /**
  * Parses search keywords.
  * 
  * @param	string		$keywordString
  */
 protected function parseKeywords($keywordString)
 {
     // convert encoding if necessary
     if (!StringUtil::isUTF8($keywordString)) {
         $keywordString = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $keywordString);
     }
     // remove bad wildcards
     $keywordString = preg_replace('/(?<!\\w)\\*/', '', $keywordString);
     // remove search operators
     $keywordString = preg_replace('/[\\+\\-><()~]+/', '', $keywordString);
     if (mb_substr($keywordString, 0, 1) == '"' && mb_substr($keywordString, -1) == '"') {
         // phrases search
         $keywordString = StringUtil::trim(mb_substr($keywordString, 1, -1));
         if (!empty($keywordString)) {
             $this->keywords = array_merge($this->keywords, array(StringUtil::encodeHTML($keywordString)));
         }
     } else {
         // replace word delimiters by space
         $keywordString = str_replace(array('.', ','), ' ', $keywordString);
         $keywords = ArrayUtil::encodeHTML(ArrayUtil::trim(explode(' ', $keywordString)));
         if (!empty($keywords)) {
             $this->keywords = array_merge($this->keywords, $keywords);
         }
     }
 }
开发者ID:jacboy,项目名称:WCF,代码行数:30,代码来源:KeywordHighlighter.class.php

示例2: readFormParameters

 /**
  * @see	\wcf\form\IForm::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['points']) && is_array($_POST['points'])) {
         $this->points = ArrayUtil::toIntegerArray($_POST['points']);
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:UserActivityPointOptionForm.class.php

示例3: readParameters

 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     MessageForm::readParameters();
     if (isset($_REQUEST['categoryIDs']) && is_array($_REQUEST['categoryIDs'])) {
         $this->categoryIDs = ArrayUtil::toIntegerArray($_REQUEST['categoryIDs']);
     }
     // get the news by id
     if (isset($_REQUEST['id'])) {
         $this->entryID = intval($_REQUEST['id']);
     }
     $this->entry = new Entry($this->entryID);
     if (!$this->entry->entryID) {
         throw new IllegalLinkException();
     }
     // check news permissions
     if (!$this->entry->canEdit()) {
         throw new PermissionDeniedException();
     }
     // set attachment object id
     $this->attachmentObjectID = $this->entry->entryID;
     // polls
     if ($this->canCreatePoll()) {
         PollManager::getInstance()->setObject('de.incendium.cms.news.entry', $this->entry->entryID, $this->entry->pollID);
     }
     // get max text length
     $this->maxTextLength = WCF::getSession()->getPermission('user.news.maxTextLength');
 }
开发者ID:Griborim,项目名称:de.incendium.cms.news,代码行数:30,代码来源:NewsEntryEditForm.class.php

示例4: getData

 /**
  * @see	\wcf\system\option\IOptionType::getData()
  */
 public function getData(Option $option, $newValue)
 {
     if (!is_array($newValue)) {
         $newValue = array();
     }
     return implode("\n", ArrayUtil::toIntegerArray($newValue));
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:10,代码来源:AbstractCategoryMultiSelectOptionType.class.php

示例5: getConditions

 /**
  * @see    \wcf\system\search\ISearchableObjectType::getConditions()
  */
 public function getConditions(IForm $form = null)
 {
     $conditionBuilder = new PreparedStatementConditionBuilder();
     // accessible category ids
     if (isset($_POST['filebaseCategoryIDs'])) {
         $this->filebaseCategoryIDs = ArrayUtil::toIntegerArray($_POST['filebaseCategoryIDs']);
     }
     $categoryIDs = FilebaseCategory::getAccessibleCategoryIDs();
     if (!empty($this->filebaseCategoryIDs)) {
         $this->filebaseCategoryIDs = array_intersect($categoryIDs, $this->filebaseCategoryIDs);
     } else {
         $this->filebaseCategoryIDs = $categoryIDs;
     }
     if (empty($this->filebaseCategoryIDs)) {
         throw new PermissionDeniedException();
     }
     $conditionBuilder->add($this->getTableName() . '.entryID IN (SELECT entryID FROM filebase' . WCF_N . '_entry_to_category WHERE categoryID IN (?))', array($this->filebaseCategoryIDs));
     // default conditions
     $conditionBuilder->add($this->getTableName() . '.isDisabled = 0');
     $conditionBuilder->add($this->getTableName() . '.isDeleted = 0');
     // language
     if (FILEBASE_ENABLE_MULTILINGUALISM && LanguageFactory::getInstance()->multilingualismEnabled() && count(WCF::getUser()->getLanguageIDs())) {
         $conditionBuilder->add('(' . $this->getTableName() . '.languageID IN (?) OR ' . $this->getTableName() . '.languageID IS NULL)', array(WCF::getUser()->getLanguageIDs()));
     }
     return $conditionBuilder;
 }
开发者ID:Griborim,项目名称:de.incendium.cms.filebase,代码行数:29,代码来源:EntrySearch.class.php

示例6: getCondition

	/**
	 * @see	wcf\system\option\ISearchableUserOption::getCondition()
	 */
	public function getCondition(PreparedStatementConditionBuilder &$conditions, Option $option, $value) {
		if (!is_array($value) || empty($value)) return false;
		$value = ArrayUtil::trim($value);
		if (empty($value)) return false;
		
		$conditions->add("option_value.userOption".$option->optionID." = ?", array(implode("\n", $value)));
		return true;
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:11,代码来源:MultiSelectOptionType.class.php

示例7: getData

 /**
  * @see	\wcf\system\option\IOptionType::getData()
  */
 public function getData(Option $option, $newValue)
 {
     if (!is_array($newValue)) {
         $newValue = array();
     }
     $newValue = ArrayUtil::toIntegerArray($newValue);
     sort($newValue, SORT_NUMERIC);
     return implode(',', $newValue);
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:12,代码来源:UserGroupsUserGroupOptionType.class.php

示例8: readParameters

	/**
	 * @see	wcf\action\Action::readParameters()
	 */
	public function readParameters() {
		AbstractSecureAction::readParameters();
		
		if (isset($_POST['action'])) $this->action = StringUtil::trim($_POST['action']);
		if (isset($_POST['containerData']) && is_array($_POST['containerData'])) $this->containerData = $_POST['containerData'];
		if (isset($_POST['objectIDs']) && is_array($_POST['objectIDs'])) $this->objectIDs = ArrayUtil::toIntegerArray($_POST['objectIDs']);
		if (isset($_POST['pageClassName'])) $this->pageClassName = StringUtil::trim($_POST['pageClassName']);
		if (isset($_POST['type'])) $this->type = StringUtil::trim($_POST['type']);
	}
开发者ID:0xLeon,项目名称:WCF,代码行数:12,代码来源:ClipboardAction.class.php

示例9: readFormParameters

 /**
  * @see	\wcf\form\IForm::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['enable'])) {
         $this->enable = intval($_POST['enable']);
     }
     if (isset($_POST['languageIDs']) && is_array($_POST['languageIDs'])) {
         $this->languageIDs = ArrayUtil::toIntegerArray($_POST['languageIDs']);
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:13,代码来源:LanguageMultilingualismForm.class.php

示例10: validate

 /**
  * @see	\wcf\system\option\IOptionType::validate()
  */
 public function validate(Option $option, $newValue)
 {
     parent::validate($option, $newValue);
     if ($option->allowedbbcodepermission) {
         $disallowedBBCodes = BBCodeParser::getInstance()->validateBBCodes($newValue, explode(',', ArrayUtil::trim(WCF::getSession()->getPermission($option->allowedbbcodepermission))));
         if (!empty($disallowedBBCodes)) {
             WCF::getTPL()->assign('disallowedBBCodes', $disallowedBBCodes);
             throw new UserInputException($option->optionName, 'disallowedBBCodes');
         }
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:14,代码来源:MessageOptionType.class.php

示例11: readParameters

 public function readParameters()
 {
     parent::readParameters();
     // polls
     if (MODULE_POLL & WCF::getSession()->getPermission('user.cms.news.canStartPoll')) {
         PollManager::getInstance()->setObject('de.codequake.cms.news', 0);
     }
     if (isset($_REQUEST['categoryIDs']) && is_array($_REQUEST['categoryIDs'])) {
         $this->categoryIDs = ArrayUtil::toIntegerArray($_REQUEST['categoryIDs']);
     }
 }
开发者ID:jacboy,项目名称:Fireball_News,代码行数:11,代码来源:NewsAddForm.class.php

示例12: validate

 /**
  * @see	\wcf\system\option\IOptionType::validate()
  */
 public function validate(Option $option, $newValue)
 {
     if (!is_array($newValue)) {
         $newValue = array();
     }
     $newValue = ArrayUtil::toIntegerArray($newValue);
     foreach ($newValue as $pageID) {
         if (PageCache::getInstance()->getPage($pageID) === null) {
             throw new UserInputException($option->optionName, 'validationFailed');
         }
     }
 }
开发者ID:knzo,项目名称:Fireball,代码行数:15,代码来源:CMSPageMultiSelectOptionType.class.php

示例13: readParameters

 /**
  * @see	\wcf\page\IPage::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_REQUEST['id'])) {
         if (is_array($_REQUEST['id'])) {
             // ?id[]=1337&id[]=9001
             $this->objectIDs = ArrayUtil::toIntegerArray($_REQUEST['id']);
         } else {
             // ?id=1337 or ?id=1337,9001
             $this->objectIDs = ArrayUtil::toIntegerArray(explode(',', $_REQUEST['id']));
         }
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:16,代码来源:AbstractFeedPage.class.php

示例14: readParameters

 /**
  * @see	\wcf\action\IAction::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_POST['interfaceName'])) {
         $this->interfaceName = StringUtil::trim($_POST['interfaceName']);
     }
     if (isset($_POST['objectIDs']) && is_array($_POST['objectIDs'])) {
         $this->objectIDs = ArrayUtil::toIntegerArray($_POST['objectIDs']);
     }
     if (isset($_POST['parameters']) && is_array($_POST['parameters'])) {
         $this->parameters = $_POST['parameters'];
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:16,代码来源:AJAXProxyAction.class.php

示例15: readFormParameters

 /**
  * @see	\wcf\form\IForm::readFormParameters()
  */
 public function readFormParameters()
 {
     parent::readFormParameters();
     if (isset($_POST['name'])) {
         $this->name = StringUtil::trim($_POST['name']);
     }
     if (isset($_POST['languageID'])) {
         $this->languageID = intval($_POST['languageID']);
     }
     // actually these are synonyms
     if (isset($_POST['tags']) && is_array($_POST['tags'])) {
         $this->synonyms = ArrayUtil::trim($_POST['tags']);
     }
 }
开发者ID:nick-strohm,项目名称:WCF,代码行数:17,代码来源:TagAddForm.class.php


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