@@ -11,14 +11,14 @@ |
||
11 | 11 | */ |
12 | 12 | class CwpSearchPage extends Page |
13 | 13 | { |
14 | - private static $hide_ancestor = CwpSearchPage::class; |
|
14 | + private static $hide_ancestor = CwpSearchPage::class; |
|
15 | 15 | |
16 | - public function canViewStage($stage = Versioned::LIVE, $member = null) |
|
17 | - { |
|
18 | - if (Permission::checkMember($member, 'VIEW_DRAFT_CONTENT')) { |
|
19 | - return true; |
|
20 | - } |
|
16 | + public function canViewStage($stage = Versioned::LIVE, $member = null) |
|
17 | + { |
|
18 | + if (Permission::checkMember($member, 'VIEW_DRAFT_CONTENT')) { |
|
19 | + return true; |
|
20 | + } |
|
21 | 21 | |
22 | - return parent::canViewStage($stage, $member); |
|
23 | - } |
|
22 | + return parent::canViewStage($stage, $member); |
|
23 | + } |
|
24 | 24 | } |
@@ -8,9 +8,9 @@ |
||
8 | 8 | class TaxonomyTermExtension extends DataExtension |
9 | 9 | { |
10 | 10 | |
11 | - private static $api_access = true; |
|
11 | + private static $api_access = true; |
|
12 | 12 | |
13 | - private static $belongs_many_many = array( |
|
14 | - 'Pages' => BasePage::class |
|
15 | - ); |
|
13 | + private static $belongs_many_many = array( |
|
14 | + 'Pages' => BasePage::class |
|
15 | + ); |
|
16 | 16 | } |
@@ -16,52 +16,52 @@ |
||
16 | 16 | class SynonymsSiteConfig extends DataExtension |
17 | 17 | { |
18 | 18 | |
19 | - private static $db = array( |
|
20 | - 'SearchSynonyms' => 'Text', // fulltextsearch synonyms.txt content |
|
21 | - ); |
|
19 | + private static $db = array( |
|
20 | + 'SearchSynonyms' => 'Text', // fulltextsearch synonyms.txt content |
|
21 | + ); |
|
22 | 22 | |
23 | - public function updateCMSFields(FieldList $fields) |
|
24 | - { |
|
25 | - // Don't show this field if you're not an admin |
|
26 | - if (!Permission::check('ADMIN')) { |
|
27 | - return; |
|
28 | - } |
|
23 | + public function updateCMSFields(FieldList $fields) |
|
24 | + { |
|
25 | + // Don't show this field if you're not an admin |
|
26 | + if (!Permission::check('ADMIN')) { |
|
27 | + return; |
|
28 | + } |
|
29 | 29 | |
30 | - // Search synonyms |
|
31 | - $fields->addFieldToTab( |
|
32 | - 'Root.FulltextSearch', |
|
33 | - TextareaField::create('SearchSynonyms', _t('CwpConfig.SearchSynonyms', 'Search Synonyms')) |
|
34 | - ->setDescription(_t( |
|
35 | - 'CwpConfig.SearchSynonyms_Description', |
|
36 | - 'Enter as many comma separated synonyms as you wish, where '. |
|
37 | - 'each line represents a group of synonyms.<br /> ' . |
|
38 | - 'You will need to run <a rel="external" target="_blank" href="dev/tasks/Solr_Configure">' |
|
39 | - . 'Solr_Configure</a> if you make any changes' |
|
40 | - )) |
|
41 | - ); |
|
42 | - } |
|
30 | + // Search synonyms |
|
31 | + $fields->addFieldToTab( |
|
32 | + 'Root.FulltextSearch', |
|
33 | + TextareaField::create('SearchSynonyms', _t('CwpConfig.SearchSynonyms', 'Search Synonyms')) |
|
34 | + ->setDescription(_t( |
|
35 | + 'CwpConfig.SearchSynonyms_Description', |
|
36 | + 'Enter as many comma separated synonyms as you wish, where '. |
|
37 | + 'each line represents a group of synonyms.<br /> ' . |
|
38 | + 'You will need to run <a rel="external" target="_blank" href="dev/tasks/Solr_Configure">' |
|
39 | + . 'Solr_Configure</a> if you make any changes' |
|
40 | + )) |
|
41 | + ); |
|
42 | + } |
|
43 | 43 | |
44 | - /** |
|
45 | - * @inheritdoc |
|
46 | - * |
|
47 | - * @param ValidationResult $validationResult |
|
48 | - */ |
|
49 | - public function validate(ValidationResult $validationResult) |
|
50 | - { |
|
51 | - $validator = new SynonymValidator(array( |
|
52 | - 'SearchSynonyms', |
|
53 | - )); |
|
44 | + /** |
|
45 | + * @inheritdoc |
|
46 | + * |
|
47 | + * @param ValidationResult $validationResult |
|
48 | + */ |
|
49 | + public function validate(ValidationResult $validationResult) |
|
50 | + { |
|
51 | + $validator = new SynonymValidator(array( |
|
52 | + 'SearchSynonyms', |
|
53 | + )); |
|
54 | 54 | |
55 | - $validator->php(array( |
|
56 | - 'SearchSynonyms' => $this->owner->SearchSynonyms |
|
57 | - )); |
|
55 | + $validator->php(array( |
|
56 | + 'SearchSynonyms' => $this->owner->SearchSynonyms |
|
57 | + )); |
|
58 | 58 | |
59 | - $errors = $validator->getErrors(); |
|
59 | + $errors = $validator->getErrors(); |
|
60 | 60 | |
61 | - if (is_array($errors) || $errors instanceof Traversable) { |
|
62 | - foreach ($errors as $error) { |
|
63 | - $validationResult->error($error['message']); |
|
64 | - } |
|
65 | - } |
|
66 | - } |
|
61 | + if (is_array($errors) || $errors instanceof Traversable) { |
|
62 | + foreach ($errors as $error) { |
|
63 | + $validationResult->error($error['message']); |
|
64 | + } |
|
65 | + } |
|
66 | + } |
|
67 | 67 | } |
@@ -33,7 +33,7 @@ |
||
33 | 33 | TextareaField::create('SearchSynonyms', _t('CwpConfig.SearchSynonyms', 'Search Synonyms')) |
34 | 34 | ->setDescription(_t( |
35 | 35 | 'CwpConfig.SearchSynonyms_Description', |
36 | - 'Enter as many comma separated synonyms as you wish, where '. |
|
36 | + 'Enter as many comma separated synonyms as you wish, where ' . |
|
37 | 37 | 'each line represents a group of synonyms.<br /> ' . |
38 | 38 | 'You will need to run <a rel="external" target="_blank" href="dev/tasks/Solr_Configure">' |
39 | 39 | . 'Solr_Configure</a> if you make any changes' |
@@ -6,154 +6,154 @@ |
||
6 | 6 | |
7 | 7 | class SynonymValidator extends Validator |
8 | 8 | { |
9 | - /** |
|
10 | - * @var array |
|
11 | - */ |
|
12 | - protected $fieldNames; |
|
13 | - |
|
14 | - /** |
|
15 | - * @inheritdoc |
|
16 | - * |
|
17 | - * @param array $fieldNames |
|
18 | - */ |
|
19 | - public function __construct(array $fieldNames) |
|
20 | - { |
|
21 | - $this->fieldNames = $fieldNames; |
|
22 | - |
|
23 | - parent::__construct(); |
|
24 | - } |
|
25 | - |
|
26 | - /** |
|
27 | - * @inheritdoc |
|
28 | - * |
|
29 | - * @param array $data |
|
30 | - * |
|
31 | - * @return mixed |
|
32 | - */ |
|
33 | - public function php($data) |
|
34 | - { |
|
35 | - foreach ($this->fieldNames as $fieldName) { |
|
36 | - if (empty($data[$fieldName])) { |
|
37 | - return; |
|
38 | - } |
|
39 | - |
|
40 | - $this->validateField($fieldName, $data[$fieldName]); |
|
41 | - } |
|
42 | - } |
|
43 | - |
|
44 | - /** |
|
45 | - * Validate field values, raising errors if the values are invalid. |
|
46 | - * |
|
47 | - * @param string $fieldName |
|
48 | - * @param mixed $value |
|
49 | - */ |
|
50 | - protected function validateField($fieldName, $value) |
|
51 | - { |
|
52 | - if (!$this->validateValue($value)) { |
|
53 | - $this->validationError( |
|
54 | - $fieldName, |
|
55 | - _t( |
|
56 | - 'FullTextSearch.SynonymValidator.InvalidValue', |
|
57 | - 'Synonyms cannot contain words separated by spaces' |
|
58 | - ) |
|
59 | - ); |
|
60 | - } |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * Check field values to see that they doesn't contain spaces between words. |
|
65 | - * |
|
66 | - * @param mixed $value |
|
67 | - * |
|
68 | - * @return bool |
|
69 | - */ |
|
70 | - protected function validateValue($value) |
|
71 | - { |
|
72 | - // strip empty lines |
|
73 | - $lines = array_filter( |
|
74 | - explode("\n", $value) |
|
75 | - ); |
|
76 | - |
|
77 | - // strip comments (lines beginning with "#") |
|
78 | - $lines = array_filter($lines, function ($line) { |
|
79 | - $line = trim($line); |
|
80 | - |
|
81 | - return !empty($line) && $line[0] !== '#'; |
|
82 | - }); |
|
83 | - |
|
84 | - // validate each line |
|
85 | - foreach ($lines as $line) { |
|
86 | - if (!$this->validateLine($line)) { |
|
87 | - return false; |
|
88 | - } |
|
89 | - } |
|
90 | - |
|
91 | - return true; |
|
92 | - } |
|
93 | - |
|
94 | - /** |
|
95 | - * Check each line to see that it doesn't contain spaces between words. |
|
96 | - * |
|
97 | - * @param string $line |
|
98 | - * |
|
99 | - * @return bool |
|
100 | - */ |
|
101 | - protected function validateLine($line) |
|
102 | - { |
|
103 | - $line = trim($line); |
|
104 | - |
|
105 | - $parts = explode(',', $line); |
|
106 | - $parts = array_filter($parts); |
|
107 | - |
|
108 | - foreach ($parts as $part) { |
|
109 | - if (!$this->validatePart($part)) { |
|
110 | - return false; |
|
111 | - } |
|
112 | - } |
|
113 | - |
|
114 | - return true; |
|
115 | - } |
|
116 | - |
|
117 | - /** |
|
118 | - * Check each part of the line doesn't contain spaces between words. |
|
119 | - * |
|
120 | - * @param string $part |
|
121 | - * |
|
122 | - * @return bool |
|
123 | - */ |
|
124 | - protected function validatePart($part) |
|
125 | - { |
|
126 | - if (strpos($part, '=>') !== false) { |
|
127 | - $subs = explode('=>', $part); |
|
128 | - $subs = array_filter($subs); |
|
129 | - |
|
130 | - foreach ($subs as $sub) { |
|
131 | - if (!$this->validateNoSpaces($sub)) { |
|
132 | - return false; |
|
133 | - } |
|
134 | - } |
|
135 | - |
|
136 | - return true; |
|
137 | - } |
|
138 | - |
|
139 | - return $this->validateNoSpaces($part); |
|
140 | - } |
|
141 | - |
|
142 | - /** |
|
143 | - * @param string $value |
|
144 | - * |
|
145 | - * @return bool |
|
146 | - */ |
|
147 | - protected function validateNoSpaces($value) |
|
148 | - { |
|
149 | - // allow spaces at the beginning and end of the value |
|
150 | - $value = trim($value); |
|
151 | - |
|
152 | - // does the value contain 1 or more whitespace characters? |
|
153 | - if (preg_match('/\s+/', $value)) { |
|
154 | - return false; |
|
155 | - } |
|
156 | - |
|
157 | - return true; |
|
158 | - } |
|
9 | + /** |
|
10 | + * @var array |
|
11 | + */ |
|
12 | + protected $fieldNames; |
|
13 | + |
|
14 | + /** |
|
15 | + * @inheritdoc |
|
16 | + * |
|
17 | + * @param array $fieldNames |
|
18 | + */ |
|
19 | + public function __construct(array $fieldNames) |
|
20 | + { |
|
21 | + $this->fieldNames = $fieldNames; |
|
22 | + |
|
23 | + parent::__construct(); |
|
24 | + } |
|
25 | + |
|
26 | + /** |
|
27 | + * @inheritdoc |
|
28 | + * |
|
29 | + * @param array $data |
|
30 | + * |
|
31 | + * @return mixed |
|
32 | + */ |
|
33 | + public function php($data) |
|
34 | + { |
|
35 | + foreach ($this->fieldNames as $fieldName) { |
|
36 | + if (empty($data[$fieldName])) { |
|
37 | + return; |
|
38 | + } |
|
39 | + |
|
40 | + $this->validateField($fieldName, $data[$fieldName]); |
|
41 | + } |
|
42 | + } |
|
43 | + |
|
44 | + /** |
|
45 | + * Validate field values, raising errors if the values are invalid. |
|
46 | + * |
|
47 | + * @param string $fieldName |
|
48 | + * @param mixed $value |
|
49 | + */ |
|
50 | + protected function validateField($fieldName, $value) |
|
51 | + { |
|
52 | + if (!$this->validateValue($value)) { |
|
53 | + $this->validationError( |
|
54 | + $fieldName, |
|
55 | + _t( |
|
56 | + 'FullTextSearch.SynonymValidator.InvalidValue', |
|
57 | + 'Synonyms cannot contain words separated by spaces' |
|
58 | + ) |
|
59 | + ); |
|
60 | + } |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * Check field values to see that they doesn't contain spaces between words. |
|
65 | + * |
|
66 | + * @param mixed $value |
|
67 | + * |
|
68 | + * @return bool |
|
69 | + */ |
|
70 | + protected function validateValue($value) |
|
71 | + { |
|
72 | + // strip empty lines |
|
73 | + $lines = array_filter( |
|
74 | + explode("\n", $value) |
|
75 | + ); |
|
76 | + |
|
77 | + // strip comments (lines beginning with "#") |
|
78 | + $lines = array_filter($lines, function ($line) { |
|
79 | + $line = trim($line); |
|
80 | + |
|
81 | + return !empty($line) && $line[0] !== '#'; |
|
82 | + }); |
|
83 | + |
|
84 | + // validate each line |
|
85 | + foreach ($lines as $line) { |
|
86 | + if (!$this->validateLine($line)) { |
|
87 | + return false; |
|
88 | + } |
|
89 | + } |
|
90 | + |
|
91 | + return true; |
|
92 | + } |
|
93 | + |
|
94 | + /** |
|
95 | + * Check each line to see that it doesn't contain spaces between words. |
|
96 | + * |
|
97 | + * @param string $line |
|
98 | + * |
|
99 | + * @return bool |
|
100 | + */ |
|
101 | + protected function validateLine($line) |
|
102 | + { |
|
103 | + $line = trim($line); |
|
104 | + |
|
105 | + $parts = explode(',', $line); |
|
106 | + $parts = array_filter($parts); |
|
107 | + |
|
108 | + foreach ($parts as $part) { |
|
109 | + if (!$this->validatePart($part)) { |
|
110 | + return false; |
|
111 | + } |
|
112 | + } |
|
113 | + |
|
114 | + return true; |
|
115 | + } |
|
116 | + |
|
117 | + /** |
|
118 | + * Check each part of the line doesn't contain spaces between words. |
|
119 | + * |
|
120 | + * @param string $part |
|
121 | + * |
|
122 | + * @return bool |
|
123 | + */ |
|
124 | + protected function validatePart($part) |
|
125 | + { |
|
126 | + if (strpos($part, '=>') !== false) { |
|
127 | + $subs = explode('=>', $part); |
|
128 | + $subs = array_filter($subs); |
|
129 | + |
|
130 | + foreach ($subs as $sub) { |
|
131 | + if (!$this->validateNoSpaces($sub)) { |
|
132 | + return false; |
|
133 | + } |
|
134 | + } |
|
135 | + |
|
136 | + return true; |
|
137 | + } |
|
138 | + |
|
139 | + return $this->validateNoSpaces($part); |
|
140 | + } |
|
141 | + |
|
142 | + /** |
|
143 | + * @param string $value |
|
144 | + * |
|
145 | + * @return bool |
|
146 | + */ |
|
147 | + protected function validateNoSpaces($value) |
|
148 | + { |
|
149 | + // allow spaces at the beginning and end of the value |
|
150 | + $value = trim($value); |
|
151 | + |
|
152 | + // does the value contain 1 or more whitespace characters? |
|
153 | + if (preg_match('/\s+/', $value)) { |
|
154 | + return false; |
|
155 | + } |
|
156 | + |
|
157 | + return true; |
|
158 | + } |
|
159 | 159 | } |
@@ -75,7 +75,7 @@ |
||
75 | 75 | ); |
76 | 76 | |
77 | 77 | // strip comments (lines beginning with "#") |
78 | - $lines = array_filter($lines, function ($line) { |
|
78 | + $lines = array_filter($lines, function($line) { |
|
79 | 79 | $line = trim($line); |
80 | 80 | |
81 | 81 | return !empty($line) && $line[0] !== '#'; |
@@ -13,21 +13,21 @@ |
||
13 | 13 | */ |
14 | 14 | class CwpCommentingExtension extends Extension |
15 | 15 | { |
16 | - public function alterCommentForm(Form $form) |
|
17 | - { |
|
18 | - $fields = $form->Fields(); |
|
16 | + public function alterCommentForm(Form $form) |
|
17 | + { |
|
18 | + $fields = $form->Fields(); |
|
19 | 19 | |
20 | 20 | |
21 | - if ($emailField = $fields->dataFieldByName(Email::class)) { |
|
22 | - $emailField |
|
23 | - ->setTitle(_t('CwpCommentingExtension.EMAIL_TITLE', Email::class)) |
|
24 | - ->setDescription(_t('CwpCommentingExtension.WILL_NOT_BE_PUBLISHED', 'Will not be published.')); |
|
25 | - } |
|
21 | + if ($emailField = $fields->dataFieldByName(Email::class)) { |
|
22 | + $emailField |
|
23 | + ->setTitle(_t('CwpCommentingExtension.EMAIL_TITLE', Email::class)) |
|
24 | + ->setDescription(_t('CwpCommentingExtension.WILL_NOT_BE_PUBLISHED', 'Will not be published.')); |
|
25 | + } |
|
26 | 26 | |
27 | - if ($urlField = $fields->dataFieldByName('URL')) { |
|
28 | - $urlField |
|
29 | - ->setTitle(_t('CwpCommentingExtension.WEBSITE_TITLE', 'Your website (optional)')) |
|
30 | - ->setAttribute('placeholder', 'http://'); |
|
31 | - } |
|
32 | - } |
|
27 | + if ($urlField = $fields->dataFieldByName('URL')) { |
|
28 | + $urlField |
|
29 | + ->setTitle(_t('CwpCommentingExtension.WEBSITE_TITLE', 'Your website (optional)')) |
|
30 | + ->setAttribute('placeholder', 'http://'); |
|
31 | + } |
|
32 | + } |
|
33 | 33 | } |
@@ -9,39 +9,39 @@ |
||
9 | 9 | |
10 | 10 | class CwpSiteTreeExtension extends DataExtension |
11 | 11 | { |
12 | - private static $db = array( |
|
13 | - 'ShowPageUtilities' => 'Boolean(1)' |
|
14 | - ); |
|
12 | + private static $db = array( |
|
13 | + 'ShowPageUtilities' => 'Boolean(1)' |
|
14 | + ); |
|
15 | 15 | |
16 | - private static $defaults = array( |
|
17 | - 'ShowPageUtilities' => true |
|
18 | - ); |
|
16 | + private static $defaults = array( |
|
17 | + 'ShowPageUtilities' => true |
|
18 | + ); |
|
19 | 19 | |
20 | - /** |
|
21 | - * Modify the settings for a SiteTree |
|
22 | - * |
|
23 | - * {@inheritDoc} |
|
24 | - * |
|
25 | - * @param FieldList $fields |
|
26 | - */ |
|
27 | - public function updateSettingsFields(FieldList $fields) |
|
28 | - { |
|
29 | - $helpText = _t( |
|
30 | - 'SiteTree.SHOW_PAGE_UTILITIES_HELP', |
|
31 | - 'You can disable page utilities (print, share, etc) for this page' |
|
32 | - ); |
|
20 | + /** |
|
21 | + * Modify the settings for a SiteTree |
|
22 | + * |
|
23 | + * {@inheritDoc} |
|
24 | + * |
|
25 | + * @param FieldList $fields |
|
26 | + */ |
|
27 | + public function updateSettingsFields(FieldList $fields) |
|
28 | + { |
|
29 | + $helpText = _t( |
|
30 | + 'SiteTree.SHOW_PAGE_UTILITIES_HELP', |
|
31 | + 'You can disable page utilities (print, share, etc) for this page' |
|
32 | + ); |
|
33 | 33 | |
34 | - $fields->addFieldsToTab( |
|
35 | - 'Root.Settings', |
|
36 | - array( |
|
37 | - LiteralField::create('PageUtilitiesHelp', $helpText), |
|
38 | - CheckboxField::create('ShowPageUtilities', $this->owner->fieldLabel('ShowPageUtilities')) |
|
39 | - ) |
|
40 | - ); |
|
41 | - } |
|
34 | + $fields->addFieldsToTab( |
|
35 | + 'Root.Settings', |
|
36 | + array( |
|
37 | + LiteralField::create('PageUtilitiesHelp', $helpText), |
|
38 | + CheckboxField::create('ShowPageUtilities', $this->owner->fieldLabel('ShowPageUtilities')) |
|
39 | + ) |
|
40 | + ); |
|
41 | + } |
|
42 | 42 | |
43 | - public function updateFieldLabels(&$labels) |
|
44 | - { |
|
45 | - $labels['ShowPageUtilities'] = _t('SiteTree.SHOW_PAGE_UTILITIES', 'Show page utilities?'); |
|
46 | - } |
|
43 | + public function updateFieldLabels(&$labels) |
|
44 | + { |
|
45 | + $labels['ShowPageUtilities'] = _t('SiteTree.SHOW_PAGE_UTILITIES', 'Show page utilities?'); |
|
46 | + } |
|
47 | 47 | } |
@@ -12,37 +12,37 @@ |
||
12 | 12 | */ |
13 | 13 | class CwpWorkflowDefinitionExtension extends DataExtension |
14 | 14 | { |
15 | - /** |
|
16 | - * Create the default 'Two-step Workflow' when this extension is loaded |
|
17 | - * |
|
18 | - * @config |
|
19 | - * @var boolean |
|
20 | - */ |
|
21 | - private static $create_default_workflow = true; |
|
15 | + /** |
|
16 | + * Create the default 'Two-step Workflow' when this extension is loaded |
|
17 | + * |
|
18 | + * @config |
|
19 | + * @var boolean |
|
20 | + */ |
|
21 | + private static $create_default_workflow = true; |
|
22 | 22 | |
23 | - public function requireDefaultRecords() |
|
24 | - { |
|
25 | - if (Config::inst()->get(CwpWorkflowDefinitionExtension::class, 'create_default_workflow')) { |
|
26 | - // Only proceed if a definition using this template has not been created yet |
|
27 | - $definition = WorkflowDefinition::get()->filter("Template", "Review and Approve")->First(); |
|
28 | - if ($definition && $definition->exists()) { |
|
29 | - return; |
|
30 | - } |
|
23 | + public function requireDefaultRecords() |
|
24 | + { |
|
25 | + if (Config::inst()->get(CwpWorkflowDefinitionExtension::class, 'create_default_workflow')) { |
|
26 | + // Only proceed if a definition using this template has not been created yet |
|
27 | + $definition = WorkflowDefinition::get()->filter("Template", "Review and Approve")->First(); |
|
28 | + if ($definition && $definition->exists()) { |
|
29 | + return; |
|
30 | + } |
|
31 | 31 | |
32 | - //generate from the template, which happens after we write the definition |
|
33 | - $definition = WorkflowDefinition::create(); |
|
34 | - $definition->Template = "Review and Approve"; |
|
35 | - $definition->write(); |
|
32 | + //generate from the template, which happens after we write the definition |
|
33 | + $definition = WorkflowDefinition::create(); |
|
34 | + $definition->Template = "Review and Approve"; |
|
35 | + $definition->write(); |
|
36 | 36 | |
37 | - //change the title, description, and reminder days |
|
38 | - $definition->update(array( |
|
39 | - 'Title' => "Two-step Workflow", |
|
40 | - 'Description' => "Content Authors can write content and Content Publishers can approve/reject.", |
|
41 | - 'RemindDays' => 3, |
|
42 | - )); |
|
43 | - $definition->write(); |
|
37 | + //change the title, description, and reminder days |
|
38 | + $definition->update(array( |
|
39 | + 'Title' => "Two-step Workflow", |
|
40 | + 'Description' => "Content Authors can write content and Content Publishers can approve/reject.", |
|
41 | + 'RemindDays' => 3, |
|
42 | + )); |
|
43 | + $definition->write(); |
|
44 | 44 | |
45 | - DB::alteration_message("Added default workflow definition to WorkflowDefinition table", "created"); |
|
46 | - } |
|
47 | - } |
|
45 | + DB::alteration_message("Added default workflow definition to WorkflowDefinition table", "created"); |
|
46 | + } |
|
47 | + } |
|
48 | 48 | } |
@@ -11,55 +11,55 @@ |
||
11 | 11 | */ |
12 | 12 | class CustomSiteConfig extends DataExtension |
13 | 13 | { |
14 | - private static $db = array( |
|
15 | - 'GACode' => 'Varchar(16)', |
|
16 | - 'FacebookURL' => 'Varchar(256)', // multitude of ways to link to Facebook accounts, best to leave it open. |
|
17 | - 'TwitterUsername' => 'Varchar(16)', // max length of Twitter username 15 |
|
18 | - ); |
|
14 | + private static $db = array( |
|
15 | + 'GACode' => 'Varchar(16)', |
|
16 | + 'FacebookURL' => 'Varchar(256)', // multitude of ways to link to Facebook accounts, best to leave it open. |
|
17 | + 'TwitterUsername' => 'Varchar(16)', // max length of Twitter username 15 |
|
18 | + ); |
|
19 | 19 | |
20 | - public function updateCMSFields(FieldList $fields) |
|
21 | - { |
|
22 | - $fields->addFieldToTab( |
|
23 | - 'Root.Main', |
|
24 | - $gaCode = TextField::create( |
|
25 | - 'GACode', |
|
26 | - _t('CwpConfig.GaField', 'Google Analytics account') |
|
27 | - ) |
|
28 | - ); |
|
20 | + public function updateCMSFields(FieldList $fields) |
|
21 | + { |
|
22 | + $fields->addFieldToTab( |
|
23 | + 'Root.Main', |
|
24 | + $gaCode = TextField::create( |
|
25 | + 'GACode', |
|
26 | + _t('CwpConfig.GaField', 'Google Analytics account') |
|
27 | + ) |
|
28 | + ); |
|
29 | 29 | |
30 | - $gaCode->setRightTitle( |
|
31 | - _t( |
|
32 | - 'CwpConfig.GaFieldDesc', |
|
33 | - 'Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)' |
|
34 | - ) |
|
35 | - ); |
|
30 | + $gaCode->setRightTitle( |
|
31 | + _t( |
|
32 | + 'CwpConfig.GaFieldDesc', |
|
33 | + 'Account number to be used all across the site (in the format <strong>UA-XXXXX-X</strong>)' |
|
34 | + ) |
|
35 | + ); |
|
36 | 36 | |
37 | - $fields->findOrMakeTab('Root.SocialMedia', _t('CustomSiteConfig.SocialMediaTab', 'Social Media')); |
|
37 | + $fields->findOrMakeTab('Root.SocialMedia', _t('CustomSiteConfig.SocialMediaTab', 'Social Media')); |
|
38 | 38 | |
39 | - $fields->addFieldToTab( |
|
40 | - 'Root.SocialMedia', |
|
41 | - $facebookURL = TextField::create( |
|
42 | - 'FacebookURL', |
|
43 | - _t('CwpConfig.FbField', 'Facebook UID or username') |
|
44 | - ) |
|
45 | - ); |
|
46 | - $facebookURL->setRightTitle( |
|
47 | - _t( |
|
48 | - 'CwpConfig.FbFieldDesc', |
|
49 | - 'Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/' |
|
50 | - . '<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)' |
|
51 | - ) |
|
52 | - ); |
|
39 | + $fields->addFieldToTab( |
|
40 | + 'Root.SocialMedia', |
|
41 | + $facebookURL = TextField::create( |
|
42 | + 'FacebookURL', |
|
43 | + _t('CwpConfig.FbField', 'Facebook UID or username') |
|
44 | + ) |
|
45 | + ); |
|
46 | + $facebookURL->setRightTitle( |
|
47 | + _t( |
|
48 | + 'CwpConfig.FbFieldDesc', |
|
49 | + 'Facebook link (everything after the "http://facebook.com/", eg http://facebook.com/' |
|
50 | + . '<strong>username</strong> or http://facebook.com/<strong>pages/108510539573</strong>)' |
|
51 | + ) |
|
52 | + ); |
|
53 | 53 | |
54 | - $fields->addFieldToTab( |
|
55 | - 'Root.SocialMedia', |
|
56 | - $twitterUsername = TextField::create( |
|
57 | - 'TwitterUsername', |
|
58 | - _t('CwpConfig.TwitterField', 'Twitter username') |
|
59 | - ) |
|
60 | - ); |
|
61 | - $twitterUsername->setRightTitle( |
|
62 | - _t('CwpConfig.TwitterFieldDesc', 'Twitter username (eg, http://twitter.com/<strong>username</strong>)') |
|
63 | - ); |
|
64 | - } |
|
54 | + $fields->addFieldToTab( |
|
55 | + 'Root.SocialMedia', |
|
56 | + $twitterUsername = TextField::create( |
|
57 | + 'TwitterUsername', |
|
58 | + _t('CwpConfig.TwitterField', 'Twitter username') |
|
59 | + ) |
|
60 | + ); |
|
61 | + $twitterUsername->setRightTitle( |
|
62 | + _t('CwpConfig.TwitterFieldDesc', 'Twitter username (eg, http://twitter.com/<strong>username</strong>)') |
|
63 | + ); |
|
64 | + } |
|
65 | 65 | } |
@@ -8,42 +8,42 @@ |
||
8 | 8 | |
9 | 9 | class BasePageTest extends SapphireTest |
10 | 10 | { |
11 | - protected static $fixture_file = 'BasePageTest.yml'; |
|
12 | - |
|
13 | - protected function setUp() |
|
14 | - { |
|
15 | - parent::setUp(); |
|
16 | - |
|
17 | - Config::modify()->set(BasePage::class, 'pdf_export', true); |
|
18 | - Config::modify()->set(BasePage::class, 'generated_pdf_path', 'assets/_generated_pdfs'); |
|
19 | - } |
|
20 | - |
|
21 | - public function testPdfFilename() |
|
22 | - { |
|
23 | - $page = $this->objFromFixture(BasePage::class, 'test-page-one'); |
|
24 | - $this->assertContains( |
|
25 | - 'assets/_generated_pdfs/test-page-one-1.pdf', |
|
26 | - $page->getPdfFilename(), |
|
27 | - 'Generated filename for PDF' |
|
28 | - ); |
|
29 | - } |
|
30 | - |
|
31 | - public function testPdfLink() |
|
32 | - { |
|
33 | - $page = $this->objFromFixture(BasePage::class, 'test-page-one'); |
|
34 | - $this->assertContains('test-page-one/downloadpdf', $page->PdfLink(), 'Link to download PDF'); |
|
35 | - } |
|
36 | - |
|
37 | - public function testHomePagePdfLink() |
|
38 | - { |
|
39 | - $page = $this->objFromFixture(BasePage::class, 'home-page'); |
|
40 | - $this->assertContains('home/downloadpdf', $page->PdfLink(), 'Link to download PDF'); |
|
41 | - } |
|
42 | - |
|
43 | - public function testPdfLinkDisabled() |
|
44 | - { |
|
45 | - Config::modify()->set(BasePage::class, 'pdf_export', false); |
|
46 | - $page = $this->objFromFixture(BasePage::class, 'test-page-one'); |
|
47 | - $this->assertFalse($page->PdfLink(), 'No PDF link as the functionality is disabled'); |
|
48 | - } |
|
11 | + protected static $fixture_file = 'BasePageTest.yml'; |
|
12 | + |
|
13 | + protected function setUp() |
|
14 | + { |
|
15 | + parent::setUp(); |
|
16 | + |
|
17 | + Config::modify()->set(BasePage::class, 'pdf_export', true); |
|
18 | + Config::modify()->set(BasePage::class, 'generated_pdf_path', 'assets/_generated_pdfs'); |
|
19 | + } |
|
20 | + |
|
21 | + public function testPdfFilename() |
|
22 | + { |
|
23 | + $page = $this->objFromFixture(BasePage::class, 'test-page-one'); |
|
24 | + $this->assertContains( |
|
25 | + 'assets/_generated_pdfs/test-page-one-1.pdf', |
|
26 | + $page->getPdfFilename(), |
|
27 | + 'Generated filename for PDF' |
|
28 | + ); |
|
29 | + } |
|
30 | + |
|
31 | + public function testPdfLink() |
|
32 | + { |
|
33 | + $page = $this->objFromFixture(BasePage::class, 'test-page-one'); |
|
34 | + $this->assertContains('test-page-one/downloadpdf', $page->PdfLink(), 'Link to download PDF'); |
|
35 | + } |
|
36 | + |
|
37 | + public function testHomePagePdfLink() |
|
38 | + { |
|
39 | + $page = $this->objFromFixture(BasePage::class, 'home-page'); |
|
40 | + $this->assertContains('home/downloadpdf', $page->PdfLink(), 'Link to download PDF'); |
|
41 | + } |
|
42 | + |
|
43 | + public function testPdfLinkDisabled() |
|
44 | + { |
|
45 | + Config::modify()->set(BasePage::class, 'pdf_export', false); |
|
46 | + $page = $this->objFromFixture(BasePage::class, 'test-page-one'); |
|
47 | + $this->assertFalse($page->PdfLink(), 'No PDF link as the functionality is disabled'); |
|
48 | + } |
|
49 | 49 | } |