@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | * |
103 | 103 | * @SuppressWarnings("UnusedFormalParameter") |
104 | 104 | */ |
105 | - public function getGroupsByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
105 | + public function getGroupsByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
106 | 106 | { |
107 | 107 | return false; |
108 | 108 | } |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | * |
121 | 121 | * @SuppressWarnings("UnusedFormalParameter") |
122 | 122 | */ |
123 | - public function getUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
123 | + public function getUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
124 | 124 | { |
125 | 125 | return false; |
126 | 126 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * |
139 | 139 | * @SuppressWarnings("UnusedFormalParameter") |
140 | 140 | */ |
141 | - public function getPendingUsersByFilter($filter, $select=false, $top=false, $skip=false, $orderby=false) |
|
141 | + public function getPendingUsersByFilter($filter, $select = false, $top = false, $skip = false, $orderby = false) |
|
142 | 142 | { |
143 | 143 | return false; |
144 | 144 | } |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | public function getActiveUserCount() |
152 | 152 | { |
153 | 153 | $users = $this->getUsersByFilter(false); |
154 | - if($users === false) |
|
154 | + if ($users === false) |
|
155 | 155 | { |
156 | 156 | return 0; |
157 | 157 | } |
@@ -166,7 +166,7 @@ discard block |
||
166 | 166 | public function getPendingUserCount() |
167 | 167 | { |
168 | 168 | $users = $this->getPendingUsersByFilter(false); |
169 | - if($users === false) |
|
169 | + if ($users === false) |
|
170 | 170 | { |
171 | 171 | return 0; |
172 | 172 | } |
@@ -181,7 +181,7 @@ discard block |
||
181 | 181 | public function getGroupCount() |
182 | 182 | { |
183 | 183 | $groups = $this->getGroupsByFilter(false); |
184 | - if($groups === false) |
|
184 | + if ($groups === false) |
|
185 | 185 | { |
186 | 186 | return 0; |
187 | 187 | } |
@@ -26,16 +26,16 @@ |
||
26 | 26 | { |
27 | 27 | $namespace = substr($classname, 0, $lastNsPos); |
28 | 28 | $classname = substr($classname, $lastNsPos + 1); |
29 | - $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
29 | + $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
30 | 30 | } |
31 | 31 | $filename = __DIR__.DIRECTORY_SEPARATOR.$filename.'class.'.$classname.'.php'; |
32 | - if(is_readable($filename)) |
|
32 | + if (is_readable($filename)) |
|
33 | 33 | { |
34 | 34 | require $filename; |
35 | 35 | } |
36 | 36 | } |
37 | 37 | |
38 | -if(version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
38 | +if (version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
39 | 39 | { |
40 | 40 | spl_autoload_register('FlipsideAutoload', true, true); |
41 | 41 | } |
@@ -5,18 +5,18 @@ discard block |
||
5 | 5 | { |
6 | 6 | protected $data = null; |
7 | 7 | |
8 | - function count($filter=false) |
|
8 | + function count($filter = false) |
|
9 | 9 | { |
10 | 10 | throw new \Exception('Unimplemented'); |
11 | 11 | } |
12 | 12 | |
13 | - function search($filter=false, $select=false, $count=false, $skip=false, $sort=false, $params=false) |
|
13 | + function search($filter = false, $select = false, $count = false, $skip = false, $sort = false, $params = false) |
|
14 | 14 | { |
15 | - if($this->data === null) |
|
15 | + if ($this->data === null) |
|
16 | 16 | { |
17 | 17 | throw new \Exception('Unimplemented'); |
18 | 18 | } |
19 | - if($filter !== false) |
|
19 | + if ($filter !== false) |
|
20 | 20 | { |
21 | 21 | $array = $filter->filter_array($this->data); |
22 | 22 | } |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | throw new \Exception('Unimplemented'); |
29 | 29 | } |
30 | 30 | |
31 | - function read($filter=false, $select=false, $count=false, $skip=false, $sort=false, $params=false) |
|
31 | + function read($filter = false, $select = false, $count = false, $skip = false, $sort = false, $params = false) |
|
32 | 32 | { |
33 | 33 | return $this->search($filter, $select, $count, $skip, $sort, $params); |
34 | 34 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | |
8 | 8 | function __construct($params) |
9 | 9 | { |
10 | - if(isset($params['user'])) |
|
10 | + if (isset($params['user'])) |
|
11 | 11 | { |
12 | 12 | $this->pdo = new \PDO($params['dsn'], $params['user'], $params['pass']); |
13 | 13 | } |
@@ -20,12 +20,12 @@ discard block |
||
20 | 20 | function _get_row_count_for_query($sql) |
21 | 21 | { |
22 | 22 | $stmt = $this->pdo->query($sql); |
23 | - if($stmt === false) |
|
23 | + if ($stmt === false) |
|
24 | 24 | { |
25 | 25 | return 0; |
26 | 26 | } |
27 | 27 | $count = $stmt->rowCount(); |
28 | - if($count === 0) |
|
28 | + if ($count === 0) |
|
29 | 29 | { |
30 | 30 | $array = $stmt->fetchAll(); |
31 | 31 | $count = count($array); |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | |
36 | 36 | function _tableExistsNoPrefix($name) |
37 | 37 | { |
38 | - if($this->_get_row_count_for_query('SHOW TABLES LIKE '.$this->pdo->quote($name)) > 0) |
|
38 | + if ($this->_get_row_count_for_query('SHOW TABLES LIKE '.$this->pdo->quote($name)) > 0) |
|
39 | 39 | { |
40 | 40 | return true; |
41 | 41 | } |
42 | - else if($this->_get_row_count_for_query('SELECT * FROM sqlite_master WHERE name LIKE '.$this->pdo->quote($name)) > 0) |
|
42 | + else if ($this->_get_row_count_for_query('SELECT * FROM sqlite_master WHERE name LIKE '.$this->pdo->quote($name)) > 0) |
|
43 | 43 | { |
44 | 44 | return true; |
45 | 45 | } |
@@ -48,11 +48,11 @@ discard block |
||
48 | 48 | |
49 | 49 | function _tableExists($name) |
50 | 50 | { |
51 | - if($this->_get_row_count_for_query('SHOW TABLES LIKE '.$this->pdo->quote('tbl'.$name)) > 0) |
|
51 | + if ($this->_get_row_count_for_query('SHOW TABLES LIKE '.$this->pdo->quote('tbl'.$name)) > 0) |
|
52 | 52 | { |
53 | 53 | return true; |
54 | 54 | } |
55 | - else if($this->_get_row_count_for_query('SELECT * FROM sqlite_master WHERE name LIKE '.$this->pdo->quote('tbl'.$name)) > 0) |
|
55 | + else if ($this->_get_row_count_for_query('SELECT * FROM sqlite_master WHERE name LIKE '.$this->pdo->quote('tbl'.$name)) > 0) |
|
56 | 56 | { |
57 | 57 | return true; |
58 | 58 | } |
@@ -61,11 +61,11 @@ discard block |
||
61 | 61 | |
62 | 62 | function _viewExists($name) |
63 | 63 | { |
64 | - if($this->_get_row_count_for_query('SHOW TABLES LIKE '.$this->pdo->quote('v'.$name)) > 0) |
|
64 | + if ($this->_get_row_count_for_query('SHOW TABLES LIKE '.$this->pdo->quote('v'.$name)) > 0) |
|
65 | 65 | { |
66 | 66 | return true; |
67 | 67 | } |
68 | - else if($this->_get_row_count_for_query('SELECT * FROM sqlite_master WHERE name LIKE '.$this->pdo->quote('v'.$name)) > 0) |
|
68 | + else if ($this->_get_row_count_for_query('SELECT * FROM sqlite_master WHERE name LIKE '.$this->pdo->quote('v'.$name)) > 0) |
|
69 | 69 | { |
70 | 70 | return true; |
71 | 71 | } |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | |
75 | 75 | function tableExists($name) |
76 | 76 | { |
77 | - if($this->_tableExists($name)) |
|
77 | + if ($this->_tableExists($name)) |
|
78 | 78 | { |
79 | 79 | return true; |
80 | 80 | } |
81 | - if($this->_tableExistsNoPrefix($name)) |
|
81 | + if ($this->_tableExistsNoPrefix($name)) |
|
82 | 82 | { |
83 | 83 | return true; |
84 | 84 | } |
85 | - if($this->_viewExists($name)) |
|
85 | + if ($this->_viewExists($name)) |
|
86 | 86 | { |
87 | 87 | return true; |
88 | 88 | } |
@@ -91,60 +91,60 @@ discard block |
||
91 | 91 | |
92 | 92 | function getTable($name) |
93 | 93 | { |
94 | - if($this->_tableExists($name)) |
|
94 | + if ($this->_tableExists($name)) |
|
95 | 95 | { |
96 | 96 | return new SQLDataTable($this, 'tbl'.$name); |
97 | 97 | } |
98 | - if($this->_viewExists($name)) |
|
98 | + if ($this->_viewExists($name)) |
|
99 | 99 | { |
100 | 100 | return new SQLDataTable($this, 'v'.$name); |
101 | 101 | } |
102 | - if($this->_tableExistsNoPrefix($name)) |
|
102 | + if ($this->_tableExistsNoPrefix($name)) |
|
103 | 103 | { |
104 | 104 | return new SQLDataTable($this, $name); |
105 | 105 | } |
106 | 106 | throw new \Exception('No such table '.$name); |
107 | 107 | } |
108 | 108 | |
109 | - function read($tablename, $where=false, $select='*', $count=false, $skip=false, $sort=false) |
|
109 | + function read($tablename, $where = false, $select = '*', $count = false, $skip = false, $sort = false) |
|
110 | 110 | { |
111 | - if($select === false) |
|
111 | + if ($select === false) |
|
112 | 112 | { |
113 | 113 | $select = '*'; |
114 | 114 | } |
115 | 115 | $sql = "SELECT $select FROM $tablename"; |
116 | - if($where !== false) |
|
116 | + if ($where !== false) |
|
117 | 117 | { |
118 | - $sql.=' WHERE '.$where; |
|
118 | + $sql .= ' WHERE '.$where; |
|
119 | 119 | } |
120 | - if($count !== false) |
|
120 | + if ($count !== false) |
|
121 | 121 | { |
122 | - if($skip === false) |
|
122 | + if ($skip === false) |
|
123 | 123 | { |
124 | - $sql.=' LIMIT '.(int)$count; |
|
124 | + $sql .= ' LIMIT '.(int)$count; |
|
125 | 125 | } |
126 | 126 | else |
127 | 127 | { |
128 | - $sql.=" LIMIT $skip, $count"; |
|
128 | + $sql .= " LIMIT $skip, $count"; |
|
129 | 129 | } |
130 | 130 | } |
131 | - if($sort !== false) |
|
131 | + if ($sort !== false) |
|
132 | 132 | { |
133 | - $sql.=' ORDER BY '; |
|
133 | + $sql .= ' ORDER BY '; |
|
134 | 134 | $tmp = array(); |
135 | - foreach($sort as $sort_col=>$dir) |
|
135 | + foreach ($sort as $sort_col=>$dir) |
|
136 | 136 | { |
137 | - array_push($tmp, $sort_col.' '.($dir === 1?'ASC':'DESC')); |
|
137 | + array_push($tmp, $sort_col.' '.($dir === 1 ? 'ASC' : 'DESC')); |
|
138 | 138 | } |
139 | - $sql.=implode($tmp,','); |
|
139 | + $sql .= implode($tmp, ','); |
|
140 | 140 | } |
141 | 141 | $stmt = $this->pdo->query($sql, \PDO::FETCH_ASSOC); |
142 | - if($stmt === false) |
|
142 | + if ($stmt === false) |
|
143 | 143 | { |
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | $ret = $stmt->fetchAll(); |
147 | - if($ret === false || empty($ret)) |
|
147 | + if ($ret === false || empty($ret)) |
|
148 | 148 | { |
149 | 149 | return false; |
150 | 150 | } |
@@ -154,19 +154,19 @@ discard block |
||
154 | 154 | function update($tablename, $where, $data) |
155 | 155 | { |
156 | 156 | $set = array(); |
157 | - if(is_object($data)) |
|
157 | + if (is_object($data)) |
|
158 | 158 | { |
159 | 159 | $data = (array)$data; |
160 | 160 | } |
161 | 161 | $cols = array_keys($data); |
162 | 162 | $count = count($cols); |
163 | - for($i = 0; $i < $count; $i++) |
|
163 | + for ($i = 0; $i < $count; $i++) |
|
164 | 164 | { |
165 | 165 | array_push($set, $cols[$i].'='.$this->pdo->quote($data[$cols[$i]])); |
166 | 166 | } |
167 | 167 | $set = implode(',', $set); |
168 | 168 | $sql = "UPDATE $tablename SET $set WHERE $where"; |
169 | - if($this->pdo->exec($sql) === false) |
|
169 | + if ($this->pdo->exec($sql) === false) |
|
170 | 170 | { |
171 | 171 | return false; |
172 | 172 | } |
@@ -176,20 +176,20 @@ discard block |
||
176 | 176 | function create($tablename, $data) |
177 | 177 | { |
178 | 178 | $set = array(); |
179 | - if(is_object($data)) |
|
179 | + if (is_object($data)) |
|
180 | 180 | { |
181 | 181 | $data = (array)$data; |
182 | 182 | } |
183 | 183 | $cols = array_keys($data); |
184 | 184 | $count = count($cols); |
185 | - for($i = 0; $i < $count; $i++) |
|
185 | + for ($i = 0; $i < $count; $i++) |
|
186 | 186 | { |
187 | 187 | array_push($set, $this->pdo->quote($data[$cols[$i]])); |
188 | 188 | } |
189 | 189 | $cols = implode(',', $cols); |
190 | 190 | $set = implode(',', $set); |
191 | 191 | $sql = "INSERT INTO $tablename ($cols) VALUES ($set);"; |
192 | - if($this->pdo->exec($sql) === false) |
|
192 | + if ($this->pdo->exec($sql) === false) |
|
193 | 193 | { |
194 | 194 | return false; |
195 | 195 | } |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | function delete($tablename, $where) |
200 | 200 | { |
201 | 201 | $sql = "DELETE FROM $tablename WHERE $where"; |
202 | - if($this->pdo->exec($sql) === false) |
|
202 | + if ($this->pdo->exec($sql) === false) |
|
203 | 203 | { |
204 | 204 | return false; |
205 | 205 | } |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | function raw_query($sql) |
210 | 210 | { |
211 | 211 | $stmt = $this->pdo->query($sql, \PDO::FETCH_ASSOC); |
212 | - if($stmt === false) |
|
212 | + if ($stmt === false) |
|
213 | 213 | { |
214 | 214 | return false; |
215 | 215 | } |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | |
10 | 10 | function __construct($string = false) |
11 | 11 | { |
12 | - if($string !== false) |
|
12 | + if ($string !== false) |
|
13 | 13 | { |
14 | 14 | $this->string = $string; |
15 | 15 | $this->children = self::process_string($this->string); |
@@ -20,21 +20,21 @@ discard block |
||
20 | 20 | { |
21 | 21 | $parens = false; |
22 | 22 | //First check for parenthesis... |
23 | - if($string[0] === '(' && substr($string, -1) === ')') |
|
23 | + if ($string[0] === '(' && substr($string, -1) === ')') |
|
24 | 24 | { |
25 | - $string = substr($string, 1, strlen($string)-2); |
|
25 | + $string = substr($string, 1, strlen($string) - 2); |
|
26 | 26 | $parens = true; |
27 | 27 | } |
28 | - if(preg_match('/(.+?)( and | or )(.+)/', $string, $clauses) === 0) |
|
28 | + if (preg_match('/(.+?)( and | or )(.+)/', $string, $clauses) === 0) |
|
29 | 29 | { |
30 | 30 | return array(new FilterClause($string)); |
31 | 31 | } |
32 | 32 | $children = array(); |
33 | - if($parens) array_push($children, '('); |
|
33 | + if ($parens) array_push($children, '('); |
|
34 | 34 | $children = array_merge($children, self::process_string($clauses[1])); |
35 | 35 | array_push($children, trim($clauses[2])); |
36 | 36 | $children = array_merge($children, self::process_string($clauses[3])); |
37 | - if($parens) array_push($children, ')'); |
|
37 | + if ($parens) array_push($children, ')'); |
|
38 | 38 | return $children; |
39 | 39 | } |
40 | 40 | |
@@ -42,23 +42,23 @@ discard block |
||
42 | 42 | { |
43 | 43 | $ret = ''; |
44 | 44 | $count = count($this->children); |
45 | - for($i = 0; $i < $count; $i++) |
|
45 | + for ($i = 0; $i < $count; $i++) |
|
46 | 46 | { |
47 | - if($this->children[$i] === '(' || $this->children[$i] === ')') |
|
47 | + if ($this->children[$i] === '(' || $this->children[$i] === ')') |
|
48 | 48 | { |
49 | - $ret.=$this->children[$i]; |
|
49 | + $ret .= $this->children[$i]; |
|
50 | 50 | } |
51 | - else if($this->children[$i] === 'and') |
|
51 | + else if ($this->children[$i] === 'and') |
|
52 | 52 | { |
53 | - $ret.=' AND '; |
|
53 | + $ret .= ' AND '; |
|
54 | 54 | } |
55 | - else if($this->children[$i] === 'or') |
|
55 | + else if ($this->children[$i] === 'or') |
|
56 | 56 | { |
57 | - $ret.=' OR '; |
|
57 | + $ret .= ' OR '; |
|
58 | 58 | } |
59 | 59 | else |
60 | 60 | { |
61 | - $ret.=$this->children[$i]->to_sql_string(); |
|
61 | + $ret .= $this->children[$i]->to_sql_string(); |
|
62 | 62 | } |
63 | 63 | } |
64 | 64 | return $ret.$this->sqlAppend; |
@@ -69,19 +69,19 @@ discard block |
||
69 | 69 | $ret = ''; |
70 | 70 | $count = count($this->children); |
71 | 71 | $prefix = ''; |
72 | - for($i = 0; $i < $count; $i++) |
|
72 | + for ($i = 0; $i < $count; $i++) |
|
73 | 73 | { |
74 | - if($this->children[$i] === 'and') |
|
74 | + if ($this->children[$i] === 'and') |
|
75 | 75 | { |
76 | - if($prefix == '|') |
|
76 | + if ($prefix == '|') |
|
77 | 77 | { |
78 | 78 | throw new \Exception('Do not support both and or'); |
79 | 79 | } |
80 | 80 | $prefix = '&'; |
81 | 81 | } |
82 | - else if($this->children[$i] === 'or') |
|
82 | + else if ($this->children[$i] === 'or') |
|
83 | 83 | { |
84 | - if($prefix == '&') |
|
84 | + if ($prefix == '&') |
|
85 | 85 | { |
86 | 86 | throw new \Exception('Do not support both and or'); |
87 | 87 | } |
@@ -89,10 +89,10 @@ discard block |
||
89 | 89 | } |
90 | 90 | else |
91 | 91 | { |
92 | - $ret.=$this->children[$i]->to_ldap_string(); |
|
92 | + $ret .= $this->children[$i]->to_ldap_string(); |
|
93 | 93 | } |
94 | 94 | } |
95 | - if($count === 1 && $prefix === '') |
|
95 | + if ($count === 1 && $prefix === '') |
|
96 | 96 | { |
97 | 97 | return $ret; |
98 | 98 | } |
@@ -103,14 +103,14 @@ discard block |
||
103 | 103 | { |
104 | 104 | $ret = array(); |
105 | 105 | $count = count($this->children); |
106 | - for($i = 0; $i < $count; $i++) |
|
106 | + for ($i = 0; $i < $count; $i++) |
|
107 | 107 | { |
108 | - if($this->children[$i] === 'and') |
|
108 | + if ($this->children[$i] === 'and') |
|
109 | 109 | { |
110 | 110 | $old = array_pop($ret); |
111 | 111 | array_push($ret, array('$and'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
112 | 112 | } |
113 | - else if($this->children[$i] === 'or') |
|
113 | + else if ($this->children[$i] === 'or') |
|
114 | 114 | { |
115 | 115 | $old = array_pop($ret); |
116 | 116 | array_push($ret, array('$or'=>array($old, $this->children[++$i]->to_mongo_filter()))); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | array_push($ret, $this->children[$i]->to_mongo_filter()); |
121 | 121 | } |
122 | 122 | } |
123 | - if(count($ret) == 1 && is_array($ret[0])) |
|
123 | + if (count($ret) == 1 && is_array($ret[0])) |
|
124 | 124 | { |
125 | 125 | //print_r(json_encode($ret[0])); die(); |
126 | 126 | return $ret[0]; |
@@ -131,27 +131,27 @@ discard block |
||
131 | 131 | function filter_array(&$array) |
132 | 132 | { |
133 | 133 | $res = array(); |
134 | - if(is_array($array)) |
|
134 | + if (is_array($array)) |
|
135 | 135 | { |
136 | 136 | $search = $array; |
137 | 137 | $count = count($this->children); |
138 | - for($i = 0; $i < $count; $i++) |
|
138 | + for ($i = 0; $i < $count; $i++) |
|
139 | 139 | { |
140 | - if($this->children[$i] === 'and') |
|
140 | + if ($this->children[$i] === 'and') |
|
141 | 141 | { |
142 | 142 | $search = $res; |
143 | 143 | } |
144 | - else if($this->children[$i] === 'or') |
|
144 | + else if ($this->children[$i] === 'or') |
|
145 | 145 | { |
146 | 146 | $search = $array; |
147 | 147 | } |
148 | 148 | else |
149 | 149 | { |
150 | - foreach($search as $subarray) |
|
150 | + foreach ($search as $subarray) |
|
151 | 151 | { |
152 | - if(isset($subarray[$this->children[$i]->var1])) |
|
152 | + if (isset($subarray[$this->children[$i]->var1])) |
|
153 | 153 | { |
154 | - if($this->children[$i]->php_compare($subarray[$this->children[$i]->var1])) |
|
154 | + if ($this->children[$i]->php_compare($subarray[$this->children[$i]->var1])) |
|
155 | 155 | { |
156 | 156 | array_push($res, $subarray); |
157 | 157 | } |
@@ -171,10 +171,10 @@ discard block |
||
171 | 171 | public function getClause($substr) |
172 | 172 | { |
173 | 173 | $count = count($this->children); |
174 | - for($i = 0; $i < $count; $i++) |
|
174 | + for ($i = 0; $i < $count; $i++) |
|
175 | 175 | { |
176 | - if(!is_object($this->children[$i])) continue; |
|
177 | - if(strstr($this->children[$i]->var1, $substr) !== false || |
|
176 | + if (!is_object($this->children[$i])) continue; |
|
177 | + if (strstr($this->children[$i]->var1, $substr) !== false || |
|
178 | 178 | strstr($this->children[$i]->var2, $substr) !== false) |
179 | 179 | { |
180 | 180 | return $this->children[$i]; |
@@ -184,17 +184,17 @@ discard block |
||
184 | 184 | |
185 | 185 | public function addToSQLString($string) |
186 | 186 | { |
187 | - $this->sqlAppend.=$string; |
|
187 | + $this->sqlAppend .= $string; |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | public function appendChild($child) |
191 | 191 | { |
192 | - if($child === 'and' || $child === 'or') |
|
192 | + if ($child === 'and' || $child === 'or') |
|
193 | 193 | { |
194 | 194 | array_push($this->children, $child); |
195 | 195 | return; |
196 | 196 | } |
197 | - else if(is_a($child, '\Data\Filter')) |
|
197 | + else if (is_a($child, '\Data\Filter')) |
|
198 | 198 | { |
199 | 199 | $this->children = array_merge($this->children, $child->children); |
200 | 200 | } |
@@ -11,14 +11,14 @@ discard block |
||
11 | 11 | { |
12 | 12 | $namespace = substr($classname, 0, $lastNsPos); |
13 | 13 | $classname = substr($classname, $lastNsPos + 1); |
14 | - $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR; |
|
14 | + $filename = str_replace('\\', DIRECTORY_SEPARATOR, $namespace).DIRECTORY_SEPARATOR; |
|
15 | 15 | } |
16 | - if(strlen($namespace)) |
|
16 | + if (strlen($namespace)) |
|
17 | 17 | { |
18 | - $namespace.=DIRECTORY_SEPARATOR; |
|
18 | + $namespace .= DIRECTORY_SEPARATOR; |
|
19 | 19 | } |
20 | 20 | $filename = __DIR__.'/../libs/mongofill/src/'.$namespace.$classname.'.php'; |
21 | - if(is_readable($filename)) |
|
21 | + if (is_readable($filename)) |
|
22 | 22 | { |
23 | 23 | require $filename; |
24 | 24 | } |
@@ -37,18 +37,18 @@ discard block |
||
37 | 37 | $this->mangaer = null; |
38 | 38 | $this->db = null; |
39 | 39 | $this->db_name = null; |
40 | - if(class_exists('MongoClient')) |
|
40 | + if (class_exists('MongoClient')) |
|
41 | 41 | { |
42 | 42 | $this->setupMongoClient($params); |
43 | 43 | } |
44 | - else if(class_exists('\MongoDB\Driver\Manager')) |
|
44 | + else if (class_exists('\MongoDB\Driver\Manager')) |
|
45 | 45 | { |
46 | 46 | $this->setupMongoManager($params); |
47 | 47 | } |
48 | 48 | else |
49 | 49 | { |
50 | 50 | require __DIR__.'/../libs/mongofill/src/functions.php'; |
51 | - if(version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
51 | + if (version_compare(PHP_VERSION, '5.3.0', '>=')) |
|
52 | 52 | { |
53 | 53 | spl_autoload_register('\Data\MongofillAutoload', true, true); |
54 | 54 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | function tableExists($name) |
64 | 64 | { |
65 | 65 | $collections = $this->db->getCollectionNames(); |
66 | - if(in_array($name, $collections)) |
|
66 | + if (in_array($name, $collections)) |
|
67 | 67 | { |
68 | 68 | return true; |
69 | 69 | } |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | |
73 | 73 | function getTable($name) |
74 | 74 | { |
75 | - if($this->db !== null) |
|
75 | + if ($this->db !== null) |
|
76 | 76 | { |
77 | 77 | return new MongoDataTable($this->db->selectCollection($name)); |
78 | 78 | } |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | |
85 | 85 | private function setupMongoClient($params) |
86 | 86 | { |
87 | - if(isset($params['user'])) |
|
87 | + if (isset($params['user'])) |
|
88 | 88 | { |
89 | 89 | $this->client = new \MongoClient('mongodb://'.$params['host'].'/'.$params['db'], array('username'=>$params['user'], 'password'=>$params['pass'])); |
90 | 90 | } |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | |
98 | 98 | private function setupMongoManager($params) |
99 | 99 | { |
100 | - if(isset($params['user'])) |
|
100 | + if (isset($params['user'])) |
|
101 | 101 | { |
102 | 102 | $this->manager = new \MongoDB\Driver\Manager('mongodb://'.$params['user'].':'.$params['pass'].'@'.$params['host'].'/'.$params['db']); |
103 | 103 | } |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | function get_primary_key() |
16 | 16 | { |
17 | 17 | $res = $this->dataset->raw_query("SHOW INDEX FROM $this->tablename WHERE Key_name='PRIMARY'"); |
18 | - if($res === false) |
|
18 | + if ($res === false) |
|
19 | 19 | { |
20 | 20 | return false; |
21 | 21 | } |
@@ -25,17 +25,17 @@ discard block |
||
25 | 25 | function prefetch_all($key = false) |
26 | 26 | { |
27 | 27 | $array = $this->read(false, false); |
28 | - if($key === false) |
|
28 | + if ($key === false) |
|
29 | 29 | { |
30 | 30 | $key = $this->get_primary_key(); |
31 | 31 | } |
32 | 32 | $count = count($array); |
33 | 33 | $this->data = array(); |
34 | - for($i = 0; $i < $count; $i++) |
|
34 | + for ($i = 0; $i < $count; $i++) |
|
35 | 35 | { |
36 | - if(isset($this->data[$array[$i][$key]])) |
|
36 | + if (isset($this->data[$array[$i][$key]])) |
|
37 | 37 | { |
38 | - if(isset($this->data[$array[$i][$key]][0])) |
|
38 | + if (isset($this->data[$array[$i][$key]][0])) |
|
39 | 39 | { |
40 | 40 | array_push($this->data[$array[$i][$key]], $array[$i]); |
41 | 41 | } |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | } |
52 | 52 | } |
53 | 53 | |
54 | - function count($filter=false) |
|
54 | + function count($filter = false) |
|
55 | 55 | { |
56 | - if($this->data !== null) |
|
56 | + if ($this->data !== null) |
|
57 | 57 | { |
58 | 58 | return parent::count($filter); |
59 | 59 | } |
60 | 60 | $where = false; |
61 | - if($filter !== false) |
|
61 | + if ($filter !== false) |
|
62 | 62 | { |
63 | 63 | $where = $filter->to_sql_string(); |
64 | 64 | } |
65 | 65 | $ret = $this->dataset->read($this->tablename, $where, 'COUNT(*)'); |
66 | - if($ret === false || !isset($ret[0]) || !isset($ret[0]['COUNT(*)'])) |
|
66 | + if ($ret === false || !isset($ret[0]) || !isset($ret[0]['COUNT(*)'])) |
|
67 | 67 | { |
68 | 68 | return false; |
69 | 69 | } |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - function search($filter=false, $select=false, $count=false, $skip=false, $sort=false, $params=false) |
|
76 | + function search($filter = false, $select = false, $count = false, $skip = false, $sort = false, $params = false) |
|
77 | 77 | { |
78 | - if($this->data !== null) |
|
78 | + if ($this->data !== null) |
|
79 | 79 | { |
80 | 80 | return parent::search($filter, $select); |
81 | 81 | } |
82 | 82 | $where = false; |
83 | - if($filter !== false) |
|
83 | + if ($filter !== false) |
|
84 | 84 | { |
85 | 85 | $where = $filter->to_sql_string(); |
86 | 86 | } |
87 | - if($select !== false && is_array($select)) |
|
87 | + if ($select !== false && is_array($select)) |
|
88 | 88 | { |
89 | 89 | $select = implode(',', $select); |
90 | 90 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | function delete($filter) |
106 | 106 | { |
107 | 107 | $where = false; |
108 | - if($filter !== false) |
|
108 | + if ($filter !== false) |
|
109 | 109 | { |
110 | 110 | $where = $filter->to_sql_string(); |
111 | 111 | } |
@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | public $var2; |
8 | 8 | public $op; |
9 | 9 | |
10 | - function __construct($string=false) |
|
10 | + function __construct($string = false) |
|
11 | 11 | { |
12 | - if($string !== false) $this->process_filter_string($string); |
|
12 | + if ($string !== false) $this->process_filter_string($string); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | static function str_startswith($haystack, $needle) |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | protected function process_filter_string($string) |
21 | 21 | { |
22 | - if(self::str_startswith($string, 'substringof') || self::str_startswith($string, 'contains') || |
|
22 | + if (self::str_startswith($string, 'substringof') || self::str_startswith($string, 'contains') || |
|
23 | 23 | self::str_startswith($string, 'indexof')) |
24 | 24 | { |
25 | 25 | $this->op = strtok($string, '('); |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | $field = strtok($string, ' '); |
31 | 31 | $op = strtok(' '); |
32 | 32 | $rest = strtok("\0"); |
33 | - switch($op) |
|
33 | + switch ($op) |
|
34 | 34 | { |
35 | 35 | case 'ne': |
36 | 36 | $op = '!='; |
@@ -59,11 +59,11 @@ discard block |
||
59 | 59 | function to_sql_string() |
60 | 60 | { |
61 | 61 | $str = ''; |
62 | - switch($this->op) |
|
62 | + switch ($this->op) |
|
63 | 63 | { |
64 | 64 | case 'substringof': |
65 | 65 | case 'contains': |
66 | - $str = $this->var1.' LIKE \'%'.trim($this->var2,"'").'%\''; |
|
66 | + $str = $this->var1.' LIKE \'%'.trim($this->var2, "'").'%\''; |
|
67 | 67 | break; |
68 | 68 | default: |
69 | 69 | $str = $this->var1.$this->op.$this->var2; |
@@ -75,17 +75,17 @@ discard block |
||
75 | 75 | function to_ldap_string() |
76 | 76 | { |
77 | 77 | $str = '('; |
78 | - switch($this->op) |
|
78 | + switch ($this->op) |
|
79 | 79 | { |
80 | 80 | case 'substringof': |
81 | 81 | case 'contains': |
82 | - $str.=$this->var1.$this->op.'*'.trim($this->var2,"'").'*'; |
|
82 | + $str .= $this->var1.$this->op.'*'.trim($this->var2, "'").'*'; |
|
83 | 83 | break; |
84 | 84 | case '!=': |
85 | - $str.='!('.$this->var1.'='.$this->var2.')'; |
|
85 | + $str .= '!('.$this->var1.'='.$this->var2.')'; |
|
86 | 86 | break; |
87 | 87 | default: |
88 | - $str.=$this->var1.$this->op.$this->var2; |
|
88 | + $str .= $this->var1.$this->op.$this->var2; |
|
89 | 89 | break; |
90 | 90 | } |
91 | 91 | return $str.')'; |
@@ -94,11 +94,11 @@ discard block |
||
94 | 94 | function to_mongo_filter() |
95 | 95 | { |
96 | 96 | $this->var2 = trim($this->var2, "'"); |
97 | - if($this->var1 === '_id') |
|
97 | + if ($this->var1 === '_id') |
|
98 | 98 | { |
99 | 99 | $this->var2 = new \MongoId($this->var2); |
100 | 100 | } |
101 | - switch($this->op) |
|
101 | + switch ($this->op) |
|
102 | 102 | { |
103 | 103 | case '!=': |
104 | 104 | return array($this->var1=>array('$ne'=>$this->var2)); |
@@ -117,13 +117,13 @@ discard block |
||
117 | 117 | case 'indexof': |
118 | 118 | $field = $this->var1; |
119 | 119 | $case = false; |
120 | - if(self::str_startswith($this->var1, 'tolower')) |
|
120 | + if (self::str_startswith($this->var1, 'tolower')) |
|
121 | 121 | { |
122 | - $field = substr($this->var1, strpos($this->var1, '(')+1); |
|
122 | + $field = substr($this->var1, strpos($this->var1, '(') + 1); |
|
123 | 123 | $field = substr($field, 0, strpos($field, ')')); |
124 | 124 | $case = true; |
125 | 125 | } |
126 | - if($case) |
|
126 | + if ($case) |
|
127 | 127 | { |
128 | 128 | return array($field=>array('$regex'=>new \MongoRegex('/'.$this->var2.'/i'))); |
129 | 129 | } |
@@ -136,7 +136,7 @@ discard block |
||
136 | 136 | |
137 | 137 | function php_compare($value) |
138 | 138 | { |
139 | - switch($this->op) |
|
139 | + switch ($this->op) |
|
140 | 140 | { |
141 | 141 | case '!=': |
142 | 142 | return $value != $this->var2; |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * We use the FlipsideSettings class for a list of sites and settings |
17 | 17 | * about CDNs and minified JS/CSS |
18 | 18 | */ |
19 | -if(isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
19 | +if (isset($GLOBALS['FLIPSIDE_SETTINGS_LOC'])) |
|
20 | 20 | { |
21 | 21 | require_once($GLOBALS['FLIPSIDE_SETTINGS_LOC'].'/class.FlipsideSettings.php'); |
22 | 22 | } |
@@ -30,32 +30,32 @@ discard block |
||
30 | 30 | */ |
31 | 31 | require_once('class.WebPage.php'); |
32 | 32 | |
33 | -define('JS_JQUERY', 0); |
|
34 | -define('JS_JQUERY_UI', 1); |
|
35 | -define('JS_BOOTSTRAP', 2); |
|
33 | +define('JS_JQUERY', 0); |
|
34 | +define('JS_JQUERY_UI', 1); |
|
35 | +define('JS_BOOTSTRAP', 2); |
|
36 | 36 | define('JQUERY_VALIDATE', 3); |
37 | -define('JQUERY_TOUCH', 4); |
|
38 | -define('JS_TINYNAV', 5); |
|
37 | +define('JQUERY_TOUCH', 4); |
|
38 | +define('JS_TINYNAV', 5); |
|
39 | 39 | define('JS_BOOTSTRAP_FH', 6); |
40 | 40 | define('JS_BOOTSTRAP_SW', 7); |
41 | -define('JS_DATATABLE', 8); |
|
42 | -define('JS_CHART', 9); |
|
43 | -define('JS_METISMENU', 10); |
|
44 | -define('JS_BOOTBOX', 11); |
|
41 | +define('JS_DATATABLE', 8); |
|
42 | +define('JS_CHART', 9); |
|
43 | +define('JS_METISMENU', 10); |
|
44 | +define('JS_BOOTBOX', 11); |
|
45 | 45 | define('JS_DATATABLE_ODATA', 12); |
46 | -define('JS_CRYPTO_MD5_JS', 13); |
|
47 | -define('JS_JCROP', 14); |
|
48 | -define('JS_TYPEAHEAD', 15); |
|
49 | -define('JS_FLIPSIDE', 20); |
|
50 | -define('JS_LOGIN', 21); |
|
51 | - |
|
52 | -define('CSS_JQUERY_UI', 0); |
|
53 | -define('CSS_BOOTSTRAP', 1); |
|
46 | +define('JS_CRYPTO_MD5_JS', 13); |
|
47 | +define('JS_JCROP', 14); |
|
48 | +define('JS_TYPEAHEAD', 15); |
|
49 | +define('JS_FLIPSIDE', 20); |
|
50 | +define('JS_LOGIN', 21); |
|
51 | + |
|
52 | +define('CSS_JQUERY_UI', 0); |
|
53 | +define('CSS_BOOTSTRAP', 1); |
|
54 | 54 | define('CSS_BOOTSTRAP_FH', 2); |
55 | 55 | define('CSS_BOOTSTRAP_SW', 3); |
56 | -define('CSS_DATATABLE', 4); |
|
57 | -define('CSS_JCROP', 5); |
|
58 | -define('CSS_FONTAWESOME', 6); |
|
56 | +define('CSS_DATATABLE', 4); |
|
57 | +define('CSS_JCROP', 5); |
|
58 | +define('CSS_FONTAWESOME', 6); |
|
59 | 59 | |
60 | 60 | global $jsArray; |
61 | 61 | $jsArray = array( |
@@ -349,7 +349,7 @@ discard block |
||
349 | 349 | * |
350 | 350 | * @SuppressWarnings("StaticAccess") |
351 | 351 | */ |
352 | - function __construct($title, $header=true) |
|
352 | + function __construct($title, $header = true) |
|
353 | 353 | { |
354 | 354 | parent::__construct($title); |
355 | 355 | $this->setupVars(); |
@@ -361,13 +361,13 @@ discard block |
||
361 | 361 | $this->notifications = array(); |
362 | 362 | $this->loginUrl = 'login.php'; |
363 | 363 | $this->logoutUrl = 'logout.php'; |
364 | - if(isset(FlipsideSettings::$global)) |
|
364 | + if (isset(FlipsideSettings::$global)) |
|
365 | 365 | { |
366 | - if(isset(FlipsideSettings::$global['login_url'])) |
|
366 | + if (isset(FlipsideSettings::$global['login_url'])) |
|
367 | 367 | { |
368 | 368 | $this->loginUrl = FlipsideSettings::$global['login_url']; |
369 | 369 | } |
370 | - if(isset(FlipsideSettings::$global['logout_url'])) |
|
370 | + if (isset(FlipsideSettings::$global['logout_url'])) |
|
371 | 371 | { |
372 | 372 | $this->logoutUrl = FlipsideSettings::$global['logout_url']; |
373 | 373 | } |
@@ -382,7 +382,7 @@ discard block |
||
382 | 382 | */ |
383 | 383 | protected function getSites() |
384 | 384 | { |
385 | - if(isset(FlipsideSettings::$sites)) |
|
385 | + if (isset(FlipsideSettings::$sites)) |
|
386 | 386 | { |
387 | 387 | return FlipsideSettings::$sites; |
388 | 388 | } |
@@ -398,9 +398,9 @@ discard block |
||
398 | 398 | */ |
399 | 399 | protected function addAllLinks() |
400 | 400 | { |
401 | - if($this->user === false || $this->user === null) |
|
401 | + if ($this->user === false || $this->user === null) |
|
402 | 402 | { |
403 | - if(isset($_SERVER['REQUEST_URI']) && strstr($_SERVER['REQUEST_URI'], 'logout.php') === false) |
|
403 | + if (isset($_SERVER['REQUEST_URI']) && strstr($_SERVER['REQUEST_URI'], 'logout.php') === false) |
|
404 | 404 | { |
405 | 405 | $this->addLink('Login', $this->loginUrl); |
406 | 406 | } |
@@ -423,16 +423,16 @@ discard block |
||
423 | 423 | */ |
424 | 424 | private function setupVars() |
425 | 425 | { |
426 | - if($this->minified !== null && $this->cdn !== null) return; |
|
426 | + if ($this->minified !== null && $this->cdn !== null) return; |
|
427 | 427 | $this->minified = 'min'; |
428 | 428 | $this->cdn = 'cdn'; |
429 | - if(isset(FlipsideSettings::$global)) |
|
429 | + if (isset(FlipsideSettings::$global)) |
|
430 | 430 | { |
431 | - if(isset(FlipsideSettings::$global['use_minified']) && !FlipsideSettings::$global['use_minified']) |
|
431 | + if (isset(FlipsideSettings::$global['use_minified']) && !FlipsideSettings::$global['use_minified']) |
|
432 | 432 | { |
433 | 433 | $this->minified = 'no'; |
434 | 434 | } |
435 | - if(isset(FlipsideSettings::$global['use_cdn']) && !FlipsideSettings::$global['use_cdn']) |
|
435 | + if (isset(FlipsideSettings::$global['use_cdn']) && !FlipsideSettings::$global['use_cdn']) |
|
436 | 436 | { |
437 | 437 | $this->cdn = 'no'; |
438 | 438 | } |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * |
448 | 448 | * @deprecated 2.0.0 Please use addJSByURI() instead |
449 | 449 | */ |
450 | - function add_js_from_src($src, $async=true) |
|
450 | + function add_js_from_src($src, $async = true) |
|
451 | 451 | { |
452 | 452 | $this->addJSByURI($src, $async); |
453 | 453 | } |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | * @param string $uri The webpath to the JavaScript file |
459 | 459 | * @param boolean $async Can the JavaScript be loaded asynchronously? |
460 | 460 | */ |
461 | - public function addJSByURI($uri, $async=true) |
|
461 | + public function addJSByURI($uri, $async = true) |
|
462 | 462 | { |
463 | 463 | $attributes = array('src'=>$uri, 'type'=>'text/javascript'); |
464 | - if($async === true) |
|
464 | + if ($async === true) |
|
465 | 465 | { |
466 | 466 | $attributes['async'] = true; |
467 | 467 | } |
@@ -479,7 +479,7 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @deprecated 2.0.0 Please use addCSSByURI() instead |
481 | 481 | */ |
482 | - function add_css_from_src($src, $import=false) |
|
482 | + function add_css_from_src($src, $import = false) |
|
483 | 483 | { |
484 | 484 | $this->addCSSByURI($src, $import); |
485 | 485 | } |
@@ -490,10 +490,10 @@ discard block |
||
490 | 490 | * @param string $src The webpath to the Cascading Style Sheet file |
491 | 491 | * @param boolean $async Can the CSS be loaded asynchronously? |
492 | 492 | */ |
493 | - public function addCSSByURI($uri, $async=false) |
|
493 | + public function addCSSByURI($uri, $async = false) |
|
494 | 494 | { |
495 | 495 | $attributes = array('rel'=>'stylesheet', 'href'=>$uri, 'type'=>'text/css'); |
496 | - if($async === true && $this->importSupport === true) |
|
496 | + if ($async === true && $this->importSupport === true) |
|
497 | 497 | { |
498 | 498 | $attributes['rel'] = 'import'; |
499 | 499 | } |
@@ -509,12 +509,12 @@ discard block |
||
509 | 509 | * |
510 | 510 | * @deprecated 2.0.0 Please use addWellKnownJS() instead |
511 | 511 | */ |
512 | - function addJS($type, $async=true) |
|
512 | + function addJS($type, $async = true) |
|
513 | 513 | { |
514 | 514 | $this->addWellKnownJS($type, $async); |
515 | 515 | } |
516 | 516 | |
517 | - function add_js($type, $async=true) |
|
517 | + function add_js($type, $async = true) |
|
518 | 518 | { |
519 | 519 | $this->addWellKnownJS($type, $async); |
520 | 520 | } |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | * @param string $jsFileID the ID of the JS file |
526 | 526 | * @param boolean $async Can the JS file be loaded asynchronously? |
527 | 527 | */ |
528 | - public function addWellKnownJS($jsFileID, $async=true) |
|
528 | + public function addWellKnownJS($jsFileID, $async = true) |
|
529 | 529 | { |
530 | 530 | global $jsArray; |
531 | 531 | $this->setupVars(); |
@@ -541,7 +541,7 @@ discard block |
||
541 | 541 | * |
542 | 542 | * @deprecated 2.0.0 Please use addWellKnownCSS() instead |
543 | 543 | */ |
544 | - function add_css($type, $import=false) |
|
544 | + function add_css($type, $import = false) |
|
545 | 545 | { |
546 | 546 | $this->addWellKnownCSS($type, $import); |
547 | 547 | } |
@@ -552,7 +552,7 @@ discard block |
||
552 | 552 | * @param string $cssFileID the ID of the CSS file |
553 | 553 | * @param boolean $async Can the CSS file be loaded asynchronously? |
554 | 554 | */ |
555 | - public function addWellKnownCSS($cssFileID, $async=true) |
|
555 | + public function addWellKnownCSS($cssFileID, $async = true) |
|
556 | 556 | { |
557 | 557 | global $cssArray; |
558 | 558 | $this->setupVars(); |
@@ -575,16 +575,16 @@ discard block |
||
575 | 575 | $sites = $this->getSites(); |
576 | 576 | $names = array_keys($sites); |
577 | 577 | $ret = ''; |
578 | - foreach($names as $name) |
|
578 | + foreach ($names as $name) |
|
579 | 579 | { |
580 | - $ret.='<li>'.$this->createLink($name, $sites[$name]).'</li>'; |
|
580 | + $ret .= '<li>'.$this->createLink($name, $sites[$name]).'</li>'; |
|
581 | 581 | } |
582 | 582 | return $ret; |
583 | 583 | } |
584 | 584 | |
585 | 585 | protected function getHrefForDropdown(&$link) |
586 | 586 | { |
587 | - if(isset($link['_'])) |
|
587 | + if (isset($link['_'])) |
|
588 | 588 | { |
589 | 589 | $ret = $link['_']; |
590 | 590 | unset($link['_']); |
@@ -597,24 +597,24 @@ discard block |
||
597 | 597 | { |
598 | 598 | $ret = '<li class="dropdown">'; |
599 | 599 | $href = $this->getHrefForDropdown($link); |
600 | - $ret.= '<a href="'.$href.'" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.$name.' <span class="caret"></span></a>'; |
|
601 | - $ret.='<ul class="dropdown-menu">'; |
|
600 | + $ret .= '<a href="'.$href.'" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">'.$name.' <span class="caret"></span></a>'; |
|
601 | + $ret .= '<ul class="dropdown-menu">'; |
|
602 | 602 | $subNames = array_keys($link); |
603 | - foreach($subNames as $subName) |
|
603 | + foreach ($subNames as $subName) |
|
604 | 604 | { |
605 | - $ret.=$this->getLinkByName($subName, $link); |
|
605 | + $ret .= $this->getLinkByName($subName, $link); |
|
606 | 606 | } |
607 | - $ret.='</ul></li>'; |
|
607 | + $ret .= '</ul></li>'; |
|
608 | 608 | return $ret; |
609 | 609 | } |
610 | 610 | |
611 | 611 | protected function getLinkByName($name, $links) |
612 | 612 | { |
613 | - if(is_array($links[$name])) |
|
613 | + if (is_array($links[$name])) |
|
614 | 614 | { |
615 | 615 | return $this->getDropdown($links[$name], $name); |
616 | 616 | } |
617 | - if($links[$name] === false) |
|
617 | + if ($links[$name] === false) |
|
618 | 618 | { |
619 | 619 | return '<li>'.$name.'</li>'; |
620 | 620 | } |
@@ -625,9 +625,9 @@ discard block |
||
625 | 625 | { |
626 | 626 | $names = array_keys($this->links); |
627 | 627 | $ret = ''; |
628 | - foreach($names as $name) |
|
628 | + foreach ($names as $name) |
|
629 | 629 | { |
630 | - $ret.=$this->getLinkByName($name, $this->links); |
|
630 | + $ret .= $this->getLinkByName($name, $this->links); |
|
631 | 631 | } |
632 | 632 | return $ret; |
633 | 633 | } |
@@ -639,7 +639,7 @@ discard block |
||
639 | 639 | { |
640 | 640 | $sites = $this->getSiteLinksForHeader(); |
641 | 641 | $links = $this->getLinksMenus(); |
642 | - $header ='<nav class="navbar navbar-default navbar-fixed-top"> |
|
642 | + $header = '<nav class="navbar navbar-default navbar-fixed-top"> |
|
643 | 643 | <div class="container-fluid"> |
644 | 644 | <!-- Brand and toggle get grouped for better mobile display --> |
645 | 645 | <div class="navbar-header"> |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | </div> |
669 | 669 | </nav>'; |
670 | 670 | $this->body = $header.$this->body; |
671 | - $this->body_tags.='style="padding-top: 60px;"'; |
|
671 | + $this->body_tags .= 'style="padding-top: 60px;"'; |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | /** Notification that is green for success */ |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | * |
690 | 690 | * @deprecated 2.0.0 Use the addNotification function instead |
691 | 691 | */ |
692 | - function add_notification($msg, $sev=self::NOTIFICATION_INFO, $dismissible=1) |
|
692 | + function add_notification($msg, $sev = self::NOTIFICATION_INFO, $dismissible = 1) |
|
693 | 693 | { |
694 | 694 | $notice = array('msg'=>$msg, 'sev'=>$sev, 'dismissible'=>$dismissible); |
695 | 695 | array_push($this->notifications, $notice); |
@@ -704,7 +704,7 @@ discard block |
||
704 | 704 | * |
705 | 705 | * @deprecated 2.0.0 Use the addNotification function instead |
706 | 706 | */ |
707 | - public function addNotification($message, $severity=self::NOTIFICATION_INFO, $dismissible=true) |
|
707 | + public function addNotification($message, $severity = self::NOTIFICATION_INFO, $dismissible = true) |
|
708 | 708 | { |
709 | 709 | array_push($this->notificatons, array('msg'=>$message, 'sev'=>$severity, 'dismissible'=>$dismissible)); |
710 | 710 | } |
@@ -715,21 +715,21 @@ discard block |
||
715 | 715 | private function renderNotifications() |
716 | 716 | { |
717 | 717 | $count = count($this->notifications); |
718 | - if($count === 0) |
|
718 | + if ($count === 0) |
|
719 | 719 | { |
720 | 720 | return; |
721 | 721 | } |
722 | - for($i = 0; $i < $count; $i++) |
|
722 | + for ($i = 0; $i < $count; $i++) |
|
723 | 723 | { |
724 | 724 | $class = 'alert '.$this->notifications[$i]['sev']; |
725 | 725 | $button = ''; |
726 | - if($this->notifications[$i]['dismissible']) |
|
726 | + if ($this->notifications[$i]['dismissible']) |
|
727 | 727 | { |
728 | 728 | $class .= ' alert-dismissible'; |
729 | 729 | $button = '<button type="button" class="close" data-dismiss="alert"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>'; |
730 | 730 | } |
731 | 731 | $prefix = ''; |
732 | - switch($this->notifications[$i]['sev']) |
|
732 | + switch ($this->notifications[$i]['sev']) |
|
733 | 733 | { |
734 | 734 | case self::NOTIFICATION_INFO: |
735 | 735 | $prefix = '<strong>Notice:</strong> '; |
@@ -742,10 +742,10 @@ discard block |
||
742 | 742 | break; |
743 | 743 | } |
744 | 744 | $style = ''; |
745 | - if($i+1 < count($this->notifications)) |
|
745 | + if ($i + 1 < count($this->notifications)) |
|
746 | 746 | { |
747 | 747 | //Not the last notification, remove the end margin |
748 | - $style='style="margin: 0px;"'; |
|
748 | + $style = 'style="margin: 0px;"'; |
|
749 | 749 | } |
750 | 750 | $this->body = ' |
751 | 751 | <div class="'.$class.'" role="alert" '.$style.'> |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | */ |
774 | 774 | private function addAnalyticsBlock() |
775 | 775 | { |
776 | - if($this->analytics === false) |
|
776 | + if ($this->analytics === false) |
|
777 | 777 | { |
778 | 778 | return; |
779 | 779 | } |
@@ -795,12 +795,12 @@ discard block |
||
795 | 795 | * @param boolean $header Draw the header |
796 | 796 | * @param boolean $analytics Include analytics on the page |
797 | 797 | */ |
798 | - public function printPage($header=true) |
|
798 | + public function printPage($header = true) |
|
799 | 799 | { |
800 | 800 | $this->renderNotifications(); |
801 | 801 | $this->addNoScript(); |
802 | 802 | $this->addAnalyticsBlock(); |
803 | - if($this->header || $header) |
|
803 | + if ($this->header || $header) |
|
804 | 804 | { |
805 | 805 | $this->addHeader(); |
806 | 806 | } |
@@ -816,7 +816,7 @@ discard block |
||
816 | 816 | * |
817 | 817 | * @deprecated 1.0.0 Use addLink instead |
818 | 818 | */ |
819 | - function add_link($name, $url=false, $submenu=false) |
|
819 | + function add_link($name, $url = false, $submenu = false) |
|
820 | 820 | { |
821 | 821 | $this->addLink($name, $url, $submenu); |
822 | 822 | } |
@@ -828,9 +828,9 @@ discard block |
||
828 | 828 | * @param false|string $url The URL to link to |
829 | 829 | * @param false|array $subment Any submenu items for the dropdown |
830 | 830 | */ |
831 | - public function addLink($name, $url=false, $submenu=false) |
|
831 | + public function addLink($name, $url = false, $submenu = false) |
|
832 | 832 | { |
833 | - if(is_array($submenu)) |
|
833 | + if (is_array($submenu)) |
|
834 | 834 | { |
835 | 835 | $submenu['_'] = $url; |
836 | 836 | $this->links[$name] = $submenu; |
@@ -852,11 +852,11 @@ discard block |
||
852 | 852 | $authLinks = $auth->getSupplementaryLinks(); |
853 | 853 | $authLinksStr = ''; |
854 | 854 | $count = count($authLinks); |
855 | - for($i = 0; $i < $count; $i++) |
|
855 | + for ($i = 0; $i < $count; $i++) |
|
856 | 856 | { |
857 | 857 | $authLinksStr .= $authLinks[$i]; |
858 | 858 | } |
859 | - if($count > 0) |
|
859 | + if ($count > 0) |
|
860 | 860 | { |
861 | 861 | $authLinksStr = 'Sign in with '.$authLinksStr; |
862 | 862 | } |