Changeset 1346 in subversion


Ignore:
Timestamp:
Apr 30, 2008 9:24:45 AM (5 years ago)
Author:
till
Message:
  • implemented set/get
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/include/rcube_html_page.php

    r1291 r1346  
    11<?php 
    2  
    32/* 
    43 +-----------------------------------------------------------------------+ 
     
    2423 * 
    2524 * @package HTML 
     25 * 
     26 * @author  Thomas Bruederli <roundcube@gmail.com> 
     27 * @license http://gnu.org GPL 
     28 * @todo    See about improving performance (__get, __set, sprintf) 
    2629 */ 
    2730class rcube_html_page 
    2831{ 
    29     protected $scripts_path = ''; 
    30     protected $script_files = array(); 
    31     protected $external_scripts = array(); 
    32     protected $scripts = array(); 
    33     protected $charset = 'UTF-8'; 
    34  
    35     protected $script_tag_file = "<script type=\"text/javascript\" src=\"%s%s\"></script>\n"; 
    36     protected $script_tag      = "<script type=\"text/javascript\">\n<!--\n%s\n\n//-->\n</script>\n"; 
    37     protected $default_template = "<html>\n<head><title></title></head>\n<body></body>\n</html>"; 
    38     protected $tag_format_external_script = "<script type=\"text/javascript\" src=\"%s\"></script>\n"; 
    39  
    40     protected $title = ''; 
    41     protected $header = ''; 
    42     protected $footer = ''; 
    43     protected $body = ''; 
    44  
    45  
    46     /** Constructor */ 
    47     public function __construct() {} 
     32    protected $_store = array(); 
     33 
     34    /** 
     35     * Constructor 
     36     * 
     37     * @return rcube_html_page 
     38     * @uses self::reset() 
     39     */ 
     40    public function __construct() 
     41    { 
     42        $this->reset(); 
     43    } 
    4844 
    4945    /** 
     
    125121    /** 
    126122     * Reset all saved properties 
     123     * 
     124     * @return void 
     125     * @see self::__construct 
     126     * @uses self::$_store 
    127127     */ 
    128128    public function reset() 
    129129    { 
     130        $this->scripts_path = ''; 
    130131        $this->script_files = array(); 
     132        $this->external_scripts = array(); 
    131133        $this->scripts = array(); 
     134        $this->charset = 'UTF-8'; 
     135 
     136        // templates 
     137        $this->script_tag_file = "<script type=\"text/javascript\" src=\"%s%s\"></script>\n"; 
     138        $this->script_tag = "<script type=\"text/javascript\">\n<!--\n%s\n\n//-->\n</script>\n"; 
     139        $this->default_template = "<html>\n<head><title></title></head>\n<body></body>\n</html>"; 
     140        $this->tag_format_external_script = "<script type=\"text/javascript\" src=\"%s\"></script>\n"; 
     141 
     142        // page stuff 
    132143        $this->title = ''; 
    133144        $this->header = ''; 
    134145        $this->footer = ''; 
     146        $this->body = ''; 
    135147    } 
    136148 
     
    251263        $output = str_replace('$__skin_path', $base_path, $output); 
    252264 
    253         print rcube_charset_convert($output, 'UTF-8', $this->charset); 
     265        echo rcube_charset_convert($output, 'UTF-8', $this->charset); 
     266    } 
     267 
     268    /** 
     269     * __get 
     270     * 
     271     * @param string $var A variable name. 
     272     * 
     273     * @return mixed 
     274     * @uses self::$_store 
     275     */ 
     276    public function __get($var) 
     277    { 
     278        return $this->_store[$var]; 
     279    } 
     280 
     281    /** 
     282     * __set 
     283     * 
     284     * @param string $var A variable name. 
     285     * @param mixed  $value The value of the variable. 
     286     * 
     287     * @return mixed 
     288     * @uses self::$_store 
     289     */ 
     290    public function __set($var, $value) 
     291    { 
     292        return $this->_store[$var] = $value; 
    254293    } 
    255294} 
    256  
Note: See TracChangeset for help on using the changeset viewer.