Code Duplication    Length = 73-73 lines in 2 locations

class/oledrion_utils.php 1 location

@@ 143-215 (lines=73) @@
140
     * @param  string $supplemental
141
     * @return object The editor to use
142
     */
143
    public static function getWysiwygForm(
144
        $caption,
145
        $name,
146
        $value = '',
147
        $width = '100%',
148
        $height = '400px',
149
        $supplemental = '')
150
    {
151
        $editor                   = false;
152
        $editor_configs           = array();
153
        $editor_configs['name']   = $name;
154
        $editor_configs['value']  = $value;
155
        $editor_configs['rows']   = 35;
156
        $editor_configs['cols']   = 60;
157
        $editor_configs['width']  = '100%';
158
        $editor_configs['height'] = '400px';
159
160
        $editor_option = strtolower(static::getModuleOption('bl_form_options'));
161
162
        if (static::isX23()) {
163
            $editor = new XoopsFormEditor($caption, $editor_option, $editor_configs);
164
165
            return $editor;
166
        }
167
168
        // Only for Xoops 2.0.x
169
        switch ($editor_option) {
170
            case 'fckeditor':
171
                if (is_readable(XOOPS_ROOT_PATH . '/class/fckeditor/formfckeditor.php')) {
172
                    require_once XOOPS_ROOT_PATH . '/class/fckeditor/formfckeditor.php';
173
                    $editor = new XoopsFormFckeditor($caption, $name, $value);
174
                }
175
                break;
176
177
            case 'htmlarea':
178
                if (is_readable(XOOPS_ROOT_PATH . '/class/htmlarea/formhtmlarea.php')) {
179
                    require_once XOOPS_ROOT_PATH . '/class/htmlarea/formhtmlarea.php';
180
                    $editor = new XoopsFormHtmlarea($caption, $name, $value);
181
                }
182
                break;
183
184
            case 'dhtmltextarea':
185
                $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 10, 50, $supplemental);
186
                break;
187
188
            case 'textarea':
189
                $editor = new XoopsFormTextArea($caption, $name, $value);
190
                break;
191
192
            case 'tinyeditor':
193
            case 'tinymce':
194
                if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/tinyeditor/formtinyeditortextarea.php')) {
195
                    require_once XOOPS_ROOT_PATH . '/class/xoopseditor/tinyeditor/formtinyeditortextarea.php';
196
                    $editor = new XoopsFormTinyeditorTextArea(array(
197
                                                                  'caption' => $caption,
198
                                                                  'name'    => $name,
199
                                                                  'value'   => $value,
200
                                                                  'width'   => '100%',
201
                                                                  'height'  => '400px'
202
                                                              ));
203
                }
204
                break;
205
206
            case 'koivi':
207
                if (is_readable(XOOPS_ROOT_PATH . '/class/wysiwyg/formwysiwygtextarea.php')) {
208
                    require_once XOOPS_ROOT_PATH . '/class/wysiwyg/formwysiwygtextarea.php';
209
                    $editor = new XoopsFormWysiwygTextArea($caption, $name, $value, $width, $height, '');
210
                }
211
                break;
212
        }
213
214
        return $editor;
215
    }
216
217
    /**
218
     * Create (in a link) a javascript confirmation's box

class/utility.php 1 location

@@ 287-359 (lines=73) @@
284
     * @param  string $supplemental
285
     * @return object The editor to use
286
     */
287
    public static function getWysiwygForm(
288
        $caption,
289
        $name,
290
        $value = '',
291
        $width = '100%',
292
        $height = '400px',
293
        $supplemental = '')
294
    {
295
        $editor                   = false;
296
        $editor_configs           = array();
297
        $editor_configs['name']   = $name;
298
        $editor_configs['value']  = $value;
299
        $editor_configs['rows']   = 35;
300
        $editor_configs['cols']   = 60;
301
        $editor_configs['width']  = '100%';
302
        $editor_configs['height'] = '400px';
303
304
        $editor_option = strtolower(self::getModuleOption('bl_form_options'));
305
306
        if (self::isX23()) {
307
            $editor = new XoopsFormEditor($caption, $editor_option, $editor_configs);
308
309
            return $editor;
310
        }
311
312
        // Only for Xoops 2.0.x
313
        switch ($editor_option) {
314
            case 'fckeditor':
315
                if (is_readable(XOOPS_ROOT_PATH . '/class/fckeditor/formfckeditor.php')) {
316
                    require_once XOOPS_ROOT_PATH . '/class/fckeditor/formfckeditor.php';
317
                    $editor = new XoopsFormFckeditor($caption, $name, $value);
318
                }
319
                break;
320
321
            case 'htmlarea':
322
                if (is_readable(XOOPS_ROOT_PATH . '/class/htmlarea/formhtmlarea.php')) {
323
                    require_once XOOPS_ROOT_PATH . '/class/htmlarea/formhtmlarea.php';
324
                    $editor = new XoopsFormHtmlarea($caption, $name, $value);
325
                }
326
                break;
327
328
            case 'dhtmltextarea':
329
                $editor = new XoopsFormDhtmlTextArea($caption, $name, $value, 10, 50, $supplemental);
330
                break;
331
332
            case 'textarea':
333
                $editor = new XoopsFormTextArea($caption, $name, $value);
334
                break;
335
336
            case 'tinyeditor':
337
            case 'tinymce':
338
                if (is_readable(XOOPS_ROOT_PATH . '/class/xoopseditor/tinyeditor/formtinyeditortextarea.php')) {
339
                    require_once XOOPS_ROOT_PATH . '/class/xoopseditor/tinyeditor/formtinyeditortextarea.php';
340
                    $editor = new XoopsFormTinyeditorTextArea(array(
341
                                                                  'caption' => $caption,
342
                                                                  'name'    => $name,
343
                                                                  'value'   => $value,
344
                                                                  'width'   => '100%',
345
                                                                  'height'  => '400px'
346
                                                              ));
347
                }
348
                break;
349
350
            case 'koivi':
351
                if (is_readable(XOOPS_ROOT_PATH . '/class/wysiwyg/formwysiwygtextarea.php')) {
352
                    require_once XOOPS_ROOT_PATH . '/class/wysiwyg/formwysiwygtextarea.php';
353
                    $editor = new XoopsFormWysiwygTextArea($caption, $name, $value, $width, $height, '');
354
                }
355
                break;
356
        }
357
358
        return $editor;
359
    }
360
361
    /**
362
     * Create (in a link) a javascript confirmation's box