@@ -192,43 +192,43 @@ |
||
192 | 192 | public function __toString() |
193 | 193 | { |
194 | 194 | if ($this->title) { |
195 | - $return[] = '<title>'.$this->title.'</title>'; |
|
195 | + $return[] = '<title>' . $this->title . '</title>'; |
|
196 | 196 | } |
197 | 197 | |
198 | 198 | $return[] = '<meta http-equiv="Content-Type" content="text/html;" />'; |
199 | - $return[] = '<meta charset="'.$this->charset.'">'; |
|
200 | - $return[] = '<meta http-equiv="content-language" content="'.$this->language.'" />'; |
|
199 | + $return[] = '<meta charset="' . $this->charset . '">'; |
|
200 | + $return[] = '<meta http-equiv="content-language" content="' . $this->language . '" />'; |
|
201 | 201 | |
202 | 202 | $return[] = '<meta name="viewport" |
203 | 203 | content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=0"/>'; |
204 | 204 | |
205 | 205 | if ($this->authors) { |
206 | - $return[] = '<meta name="author" content="'.implode(", ", $this->authors).'" />'; |
|
206 | + $return[] = '<meta name="author" content="' . implode(", ", $this->authors) . '" />'; |
|
207 | 207 | } |
208 | 208 | if ($this->publisher) { |
209 | - $return[] = '<meta name="publisher" content="'.$this->publisher.'" />'; |
|
209 | + $return[] = '<meta name="publisher" content="' . $this->publisher . '" />'; |
|
210 | 210 | } |
211 | 211 | if ($this->copyright) { |
212 | - $return[] = '<meta name="copyright" content="'.$this->copyright.'" />'; |
|
212 | + $return[] = '<meta name="copyright" content="' . $this->copyright . '" />'; |
|
213 | 213 | } |
214 | 214 | |
215 | - $return[] = '<meta name="robots" content="'.$this->robots.'" />'; |
|
215 | + $return[] = '<meta name="robots" content="' . $this->robots . '" />'; |
|
216 | 216 | |
217 | 217 | if ($this->keywords) { |
218 | - $return[] = '<meta name="keywords" content="'.implode(",", $this->keywords).'" />'; |
|
218 | + $return[] = '<meta name="keywords" content="' . implode(",", $this->keywords) . '" />'; |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | if (!empty($this->description)) { |
222 | - $return[] = '<meta name="description" content="'.$this->description.'" />'; |
|
222 | + $return[] = '<meta name="description" content="' . $this->description . '" />'; |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | if (!empty($this->verify_v1)) { |
226 | - $return[] = '<meta name="verify-v1" content="'.$this->verify_v1.'" />'; |
|
226 | + $return[] = '<meta name="verify-v1" content="' . $this->verify_v1 . '" />'; |
|
227 | 227 | } |
228 | 228 | |
229 | 229 | foreach ($this->feeds as $feed) { |
230 | 230 | $return[] = '<link rel="alternate" |
231 | - type="application/rss+xml" title="'.$feed->title.'" href="'.$feed->url.'" />'; |
|
231 | + type="application/rss+xml" title="'.$feed->title . '" href="' . $feed->url . '" />'; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | // $return[] = '<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />'; |
@@ -5,15 +5,15 @@ discard block |
||
5 | 5 | class Paginator extends AbstractHelper |
6 | 6 | { |
7 | 7 | |
8 | - protected $_url; |
|
8 | + protected $_url; |
|
9 | 9 | protected $_interval = []; |
10 | - protected $_paginator; |
|
11 | - protected $_viewPath = "/pagination"; |
|
10 | + protected $_paginator; |
|
11 | + protected $_viewPath = "/pagination"; |
|
12 | 12 | |
13 | - public function __call($name, $arguments) |
|
14 | - { |
|
15 | - return call_user_func_array(array($this->getPaginator(), $name), $arguments); |
|
16 | - } |
|
13 | + public function __call($name, $arguments) |
|
14 | + { |
|
15 | + return call_user_func_array(array($this->getPaginator(), $name), $arguments); |
|
16 | + } |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * @return \Nip_Record_Paginator |
@@ -30,75 +30,75 @@ discard block |
||
30 | 30 | return $this; |
31 | 31 | } |
32 | 32 | |
33 | - public function url($page) |
|
34 | - { |
|
35 | - $return = $this->_url; |
|
33 | + public function url($page) |
|
34 | + { |
|
35 | + $return = $this->_url; |
|
36 | 36 | $return = str_replace('&page=' . $this->getPaginator()->getPage(), '', $return); |
37 | 37 | $return = str_replace('&page=' . $this->getPaginator()->getPage(), '', $return); |
38 | 38 | $return = str_replace('page=' . $this->getPaginator()->getPage(), '', $return); |
39 | 39 | |
40 | - if ($page > 1) { |
|
41 | - $return = rtrim($return, "/"); |
|
40 | + if ($page > 1) { |
|
41 | + $return = rtrim($return, "/"); |
|
42 | 42 | |
43 | 43 | if (strpos($return, '?') === false) { |
44 | - $return .= '?page=' . $page; |
|
45 | - } else { |
|
46 | - $return .= '&page=' . $page; |
|
47 | - } |
|
44 | + $return .= '?page=' . $page; |
|
45 | + } else { |
|
46 | + $return .= '&page=' . $page; |
|
47 | + } |
|
48 | + } |
|
49 | + return $return; |
|
50 | + } |
|
51 | + |
|
52 | + public function render() |
|
53 | + { |
|
54 | + $return = ''; |
|
55 | + |
|
56 | + if ($this->getPaginator() && $this->getPaginator()->getPages() > 1) { |
|
57 | + $this->getView()->paginator = $this; |
|
58 | + $this->getView()->pages = $this->getPaginator()->getPages(); |
|
59 | + $this->getView()->page = $this->getPaginator()->getPage(); |
|
60 | + $this->getView()->interval = $this->getInterval(); |
|
61 | + |
|
62 | + $return = $this->getView()->load($this->_viewPath, array(), true); |
|
63 | + } |
|
64 | + |
|
65 | + return $return; |
|
66 | + } |
|
67 | + |
|
68 | + public function getInterval() |
|
69 | + { |
|
70 | + $this->interval['min'] = 1; |
|
71 | + $this->interval['max'] = $this->getPaginator()->getPages(); |
|
72 | + |
|
73 | + $pages = $this->interval['max']; |
|
74 | + $page = $this->getPaginator()->getPage(); |
|
75 | + |
|
76 | + if ($pages > 7) { |
|
77 | + if ($page <= 6) { |
|
78 | + $this->interval['min'] = 1; |
|
79 | + $this->interval['max'] = 7; |
|
80 | + } elseif ($pages - $page <= 5) { |
|
81 | + $this->interval['min'] = $pages - 6; |
|
82 | + $this->interval['max'] = $pages; |
|
83 | + } else { |
|
84 | + $this->interval['min'] = $page - 3; |
|
85 | + $this->interval['max'] = $page + 3; |
|
86 | + } |
|
48 | 87 | } |
49 | - return $return; |
|
50 | - } |
|
51 | - |
|
52 | - public function render() |
|
53 | - { |
|
54 | - $return = ''; |
|
55 | - |
|
56 | - if ($this->getPaginator() && $this->getPaginator()->getPages() > 1) { |
|
57 | - $this->getView()->paginator = $this; |
|
58 | - $this->getView()->pages = $this->getPaginator()->getPages(); |
|
59 | - $this->getView()->page = $this->getPaginator()->getPage(); |
|
60 | - $this->getView()->interval = $this->getInterval(); |
|
61 | - |
|
62 | - $return = $this->getView()->load($this->_viewPath, array(), true); |
|
63 | - } |
|
64 | - |
|
65 | - return $return; |
|
66 | - } |
|
67 | - |
|
68 | - public function getInterval() |
|
69 | - { |
|
70 | - $this->interval['min'] = 1; |
|
71 | - $this->interval['max'] = $this->getPaginator()->getPages(); |
|
72 | - |
|
73 | - $pages = $this->interval['max']; |
|
74 | - $page = $this->getPaginator()->getPage(); |
|
75 | - |
|
76 | - if ($pages > 7) { |
|
77 | - if ($page <= 6) { |
|
78 | - $this->interval['min'] = 1; |
|
79 | - $this->interval['max'] = 7; |
|
80 | - } elseif ($pages - $page <= 5) { |
|
81 | - $this->interval['min'] = $pages - 6; |
|
82 | - $this->interval['max'] = $pages; |
|
83 | - } else { |
|
84 | - $this->interval['min'] = $page - 3; |
|
85 | - $this->interval['max'] = $page + 3; |
|
86 | - } |
|
87 | - } |
|
88 | - |
|
89 | - return $this->interval; |
|
90 | - } |
|
91 | - |
|
92 | - public function setViewPath($view) |
|
93 | - { |
|
94 | - $this->_viewPath = $view; |
|
95 | - return $this; |
|
96 | - } |
|
97 | - |
|
98 | - public function setURL($url) |
|
99 | - { |
|
100 | - $this->_url = $url; |
|
101 | - return $this; |
|
102 | - } |
|
88 | + |
|
89 | + return $this->interval; |
|
90 | + } |
|
91 | + |
|
92 | + public function setViewPath($view) |
|
93 | + { |
|
94 | + $this->_viewPath = $view; |
|
95 | + return $this; |
|
96 | + } |
|
97 | + |
|
98 | + public function setURL($url) |
|
99 | + { |
|
100 | + $this->_url = $url; |
|
101 | + return $this; |
|
102 | + } |
|
103 | 103 | |
104 | 104 | } |
@@ -36,7 +36,7 @@ |
||
36 | 36 | { |
37 | 37 | $return = ''; |
38 | 38 | |
39 | - $items = (array)$items; |
|
39 | + $items = (array) $items; |
|
40 | 40 | |
41 | 41 | if (count($items)) { |
42 | 42 | if ($wrap) { |
@@ -18,7 +18,7 @@ |
||
18 | 18 | */ |
19 | 19 | public function hash($password) |
20 | 20 | { |
21 | - return md5($this->getSalt().$password); |
|
21 | + return md5($this->getSalt() . $password); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -237,8 +237,9 @@ discard block |
||
237 | 237 | public function toXML($data, $rootNodeName = 'ResultSet', &$xml = null) |
238 | 238 | { |
239 | 239 | // turn off compatibility mode as simple xml throws a wobbly if you don't. |
240 | - if (ini_get('zend.ze1_compatibility_mode') == 1) |
|
241 | - ini_set('zend.ze1_compatibility_mode', 0); |
|
240 | + if (ini_get('zend.ze1_compatibility_mode') == 1) { |
|
241 | + ini_set('zend.ze1_compatibility_mode', 0); |
|
242 | + } |
|
242 | 243 | |
243 | 244 | if (is_null($xml)) { |
244 | 245 | $xml = simplexml_load_string("<?xml version='1.0' encoding='utf-8'?><$rootNodeName />"); |
@@ -260,8 +261,9 @@ discard block |
||
260 | 261 | $node = $this->isAssoc($value) || $numeric ? $xml->addChild($key) : $xml; |
261 | 262 | |
262 | 263 | // recursive call |
263 | - if ($numeric) |
|
264 | - $key = 'anon'; |
|
264 | + if ($numeric) { |
|
265 | + $key = 'anon'; |
|
266 | + } |
|
265 | 267 | $this->toXML($value, $key, $node); |
266 | 268 | } else { |
267 | 269 | // add single node. |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | /** |
33 | 33 | * Return the first element in an array passing a given truth test. |
34 | 34 | * |
35 | - * @param array $array |
|
35 | + * @param Nip\Container\ServiceProviders\Providers\AbstractServiceProvider[] $array |
|
36 | 36 | * @param callable|null $callback |
37 | 37 | * @param mixed $default |
38 | 38 | * @return mixed |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | /** |
188 | 188 | * Fetch the same property for all the elements. |
189 | 189 | * |
190 | - * @param array|\Nip\Records\Collections\Collection $array |
|
190 | + * @param Nip\Records\Collections\Collection $array |
|
191 | 191 | * @param string $property |
192 | 192 | * @param bool|string $return |
193 | 193 | * @return array The property values |
@@ -258,7 +258,6 @@ discard block |
||
258 | 258 | * |
259 | 259 | * @param array $array |
260 | 260 | * @param array $params |
261 | - * @param string $key |
|
262 | 261 | * @return array |
263 | 262 | */ |
264 | 263 | public function findAll($array, $params, $returnKey = false) |
@@ -82,39 +82,39 @@ |
||
82 | 82 | return $string; |
83 | 83 | } |
84 | 84 | |
85 | - public function moneyFormat($number) |
|
86 | - { |
|
87 | - return money_format('%n', $number); |
|
88 | - } |
|
85 | + public function moneyFormat($number) |
|
86 | + { |
|
87 | + return money_format('%n', $number); |
|
88 | + } |
|
89 | 89 | |
90 | - public function cronoTimeInSeconds($time) |
|
91 | - { |
|
92 | - $parts = explode(':', $time); |
|
93 | - $seconds = array_pop($parts); |
|
94 | - $minutes = array_pop($parts); |
|
95 | - $hours = array_pop($parts); |
|
96 | - $days = array_pop($parts); |
|
97 | - |
|
98 | - return (($days*24 + $hours)*60 + $minutes)*60 + $seconds; |
|
99 | - } |
|
90 | + public function cronoTimeInSeconds($time) |
|
91 | + { |
|
92 | + $parts = explode(':', $time); |
|
93 | + $seconds = array_pop($parts); |
|
94 | + $minutes = array_pop($parts); |
|
95 | + $hours = array_pop($parts); |
|
96 | + $days = array_pop($parts); |
|
97 | + |
|
98 | + return (($days*24 + $hours)*60 + $minutes)*60 + $seconds; |
|
99 | + } |
|
100 | 100 | |
101 | - public function secondsInCronoTime($seconds) |
|
102 | - { |
|
103 | - if ($days = intval((floor($seconds / 86400)))) { |
|
101 | + public function secondsInCronoTime($seconds) |
|
102 | + { |
|
103 | + if ($days = intval((floor($seconds / 86400)))) { |
|
104 | 104 | $seconds = $seconds - $days*86400; |
105 | - $return .= ($return ? ':' : '') . str_pad($days, 2, 0,STR_PAD_LEFT); |
|
106 | - } |
|
107 | - if ($hours = intval((floor($seconds / 3600))) OR $return) { |
|
105 | + $return .= ($return ? ':' : '') . str_pad($days, 2, 0,STR_PAD_LEFT); |
|
106 | + } |
|
107 | + if ($hours = intval((floor($seconds / 3600))) OR $return) { |
|
108 | 108 | $seconds = $seconds - $hours*3600; |
109 | - $return .= ($return ? ':' : '') . str_pad($hours, 2, 0,STR_PAD_LEFT); |
|
110 | - } |
|
111 | - if ($minutes = intval((floor($seconds / 60))) OR $return) { |
|
112 | - $seconds = $seconds - $minutes*60; |
|
113 | - $return .= ($return ? ':' : '') . str_pad($minutes, 2, 0, STR_PAD_LEFT); |
|
114 | - } |
|
115 | - $seconds = round($seconds, 2); |
|
116 | - $return .= ($return ? ':' : '') . str_pad($seconds, 2, 0, STR_PAD_LEFT); |
|
109 | + $return .= ($return ? ':' : '') . str_pad($hours, 2, 0,STR_PAD_LEFT); |
|
110 | + } |
|
111 | + if ($minutes = intval((floor($seconds / 60))) OR $return) { |
|
112 | + $seconds = $seconds - $minutes*60; |
|
113 | + $return .= ($return ? ':' : '') . str_pad($minutes, 2, 0, STR_PAD_LEFT); |
|
114 | + } |
|
115 | + $seconds = round($seconds, 2); |
|
116 | + $return .= ($return ? ':' : '') . str_pad($seconds, 2, 0, STR_PAD_LEFT); |
|
117 | 117 | |
118 | - return $return; |
|
119 | - } |
|
118 | + return $return; |
|
119 | + } |
|
120 | 120 | } |
121 | 121 | \ No newline at end of file |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | |
75 | 75 | foreach ($matches as &$match) { |
76 | 76 | if (preg_match('/<(a|img)\b/', $match) && !preg_match('/(?:http|#|mailto)/', $match)) { |
77 | - $match = preg_replace('/^([^"]+")([^"]+)/', '$1'.$base.'$2', $match); |
|
77 | + $match = preg_replace('/^([^"]+")([^"]+)/', '$1' . $base . '$2', $match); |
|
78 | 78 | } |
79 | 79 | } |
80 | 80 | |
@@ -95,21 +95,21 @@ discard block |
||
95 | 95 | $hours = array_pop($parts); |
96 | 96 | $days = array_pop($parts); |
97 | 97 | |
98 | - return (($days*24 + $hours)*60 + $minutes)*60 + $seconds; |
|
98 | + return (($days * 24 + $hours) * 60 + $minutes) * 60 + $seconds; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | public function secondsInCronoTime($seconds) |
102 | 102 | { |
103 | 103 | if ($days = intval((floor($seconds / 86400)))) { |
104 | - $seconds = $seconds - $days*86400; |
|
105 | - $return .= ($return ? ':' : '') . str_pad($days, 2, 0,STR_PAD_LEFT); |
|
104 | + $seconds = $seconds - $days * 86400; |
|
105 | + $return .= ($return ? ':' : '') . str_pad($days, 2, 0, STR_PAD_LEFT); |
|
106 | 106 | } |
107 | 107 | if ($hours = intval((floor($seconds / 3600))) OR $return) { |
108 | - $seconds = $seconds - $hours*3600; |
|
109 | - $return .= ($return ? ':' : '') . str_pad($hours, 2, 0,STR_PAD_LEFT); |
|
108 | + $seconds = $seconds - $hours * 3600; |
|
109 | + $return .= ($return ? ':' : '') . str_pad($hours, 2, 0, STR_PAD_LEFT); |
|
110 | 110 | } |
111 | 111 | if ($minutes = intval((floor($seconds / 60))) OR $return) { |
112 | - $seconds = $seconds - $minutes*60; |
|
112 | + $seconds = $seconds - $minutes * 60; |
|
113 | 113 | $return .= ($return ? ':' : '') . str_pad($minutes, 2, 0, STR_PAD_LEFT); |
114 | 114 | } |
115 | 115 | $seconds = round($seconds, 2); |
@@ -62,8 +62,7 @@ |
||
62 | 62 | // This is why we use urldecode and then normalize to |
63 | 63 | // RFC 3986 with rawurlencode. |
64 | 64 | $parts[] = isset($keyValuePair[1]) ? |
65 | - rawurlencode(urldecode($keyValuePair[0])) . '=' . rawurlencode(urldecode($keyValuePair[1])) : |
|
66 | - rawurlencode(urldecode($keyValuePair[0])); |
|
65 | + rawurlencode(urldecode($keyValuePair[0])) . '=' . rawurlencode(urldecode($keyValuePair[1])) : rawurlencode(urldecode($keyValuePair[0])); |
|
67 | 66 | $order[] = urldecode($keyValuePair[0]); |
68 | 67 | } |
69 | 68 | array_multisort($order, SORT_ASC, $parts); |
@@ -5,18 +5,18 @@ |
||
5 | 5 | class AndCondition extends Condition |
6 | 6 | { |
7 | 7 | |
8 | - protected $_condition; |
|
9 | - protected $_andCondition; |
|
8 | + protected $_condition; |
|
9 | + protected $_andCondition; |
|
10 | 10 | |
11 | - public function __construct($condition, $andCondition) |
|
12 | - { |
|
13 | - $this->_condition = $condition; |
|
14 | - $this->_andCondition = $andCondition; |
|
15 | - } |
|
11 | + public function __construct($condition, $andCondition) |
|
12 | + { |
|
13 | + $this->_condition = $condition; |
|
14 | + $this->_andCondition = $andCondition; |
|
15 | + } |
|
16 | 16 | |
17 | - public function getString() |
|
18 | - { |
|
19 | - return $this->protectCondition($this->_condition->getString()) . " AND " . $this->protectCondition($this->_andCondition->getString()) . ""; |
|
20 | - } |
|
17 | + public function getString() |
|
18 | + { |
|
19 | + return $this->protectCondition($this->_condition->getString()) . " AND " . $this->protectCondition($this->_andCondition->getString()) . ""; |
|
20 | + } |
|
21 | 21 | |
22 | 22 | } |
23 | 23 | \ No newline at end of file |
@@ -10,6 +10,6 @@ |
||
10 | 10 | } |
11 | 11 | |
12 | 12 | public function getString() { |
13 | - return $this->protectCondition($this->_condition->getString()) ." OR ". $this->protectCondition($this->_orCondition->getString()) .""; |
|
13 | + return $this->protectCondition($this->_condition->getString()) . " OR " . $this->protectCondition($this->_orCondition->getString()) . ""; |
|
14 | 14 | } |
15 | 15 | } |
16 | 16 | \ No newline at end of file |