Add notification to queue.

@param array $all_notifications Previous notification.

@return array All notifications.
8175
public function add_notification( $all_notifications ) {

		$developers = [
			'Bogdan',
			'Marius',
			'Hardeep',
			'Rodica',
			'Stefan',
			'Uriahs',
			'Madalin',
			'Radu',
			'Silviu',
			'Andrei',
		];

		$link = 'https://wordpress.org/support/' . $this->product->get_type() . '/' . $this->product->get_slug() . '/reviews/#wporg-footer';

		$message = apply_filters( $this->product->get_key() . '_feedback_review_message', '<p>Hey, it’s great to see you have <b>{product}</b> active for a few days now. How is everything going? If you can spare a few moments to rate it on WordPress.org it would help us a lot (and boost my motivation). Cheers! <br/> <br/>~ {developer}, developer of {product}</p>' );

		$button_submit = apply_filters( $this->product->get_key() . '_feedback_review_button_do', 'Ok, I will gladly help.' );
		$button_cancel = apply_filters( $this->product->get_key() . '_feedback_review_button_cancel', 'No, thanks.' );
		$message       = str_replace(
			[ '{product}', '{developer}' ],
			[
				$this->product->get_friendly_name(),
				$developers[ strlen( get_site_url() ) % 10 ],
			],
			$message
		);

		$all_notifications[] = [
			'id'      => $this->product->get_key() . '_review_flag',
			'message' => $message,
			'ctas'    => [
				'confirm' => [
					'link' => $link,
					'text' => $button_submit,
				],
				'cancel'  => [
					'link' => '#',
					'text' => $button_cancel,
				],
			],
		];

		return $all_notifications;
	}
161279
public function notifynderNotifications()
    {
        $model = app('notifynder.resolver.model')->getModel(Notification::class);
        if (notifynder_config()->isPolymorphic()) {
            return $this->morphMany($model, 'to');
        }

        return $this->hasMany($model, 'to_id');
    }
995142
public function registerSenders()
    {
        app('notifynder')->extend('sendSingle', function (array $notifications) {
            return new SingleSender($notifications);
        });

        app('notifynder')->extend('sendMultiple', function (array $notifications) {
            return new MultipleSender($notifications);
        });

        app('notifynder')->extend('sendOnce', function (array $notifications) {
            return new OnceSender($notifications);
        });
    }
269391
protected function _addNotificationMenu()
    {
        $this->Menu->area('headerLeft');

        $this->Menu->add('notifier.notifications', [
            'title' => __d('CakeAdmin', 'Notifications ({0})', $this->Notifier->countNotifications(null, true)),
            'url' => '#',
            'weight' => 5
        ]);

        $notifications = $this->Notifier->getNotifications(null, true);

        foreach ($notifications as $not) {
            $this->Menu->add('notifier.notifications.' . $not->id, [
                'parent' => 'notifier.notifications',
                'title' => $not->title,
                'url' => [
                    'prefix' => 'admin',
                    'plugin' => 'CakeAdmin',
                    'controller' => 'Notifications',
                    'action' => 'index'
                ]
            ]);
        }

        $this->Menu->add('notifier.notifications.url', [
            'parent' => 'notifier.notifications',
            'title' => '> ' . __d('CakeAdmin', 'All Notifications'),
            'url' => [
                'prefix' => 'admin',
                'plugin' => 'CakeAdmin',
                'controller' => 'Notifications',
                'action' => 'index'
            ]
        ]);
    }
1064559
public function markAsUnread(array $notifications)
    {
        $ids = $this->getIds($notifications);

        $this->whereIn($this->getKeyName(), $ids)->update(['read' => false, 'read_at' => null]);

        return $this->whereIn($this->getKeyName(), $ids)->get()->all();
    }
785795
protected function setNotificationsAsSent(array $notifications)
    {
        foreach ($notifications as $notification) {
            $notification->setSent(new \DateTime());
            $this->managerRegistry->getManager()->persist($notification);
        }
        $this->managerRegistry->getManager()->flush();
    }
1208473
private function get_notifications($user) : array {
        $notifications = $this->notifications;
        $discussion = $this->discussion;
        $forum = $this->forum;
        $renderer = $this->renderer;

        if ($forum->is_cutoff_date_reached()) {
            $notifications[] = (new notification(
                    get_string('cutoffdatereached', 'forum'),
                    notification::NOTIFY_INFO
            ))->set_show_closebutton();
        } else if ($forum->is_due_date_reached()) {
            $notifications[] = (new notification(
                    get_string('thisforumisdue', 'forum', userdate($forum->get_due_date())),
                    notification::NOTIFY_INFO
            ))->set_show_closebutton();
        } else if ($forum->has_due_date()) {
            $notifications[] = (new notification(
                    get_string('thisforumhasduedate', 'forum', userdate($forum->get_due_date())),
                    notification::NOTIFY_INFO
            ))->set_show_closebutton();
        }

        if ($forum->is_discussion_locked($discussion)) {
            $notifications[] = (new notification(
                get_string('discussionlocked', 'forum'),
                notification::NOTIFY_INFO
            ))
            ->set_extra_classes(['discussionlocked'])
            ->set_show_closebutton();
        }

        if ($forum->get_type() == 'qanda') {
            if ($this->capabilitymanager->must_post_before_viewing_discussion($user, $discussion)) {
                $notifications[] = (new notification(
                    get_string('qandanotify', 'forum')
                ))->set_show_closebutton(true);
            }
        }

        if ($forum->has_blocking_enabled()) {
            $notifications[] = (new notification(
                get_string('thisforumisthrottled', 'forum', [
                    'blockafter' => $forum->get_block_after(),
                    'blockperiod' => get_string('secondstotime' . $forum->get_block_period())
                ])
            ))->set_show_closebutton();
        }

        return array_map(function($notification) {
            return $notification->export_for_template($this->renderer);
        }, $notifications);
    }
1073223
public PushedNotifications getSuccessfulNotifications() {
		PushedNotifications filteredList = new PushedNotifications(this);
		for (PushedNotification notification : this) {
			if (notification.isSuccessful()) filteredList.add(notification);
		}
		return filteredList;
	}
1186245
function listNotifications(params, cb) {

  params.resourcePath = config.addURIParams(constants.NOTIFICATIONS_BASE_PATH, params);
  params.method = 'GET';
  params.data = params.data || {};
  mbaasRequest.admin(params, cb);
}
1321727
public function group($notifications)
    {
        $dates = array();
        $actor = $this->getTemplate()->getView()->actor;
        $timezone = pick($actor->timezone, 0);
        foreach ($notifications as $notification) {
            $current = AnDomainAttributeDate::getInstance()->addHours($timezone);
            $diff = $current->compare($notification->creationTime->addHours($timezone));

            if ($diff <= AnHelperDate::dayToSeconds('1')) {
                if ($current->day ==  $notification->creationTime->day) {
                    $key = AnTranslator::_('LIB-AN-DATE-TODAY');
                } else {
                    $key = AnTranslator::_('LIB-AN-DATE-DAY');
                }
            } else {
                $key = $this->getTemplate()->renderHelper('date.format', $notification->creationTime, array('format' => '%B %d'));
            }

            if (!isset($dates[$key])) {
                $dates[$key] = array();
            }

            $dates[$key][] = $notification;
        }

        return $dates;
    }
1318957
public function render(array $notifications)
    {
        $sweetAlerts = '';

        foreach ($notifications as $notification) {
            $message = $this->escapeMessage($notification['message']);
            $type    = $notification['type'];
            $title   = is_null($notification['title']) ? ucfirst($type) : $this->escapeTitle($notification['title']);

            $sweetAlerts = <<<TAG
    swal({
        title: '{$title}',
        text: '{$message}',
        type: '{$type}'
    });\n
TAG;
        }

        return $this->renderOutput($sweetAlerts);
    }
510294
public function addNotification($notification)
    {
        $this->_mixer->getRepository()
        ->registerCallback('before.update', array($this, 'resetStats'), array($this->_mixer));

        $this->_mixer->getRepository()
        ->registerCallback('before.update', array($this, 'removeOldNotifications'), array($this->_mixer));

        $ids = clone $this->notificationIds;
        $ids[] = $notification->id;
        $this->set('notificationIds', $ids);

        $ids = clone $this->newNotificationIds;
        $ids[] = $notification->id;
        $this->set('newNotificationIds', $ids);
    }
358422
public function listNotifications(bool $all = false, bool $participating = false, string $since = 'now',
                                      string $before = null): array
    {
        return $this->getApi()->request($this->getApi()->sprintf('/notifications?:args', http_build_query([
            'all'           => $all,
            'participating' => $participating,
            'since'         => (new DateTime($since))->format(DateTime::ATOM),
            'before'        => (new DateTime($before))->format(DateTime::ATOM)
        ])));
    }
799157
def notifications(self):
        """"""
        self.__init()
        items = []
        for n in self._notifications:
            if "id" in n:
                url = "%s/%s" % (self.root, n['id'])
                items.append(self.Notification(url=url,
                                               securityHandler=self._securityHandler,
                                               proxy_url=self._proxy_url,
                                               proxy_port=self._proxy_port))
        return items
980047
public function notify(array $devices, array $notification)
    {
        $headers = $this->getNotificationHeaders();
        $body = $this->getNotificationBody($devices, $notification);

        return $this->sendRequest($headers, $body);
    }
244904
def ShowNotifications(self, reset=True):
    """"""
    shown_notifications = self.Schema.SHOWN_NOTIFICATIONS()

    # Pending notifications first
    pending = self.Get(self.Schema.PENDING_NOTIFICATIONS, [])
    for notification in pending:
      shown_notifications.Append(notification)

    notifications = self.Get(self.Schema.SHOWN_NOTIFICATIONS, [])
    for notification in notifications:
      shown_notifications.Append(notification)

    # Shall we reset the pending notification state?
    if reset:
      self.Set(shown_notifications)
      self.Set(self.Schema.PENDING_NOTIFICATIONS())
      self.Flush()

    return shown_notifications
1305182
public void setNotifications(java.util.Collection<Notification> notifications) {
        if (notifications == null) {
            this.notifications = null;
            return;
        }

        this.notifications = new java.util.ArrayList<Notification>(notifications);
    }