Exemplo n.º 1
0
 public function attValueEnd($ch)
 {
     $this->c_quote = $this->att_quote;
     $c_val = $this->stack;
     $res = parent::attValueEnd($ch);
     if ($this->debug) {
         fx::debug($res === false, $c_val);
     }
     if ($res !== false) {
         $this->c_att['value'] = $c_val;
         $this->addAtt();
         $this->stack = '';
     }
     $this->c_quote = null;
     return $res;
 }
Exemplo n.º 2
0
 public static function data($datatype, $id = null)
 {
     // fx::data($page) instead of $page_id
     if (is_object($id) && $id instanceof Entity) {
         return $id;
     }
     $namespace = self::getComponentNamespace($datatype);
     $class_name = $namespace . '\\Finder';
     if (!class_exists($class_name)) {
         fx::debug('no data class', $class_name, debug_backtrace());
         throw new \Exception('Class not found: ' . $class_name . ' for ' . $datatype);
     }
     $num_args = func_num_args();
     if ($num_args > 1 && $class_name::isStaticCacheUsed()) {
         if (is_scalar($id)) {
             $static_res = $class_name::getFromStaticCache($id);
             if ($static_res) {
                 return $static_res;
             }
         }
     }
     $finder = new $class_name();
     if ($num_args === 1) {
         return $finder;
     }
     if (is_array($id) || $id instanceof \Traversable) {
         return $finder->getByIds($id);
     }
     return $finder->getById($id);
 }
Exemplo n.º 3
0
<?php

ini_set('display_errors', 'off');
try {
    require_once 'boot.php';
    $result = fx::router()->route();
    if (fx::env('ajax')) {
        $result = fx::page()->ajaxResponse($result);
    }
    echo $result;
    fx::complete();
} catch (\Exception $e) {
    fx::log($e, $e->getTraceAsString());
    if (!fx::env('ajax') || fx::env('console')) {
        fx::debug($e, $e->getTraceAsString());
    }
}
Exemplo n.º 4
0
 /**
  * The file read
  * @param string $filename the file name
  */
 public function readfile($filename)
 {
     $local_filename = $this->getFullPath($filename);
     // Check for the existence, the ability to read and is not a directory
     if (!file_exists($local_filename) || !is_readable($local_filename) || is_dir($local_filename)) {
         fx::debug(debug_backtrace());
         throw new Exception\Files("Unable to read file {$local_filename}");
     }
     return file_get_contents($local_filename);
 }