Passed
Push — releases ( 51c2cc...e1d10c )
by steve
39:06 queued 13:38
created
firefly/migrations/m170830_121945_firefly_change_local_drive_to_media.php 1 patch
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@
 block discarded – undo
4 4
 
5 5
 class m170830_121945_firefly_change_local_drive_to_media extends Migration
6 6
 {
7
-    public function safeUp()
8
-    {
9
-        $this->execute('UPDATE firefly_file_manager SET drive = "media" WHERE drive = "local"');
10
-    }
7
+	public function safeUp()
8
+	{
9
+		$this->execute('UPDATE firefly_file_manager SET drive = "media" WHERE drive = "local"');
10
+	}
11 11
 
12
-    public function safeDown()
13
-    {
14
-        $this->execute('UPDATE firefly_file_manager SET drive = "local" WHERE drive = "media"');
15
-    }
12
+	public function safeDown()
13
+	{
14
+		$this->execute('UPDATE firefly_file_manager SET drive = "local" WHERE drive = "media"');
15
+	}
16 16
 
17
-    /*
17
+	/*
18 18
     // Use up()/down() to run migration code without a transaction.
19 19
     public function up()
20 20
     {
Please login to merge, or discard this patch.
neon/firefly/migrations/m161123_191412_firefly_files_table.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -5,8 +5,8 @@  discard block
 block discarded – undo
5 5
 
6 6
 class m161123_191412_firefly_files_table extends Migration
7 7
 {
8
-    public function safeUp()
9
-    {
8
+	public function safeUp()
9
+	{
10 10
 		$this->createTable(DbFile::tableName(), [
11 11
 			// limit the path size on the db file storage driver.
12 12
 			// otherwise the key gets too big.
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 			'created_at' => $this->datetime()->comment('When the file was first created'),
36 36
 			'PRIMARY KEY (`path`(150))'
37 37
 		]);
38
-    }
38
+	}
39 39
 
40
-    public function safeDown()
41
-    {
40
+	public function safeDown()
41
+	{
42 42
 		$this->dropTable(DbFile::tableName());
43
-    }
43
+	}
44 44
 
45 45
 }
Please login to merge, or discard this patch.
firefly/migrations/m170312_165920_firefly_firefly_fix_uuid_collation.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,15 +4,15 @@
 block discarded – undo
4 4
 
5 5
 class m170312_165920_firefly_firefly_fix_uuid_collation extends Migration
6 6
 {
7
-    public function safeUp()
8
-    {
7
+	public function safeUp()
8
+	{
9 9
 		$query = "ALTER TABLE `firefly_file_manager` CHANGE `uuid` `uuid` CHAR(22) CHARACTER SET latin1 COLLATE latin1_general_cs NOT NULL COMMENT 'The unique identifier for this file'";
10 10
 		$this->execute($query);
11
-    }
11
+	}
12 12
 
13
-    public function safeDown()
14
-    {
13
+	public function safeDown()
14
+	{
15 15
 		$query = "ALTER TABLE `firefly_file_manager` CHANGE `uuid` `uuid` CHAR(22) CHARACTER SET latin1 COLLATE latin1_general_ci NOT NULL COMMENT 'The unique identifier for this file'";
16 16
 		$this->execute($query);
17
-    }
17
+	}
18 18
 }
Please login to merge, or discard this patch.
neon/firefly/migrations/m161126_123100_firefly_file_manager.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -6,8 +6,8 @@  discard block
 block discarded – undo
6 6
 class m161126_123100_firefly_file_manager extends Migration
7 7
 {
8 8
 
9
-    public function safeUp()
10
-    {
9
+	public function safeUp()
10
+	{
11 11
 		$this->createTable(FileManager::tableName(), [
12 12
 
13 13
 			'uuid' => $this->char(36)->notNull()->comment('The uuid for this file'),
@@ -35,11 +35,11 @@  discard block
 block discarded – undo
35 35
 			'PRIMARY KEY (uuid)'
36 36
 
37 37
 		]);
38
-    }
38
+	}
39 39
 
40
-    public function safeDown()
41
-    {
40
+	public function safeDown()
41
+	{
42 42
 		$this->dropTable(FileManager::tableName());
43
-    }
43
+	}
44 44
 
45 45
 }
Please login to merge, or discard this patch.
neon/firefly/migrations/m161130_132459_firefly_uuid_change_to_22_chars.php 1 patch
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,13 +4,13 @@
 block discarded – undo
4 4
 
5 5
 class m161130_132459_firefly_uuid_change_to_22_chars extends Migration
6 6
 {
7
-    public function safeUp()
8
-    {
7
+	public function safeUp()
8
+	{
9 9
 		$this->alterColumn('firefly_file_manager', 'uuid', "CHAR(22) NOT NULL COMMENT 'The unique identifier for this file'");
10
-    }
10
+	}
11 11
 
12
-    public function safeDown()
13
-    {
12
+	public function safeDown()
13
+	{
14 14
 		$this->alterColumn('firefly_file_manager', 'uuid', "CHAR(36) NOT NULL COMMENT 'The uuid for this file'");
15
-    }
15
+	}
16 16
 }
Please login to merge, or discard this patch.
neon/firefly/migrations/m190204_134239_firefly_interface_change_db_fix.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
 	private function convertFireflyGetsToFiles($search, $replace)
34 34
 	{
35 35
 		$potentiallyAffected = $this->db->createCommand("SELECT `class_type`, `member_ref` FROM `dds_member` WHERE `data_type_ref`='textlong'")->queryAll();
36
-		if (count($potentiallyAffected)==0)
36
+		if (count($potentiallyAffected) == 0)
37 37
 			return;
38 38
 		$classes = [];
39 39
 		foreach ($potentiallyAffected as $pa)
@@ -70,21 +70,21 @@  discard block
 block discarded – undo
70 70
 
71 71
 		$dds = neon('dds')->IDdsObjectManagement;
72 72
 		foreach ($wysiwygFields as $classType => $fields) {
73
-			$start=0;
73
+			$start = 0;
74 74
 			do {
75 75
 				$found = $dds->listObjects($classType, $total, true, true, $start, 100);
76 76
 				$start += count($found);
77 77
 				foreach ($found as $objectData) {
78 78
 					$changes = [];
79 79
 					foreach ($fields as $field) {
80
-						if (!empty($objectData[$field]) && strpos($objectData[$field],$search)!==false)
80
+						if (!empty($objectData[$field]) && strpos($objectData[$field], $search) !== false)
81 81
 							$changes[$field] = str_replace($search, $replace, $objectData[$field]);
82 82
 					}
83 83
 					if (count($changes)) {
84 84
 						$dds->editObject($objectData['_uuid'], $changes);
85 85
 					}
86 86
 				}
87
-			} while (count($found)>0);
87
+			} while (count($found) > 0);
88 88
 		}
89 89
 
90 90
 		return true;
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -33,22 +33,26 @@  discard block
 block discarded – undo
33 33
 	private function convertFireflyGetsToFiles($search, $replace)
34 34
 	{
35 35
 		$potentiallyAffected = $this->db->createCommand("SELECT `class_type`, `member_ref` FROM `dds_member` WHERE `data_type_ref`='textlong'")->queryAll();
36
-		if (count($potentiallyAffected)==0)
37
-			return;
36
+		if (count($potentiallyAffected)==0) {
37
+					return;
38
+		}
38 39
 		$classes = [];
39
-		foreach ($potentiallyAffected as $pa)
40
-			$classes[$pa['class_type']][] = $pa['member_ref'];
40
+		foreach ($potentiallyAffected as $pa) {
41
+					$classes[$pa['class_type']][] = $pa['member_ref'];
42
+		}
41 43
 		$phoebeClasses = array_keys($classes);
42 44
 		$phoebe = neon('phoebe')->getIPhoebeType('daedalus');
43 45
 
44 46
 		$phoebeDefinition = [];
45
-		foreach ($phoebeClasses as $pc)
46
-			$phoebeDefinition[$pc] = $phoebe->getClass($pc, null, false);
47
+		foreach ($phoebeClasses as $pc) {
48
+					$phoebeDefinition[$pc] = $phoebe->getClass($pc, null, false);
49
+		}
47 50
 
48 51
 		$potentiallyAffectedLookup = [];
49 52
 		foreach ($potentiallyAffected as $pa) {
50
-			if (empty($potentiallyAffectedLookup[$pa['class_type']]))
51
-				$potentiallyAffectedLookup[$pa['class_type']] = [];
53
+			if (empty($potentiallyAffectedLookup[$pa['class_type']])) {
54
+							$potentiallyAffectedLookup[$pa['class_type']] = [];
55
+			}
52 56
 			$potentiallyAffectedLookup[$pa['class_type']][] = $pa['member_ref'];
53 57
 		}
54 58
 
@@ -77,8 +81,9 @@  discard block
 block discarded – undo
77 81
 				foreach ($found as $objectData) {
78 82
 					$changes = [];
79 83
 					foreach ($fields as $field) {
80
-						if (!empty($objectData[$field]) && strpos($objectData[$field],$search)!==false)
81
-							$changes[$field] = str_replace($search, $replace, $objectData[$field]);
84
+						if (!empty($objectData[$field]) && strpos($objectData[$field],$search)!==false) {
85
+													$changes[$field] = str_replace($search, $replace, $objectData[$field]);
86
+						}
82 87
 					}
83 88
 					if (count($changes)) {
84 89
 						$dds->editObject($objectData['_uuid'], $changes);
Please login to merge, or discard this patch.
neon/firefly/App.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -203,7 +203,7 @@  discard block
 block discarded – undo
203 203
 	/**
204 204
 	 * @inheritdoc
205 205
 	 */
206
-	public function getImage($uuid, $params=[])
206
+	public function getImage($uuid, $params = [])
207 207
 	{
208 208
 		return $this->fileManager->getImage($uuid, $params);
209 209
 	}
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
 	 * @param  string  $name
301 301
 	 * @return \neon\firefly\services\driveManager\interfaces\IFileSystem
302 302
 	 */
303
-	public function drive($name=null)
303
+	public function drive($name = null)
304 304
 	{
305 305
 		return $this->driveManager->drive($name);
306 306
 	}
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	/**
309 309
 	 * @inheritdoc
310 310
 	 */
311
-	public function sendFile($uuid, $download=false)
311
+	public function sendFile($uuid, $download = false)
312 312
 	{
313 313
 		return $this->fileManager->sendFile($uuid, $download);
314 314
 	}
@@ -364,7 +364,7 @@  discard block
 block discarded – undo
364 364
 	 * @param boolean $throwExceptions - whether to throw exceptions on validation failure
365 365
 	 * @return boolean
366 366
 	 */
367
-	public function isFileObjectValid($file, $throwExceptions=true)
367
+	public function isFileObjectValid($file, $throwExceptions = true)
368 368
 	{
369 369
 		if ($file instanceof IFile)
370 370
 			return true;
@@ -374,7 +374,7 @@  discard block
 block discarded – undo
374 374
 			&& method_exists($file, 'getRealPath')
375 375
 			&& method_exists($file, 'getFilename');
376 376
 		// the $file param must be an object with getRealPath and getFilename functions
377
-		if (! $objectIsValid && $throwExceptions) {
377
+		if (!$objectIsValid && $throwExceptions) {
378 378
 			throw new \InvalidArgumentException('$file param must be an object with a getRealPath and getFilename method');
379 379
 		}
380 380
 		return $objectIsValid;
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -366,8 +366,9 @@
 block discarded – undo
366 366
 	 */
367 367
 	public function isFileObjectValid($file, $throwExceptions=true)
368 368
 	{
369
-		if ($file instanceof IFile)
370
-			return true;
369
+		if ($file instanceof IFile) {
370
+					return true;
371
+		}
371 372
 		// not all objects have the privilege of implementing the IFile interface like \SplFileObject
372 373
 		// Firefly only cares about these two functions 'getRealPath' and 'getFilename'
373 374
 		$objectIsValid = is_object($file)
Please login to merge, or discard this patch.
neon/cms/components/Renderer.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -58,8 +58,8 @@  discard block
 block discarded – undo
58 58
 		$this->registerDefaultPluginHandler([$this, 'pluginHandler']);
59 59
 		// We have to set cachable to false otherwise it only caches the id output not the full rendering
60 60
 		$this->registerPlugin(Smarty::PLUGIN_FUNCTION, 'widget', ['\neon\cms\components\Widget', 'factory'], false);
61
-		$this->registerPlugin(Smarty::PLUGIN_BLOCK, 'drop_zone', [$this, 'layout'] , false);
62
-		$this->registerPlugin(Smarty::PLUGIN_FUNCTION, 'layout', [$this, 'layout'] , false);
61
+		$this->registerPlugin(Smarty::PLUGIN_BLOCK, 'drop_zone', [$this, 'layout'], false);
62
+		$this->registerPlugin(Smarty::PLUGIN_FUNCTION, 'layout', [$this, 'layout'], false);
63 63
 
64 64
 		$this->registerPlugin(Smarty::PLUGIN_FUNCTION, 'asset', [$this, 'asset']);
65 65
 		$this->registerPlugin(Smarty::PLUGIN_FUNCTION, 'dds', ['\neon\cms\components\Daedalus', 'dds'], false);
@@ -230,7 +230,7 @@  discard block
 block discarded – undo
230 230
 	 * @throws \InvalidArgumentException if no page object is currently set and no id was specified
231 231
 	 * @return string  the page URL
232 232
 	 */
233
-	public function page_url($params, $smarty=null)
233
+	public function page_url($params, $smarty = null)
234 234
 	{
235 235
 		$id = Arr::get($params, 'id', Arr::get($params, 'nice', false));
236 236
 		if ($id === '#') return '#';
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 	{
266 266
 		$pages = Arr::getRequired($params, 'id');
267 267
 		$allPages = is_array($pages) ? $pages : [$pages];
268
-		$urls = []; foreach ($allPages as $page) $urls[] =  $this->page_url(['id' => $page]);
268
+		$urls = []; foreach ($allPages as $page) $urls[] = $this->page_url(['id' => $page]);
269 269
 		return Url::isUrl($urls);
270 270
 	}
271 271
 
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			//
281 281
 
282 282
 
283
-			return 'hello  -- ' . $content . '---';
283
+			return 'hello  -- '.$content.'---';
284 284
 
285 285
 		}
286 286
 	}
Please login to merge, or discard this patch.
Braces   +21 added lines, -12 removed lines patch added patch discarded remove patch
@@ -34,12 +34,14 @@  discard block
 block discarded – undo
34 34
 		// set up the theme directories
35 35
 		foreach ($themeHierarchy as $theme) {
36 36
 			if (isset($theme['templates'])) {
37
-				foreach ($theme['templates'] as $tplDir)
38
-					$this->addTemplateDir($tplDir);
37
+				foreach ($theme['templates'] as $tplDir) {
38
+									$this->addTemplateDir($tplDir);
39
+				}
39 40
 			}
40 41
 			if (isset($theme['plugins'])) {
41
-				foreach ($theme['plugins'] as $pluginDir)
42
-					$this->addPluginsDir($pluginDir);
42
+				foreach ($theme['plugins'] as $pluginDir) {
43
+									$this->addPluginsDir($pluginDir);
44
+				}
43 45
 			}
44 46
 		}
45 47
 
@@ -153,8 +155,9 @@  discard block
 block discarded – undo
153 155
 		$this->assign('site', $this->_page->getSiteData());
154 156
 
155 157
 		// an expensive-ish call so reduce need for it in repeated renders
156
-		if (!isset($templates[$template]))
157
-			$templates[$template] = $this->createTemplate($template);
158
+		if (!isset($templates[$template])) {
159
+					$templates[$template] = $this->createTemplate($template);
160
+		}
158 161
 		$tpl = $templates[$template];
159 162
 
160 163
 		// reset any parameters for the new render
@@ -233,7 +236,9 @@  discard block
 block discarded – undo
233 236
 	public function page_url($params, $smarty=null)
234 237
 	{
235 238
 		$id = Arr::get($params, 'id', Arr::get($params, 'nice', false));
236
-		if ($id === '#') return '#';
239
+		if ($id === '#') {
240
+			return '#';
241
+		}
237 242
 		if ($id) {
238 243
 			$url = $this->getPage()->getUrlOfPageByNiceId($id);
239 244
 		} else if (!$id && $this->getPage()->hasPage()) {
@@ -241,11 +246,13 @@  discard block
 block discarded – undo
241 246
 		} else {
242 247
 			throw new \InvalidArgumentException('There is no current page - and no id or nice parameter was specified');
243 248
 		}
244
-		if (!empty($params['prefix']))
245
-			$url = $params['prefix'].$url;
249
+		if (!empty($params['prefix'])) {
250
+					$url = $params['prefix'].$url;
251
+		}
246 252
 
247
-		if (isset($params['full']))
248
-			return url_base()."$url";
253
+		if (isset($params['full'])) {
254
+					return url_base()."$url";
255
+		}
249 256
 		return $url;
250 257
 	}
251 258
 
@@ -265,7 +272,9 @@  discard block
 block discarded – undo
265 272
 	{
266 273
 		$pages = Arr::getRequired($params, 'id');
267 274
 		$allPages = is_array($pages) ? $pages : [$pages];
268
-		$urls = []; foreach ($allPages as $page) $urls[] =  $this->page_url(['id' => $page]);
275
+		$urls = []; foreach ($allPages as $page) {
276
+			$urls[] =  $this->page_url(['id' => $page]);
277
+		}
269 278
 		return Url::isUrl($urls);
270 279
 	}
271 280
 
Please login to merge, or discard this patch.
neon/cms/components/CmsUrlRule.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
 	protected function loadUrl($id, $field)
129 129
 	{
130 130
 		$url = CmsUrl::find()->select("cms_url.*, cms_page.id as page_id")
131
-			->innerJoin('cms_page','`cms_page`.`nice_id`=`cms_url`.`nice_id`')
131
+			->innerJoin('cms_page', '`cms_page`.`nice_id`=`cms_url`.`nice_id`')
132 132
 			->where([$field => $id])->asArray()->one();
133 133
 		if ($url)
134 134
 			$this->storeUrl($url);
@@ -141,12 +141,12 @@  discard block
 block discarded – undo
141 141
 	 * added using @see loadUrlByPageId
142 142
 	 * @param integer $limit  max number to load in
143 143
 	 */
144
-	protected function loadUrls($limit=500)
144
+	protected function loadUrls($limit = 500)
145 145
 	{
146 146
 		if ($this->_allUrlsByPageId === null) {
147 147
 			$urls = CmsUrl::find()
148 148
 				->select("cms_url.*, cms_page.id as page_id")
149
-				->innerJoin('cms_page','`cms_page`.`nice_id`=`cms_url`.`nice_id`')
149
+				->innerJoin('cms_page', '`cms_page`.`nice_id`=`cms_url`.`nice_id`')
150 150
 				->asArray()->limit($limit)->all();
151 151
 			$this->_allUrlsByPageId = [];
152 152
 			foreach ($urls as $u) {
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -24,8 +24,9 @@  discard block
 block discarded – undo
24 24
 	{
25 25
 		$pathInfo = $this->getCanonicalPathFromRequest($request);
26 26
 		$found = neon('cms')->page->setByUrl($pathInfo);
27
-		if ($found)
28
-			$pageData = neon('cms')->page->getPageData();
27
+		if ($found) {
28
+					$pageData = neon('cms')->page->getPageData();
29
+		}
29 30
 		return $found ? [$this->cmsRoute, ['nice_id' => $pageData['nice_id']]] : false;
30 31
 	}
31 32
 
@@ -101,8 +102,9 @@  discard block
 block discarded – undo
101 102
 	protected function loadUrlByPageId($id)
102 103
 	{
103 104
 		$this->loadUrls();
104
-		if (isset($this->_allUrlsByPageId[$id]))
105
-			return $this->_allUrlsByPageId[$id];
105
+		if (isset($this->_allUrlsByPageId[$id])) {
106
+					return $this->_allUrlsByPageId[$id];
107
+		}
106 108
 		return $this->loadUrl($id, 'cms_page.id');
107 109
 	}
108 110
 
@@ -114,8 +116,9 @@  discard block
 block discarded – undo
114 116
 	protected function loadUrlByNiceId($id)
115 117
 	{
116 118
 		$this->loadUrls();
117
-		if (isset($this->_allUrlsByNiceId[$id]))
118
-			return $this->_allUrlsByNiceId[$id];
119
+		if (isset($this->_allUrlsByNiceId[$id])) {
120
+					return $this->_allUrlsByNiceId[$id];
121
+		}
119 122
 		return $this->loadUrl($id, 'cms_url.nice_id');
120 123
 	}
121 124
 
@@ -130,8 +133,9 @@  discard block
 block discarded – undo
130 133
 		$url = CmsUrl::find()->select("cms_url.*, cms_page.id as page_id")
131 134
 			->innerJoin('cms_page','`cms_page`.`nice_id`=`cms_url`.`nice_id`')
132 135
 			->where([$field => $id])->asArray()->one();
133
-		if ($url)
134
-			$this->storeUrl($url);
136
+		if ($url) {
137
+					$this->storeUrl($url);
138
+		}
135 139
 		return $url;
136 140
 	}
137 141
 
Please login to merge, or discard this patch.