PluginProbe ʕ •ᴥ•ʔ
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets / 4.1.1
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets v4.1.1
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 1 month ago XmlImportAstExpression.php 1 month ago XmlImportAstFloat.php 1 month ago XmlImportAstForeach.php 1 month ago XmlImportAstFunction.php 1 month ago XmlImportAstIf.php 1 month ago XmlImportAstInteger.php 1 month ago XmlImportAstLiteral.php 1 month ago XmlImportAstMath.php 1 month ago XmlImportAstPrint.php 1 month ago XmlImportAstSequence.php 1 month ago XmlImportAstSpintax.php 1 month ago XmlImportAstStatement.php 1 month ago XmlImportAstString.php 1 month ago XmlImportAstText.php 1 month ago XmlImportAstWith.php 1 month ago XmlImportAstXPath.php 1 month ago XmlImportAstXpathClause.php 1 month ago
XmlImportAstIf.php
163 lines
1 <?php
2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals
3 /**
4 * @author Olexandr Zanichkovsky <olexandr.zanichkovsky@zophiatech.com>
5 * @package AST
6 */
7
8 require_once dirname(__FILE__) . '/XmlImportAstStatement.php';
9 require_once dirname(__FILE__) . '/XmlImportAstElseif.php';
10
11 /**
12 * Represents an IF clause
13 */
14 class XmlImportAstIf extends XmlImportAstStatement
15 {
16 /**
17 * Condition
18 *
19 * @var XmlImportAstExpression
20 */
21 private $condition;
22
23 /**
24 * If body
25 *
26 * @var XmlImportAstSequence
27 */
28 private $ifBody;
29
30 /**
31 * List of elseif subclauses
32 *
33 * @var array
34 */
35 private $elseIfs = array();
36
37 /**
38 * Else body
39 *
40 * @var XmlImportAstSequence
41 */
42 private $elseBody;
43
44 /**
45 * Creates new instance
46 *
47 * @param XmlImportAstExpression $condition
48 */
49 public function __construct(XmlImportAstExpression $condition)
50 {
51 $this->condition = $condition;
52 }
53
54 /**
55 * Gets condition
56 *
57 * @return XmlImportAstExpression
58 */
59 public function getCondition()
60 {
61 return $this->condition;
62 }
63
64 /**
65 * Gets if body
66 *
67 * @return XmlImportAstSequence
68 */
69 public function getIfBody()
70 {
71 return $this->ifBody;
72 }
73
74 /**
75 * Adds If body
76 *
77 * @param XmlImportAstSequence $body
78 */
79 public function addIfBody(XmlImportAstSequence $body)
80 {
81 $this->ifBody = $body;
82 }
83
84 /**
85 * Gets list of elseif subcloses
86 *
87 * @return array
88 */
89 public function getElseIfs()
90 {
91 return $this->elseIfs;
92 }
93
94 /**
95 * Gets else body
96 *
97 * @return XmlImportAstSequence
98 */
99 public function getElseBody()
100 {
101 return $this->elseBody;
102 }
103
104 /**
105 * Adds else body
106 *
107 * @param XmlImportAstSequence $body
108 */
109 public function addElseBody(XmlImportAstSequence $body)
110 {
111 $this->elseBody = $body;
112 }
113
114 /**
115 * Adds elseif subclause
116 *
117 * @param XmlImportAstElseif $elseif
118 */
119 public function addElseif(XmlImportAstElseif $elseif)
120 {
121 $this->elseIfs[] = $elseif;
122 }
123
124 /**
125 * String represetation of an IF clause
126 *
127 * @return string
128 */
129 public function __toString()
130 {
131 $result = "--> begin " . get_class($this) . "\n";
132 $result .= ' Condition: ' . $this->condition . "\n";
133 $result .= " Body:\n";
134 $array = explode("\n", $this->ifBody);
135 for ($i = 0; $i < count($array); $i++)
136 {
137 $array[$i] = ' ' . $array[$i];
138 }
139 $result .= implode("\n", $array) . "\n";
140 foreach($this->elseIfs as $elseIf)
141 {
142 $array = explode("\n", $elseIf);
143 for ($i = 0; $i < count($array); $i++)
144 {
145 $array[$i] = '' . $array[$i];
146 }
147 $result .= implode("\n", $array) . "\n";
148 }
149 if (!is_null($this->elseBody))
150 {
151 $result .= " Else:\n";
152 $array = explode("\n", $this->elseBody);
153 for ($i = 0; $i < count($array); $i++)
154 {
155 $array[$i] = ' ' . $array[$i];
156 }
157 $result .= implode("\n", $array) . "\n";
158 }
159 $result .= "--> end " . get_class($this) . "\n";
160 return $result;
161 }
162 }
163