示例#1
0
 /**
  * Get the singleton instance of Xhtml.
  * @return  Xhtml
  */
 public static function instance($file = NULL, $config_name = 'default')
 {
     if (self::$_instance === NULL) {
         // Create a new instance
         self::$_instance = new self($file);
         // Set instance of Head class
         self::$head = Head::instance(array(), $config_name);
         // Set defaults from config
         $default = Kohana::config('xhtml.' . $config_name);
         foreach (array('doctype', 'langcode', 'htmlatts', 'body') as $key) {
             if (isset($default[$key]) and !empty($default[$key])) {
                 self::${$key} = $default[$key];
             }
         }
     }
     return self::$_instance;
 }