@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | public function __construct($terms = '', ArrayData $results = null) { |
| 56 | 56 | $this->query = $terms; |
| 57 | - if($results) { |
|
| 57 | + if ($results) { |
|
| 58 | 58 | // Clean up the results. |
| 59 | 59 | $matches = $results->Matches; |
| 60 | - foreach($matches as $result) { |
|
| 61 | - if(!$result->canView()) { |
|
| 60 | + foreach ($matches as $result) { |
|
| 61 | + if (!$result->canView()) { |
|
| 62 | 62 | $matches->remove($result); |
| 63 | 63 | } |
| 64 | 64 | } |
@@ -177,12 +177,12 @@ discard block |
||
| 177 | 177 | * @return string|null |
| 178 | 178 | */ |
| 179 | 179 | protected function getLink($terms, $format = null) { |
| 180 | - if(!$terms) { |
|
| 180 | + if (!$terms) { |
|
| 181 | 181 | return null; |
| 182 | 182 | } |
| 183 | - $link = 'search/SearchForm?Search='.rawurlencode($terms); |
|
| 184 | - if($format) { |
|
| 185 | - $link .= '&format='.rawurlencode($format); |
|
| 183 | + $link = 'search/SearchForm?Search=' . rawurlencode($terms); |
|
| 184 | + if ($format) { |
|
| 185 | + $link .= '&format=' . rawurlencode($format); |
|
| 186 | 186 | } |
| 187 | 187 | return $link; |
| 188 | 188 | } |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | private static $hide_ancestor = 'CwpSearchPage'; |
| 9 | 9 | |
| 10 | 10 | public function canViewStage($stage = 'Live', $member = null) { |
| 11 | - if(Permission::checkMember($member, 'VIEW_DRAFT_CONTENT')) { |
|
| 11 | + if (Permission::checkMember($member, 'VIEW_DRAFT_CONTENT')) { |
|
| 12 | 12 | return true; |
| 13 | 13 | } |
| 14 | 14 | |
@@ -37,7 +37,7 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | public function __construct($dataRecord = null) { |
| 40 | - if(!$dataRecord) { |
|
| 40 | + if (!$dataRecord) { |
|
| 41 | 41 | $dataRecord = $this->generateSearchRecord(); |
| 42 | 42 | } |
| 43 | 43 | parent::__construct($dataRecord); |
@@ -58,7 +58,7 @@ discard block |
||
| 58 | 58 | */ |
| 59 | 59 | protected function getSearchOptions($spellcheck) { |
| 60 | 60 | $options = $this->config()->search_options; |
| 61 | - if($spellcheck) { |
|
| 61 | + if ($spellcheck) { |
|
| 62 | 62 | $options = array_merge($options, $this->config()->spellcheck_options); |
| 63 | 63 | } |
| 64 | 64 | return $options; |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | * @return CwpSearchResult|null |
| 104 | 104 | */ |
| 105 | 105 | public function search($keywords, $classes, $searchIndex, $limit = -1, $start = 0, $followSuggestions = false) { |
| 106 | - if(empty($keywords)) { |
|
| 106 | + if (empty($keywords)) { |
|
| 107 | 107 | return null; |
| 108 | 108 | } |
| 109 | 109 | |
@@ -112,7 +112,7 @@ discard block |
||
| 112 | 112 | $result = $this->getResult($keywords, $classes, $searchIndex, $limit, $start, true); |
| 113 | 113 | |
| 114 | 114 | // Return results if we don't need to refine this any further |
| 115 | - if(!$followSuggestions || $result->hasResults() || !$result->getSuggestion()) { |
|
| 115 | + if (!$followSuggestions || $result->hasResults() || !$result->getSuggestion()) { |
|
| 116 | 116 | return $result; |
| 117 | 117 | } |
| 118 | 118 | |
@@ -122,13 +122,13 @@ discard block |
||
| 122 | 122 | $newResult->setOriginal($keywords); |
| 123 | 123 | |
| 124 | 124 | // Compare new results to the original query |
| 125 | - if($newResult->hasResults()) { |
|
| 125 | + if ($newResult->hasResults()) { |
|
| 126 | 126 | return $newResult; |
| 127 | 127 | } else { |
| 128 | 128 | return $result; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - } catch(Exception $e) { |
|
| 131 | + } catch (Exception $e) { |
|
| 132 | 132 | SS_Log::log($e, SS_Log::WARN); |
| 133 | 133 | } |
| 134 | 134 | |
@@ -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')); |
@@ -10,22 +10,22 @@ |
||
| 10 | 10 | $fields = $form->Fields(); |
| 11 | 11 | |
| 12 | 12 | // Set field names and descriptions |
| 13 | - if($nameField = $fields->dataFieldByName('Name')) { |
|
| 13 | + if ($nameField = $fields->dataFieldByName('Name')) { |
|
| 14 | 14 | $nameField |
| 15 | 15 | ->setTitle('Name') |
| 16 | 16 | ->setDescription('(required)'); |
| 17 | 17 | } |
| 18 | 18 | |
| 19 | - if($emailField = $fields->dataFieldByName('Email')) { |
|
| 19 | + if ($emailField = $fields->dataFieldByName('Email')) { |
|
| 20 | 20 | $emailField |
| 21 | 21 | ->setTitle('Email') |
| 22 | 22 | ->setDescription('will not be published (required)'); |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | - if($urlField = $fields->dataFieldByName('URL')) { |
|
| 25 | + if ($urlField = $fields->dataFieldByName('URL')) { |
|
| 26 | 26 | $urlField |
| 27 | 27 | ->setTitle('Your website (optional)') |
| 28 | - ->setAttribute('placeholder','http://'); |
|
| 28 | + ->setAttribute('placeholder', 'http://'); |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | } |
@@ -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); |