Changeset 757

Show
Ignore:
Timestamp:
01/28/08 14:18:43 (1 year ago)
Author:
laurentj
Message:

enhancement #440: we can specify our own doctype in html response, by overriding the new outputDoctype function.
renamed also the _commonProcess function with the name doAfterActions, however _commonProcess is still there for the compatibility

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/lib/jelix/core/response/jResponseHtml.class.php

    r699 r757  
    152152 
    153153        $this->sendHttpHeaders(); 
    154         if($this->_isXhtml){ 
    155             echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    156 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="',$this->_lang,'" lang="',$this->_lang,'"> 
    157 '; 
    158         }else{ 
    159             echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', "\n"; 
    160             echo '<html lang="',$this->_lang,'">'; 
    161         } 
     154        $this->outputDoctype(); 
    162155        $this->_headSent = 1; 
    163         $this->_commonProcess(); 
     156        $this->doAfterActions(); 
    164157        if($this->bodyTpl != '') 
    165158            $this->body->meta($this->bodyTpl); 
     
    226219     * The method you can overload in your inherited html response 
    227220     * overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) 
    228      * for all actions 
     221     * after all actions 
     222     * @since 1.1 
     223     */ 
     224    protected function doAfterActions(){ 
     225        $this->_commonProcess(); // for compatibility with jelix 1.0 
     226    } 
     227 
     228    /** 
     229     * same use as doAfterActions, but deprecated method. It is just here for compatibility with Jelix 1.0. 
     230     * Use doAfterActions instead 
     231     * @deprecated 
    229232     */ 
    230233    protected function _commonProcess(){ 
    231  
    232234    } 
    233235 
     
    370372    final public function addMetaDescription ($content){ 
    371373        $this->_MetaDescription[] = $content; 
     374    } 
     375 
     376    /** 
     377     * generate the doctype. You can override it if you want to have your own doctype, like XHTML+MATHML. 
     378     */ 
     379    protected function outputDoctype (){ 
     380        if($this->_isXhtml){ 
     381            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     382<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="',$this->_lang,'" lang="',$this->_lang,'"> 
     383'; 
     384        }else{ 
     385            echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', "\n"; 
     386            echo '<html lang="',$this->_lang,'">'; 
     387        } 
    372388    } 
    373389 
  • trunk/lib/jelix/core/response/jResponseHtml.class.php

    r699 r757  
    152152 
    153153        $this->sendHttpHeaders(); 
    154         if($this->_isXhtml){ 
    155             echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    156 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="',$this->_lang,'" lang="',$this->_lang,'"> 
    157 '; 
    158         }else{ 
    159             echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', "\n"; 
    160             echo '<html lang="',$this->_lang,'">'; 
    161         } 
     154        $this->outputDoctype(); 
    162155        $this->_headSent = 1; 
    163         $this->_commonProcess(); 
     156        $this->doAfterActions(); 
    164157        if($this->bodyTpl != '') 
    165158            $this->body->meta($this->bodyTpl); 
     
    226219     * The method you can overload in your inherited html response 
    227220     * overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) 
    228      * for all actions 
     221     * after all actions 
     222     * @since 1.1 
     223     */ 
     224    protected function doAfterActions(){ 
     225        $this->_commonProcess(); // for compatibility with jelix 1.0 
     226    } 
     227 
     228    /** 
     229     * same use as doAfterActions, but deprecated method. It is just here for compatibility with Jelix 1.0. 
     230     * Use doAfterActions instead 
     231     * @deprecated 
    229232     */ 
    230233    protected function _commonProcess(){ 
    231  
    232234    } 
    233235 
     
    370372    final public function addMetaDescription ($content){ 
    371373        $this->_MetaDescription[] = $content; 
     374    } 
     375 
     376    /** 
     377     * generate the doctype. You can override it if you want to have your own doctype, like XHTML+MATHML. 
     378     */ 
     379    protected function outputDoctype (){ 
     380        if($this->_isXhtml){ 
     381            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     382<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="',$this->_lang,'" lang="',$this->_lang,'"> 
     383'; 
     384        }else{ 
     385            echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', "\n"; 
     386            echo '<html lang="',$this->_lang,'">'; 
     387        } 
    372388    } 
    373389 
  • trunk/lib/jelix/core/response/jResponseHtml.class.php

    r699 r757  
    152152 
    153153        $this->sendHttpHeaders(); 
    154         if($this->_isXhtml){ 
    155             echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
    156 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="',$this->_lang,'" lang="',$this->_lang,'"> 
    157 '; 
    158         }else{ 
    159             echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', "\n"; 
    160             echo '<html lang="',$this->_lang,'">'; 
    161         } 
     154        $this->outputDoctype(); 
    162155        $this->_headSent = 1; 
    163         $this->_commonProcess(); 
     156        $this->doAfterActions(); 
    164157        if($this->bodyTpl != '') 
    165158            $this->body->meta($this->bodyTpl); 
     
    226219     * The method you can overload in your inherited html response 
    227220     * overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) 
    228      * for all actions 
     221     * after all actions 
     222     * @since 1.1 
     223     */ 
     224    protected function doAfterActions(){ 
     225        $this->_commonProcess(); // for compatibility with jelix 1.0 
     226    } 
     227 
     228    /** 
     229     * same use as doAfterActions, but deprecated method. It is just here for compatibility with Jelix 1.0. 
     230     * Use doAfterActions instead 
     231     * @deprecated 
    229232     */ 
    230233    protected function _commonProcess(){ 
    231  
    232234    } 
    233235 
     
    370372    final public function addMetaDescription ($content){ 
    371373        $this->_MetaDescription[] = $content; 
     374    } 
     375 
     376    /** 
     377     * generate the doctype. You can override it if you want to have your own doctype, like XHTML+MATHML. 
     378     */ 
     379    protected function outputDoctype (){ 
     380        if($this->_isXhtml){ 
     381            echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 
     382<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="',$this->_lang,'" lang="',$this->_lang,'"> 
     383'; 
     384        }else{ 
     385            echo '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">', "\n"; 
     386            echo '<html lang="',$this->_lang,'">'; 
     387        } 
    372388    } 
    373389 
  • trunk/lib/jelix/core/response/jResponseXul.class.php

    r705 r757  
    105105        $this->_httpHeaders['Content-Type']='application/vnd.mozilla.xul+xml;charset='.$GLOBALS['gJConfig']->charset; 
    106106        $this->sendHttpHeaders(); 
    107         $this->_commonProcess(); 
     107        $this->doAfterActions(); 
    108108        if($this->bodyTpl != '') 
    109109            $this->body->meta($this->bodyTpl); 
     
    277277 
    278278    /** 
    279      * override it into your own xul response object, to do 
    280      * all things commons to all xul actions 
     279     * The method you can overload in your inherited XUL response 
     280     * overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) 
     281     * after all actions 
     282     * @since 1.1 
     283     */ 
     284    protected function doAfterActions(){ 
     285        $this->_commonProcess(); // for compatibility with jelix 1.0 
     286    } 
     287 
     288    /** 
     289     * same use as doAfterActions, but deprecated method. It is just here for compatibility with Jelix 1.0. 
     290     * Use doAfterActions instead 
     291     * @deprecated 
    281292     */ 
    282293    protected function _commonProcess(){ 
    283  
    284294    } 
    285295 
  • trunk/lib/jelix/core/response/jResponseXul.class.php

    r705 r757  
    105105        $this->_httpHeaders['Content-Type']='application/vnd.mozilla.xul+xml;charset='.$GLOBALS['gJConfig']->charset; 
    106106        $this->sendHttpHeaders(); 
    107         $this->_commonProcess(); 
     107        $this->doAfterActions(); 
    108108        if($this->bodyTpl != '') 
    109109            $this->body->meta($this->bodyTpl); 
     
    277277 
    278278    /** 
    279      * override it into your own xul response object, to do 
    280      * all things commons to all xul actions 
     279     * The method you can overload in your inherited XUL response 
     280     * overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) 
     281     * after all actions 
     282     * @since 1.1 
     283     */ 
     284    protected function doAfterActions(){ 
     285        $this->_commonProcess(); // for compatibility with jelix 1.0 
     286    } 
     287 
     288    /** 
     289     * same use as doAfterActions, but deprecated method. It is just here for compatibility with Jelix 1.0. 
     290     * Use doAfterActions instead 
     291     * @deprecated 
    281292     */ 
    282293    protected function _commonProcess(){ 
    283  
    284294    } 
    285295 
  • trunk/lib/jelix/core/response/jResponseXul.class.php

    r705 r757  
    105105        $this->_httpHeaders['Content-Type']='application/vnd.mozilla.xul+xml;charset='.$GLOBALS['gJConfig']->charset; 
    106106        $this->sendHttpHeaders(); 
    107         $this->_commonProcess(); 
     107        $this->doAfterActions(); 
    108108        if($this->bodyTpl != '') 
    109109            $this->body->meta($this->bodyTpl); 
     
    277277 
    278278    /** 
    279      * override it into your own xul response object, to do 
    280      * all things commons to all xul actions 
     279     * The method you can overload in your inherited XUL response 
     280     * overload it if you want to add processes (stylesheet, head settings, additionnal content etc..) 
     281     * after all actions 
     282     * @since 1.1 
     283     */ 
     284    protected function doAfterActions(){ 
     285        $this->_commonProcess(); // for compatibility with jelix 1.0 
     286    } 
     287 
     288    /** 
     289     * same use as doAfterActions, but deprecated method. It is just here for compatibility with Jelix 1.0. 
     290     * Use doAfterActions instead 
     291     * @deprecated 
    281292     */ 
    282293    protected function _commonProcess(){ 
    283  
    284294    } 
    285295 
  • trunk/testapp/responses/myHtmlResponse.class.php

    r705 r757  
    1919 
    2020   // modifications communes aux actions utilisant cette reponses 
    21    protected function _commonProcess(){ 
     21   protected function doAfterActions(){ 
    2222       $this->title .= ($this->title !=''?' - ':'').' Test App'; 
    2323 
  • trunk/testapp/responses/myHtmlResponse.class.php

    r705 r757  
    1919 
    2020   // modifications communes aux actions utilisant cette reponses 
    21    protected function _commonProcess(){ 
     21   protected function doAfterActions(){ 
    2222       $this->title .= ($this->title !=''?' - ':'').' Test App'; 
    2323 
  • trunk/testapp/responses/myHtmlResponse.class.php

    r705 r757  
    1919 
    2020   // modifications communes aux actions utilisant cette reponses 
    21    protected function _commonProcess(){ 
     21   protected function doAfterActions(){ 
    2222       $this->title .= ($this->title !=''?' - ':'').' Test App'; 
    2323 
Download in other formats: Unified Diff Zip Archive