Code Duplication    Length = 31-33 lines in 2 locations

class/class.newsstory.php 2 locations

@@ 1576-1606 (lines=31) @@
1573
     *
1574
     * @return mixed
1575
     */
1576
    public function hometext($format = 'Show')
1577
    {
1578
        $myts = MyTextSanitizer::getInstance();
1579
        $html = $smiley = $xcodes = 1;
1580
        if ($this->nohtml()) {
1581
            $html = 0;
1582
        }
1583
        if ($this->nosmiley()) {
1584
            $smiley = 0;
1585
        }
1586
        switch ($format) {
1587
            case 'Show':
1588
                $hometext     = $myts->displayTarea($this->hometext, $html, $smiley, $xcodes);
1589
                $tmp          = '';
1590
                $auto_summary = $this->auto_summary($this->bodytext('Show'), $tmp);
1591
                $hometext     = str_replace('[summary]', $auto_summary, $hometext);
1592
                break;
1593
            case 'Edit':
1594
                $hometext = $myts->htmlSpecialChars($this->hometext);
1595
                break;
1596
            case 'Preview':
1597
                $hometext = $myts->previewTarea($this->hometext, $html, $smiley, $xcodes);
1598
                break;
1599
            case 'InForm':
1600
                $hometext = $myts->stripSlashesGPC($this->hometext);
1601
                $hometext = $myts->htmlSpecialChars($hometext);
1602
                break;
1603
        }
1604
1605
        return $hometext;
1606
    }
1607
1608
    /**
1609
     * @param string $format
@@ 1613-1645 (lines=33) @@
1610
     *
1611
     * @return mixed
1612
     */
1613
    public function bodytext($format = 'Show')
1614
    {
1615
        $myts   = MyTextSanitizer::getInstance();
1616
        $html   = 1;
1617
        $smiley = 1;
1618
        $xcodes = 1;
1619
        if ($this->nohtml()) {
1620
            $html = 0;
1621
        }
1622
        if ($this->nosmiley()) {
1623
            $smiley = 0;
1624
        }
1625
        switch ($format) {
1626
            case 'Show':
1627
                $bodytext     = $myts->displayTarea($this->bodytext, $html, $smiley, $xcodes);
1628
                $tmp          = '';
1629
                $auto_summary = $this->auto_summary($bodytext, $tmp);
1630
                $bodytext     = str_replace('[summary]', $auto_summary, $bodytext);
1631
                break;
1632
            case 'Edit':
1633
                $bodytext = $myts->htmlSpecialChars($this->bodytext);
1634
                break;
1635
            case 'Preview':
1636
                $bodytext = $myts->previewTarea($this->bodytext, $html, $smiley, $xcodes);
1637
                break;
1638
            case 'InForm':
1639
                $bodytext = $myts->stripSlashesGPC($this->bodytext);
1640
                $bodytext = $myts->htmlSpecialChars($bodytext);
1641
                break;
1642
        }
1643
1644
        return $bodytext;
1645
    }
1646
1647
    /**
1648
     * Returns stories by Ids