Completed
Push — master ( fffbfa...9fa4a1 )
by Charles
03:39
created
protected/commands/CiiCacheCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 
3
-Yii::import('cii.commands.CiiConsoleCommand');
3
+Yii::import ('cii.commands.CiiConsoleCommand');
4 4
 class CiiCacheCommand extends CiiConsoleCommand
5 5
 {
6
-    public function actionFlush()
6
+    public function actionFlush ()
7 7
     {
8
-        $this->log(Yii::app()->cache->flush() ? "Cache flushed" : "Unable to flush cache. Are we connected?");
9
-        unlink(__DIR__.DS.'..'.DS.'runtime'.DS.'modules.config.php');
8
+        $this->log (Yii::app ()->cache->flush () ? "Cache flushed" : "Unable to flush cache. Are we connected?");
9
+        unlink (__DIR__ . DS . '..' . DS . 'runtime' . DS . 'modules.config.php');
10 10
         return;
11 11
     }
12 12
 }
Please login to merge, or discard this patch.
protected/commands/CiiClassMapCommand.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -1,36 +1,36 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 
3
-Yii::import('cii.commands.CiiConsoleCommand');
3
+Yii::import ('cii.commands.CiiConsoleCommand');
4 4
 class CiiClassMapCommand extends CiiConsoleCommand
5 5
 {
6
-    public function actionIndex()
6
+    public function actionIndex ()
7 7
     {
8 8
         $data = "<?php\n";
9 9
         $data .= '$basePath = dirname(__FILE__) . \'/..\';' . "\n";
10 10
         $data .= 'Yii::$classMap = ' . "array(\n";
11 11
 
12
-        $this->updateDataPath(Yii::getPathOfAlias('ext'), $data);
13
-        $this->updateDataPath( Yii::getPathOfAlias('application.models'), $data);
14
-        $this->updateDataPath(Yii::getPathOfAlias('application.controllers'), $data);
12
+        $this->updateDataPath (Yii::getPathOfAlias ('ext'), $data);
13
+        $this->updateDataPath (Yii::getPathOfAlias ('application.models'), $data);
14
+        $this->updateDataPath (Yii::getPathOfAlias ('application.controllers'), $data);
15 15
 
16
-        $data .=  ");\n";
16
+        $data .= ");\n";
17 17
 
18
-        $handle = fopen(Yii::getPathOfAlias('application.config') . DIRECTORY_SEPARATOR . 'classmap.php', 'w+');
19
-        fwrite($handle, $data);
20
-        fclose($handle);
18
+        $handle = fopen (Yii::getPathOfAlias ('application.config') . DIRECTORY_SEPARATOR . 'classmap.php', 'w+');
19
+        fwrite ($handle, $data);
20
+        fclose ($handle);
21 21
         return;
22 22
     }
23 23
 
24
-    private function updateDataPath($path, &$data)
24
+    private function updateDataPath ($path, &$data)
25 25
     {
26
-        $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST);
27
-        foreach($objects as $name => $object)
26
+        $objects = new RecursiveIteratorIterator (new RecursiveDirectoryIterator ($path), RecursiveIteratorIterator::SELF_FIRST);
27
+        foreach ($objects as $name => $object)
28 28
         {
29
-            if (strpos($name, '.php') !== false && strpos($name, 'gii') === false)
29
+            if (strpos ($name, '.php') !== false && strpos ($name, 'gii') === false)
30 30
             {
31
-                $id = str_replace('.php', '', substr( $name, strrpos( $name, '/' )+1 ));
32
-                if ($this->startsWithUpper($id))
33
-                    $data .=  "    '" . $id . "' => " . '$basePath . \'' . str_replace('/var/www/ciims/protected', '', $name) . "',\n";
31
+                $id = str_replace ('.php', '', substr ($name, strrpos ($name, '/') + 1));
32
+                if ($this->startsWithUpper ($id))
33
+                    $data .= "    '" . $id . "' => " . '$basePath . \'' . str_replace ('/var/www/ciims/protected', '', $name) . "',\n";
34 34
             }
35 35
         }
36 36
 
@@ -40,10 +40,10 @@  discard block
 block discarded – undo
40 40
     /**
41 41
      * @param string $str
42 42
      */
43
-    private function startsWithUpper($str)
43
+    private function startsWithUpper ($str)
44 44
     {
45 45
         $chr = mb_substr ($str, 0, 1, "UTF-8");
46
-        return mb_strtolower($chr, "UTF-8") != $chr;
46
+        return mb_strtolower ($chr, "UTF-8") != $chr;
47 47
     }
48 48
 }
49 49
 
Please login to merge, or discard this patch.
protected/commands/CiiMessageCommand.php 1 patch
Spacing   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -2,7 +2,7 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * This is an alternative implementation of the MessageCommand class, designed to work with CiiMS' modules and themes
4 4
  */
5
-Yii::import('cii.commands.CiiConsoleCommand');
5
+Yii::import ('cii.commands.CiiConsoleCommand');
6 6
 class CiiMessageCommand extends CiiConsoleCommand
7 7
 {
8 8
 
@@ -28,12 +28,12 @@  discard block
 block discarded – undo
28 28
 	 * Default args
29 29
 	 * @return array
30 30
 	 */
31
-	private function getArgs()
31
+	private function getArgs ()
32 32
 	{
33 33
 		return array(
34 34
 			'type'			=> 'core',
35
-			'sourcePath'	=> Yii::getPathOfAlias('application').DS,
36
-			'messagePath'	=> Yii::getPathOfAlias('application.messages').DS,
35
+			'sourcePath'	=> Yii::getPathOfAlias ('application') . DS,
36
+			'messagePath'	=> Yii::getPathOfAlias ('application.messages') . DS,
37 37
 			'languages'		=> array('en_us'),
38 38
 			'fileTypes'		=> array('php'),
39 39
 			'overwrite'		=> true,
@@ -61,102 +61,102 @@  discard block
 block discarded – undo
61 61
 	/**
62 62
 	 * Init method
63 63
 	 */
64
-	public function init()
64
+	public function init ()
65 65
 	{
66
-		$this->_config = $this->getArgs();
66
+		$this->_config = $this->getArgs ();
67 67
 	}
68 68
 
69 69
 	/**
70 70
  	 * Generates translation files for a given mtheme
71 71
 	 * @param string $name 	The name of the theme to generate translations for
72 72
 	 */
73
-	public function actionThemes($name=NULL)
73
+	public function actionThemes ($name = NULL)
74 74
 	{
75 75
 		if ($name === NULL)
76
-			$this->usageError('A theme was not specified for translations');
76
+			$this->usageError ('A theme was not specified for translations');
77 77
 
78 78
 		$this->_config['type'] = 'theme';
79
-		array_push($this->_config['exclude'], 'modules');
80
-		$this->_config['sourcePath'] .= '..'.DS.'themes' . DS . $name . DS;
81
-		$this->_config['messagePath'] = $this->_config['sourcePath'].'messages';
82
-		$this->execute();
79
+		array_push ($this->_config['exclude'], 'modules');
80
+		$this->_config['sourcePath'] .= '..' . DS . 'themes' . DS . $name . DS;
81
+		$this->_config['messagePath'] = $this->_config['sourcePath'] . 'messages';
82
+		$this->execute ();
83 83
 	}
84 84
 
85 85
 	/**
86 86
  	 * Generates translation files for a given module
87 87
 	 * @param string $name 	The name of the module to generate translations for
88 88
 	 */
89
-	public function actionModules($name=NULL)
89
+	public function actionModules ($name = NULL)
90 90
 	{
91 91
 		if ($name === NULL)
92
-			$this->usageError('A module was not specified for translations');
92
+			$this->usageError ('A module was not specified for translations');
93 93
 
94 94
 		$this->_config['type'] = 'module';
95
-		array_push($this->_config['exclude'], 'themes');
95
+		array_push ($this->_config['exclude'], 'themes');
96 96
 		unset($this->_config['exclude']['modules']);
97
-		$this->_config['sourcePath'] = Yii::getPathOfAlias('application.modules') . DS . $name . DS;
98
-		$this->_config['messagePath'] = $this->_config['sourcePath'].'messages';
99
-		$this->execute($this->_config);
97
+		$this->_config['sourcePath'] = Yii::getPathOfAlias ('application.modules') . DS . $name . DS;
98
+		$this->_config['messagePath'] = $this->_config['sourcePath'] . 'messages';
99
+		$this->execute ($this->_config);
100 100
 	}
101 101
 
102 102
 	/**
103 103
  	 * Defualt action
104 104
 	 */
105
-	public function actionIndex()
105
+	public function actionIndex ()
106 106
 	{
107
-		array_push($this->_config['exclude'], 'modules');
108
-		array_push($this->_config['exclude'], 'themes');
109
-		return $this->execute();
107
+		array_push ($this->_config['exclude'], 'modules');
108
+		array_push ($this->_config['exclude'], 'themes');
109
+		return $this->execute ();
110 110
 	}
111 111
 
112 112
 	/**
113 113
 	 * Execute the action.
114 114
 	 */
115
-	private function execute()
115
+	private function execute ()
116 116
 	{
117 117
 		// Validate the configuration
118
-		extract($this->_config);
119
-		$this->validateConfig();
118
+		extract ($this->_config);
119
+		$this->validateConfig ();
120 120
 
121 121
 		// Determine the messages
122
-		foreach($this->getFiles() as $file)
123
-			$this->_messages = array_merge_recursive($this->_messages,$this->extractMessages($file,$this->_translator));
122
+		foreach ($this->getFiles () as $file)
123
+			$this->_messages = array_merge_recursive ($this->_messages, $this->extractMessages ($file, $this->_translator));
124 124
 
125
-		foreach($languages as $language)
125
+		foreach ($languages as $language)
126 126
 		{
127
-			$dir = $messagePath.DS.$language;
127
+			$dir = $messagePath . DS . $language;
128 128
 
129
-			$this->createDirectory($dir);
129
+			$this->createDirectory ($dir);
130 130
 
131 131
 			foreach ($this->_messages as $category=>$msgs)
132 132
 			{
133
-				$msgs = array_values(array_unique($msgs));
133
+				$msgs = array_values (array_unique ($msgs));
134 134
 
135
-				$dir = $this->_config['messagePath'].DS.$language;
135
+				$dir = $this->_config['messagePath'] . DS . $language;
136 136
 
137
-				if ($this->_config['type']  == 'theme')
137
+				if ($this->_config['type'] == 'theme')
138 138
 				{
139
-					$data = explode('.', $category);
139
+					$data = explode ('.', $category);
140 140
 					unset($data[0]);
141
-					$dirPath = implode(DS, $data);
141
+					$dirPath = implode (DS, $data);
142 142
 				}
143 143
 				else if ($this->_config['type'] == 'module')
144 144
 				{
145
-					$data = explode('.', $category);
145
+					$data = explode ('.', $category);
146 146
 					unset($data[0]);
147 147
 					unset($data[1]);
148
-					$dirPath = implode(DS, $data);
148
+					$dirPath = implode (DS, $data);
149 149
 				}
150 150
 				else
151
-					$dirPath = implode(DS, explode('.', $category));
151
+					$dirPath = implode (DS, explode ('.', $category));
152 152
 
153 153
 				if (empty($dirPath))
154 154
 					continue;
155 155
 
156
-				$this->createDirectory($dir . DS . $dirPath);
157
-				$this->createDirectory($dir . DS . $language);
156
+				$this->createDirectory ($dir . DS . $dirPath);
157
+				$this->createDirectory ($dir . DS . $language);
158 158
 
159
-				$this->generateMessageFile($msgs,$dir.DS.$dirPath.'.php',$overwrite,$removeOld,$sort);
159
+				$this->generateMessageFile ($msgs, $dir . DS . $dirPath . '.php', $overwrite, $removeOld, $sort);
160 160
 			}
161 161
 		}
162 162
 	}
@@ -166,12 +166,12 @@  discard block
 block discarded – undo
166 166
 	 * @param string $directory
167 167
 	 * @return boolean
168 168
 	 */
169
-	private function createDirectory($directory)
169
+	private function createDirectory ($directory)
170 170
 	{
171
-		if (!is_dir($directory)) 
171
+		if (!is_dir ($directory)) 
172 172
 		{
173
-			if (!mkdir($directory, 0777, true))
174
-				$this->usageError('The directory ' . $directory .' could not be created. Please make sure this process has write access to this directory.');
173
+			if (!mkdir ($directory, 0777, true))
174
+				$this->usageError ('The directory ' . $directory . ' could not be created. Please make sure this process has write access to this directory.');
175 175
 		}
176 176
 
177 177
 		return true;
@@ -181,10 +181,10 @@  discard block
 block discarded – undo
181 181
 	 * Retrieves the files that should be translated
182 182
 	 * @return array $files
183 183
 	 */
184
-	private function getFiles()
184
+	private function getFiles ()
185 185
 	{
186
-		extract($this->_config);
187
-		$files = CFileHelper::findFiles(realpath($sourcePath),array(
186
+		extract ($this->_config);
187
+		$files = CFileHelper::findFiles (realpath ($sourcePath), array(
188 188
 					'fileTypes' => $fileTypes,
189 189
 					'exclude'	=> $exclude
190 190
 				 ));
@@ -192,11 +192,11 @@  discard block
 block discarded – undo
192 192
 		// Strip out all extensions
193 193
 		foreach ($files as $k=>$file)
194 194
 		{
195
-			if (strpos($file, 'extensions') !== false)
195
+			if (strpos ($file, 'extensions') !== false)
196 196
 				unset($files[$k]);
197 197
 		}
198 198
 
199
-		reset($files);
199
+		reset ($files);
200 200
 
201 201
 		return $files;
202 202
 	}
@@ -204,58 +204,58 @@  discard block
 block discarded – undo
204 204
 	/**
205 205
 	 * Does basic validation on the configuration options
206 206
 	 */
207
-	private function validateConfig()
207
+	private function validateConfig ()
208 208
 	{
209
-		extract($this->_config);
209
+		extract ($this->_config);
210 210
 
211
-		if(!isset($sourcePath,$messagePath,$languages))
212
-			$this->usageError('The configuration file must specify "sourcePath", "messagePath" and "languages".');
211
+		if (!isset($sourcePath, $messagePath, $languages))
212
+			$this->usageError ('The configuration file must specify "sourcePath", "messagePath" and "languages".');
213 213
 
214
-		if(!is_dir($sourcePath))
215
-			$this->usageError("The source path $sourcePath is not a valid directory.");
214
+		if (!is_dir ($sourcePath))
215
+			$this->usageError ("The source path $sourcePath is not a valid directory.");
216 216
 
217
-		if(!is_dir($messagePath))
218
-			$this->usageError("The message path $messagePath is not a valid directory.");
217
+		if (!is_dir ($messagePath))
218
+			$this->usageError ("The message path $messagePath is not a valid directory.");
219 219
 
220
-		if(empty($languages))
221
-			$this->usageError("Languages cannot be empty.");
220
+		if (empty($languages))
221
+			$this->usageError ("Languages cannot be empty.");
222 222
 	}
223 223
 
224 224
 	/**
225 225
 	 * @param string $translator
226 226
 	 */
227
-	protected function extractMessages($fileName,$translator)
227
+	protected function extractMessages ($fileName, $translator)
228 228
 	{
229
-		$subject=file_get_contents($fileName);
230
-		$messages=array();
231
-		if(!is_array($translator))
232
-			$translator=array($translator);
229
+		$subject = file_get_contents ($fileName);
230
+		$messages = array();
231
+		if (!is_array ($translator))
232
+			$translator = array($translator);
233 233
 
234 234
 		foreach ($translator as $currentTranslator)
235 235
 		{
236
-			$n=preg_match_all('/\b'.$currentTranslator.'\s*\(\s*(\'[\w.\/]*?(?<!\.)\'|"[\w.]*?(?<!\.)")\s*,\s*(\'.*?(?<!\\\\)\'|".*?(?<!\\\\)")\s*[,\)]/s',$subject,$matches,PREG_SET_ORDER);
236
+			$n = preg_match_all ('/\b' . $currentTranslator . '\s*\(\s*(\'[\w.\/]*?(?<!\.)\'|"[\w.]*?(?<!\.)")\s*,\s*(\'.*?(?<!\\\\)\'|".*?(?<!\\\\)")\s*[,\)]/s', $subject, $matches, PREG_SET_ORDER);
237 237
 
238
-			for($i=0; $i<$n; ++$i)
238
+			for ($i = 0; $i < $n; ++$i)
239 239
 			{
240
-				if(($pos=strpos($matches[$i][1],'.'))!==false)
240
+				if (($pos = strpos ($matches[$i][1], '.')) !== false)
241 241
 				{
242
-					if (strpos($matches[$i][1],'Dashboard')!==false || strpos($matches[$i][1],'Hybridauth')!==false || strpos($matches[$i][1],'Install')!==false)
243
-						$category='module.'.substr($matches[$i][1],1,-1);
244
-					else if (strpos($matches[$i][1],'Theme')!==false)
245
-						$category=$matches[$i][1];
242
+					if (strpos ($matches[$i][1], 'Dashboard') !== false || strpos ($matches[$i][1], 'Hybridauth') !== false || strpos ($matches[$i][1], 'Install') !== false)
243
+						$category = 'module.' . substr ($matches[$i][1], 1, -1);
244
+					else if (strpos ($matches[$i][1], 'Theme') !== false)
245
+						$category = $matches[$i][1];
246 246
 					else
247
-						$category=substr($matches[$i][1],$pos+1,-1);
247
+						$category = substr ($matches[$i][1], $pos + 1, -1);
248 248
 				}
249 249
 				else
250
-					$category=substr($matches[$i][1],1,-1);
250
+					$category = substr ($matches[$i][1], 1, -1);
251 251
 
252 252
 
253
-				$message=$matches[$i][2];
253
+				$message = $matches[$i][2];
254 254
 
255
-				$category = str_replace("'", '', $category);
255
+				$category = str_replace ("'", '', $category);
256 256
 
257 257
 				// This is how Yii does it
258
-				$messages[$category][]=eval("return $message;");  // use eval to eliminate quote escape
258
+				$messages[$category][] = eval("return $message;"); // use eval to eliminate quote escape
259 259
 			}
260 260
 		}
261 261
 
@@ -268,74 +268,74 @@  discard block
 block discarded – undo
268 268
 	 * @param boolean $removeOld
269 269
 	 * @param boolean $sort
270 270
 	 */
271
-	protected function generateMessageFile($messages,$fileName,$overwrite,$removeOld,$sort)
271
+	protected function generateMessageFile ($messages, $fileName, $overwrite, $removeOld, $sort)
272 272
 	{
273 273
 		echo "Saving messages to $fileName...";
274
-		if(is_file($fileName))
274
+		if (is_file ($fileName))
275 275
 		{
276
-			$translated=require($fileName);
277
-			sort($messages);
278
-			ksort($translated);
279
-			if(array_keys($translated)==$messages)
276
+			$translated = require($fileName);
277
+			sort ($messages);
278
+			ksort ($translated);
279
+			if (array_keys ($translated) == $messages)
280 280
 			{
281 281
 				echo "nothing new...skipped.\n";
282 282
 				return;
283 283
 			}
284 284
 
285
-			$merged=array();
286
-			$untranslated=array();
285
+			$merged = array();
286
+			$untranslated = array();
287 287
 
288
-			foreach($messages as $message)
288
+			foreach ($messages as $message)
289 289
 			{
290
-				if(array_key_exists($message,$translated) && strlen($translated[$message])>0)
291
-					$merged[$message]=$translated[$message];
290
+				if (array_key_exists ($message, $translated) && strlen ($translated[$message]) > 0)
291
+					$merged[$message] = $translated[$message];
292 292
 				else
293
-					$untranslated[]=$message;
293
+					$untranslated[] = $message;
294 294
 			}
295 295
 
296
-			ksort($merged);
297
-			sort($untranslated);
298
-			$todo=array();
296
+			ksort ($merged);
297
+			sort ($untranslated);
298
+			$todo = array();
299 299
 
300
-			foreach($untranslated as $message)
301
-				$todo[$message]='';
300
+			foreach ($untranslated as $message)
301
+				$todo[$message] = '';
302 302
 
303
-			ksort($translated);
303
+			ksort ($translated);
304 304
 
305
-			foreach($translated as $message=>$translation)
305
+			foreach ($translated as $message=>$translation)
306 306
 			{
307
-				if(!isset($merged[$message]) && !isset($todo[$message]) && !$removeOld)
307
+				if (!isset($merged[$message]) && !isset($todo[$message]) && !$removeOld)
308 308
 				{
309
-					if(substr($translation,0,2)==='@@' && substr($translation,-2)==='@@')
310
-						$todo[$message]=$translation;
309
+					if (substr ($translation, 0, 2) === '@@' && substr ($translation, -2) === '@@')
310
+						$todo[$message] = $translation;
311 311
 					else if ($translation == '')
312 312
 						$todo[$message] = '';
313 313
 					else
314
-						$todo[$message]='@@'.$translation.'@@';
314
+						$todo[$message] = '@@' . $translation . '@@';
315 315
 				}
316 316
 			}
317 317
 
318
-			$merged=array_merge($todo,$merged);
318
+			$merged = array_merge ($todo, $merged);
319 319
 
320
-			if($sort)
321
-				ksort($merged);
320
+			if ($sort)
321
+				ksort ($merged);
322 322
 
323
-			if($overwrite === false)
324
-				$fileName.='.merged';
323
+			if ($overwrite === false)
324
+				$fileName .= '.merged';
325 325
 
326 326
 			echo "translation merged.\n";
327 327
 		}
328 328
 		else
329 329
 		{
330
-			$merged=array();
331
-			foreach($messages as $message)
332
-				$merged[$message]='';
330
+			$merged = array();
331
+			foreach ($messages as $message)
332
+				$merged[$message] = '';
333 333
 
334
-			ksort($merged);
334
+			ksort ($merged);
335 335
 			echo "saved.\n";
336 336
 		}
337
-		$array=str_replace("\r",'',var_export($merged,true));
338
-		$content=<<<EOD
337
+		$array = str_replace ("\r", '', var_export ($merged, true));
338
+		$content = <<<EOD
339 339
 <?php
340 340
 /**
341 341
  * Message translations.
@@ -357,6 +357,6 @@  discard block
 block discarded – undo
357 357
 return $array;
358 358
 
359 359
 EOD;
360
-		file_put_contents($fileName, $content);
360
+		file_put_contents ($fileName, $content);
361 361
 	}
362 362
 }
Please login to merge, or discard this patch.
protected/commands/CiiMigrateCommand.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 // Import System/Cli/Commands/MigrateCommand
3
-Yii::import('system.cli.commands.MigrateCommand');
3
+Yii::import ('system.cli.commands.MigrateCommand');
4 4
 /**
5 5
  * This class is an injection container for CDbMigration which permits us to
6 6
  * directly access CDbMigrations from our web application without having
@@ -21,10 +21,10 @@  discard block
 block discarded – undo
21 21
      * This is our overloaded getDbConnection, allowing us to tell yii what our db connection is
22 22
      * without it having to go through
23 23
      */
24
-    public function getDbConnection()
24
+    public function getDbConnection ()
25 25
     {
26
-        $connection = new CDbConnection("mysql:host={$this->dsn['host']};dbname={$this->dsn['dbname']}", $this->dsn['username'], $this->dsn['password']);
27
-        $connection->setActive(true);
26
+        $connection = new CDbConnection ("mysql:host={$this->dsn['host']};dbname={$this->dsn['dbname']}", $this->dsn['username'], $this->dsn['password']);
27
+        $connection->setActive (true);
28 28
         return $connection;
29 29
     }
30 30
 }
31 31
\ No newline at end of file
Please login to merge, or discard this patch.
protected/config/classmap.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php
2
-$basePath = dirname(__FILE__) . '/..';
2
+$basePath = dirname (__FILE__) . '/..';
3 3
 Yii::$classMap = array(
4 4
     'YiinfiniteScroller' => $basePath . '/extensions/yiinfinite-scroll/YiinfiniteScroller.php',
5 5
     'ContentMetadata' => $basePath . '/models/ContentMetadata.php',
Please login to merge, or discard this patch.
protected/config/install.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1,5 +1,5 @@
 block discarded – undo
1 1
 <?php return array(
2
-	'basePath' => dirname(__FILE__).DIRECTORY_SEPARATOR.'..',
2
+	'basePath' => dirname (__FILE__) . DIRECTORY_SEPARATOR . '..',
3 3
 	'name' => 'CiiMS Installer',
4 4
 	'preload' => array(
5 5
 		'cii'
Please login to merge, or discard this patch.
protected/config/main.default.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 * @license    http://opensource.org/licenses/MIT  MIT LICENSE
19 19
 * @link       https://github.com/charlesportwoodii/CiiMS
20 20
 */
21
-$import = function($default=false) {
21
+$import = function ($default = false) {
22 22
 
23 23
 	$modules = (require __DIR__ . DS . 'modules.php');
24 24
 
@@ -32,22 +32,22 @@  discard block
 block discarded – undo
32 32
 	);
33 33
 
34 34
 	foreach ($modules as $k=>$v) {
35
-		$m[] = 'application.modules.'.$v.'.*';
35
+		$m[] = 'application.modules.' . $v . '.*';
36 36
 	}
37 37
 
38 38
 	return $m;
39 39
 };
40 40
 
41 41
 $ciimsCoreConfig = array(
42
-	'basePath' => __DIR__.DS.'..',
42
+	'basePath' => __DIR__ . DS . '..',
43 43
 	'name' => NULL,
44 44
 	'sourceLanguage' => 'en_US',
45 45
 	'preload' => array(
46 46
 		'cii',
47 47
 		'analytics'
48 48
 	),
49
-	'import' => $import(),
50
-	'modules' => $import(true),
49
+	'import' => $import (),
50
+	'modules' => $import (true),
51 51
 	'behaviors' => array(
52 52
 		'onBeginRequest' => array(
53 53
 			'class' => 'vendor.charlesportwoodii.yii-newrelic.behaviors.YiiNewRelicWebAppBehavior',
@@ -139,7 +139,7 @@  discard block
 block discarded – undo
139 139
 );
140 140
 
141 141
 // CLI specific data
142
-if (php_sapi_name() == "cli")
142
+if (php_sapi_name () == "cli")
143 143
 {
144 144
 	$ciimsCoreConfig['behaviors'] = array(
145 145
 		'onBeginRequest' => array(
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
 	);
152 152
 }
153 153
 
154
-if (php_sapi_name() != "cli" && YII_DEBUG)
154
+if (php_sapi_name () != "cli" && YII_DEBUG)
155 155
 {
156 156
 	$ciimsCoreConfig['preload'][] = 'debug';
157 157
 	$ciimsCoreConfig['components']['debug'] = array(
Please login to merge, or discard this patch.
protected/config/modules.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,10 +2,10 @@  discard block
 block discarded – undo
2 2
 
3 3
 // Set the scan directory
4 4
 $directory = __DIR__ . DS . '..' . DS . 'modules';
5
-$cachedConfig = __DIR__.DS.'..'.DS.'runtime'.DS.'modules.config.php';
5
+$cachedConfig = __DIR__ . DS . '..' . DS . 'runtime' . DS . 'modules.config.php';
6 6
 
7 7
 // Attempt to load the cached file if it exists
8
-if (file_exists($cachedConfig))
8
+if (file_exists ($cachedConfig))
9 9
 	return require($cachedConfig);
10 10
 else
11 11
 {
@@ -13,22 +13,22 @@  discard block
 block discarded – undo
13 13
 	$response = array();
14 14
 
15 15
 	// Find all the modules currently installed, and preload them
16
-	foreach (new IteratorIterator(new DirectoryIterator($directory)) as $filename)
16
+	foreach (new IteratorIterator (new DirectoryIterator ($directory)) as $filename)
17 17
 	{
18 18
 		// Don't import dot files
19
-		if (!$filename->isDot() && strpos($filename->getFileName(), ".") === false)
19
+		if (!$filename->isDot () && strpos ($filename->getFileName (), ".") === false)
20 20
 		{
21
-			$path = $filename->getPathname();
21
+			$path = $filename->getPathname ();
22 22
 
23
-			if (file_exists($path.DS.'config'.DS.'main.php'))
24
-				$response[$filename->getFilename()] = require($path.DS.'config'.DS.'main.php');
23
+			if (file_exists ($path . DS . 'config' . DS . 'main.php'))
24
+				$response[$filename->getFilename ()] = require($path . DS . 'config' . DS . 'main.php');
25 25
 			else
26
-				array_push($response, $filename->getFilename());
26
+				array_push ($response, $filename->getFilename ());
27 27
 		}
28 28
 	}
29 29
 
30
-	$encoded = serialize($response);
31
-	file_put_contents($cachedConfig, '<?php return unserialize(\''.$encoded.'\');');
30
+	$encoded = serialize ($response);
31
+	file_put_contents ($cachedConfig, '<?php return unserialize(\'' . $encoded . '\');');
32 32
 
33 33
 	// return the response
34 34
 	return $response;
Please login to merge, or discard this patch.
protected/controllers/CategoriesController.php 1 patch
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -5,17 +5,17 @@  discard block
 block discarded – undo
5 5
 	/**
6 6
 	 * Base filter, allows logged in and non-logged in users to cache the page
7 7
 	 */
8
-	public function filters()
8
+	public function filters ()
9 9
 	{
10
-		$id = Yii::app()->getRequest()->getQuery('id');
10
+		$id = Yii::app ()->getRequest ()->getQuery ('id');
11 11
 
12 12
 		if ($id == NULL || $id === false)
13
-			throw new CHttpException(400, Yii::t('ciims.controllers.Categories', 'Invalid routing'));
13
+			throw new CHttpException (400, Yii::t ('ciims.controllers.Categories', 'Invalid routing'));
14 14
 
15
-		return CMap::mergeArray(parent::filters(), array(
15
+		return CMap::mergeArray (parent::filters (), array(
16 16
 			array(
17 17
 				'CHttpCacheFilter + index',
18
-				'cacheControl'=>Cii::get(Yii::app()->user->id) == NULL ? 'public' : 'private' .', no-cache, must-revalidate',
18
+				'cacheControl'=>Cii::get (Yii::app ()->user->id) == NULL ? 'public' : 'private' . ', no-cache, must-revalidate',
19 19
 				'etagSeed'=>$id
20 20
 			),
21 21
 			array(
@@ -47,51 +47,51 @@  discard block
 block discarded – undo
47 47
 	 * Shows all blog posts for a particular category_id
48 48
 	 * @param $id	- The content ID that we want to pull from the database
49 49
 	 **/
50
-	public function actionIndex($id=NULL)
50
+	public function actionIndex ($id = NULL)
51 51
 	{
52 52
 		// Run a pre check of our data
53
-		$this->beforeCiiAction($id);
53
+		$this->beforeCiiAction ($id);
54 54
 
55 55
 		// Retrieve the data
56
-		$category = Categories::model()->findByPk($id);
56
+		$category = Categories::model ()->findByPk ($id);
57 57
 
58 58
 		// Set the layout
59
-		$this->setLayout('default');
59
+		$this->setLayout ('default');
60 60
 
61
-		$this->setPageTitle(Yii::t('ciims.controllers.Categories', '{{app_name}} | {{label}}', array(
62
-			'{{app_name}}' => Cii::getConfig('name', Yii::app()->name),
61
+		$this->setPageTitle (Yii::t ('ciims.controllers.Categories', '{{app_name}} | {{label}}', array(
62
+			'{{app_name}}' => Cii::getConfig ('name', Yii::app ()->name),
63 63
 			'{{label}}'    => $category->name
64 64
 		)));
65 65
 
66
-		$pageSize = Cii::getConfig('categoryPaginationSize', 10);
66
+		$pageSize = Cii::getConfig ('categoryPaginationSize', 10);
67 67
 
68
-		$criteria = Content::model()
69
-					->getBaseCriteria()
70
-					->addCondition('type_id >= 2')
71
-					->addCondition("category_id = " . $id)
72
-					->addCondition('password = ""');
68
+		$criteria = Content::model ()
69
+					->getBaseCriteria ()
70
+					->addCondition ('type_id >= 2')
71
+					->addCondition ("category_id = " . $id)
72
+					->addCondition ('password = ""');
73 73
 
74 74
 		$criteria->limit = $pageSize;
75 75
 		$criteria->order = 'created DESC';
76 76
 
77
-		$itemCount = Content::model()->count($criteria);
78
-		$pages=new CPagination($itemCount);
79
-		$pages->pageSize=$pageSize;
77
+		$itemCount = Content::model ()->count ($criteria);
78
+		$pages = new CPagination ($itemCount);
79
+		$pages->pageSize = $pageSize;
80 80
 
81 81
 
82
-		$criteria->offset = $criteria->limit*($pages->getCurrentPage());
83
-		$data = Content::model()->findAll($criteria);
82
+		$criteria->offset = $criteria->limit * ($pages->getCurrentPage ());
83
+		$data = Content::model ()->findAll ($criteria);
84 84
 
85
-		$pages->applyLimit($criteria);
85
+		$pages->applyLimit ($criteria);
86 86
 
87
-		$this->render('index', array(
87
+		$this->render ('index', array(
88 88
 			'id'		=> $id,
89 89
 			'category' 	=> $category,
90 90
 			'data' 		=> $data,
91 91
 			'itemCount' => $itemCount,
92 92
 			'pages' 	=> $pages,
93 93
 			'meta' 		=> array(
94
-				'description' => $category->getDescription()
94
+				'description' => $category->getDescription ()
95 95
 		)));
96 96
 	}
97 97
 
@@ -100,25 +100,25 @@  discard block
 block discarded – undo
100 100
 	 * So that RSS Readers can access the website
101 101
 	 * @param  int $id
102 102
 	 */
103
-	public function actionRss($id=NULL)
103
+	public function actionRss ($id = NULL)
104 104
 	{
105
-		Yii::app()->log->routes[0]->enabled = false;
106
-		ob_end_clean();
107
-		header('Content-type: text/xml; charset=utf-8');
108
-		$url = 'http://'.Yii::app()->request->serverName . Yii::app()->baseUrl;
109
-		$this->setLayout(null);
110
-		$criteria = Content::model()
111
-					->getBaseCriteria()
112
-					->addCondition('type_id >= 2')
113
-					->addCondition('password = ""');
105
+		Yii::app ()->log->routes[0]->enabled = false;
106
+		ob_end_clean ();
107
+		header ('Content-type: text/xml; charset=utf-8');
108
+		$url = 'http://' . Yii::app ()->request->serverName . Yii::app ()->baseUrl;
109
+		$this->setLayout (null);
110
+		$criteria = Content::model ()
111
+					->getBaseCriteria ()
112
+					->addCondition ('type_id >= 2')
113
+					->addCondition ('password = ""');
114 114
 
115 115
 		if ($id !== NULL)
116
-			$criteria->addCondition("category_id = " . $id);
116
+			$criteria->addCondition ("category_id = " . $id);
117 117
 
118 118
 		$criteria->order = 'created DESC';
119
-		$data = Content::model()->findAll($criteria);
119
+		$data = Content::model ()->findAll ($criteria);
120 120
 
121
-		$this->renderPartial('application.views.site/rss', array(
121
+		$this->renderPartial ('application.views.site/rss', array(
122 122
 			'data' 	=> $data, 
123 123
 			'url'	=> $url
124 124
 		));
Please login to merge, or discard this patch.