public function view($view = null, $data = null) { if (!$view || !MValidate::varname($view)) { $view = 'default'; } $init = 'views:' . $view; $viewfile = mapi_abs_path($init, $this->get_wdir()); if (is_file($viewfile) && is_readable($viewfile)) { include_once $viewfile; } }
function mapi_include_abs_path($path, $prefix = null) { $path = mapi_abs_path($path, $prefix); if (!$path) { return null; } if (!is_file($path)) { return null; } if (!is_readable($path)) { return null; } include_once $path; return true; }
static function check_template($template) { if (!MValidate::ext_name($template)) { return false; } if (!mapi_abs_path($template . ':head', 'templates')) { return false; } if (!mapi_abs_path($template . ':body', 'templates')) { return false; } if (!mapi_abs_path($template . ':foot', 'templates')) { return false; } $markdown = self::markdown('template', $template); if (!isset($markdown['title']) || !strlen($markdown['title']) > 1) { return false; } if (!isset($markdown['version']) || !strlen($markdown['version']) > 0) { return false; } return true; }
private function render_foot() { $footfile = mapi_abs_path('foot', $this->get_wdir()); if (is_file($footfile) && is_readable($footfile)) { ob_start(); include $footfile; $this->foot = ob_get_contents(); ob_end_clean(); } else { die('M_ERROR (00215): Cannot load template: Temaplate foot file is missing'); } }