本文整理汇总了PHP中ArrayUtil类的典型用法代码示例。如果您正苦于以下问题:PHP ArrayUtil类的具体用法?PHP ArrayUtil怎么用?PHP ArrayUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ArrayUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: parseKeywords
/**
* Parses search keywords.
*
* @param string $keywordString
*/
protected static function parseKeywords($keywordString)
{
// convert encoding if necessary
if (CHARSET == 'UTF-8' && !StringUtil::isASCII($keywordString) && !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 (StringUtil::substring($keywordString, 0, 1) == '"' && StringUtil::substring($keywordString, -1) == '"') {
// phrases search
$keywordString = StringUtil::trim(StringUtil::substring($keywordString, 1, -1));
if (!empty($keywordString)) {
self::$keywords = array_merge(self::$keywords, array(StringUtil::encodeHTML($keywordString)));
}
} else {
// replace word delimiters by space
$keywordString = preg_replace('/[.,]/', ' ', $keywordString);
$keywords = ArrayUtil::encodeHTML(ArrayUtil::trim(explode(' ', $keywordString)));
if (count($keywords) > 0) {
self::$keywords = array_merge(self::$keywords, $keywords);
}
}
}
示例2: readFormParameters
/**
* @see Form::readFormParameters()
*/
public function readFormParameters()
{
parent::readFormParameters();
if (isset($_POST['unignoredBoardIDArray']) && is_array($_POST['unignoredBoardIDArray'])) {
$this->unignoredBoardIDArray = ArrayUtil::toIntegerArray($_POST['unignoredBoardIDArray']);
}
}
示例3: resolveEmailMessageFromPostData
/**
* Given post data and an email message, populate the sender and account on the email message if possible.
* Also add message recipients and any attachments.
* @param array $postData
* @param EmailMessage $emailMessage
* @param User $userToSendMessagesFrom
* @return boolean
*/
public static function resolveEmailMessageFromPostData(array &$postData, CreateEmailMessageForm $emailMessageForm, User $userToSendMessagesFrom)
{
$postVariableName = get_class($emailMessageForm);
Yii::app()->emailHelper->loadOutboundSettingsFromUserEmailAccount($userToSendMessagesFrom);
$toRecipients = explode(",", $postData[$postVariableName]['recipientsData']['to']);
// Not Coding Standard
static::attachRecipientsToMessage($toRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_TO);
if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'cc') != null) {
$ccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['cc']);
// Not Coding Standard
static::attachRecipientsToMessage($ccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_CC);
}
if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'bcc') != null) {
$bccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['bcc']);
// Not Coding Standard
static::attachRecipientsToMessage($bccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_BCC);
}
if (isset($postData['filesIds'])) {
static::attachFilesToMessage($postData['filesIds'], $emailMessageForm->getModel());
}
$emailAccount = EmailAccount::getByUserAndName($userToSendMessagesFrom);
$sender = new EmailMessageSender();
$sender->fromName = Yii::app()->emailHelper->fromName;
$sender->fromAddress = Yii::app()->emailHelper->fromAddress;
$sender->personOrAccount = $userToSendMessagesFrom;
$emailMessageForm->sender = $sender;
$emailMessageForm->account = $emailAccount;
$emailMessageForm->content->textContent = EmailMessageUtil::resolveTextContent(ArrayUtil::getArrayValue($postData[$postVariableName]['content'], 'htmlContent'), null);
$box = EmailBox::resolveAndGetByName(EmailBox::NOTIFICATIONS_NAME);
$emailMessageForm->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
return $emailMessageForm;
}
示例4: actionDetails
public function actionDetails($id)
{
$contact = static::getModelAndCatchNotFoundAndDisplayError('Contact', intval($id));
ControllerSecurityUtil::resolveAccessCanCurrentUserReadModel($contact);
if (!LeadsUtil::isStateALead($contact->state)) {
$urlParams = array('/contacts/' . $this->getId() . '/details', 'id' => $contact->id);
$this->redirect($urlParams);
} else {
AuditEvent::logAuditEvent('ZurmoModule', ZurmoModule::AUDIT_EVENT_ITEM_VIEWED, array(strval($contact), 'LeadsModule'), $contact);
$getData = GetUtil::getData();
$isKanbanBoardInRequest = ArrayUtil::getArrayValue($getData, 'kanbanBoard');
if ($isKanbanBoardInRequest == 0 || $isKanbanBoardInRequest == null || Yii::app()->userInterface->isMobile() === true) {
$breadCrumbView = StickySearchUtil::resolveBreadCrumbViewForDetailsControllerAction($this, 'LeadsSearchView', $contact);
$detailsAndRelationsView = $this->makeDetailsAndRelationsView($contact, 'LeadsModule', 'LeadDetailsAndRelationsView', Yii::app()->request->getRequestUri(), $breadCrumbView);
$view = new LeadsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $detailsAndRelationsView));
} else {
$kanbanItem = new KanbanItem();
$kanbanBoard = new TaskKanbanBoard($kanbanItem, 'type', $contact, get_class($contact));
$kanbanBoard->setIsActive();
$params['relationModel'] = $contact;
$params['relationModuleId'] = $this->getModule()->getId();
$params['redirectUrl'] = null;
$listView = new TasksForLeadKanbanView($this->getId(), 'tasks', 'Task', null, $params, null, array(), $kanbanBoard);
$view = new LeadsPageView(ZurmoDefaultViewUtil::makeStandardViewForCurrentUser($this, $listView));
}
echo $view->render();
}
}
示例5: readFormParameters
/**
* @see Form::readFormParameters()
*/
public function readFormParameters()
{
parent::readFormParameters();
if (isset($_POST['subject'])) {
$this->subject = $_POST['subject'];
}
if (isset($_POST['text'])) {
$this->text = $_POST['text'];
}
if (isset($_POST['enableSmilies'])) {
$this->enableSmilies = $_POST['enableSmilies'];
}
if (isset($_POST['enableHtml'])) {
$this->enableHtml = $_POST['enableHtml'];
}
if (isset($_POST['enableBBCodes'])) {
$this->enableBBCodes = $_POST['enableBBCodes'];
}
if (isset($_POST['showSignature'])) {
$this->showSignature = $_POST['showSignature'];
}
if (isset($_POST['groupIDs']) && is_array($_POST['groupIDs'])) {
$this->groupIDs = ArrayUtil::toIntegerArray($_POST['groupIDs']);
}
if (isset($_POST['preview'])) {
$this->preview = (bool) $_POST['preview'];
}
if (isset($_POST['send'])) {
$this->send = (bool) $_POST['send'];
}
if (isset($_POST['maxLifeTime'])) {
$this->maxLifeTime = intval($_POST['maxLifeTime']);
}
}
示例6: resolveNonEditableWrapperHtmlOptions
protected function resolveNonEditableWrapperHtmlOptions()
{
$htmlOptions = parent::resolveNonEditableWrapperHtmlOptions();
$htmlOptions['class'] .= ' button-wrapper';
$htmlOptions['align'] = ArrayUtil::getArrayValue($this->properties['backend'], 'align');
return $htmlOptions;
}
示例7: __construct
public function __construct($modelClassName, $attributeName)
{
parent::__construct($modelClassName, $attributeName);
assert('$attributeName == null');
$states = $this->resolveStates();
$this->states = ArrayUtil::resolveArrayToLowerCase($states);
}
示例8: readFormParameters
/**
* @see Form::readFormParameters()
*/
public function readFormParameters()
{
parent::readFormParameters();
if (isset($_POST['username'])) {
$this->username = StringUtil::trim($_POST['username']);
}
if (isset($_POST['email'])) {
$this->email = StringUtil::trim($_POST['email']);
}
if (isset($_POST['confirmEmail'])) {
$this->confirmEmail = StringUtil::trim($_POST['confirmEmail']);
}
if (isset($_POST['password'])) {
$this->password = $_POST['password'];
}
if (isset($_POST['confirmPassword'])) {
$this->confirmPassword = $_POST['confirmPassword'];
}
if (isset($_POST['groupIDs']) && is_array($_POST['groupIDs'])) {
$this->groupIDs = ArrayUtil::toIntegerArray($_POST['groupIDs']);
}
if (isset($_POST['visibleLanguages']) && is_array($_POST['visibleLanguages'])) {
$this->visibleLanguages = ArrayUtil::toIntegerArray($_POST['visibleLanguages']);
}
if (isset($_POST['languageID'])) {
$this->languageID = intval($_POST['languageID']);
}
}
示例9: readParameters
/**
* @see Action::readParameters()
*/
public function readParameters()
{
parent::readParameters();
if (isset($_POST['applicationIDs'])) {
$this->applicationIDs = ArrayUtil::toIntegerArray($_POST['applicationIDs']);
}
}
示例10: go
public static function go($obj, $arr)
{
if (!is_null($obj)) {
try {
if (!is_array($obj)) {
throw new Exception("obj or arr is not an array");
}
} catch (Exception $e) {
krumo($obj, $arr);
krumo($e);
die;
}
}
//-------------------------------------------
$obj = ArrayUtil::array_replace_recursive($arr, $obj);
//-------------------------------------------
if (is_array($obj['file'])) {
$files = array();
foreach ($obj['file'] as $value) {
$newObj = ArrayUtil::array_replace_recursive(array(), $obj);
$newObj['file'] = $value;
//-------------------------------------------
$ref = new Import($newObj);
//-------------------------------------------
array_push($files, $ref->init());
}
} else {
$ref = new Import($obj);
return $ref->init();
}
}
示例11: resolveEmailMessageFromPostData
/**
* Given post data and an email message, populate the sender and account on the email message if possible.
* Also add message recipients and any attachments.
* @param array $postData
* @param CreateEmailMessageForm $emailMessageForm
* @param User $userToSendMessagesFrom
* @return CreateEmailMessageForm
*/
public static function resolveEmailMessageFromPostData(array &$postData, CreateEmailMessageForm $emailMessageForm, User $userToSendMessagesFrom)
{
$postVariableName = get_class($emailMessageForm);
$toRecipients = explode(",", $postData[$postVariableName]['recipientsData']['to']);
// Not Coding Standard
static::attachRecipientsToMessage($toRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_TO);
if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'cc') != null) {
$ccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['cc']);
// Not Coding Standard
static::attachRecipientsToMessage($ccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_CC);
}
if (ArrayUtil::getArrayValue($postData[$postVariableName]['recipientsData'], 'bcc') != null) {
$bccRecipients = explode(",", $postData[$postVariableName]['recipientsData']['bcc']);
// Not Coding Standard
static::attachRecipientsToMessage($bccRecipients, $emailMessageForm->getModel(), EmailMessageRecipient::TYPE_BCC);
}
if (isset($postData['filesIds'])) {
static::attachFilesToMessage($postData['filesIds'], $emailMessageForm->getModel());
}
$emailAccount = EmailAccount::getByUserAndName($userToSendMessagesFrom);
$sender = new EmailMessageSender();
$sender->fromName = $emailAccount->fromName;
$sender->fromAddress = $emailAccount->fromAddress;
$sender->personsOrAccounts->add($userToSendMessagesFrom);
$emailMessageForm->sender = $sender;
$emailMessageForm->account = $emailAccount;
$box = EmailBoxUtil::getDefaultEmailBoxByUser($userToSendMessagesFrom);
$emailMessageForm->folder = EmailFolder::getByBoxAndType($box, EmailFolder::TYPE_OUTBOX);
return $emailMessageForm;
}
示例12: readParameters
/**
* @see Page::readParameters()
*/
public function readParameters()
{
parent::readParameters();
if (isset($_REQUEST['userID'])) {
$this->userID = ArrayUtil::toIntegerArray($_REQUEST['userID']);
}
}
示例13: renderControlContentNonEditable
protected function renderControlContentNonEditable()
{
if (!isset($this->properties['backend']['services'])) {
return null;
}
$content = null;
$sizeClass = null;
if (isset($this->properties['backend']['sizeClass'])) {
$sizeClass = $this->properties['backend']['sizeClass'];
}
foreach ($this->properties['backend']['services'] as $serviceName => $serviceDetails) {
if (ArrayUtil::getArrayValue($serviceDetails, 'enabled') and ArrayUtil::getArrayValue($serviceDetails, 'url')) {
$properties = array();
$properties['frontend']['href'] = $serviceDetails['url'];
$properties['frontend']['target'] = '_blank';
$properties['backend']['text'] = $serviceName;
$properties['backend']['sizeClass'] = 'button social-button ' . $serviceName . ' ' . $sizeClass;
$id = $this->id . '_' . $serviceName;
$element = BuilderElementRenderUtil::resolveElement('BuilderSocialButtonElement', $this->renderForCanvas, $id, $properties);
$content .= $element->renderNonEditable();
$content .= $this->resolveSpacerContentForVerticalLayout();
$content .= $this->resolveTdCloseAndOpenContentForHorizontalLayout();
}
}
return $content;
}
示例14: readFormParameters
/**
* @see Form::readFormParameters()
*/
public function readFormParameters()
{
parent::readFormParameters();
$this->ignoreUniques = $this->plugin = $this->standalone = 0;
if (isset($_POST['packageUpdateServerIDs']) && is_array($_POST['packageUpdateServerIDs'])) {
$this->packageUpdateServerIDs = ArrayUtil::toIntegerArray($_POST['packageUpdateServerIDs']);
}
if (isset($_POST['packageName'])) {
$this->packageName = StringUtil::trim($_POST['packageName']);
}
if (isset($_POST['author'])) {
$this->author = StringUtil::trim($_POST['author']);
}
if (isset($_POST['searchDescription'])) {
$this->searchDescription = intval($_POST['searchDescription']);
}
if (isset($_POST['plugin'])) {
$this->plugin = intval($_POST['plugin']);
}
if (isset($_POST['standalone'])) {
$this->standalone = intval($_POST['standalone']);
}
if (isset($_POST['other'])) {
$this->other = intval($_POST['other']);
}
if (isset($_POST['ignoreUniques'])) {
$this->ignoreUniques = intval($_POST['ignoreUniques']);
}
}
示例15: readParameters
/**
* @see Action::readParameters()
*/
public function readParameters()
{
parent::readParameters();
if (isset($_POST['sourceListPositions']) && is_array($_POST['sourceListPositions'])) {
$this->positions = ArrayUtil::toIntegerArray($_POST['sourceListPositions']);
}
}