PluginProbe ʕ •ᴥ•ʔ
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets / 2.13
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets v2.13
4.1.1 3.9.5 3.9.6 4.0.0 4.0.1 4.1.0 trunk 2.12 2.13 2.14 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.3-beta-1.0 3.7.4 3.7.4-beta-1.0 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4
wp-all-import / libraries / ast / XmlImportAstIf.php
wp-all-import / libraries / ast Last commit date
XmlImportAstElseif.php 14 years ago XmlImportAstExpression.php 14 years ago XmlImportAstFloat.php 14 years ago XmlImportAstForeach.php 14 years ago XmlImportAstFunction.php 14 years ago XmlImportAstIf.php 14 years ago XmlImportAstInteger.php 14 years ago XmlImportAstLiteral.php 14 years ago XmlImportAstMath.php 14 years ago XmlImportAstPrint.php 14 years ago XmlImportAstSequence.php 14 years ago XmlImportAstStatement.php 14 years ago XmlImportAstString.php 14 years ago XmlImportAstText.php 14 years ago XmlImportAstWith.php 14 years ago XmlImportAstXPath.php 14 years ago XmlImportAstXpathClause.php 14 years ago
XmlImportAstIf.php
162 lines
1 <?php
2 /**
3 * @author Olexandr Zanichkovsky <olexandr.zanichkovsky@zophiatech.com>
4 * @package AST
5 */
6
7 require_once dirname(__FILE__) . '/XmlImportAstStatement.php';
8 require_once dirname(__FILE__) . '/XmlImportAstElseif.php';
9
10 /**
11 * Represents an IF clause
12 */
13 class XmlImportAstIf extends XmlImportAstStatement
14 {
15 /**
16 * Condition
17 *
18 * @var XmlImportAstExpression
19 */
20 private $condition;
21
22 /**
23 * If body
24 *
25 * @var XmlImportAstSequence
26 */
27 private $ifBody;
28
29 /**
30 * List of elseif subclauses
31 *
32 * @var array
33 */
34 private $elseIfs = array();
35
36 /**
37 * Else body
38 *
39 * @var XmlImportAstSequence
40 */
41 private $elseBody;
42
43 /**
44 * Creates new instance
45 *
46 * @param XmlImportAstExpression $condition
47 */
48 public function __construct(XmlImportAstExpression $condition)
49 {
50 $this->condition = $condition;
51 }
52
53 /**
54 * Gets condition
55 *
56 * @return XmlImportAstExpression
57 */
58 public function getCondition()
59 {
60 return $this->condition;
61 }
62
63 /**
64 * Gets if body
65 *
66 * @return XmlImportAstSequence
67 */
68 public function getIfBody()
69 {
70 return $this->ifBody;
71 }
72
73 /**
74 * Adds If body
75 *
76 * @param XmlImportAstSequence $body
77 */
78 public function addIfBody(XmlImportAstSequence $body)
79 {
80 $this->ifBody = $body;
81 }
82
83 /**
84 * Gets list of elseif subcloses
85 *
86 * @return array
87 */
88 public function getElseIfs()
89 {
90 return $this->elseIfs;
91 }
92
93 /**
94 * Gets else body
95 *
96 * @return XmlImportAstSequence
97 */
98 public function getElseBody()
99 {
100 return $this->elseBody;
101 }
102
103 /**
104 * Adds else body
105 *
106 * @param XmlImportAstSequence $body
107 */
108 public function addElseBody(XmlImportAstSequence $body)
109 {
110 $this->elseBody = $body;
111 }
112
113 /**
114 * Adds elseif subclause
115 *
116 * @param XmlImportAstElseif $elseif
117 */
118 public function addElseif(XmlImportAstElseif $elseif)
119 {
120 $this->elseIfs[] = $elseif;
121 }
122
123 /**
124 * String represetation of an IF clause
125 *
126 * @return string
127 */
128 public function __toString()
129 {
130 $result = "--> begin " . get_class($this) . "\n";
131 $result .= ' Condition: ' . $this->condition . "\n";
132 $result .= " Body:\n";
133 $array = explode("\n", $this->ifBody);
134 for ($i = 0; $i < count($array); $i++)
135 {
136 $array[$i] = ' ' . $array[$i];
137 }
138 $result .= implode("\n", $array) . "\n";
139 foreach($this->elseIfs as $elseIf)
140 {
141 $array = explode("\n", $elseIf);
142 for ($i = 0; $i < count($array); $i++)
143 {
144 $array[$i] = '' . $array[$i];
145 }
146 $result .= implode("\n", $array) . "\n";
147 }
148 if (!is_null($this->elseBody))
149 {
150 $result .= " Else:\n";
151 $array = explode("\n", $this->elseBody);
152 for ($i = 0; $i < count($array); $i++)
153 {
154 $array[$i] = ' ' . $array[$i];
155 }
156 $result .= implode("\n", $array) . "\n";
157 }
158 $result .= "--> end " . get_class($this) . "\n";
159 return $result;
160 }
161 }
162