Completed
Push — master ( e5db64...945d9a )
by Schlaefer
05:09 queued 28s
created
app/webroot/index.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -47,7 +47,7 @@  discard block
 block discarded – undo
47 47
  * Config Directory
48 48
  */
49 49
 if (!defined('CONFIG')) {
50
-	define('CONFIG', ROOT . DS . APP_DIR . DS . 'Config' . DS);
50
+	define('CONFIG', ROOT.DS.APP_DIR.DS.'Config'.DS);
51 51
 }
52 52
 
53 53
 /**
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
  * This auto-detects CakePHP as a composer installed library.
71 71
  * You may remove this if you are not planning to use composer (not recommended, though).
72 72
  */
73
-$vendorPath = ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib';
74
-$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
75
-if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath . DS . $dispatcher)) {
73
+$vendorPath = ROOT.DS.APP_DIR.DS.'Vendor'.DS.'cakephp'.DS.'cakephp'.DS.'lib';
74
+$dispatcher = 'Cake'.DS.'Console'.DS.'ShellDispatcher.php';
75
+if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath.DS.$dispatcher)) {
76 76
 	define('CAKE_CORE_INCLUDE_PATH', $vendorPath);
77 77
 }
78 78
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 	define('WEBROOT_DIR', basename(dirname(__FILE__)));
85 85
 }
86 86
 if (!defined('WWW_ROOT')) {
87
-	define('WWW_ROOT', dirname(__FILE__) . DS);
87
+	define('WWW_ROOT', dirname(__FILE__).DS);
88 88
 }
89 89
 
90 90
 // For the built-in server
91 91
 if (PHP_SAPI === 'cli-server') {
92
-	if ($_SERVER['PHP_SELF'] !== '/' . basename(__FILE__) && file_exists(WWW_ROOT . $_SERVER['PHP_SELF'])) {
92
+	if ($_SERVER['PHP_SELF'] !== '/'.basename(__FILE__) && file_exists(WWW_ROOT.$_SERVER['PHP_SELF'])) {
93 93
 		return false;
94 94
 	}
95
-	$_SERVER['PHP_SELF'] = '/' . basename(__FILE__);
95
+	$_SERVER['PHP_SELF'] = '/'.basename(__FILE__);
96 96
 }
97 97
 
98 98
 if (!defined('CAKE_CORE_INCLUDE_PATH')) {
99 99
 	if (function_exists('ini_set')) {
100
-		ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
100
+		ini_set('include_path', ROOT.DS.'lib'.PATH_SEPARATOR.ini_get('include_path'));
101 101
 	}
102
-	if (!include 'Cake' . DS . 'bootstrap.php') {
102
+	if (!include 'Cake'.DS.'bootstrap.php') {
103 103
 		$failed = true;
104 104
 	}
105
-} elseif (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') {
105
+} elseif (!include CAKE_CORE_INCLUDE_PATH.DS.'Cake'.DS.'bootstrap.php') {
106 106
 	$failed = true;
107 107
 }
108 108
 if (!empty($failed)) {
109
-	trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
109
+	trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/index.php. It should point to the directory containing your ".DS."cake core directory and your ".DS."vendors root directory.", E_USER_ERROR);
110 110
 }
111 111
 
112 112
 App::uses('Dispatcher', 'Routing');
Please login to merge, or discard this patch.
app/webroot/test.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
  * Config Directory
51 51
  */
52 52
 if (!defined('CONFIG')) {
53
-	define('CONFIG', ROOT . DS . APP_DIR . DS . 'Config' . DS);
53
+	define('CONFIG', ROOT.DS.APP_DIR.DS.'Config'.DS);
54 54
 }
55 55
 
56 56
 /**
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
  * This auto-detects CakePHP as a composer installed library.
71 71
  * You may remove this if you are not planning to use composer (not recommended, though).
72 72
  */
73
-$vendorPath = ROOT . DS . APP_DIR . DS . 'Vendor' . DS . 'cakephp' . DS . 'cakephp' . DS . 'lib';
74
-$dispatcher = 'Cake' . DS . 'Console' . DS . 'ShellDispatcher.php';
75
-if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath . DS . $dispatcher)) {
73
+$vendorPath = ROOT.DS.APP_DIR.DS.'Vendor'.DS.'cakephp'.DS.'cakephp'.DS.'lib';
74
+$dispatcher = 'Cake'.DS.'Console'.DS.'ShellDispatcher.php';
75
+if (!defined('CAKE_CORE_INCLUDE_PATH') && file_exists($vendorPath.DS.$dispatcher)) {
76 76
 	define('CAKE_CORE_INCLUDE_PATH', $vendorPath);
77 77
 }
78 78
 
@@ -84,29 +84,29 @@  discard block
 block discarded – undo
84 84
 	define('WEBROOT_DIR', basename(dirname(__FILE__)));
85 85
 }
86 86
 if (!defined('WWW_ROOT')) {
87
-	define('WWW_ROOT', dirname(__FILE__) . DS);
87
+	define('WWW_ROOT', dirname(__FILE__).DS);
88 88
 }
89 89
 
90 90
 if (!defined('CAKE_CORE_INCLUDE_PATH')) {
91 91
 	if (function_exists('ini_set')) {
92
-		ini_set('include_path', ROOT . DS . 'lib' . PATH_SEPARATOR . ini_get('include_path'));
92
+		ini_set('include_path', ROOT.DS.'lib'.PATH_SEPARATOR.ini_get('include_path'));
93 93
 	}
94
-	if (!include 'Cake' . DS . 'bootstrap.php') {
94
+	if (!include 'Cake'.DS.'bootstrap.php') {
95 95
 		$failed = true;
96 96
 	}
97 97
 } else {
98
-	if (!include CAKE_CORE_INCLUDE_PATH . DS . 'Cake' . DS . 'bootstrap.php') {
98
+	if (!include CAKE_CORE_INCLUDE_PATH.DS.'Cake'.DS.'bootstrap.php') {
99 99
 		$failed = true;
100 100
 	}
101 101
 }
102 102
 if (!empty($failed)) {
103
-	trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/test.php. It should point to the directory containing your " . DS . "cake core directory and your " . DS . "vendors root directory.", E_USER_ERROR);
103
+	trigger_error("CakePHP core could not be found. Check the value of CAKE_CORE_INCLUDE_PATH in APP/webroot/test.php. It should point to the directory containing your ".DS."cake core directory and your ".DS."vendors root directory.", E_USER_ERROR);
104 104
 }
105 105
 
106 106
 if (Configure::read('debug') < 1) {
107 107
 	throw new NotFoundException(__d('cake_dev', 'Debug setting does not allow access to this URL.'));
108 108
 }
109 109
 
110
-require_once CAKE . 'TestSuite' . DS . 'CakeTestSuiteDispatcher.php';
110
+require_once CAKE.'TestSuite'.DS.'CakeTestSuiteDispatcher.php';
111 111
 
112 112
 CakeTestSuiteDispatcher::run();
Please login to merge, or discard this patch.
app/Plugin/FileUpload/Model/Behavior/FileUploadBehavior.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
   /**
38 38
     * Setup the behavior
39 39
     */
40
-  function setUp(Model $Model, $options = array()){
40
+  function setUp(Model $Model, $options = array()) {
41 41
     $FileUploadSettings = new FileUploadSettings;
42
-    if(!is_array($options)){
42
+    if (!is_array($options)) {
43 43
       $options = array();
44 44
     }
45 45
     $this->options = array_merge($FileUploadSettings->defaults, $options);
@@ -55,13 +55,13 @@  discard block
 block discarded – undo
55 55
     *
56 56
     */
57 57
 	public function beforeSave(Model $Model, $options = array()) {
58
-    if(isset($Model->data[$Model->alias][$this->options['fileVar']])){
58
+    if (isset($Model->data[$Model->alias][$this->options['fileVar']])) {
59 59
       $file = $Model->data[$Model->alias][$this->options['fileVar']];
60 60
       $this->Uploader->file = $file;
61 61
 
62
-      if($this->Uploader->hasUpload()){
62
+      if ($this->Uploader->hasUpload()) {
63 63
         $fileName = $this->Uploader->processFile();
64
-        if($fileName){
64
+        if ($fileName) {
65 65
           $Model->data[$Model->alias][$this->options['fields']['name']] = $fileName;
66 66
           $Model->data[$Model->alias][$this->options['fields']['size']] = $file['size'];
67 67
           $Model->data[$Model->alias][$this->options['fields']['type']] = $file['type'];
@@ -82,11 +82,11 @@  discard block
 block discarded – undo
82 82
     * presents the user the errors.
83 83
     */
84 84
 	public function beforeValidate(Model $Model, $options = array()) {
85
-    if(isset($Model->data[$Model->alias][$this->options['fileVar']])){
85
+    if (isset($Model->data[$Model->alias][$this->options['fileVar']])) {
86 86
       $file = $Model->data[$Model->alias][$this->options['fileVar']];
87 87
       $this->Uploader->file = $file;
88
-      if($this->Uploader->hasUpload()){
89
-        if($this->Uploader->checkFile() && $this->Uploader->checkType() && $this->Uploader->checkSize()){
88
+      if ($this->Uploader->hasUpload()) {
89
+        if ($this->Uploader->checkFile() && $this->Uploader->checkType() && $this->Uploader->checkSize()) {
90 90
           $Model->beforeValidate();
91 91
         }
92 92
         else {
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         }
95 95
       }
96 96
     }
97
-    elseif(isset($this->options['required']) && $this->options['required']){
97
+    elseif (isset($this->options['required']) && $this->options['required']) {
98 98
       $Model->validationErrors[$this->options['fileVar']] = 'No File';
99 99
     }
100 100
     return $Model->beforeValidate();
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
   /**
104 104
     * Automatically remove the uploaded file.
105 105
     */
106
-  function beforeDelete(Model $Model, $cascade = true){
106
+  function beforeDelete(Model $Model, $cascade = true) {
107 107
     $Model->recursive = -1;
108 108
     $data = $Model->read();
109 109
 
Please login to merge, or discard this patch.
app/Plugin/FileUpload/Vendor/uploader.php 1 patch
Spacing   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
     */
56 56
   var $finalFile = null;
57 57
 
58
-  function __construct($options = array()){
58
+  function __construct($options = array()) {
59 59
     $this->options = array_merge($this->options, $options);
60 60
   }
61 61
 
@@ -66,25 +66,25 @@  discard block
 block discarded – undo
66 66
     * @return string of resulting filename
67 67
     * @access private
68 68
     */
69
-  function __handleFileNameCallback($fileName){
70
-    if($this->options['fileNameFunction']){
71
-      if($this->options['fileModel']){
69
+  function __handleFileNameCallback($fileName) {
70
+    if ($this->options['fileNameFunction']) {
71
+      if ($this->options['fileModel']) {
72 72
         $Model = ClassRegistry::init($this->options['fileModel']);
73
-        if(method_exists($Model, $this->options['fileNameFunction'])){
73
+        if (method_exists($Model, $this->options['fileNameFunction'])) {
74 74
           $fileName = $Model->{$this->options['fileNameFunction']}($fileName);
75 75
         }
76
-        elseif(function_exists($this->options['fileNameFunction'])){
76
+        elseif (function_exists($this->options['fileNameFunction'])) {
77 77
           $fileName = call_user_func($this->options['fileNameFunction'], $fileName);
78 78
         }
79 79
       }
80 80
       else {
81
-        if(function_exists($this->options['fileNameFunction'])){
81
+        if (function_exists($this->options['fileNameFunction'])) {
82 82
           $fileName = call_user_func($this->options['fileNameFunction'], $fileName);
83 83
         }
84 84
       }
85 85
 
86
-      if(!$fileName){
87
-        $this->_error('No filename resulting after parsing. Function: ' . $this->options['fileNameFunction']);
86
+      if (!$fileName) {
87
+        $this->_error('No filename resulting after parsing. Function: '.$this->options['fileNameFunction']);
88 88
       }
89 89
     }
90 90
     return $fileName;
@@ -97,12 +97,12 @@  discard block
 block discarded – undo
97 97
     * @return string of resulting target_path
98 98
     * @access private
99 99
     */
100
-  function __handleUnique($target_path){
101
-    if($this->options['unique']){
100
+  function __handleUnique($target_path) {
101
+    if ($this->options['unique']) {
102 102
       $temp_path = substr($target_path, 0, strlen($target_path) - strlen($this->_ext())); //temp path without the ext
103
-      $i=1;
104
-      while(file_exists($target_path)){
105
-        $target_path = $temp_path . "-" . $i . $this->_ext();
103
+      $i = 1;
104
+      while (file_exists($target_path)) {
105
+        $target_path = $temp_path."-".$i.$this->_ext();
106 106
         $i++;
107 107
       }
108 108
 		}
@@ -118,11 +118,11 @@  discard block
 block discarded – undo
118 118
     * @return String | false String of finalFile name saved to the file system or false if unable to save to file system.
119 119
     * @access public
120 120
     */
121
-  function processFile($file = null){
121
+  function processFile($file = null) {
122 122
     $this->setFile($file);
123 123
 
124 124
     //check if we have a file and if we allow the type, return false otherwise.
125
-    if(!$this->checkFile() || !$this->checkType() || !$this->checkSize()){
125
+    if (!$this->checkFile() || !$this->checkType() || !$this->checkSize()) {
126 126
       return false;
127 127
     }
128 128
 
@@ -130,18 +130,18 @@  discard block
 block discarded – undo
130 130
     $up_dir = $this->options['uploadDir'];
131 131
     $fileName = $this->__handleFileNameCallback($this->file['name']);
132 132
     //if callback returns false hault the upload
133
-    if(!$fileName){
133
+    if (!$fileName) {
134 134
       return false;
135 135
     }
136
-    $target_path = $up_dir . DS . $fileName;
136
+    $target_path = $up_dir.DS.$fileName;
137 137
     $target_path = $this->__handleUnique($target_path);
138 138
 
139 139
     //now move the file.
140
-    if(move_uploaded_file($this->file['tmp_name'], $target_path)){
140
+    if (move_uploaded_file($this->file['tmp_name'], $target_path)) {
141 141
       $this->finalFile = basename($target_path);
142 142
       return $this->finalFile;
143 143
     }
144
-    else{
144
+    else {
145 145
       $this->_error('Unable to save temp file to file system.');
146 146
       return false;
147 147
     }
@@ -153,8 +153,8 @@  discard block
 block discarded – undo
153 153
     * @param file array of uploaded file. (optional)
154 154
     * @return void
155 155
     */
156
-  function setFile($file = null){
157
-    if($file) $this->file = $file;
156
+  function setFile($file = null) {
157
+    if ($file) $this->file = $file;
158 158
   }
159 159
 
160 160
   /**
@@ -164,9 +164,9 @@  discard block
 block discarded – undo
164 164
     * @param file array of uploaded file (optional)
165 165
     * @access protected
166 166
     */
167
-  function _ext($file = null){
167
+  function _ext($file = null) {
168 168
     $this->setFile($file);
169
-    return strrchr($this->file['name'],".");
169
+    return strrchr($this->file['name'], ".");
170 170
   }
171 171
 
172 172
   /**
@@ -176,7 +176,7 @@  discard block
 block discarded – undo
176 176
   * @return void
177 177
   * @access protected
178 178
   */
179
-  function _error($text){
179
+  function _error($text) {
180 180
     $this->errors[] = __($text);
181 181
   }
182 182
 
@@ -187,20 +187,20 @@  discard block
 block discarded – undo
187 187
   * @param file array of uploaded file (optional)
188 188
   * @access public
189 189
   */
190
-  function checkType($file = null){
190
+  function checkType($file = null) {
191 191
     $this->setFile($file);
192
-    foreach($this->options['allowedTypes'] as $ext => $types){
193
-      if(!is_string($ext)){
192
+    foreach ($this->options['allowedTypes'] as $ext => $types) {
193
+      if (!is_string($ext)) {
194 194
         $ext = $types;
195 195
       }
196
-      if($ext == '*'){
196
+      if ($ext == '*') {
197 197
         return true;
198 198
       }
199 199
 
200
-      $ext = strtolower('.' . str_replace('.','', $ext));
200
+      $ext = strtolower('.'.str_replace('.', '', $ext));
201 201
       $file_ext = strtolower($this->_ext());
202
-      if($file_ext == $ext){
203
-        if(is_array($types) && !in_array($this->file['type'], $types)){
202
+      if ($file_ext == $ext) {
203
+        if (is_array($types) && !in_array($this->file['type'], $types)) {
204 204
           $this->_error("{$this->file['type']} is not an allowed type.");
205 205
           return false;
206 206
         }
@@ -221,10 +221,10 @@  discard block
 block discarded – undo
221 221
     * @access public
222 222
     * @param file array of uploaded file (optional)
223 223
     */
224
-  function checkFile($file = null){
224
+  function checkFile($file = null) {
225 225
     $this->setFile($file);
226
-    if($this->hasUpload() && $this->file){
227
-      if(isset($this->file['error']) && $this->file['error'] == UPLOAD_ERR_OK ) {
226
+    if ($this->hasUpload() && $this->file) {
227
+      if (isset($this->file['error']) && $this->file['error'] == UPLOAD_ERR_OK) {
228 228
         return true;
229 229
       }
230 230
       else {
@@ -241,13 +241,13 @@  discard block
 block discarded – undo
241 241
     * @access public
242 242
     * @param file array of uploaded file (optional)
243 243
     */
244
-  function checkSize($file = null){
244
+  function checkSize($file = null) {
245 245
     $this->setFile($file);
246
-    if($this->hasUpload() && $this->file){
247
-      if(!$this->options['maxFileSize']){ //We don't want to test maxFileSize
246
+    if ($this->hasUpload() && $this->file) {
247
+      if (!$this->options['maxFileSize']) { //We don't want to test maxFileSize
248 248
         return true;
249 249
       }
250
-      elseif($this->options['maxFileSize'] && $this->file['size'] < $this->options['maxFileSize']){
250
+      elseif ($this->options['maxFileSize'] && $this->file['size'] < $this->options['maxFileSize']) {
251 251
         return true;
252 252
       }
253 253
       else {
@@ -265,16 +265,16 @@  discard block
 block discarded – undo
265 265
     * @return boolean
266 266
     * @access public
267 267
     */
268
-  function removeFile($name = null){
269
-    if(!$name || strpos($name, '://')){
268
+  function removeFile($name = null) {
269
+    if (!$name || strpos($name, '://')) {
270 270
       return false;
271 271
     }
272 272
 
273 273
     $up_dir = $this->options['uploadDir'];
274
-    $target_path = $up_dir . DS . $name;
274
+    $target_path = $up_dir.DS.$name;
275 275
 
276 276
     //delete main image -- $name
277
-    if(@unlink($target_path)){
277
+    if (@unlink($target_path)) {
278 278
       return true;
279 279
     } else {
280 280
       return false;
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
     * @return boolean true | false depending if a file was actually uploaded.
288 288
     * @param file array of uploaded file (optional)
289 289
     */
290
-  function hasUpload($file = null){
290
+  function hasUpload($file = null) {
291 291
     $this->setFile($file);
292 292
     return ($this->_multiArrayKeyExists("tmp_name", $this->file));
293 293
   }
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
   /**
296 296
     * @return boolean true if errors were detected.
297 297
     */
298
-  function hasErrors(){
298
+  function hasErrors() {
299 299
     return count($this->errors);
300 300
   }
301 301
 
@@ -308,9 +308,9 @@  discard block
 block discarded – undo
308 308
     * @return string
309 309
     * @access public
310 310
     */
311
-  function showErrors($sep = " "){
311
+  function showErrors($sep = " ") {
312 312
     $retval = "";
313
-    foreach($this->errors as $error){
313
+    foreach ($this->errors as $error) {
314 314
       $retval .= "$error $sep";
315 315
     }
316 316
     return $retval;
@@ -325,13 +325,13 @@  discard block
 block discarded – undo
325 325
     * @access protected
326 326
     */
327 327
   function _multiArrayKeyExists($needle, $haystack) {
328
-    if(is_array($haystack)){
328
+    if (is_array($haystack)) {
329 329
       foreach ($haystack as $key=>$value) {
330
-        if ($needle===$key && $value) {
330
+        if ($needle === $key && $value) {
331 331
           return true;
332 332
         }
333 333
         if (is_array($value)) {
334
-          if($this->_multiArrayKeyExists($needle, $value)){
334
+          if ($this->_multiArrayKeyExists($needle, $value)) {
335 335
             return true;
336 336
           }
337 337
         }
Please login to merge, or discard this patch.
app/Plugin/FileUpload/View/Helper/FileUploadHelper.php 1 patch
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
   *
21 21
   */
22 22
 App::import('Config', 'FileUpload.file_upload_settings');
23
-class FileUploadHelper extends AppHelper{
23
+class FileUploadHelper extends AppHelper {
24 24
   var $helpers = array('Html', 'Form');
25 25
 
26 26
   /**
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     * Constructor, initiallizes the FileUpload Component
65 65
     * and sets the default options.
66 66
     */
67
-  function __construct(View $View, $settings = array()){
67
+  function __construct(View $View, $settings = array()) {
68 68
 		parent::__construct($View, $settings);
69 69
     $this->FileUploadSettings = new FileUploadSettings;
70 70
 
@@ -77,7 +77,7 @@  discard block
 block discarded – undo
77 77
     * @access public
78 78
     * @return void
79 79
     */
80
-  function reset(){
80
+  function reset() {
81 81
     $this->fileName = null;
82 82
     $this->options = array(
83 83
       'width' => 0,
@@ -101,10 +101,10 @@  discard block
 block discarded – undo
101 101
     * @access public
102 102
     * @return mixed html tag, url string, or false if unable to find image.
103 103
     */
104
-  function image($name, $options = array()){
104
+  function image($name, $options = array()) {
105 105
     $this->fileName = $name;
106 106
     //options takes in a width as well
107
-    if(is_int($options)){
107
+    if (is_int($options)) {
108 108
       $width = $options;
109 109
       $options = array();
110 110
       $options['width'] = $width;
@@ -113,14 +113,14 @@  discard block
 block discarded – undo
113 113
     $this->settings = array_merge($this->settings, $options);
114 114
 
115 115
     $img = false;
116
-    if(is_string($name)){
116
+    if (is_string($name)) {
117 117
       $img = $this->_getImageByName();
118 118
     }
119
-    elseif(is_int($name)){
119
+    elseif (is_int($name)) {
120 120
       $img = $this->_getImageById();
121 121
     }
122 122
 
123
-    if($img){
123
+    if ($img) {
124 124
       return $img;
125 125
     }
126 126
 
@@ -135,13 +135,13 @@  discard block
 block discarded – undo
135 135
     * @return String HTML form input element configured for the FileUploadComponent
136 136
     * @access public
137 137
     */
138
-  function input($options = array()){
138
+  function input($options = array()) {
139 139
     $options = array_merge(
140
-      array('var' => $this->settings['fileVar'],'model' => $this->settings['fileModel']),
140
+      array('var' => $this->settings['fileVar'], 'model' => $this->settings['fileModel']),
141 141
       $options
142 142
     );
143 143
     $configs = $options;
144
-    if($configs['model']){
144
+    if ($configs['model']) {
145 145
       unset($options['model'], $options['var']);
146 146
 
147 147
       return $this->Form->input("{$configs['model']}.".$this->inputCount++.".{$configs['var']}", array_merge(array('type'=>'file'), $options));
@@ -154,20 +154,20 @@  discard block
 block discarded – undo
154 154
   /**
155 155
     * @access protected
156 156
     */
157
-  function _getImageById(){
157
+  function _getImageById() {
158 158
     App::import('Component', 'FileUpload.FileUpload');
159 159
     $this->FileUpload = new FileUploadComponent;
160 160
 
161 161
     $id = $this->fileName;
162 162
     $this->FileUpload->options['fileModel'] = $this->settings['fileModel'];
163
-    $Model =& $this->FileUpload->getModel();
163
+    $Model = & $this->FileUpload->getModel();
164 164
     $Model->recursive = -1;
165 165
     $upload = $Model->findById($id);
166
-    if(!empty($upload)){
166
+    if (!empty($upload)) {
167 167
       $this->fileName = $upload[$this->settings['fileModel']][$this->settings['fields']['name']];
168 168
       return $this->_getImageByName();
169 169
     }
170
-    else{
170
+    else {
171 171
       return false;
172 172
     }
173 173
   }
@@ -177,12 +177,12 @@  discard block
 block discarded – undo
177 177
     * @access protected
178 178
     * @return String full path of the file name
179 179
     */
180
-  function _getFullPath(){
181
-    if($this->_isOutsideSource()){
180
+  function _getFullPath() {
181
+    if ($this->_isOutsideSource()) {
182 182
       return $this->fileName;
183 183
     }
184 184
     else {
185
-      return WWW_ROOT . $this->_getUploadPath();
185
+      return WWW_ROOT.$this->_getUploadPath();
186 186
     }
187 187
   }
188 188
 
@@ -191,12 +191,12 @@  discard block
 block discarded – undo
191 191
     * @access protected
192 192
     * @return String full path of the file name
193 193
     */
194
-  function _getImagePath(){
195
-    if($this->_isOutsideSource()){
194
+  function _getImagePath() {
195
+    if ($this->_isOutsideSource()) {
196 196
       return $this->fileName;
197 197
     }
198 198
     else {
199
-      return '/' . $this->_getUploadPath();
199
+      return '/'.$this->_getUploadPath();
200 200
     }
201 201
   }
202 202
 
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
     * @access protected
206 206
     * @return String upload path of all files
207 207
     */
208
-  function _getUploadPath(){
209
-    return $this->settings['uploadDir'] . '/' . $this->fileName;
208
+  function _getUploadPath() {
209
+    return $this->settings['uploadDir'].'/'.$this->fileName;
210 210
   }
211 211
 
212 212
   /**
@@ -214,8 +214,8 @@  discard block
 block discarded – undo
214 214
     * @access protected
215 215
     * @return String extension of filename
216 216
     */
217
-  function _getExt(){
218
-    return strrchr($this->fileName,".");
217
+  function _getExt() {
218
+    return strrchr($this->fileName, ".");
219 219
   }
220 220
 
221 221
   /**
@@ -225,12 +225,12 @@  discard block
 block discarded – undo
225 225
     * if not, make it, save it, and return it.
226 226
     * @return String HTML of resized or full image.
227 227
     */
228
-  function _getImageByName(){
228
+  function _getImageByName() {
229 229
     //only proceed if we actually have the file in question
230
-    if(!$this->_isOutsideSource() && !file_exists($this->_getFullPath())) return false;
230
+    if (!$this->_isOutsideSource() && !file_exists($this->_getFullPath())) return false;
231 231
 
232 232
     //resize if we have resize on, a width, and if it doesn't already exist.
233
-    if($this->options['autoResize'] && $this->options['width'] > 0 && !file_exists($this->_getResizeNameOrPath($this->_getFullPath()))){
233
+    if ($this->options['autoResize'] && $this->options['width'] > 0 && !file_exists($this->_getResizeNameOrPath($this->_getFullPath()))) {
234 234
       $this->_resizeImage();
235 235
     }
236 236
     return $this->_htmlImage();
@@ -240,11 +240,11 @@  discard block
 block discarded – undo
240 240
     * @return String of the resizedpath of a filename or path.
241 241
     * @access protected
242 242
     */
243
-  function _getResizeNameOrPath($file_name_or_path){
243
+  function _getResizeNameOrPath($file_name_or_path) {
244 244
     $file_name = basename($file_name_or_path);
245 245
     $path = substr($file_name_or_path, 0, strlen($file_name_or_path) - strlen($file_name));
246
-    $temp_path = substr($file_name,0,strlen($file_name) - strlen($this->_getExt())) . "x" . $this->options['width'] . $this->_getExt();
247
-    $full_path = (strlen($this->options['resizedDir']) > 0) ? $path . $this->options['resizedDir'] . '/' . $temp_path : $path . $temp_path;
246
+    $temp_path = substr($file_name, 0, strlen($file_name) - strlen($this->_getExt()))."x".$this->options['width'].$this->_getExt();
247
+    $full_path = (strlen($this->options['resizedDir']) > 0) ? $path.$this->options['resizedDir'].'/'.$temp_path : $path.$temp_path;
248 248
     return $full_path;
249 249
   }
250 250
 
@@ -253,9 +253,9 @@  discard block
 block discarded – undo
253 253
     * @access protected
254 254
     * @return null
255 255
     */
256
-  function _resizeImage(){
256
+  function _resizeImage() {
257 257
     $this->newImage = new RResizeImage($this->_getFullPath());
258
-    if($this->newImage->imgWidth > $this->options['width']){
258
+    if ($this->newImage->imgWidth > $this->options['width']) {
259 259
       $this->newImage->resize_limitwh($this->options['width'], 0, $this->_getResizeNameOrPath($this->_getFullPath()));
260 260
     }
261 261
     else {
@@ -268,9 +268,9 @@  discard block
 block discarded – undo
268 268
     * @access protected
269 269
     * @return String HTML image asked for
270 270
     */
271
-  function _htmlImage(){
272
-    if(!$this->_isOutsideSource() && $this->options['autoResize'] && $this->options['width'] > 0){
273
-      if(isset($this->newImage) && $this->newImage->imgWidth && $this->newImage->imgWidth <= $this->options['width']){
271
+  function _htmlImage() {
272
+    if (!$this->_isOutsideSource() && $this->options['autoResize'] && $this->options['width'] > 0) {
273
+      if (isset($this->newImage) && $this->newImage->imgWidth && $this->newImage->imgWidth <= $this->options['width']) {
274 274
         $image = $this->_getImagePath();
275 275
       }
276 276
       else {
@@ -285,10 +285,10 @@  discard block
 block discarded – undo
285 285
     //unset the default options
286 286
     unset($options['resizedDir'], $options['uploadDir'], $options['imagePathOnly'], $options['autoResize'], $options['resizeThumbOnly']);
287 287
     //unset width only if we're not an outsourced image, we have resize turned on, or we don't have a width to begin with.
288
-    if(!$this->_isOutsideSource() && ($this->options['resizeThumbOnly'] || !$options['width'])) unset($options['width']);
288
+    if (!$this->_isOutsideSource() && ($this->options['resizeThumbOnly'] || !$options['width'])) unset($options['width']);
289 289
 
290 290
     //return the impage path or image html
291
-    if($this->options['imagePathOnly']){
291
+    if ($this->options['imagePathOnly']) {
292 292
       return $image;
293 293
     }
294 294
     else {
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
   /**
300 300
     * _isOutsideSource searches the fileName string for :// to determine if the image source is inside or outside our server
301 301
     */
302
-  function _isOutsideSource(){
302
+  function _isOutsideSource() {
303 303
     return !!strpos($this->fileName, '://');
304 304
   }
305 305
 }
@@ -315,15 +315,15 @@  discard block
 block discarded – undo
315 315
 	 *
316 316
 	 */
317 317
 	//define("HAR_AUTO_NAME",1);
318
-	Class RResizeImage	{
319
-		var $imgFile="";
320
-		var $imgWidth=0;
321
-		var $imgHeight=0;
322
-		var $imgType="";
323
-		var $imgAttr="";
324
-		var $type=NULL;
325
-		var $_img=NULL;
326
-		var $_error="";
318
+	Class RResizeImage {
319
+		var $imgFile = "";
320
+		var $imgWidth = 0;
321
+		var $imgHeight = 0;
322
+		var $imgType = "";
323
+		var $imgAttr = "";
324
+		var $type = NULL;
325
+		var $_img = NULL;
326
+		var $_error = "";
327 327
 
328 328
 		/**
329 329
 		 * Constructor
@@ -331,14 +331,14 @@  discard block
 block discarded – undo
331 331
 		 * @param [String $imgFile] Image File Name
332 332
 		 * @return RESIZEIMAGE (Class Object)
333 333
 		 */
334
-		function __construct($imgFile=""){
335
-			if (!function_exists("imagecreate")){
336
-				$this->_error="Error: GD Library is not available.";
334
+		function __construct($imgFile = "") {
335
+			if (!function_exists("imagecreate")) {
336
+				$this->_error = "Error: GD Library is not available.";
337 337
 				return false;
338 338
 			}
339 339
 
340
-			$this->type=Array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM');
341
-			if(!empty($imgFile)){
340
+			$this->type = Array(1 => 'GIF', 2 => 'JPG', 3 => 'PNG', 4 => 'SWF', 5 => 'PSD', 6 => 'BMP', 7 => 'TIFF', 8 => 'TIFF', 9 => 'JPC', 10 => 'JP2', 11 => 'JPX', 12 => 'JB2', 13 => 'SWC', 14 => 'IFF', 15 => 'WBMP', 16 => 'XBM');
341
+			if (!empty($imgFile)) {
342 342
 				$this->setImage($imgFile);
343 343
       }
344 344
 		}
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 		 *
349 349
 		 * @return String
350 350
 		 */
351
-		function error(){
351
+		function error() {
352 352
 			return $this->_error;
353 353
 		}
354 354
 
@@ -358,15 +358,15 @@  discard block
 block discarded – undo
358 358
 		 * @param String $imgFile
359 359
 		 * @return void
360 360
 		 */
361
-		function setImage($imgFile){
362
-			$this->imgFile=$imgFile;
361
+		function setImage($imgFile) {
362
+			$this->imgFile = $imgFile;
363 363
 			return $this->_createImage();
364 364
 		}
365 365
 
366 366
     /**
367 367
 		 * @return void
368 368
 		 */
369
-		function close(){
369
+		function close() {
370 370
 			return @imagedestroy($this->_img);
371 371
 		}
372 372
 
@@ -377,18 +377,18 @@  discard block
 block discarded – undo
377 377
 		 * @param Numnber $imgheight
378 378
 		 * @param String $newfile
379 379
 		 */
380
-		function resize_limitwh($imgwidth,$imgheight,$newfile=NULL){
380
+		function resize_limitwh($imgwidth, $imgheight, $newfile = NULL) {
381 381
 			$image_per = 100;
382 382
 			list($width, $height, $type, $attr) = @getimagesize($this->imgFile);
383
-			if($width > $imgwidth && $imgwidth > 0){
384
-				$image_per = (double)(($imgwidth * 100) / $width);
383
+			if ($width > $imgwidth && $imgwidth > 0) {
384
+				$image_per = (double) (($imgwidth * 100) / $width);
385 385
       }
386 386
 
387
-			if(floor(($height * $image_per)/100)>$imgheight && $imgheight > 0){
388
-				$image_per = (double)(($imgheight * 100) / $height);
387
+			if (floor(($height * $image_per) / 100) > $imgheight && $imgheight > 0) {
388
+				$image_per = (double) (($imgheight * 100) / $height);
389 389
       }
390 390
 
391
-			$this->resize_percentage($image_per,$newfile);
391
+			$this->resize_percentage($image_per, $newfile);
392 392
 		}
393 393
 
394 394
     /**
@@ -398,10 +398,10 @@  discard block
 block discarded – undo
398 398
 		 * @param String $newfile
399 399
 		 * @return Boolean
400 400
 		 */
401
-		function resize_percentage($percent=100,$newfile=NULL)	{
402
-			$newWidth=($this->imgWidth*$percent)/100;
403
-			$newHeight=($this->imgHeight*$percent)/100;
404
-			return $this->resize($newWidth,$newHeight,$newfile);
401
+		function resize_percentage($percent = 100, $newfile = NULL) {
402
+			$newWidth = ($this->imgWidth * $percent) / 100;
403
+			$newHeight = ($this->imgHeight * $percent) / 100;
404
+			return $this->resize($newWidth, $newHeight, $newfile);
405 405
 		}
406 406
 
407 407
     /**
@@ -412,10 +412,10 @@  discard block
 block discarded – undo
412 412
 		 * @param String $newfile
413 413
 		 * @return Boolean
414 414
 		 */
415
-		function resize_xypercentage($xpercent=100,$ypercent=100,$newfile=NULL)		{
416
-			$newWidth=($this->imgWidth*$xpercent)/100;
417
-			$newHeight=($this->imgHeight*$ypercent)/100;
418
-			return $this->resize($newWidth,$newHeight,$newfile);
415
+		function resize_xypercentage($xpercent = 100, $ypercent = 100, $newfile = NULL) {
416
+			$newWidth = ($this->imgWidth * $xpercent) / 100;
417
+			$newHeight = ($this->imgHeight * $ypercent) / 100;
418
+			return $this->resize($newWidth, $newHeight, $newfile);
419 419
 		}
420 420
 
421 421
 		/**
@@ -426,19 +426,19 @@  discard block
 block discarded – undo
426 426
 		 * @param String $newfile
427 427
 		 * @return Boolean
428 428
 		 */
429
-		function resize($width,$height,$newfile=NULL){
430
-			if(empty($this->imgFile)){
431
-				$this->_error="File name is not initialised.";
429
+		function resize($width, $height, $newfile = NULL) {
430
+			if (empty($this->imgFile)) {
431
+				$this->_error = "File name is not initialised.";
432 432
 				return false;
433 433
 			}
434
-			if($this->imgWidth<=0 || $this->imgHeight<=0){
435
-				$this->_error="Could not resize given image";
434
+			if ($this->imgWidth <= 0 || $this->imgHeight <= 0) {
435
+				$this->_error = "Could not resize given image";
436 436
 				return false;
437 437
 			}
438
-			if($width<=0)	$width=$this->imgWidth;
439
-			if($height<=0) $height=$this->imgHeight;
438
+			if ($width <= 0)	$width = $this->imgWidth;
439
+			if ($height <= 0) $height = $this->imgHeight;
440 440
 
441
-			return $this->_resize($width,$height,$newfile);
441
+			return $this->_resize($width, $height, $newfile);
442 442
 		}
443 443
 
444 444
 		/**
@@ -448,8 +448,8 @@  discard block
 block discarded – undo
448 448
 		 */
449 449
 		function _getImageInfo()
450 450
 		{
451
-			@list($this->imgWidth,$this->imgHeight,$type,$this->imgAttr)=@getimagesize($this->imgFile);
452
-			$this->imgType=$this->type[$type];
451
+			@list($this->imgWidth, $this->imgHeight, $type, $this->imgAttr) = @getimagesize($this->imgFile);
452
+			$this->imgType = $this->type[$type];
453 453
 		}
454 454
 
455 455
 		/**
@@ -457,20 +457,20 @@  discard block
 block discarded – undo
457 457
 		 * @access Private
458 458
 		 * @return Boolean
459 459
 		 */
460
-		function _createImage(){
460
+		function _createImage() {
461 461
 			$this->_getImageInfo();
462
-			if($this->imgType=='GIF'){
463
-				$this->_img=@imagecreatefromgif($this->imgFile);
462
+			if ($this->imgType == 'GIF') {
463
+				$this->_img = @imagecreatefromgif($this->imgFile);
464 464
 			}
465
-			elseif($this->imgType=='JPG'){
466
-				$this->_img=@imagecreatefromjpeg($this->imgFile);
465
+			elseif ($this->imgType == 'JPG') {
466
+				$this->_img = @imagecreatefromjpeg($this->imgFile);
467 467
 			}
468
-			elseif($this->imgType=='PNG'){
469
-				$this->_img=@imagecreatefrompng($this->imgFile);
468
+			elseif ($this->imgType == 'PNG') {
469
+				$this->_img = @imagecreatefrompng($this->imgFile);
470 470
 			}
471 471
 
472
-			if(!$this->_img || !@is_resource($this->_img)){
473
-				$this->_error="Error loading ".$this->imgFile;
472
+			if (!$this->_img || !@is_resource($this->_img)) {
473
+				$this->_error = "Error loading ".$this->imgFile;
474 474
 				return false;
475 475
 			}
476 476
 			return true;
@@ -485,64 +485,64 @@  discard block
 block discarded – undo
485 485
 		 * @param String $newfile
486 486
 		 * @return Boolean
487 487
 		 */
488
-		function _resize($width,$height,$newfile=NULL){
489
-			if (!function_exists("imagecreate")){
490
-				$this->_error="Error: GD Library is not available.";
488
+		function _resize($width, $height, $newfile = NULL) {
489
+			if (!function_exists("imagecreate")) {
490
+				$this->_error = "Error: GD Library is not available.";
491 491
 				return false;
492 492
 			}
493 493
 
494
-			$newimg=@imagecreatetruecolor($width,$height);
494
+			$newimg = @imagecreatetruecolor($width, $height);
495 495
 			//imagecolortransparent( $newimg, imagecolorat( $newimg, 0, 0 ) );
496 496
 
497
-			if($this->imgType=='GIF' || $this->imgType=='PNG')	{
497
+			if ($this->imgType == 'GIF' || $this->imgType == 'PNG') {
498 498
 				/** Code to keep transparency of image **/
499 499
 				$colorcount = imagecolorstotal($this->_img);
500 500
 				if ($colorcount == 0) $colorcount = 256;
501
-				imagetruecolortopalette($newimg,true,$colorcount);
502
-				imagepalettecopy($newimg,$this->_img);
501
+				imagetruecolortopalette($newimg, true, $colorcount);
502
+				imagepalettecopy($newimg, $this->_img);
503 503
 				$transparentcolor = imagecolortransparent($this->_img);
504
-				imagefill($newimg,0,0,$transparentcolor);
505
-				imagecolortransparent($newimg,$transparentcolor);
504
+				imagefill($newimg, 0, 0, $transparentcolor);
505
+				imagecolortransparent($newimg, $transparentcolor);
506 506
 			}
507 507
 
508
-			@imagecopyresampled ( $newimg, $this->_img, 0,0,0,0, $width, $height, $this->imgWidth,$this->imgHeight);
508
+			@imagecopyresampled($newimg, $this->_img, 0, 0, 0, 0, $width, $height, $this->imgWidth, $this->imgHeight);
509 509
 
510
-			if($newfile===1)	{
511
-				if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches)){
512
-			   		$newfile=@substr_replace($this->imgFile,"_har",-@strlen($matches[0]),0);
510
+			if ($newfile === 1) {
511
+				if (@preg_match("/\..*+$/", @basename($this->imgFile), $matches)) {
512
+			   		$newfile = @substr_replace($this->imgFile, "_har", -@strlen($matches[0]), 0);
513 513
         }
514 514
 			}
515
-			elseif(!empty($newfile)){
516
-				if(!@preg_match("/\..*+$/",@basename($newfile))){
517
-					if(@preg_match("/\..*+$/",@basename($this->imgFile),$matches)){
518
-					   $newfile=$newfile.$matches[0];
515
+			elseif (!empty($newfile)) {
516
+				if (!@preg_match("/\..*+$/", @basename($newfile))) {
517
+					if (@preg_match("/\..*+$/", @basename($this->imgFile), $matches)) {
518
+					   $newfile = $newfile.$matches[0];
519 519
           }
520 520
 				}
521 521
 			}
522 522
 
523
-			if($this->imgType=='GIF'){
524
-				if(!empty($newfile)){
525
-          @imagegif($newimg,$newfile);
523
+			if ($this->imgType == 'GIF') {
524
+				if (!empty($newfile)) {
525
+          @imagegif($newimg, $newfile);
526 526
         }
527 527
 				else {
528 528
 					@header("Content-type: image/gif");
529 529
 					@imagegif($newimg);
530 530
 				}
531 531
 			}
532
-			elseif($this->imgType=='JPG'){
533
-				if(!empty($newfile)){
534
-					@imagejpeg($newimg,$newfile);
532
+			elseif ($this->imgType == 'JPG') {
533
+				if (!empty($newfile)) {
534
+					@imagejpeg($newimg, $newfile);
535 535
         }
536
-				else	{
536
+				else {
537 537
 					@header("Content-type: image/jpeg");
538 538
 					@imagejpeg($newimg);
539 539
 				}
540 540
 			}
541
-			elseif($this->imgType=='PNG'){
542
-				if(!empty($newfile)){
543
-					@imagepng($newimg,$newfile);
541
+			elseif ($this->imgType == 'PNG') {
542
+				if (!empty($newfile)) {
543
+					@imagepng($newimg, $newfile);
544 544
         }
545
-				else{
545
+				else {
546 546
 					@header("Content-type: image/png");
547 547
 					@imagepng($newimg);
548 548
 				}
Please login to merge, or discard this patch.
app/Plugin/FileUpload/Lib/Config/FileUploadSettings.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
       'jpg' => array('image/jpeg', 'image/pjpeg'),
95 95
       'jpeg' => array('image/jpeg', 'image/pjpeg'), 
96 96
       'gif' => array('image/gif'),
97
-      'png' => array('image/png','image/x-png'),
97
+      'png' => array('image/png', 'image/x-png'),
98 98
     ),
99 99
     
100 100
     /**
@@ -112,7 +112,7 @@  discard block
 block discarded – undo
112 112
       * fields are the fields relating to the database columns
113 113
       * @var array of fields related to database columns.
114 114
       */
115
-    'fields' => array('name'=>'name','type'=>'type','size'=>'size'),
115
+    'fields' => array('name'=>'name', 'type'=>'type', 'size'=>'size'),
116 116
     
117 117
     /**
118 118
       * Component Setting Only.
Please login to merge, or discard this patch.
app/Plugin/Search/Model/Behavior/SearchableBehavior.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
  * @return void
43 43
  */
44 44
 	public function setup(Model $Model, $config = array()) {
45
-		$this->_defaults = array_merge($this->_defaults, (array)Configure::read('Search.Searchable'));
45
+		$this->_defaults = array_merge($this->_defaults, (array) Configure::read('Search.Searchable'));
46 46
 		$this->settings[$Model->alias] = array_merge($this->_defaults, $config);
47 47
 		if (empty($Model->filterArgs)) {
48 48
 			return;
@@ -246,12 +246,12 @@  discard block
 block discarded – undo
246 246
 		if (empty($data[$field['name']])) {
247 247
 			return $conditions;
248 248
 		}
249
-		$fieldNames = (array)$field['field'];
249
+		$fieldNames = (array) $field['field'];
250 250
 
251 251
 		$cond = array();
252 252
 		foreach ($fieldNames as $fieldName) {
253 253
 			if (strpos($fieldName, '.') === false) {
254
-				$fieldName = $Model->alias . '.' . $fieldName;
254
+				$fieldName = $Model->alias.'.'.$fieldName;
255 255
 			}
256 256
 
257 257
 			if ($field['before'] === true) {
@@ -290,7 +290,7 @@  discard block
 block discarded – undo
290 290
 			if (!empty($field['connectorAnd']) || !empty($field['connectorOr'])) {
291 291
 				$cond[] = $this->_connectedLike($value, $field, $fieldName);
292 292
 			} else {
293
-				$cond[$fieldName . " LIKE"] = $field['before'] . $value . $field['after'];
293
+				$cond[$fieldName." LIKE"] = $field['before'].$value.$field['after'];
294 294
 			}
295 295
 		}
296 296
 		if (count($cond) > 1) {
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 			$andValues = String::tokenize($orValue, $field['connectorAnd']);
322 322
 			$and = array();
323 323
 			foreach ($andValues as $andValue) {
324
-				$and[] = array($fieldName . " LIKE" => $field['before'] . $andValue . $field['after']);
324
+				$and[] = array($fieldName." LIKE" => $field['before'].$andValue.$field['after']);
325 325
 			}
326 326
 
327 327
 			$or[] = array('AND' => $and);
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
  * @return array of conditions
341 341
  */
342 342
 	protected function _addCondValue(Model $Model, &$conditions, $data, $field) {
343
-		$fieldNames = (array)$field['field'];
343
+		$fieldNames = (array) $field['field'];
344 344
 		$fieldValue = isset($data[$field['name']]) ? $data[$field['name']] : null;
345 345
 
346 346
 		$cond = array();
347 347
 		foreach ($fieldNames as $fieldName) {
348 348
 			if (strpos($fieldName, '.') === false) {
349
-				$fieldName = $Model->alias . '.' . $fieldName;
349
+				$fieldName = $Model->alias.'.'.$fieldName;
350 350
 			}
351 351
 			if (is_array($fieldValue) && empty($fieldValue)) {
352 352
 				continue;
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 				continue;
356 356
 			}
357 357
 
358
-			if (is_array($fieldValue) || !is_array($fieldValue) && (string)$fieldValue !== '') {
358
+			if (is_array($fieldValue) || !is_array($fieldValue) && (string) $fieldValue !== '') {
359 359
 				$cond[$fieldName] = $fieldValue;
360 360
 			} elseif (isset($data[$field['name']]) && !empty($field['allowEmpty'])) {
361 361
 				$schema = $Model->schema($field['name']);
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 	protected function _addCondExpression(Model $Model, &$conditions, $data, $field) {
393 393
 		$fieldName = $field['field'];
394 394
 
395
-		if ((method_exists($Model, $field['method']) || $this->_checkBehaviorMethods($Model, $field['method'])) && (!empty($field['allowEmpty']) || !empty($data[$field['name']]) || (isset($data[$field['name']]) && (string)$data[$field['name']] !== ''))) {
395
+		if ((method_exists($Model, $field['method']) || $this->_checkBehaviorMethods($Model, $field['method'])) && (!empty($field['allowEmpty']) || !empty($data[$field['name']]) || (isset($data[$field['name']]) && (string) $data[$field['name']] !== ''))) {
396 396
 			$fieldValues = $Model->{$field['method']}($data, $field);
397 397
 			if (!empty($conditions[$fieldName]) && is_array($conditions[$fieldName])) {
398 398
 				$conditions[$fieldName] = array_unique(array_merge(array($conditions[$fieldName]), array($fieldValues)));
@@ -413,11 +413,11 @@  discard block
 block discarded – undo
413 413
  * @return array of conditions modified by this method
414 414
  */
415 415
 	protected function _addCondQuery(Model $Model, &$conditions, $data, $field) {
416
-		if ((method_exists($Model, $field['method']) || $this->_checkBehaviorMethods($Model, $field['method'])) && (!empty($field['allowEmpty']) || !empty($data[$field['name']]) || (isset($data[$field['name']]) && (string)$data[$field['name']] !== ''))) {
416
+		if ((method_exists($Model, $field['method']) || $this->_checkBehaviorMethods($Model, $field['method'])) && (!empty($field['allowEmpty']) || !empty($data[$field['name']]) || (isset($data[$field['name']]) && (string) $data[$field['name']] !== ''))) {
417 417
 			$conditionsAdd = $Model->{$field['method']}($data, $field);
418 418
 			// if our conditions function returns something empty, nothing to merge in
419 419
 			if (!empty($conditionsAdd)) {
420
-				$conditions = Set::merge($conditions, (array)$conditionsAdd);
420
+				$conditions = Set::merge($conditions, (array) $conditionsAdd);
421 421
 			}
422 422
 		}
423 423
 		return $conditions;
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
  */
435 435
 	protected function _addCondSubquery(Model $Model, &$conditions, $data, $field) {
436 436
 		$fieldName = $field['field'];
437
-		if ((method_exists($Model, $field['method']) || $this->_checkBehaviorMethods($Model, $field['method'])) && (!empty($field['allowEmpty']) || !empty($data[$field['name']]) || (isset($data[$field['name']]) && (string)$data[$field['name']] !== ''))) {
437
+		if ((method_exists($Model, $field['method']) || $this->_checkBehaviorMethods($Model, $field['method'])) && (!empty($field['allowEmpty']) || !empty($data[$field['name']]) || (isset($data[$field['name']]) && (string) $data[$field['name']] !== ''))) {
438 438
 			$subquery = $Model->{$field['method']}($data, $field);
439 439
 			// if our subquery function returns something empty, nothing to merge in
440 440
 			if (!empty($subquery)) {
@@ -496,7 +496,7 @@  discard block
 block discarded – undo
496 496
 						$assocData['fields'] = false;
497 497
 					}
498 498
 					if ($db->generateAssociationQuery($Model, $linkModel, $type, $assoc, $assocData, $queryData, $external, $null) === true) {
499
-						$linkedModels[$type . '/' . $assoc] = true;
499
+						$linkedModels[$type.'/'.$assoc] = true;
500 500
 					}
501 501
 				}
502 502
 			}
@@ -516,7 +516,7 @@  discard block
 block discarded – undo
516 516
 		if ($base === null) {
517 517
 			$base = array_fill_keys(array('conditions', 'fields', 'joins', 'order', 'limit', 'offset', 'group'), array());
518 518
 		}
519
-		return (array)$data + $base;
519
+		return (array) $data + $base;
520 520
 	}
521 521
 
522 522
 /**
Please login to merge, or discard this patch.
app/Plugin/Search/Controller/Component/PrgComponent.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -82,8 +82,8 @@  discard block
 block discarded – undo
82 82
  */
83 83
 	public function __construct(ComponentCollection $collection, $settings) {
84 84
 		$this->_defaults = Set::merge($this->_defaults, array(
85
-			'commonProcess' => (array)Configure::read('Search.Prg.commonProcess'),
86
-			'presetForm' => (array)Configure::read('Search.Prg.presetForm'),
85
+			'commonProcess' => (array) Configure::read('Search.Prg.commonProcess'),
86
+			'presetForm' => (array) Configure::read('Search.Prg.presetForm'),
87 87
 		), $settings);
88 88
 	}
89 89
 
@@ -238,7 +238,7 @@  discard block
 block discarded – undo
238 238
 		foreach ($this->controller->presetVars as $field) {
239 239
 			if ($field['type'] === 'checkbox') {
240 240
 				if (array_key_exists($field['field'], $data)) {
241
-					$values = join('|', (array)$data[$field['field']]);
241
+					$values = join('|', (array) $data[$field['field']]);
242 242
 				} else {
243 243
 					$values = '';
244 244
 				}
Please login to merge, or discard this patch.
app/Plugin/Search/Test/Case/AllSearchPluginTest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,8 +12,8 @@
 block discarded – undo
12 12
 	public static function suite() {
13 13
 		$Suite = new CakeTestSuite('All Plugin tests');
14 14
 		$path = dirname(__FILE__);
15
-		$Suite->addTestDirectory($path . DS . 'Controller' . DS . 'Component');
16
-		$Suite->addTestDirectory($path . DS . 'Model' . DS . 'Behavior');
15
+		$Suite->addTestDirectory($path.DS.'Controller'.DS.'Component');
16
+		$Suite->addTestDirectory($path.DS.'Model'.DS.'Behavior');
17 17
 		return $Suite;
18 18
 	}
19 19
 
Please login to merge, or discard this patch.