@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -class OctaORM{ |
|
2 | +class OctaORM { |
|
3 | 3 | |
4 | 4 | protected $redbean; |
5 | 5 | protected $db_field; |
@@ -29,19 +29,19 @@ discard block |
||
29 | 29 | var $num_rows; |
30 | 30 | var $result; |
31 | 31 | |
32 | - public function __construct($db){ |
|
32 | + public function __construct($db) { |
|
33 | 33 | include_once('RedBean.php'); |
34 | 34 | $this->redbean = new R(); |
35 | 35 | $this->db_field = $db; |
36 | 36 | |
37 | - if(!$this->redbean->testConnection()){ |
|
37 | + if (!$this->redbean->testConnection()) { |
|
38 | 38 | $conn = $this->initiate_database_connection($db); |
39 | 39 | $this->redbean->setup($conn); |
40 | - $this->redbean->useFeatureSet( 'novice/latest' ); |
|
40 | + $this->redbean->useFeatureSet('novice/latest'); |
|
41 | 41 | } |
42 | 42 | } |
43 | 43 | |
44 | - public function initiate_database_connection($db){ |
|
44 | + public function initiate_database_connection($db) { |
|
45 | 45 | $DB_HOST = $db['hostname']; |
46 | 46 | $DB_USERNAME = $db['username']; |
47 | 47 | $DB_PASSWORD = $db['password']; |
@@ -53,24 +53,24 @@ discard block |
||
53 | 53 | |
54 | 54 | $DB_con->exec("CREATE DATABASE IF NOT EXISTS $DB_NAME;"); |
55 | 55 | |
56 | - $DB_con = new PDO("mysql:host={$DB_HOST};dbname={$DB_NAME}",$DB_USERNAME,$DB_PASSWORD); |
|
56 | + $DB_con = new PDO("mysql:host={$DB_HOST};dbname={$DB_NAME}", $DB_USERNAME, $DB_PASSWORD); |
|
57 | 57 | $DB_con->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
58 | 58 | return $DB_con; |
59 | 59 | } |
60 | 60 | |
61 | - public function insert_id(){ |
|
61 | + public function insert_id() { |
|
62 | 62 | return $this->last_id; |
63 | 63 | } |
64 | 64 | |
65 | - public function last_query(){ |
|
65 | + public function last_query() { |
|
66 | 66 | return $this->last_query; |
67 | 67 | } |
68 | 68 | |
69 | - public function insert($array,$table){ |
|
69 | + public function insert($array, $table) { |
|
70 | 70 | $data = $this->redbean->dispense($table); |
71 | 71 | |
72 | - if($array){ |
|
73 | - foreach($array as $key=>$row){ |
|
72 | + if ($array) { |
|
73 | + foreach ($array as $key=>$row) { |
|
74 | 74 | $data->$key = $row; |
75 | 75 | } |
76 | 76 | } |
@@ -79,28 +79,28 @@ discard block |
||
79 | 79 | return ($this->last_id) ? true : false; |
80 | 80 | } |
81 | 81 | |
82 | - public function insert_batch($array,$table){ |
|
82 | + public function insert_batch($array, $table) { |
|
83 | 83 | $data = array(); |
84 | 84 | |
85 | - if($array){ |
|
86 | - foreach($array as $key_ib=>$row_ib){ |
|
85 | + if ($array) { |
|
86 | + foreach ($array as $key_ib=>$row_ib) { |
|
87 | 87 | |
88 | - $data[$key_ib]=$this->redbean->dispense($table); |
|
88 | + $data[$key_ib] = $this->redbean->dispense($table); |
|
89 | 89 | $table_fields = []; |
90 | 90 | $table_fields_val = []; |
91 | 91 | |
92 | - if($row_ib){ |
|
93 | - foreach($row_ib as $row=>$val){ |
|
92 | + if ($row_ib) { |
|
93 | + foreach ($row_ib as $row=>$val) { |
|
94 | 94 | $table_fields[] = $row; |
95 | 95 | $table_fields_val[] = $val; |
96 | 96 | } |
97 | 97 | |
98 | - if($table_fields && $table_fields_val){ |
|
99 | - foreach($table_fields as $key=>$row){ |
|
98 | + if ($table_fields && $table_fields_val) { |
|
99 | + foreach ($table_fields as $key=>$row) { |
|
100 | 100 | $data[$key_ib]->$row = $table_fields_val[$key]; |
101 | 101 | } |
102 | 102 | |
103 | - }else{ |
|
103 | + } else { |
|
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | } |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | return ($result) ? true : false; |
112 | 112 | } |
113 | 113 | |
114 | - public function update($table,$array,$id){ |
|
114 | + public function update($table, $array, $id) { |
|
115 | 115 | $data = $this->redbean->load($table, $id); |
116 | 116 | |
117 | - if($array){ |
|
118 | - foreach($array as $key=>$row){ |
|
117 | + if ($array) { |
|
118 | + foreach ($array as $key=>$row) { |
|
119 | 119 | $data->$key = $row; |
120 | 120 | } |
121 | 121 | } |
@@ -124,33 +124,33 @@ discard block |
||
124 | 124 | return ($result) ? true : false; |
125 | 125 | } |
126 | 126 | |
127 | - public function update_batch($table,$array,$where){ |
|
128 | - if($array){ |
|
129 | - foreach($array as $key_ub=>$row_ub){ |
|
127 | + public function update_batch($table, $array, $where) { |
|
128 | + if ($array) { |
|
129 | + foreach ($array as $key_ub=>$row_ub) { |
|
130 | 130 | $where_key = ''; |
131 | 131 | $table_fields = []; |
132 | 132 | $table_fields_val = []; |
133 | 133 | |
134 | - if($row_ub){ |
|
135 | - foreach($row_ub as $row=>$val){ |
|
134 | + if ($row_ub) { |
|
135 | + foreach ($row_ub as $row=>$val) { |
|
136 | 136 | |
137 | - if($row === $where){ |
|
137 | + if ($row === $where) { |
|
138 | 138 | $where_key = $val; |
139 | 139 | } |
140 | 140 | |
141 | - if($row !== $where){ |
|
141 | + if ($row !== $where) { |
|
142 | 142 | $table_fields[] = $row; |
143 | 143 | $table_fields_val[] = $val; |
144 | 144 | } |
145 | 145 | } |
146 | 146 | |
147 | 147 | $data = $this->redbean->load($table, $where_key); |
148 | - if($table_fields && $table_fields_val){ |
|
149 | - foreach($table_fields as $key=>$row){ |
|
148 | + if ($table_fields && $table_fields_val) { |
|
149 | + foreach ($table_fields as $key=>$row) { |
|
150 | 150 | $data->$row = $table_fields_val[$key]; |
151 | 151 | } |
152 | 152 | |
153 | - }else{ |
|
153 | + } else { |
|
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | |
@@ -162,32 +162,32 @@ discard block |
||
162 | 162 | return true; |
163 | 163 | } |
164 | 164 | |
165 | - public function delete($table,$id){ |
|
166 | - if(is_array($id)){ |
|
167 | - if($id){ |
|
168 | - foreach($id as $key=>$row){ |
|
169 | - $this->redbean->trash($table,$row); |
|
165 | + public function delete($table, $id) { |
|
166 | + if (is_array($id)) { |
|
167 | + if ($id) { |
|
168 | + foreach ($id as $key=>$row) { |
|
169 | + $this->redbean->trash($table, $row); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return true; |
173 | 173 | } |
174 | 174 | |
175 | - }else{ |
|
176 | - $this->redbean->trash($table,$id); |
|
175 | + } else { |
|
176 | + $this->redbean->trash($table, $id); |
|
177 | 177 | return true; |
178 | 178 | } |
179 | 179 | } |
180 | 180 | |
181 | - public function delete_all($table){ |
|
181 | + public function delete_all($table) { |
|
182 | 182 | $result = $this->redbean->wipe($table); |
183 | 183 | return ($result) ? true : false; |
184 | 184 | } |
185 | 185 | |
186 | - public function select($data){ |
|
186 | + public function select($data) { |
|
187 | 187 | $reset = []; |
188 | - if($data){ |
|
189 | - foreach($data as $key=>$row){ |
|
190 | - array_push($reset,$row); |
|
188 | + if ($data) { |
|
189 | + foreach ($data as $key=>$row) { |
|
190 | + array_push($reset, $row); |
|
191 | 191 | } |
192 | 192 | } |
193 | 193 | |
@@ -195,25 +195,25 @@ discard block |
||
195 | 195 | return $this->select; |
196 | 196 | } |
197 | 197 | |
198 | - public function where($data=null,$match=null){ |
|
198 | + public function where($data = null, $match = null) { |
|
199 | 199 | $tmp_where = ''; |
200 | 200 | $arr_check = false; |
201 | - if($data){ |
|
202 | - if(is_array($data)){ |
|
201 | + if ($data) { |
|
202 | + if (is_array($data)) { |
|
203 | 203 | end($data); |
204 | 204 | $last_element = key($data); |
205 | 205 | |
206 | - if($data){ |
|
206 | + if ($data) { |
|
207 | 207 | $arr_check = true; |
208 | - foreach($data as $key=>$row){ |
|
209 | - if($key == $last_element){ |
|
208 | + foreach ($data as $key=>$row) { |
|
209 | + if ($key == $last_element) { |
|
210 | 210 | $tmp_where .= $key."='".$row."'"; |
211 | - }else{ |
|
211 | + } else { |
|
212 | 212 | $tmp_where .= $key."='".$row."' AND "; |
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - }else{ |
|
216 | + } else { |
|
217 | 217 | $arr_check = false; |
218 | 218 | $tmp_where = "WHERE ".$data."='".$match."'"; |
219 | 219 | } |
@@ -222,25 +222,25 @@ discard block |
||
222 | 222 | $this->where = ($arr_check == false) ? $tmp_where : "WHERE ".$tmp_where; |
223 | 223 | } |
224 | 224 | |
225 | - public function or_where($data=null,$match=null){ |
|
225 | + public function or_where($data = null, $match = null) { |
|
226 | 226 | $tmp_or_where = ''; |
227 | 227 | $arr_check = false; |
228 | - if($data){ |
|
229 | - if(is_array($data)){ |
|
228 | + if ($data) { |
|
229 | + if (is_array($data)) { |
|
230 | 230 | end($data); |
231 | 231 | $last_element = key($data); |
232 | 232 | $arr_check = true; |
233 | 233 | |
234 | - if($data){ |
|
235 | - foreach($data as $key=>$row){ |
|
236 | - if($key == $last_element){ |
|
234 | + if ($data) { |
|
235 | + foreach ($data as $key=>$row) { |
|
236 | + if ($key == $last_element) { |
|
237 | 237 | $tmp_or_where .= $key."='".$row."'"; |
238 | - }else{ |
|
238 | + } else { |
|
239 | 239 | $tmp_or_where .= $key."='".$row."' AND "; |
240 | 240 | } |
241 | 241 | } |
242 | 242 | } |
243 | - }else{ |
|
243 | + } else { |
|
244 | 244 | $arr_check = false; |
245 | 245 | $tmp_or_where = "OR ".$data."='".$match."'"; |
246 | 246 | } |
@@ -249,14 +249,14 @@ discard block |
||
249 | 249 | $this->or_where = ($arr_check == false) ? $tmp_or_where : "OR ".$tmp_or_where; |
250 | 250 | } |
251 | 251 | |
252 | - public function where_in($field,$data){ |
|
252 | + public function where_in($field, $data) { |
|
253 | 253 | $where_in_fields = ''; |
254 | 254 | $last_key = end(array_keys($data)); |
255 | - if($data){ |
|
256 | - foreach($data as $key=>$row){ |
|
257 | - if($key == $last_key){ |
|
255 | + if ($data) { |
|
256 | + foreach ($data as $key=>$row) { |
|
257 | + if ($key == $last_key) { |
|
258 | 258 | $where_in_fields .= $row; |
259 | - }else{ |
|
259 | + } else { |
|
260 | 260 | $where_in_fields .= $row.","; |
261 | 261 | } |
262 | 262 | } |
@@ -265,14 +265,14 @@ discard block |
||
265 | 265 | $this->where_in = 'WHERE '.$field.' IN ('.$where_in_fields.')'; |
266 | 266 | } |
267 | 267 | |
268 | - public function or_where_in($field,$data){ |
|
268 | + public function or_where_in($field, $data) { |
|
269 | 269 | $where_in_fields = ''; |
270 | 270 | $last_key = end(array_keys($data)); |
271 | - if($data){ |
|
272 | - foreach($data as $key=>$row){ |
|
273 | - if($key == $last_key){ |
|
271 | + if ($data) { |
|
272 | + foreach ($data as $key=>$row) { |
|
273 | + if ($key == $last_key) { |
|
274 | 274 | $where_in_fields .= $row; |
275 | - }else{ |
|
275 | + } else { |
|
276 | 276 | $where_in_fields .= $row.","; |
277 | 277 | } |
278 | 278 | } |
@@ -281,14 +281,14 @@ discard block |
||
281 | 281 | $this->or_where_in = 'OR '.$field.' IN ('.$where_in_fields.')'; |
282 | 282 | } |
283 | 283 | |
284 | - public function where_not_in($field,$data){ |
|
284 | + public function where_not_in($field, $data) { |
|
285 | 285 | $where_in_fields = ''; |
286 | 286 | $last_key = end(array_keys($data)); |
287 | - if($data){ |
|
288 | - foreach($data as $key=>$row){ |
|
289 | - if($key == $last_key){ |
|
287 | + if ($data) { |
|
288 | + foreach ($data as $key=>$row) { |
|
289 | + if ($key == $last_key) { |
|
290 | 290 | $where_in_fields .= $row; |
291 | - }else{ |
|
291 | + } else { |
|
292 | 292 | $where_in_fields .= $row.","; |
293 | 293 | } |
294 | 294 | } |
@@ -297,14 +297,14 @@ discard block |
||
297 | 297 | $this->where_not_in = 'WHERE '.$field.' NOT IN ('.$where_in_fields.')'; |
298 | 298 | } |
299 | 299 | |
300 | - public function or_where_not_in($field,$data){ |
|
300 | + public function or_where_not_in($field, $data) { |
|
301 | 301 | $where_in_fields = ''; |
302 | 302 | $last_key = end(array_keys($data)); |
303 | - if($data){ |
|
304 | - foreach($data as $key=>$row){ |
|
305 | - if($key == $last_key){ |
|
303 | + if ($data) { |
|
304 | + foreach ($data as $key=>$row) { |
|
305 | + if ($key == $last_key) { |
|
306 | 306 | $where_in_fields .= $row; |
307 | - }else{ |
|
307 | + } else { |
|
308 | 308 | $where_in_fields .= $row.","; |
309 | 309 | } |
310 | 310 | } |
@@ -313,25 +313,25 @@ discard block |
||
313 | 313 | $this->or_where_not_in = 'OR '.$field.' NOT IN ('.$where_in_fields.')'; |
314 | 314 | } |
315 | 315 | |
316 | - public function like($data=null,$match=null){ |
|
316 | + public function like($data = null, $match = null) { |
|
317 | 317 | $tmp_like = ''; |
318 | 318 | $arr_check = false; |
319 | - if($data){ |
|
320 | - if(is_array($data)){ |
|
319 | + if ($data) { |
|
320 | + if (is_array($data)) { |
|
321 | 321 | end($data); |
322 | 322 | $last_element = key($data); |
323 | 323 | |
324 | - if($data){ |
|
324 | + if ($data) { |
|
325 | 325 | $arr_check = true; |
326 | - foreach($data as $key=>$row){ |
|
327 | - if($key == $last_element){ |
|
326 | + foreach ($data as $key=>$row) { |
|
327 | + if ($key == $last_element) { |
|
328 | 328 | $tmp_like .= $key." LIKE '%".$row."%'"; |
329 | - }else{ |
|
329 | + } else { |
|
330 | 330 | $tmp_like .= $key." LIKE '%".$row."%' AND "; |
331 | 331 | } |
332 | 332 | } |
333 | 333 | } |
334 | - }else{ |
|
334 | + } else { |
|
335 | 335 | $arr_check = false; |
336 | 336 | $tmp_like = "WHERE ".$data." LIKE '%".$match."%'"; |
337 | 337 | } |
@@ -341,23 +341,23 @@ discard block |
||
341 | 341 | $this->like = ($arr_check == false) ? $tmp_like : "WHERE ".$tmp_like; |
342 | 342 | } |
343 | 343 | |
344 | - public function or_like($data=null,$match=null){ |
|
344 | + public function or_like($data = null, $match = null) { |
|
345 | 345 | $tmp_or_like = ''; |
346 | - if($data){ |
|
347 | - if(is_array($data)){ |
|
346 | + if ($data) { |
|
347 | + if (is_array($data)) { |
|
348 | 348 | end($data); |
349 | 349 | $last_element = key($data); |
350 | 350 | |
351 | - if($data){ |
|
352 | - foreach($data as $key=>$row){ |
|
353 | - if($key == $last_element){ |
|
351 | + if ($data) { |
|
352 | + foreach ($data as $key=>$row) { |
|
353 | + if ($key == $last_element) { |
|
354 | 354 | $tmp_or_like .= "OR ".$key." LIKE '%".$row."%'"; |
355 | - }else{ |
|
355 | + } else { |
|
356 | 356 | $tmp_or_like .= "OR ".$key." LIKE '%".$row."%' AND "; |
357 | 357 | } |
358 | 358 | } |
359 | 359 | } |
360 | - }else{ |
|
360 | + } else { |
|
361 | 361 | $tmp_or_like = "OR ".$data." LIKE '%".$match."%'"; |
362 | 362 | } |
363 | 363 | } |
@@ -365,25 +365,25 @@ discard block |
||
365 | 365 | $this->or_like = $tmp_or_like; |
366 | 366 | } |
367 | 367 | |
368 | - public function not_like($data=null,$match=null){ |
|
368 | + public function not_like($data = null, $match = null) { |
|
369 | 369 | $tmp_like = ''; |
370 | 370 | $arr_check = false; |
371 | - if($data){ |
|
372 | - if(is_array($data)){ |
|
371 | + if ($data) { |
|
372 | + if (is_array($data)) { |
|
373 | 373 | end($data); |
374 | 374 | $last_element = key($data); |
375 | 375 | |
376 | - if($data){ |
|
376 | + if ($data) { |
|
377 | 377 | $arr_check = true; |
378 | - foreach($data as $key=>$row){ |
|
379 | - if($key == $last_element){ |
|
378 | + foreach ($data as $key=>$row) { |
|
379 | + if ($key == $last_element) { |
|
380 | 380 | $tmp_like .= $key." NOT LIKE '%".$row."%'"; |
381 | - }else{ |
|
381 | + } else { |
|
382 | 382 | $tmp_like .= $key." NOT LIKE '%".$row."%' AND "; |
383 | 383 | } |
384 | 384 | } |
385 | 385 | } |
386 | - }else{ |
|
386 | + } else { |
|
387 | 387 | $arr_check = false; |
388 | 388 | $tmp_like = "WHERE ".$data." NOT LIKE '%".$match."%'"; |
389 | 389 | } |
@@ -393,23 +393,23 @@ discard block |
||
393 | 393 | $this->like = ($arr_check == false) ? $tmp_like : "WHERE ".$tmp_like; |
394 | 394 | } |
395 | 395 | |
396 | - public function or_not_like($data=null,$match=null){ |
|
396 | + public function or_not_like($data = null, $match = null) { |
|
397 | 397 | $tmp_or_like = ''; |
398 | - if($data){ |
|
399 | - if(is_array($data)){ |
|
398 | + if ($data) { |
|
399 | + if (is_array($data)) { |
|
400 | 400 | end($data); |
401 | 401 | $last_element = key($data); |
402 | 402 | |
403 | - if($data){ |
|
404 | - foreach($data as $key=>$row){ |
|
405 | - if($key == $last_element){ |
|
403 | + if ($data) { |
|
404 | + foreach ($data as $key=>$row) { |
|
405 | + if ($key == $last_element) { |
|
406 | 406 | $tmp_or_like .= "OR ".$key." NOT LIKE '%".$row."%'"; |
407 | - }else{ |
|
407 | + } else { |
|
408 | 408 | $tmp_or_like .= "OR ".$key." NOT LIKE '%".$row."%' AND "; |
409 | 409 | } |
410 | 410 | } |
411 | 411 | } |
412 | - }else{ |
|
412 | + } else { |
|
413 | 413 | $tmp_or_like = "OR ".$data." NOT LIKE '%".$match."%'"; |
414 | 414 | } |
415 | 415 | } |
@@ -417,25 +417,25 @@ discard block |
||
417 | 417 | $this->or_like = $tmp_or_like; |
418 | 418 | } |
419 | 419 | |
420 | - public function order_by($field,$sort){ |
|
420 | + public function order_by($field, $sort) { |
|
421 | 421 | $this->order_by = $field.' '.$sort; |
422 | 422 | } |
423 | 423 | |
424 | - public function join($table,$joint,$join_type="INNER"){ |
|
424 | + public function join($table, $joint, $join_type = "INNER") { |
|
425 | 425 | $this->join = $join_type.' JOIN '.$table.' ON '.$joint; |
426 | 426 | } |
427 | 427 | |
428 | - public function group_by($field){ |
|
428 | + public function group_by($field) { |
|
429 | 429 | $this->group_by = 'GROUP BY '.$field; |
430 | 430 | } |
431 | 431 | |
432 | - public function get($table=null,$limit=null,$offset=null){ |
|
432 | + public function get($table = null, $limit = null, $offset = null) { |
|
433 | 433 | $this->table = $table; |
434 | 434 | $this->limit = $limit; |
435 | 435 | $this->offset = $offset; |
436 | 436 | } |
437 | 437 | |
438 | - public function clear_global_var(){ |
|
438 | + public function clear_global_var() { |
|
439 | 439 | $this->select = ''; |
440 | 440 | $this->where = ''; |
441 | 441 | $this->or_where = ''; |
@@ -458,10 +458,10 @@ discard block |
||
458 | 458 | $this->result = ''; |
459 | 459 | } |
460 | 460 | |
461 | - public function row(){ |
|
461 | + public function row() { |
|
462 | 462 | /*init var*/ |
463 | 463 | $result = []; |
464 | - $select = ($this->select) ? implode(',',$this->select) : '*'; |
|
464 | + $select = ($this->select) ? implode(',', $this->select) : '*'; |
|
465 | 465 | $order_by = ($this->order_by) ? 'ORDER BY '.$this->order_by : ''; |
466 | 466 | $join = ($this->join) ? $this->join : ''; |
467 | 467 | $group_by = ($this->group_by) ? $this->group_by : ''; |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | $this->row = "SELECT {$select} FROM {$table} {$join} {$where} {$or_where} {$where_in} {$or_where_in} {$where_not_in} {$or_where_not_in} {$like} {$or_like} {$not_like} {$or_not_like} {$group_by} {$order_by} {$limit} {$offset}"; |
486 | 486 | $this->last_query = $this->row; |
487 | 487 | $data = $this->redbean->getRow($this->row); |
488 | - if($data){ |
|
489 | - foreach($data as $key=>$row){ |
|
488 | + if ($data) { |
|
489 | + foreach ($data as $key=>$row) { |
|
490 | 490 | $result[$key] = $row; |
491 | 491 | } |
492 | 492 | } |
@@ -498,10 +498,10 @@ discard block |
||
498 | 498 | return $result; |
499 | 499 | } |
500 | 500 | |
501 | - public function num_rows(){ |
|
501 | + public function num_rows() { |
|
502 | 502 | /*init var*/ |
503 | - $result = 0;#array(); |
|
504 | - $select = ($this->select) ? implode(',',$this->select) : '*'; |
|
503 | + $result = 0; #array(); |
|
504 | + $select = ($this->select) ? implode(',', $this->select) : '*'; |
|
505 | 505 | $order_by = ($this->order_by) ? 'ORDER BY '.$this->order_by : ''; |
506 | 506 | $join = ($this->join) ? $this->join : ''; |
507 | 507 | $group_by = ($this->group_by) ? $this->group_by : ''; |
@@ -534,10 +534,10 @@ discard block |
||
534 | 534 | return $result; |
535 | 535 | } |
536 | 536 | |
537 | - public function result(){ |
|
537 | + public function result() { |
|
538 | 538 | /*init var*/ |
539 | 539 | $result = array(); |
540 | - $select = ($this->select) ? implode(',',$this->select) : '*'; |
|
540 | + $select = ($this->select) ? implode(',', $this->select) : '*'; |
|
541 | 541 | $order_by = ($this->order_by) ? 'ORDER BY '.$this->order_by : ''; |
542 | 542 | $join = ($this->join) ? $this->join : ''; |
543 | 543 | $group_by = ($this->group_by) ? $this->group_by : ''; |
@@ -563,9 +563,9 @@ discard block |
||
563 | 563 | $this->result = "SELECT {$select} FROM {$table} {$join} {$where} {$or_where} {$where_in} {$or_where_in} {$where_not_in} {$or_where_not_in} {$like} {$or_like} {$not_like} {$or_not_like} {$group_by} {$order_by} {$limit} {$offset}"; |
564 | 564 | $this->last_query = $this->result; |
565 | 565 | $data = $this->redbean->getAll($this->result); |
566 | - if($data){ |
|
567 | - foreach($data as $key=>$row){ |
|
568 | - $result[$key] = (object)$row; |
|
566 | + if ($data) { |
|
567 | + foreach ($data as $key=>$row) { |
|
568 | + $result[$key] = (object) $row; |
|
569 | 569 | } |
570 | 570 | } |
571 | 571 | |
@@ -577,166 +577,166 @@ discard block |
||
577 | 577 | } |
578 | 578 | |
579 | 579 | /*Database*/ |
580 | - public function wipe($beanType){ |
|
580 | + public function wipe($beanType) { |
|
581 | 581 | $result = $this->redbean->wipe($beanType); |
582 | 582 | return ($result) ? $result : false; |
583 | 583 | } |
584 | 584 | |
585 | - public function dispense($data){ |
|
585 | + public function dispense($data) { |
|
586 | 586 | $result = $this->redbean->dispense($data); |
587 | 587 | return ($result) ? true : false; |
588 | 588 | } |
589 | 589 | |
590 | - public function store($data){ |
|
590 | + public function store($data) { |
|
591 | 591 | $result = $this->redbean->store($data); |
592 | 592 | return ($result) ? true : false; |
593 | 593 | } |
594 | 594 | |
595 | - public function inspect($data){ |
|
596 | - if($data){ |
|
597 | - if(is_array($data)){ |
|
595 | + public function inspect($data) { |
|
596 | + if ($data) { |
|
597 | + if (is_array($data)) { |
|
598 | 598 | |
599 | 599 | $result = array(); |
600 | - foreach($data as $key=>$row){ |
|
601 | - $result[$key]=$this->redbean->inspect($row); |
|
600 | + foreach ($data as $key=>$row) { |
|
601 | + $result[$key] = $this->redbean->inspect($row); |
|
602 | 602 | } |
603 | 603 | |
604 | 604 | return ($result) ? $result : false; |
605 | 605 | |
606 | - }else{ |
|
606 | + } else { |
|
607 | 607 | $this->redbean->inspect($data); |
608 | 608 | return true; |
609 | 609 | } |
610 | 610 | } |
611 | 611 | } |
612 | 612 | |
613 | - public function get_all_tables(){ |
|
613 | + public function get_all_tables() { |
|
614 | 614 | $result = $this->redbean->inspect(); |
615 | 615 | return ($result) ? $result : false; |
616 | 616 | } |
617 | 617 | |
618 | - public function add_database($db_name,$hostname,$user_name,$password,$frozen=null){ |
|
619 | - $result = $this->redbean->addDatabase($db_name, $hostname, $user_name, $password, $frozen ); |
|
618 | + public function add_database($db_name, $hostname, $user_name, $password, $frozen = null) { |
|
619 | + $result = $this->redbean->addDatabase($db_name, $hostname, $user_name, $password, $frozen); |
|
620 | 620 | return ($result) ? true : false; |
621 | 621 | } |
622 | 622 | |
623 | - public function select_database($db_name){ |
|
623 | + public function select_database($db_name) { |
|
624 | 624 | $result = $this->redbean->selectDatabase($db_name); |
625 | 625 | return ($result) ? true : false; |
626 | 626 | } |
627 | 627 | |
628 | - public function set_database(){ |
|
628 | + public function set_database() { |
|
629 | 629 | $result = $this->redbean->selectDatabase('default'); |
630 | 630 | return ($result) ? true : false; |
631 | 631 | } |
632 | 632 | |
633 | - public function begin(){ |
|
633 | + public function begin() { |
|
634 | 634 | $result = $this->redbean->begin(); |
635 | 635 | return ($result) ? true : false; |
636 | 636 | } |
637 | 637 | |
638 | - public function commit(){ |
|
638 | + public function commit() { |
|
639 | 639 | $result = $this->redbean->commit(); |
640 | 640 | return ($result) ? true : false; |
641 | 641 | } |
642 | 642 | |
643 | - public function roll_back(){ |
|
643 | + public function roll_back() { |
|
644 | 644 | $result = $this->redbean->rollback(); |
645 | 645 | return ($result) ? true : false; |
646 | 646 | } |
647 | 647 | |
648 | - public function reset_query_count(){ |
|
648 | + public function reset_query_count() { |
|
649 | 649 | $result = $this->redbean->resetQueryCount(); |
650 | 650 | return ($result) ? true : false; |
651 | 651 | } |
652 | 652 | |
653 | - public function get_query_count(){ |
|
653 | + public function get_query_count() { |
|
654 | 654 | $result = $this->redbean->getQueryCount(); |
655 | 655 | return ($result) ? $result : false; |
656 | 656 | } |
657 | 657 | |
658 | - public function start_logging(){ |
|
658 | + public function start_logging() { |
|
659 | 659 | $result = $this->redbean->startLogging(); |
660 | 660 | return ($result) ? true : false; |
661 | 661 | } |
662 | 662 | |
663 | - public function get_logs(){ |
|
663 | + public function get_logs() { |
|
664 | 664 | $result = $this->redbean->getLogs(); |
665 | 665 | return ($result) ? $result : false; |
666 | 666 | } |
667 | 667 | |
668 | 668 | /*querying*/ |
669 | - public function exec($data){ |
|
669 | + public function exec($data) { |
|
670 | 670 | $result = $this->redbean->exec($data); |
671 | 671 | return ($result) ? $result : false; |
672 | 672 | } |
673 | 673 | |
674 | - public function get_all($table){ |
|
674 | + public function get_all($table) { |
|
675 | 675 | $result = $this->redbean->getAll($table); |
676 | 676 | return ($result) ? $result : false; |
677 | 677 | } |
678 | 678 | |
679 | - public function get_row($data){ |
|
679 | + public function get_row($data) { |
|
680 | 680 | $result = $this->redbean->getRow($data); |
681 | 681 | return ($result) ? $result : false; |
682 | 682 | } |
683 | 683 | |
684 | - public function get_column($data){ |
|
684 | + public function get_column($data) { |
|
685 | 685 | $result = $this->redbean->getCol($data); |
686 | 686 | return ($result) ? $result : false; |
687 | 687 | } |
688 | 688 | |
689 | - public function get_cell($data){ |
|
689 | + public function get_cell($data) { |
|
690 | 690 | $result = $this->redbean->getCell($data); |
691 | 691 | return ($result) ? $result : false; |
692 | 692 | } |
693 | 693 | |
694 | - public function get_assoc($data){ |
|
694 | + public function get_assoc($data) { |
|
695 | 695 | $result = $this->redbean->getAssoc($data); |
696 | 696 | return ($result) ? $result : false; |
697 | 697 | } |
698 | 698 | |
699 | - public function get_inserted_id(){ |
|
699 | + public function get_inserted_id() { |
|
700 | 700 | $result = $this->redbean->getInsertID(); |
701 | 701 | return ($result) ? $result : false; |
702 | 702 | } |
703 | 703 | |
704 | - public function convert_to_beans($type,$rows,$metamask=null){ |
|
705 | - $result = $this->redbean->convertToBeans( $type, $rows, $metamask ); |
|
704 | + public function convert_to_beans($type, $rows, $metamask = null) { |
|
705 | + $result = $this->redbean->convertToBeans($type, $rows, $metamask); |
|
706 | 706 | return ($result) ? $result : false; |
707 | 707 | } |
708 | 708 | |
709 | 709 | /*Data Tools*/ |
710 | 710 | /*this will return an html data*/ |
711 | - public function get_look($sql, $bindings = array(), $keys = array( 'selected', 'id', 'name' ), $template = '<option %s value="%s">%s</option>', $filter = 'trim', $glue = '' ){ |
|
712 | - $result = $this->redbean->getLook()->look($sql,$bindings,$keys,$template,$filter,$glue); |
|
711 | + public function get_look($sql, $bindings = array(), $keys = array('selected', 'id', 'name'), $template = '<option %s value="%s">%s</option>', $filter = 'trim', $glue = '') { |
|
712 | + $result = $this->redbean->getLook()->look($sql, $bindings, $keys, $template, $filter, $glue); |
|
713 | 713 | return ($result) ? $result : false; |
714 | 714 | } |
715 | 715 | |
716 | - public function match_up($type, $sql, $bindings = array(), $onFoundDo = NULL, $onNotFoundDo = NULL, &$bean = NULL){ |
|
716 | + public function match_up($type, $sql, $bindings = array(), $onFoundDo = NULL, $onNotFoundDo = NULL, &$bean = NULL) { |
|
717 | 717 | $result = $this->redbean->matchUp($type, $sql, $bindings, $onFoundDo, $onNotFoundDo, $bean); |
718 | 718 | return ($result) ? $result : false; |
719 | 719 | } |
720 | 720 | |
721 | - public function csv($sql, $id = array(), $bindings = array()){ |
|
722 | - $result = $this->redbean->csv($sql,$id,$bindings); |
|
721 | + public function csv($sql, $id = array(), $bindings = array()) { |
|
722 | + $result = $this->redbean->csv($sql, $id, $bindings); |
|
723 | 723 | return ($result) ? true : false; |
724 | 724 | } |
725 | 725 | |
726 | - public function find_all($table){ |
|
726 | + public function find_all($table) { |
|
727 | 727 | $result = $this->redbean->findAll($table); |
728 | 728 | return ($result) ? $result : false; |
729 | 729 | } |
730 | 730 | |
731 | - public function find($type,$sql,$bindings){ |
|
732 | - $result = $this->redbean->find($type,$sql,$bindings); |
|
731 | + public function find($type, $sql, $bindings) { |
|
732 | + $result = $this->redbean->find($type, $sql, $bindings); |
|
733 | 733 | return ($result) ? $result : false; |
734 | 734 | } |
735 | 735 | |
736 | - public function csv_result(){ |
|
736 | + public function csv_result() { |
|
737 | 737 | /*init var*/ |
738 | 738 | $result = array(); |
739 | - $select = ($this->select) ? implode(',',$this->select) : '*'; |
|
739 | + $select = ($this->select) ? implode(',', $this->select) : '*'; |
|
740 | 740 | $order_by = ($this->order_by) ? 'ORDER BY '.$this->order_by : ''; |
741 | 741 | $join = ($this->join) ? $this->join : ''; |
742 | 742 | $group_by = ($this->group_by) ? $this->group_by : ''; |
@@ -758,9 +758,9 @@ discard block |
||
758 | 758 | |
759 | 759 | $this->last_query = "SELECT {$select} FROM {$table} {$join} {$where} {$or_where} {$where_in} {$or_where_in} {$where_not_in} {$or_where_not_in} {$like} {$or_like} {$not_like} {$or_not_like} {$group_by} {$order_by} {$limit}"; |
760 | 760 | $data = $this->redbean->csv("SELECT {$select} FROM {$table} {$join} {$where} {$or_where} {$where_in} {$or_where_in} {$where_not_in} {$or_where_not_in} {$like} {$or_like} {$not_like} {$or_not_like} {$group_by} {$order_by} {$limit}"); |
761 | - if($data){ |
|
762 | - foreach($data as $key=>$row){ |
|
763 | - $result[$key] = (object)$row; |
|
761 | + if ($data) { |
|
762 | + foreach ($data as $key=>$row) { |
|
763 | + $result[$key] = (object) $row; |
|
764 | 764 | } |
765 | 765 | } |
766 | 766 | |
@@ -772,157 +772,157 @@ discard block |
||
772 | 772 | } |
773 | 773 | |
774 | 774 | /*Fluid and Frozen*/ |
775 | - public function freeze($data=null){ |
|
776 | - if($data){ |
|
777 | - if(is_array($data)){ |
|
778 | - if($data){ |
|
775 | + public function freeze($data = null) { |
|
776 | + if ($data) { |
|
777 | + if (is_array($data)) { |
|
778 | + if ($data) { |
|
779 | 779 | |
780 | 780 | $data = array(); |
781 | - foreach($data as $key=>$row){ |
|
781 | + foreach ($data as $key=>$row) { |
|
782 | 782 | $data[$key] = $row; |
783 | 783 | } |
784 | 784 | |
785 | 785 | $this->redbean->freeze($data); |
786 | 786 | } |
787 | 787 | } |
788 | - }else{ |
|
788 | + } else { |
|
789 | 789 | $this->redbean->freeze(TRUE); |
790 | 790 | } |
791 | 791 | return true; |
792 | 792 | } |
793 | 793 | |
794 | 794 | /*Debugging*/ |
795 | - public function fancy_debug($toggle = TRUE){ |
|
795 | + public function fancy_debug($toggle = TRUE) { |
|
796 | 796 | $result = $this->redbean->fancyDebug($toggle); |
797 | 797 | return ($result) ? $result : false; |
798 | 798 | } |
799 | 799 | |
800 | 800 | /*value "true", "false"*/ |
801 | - public function debug($tf = TRUE, $mode = 0){ |
|
802 | - $result = $this->redbean->debug($tf,$mode); |
|
801 | + public function debug($tf = TRUE, $mode = 0) { |
|
802 | + $result = $this->redbean->debug($tf, $mode); |
|
803 | 803 | return ($result) ? $result : false; |
804 | 804 | } |
805 | 805 | |
806 | - public function dump($data){ |
|
806 | + public function dump($data) { |
|
807 | 807 | $result = $this->redbean->dump($data); |
808 | 808 | return ($result) ? $result : false; |
809 | 809 | } |
810 | 810 | |
811 | - public function test_connection(){ |
|
811 | + public function test_connection() { |
|
812 | 812 | $result = $this->redbean->testConnection(); |
813 | 813 | return ($result) ? $result : false; |
814 | 814 | } |
815 | 815 | |
816 | 816 | /*Aliases*/ |
817 | - public function load($oodb, $types, $id){ |
|
817 | + public function load($oodb, $types, $id) { |
|
818 | 818 | $result = $this->redbean->load($oodb, $types, $id); |
819 | 819 | return ($result) ? $result : false; |
820 | 820 | } |
821 | 821 | |
822 | - public function fetch_as($type){ |
|
822 | + public function fetch_as($type) { |
|
823 | 823 | $result = $this->redbean->fetchAs($type); |
824 | 824 | return ($result) ? $result : false; |
825 | 825 | } |
826 | 826 | |
827 | - public function alias($alias_name){ |
|
827 | + public function alias($alias_name) { |
|
828 | 828 | $result = $this->redbean->alias($alias_name); |
829 | 829 | return ($result) ? $result : false; |
830 | 830 | } |
831 | 831 | |
832 | 832 | /*Count*/ |
833 | - public function count(){ |
|
833 | + public function count() { |
|
834 | 834 | $result = $this->redbean->count(); |
835 | 835 | return ($result) ? $result : false; |
836 | 836 | } |
837 | 837 | |
838 | - public function count_own($type){ |
|
838 | + public function count_own($type) { |
|
839 | 839 | $result = $this->redbean->countOwn($type); |
840 | 840 | return ($result) ? $result : false; |
841 | 841 | } |
842 | 842 | |
843 | - public function count_shared($type){ |
|
843 | + public function count_shared($type) { |
|
844 | 844 | $result = $this->redbean->countOwn($type); |
845 | 845 | return ($result) ? $result : false; |
846 | 846 | } |
847 | 847 | |
848 | 848 | /*Labels, Enums, Tags*/ |
849 | - public function dispense_labels($type,$labels){ |
|
850 | - $result = $this->redbean->dispenseLabels($type,$labels); |
|
849 | + public function dispense_labels($type, $labels) { |
|
850 | + $result = $this->redbean->dispenseLabels($type, $labels); |
|
851 | 851 | return ($result) ? $result : false; |
852 | 852 | } |
853 | 853 | |
854 | - public function gather_labels($beans){ |
|
854 | + public function gather_labels($beans) { |
|
855 | 855 | $result = $this->redbean->gatherLabels($beans); |
856 | 856 | return ($result) ? $result : false; |
857 | 857 | } |
858 | 858 | |
859 | - public function enum($enum){ |
|
859 | + public function enum($enum) { |
|
860 | 860 | $result = $this->redbean->enum($enum); |
861 | 861 | return ($result) ? $result : false; |
862 | 862 | } |
863 | 863 | |
864 | - public function tag($bean, $tagList){ |
|
864 | + public function tag($bean, $tagList) { |
|
865 | 865 | $result = $this->redbean->tag($bean, $tagList); |
866 | 866 | return ($result) ? $result : false; |
867 | 867 | } |
868 | 868 | |
869 | - public function add_tag($bean, $tagList){ |
|
869 | + public function add_tag($bean, $tagList) { |
|
870 | 870 | $result = $this->redbean->addTags($bean, $tagList); |
871 | 871 | return ($result) ? $result : false; |
872 | 872 | } |
873 | 873 | |
874 | - public function tagged($beanType,$tagList,$sql='',$bindings=array()){ |
|
875 | - $result = $this->redbean->addTags($beanType,$tagList,$sql,$bindings); |
|
874 | + public function tagged($beanType, $tagList, $sql = '', $bindings = array()) { |
|
875 | + $result = $this->redbean->addTags($beanType, $tagList, $sql, $bindings); |
|
876 | 876 | return ($result) ? $result : false; |
877 | 877 | } |
878 | 878 | |
879 | - public function untag($bean,$tagList){ |
|
880 | - $result = $this->redbean->untag($bean,$tagList); |
|
879 | + public function untag($bean, $tagList) { |
|
880 | + $result = $this->redbean->untag($bean, $tagList); |
|
881 | 881 | return ($result) ? $result : false; |
882 | 882 | } |
883 | 883 | |
884 | - public function tagged_all($beanType,$tagList,$sql='',$bindings=array()){ |
|
885 | - $result = $this->redbean->taggedAll($beanType,$tagList,$sql,$bindings); |
|
884 | + public function tagged_all($beanType, $tagList, $sql = '', $bindings = array()) { |
|
885 | + $result = $this->redbean->taggedAll($beanType, $tagList, $sql, $bindings); |
|
886 | 886 | return ($result) ? $result : false; |
887 | 887 | } |
888 | 888 | |
889 | - public function count_tagged_all($beanType,$tagList,$sql='',$bindings=array()){ |
|
890 | - $result = $this->redbean->countTaggedAll($beanType,$tagList,$sql,$bindings); |
|
889 | + public function count_tagged_all($beanType, $tagList, $sql = '', $bindings = array()) { |
|
890 | + $result = $this->redbean->countTaggedAll($beanType, $tagList, $sql, $bindings); |
|
891 | 891 | return ($result) ? $result : false; |
892 | 892 | } |
893 | 893 | |
894 | - public function count_tagged($beanType,$tagList,$sql='',$bindings=array()){ |
|
895 | - $result = $this->redbean->countTagged($beanType,$tagList,$sql,$bindings); |
|
894 | + public function count_tagged($beanType, $tagList, $sql = '', $bindings = array()) { |
|
895 | + $result = $this->redbean->countTagged($beanType, $tagList, $sql, $bindings); |
|
896 | 896 | return ($result) ? $result : false; |
897 | 897 | } |
898 | 898 | |
899 | - public function has_tag($bean,$tags,$all=FALSE){ |
|
900 | - $result = $this->redbean->hasTag($bean,$tags,$all); |
|
899 | + public function has_tag($bean, $tags, $all = FALSE) { |
|
900 | + $result = $this->redbean->hasTag($bean, $tags, $all); |
|
901 | 901 | return ($result) ? $result : false; |
902 | 902 | } |
903 | 903 | |
904 | 904 | /*Import and Export*/ |
905 | - public function import($array, $selection = FALSE, $notrim = FALSE){ |
|
906 | - $result = $this->redbean->import($array,$selection,$notrim); |
|
905 | + public function import($array, $selection = FALSE, $notrim = FALSE) { |
|
906 | + $result = $this->redbean->import($array, $selection, $notrim); |
|
907 | 907 | return ($result) ? $result : false; |
908 | 908 | } |
909 | 909 | |
910 | - public function import_row($row){ |
|
910 | + public function import_row($row) { |
|
911 | 911 | $result = $this->redbean->importRow($row); |
912 | 912 | return ($result) ? $result : false; |
913 | 913 | } |
914 | 914 | |
915 | - public function export($meta = FALSE, $parents = FALSE, $onlyMe = FALSE, $filters = array()){ |
|
916 | - $result = $this->redbean->export($meta,$parents,$onlyMe,$filters); |
|
915 | + public function export($meta = FALSE, $parents = FALSE, $onlyMe = FALSE, $filters = array()) { |
|
916 | + $result = $this->redbean->export($meta, $parents, $onlyMe, $filters); |
|
917 | 917 | return ($result) ? $result : false; |
918 | 918 | } |
919 | 919 | |
920 | - public function export_all($beans, $parents = FALSE, $filters = array()){ |
|
921 | - $result = $this->redbean->exportAll($beans,$parents,$filters); |
|
920 | + public function export_all($beans, $parents = FALSE, $filters = array()) { |
|
921 | + $result = $this->redbean->exportAll($beans, $parents, $filters); |
|
922 | 922 | return ($result) ? $result : false; |
923 | 923 | } |
924 | 924 | |
925 | - public function import_from($sourceBean){ |
|
925 | + public function import_from($sourceBean) { |
|
926 | 926 | $result = $this->redbean->importFrom($sourceBean); |
927 | 927 | return ($result) ? $result : false; |
928 | 928 | } |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $data[$key_ib]->$row = $table_fields_val[$key]; |
101 | 101 | } |
102 | 102 | |
103 | - }else{ |
|
103 | + } else{ |
|
104 | 104 | return false; |
105 | 105 | } |
106 | 106 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | $data->$row = $table_fields_val[$key]; |
151 | 151 | } |
152 | 152 | |
153 | - }else{ |
|
153 | + } else{ |
|
154 | 154 | return false; |
155 | 155 | } |
156 | 156 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | return true; |
173 | 173 | } |
174 | 174 | |
175 | - }else{ |
|
175 | + } else{ |
|
176 | 176 | $this->redbean->trash($table,$id); |
177 | 177 | return true; |
178 | 178 | } |
@@ -208,12 +208,12 @@ discard block |
||
208 | 208 | foreach($data as $key=>$row){ |
209 | 209 | if($key == $last_element){ |
210 | 210 | $tmp_where .= $key."='".$row."'"; |
211 | - }else{ |
|
211 | + } else{ |
|
212 | 212 | $tmp_where .= $key."='".$row."' AND "; |
213 | 213 | } |
214 | 214 | } |
215 | 215 | } |
216 | - }else{ |
|
216 | + } else{ |
|
217 | 217 | $arr_check = false; |
218 | 218 | $tmp_where = "WHERE ".$data."='".$match."'"; |
219 | 219 | } |
@@ -235,12 +235,12 @@ discard block |
||
235 | 235 | foreach($data as $key=>$row){ |
236 | 236 | if($key == $last_element){ |
237 | 237 | $tmp_or_where .= $key."='".$row."'"; |
238 | - }else{ |
|
238 | + } else{ |
|
239 | 239 | $tmp_or_where .= $key."='".$row."' AND "; |
240 | 240 | } |
241 | 241 | } |
242 | 242 | } |
243 | - }else{ |
|
243 | + } else{ |
|
244 | 244 | $arr_check = false; |
245 | 245 | $tmp_or_where = "OR ".$data."='".$match."'"; |
246 | 246 | } |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | foreach($data as $key=>$row){ |
257 | 257 | if($key == $last_key){ |
258 | 258 | $where_in_fields .= $row; |
259 | - }else{ |
|
259 | + } else{ |
|
260 | 260 | $where_in_fields .= $row.","; |
261 | 261 | } |
262 | 262 | } |
@@ -272,7 +272,7 @@ discard block |
||
272 | 272 | foreach($data as $key=>$row){ |
273 | 273 | if($key == $last_key){ |
274 | 274 | $where_in_fields .= $row; |
275 | - }else{ |
|
275 | + } else{ |
|
276 | 276 | $where_in_fields .= $row.","; |
277 | 277 | } |
278 | 278 | } |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | foreach($data as $key=>$row){ |
289 | 289 | if($key == $last_key){ |
290 | 290 | $where_in_fields .= $row; |
291 | - }else{ |
|
291 | + } else{ |
|
292 | 292 | $where_in_fields .= $row.","; |
293 | 293 | } |
294 | 294 | } |
@@ -304,7 +304,7 @@ discard block |
||
304 | 304 | foreach($data as $key=>$row){ |
305 | 305 | if($key == $last_key){ |
306 | 306 | $where_in_fields .= $row; |
307 | - }else{ |
|
307 | + } else{ |
|
308 | 308 | $where_in_fields .= $row.","; |
309 | 309 | } |
310 | 310 | } |
@@ -326,12 +326,12 @@ discard block |
||
326 | 326 | foreach($data as $key=>$row){ |
327 | 327 | if($key == $last_element){ |
328 | 328 | $tmp_like .= $key." LIKE '%".$row."%'"; |
329 | - }else{ |
|
329 | + } else{ |
|
330 | 330 | $tmp_like .= $key." LIKE '%".$row."%' AND "; |
331 | 331 | } |
332 | 332 | } |
333 | 333 | } |
334 | - }else{ |
|
334 | + } else{ |
|
335 | 335 | $arr_check = false; |
336 | 336 | $tmp_like = "WHERE ".$data." LIKE '%".$match."%'"; |
337 | 337 | } |
@@ -352,12 +352,12 @@ discard block |
||
352 | 352 | foreach($data as $key=>$row){ |
353 | 353 | if($key == $last_element){ |
354 | 354 | $tmp_or_like .= "OR ".$key." LIKE '%".$row."%'"; |
355 | - }else{ |
|
355 | + } else{ |
|
356 | 356 | $tmp_or_like .= "OR ".$key." LIKE '%".$row."%' AND "; |
357 | 357 | } |
358 | 358 | } |
359 | 359 | } |
360 | - }else{ |
|
360 | + } else{ |
|
361 | 361 | $tmp_or_like = "OR ".$data." LIKE '%".$match."%'"; |
362 | 362 | } |
363 | 363 | } |
@@ -378,12 +378,12 @@ discard block |
||
378 | 378 | foreach($data as $key=>$row){ |
379 | 379 | if($key == $last_element){ |
380 | 380 | $tmp_like .= $key." NOT LIKE '%".$row."%'"; |
381 | - }else{ |
|
381 | + } else{ |
|
382 | 382 | $tmp_like .= $key." NOT LIKE '%".$row."%' AND "; |
383 | 383 | } |
384 | 384 | } |
385 | 385 | } |
386 | - }else{ |
|
386 | + } else{ |
|
387 | 387 | $arr_check = false; |
388 | 388 | $tmp_like = "WHERE ".$data." NOT LIKE '%".$match."%'"; |
389 | 389 | } |
@@ -404,12 +404,12 @@ discard block |
||
404 | 404 | foreach($data as $key=>$row){ |
405 | 405 | if($key == $last_element){ |
406 | 406 | $tmp_or_like .= "OR ".$key." NOT LIKE '%".$row."%'"; |
407 | - }else{ |
|
407 | + } else{ |
|
408 | 408 | $tmp_or_like .= "OR ".$key." NOT LIKE '%".$row."%' AND "; |
409 | 409 | } |
410 | 410 | } |
411 | 411 | } |
412 | - }else{ |
|
412 | + } else{ |
|
413 | 413 | $tmp_or_like = "OR ".$data." NOT LIKE '%".$match."%'"; |
414 | 414 | } |
415 | 415 | } |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | |
604 | 604 | return ($result) ? $result : false; |
605 | 605 | |
606 | - }else{ |
|
606 | + } else{ |
|
607 | 607 | $this->redbean->inspect($data); |
608 | 608 | return true; |
609 | 609 | } |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | $this->redbean->freeze($data); |
786 | 786 | } |
787 | 787 | } |
788 | - }else{ |
|
788 | + } else{ |
|
789 | 789 | $this->redbean->freeze(TRUE); |
790 | 790 | } |
791 | 791 | return true; |