本文整理汇总了PHP中Notification::notifications方法的典型用法代码示例。如果您正苦于以下问题:PHP Notification::notifications方法的具体用法?PHP Notification::notifications怎么用?PHP Notification::notifications使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::notifications方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Notification
<ul>
<li class="selected-option"><a href="./">Recent Activity</a></li>
<li><a href="friend-requests.php">Friend Requests</a></li>
<li><a href="my-friends.php">Friends</a></li>
<li><a href="search.php">Search</a></li>
</ul>
</div>
<div id="main-container" class="page">
<h2 class="title">Recent Activity</h2>
<?php
include 'includes/alerts.php';
?>
<?php
$activity = new Notification();
if ($activity->get($user->data()->id)) {
$notifications = $activity->notifications();
?>
<?php
foreach ($notifications as $notification) {
?>
<div class="notification">
<div class="picture">
<a href="profile.php?user=<?php
echo $notification['username'];
?>
"><img src="<?php
echo $notification['profilePicture'];
?>
"></a>
</div>
<div class="message">
示例2: init
/**
* Initializes the Notification service.
*
* <code>
* Notification::init();
* </code>
*
* This will read notification/flash data from the $_SESSION variable and load it into
* the $this->previous array.
*/
public static function init()
{
// Get notification/flash data...
if (!empty($_SESSION[Notification::SESSION_KEY]) && is_array($_SESSION[Notification::SESSION_KEY])) {
Notification::$notifications = $_SESSION[Notification::SESSION_KEY];
}
$_SESSION[Notification::SESSION_KEY] = array();
}
示例3: _unserialize
/**
* This function restores saved notifications. It also handles whether or
* not to clear not persisting notifications.
*
* @return array
*/
public static function _unserialize()
{
if (!isset(self::$notifications)) {
if (isset($_SESSION["Notifications"])) {
self::$notifications = $_SESSION["Notifications"];
foreach (self::$notifications as $notification) {
switch ($notification->persist) {
case 0:
unset(self::$notifications[$notification->id]);
break;
case 1:
$notification->persist = 0;
break;
}
if ($notification->id >= self::$next_id) {
self::$next_id = $notification->id + 1;
}
}
} else {
self::$notifications = array();
}
}
$_SESSION["Notifications"] = self::$notifications;
return self::$notifications;
}