@@ -30,6 +30,9 @@ discard block |
||
30 | 30 | return true; |
31 | 31 | } |
32 | 32 | |
33 | + /** |
|
34 | + * @param string $title |
|
35 | + */ |
|
33 | 36 | function _title($title) { |
34 | 37 | $this->objPHPExcel->getActiveSheet()->setCellValue('A2', $title); |
35 | 38 | } |
@@ -71,6 +74,9 @@ discard block |
||
71 | 74 | } |
72 | 75 | } |
73 | 76 | |
77 | + /** |
|
78 | + * @param string $title |
|
79 | + */ |
|
74 | 80 | function _output($title, $type = 'Excel5') { |
75 | 81 | if ($type == 'Excel5') { |
76 | 82 | header("Content-type: application/vnd.ms-excel"); |
@@ -6,47 +6,47 @@ discard block |
||
6 | 6 | class ExcelHelper extends AppHelper { |
7 | 7 | |
8 | 8 | var $objPHPExcel; |
9 | - var $writer; |
|
10 | - var $sheet; |
|
11 | - var $data; |
|
12 | - var $blacklist = array(); |
|
9 | + var $writer; |
|
10 | + var $sheet; |
|
11 | + var $data; |
|
12 | + var $blacklist = array(); |
|
13 | 13 | |
14 | - public function excelHelper() { |
|
14 | + public function excelHelper() { |
|
15 | 15 | $this->log('run this'); |
16 | 16 | $this->objPHPExcel = new PHPExcel(); |
17 | 17 | |
18 | - //$this->objPHPExcel->getActiveSheet() = $this->objPHPExcel->getActiveSheet(); |
|
19 | - } |
|
18 | + //$this->objPHPExcel->getActiveSheet() = $this->objPHPExcel->getActiveSheet(); |
|
19 | + } |
|
20 | 20 | |
21 | - function generate($data, $title = 'Report') { |
|
22 | - $this->data = $data; |
|
21 | + function generate($data, $title = 'Report') { |
|
22 | + $this->data = $data; |
|
23 | 23 | |
24 | 24 | |
25 | 25 | |
26 | - $this->_title($title); |
|
26 | + $this->_title($title); |
|
27 | 27 | // $this->_headers(); |
28 | 28 | // $this->_rows(); |
29 | - $this->_output($title); |
|
30 | - return true; |
|
31 | - } |
|
29 | + $this->_output($title); |
|
30 | + return true; |
|
31 | + } |
|
32 | 32 | |
33 | - function _title($title) { |
|
34 | - $this->objPHPExcel->getActiveSheet()->setCellValue('A2', $title); |
|
35 | - } |
|
33 | + function _title($title) { |
|
34 | + $this->objPHPExcel->getActiveSheet()->setCellValue('A2', $title); |
|
35 | + } |
|
36 | 36 | |
37 | - function _headers() { |
|
38 | - $i=0; |
|
37 | + function _headers() { |
|
38 | + $i=0; |
|
39 | 39 | |
40 | 40 | $this->log($this->data); |
41 | 41 | |
42 | - foreach ($this->data[0] as $field => $value) { |
|
43 | - if (!in_array($field,$this->blacklist)) { |
|
42 | + foreach ($this->data[0] as $field => $value) { |
|
43 | + if (!in_array($field,$this->blacklist)) { |
|
44 | 44 | |
45 | - $columnName = Inflector::humanize($field); |
|
46 | - $this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($i++, 4, $columnName); |
|
45 | + $columnName = Inflector::humanize($field); |
|
46 | + $this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($i++, 4, $columnName); |
|
47 | 47 | |
48 | - } |
|
49 | - } |
|
48 | + } |
|
49 | + } |
|
50 | 50 | /** |
51 | 51 | $this->objPHPExcel->getActiveSheet()->getStyle('A4')->getFont()->setBold(true); |
52 | 52 | $this->objPHPExcel->getActiveSheet()->getStyle('A4')->getFill()->setFillType(PHPExcel_Style_Fill::FILL_SOLID); |
@@ -55,42 +55,42 @@ discard block |
||
55 | 55 | for ($j=1; $j<$i; $j++) { |
56 | 56 | $this->objPHPExcel->getActiveSheet()->getColumnDimension(PHPExcel_Cell::stringFromColumnIndex($j))->setAutoSize(true); |
57 | 57 | } |
58 | - ***/ |
|
59 | - } |
|
58 | + ***/ |
|
59 | + } |
|
60 | 60 | |
61 | - function _rows() { |
|
62 | - $i=5; |
|
63 | - foreach ($this->data as $row) { |
|
64 | - $j=0; |
|
65 | - foreach ($row as $field => $value) { |
|
66 | - if(!in_array($field,$this->blacklist)) { |
|
67 | - $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++,$i, $value); |
|
68 | - } |
|
69 | - } |
|
70 | - $i++; |
|
71 | - } |
|
72 | - } |
|
61 | + function _rows() { |
|
62 | + $i=5; |
|
63 | + foreach ($this->data as $row) { |
|
64 | + $j=0; |
|
65 | + foreach ($row as $field => $value) { |
|
66 | + if(!in_array($field,$this->blacklist)) { |
|
67 | + $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++,$i, $value); |
|
68 | + } |
|
69 | + } |
|
70 | + $i++; |
|
71 | + } |
|
72 | + } |
|
73 | 73 | |
74 | - function _output($title, $type = 'Excel5') { |
|
74 | + function _output($title, $type = 'Excel5') { |
|
75 | 75 | if ($type == 'Excel5') { |
76 | 76 | header("Content-type: application/vnd.ms-excel"); |
77 | - header('Content-Disposition: attachment;filename="'.$title.'.xls"'); |
|
78 | - header('Cache-Control: max-age=0'); |
|
77 | + header('Content-Disposition: attachment;filename="'.$title.'.xls"'); |
|
78 | + header('Cache-Control: max-age=0'); |
|
79 | 79 | $this->writer = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'Excel5'); |
80 | 80 | |
81 | 81 | |
82 | 82 | } else if ($type == 'CSV') { |
83 | 83 | header("Content-type: text/csv"); |
84 | - header('Content-Disposition: attachment;filename="'.$title.'.csv"'); |
|
85 | - header('Cache-Control: max-age=0'); |
|
84 | + header('Content-Disposition: attachment;filename="'.$title.'.csv"'); |
|
85 | + header('Cache-Control: max-age=0'); |
|
86 | 86 | $this->writer = PHPExcel_IOFactory::createWriter($this->objPHPExcel, 'CSV'); |
87 | 87 | |
88 | 88 | } |
89 | 89 | |
90 | 90 | |
91 | - //$this->writer->setTempDir(TMP); |
|
92 | - $this->writer->save('php://output'); |
|
93 | - } |
|
91 | + //$this->writer->setTempDir(TMP); |
|
92 | + $this->writer->save('php://output'); |
|
93 | + } |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | ?> |
97 | 97 | \ No newline at end of file |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -include_once(APP . 'Vendor' . DS . 'PHPExcel' . DS . 'IOFactory.php'); |
|
4 | -include_once(APP . 'Vendor' . DS . 'PHPExcel' . DS . 'PHPExcel.php'); |
|
3 | +include_once(APP.'Vendor'.DS.'PHPExcel'.DS.'IOFactory.php'); |
|
4 | +include_once(APP.'Vendor'.DS.'PHPExcel'.DS.'PHPExcel.php'); |
|
5 | 5 | |
6 | 6 | class ExcelHelper extends AppHelper { |
7 | 7 | |
@@ -35,12 +35,12 @@ discard block |
||
35 | 35 | } |
36 | 36 | |
37 | 37 | function _headers() { |
38 | - $i=0; |
|
38 | + $i = 0; |
|
39 | 39 | |
40 | 40 | $this->log($this->data); |
41 | 41 | |
42 | 42 | foreach ($this->data[0] as $field => $value) { |
43 | - if (!in_array($field,$this->blacklist)) { |
|
43 | + if ( ! in_array($field, $this->blacklist)) { |
|
44 | 44 | |
45 | 45 | $columnName = Inflector::humanize($field); |
46 | 46 | $this->objPHPExcel->getActiveSheet()->getCellByColumnAndRow($i++, 4, $columnName); |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | function _rows() { |
62 | - $i=5; |
|
62 | + $i = 5; |
|
63 | 63 | foreach ($this->data as $row) { |
64 | - $j=0; |
|
64 | + $j = 0; |
|
65 | 65 | foreach ($row as $field => $value) { |
66 | - if(!in_array($field,$this->blacklist)) { |
|
67 | - $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++,$i, $value); |
|
66 | + if ( ! in_array($field, $this->blacklist)) { |
|
67 | + $this->objPHPExcel->getActiveSheet()->setCellValueByColumnAndRow($j++, $i, $value); |
|
68 | 68 | } |
69 | 69 | } |
70 | 70 | $i++; |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * all files in app/tmp/cache/views will be deleted |
457 | 457 | * @param string $type Directory in tmp/cache defaults to view directory |
458 | 458 | * @param string $ext The file extension you are deleting |
459 | - * @return true if files found and deleted false otherwise |
|
459 | + * @return boolean if files found and deleted false otherwise |
|
460 | 460 | */ |
461 | 461 | function clearCache($params = null, $type = 'views', $ext = '.php') { |
462 | 462 | if (is_string($params) || $params === null) { |
@@ -547,7 +547,7 @@ discard block |
||
547 | 547 | * |
548 | 548 | * @param string $singular Text to translate |
549 | 549 | * @param mixed $args Array with arguments or multiple arguments in function |
550 | - * @return mixed translated string |
|
550 | + * @return null|string translated string |
|
551 | 551 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__ |
552 | 552 | */ |
553 | 553 | function __($singular, $args = null) { |
@@ -577,7 +577,7 @@ discard block |
||
577 | 577 | * @param string $plural Plural text |
578 | 578 | * @param integer $count Count |
579 | 579 | * @param mixed $args Array with arguments or multiple arguments in function |
580 | - * @return mixed plural form of translated string |
|
580 | + * @return null|string plural form of translated string |
|
581 | 581 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__n |
582 | 582 | */ |
583 | 583 | function __n($singular, $plural, $count, $args = null) { |
@@ -605,7 +605,7 @@ discard block |
||
605 | 605 | * @param string $domain Domain |
606 | 606 | * @param string $msg String to translate |
607 | 607 | * @param mixed $args Array with arguments or multiple arguments in function |
608 | - * @return translated string |
|
608 | + * @return null|string string |
|
609 | 609 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__d |
610 | 610 | */ |
611 | 611 | function __d($domain, $msg, $args = null) { |
@@ -636,7 +636,7 @@ discard block |
||
636 | 636 | * @param string $plural Plural |
637 | 637 | * @param integer $count Count |
638 | 638 | * @param mixed $args Array with arguments or multiple arguments in function |
639 | - * @return plural form of translated string |
|
639 | + * @return null|string form of translated string |
|
640 | 640 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dn |
641 | 641 | */ |
642 | 642 | function __dn($domain, $singular, $plural, $count, $args = null) { |
@@ -678,7 +678,7 @@ discard block |
||
678 | 678 | * @param string $msg Message to translate |
679 | 679 | * @param integer $category Category |
680 | 680 | * @param mixed $args Array with arguments or multiple arguments in function |
681 | - * @return translated string |
|
681 | + * @return null|string string |
|
682 | 682 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dc |
683 | 683 | */ |
684 | 684 | function __dc($domain, $msg, $category, $args = null) { |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | * @param integer $count Count |
725 | 725 | * @param integer $category Category |
726 | 726 | * @param mixed $args Array with arguments or multiple arguments in function |
727 | - * @return plural form of translated string |
|
727 | + * @return null|string form of translated string |
|
728 | 728 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dcn |
729 | 729 | */ |
730 | 730 | function __dcn($domain, $singular, $plural, $count, $category, $args = null) { |
@@ -762,7 +762,7 @@ discard block |
||
762 | 762 | * @param string $msg String to translate |
763 | 763 | * @param integer $category Category |
764 | 764 | * @param mixed $args Array with arguments or multiple arguments in function |
765 | - * @return translated string |
|
765 | + * @return null|string string |
|
766 | 766 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__c |
767 | 767 | */ |
768 | 768 | function __c($msg, $category, $args = null) { |
@@ -805,7 +805,7 @@ discard block |
||
805 | 805 | * Searches include path for files. |
806 | 806 | * |
807 | 807 | * @param string $file File to look for |
808 | - * @return Full path to file if exists, otherwise false |
|
808 | + * @return string|false path to file if exists, otherwise false |
|
809 | 809 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#fileExistsInPath |
810 | 810 | */ |
811 | 811 | function fileExistsInPath($file) { |
@@ -844,18 +844,18 @@ |
||
844 | 844 | |
845 | 845 | |
846 | 846 | function receber_data($data, $dia = true, $mes = true, $ano = true, $hora = false, $minuto = false, $segundo = false) { |
847 | - if ($hora || $minuto || $segundo) { |
|
848 | - $data = explode(' ', $data); |
|
849 | - $_hora = $data[1]; |
|
850 | - $data = $data[0]; |
|
851 | - |
|
852 | - $_hora = explode(':', $_hora); |
|
853 | - $_hora = ($hora ? $_hora[0] : '') . ($minuto ? ($hora ? ':' : '') . $_hora[1] : '') . ($segundo ? ($hora || $minuto ? ':' : '') . $_hora[2] : ''); |
|
854 | - } |
|
855 | - $recebe = explode('-', $data); |
|
856 | - if (isset($recebe[2]) && isset($recebe[1])) { |
|
857 | - $data = ($dia ? $recebe[2] : '') . ($mes ? ($dia ? '/' : '') . $recebe[1] : '') . ($ano ? ($mes || $dia ? '/' : '') . $recebe[0] : ''); |
|
858 | - } |
|
859 | - |
|
860 | - return $data . (isset($_hora) ? ' ' . $_hora : ''); |
|
847 | + if ($hora || $minuto || $segundo) { |
|
848 | + $data = explode(' ', $data); |
|
849 | + $_hora = $data[1]; |
|
850 | + $data = $data[0]; |
|
851 | + |
|
852 | + $_hora = explode(':', $_hora); |
|
853 | + $_hora = ($hora ? $_hora[0] : '') . ($minuto ? ($hora ? ':' : '') . $_hora[1] : '') . ($segundo ? ($hora || $minuto ? ':' : '') . $_hora[2] : ''); |
|
854 | + } |
|
855 | + $recebe = explode('-', $data); |
|
856 | + if (isset($recebe[2]) && isset($recebe[1])) { |
|
857 | + $data = ($dia ? $recebe[2] : '') . ($mes ? ($dia ? '/' : '') . $recebe[1] : '') . ($ano ? ($mes || $dia ? '/' : '') . $recebe[0] : ''); |
|
858 | + } |
|
859 | + |
|
860 | + return $data . (isset($_hora) ? ' ' . $_hora : ''); |
|
861 | 861 | } |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | define('MONTH', 2592000); |
30 | 30 | define('YEAR', 31536000); |
31 | 31 | |
32 | -if (!function_exists('config')) { |
|
32 | +if ( ! function_exists('config')) { |
|
33 | 33 | |
34 | 34 | /** |
35 | 35 | * Loads configuration files. Receives a set of configuration files |
@@ -46,8 +46,8 @@ discard block |
||
46 | 46 | $count = count($args); |
47 | 47 | $included = 0; |
48 | 48 | foreach ($args as $arg) { |
49 | - if (file_exists(APP . 'Config' . DS . $arg . '.php')) { |
|
50 | - include_once APP . 'Config' . DS . $arg . '.php'; |
|
49 | + if (file_exists(APP.'Config'.DS.$arg.'.php')) { |
|
50 | + include_once APP.'Config'.DS.$arg.'.php'; |
|
51 | 51 | $included++; |
52 | 52 | } |
53 | 53 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | |
57 | 57 | } |
58 | 58 | |
59 | -if (!function_exists('debug')) { |
|
59 | +if ( ! function_exists('debug')) { |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Prints out debug information about given variable. |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | |
121 | 121 | } |
122 | 122 | |
123 | -if (!function_exists('sortByKey')) { |
|
123 | +if ( ! function_exists('sortByKey')) { |
|
124 | 124 | |
125 | 125 | /** |
126 | 126 | * Sorts given $array by key $sortBy. |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#sortByKey |
134 | 134 | */ |
135 | 135 | function sortByKey(&$array, $sortBy, $order = 'asc', $type = SORT_NUMERIC) { |
136 | - if (!is_array($array)) { |
|
136 | + if ( ! is_array($array)) { |
|
137 | 137 | return null; |
138 | 138 | } |
139 | 139 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | |
156 | 156 | } |
157 | 157 | |
158 | -if (!function_exists('h')) { |
|
158 | +if ( ! function_exists('h')) { |
|
159 | 159 | |
160 | 160 | /** |
161 | 161 | * Convenience method for htmlspecialchars. |
@@ -177,9 +177,9 @@ discard block |
||
177 | 177 | return $texts; |
178 | 178 | } elseif (is_object($text)) { |
179 | 179 | if (method_exists($text, '__toString')) { |
180 | - $text = (string)$text; |
|
180 | + $text = (string) $text; |
|
181 | 181 | } else { |
182 | - $text = '(object)' . get_class($text); |
|
182 | + $text = '(object)'.get_class($text); |
|
183 | 183 | } |
184 | 184 | } elseif (is_bool($text)) { |
185 | 185 | return $text; |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | |
201 | 201 | } |
202 | 202 | |
203 | -if (!function_exists('pluginSplit')) { |
|
203 | +if ( ! function_exists('pluginSplit')) { |
|
204 | 204 | |
205 | 205 | /** |
206 | 206 | * Splits a dot syntax plugin name into its plugin and class name. |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | |
228 | 228 | } |
229 | 229 | |
230 | -if (!function_exists('pr')) { |
|
230 | +if ( ! function_exists('pr')) { |
|
231 | 231 | |
232 | 232 | /** |
233 | 233 | * print_r() convenience function |
@@ -252,7 +252,7 @@ discard block |
||
252 | 252 | |
253 | 253 | } |
254 | 254 | |
255 | -if (!function_exists('am')) { |
|
255 | +if ( ! function_exists('am')) { |
|
256 | 256 | |
257 | 257 | /** |
258 | 258 | * Merge a group of arrays |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | $r = array(); |
269 | 269 | $args = func_get_args(); |
270 | 270 | foreach ($args as $a) { |
271 | - if (!is_array($a)) { |
|
271 | + if ( ! is_array($a)) { |
|
272 | 272 | $a = array($a); |
273 | 273 | } |
274 | 274 | $r = array_merge($r, $a); |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | } |
280 | 280 | |
281 | -if (!function_exists('env')) { |
|
281 | +if ( ! function_exists('env')) { |
|
282 | 282 | |
283 | 283 | /** |
284 | 284 | * Gets an environment variable from available sources, and provides emulation |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | function env($key) { |
294 | 294 | if ($key === 'HTTPS') { |
295 | 295 | if (isset($_SERVER['HTTPS'])) { |
296 | - return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'); |
|
296 | + return ( ! empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'); |
|
297 | 297 | } |
298 | 298 | return (strpos(env('SCRIPT_URI'), 'https://') === 0); |
299 | 299 | } |
@@ -329,7 +329,7 @@ discard block |
||
329 | 329 | $name = env('SCRIPT_NAME'); |
330 | 330 | $filename = env('SCRIPT_FILENAME'); |
331 | 331 | $offset = 0; |
332 | - if (!strpos($name, '.php')) { |
|
332 | + if ( ! strpos($name, '.php')) { |
|
333 | 333 | $offset = 4; |
334 | 334 | } |
335 | 335 | return substr($filename, 0, -(strlen($name) + $offset)); |
@@ -343,9 +343,9 @@ discard block |
||
343 | 343 | $count = count($parts); |
344 | 344 | |
345 | 345 | if ($count === 1) { |
346 | - return '.' . $host; |
|
346 | + return '.'.$host; |
|
347 | 347 | } elseif ($count === 2) { |
348 | - return '.' . $host; |
|
348 | + return '.'.$host; |
|
349 | 349 | } elseif ($count === 3) { |
350 | 350 | $gTLD = array( |
351 | 351 | 'aero', |
@@ -371,18 +371,18 @@ discard block |
||
371 | 371 | 'xxx' |
372 | 372 | ); |
373 | 373 | if (in_array($parts[1], $gTLD)) { |
374 | - return '.' . $host; |
|
374 | + return '.'.$host; |
|
375 | 375 | } |
376 | 376 | } |
377 | 377 | array_shift($parts); |
378 | - return '.' . implode('.', $parts); |
|
378 | + return '.'.implode('.', $parts); |
|
379 | 379 | } |
380 | 380 | return null; |
381 | 381 | } |
382 | 382 | |
383 | 383 | } |
384 | 384 | |
385 | -if (!function_exists('cache')) { |
|
385 | +if ( ! function_exists('cache')) { |
|
386 | 386 | |
387 | 387 | /** |
388 | 388 | * Reads/writes temporary data to cache files or session. |
@@ -400,19 +400,19 @@ discard block |
||
400 | 400 | } |
401 | 401 | $now = time(); |
402 | 402 | |
403 | - if (!is_numeric($expires)) { |
|
403 | + if ( ! is_numeric($expires)) { |
|
404 | 404 | $expires = strtotime($expires, $now); |
405 | 405 | } |
406 | 406 | |
407 | 407 | switch (strtolower($target)) { |
408 | 408 | case 'cache': |
409 | - $filename = CACHE . $path; |
|
409 | + $filename = CACHE.$path; |
|
410 | 410 | break; |
411 | 411 | case 'public': |
412 | - $filename = WWW_ROOT . $path; |
|
412 | + $filename = WWW_ROOT.$path; |
|
413 | 413 | break; |
414 | 414 | case 'tmp': |
415 | - $filename = TMP . $path; |
|
415 | + $filename = TMP.$path; |
|
416 | 416 | break; |
417 | 417 | } |
418 | 418 | $timediff = $expires - $now; |
@@ -446,7 +446,7 @@ discard block |
||
446 | 446 | |
447 | 447 | } |
448 | 448 | |
449 | -if (!function_exists('clearCache')) { |
|
449 | +if ( ! function_exists('clearCache')) { |
|
450 | 450 | |
451 | 451 | /** |
452 | 452 | * Used to delete files in the cache directories, or clear contents of cache directories |
@@ -461,22 +461,22 @@ discard block |
||
461 | 461 | function clearCache($params = null, $type = 'views', $ext = '.php') { |
462 | 462 | if (is_string($params) || $params === null) { |
463 | 463 | $params = preg_replace('/\/\//', '/', $params); |
464 | - $cache = CACHE . $type . DS . $params; |
|
464 | + $cache = CACHE.$type.DS.$params; |
|
465 | 465 | |
466 | - if (is_file($cache . $ext)) { |
|
466 | + if (is_file($cache.$ext)) { |
|
467 | 467 | //@codingStandardsIgnoreStart |
468 | - @unlink($cache . $ext); |
|
468 | + @unlink($cache.$ext); |
|
469 | 469 | //@codingStandardsIgnoreEnd |
470 | 470 | return true; |
471 | 471 | } elseif (is_dir($cache)) { |
472 | - $files = glob($cache . '*'); |
|
472 | + $files = glob($cache.'*'); |
|
473 | 473 | |
474 | 474 | if ($files === false) { |
475 | 475 | return false; |
476 | 476 | } |
477 | 477 | |
478 | 478 | foreach ($files as $file) { |
479 | - if (is_file($file) && strrpos($file, DS . 'empty') !== strlen($file) - 6) { |
|
479 | + if (is_file($file) && strrpos($file, DS.'empty') !== strlen($file) - 6) { |
|
480 | 480 | //@codingStandardsIgnoreStart |
481 | 481 | @unlink($file); |
482 | 482 | //@codingStandardsIgnoreEnd |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | return true; |
486 | 486 | } |
487 | 487 | $cache = array( |
488 | - CACHE . $type . DS . '*' . $params . $ext, |
|
489 | - CACHE . $type . DS . '*' . $params . '_*' . $ext |
|
488 | + CACHE.$type.DS.'*'.$params.$ext, |
|
489 | + CACHE.$type.DS.'*'.$params.'_*'.$ext |
|
490 | 490 | ); |
491 | 491 | $files = array(); |
492 | 492 | while ($search = array_shift($cache)) { |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | return false; |
500 | 500 | } |
501 | 501 | foreach ($files as $file) { |
502 | - if (is_file($file) && strrpos($file, DS . 'empty') !== strlen($file) - 6) { |
|
502 | + if (is_file($file) && strrpos($file, DS.'empty') !== strlen($file) - 6) { |
|
503 | 503 | //@codingStandardsIgnoreStart |
504 | 504 | @unlink($file); |
505 | 505 | //@codingStandardsIgnoreEnd |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | |
519 | 519 | } |
520 | 520 | |
521 | -if (!function_exists('stripslashes_deep')) { |
|
521 | +if ( ! function_exists('stripslashes_deep')) { |
|
522 | 522 | |
523 | 523 | /** |
524 | 524 | * Recursively strips slashes from all values in an array |
@@ -540,7 +540,7 @@ discard block |
||
540 | 540 | |
541 | 541 | } |
542 | 542 | |
543 | -if (!function_exists('__')) { |
|
543 | +if ( ! function_exists('__')) { |
|
544 | 544 | |
545 | 545 | /** |
546 | 546 | * Returns a translated string if one is found; Otherwise, the submitted message. |
@@ -551,7 +551,7 @@ discard block |
||
551 | 551 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__ |
552 | 552 | */ |
553 | 553 | function __($singular, $args = null) { |
554 | - if (!$singular) { |
|
554 | + if ( ! $singular) { |
|
555 | 555 | return; |
556 | 556 | } |
557 | 557 | |
@@ -559,7 +559,7 @@ discard block |
||
559 | 559 | $translated = I18n::translate($singular); |
560 | 560 | if ($args === null) { |
561 | 561 | return $translated; |
562 | - } elseif (!is_array($args)) { |
|
562 | + } elseif ( ! is_array($args)) { |
|
563 | 563 | $args = array_slice(func_get_args(), 1); |
564 | 564 | } |
565 | 565 | return vsprintf($translated, $args); |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | |
568 | 568 | } |
569 | 569 | |
570 | -if (!function_exists('__n')) { |
|
570 | +if ( ! function_exists('__n')) { |
|
571 | 571 | |
572 | 572 | /** |
573 | 573 | * Returns correct plural form of message identified by $singular and $plural for count $count. |
@@ -581,7 +581,7 @@ discard block |
||
581 | 581 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__n |
582 | 582 | */ |
583 | 583 | function __n($singular, $plural, $count, $args = null) { |
584 | - if (!$singular) { |
|
584 | + if ( ! $singular) { |
|
585 | 585 | return; |
586 | 586 | } |
587 | 587 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | $translated = I18n::translate($singular, $plural, null, 6, $count); |
590 | 590 | if ($args === null) { |
591 | 591 | return $translated; |
592 | - } elseif (!is_array($args)) { |
|
592 | + } elseif ( ! is_array($args)) { |
|
593 | 593 | $args = array_slice(func_get_args(), 3); |
594 | 594 | } |
595 | 595 | return vsprintf($translated, $args); |
@@ -597,7 +597,7 @@ discard block |
||
597 | 597 | |
598 | 598 | } |
599 | 599 | |
600 | -if (!function_exists('__d')) { |
|
600 | +if ( ! function_exists('__d')) { |
|
601 | 601 | |
602 | 602 | /** |
603 | 603 | * Allows you to override the current domain for a single message lookup. |
@@ -609,14 +609,14 @@ discard block |
||
609 | 609 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__d |
610 | 610 | */ |
611 | 611 | function __d($domain, $msg, $args = null) { |
612 | - if (!$msg) { |
|
612 | + if ( ! $msg) { |
|
613 | 613 | return; |
614 | 614 | } |
615 | 615 | App::uses('I18n', 'I18n'); |
616 | 616 | $translated = I18n::translate($msg, null, $domain); |
617 | 617 | if ($args === null) { |
618 | 618 | return $translated; |
619 | - } elseif (!is_array($args)) { |
|
619 | + } elseif ( ! is_array($args)) { |
|
620 | 620 | $args = array_slice(func_get_args(), 2); |
621 | 621 | } |
622 | 622 | return vsprintf($translated, $args); |
@@ -624,7 +624,7 @@ discard block |
||
624 | 624 | |
625 | 625 | } |
626 | 626 | |
627 | -if (!function_exists('__dn')) { |
|
627 | +if ( ! function_exists('__dn')) { |
|
628 | 628 | |
629 | 629 | /** |
630 | 630 | * Allows you to override the current domain for a single plural message lookup. |
@@ -640,14 +640,14 @@ discard block |
||
640 | 640 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dn |
641 | 641 | */ |
642 | 642 | function __dn($domain, $singular, $plural, $count, $args = null) { |
643 | - if (!$singular) { |
|
643 | + if ( ! $singular) { |
|
644 | 644 | return; |
645 | 645 | } |
646 | 646 | App::uses('I18n', 'I18n'); |
647 | 647 | $translated = I18n::translate($singular, $plural, $domain, 6, $count); |
648 | 648 | if ($args === null) { |
649 | 649 | return $translated; |
650 | - } elseif (!is_array($args)) { |
|
650 | + } elseif ( ! is_array($args)) { |
|
651 | 651 | $args = array_slice(func_get_args(), 4); |
652 | 652 | } |
653 | 653 | return vsprintf($translated, $args); |
@@ -655,7 +655,7 @@ discard block |
||
655 | 655 | |
656 | 656 | } |
657 | 657 | |
658 | -if (!function_exists('__dc')) { |
|
658 | +if ( ! function_exists('__dc')) { |
|
659 | 659 | |
660 | 660 | /** |
661 | 661 | * Allows you to override the current domain for a single message lookup. |
@@ -682,14 +682,14 @@ discard block |
||
682 | 682 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dc |
683 | 683 | */ |
684 | 684 | function __dc($domain, $msg, $category, $args = null) { |
685 | - if (!$msg) { |
|
685 | + if ( ! $msg) { |
|
686 | 686 | return; |
687 | 687 | } |
688 | 688 | App::uses('I18n', 'I18n'); |
689 | 689 | $translated = I18n::translate($msg, null, $domain, $category); |
690 | 690 | if ($args === null) { |
691 | 691 | return $translated; |
692 | - } elseif (!is_array($args)) { |
|
692 | + } elseif ( ! is_array($args)) { |
|
693 | 693 | $args = array_slice(func_get_args(), 3); |
694 | 694 | } |
695 | 695 | return vsprintf($translated, $args); |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | |
698 | 698 | } |
699 | 699 | |
700 | -if (!function_exists('__dcn')) { |
|
700 | +if ( ! function_exists('__dcn')) { |
|
701 | 701 | |
702 | 702 | /** |
703 | 703 | * Allows you to override the current domain for a single plural message lookup. |
@@ -728,14 +728,14 @@ discard block |
||
728 | 728 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__dcn |
729 | 729 | */ |
730 | 730 | function __dcn($domain, $singular, $plural, $count, $category, $args = null) { |
731 | - if (!$singular) { |
|
731 | + if ( ! $singular) { |
|
732 | 732 | return; |
733 | 733 | } |
734 | 734 | App::uses('I18n', 'I18n'); |
735 | 735 | $translated = I18n::translate($singular, $plural, $domain, $category, $count); |
736 | 736 | if ($args === null) { |
737 | 737 | return $translated; |
738 | - } elseif (!is_array($args)) { |
|
738 | + } elseif ( ! is_array($args)) { |
|
739 | 739 | $args = array_slice(func_get_args(), 5); |
740 | 740 | } |
741 | 741 | return vsprintf($translated, $args); |
@@ -743,7 +743,7 @@ discard block |
||
743 | 743 | |
744 | 744 | } |
745 | 745 | |
746 | -if (!function_exists('__c')) { |
|
746 | +if ( ! function_exists('__c')) { |
|
747 | 747 | |
748 | 748 | /** |
749 | 749 | * The category argument allows a specific category of the locale settings to be used for fetching a message. |
@@ -766,14 +766,14 @@ discard block |
||
766 | 766 | * @link http://book.cakephp.org/2.0/en/core-libraries/global-constants-and-functions.html#__c |
767 | 767 | */ |
768 | 768 | function __c($msg, $category, $args = null) { |
769 | - if (!$msg) { |
|
769 | + if ( ! $msg) { |
|
770 | 770 | return; |
771 | 771 | } |
772 | 772 | App::uses('I18n', 'I18n'); |
773 | 773 | $translated = I18n::translate($msg, null, null, $category); |
774 | 774 | if ($args === null) { |
775 | 775 | return $translated; |
776 | - } elseif (!is_array($args)) { |
|
776 | + } elseif ( ! is_array($args)) { |
|
777 | 777 | $args = array_slice(func_get_args(), 2); |
778 | 778 | } |
779 | 779 | return vsprintf($translated, $args); |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | |
782 | 782 | } |
783 | 783 | |
784 | -if (!function_exists('LogError')) { |
|
784 | +if ( ! function_exists('LogError')) { |
|
785 | 785 | |
786 | 786 | /** |
787 | 787 | * Shortcut to Log::write. |
@@ -799,7 +799,7 @@ discard block |
||
799 | 799 | |
800 | 800 | } |
801 | 801 | |
802 | -if (!function_exists('fileExistsInPath')) { |
|
802 | +if ( ! function_exists('fileExistsInPath')) { |
|
803 | 803 | |
804 | 804 | /** |
805 | 805 | * Searches include path for files. |
@@ -811,7 +811,7 @@ discard block |
||
811 | 811 | function fileExistsInPath($file) { |
812 | 812 | $paths = explode(PATH_SEPARATOR, ini_get('include_path')); |
813 | 813 | foreach ($paths as $path) { |
814 | - $fullPath = $path . DS . $file; |
|
814 | + $fullPath = $path.DS.$file; |
|
815 | 815 | |
816 | 816 | if (file_exists($fullPath)) { |
817 | 817 | return $fullPath; |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | |
825 | 825 | } |
826 | 826 | |
827 | -if (!function_exists('convertSlash')) { |
|
827 | +if ( ! function_exists('convertSlash')) { |
|
828 | 828 | |
829 | 829 | /** |
830 | 830 | * Convert forward slashes to underscores and removes first and last underscores in a string |
@@ -850,12 +850,12 @@ discard block |
||
850 | 850 | $data = $data[0]; |
851 | 851 | |
852 | 852 | $_hora = explode(':', $_hora); |
853 | - $_hora = ($hora ? $_hora[0] : '') . ($minuto ? ($hora ? ':' : '') . $_hora[1] : '') . ($segundo ? ($hora || $minuto ? ':' : '') . $_hora[2] : ''); |
|
853 | + $_hora = ($hora ? $_hora[0] : '').($minuto ? ($hora ? ':' : '').$_hora[1] : '').($segundo ? ($hora || $minuto ? ':' : '').$_hora[2] : ''); |
|
854 | 854 | } |
855 | 855 | $recebe = explode('-', $data); |
856 | 856 | if (isset($recebe[2]) && isset($recebe[1])) { |
857 | - $data = ($dia ? $recebe[2] : '') . ($mes ? ($dia ? '/' : '') . $recebe[1] : '') . ($ano ? ($mes || $dia ? '/' : '') . $recebe[0] : ''); |
|
857 | + $data = ($dia ? $recebe[2] : '').($mes ? ($dia ? '/' : '').$recebe[1] : '').($ano ? ($mes || $dia ? '/' : '').$recebe[0] : ''); |
|
858 | 858 | } |
859 | 859 | |
860 | - return $data . (isset($_hora) ? ' ' . $_hora : ''); |
|
860 | + return $data.(isset($_hora) ? ' '.$_hora : ''); |
|
861 | 861 | } |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * If set to false, it returns all of $haystack from the first occurrence of $needle to the end, |
215 | 215 | * Default value is false. |
216 | 216 | * @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used. |
217 | - * @return string|boolean The portion of $haystack, or false if $needle is not found. |
|
217 | + * @return string|false The portion of $haystack, or false if $needle is not found. |
|
218 | 218 | */ |
219 | 219 | function mb_stristr($haystack, $needle, $part = false, $encoding = null) { |
220 | 220 | return Multibyte::stristr($haystack, $needle, $part); |
@@ -268,7 +268,7 @@ discard block |
||
268 | 268 | * If set to false, it returns all of $haystack from the last occurrence of $needle to the end, |
269 | 269 | * Default value is false. |
270 | 270 | * @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used. |
271 | - * @return string|boolean The portion of $haystack. or false if $needle is not found. |
|
271 | + * @return string|false The portion of $haystack. or false if $needle is not found. |
|
272 | 272 | */ |
273 | 273 | function mb_strrchr($haystack, $needle, $part = false, $encoding = null) { |
274 | 274 | return Multibyte::strrchr($haystack, $needle, $part); |
@@ -288,7 +288,7 @@ discard block |
||
288 | 288 | * If set to false, it returns all of $haystack from the last occurrence of $needle to the end, |
289 | 289 | * Default value is false. |
290 | 290 | * @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used. |
291 | - * @return string|boolean The portion of $haystack. or false if $needle is not found. |
|
291 | + * @return string|false The portion of $haystack. or false if $needle is not found. |
|
292 | 292 | */ |
293 | 293 | function mb_strrichr($haystack, $needle, $part = false, $encoding = null) { |
294 | 294 | return Multibyte::strrichr($haystack, $needle, $part); |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * If set to false, it returns all of $haystack from the first occurrence of $needle to the end, |
346 | 346 | * Default value is FALSE. |
347 | 347 | * @param string $encoding Character encoding name to use. If it is omitted, internal character encoding is used. |
348 | - * @return string|boolean The portion of $haystack, or true if $needle is not found. |
|
348 | + * @return string|false The portion of $haystack, or true if $needle is not found. |
|
349 | 349 | */ |
350 | 350 | function mb_strstr($haystack, $needle, $part = false, $encoding = null) { |
351 | 351 | return Multibyte::strstr($haystack, $needle, $part); |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * @param string $str The string being encoded |
425 | 425 | * @param string $charset specifies the name of the character set in which str is represented in. |
426 | 426 | * The default value is determined by the current NLS setting (mbstring.language). |
427 | - * @param string $transfer_encoding specifies the scheme of MIME encoding. |
|
427 | + * @param string $transferEncoding specifies the scheme of MIME encoding. |
|
428 | 428 | * It should be either "B" (Base64) or "Q" (Quoted-Printable). Falls back to "B" if not given. |
429 | 429 | * @param string $linefeed specifies the EOL (end-of-line) marker with which |
430 | 430 | * mb_encode_mimeheader() performs line-folding |
@@ -20,124 +20,124 @@ discard block |
||
20 | 20 | |
21 | 21 | define('TIME_START', microtime(true)); |
22 | 22 | |
23 | -if (!defined('E_DEPRECATED')) { |
|
23 | +if ( ! defined('E_DEPRECATED')) { |
|
24 | 24 | define('E_DEPRECATED', 8192); |
25 | 25 | } |
26 | 26 | |
27 | -if (!defined('E_USER_DEPRECATED')) { |
|
27 | +if ( ! defined('E_USER_DEPRECATED')) { |
|
28 | 28 | define('E_USER_DEPRECATED', E_USER_NOTICE); |
29 | 29 | } |
30 | 30 | error_reporting(E_ALL & ~E_DEPRECATED); |
31 | 31 | |
32 | -if (!defined('CAKE_CORE_INCLUDE_PATH')) { |
|
32 | +if ( ! defined('CAKE_CORE_INCLUDE_PATH')) { |
|
33 | 33 | define('CAKE_CORE_INCLUDE_PATH', dirname(dirname(__FILE__))); |
34 | 34 | } |
35 | 35 | |
36 | -if (!defined('CORE_PATH')) { |
|
37 | - define('CORE_PATH', CAKE_CORE_INCLUDE_PATH . DS); |
|
36 | +if ( ! defined('CORE_PATH')) { |
|
37 | + define('CORE_PATH', CAKE_CORE_INCLUDE_PATH.DS); |
|
38 | 38 | } |
39 | 39 | |
40 | -if (!defined('WEBROOT_DIR')) { |
|
40 | +if ( ! defined('WEBROOT_DIR')) { |
|
41 | 41 | define('WEBROOT_DIR', 'webroot'); |
42 | 42 | } |
43 | 43 | |
44 | 44 | /** |
45 | 45 | * Path to the cake directory. |
46 | 46 | */ |
47 | - define('CAKE', CORE_PATH . 'Cake' . DS); |
|
47 | + define('CAKE', CORE_PATH.'Cake'.DS); |
|
48 | 48 | |
49 | 49 | /** |
50 | 50 | * Path to the application's directory. |
51 | 51 | */ |
52 | -if (!defined('APP')) { |
|
53 | - define('APP', ROOT . DS . APP_DIR . DS); |
|
52 | +if ( ! defined('APP')) { |
|
53 | + define('APP', ROOT.DS.APP_DIR.DS); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
57 | 57 | * Path to the application's libs directory. |
58 | 58 | */ |
59 | - define('APPLIBS', APP . 'Lib' . DS); |
|
59 | + define('APPLIBS', APP.'Lib'.DS); |
|
60 | 60 | |
61 | 61 | /** |
62 | 62 | * Path to the public CSS directory. |
63 | 63 | */ |
64 | -if (!defined('CSS')) { |
|
65 | - define('CSS', WWW_ROOT . 'css' . DS); |
|
64 | +if ( ! defined('CSS')) { |
|
65 | + define('CSS', WWW_ROOT.'css'.DS); |
|
66 | 66 | } |
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Path to the public JavaScript directory. |
70 | 70 | */ |
71 | -if (!defined('JS')) { |
|
72 | - define('JS', WWW_ROOT . 'js' . DS); |
|
71 | +if ( ! defined('JS')) { |
|
72 | + define('JS', WWW_ROOT.'js'.DS); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | /** |
76 | 76 | * Path to the public images directory. |
77 | 77 | */ |
78 | -if (!defined('IMAGES')) { |
|
79 | - define('IMAGES', WWW_ROOT . 'img' . DS); |
|
78 | +if ( ! defined('IMAGES')) { |
|
79 | + define('IMAGES', WWW_ROOT.'img'.DS); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Path to the tests directory. |
84 | 84 | */ |
85 | -if (!defined('TESTS')) { |
|
86 | - define('TESTS', APP . 'Test' . DS); |
|
85 | +if ( ! defined('TESTS')) { |
|
86 | + define('TESTS', APP.'Test'.DS); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | /** |
90 | 90 | * Path to the temporary files directory. |
91 | 91 | */ |
92 | -if (!defined('TMP')) { |
|
93 | - define('TMP', APP . 'tmp' . DS); |
|
92 | +if ( ! defined('TMP')) { |
|
93 | + define('TMP', APP.'tmp'.DS); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
97 | 97 | * Path to the logs directory. |
98 | 98 | */ |
99 | -if (!defined('LOGS')) { |
|
100 | - define('LOGS', TMP . 'logs' . DS); |
|
99 | +if ( ! defined('LOGS')) { |
|
100 | + define('LOGS', TMP.'logs'.DS); |
|
101 | 101 | } |
102 | 102 | |
103 | 103 | /** |
104 | 104 | * Path to the cache files directory. It can be shared between hosts in a multi-server setup. |
105 | 105 | */ |
106 | -if (!defined('CACHE')) { |
|
107 | - define('CACHE', TMP . 'cache' . DS); |
|
106 | +if ( ! defined('CACHE')) { |
|
107 | + define('CACHE', TMP.'cache'.DS); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
111 | 111 | * Path to the vendors directory. |
112 | 112 | */ |
113 | -if (!defined('VENDORS')) { |
|
114 | - define('VENDORS', ROOT . DS . 'vendors' . DS); |
|
113 | +if ( ! defined('VENDORS')) { |
|
114 | + define('VENDORS', ROOT.DS.'vendors'.DS); |
|
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | 118 | * Web path to the public images directory. |
119 | 119 | */ |
120 | -if (!defined('IMAGES_URL')) { |
|
120 | +if ( ! defined('IMAGES_URL')) { |
|
121 | 121 | define('IMAGES_URL', 'img/'); |
122 | 122 | } |
123 | 123 | |
124 | 124 | /** |
125 | 125 | * Web path to the CSS files directory. |
126 | 126 | */ |
127 | -if (!defined('CSS_URL')) { |
|
127 | +if ( ! defined('CSS_URL')) { |
|
128 | 128 | define('CSS_URL', 'css/'); |
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
132 | 132 | * Web path to the js files directory. |
133 | 133 | */ |
134 | -if (!defined('JS_URL')) { |
|
134 | +if ( ! defined('JS_URL')) { |
|
135 | 135 | define('JS_URL', 'js/'); |
136 | 136 | } |
137 | 137 | |
138 | -require CAKE . 'basics.php'; |
|
139 | -require CAKE . 'Core' . DS . 'App.php'; |
|
140 | -require CAKE . 'Error' . DS . 'exceptions.php'; |
|
138 | +require CAKE.'basics.php'; |
|
139 | +require CAKE.'Core'.DS.'App.php'; |
|
140 | +require CAKE.'Error'.DS.'exceptions.php'; |
|
141 | 141 | |
142 | 142 | spl_autoload_register(array('App', 'load')); |
143 | 143 | |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | /** |
152 | 152 | * Full URL prefix |
153 | 153 | */ |
154 | -if (!defined('FULL_BASE_URL')) { |
|
154 | +if ( ! defined('FULL_BASE_URL')) { |
|
155 | 155 | $s = null; |
156 | 156 | if (env('HTTPS')) { |
157 | 157 | $s = 's'; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $httpHost = env('HTTP_HOST'); |
161 | 161 | |
162 | 162 | if (isset($httpHost)) { |
163 | - define('FULL_BASE_URL', 'http' . $s . '://' . $httpHost); |
|
163 | + define('FULL_BASE_URL', 'http'.$s.'://'.$httpHost); |
|
164 | 164 | Configure::write('App.fullBaseUrl', FULL_BASE_URL); |
165 | 165 | } |
166 | 166 | unset($httpHost, $s); |
@@ -176,15 +176,15 @@ discard block |
||
176 | 176 | |
177 | 177 | if (function_exists('mb_internal_encoding')) { |
178 | 178 | $encoding = Configure::read('App.encoding'); |
179 | - if (!empty($encoding)) { |
|
179 | + if ( ! empty($encoding)) { |
|
180 | 180 | mb_internal_encoding($encoding); |
181 | 181 | } |
182 | - if (!empty($encoding) && function_exists('mb_regex_encoding')) { |
|
182 | + if ( ! empty($encoding) && function_exists('mb_regex_encoding')) { |
|
183 | 183 | mb_regex_encoding($encoding); |
184 | 184 | } |
185 | 185 | } |
186 | 186 | |
187 | -if (!function_exists('mb_stripos')) { |
|
187 | +if ( ! function_exists('mb_stripos')) { |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Find position of first occurrence of a case-insensitive string. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | |
203 | 203 | } |
204 | 204 | |
205 | -if (!function_exists('mb_stristr')) { |
|
205 | +if ( ! function_exists('mb_stristr')) { |
|
206 | 206 | |
207 | 207 | /** |
208 | 208 | * Finds first occurrence of a string within another, case insensitive. |
@@ -222,7 +222,7 @@ discard block |
||
222 | 222 | |
223 | 223 | } |
224 | 224 | |
225 | -if (!function_exists('mb_strlen')) { |
|
225 | +if ( ! function_exists('mb_strlen')) { |
|
226 | 226 | |
227 | 227 | /** |
228 | 228 | * Get string length. |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | |
239 | 239 | } |
240 | 240 | |
241 | -if (!function_exists('mb_strpos')) { |
|
241 | +if ( ! function_exists('mb_strpos')) { |
|
242 | 242 | |
243 | 243 | /** |
244 | 244 | * Find position of first occurrence of a string. |
@@ -256,7 +256,7 @@ discard block |
||
256 | 256 | |
257 | 257 | } |
258 | 258 | |
259 | -if (!function_exists('mb_strrchr')) { |
|
259 | +if ( ! function_exists('mb_strrchr')) { |
|
260 | 260 | |
261 | 261 | /** |
262 | 262 | * Finds the last occurrence of a character in a string within another. |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | } |
278 | 278 | |
279 | -if (!function_exists('mb_strrichr')) { |
|
279 | +if ( ! function_exists('mb_strrichr')) { |
|
280 | 280 | |
281 | 281 | /** |
282 | 282 | * Finds the last occurrence of a character in a string within another, case insensitive. |
@@ -296,7 +296,7 @@ discard block |
||
296 | 296 | |
297 | 297 | } |
298 | 298 | |
299 | -if (!function_exists('mb_strripos')) { |
|
299 | +if ( ! function_exists('mb_strripos')) { |
|
300 | 300 | |
301 | 301 | /** |
302 | 302 | * Finds position of last occurrence of a string within another, case insensitive |
@@ -314,7 +314,7 @@ discard block |
||
314 | 314 | |
315 | 315 | } |
316 | 316 | |
317 | -if (!function_exists('mb_strrpos')) { |
|
317 | +if ( ! function_exists('mb_strrpos')) { |
|
318 | 318 | |
319 | 319 | /** |
320 | 320 | * Find position of last occurrence of a string in a string. |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | |
334 | 334 | } |
335 | 335 | |
336 | -if (!function_exists('mb_strstr')) { |
|
336 | +if ( ! function_exists('mb_strstr')) { |
|
337 | 337 | |
338 | 338 | /** |
339 | 339 | * Finds first occurrence of a string within another |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | } |
355 | 355 | |
356 | -if (!function_exists('mb_strtolower')) { |
|
356 | +if ( ! function_exists('mb_strtolower')) { |
|
357 | 357 | |
358 | 358 | /** |
359 | 359 | * Make a string lowercase |
@@ -368,7 +368,7 @@ discard block |
||
368 | 368 | |
369 | 369 | } |
370 | 370 | |
371 | -if (!function_exists('mb_strtoupper')) { |
|
371 | +if ( ! function_exists('mb_strtoupper')) { |
|
372 | 372 | |
373 | 373 | /** |
374 | 374 | * Make a string uppercase |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | |
384 | 384 | } |
385 | 385 | |
386 | -if (!function_exists('mb_substr_count')) { |
|
386 | +if ( ! function_exists('mb_substr_count')) { |
|
387 | 387 | |
388 | 388 | /** |
389 | 389 | * Count the number of substring occurrences |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | } |
401 | 401 | |
402 | -if (!function_exists('mb_substr')) { |
|
402 | +if ( ! function_exists('mb_substr')) { |
|
403 | 403 | |
404 | 404 | /** |
405 | 405 | * Get part of string |
@@ -416,7 +416,7 @@ discard block |
||
416 | 416 | |
417 | 417 | } |
418 | 418 | |
419 | -if (!function_exists('mb_encode_mimeheader')) { |
|
419 | +if ( ! function_exists('mb_encode_mimeheader')) { |
|
420 | 420 | |
421 | 421 | /** |
422 | 422 | * Encode string for MIME header |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | * to decide whether actually delete the keys or just simulate it to achieve |
131 | 131 | * the same result. |
132 | 132 | * |
133 | - * @param string $groups name of the group to be cleared |
|
133 | + * @param string $group name of the group to be cleared |
|
134 | 134 | * @return boolean |
135 | 135 | */ |
136 | 136 | public function clearGroup($group) { |
@@ -161,7 +161,7 @@ discard block |
||
161 | 161 | * Generates a safe key for use with cache engine storage engines. |
162 | 162 | * |
163 | 163 | * @param string $key the key passed over |
164 | - * @return mixed string $key or false |
|
164 | + * @return false|string string $key or false |
|
165 | 165 | */ |
166 | 166 | public function key($key) { |
167 | 167 | if (empty($key)) { |
@@ -52,11 +52,11 @@ discard block |
||
52 | 52 | 'groups' => array() |
53 | 53 | ); |
54 | 54 | $this->settings = $settings; |
55 | - if (!empty($this->settings['groups'])) { |
|
55 | + if ( ! empty($this->settings['groups'])) { |
|
56 | 56 | sort($this->settings['groups']); |
57 | 57 | $this->_groupPrefix = str_repeat('%s_', count($this->settings['groups'])); |
58 | 58 | } |
59 | - if (!is_numeric($this->settings['duration'])) { |
|
59 | + if ( ! is_numeric($this->settings['duration'])) { |
|
60 | 60 | $this->settings['duration'] = strtotime($this->settings['duration']) - time(); |
61 | 61 | } |
62 | 62 | return true; |
@@ -169,12 +169,12 @@ discard block |
||
169 | 169 | } |
170 | 170 | |
171 | 171 | $prefix = ''; |
172 | - if (!empty($this->_groupPrefix)) { |
|
172 | + if ( ! empty($this->_groupPrefix)) { |
|
173 | 173 | $prefix = vsprintf($this->_groupPrefix, $this->groups()); |
174 | 174 | } |
175 | 175 | |
176 | 176 | $key = preg_replace('/[\s]+/', '_', strtolower(trim(str_replace(array(DS, '/', '.'), '_', strval($key))))); |
177 | - return $prefix . $key; |
|
177 | + return $prefix.$key; |
|
178 | 178 | } |
179 | 179 | |
180 | 180 | } |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * Write data for key into cache |
105 | 105 | * |
106 | 106 | * @param string $key Identifier for the data |
107 | - * @param mixed $data Data to be cached |
|
107 | + * @param string $data Data to be cached |
|
108 | 108 | * @param integer $duration How long to cache the data, in seconds |
109 | 109 | * @return boolean True if the data was successfully cached, false on failure |
110 | 110 | */ |
@@ -391,7 +391,7 @@ discard block |
||
391 | 391 | * Generates a safe key for use with cache engine storage engines. |
392 | 392 | * |
393 | 393 | * @param string $key the key passed over |
394 | - * @return mixed string $key or false |
|
394 | + * @return false|string string $key or false |
|
395 | 395 | */ |
396 | 396 | public function key($key) { |
397 | 397 | if (empty($key)) { |
@@ -84,7 +84,7 @@ discard block |
||
84 | 84 | if (substr($this->settings['path'], -1) !== DS) { |
85 | 85 | $this->settings['path'] .= DS; |
86 | 86 | } |
87 | - if (!empty($this->_groupPrefix)) { |
|
87 | + if ( ! empty($this->_groupPrefix)) { |
|
88 | 88 | $this->_groupPrefix = str_replace('_', DS, $this->_groupPrefix); |
89 | 89 | } |
90 | 90 | return $this->_active(); |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | * @return boolean True if the data was successfully cached, false on failure |
110 | 110 | */ |
111 | 111 | public function write($key, $data, $duration) { |
112 | - if ($data === '' || !$this->_init) { |
|
112 | + if ($data === '' || ! $this->_init) { |
|
113 | 113 | return false; |
114 | 114 | } |
115 | 115 | |
@@ -123,7 +123,7 @@ discard block |
||
123 | 123 | $lineBreak = "\r\n"; |
124 | 124 | } |
125 | 125 | |
126 | - if (!empty($this->settings['serialize'])) { |
|
126 | + if ( ! empty($this->settings['serialize'])) { |
|
127 | 127 | if ($this->settings['isWindows']) { |
128 | 128 | $data = str_replace('\\', '\\\\\\\\', serialize($data)); |
129 | 129 | } else { |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | } |
133 | 133 | |
134 | 134 | $expires = time() + $duration; |
135 | - $contents = $expires . $lineBreak . $data . $lineBreak; |
|
135 | + $contents = $expires.$lineBreak.$data.$lineBreak; |
|
136 | 136 | |
137 | 137 | if ($this->settings['lock']) { |
138 | 138 | $this->_File->flock(LOCK_EX); |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | * @return mixed The cached data, or false if the data doesn't exist, has expired, or if there was an error fetching it |
156 | 156 | */ |
157 | 157 | public function read($key) { |
158 | - if (!$this->_init || $this->_setKey($key) === false) { |
|
158 | + if ( ! $this->_init || $this->_setKey($key) === false) { |
|
159 | 159 | return false; |
160 | 160 | } |
161 | 161 | |
@@ -187,11 +187,11 @@ discard block |
||
187 | 187 | |
188 | 188 | $data = trim($data); |
189 | 189 | |
190 | - if ($data !== '' && !empty($this->settings['serialize'])) { |
|
190 | + if ($data !== '' && ! empty($this->settings['serialize'])) { |
|
191 | 191 | if ($this->settings['isWindows']) { |
192 | 192 | $data = str_replace('\\\\\\\\', '\\', $data); |
193 | 193 | } |
194 | - $data = unserialize((string)$data); |
|
194 | + $data = unserialize((string) $data); |
|
195 | 195 | } |
196 | 196 | return $data; |
197 | 197 | } |
@@ -203,7 +203,7 @@ discard block |
||
203 | 203 | * @return boolean True if the value was successfully deleted, false if it didn't exist or couldn't be removed |
204 | 204 | */ |
205 | 205 | public function delete($key) { |
206 | - if ($this->_setKey($key) === false || !$this->_init) { |
|
206 | + if ($this->_setKey($key) === false || ! $this->_init) { |
|
207 | 207 | return false; |
208 | 208 | } |
209 | 209 | $path = $this->_File->getRealPath(); |
@@ -221,7 +221,7 @@ discard block |
||
221 | 221 | * @return boolean True if the cache was successfully cleared, false otherwise |
222 | 222 | */ |
223 | 223 | public function clear($check) { |
224 | - if (!$this->_init) { |
|
224 | + if ( ! $this->_init) { |
|
225 | 225 | return false; |
226 | 226 | } |
227 | 227 | $this->_File = null; |
@@ -242,8 +242,8 @@ discard block |
||
242 | 242 | continue; |
243 | 243 | } |
244 | 244 | |
245 | - $path = $path->getRealPath() . DS; |
|
246 | - if (!in_array($path, $cleared)) { |
|
245 | + $path = $path->getRealPath().DS; |
|
246 | + if ( ! in_array($path, $cleared)) { |
|
247 | 247 | $this->_clearDirectory($path, $now, $threshold); |
248 | 248 | $cleared[] = $path; |
249 | 249 | } |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | protected function _clearDirectory($path, $now, $threshold) { |
263 | 263 | $prefixLength = strlen($this->settings['prefix']); |
264 | 264 | |
265 | - if (!is_dir($path)) { |
|
265 | + if ( ! is_dir($path)) { |
|
266 | 266 | return; |
267 | 267 | } |
268 | 268 | |
@@ -271,11 +271,11 @@ discard block |
||
271 | 271 | if (substr($entry, 0, $prefixLength) !== $this->settings['prefix']) { |
272 | 272 | continue; |
273 | 273 | } |
274 | - $filePath = $path . $entry; |
|
275 | - if (!file_exists($filePath) || is_dir($filePath)) { |
|
274 | + $filePath = $path.$entry; |
|
275 | + if ( ! file_exists($filePath) || is_dir($filePath)) { |
|
276 | 276 | continue; |
277 | 277 | } |
278 | - $file = new SplFileObject($path . $entry, 'r'); |
|
278 | + $file = new SplFileObject($path.$entry, 'r'); |
|
279 | 279 | |
280 | 280 | if ($threshold) { |
281 | 281 | $mtime = $file->getMTime(); |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | if ($mtime > $threshold) { |
284 | 284 | continue; |
285 | 285 | } |
286 | - $expires = (int)$file->current(); |
|
286 | + $expires = (int) $file->current(); |
|
287 | 287 | |
288 | 288 | if ($expires > $now) { |
289 | 289 | continue; |
@@ -334,17 +334,17 @@ discard block |
||
334 | 334 | */ |
335 | 335 | protected function _setKey($key, $createKey = false) { |
336 | 336 | $groups = null; |
337 | - if (!empty($this->_groupPrefix)) { |
|
337 | + if ( ! empty($this->_groupPrefix)) { |
|
338 | 338 | $groups = vsprintf($this->_groupPrefix, $this->groups()); |
339 | 339 | } |
340 | - $dir = $this->settings['path'] . $groups; |
|
340 | + $dir = $this->settings['path'].$groups; |
|
341 | 341 | |
342 | - if (!is_dir($dir)) { |
|
342 | + if ( ! is_dir($dir)) { |
|
343 | 343 | mkdir($dir, 0775, true); |
344 | 344 | } |
345 | - $path = new SplFileInfo($dir . $key); |
|
345 | + $path = new SplFileInfo($dir.$key); |
|
346 | 346 | |
347 | - if (!$createKey && !$path->isFile()) { |
|
347 | + if ( ! $createKey && ! $path->isFile()) { |
|
348 | 348 | return false; |
349 | 349 | } |
350 | 350 | if (empty($this->_File) || $this->_File->getBaseName() !== $key) { |
@@ -357,7 +357,7 @@ discard block |
||
357 | 357 | } |
358 | 358 | unset($path); |
359 | 359 | |
360 | - if (!$exists && !chmod($this->_File->getPathname(), (int)$this->settings['mask'])) { |
|
360 | + if ( ! $exists && ! chmod($this->_File->getPathname(), (int) $this->settings['mask'])) { |
|
361 | 361 | trigger_error(__d( |
362 | 362 | 'cake_dev', 'Could not apply permission mask "%s" on cache file "%s"', |
363 | 363 | array($this->_File->getPathname(), $this->settings['mask'])), E_USER_WARNING); |
@@ -375,11 +375,11 @@ discard block |
||
375 | 375 | $dir = new SplFileInfo($this->settings['path']); |
376 | 376 | if (Configure::read('debug')) { |
377 | 377 | $path = $dir->getPathname(); |
378 | - if (!is_dir($path)) { |
|
378 | + if ( ! is_dir($path)) { |
|
379 | 379 | mkdir($path, 0775, true); |
380 | 380 | } |
381 | 381 | } |
382 | - if ($this->_init && !($dir->isDir() && $dir->isWritable())) { |
|
382 | + if ($this->_init && ! ($dir->isDir() && $dir->isWritable())) { |
|
383 | 383 | $this->_init = false; |
384 | 384 | trigger_error(__d('cake_dev', '%s is not writable', $this->settings['path']), E_USER_WARNING); |
385 | 385 | return false; |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | $directoryIterator = new RecursiveDirectoryIterator($this->settings['path']); |
413 | 413 | $contents = new RecursiveIteratorIterator($directoryIterator, RecursiveIteratorIterator::CHILD_FIRST); |
414 | 414 | foreach ($contents as $object) { |
415 | - $containsGroup = strpos($object->getPathName(), DS . $group . DS) !== false; |
|
415 | + $containsGroup = strpos($object->getPathName(), DS.$group.DS) !== false; |
|
416 | 416 | $hasPrefix = true; |
417 | 417 | if (strlen($this->settings['prefix']) !== 0) { |
418 | 418 | $hasPrefix = strpos($object->getBaseName(), $this->settings['prefix']) === 0; |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * |
134 | 134 | * @param string $key Identifier for the data |
135 | 135 | * @param integer $offset How much to increment |
136 | - * @return New incremented value, false otherwise |
|
136 | + * @return integer incremented value, false otherwise |
|
137 | 137 | * @throws CacheException when you try to increment with compress = true |
138 | 138 | */ |
139 | 139 | public function increment($key, $offset = 1) { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param string $key Identifier for the data |
147 | 147 | * @param integer $offset How much to subtract |
148 | - * @return New decremented value, false otherwise |
|
148 | + * @return integer decremented value, false otherwise |
|
149 | 149 | * @throws CacheException when you try to decrement with compress = true |
150 | 150 | */ |
151 | 151 | public function decrement($key, $offset = 1) { |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return boolean True if the engine has been successfully initialized, false if not |
53 | 53 | */ |
54 | 54 | public function init($settings = array()) { |
55 | - if (!class_exists('Redis')) { |
|
55 | + if ( ! class_exists('Redis')) { |
|
56 | 56 | return false; |
57 | 57 | } |
58 | 58 | parent::init(array_merge(array( |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | * @return boolean True if the data was successfully cached, false on failure |
102 | 102 | */ |
103 | 103 | public function write($key, $value, $duration) { |
104 | - if (!is_int($value)) { |
|
104 | + if ( ! is_int($value)) { |
|
105 | 105 | $value = serialize($value); |
106 | 106 | } |
107 | 107 | if ($duration === 0) { |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | public function read($key) { |
121 | 121 | $value = $this->_Redis->get($key); |
122 | 122 | if (ctype_digit($value)) { |
123 | - $value = (int)$value; |
|
123 | + $value = (int) $value; |
|
124 | 124 | } |
125 | 125 | if ($value !== false && is_string($value)) { |
126 | 126 | $value = unserialize($value); |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | * @throws CacheException when you try to increment with compress = true |
138 | 138 | */ |
139 | 139 | public function increment($key, $offset = 1) { |
140 | - return (int)$this->_Redis->incrBy($key, $offset); |
|
140 | + return (int) $this->_Redis->incrBy($key, $offset); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | /** |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | * @throws CacheException when you try to decrement with compress = true |
150 | 150 | */ |
151 | 151 | public function decrement($key, $offset = 1) { |
152 | - return (int)$this->_Redis->decrBy($key, $offset); |
|
152 | + return (int) $this->_Redis->decrBy($key, $offset); |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | if ($check) { |
173 | 173 | return true; |
174 | 174 | } |
175 | - $keys = $this->_Redis->getKeys($this->settings['prefix'] . '*'); |
|
175 | + $keys = $this->_Redis->getKeys($this->settings['prefix'].'*'); |
|
176 | 176 | $this->_Redis->del($keys); |
177 | 177 | |
178 | 178 | return true; |
@@ -188,12 +188,12 @@ discard block |
||
188 | 188 | public function groups() { |
189 | 189 | $result = array(); |
190 | 190 | foreach ($this->settings['groups'] as $group) { |
191 | - $value = $this->_Redis->get($this->settings['prefix'] . $group); |
|
192 | - if (!$value) { |
|
191 | + $value = $this->_Redis->get($this->settings['prefix'].$group); |
|
192 | + if ( ! $value) { |
|
193 | 193 | $value = 1; |
194 | - $this->_Redis->set($this->settings['prefix'] . $group, $value); |
|
194 | + $this->_Redis->set($this->settings['prefix'].$group, $value); |
|
195 | 195 | } |
196 | - $result[] = $group . $value; |
|
196 | + $result[] = $group.$value; |
|
197 | 197 | } |
198 | 198 | return $result; |
199 | 199 | } |
@@ -205,14 +205,14 @@ discard block |
||
205 | 205 | * @return boolean success |
206 | 206 | */ |
207 | 207 | public function clearGroup($group) { |
208 | - return (bool)$this->_Redis->incr($this->settings['prefix'] . $group); |
|
208 | + return (bool) $this->_Redis->incr($this->settings['prefix'].$group); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
212 | 212 | * Disconnects from the redis server |
213 | 213 | */ |
214 | 214 | public function __destruct() { |
215 | - if (!$this->settings['persistent']) { |
|
215 | + if ( ! $this->settings['persistent']) { |
|
216 | 216 | $this->_Redis->close(); |
217 | 217 | } |
218 | 218 | } |
@@ -181,7 +181,7 @@ |
||
181 | 181 | /** |
182 | 182 | * Converts a value into the ini equivalent |
183 | 183 | * |
184 | - * @param mixed $value to export. |
|
184 | + * @param mixed $val to export. |
|
185 | 185 | * @return string String value for ini file. |
186 | 186 | */ |
187 | 187 | protected function _value($val) { |
@@ -77,8 +77,8 @@ discard block |
||
77 | 77 | * all sections in the ini file. |
78 | 78 | */ |
79 | 79 | public function __construct($path = null, $section = null) { |
80 | - if (!$path) { |
|
81 | - $path = APP . 'Config' . DS; |
|
80 | + if ( ! $path) { |
|
81 | + $path = APP.'Config'.DS; |
|
82 | 82 | } |
83 | 83 | $this->_path = $path; |
84 | 84 | $this->_section = $section; |
@@ -101,12 +101,12 @@ discard block |
||
101 | 101 | } |
102 | 102 | |
103 | 103 | $file = $this->_getFilePath($key); |
104 | - if (!is_file($file)) { |
|
104 | + if ( ! is_file($file)) { |
|
105 | 105 | throw new ConfigureException(__d('cake_dev', 'Could not load configuration file: %s', $file)); |
106 | 106 | } |
107 | 107 | |
108 | 108 | $contents = parse_ini_file($file, true); |
109 | - if (!empty($this->_section) && isset($contents[$this->_section])) { |
|
109 | + if ( ! empty($this->_section) && isset($contents[$this->_section])) { |
|
110 | 110 | $values = $this->_parseNestedValues($contents[$this->_section]); |
111 | 111 | } else { |
112 | 112 | $values = array(); |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | if (is_array($value)) { |
166 | 166 | $kValues = Hash::flatten($value, '.'); |
167 | 167 | foreach ($kValues as $k2 => $v) { |
168 | - $result[] = "$k2 = " . $this->_value($v); |
|
168 | + $result[] = "$k2 = ".$this->_value($v); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | if ($isSection) { |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | if ($val === false) { |
195 | 195 | return 'false'; |
196 | 196 | } |
197 | - return (string)$val; |
|
197 | + return (string) $val; |
|
198 | 198 | } |
199 | 199 | |
200 | 200 | /** |
@@ -218,9 +218,9 @@ discard block |
||
218 | 218 | } |
219 | 219 | |
220 | 220 | if ($plugin) { |
221 | - $file = App::pluginPath($plugin) . 'Config' . DS . $key; |
|
221 | + $file = App::pluginPath($plugin).'Config'.DS.$key; |
|
222 | 222 | } else { |
223 | - $file = $this->_path . $key; |
|
223 | + $file = $this->_path.$key; |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | return $file; |
@@ -356,7 +356,7 @@ discard block |
||
356 | 356 | /** |
357 | 357 | * Initialize ACL database. |
358 | 358 | * |
359 | - * @return mixed |
|
359 | + * @return boolean |
|
360 | 360 | */ |
361 | 361 | public function initdb() { |
362 | 362 | return $this->dispatchShell('schema create DbAcl'); |
@@ -365,7 +365,7 @@ discard block |
||
365 | 365 | /** |
366 | 366 | * Get the option parser. |
367 | 367 | * |
368 | - * @return void |
|
368 | + * @return ConsoleOptionParser |
|
369 | 369 | */ |
370 | 370 | public function getOptionParser() { |
371 | 371 | $parser = parent::getOptionParser(); |
@@ -71,27 +71,27 @@ discard block |
||
71 | 71 | |
72 | 72 | $class = Configure::read('Acl.classname'); |
73 | 73 | list($plugin, $class) = pluginSplit($class, true); |
74 | - App::uses($class, $plugin . 'Controller/Component/Acl'); |
|
75 | - if (!in_array($class, array('DbAcl', 'DB_ACL')) && !is_subclass_of($class, 'DbAcl')) { |
|
74 | + App::uses($class, $plugin.'Controller/Component/Acl'); |
|
75 | + if ( ! in_array($class, array('DbAcl', 'DB_ACL')) && ! is_subclass_of($class, 'DbAcl')) { |
|
76 | 76 | $out = "--------------------------------------------------\n"; |
77 | - $out .= __d('cake_console', 'Error: Your current CakePHP configuration is set to an ACL implementation other than DB.') . "\n"; |
|
78 | - $out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script') . "\n"; |
|
77 | + $out .= __d('cake_console', 'Error: Your current CakePHP configuration is set to an ACL implementation other than DB.')."\n"; |
|
78 | + $out .= __d('cake_console', 'Please change your core config to reflect your decision to use DbAcl before attempting to use this script')."\n"; |
|
79 | 79 | $out .= "--------------------------------------------------\n"; |
80 | - $out .= __d('cake_console', 'Current ACL Classname: %s', $class) . "\n"; |
|
80 | + $out .= __d('cake_console', 'Current ACL Classname: %s', $class)."\n"; |
|
81 | 81 | $out .= "--------------------------------------------------\n"; |
82 | 82 | $this->err($out); |
83 | 83 | return $this->_stop(); |
84 | 84 | } |
85 | 85 | |
86 | 86 | if ($this->command) { |
87 | - if (!config('database')) { |
|
87 | + if ( ! config('database')) { |
|
88 | 88 | $this->out(__d('cake_console', 'Your database configuration was not found. Take a moment to create one.')); |
89 | 89 | $this->args = null; |
90 | 90 | return $this->DbConfig->execute(); |
91 | 91 | } |
92 | - require_once APP . 'Config' . DS . 'database.php'; |
|
92 | + require_once APP.'Config'.DS.'database.php'; |
|
93 | 93 | |
94 | - if (!in_array($this->command, array('initdb'))) { |
|
94 | + if ( ! in_array($this->command, array('initdb'))) { |
|
95 | 95 | $collection = new ComponentCollection(); |
96 | 96 | $this->Acl = new AclComponent($collection); |
97 | 97 | $controller = new Controller(); |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $class = ucfirst($this->args[0]); |
121 | 121 | $parent = $this->parseIdentifier($this->args[1]); |
122 | 122 | |
123 | - if (!empty($parent) && $parent !== '/' && $parent !== 'root') { |
|
123 | + if ( ! empty($parent) && $parent !== '/' && $parent !== 'root') { |
|
124 | 124 | $parent = $this->_getNodeId($class, $parent); |
125 | 125 | } else { |
126 | 126 | $parent = null; |
@@ -130,7 +130,7 @@ discard block |
||
130 | 130 | if (is_string($data) && $data !== '/') { |
131 | 131 | $data = array('alias' => $data); |
132 | 132 | } elseif (is_string($data)) { |
133 | - $this->error(__d('cake_console', '/ can not be used as an alias!') . __d('cake_console', " / is the root, please supply a sub alias")); |
|
133 | + $this->error(__d('cake_console', '/ can not be used as an alias!').__d('cake_console', " / is the root, please supply a sub alias")); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | $data['parent_id'] = $parent; |
@@ -157,12 +157,12 @@ discard block |
||
157 | 157 | } |
158 | 158 | |
159 | 159 | if ($this->Acl->{$class}->find('all', array('conditions' => $identifier))) { |
160 | - if (!$this->Acl->{$class}->deleteAll($identifier)) { |
|
161 | - $this->error(__d('cake_console', 'Node Not Deleted. ') . __d('cake_console', 'There was an error deleting the %s.', $class) . "\n"); |
|
160 | + if ( ! $this->Acl->{$class}->deleteAll($identifier)) { |
|
161 | + $this->error(__d('cake_console', 'Node Not Deleted. ').__d('cake_console', 'There was an error deleting the %s.', $class)."\n"); |
|
162 | 162 | } |
163 | 163 | $this->out(__d('cake_console', '<success>%s deleted.</success>', $class), 2); |
164 | 164 | } else { |
165 | - $this->error(__d('cake_console', 'Node Not Deleted. ') . __d('cake_console', 'There was an error deleting the %s. Node does not exist.', $class) . "\n"); |
|
165 | + $this->error(__d('cake_console', 'Node Not Deleted. ').__d('cake_console', 'There was an error deleting the %s. Node does not exist.', $class)."\n"); |
|
166 | 166 | } |
167 | 167 | } |
168 | 168 | |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | ) |
184 | 184 | ); |
185 | 185 | $this->Acl->{$class}->create(); |
186 | - if (!$this->Acl->{$class}->save($data)) { |
|
186 | + if ( ! $this->Acl->{$class}->save($data)) { |
|
187 | 187 | $this->out(__d('cake_console', 'Error in setting new parent. Please make sure the parent node exists, and is not a descendant of the node specified.')); |
188 | 188 | } else { |
189 | - $this->out(__d('cake_console', 'Node parent set to %s', $this->args[2]) . "\n"); |
|
189 | + $this->out(__d('cake_console', 'Node parent set to %s', $this->args[2])."\n"); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -227,9 +227,9 @@ discard block |
||
227 | 227 | $indent = str_repeat(' ', $indent); |
228 | 228 | $data = $node[$class]; |
229 | 229 | if ($data['alias']) { |
230 | - $this->out($indent . "[" . $data['id'] . "] " . $data['alias']); |
|
230 | + $this->out($indent."[".$data['id']."] ".$data['alias']); |
|
231 | 231 | } else { |
232 | - $this->out($indent . "[" . $data['id'] . "] " . $data['model'] . '.' . $data['foreign_key']); |
|
232 | + $this->out($indent."[".$data['id']."] ".$data['model'].'.'.$data['foreign_key']); |
|
233 | 233 | } |
234 | 234 | } |
235 | 235 | |
@@ -305,18 +305,18 @@ discard block |
||
305 | 305 | $identity = $this->parseIdentifier($this->args[1]); |
306 | 306 | |
307 | 307 | $topNode = $this->Acl->{$class}->find('first', array( |
308 | - 'conditions' => array($class . '.id' => $this->_getNodeId($class, $identity)) |
|
308 | + 'conditions' => array($class.'.id' => $this->_getNodeId($class, $identity)) |
|
309 | 309 | )); |
310 | 310 | |
311 | 311 | $nodes = $this->Acl->{$class}->find('all', array( |
312 | 312 | 'conditions' => array( |
313 | - $class . '.lft >=' => $topNode[$class]['lft'], |
|
314 | - $class . '.lft <=' => $topNode[$class]['rght'] |
|
313 | + $class.'.lft >=' => $topNode[$class]['lft'], |
|
314 | + $class.'.lft <=' => $topNode[$class]['rght'] |
|
315 | 315 | ), |
316 | - 'order' => $class . '.lft ASC' |
|
316 | + 'order' => $class.'.lft ASC' |
|
317 | 317 | )); |
318 | 318 | } else { |
319 | - $nodes = $this->Acl->{$class}->find('all', array('order' => $class . '.lft ASC')); |
|
319 | + $nodes = $this->Acl->{$class}->find('all', array('order' => $class.'.lft ASC')); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | if (empty($nodes)) { |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | $this->error(__d('cake_console', '%s not found', $this->args[0]), __d('cake_console', 'No tree returned.')); |
327 | 327 | } |
328 | 328 | } |
329 | - $this->out($class . ' tree:'); |
|
329 | + $this->out($class.' tree:'); |
|
330 | 330 | $this->hr(); |
331 | 331 | |
332 | 332 | $stack = array(); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | |
335 | 335 | foreach ($nodes as $n) { |
336 | 336 | $stack[] = $n; |
337 | - if (!empty($last)) { |
|
337 | + if ( ! empty($last)) { |
|
338 | 338 | $end = end($stack); |
339 | 339 | if ($end[$class]['rght'] > $last) { |
340 | 340 | foreach ($stack as $k => $v) { |
@@ -523,13 +523,13 @@ discard block |
||
523 | 523 | * @return boolean Success |
524 | 524 | */ |
525 | 525 | public function nodeExists() { |
526 | - if (!isset($this->args[0]) || !isset($this->args[1])) { |
|
526 | + if ( ! isset($this->args[0]) || ! isset($this->args[1])) { |
|
527 | 527 | return false; |
528 | 528 | } |
529 | 529 | $dataVars = $this->_dataVars($this->args[0]); |
530 | 530 | extract($dataVars); |
531 | 531 | $key = is_numeric($this->args[1]) ? $dataVars['secondary_id'] : 'alias'; |
532 | - $conditions = array($class . '.' . $key => $this->args[1]); |
|
532 | + $conditions = array($class.'.'.$key => $this->args[1]); |
|
533 | 533 | $possibility = $this->Acl->{$class}->find('all', compact('conditions')); |
534 | 534 | if (empty($possibility)) { |
535 | 535 | $this->error(__d('cake_console', '%s not found', $this->args[1]), __d('cake_console', 'No tree returned.')); |
@@ -592,7 +592,7 @@ discard block |
||
592 | 592 | $aco = $this->parseIdentifier($aco); |
593 | 593 | } |
594 | 594 | $action = '*'; |
595 | - if (isset($this->args[2]) && !in_array($this->args[2], array('', 'all'))) { |
|
595 | + if (isset($this->args[2]) && ! in_array($this->args[2], array('', 'all'))) { |
|
596 | 596 | $action = $this->args[2]; |
597 | 597 | } |
598 | 598 | return compact('aro', 'aco', 'action', 'aroName', 'acoName'); |
@@ -605,14 +605,14 @@ discard block |
||
605 | 605 | * @return array Variables |
606 | 606 | */ |
607 | 607 | protected function _dataVars($type = null) { |
608 | - if (!$type) { |
|
608 | + if ( ! $type) { |
|
609 | 609 | $type = $this->args[0]; |
610 | 610 | } |
611 | 611 | $vars = array(); |
612 | 612 | $class = ucwords($type); |
613 | 613 | $vars['secondary_id'] = (strtolower($class) === 'aro') ? 'foreign_key' : 'object_id'; |
614 | 614 | $vars['data_name'] = $type; |
615 | - $vars['table_name'] = $type . 's'; |
|
615 | + $vars['table_name'] = $type.'s'; |
|
616 | 616 | $vars['class'] = $class; |
617 | 617 | return $vars; |
618 | 618 | } |
@@ -411,7 +411,7 @@ discard block |
||
411 | 411 | * @param array $contents |
412 | 412 | * @param string $event |
413 | 413 | * @param CakeSchema $Schema |
414 | - * @return void |
|
414 | + * @return null|false |
|
415 | 415 | */ |
416 | 416 | protected function _run($contents, $event, CakeSchema $Schema) { |
417 | 417 | if (empty($contents)) { |
@@ -454,7 +454,7 @@ discard block |
||
454 | 454 | /** |
455 | 455 | * get the option parser |
456 | 456 | * |
457 | - * @return void |
|
457 | + * @return ConsoleOptionParser |
|
458 | 458 | */ |
459 | 459 | public function getOptionParser() { |
460 | 460 | $plugin = array( |
@@ -56,9 +56,9 @@ discard block |
||
56 | 56 | Configure::write('Cache.disable', 1); |
57 | 57 | |
58 | 58 | $name = $path = $connection = $plugin = null; |
59 | - if (!empty($this->params['name'])) { |
|
59 | + if ( ! empty($this->params['name'])) { |
|
60 | 60 | $name = $this->params['name']; |
61 | - } elseif (!empty($this->args[0]) && $this->args[0] !== 'snapshot') { |
|
61 | + } elseif ( ! empty($this->args[0]) && $this->args[0] !== 'snapshot') { |
|
62 | 62 | $name = $this->params['name'] = $this->args[0]; |
63 | 63 | } |
64 | 64 | |
@@ -79,14 +79,14 @@ discard block |
||
79 | 79 | } |
80 | 80 | $file = $this->params['file']; |
81 | 81 | |
82 | - if (!empty($this->params['path'])) { |
|
82 | + if ( ! empty($this->params['path'])) { |
|
83 | 83 | $path = $this->params['path']; |
84 | 84 | } |
85 | 85 | |
86 | - if (!empty($this->params['connection'])) { |
|
86 | + if ( ! empty($this->params['connection'])) { |
|
87 | 87 | $connection = $this->params['connection']; |
88 | 88 | } |
89 | - if (!empty($this->params['plugin'])) { |
|
89 | + if ( ! empty($this->params['plugin'])) { |
|
90 | 90 | $plugin = $this->params['plugin']; |
91 | 91 | if (empty($name)) { |
92 | 92 | $name = $plugin; |
@@ -103,12 +103,12 @@ discard block |
||
103 | 103 | * @return void |
104 | 104 | */ |
105 | 105 | public function view() { |
106 | - $File = new File($this->Schema->path . DS . $this->params['file']); |
|
106 | + $File = new File($this->Schema->path.DS.$this->params['file']); |
|
107 | 107 | if ($File->exists()) { |
108 | 108 | $this->out($File->read()); |
109 | 109 | return $this->_stop(); |
110 | 110 | } |
111 | - $file = $this->Schema->path . DS . $this->params['file']; |
|
111 | + $file = $this->Schema->path.DS.$this->params['file']; |
|
112 | 112 | $this->err(__d('cake_console', 'Schema file (%s) could not be found.', $file)); |
113 | 113 | return $this->_stop(); |
114 | 114 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | $options = array(); |
125 | 125 | if ($this->params['force']) { |
126 | 126 | $options['models'] = false; |
127 | - } elseif (!empty($this->params['models'])) { |
|
127 | + } elseif ( ! empty($this->params['models'])) { |
|
128 | 128 | $options['models'] = String::tokenize($this->params['models']); |
129 | 129 | } |
130 | 130 | |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $snapshot = true; |
134 | 134 | } |
135 | 135 | |
136 | - if (!$snapshot && file_exists($this->Schema->path . DS . $this->params['file'])) { |
|
136 | + if ( ! $snapshot && file_exists($this->Schema->path.DS.$this->params['file'])) { |
|
137 | 137 | $snapshot = true; |
138 | 138 | $prompt = __d('cake_console', "Schema file exists.\n [O]verwrite\n [S]napshot\n [Q]uit\nWould you like to do?"); |
139 | 139 | $result = strtolower($this->in($prompt, array('o', 's', 'q'), 's')); |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | |
154 | 154 | Configure::write('Cache.disable', $cacheDisable); |
155 | 155 | |
156 | - if (!empty($this->params['exclude']) && !empty($content)) { |
|
156 | + if ( ! empty($this->params['exclude']) && ! empty($content)) { |
|
157 | 157 | $excluded = String::tokenize($this->params['exclude']); |
158 | 158 | foreach ($excluded as $table) { |
159 | 159 | unset($content['tables'][$table]); |
@@ -171,9 +171,9 @@ discard block |
||
171 | 171 | } |
172 | 172 | |
173 | 173 | $count = 0; |
174 | - if (!empty($result[1])) { |
|
174 | + if ( ! empty($result[1])) { |
|
175 | 175 | foreach ($result[1] as $file) { |
176 | - if (preg_match('/' . preg_quote($fileName) . '(?:[_\d]*)?\.php$/', $file)) { |
|
176 | + if (preg_match('/'.preg_quote($fileName).'(?:[_\d]*)?\.php$/', $file)) { |
|
177 | 177 | $count++; |
178 | 178 | } |
179 | 179 | } |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | - $content['file'] = $fileName . '_' . $count . '.php'; |
|
188 | + $content['file'] = $fileName.'_'.$count.'.php'; |
|
189 | 189 | } |
190 | 190 | |
191 | 191 | if ($this->Schema->write($content)) { |
@@ -208,11 +208,11 @@ discard block |
||
208 | 208 | public function dump() { |
209 | 209 | $write = false; |
210 | 210 | $Schema = $this->Schema->load(); |
211 | - if (!$Schema) { |
|
211 | + if ( ! $Schema) { |
|
212 | 212 | $this->err(__d('cake_console', 'Schema could not be loaded')); |
213 | 213 | return $this->_stop(); |
214 | 214 | } |
215 | - if (!empty($this->params['write'])) { |
|
215 | + if ( ! empty($this->params['write'])) { |
|
216 | 216 | if ($this->params['write'] == 1) { |
217 | 217 | $write = Inflector::underscore($this->Schema->name); |
218 | 218 | } else { |
@@ -220,7 +220,7 @@ discard block |
||
220 | 220 | } |
221 | 221 | } |
222 | 222 | $db = ConnectionManager::getDataSource($this->Schema->connection); |
223 | - $contents = "\n\n" . $db->dropSchema($Schema) . "\n\n" . $db->createSchema($Schema); |
|
223 | + $contents = "\n\n".$db->dropSchema($Schema)."\n\n".$db->createSchema($Schema); |
|
224 | 224 | |
225 | 225 | if ($write) { |
226 | 226 | if (strpos($write, '.sql') === false) { |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | if (strpos($write, DS) !== false) { |
230 | 230 | $File = new File($write, true); |
231 | 231 | } else { |
232 | - $File = new File($this->Schema->path . DS . $write, true); |
|
232 | + $File = new File($this->Schema->path.DS.$write, true); |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | if ($File->write($contents)) { |
@@ -270,14 +270,14 @@ discard block |
||
270 | 270 | */ |
271 | 271 | protected function _loadSchema() { |
272 | 272 | $name = $plugin = null; |
273 | - if (!empty($this->params['name'])) { |
|
273 | + if ( ! empty($this->params['name'])) { |
|
274 | 274 | $name = $this->params['name']; |
275 | 275 | } |
276 | - if (!empty($this->params['plugin'])) { |
|
276 | + if ( ! empty($this->params['plugin'])) { |
|
277 | 277 | $plugin = $this->params['plugin']; |
278 | 278 | } |
279 | 279 | |
280 | - if (!empty($this->params['dry'])) { |
|
280 | + if ( ! empty($this->params['dry'])) { |
|
281 | 281 | $this->_dry = true; |
282 | 282 | $this->out(__d('cake_console', 'Performing a dry run.')); |
283 | 283 | } |
@@ -287,16 +287,16 @@ discard block |
||
287 | 287 | 'plugin' => $plugin, |
288 | 288 | 'connection' => $this->params['connection'], |
289 | 289 | ); |
290 | - if (!empty($this->params['snapshot'])) { |
|
290 | + if ( ! empty($this->params['snapshot'])) { |
|
291 | 291 | $fileName = rtrim($this->Schema->file, '.php'); |
292 | - $options['file'] = $fileName . '_' . $this->params['snapshot'] . '.php'; |
|
292 | + $options['file'] = $fileName.'_'.$this->params['snapshot'].'.php'; |
|
293 | 293 | } |
294 | 294 | |
295 | 295 | $Schema = $this->Schema->load($options); |
296 | 296 | |
297 | - if (!$Schema) { |
|
297 | + if ( ! $Schema) { |
|
298 | 298 | $this->err(__d('cake_console', 'The chosen schema could not be loaded. Attempted to load:')); |
299 | - $this->err(__d('cake_console', 'File: %s', $this->Schema->path . DS . $this->Schema->file)); |
|
299 | + $this->err(__d('cake_console', 'File: %s', $this->Schema->path.DS.$this->Schema->file)); |
|
300 | 300 | $this->err(__d('cake_console', 'Name: %s', $this->Schema->name)); |
301 | 301 | return $this->_stop(); |
302 | 302 | } |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | |
321 | 321 | $drop = $create = array(); |
322 | 322 | |
323 | - if (!$table) { |
|
323 | + if ( ! $table) { |
|
324 | 324 | foreach ($Schema->tables as $table => $fields) { |
325 | 325 | $drop[$table] = $db->dropSchema($Schema, $table); |
326 | 326 | $create[$table] = $db->createSchema($Schema, $table); |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | return $this->_stop(); |
335 | 335 | } |
336 | 336 | |
337 | - $this->out("\n" . __d('cake_console', 'The following table(s) will be dropped.')); |
|
337 | + $this->out("\n".__d('cake_console', 'The following table(s) will be dropped.')); |
|
338 | 338 | $this->out(array_keys($drop)); |
339 | 339 | |
340 | 340 | if ($this->in(__d('cake_console', 'Are you sure you want to drop the table(s)?'), array('y', 'n'), 'n') === 'y') { |
@@ -342,7 +342,7 @@ discard block |
||
342 | 342 | $this->_run($drop, 'drop', $Schema); |
343 | 343 | } |
344 | 344 | |
345 | - $this->out("\n" . __d('cake_console', 'The following table(s) will be created.')); |
|
345 | + $this->out("\n".__d('cake_console', 'The following table(s) will be created.')); |
|
346 | 346 | $this->out(array_keys($create)); |
347 | 347 | |
348 | 348 | if ($this->in(__d('cake_console', 'Are you sure you want to create the table(s)?'), array('y', 'n'), 'y') === 'y') { |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | return $this->_stop(); |
395 | 395 | } |
396 | 396 | |
397 | - $this->out("\n" . __d('cake_console', 'The following statements will run.')); |
|
397 | + $this->out("\n".__d('cake_console', 'The following statements will run.')); |
|
398 | 398 | $this->out(array_map('trim', $contents)); |
399 | 399 | if ($this->in(__d('cake_console', 'Are you sure you want to alter the tables?'), array('y', 'n'), 'n') === 'y') { |
400 | 400 | $this->out(); |
@@ -429,19 +429,19 @@ discard block |
||
429 | 429 | $this->out(__d('cake_console', 'Dry run for %s :', $table)); |
430 | 430 | $this->out($sql); |
431 | 431 | } else { |
432 | - if (!$Schema->before(array($event => $table))) { |
|
432 | + if ( ! $Schema->before(array($event => $table))) { |
|
433 | 433 | return false; |
434 | 434 | } |
435 | 435 | $error = null; |
436 | 436 | try { |
437 | 437 | $db->execute($sql); |
438 | 438 | } catch (PDOException $e) { |
439 | - $error = $table . ': ' . $e->getMessage(); |
|
439 | + $error = $table.': '.$e->getMessage(); |
|
440 | 440 | } |
441 | 441 | |
442 | 442 | $Schema->after(array($event => $table, 'errors' => $error)); |
443 | 443 | |
444 | - if (!empty($error)) { |
|
444 | + if ( ! empty($error)) { |
|
445 | 445 | $this->err($error); |
446 | 446 | } else { |
447 | 447 | $this->out(__d('cake_console', '%s updated.', $table)); |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | ); |
469 | 469 | $path = array( |
470 | 470 | 'help' => __d('cake_console', 'Path to read and write schema.php'), |
471 | - 'default' => APP . 'Config' . DS . 'Schema' |
|
471 | + 'default' => APP.'Config'.DS.'Schema' |
|
472 | 472 | ); |
473 | 473 | $file = array( |
474 | 474 | 'help' => __d('cake_console', 'File name to read and write.'), |