@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | class Model { |
32 | 32 | |
33 | - /** |
|
33 | + /** |
|
34 | 34 | * This model's default database table. |
35 | 35 | * @var string the name of table |
36 | 36 | */ |
@@ -173,12 +173,12 @@ discard block |
||
173 | 173 | if ($db !== null) { |
174 | 174 | $this->setDb($db); |
175 | 175 | } else { |
176 | - /** |
|
177 | - * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
|
178 | - * to prevent duplication |
|
179 | - */ |
|
180 | - $obj = & get_instance(); |
|
181 | - $this->setDb(clone $obj->database); |
|
176 | + /** |
|
177 | + * NOTE: Need use "clone" because some Model need have the personal instance of the database library |
|
178 | + * to prevent duplication |
|
179 | + */ |
|
180 | + $obj = & get_instance(); |
|
181 | + $this->setDb(clone $obj->database); |
|
182 | 182 | } |
183 | 183 | array_unshift($this->beforeCreateCallbacks, 'removeProtectedTableColumns'); |
184 | 184 | array_unshift($this->beforeUpdateCallbacks, 'removeProtectedTableColumns'); |
@@ -623,7 +623,7 @@ discard block |
||
623 | 623 | * Only get deleted rows on the next call |
624 | 624 | * |
625 | 625 | * @return object the current instance |
626 | - */ |
|
626 | + */ |
|
627 | 627 | public function onlyRecordDeleted() { |
628 | 628 | $this->returnOnlyRecordDeleted = true; |
629 | 629 | return $this; |
@@ -649,8 +649,8 @@ discard block |
||
649 | 649 | * @return array the data after add field for updated time |
650 | 650 | */ |
651 | 651 | public function updatedAt($row) { |
652 | - $row['updated_at'] = date('Y-m-d H:i:s'); |
|
653 | - return $row; |
|
652 | + $row['updated_at'] = date('Y-m-d H:i:s'); |
|
653 | + return $row; |
|
654 | 654 | } |
655 | 655 | |
656 | 656 | /** |
@@ -695,7 +695,7 @@ discard block |
||
695 | 695 | */ |
696 | 696 | public function removeProtectedTableColumns($row) { |
697 | 697 | foreach ($this->protectedTableColumns as $attr) { |
698 | - if (isset($row[$attr])) { |
|
698 | + if (isset($row[$attr])) { |
|
699 | 699 | unset($row[$attr]); |
700 | 700 | } |
701 | 701 | } |
@@ -818,23 +818,23 @@ discard block |
||
818 | 818 | return false; |
819 | 819 | } |
820 | 820 | |
821 | - /** |
|
822 | - * Get the record return type array or object |
|
823 | - * |
|
824 | - * @return string|boolean |
|
825 | - */ |
|
821 | + /** |
|
822 | + * Get the record return type array or object |
|
823 | + * |
|
824 | + * @return string|boolean |
|
825 | + */ |
|
826 | 826 | protected function getReturnType(){ |
827 | 827 | $type = false; |
828 | 828 | if ($this->temporaryReturnRecordType == 'array') { |
829 | - $type = 'array'; |
|
829 | + $type = 'array'; |
|
830 | 830 | } |
831 | 831 | return $type; |
832 | 832 | } |
833 | 833 | |
834 | - /** |
|
835 | - * Check if soft delete is enable setting the condition |
|
836 | - * @return object the current instance |
|
837 | - */ |
|
834 | + /** |
|
835 | + * Check if soft delete is enable setting the condition |
|
836 | + * @return object the current instance |
|
837 | + */ |
|
838 | 838 | protected function checkForSoftDelete(){ |
839 | 839 | if ($this->softDeleteStatus && $this->returnRecordWithDeleted !== true) { |
840 | 840 | $this->getQueryBuilder()->where( |
@@ -845,16 +845,16 @@ discard block |
||
845 | 845 | return $this; |
846 | 846 | } |
847 | 847 | |
848 | - /** |
|
849 | - * Relate for "manyToOne" and "oneToMany" |
|
850 | - * |
|
851 | - * @param string $relationship the name of relation |
|
852 | - * @param string|array $options the model and primary key values |
|
853 | - * @param object|array $row the row to update |
|
854 | - * @param string $type the type can be "manyToOne", "oneToMany" |
|
855 | - * |
|
856 | - * @return array|object the final row values |
|
857 | - */ |
|
848 | + /** |
|
849 | + * Relate for "manyToOne" and "oneToMany" |
|
850 | + * |
|
851 | + * @param string $relationship the name of relation |
|
852 | + * @param string|array $options the model and primary key values |
|
853 | + * @param object|array $row the row to update |
|
854 | + * @param string $type the type can be "manyToOne", "oneToMany" |
|
855 | + * |
|
856 | + * @return array|object the final row values |
|
857 | + */ |
|
858 | 858 | protected function relateOneToManyAndManyToOne($relationship, $options, $row, $type){ |
859 | 859 | if (in_array($relationship, $this->withs)) { |
860 | 860 | get_instance()->loader->model($options['model'], $relationship . '_model'); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | */ |
112 | 112 | public function __construct(DatabaseConnection $connection = null) { |
113 | 113 | parent::__construct(); |
114 | - if ($connection !== null) { |
|
114 | + if ($connection !== null) { |
|
115 | 115 | $this->connection = $connection; |
116 | 116 | } |
117 | 117 | } |
@@ -385,9 +385,9 @@ discard block |
||
385 | 385 | $this->queryCount++; |
386 | 386 | |
387 | 387 | $queryResult = $this->queryRunner->setQuery($query) |
388 | - ->setReturnType($returnAsList) |
|
389 | - ->setReturnAsArray($returnAsArray) |
|
390 | - ->execute(); |
|
388 | + ->setReturnType($returnAsList) |
|
389 | + ->setReturnAsArray($returnAsArray) |
|
390 | + ->execute(); |
|
391 | 391 | |
392 | 392 | if (is_object($queryResult)) { |
393 | 393 | $this->result = $queryResult->getResult(); |
@@ -156,7 +156,7 @@ |
||
156 | 156 | return; |
157 | 157 | } |
158 | 158 | $this->logger->info('Found the registered event listener for the ' |
159 | - . 'event [' . $event->name . '] the list are: ' . stringfy_vars($list)); |
|
159 | + . 'event [' . $event->name . '] the list are: ' . stringfy_vars($list)); |
|
160 | 160 | foreach ($list as $listener) { |
161 | 161 | $result = call_user_func_array($listener, array($event)); |
162 | 162 | if ($eBackup->returnBack === true) { |
@@ -134,26 +134,26 @@ discard block |
||
134 | 134 | */ |
135 | 135 | |
136 | 136 | /** |
137 | - * The log level |
|
138 | - * |
|
139 | - * The valid log level are: OFF, NONE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY |
|
140 | - * |
|
141 | - * 'OFF' or 'NONE' = do not save log |
|
142 | - * 'EMERGENCY' = enable log for emergency level and above (EMERGENCY) |
|
143 | - * 'ALERT' = enable log for alert level and above (ALERT, EMERGENCY) |
|
144 | - * 'CRITICAL' = enable log for critical level and above (CRITICAL, ALERT, EMERGENCY) |
|
145 | - * 'ERROR' = enable log for error level and above (ERROR, CRITICAL, ALERT, EMERGENCY) |
|
146 | - * 'WARNING' = enable log for warning level and above (WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
147 | - * 'NOTICE' = enable log for notice level and above (NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
148 | - * 'INFO' = enable log for info level and above (INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
149 | - * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
150 | - * |
|
151 | - * The default value is NONE if the config value is: null, '', 0, false |
|
152 | - * |
|
153 | - * Note: in production environment it's recommand to set the log level to 'WARNING' or 'ERROR' if not, in small |
|
154 | - * time the log file size will increase very fast and will cost the application performance |
|
155 | - * and also the filesystem usage of your server. |
|
156 | - */ |
|
137 | + * The log level |
|
138 | + * |
|
139 | + * The valid log level are: OFF, NONE, DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY |
|
140 | + * |
|
141 | + * 'OFF' or 'NONE' = do not save log |
|
142 | + * 'EMERGENCY' = enable log for emergency level and above (EMERGENCY) |
|
143 | + * 'ALERT' = enable log for alert level and above (ALERT, EMERGENCY) |
|
144 | + * 'CRITICAL' = enable log for critical level and above (CRITICAL, ALERT, EMERGENCY) |
|
145 | + * 'ERROR' = enable log for error level and above (ERROR, CRITICAL, ALERT, EMERGENCY) |
|
146 | + * 'WARNING' = enable log for warning level and above (WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
147 | + * 'NOTICE' = enable log for notice level and above (NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
148 | + * 'INFO' = enable log for info level and above (INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
149 | + * 'DEBUG' = enable log for debug level and above (DEBUG, INFO, NOTICE, WARNING, ERROR, CRITICAL, ALERT, EMERGENCY) |
|
150 | + * |
|
151 | + * The default value is NONE if the config value is: null, '', 0, false |
|
152 | + * |
|
153 | + * Note: in production environment it's recommand to set the log level to 'WARNING' or 'ERROR' if not, in small |
|
154 | + * time the log file size will increase very fast and will cost the application performance |
|
155 | + * and also the filesystem usage of your server. |
|
156 | + */ |
|
157 | 157 | $config['log_level'] = 'NONE'; |
158 | 158 | |
159 | 159 | |
@@ -180,20 +180,20 @@ discard block |
||
180 | 180 | $config['log_logger_name'] = array(); |
181 | 181 | |
182 | 182 | /** |
183 | - * The logger name custom level to use for the log |
|
184 | - * |
|
185 | - * If this config is set so means the logger level will be used to overwrite |
|
186 | - * the default log level configuration above. |
|
187 | - * |
|
188 | - * Example: |
|
189 | - * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
190 | - * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
191 | - * will be saved for WARNING message and above |
|
192 | - * Note: You can also use an regular expression for the logger name. |
|
193 | - * Example: |
|
194 | - * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
195 | - * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
196 | - */ |
|
183 | + * The logger name custom level to use for the log |
|
184 | + * |
|
185 | + * If this config is set so means the logger level will be used to overwrite |
|
186 | + * the default log level configuration above. |
|
187 | + * |
|
188 | + * Example: |
|
189 | + * $config['log_logger_name_level'] = array('MY_LOGGER1' => 'WARNING'); |
|
190 | + * So if $config['log_level'] = 'ERROR' but all log messages with "MY_LOGGER1" as logger name |
|
191 | + * will be saved for WARNING message and above |
|
192 | + * Note: You can also use an regular expression for the logger name. |
|
193 | + * Example: |
|
194 | + * $config['log_logger_name_level'] = array('^Class::Con(.*)' => 'info'); |
|
195 | + * So all logger name like "Class::Config", "Class::Cookie", etc. will be match |
|
196 | + */ |
|
197 | 197 | $config['log_logger_name_level'] = array(); |
198 | 198 | |
199 | 199 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * Construct new ApcCache instance |
35 | 35 | */ |
36 | - public function __construct() { |
|
36 | + public function __construct() { |
|
37 | 37 | parent::__construct(); |
38 | 38 | if (!$this->isSupported()) { |
39 | 39 | show_error('The cache for APC[u] driver is not available. Check if APC[u] extension is loaded and enabled.'); |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | public function set($key, $data, $ttl = 0) { |
80 | 80 | $expire = time() + $ttl; |
81 | 81 | $this->logger->debug('Setting cache data for key [' . $key . '], time to live [' . $ttl . '], ' |
82 | - . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
82 | + . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
83 | 83 | $result = apc_store($key, $data, $ttl); |
84 | 84 | if ($result === false) { |
85 | 85 | $this->logger->error('Can not save cache data for the key [' . $key . '], return false'); |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | 'mtime' => $cacheInfos['creation_time'], |
128 | 128 | 'expire' => $cacheInfos['creation_time'] + $cacheInfos['ttl'], |
129 | 129 | 'ttl' => $cacheInfos['ttl'] |
130 | - ); |
|
130 | + ); |
|
131 | 131 | } |
132 | 132 | $this->logger->info('This cache does not exists skipping'); |
133 | 133 | return false; |
@@ -108,13 +108,13 @@ discard block |
||
108 | 108 | public function set($key, $data, $ttl = 0) { |
109 | 109 | $expire = time() + $ttl; |
110 | 110 | $this->logger->debug('Setting cache data for key [' . $key . '], ' |
111 | - . 'time to live [' . $ttl . '], ' |
|
112 | - . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
111 | + . 'time to live [' . $ttl . '], ' |
|
112 | + . 'expire at [' . date('Y-m-d H:i:s', $expire) . ']'); |
|
113 | 113 | $filePath = $this->getFilePath($key); |
114 | 114 | $handle = fopen($filePath, 'w'); |
115 | 115 | if (!is_resource($handle)) { |
116 | 116 | $this->logger->error('Can not open the file cache ' |
117 | - . '[' . $filePath . '] for the key [' . $key . '], return false'); |
|
117 | + . '[' . $filePath . '] for the key [' . $key . '], return false'); |
|
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | flock($handle, LOCK_EX); // exclusive lock, will get released when the file is closed |
@@ -191,10 +191,10 @@ discard block |
||
191 | 191 | if ($data['expire'] > time()) { |
192 | 192 | $this->logger->info('This cache not yet expired return cache informations'); |
193 | 193 | return array( |
194 | - 'mtime' => $data['mtime'], |
|
195 | - 'expire' => $data['expire'], |
|
196 | - 'ttl' => $data['ttl'] |
|
197 | - ); |
|
194 | + 'mtime' => $data['mtime'], |
|
195 | + 'expire' => $data['expire'], |
|
196 | + 'ttl' => $data['ttl'] |
|
197 | + ); |
|
198 | 198 | } |
199 | 199 | $this->logger->info('This cache already expired return false'); |
200 | 200 | return false; |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | */ |
45 | 45 | class Assets extends BaseClass { |
46 | 46 | |
47 | - /** |
|
48 | - * Construct new instance |
|
49 | - */ |
|
47 | + /** |
|
48 | + * Construct new instance |
|
49 | + */ |
|
50 | 50 | public function __construct() { |
51 | 51 | parent::__construct(); |
52 | 52 | } |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | * @see Assets:link |
96 | 96 | */ |
97 | 97 | public function css($path) { |
98 | - return $this->link($path, 'css'); |
|
98 | + return $this->link($path, 'css'); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | } |
91 | 91 | |
92 | 92 | /** |
93 | - * Set the value of the pagination query string |
|
94 | - * @param string $pQueryString the new value |
|
95 | - * @return object |
|
96 | - */ |
|
93 | + * Set the value of the pagination query string |
|
94 | + * @param string $pQueryString the new value |
|
95 | + * @return object |
|
96 | + */ |
|
97 | 97 | public function setPaginationQueryString($pQueryString) { |
98 | 98 | $this->paginationQueryString = $pQueryString; |
99 | 99 | return $this; |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | } |
245 | 245 | } |
246 | 246 | $navbar .= $this->config['next_open'] . '<a href="' . $query . ($currentPageNumber + 1) . '">' |
247 | - . $this->config['next_text'] . '</a>' . $this->config['next_close']; |
|
247 | + . $this->config['next_text'] . '</a>' . $this->config['next_close']; |
|
248 | 248 | return $navbar; |
249 | 249 | } |
250 | 250 | |
251 | 251 | |
252 | - /** |
|
253 | - * Build the pagination link for the first page |
|
254 | - * @see Pagination::buildPaginationLinkForFirstAndLastPage |
|
255 | - */ |
|
252 | + /** |
|
253 | + * Build the pagination link for the first page |
|
254 | + * @see Pagination::buildPaginationLinkForFirstAndLastPage |
|
255 | + */ |
|
256 | 256 | protected function buildPaginationLinkForFirstPage($begin, $end, $currentPageNumber) { |
257 | 257 | return $this->buildPaginationLinkForFirstAndLastPage($begin, $end, $currentPageNumber, 'first'); |
258 | 258 | } |
@@ -277,10 +277,10 @@ discard block |
||
277 | 277 | return $this; |
278 | 278 | } |
279 | 279 | |
280 | - /** |
|
281 | - * Get the uploade file array |
|
282 | - * @return array |
|
283 | - */ |
|
280 | + /** |
|
281 | + * Get the uploade file array |
|
282 | + * @return array |
|
283 | + */ |
|
284 | 284 | public function getUploadedFileData() { |
285 | 285 | return $this->uploadedFileData; |
286 | 286 | } |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | return $this; |
321 | 321 | } |
322 | 322 | |
323 | - /** |
|
324 | - * Get the filename |
|
325 | - * @return string |
|
326 | - */ |
|
323 | + /** |
|
324 | + * Get the filename |
|
325 | + * @return string |
|
326 | + */ |
|
327 | 327 | public function getFilename() { |
328 | 328 | return $this->filename; |
329 | 329 | } |
@@ -352,23 +352,23 @@ discard block |
||
352 | 352 | return $this; |
353 | 353 | } |
354 | 354 | |
355 | - /** |
|
356 | - * Get the max file size |
|
357 | - * @return double|int |
|
358 | - */ |
|
355 | + /** |
|
356 | + * Get the max file size |
|
357 | + * @return double|int |
|
358 | + */ |
|
359 | 359 | public function getMaxFileSize() { |
360 | 360 | return $this->maxFileSize; |
361 | 361 | } |
362 | 362 | |
363 | - /** |
|
364 | - * Append a mime type to allowed mime types |
|
365 | - * |
|
366 | - * @since 1.0 |
|
367 | - * @version 1.0.1 |
|
368 | - * @param string $mime |
|
369 | - * @return object |
|
370 | - * @method boolean setAllowMimeType |
|
371 | - */ |
|
363 | + /** |
|
364 | + * Append a mime type to allowed mime types |
|
365 | + * |
|
366 | + * @since 1.0 |
|
367 | + * @version 1.0.1 |
|
368 | + * @param string $mime |
|
369 | + * @return object |
|
370 | + * @method boolean setAllowMimeType |
|
371 | + */ |
|
372 | 372 | public function setAllowMimeType($mime) { |
373 | 373 | $this->allowedMimeTypes[] = strtolower($mime); |
374 | 374 | $this->file['allowed_mime_types'][] = strtolower($mime); |
@@ -485,10 +485,10 @@ discard block |
||
485 | 485 | return $this; |
486 | 486 | } |
487 | 487 | |
488 | - /** |
|
489 | - * Get the upload function name like "copy", "move_uploaded_file" |
|
490 | - * @return string |
|
491 | - */ |
|
488 | + /** |
|
489 | + * Get the upload function name like "copy", "move_uploaded_file" |
|
490 | + * @return string |
|
491 | + */ |
|
492 | 492 | public function getUploadFunction() { |
493 | 493 | return $this->uploadFunction; |
494 | 494 | } |
@@ -506,10 +506,10 @@ discard block |
||
506 | 506 | return $this; |
507 | 507 | } |
508 | 508 | |
509 | - /** |
|
510 | - * Get the allow overwriting |
|
511 | - * @return boolean |
|
512 | - */ |
|
509 | + /** |
|
510 | + * Get the allow overwriting |
|
511 | + * @return boolean |
|
512 | + */ |
|
513 | 513 | public function isAllowOverwriting() { |
514 | 514 | return $this->overwriteFile ; |
515 | 515 | } |
@@ -614,14 +614,14 @@ discard block |
||
614 | 614 | return $this->error; |
615 | 615 | } |
616 | 616 | |
617 | - /** |
|
618 | - * Retrive status of upload |
|
619 | - * |
|
620 | - * @since 1.0 |
|
621 | - * @version 1.0 |
|
622 | - * @return boolean |
|
623 | - * @method boolean getStatus |
|
624 | - */ |
|
617 | + /** |
|
618 | + * Retrive status of upload |
|
619 | + * |
|
620 | + * @since 1.0 |
|
621 | + * @version 1.0 |
|
622 | + * @return boolean |
|
623 | + * @method boolean getStatus |
|
624 | + */ |
|
625 | 625 | public function getStatus() { |
626 | 626 | return $this->file['status']; |
627 | 627 | } |
@@ -654,11 +654,11 @@ discard block |
||
654 | 654 | && is_file($file); |
655 | 655 | } |
656 | 656 | |
657 | - /** |
|
658 | - * Set the filename if is empty using the uploaded data information |
|
659 | - * |
|
660 | - * @return object the current instance |
|
661 | - */ |
|
657 | + /** |
|
658 | + * Set the filename if is empty using the uploaded data information |
|
659 | + * |
|
660 | + * @return object the current instance |
|
661 | + */ |
|
662 | 662 | protected function setFilenameUsingUploadedData() { |
663 | 663 | // set original filename if not have a new name |
664 | 664 | if (empty($this->filename)) { |
@@ -742,12 +742,12 @@ discard block |
||
742 | 742 | return $this->maxFileSize >= $size; |
743 | 743 | } |
744 | 744 | |
745 | - /** |
|
746 | - * Check the file overwritting |
|
747 | - * @since 1.0 |
|
748 | - * @version 1.0 |
|
749 | - * @return boolean |
|
750 | - */ |
|
745 | + /** |
|
746 | + * Check the file overwritting |
|
747 | + * @since 1.0 |
|
748 | + * @version 1.0 |
|
749 | + * @return boolean |
|
750 | + */ |
|
751 | 751 | protected function checkFileOverwritting() { |
752 | 752 | if ($this->fileExists($this->destinationDirectory . $this->filename)) { |
753 | 753 | return $this->overwriteFile; |