public function run(&$_data)
 {
     $engine = strtolower(C('TMPL_ENGINE_TYPE'));
     $_content = empty($_data['content']) ? $_data['file'] : $_data['content'];
     $_data['prefix'] = !empty($_data['prefix']) ? $_data['prefix'] : C('TMPL_CACHE_PREFIX');
     if ('sen' == $engine) {
         // Template engine using Sen
         if (!empty($_data['content']) && $this->checkContentCache($_data['content'], $_data['prefix']) || $this->checkCache($_data['file'], $_data['prefix'])) {
             // Cache is valid
             // Decomposition and load the template cache variables
             extract($_data['var'], EXTR_OVERWRITE);
             //Load template cache files
             include C('CACHE_PATH') . $_data['prefix'] . md5($_content) . C('TMPL_CACHFILE_SUFFIX');
         } else {
             $tpl = Sen::instance('SenTemplate');
             // Compile and load the template file
             $tpl->fetch($_content, $_data['var'], $_data['prefix']);
         }
     } else {
         // Called third-party template engine to parse and output
         $class = 'Template' . ucwords($engine);
         if (class_exists($class)) {
             $tpl = new $class();
             $tpl->fetch($_content, $_data['var']);
         } else {
             // Class does not define
             throw_exception(L('_NOT_SUPPERT_') . ': ' . $class);
         }
     }
 }
 public static function fatalError()
 {
     if ($e = error_get_last()) {
         Sen::appError($e['type'], $e['message'], $e['file'], $e['line']);
     }
 }
 /**
  * Resolution tab library
  * Need to call the corresponding tag library file parsing class
  * @access public
  * @param string $tagLib  Tag library name
  * @param string $tag  Tag names
  * @param string $attr  Tag attributes
  * @param string $content  Tag contents
  * @return string|false
  */
 public function parseXmlTag($tagLib, $tag, $attr, $content)
 {
     //if (MAGIC_QUOTES_GPC) {
     $attr = stripslashes($attr);
     $content = stripslashes($content);
     //}
     if (ini_get('magic_quotes_sybase')) {
         $attr = str_replace('\\"', '\'', $attr);
     }
     $tLib = Sen::instance('TagLib' . ucwords(strtolower($tagLib)));
     $parse = '_' . $tag;
     $content = trim($content);
     return $tLib->{$parse}($attr, $content);
 }
 /**
  * Architecture function
  * @access public
  */
 public function __construct()
 {
     $this->tagLib = strtolower(substr(get_class($this), 4));
     $this->tpl = Sen::instance('SenTemplate');
 }
 /**
  * Initialize the view
  * @access private
  * @return void
  */
 private function initView()
 {
     //View class is instantiated
     if (!$this->view) {
         $this->view = Sen::instance('View');
     }
     // Template variables by value
     if ($this->tVar) {
         $this->view->assign($this->tVar);
     }
 }
}
// Create a test Action
function build_first_action()
{
    $content = file_get_contents(SEN_PATH . 'Tpl/default_index.tpl');
    file_put_contents(LIB_PATH . 'Action/IndexAction.class.php', $content);
}
// Build directory security file
function build_dir_secure($dirs = '')
{
    // Write directory security
    if (defined('BUILD_DIR_SECURE') && BUILD_DIR_SECURE) {
        defined('DIR_SECURE_FILENAME') or define('DIR_SECURE_FILENAME', 'index.html');
        defined('DIR_SECURE_CONTENT') or define('DIR_SECURE_CONTENT', ' ');
        // Automatic write to directory security file
        $content = DIR_SECURE_CONTENT;
        $files = explode(',', DIR_SECURE_FILENAME);
        foreach ($files as $filename) {
            foreach ($dirs as $dir) {
                file_put_contents($dir . $filename, $content);
            }
        }
    }
}
// Required to load the runtime files
load_runtime_file();
// Records the time loading files
G('loadTime');
// Execute the entry
Sen::Start();
/**
 * Render Output Widget
 * @param string $name Widget name
 * @param array $data Transmission parameters
 * @param boolean $return Returns the content 
 * @return void
 */
function W($name, $data = array(), $return = false)
{
    $class = $name . 'Widget';
    require_cache(BASE_LIB_PATH . 'Widget/' . $class . '.class.php');
    if (!class_exists($class)) {
        throw_exception(L('_CLASS_NOT_EXIST_') . ':' . $class);
    }
    $widget = Sen::instance($class);
    $content = $widget->render($data);
    if ($return) {
        return $content;
    } else {
        echo $content;
    }
}