@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @inheritdoc |
35 | 35 | */ |
36 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
36 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
37 | 37 | { |
38 | 38 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
39 | 39 | if (!empty($searchData)) { |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | public function getComponentDetails() |
60 | 60 | { |
61 | 61 | return [ |
62 | - 'name' => 'Colour', 'icon' => 'fa fa-paint-brush', 'group' => 'Text', 'order' => 170, |
|
62 | + 'name' => 'Colour', 'icon' => 'fa fa-paint-brush', 'group' => 'Text', 'order' => 170, |
|
63 | 63 | ]; |
64 | 64 | } |
65 | 65 | } |
66 | 66 | \ No newline at end of file |
@@ -53,7 +53,7 @@ |
||
53 | 53 | public function setValue($value) |
54 | 54 | { |
55 | 55 | if ($value === 'true' || $value === true) |
56 | - $this->getForm()->submittedButton=$this->getName(); |
|
56 | + $this->getForm()->submittedButton = $this->getName(); |
|
57 | 57 | return $this; |
58 | 58 | } |
59 | 59 |
@@ -70,18 +70,18 @@ discard block |
||
70 | 70 | 'toolbar' => [ |
71 | 71 | [ |
72 | 72 | 'name' => 'paragraph', |
73 | - 'items' => [ 'Bold', 'Italic', 'Underline', 'Link', 'Unlink', 'EmojiPanel', 'Source' ] |
|
73 | + 'items' => ['Bold', 'Italic', 'Underline', 'Link', 'Unlink', 'EmojiPanel', 'Source'] |
|
74 | 74 | ] |
75 | 75 | ] |
76 | 76 | ], |
77 | 77 | 'default' => [ |
78 | 78 | 'toolbar' => [ |
79 | - [ 'name' => 'paragraph', 'items' => [ 'Format', 'Bold', 'Italic', 'Underline', '-', 'Superscript', 'Subscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock','-', 'NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote'] ], |
|
80 | - [ 'name' => 'links', 'items' => [ 'Link', 'Unlink', 'Anchor', '-', 'EmojiPanel' ] ], |
|
81 | - [ 'name' => 'insert', 'items' => [ |
|
82 | - 'Image', ($this->useMediaBrowser ? 'Fireflyimage' : 'SimpleImageUpload'), '-', 'Table', 'SpecialChar' ] ], |
|
83 | - [ 'name' => 'document', 'items' => ['Maximize' ] ], |
|
84 | - [ 'name' => 'source', 'items' => [ 'RemoveFormat', '-', 'Source' ] ] |
|
79 | + ['name' => 'paragraph', 'items' => ['Format', 'Bold', 'Italic', 'Underline', '-', 'Superscript', 'Subscript', '-', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock', '-', 'NumberedList', 'BulletedList', 'Outdent', 'Indent', 'Blockquote']], |
|
80 | + ['name' => 'links', 'items' => ['Link', 'Unlink', 'Anchor', '-', 'EmojiPanel']], |
|
81 | + ['name' => 'insert', 'items' => [ |
|
82 | + 'Image', ($this->useMediaBrowser ? 'Fireflyimage' : 'SimpleImageUpload'), '-', 'Table', 'SpecialChar']], |
|
83 | + ['name' => 'document', 'items' => ['Maximize']], |
|
84 | + ['name' => 'source', 'items' => ['RemoveFormat', '-', 'Source']] |
|
85 | 85 | ], |
86 | 86 | 'extraPlugins' => [($this->useMediaBrowser ? 'fireflyimage' : 'simpleImageUpload')], |
87 | 87 | 'extraAllowedContent'=>'img[srcset,sizes,loading]' |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | * Return the purified value but allow tags to be as normal |
119 | 119 | * otherwise will lose ability to edit wysiwyg fields properly |
120 | 120 | */ |
121 | - public function getValueDisplay($context='') |
|
121 | + public function getValueDisplay($context = '') |
|
122 | 122 | { |
123 | - if ($context==='grid') { |
|
123 | + if ($context === 'grid') { |
|
124 | 124 | return strip_tags(Str::truncate($this->getValue(), 200, '...', null, true)); |
125 | 125 | } |
126 | 126 | return $this->getValue(); |
@@ -131,6 +131,6 @@ discard block |
||
131 | 131 | */ |
132 | 132 | public function getComponentDetails() |
133 | 133 | { |
134 | - return ['label' => 'Rich Text', 'group' => 'Formatted Text', 'icon' => 'fa fa-font', 'order' => 220]; |
|
134 | + return ['label' => 'Rich Text', 'group' => 'Formatted Text', 'icon' => 'fa fa-font', 'order' => 220]; |
|
135 | 135 | } |
136 | 136 | } |
@@ -40,7 +40,7 @@ |
||
40 | 40 | public function getComponentDetails() |
41 | 41 | { |
42 | 42 | return [ |
43 | - 'label' => 'El Switch', 'icon' => 'fa fa-toggle-on', 'group' => 'Choice', 'order'=>465, |
|
43 | + 'label' => 'El Switch', 'icon' => 'fa fa-toggle-on', 'group' => 'Choice', 'order'=>465, |
|
44 | 44 | ]; |
45 | 45 | } |
46 | 46 |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | * Any filters you want to apply to a data map selection. |
64 | 64 | * @var array field=>value |
65 | 65 | */ |
66 | - public $dataMapFilters=[]; |
|
66 | + public $dataMapFilters = []; |
|
67 | 67 | |
68 | 68 | /** |
69 | 69 | * Any fields you want to return in a data map selection if not the default. |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | * string (otherwise with a space) and prefix postfix arguments will be |
75 | 75 | * applied to it. |
76 | 76 | */ |
77 | - public $dataMapFields=[]; |
|
77 | + public $dataMapFields = []; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * @inheritdoc |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | * @return array |
134 | 134 | * @throws \Exception |
135 | 135 | */ |
136 | - public function getMapObjects($query=null, $start=0, $length=100) |
|
136 | + public function getMapObjects($query = null, $start = 0, $length = 100) |
|
137 | 137 | { |
138 | 138 | $provider = $this->getProviderService(); |
139 | 139 | $format = ['prefix'=>'', 'concat'=>' ', 'postfix' => '']; |
@@ -165,12 +165,12 @@ discard block |
||
165 | 165 | /** |
166 | 166 | * @inheritdoc |
167 | 167 | */ |
168 | - public function getValueDisplay($context='') |
|
168 | + public function getValueDisplay($context = '') |
|
169 | 169 | { |
170 | 170 | $items = $this->getItems(); |
171 | 171 | if (is_array($this->value)) { |
172 | 172 | $values = array_intersect_key($items, array_flip($this->value)); |
173 | - return implode(', ',$values); |
|
173 | + return implode(', ', $values); |
|
174 | 174 | } else if (isset($items[$this->value])) { |
175 | 175 | return $items[$this->value]; |
176 | 176 | } |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | /** |
206 | 206 | * @inheritdoc |
207 | 207 | */ |
208 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
208 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
209 | 209 | { |
210 | 210 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
211 | 211 | if ($searchData !== '') { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | class HtmlRaw extends TextArea |
17 | 17 | { |
18 | - const TEXT_TRUNCATE_LENGTH=250; |
|
18 | + const TEXT_TRUNCATE_LENGTH = 250; |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * Set some allowable tags for single text fields |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | /** |
34 | 34 | * @inheritdoc |
35 | 35 | */ |
36 | - public function getValueDisplay($context='') |
|
36 | + public function getValueDisplay($context = '') |
|
37 | 37 | { |
38 | 38 | $text = parent::getValueDisplay(); |
39 | 39 | if (strlen($text) > self::TEXT_TRUNCATE_LENGTH) |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | /** |
55 | 55 | * @inheritdoc |
56 | 56 | */ |
57 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
57 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
58 | 58 | { |
59 | 59 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
60 | 60 | if ($searchData !== '') { |
@@ -72,7 +72,7 @@ discard block |
||
72 | 72 | // depending on how this grid was set up, this call may or may not have been made. |
73 | 73 | // The results are cached so call it here to be safe. |
74 | 74 | $totalCount = $this->getTotalCount(); |
75 | - $limit = [ |
|
75 | + $limit = [ |
|
76 | 76 | 'start' => $pagination->getOffset(), |
77 | 77 | 'length' => $pagination->getLimit(), |
78 | 78 | 'total' => ($totalCount > 0 ? $totalCount : true) |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | * Store a total count to save multiple recalculations |
122 | 122 | * @var type |
123 | 123 | */ |
124 | - private $_totalCountCache=[]; |
|
124 | + private $_totalCountCache = []; |
|
125 | 125 | |
126 | 126 | /** |
127 | 127 | * @inheritDoc |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | * 'count_current', 'count_deleted', ['deleted']] - deleted is set if you've |
49 | 49 | * set $includeDeleted to true |
50 | 50 | */ |
51 | - public function listClasses($module, &$total, $includeDeleted=false, $start=0, $length=100, $orderBy='label'); |
|
51 | + public function listClasses($module, &$total, $includeDeleted = false, $start = 0, $length = 100, $orderBy = 'label'); |
|
52 | 52 | |
53 | 53 | /** |
54 | 54 | * Return the number of defined classes |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @param boolean $includeDeleted default false |
58 | 58 | * @return integer |
59 | 59 | */ |
60 | - public function countClasses($module=null, $includeDeleted=false); |
|
60 | + public function countClasses($module = null, $includeDeleted = false); |
|
61 | 61 | |
62 | 62 | /** |
63 | 63 | * create a new class |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * class_type, label, description, module, deleted, count_total, |
97 | 97 | * count_deleted, members |
98 | 98 | */ |
99 | - public function getClass($classType, $includeMembers=false); |
|
99 | + public function getClass($classType, $includeMembers = false); |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Edit a class |
@@ -156,7 +156,7 @@ discard block |
||
156 | 156 | * where deleted is given if $includeDeleted is true and keyBy is @see $keyBy |
157 | 157 | * Empty array is returned if there are no results |
158 | 158 | */ |
159 | - public function listMembers($classType, $includeDeleted=false, $keyBy='member_ref'); |
|
159 | + public function listMembers($classType, $includeDeleted = false, $keyBy = 'member_ref'); |
|
160 | 160 | |
161 | 161 | /** |
162 | 162 | * Create a new member for a class |
@@ -182,7 +182,7 @@ discard block |
||
182 | 182 | * @throw InvalidArgumentException if the member already exists or the class doesn't |
183 | 183 | * @throw RunTimeException if the member could not be added |
184 | 184 | */ |
185 | - public function addMember($classType, &$memberRef, $dataTypeRef, $label, $description, $additional=null); |
|
185 | + public function addMember($classType, &$memberRef, $dataTypeRef, $label, $description, $additional = null); |
|
186 | 186 | |
187 | 187 | /** |
188 | 188 | * Get the details of a member |
@@ -194,7 +194,7 @@ discard block |
||
194 | 194 | * id, class_type, member_ref, data_type_ref, label, description, |
195 | 195 | * choices, link_class, deleted] |
196 | 196 | */ |
197 | - public function getMember($classType, $memberRef, $fields=[]); |
|
197 | + public function getMember($classType, $memberRef, $fields = []); |
|
198 | 198 | |
199 | 199 | /** |
200 | 200 | * Edit a member's details |
@@ -51,7 +51,7 @@ discard block |
||
51 | 51 | /** |
52 | 52 | * @inheritdoc |
53 | 53 | */ |
54 | - public function countClasses($module=null, $includeDeleted=false) |
|
54 | + public function countClasses($module = null, $includeDeleted = false) |
|
55 | 55 | { |
56 | 56 | $query = $this->_getClassesQuery($module, $includeDeleted); |
57 | 57 | return $query->count(); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | /** |
61 | 61 | * @inheritdoc |
62 | 62 | */ |
63 | - public function listClasses($module, &$total, $includeDeleted=false, $start=0, $length=100, $orderBy='label') |
|
63 | + public function listClasses($module, &$total, $includeDeleted = false, $start = 0, $length = 100, $orderBy = 'label') |
|
64 | 64 | { |
65 | 65 | $query = $this->_getClassesQuery($module, $includeDeleted); |
66 | 66 | if ($start == 0) |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | $c->class_type = $classType; |
121 | 121 | $c->module = (empty($module) ? null : $module); |
122 | 122 | if (!$c->save()) |
123 | - throw new \RuntimeException("Couldn't save the class: ".print_r($c->errors,true)); |
|
123 | + throw new \RuntimeException("Couldn't save the class: ".print_r($c->errors, true)); |
|
124 | 124 | $upSql = $this->getClassTypeMigrationSql($classType); |
125 | 125 | $downSql = "DELETE FROM `dds_class` WHERE `class_type`='$classType';"; |
126 | 126 | $this->storeMigration($upSql, $downSql); |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | /** |
132 | 132 | * @inheritdoc |
133 | 133 | */ |
134 | - public function getClass($classType, $includeMembers=false) |
|
134 | + public function getClass($classType, $includeMembers = false) |
|
135 | 135 | { |
136 | 136 | if ($this->findClass($classType, $class)) { |
137 | 137 | $data = $class->toArray(); |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | public function editClass($classType, $changes) |
149 | 149 | { |
150 | 150 | $allowed = array_intersect_key($changes, array_flip(['label', 'description', 'module', 'change_log'])); |
151 | - if (count($allowed)==0) |
|
151 | + if (count($allowed) == 0) |
|
152 | 152 | return; |
153 | 153 | $this->clearClassCache($classType); |
154 | 154 | $downSql = $this->getClassTypeMigrationSql($classType); |
@@ -232,7 +232,7 @@ discard block |
||
232 | 232 | /** |
233 | 233 | * @inheritdoc |
234 | 234 | */ |
235 | - public function listMembers($classType, $includeDeleted=false, $keyBy='member_ref') |
|
235 | + public function listMembers($classType, $includeDeleted = false, $keyBy = 'member_ref') |
|
236 | 236 | { |
237 | 237 | return $this->listMembersForClass($classType, $includeDeleted, $keyBy); |
238 | 238 | } |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | /** |
241 | 241 | * @inheritdoc |
242 | 242 | */ |
243 | - public function addMember($classType, &$memberRef, $dataTypeRef, $label, $description, $additional=null) |
|
243 | + public function addMember($classType, &$memberRef, $dataTypeRef, $label, $description, $additional = null) |
|
244 | 244 | { |
245 | 245 | $classType = $this->canonicaliseRef($classType); |
246 | 246 | $memberRef = $this->canonicaliseRef($memberRef); |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | // extract out any additional information |
250 | 250 | $choices = ((!empty($additional['choices']) && is_array($additional['choices'])) ? $additional['choices'] : []); |
251 | 251 | $linkClass = (!empty($additional['link_class']) ? $additional['link_class'] : null); |
252 | - if (DdsMember::findOne(['class_type' => $classType, 'member_ref' => $memberRef])!==null) |
|
252 | + if (DdsMember::findOne(['class_type' => $classType, 'member_ref' => $memberRef]) !== null) |
|
253 | 253 | throw new \InvalidArgumentException("The member $memberRef already exists"); |
254 | 254 | if (in_array($dataTypeRef, ['link_uni', 'link_multi']) && !$linkClass) { |
255 | 255 | throw new \InvalidArgumentException("Link_uni, link_multi data types require a link_class to be passed for member '$classType::$memberRef'. You passed in ".print_r($additional, true)); |
@@ -273,7 +273,7 @@ discard block |
||
273 | 273 | $mId = $this->storeMigration($upMember, $downMember); |
274 | 274 | |
275 | 275 | // and create the member column |
276 | - if (($error=$this->addClassMemberColumn($classType, $member->member_ref)) !== true) { |
|
276 | + if (($error = $this->addClassMemberColumn($classType, $member->member_ref)) !== true) { |
|
277 | 277 | $member->delete(); |
278 | 278 | $this->removeMigration($mId); |
279 | 279 | throw new \RuntimeException("Couldn't create the member column. Error=".$error); |
@@ -286,7 +286,7 @@ discard block |
||
286 | 286 | /** |
287 | 287 | * @inheritdoc |
288 | 288 | */ |
289 | - public function getMember($classType, $memberRef, $fields=[]) |
|
289 | + public function getMember($classType, $memberRef, $fields = []) |
|
290 | 290 | { |
291 | 291 | // !! keep member as an object so it runs all conversion code |
292 | 292 | $query = DdsMember::find(); |
@@ -308,7 +308,7 @@ discard block |
||
308 | 308 | { |
309 | 309 | // check that only allowed updates are made |
310 | 310 | $allowed = array_intersect_key($changes, array_flip(['label', 'description', 'definition', 'choices', 'link_class'])); |
311 | - if (count($allowed)==0) |
|
311 | + if (count($allowed) == 0) |
|
312 | 312 | return; |
313 | 313 | |
314 | 314 | // find the member and remove any illegitamate updates |
@@ -330,7 +330,7 @@ discard block |
||
330 | 330 | $downSql = $this->getTableRowReplaceSql('dds_member', $member); |
331 | 331 | $member->attributes = $updates; |
332 | 332 | if (!$member->save()) |
333 | - throw new \RuntimeException("Couldn't update the member: ".print_r ($member->errors, true)); |
|
333 | + throw new \RuntimeException("Couldn't update the member: ".print_r($member->errors, true)); |
|
334 | 334 | $upSql = $this->getTableRowReplaceSql('dds_member', $member); |
335 | 335 | $this->storeMigration($upSql, $downSql); |
336 | 336 | $this->clearClassMemberCache($classType); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | public function deleteMember($classType, $memberRef) |
364 | 364 | { |
365 | 365 | // delete a member if it isn't already deleted |
366 | - if ($this->findMember($classType, $memberRef, $member) && $member->deleted==0) { |
|
366 | + if ($this->findMember($classType, $memberRef, $member) && $member->deleted == 0) { |
|
367 | 367 | $upSql = "UPDATE `dds_member` SET `deleted`=1 WHERE `class_type`='$classType' AND `member_ref`='$memberRef';"; |
368 | 368 | $downSql = "UPDATE `dds_member` SET `deleted`=0 WHERE `class_type`='$classType' AND `member_ref`='$memberRef';"; |
369 | 369 | neon()->db->createCommand($upSql)->execute(); |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | public function undeleteMember($classType, $memberRef) |
379 | 379 | { |
380 | 380 | // undelete a member if it is already deleted |
381 | - if ($this->findMember($classType, $memberRef, $member) && $member->deleted==1) { |
|
381 | + if ($this->findMember($classType, $memberRef, $member) && $member->deleted == 1) { |
|
382 | 382 | // create migrations |
383 | 383 | $upSql = "UPDATE `dds_member` SET `deleted`=0 WHERE `class_type`='$classType' AND `member_ref`='$memberRef';"; |
384 | 384 | $downSql = "UPDATE `dds_member` SET `deleted`=1 WHERE `class_type`='$classType' AND `member_ref`='$memberRef';"; |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | /** |
426 | 426 | * @inheritdoc |
427 | 427 | */ |
428 | - public function listDataTypes($includeDeleted=false) |
|
428 | + public function listDataTypes($includeDeleted = false) |
|
429 | 429 | { |
430 | 430 | $query = DdsDataType::find(); |
431 | 431 | $select = ['data_type_ref', 'label', 'description', 'definition', 'storage_ref']; |
@@ -486,7 +486,7 @@ discard block |
||
486 | 486 | $downSql = $this->getTableRowReplaceSql('dds_data_type', $dataType); |
487 | 487 | $dataType->attributes = $updates; |
488 | 488 | if (!$dataType->save()) |
489 | - throw new \RuntimeException("Couldn't save the datatype: ".print_r($dataType->errors(),true)); |
|
489 | + throw new \RuntimeException("Couldn't save the datatype: ".print_r($dataType->errors(), true)); |
|
490 | 490 | $upSql = $this->getTableRowReplaceSql('dds_data_type', $dataType); |
491 | 491 | $this->storeMigration($upSql, $downSql); |
492 | 492 | } |
@@ -604,7 +604,7 @@ discard block |
||
604 | 604 | if (count($diff)) |
605 | 605 | $diffs[$k] = $v; |
606 | 606 | } else { |
607 | - if ((string)$v !== (string)$b[$k]) |
|
607 | + if ((string) $v !== (string) $b[$k]) |
|
608 | 608 | $diffs[$k] = $v; |
609 | 609 | } |
610 | 610 | } else { |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | */ |
622 | 622 | private static $_classCache = []; |
623 | 623 | |
624 | - private function _getClassesQuery($module=null, $includeDeleted=false) |
|
624 | + private function _getClassesQuery($module = null, $includeDeleted = false) |
|
625 | 625 | { |
626 | 626 | $query = DdsClass::find(); |
627 | 627 | $select = ['class_type', 'label', 'description', 'module', 'count_total', 'count_deleted', 'change_log']; |