function __set($name, $value)
 {
     if (strncmp($name, 'param_', 6) == 0) {
         $paramname = substr($name, 6);
         $params = empty($this->params) ? array() : unserialize($this->params);
         $params[$paramname] = $value;
         $this->params = serialize($params);
     } else {
         parent::__set($name, $value);
     }
 }
Esempio n. 2
0
 /**
  * Magic setter to set parameter values
  */
 public function __set($name, $value)
 {
     if (strncmp($name, 'param_', 6) == 0) {
         $paramname = substr($name, 6);
         $params = unserialize($this->params);
         $params[$paramname] = $value;
         $this->params = serialize($params);
     } else {
         return parent::__set($name, $value);
     }
 }
 /**
  * Magic set method to set the value of a custom field.  See __get.
  */
 public function __set($name, $value)
 {
     $prefix_len = strlen(self::CUSTOM_FIELD_PREFIX);
     if (strncmp($name, self::CUSTOM_FIELD_PREFIX, $prefix_len) == 0) {
         $this->_load_fields();
         $contextlevel = $this->get_field_context_level();
         $shortname = substr($name, $prefix_len);
         if (isset(self::$_fields[$contextlevel][$shortname])) {
             if (self::$_fields[$contextlevel][$shortname]->multivalued) {
                 // field is multivalued, so make sure that value is an array
                 if (!is_array($value)) {
                     $value = array($value);
                 }
             } else {
                 // field is not multivalued, so make sure that it isn't an
                 // array
                 if (is_array($value)) {
                     $value = current($value);
                 }
             }
             $this->_field_data[$shortname] = $value;
             $this->_field_changed[$shortname] = true;
             return;
         }
     }
     return parent::__set($name, $value);
 }