本文整理汇总了PHP中ArrayHelper::prependOrAppend方法的典型用法代码示例。如果您正苦于以下问题:PHP ArrayHelper::prependOrAppend方法的具体用法?PHP ArrayHelper::prependOrAppend怎么用?PHP ArrayHelper::prependOrAppend使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ArrayHelper
的用法示例。
在下文中一共展示了ArrayHelper::prependOrAppend方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: includeJs
/**
* Prepares JS for inclusion in the template.
*
* @param string $js The Javascript code.
* @param bool $first Whether the Javascript code should be included before any other Javascript code that was
* already included with this method.
*
* @return null
*/
public function includeJs($js, $first = false)
{
// Trim any whitespace and ensure it ends with a semicolon.
$js = trim($js, " \t\n\r\v;") . ';';
$latestBuffer =& $this->_jsBuffers[count($this->_jsBuffers) - 1];
ArrayHelper::prependOrAppend($latestBuffer, $js, $first);
}
示例2: includeJs
/**
* Prepares JS for inclusion in the template.
*
* @param string $js The Javascript code.
* @param bool $first Whether the Javascript code should be included before any other Javascript code that was
* already included with this method.
*
* @return null
*/
public function includeJs($js, $first = false)
{
$latestBuffer =& $this->_jsBuffers[count($this->_jsBuffers) - 1];
ArrayHelper::prependOrAppend($latestBuffer, trim($js), $first);
}
示例3: includeJs
/**
* Prepares JS for inclusion in the template.
*
* @param $js
* @param bool|null $first
* @return void
*/
public function includeJs($js, $first = false)
{
ArrayHelper::prependOrAppend($this->_js, trim($js), $first);
}
示例4: sendEmailNotification
/**
* Send Email Notification
*
*/
public function sendEmailNotification($form, $files, $postData, $customEmail, $customSubject, $message, $html = true, $email = null)
{
$errors = false;
$attributes = $form->getAttributes();
$notificationSettings = $attributes['notificationSettings'];
$toEmails = ArrayHelper::stringToArray($notificationSettings['emailSettings']['notifyEmail']);
$emailSettings = craft()->email->getSettings();
if (isset($notificationSettings['replyTo']) && $notificationSettings['replyTo'] != '') {
$replyTo = $postData[$notificationSettings['replyTo']];
} else {
$replyTo = $emailSettings['emailAddress'];
}
// Process Subject Line
if ($customSubject) {
$subject = $customSubject;
} else {
$subject = $notificationSettings['emailSettings']['emailSubject'];
}
if ($customEmail != '') {
$theEmailAddress = explode('|', $customEmail);
ArrayHelper::prependOrAppend($toEmails, $theEmailAddress[0], true);
}
foreach ($toEmails as $toEmail) {
$email = new EmailModel();
$email->fromEmail = $emailSettings['emailAddress'];
$email->replyTo = $replyTo;
$email->sender = $emailSettings['emailAddress'];
$email->fromName = $form->name;
$email->toEmail = $toEmail;
$email->subject = $subject;
$email->htmlBody = $message;
// Attach files to email
if (!empty($files)) {
foreach ($files as $attachment) {
$email->addAttachment($attachment['tempPath'], $attachment['filename'], 'base64', $attachment['type']);
}
}
if (!craft()->email->sendEmail($email)) {
$errors = true;
}
}
return $errors ? false : true;
}