You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: build/shortpixel/notices/src/NoticeModel.php
+58-4Lines changed: 58 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,7 @@
4
4
class NoticeModel //extends ShortPixelModel
5
5
{
6
6
public$message; // The message we want to convey.
7
+
public$details = array(); // extra details, like the files involved. Something could be hideable in the future.
7
8
public$code;
8
9
9
10
private$id = null; // used for persistent messages.
@@ -16,6 +17,7 @@ class NoticeModel //extends ShortPixelModel
16
17
public$messageType = self::NOTICE_NORMAL;
17
18
18
19
public$notice_action; // empty unless for display. Ajax action to talk back to controller.
20
+
protected$callback; // empty unless callback is needed
19
21
20
22
publicstatic$icons = array();
21
23
@@ -82,16 +84,33 @@ public function setDismissedUntil($timestamp)
82
84
$this->suppress_until = $timestamp;
83
85
}
84
86
87
+
/** Support for extra information beyond the message.
88
+
* Can help to not overwhelm users w/ the same message but different file /circumstances.
89
+
*/
90
+
publicfunctionaddDetail($detail, $clean = false)
91
+
{
92
+
if ($clean)
93
+
$this->details = array();
94
+
95
+
if (! in_array($detail, $this->details) )
96
+
$this->details[] = $detail;
97
+
}
98
+
99
+
85
100
86
101
/** Set a notice persistent. Meaning it shows every page load until dismissed.
87
102
* @param $key Unique Key of this message. Required
88
103
* @param $suppress When dismissed do not show this message again for X amount of time. When -1 it will just be dropped from the Notices and not suppressed
0 commit comments