Conditions | 7 |
Paths | 16 |
Total Lines | 124 |
Code Lines | 38 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.
For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.
Commonly applied refactorings include:
If many parameters/temporary variables are present:
1 | <?php |
||
149 | public function getConfig() |
||
150 | { |
||
151 | $config = []; |
||
152 | /*if ('true' === api_get_setting('more_buttons_maximized_mode')) { |
||
153 | $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); |
||
154 | $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); |
||
155 | } |
||
156 | |||
157 | $config['customConfig'] = api_get_path(WEB_PUBLIC_PATH).'editor/config?'.api_get_cidreq().'&tool=document&type=files';*/ |
||
158 | //$config['flash_flvPlayer'] = api_get_path(WEB_LIBRARY_JS_PATH).'ckeditor/plugins/flash/swf/player.swf'; |
||
159 | |||
160 | /*filebrowserFlashBrowseUrl |
||
161 | filebrowserFlashUploadUrl |
||
162 | filebrowserImageBrowseLinkUrl |
||
163 | filebrowserImageBrowseUrl |
||
164 | filebrowserImageUploadUrl |
||
165 | filebrowserUploadUrl*/ |
||
166 | |||
167 | //$config['extraPlugins'] = $this->getPluginsToString(); |
||
168 | |||
169 | //$config['oembed_maxWidth'] = '560'; |
||
170 | //$config['oembed_maxHeight'] = '315'; |
||
171 | |||
172 | /*$config['wordcount'] = array( |
||
173 | // Whether or not you want to show the Word Count |
||
174 | 'showWordCount' => true, |
||
175 | // Whether or not you want to show the Char Count |
||
176 | 'showCharCount' => true, |
||
177 | // Option to limit the characters in the Editor |
||
178 | 'charLimit' => 'unlimited', |
||
179 | // Option to limit the words in the Editor |
||
180 | 'wordLimit' => 'unlimited' |
||
181 | );*/ |
||
182 | |||
183 | /*$config['skin'] = 'moono-lisa'; |
||
184 | $config['image2_chamilo_alignClasses'] = [ |
||
185 | 'pull-left', |
||
186 | 'text-center', |
||
187 | 'pull-right', |
||
188 | 'img-va-baseline', |
||
189 | 'img-va-top', |
||
190 | 'img-va-bottom', |
||
191 | 'img-va-middle', |
||
192 | 'img-va-super', |
||
193 | 'img-va-sub', |
||
194 | 'img-va-text-top', |
||
195 | 'img-va-text-bottom', |
||
196 | ]; |
||
197 | $config['startupOutlineBlocks'] = true === api_get_configuration_value('ckeditor_startup_outline_blocks');*/ |
||
198 | |||
199 | $customPlugins = ''; |
||
200 | $customPluginsPath = []; |
||
201 | if ('true' === api_get_setting('editor.translate_html')) { |
||
202 | $customPlugins .= ' translatehtml'; |
||
203 | $customPluginsPath['translatehtml'] = api_get_path(WEB_PUBLIC_PATH).'libs/editor/tinymce_plugins/translatehtml/plugin.js'; |
||
204 | |||
205 | $languageList = api_get_languages(); |
||
206 | $rtlIsocodes = ['ps', 'ar', 'he', 'fa']; |
||
207 | $list = []; |
||
208 | foreach ($languageList as $isocode => $name) { |
||
209 | // Example format language list : ['ar:Arabic:rtl', 'fr:French', 'es:Spanish']; |
||
210 | $rtl = (in_array($isocode, $rtlIsocodes)?':rtl':''); |
||
211 | $list[] = $isocode.':'.$name.$rtl; |
||
212 | } |
||
213 | $config['translatehtml_lenguage_list'] = $list; |
||
214 | } |
||
215 | |||
216 | $plugins = [ |
||
217 | 'advlist autolink lists link image charmap print preview anchor', |
||
218 | 'searchreplace visualblocks code fullscreen', |
||
219 | 'insertdatetime media table paste wordcount'.$customPlugins, |
||
220 | ]; |
||
221 | |||
222 | /*plugins: [ |
||
223 | 'fullpage advlist autolink lists link image charmap print preview anchor', |
||
224 | 'searchreplace visualblocks code fullscreen', |
||
225 | 'insertdatetime media table paste wordcount emoticons' |
||
226 | ],*/ |
||
227 | |||
228 | if ($this->getConfigAttribute('fullPage')) { |
||
229 | $plugins[] = 'fullpage'; |
||
230 | } |
||
231 | |||
232 | $config['plugins'] = implode(' ', $plugins); |
||
233 | $config['toolbar'] = 'undo redo directionality | bold italic underline strikethrough | insertfile image media template link | fontselect fontsizeselect formatselect | alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | forecolor backcolor removeformat | pagebreak | charmap emoticons | fullscreen preview save print | code codesample | ltr rtl'.$customPlugins; |
||
234 | |||
235 | if (!empty($customPluginsPath)) { |
||
236 | $config['external_plugins'] = $customPluginsPath; |
||
237 | } |
||
238 | |||
239 | //$config['skin'] = 'oxide'; |
||
240 | $config['skin_url'] = '/build/libs/tinymce/skins/ui/oxide'; |
||
241 | $config['content_css'] = '/build/libs/tinymce/skins/content/default/content.css'; |
||
242 | $config['branding'] = false; |
||
243 | $config['relative_urls'] = false; |
||
244 | $config['toolbar_mode'] = 'sliding'; |
||
245 | $config['autosave_ask_before_unload'] = true; |
||
246 | $config['toolbar_mode'] = 'sliding'; |
||
247 | |||
248 | //file_picker_callback : browser, |
||
249 | |||
250 | $iso = api_get_language_isocode(); |
||
251 | $url = api_get_path(WEB_PATH); |
||
252 | |||
253 | // Language list: https://www.tiny.cloud/get-tiny/language-packages/ |
||
254 | if ('en_US' !== $iso) { |
||
255 | $config['language'] = $iso; |
||
256 | $config['language_url'] = "$url/libs/editor/langs/$iso.js"; |
||
257 | } |
||
258 | |||
259 | |||
260 | |||
261 | /*if (isset($this->config)) { |
||
262 | $this->config = array_merge($config, $this->config); |
||
263 | } else { |
||
264 | $this->config = $config; |
||
265 | }*/ |
||
266 | |||
267 | $this->config = $config; |
||
268 | |||
269 | //$config['width'] = '100'; |
||
270 | $config['height'] = '300'; |
||
271 | |||
272 | return $this->config; |
||
273 | } |
||
364 |