@@ -96,8 +96,9 @@ discard block |
||
96 | 96 | public function getItems() |
97 | 97 | { |
98 | 98 | // if we haven't or can't map a map request we can't have any values |
99 | - if (empty($this->dataMapKey)) |
|
100 | - return []; |
|
99 | + if (empty($this->dataMapKey)) { |
|
100 | + return []; |
|
101 | + } |
|
101 | 102 | |
102 | 103 | $provider = $this->getProviderService(); |
103 | 104 | $format = false; |
@@ -119,8 +120,9 @@ discard block |
||
119 | 120 | $concat = isset($format['concat']) ? $format['concat'] : ' '; |
120 | 121 | $prefix = isset($format['prefix']) ? $format['prefix'] : ''; |
121 | 122 | $postfix = isset($format['postfix']) ? $format['postfix'] : ''; |
122 | - foreach ($items as $k=>$i) |
|
123 | - $items[$k] = $prefix.implode($concat, is_array($i) ? $i : [$i]).$postfix; |
|
123 | + foreach ($items as $k=>$i) { |
|
124 | + $items[$k] = $prefix.implode($concat, is_array($i) ? $i : [$i]).$postfix; |
|
125 | + } |
|
124 | 126 | } |
125 | 127 | return $items; |
126 | 128 | } |
@@ -184,8 +186,9 @@ discard block |
||
184 | 186 | public function setValueFromDb($value) |
185 | 187 | { |
186 | 188 | parent::setValueFromDb($value); |
187 | - if (!empty($value)) |
|
188 | - $this->makeMapRequest($value); |
|
189 | + if (!empty($value)) { |
|
190 | + $this->makeMapRequest($value); |
|
191 | + } |
|
189 | 192 | return $this; |
190 | 193 | } |
191 | 194 |
@@ -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 !== '') { |
@@ -35,7 +35,7 @@ |
||
35 | 35 | /** |
36 | 36 | * @inheritdoc |
37 | 37 | */ |
38 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
38 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
39 | 39 | { |
40 | 40 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
41 | 41 | if (!empty($searchData)) { |
@@ -50,8 +50,9 @@ |
||
50 | 50 | { |
51 | 51 | $guesser = new \Faker\Guesser\Name(faker()); |
52 | 52 | $guess = $guesser->guessFormat($this->getName(), 150); |
53 | - if (is_callable($guess)) |
|
54 | - return $guess(); |
|
53 | + if (is_callable($guess)) { |
|
54 | + return $guess(); |
|
55 | + } |
|
55 | 56 | return faker()->realText(mt_rand(10, 150)); |
56 | 57 | } |
57 | 58 |
@@ -21,9 +21,9 @@ |
||
21 | 21 | */ |
22 | 22 | public function getFieldHtml() |
23 | 23 | { |
24 | - return Html::tag('neon-core-form-fields-guidance', [ |
|
25 | - 'text' => $this->getText(), |
|
26 | - ]); |
|
24 | + return Html::tag('neon-core-form-fields-guidance', [ |
|
25 | + 'text' => $this->getText(), |
|
26 | + ]); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
@@ -31,8 +31,9 @@ |
||
31 | 31 | public function getValue() |
32 | 32 | { |
33 | 33 | $value = parent::getValue(); |
34 | - if (is_array($value)) |
|
35 | - return $value; |
|
34 | + if (is_array($value)) { |
|
35 | + return $value; |
|
36 | + } |
|
36 | 37 | return ['from' => '', 'to' => '']; |
37 | 38 | } |
38 | 39 |
@@ -60,7 +60,7 @@ |
||
60 | 60 | /** |
61 | 61 | * @inheritdoc |
62 | 62 | */ |
63 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
63 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
64 | 64 | { |
65 | 65 | $searchData = ($searchData === null) ? $this->getValue() : $searchData; |
66 | 66 | if ($searchData !== '') { |
@@ -66,10 +66,12 @@ discard block |
||
66 | 66 | if ($searchData !== '') { |
67 | 67 | $dateFrom = Arr::get($searchData, 'from'); |
68 | 68 | $dateTo = Arr::get($searchData, 'to'); |
69 | - if ($dateFrom) |
|
70 | - $query->where($this->getDataKey(), '>=', $dateFrom); |
|
71 | - if ($dateTo) |
|
72 | - $query->where($this->getDataKey(), '<=', $dateTo); |
|
69 | + if ($dateFrom) { |
|
70 | + $query->where($this->getDataKey(), '>=', $dateFrom); |
|
71 | + } |
|
72 | + if ($dateTo) { |
|
73 | + $query->where($this->getDataKey(), '<=', $dateTo); |
|
74 | + } |
|
73 | 75 | } |
74 | 76 | } |
75 | 77 | |
@@ -87,8 +89,9 @@ discard block |
||
87 | 89 | public function getValue() |
88 | 90 | { |
89 | 91 | $value = parent::getValue(); |
90 | - if (is_array($value)) |
|
91 | - return $value; |
|
92 | + if (is_array($value)) { |
|
93 | + return $value; |
|
94 | + } |
|
92 | 95 | return ['from' => '', 'to' => '']; |
93 | 96 | } |
94 | 97 |
@@ -25,7 +25,7 @@ |
||
25 | 25 | */ |
26 | 26 | public function getProperties() |
27 | 27 | { |
28 | - return array_merge(parent::getProperties(), ['decimal', 'height', 'vertical', 'min', 'max'] ); |
|
28 | + return array_merge(parent::getProperties(), ['decimal', 'height', 'vertical', 'min', 'max']); |
|
29 | 29 | } |
30 | 30 | /** |
31 | 31 | * @inheritdoc |
@@ -73,7 +73,7 @@ |
||
73 | 73 | /** |
74 | 74 | * @inheritdoc |
75 | 75 | */ |
76 | - public function processAsFilter(IQuery $query, $searchData=null) |
|
76 | + public function processAsFilter(IQuery $query, $searchData = null) |
|
77 | 77 | { |
78 | 78 | // no filters can be applied here - so we override and do nothing. |
79 | 79 | } |
@@ -61,8 +61,9 @@ discard block |
||
61 | 61 | // disallow any quotes in the URL to prevent a class of attacks |
62 | 62 | if (strpos($value, "'") === false && strpos($value,'"') === false) { |
63 | 63 | // prefix with the schema if not provided |
64 | - if ($value && $this->absolute && strpos($value, 'http')===false) |
|
65 | - $value = str_replace('///','//','https://'.$value); |
|
64 | + if ($value && $this->absolute && strpos($value, 'http')===false) { |
|
65 | + $value = str_replace('///','//','https://'.$value); |
|
66 | + } |
|
66 | 67 | // now turn into a link and run through purify to strip |
67 | 68 | // out any dodgy shenanigans |
68 | 69 | $link = '<a href="'.$value.'">'; |
@@ -71,8 +72,9 @@ discard block |
||
71 | 72 | $exploded = explode('"',$safeValue); |
72 | 73 | $this->_sanitisedValue = $exploded[1]; |
73 | 74 | } |
74 | - } else |
|
75 | - $this->_sanitisedValue = ''; |
|
75 | + } else { |
|
76 | + $this->_sanitisedValue = ''; |
|
77 | + } |
|
76 | 78 | } |
77 | 79 | return $this->_sanitisedValue; |
78 | 80 | } |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * set whether or not this is an absolute or relative URL |
23 | 23 | */ |
24 | - public $absolute=true; |
|
24 | + public $absolute = true; |
|
25 | 25 | |
26 | 26 | /** |
27 | 27 | * Set some allowable tags for single text fields |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | * Get a displayable representation of the fields value |
45 | 45 | * @return string |
46 | 46 | */ |
47 | - public function getValueDisplay($context='') |
|
47 | + public function getValueDisplay($context = '') |
|
48 | 48 | { |
49 | - return '<a href="'.$this->getValue().'" target="_blank" noopener noreferrer>'.$this->getValue().'</a>' ; |
|
49 | + return '<a href="'.$this->getValue().'" target="_blank" noopener noreferrer>'.$this->getValue().'</a>'; |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -59,16 +59,16 @@ discard block |
||
59 | 59 | if ($this->_sanitisedValue === null) { |
60 | 60 | $value = $this->getUnsafeValue(); |
61 | 61 | // disallow any quotes in the URL to prevent a class of attacks |
62 | - if (strpos($value, "'") === false && strpos($value,'"') === false) { |
|
62 | + if (strpos($value, "'") === false && strpos($value, '"') === false) { |
|
63 | 63 | // prefix with the schema if not provided |
64 | - if ($value && $this->absolute && strpos($value, 'http')===false) |
|
65 | - $value = str_replace('///','//','https://'.$value); |
|
64 | + if ($value && $this->absolute && strpos($value, 'http') === false) |
|
65 | + $value = str_replace('///', '//', 'https://'.$value); |
|
66 | 66 | // now turn into a link and run through purify to strip |
67 | 67 | // out any dodgy shenanigans |
68 | 68 | $link = '<a href="'.$value.'">'; |
69 | 69 | $safeValue = $this->purifyInput($link); |
70 | 70 | if (strpos($safeValue, 'href')) { |
71 | - $exploded = explode('"',$safeValue); |
|
71 | + $exploded = explode('"', $safeValue); |
|
72 | 72 | $this->_sanitisedValue = $exploded[1]; |
73 | 73 | } |
74 | 74 | } else |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | public function getProperties() |
84 | 84 | { |
85 | 85 | // convert the database values to booleans |
86 | - $this->absolute = (bool)$this->absolute; |
|
86 | + $this->absolute = (bool) $this->absolute; |
|
87 | 87 | $properties = parent::getProperties(); |
88 | 88 | $properties[] = 'absolute'; |
89 | 89 | return $properties; |
@@ -81,8 +81,9 @@ |
||
81 | 81 | $fullConfig = array_merge_recursive($defaultConfigSets, $additionalConfigSets); |
82 | 82 | // convert the extraPlugins into a comma separated list as required by ckeditor |
83 | 83 | foreach ($fullConfig as $set=>$config) { |
84 | - if (isset($config['extraPlugins'])) |
|
85 | - $fullConfig[$set]['extraPlugins'] = implode(',', $config['extraPlugins']); |
|
84 | + if (isset($config['extraPlugins'])) { |
|
85 | + $fullConfig[$set]['extraPlugins'] = implode(',', $config['extraPlugins']); |
|
86 | + } |
|
86 | 87 | } |
87 | 88 | return json_encode($fullConfig); |
88 | 89 | } |
@@ -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 | } |