XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
ConditionsTag.class.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
12 {
13 
19 
25  function __construct($xml_conditions)
26  {
27  $this->condition_groups = array();
28  if(!$xml_conditions)
29  {
30  return;
31  }
32 
33  $xml_condition_list = array();
34  if($xml_conditions->condition)
35  {
36  $xml_condition_list = $xml_conditions->condition;
37  }
38 
39  if($xml_conditions->query)
40  {
41  if(!is_array($xml_condition_list))
42  {
43  $xml_condition_list = array($xml_condition_list);
44  }
45  if(!is_array($xml_conditions->query))
46  {
47  $xml_conditions->query = array($xml_conditions->query);
48  }
49  $xml_condition_list = array_merge($xml_condition_list, $xml_conditions->query);
50  }
51  if($xml_condition_list)
52  {
53  $this->condition_groups[] = new ConditionGroupTag($xml_condition_list);
54  }
55 
56  $xml_groups = $xml_conditions->group;
57  if($xml_groups)
58  {
59  if(!is_array($xml_groups))
60  {
61  $xml_groups = array($xml_groups);
62  }
63  foreach($xml_groups as $group)
64  {
65  $this->condition_groups[] = new ConditionGroupTag($group->condition, $group->attrs->pipe);
66  }
67  }
68  }
69 
74  function toString()
75  {
76  $output_conditions = 'array(' . PHP_EOL;
77  foreach($this->condition_groups as $condition)
78  {
79  $output_conditions .= $condition->getConditionGroupString() . PHP_EOL . ',';
80  }
81  $output_conditions = substr($output_conditions, 0, -1);
82  $output_conditions .= ')';
83  return $output_conditions;
84  }
85 
86  function getArguments()
87  {
88  $arguments = array();
89  foreach($this->condition_groups as $condition)
90  {
91  $arguments = array_merge($arguments, $condition->getArguments());
92  }
93  return $arguments;
94  }
95 
96 }
97 /* End of file ConditionsTag.class.php */
98 /* Location: ./classes/xml/xmlquery/tags/condition/ConditionsTag.class.php */
__construct($xml_conditions)