/** * Gettin data from request for this object * @param string $prefix * @param string $request */ public function getRequest($prefix = null, $request = 'POST') { $prefix = $prefix ? $prefix . '_' : null; /* get data types of my properties */ $properties = get_object_vars($this); Sobi::Trigger($this->name(), ucfirst(__FUNCTION__) . 'Start', array(&$properties)); /* and of the parent properties */ $types = array_merge($this->types(), self::$types); foreach ($properties as $property => $values) { /* if this is an internal variable */ if (substr($property, 0, 1) == '_') { continue; } /* if no data type has been declared */ if (!isset($types[$property])) { continue; } /* if there was no data for this property ( not if it was just empty ) */ if (!SPRequest::exists($prefix . $property, $request)) { continue; } /* if the declared data type has not handler in request class */ if (!method_exists('SPRequest', $types[$property])) { Sobi::Error($this->name(), SPLang::e('Method %s does not exist!', $types[$property]), SPC::WARNING, 0, __LINE__, __FILE__); continue; } /* now we get it ;) */ $this->{$property} = SPRequest::$types[$property]($prefix . $property, null, $request); } /* trigger plugins */ Sobi::Trigger('getRequest', $this->name(), array(&$this)); }