Completed
Push — 1.1 ( bc909e...b4f471 )
by Robbie
17:02 queued 09:09
created
code/pagetypes/DatedUpdateHolder.php 1 patch
Braces   +30 added lines, -10 removed lines patch added patch discarded remove patch
@@ -313,13 +313,25 @@  discard block
 block discarded – undo
313 313
 		$year = $this->request->getVar('year');
314 314
 		$month = $this->request->getVar('month');
315 315
 
316
-		if ($tag=='') $tag = null;
317
-		if ($from=='') $from = null;
318
-		if ($to=='') $to = null;
319
-		if ($year=='') $year = null;
320
-		if ($month=='') $month = null;
316
+		if ($tag=='') {
317
+			$tag = null;
318
+		}
319
+		if ($from=='') {
320
+			$from = null;
321
+		}
322
+		if ($to=='') {
323
+			$to = null;
324
+		}
325
+		if ($year=='') {
326
+			$year = null;
327
+		}
328
+		if ($month=='') {
329
+			$month = null;
330
+		}
321 331
 
322
-		if (isset($tag)) $tag = (int)$tag;
332
+		if (isset($tag)) {
333
+			$tag = (int)$tag;
334
+		}
323 335
 		if (isset($from)) {
324 336
 			$from = urldecode($from);
325 337
 			$parser = new SS_Datetime;
@@ -332,8 +344,12 @@  discard block
 block discarded – undo
332 344
 			$parser->setValue($to);
333 345
 			$to = $parser->Format('Y-m-d');
334 346
 		}
335
-		if (isset($year)) $year = (int)$year;
336
-		if (isset($month)) $month = (int)$month;
347
+		if (isset($year)) {
348
+			$year = (int)$year;
349
+		}
350
+		if (isset($month)) {
351
+			$month = (int)$month;
352
+		}
337 353
 
338 354
 		// If only "To" has been provided filter by single date. Normalise by swapping with "From".
339 355
 		if (isset($to) && !isset($from)) {
@@ -499,7 +515,9 @@  discard block
 block discarded – undo
499 515
 		// Build the link - keep the tag, but reset month, year and pagination.
500 516
 		$link = HTTP::setGetVar('from', $params['from'], $this->AbsoluteLink(), '&');
501 517
 		$link = HTTP::setGetVar('to', $params['to'], $link, '&');
502
-		if (isset($params['tag'])) $link = HTTP::setGetVar('tag', $params['tag'], $link, '&');
518
+		if (isset($params['tag'])) {
519
+			$link = HTTP::setGetVar('tag', $params['tag'], $link, '&');
520
+		}
503 521
 
504 522
 		$this->redirect($link);
505 523
 	}
@@ -509,7 +527,9 @@  discard block
 block discarded – undo
509 527
 
510 528
 		// Reset the link - only include the tag.
511 529
 		$link = $this->AbsoluteLink();
512
-		if (isset($params['tag'])) $link = HTTP::setGetVar('tag', $params['tag'], $link, '&');
530
+		if (isset($params['tag'])) {
531
+			$link = HTTP::setGetVar('tag', $params['tag'], $link, '&');
532
+		}
513 533
 
514 534
 		$this->redirect($link);
515 535
 	}
Please login to merge, or discard this patch.
code/extensions/CwpWorkflowDefinitionExtension.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,7 +17,9 @@
 block discarded – undo
17 17
 		if(Config::inst()->get('CwpWorkflowDefinitionExtension', 'create_default_workflow')) {
18 18
 			// Only proceed if a definition using this template has not been created yet
19 19
 			$definition = WorkflowDefinition::get()->filter("Template", "Review and Approve")->First();
20
-			if($definition && $definition->exists()) return;
20
+			if($definition && $definition->exists()) {
21
+				return;
22
+			}
21 23
 
22 24
 			//generate from the template, which happens after we write the definition
23 25
 			$definition = WorkflowDefinition::create();
Please login to merge, or discard this patch.
code/model/CarouselItem.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,9 @@
 block discarded – undo
77 77
 	}
78 78
 
79 79
 	public function ArchivedReadable(){
80
-		if($this->Archived == 1) return _t('GridField.Archived', 'Archived');
80
+		if($this->Archived == 1) {
81
+			return _t('GridField.Archived', 'Archived');
82
+		}
81 83
 		return _t('GridField.Live', 'Live');
82 84
 	}
83 85
 }
Please login to merge, or discard this patch.
code/pagetypes/BasePage.php 1 patch
Braces   +23 added lines, -8 removed lines patch added patch discarded remove patch
@@ -60,7 +60,9 @@  discard block
 block discarded – undo
60 60
 		$baseName = sprintf('%s-%s', $this->URLSegment, $this->ID);
61 61
 
62 62
 		$folderPath = Config::inst()->get('BasePage', 'generated_pdf_path');
63
-		if($folderPath[0] != '/') $folderPath = BASE_PATH . '/' . $folderPath;
63
+		if($folderPath[0] != '/') {
64
+			$folderPath = BASE_PATH . '/' . $folderPath;
65
+		}
64 66
 
65 67
 		return sprintf('%s/%s.pdf', $folderPath, $baseName);
66 68
 	}
@@ -69,7 +71,9 @@  discard block
 block discarded – undo
69 71
 	 * Build pdf link for template.
70 72
 	 */
71 73
 	public function PdfLink() {
72
-		if(!Config::inst()->get('BasePage', 'pdf_export')) return false;
74
+		if(!Config::inst()->get('BasePage', 'pdf_export')) {
75
+			return false;
76
+		}
73 77
 
74 78
 		$path = $this->getPdfFilename();
75 79
 
@@ -106,7 +110,9 @@  discard block
 block discarded – undo
106 110
 	 * @return boolean
107 111
 	 */
108 112
 	public function doUnpublish() {
109
-		if(!parent::doUnpublish()) return false;
113
+		if(!parent::doUnpublish()) {
114
+			return false;
115
+		}
110 116
 
111 117
 		$filepath = $this->getPdfFilename();
112 118
 		if(file_exists($filepath)) {
@@ -228,8 +234,11 @@  discard block
 block discarded – undo
228 234
 			)));
229 235
 		}
230 236
 
231
-		if ($translations->count()>1) return $translations;
232
-		else return null;
237
+		if ($translations->count()>1) {
238
+			return $translations;
239
+		} else {
240
+			return null;
241
+		}
233 242
 	}
234 243
 
235 244
 }
@@ -274,7 +283,9 @@  discard block
 block discarded – undo
274 283
 	 * Serve the page rendered as PDF.
275 284
 	 */
276 285
 	public function downloadpdf() {
277
-		if(!Config::inst()->get('BasePage', 'pdf_export')) return false;
286
+		if(!Config::inst()->get('BasePage', 'pdf_export')) {
287
+			return false;
288
+		}
278 289
 
279 290
 		// We only allow producing live pdf. There is no way to secure the draft files.
280 291
 		Versioned::reading_stage('Live');
@@ -291,7 +302,9 @@  discard block
 block discarded – undo
291 302
 	 * Render the page as PDF using wkhtmltopdf.
292 303
 	 */
293 304
 	public function generatePDF() {
294
-		if(!Config::inst()->get('BasePage', 'pdf_export')) return false;
305
+		if(!Config::inst()->get('BasePage', 'pdf_export')) {
306
+			return false;
307
+		}
295 308
 
296 309
 		$binaryPath = Config::inst()->get('BasePage', 'wkhtmltopdf_binary');
297 310
 		if(!$binaryPath || !is_executable($binaryPath)) {
@@ -316,7 +329,9 @@  discard block
 block discarded – undo
316 329
 		$footerFile = str_replace('.pdf', '_pdffooter.html', $pdfFile);
317 330
 
318 331
 		// make sure the work directory exists
319
-		if(!file_exists(dirname($pdfFile))) Filesystem::makeFolder(dirname($pdfFile));
332
+		if(!file_exists(dirname($pdfFile))) {
333
+			Filesystem::makeFolder(dirname($pdfFile));
334
+		}
320 335
 
321 336
 		// Force http protocol on CWP - fetching from localhost without using the proxy, SSL terminates on gateway.
322 337
 		if (defined('CWP_ENVIRONMENT')) {
Please login to merge, or discard this patch.
tasks/CleanupGeneratedPdf.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,9 @@
 block discarded – undo
8 8
 
9 9
 	public function run($request) {
10 10
 		$path = sprintf('%s/%s', BASE_PATH, BasePage::config()->generated_pdf_path);
11
-		if(!file_exists($path)) return false;
11
+		if(!file_exists($path)) {
12
+			return false;
13
+		}
12 14
 
13 15
 		exec(sprintf('rm %s/*', $path), $output, $return_val);
14 16
 
Please login to merge, or discard this patch.