@@ -173,7 +173,7 @@ |
||
173 | 173 | } |
174 | 174 | |
175 | 175 | $entry = Multi_Entry::from_entries( array_filter( $multientry ) ); |
176 | - } else { |
|
176 | + } else { |
|
177 | 177 | /** |
178 | 178 | * A regular one. |
179 | 179 | */ |
@@ -61,14 +61,16 @@ discard block |
||
61 | 61 | $value = $this->get_value( $atts ); |
62 | 62 | |
63 | 63 | if ( false === $operator && is_null( $value ) ) { |
64 | - if ( false !== $atts['if'] ) { // Only-if test |
|
64 | + if ( false !== $atts['if'] ) { |
|
65 | +// Only-if test |
|
65 | 66 | $match = $authed && ! in_array( strtolower( $atts['if'] ), array( '', '0', 'false', 'no' ) ); |
66 | 67 | } else { |
67 | 68 | $match = $authed; // Just login test |
68 | 69 | } |
69 | 70 | |
70 | 71 | $output = $this->get_output( $match, $atts, $content ); |
71 | - } else { // Regular test |
|
72 | + } else { |
|
73 | +// Regular test |
|
72 | 74 | |
73 | 75 | $output = $content; |
74 | 76 | |
@@ -199,12 +201,15 @@ discard block |
||
199 | 201 | $opens = 0; // inner opens |
200 | 202 | $found = false; // found split position |
201 | 203 | |
202 | - while ( $content ) { // scan |
|
204 | + while ( $content ) { |
|
205 | +// scan |
|
203 | 206 | |
204 | 207 | if ( ! preg_match( '#(.*?)(\[\/?(gvlogic|else).*?])(.*)#s', $content, $matches ) ) { |
205 | - if ( ! $found ) { // We're still iffing. |
|
208 | + if ( ! $found ) { |
|
209 | +// We're still iffing. |
|
206 | 210 | $if .= $content; |
207 | - } else { // We are elsing |
|
211 | + } else { |
|
212 | +// We are elsing |
|
208 | 213 | $else .= $content; |
209 | 214 | } |
210 | 215 | break; // No more shortcodes |
@@ -212,9 +217,11 @@ discard block |
||
212 | 217 | |
213 | 218 | list( $_, $before_shortcode, $shortcode, $_, $after_shortcode ) = $matches; |
214 | 219 | |
215 | - if ( ! $found ) { // We're still iffing. |
|
220 | + if ( ! $found ) { |
|
221 | +// We're still iffing. |
|
216 | 222 | $if .= $before_shortcode; |
217 | - } else { // We are elsing |
|
223 | + } else { |
|
224 | +// We are elsing |
|
218 | 225 | $else .= $before_shortcode; |
219 | 226 | } |
220 | 227 | |
@@ -238,9 +245,11 @@ discard block |
||
238 | 245 | } |
239 | 246 | |
240 | 247 | // Tack on the shortcode |
241 | - if ( ! $found ) { // We're still iffing. |
|
248 | + if ( ! $found ) { |
|
249 | +// We're still iffing. |
|
242 | 250 | $if .= $shortcode; |
243 | - } else { // We are elsing |
|
251 | + } else { |
|
252 | +// We are elsing |
|
244 | 253 | $else .= $shortcode; |
245 | 254 | } |
246 | 255 | } |
@@ -15,8 +15,7 @@ discard block |
||
15 | 15 | * reduce boilerplate code that a simple Logger that does the same thing with |
16 | 16 | * messages regardless of the error level has to implement. |
17 | 17 | */ |
18 | -abstract class AbstractLogger implements LoggerInterface |
|
19 | -{ |
|
18 | +abstract class AbstractLogger implements LoggerInterface { |
|
20 | 19 | /** |
21 | 20 | * System is unusable. |
22 | 21 | * |
@@ -25,8 +24,7 @@ discard block |
||
25 | 24 | * |
26 | 25 | * @return void |
27 | 26 | */ |
28 | - public function emergency($message, array $context = array()) |
|
29 | - { |
|
27 | + public function emergency($message, array $context = array()) { |
|
30 | 28 | $this->log(LogLevel::EMERGENCY, $message, $context); |
31 | 29 | } |
32 | 30 | |
@@ -41,8 +39,7 @@ discard block |
||
41 | 39 | * |
42 | 40 | * @return void |
43 | 41 | */ |
44 | - public function alert($message, array $context = array()) |
|
45 | - { |
|
42 | + public function alert($message, array $context = array()) { |
|
46 | 43 | $this->log(LogLevel::ALERT, $message, $context); |
47 | 44 | } |
48 | 45 | |
@@ -56,8 +53,7 @@ discard block |
||
56 | 53 | * |
57 | 54 | * @return void |
58 | 55 | */ |
59 | - public function critical($message, array $context = array()) |
|
60 | - { |
|
56 | + public function critical($message, array $context = array()) { |
|
61 | 57 | $this->log(LogLevel::CRITICAL, $message, $context); |
62 | 58 | } |
63 | 59 | |
@@ -70,8 +66,7 @@ discard block |
||
70 | 66 | * |
71 | 67 | * @return void |
72 | 68 | */ |
73 | - public function error($message, array $context = array()) |
|
74 | - { |
|
69 | + public function error($message, array $context = array()) { |
|
75 | 70 | $this->log(LogLevel::ERROR, $message, $context); |
76 | 71 | } |
77 | 72 | |
@@ -86,8 +81,7 @@ discard block |
||
86 | 81 | * |
87 | 82 | * @return void |
88 | 83 | */ |
89 | - public function warning($message, array $context = array()) |
|
90 | - { |
|
84 | + public function warning($message, array $context = array()) { |
|
91 | 85 | $this->log(LogLevel::WARNING, $message, $context); |
92 | 86 | } |
93 | 87 | |
@@ -99,8 +93,7 @@ discard block |
||
99 | 93 | * |
100 | 94 | * @return void |
101 | 95 | */ |
102 | - public function notice($message, array $context = array()) |
|
103 | - { |
|
96 | + public function notice($message, array $context = array()) { |
|
104 | 97 | $this->log(LogLevel::NOTICE, $message, $context); |
105 | 98 | } |
106 | 99 | |
@@ -114,8 +107,7 @@ discard block |
||
114 | 107 | * |
115 | 108 | * @return void |
116 | 109 | */ |
117 | - public function info($message, array $context = array()) |
|
118 | - { |
|
110 | + public function info($message, array $context = array()) { |
|
119 | 111 | $this->log(LogLevel::INFO, $message, $context); |
120 | 112 | } |
121 | 113 | |
@@ -127,8 +119,7 @@ discard block |
||
127 | 119 | * |
128 | 120 | * @return void |
129 | 121 | */ |
130 | - public function debug($message, array $context = array()) |
|
131 | - { |
|
122 | + public function debug($message, array $context = array()) { |
|
132 | 123 | $this->log(LogLevel::DEBUG, $message, $context); |
133 | 124 | } |
134 | 125 | } |
@@ -11,8 +11,7 @@ discard block |
||
11 | 11 | /** |
12 | 12 | * Basic Implementation of LoggerAwareInterface. |
13 | 13 | */ |
14 | -trait LoggerAwareTrait |
|
15 | -{ |
|
14 | +trait LoggerAwareTrait { |
|
16 | 15 | /** |
17 | 16 | * The logger instance. |
18 | 17 | * |
@@ -25,8 +24,7 @@ discard block |
||
25 | 24 | * |
26 | 25 | * @param LoggerInterface $logger |
27 | 26 | */ |
28 | - public function setLogger(LoggerInterface $logger) |
|
29 | - { |
|
27 | + public function setLogger(LoggerInterface $logger) { |
|
30 | 28 | $this->logger = $logger; |
31 | 29 | } |
32 | 30 | } |
@@ -11,8 +11,7 @@ |
||
11 | 11 | /** |
12 | 12 | * Describes a logger-aware instance. |
13 | 13 | */ |
14 | -interface LoggerAwareInterface |
|
15 | -{ |
|
14 | +interface LoggerAwareInterface { |
|
16 | 15 | /** |
17 | 16 | * Sets a logger instance on the object. |
18 | 17 | * |
@@ -11,8 +11,7 @@ |
||
11 | 11 | /** |
12 | 12 | * Describes log levels. |
13 | 13 | */ |
14 | -class LogLevel |
|
15 | -{ |
|
14 | +class LogLevel { |
|
16 | 15 | const EMERGENCY = 'emergency'; |
17 | 16 | const ALERT = 'alert'; |
18 | 17 | const CRITICAL = 'critical'; |
@@ -16,8 +16,7 @@ discard block |
||
16 | 16 | * is a good way to avoid littering your code with `if ($this->logger) { }` |
17 | 17 | * blocks. |
18 | 18 | */ |
19 | -class NullLogger extends AbstractLogger |
|
20 | -{ |
|
19 | +class NullLogger extends AbstractLogger { |
|
21 | 20 | /** |
22 | 21 | * Logs with an arbitrary level. |
23 | 22 | * |
@@ -29,8 +28,7 @@ discard block |
||
29 | 28 | * |
30 | 29 | * @throws \GravityView\Psr\Log\InvalidArgumentException |
31 | 30 | */ |
32 | - public function log($level, $message, array $context = array()) |
|
33 | - { |
|
31 | + public function log($level, $message, array $context = array()) { |
|
34 | 32 | // noop |
35 | 33 | } |
36 | 34 | } |
@@ -16,8 +16,7 @@ discard block |
||
16 | 16 | * reduce boilerplate code that a simple Logger that does the same thing with |
17 | 17 | * messages regardless of the error level has to implement. |
18 | 18 | */ |
19 | -trait LoggerTrait |
|
20 | -{ |
|
19 | +trait LoggerTrait { |
|
21 | 20 | /** |
22 | 21 | * System is unusable. |
23 | 22 | * |
@@ -26,8 +25,7 @@ discard block |
||
26 | 25 | * |
27 | 26 | * @return void |
28 | 27 | */ |
29 | - public function emergency($message, array $context = array()) |
|
30 | - { |
|
28 | + public function emergency($message, array $context = array()) { |
|
31 | 29 | $this->log(LogLevel::EMERGENCY, $message, $context); |
32 | 30 | } |
33 | 31 | |
@@ -42,8 +40,7 @@ discard block |
||
42 | 40 | * |
43 | 41 | * @return void |
44 | 42 | */ |
45 | - public function alert($message, array $context = array()) |
|
46 | - { |
|
43 | + public function alert($message, array $context = array()) { |
|
47 | 44 | $this->log(LogLevel::ALERT, $message, $context); |
48 | 45 | } |
49 | 46 | |
@@ -57,8 +54,7 @@ discard block |
||
57 | 54 | * |
58 | 55 | * @return void |
59 | 56 | */ |
60 | - public function critical($message, array $context = array()) |
|
61 | - { |
|
57 | + public function critical($message, array $context = array()) { |
|
62 | 58 | $this->log(LogLevel::CRITICAL, $message, $context); |
63 | 59 | } |
64 | 60 | |
@@ -71,8 +67,7 @@ discard block |
||
71 | 67 | * |
72 | 68 | * @return void |
73 | 69 | */ |
74 | - public function error($message, array $context = array()) |
|
75 | - { |
|
70 | + public function error($message, array $context = array()) { |
|
76 | 71 | $this->log(LogLevel::ERROR, $message, $context); |
77 | 72 | } |
78 | 73 | |
@@ -87,8 +82,7 @@ discard block |
||
87 | 82 | * |
88 | 83 | * @return void |
89 | 84 | */ |
90 | - public function warning($message, array $context = array()) |
|
91 | - { |
|
85 | + public function warning($message, array $context = array()) { |
|
92 | 86 | $this->log(LogLevel::WARNING, $message, $context); |
93 | 87 | } |
94 | 88 | |
@@ -100,8 +94,7 @@ discard block |
||
100 | 94 | * |
101 | 95 | * @return void |
102 | 96 | */ |
103 | - public function notice($message, array $context = array()) |
|
104 | - { |
|
97 | + public function notice($message, array $context = array()) { |
|
105 | 98 | $this->log(LogLevel::NOTICE, $message, $context); |
106 | 99 | } |
107 | 100 | |
@@ -115,8 +108,7 @@ discard block |
||
115 | 108 | * |
116 | 109 | * @return void |
117 | 110 | */ |
118 | - public function info($message, array $context = array()) |
|
119 | - { |
|
111 | + public function info($message, array $context = array()) { |
|
120 | 112 | $this->log(LogLevel::INFO, $message, $context); |
121 | 113 | } |
122 | 114 | |
@@ -128,8 +120,7 @@ discard block |
||
128 | 120 | * |
129 | 121 | * @return void |
130 | 122 | */ |
131 | - public function debug($message, array $context = array()) |
|
132 | - { |
|
123 | + public function debug($message, array $context = array()) { |
|
133 | 124 | $this->log(LogLevel::DEBUG, $message, $context); |
134 | 125 | } |
135 | 126 |
@@ -60,8 +60,7 @@ discard block |
||
60 | 60 | * @method bool hasInfoThatPasses($message) |
61 | 61 | * @method bool hasDebugThatPasses($message) |
62 | 62 | */ |
63 | -class TestLogger extends AbstractLogger |
|
64 | -{ |
|
63 | +class TestLogger extends AbstractLogger { |
|
65 | 64 | /** |
66 | 65 | * @var array |
67 | 66 | */ |
@@ -72,8 +71,7 @@ discard block |
||
72 | 71 | /** |
73 | 72 | * @inheritdoc |
74 | 73 | */ |
75 | - public function log($level, $message, array $context = []) |
|
76 | - { |
|
74 | + public function log($level, $message, array $context = []) { |
|
77 | 75 | $record = [ |
78 | 76 | 'level' => $level, |
79 | 77 | 'message' => $message, |
@@ -84,13 +82,11 @@ discard block |
||
84 | 82 | $this->records[] = $record; |
85 | 83 | } |
86 | 84 | |
87 | - public function hasRecords($level) |
|
88 | - { |
|
85 | + public function hasRecords($level) { |
|
89 | 86 | return isset($this->recordsByLevel[$level]); |
90 | 87 | } |
91 | 88 | |
92 | - public function hasRecord($record, $level) |
|
93 | - { |
|
89 | + public function hasRecord($record, $level) { |
|
94 | 90 | if (is_string($record)) { |
95 | 91 | $record = ['message' => $record]; |
96 | 92 | } |
@@ -105,22 +101,19 @@ discard block |
||
105 | 101 | }, $level); |
106 | 102 | } |
107 | 103 | |
108 | - public function hasRecordThatContains($message, $level) |
|
109 | - { |
|
104 | + public function hasRecordThatContains($message, $level) { |
|
110 | 105 | return $this->hasRecordThatPasses(function ($rec) use ($message) { |
111 | 106 | return strpos($rec['message'], $message) !== false; |
112 | 107 | }, $level); |
113 | 108 | } |
114 | 109 | |
115 | - public function hasRecordThatMatches($regex, $level) |
|
116 | - { |
|
110 | + public function hasRecordThatMatches($regex, $level) { |
|
117 | 111 | return $this->hasRecordThatPasses(function ($rec) use ($regex) { |
118 | 112 | return preg_match($regex, $rec['message']) > 0; |
119 | 113 | }, $level); |
120 | 114 | } |
121 | 115 | |
122 | - public function hasRecordThatPasses(callable $predicate, $level) |
|
123 | - { |
|
116 | + public function hasRecordThatPasses(callable $predicate, $level) { |
|
124 | 117 | if (!isset($this->recordsByLevel[$level])) { |
125 | 118 | return false; |
126 | 119 | } |
@@ -132,8 +125,7 @@ discard block |
||
132 | 125 | return false; |
133 | 126 | } |
134 | 127 | |
135 | - public function __call($method, $args) |
|
136 | - { |
|
128 | + public function __call($method, $args) { |
|
137 | 129 | if (preg_match('/(.*)(Debug|Info|Notice|Warning|Error|Critical|Alert|Emergency)(.*)/', $method, $matches) > 0) { |
138 | 130 | $genericMethod = $matches[1] . ('Records' !== $matches[3] ? 'Record' : '') . $matches[3]; |
139 | 131 | $level = strtolower($matches[2]); |
@@ -145,8 +137,7 @@ discard block |
||
145 | 137 | throw new \BadMethodCallException('Call to undefined method ' . get_class($this) . '::' . $method . '()'); |
146 | 138 | } |
147 | 139 | |
148 | - public function reset() |
|
149 | - { |
|
140 | + public function reset() { |
|
150 | 141 | $this->records = []; |
151 | 142 | $this->recordsByLevel = []; |
152 | 143 | } |