Пример #1
0
 /**
  * assign a value to a variable
  *
  * @access public
  * @param string $key   name of the variable to assign
  * @param mixed  $value value to assign
  */
 public function assignVar($key, $value)
 {
     if (isset($key) && isset($this->vars[$key])) {
         switch ($this->vars[$key]['data_type']) {
             case XOBJ_DTYPE_UNICODE_ARRAY:
                 if (is_array($value)) {
                     $this->vars[$key]['value'] =& array_walk($value, 'xoops_aw_decode');
                 } else {
                     $this->vars[$key]['value'] =& xoops_convert_decode($value);
                 }
                 break;
             case XOBJ_DTYPE_UNICODE_URL:
             case XOBJ_DTYPE_UNICODE_EMAIL:
             case XOBJ_DTYPE_UNICODE_OTHER:
             case XOBJ_DTYPE_UNICODE_TXTBOX:
             case XOBJ_DTYPE_UNICODE_TXTAREA:
                 $this->vars[$key]['value'] =& xoops_convert_decode($value);
                 break;
             case XOBJ_DTYPE_DATE:
                 if (!is_string($value) && is_numeric($value)) {
                     $this->vars[$key]['value'] = date(_DBDATESTRING, $value);
                 } else {
                     $this->vars[$key]['value'] = date(_DBDATESTRING, strtotime($value));
                 }
                 break;
             case XOBJ_DTYPE_TIME:
                 if (!is_string($value) && is_numeric($value)) {
                     $this->vars[$key]['value'] = date(_DBTIMESTRING, $value);
                 } else {
                     $this->vars[$key]['value'] = date(_DBTIMESTRING, strtotime($value));
                 }
                 break;
             case XOBJ_DTYPE_TIMESTAMP:
                 if (!is_string($value) && is_numeric($value)) {
                     $this->vars[$key]['value'] = date(_DBTIMESTAMPSTRING, $value);
                 } else {
                     $this->vars[$key]['value'] = date(_DBTIMESTAMPSTRING, strtotime($value));
                 }
                 break;
                 // YOU SHOULD NOT USE THE ABOVE TYPES, THEY WILL BE REMOVED
             // YOU SHOULD NOT USE THE ABOVE TYPES, THEY WILL BE REMOVED
             default:
                 $this->vars[$key]['value'] =& $value;
         }
     }
 }
/**
 * xoops_aw_decode()
 *
 * @param value of array $value
 * @param key of array $key
 * @return boolean
 */
function xoops_aw_decode($value, $key, $store_method = "urlcode")
{
    $value = xoops_convert_decode($value, $store_method);
}
Пример #3
0
 /**
  * assign a value to a variable
  *
  * @access public
  * @param string $key name of the variable to assign
  * @param mixed $value value to assign
  */
 function assignVar($key, $value)
 {
     if (isset($key) && isset($this->vars[$key])) {
         switch ($this->vars[$key]['data_type']) {
             case XOBJ_DTYPE_UNICODE_ARRAY:
                 if (is_array($value)) {
                     $this->vars[$key]['value'] =& array_walk($value, "xoops_aw_decode");
                 } else {
                     $this->vars[$key]['value'] =& xoops_convert_decode($value);
                 }
                 break;
             case XOBJ_DTYPE_UNICODE_URL:
             case XOBJ_DTYPE_UNICODE_EMAIL:
             case XOBJ_DTYPE_UNICODE_OTHER:
             case XOBJ_DTYPE_UNICODE_TXTBOX:
             case XOBJ_DTYPE_UNICODE_TXTAREA:
                 $this->vars[$key]['value'] =& xoops_convert_decode($value);
                 break;
             default:
                 $this->vars[$key]['value'] =& $value;
         }
     }
 }