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 / XmlImportAstSequence.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
XmlImportAstSequence.php
162 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
10 /**
11 * Represents statement sequence
12 */
13 class XmlImportAstSequence extends XmlImportAstStatement
14 {
15
16 /**
17 * Sequence instance number
18 *
19 * @var int
20 */
21 private static $sequenceInstanceNumber = 0;
22
23 /**
24 * Current sequence number
25 *
26 * @var int
27 */
28 private $sequenceNumber;
29
30 /**
31 * Current variable number
32 *
33 * @var int
34 */
35 private $varNumber = 0;
36
37 /**
38 * List of statements
39 *
40 * @var array
41 */
42 private $statements = array();
43
44 /**
45 * Variable definitions
46 *
47 * @var array
48 */
49 private $variableDefinitions = array();
50
51 /**
52 * Variables
53 *
54 * @var array
55 */
56 private $variables = array();
57
58 /**
59 * Creates new instance
60 */
61 public function __construct()
62 {
63 $this->sequenceNumber = self::$sequenceInstanceNumber++;
64 }
65
66 /**
67 * Adds statement to a sequence
68 *
69 * @param XmlImportAstStatement $statement
70 */
71 public function addStatement(XmlImportAstStatement $statement)
72 {
73 $this->statements[] = $statement;
74 }
75
76 /**
77 * Gets the list of statements
78 *
79 * @return array
80 */
81 public function getStatements()
82 {
83 return $this->statements;
84 }
85
86 /**
87 * Adds variable to a sequence
88 *
89 * @param XmlImportAstXPath $xpath
90 */
91 public function addVariable(XmlImportAstXPath $xpath)
92 {
93 if (!array_key_exists($xpath->getValue(), $this->variables))
94 {
95 $var = '$v' . $this->sequenceNumber . '_' . $this->varNumber++;
96 $value = $escapedValue = strtr($xpath->getValue(), array(
97 "\n" => "\\n",
98 "\t" => "\\t",
99 "\r" => "\\r",
100 "$" => "\\$",
101 "\"" => "\\\"",
102 "\\" => "\\\\",
103 ));
104 $result = $var . ' = {{XML}}->xpath("' . $value . '");';
105 $this->variables[$xpath->getValue()] = $var;
106 $this->variableDefinitions[] = $result;
107 }
108 }
109
110 /**
111 * Gets variable definitions
112 *
113 * @return array
114 */
115 public function getVariableDefinitions()
116 {
117 return $this->variableDefinitions;
118 }
119
120 /**
121 * Gets variables
122 *
123 * @return array
124 */
125 public function getVariables()
126 {
127 return $this->variables;
128 }
129
130 /**
131 * Returns the number of current instance
132 *
133 * @return int
134 */
135 public function getSequenceNumber()
136 {
137 return $this->sequenceNumber;
138 }
139
140 /**
141 * String representation of a sequence node
142 *
143 * @return string
144 */
145 public function __toString()
146 {
147 $result = "--> begin " . get_class($this) . "\n";
148 foreach ($this->getStatements() as $statement)
149 {
150 $array = explode("\n", $statement);
151 for ($i = 0; $i < count($array); $i++)
152 {
153 $array[$i] = ' ' . $array[$i];
154 }
155 $result .= implode("\n", $array) . "\n";
156 }
157
158 $result .= "--> end " . get_class($this);
159
160 return $result;
161 }
162 }