PluginProbe
Advanced Access Manager – Access Governance for WordPress / 6.9.0
Advanced Access Manager – Access Governance for WordPress v6.9.0
7.1.4 7.1.2 7.1.3 6.8.4 6.8.5 6.9.0 6.9.1 6.9.10 6.9.11 6.9.12 6.9.13 6.9.14 6.9.15 6.9.16 6.9.17 6.9.18 6.9.19 6.9.2 6.9.20 6.9.21 6.9.22 6.9.23 6.9.24 6.9.25 6.9.26 All 210 releases
advanced-access-manager / application / Core / Console.php
Console.php
89 lines 2.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * ======================================================================
5 * LICENSE: This file is subject to the terms and conditions defined in *
6 * file 'license.txt', which is part of this source code package. *
7 * ======================================================================
8 *
9 * @version 6.0.0
10 */
11
12 /**
13 * AAM Core notification consol
14 *
15 * Track and display list of all warnings that has been detected during AAM
16 * execution. The consol is used only when AAM interface was triggered in Admin side.
17 *
18 * @package AAM
19 * @version 6.0.0
20 */
21 class AAM_Core_Console
22 {
23
24 /**
25 * List of Runtime errors related to AAM
26 *
27 * @var array
28 *
29 * @access private
30 * @version 6.0.0
31 */
32 private static $_messages = array();
33
34 /**
35 * Add new warning
36 *
37 * @param string $message
38 * @param string $args...
39 *
40 * @return void
41 *
42 * @access public
43 * @version 6.0.0
44 */
45 public static function add($message)
46 {
47 //prepare search patterns
48 $num = func_num_args();
49 $search = ($num > 1 ? array_fill(0, ($num - 1) * 2, null) : array());
50
51 array_walk($search, function (&$value, $index) {
52 $value = '/\\' . ($index % 2 ? ']' : '[') . '/';
53 });
54
55 $replace = array();
56 foreach (array_slice(func_get_args(), 1) as $key) {
57 array_push($replace, "<{$key}>", "</{$key}>");
58 }
59
60 self::$_messages[] = preg_replace($search, $replace, $message, 1);
61 }
62
63 /**
64 * Get list of all warnings
65 *
66 * @return array
67 *
68 * @access public
69 * @version 6.0.0
70 */
71 public static function getAll()
72 {
73 return self::$_messages;
74 }
75
76 /**
77 * Count the list of all notifications
78 *
79 * @return int
80 *
81 * @access public
82 * @version 6.0.0
83 */
84 public static function count()
85 {
86 return count(self::$_messages);
87 }
88
89 }