@@ -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 | ) |
@@ -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 | |
@@ -14,10 +14,10 @@ |
||
| 14 | 14 | private static $create_default_workflow = true; |
| 15 | 15 | |
| 16 | 16 | public function requireDefaultRecords() { |
| 17 | - if(Config::inst()->get('CwpWorkflowDefinitionExtension', 'create_default_workflow')) { |
|
| 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()) return; |
|
| 21 | 21 | |
| 22 | 22 | //generate from the template, which happens after we write the definition |
| 23 | 23 | $definition = WorkflowDefinition::create(); |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | * @return mixed |
| 26 | 26 | */ |
| 27 | 27 | public function php($data) { |
| 28 | - foreach($this->fieldNames as $fieldName) { |
|
| 29 | - if(empty($data[$fieldName])) { |
|
| 28 | + foreach ($this->fieldNames as $fieldName) { |
|
| 29 | + if (empty($data[$fieldName])) { |
|
| 30 | 30 | return; |
| 31 | 31 | } |
| 32 | 32 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | * @param mixed $value |
| 42 | 42 | */ |
| 43 | 43 | protected function validateField($fieldName, $value) { |
| 44 | - if(!$this->validateValue($value)) { |
|
| 44 | + if (!$this->validateValue($value)) { |
|
| 45 | 45 | $this->validationError( |
| 46 | 46 | $fieldName, |
| 47 | 47 | _t( |
@@ -66,15 +66,15 @@ discard block |
||
| 66 | 66 | ); |
| 67 | 67 | |
| 68 | 68 | // strip comments (lines beginning with "#") |
| 69 | - $lines = array_filter($lines, function ($line) { |
|
| 69 | + $lines = array_filter($lines, function($line) { |
|
| 70 | 70 | $line = trim($line); |
| 71 | 71 | |
| 72 | 72 | return !empty($line) && $line[0] !== '#'; |
| 73 | 73 | }); |
| 74 | 74 | |
| 75 | 75 | // validate each line |
| 76 | - foreach($lines as $line) { |
|
| 77 | - if(!$this->validateLine($line)) { |
|
| 76 | + foreach ($lines as $line) { |
|
| 77 | + if (!$this->validateLine($line)) { |
|
| 78 | 78 | return false; |
| 79 | 79 | } |
| 80 | 80 | } |
@@ -95,8 +95,8 @@ discard block |
||
| 95 | 95 | $parts = explode(',', $line); |
| 96 | 96 | $parts = array_filter($parts); |
| 97 | 97 | |
| 98 | - foreach($parts as $part) { |
|
| 99 | - if(!$this->validatePart($part)) { |
|
| 98 | + foreach ($parts as $part) { |
|
| 99 | + if (!$this->validatePart($part)) { |
|
| 100 | 100 | return false; |
| 101 | 101 | } |
| 102 | 102 | } |
@@ -112,11 +112,11 @@ discard block |
||
| 112 | 112 | * @return bool |
| 113 | 113 | */ |
| 114 | 114 | protected function validatePart($part) { |
| 115 | - if(strpos($part, '=>') !== false) { |
|
| 115 | + if (strpos($part, '=>') !== false) { |
|
| 116 | 116 | $subs = explode('=>', $part); |
| 117 | 117 | $subs = array_filter($subs); |
| 118 | 118 | |
| 119 | - foreach($subs as $sub) { |
|
| 119 | + foreach ($subs as $sub) { |
|
| 120 | 120 | if (!$this->validateNoSpaces($sub)) { |
| 121 | 121 | return false; |
| 122 | 122 | } |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | $value = trim($value); |
| 139 | 139 | |
| 140 | 140 | // does the value contain 1 or more whitespace characters? |
| 141 | - if(preg_match('/\s+/', $value)) { |
|
| 141 | + if (preg_match('/\s+/', $value)) { |
|
| 142 | 142 | return false; |
| 143 | 143 | } |
| 144 | 144 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | |
| 13 | 13 | public function updateCMSFields(FieldList $fields) { |
| 14 | 14 | // Don't show this field if you're not an admin |
| 15 | - if(!Permission::check('ADMIN')) { |
|
| 15 | + if (!Permission::check('ADMIN')) { |
|
| 16 | 16 | return; |
| 17 | 17 | } |
| 18 | 18 | |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | TextareaField::create('SearchSynonyms', _t('CwpConfig.SearchSynonyms', 'Search Synonyms')) |
| 23 | 23 | ->setDescription(_t( |
| 24 | 24 | 'CwpConfig.SearchSynonyms_Description', |
| 25 | - 'Enter as many comma separated synonyms as you wish, where '. |
|
| 25 | + 'Enter as many comma separated synonyms as you wish, where ' . |
|
| 26 | 26 | 'each line represents a group of synonyms.<br /> ' . |
| 27 | 27 | 'You will need to run <a rel="external" target="_blank" href="dev/tasks/Solr_Configure">Solr_Configure</a> if you make any changes' |
| 28 | 28 | )) |
@@ -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 | |