本文整理汇总了PHP中Frontend\Core\Engine\Navigation::getBackendURLForBlock方法的典型用法代码示例。如果您正苦于以下问题:PHP Navigation::getBackendURLForBlock方法的具体用法?PHP Navigation::getBackendURLForBlock怎么用?PHP Navigation::getBackendURLForBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Frontend\Core\Engine\Navigation
的用法示例。
在下文中一共展示了Navigation::getBackendURLForBlock方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notifyAdmin
/**
* Notify the admin
*
* @param array $comment The comment that was submitted.
*/
public static function notifyAdmin(array $comment)
{
// don't notify admin in case of spam
if ($comment['status'] == 'spam') {
return;
}
// get settings
$notifyByMailOnComment = FrontendModel::get('fork.settings')->get('Blog', 'notify_by_email_on_new_comment', false);
$notifyByMailOnCommentToModerate = FrontendModel::get('fork.settings')->get('Blog', 'notify_by_email_on_new_comment_to_moderate', false);
// create URLs
$url = SITE_URL . FrontendNavigation::getURLForBlock('Blog', 'Detail') . '/' . $comment['post_url'] . '#comment-' . $comment['id'];
$backendURL = SITE_URL . FrontendNavigation::getBackendURLForBlock('comments', 'Blog') . '#tabModeration';
// notify on all comments
if ($notifyByMailOnComment) {
// init var
$variables = null;
// comment to moderate
if ($comment['status'] == 'moderation') {
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewCommentToModerate'), array($comment['author'], $url, $comment['post_title'], $backendURL));
} elseif ($comment['status'] == 'published') {
// comment was published
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewComment'), array($comment['author'], $url, $comment['post_title']));
}
$to = FrontendModel::get('fork.settings')->get('Core', 'mailer_to');
$from = FrontendModel::get('fork.settings')->get('Core', 'mailer_from');
$replyTo = FrontendModel::get('fork.settings')->get('Core', 'mailer_reply_to');
$message = Message::newInstance(FL::msg('NotificationSubject'))->setFrom(array($from['email'] => $from['name']))->setTo(array($to['email'] => $to['name']))->setReplyTo(array($replyTo['email'] => $replyTo['name']))->parseHtml('/Core/Layout/Templates/Mails/Notification.html.twig', $variables, true);
FrontendModel::get('mailer')->send($message);
} elseif ($notifyByMailOnCommentToModerate && $comment['status'] == 'moderation') {
// only notify on new comments to moderate and if the comment is one to moderate
// set variables
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewCommentToModerate'), array($comment['author'], $url, $comment['post_title'], $backendURL));
$to = FrontendModel::get('fork.settings')->get('Core', 'mailer_to');
$from = FrontendModel::get('fork.settings')->get('Core', 'mailer_from');
$replyTo = FrontendModel::get('fork.settings')->get('Core', 'mailer_reply_to');
$message = Message::newInstance(FL::msg('NotificationSubject'))->setFrom(array($from['email'] => $from['name']))->setTo(array($to['email'] => $to['name']))->setReplyTo(array($replyTo['email'] => $replyTo['name']))->parseHtml('/Core/Layout/Templates/Mails/Notification.html.twig', $variables, true);
FrontendModel::get('mailer')->send($message);
}
}
示例2: notifyAdmin
/**
* Notify the admin
*
* @param array $comment The comment that was submitted.
*/
public static function notifyAdmin(array $comment)
{
// don't notify admin in case of spam
if ($comment['status'] == 'spam') {
return;
}
// build data for push notification
if ($comment['status'] == 'moderation') {
$key = 'BLOG_COMMENT_MOD';
} else {
$key = 'BLOG_COMMENT';
}
$author = $comment['author'];
if (mb_strlen($author) > 20) {
$author = mb_substr($author, 0, 19) . '…';
}
$text = $comment['text'];
if (mb_strlen($text) > 50) {
$text = mb_substr($text, 0, 49) . '…';
}
$alert = array('loc-key' => $key, 'loc-args' => array($author, $text));
// build data
$data = array('api' => SITE_URL . '/api/1.0', 'id' => $comment['id']);
// push it
FrontendModel::pushToAppleApp($alert, null, 'default', $data);
// get settings
$notifyByMailOnComment = FrontendModel::get('fork.settings')->get('Blog', 'notify_by_email_on_new_comment', false);
$notifyByMailOnCommentToModerate = FrontendModel::get('fork.settings')->get('Blog', 'notify_by_email_on_new_comment_to_moderate', false);
// create URLs
$URL = SITE_URL . FrontendNavigation::getURLForBlock('Blog', 'Detail') . '/' . $comment['post_url'] . '#comment-' . $comment['id'];
$backendURL = SITE_URL . FrontendNavigation::getBackendURLForBlock('comments', 'Blog') . '#tabModeration';
// notify on all comments
if ($notifyByMailOnComment) {
// init var
$variables = null;
// comment to moderate
if ($comment['status'] == 'moderation') {
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewCommentToModerate'), array($comment['author'], $URL, $comment['post_title'], $backendURL));
} elseif ($comment['status'] == 'published') {
// comment was published
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewComment'), array($comment['author'], $URL, $comment['post_title']));
}
$to = FrontendModel::get('fork.settings')->get('Core', 'mailer_to');
$from = FrontendModel::get('fork.settings')->get('Core', 'mailer_from');
$replyTo = FrontendModel::get('fork.settings')->get('Core', 'mailer_reply_to');
$message = \Common\Mailer\Message::newInstance(FL::msg('NotificationSubject'))->setFrom(array($from['email'] => $from['name']))->setTo(array($to['email'] => $to['name']))->setReplyTo(array($replyTo['email'] => $replyTo['name']))->parseHtml(FRONTEND_CORE_PATH . '/Layout/Templates/Mails/Notification.tpl', $variables, true);
FrontendModel::get('mailer')->send($message);
} elseif ($notifyByMailOnCommentToModerate && $comment['status'] == 'moderation') {
// only notify on new comments to moderate and if the comment is one to moderate
// set variables
$variables['message'] = vsprintf(FL::msg('BlogEmailNotificationsNewCommentToModerate'), array($comment['author'], $URL, $comment['post_title'], $backendURL));
$to = FrontendModel::get('fork.settings')->get('Core', 'mailer_to');
$from = FrontendModel::get('fork.settings')->get('Core', 'mailer_from');
$replyTo = FrontendModel::get('fork.settings')->get('Core', 'mailer_reply_to');
$message = \Common\Mailer\Message::newInstance(FL::msg('NotificationSubject'))->setFrom(array($from['email'] => $from['name']))->setTo(array($to['email'] => $to['name']))->setReplyTo(array($replyTo['email'] => $replyTo['name']))->parseHtml(FRONTEND_CORE_PATH . '/Layout/Templates/Mails/Notification.tpl', $variables, true);
FrontendModel::get('mailer')->send($message);
}
}
示例3: notifyAdmin
/**
* Notify the admin
*
* @param array $subscription The subscription that was submitted.
*/
public static function notifyAdmin(array $subscription)
{
// don't notify admin in case of spam
if ($subscription['status'] == 'spam') {
return;
}
// build data for push notification
if ($subscription['status'] == 'moderation') {
$key = 'AGENDA_SUBSCRIPTION_MOD';
} else {
$key = 'AGENDA_SUBSCRIPTION';
}
$name = $subscription['name'];
if (mb_strlen($name) > 20) {
$name = mb_substr($name, 0, 19) . '…';
}
$alert = array('loc-key' => $key, 'loc-args' => array($name));
// build data
$data = array('api' => SITE_URL . '/api/1.0', 'id' => $subscription['id']);
// push it
FrontendModel::pushToAppleApp($alert, null, 'default', $data);
// get settings
$notifyByMailOnSubscription = FrontendModel::get('fork.settings')->get('Agenda', 'notify_by_email_on_new_subscription', false);
$notifyByMailOnSubscription = FrontendModel::get('fork.settings')->get('Agenda', 'notify_by_email_on_new_subscription_to_moderate', false);
// create URLs
$backendURL = SITE_URL . FrontendNavigation::getBackendURLForBlock('subscriptions', 'agenda') . '#tabModeration';
// notify on all comments
if ($notifyByMailOnSubscription) {
// init var
$message = null;
$from = FrontendModel::get('fork.settings')->get('Core', 'mailer_from');
if ($subscription['status'] == 'moderation') {
$message = \Common\Mailer\Message::newInstance(FL::msg('NotificationSubject'))->parseHtml(FRONTEND_CORE_PATH . '/Layout/Templates/Mails/Notification.tpl', array('message' => vsprintf(FL::msg('AgendaEmailNotificationsNewSubscriptionToModerate'), array($subscription['name'], $subscription['agenda_title'], $backendURL))), true)->setTo('nick@comsa.be')->setFrom(array($from['email'] => $from['name']));
} elseif ($subscription['status'] == 'published') {
$message = \Common\Mailer\Message::newInstance(FL::msg('NotificationSubject'))->parseHtml(FRONTEND_CORE_PATH . '/Layout/Templates/Mails/Notification.tpl', array('message' => vsprintf(FL::msg('AgendaEmailNotificationsNewSubscription'), array($subscription['name'], $subscription['agenda_title']))), true)->setTo('nick@comsa.be')->setFrom(array($from['email'] => $from['name']));
}
FrontendModel::get('mailer')->send($message);
// send the mail
// FrontendModel::get('mailer')->addEmail(
// FL::msg('NotificationSubject'),
// FRONTEND_CORE_PATH . '/Layout/Templates/Mails/Notification.tpl',
// $variables,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// true
// );
} elseif ($notifyByMailOnSubscriptionToModerate && $subscription['status'] == 'moderation') {
$message = null;
$from = FrontendModel::get('fork.settings')->get('Core', 'mailer_from');
$message = \Common\Mailer\Message::newInstance(FL::msg('NotificationSubject'))->parseHtml(FRONTEND_CORE_PATH . '/Layout/Templates/Mails/Notification.tpl', array('message' => vsprintf(FL::msg('AgendaEmailNotificationsNewSubscriptionToModerate'), array($subscription['name'], $subscription['agenda_title'], $backendURL))), true)->setTo('nick@comsa.be')->setFrom(array($from['email'] => $from['name']));
FrontendModel::get('mailer')->send($message);
// set variables
// $variables['message'] = vsprintf(FL::msg('AgendaEmailNotificationsNewSubscriptionToModerate'),
// array($subscription['name'], $subscription['agenda_title'], $backendURL));
//
// // send the mail
// FrontendModel::get('mailer')->addEmail(
// FL::msg('NotificationSubject'),
// FRONTEND_CORE_PATH . '/Layout/Templates/Mails/Notification.tpl',
// $variables,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// null,
// true
// );
}
}