XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
ConditionWithArgument.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
10 {
11 
21  {
22  if($argument === null)
23  {
24  $this->_show = false;
25  return;
26  }
27  parent::__construct($column_name, $argument, $operation, $pipe);
28  $this->_value = $argument->getValue();
29  }
30 
31  function getArgument()
32  {
33  if(!$this->show())
34  return;
35  return $this->argument;
36  }
37 
43  {
44  $value = $this->argument->getUnescapedValue();
45 
46  if(is_array($value))
47  {
48  $q = '';
49  foreach($value as $v)
50  {
51  $q .= '?,';
52  }
53  if($q !== '')
54  {
55  $q = substr($q, 0, -1);
56  }
57  $q = '(' . $q . ')';
58  }
59  else
60  {
61  // Prepared statements: column names should not be sent as query arguments, but instead concatenated to query string
62  if($this->argument->isColumnName())
63  {
64  $q = $value;
65  }
66  else
67  {
68  $q = '?';
69  }
70  }
71  return $this->pipe . ' ' . $this->getConditionPart($q);
72  }
73 
77  function show()
78  {
79  if(!isset($this->_show))
80  {
81  if(!$this->argument->isValid())
82  {
83  $this->_show = false;
84  }
85  if($this->_value === '\'\'')
86  {
87  $this->_show = false;
88  }
89  if(!isset($this->_show))
90  {
91  return parent::show();
92  }
93  }
94  return $this->_show;
95  }
96 
97 }
98 /* End of file ConditionWithArgument.class.php */
99 /* Location: ./classes/db/queryparts/condition/ConditionWithArgument.class.php */
__construct($column_name, $argument, $operation, $pipe="")
getConditionPart($value)