/** * Clean values of all variables of the object for storage. * also add slashes and quote string wherever needed * * @param XoopsObject $object object to act on * * @return bool true if successful * @access public */ public function cleanVars(XoopsObject $object) { $vars = $object->getVars(); $object->cleanVars = array(); foreach ($vars as $k => $v) { if (!$v["changed"]) { continue; } $object->cleanVars[$k] = Dtype::cleanVar($object, $k); } $object->unsetDirty(); $errors = $object->getErrors(); return empty($errors) ? true : false; }
/** * clean values of all variables of the object for storage. * also add slashes whereever needed * * @param bool $quote add quotes for db storage * * @return bool true if successful * @access public */ public function cleanVars($quote = true) { $ts = \MyTextSanitizer::getInstance(); $existing_errors = $this->getErrors(); $this->_errors = array(); foreach ($this->vars as $k => $v) { if (!$v['changed']) { } else { $this->cleanVars[$k] = Dtype::cleanVar($this, $k, $quote); } } if (count($this->_errors) > 0) { $this->_errors = array_merge($existing_errors, $this->_errors); return false; } // $this->_errors = array_merge($existing_errors, $this->_errors); $this->unsetDirty(); return true; }
/** * getDtypeName * * @param XoopsObject $obj object * @param mixed $key key * * @return string */ private static function getDtypeName(XoopsObject $obj, $key) { $name = $obj->vars[$key]['data_type']; $lNames = Dtype::getLegacyNames(); if (isset($lNames[$name])) { return $lNames[$name]; } return $name; }
/** * getVar * * @param XoopsObject $obj object * @param string $key key * @param string $format format * * @return mixed */ public static function getVar(XoopsObject $obj, $key, $format) { return Dtype::loadDtype(Dtype::getDtypeName($obj, $key))->getVar($obj, $key, $format); }
/** * clean values of all variables of the object for storage. * * @return bool true if successful */ public function cleanVars() { $existing_errors = $this->getErrors(); $this->errors = array(); foreach ($this->vars as $k => $v) { if (!$v['changed']) { } else { $this->cleanVars[$k] = Dtype::cleanVar($this, $k); } } if (count($this->errors) > 0) { $this->errors = array_merge($existing_errors, $this->errors); return false; } // $this->_errors = array_merge($existing_errors, $this->_errors); $this->unsetDirty(); return true; }