Code Duplication    Length = 31-33 lines in 2 locations

class/class.newsstory.php 2 locations

@@ 1446-1476 (lines=31) @@
1443
     *
1444
     * @return mixed
1445
     */
1446
    public function hometext($format = 'Show')
1447
    {
1448
        $myts = MyTextSanitizer::getInstance();
1449
        $html = $smiley = $xcodes = 1;
1450
        if ($this->nohtml()) {
1451
            $html = 0;
1452
        }
1453
        if ($this->nosmiley()) {
1454
            $smiley = 0;
1455
        }
1456
        switch ($format) {
1457
            case 'Show':
1458
                $hometext     = $myts->displayTarea($this->hometext, $html, $smiley, $xcodes);
1459
                $tmp          = '';
1460
                $auto_summary = $this->auto_summary($this->bodytext('Show'), $tmp);
1461
                $hometext     = str_replace('[summary]', $auto_summary, $hometext);
1462
                break;
1463
            case 'Edit':
1464
                $hometext = $myts->htmlSpecialChars($this->hometext);
1465
                break;
1466
            case 'Preview':
1467
                $hometext = $myts->previewTarea($this->hometext, $html, $smiley, $xcodes);
1468
                break;
1469
            case 'InForm':
1470
                $hometext = $myts->stripSlashesGPC($this->hometext);
1471
                $hometext = $myts->htmlSpecialChars($hometext);
1472
                break;
1473
        }
1474
1475
        return $hometext;
1476
    }
1477
1478
    /**
1479
     * @param string $format
@@ 1483-1515 (lines=33) @@
1480
     *
1481
     * @return mixed
1482
     */
1483
    public function bodytext($format = 'Show')
1484
    {
1485
        $myts   = MyTextSanitizer::getInstance();
1486
        $html   = 1;
1487
        $smiley = 1;
1488
        $xcodes = 1;
1489
        if ($this->nohtml()) {
1490
            $html = 0;
1491
        }
1492
        if ($this->nosmiley()) {
1493
            $smiley = 0;
1494
        }
1495
        switch ($format) {
1496
            case 'Show':
1497
                $bodytext     = $myts->displayTarea($this->bodytext, $html, $smiley, $xcodes);
1498
                $tmp          = '';
1499
                $auto_summary = $this->auto_summary($bodytext, $tmp);
1500
                $bodytext     = str_replace('[summary]', $auto_summary, $bodytext);
1501
                break;
1502
            case 'Edit':
1503
                $bodytext = $myts->htmlSpecialChars($this->bodytext);
1504
                break;
1505
            case 'Preview':
1506
                $bodytext = $myts->previewTarea($this->bodytext, $html, $smiley, $xcodes);
1507
                break;
1508
            case 'InForm':
1509
                $bodytext = $myts->stripSlashesGPC($this->bodytext);
1510
                $bodytext = $myts->htmlSpecialChars($bodytext);
1511
                break;
1512
        }
1513
1514
        return $bodytext;
1515
    }
1516
1517
    /**
1518
     * Returns stories by Ids