XOOPS  2.6.0
DtypeSource.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10  */
11 
12 namespace Xoops\Core\Kernel\Dtype;
13 
16 
29 {
37  public function getVar(XoopsObject $obj, $key, $format)
38  {
39  $value = $obj->vars[$key]['value'];
40  switch (strtolower($format)) {
41  case 's':
42  case 'show':
43  return $value;
44  case 'e':
45  case 'edit':
46  return htmlspecialchars($value, ENT_QUOTES);
47  case 'p':
48  case 'preview':
49  return $this->ts->stripSlashesGPC($value);
50  case 'f':
51  case 'formpreview':
52  return htmlspecialchars($this->ts->stripSlashesGPC($value), ENT_QUOTES);
53  case 'n':
54  case 'none':
55  default:
56  return $value;
57  }
58  }
59 
67  public function cleanVar(XoopsObject $obj, $key, $quote = true)
68  {
69  $value = trim($obj->vars[$key]['value']);
70 
71  if (!$obj->vars[$key]['not_gpc']) {
72  $value = $this->ts->stripSlashesGPC($value);
73  }
74  if ($quote) {
75  $value = str_replace('\\"', '"', $this->db->quote($value));
76  }
77  return $value;
78  }
79 }
db()
Definition: Xoops.php:175
getVar(XoopsObject $obj, $key, $format)
Definition: DtypeSource.php:37
cleanVar(XoopsObject $obj, $key, $quote=true)
Definition: DtypeSource.php:67