示例#1
0
 public function __construct()
 {
     $this->fw = fw::i();
     if ($this->model_name) {
         $this->model = fw::model($this->model_name);
     }
 }
示例#2
0
 public function __construct($param_fw = null)
 {
     if (is_null($param_fw)) {
         $this->fw = fw::i();
     } else {
         $this->fw = $fw;
     }
 }
示例#3
0
function hfvalue($tag, &$hf)
{
    $value = NULL;
    if (!isset($tag)) {
        return $value;
    }
    $empty_val = NULL;
    if (preg_match("/\\[/", $tag)) {
        $arr = explode('[', $tag);
        if (strtoupper($arr[0]) == 'GLOBAL') {
            #was $ptr=&$GLOBALS;
            $ptr = fw::i()->G;
            array_shift($arr);
        } elseif (strtoupper($arr[0]) == 'SESSION') {
            $ptr =& $_SESSION;
            array_shift($arr);
        } else {
            $ptr =& $hf;
        }
        for ($i = 0; $i < count($arr); $i++) {
            $k = preg_replace("/\\].*?/", '', $arr[$i]);
            #remove last ]
            if (is_array($ptr) && array_key_exists($k, $ptr)) {
                $ptr =& $ptr[$k];
            } else {
                $ptr =& $empty_val;
                #looks like there are just no such key in array OR $ptr is not an array at all - so return empty value
                break;
            }
        }
        $value = $ptr;
    } else {
        if (is_array($hf) && array_key_exists($tag, $hf)) {
            $value = $hf[$tag];
        }
    }
    return $value;
}
示例#4
0
文件: fw.php 项目: osalabs/osafw-php
 public static function model($model_class)
 {
     $fw = fw::i();
     if (array_key_exists(strtolower($model_class), $fw->models_cache)) {
         return $fw->models_cache[$model_class];
     }
     #logger($model_class);
     $object = new $model_class($fw);
     $fw->models_cache[$model_class] = $object;
     return $object;
 }
示例#5
0
 public static function write($icode, $value)
 {
     return Utils::f2date(fw::i()->set_value($icode, $value));
 }