@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | 'outdent', |
70 | 70 | ], |
71 | 71 | 'add_buttons' => [ |
72 | - 2 => ['fullscreen'], |
|
72 | + 2 => [ 'fullscreen' ], |
|
73 | 73 | ], |
74 | 74 | 'block_formats' => [ |
75 | 75 | 'p' => 'Paragraph', |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | 'options' => [ |
175 | 175 | 'style_formats' => [ |
176 | 176 | 'title' => 'Button-Link', |
177 | - 'attributes' => ['class' => 'tiny-mce-button'], |
|
177 | + 'attributes' => [ 'class' => 'tiny-mce-button' ], |
|
178 | 178 | 'selector' => 'a', |
179 | 179 | ], |
180 | 180 | ], |
@@ -185,11 +185,11 @@ discard block |
||
185 | 185 | { |
186 | 186 | $list = $this->config()->get('editor_configs'); |
187 | 187 | foreach ($list as $key => $entry) { |
188 | - if (! empty($entry['based_on']) && ! empty($list[$entry['based_on']])) { |
|
189 | - $entry = array_merge_recursive($list[$entry['based_on']], $entry); |
|
188 | + if ( ! empty($entry[ 'based_on' ]) && ! empty($list[ $entry[ 'based_on' ] ])) { |
|
189 | + $entry = array_merge_recursive($list[ $entry[ 'based_on' ] ], $entry); |
|
190 | 190 | } |
191 | 191 | |
192 | - $list[$key] = $entry; |
|
192 | + $list[ $key ] = $entry; |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | return $list; |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | $cmsModule = ModuleLoader::inst()->getManifest()->getModule('silverstripe/cms'); |
30 | 30 | |
31 | 31 | foreach ($editorConfigs as $editorConfigName => $editorConfigSettings) { |
32 | - if (! in_array($editorConfigName, $remove, true)) { |
|
32 | + if ( ! in_array($editorConfigName, $remove, true)) { |
|
33 | 33 | $editor = TinyMCEConfig::get($editorConfigName); |
34 | 34 | // Register the default internal shortcodes. |
35 | 35 | ShortcodeParser::get('default')->register( |
36 | 36 | 'sitetree_link', |
37 | - function (array $arguments, ?string $content = null, ?ShortcodeParser $parser = null): string { |
|
37 | + function(array $arguments, ?string $content = null, ?ShortcodeParser $parser = null): string { |
|
38 | 38 | return (string) \SilverStripe\CMS\Model\SiteTree::link_shortcode_handler($arguments, $content, $parser); |
39 | 39 | } |
40 | 40 | ); |
@@ -84,23 +84,23 @@ discard block |
||
84 | 84 | $editor->insertButtonsAfter('sslink', 'anchor'); |
85 | 85 | |
86 | 86 | // disable plugins |
87 | - if (! empty($editorConfigSettings['disabled_plugins'])) { |
|
87 | + if ( ! empty($editorConfigSettings[ 'disabled_plugins' ])) { |
|
88 | 88 | $editor->disablePlugins( |
89 | - $this->stringToArray($editorConfigSettings['disabled_plugins']) |
|
89 | + $this->stringToArray($editorConfigSettings[ 'disabled_plugins' ]) |
|
90 | 90 | ); |
91 | 91 | } |
92 | 92 | |
93 | 93 | // add buttons |
94 | - if (! empty($editorConfigSettings['add_buttons'])) { |
|
95 | - $addButtons = $this->stringToArray($editorConfigSettings['add_buttons']); |
|
94 | + if ( ! empty($editorConfigSettings[ 'add_buttons' ])) { |
|
95 | + $addButtons = $this->stringToArray($editorConfigSettings[ 'add_buttons' ]); |
|
96 | 96 | foreach ($addButtons as $line => $buttons) { |
97 | 97 | $editor->addButtonsToLine($line, $buttons); |
98 | 98 | } |
99 | 99 | } |
100 | 100 | |
101 | 101 | // remove buttons |
102 | - if (! empty($editorConfigSettings['remove_buttons'])) { |
|
103 | - $removeButtons = $this->stringToArray($editorConfigSettings['remove_buttons']); |
|
102 | + if ( ! empty($editorConfigSettings[ 'remove_buttons' ])) { |
|
103 | + $removeButtons = $this->stringToArray($editorConfigSettings[ 'remove_buttons' ]); |
|
104 | 104 | $editor->removeButtons($removeButtons); |
105 | 105 | } |
106 | 106 | |
@@ -125,33 +125,33 @@ discard block |
||
125 | 125 | // ); |
126 | 126 | |
127 | 127 | // add macrons |
128 | - if (! empty($editorConfigSettings['add_macrons'])) { |
|
128 | + if ( ! empty($editorConfigSettings[ 'add_macrons' ])) { |
|
129 | 129 | $editor |
130 | - ->addButtonsToLine(1, ['charmap']) |
|
130 | + ->addButtonsToLine(1, [ 'charmap' ]) |
|
131 | 131 | ->setOption( |
132 | 132 | 'charmap_append', |
133 | 133 | [ |
134 | - ['256', 'A - macron'], |
|
135 | - ['274', 'E - macron'], |
|
136 | - ['298', 'I - macron'], |
|
137 | - ['332', 'O - macron'], |
|
138 | - ['362', 'U - macron'], |
|
139 | - ['257', 'a - macron'], |
|
140 | - ['275', 'e - macron'], |
|
141 | - ['299', 'i - macron'], |
|
142 | - ['333', 'o - macron'], |
|
143 | - ['363', 'u - macron'], |
|
134 | + [ '256', 'A - macron' ], |
|
135 | + [ '274', 'E - macron' ], |
|
136 | + [ '298', 'I - macron' ], |
|
137 | + [ '332', 'O - macron' ], |
|
138 | + [ '362', 'U - macron' ], |
|
139 | + [ '257', 'a - macron' ], |
|
140 | + [ '275', 'e - macron' ], |
|
141 | + [ '299', 'i - macron' ], |
|
142 | + [ '333', 'o - macron' ], |
|
143 | + [ '363', 'u - macron' ], |
|
144 | 144 | ] |
145 | 145 | ) |
146 | 146 | ; |
147 | 147 | } |
148 | 148 | |
149 | 149 | // lines |
150 | - if (! empty($editorConfigSettings['lines'])) { |
|
151 | - $lines = $editorConfigSettings['lines']; |
|
150 | + if ( ! empty($editorConfigSettings[ 'lines' ])) { |
|
151 | + $lines = $editorConfigSettings[ 'lines' ]; |
|
152 | 152 | for ($i = 1; $i < 4; ++$i) { |
153 | - $lines[$i] = isset($lines[$i]) ? $this->stringToArray($lines[$i]) : []; |
|
154 | - $editor->setButtonsForLine($i, implode(', ', $lines[$i])); |
|
153 | + $lines[ $i ] = isset($lines[ $i ]) ? $this->stringToArray($lines[ $i ]) : [ ]; |
|
154 | + $editor->setButtonsForLine($i, implode(', ', $lines[ $i ])); |
|
155 | 155 | } |
156 | 156 | } |
157 | 157 | |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | 'skin' => 'silverstripe', |
163 | 163 | 'importcss_append' => true, |
164 | 164 | 'style_formats_merge' => false, |
165 | - 'style_formats' => [], |
|
165 | + 'style_formats' => [ ], |
|
166 | 166 | 'contextmenu' => 'sslink anchor ssmedia ssembed', |
167 | 167 | 'use_native_selects' => false, |
168 | 168 | 'paste_as_text' => true, |
@@ -208,15 +208,15 @@ discard block |
||
208 | 208 | ] |
209 | 209 | ); |
210 | 210 | |
211 | - if (! empty($editorConfigSettings['options'])) { |
|
212 | - $editor->setOptions($editorConfigSettings['options']); |
|
211 | + if ( ! empty($editorConfigSettings[ 'options' ])) { |
|
212 | + $editor->setOptions($editorConfigSettings[ 'options' ]); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | // block formats |
216 | - if (! empty($editorConfigSettings['blocks'])) { |
|
217 | - $blocks = $this->stringToArray($editorConfigSettings['blocks']) ?? []; |
|
218 | - foreach ($editorConfigSettings['blocks'] as $tag => $name) { |
|
219 | - $blocks[] = $name . '=' . $tag; |
|
216 | + if ( ! empty($editorConfigSettings[ 'blocks' ])) { |
|
217 | + $blocks = $this->stringToArray($editorConfigSettings[ 'blocks' ]) ?? [ ]; |
|
218 | + foreach ($editorConfigSettings[ 'blocks' ] as $tag => $name) { |
|
219 | + $blocks[ ] = $name.'='.$tag; |
|
220 | 220 | } |
221 | 221 | |
222 | 222 | $formats = implode(';', $blocks); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | |
241 | 241 | protected function stringToArray($mixed): array |
242 | 242 | { |
243 | - if (! is_array($mixed)) { |
|
243 | + if ( ! is_array($mixed)) { |
|
244 | 244 | $mixed = explode(',', $mixed); |
245 | 245 | } |
246 | 246 |
@@ -11,40 +11,40 @@ |
||
11 | 11 | { |
12 | 12 | $yamlFormats = TinyMCEConfig::config()->get('formats'); |
13 | 13 | |
14 | - if (! isset($yamlFormats[$identifier])) { |
|
15 | - user_error('no editor formats for ' . $identifier); |
|
16 | - return []; |
|
14 | + if ( ! isset($yamlFormats[ $identifier ])) { |
|
15 | + user_error('no editor formats for '.$identifier); |
|
16 | + return [ ]; |
|
17 | 17 | } |
18 | 18 | |
19 | - $parsedFormats = []; |
|
19 | + $parsedFormats = [ ]; |
|
20 | 20 | |
21 | - foreach ($yamlFormats[$identifier] as $sectionTitle => $sectionFormats) { |
|
22 | - $formats = []; |
|
21 | + foreach ($yamlFormats[ $identifier ] as $sectionTitle => $sectionFormats) { |
|
22 | + $formats = [ ]; |
|
23 | 23 | $sort = 100; |
24 | 24 | |
25 | 25 | foreach ($sectionFormats as $sTitle => $sFormat) { |
26 | - if (isset($sFormat['disabled']) && $sFormat['disabled']) { |
|
26 | + if (isset($sFormat[ 'disabled' ]) && $sFormat[ 'disabled' ]) { |
|
27 | 27 | continue; |
28 | 28 | } |
29 | 29 | |
30 | 30 | $title = $sTitle; |
31 | 31 | |
32 | - if (isset($sFormat['title'])) { |
|
33 | - $title = $sFormat['title']; |
|
32 | + if (isset($sFormat[ 'title' ])) { |
|
33 | + $title = $sFormat[ 'title' ]; |
|
34 | 34 | } |
35 | 35 | |
36 | - if (! isset($sFormat['sort'])) { |
|
37 | - $sFormat['sort'] = $sort; |
|
36 | + if ( ! isset($sFormat[ 'sort' ])) { |
|
37 | + $sFormat[ 'sort' ] = $sort; |
|
38 | 38 | } |
39 | 39 | |
40 | - $formats[] = ['title' => $title] + $sFormat; |
|
40 | + $formats[ ] = [ 'title' => $title ] + $sFormat; |
|
41 | 41 | } |
42 | 42 | |
43 | - usort($formats, function ($x, $y) { |
|
44 | - return $x['sort'] <=> $y['sort']; |
|
43 | + usort($formats, function($x, $y) { |
|
44 | + return $x[ 'sort' ] <=> $y[ 'sort' ]; |
|
45 | 45 | }); |
46 | 46 | |
47 | - $parsedFormats[] = [ |
|
47 | + $parsedFormats[ ] = [ |
|
48 | 48 | 'title' => $sectionTitle, |
49 | 49 | 'items' => $formats, |
50 | 50 | ]; |