本文整理汇总了PHP中Notifications::addLog方法的典型用法代码示例。如果您正苦于以下问题:PHP Notifications::addLog方法的具体用法?PHP Notifications::addLog怎么用?PHP Notifications::addLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notifications
的用法示例。
在下文中一共展示了Notifications::addLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pushNotification
private static function pushNotification($userKey, $message, $title = null, $url = null, $urltitle = null)
{
Notifications::addLog('Pushover[pushNotification' . ']; $userKey=[' . $userKey . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
$notification = new Pushover();
$token = Config::get('applicationToken', 'msg_pushover');
if (is_null($token)) {
throw new Exception("Pushover - Application token not specified", 500);
}
if (is_null($userKey)) {
throw new Exception("Pushover - User key not specified", 500);
}
$notification->setToken($token);
$notification->setUser($userKey);
$notification->setMessage($message);
if (!is_null($title)) {
$notification->setTitle($title);
}
$notification->setHtml(1);
$notification->setUrl($url);
$notification->setUrlTitle($urltitle);
if (!$notification->send()) {
Notifications::addError("Pushover - Error in sending a notification to '{$userKey}'");
} else {
Notifications::addSuccess('Pushover message sent.');
}
}
示例2: saveMutation
private static function saveMutation($operation, $fullRelationSignature, $stableAtom, $stableConcept, $modifiedAtom, $modifiedConcept, $source)
{
if (array_key_exists($fullRelationSignature, Config::get('mutationConcepts', 'MutationExtension'))) {
Notifications::addLog("Save mutation on '{$fullRelationSignature}' (editUpdate)", 'Mutation');
$mutConcept = Config::get('mutationConcepts', 'MutationExtension')[$fullRelationSignature];
$database = Database::singleton();
$database->setTrackAffectedConjuncts(false);
// Don't track affected conjuncts for Mutation concept and relations;
// New Mutation
$mut = $database->addAtomToConcept(Concept::createNewAtom($mutConcept), $mutConcept);
// Add mut info
$database->editUpdate('mutRelation', false, $mut, 'Mutation', $fullRelationSignature, 'Relation');
$database->editUpdate('mutDateTime', false, $mut, 'Mutation', date(DATE_ISO8601), 'DateTime');
if ($source == 'User') {
$user = Session::getSessionUserId();
} else {
$user = $source;
}
$database->editUpdate('mutBy', false, $mut, 'Mutation', $user, 'User');
$database->editUpdate('mutOp', false, $mut, 'Mutation', $operation, 'Operation');
// $database->editUpdate('mutReason', false, $mut, 'Mutation', 'zomaar', 'MutationReason'); // TODO: get reason from somewhere
$database->editUpdate('mutValue', false, $mut, 'Mutation', $modifiedAtom, 'MutationValue');
$database->editUpdate('mutStable', false, $mut, $mutConcept, $stableAtom, $stableConcept);
$database->editUpdate('mutPublish', false, $mut, 'Mutation', $mut, 'Mutation');
$database->setTrackAffectedConjuncts(true);
// Enable tracking of affected conjuncts again!!
}
}
示例3: SendSMS
function SendSMS($phonenumber, $message)
{
$config = Config::get('sendSMSConfig', 'execEngine');
$username = $config['username'];
$password = $config['password'];
$sender = $config['sender'];
Notifications::addLog('Username = ' . $username, 'ExecEngine');
// Set the Messabeird username and password, and create an instance of the MessageBird class
$sms = new MessageBird($username, $password);
// Set the sender, could be a number (16 numbers) or letters (11 characters)
$sms->setSender($sender);
// Add the destination mobile number.
// This method can be called several times to add have more then one recipient for the same message
$sms->addDestination($phonenumber);
//e.g. $sms->addDestination('31600000000');
// Set an reference, optional
// $sms->setReference('123456789');
// Set a schedule date-time, optional
// $sms->setTimestamp('2014-01-01 10:02');
// Replace non GSM-7 characters by appropriate valid GSM-7 characters
// $sms->setReplacechars(false);
// If you want a dlr notification of the message send to another url then that you have set on the web site, you can use this parameter. Don't forget to set a reference!
// $sms->setDlrUrl('http://www.example.com/dlr_url.php');
// If $test is TRUE, then the message is not actually sent or scheduled, and there will be no credits deducted.
// $sms->setTest(true);
// Send the message to the destination(s)
$sms->sendSms($message);
Notifications::addLog("ResponseCode: " . $sms->getResponseCode(), 'ExecEngine');
Notifications::addLog("ResponseMessage: " . $sms->getResponseMessage(), 'ExecEngine');
Notifications::addLog("Balance: " . $sms->getCreditBalance(), 'ExecEngine');
}
示例4: CreateCvrMsgTitle
function CreateCvrMsgTitle($nonce)
{
if (!$nonce) {
throw new Exception("CreateCvrMsgTitle - cannot make TITLE as no nonce is provided", 500);
}
Notifications::addLog('Created a challenge message for CEPValidation using [' . $nonce, 'MESSAGING');
return 'Validation code: ' . $nonce;
}
示例5: ParseFile
public function ParseFile()
{
Notifications::addLog('------------------------- EXCEL IMPORT STARTED -------------------------', 'ExcelImport');
$this->ProcessFileContent();
Notifications::addLog('------------------------- END OF EXCEL IMPORT -------------------------', 'ExcelImport');
// Close transaction => ROLLBACK or COMMIT.
$this->db->closeTransaction('File uploaded', false, true, false);
return Notifications::getAll();
}
示例6: addHook
public static function addHook($hookpoint, $hook)
{
Hooks::$hooks[$hookpoint][] = $hook;
if ($hook['class']) {
$log = $hook['class'] . '::';
}
$log .= $hook['function'] . '(';
$log .= implode(', ', $hook['params']) . ')';
Notifications::addLog("Hook {$log} added to {$hookpoint}", 'Hooks');
}
示例7: pushNotification
private static function pushNotification($userKey, $message, $title = null, $url = null, $urltitle = null)
{
Notifications::addLog('Pushalot - $userKey=[' . $userKey . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
if (is_null($userKey)) {
throw new Exception("Pushalot - User/API key not specified", 500);
}
$notification = new Pushalot($userKey);
//$pushalot->setProxy('http://localhost:12345','user:pass');
$success = $notification->sendMessage(array('Title' => $title, 'Body' => $message, 'IsImportant' => true, 'IsSilent' => false, 'Image' => 'http://wiki.tarski.nl/skins/common/images/AmpersandLogo.png', 'Source' => 'Ampersand prototype'));
if (!$success) {
Notifications::addError("Pushalot error '{$notification->getError}()' sending notification to '{$userKey}'");
} else {
Notifications::addSuccess('Pushalot message sent.');
}
}
示例8: TransitiveClosure
function TransitiveClosure($r, $C, $rCopy, $rStar)
{
if (func_num_args() != 4) {
throw new Exception("Wrong number of arguments supplied for function TransitiveClosure(): " . func_num_args() . " arguments", 500);
}
Notifications::addLog("Exeucte TransitiveClosure({$r},{$C},{$rCopy},{$rStar})", 'ExecEngine');
$warshallRunCount = $GLOBALS['ext']['ExecEngine']['functions']['warshall']['runCount'];
$execEngineRunCount = ExecEngine::$runCount;
if ($GLOBALS['ext']['ExecEngine']['functions']['warshall']['warshallRuleChecked'][$r]) {
if ($warshallRunCount == $execEngineRunCount) {
Notifications::addLog("Skipping TransitiveClosure({$r},{$C},{$rCopy},{$rStar})", 'ExecEngine');
return;
// this is the case if we have executed this function already in this transaction
}
}
$GLOBALS['ext']['ExecEngine']['functions']['warshall']['warshallRuleChecked'][$r] = true;
$GLOBALS['ext']['ExecEngine']['functions']['warshall']['runCount'] = ExecEngine::$runCount;
// Compute transitive closure following Warshall's algorithm
$closure = RetrievePopulation($r, $C);
// get adjacency matrix
OverwritePopulation($closure, $rCopy, $C);
// store it in the 'rCopy' relation
// Get all unique atoms from this population
$atoms = array_keys($closure);
// 'Src' (left) atoms of pairs in $closure
foreach ($closure as $tgtAtomsList) {
// Loop to add 'Tgt' atoms that not yet exist
$tgtAtoms = array_keys($tgtAtomsList);
foreach ($tgtAtoms as $tgtAtom) {
if (!in_array($tgtAtom, $atoms)) {
$atoms[] = $tgtAtom;
}
}
}
foreach ($atoms as $k) {
foreach ($atoms as $i) {
if ($closure[$i][$k]) {
foreach ($atoms as $j) {
$closure[$i][$j] = $closure[$i][$j] || $closure[$k][$j];
}
}
}
}
OverwritePopulation($closure, $rStar, $C);
}
示例9: SendEmail
function SendEmail($to, $subject, $message)
{
// adapted from http://phpmailer.worxware.com/?pg=examplebgmail
$config = Config::get('sendEmailConfig', 'execEngine');
$from = $config['from'];
$username = $config['username'];
$password = $config['password'];
Notifications::addLog('Username = ' . $username, 'ExecEngine');
$mail = new PHPMailer();
$mail->IsSMTP();
// Set mailer to use SMTP
// $mail->SMTPDebug = 1;
$mail->Host = 'smtp.gmail.com';
// Specify main and backup server
$mail->SMTPSecure = 'tls';
// Enable encryption, 'ssl' also accepted
$mail->Port = 587;
$mail->SMTPAuth = true;
// Enable SMTP authentication
$mail->Username = $username;
// SMTP username (for GMAIL)
$mail->Password = $password;
// SMTP password
$mail->From = $from;
$mail->FromName = 'Ampersand Prototype';
$mail->AddAddress($to);
// Add a recipient, e.g. $to = 'rieks.joosten@tno.nl', 'Rieks Joosten'
$mail->Subject = $subject;
$mail->Body = $message;
$mail->WordWrap = 50;
// Set word wrap to 50 characters
if (!$mail->Send()) {
Notifications::addError('Mailer Error: ' . $mail->ErrorInfo);
} else {
Notifications::addSuccess('Email message sent.');
}
}
示例10: getPairView
public static function getPairView($srcAtom, $srcConcept, $tgtAtom, $tgtConcept, $pairView)
{
$database = Database::singleton();
Notifications::addLog('Creating violation message', 'RuleEngine');
$pairStrs = array();
$interfaceIds = array();
foreach ($pairView as $segment) {
// interface segment
if ($segment['segmentType'] == 'Ifc') {
$interfaceIds = explode(';', $segment['Interfaces']);
// text segment
} elseif ($segment['segmentType'] == 'Text') {
$pairStrs[] = $segment['Text'];
// expressie segment
} elseif ($segment['segmentType'] == 'Exp') {
// select starting atom depending on whether the segment uses the src of tgt atom.
$atom = $segment['srcOrTgt'] == 'Src' ? $srcAtom : $tgtAtom;
// quering the expression
$atomEsc = $database->escape($atom);
$query = "SELECT DISTINCT `tgt` FROM ({$segment['expSQL']}) AS `results` WHERE `src` = '{$atomEsc}'";
// SRC of TGT kunnen door een expressie gevolgd worden
$rows = $database->Exe($query);
// returning the result
if (count($row) > 1) {
throw new Exception("Expression of pairview results in more than one tgt atom", 501);
}
// 501: Not implemented
$pairStrs[] = $rows[0]['tgt'];
// unknown segment
} else {
$errorMessage = "Unknown segmentType '" . $segment['segmentType'] . "' in pairview";
throw new Exception($errorMessage, 501);
// 501: Not implemented
}
}
return array('violationMessage' => implode($pairStrs), 'interfaceIds' => $interfaceIds);
}
示例11: checkAddressSyntax
public static function checkAddressSyntax($CEPAddress)
{
Notifications::addLog('Email checkAddressSyntax for [' . $CEPAddress . ']', 'MESSAGING');
if (!filter_var($CEPAddress, FILTER_VALIDATE_EMAIL) === false) {
Notifications::addLog('Email address is syntactically correct.', 'MESSAGING');
return $CEPAddress;
}
$message = 'Email adress [' . $CEPAddress . '] is syntactically incorrect';
Notifications::addError($message);
Notifications::addLog($message, 'MESSAGING');
return $message;
}
示例12: datimeGT
function datimeGT($gtRelation, $DateConcept, $srcAtom, $tgtAtom)
{
Notifications::addLog("datimeGT({$gtRelation},{$DateConcept},{$srcAtom},{$tgtAtom})", 'ExecEngine');
if (($dt1 = strtotime($srcAtom)) === false) {
Notifications::addError("datimeGT: Illegal date {$dt1} specified in srcAtom (3rd arg): {$srcAtom}");
}
if (($dt2 = strtotime($tgtAtom)) === false) {
Notifications::addError("datimeGT: Illegal date {$dt2} specified in tgtAtom (4th arg): {$tgtAtom}");
}
if ($dt1 == $dt2) {
return;
}
if ($dt1 > $dt2) {
InsPair($gtRelation, $DateConcept, $srcAtom, $DateConcept, $tgtAtom);
} else {
InsPair($gtRelation, $DateConcept, $tgtAtom, $DateConcept, $srcAtom);
}
return;
}
示例13: pushNotification
private static function pushNotification($SMSAddr, $message, $title = null, $url = null, $urltitle = null)
{
Notifications::addLog('UNTESTED !!! SMS[pushNotification' . ']; $SMSAddr=[' . $SMSAddr . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
/* Config params for SendSMS function of ExecEngine (using MessageBird.com)
* Set the sender, could be a number (16 numbers) or letters (11 characters)
*
*/
// Copy the following line to localSettings.php and provide settings
// Config::set('sendSMSConfig', 'execEngine', array('username' => '', 'password' => '', 'sender' => ''));
$config = Config::get('sendSMSConfig', 'msg_SMS');
$username = $config['username'];
$password = $config['password'];
$sender = $config['sender'];
Notifications::addLog('Username = ' . $username, 'MESSAGING');
// Set the Messagebird username and password, and create an instance of the MessageBird class
$sms = new MessageBird($username, $password);
// Set the sender, could be a number (16 numbers) or letters (11 characters)
$sms->setSender($sender);
// Add the destination mobile number.
// This method can be called several times to add have more then one recipient for the same message
$sms->addDestination($SMSAddr);
//e.g. $sms->addDestination('31600000000');
// Set an reference, optional
// $sms->setReference('123456789');
// Set a schedule date-time, optional
// $sms->setTimestamp('2014-01-01 10:02');
// Replace non GSM-7 characters by appropriate valid GSM-7 characters
// $sms->setReplacechars(false);
// If you want a dlr notification of the message send to another url then that you have set on the web site, you can use this parameter. Don't forget to set a reference!
// $sms->setDlrUrl('http://www.example.com/dlr_url.php');
// If $test is TRUE, then the message is not actually sent or scheduled, and there will be no credits deducted.
Notifications::addLog("SMS testing is set to TRUE (messages are not actually sent)", 'MESSAGING');
$sms->setTest(true);
// Send the message to the destination(s)
$sms->sendSms($message);
if ($sms->getResponseCode() == "01") {
Notifications::addSuccess('SMS message sent.');
} else {
Notifications::addError('SMS error: ' . $sms->getResponseMessage());
}
Notifications::addLog("SMS Response: " . $sms->getResponseMessage(), 'MESSAGING');
Notifications::addLog("SMS Balance: " . $sms->getCreditBalance(), 'MESSAGING');
}
示例14: pushNotification
private static function pushNotification($emailAddr, $message, $title = null, $url = null, $urltitle = null)
{
Notifications::addLog('Email[pushNotification' . ']; $emailAddr=[' . $emailAddr . ']; $message=[' . $message . ']; $title=[' . $title . ']; $url=[' . $url . ']; $urltitle=[' . $urltitle . ']', 'MESSAGING');
// adapted from http://phpmailer.worxware.com/?pg=examplebgmail
$config = Config::get('sendEmailConfig', 'msg_email');
$from = $config['from'];
$username = $config['username'];
$password = $config['password'];
Notifications::addLog('Email.php - Username = ' . $username, 'MESSAGING');
$mail = new PHPMailer();
$mail->IsSMTP();
// Set mailer to use SMTP
// $mail->SMTPDebug = 1;
$mail->Host = 'smtp.gmail.com';
// Specify main and backup server
$mail->SMTPSecure = 'ssl';
// Enable encryption, 'ssl' also accepted
$mail->Port = 465;
$mail->SMTPAuth = true;
// Enable SMTP authentication
$mail->Username = $username;
// SMTP username (for GMAIL)
$mail->Password = $password;
// SMTP password
$mail->From = $from;
$mail->FromName = 'Ampersand Prototype';
$mail->AddAddress($emailAddr);
// Add a recipient, e.g. $to = 'rieks.joosten@tno.nl', 'Rieks Joosten'
$mail->Subject = $title;
// $message = $message . 'optional URL';
if ($url != '_NULL' && $url != '') {
$mail->IsHTML(true);
// make sure we send in HTML
if ($urltitle != '_NULL' && $urltitle != '') {
$message = '<p>' . $message . '</p><p><a href=' . $url . '>' . $urltitle . '</a></p>';
} else {
$message = $message . '<a' . $urltitle . '</a>';
}
Notifications::addLog('Email message refactored to: [' . $message . ']', 'MESSAGING');
}
$mail->Body = $message;
$mail->WordWrap = 50;
// Set word wrap to 50 characters
if (!$mail->Send()) {
Notifications::addError('Mailer Error: ' . $mail->ErrorInfo);
} else {
Notifications::addSuccess('Email message sent.');
}
}
示例15: CreateCvrMsgTitle
function CreateCvrMsgTitle($Nonce)
{
Notifications::addLog('Created a challenge message for CEPValidation using [' . $Nonce, 'MESSAGING');
return 'Validation code: ' . $Nonce;
}