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


PHP Mailer::build_notification方法代码示例

本文整理汇总了PHP中Mailer::build_notification方法的典型用法代码示例。如果您正苦于以下问题:PHP Mailer::build_notification方法的具体用法?PHP Mailer::build_notification怎么用?PHP Mailer::build_notification使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mailer的用法示例。


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

示例1: alert_watchers

 /**
  * alert watchers of this anchor
  *
  * @param array message attributes, such as 'subject', 'message', 'headers'
  * @param string description of the on-going action (e.g., 'file:create')
  * @param boolean TRUE if access to the target object is restricted, FALSE otherwise
  * @return boolean TRUE on success, FALSE otherwise
  */
 function alert_watchers($mail, $action = NULL, $restricted = FALSE)
 {
     global $context;
     // do not notify watchers if overlay prevents it
     if (is_object($this->overlay) && !$this->overlay->should_notify_watchers($mail)) {
         return FALSE;
     }
     // list all items in the watching context
     $containers = $this->get_watched_context($action);
     // finalize the message
     $mail['message'] = Mailer::build_notification($mail['notification'], 1);
     // allow for message threading
     if (!isset($mail['headers'])) {
         $mail['headers'] = Mailer::set_thread($this->get_reference());
     }
     // we are private, so consider only watchers who are also editors
     if ($this->item['active'] == 'N') {
         $restricted = TRUE;
     }
     // list editors if access is restricted
     $editors = NULL;
     if ($restricted) {
         $editors = Members::list_editors_for_member($this->get_focus(), 0, 10000, 'ids');
     }
     // do the job
     return Users::alert_watchers($containers, $mail, $editors);
 }
开发者ID:rair,项目名称:yacs,代码行数:35,代码来源:anchor.php

示例2: finalize_update

 /**
  * do whatever is necessary when a page has been updated
  *
  * This function:
  * - logs the update
  * - sends notification to watchers and to followers
  * - "touches" the container of the page,
  * - ping referred pages remotely (via the pingback protocol)
  * - ping selected servers, if any
  * - and triggers the hook 'update'.
  *
  * The first parameter provides the watching context to consider. If call is related
  * to the creation of a published page, the context is the section that hosts the new
  * page. If call is related to a draft page that has been published, then the context
  * is the page itself.
  *
  * This function is also able to notify followers of the surfer who has initiated the
  * action.
  *
  * @param object the watching context
  * @param array attributes of the published page
  * @param object page overlay, if any
  * @param boolean TRUE if dates should be left unchanged, FALSE otherwise
  * @param boolean TRUE if watchers should be notified, FALSE otherwise
  * @param boolean TRUE if followers should be notified, FALSE otherwise
  */
 public static function finalize_update($anchor, $item, $overlay = NULL, $silently = FALSE, $with_watchers = TRUE, $with_followers = FALSE)
 {
     global $context;
     // proceed only if the page has been published
     if (isset($item['publish_date']) && $item['publish_date'] > NULL_DATE) {
         // notification to send by e-mail
         $mail = array();
         $mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Update'), strip_tags($item['title']));
         $mail['notification'] = Articles::build_notification('update', $item);
         $mail['headers'] = Mailer::set_thread('article:' . $item['id']);
         // allow the overlay to prevent notifications of watcherss
         if (is_object($overlay) && !$overlay->should_notify_watchers($mail)) {
             $with_watchers = FALSE;
         }
         // send to watchers of this page, and to watchers upwards
         if ($with_watchers && ($handle = new Article())) {
             $handle->load_by_content($item, $anchor);
             $handle->alert_watchers($mail, 'article:update', $item['active'] == 'N');
         }
         // never notify followers on private pages
         if (isset($item['active']) && $item['active'] == 'N') {
             $with_followers = FALSE;
         }
         // allow the overlay to prevent notifications of followers
         if (is_object($overlay) && !$overlay->should_notify_followers()) {
             $with_followers = FALSE;
         }
         // send to followers of this user
         if ($with_followers && Surfer::get_id()) {
             $mail['message'] = Mailer::build_notification($mail['notification'], 2);
             Users::alert_watchers('user:' . Surfer::get_id(), $mail);
         }
         // update anchors
         $anchor->touch('article:update', $item['id'], $silently);
         // advertise public pages
         if (isset($item['active']) && $item['active'] == 'Y') {
             // expose links within the page
             $raw = '';
             if (isset($item['introduction'])) {
                 $raw .= $item['introduction'];
             }
             if (isset($item['source'])) {
                 $raw .= ' ' . $item['source'];
             }
             if (isset($item['description'])) {
                 $raw .= ' ' . $item['description'];
             }
             // pingback to referred links, if any
             include_once $context['path_to_root'] . 'links/links.php';
             Links::ping($raw, 'article:' . $item['id']);
             // ping servers, if any
             Servers::notify($anchor->get_url());
         }
     }
     // 'update' hook
     if (is_callable(array('Hooks', 'include_scripts'))) {
         Hooks::include_scripts('update', $item['id']);
     }
     // log page update
     $label = sprintf(i18n::c('Update: %s'), strip_tags($item['title']));
     $poster = Users::get_link($item['edit_name'], $item['edit_address'], $item['edit_id']);
     $description = sprintf(i18n::c('Updated by %s in %s'), $poster, $anchor->get_title());
     $description .= "\n\n" . '<a href="' . Articles::get_permalink($item) . '">' . $item['title'] . '</a>';
     Logger::notify('articles/articles.php: ' . $label, $description);
 }
开发者ID:rair,项目名称:yacs,代码行数:91,代码来源:articles.php

示例3: sprintf

             $label = sprintf(i18n::c('New file in %s'), strip_tags($anchor->get_title()));
             $link = Files::get_permalink($item);
             $description = sprintf(i18n::c('%s at %s'), $item['file_name'], '<a href="' . $link . '">' . $link . '</a>');
             Logger::notify('files/edit.php: ' . $label, $description);
             // notification to send by e-mail
             $mail = array();
             $mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Contribution'), strip_tags($anchor->get_title()));
             $mail['notification'] = Files::build_notification('upload', $item);
         }
         // send to anchor watchers
         if (isset($_REQUEST['notify_watchers']) && $_REQUEST['notify_watchers'] == 'Y') {
             $anchor->alert_watchers($mail, $action, isset($_REQUEST['active']) && $_REQUEST['active'] == 'N');
         }
         // send to followers of this user
         if (isset($_REQUEST['notify_followers']) && $_REQUEST['notify_followers'] == 'Y' && Surfer::get_id() && $_REQUEST['active'] != 'N') {
             $mail['message'] = Mailer::build_notification($mail['notification'], 2);
             Users::alert_watchers('user:' . Surfer::get_id(), $mail);
         }
     }
     // update a record about an uploaded file
 } elseif (isset($_REQUEST['id'])) {
     // change has been documented
     if (isset($_REQUEST['version']) && $_REQUEST['version']) {
         $_REQUEST['description'] = Files::add_to_history($item, $_REQUEST['version']);
     }
     // when the file has been overlaid
     if (is_object($overlay)) {
         // allow for change detection
         $overlay->snapshot();
         // update the overlay from form content
         $overlay->parse_fields($_REQUEST);
开发者ID:rair,项目名称:yacs,代码行数:31,代码来源:edit.php

示例4: get_comment_notification

 public function get_comment_notification($item)
 {
     global $context;
     // build a tease notification for simple members
     // sanity check
     if (!isset($item['anchor']) || !($anchor = Anchors::get($item['anchor']))) {
         throw new Exception('no anchor for this comment');
     }
     // headline
     $headline = sprintf(i18n::c('%s has replied'), Surfer::get_link());
     $content = BR;
     // shape these
     $tease = Skin::build_mail_content($headline, $content);
     // a set of links
     $menu = array();
     // call for action
     $link = $context['url_to_home'] . $context['url_to_root'] . Comments::get_url($item['id'], 'view');
     $menu[] = Skin::build_mail_button($link, i18n::c('View the reply'), TRUE);
     // link to the container
     $menu[] = Skin::build_mail_button($anchor->get_url(), $anchor->get_title(), FALSE);
     // finalize links
     $tease .= Skin::build_mail_menu($menu);
     // assemble all parts of the mail
     $mail = array();
     $mail['subject'] = sprintf(i18n::c('%s: %s'), i18n::c('Reply in the discussion'), strip_tags($anchor->get_title()));
     $mail['notification'] = Comments::build_notification($item);
     // full notification
     $mail['tease'] = Mailer::build_notification($tease, 1);
     return $mail;
 }
开发者ID:rair,项目名称:yacs,代码行数:30,代码来源:thread.php


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