本文整理汇总了PHP中Mautic\CoreBundle\Helper\InputHelper::html方法的典型用法代码示例。如果您正苦于以下问题:PHP InputHelper::html方法的具体用法?PHP InputHelper::html怎么用?PHP InputHelper::html使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mautic\CoreBundle\Helper\InputHelper
的用法示例。
在下文中一共展示了InputHelper::html方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setBuilderContentAction
/**
* @param Request $request
*
* @return \Symfony\Component\HttpFoundation\JsonResponse
*/
protected function setBuilderContentAction(Request $request)
{
$dataArray = array('success' => 0);
$entityId = InputHelper::clean($request->request->get('entity'));
$session = $this->factory->getSession();
if (!empty($entityId)) {
$sessionVar = 'mautic.emailbuilder.' . $entityId . '.content';
// Check for an array of slots
$slots = InputHelper::_($request->request->get('slots', array(), true), 'html');
$content = $session->get($sessionVar, array());
if (!is_array($content)) {
$content = array();
}
if (!empty($slots)) {
// Builder was closed so save each content
foreach ($slots as $slot => $newContent) {
$content[$slot] = $newContent;
}
$session->set($sessionVar, $content);
$dataArray['success'] = 1;
} else {
// Check for a single slot
$newContent = InputHelper::html($request->request->get('content'));
$slot = InputHelper::clean($request->request->get('slot'));
if (!empty($slot)) {
$content[$slot] = $newContent;
$session->set($sessionVar, $content);
$dataArray['success'] = 1;
}
}
}
return $this->sendJsonResponse($dataArray);
}
示例2: addNotification
/**
* Write a notification.
*
* @param string $message Message of the notification
* @param string $type Optional $type to ID the source of the notification
* @param bool|true $isRead Add unread indicator
* @param string $header Header for message
* @param string $iconClass Font Awesome CSS class for the icon (e.g. fa-eye)
* @param \DateTime $datetime Date the item was created
* @param User|null $user User object; defaults to current user
*/
public function addNotification($message, $type = null, $isRead = false, $header = null, $iconClass = null, \DateTime $datetime = null, User $user = null)
{
if ($user === null) {
$user = $this->userHelper->getUser();
}
if ($user === null || !$user->getId()) {
//ensure notifications aren't written for non users
return;
}
$notification = new Notification();
$notification->setType($type);
$notification->setIsRead($isRead);
$notification->setHeader(EmojiHelper::toHtml(InputHelper::html($header)));
$notification->setMessage(EmojiHelper::toHtml(InputHelper::html($message)));
$notification->setIconClass($iconClass);
$notification->setUser($user);
if ($datetime == null) {
$datetime = new \DateTime();
}
$notification->setDateAdded($datetime);
$this->saveEntity($notification);
}