| @@ -34,7 +34,7 @@ discard block | ||
| 34 | 34 | $url = parse_url($this->ExternalLink); | 
| 35 | 35 | |
| 36 | 36 | // if no scheme set in the link, default to http | 
| 37 | -			if(!isset($url['scheme'])) { | |
| 37 | +			if (!isset($url['scheme'])) { | |
| 38 | 38 | return 'http://' . $this->ExternalLink; | 
| 39 | 39 | } | 
| 40 | 40 | |
| @@ -72,7 +72,7 @@ discard block | ||
| 72 | 72 |  		$fields->removeByName('SortOrder'); | 
| 73 | 73 |  		$externalLinkField->addExtraClass('noBorder'); | 
| 74 | 74 | |
| 75 | -		$fields->addFieldToTab('Root.Main',CompositeField::create( | |
| 75 | +		$fields->addFieldToTab('Root.Main', CompositeField::create( | |
| 76 | 76 | array( | 
| 77 | 77 | TreeDropdownField::create( | 
| 78 | 78 | 'InternalLinkID', | 
| @@ -83,7 +83,7 @@ discard block | ||
| 83 | 83 | $wrap = CompositeField::create( | 
| 84 | 84 | $extraLabel = LiteralField::create( | 
| 85 | 85 | 'NoteOverride', | 
| 86 | -						_t('Quicklink.Note','<div class="message good notice">Note:  If you specify an External Link, the Internal Link will be ignored.</div>') | |
| 86 | +						_t('Quicklink.Note', '<div class="message good notice">Note:  If you specify an External Link, the Internal Link will be ignored.</div>') | |
| 87 | 87 | ) | 
| 88 | 88 | ) | 
| 89 | 89 | ) | 
| @@ -10,7 +10,7 @@ discard block | ||
| 10 | 10 | |
| 11 | 11 | static $icon = 'cwp/images/icons/sitetree_images/event_page.png'; | 
| 12 | 12 | |
| 13 | - public $pageIcon = 'images/icons/sitetree_images/event_page.png'; | |
| 13 | + public $pageIcon = 'images/icons/sitetree_images/event_page.png'; | |
| 14 | 14 | |
| 15 | 15 | private static $singular_name = 'Event Page'; | 
| 16 | 16 | |
| @@ -35,15 +35,15 @@ discard block | ||
| 35 | 35 | * Add the default for the Date being the current day. | 
| 36 | 36 | */ | 
| 37 | 37 |  	public function populateDefaults() { | 
| 38 | -		if(!isset($this->Date) || $this->Date === null) { | |
| 38 | +		if (!isset($this->Date) || $this->Date === null) { | |
| 39 | 39 |  			$this->Date = SS_Datetime::now()->Format('Y-m-d'); | 
| 40 | 40 | } | 
| 41 | 41 | |
| 42 | -		if(!isset($this->StartTime) || $this->StartTime === null) { | |
| 42 | +		if (!isset($this->StartTime) || $this->StartTime === null) { | |
| 43 | 43 | $this->StartTime = '09:00:00'; | 
| 44 | 44 | } | 
| 45 | 45 | |
| 46 | -		if(!isset($this->EndTime) || $this->EndTime === null) { | |
| 46 | +		if (!isset($this->EndTime) || $this->EndTime === null) { | |
| 47 | 47 | $this->EndTime = '17:00:00'; | 
| 48 | 48 | } | 
| 49 | 49 | |
| @@ -51,7 +51,7 @@ discard block | ||
| 51 | 51 | } | 
| 52 | 52 | |
| 53 | 53 |  	public function getCMSFields() { | 
| 54 | -		$this->beforeUpdateCMSFields(function (FieldList $fields) { | |
| 54 | +		$this->beforeUpdateCMSFields(function(FieldList $fields) { | |
| 55 | 55 |  			$fields->removeByName('Date'); | 
| 56 | 56 | |
| 57 | 57 | $dateTimeFields = array(); | 
| @@ -19,7 +19,7 @@ discard block | ||
| 19 | 19 | ); | 
| 20 | 20 | |
| 21 | 21 |  	public function Page($link) { | 
| 22 | -		if($link instanceof SS_HTTPRequest) { | |
| 22 | +		if ($link instanceof SS_HTTPRequest) { | |
| 23 | 23 |  			Deprecation::notice('2.0', 'Using page() as a url handler is deprecated. Use showpage() action instead'); | 
| 24 | 24 | return $this->showpage($link); | 
| 25 | 25 | } | 
| @@ -28,18 +28,18 @@ discard block | ||
| 28 | 28 | |
| 29 | 29 |  	public function showpage($request) { | 
| 30 | 30 |  		$id = (int) $request->param('ID'); | 
| 31 | -		if(!$id) { | |
| 31 | +		if (!$id) { | |
| 32 | 32 | return false; | 
| 33 | 33 | } | 
| 34 | 34 | $page = SiteTree::get()->byId($id); | 
| 35 | 35 | |
| 36 | 36 | // does the page exist? | 
| 37 | -		if(!($page && $page->exists())) { | |
| 37 | +		if (!($page && $page->exists())) { | |
| 38 | 38 | return $this->httpError(404); | 
| 39 | 39 | } | 
| 40 | 40 | |
| 41 | 41 | // can the page be viewed? | 
| 42 | -		if(!$page->canView()) { | |
| 42 | +		if (!$page->canView()) { | |
| 43 | 43 | return $this->httpError(403); | 
| 44 | 44 | } | 
| 45 | 45 | |
| @@ -49,7 +49,7 @@ discard block | ||
| 49 | 49 | 'Children' => $page->Children() | 
| 50 | 50 | )); | 
| 51 | 51 | |
| 52 | -		if($request->isAjax()) { | |
| 52 | +		if ($request->isAjax()) { | |
| 53 | 53 |  			return $viewer->renderWith('SitemapNodeChildren'); | 
| 54 | 54 |  		} else { | 
| 55 | 55 | return $viewer; | 
| @@ -250,22 +250,22 @@ | ||
| 250 | 250 | } | 
| 251 | 251 | |
| 252 | 252 | /** | 
| 253 | - * Returns the native language name for the selected locale/language, empty string if Translatable is not available | |
| 254 | - * | |
| 255 | - * @return string | |
| 256 | - */ | |
| 257 | - public function getSelectedLanguage() | |
| 258 | -    { | |
| 259 | -        if (!class_exists('Translatable')) { | |
| 260 | - return ''; | |
| 261 | - } | |
| 262 | - | |
| 263 | -        $language = explode('_', Translatable::get_current_locale()); | |
| 264 | - $languageCode = array_shift($language); | |
| 265 | - $nativeName = i18n::get_language_name($languageCode, true); | |
| 266 | - | |
| 267 | - return $nativeName; | |
| 268 | - } | |
| 253 | + * Returns the native language name for the selected locale/language, empty string if Translatable is not available | |
| 254 | + * | |
| 255 | + * @return string | |
| 256 | + */ | |
| 257 | + public function getSelectedLanguage() | |
| 258 | +	{ | |
| 259 | +		if (!class_exists('Translatable')) { | |
| 260 | + return ''; | |
| 261 | + } | |
| 262 | + | |
| 263 | +		$language = explode('_', Translatable::get_current_locale()); | |
| 264 | + $languageCode = array_shift($language); | |
| 265 | + $nativeName = i18n::get_language_name($languageCode, true); | |
| 266 | + | |
| 267 | + return $nativeName; | |
| 268 | + } | |
| 269 | 269 | } | 
| 270 | 270 | |
| 271 | 271 |  class BasePage_Controller extends ContentController { | 
| @@ -66,7 +66,7 @@ discard block | ||
| 66 | 66 |  		$baseName = sprintf('%s-%s', $this->URLSegment, $this->ID); | 
| 67 | 67 | |
| 68 | 68 |  		$folderPath = Config::inst()->get('BasePage', 'generated_pdf_path'); | 
| 69 | - if($folderPath[0] != '/') $folderPath = BASE_PATH . '/' . $folderPath; | |
| 69 | + if ($folderPath[0] != '/') $folderPath = BASE_PATH . '/' . $folderPath; | |
| 70 | 70 | |
| 71 | 71 |  		return sprintf('%s/%s.pdf', $folderPath, $baseName); | 
| 72 | 72 | } | 
| @@ -75,11 +75,11 @@ discard block | ||
| 75 | 75 | * Build pdf link for template. | 
| 76 | 76 | */ | 
| 77 | 77 |  	public function PdfLink() { | 
| 78 | -		if(!Config::inst()->get('BasePage', 'pdf_export')) return false; | |
| 78 | +		if (!Config::inst()->get('BasePage', 'pdf_export')) return false; | |
| 79 | 79 | |
| 80 | 80 | $path = $this->getPdfFilename(); | 
| 81 | 81 | |
| 82 | -		if((Versioned::current_stage() == 'Live') && file_exists($path)) { | |
| 82 | +		if ((Versioned::current_stage() == 'Live') && file_exists($path)) { | |
| 83 | 83 |  			return Director::baseURL() . preg_replace('#^/#', '', Director::makeRelative($path)); | 
| 84 | 84 |  		} else { | 
| 85 | 85 |  			return $this->Link('downloadpdf'); | 
| @@ -100,7 +100,7 @@ discard block | ||
| 100 | 100 | */ | 
| 101 | 101 |  	public function onAfterPublish(&$original) { | 
| 102 | 102 | $filepath = $this->getPdfFilename(); | 
| 103 | -		if(file_exists($filepath)) { | |
| 103 | +		if (file_exists($filepath)) { | |
| 104 | 104 | unlink($filepath); | 
| 105 | 105 | } | 
| 106 | 106 | } | 
| @@ -112,10 +112,10 @@ discard block | ||
| 112 | 112 | * @return boolean | 
| 113 | 113 | */ | 
| 114 | 114 |  	public function doUnpublish() { | 
| 115 | - if(!parent::doUnpublish()) return false; | |
| 115 | + if (!parent::doUnpublish()) return false; | |
| 116 | 116 | |
| 117 | 117 | $filepath = $this->getPdfFilename(); | 
| 118 | -		if(file_exists($filepath)) { | |
| 118 | +		if (file_exists($filepath)) { | |
| 119 | 119 | unlink($filepath); | 
| 120 | 120 | } | 
| 121 | 121 | |
| @@ -135,7 +135,7 @@ discard block | ||
| 135 | 135 | } | 
| 136 | 136 | |
| 137 | 137 |  	public function getCMSFields() { | 
| 138 | -		$this->beforeUpdateCMSFields(function (FieldList $fields) { | |
| 138 | +		$this->beforeUpdateCMSFields(function(FieldList $fields) { | |
| 139 | 139 | // Related Pages | 
| 140 | 140 | $components = GridFieldConfig_RelationEditor::create(); | 
| 141 | 141 |  			$components->removeComponentsByType('GridFieldAddNewButton'); | 
| @@ -151,20 +151,20 @@ discard block | ||
| 151 | 151 | |
| 152 | 152 | $fields->findOrMakeTab( | 
| 153 | 153 | 'Root.RelatedPages', | 
| 154 | -				_t('BasePage.RelatedPages','Related pages') | |
| 154 | +				_t('BasePage.RelatedPages', 'Related pages') | |
| 155 | 155 | ); | 
| 156 | 156 | $fields->addFieldToTab( | 
| 157 | 157 | 'Root.RelatedPages', | 
| 158 | 158 | GridField::create( | 
| 159 | 159 | 'RelatedPages', | 
| 160 | -					_t('BasePage.RelatedPages','Related pages'), | |
| 160 | +					_t('BasePage.RelatedPages', 'Related pages'), | |
| 161 | 161 | $this->RelatedPages(), | 
| 162 | 162 | $components | 
| 163 | 163 | ) | 
| 164 | 164 | ); | 
| 165 | 165 | |
| 166 | 166 | // Taxonomies - Unless they have their own 'Tags' field (such as in Blog, etc) | 
| 167 | -			if(!$this->has_many('Tags') && !$this->many_many('Tags')) { | |
| 167 | +			if (!$this->has_many('Tags') && !$this->many_many('Tags')) { | |
| 168 | 168 | $components = GridFieldConfig_RelationEditor::create(); | 
| 169 | 169 |  				$components->removeComponentsByType('GridFieldAddNewButton'); | 
| 170 | 170 |  				$components->removeComponentsByType('GridFieldEditButton'); | 
| @@ -174,8 +174,8 @@ discard block | ||
| 174 | 174 | |
| 175 | 175 |  				$dataColumns = $components->getComponentByType('GridFieldDataColumns'); | 
| 176 | 176 | $dataColumns->setDisplayFields(array( | 
| 177 | -					'Name' => _t('BasePage.Term','Term'), | |
| 178 | -					'TaxonomyName' => _t('BasePage.Taxonomy','Taxonomy') | |
| 177 | +					'Name' => _t('BasePage.Term', 'Term'), | |
| 178 | +					'TaxonomyName' => _t('BasePage.Taxonomy', 'Taxonomy') | |
| 179 | 179 | )); | 
| 180 | 180 | |
| 181 | 181 |  				$fields->findOrMakeTab('Root.Tags', _t('BasePage.TagsTabTitle', 'Tags')); | 
| @@ -183,7 +183,7 @@ discard block | ||
| 183 | 183 | 'Root.Tags', | 
| 184 | 184 | TreeMultiselectField::create( | 
| 185 | 185 | 'Terms', | 
| 186 | -						_t('BasePage.Terms','Terms'), | |
| 186 | +						_t('BasePage.Terms', 'Terms'), | |
| 187 | 187 | 'TaxonomyTerm' | 
| 188 | 188 |  					)->setDescription(_t('BasePage.TermsDescription', 'Click to search for additional terms')) | 
| 189 | 189 | ); | 
| @@ -200,7 +200,7 @@ discard block | ||
| 200 | 200 | */ | 
| 201 | 201 |  	public function getAvailableTranslations() { | 
| 202 | 202 | |
| 203 | -		if(!class_exists('Translatable')){ | |
| 203 | +		if (!class_exists('Translatable')) { | |
| 204 | 204 | return false; | 
| 205 | 205 | } | 
| 206 | 206 | |
| @@ -241,11 +241,11 @@ discard block | ||
| 241 | 241 | 'Locale' => i18n::convert_rfc1766($loc), | 
| 242 | 242 | 'LangName' => $nativeLangName, | 
| 243 | 243 | 'Link' => $link, | 
| 244 | - 'Current' => (Translatable::get_current_locale()==$loc) | |
| 244 | + 'Current' => (Translatable::get_current_locale() == $loc) | |
| 245 | 245 | ))); | 
| 246 | 246 | } | 
| 247 | 247 | |
| 248 | - if ($translations->count()>1) return $translations; | |
| 248 | + if ($translations->count() > 1) return $translations; | |
| 249 | 249 | else return null; | 
| 250 | 250 | } | 
| 251 | 251 | |
| @@ -308,13 +308,13 @@ discard block | ||
| 308 | 308 | * Serve the page rendered as PDF. | 
| 309 | 309 | */ | 
| 310 | 310 |  	public function downloadpdf() { | 
| 311 | -		if(!Config::inst()->get('BasePage', 'pdf_export')) return false; | |
| 311 | +		if (!Config::inst()->get('BasePage', 'pdf_export')) return false; | |
| 312 | 312 | |
| 313 | 313 | // We only allow producing live pdf. There is no way to secure the draft files. | 
| 314 | 314 |  		Versioned::reading_stage('Live'); | 
| 315 | 315 | |
| 316 | 316 | $path = $this->dataRecord->getPdfFilename(); | 
| 317 | -		if(!file_exists($path)) { | |
| 317 | +		if (!file_exists($path)) { | |
| 318 | 318 | $this->generatePDF(); | 
| 319 | 319 | } | 
| 320 | 320 | |
| @@ -327,11 +327,11 @@ discard block | ||
| 327 | 327 | */ | 
| 328 | 328 |  	public function getPDFBaseURL() { | 
| 329 | 329 | //if base url YML is defined in YML, use that | 
| 330 | -		if(Config::inst()->get('BasePage', 'pdf_base_url')){ | |
| 331 | -			$pdf_base_url = Config::inst()->get('BasePage', 'pdf_base_url').'/'; | |
| 330 | +		if (Config::inst()->get('BasePage', 'pdf_base_url')) { | |
| 331 | +			$pdf_base_url = Config::inst()->get('BasePage', 'pdf_base_url') . '/'; | |
| 332 | 332 | //otherwise, if we are CWP use the secure domain | 
| 333 | -		} elseif (defined('CWP_SECURE_DOMAIN')){ | |
| 334 | - $pdf_base_url = CWP_SECURE_DOMAIN.'/'; | |
| 333 | +		} elseif (defined('CWP_SECURE_DOMAIN')) { | |
| 334 | + $pdf_base_url = CWP_SECURE_DOMAIN . '/'; | |
| 335 | 335 | //or if neither, leave blank | 
| 336 | 336 |  		} else { | 
| 337 | 337 | $pdf_base_url = ''; | 
| @@ -344,7 +344,7 @@ discard block | ||
| 344 | 344 | * Or if we aren't on a CWP server | 
| 345 | 345 | */ | 
| 346 | 346 |  	public function getPDFProxy($pdf_base_url) { | 
| 347 | -		if (!defined('CWP_SECURE_DOMAIN') || $pdf_base_url == CWP_SECURE_DOMAIN.'/') { | |
| 347 | +		if (!defined('CWP_SECURE_DOMAIN') || $pdf_base_url == CWP_SECURE_DOMAIN . '/') { | |
| 348 | 348 | $proxy = ''; | 
| 349 | 349 |  		} else { | 
| 350 | 350 | $proxy = ' --proxy ' . SS_OUTBOUND_PROXY . ':' . SS_OUTBOUND_PROXY_PORT; | 
| @@ -356,20 +356,20 @@ discard block | ||
| 356 | 356 | * Render the page as PDF using wkhtmltopdf. | 
| 357 | 357 | */ | 
| 358 | 358 |  	public function generatePDF() { | 
| 359 | -		if(!Config::inst()->get('BasePage', 'pdf_export')) return false; | |
| 359 | +		if (!Config::inst()->get('BasePage', 'pdf_export')) return false; | |
| 360 | 360 | |
| 361 | 361 |  		$binaryPath = Config::inst()->get('BasePage', 'wkhtmltopdf_binary'); | 
| 362 | -		if(!$binaryPath || !is_executable($binaryPath)) { | |
| 363 | -			if(defined('WKHTMLTOPDF_BINARY') && is_executable(WKHTMLTOPDF_BINARY)) { | |
| 362 | +		if (!$binaryPath || !is_executable($binaryPath)) { | |
| 363 | +			if (defined('WKHTMLTOPDF_BINARY') && is_executable(WKHTMLTOPDF_BINARY)) { | |
| 364 | 364 | $binaryPath = WKHTMLTOPDF_BINARY; | 
| 365 | 365 | } | 
| 366 | 366 | } | 
| 367 | 367 | |
| 368 | -		if(!$binaryPath) { | |
| 368 | +		if (!$binaryPath) { | |
| 369 | 369 |  			user_error('Neither WKHTMLTOPDF_BINARY nor BasePage.wkhtmltopdf_binary are defined', E_USER_ERROR); | 
| 370 | 370 | } | 
| 371 | 371 | |
| 372 | -		if(Versioned::get_reading_mode() == 'Stage.Stage') { | |
| 372 | +		if (Versioned::get_reading_mode() == 'Stage.Stage') { | |
| 373 | 373 |  			user_error('Generating PDFs on draft is not supported', E_USER_ERROR); | 
| 374 | 374 | } | 
| 375 | 375 | |
| @@ -381,7 +381,7 @@ discard block | ||
| 381 | 381 |  		$footerFile = str_replace('.pdf', '_pdffooter.html', $pdfFile); | 
| 382 | 382 | |
| 383 | 383 | // make sure the work directory exists | 
| 384 | - if(!file_exists(dirname($pdfFile))) Filesystem::makeFolder(dirname($pdfFile)); | |
| 384 | + if (!file_exists(dirname($pdfFile))) Filesystem::makeFolder(dirname($pdfFile)); | |
| 385 | 385 | |
| 386 | 386 | //decide the domain to use in generation | 
| 387 | 387 | $pdf_base_url = $this->getPDFBaseURL(); | 
| @@ -391,8 +391,8 @@ discard block | ||
| 391 | 391 | Config::inst()->nest(); | 
| 392 | 392 |  			Config::inst()->update('Director', 'alternate_protocol', 'http'); | 
| 393 | 393 | //only set alternate protocol if CWP_SECURE_DOMAIN is defined OR pdf_base_url is | 
| 394 | -			if($pdf_base_url){ | |
| 395 | -				Config::inst()->update('Director', 'alternate_base_url', 'http://'.$pdf_base_url); | |
| 394 | +			if ($pdf_base_url) { | |
| 395 | +				Config::inst()->update('Director', 'alternate_base_url', 'http://' . $pdf_base_url); | |
| 396 | 396 | } | 
| 397 | 397 | } | 
| 398 | 398 | |
| @@ -425,7 +425,7 @@ discard block | ||
| 425 | 425 | unlink($footerFile); | 
| 426 | 426 | |
| 427 | 427 | // output any errors | 
| 428 | -		if($return_val != 0) { | |
| 428 | +		if ($return_val != 0) { | |
| 429 | 429 |  			user_error('wkhtmltopdf failed: ' . implode("\n", $output), E_USER_ERROR); | 
| 430 | 430 | } | 
| 431 | 431 | |
| @@ -501,10 +501,10 @@ discard block | ||
| 501 | 501 | |
| 502 | 502 | // Customise page | 
| 503 | 503 | $response = $this->customise($properties); | 
| 504 | -		if($results) { | |
| 504 | +		if ($results) { | |
| 505 | 505 | $response = $response | 
| 506 | 506 | ->customise($results) | 
| 507 | - ->customise(array( 'Results' => $results->getResults() )); | |
| 507 | +				->customise(array('Results' => $results->getResults())); | |
| 508 | 508 | } | 
| 509 | 509 | |
| 510 | 510 | // Render | 
| @@ -66,7 +66,9 @@ discard block | ||
| 66 | 66 |  		$baseName = sprintf('%s-%s', $this->URLSegment, $this->ID); | 
| 67 | 67 | |
| 68 | 68 |  		$folderPath = Config::inst()->get('BasePage', 'generated_pdf_path'); | 
| 69 | - if($folderPath[0] != '/') $folderPath = BASE_PATH . '/' . $folderPath; | |
| 69 | +		if($folderPath[0] != '/') { | |
| 70 | + $folderPath = BASE_PATH . '/' . $folderPath; | |
| 71 | + } | |
| 70 | 72 | |
| 71 | 73 |  		return sprintf('%s/%s.pdf', $folderPath, $baseName); | 
| 72 | 74 | } | 
| @@ -75,7 +77,9 @@ discard block | ||
| 75 | 77 | * Build pdf link for template. | 
| 76 | 78 | */ | 
| 77 | 79 |  	public function PdfLink() { | 
| 78 | -		if(!Config::inst()->get('BasePage', 'pdf_export')) return false; | |
| 80 | +		if(!Config::inst()->get('BasePage', 'pdf_export')) { | |
| 81 | + return false; | |
| 82 | + } | |
| 79 | 83 | |
| 80 | 84 | $path = $this->getPdfFilename(); | 
| 81 | 85 | |
| @@ -112,7 +116,9 @@ discard block | ||
| 112 | 116 | * @return boolean | 
| 113 | 117 | */ | 
| 114 | 118 |  	public function doUnpublish() { | 
| 115 | - if(!parent::doUnpublish()) return false; | |
| 119 | +		if(!parent::doUnpublish()) { | |
| 120 | + return false; | |
| 121 | + } | |
| 116 | 122 | |
| 117 | 123 | $filepath = $this->getPdfFilename(); | 
| 118 | 124 |  		if(file_exists($filepath)) { | 
| @@ -245,8 +251,11 @@ discard block | ||
| 245 | 251 | ))); | 
| 246 | 252 | } | 
| 247 | 253 | |
| 248 | - if ($translations->count()>1) return $translations; | |
| 249 | - else return null; | |
| 254 | +		if ($translations->count()>1) { | |
| 255 | + return $translations; | |
| 256 | +		} else { | |
| 257 | + return null; | |
| 258 | + } | |
| 250 | 259 | } | 
| 251 | 260 | |
| 252 | 261 | /** | 
| @@ -308,7 +317,9 @@ discard block | ||
| 308 | 317 | * Serve the page rendered as PDF. | 
| 309 | 318 | */ | 
| 310 | 319 |  	public function downloadpdf() { | 
| 311 | -		if(!Config::inst()->get('BasePage', 'pdf_export')) return false; | |
| 320 | +		if(!Config::inst()->get('BasePage', 'pdf_export')) { | |
| 321 | + return false; | |
| 322 | + } | |
| 312 | 323 | |
| 313 | 324 | // We only allow producing live pdf. There is no way to secure the draft files. | 
| 314 | 325 |  		Versioned::reading_stage('Live'); | 
| @@ -356,7 +367,9 @@ discard block | ||
| 356 | 367 | * Render the page as PDF using wkhtmltopdf. | 
| 357 | 368 | */ | 
| 358 | 369 |  	public function generatePDF() { | 
| 359 | -		if(!Config::inst()->get('BasePage', 'pdf_export')) return false; | |
| 370 | +		if(!Config::inst()->get('BasePage', 'pdf_export')) { | |
| 371 | + return false; | |
| 372 | + } | |
| 360 | 373 | |
| 361 | 374 |  		$binaryPath = Config::inst()->get('BasePage', 'wkhtmltopdf_binary'); | 
| 362 | 375 |  		if(!$binaryPath || !is_executable($binaryPath)) { | 
| @@ -381,7 +394,9 @@ discard block | ||
| 381 | 394 |  		$footerFile = str_replace('.pdf', '_pdffooter.html', $pdfFile); | 
| 382 | 395 | |
| 383 | 396 | // make sure the work directory exists | 
| 384 | - if(!file_exists(dirname($pdfFile))) Filesystem::makeFolder(dirname($pdfFile)); | |
| 397 | +		if(!file_exists(dirname($pdfFile))) { | |
| 398 | + Filesystem::makeFolder(dirname($pdfFile)); | |
| 399 | + } | |
| 385 | 400 | |
| 386 | 401 | //decide the domain to use in generation | 
| 387 | 402 | $pdf_base_url = $this->getPDFBaseURL(); | 
| @@ -14,7 +14,7 @@ discard block | ||
| 14 | 14 | |
| 15 | 15 | private static $icon = 'cwp/images/icons/sitetree_images/event_holder.png'; | 
| 16 | 16 | |
| 17 | - public $pageIcon = 'images/icons/sitetree_images/event_holder.png'; | |
| 17 | + public $pageIcon = 'images/icons/sitetree_images/event_holder.png'; | |
| 18 | 18 | |
| 19 | 19 | private static $singular_name = 'Event Holder'; | 
| 20 | 20 | |
| @@ -58,7 +58,7 @@ discard block | ||
| 58 | 58 |  	public function getUpdateName() { | 
| 59 | 59 | $params = $this->parseParams(); | 
| 60 | 60 |  		if ($params['upcomingOnly']) { | 
| 61 | -			return _t('EventHolder.Upcoming','Upcoming events'); | |
| 61 | +			return _t('EventHolder.Upcoming', 'Upcoming events'); | |
| 62 | 62 | } | 
| 63 | 63 | |
| 64 | 64 | return 'Events'; | 
| @@ -14,7 +14,7 @@ | ||
| 14 | 14 | |
| 15 | 15 | private static $icon = 'cwp/images/icons/sitetree_images/news_listing.png'; | 
| 16 | 16 | |
| 17 | - public $pageIcon = 'images/icons/sitetree_images/news_listing.png'; | |
| 17 | + public $pageIcon = 'images/icons/sitetree_images/news_listing.png'; | |
| 18 | 18 | |
| 19 | 19 | private static $singular_name = 'News Holder'; | 
| 20 | 20 | |
| @@ -19,7 +19,7 @@ discard block | ||
| 19 | 19 | ); | 
| 20 | 20 | |
| 21 | 21 |  	public function getCMSFields() { | 
| 22 | -		$this->beforeUpdateCMSFields(function (FieldList $fields) { | |
| 22 | +		$this->beforeUpdateCMSFields(function(FieldList $fields) { | |
| 23 | 23 |  			$fields->removeByName('RedirectorDescHeader'); | 
| 24 | 24 |  			$fields->removeByName('RedirectionType'); | 
| 25 | 25 |  			$fields->removeByName('LinkToID'); | 
| @@ -34,7 +34,7 @@ discard block | ||
| 34 | 34 |  	public function redirectionLink() { | 
| 35 | 35 | $childPage = $this->Children()->first(); | 
| 36 | 36 | |
| 37 | -		if($childPage) { | |
| 37 | +		if ($childPage) { | |
| 38 | 38 | // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of redirector | 
| 39 | 39 | // pages from causing an infinite loop. Instead, they will cause a 30x redirection loop in the browser, but | 
| 40 | 40 | // this can be handled sufficiently gracefully by the browser. | 
| @@ -23,7 +23,7 @@ discard block | ||
| 23 | 23 |  	public function populateDefaults() { | 
| 24 | 24 | parent::populateDefaults(); | 
| 25 | 25 | |
| 26 | -		if(!isset($this->Date) || $this->Date === null) { | |
| 26 | +		if (!isset($this->Date) || $this->Date === null) { | |
| 27 | 27 |  			$this->Date = SS_Datetime::now()->Format('Y-m-d 09:00:00'); | 
| 28 | 28 | } | 
| 29 | 29 | } | 
| @@ -37,7 +37,7 @@ discard block | ||
| 37 | 37 | } | 
| 38 | 38 | |
| 39 | 39 |  	public function getCMSFields() { | 
| 40 | -		$this->beforeUpdateCMSFields(function (FieldList $fields) { | |
| 40 | +		$this->beforeUpdateCMSFields(function(FieldList $fields) { | |
| 41 | 41 | $fields->addFieldToTab( | 
| 42 | 42 | 'Root.Main', | 
| 43 | 43 |  				$dateTimeField = DatetimeField::create('Date', $this->fieldLabel('Date')), | 
| @@ -52,7 +52,7 @@ discard block | ||
| 52 | 52 | ); | 
| 53 | 53 |  			$abstractField->setAttribute('maxlength', '160'); | 
| 54 | 54 | $abstractField->setRightTitle( | 
| 55 | -				_t('DateUpdatePage.AbstractDesc','The abstract is used as a summary on the listing pages. It is limited to 160 characters.') | |
| 55 | +				_t('DateUpdatePage.AbstractDesc', 'The abstract is used as a summary on the listing pages. It is limited to 160 characters.') | |
| 56 | 56 | ); | 
| 57 | 57 | $abstractField->setRows(6); | 
| 58 | 58 | }); | 
| @@ -43,13 +43,13 @@ discard block | ||
| 43 | 43 | } | 
| 44 | 44 | |
| 45 | 45 |  	public function getCMSFields() { | 
| 46 | -		$this->beforeUpdateCMSFields(function (FieldList $fields) { | |
| 46 | +		$this->beforeUpdateCMSFields(function(FieldList $fields) { | |
| 47 | 47 | // Main Content tab | 
| 48 | 48 | $fields->addFieldToTab( | 
| 49 | 49 | 'Root.Main', | 
| 50 | 50 | TreeDropdownField::create( | 
| 51 | 51 | 'LearnMorePageID', | 
| 52 | -					_t('BaseHomePage.LearnMoreLink','Page to link the "Learn More" button to:'), | |
| 52 | +					_t('BaseHomePage.LearnMoreLink', 'Page to link the "Learn More" button to:'), | |
| 53 | 53 | 'SiteTree' | 
| 54 | 54 | ), | 
| 55 | 55 | 'Metadata' | 
| @@ -63,7 +63,7 @@ discard block | ||
| 63 | 63 | ); | 
| 64 | 64 | $gridConfig = $gridField->getConfig(); | 
| 65 | 65 |  			$gridConfig->getComponentByType('GridFieldAddNewButton')->setButtonName( | 
| 66 | -				_t('BaseHomePage.AddNewButton','Add new') | |
| 66 | +				_t('BaseHomePage.AddNewButton', 'Add new') | |
| 67 | 67 | ); | 
| 68 | 68 |  			$gridConfig->removeComponentsByType('GridFieldAddExistingAutocompleter'); | 
| 69 | 69 |  			$gridConfig->removeComponentsByType('GridFieldDeleteAction'); | 
| @@ -79,25 +79,25 @@ discard block | ||
| 79 | 79 | 'Root.Features', | 
| 80 | 80 |  				ToggleCompositeField::create('FeatureOne', _t('SiteTree.FeatureOne', 'Feature One'), | 
| 81 | 81 | array( | 
| 82 | -						TextField::create('FeatureOneTitle', _t('BaseHomePage.Title','Title')), | |
| 82 | +						TextField::create('FeatureOneTitle', _t('BaseHomePage.Title', 'Title')), | |
| 83 | 83 | $dropdownField = DropdownField::create( | 
| 84 | 84 | 'FeatureOneCategory', | 
| 85 | -							_t('BaseHomePage.FeatureCategoryDropdown','Category icon'), | |
| 85 | +							_t('BaseHomePage.FeatureCategoryDropdown', 'Category icon'), | |
| 86 | 86 |  							singleton('BaseHomePage')->dbObject('FeatureOneCategory')->enumValues() | 
| 87 | 87 | ), | 
| 88 | 88 | HTMLEditorField::create( | 
| 89 | 89 | 'FeatureOneContent', | 
| 90 | -							_t('BaseHomePage.FeatureContentFieldLabel','Content') | |
| 90 | +							_t('BaseHomePage.FeatureContentFieldLabel', 'Content') | |
| 91 | 91 | ), | 
| 92 | 92 | TextField::create( | 
| 93 | 93 | 'FeatureOneButtonText', | 
| 94 | -							_t('BaseHomePage.FeatureButtonText','Button text') | |
| 94 | +							_t('BaseHomePage.FeatureButtonText', 'Button text') | |
| 95 | 95 | ), | 
| 96 | 96 | TreeDropdownField::create( | 
| 97 | 97 | 'FeatureOneLinkID', | 
| 98 | -							_t('BaseHomePage.FeatureLink','Page to link to'), | |
| 98 | +							_t('BaseHomePage.FeatureLink', 'Page to link to'), | |
| 99 | 99 | 'SiteTree' | 
| 100 | -						)->setDescription(_t('BaseHomePage.ButtonTextRequired','Button text must be filled in')) | |
| 100 | +						)->setDescription(_t('BaseHomePage.ButtonTextRequired', 'Button text must be filled in')) | |
| 101 | 101 | ) | 
| 102 | 102 | )->setHeadingLevel(3) | 
| 103 | 103 | ); | 
| @@ -105,25 +105,25 @@ discard block | ||
| 105 | 105 | |
| 106 | 106 |  			$fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureTwo', _t('SiteTree.FeatureTwo', 'Feature Two'), | 
| 107 | 107 | array( | 
| 108 | -					TextField::create('FeatureTwoTitle', _t('BaseHomePage.Title','Title')), | |
| 108 | +					TextField::create('FeatureTwoTitle', _t('BaseHomePage.Title', 'Title')), | |
| 109 | 109 | $dropdownField = DropdownField::create( | 
| 110 | 110 | 'FeatureTwoCategory', | 
| 111 | -						_t('BaseHomePage.FeatureCategoryDropdown','Category icon'), | |
| 111 | +						_t('BaseHomePage.FeatureCategoryDropdown', 'Category icon'), | |
| 112 | 112 |  						singleton('BaseHomePage')->dbObject('FeatureTwoCategory')->enumValues() | 
| 113 | 113 | ), | 
| 114 | 114 | HTMLEditorField::create( | 
| 115 | 115 | 'FeatureTwoContent', | 
| 116 | -						_t('BaseHomePage.FeatureContentFieldLabel','Content') | |
| 116 | +						_t('BaseHomePage.FeatureContentFieldLabel', 'Content') | |
| 117 | 117 | ), | 
| 118 | 118 | TextField::create( | 
| 119 | 119 | 'FeatureTwoButtonText', | 
| 120 | -						_t('BaseHomePage.FeatureButtonText','Button text') | |
| 120 | +						_t('BaseHomePage.FeatureButtonText', 'Button text') | |
| 121 | 121 | ), | 
| 122 | 122 | TreeDropdownField::create( | 
| 123 | 123 | 'FeatureTwoLinkID', | 
| 124 | -						_t('BaseHomePage.FeatureLink','Page to link to'), | |
| 124 | +						_t('BaseHomePage.FeatureLink', 'Page to link to'), | |
| 125 | 125 | 'SiteTree' | 
| 126 | -					)->setDescription(_t('BaseHomePage.ButtonTextRequired','Button text must be filled in')) | |
| 126 | +					)->setDescription(_t('BaseHomePage.ButtonTextRequired', 'Button text must be filled in')) | |
| 127 | 127 | ) | 
| 128 | 128 | )->setHeadingLevel(3) | 
| 129 | 129 | ); |