本文整理汇总了PHP中Notify::send方法的典型用法代码示例。如果您正苦于以下问题:PHP Notify::send方法的具体用法?PHP Notify::send怎么用?PHP Notify::send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notify
的用法示例。
在下文中一共展示了Notify::send方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: runTrigger
/**
* Function called when a Dolibarrr business event is done.
* All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared)
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf)
{
if (empty($conf->notification->enabled)) {
return 0;
}
// Module not active, we do nothing
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
$notify = new Notify($this->db);
$notify->send($action, $object);
return 1;
}
示例2: Notify
/**
* Function called when a Dolibarrr business event is done.
* All functions "run_trigger" are triggered if file is inside directory htdocs/core/triggers
*
* @param string $action Event action code
* @param Object $object Object
* @param User $user Object user
* @param Translate $langs Object langs
* @param conf $conf Object conf
* @return int <0 if KO, 0 if no triggered ran, >0 if OK
*/
function run_trigger($action, $object, $user, $langs, $conf)
{
if (empty($conf->notification->enabled)) {
return 0;
}
// Module not active, we do nothing
require_once DOL_DOCUMENT_ROOT . '/core/class/notify.class.php';
if ($action == 'BILL_VALIDATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$filepdf = '';
// We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextInvoiceValidated", $object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'facture', $object->id, $filepdf);
} elseif ($action == 'ORDER_VALIDATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->commande->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$filepdf = '';
// We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextOrderValidated", $object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'order', $object->id, $filepdf);
} elseif ($action == 'PROPAL_VALIDATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->propal->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$filepdf = '';
// We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextProposalValidated", $object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf);
} elseif ($action == 'FICHEINTER_VALIDATE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->facture->dir_output . '/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$filepdf = '';
// We can't add PDF as it is not generated yet.
$langs->load("other");
$mesg = $langs->transnoentitiesnoconv("EMailTextInterventionValidated", $object->ref);
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'ficheinter', $object->id, $filepdf);
} elseif ($action == 'ORDER_SUPPLIER_APPROVE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$mesg = $langs->transnoentitiesnoconv("Hello") . ",\n\n";
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderApprovedBy", $object->ref, $user->getFullName($langs));
$mesg .= "\n\n" . $langs->transnoentitiesnoconv("Sincerely") . ".\n\n";
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
} elseif ($action == 'ORDER_SUPPLIER_REFUSE') {
dol_syslog("Trigger '" . $this->name . "' for action '{$action}' launched by " . __FILE__ . ". id=" . $object->id);
$ref = dol_sanitizeFileName($object->ref);
$filepdf = $conf->fournisseur->dir_output . '/commande/' . $ref . '/' . $ref . '.pdf';
if (!file_exists($filepdf)) {
$filepdf = '';
}
$mesg = $langs->transnoentitiesnoconv("Hello") . ",\n\n";
$mesg .= $langs->transnoentitiesnoconv("EMailTextOrderRefusedBy", $object->ref, $user->getFullName($langs));
$mesg .= "\n\n" . $langs->transnoentitiesnoconv("Sincerely") . ".\n\n";
$notify = new Notify($this->db);
$notify->send($action, $object->socid, $mesg, 'order_supplier', $object->id, $filepdf);
}
// If not found
/*
else
{
dol_syslog("Trigger '".$this->name."' for action '$action' was ran by ".__FILE__." but no handler found for this action.");
//.........这里部分代码省略.........
示例3: function
<?php
Weapon::add('on_comment_construct', function ($G, $P) use($config, $speak) {
if ($config->is->post && ($post = $G['data'][$config->page_type])) {
$c = $config->states->{'plugin_' . md5(File::B(__DIR__))};
$title = $post['title'];
$url = $post['url'] . '#' . sprintf($G['data']['comment_id'], Date::format($P['data']['id'], 'U'));
$topic = sprintf($c->subject, $title, $url);
$parser = Request::post('content_type', $config->html_parser->active);
$message = '<blockquote><p>' . sprintf($c->message, $title, $url) . '</p></blockquote>';
$message .= '<h3>' . $P['data']['name'] . '</h3>';
$message .= $parser !== false && $parser !== 'HTML' ? Text::parse($P['data']['message'], '->html') : $P['data']['message'];
$message .= '<p>';
$message .= '<a href="' . $config->url . '/' . $config->manager->slug . '/comment/repair/id:' . $P['data']['id'] . '">' . $speak->edit . '</a>';
$message .= ' / ';
$message .= '<a href="' . $config->url . '/' . $config->manager->slug . '/comment/kill/id:' . $P['data']['id'] . '">' . $speak->delete . '</a>';
$message .= '</p>';
// Sending email notification ...
if (!Guardian::happy() && Notify::send($P['data']['email'], $config->author->email, $topic, $message, 'comment:')) {
Weapon::fire('on_comment_notify_construct', array($P, $config->author->email, $topic, $message));
}
}
});
示例4: array
$field = Request::post('fields', array());
include DECK . DS . 'workers' . DS . 'task.field.1.php';
// Temporarily disallow image(s) in comment to prevent XSS
$message = strip_tags($message, '<br><img>' . ($parser === 'HTML' ? '<a><abbr><b><blockquote><code><del><dfn><em><i><ins><p><pre><span><strong><sub><sup><time><u><var>' : ""));
$message = preg_replace('#(\\!\\[.*?\\]\\(.*?\\))#', '`$1`', $message);
$message = preg_replace('#<img(\\s[^<>]*?)>#', '<img$1>', $message);
Page::header(array('Name' => $name, 'Email' => $email, 'URL' => $url, 'Status' => Guardian::happy() ? 'pilot' : 'passenger', 'Content Type' => $parser, 'Fields' => !empty($field) ? Text::parse($field, '->encoded_json') : false, 'UA' => Get::UA(), 'IP' => Get::IP()))->content($message)->saveTo(RESPONSE . DS . $post . '_' . Date::format($id, 'Y-m-d-H-i-s') . '_' . ($parent ? Date::format($parent, 'Y-m-d-H-i-s') : '0000-00-00-00-00-00') . $extension);
Notify::success(Config::speak('notify_success_submitted', $speak->comment));
if ($extension === '.hold') {
Notify::info($speak->notify_info_comment_moderation);
}
Weapon::fire('on_comment_update', array($P, $P));
Weapon::fire('on_comment_construct', array($P, $P));
if ($config->comment_notification_email) {
$mail = '<p>' . Config::speak('comment_notification', $article->url . '#' . sprintf($comment_id, Date::format($id, 'U'))) . '</p>';
$mail .= '<p><strong>' . $name . ':</strong></p>';
$mail .= $parser !== 'HTML' ? Text::parse($message, '->html') : $message;
$mail .= '<p>' . Date::format($id, 'Y/m/d H:i:s') . '</p>';
// Sending email notification ...
if (!Guardian::happy()) {
if (Notify::send($request['email'], $config->author_email, $speak->comment_notification_subject, $mail, 'comment:')) {
Weapon::fire('on_comment_notification_construct', array($request, $config->author_email, $speak->comment_notification_subject, $mail));
}
}
}
Guardian::kick($config->url_current . (!Guardian::happy() && $config->comment_moderation ? '#' . $comment_form_id : '#' . sprintf($comment_id, Date::format($id, 'U'))));
} else {
Guardian::kick($config->url_current . '#' . $comment_form_id);
}
}
});
示例5: Notify
<?php
/**
* Copyright (c) 2014 Keith Casey
*
* This code is designed to accompany the lynda.com video course "Design Patterns in PHP"
* by Keith Casey. If you've received this code without seeing the videos, go watch the
* videos. It will make way more sense and be more useful in general.
*/
require 'vendor/autoload.php';
include_once 'notify.php';
$notify = new Notify('username', 'password');
$notify->send('17035551212', '15125551212', 'body of the message');