예제 #1
0
 function Red_Item($values, $type = '', $match = '')
 {
     if (is_object($values)) {
         foreach ($values as $key => $value) {
             $this->{$key} = $value;
         }
         if ($this->match_type) {
             $this->match = Red_Match::create($this->match_type, $this->action_data);
             $this->match->id = $this->id;
             $this->match->action_code = $this->action_code;
         }
         if ($this->action_type) {
             $this->action = Red_Action::create($this->action_type, $this->action_code);
             $this->match->action = $this->action;
         } else {
             $this->action = Red_Action::create('nothing', 0);
         }
         if ($this->last_access == '0000-00-00 00:00:00') {
             $this->last_access = 0;
         } else {
             $this->last_access = mysql2date('U', $this->last_access);
         }
     } else {
         $this->url = $values;
         $this->type = $type;
         $this->match = $match;
     }
 }
예제 #2
0
 function create($name, $code)
 {
     $avail = Red_Action::available();
     if (isset($avail[$name])) {
         if (!class_exists(strtolower($avail[$name][1]))) {
             include dirname(__FILE__) . '/../actions/' . $avail[$name][0];
         }
         $obj = new $avail[$name][1](array('action_code' => $code));
         $obj->type = $name;
         return $obj;
     }
     return false;
 }