Go to the FreeLists Home Page Home Signup Help Login
 



[dokuwiki] || [Date Prev] [01-2008 Date Index] [Date Next] || [Thread Prev] [01-2008 Thread Index] [Thread Next]

[dokuwiki] Doku_Handler : remove htmlok and phpok tests

  • From: Spring Pierre <pierre.spring@xxxxxxx>
  • To: dokuwiki@xxxxxxxxxxxxx
  • Date: Fri, 11 Jan 2008 16:48:28 +0100
hi list,

when extending the xhtml renderer, i noticed something:

when html and php input are "disabled" (i.e. $conf['htmlok'] = false), the $renderer->html() and $renderer->php() methodes never get called. instead, the $renderer->file() gets called directly.

the reason is, that the Doku_Handler implements the following methode:

    function html($match, $state, $pos) {
        global $conf;
        if ( $state == DOKU_LEXER_UNMATCHED ) {
            if($conf['htmlok']){
                $this->_addCall('html',array($match), $pos);
            } else {
                $this->_addCall('file',array($match), $pos);
            }
        }
        return true;
    }

and therefor the <html> and <php> tags become "file" instructions before ever getting to the renderer.

that way, the renderer can not know, if it initially was php or html. this could be usefull, if you'd want to add highlighting to the output, that is not evaluated. furthermore, the Doku_Renderer_xhtml already implements the check in the php() and html() methodes [1].

what do you think?

could we remove that double checking in the Doku_Handler, and trust that the renderer does it's job correctly?

greetings. pierre

=====
[1] from inc/parser/xhtml.php
    /**
     * Execute PHP code if allowed
     *
     * @author Andreas Gohr <andi@xxxxxxxxxxxxxx>
     */
    function php($text) {
        global $conf;
        if($conf['phpok']){
            ob_start();
            eval($text);
            $this->doc .= ob_get_contents();
            ob_end_clean();
        }else{
            $this->file($text, "php");
        }
    }

    /**
     * Insert HTML if allowed
     *
     * @author Andreas Gohr <andi@xxxxxxxxxxxxxx>
     */
    function html($text) {
        global $conf;
        if($conf['htmlok']){
          $this->doc .= $text;
        }else{
          $this->file($text, "html");
        }
    }
--
Liip AG // Rte de la Fonderie 7 // CH-1700 Fribourg
Fon 026 4222511 // Key id 0x5BF5F8FA // www.liip.ch




--
DokuWiki mailing list - more info at
http://wiki.splitbrain.org/wiki:mailinglist




[ Home | Signup | Help | Login | Archives | Lists ]

All trademarks and copyrights within the FreeLists archives are owned by their respective owners.
Everything else ©2007 Avenir Technologies, LLC.