public function __construct() { $this->fw = fw::i(); if ($this->model_name) { $this->model = fw::model($this->model_name); } }
public function __construct($param_fw = null) { if (is_null($param_fw)) { $this->fw = fw::i(); } else { $this->fw = $fw; } }
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; }
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; }
public static function write($icode, $value) { return Utils::f2date(fw::i()->set_value($icode, $value)); }