Code Duplication    Length = 31-33 lines in 2 locations

class/class.newsstory.php 2 locations

@@ 1676-1706 (lines=31) @@
1673
     *
1674
     * @return mixed
1675
     */
1676
    public function hometext($format = 'Show')
1677
    {
1678
        $myts = MyTextSanitizer::getInstance();
1679
        $html = $smiley = $xcodes = 1;
1680
        if ($this->nohtml()) {
1681
            $html = 0;
1682
        }
1683
        if ($this->nosmiley()) {
1684
            $smiley = 0;
1685
        }
1686
        switch ($format) {
1687
            case 'Show':
1688
                $hometext     = $myts->displayTarea($this->hometext, $html, $smiley, $xcodes);
1689
                $tmp          = '';
1690
                $auto_summary = $this->auto_summary($this->bodytext('Show'), $tmp);
1691
                $hometext     = str_replace('[summary]', $auto_summary, $hometext);
1692
                break;
1693
            case 'Edit':
1694
                $hometext = $myts->htmlSpecialChars($this->hometext);
1695
                break;
1696
            case 'Preview':
1697
                $hometext = $myts->previewTarea($this->hometext, $html, $smiley, $xcodes);
1698
                break;
1699
            case 'InForm':
1700
                $hometext = $myts->stripSlashesGPC($this->hometext);
1701
                $hometext = $myts->htmlSpecialChars($hometext);
1702
                break;
1703
        }
1704
1705
        return $hometext;
1706
    }
1707
1708
    /**
1709
     * @param string $format
@@ 1713-1745 (lines=33) @@
1710
     *
1711
     * @return mixed
1712
     */
1713
    public function bodytext($format = 'Show')
1714
    {
1715
        $myts   = MyTextSanitizer::getInstance();
1716
        $html   = 1;
1717
        $smiley = 1;
1718
        $xcodes = 1;
1719
        if ($this->nohtml()) {
1720
            $html = 0;
1721
        }
1722
        if ($this->nosmiley()) {
1723
            $smiley = 0;
1724
        }
1725
        switch ($format) {
1726
            case 'Show':
1727
                $bodytext     = $myts->displayTarea($this->bodytext, $html, $smiley, $xcodes);
1728
                $tmp          = '';
1729
                $auto_summary = $this->auto_summary($bodytext, $tmp);
1730
                $bodytext     = str_replace('[summary]', $auto_summary, $bodytext);
1731
                break;
1732
            case 'Edit':
1733
                $bodytext = $myts->htmlSpecialChars($this->bodytext);
1734
                break;
1735
            case 'Preview':
1736
                $bodytext = $myts->previewTarea($this->bodytext, $html, $smiley, $xcodes);
1737
                break;
1738
            case 'InForm':
1739
                $bodytext = $myts->stripSlashesGPC($this->bodytext);
1740
                $bodytext = $myts->htmlSpecialChars($bodytext);
1741
                break;
1742
        }
1743
1744
        return $bodytext;
1745
    }
1746
1747
    /**
1748
     * Returns stories by Ids