Ejemplo n.º 1
0
 public function action($path, \Closure $callback)
 {
     if (ltrim($path, '/') === $this->route) {
         $pug = new Pug();
         $vars = $callback($path) ?: array();
         $output = $pug->render(__DIR__ . '/' . $path . $pug->getExtension(), $vars);
         echo $output;
     }
 }
Ejemplo n.º 2
0
 public static function shutdown()
 {
     if (is_null($error = error_get_last()) === false) {
         self::handler($error['type'], $error['message'], $error['file'], $error['line']);
     }
     global $cfg;
     if (count(self::$errors) > 0) {
         /*if(
             !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && 
             strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest') {
           */
         if (defined('KDB_JSON')) {
             Header('Content-type: application/json');
             http_response_code(400);
             $return = ['status' => 400, 'result' => 'Internal', 'errors' => self::$errors];
             echo json_encode($return, JSON_PRETTY_PRINT);
         } else {
             self::$html = Pug::c('Debug', ['errors' => self::$errors], true);
             if (self::$html == false) {
                 hpr(self::$errors);
             } else {
                 echo self::$html;
             }
         }
     }
 }
Ejemplo n.º 3
0
function jBlockParsing($_type = "html", $_string = "", $_parameters = [])
{
    switch ($_type) {
        case "pug":
        case "jade":
            $Pug = new Pug();
            $_string = $Pug->drawText($_string, $_parameters);
            break;
        case "md":
        case "markdown":
        case "parsedown":
            $Parsedown = new Parsedown();
            $_string = $Parsedown->drawText($_string);
            break;
        case "twig":
            $Twig = new Twig();
            $_string = $Twig->drawText($_string, $_parameters);
            break;
        default:
            break;
    }
    return $_string;
}
Ejemplo n.º 4
0
Archivo: GUI.php Proyecto: XaBerr/JUICE
 protected function parsingFile($_file, $_type = "html")
 {
     switch ($_type) {
         case 'pug':
         case 'jade':
             $pug = new Pug();
             $page = $pug->drawFile($_file);
             break;
         case "md":
         case "markdown":
         case "parsedown":
             $Parsedown = new Parsedown();
             $page = $Parsedown->drawFile($_file);
             break;
         case 'twig':
             $twig = new Twig();
             $page = $twig->drawFile($_file);
             break;
         default:
             $page = file_get_contents($_file);
             break;
     }
     return $page;
 }