Exemplo n.º 1
0
 /**
  * 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;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }
Exemplo n.º 3
0
 /**
  * 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;
 }
Exemplo n.º 4
0
 /**
  * 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);
 }
Exemplo n.º 5
0
 /**
  * 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;
 }