Code Duplication    Length = 35-40 lines in 2 locations

htdocs/kernel/block.php 1 location

@@ 298-332 (lines=35) @@
295
     *                        <li>T : use text sanitizater (smilies disabled)</ul>
296
     * @return string content for output
297
     */
298
    public function getContent($format = 's', $c_type = 'T')
299
    {
300
        $format = strtolower($format);
301
        $c_type = strtoupper($c_type);
302
        switch ($format) {
303
            case 's':
304
                if ($c_type === 'H') {
305
                    return str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n'));
306
                } elseif ($c_type === 'P') {
307
                    ob_start();
308
                    echo eval($this->getVar('content', 'n'));
309
                    $content = ob_get_contents();
310
                    ob_end_clean();
311
312
                    return str_replace('{X_SITEURL}', XOOPS_URL . '/', $content);
313
                } elseif ($c_type === 'S') {
314
                    $myts    = MyTextSanitizer::getInstance();
315
                    $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n'));
316
317
                    return $myts->displayTarea($content, 0, 1);
318
                } else {
319
                    $myts    = MyTextSanitizer::getInstance();
320
                    $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n'));
321
322
                    return $myts->displayTarea($content, 0, 0);
323
                }
324
                break;
325
            case 'e':
326
                return $this->getVar('content', 'e');
327
                break;
328
            default:
329
                return $this->getVar('content', 'n');
330
                break;
331
        }
332
    }
333
334
    /**
335
     * (HTML-) form for setting the options of the block

htdocs/modules/system/class/block.php 1 location

@@ 251-290 (lines=40) @@
248
     *
249
     * @returns string
250
     */
251
    public function getContent($format = 's', $c_type = 'T')
252
    {
253
        $format = strtolower($format);
254
        $c_type = strtoupper($c_type);
255
        switch ($format) {
256
            case 's':
257
                // check the type of content
258
                // H : custom HTML block
259
                // P : custom PHP block
260
                // S : use text sanitizater (smilies enabled)
261
                // T : use text sanitizater (smilies disabled)
262
                if ($c_type === 'H') {
263
                    return str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n'));
264
                } elseif ($c_type === 'P') {
265
                    ob_start();
266
                    echo eval($this->getVar('content', 'n'));
267
                    $content = ob_get_contents();
268
                    ob_end_clean();
269
270
                    return str_replace('{X_SITEURL}', XOOPS_URL . '/', $content);
271
                } elseif ($c_type === 'S') {
272
                    $myts    = MyTextSanitizer::getInstance();
273
                    $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n'));
274
275
                    return $myts->displayTarea($content, 1, 1);
276
                } else {
277
                    $myts    = MyTextSanitizer::getInstance();
278
                    $content = str_replace('{X_SITEURL}', XOOPS_URL . '/', $this->getVar('content', 'n'));
279
280
                    return $myts->displayTarea($content, 1, 0);
281
                }
282
                break;
283
            case 'e':
284
                return $this->getVar('content', 'e');
285
                break;
286
            default:
287
                return $this->getVar('content', 'n');
288
                break;
289
        }
290
    }
291
}
292
293
/**