/** * create instance of the object * @param string $className * @return ezcomNotificationManager */ public static function instance($className = null) { if (is_null($className)) { $ini = eZINI::instance('ezcomments.ini'); $className = $ini->variable('NotificationSettings', 'NotificationManagerClass'); } if (!isset(self::$instance)) { self::$instance = new $className(); } return self::$instance; }
/** * Test executeSending method via email * email account needed * NB: the user should be able to get one mail with 'email testing' as the subject * @return */ public function testExuecuteSending() { $subscriber = ezcomSubscriber::create(); $subscriber->setAttribute('email', '*****@*****.**'); $subscriber->store(); $notificationManager = ezcomNotificationManager::instance('ezcomNotificationEmailManager'); $notificationManager->executeSending('email testing!', 'email test subject', $subscriber); }
$subscriberList[] = ezcomSubscriber::fetch($subscription['subscriber_id']); } //fetch comment list $commentList = array(); foreach ($notifications as $notification) { // fetch comment object $comment = ezcomComment::fetch($notification['comment_id']); if (is_null($comment)) { $cli->output("Comment doesn't exist, delete the notification. Comment ID:" . $notification['comment_id']); $db->query('DELETE FROM ezcomment_notification WHERE id=' . $notification['id']); continue; } $commentList[] = $comment; } try { $notificationManager = ezcomNotificationManager::instance(); $commentsInOne = $ezcommentsINI->variable('NotificationSettings', 'CommentsInOne'); foreach ($subscriberList as $subscriber) { if ($commentsInOne !== 'true') { foreach ($commentList as $comment) { if ($comment->attribute('email') != $subscriber->attribute('email')) { $notificationManager->sendNotificationInMany($subscriber, $contentObject, $comment); if (!$isQuiet) { $cli->output('Email sent to ' . $subscriber->attribute('email')); } } } } else { $sendingMail = false; // if the comments are not made by one subscriber, send mail foreach ($commentList as $comment) {