@@ -32,11 +32,11 @@ discard block |
||
| 32 | 32 | 'Root.Main', |
| 33 | 33 | $gaCode = TextField::create( |
| 34 | 34 | 'GACode', |
| 35 | - _t('CwpConfig.GaField','Google Analytics account') |
|
| 35 | + _t('CwpConfig.GaField', 'Google Analytics account') |
|
| 36 | 36 | ) |
| 37 | 37 | ); |
| 38 | 38 | $gaCode->setRightTitle( |
| 39 | - _t('CwpConfig.GaFieldDesc','Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)') |
|
| 39 | + _t('CwpConfig.GaFieldDesc', 'Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)') |
|
| 40 | 40 | ); |
| 41 | 41 | |
| 42 | 42 | $fields->findOrMakeTab( |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | 'Root.SocialMedia', |
| 49 | 49 | $facebookURL = TextField::create( |
| 50 | 50 | 'FacebookURL', |
| 51 | - _t('CwpConfig.FbField','Facebook UID or username') |
|
| 51 | + _t('CwpConfig.FbField', 'Facebook UID or username') |
|
| 52 | 52 | ) |
| 53 | 53 | ); |
| 54 | 54 | $facebookURL->setRightTitle( |
@@ -62,22 +62,22 @@ discard block |
||
| 62 | 62 | 'Root.SocialMedia', |
| 63 | 63 | $twitterUsername = TextField::create( |
| 64 | 64 | 'TwitterUsername', |
| 65 | - _t('CwpConfig.TwitterField','Twitter username') |
|
| 65 | + _t('CwpConfig.TwitterField', 'Twitter username') |
|
| 66 | 66 | ) |
| 67 | 67 | ); |
| 68 | 68 | $twitterUsername->setRightTitle( |
| 69 | - _t('CwpConfig.TwitterFieldDesc','Twitter username (eg, http://twitter.com/<strong>username</strong>)') |
|
| 69 | + _t('CwpConfig.TwitterFieldDesc', 'Twitter username (eg, http://twitter.com/<strong>username</strong>)') |
|
| 70 | 70 | ); |
| 71 | 71 | |
| 72 | 72 | $fields->addFieldToTab( |
| 73 | 73 | 'Root.SocialMedia', |
| 74 | 74 | $addThisID = TextField::create( |
| 75 | 75 | 'AddThisProfileID', |
| 76 | - _t('CwpConfig.AddThisField','AddThis Profile ID') |
|
| 76 | + _t('CwpConfig.AddThisField', 'AddThis Profile ID') |
|
| 77 | 77 | ) |
| 78 | 78 | ); |
| 79 | 79 | $addThisID->setRightTitle( |
| 80 | - _t('CwpConfig.AddThisFieldDesc','Profile ID to be used all across the site (in the format <strong>ra-XXXXXXXXXXXXXXXX</strong>)') |
|
| 80 | + _t('CwpConfig.AddThisFieldDesc', 'Profile ID to be used all across the site (in the format <strong>ra-XXXXXXXXXXXXXXXX</strong>)') |
|
| 81 | 81 | ); |
| 82 | 82 | |
| 83 | 83 | $fields->findOrMakeTab( |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | 'Root.LogosIcons', |
| 90 | 90 | $logoField = UploadField::create( |
| 91 | 91 | 'Logo', |
| 92 | - _t('CwpConfig.LogoUploadField','Logo, to appear in the top left') |
|
| 92 | + _t('CwpConfig.LogoUploadField', 'Logo, to appear in the top left') |
|
| 93 | 93 | ) |
| 94 | 94 | ); |
| 95 | 95 | $logoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif')); |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | 'Root.LogosIcons', |
| 113 | 113 | $footerLogoField = UploadField::create( |
| 114 | 114 | 'FooterLogo', |
| 115 | - _t('CwpConfig.FooterLogoField','Footer logo, to appear in the footer') |
|
| 115 | + _t('CwpConfig.FooterLogoField', 'Footer logo, to appear in the footer') |
|
| 116 | 116 | ) |
| 117 | 117 | ); |
| 118 | 118 | $footerLogoField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif')); |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | 'Root.LogosIcons', |
| 123 | 123 | $footerLogoRetinaField = UploadField::create( |
| 124 | 124 | 'FooterLogoRetina', |
| 125 | - _t('CwpConfig.FooterLogoRetinaField','High resolution footer logo (recommended twice the height and width of the standard footer logo)') |
|
| 125 | + _t('CwpConfig.FooterLogoRetinaField', 'High resolution footer logo (recommended twice the height and width of the standard footer logo)') |
|
| 126 | 126 | ) |
| 127 | 127 | ); |
| 128 | 128 | $footerLogoRetinaField->getValidator()->setAllowedExtensions(array('jpg', 'jpeg', 'png', 'gif')); |
@@ -132,18 +132,18 @@ discard block |
||
| 132 | 132 | 'Root.LogosIcons', |
| 133 | 133 | $footerLink = TextField::create( |
| 134 | 134 | 'FooterLogoLink', |
| 135 | - _t('CwpConfig.FooterLogoLinkField','Footer Logo link') |
|
| 135 | + _t('CwpConfig.FooterLogoLinkField', 'Footer Logo link') |
|
| 136 | 136 | ) |
| 137 | 137 | ); |
| 138 | 138 | $footerLink->setRightTitle( |
| 139 | - _t('CwpConfig.FooterLogoLinkDesc','Please include the protocol (ie, http:// or https://) unless it is an internal link.') |
|
| 139 | + _t('CwpConfig.FooterLogoLinkDesc', 'Please include the protocol (ie, http:// or https://) unless it is an internal link.') |
|
| 140 | 140 | ); |
| 141 | 141 | |
| 142 | 142 | $fields->addFieldToTab( |
| 143 | 143 | 'Root.LogosIcons', |
| 144 | 144 | TextField::create( |
| 145 | 145 | 'FooterLogoDescription', |
| 146 | - _t('CwpConfig.FooterLogoDescField','Footer Logo description') |
|
| 146 | + _t('CwpConfig.FooterLogoDescField', 'Footer Logo description') |
|
| 147 | 147 | ) |
| 148 | 148 | ); |
| 149 | 149 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | 'Root.LogosIcons', |
| 152 | 152 | $favIconField = UploadField::create( |
| 153 | 153 | 'FavIcon', |
| 154 | - _t('CwpConfig.FavIconField','Favicon, in .ico format, dimensions of 16x16, 32x32, or 48x48') |
|
| 154 | + _t('CwpConfig.FavIconField', 'Favicon, in .ico format, dimensions of 16x16, 32x32, or 48x48') |
|
| 155 | 155 | ) |
| 156 | 156 | ); |
| 157 | 157 | $favIconField->getValidator()->setAllowedExtensions(array('ico')); |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | 'Root.LogosIcons', |
| 162 | 162 | $atIcon144 = UploadField::create( |
| 163 | 163 | 'AppleTouchIcon144', |
| 164 | - _t('CwpConfig.AppleIconField144','Apple Touch Web Clip and Windows 8 Tile Icon (dimensions of 144x144, PNG format)') |
|
| 164 | + _t('CwpConfig.AppleIconField144', 'Apple Touch Web Clip and Windows 8 Tile Icon (dimensions of 144x144, PNG format)') |
|
| 165 | 165 | ) |
| 166 | 166 | ); |
| 167 | 167 | $atIcon144->getValidator()->setAllowedExtensions(array('png')); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | 'Root.LogosIcons', |
| 172 | 172 | $atIcon114 = UploadField::create( |
| 173 | 173 | 'AppleTouchIcon114', |
| 174 | - _t('CwpConfig.AppleIconField114','Apple Touch Web Clip Icon (dimensions of 114x114, PNG format)') |
|
| 174 | + _t('CwpConfig.AppleIconField114', 'Apple Touch Web Clip Icon (dimensions of 114x114, PNG format)') |
|
| 175 | 175 | ) |
| 176 | 176 | ); |
| 177 | 177 | $atIcon114->getValidator()->setAllowedExtensions(array('png')); |
@@ -181,7 +181,7 @@ discard block |
||
| 181 | 181 | 'Root.LogosIcons', |
| 182 | 182 | $atIcon72 = UploadField::create( |
| 183 | 183 | 'AppleTouchIcon72', |
| 184 | - _t('CwpConfig.AppleIconField72','Apple Touch Web Clip Icon (dimensions of 72x72, PNG format)') |
|
| 184 | + _t('CwpConfig.AppleIconField72', 'Apple Touch Web Clip Icon (dimensions of 72x72, PNG format)') |
|
| 185 | 185 | ) |
| 186 | 186 | ); |
| 187 | 187 | $atIcon72->getValidator()->setAllowedExtensions(array('png')); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | 'Root.LogosIcons', |
| 192 | 192 | $atIcon57 = UploadField::create( |
| 193 | 193 | 'AppleTouchIcon57', |
| 194 | - _t('CwpConfig.AppleIconField57','Apple Touch Web Clip Icon (dimensions of 57x57, PNG format)') |
|
| 194 | + _t('CwpConfig.AppleIconField57', 'Apple Touch Web Clip Icon (dimensions of 57x57, PNG format)') |
|
| 195 | 195 | ) |
| 196 | 196 | ); |
| 197 | 197 | $atIcon57->getValidator()->setAllowedExtensions(array('png')); |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | CompositeField::create( |
| 47 | 47 | LabelField::create( |
| 48 | 48 | "LabelArchive", |
| 49 | - _t('CwpCarousel.ArchivedField',"Archive this carousel item?") |
|
| 49 | + _t('CwpCarousel.ArchivedField', "Archive this carousel item?") |
|
| 50 | 50 | )->addExtraClass("left"), |
| 51 | 51 | CheckboxField::create('Archived', '') |
| 52 | 52 | )->addExtraClass("field special") |
@@ -72,12 +72,12 @@ discard block |
||
| 72 | 72 | return $this->Parent()->canView($member); |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - public function ImageThumb(){ |
|
| 75 | + public function ImageThumb() { |
|
| 76 | 76 | return $this->Image()->SetWidth(50); |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - public function ArchivedReadable(){ |
|
| 80 | - if($this->Archived == 1) return _t('GridField.Archived', 'Archived'); |
|
| 79 | + public function ArchivedReadable() { |
|
| 80 | + if ($this->Archived == 1) return _t('GridField.Archived', 'Archived'); |
|
| 81 | 81 | return _t('GridField.Live', 'Live'); |
| 82 | 82 | } |
| 83 | 83 | } |
@@ -77,7 +77,9 @@ |
||
| 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 | } |
@@ -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 | |
@@ -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 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | ); |
| 54 | 54 | $abstractField->setAttribute('maxlength', '160'); |
| 55 | 55 | $abstractField->setRightTitle( |
| 56 | - _t('DateUpdatePage.AbstractDesc','The abstract is used as a summary on the listing pages. It is limited to 160 characters.') |
|
| 56 | + _t('DateUpdatePage.AbstractDesc', 'The abstract is used as a summary on the listing pages. It is limited to 160 characters.') |
|
| 57 | 57 | ); |
| 58 | 58 | $abstractField->setRows(6); |
| 59 | 59 | |
@@ -22,7 +22,7 @@ |
||
| 22 | 22 | 'FeaturedImage' => 'Image' |
| 23 | 23 | ); |
| 24 | 24 | |
| 25 | - public $pageIcon = 'images/icons/sitetree_images/news.png'; |
|
| 25 | + public $pageIcon = 'images/icons/sitetree_images/news.png'; |
|
| 26 | 26 | |
| 27 | 27 | public function fieldLabels($includerelations = true) { |
| 28 | 28 | $labels = parent::fieldLabels($includerelations); |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | 'Root.Main', |
| 56 | 56 | TreeDropdownField::create( |
| 57 | 57 | 'LearnMorePageID', |
| 58 | - _t('BaseHomePage.LearnMoreLink','Page to link the "Learn More" button to:'), |
|
| 58 | + _t('BaseHomePage.LearnMoreLink', 'Page to link the "Learn More" button to:'), |
|
| 59 | 59 | 'SiteTree' |
| 60 | 60 | ), |
| 61 | 61 | 'Metadata' |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | ); |
| 71 | 71 | $gridConfig = $gridField->getConfig(); |
| 72 | 72 | $gridConfig->getComponentByType('GridFieldAddNewButton')->setButtonName( |
| 73 | - _t('BaseHomePage.AddNewButton','Add new') |
|
| 73 | + _t('BaseHomePage.AddNewButton', 'Add new') |
|
| 74 | 74 | ); |
| 75 | 75 | $gridConfig->removeComponentsByType('GridFieldAddExistingAutocompleter'); |
| 76 | 76 | $gridConfig->removeComponentsByType('GridFieldDeleteAction'); |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | ); |
| 90 | 90 | $gridConfig = $gridField->getConfig(); |
| 91 | 91 | $gridConfig->getComponentByType('GridFieldAddNewButton')->setButtonName( |
| 92 | - _t('BaseHomePage.AddNewButton','Add new') |
|
| 92 | + _t('BaseHomePage.AddNewButton', 'Add new') |
|
| 93 | 93 | ); |
| 94 | 94 | $gridConfig->removeComponentsByType('GridFieldAddExistingAutocompleter'); |
| 95 | 95 | $gridConfig->removeComponentsByType('GridFieldDeleteAction'); |
@@ -105,25 +105,25 @@ discard block |
||
| 105 | 105 | 'Root.Features', |
| 106 | 106 | ToggleCompositeField::create('FeatureOne', _t('SiteTree.FeatureOne', 'Feature One'), |
| 107 | 107 | array( |
| 108 | - TextField::create('FeatureOneTitle', _t('BaseHomePage.Title','Title')), |
|
| 108 | + TextField::create('FeatureOneTitle', _t('BaseHomePage.Title', 'Title')), |
|
| 109 | 109 | $dropdownField = DropdownField::create( |
| 110 | 110 | 'FeatureOneCategory', |
| 111 | - _t('BaseHomePage.FeatureCategoryDropdown','Category icon'), |
|
| 111 | + _t('BaseHomePage.FeatureCategoryDropdown', 'Category icon'), |
|
| 112 | 112 | singleton('BaseHomePage')->dbObject('FeatureOneCategory')->enumValues() |
| 113 | 113 | ), |
| 114 | 114 | HTMLEditorField::create( |
| 115 | 115 | 'FeatureOneContent', |
| 116 | - _t('BaseHomePage.FeatureContentFieldLabel','Content') |
|
| 116 | + _t('BaseHomePage.FeatureContentFieldLabel', 'Content') |
|
| 117 | 117 | ), |
| 118 | 118 | TextField::create( |
| 119 | 119 | 'FeatureOneButtonText', |
| 120 | - _t('BaseHomePage.FeatureButtonText','Button text') |
|
| 120 | + _t('BaseHomePage.FeatureButtonText', 'Button text') |
|
| 121 | 121 | ), |
| 122 | 122 | TreeDropdownField::create( |
| 123 | 123 | 'FeatureOneLinkID', |
| 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 | ); |
@@ -131,25 +131,25 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | $fields->addFieldToTab('Root.Features', ToggleCompositeField::create('FeatureTwo', _t('SiteTree.FeatureTwo', 'Feature Two'), |
| 133 | 133 | array( |
| 134 | - TextField::create('FeatureTwoTitle', _t('BaseHomePage.Title','Title')), |
|
| 134 | + TextField::create('FeatureTwoTitle', _t('BaseHomePage.Title', 'Title')), |
|
| 135 | 135 | $dropdownField = DropdownField::create( |
| 136 | 136 | 'FeatureTwoCategory', |
| 137 | - _t('BaseHomePage.FeatureCategoryDropdown','Category icon'), |
|
| 137 | + _t('BaseHomePage.FeatureCategoryDropdown', 'Category icon'), |
|
| 138 | 138 | singleton('BaseHomePage')->dbObject('FeatureTwoCategory')->enumValues() |
| 139 | 139 | ), |
| 140 | 140 | HTMLEditorField::create( |
| 141 | 141 | 'FeatureTwoContent', |
| 142 | - _t('BaseHomePage.FeatureContentFieldLabel','Content') |
|
| 142 | + _t('BaseHomePage.FeatureContentFieldLabel', 'Content') |
|
| 143 | 143 | ), |
| 144 | 144 | TextField::create( |
| 145 | 145 | 'FeatureTwoButtonText', |
| 146 | - _t('BaseHomePage.FeatureButtonText','Button text') |
|
| 146 | + _t('BaseHomePage.FeatureButtonText', 'Button text') |
|
| 147 | 147 | ), |
| 148 | 148 | TreeDropdownField::create( |
| 149 | 149 | 'FeatureTwoLinkID', |
| 150 | - _t('BaseHomePage.FeatureLink','Page to link to'), |
|
| 150 | + _t('BaseHomePage.FeatureLink', 'Page to link to'), |
|
| 151 | 151 | 'SiteTree' |
| 152 | - )->setDescription(_t('BaseHomePage.ButtonTextRequired','Button text must be filled in')) |
|
| 152 | + )->setDescription(_t('BaseHomePage.ButtonTextRequired', 'Button text must be filled in')) |
|
| 153 | 153 | ) |
| 154 | 154 | )->setHeadingLevel(3) |
| 155 | 155 | ); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | public function redirectionLink() { |
| 36 | 36 | $childPage = $this->Children()->first(); |
| 37 | 37 | |
| 38 | - if($childPage) { |
|
| 38 | + if ($childPage) { |
|
| 39 | 39 | // If we're linking to another redirectorpage then just return the URLSegment, to prevent a cycle of redirector |
| 40 | 40 | // pages from causing an infinite loop. Instead, they will cause a 30x redirection loop in the browser, but |
| 41 | 41 | // this can be handled sufficiently gracefully by the browser. |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // default to the binary being in the usual path on Linux |
| 4 | -if(!defined('WKHTMLTOPDF_BINARY')) { |
|
| 4 | +if (!defined('WKHTMLTOPDF_BINARY')) { |
|
| 5 | 5 | define('WKHTMLTOPDF_BINARY', '/usr/local/bin/wkhtmltopdf'); |
| 6 | 6 | } |
@@ -60,7 +60,7 @@ discard block |
||
| 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] != '/') $folderPath = BASE_PATH . '/' . $folderPath; |
|
| 64 | 64 | |
| 65 | 65 | return sprintf('%s/%s.pdf', $folderPath, $baseName); |
| 66 | 66 | } |
@@ -69,11 +69,11 @@ discard block |
||
| 69 | 69 | * Build pdf link for template. |
| 70 | 70 | */ |
| 71 | 71 | public function PdfLink() { |
| 72 | - if(!Config::inst()->get('BasePage', 'pdf_export')) return false; |
|
| 72 | + if (!Config::inst()->get('BasePage', 'pdf_export')) return false; |
|
| 73 | 73 | |
| 74 | 74 | $path = $this->getPdfFilename(); |
| 75 | 75 | |
| 76 | - if((Versioned::current_stage() == 'Live') && file_exists($path)) { |
|
| 76 | + if ((Versioned::current_stage() == 'Live') && file_exists($path)) { |
|
| 77 | 77 | return Director::baseURL() . preg_replace('#^/#', '', Director::makeRelative($path)); |
| 78 | 78 | } else { |
| 79 | 79 | return $this->Link('downloadpdf'); |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function onAfterPublish(&$original) { |
| 96 | 96 | $filepath = $this->getPdfFilename(); |
| 97 | - if(file_exists($filepath)) { |
|
| 97 | + if (file_exists($filepath)) { |
|
| 98 | 98 | unlink($filepath); |
| 99 | 99 | } |
| 100 | 100 | } |
@@ -106,10 +106,10 @@ discard block |
||
| 106 | 106 | * @return boolean |
| 107 | 107 | */ |
| 108 | 108 | public function doUnpublish() { |
| 109 | - if(!parent::doUnpublish()) return false; |
|
| 109 | + if (!parent::doUnpublish()) return false; |
|
| 110 | 110 | |
| 111 | 111 | $filepath = $this->getPdfFilename(); |
| 112 | - if(file_exists($filepath)) { |
|
| 112 | + if (file_exists($filepath)) { |
|
| 113 | 113 | unlink($filepath); |
| 114 | 114 | } |
| 115 | 115 | |
@@ -135,20 +135,20 @@ discard block |
||
| 135 | 135 | |
| 136 | 136 | $fields->findOrMakeTab( |
| 137 | 137 | 'Root.RelatedPages', |
| 138 | - _t('BasePage.RelatedPages','Related pages') |
|
| 138 | + _t('BasePage.RelatedPages', 'Related pages') |
|
| 139 | 139 | ); |
| 140 | 140 | $fields->addFieldToTab( |
| 141 | 141 | 'Root.RelatedPages', |
| 142 | 142 | GridField::create( |
| 143 | 143 | 'RelatedPages', |
| 144 | - _t('BasePage.RelatedPages','Related pages'), |
|
| 144 | + _t('BasePage.RelatedPages', 'Related pages'), |
|
| 145 | 145 | $this->RelatedPages(), |
| 146 | 146 | $components |
| 147 | 147 | ) |
| 148 | 148 | ); |
| 149 | 149 | |
| 150 | 150 | // Taxonomies - Unless they have their own 'Tags' field (such as in Blog, etc) |
| 151 | - if(!$this->has_many('Tags') && !$this->many_many('Tags')) { |
|
| 151 | + if (!$this->has_many('Tags') && !$this->many_many('Tags')) { |
|
| 152 | 152 | $components = GridFieldConfig_RelationEditor::create(); |
| 153 | 153 | $components->removeComponentsByType('GridFieldAddNewButton'); |
| 154 | 154 | $components->removeComponentsByType('GridFieldEditButton'); |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | |
| 159 | 159 | $dataColumns = $components->getComponentByType('GridFieldDataColumns'); |
| 160 | 160 | $dataColumns->setDisplayFields(array( |
| 161 | - 'Name' => _t('BasePage.Term','Term'), |
|
| 162 | - 'TaxonomyName' => _t('BasePage.Taxonomy','Taxonomy') |
|
| 161 | + 'Name' => _t('BasePage.Term', 'Term'), |
|
| 162 | + 'TaxonomyName' => _t('BasePage.Taxonomy', 'Taxonomy') |
|
| 163 | 163 | )); |
| 164 | 164 | |
| 165 | 165 | $fields->findOrMakeTab('Root.Tags', _t('BasePage.TagsTabTitle', 'Tags')); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | 'Root.Tags', |
| 168 | 168 | TreeMultiselectField::create( |
| 169 | 169 | 'Terms', |
| 170 | - _t('BasePage.Terms','Terms'), |
|
| 170 | + _t('BasePage.Terms', 'Terms'), |
|
| 171 | 171 | 'TaxonomyTerm' |
| 172 | 172 | )->setDescription(_t('BasePage.TermsDescription', 'Click to search for additional terms')) |
| 173 | 173 | ); |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | function getAvailableTranslations() { |
| 186 | 186 | |
| 187 | - if(!class_exists('Translatable')){ |
|
| 187 | + if (!class_exists('Translatable')) { |
|
| 188 | 188 | return false; |
| 189 | 189 | } |
| 190 | 190 | |
@@ -224,11 +224,11 @@ discard block |
||
| 224 | 224 | $translations->push(new ArrayData(array( |
| 225 | 225 | 'LangName' => $nativeLangName, |
| 226 | 226 | 'Link' => $link, |
| 227 | - 'Current' => (Translatable::get_current_locale()==$loc) |
|
| 227 | + 'Current' => (Translatable::get_current_locale() == $loc) |
|
| 228 | 228 | ))); |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - if ($translations->count()>1) return $translations; |
|
| 231 | + if ($translations->count() > 1) return $translations; |
|
| 232 | 232 | else return null; |
| 233 | 233 | } |
| 234 | 234 | |
@@ -274,13 +274,13 @@ discard block |
||
| 274 | 274 | * Serve the page rendered as PDF. |
| 275 | 275 | */ |
| 276 | 276 | public function downloadpdf() { |
| 277 | - if(!Config::inst()->get('BasePage', 'pdf_export')) return false; |
|
| 277 | + if (!Config::inst()->get('BasePage', 'pdf_export')) return false; |
|
| 278 | 278 | |
| 279 | 279 | // We only allow producing live pdf. There is no way to secure the draft files. |
| 280 | 280 | Versioned::reading_stage('Live'); |
| 281 | 281 | |
| 282 | 282 | $path = $this->dataRecord->getPdfFilename(); |
| 283 | - if(!file_exists($path)) { |
|
| 283 | + if (!file_exists($path)) { |
|
| 284 | 284 | $this->generatePDF(); |
| 285 | 285 | } |
| 286 | 286 | |
@@ -291,20 +291,20 @@ discard block |
||
| 291 | 291 | * Render the page as PDF using wkhtmltopdf. |
| 292 | 292 | */ |
| 293 | 293 | public function generatePDF() { |
| 294 | - if(!Config::inst()->get('BasePage', 'pdf_export')) return false; |
|
| 294 | + if (!Config::inst()->get('BasePage', 'pdf_export')) return false; |
|
| 295 | 295 | |
| 296 | 296 | $binaryPath = Config::inst()->get('BasePage', 'wkhtmltopdf_binary'); |
| 297 | - if(!$binaryPath || !is_executable($binaryPath)) { |
|
| 298 | - if(defined('WKHTMLTOPDF_BINARY') && is_executable(WKHTMLTOPDF_BINARY)) { |
|
| 297 | + if (!$binaryPath || !is_executable($binaryPath)) { |
|
| 298 | + if (defined('WKHTMLTOPDF_BINARY') && is_executable(WKHTMLTOPDF_BINARY)) { |
|
| 299 | 299 | $binaryPath = WKHTMLTOPDF_BINARY; |
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
| 303 | - if(!$binaryPath) { |
|
| 303 | + if (!$binaryPath) { |
|
| 304 | 304 | user_error('Neither WKHTMLTOPDF_BINARY nor BasePage.wkhtmltopdf_binary are defined', E_USER_ERROR); |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - if(Versioned::get_reading_mode() == 'Stage.Stage') { |
|
| 307 | + if (Versioned::get_reading_mode() == 'Stage.Stage') { |
|
| 308 | 308 | user_error('Generating PDFs on draft is not supported', E_USER_ERROR); |
| 309 | 309 | } |
| 310 | 310 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | $footerFile = str_replace('.pdf', '_pdffooter.html', $pdfFile); |
| 317 | 317 | |
| 318 | 318 | // make sure the work directory exists |
| 319 | - if(!file_exists(dirname($pdfFile))) Filesystem::makeFolder(dirname($pdfFile)); |
|
| 319 | + if (!file_exists(dirname($pdfFile))) Filesystem::makeFolder(dirname($pdfFile)); |
|
| 320 | 320 | |
| 321 | 321 | // Force http protocol on CWP - fetching from localhost without using the proxy, SSL terminates on gateway. |
| 322 | 322 | if (defined('CWP_ENVIRONMENT')) { |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | unlink($footerFile); |
| 352 | 352 | |
| 353 | 353 | // output any errors |
| 354 | - if($return_val != 0) { |
|
| 354 | + if ($return_val != 0) { |
|
| 355 | 355 | user_error('wkhtmltopdf failed: ' . implode("\n", $output), E_USER_ERROR); |
| 356 | 356 | } |
| 357 | 357 | |
@@ -363,9 +363,9 @@ discard block |
||
| 363 | 363 | * Site search form |
| 364 | 364 | */ |
| 365 | 365 | public function SearchForm() { |
| 366 | - $searchText = _t('SearchForm.SEARCH', 'Search'); |
|
| 366 | + $searchText = _t('SearchForm.SEARCH', 'Search'); |
|
| 367 | 367 | |
| 368 | - if($this->getRequest()->getVar('Search')) { |
|
| 368 | + if ($this->getRequest()->getVar('Search')) { |
|
| 369 | 369 | $searchText = $this->getRequest()->getVar('Search'); |
| 370 | 370 | } |
| 371 | 371 | |
@@ -415,7 +415,7 @@ discard block |
||
| 415 | 415 | 'Results' => $results ? $results->getResults() : '', |
| 416 | 416 | 'Title' => _t('SearchForm.SearchResults', 'Search Results') |
| 417 | 417 | )); |
| 418 | - if($results) { |
|
| 418 | + if ($results) { |
|
| 419 | 419 | $response = $response->customise($results); |
| 420 | 420 | } |
| 421 | 421 | |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | $themeDir = SSViewer::get_theme_folder(); |
| 450 | 450 | |
| 451 | 451 | return array( |
| 452 | - THIRDPARTY_DIR .'/jquery/jquery.js', |
|
| 453 | - THIRDPARTY_DIR .'/jquery-ui/jquery-ui.js', |
|
| 452 | + THIRDPARTY_DIR . '/jquery/jquery.js', |
|
| 453 | + THIRDPARTY_DIR . '/jquery-ui/jquery-ui.js', |
|
| 454 | 454 | "$themeDir/js/lib/modernizr.js", |
| 455 | 455 | "$themeDir/js/bootstrap-transition.2.3.1.js", |
| 456 | 456 | 'themes/module_bootstrap/js/bootstrap-collapse.js', |
@@ -486,7 +486,7 @@ discard block |
||
| 486 | 486 | |
| 487 | 487 | // Ensure we only include styles when theme is enabled (except when running certain tests) |
| 488 | 488 | $theme = Config::inst()->get('SSViewer', 'theme'); |
| 489 | - if($theme) { |
|
| 489 | + if ($theme) { |
|
| 490 | 490 | // Include base scripts that are needed on all pages |
| 491 | 491 | Requirements::combine_files('scripts.js', $this->getBaseScripts()); |
| 492 | 492 | |
@@ -60,7 +60,9 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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 |
||
| 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')) { |