Code Duplication    Length = 31-33 lines in 2 locations

class/class.newsstory.php 2 locations

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