wp-studio 1.7.10 → 1.7.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/dist/cli/{_events-BcapW3eh.mjs → _events-B8xQ_baD.mjs} +4 -5
  2. package/dist/cli/appdata-D-luHxJU.mjs +19 -0
  3. package/dist/cli/{certificate-manager-SVYcCL_i.mjs → certificate-manager-v-yNLDFJ.mjs} +134 -15
  4. package/dist/cli/{delete-D1924O3o.mjs → delete-BG-E-HsW.mjs} +3 -3
  5. package/dist/cli/{helpers-oQuItT8n.mjs → helpers-CIAgfdq8.mjs} +2 -2
  6. package/dist/cli/{index-4lan3TI_.mjs → index-Bej4fL6n.mjs} +31 -4
  7. package/dist/cli/{index-BjzOJKPi.mjs → index-Dhun0W1n.mjs} +90 -52
  8. package/dist/cli/{index-DRQnCQvM.mjs → index-ul3DeWvy.mjs} +1308 -1109
  9. package/dist/cli/{list-DOFyyV1f.mjs → list-ck0oK4vb.mjs} +3 -3
  10. package/dist/cli/{login-BtPZeZ4G.mjs → login-Dz63Zdfn.mjs} +3 -3
  11. package/dist/cli/{logout-Cr631QzG.mjs → logout-CLUKQeZh.mjs} +2 -3
  12. package/dist/cli/main.mjs +2 -2
  13. package/dist/cli/{paths-CqXGLB7R.mjs → paths-D7DniT1Q.mjs} +7 -6
  14. package/dist/cli/plugin/skills/rank-me-up/SKILL.md +166 -0
  15. package/dist/cli/plugin/skills/site-spec/SKILL.md +4 -0
  16. package/dist/cli/process-manager-daemon.mjs +29 -5
  17. package/dist/cli/{process-manager-ipc-BisO0qtU.mjs → process-manager-ipc-GCdebuBH.mjs} +4 -1
  18. package/dist/cli/proxy-daemon.mjs +1 -1
  19. package/dist/cli/{prune-pm-logs-COryxqeo.mjs → prune-pm-logs-Dm_Bwi7l.mjs} +1 -1
  20. package/dist/cli/{resume-BwDwdJtq.mjs → resume-BSIOJnyM.mjs} +4 -15
  21. package/dist/cli/{rewrite-wp-cli-post-content-2zlfFnKT.mjs → rewrite-wp-cli-post-content-Beo5_Ojo.mjs} +32 -531
  22. package/dist/cli/{set-D5eeqHbp.mjs → set-CtDZnARG.mjs} +2 -3
  23. package/dist/cli/{set-DYnzUz_G.mjs → set-PJvs-Yw5.mjs} +4 -5
  24. package/dist/cli/{status-DNvMZBqD.mjs → status-DU07aAtD.mjs} +2 -2
  25. package/dist/cli/well-known-paths-QcSJNi_l.mjs +95 -0
  26. package/dist/cli/wordpress-server-child.mjs +5 -3
  27. package/dist/cli/{wp-DD2-QiiP.mjs → wp-_X-h-yuW.mjs} +2 -2
  28. package/dist/cli/wp-files/latest/available-site-translations.json +1 -1
  29. package/dist/cli/wp-files/sqlite-database-integration/admin-page.php +1 -2
  30. package/dist/cli/wp-files/sqlite-database-integration/constants.php +0 -5
  31. package/dist/cli/wp-files/sqlite-database-integration/load.php +1 -1
  32. package/dist/cli/wp-files/sqlite-database-integration/readme.txt +6 -3
  33. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/database/sqlite/class-wp-pdo-mysql-on-sqlite.php +22 -3
  34. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/database/version.php +1 -1
  35. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-db.php +41 -89
  36. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/db.php +2 -24
  37. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/install-functions.php +7 -16
  38. package/package.json +2 -1
  39. package/dist/cli/well-known-paths-BYA1Bw5o.mjs +0 -214
  40. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-lexer.php +0 -2575
  41. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-pdo-user-defined-functions.php +0 -899
  42. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-query-rewriter.php +0 -343
  43. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-token.php +0 -327
  44. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/class-wp-sqlite-translator.php +0 -4543
  45. package/dist/cli/wp-files/sqlite-database-integration/wp-includes/sqlite/php-polyfills.php +0 -68
@@ -1,343 +0,0 @@
1
- <?php
2
- /**
3
- * Class WP_SQLite_Query_Rewriter
4
- *
5
- * @package wp-sqlite-integration
6
- */
7
-
8
- /**
9
- * The query rewriter class.
10
- */
11
- class WP_SQLite_Query_Rewriter {
12
-
13
- /**
14
- * An array of input token objects.
15
- *
16
- * @var WP_SQLite_Token[]
17
- */
18
- public $input_tokens = array();
19
-
20
- /**
21
- * An array of output token objects.
22
- *
23
- * @var WP_SQLite_Token[]
24
- */
25
- public $output_tokens = array();
26
-
27
- /**
28
- * The current index.
29
- *
30
- * @var int
31
- */
32
- public $index = -1;
33
-
34
- /**
35
- * The maximum index.
36
- *
37
- * @var int
38
- */
39
- public $max = -1;
40
-
41
- /**
42
- * The call stack.
43
- *
44
- * @var array
45
- */
46
- public $call_stack = array();
47
-
48
- /**
49
- * The current depth.
50
- *
51
- * @var int
52
- */
53
- public $depth = 0;
54
-
55
- /**
56
- * The current token.
57
- *
58
- * @var WP_SQLite_Token
59
- */
60
- private $token;
61
-
62
- /**
63
- * The last function call.
64
- *
65
- * @var WP_SQLite_Token
66
- */
67
- private $last_function_call;
68
-
69
- /**
70
- * Constructor.
71
- *
72
- * @param WP_SQLite_Token[] $input_tokens Array of token objects.
73
- */
74
- public function __construct( $input_tokens ) {
75
- $this->input_tokens = $input_tokens;
76
- $this->max = count( $input_tokens );
77
- }
78
-
79
- /**
80
- * Returns the updated query.
81
- *
82
- * @return string
83
- */
84
- public function get_updated_query() {
85
- $query = '';
86
- foreach ( $this->output_tokens as $token ) {
87
- $query .= $token->token;
88
- }
89
- return $query;
90
- }
91
-
92
- /**
93
- * Add a token to the output.
94
- *
95
- * @param WP_SQLite_Token $token Token object.
96
- */
97
- public function add( $token ) {
98
- if ( $token ) {
99
- $this->output_tokens[] = $token;
100
- }
101
- }
102
-
103
- /**
104
- * Add multiple tokens to the output.
105
- *
106
- * @param WP_SQLite_Token[] $tokens Array of token objects.
107
- */
108
- public function add_many( $tokens ) {
109
- $this->output_tokens = array_merge( $this->output_tokens, $tokens );
110
- }
111
-
112
- /**
113
- * Replaces all tokens.
114
- *
115
- * @param WP_SQLite_Token[] $tokens Array of token objects.
116
- */
117
- public function replace_all( $tokens ) {
118
- $this->output_tokens = $tokens;
119
- }
120
-
121
- /**
122
- * Peek at the next tokens and return one that matches the given criteria.
123
- *
124
- * @param array $query Optional. Search query.
125
- * [
126
- * 'type' => string|null, // Token type.
127
- * 'flags' => int|null, // Token flags.
128
- * 'values' => string|null, // Token values.
129
- * ].
130
- *
131
- * @return WP_SQLite_Token
132
- */
133
- public function peek( $query = array() ) {
134
- $type = isset( $query['type'] ) ? $query['type'] : null;
135
- $flags = isset( $query['flags'] ) ? $query['flags'] : null;
136
- $values = isset( $query['value'] )
137
- ? ( is_array( $query['value'] ) ? $query['value'] : array( $query['value'] ) )
138
- : null;
139
-
140
- $i = $this->index;
141
- while ( ++$i < $this->max ) {
142
- if ( $this->input_tokens[ $i ]->matches( $type, $flags, $values ) ) {
143
- return $this->input_tokens[ $i ];
144
- }
145
- }
146
- }
147
-
148
- /**
149
- * Move forward and return the next tokens that match the given criteria.
150
- *
151
- * @param int $nth The nth token to return.
152
- *
153
- * @return WP_SQLite_Token
154
- */
155
- public function peek_nth( $nth ) {
156
- $found = 0;
157
- for ( $i = $this->index + 1;$i < $this->max;$i++ ) {
158
- $token = $this->input_tokens[ $i ];
159
- if ( ! $token->is_semantically_void() ) {
160
- ++$found;
161
- }
162
- if ( $found === $nth ) {
163
- return $this->input_tokens[ $i ];
164
- }
165
- }
166
- }
167
-
168
- /**
169
- * Consume all the tokens.
170
- *
171
- * @param array $query Search query.
172
- *
173
- * @return void
174
- */
175
- public function consume_all( $query = array() ) {
176
- while ( $this->consume( $query ) ) {
177
- // Do nothing.
178
- }
179
- }
180
-
181
- /**
182
- * Consume the next tokens and return one that matches the given criteria.
183
- *
184
- * @param array $query Search query.
185
- * [
186
- * 'type' => null, // Optional. Token type.
187
- * 'flags' => null, // Optional. Token flags.
188
- * 'values' => null, // Optional. Token values.
189
- * ].
190
- *
191
- * @return WP_SQLite_Token|null
192
- */
193
- public function consume( $query = array() ) {
194
- $tokens = $this->move_forward( $query );
195
- $this->output_tokens = array_merge( $this->output_tokens, $tokens );
196
- return $this->token;
197
- }
198
-
199
- /**
200
- * Drop the last consumed token and return it.
201
- *
202
- * @return WP_SQLite_Token|null
203
- */
204
- public function drop_last() {
205
- return array_pop( $this->output_tokens );
206
- }
207
-
208
- /**
209
- * Skip over the next tokens and return one that matches the given criteria.
210
- *
211
- * @param array $query Search query.
212
- * [
213
- * 'type' => null, // Optional. Token type.
214
- * 'flags' => null, // Optional. Token flags.
215
- * 'values' => null, // Optional. Token values.
216
- * ].
217
- *
218
- * @return WP_SQLite_Token|null
219
- */
220
- public function skip( $query = array() ) {
221
- $this->skip_and_return_all( $query );
222
- return $this->token;
223
- }
224
-
225
- /**
226
- * Skip over the next tokens until one matches the given criteria,
227
- * and return all the skipped tokens.
228
- *
229
- * @param array $query Search query.
230
- * [
231
- * 'type' => null, // Optional. Token type.
232
- * 'flags' => null, // Optional. Token flags.
233
- * 'values' => null, // Optional. Token values.
234
- * ].
235
- *
236
- * @return WP_SQLite_Token[]
237
- */
238
- public function skip_and_return_all( $query = array() ) {
239
- $tokens = $this->move_forward( $query );
240
-
241
- /*
242
- * When skipping over whitespaces, make sure to consume
243
- * at least one to avoid SQL syntax errors.
244
- */
245
- foreach ( $tokens as $token ) {
246
- if ( $token->matches( WP_SQLite_Token::TYPE_WHITESPACE ) ) {
247
- $this->add( $token );
248
- break;
249
- }
250
- }
251
-
252
- return $tokens;
253
- }
254
-
255
- /**
256
- * Returns the next tokens that match the given criteria.
257
- *
258
- * @param array $query Search query.
259
- * [
260
- * 'type' => string|null, // Optional. Token type.
261
- * 'flags' => int|null, // Optional. Token flags.
262
- * 'values' => string|null, // Optional. Token values.
263
- * ].
264
- *
265
- * @return array
266
- */
267
- private function move_forward( $query = array() ) {
268
- $type = isset( $query['type'] ) ? $query['type'] : null;
269
- $flags = isset( $query['flags'] ) ? $query['flags'] : null;
270
- $values = isset( $query['value'] )
271
- ? ( is_array( $query['value'] ) ? $query['value'] : array( $query['value'] ) )
272
- : null;
273
- $depth = isset( $query['depth'] ) ? $query['depth'] : null;
274
-
275
- $buffered = array();
276
- while ( true ) {
277
- if ( ++$this->index >= $this->max ) {
278
- $this->token = null;
279
- $this->call_stack = array();
280
- break;
281
- }
282
- $this->token = $this->input_tokens[ $this->index ];
283
- $this->update_call_stack();
284
- $buffered[] = $this->token;
285
- if (
286
- ( null === $depth || $this->depth === $depth )
287
- && $this->token->matches( $type, $flags, $values )
288
- ) {
289
- break;
290
- }
291
- }
292
-
293
- return $buffered;
294
- }
295
-
296
- /**
297
- * Returns the last call stack element.
298
- *
299
- * @return array|null
300
- */
301
- public function last_call_stack_element() {
302
- return count( $this->call_stack ) ? $this->call_stack[ count( $this->call_stack ) - 1 ] : null;
303
- }
304
-
305
- /**
306
- * Updates the call stack.
307
- *
308
- * @return void
309
- */
310
- private function update_call_stack() {
311
- if ( $this->token->flags & WP_SQLite_Token::FLAG_KEYWORD_FUNCTION ) {
312
- $this->last_function_call = $this->token->value;
313
- }
314
- if ( WP_SQLite_Token::TYPE_OPERATOR === $this->token->type ) {
315
- switch ( $this->token->value ) {
316
- case '(':
317
- if ( $this->last_function_call ) {
318
- array_push(
319
- $this->call_stack,
320
- array(
321
- 'function' => $this->last_function_call,
322
- 'depth' => $this->depth,
323
- )
324
- );
325
- $this->last_function_call = null;
326
- }
327
- ++$this->depth;
328
- break;
329
-
330
- case ')':
331
- --$this->depth;
332
- $call_parent = $this->last_call_stack_element();
333
- if (
334
- $call_parent &&
335
- $call_parent['depth'] === $this->depth
336
- ) {
337
- array_pop( $this->call_stack );
338
- }
339
- break;
340
- }
341
- }
342
- }
343
- }
@@ -1,327 +0,0 @@
1
- <?php
2
- /**
3
- * This file is a port of the Token class from the PHPMyAdmin/sql-parser library.
4
- *
5
- * @package wp-sqlite-integration
6
- * @see https://github.com/phpmyadmin/sql-parser
7
- */
8
-
9
- /**
10
- * Defines a token along with a set of types and flags and utility functions.
11
- *
12
- * An array of tokens will result after parsing the query.
13
- *
14
- * A structure representing a lexeme that explicitly indicates its categorization for the purpose of parsing.
15
- */
16
- class WP_SQLite_Token {
17
-
18
- /**
19
- * This type is used when the token is invalid or its type cannot be
20
- * determined because of the ambiguous context. Further analysis might be
21
- * required to detect its type.
22
- */
23
- const TYPE_NONE = 0;
24
-
25
- /**
26
- * SQL specific keywords: SELECT, UPDATE, INSERT, etc.
27
- */
28
- const TYPE_KEYWORD = 1;
29
-
30
- /**
31
- * Any type of legal operator.
32
- *
33
- * Arithmetic operators: +, -, *, /, etc.
34
- * Logical operators: ===, <>, !==, etc.
35
- * Bitwise operators: &, |, ^, etc.
36
- * Assignment operators: =, +=, -=, etc.
37
- * SQL specific operators: . (e.g. .. WHERE database.table ..),
38
- * * (e.g. SELECT * FROM ..)
39
- */
40
- const TYPE_OPERATOR = 2;
41
-
42
- /**
43
- * Spaces, tabs, new lines, etc.
44
- */
45
- const TYPE_WHITESPACE = 3;
46
-
47
- /**
48
- * Any type of legal comment.
49
- *
50
- * Bash (#), C (/* *\/) or SQL (--) comments:
51
- *
52
- * -- SQL-comment
53
- *
54
- * #Bash-like comment
55
- *
56
- * /*C-like comment*\/
57
- *
58
- * or:
59
- *
60
- * /*C-like
61
- * comment*\/
62
- *
63
- * Backslashes were added to respect PHP's comments syntax.
64
- */
65
- const TYPE_COMMENT = 4;
66
-
67
- /**
68
- * Boolean values: true or false.
69
- */
70
- const TYPE_BOOL = 5;
71
-
72
- /**
73
- * Numbers: 4, 0x8, 15.16, 23e42, etc.
74
- */
75
- const TYPE_NUMBER = 6;
76
-
77
- /**
78
- * Literal strings: 'string', "test".
79
- * Some of these strings are actually symbols.
80
- */
81
- const TYPE_STRING = 7;
82
-
83
- /**
84
- * Database, table names, variables, etc.
85
- * For example: ```SELECT `foo`, `bar` FROM `database`.`table`;```.
86
- */
87
- const TYPE_SYMBOL = 8;
88
-
89
- /**
90
- * Delimits an unknown string.
91
- * For example: ```SELECT * FROM test;```, `test` is a delimiter.
92
- */
93
- const TYPE_DELIMITER = 9;
94
-
95
- /**
96
- * Labels in LOOP statement, ITERATE statement etc.
97
- * For example (only for begin label):
98
- * begin_label: BEGIN [statement_list] END [end_label]
99
- * begin_label: LOOP [statement_list] END LOOP [end_label]
100
- * begin_label: REPEAT [statement_list] ... END REPEAT [end_label]
101
- * begin_label: WHILE ... DO [statement_list] END WHILE [end_label].
102
- */
103
- const TYPE_LABEL = 10;
104
-
105
- // Flags that describe the tokens in more detail.
106
- // All keywords must have flag 1 so `Context::isKeyword` method doesn't
107
- // require strict comparison.
108
- const FLAG_KEYWORD_RESERVED = 2;
109
- const FLAG_KEYWORD_COMPOSED = 4;
110
- const FLAG_KEYWORD_DATA_TYPE = 8;
111
- const FLAG_KEYWORD_KEY = 16;
112
- const FLAG_KEYWORD_FUNCTION = 32;
113
-
114
- // Numbers related flags.
115
- const FLAG_NUMBER_HEX = 1;
116
- const FLAG_NUMBER_FLOAT = 2;
117
- const FLAG_NUMBER_APPROXIMATE = 4;
118
- const FLAG_NUMBER_NEGATIVE = 8;
119
- const FLAG_NUMBER_BINARY = 16;
120
-
121
- // Strings related flags.
122
- const FLAG_STRING_SINGLE_QUOTES = 1;
123
- const FLAG_STRING_DOUBLE_QUOTES = 2;
124
-
125
- // Comments related flags.
126
- const FLAG_COMMENT_BASH = 1;
127
- const FLAG_COMMENT_C = 2;
128
- const FLAG_COMMENT_SQL = 4;
129
- const FLAG_COMMENT_MYSQL_CMD = 8;
130
-
131
- // Operators related flags.
132
- const FLAG_OPERATOR_ARITHMETIC = 1;
133
- const FLAG_OPERATOR_LOGICAL = 2;
134
- const FLAG_OPERATOR_BITWISE = 4;
135
- const FLAG_OPERATOR_ASSIGNMENT = 8;
136
- const FLAG_OPERATOR_SQL = 16;
137
-
138
- // Symbols related flags.
139
- const FLAG_SYMBOL_VARIABLE = 1;
140
- const FLAG_SYMBOL_BACKTICK = 2;
141
- const FLAG_SYMBOL_USER = 4;
142
- const FLAG_SYMBOL_SYSTEM = 8;
143
- const FLAG_SYMBOL_PARAMETER = 16;
144
-
145
- /**
146
- * The token it its raw string representation.
147
- *
148
- * @var string
149
- */
150
- public $token;
151
-
152
- /**
153
- * The value this token contains (i.e. token after some evaluation).
154
- *
155
- * @var mixed
156
- */
157
- public $value;
158
-
159
- /**
160
- * The keyword value this token contains, always uppercase.
161
- *
162
- * @var mixed|string|null
163
- */
164
- public $keyword = null;
165
-
166
- /**
167
- * The type of this token.
168
- *
169
- * @var int
170
- */
171
- public $type;
172
-
173
- /**
174
- * The flags of this token.
175
- *
176
- * @var int
177
- */
178
- public $flags;
179
-
180
- /**
181
- * The position in the initial string where this token started.
182
- *
183
- * The position is counted in chars, not bytes, so you should
184
- * use mb_* functions to properly handle utf-8 multibyte chars.
185
- *
186
- * @var int|null
187
- */
188
- public $position;
189
-
190
- /**
191
- * Constructor.
192
- *
193
- * @param string $token The value of the token.
194
- * @param int $type The type of the token.
195
- * @param int $flags The flags of the token.
196
- */
197
- public function __construct( $token, $type = 0, $flags = 0 ) {
198
- $this->token = $token;
199
- $this->type = $type;
200
- $this->flags = $flags;
201
- $this->value = $this->extract();
202
- }
203
-
204
- /**
205
- * Check if the token matches the given parameters.
206
- *
207
- * @param int|null $type The type of the token.
208
- * @param int|null $flags The flags of the token.
209
- * @param array|null $values The values of the token.
210
- *
211
- * @return bool
212
- */
213
- public function matches( $type = null, $flags = null, $values = null ) {
214
- if ( null === $type && null === $flags && ( null === $values || array() === $values ) ) {
215
- return ! $this->is_semantically_void();
216
- }
217
-
218
- return (
219
- ( null === $type || $this->type === $type )
220
- && ( null === $flags || ( $this->flags & $flags ) )
221
- && ( null === $values || in_array( strtoupper( $this->value ?? '' ), $values, true ) )
222
- );
223
- }
224
-
225
- /**
226
- * Check if the token is semantically void (i.e. whitespace or comment).
227
- *
228
- * @return bool
229
- */
230
- public function is_semantically_void() {
231
- return $this->matches( self::TYPE_WHITESPACE ) || $this->matches( self::TYPE_COMMENT );
232
- }
233
-
234
- /**
235
- * Does little processing to the token to extract a value.
236
- *
237
- * If no processing can be done it will return the initial string.
238
- *
239
- * @return mixed
240
- */
241
- private function extract() {
242
- switch ( $this->type ) {
243
- case self::TYPE_KEYWORD:
244
- $this->keyword = strtoupper( $this->token ?? '' );
245
- if ( ! ( $this->flags & self::FLAG_KEYWORD_RESERVED ) ) {
246
- /*
247
- * Unreserved keywords should stay the way they are
248
- * because they might represent field names.
249
- */
250
- return $this->token;
251
- }
252
-
253
- return $this->keyword;
254
-
255
- case self::TYPE_WHITESPACE:
256
- return ' ';
257
-
258
- case self::TYPE_BOOL:
259
- return strtoupper( $this->token ?? '' ) === 'TRUE';
260
-
261
- case self::TYPE_NUMBER:
262
- $ret = str_replace( '--', '', $this->token ); // e.g. ---42 === -42.
263
- if ( $this->flags & self::FLAG_NUMBER_HEX ) {
264
- $ret = str_replace( array( '-', '+' ), '', $this->token );
265
- if ( $this->flags & self::FLAG_NUMBER_NEGATIVE ) {
266
- $ret = -hexdec( $ret );
267
- } else {
268
- $ret = hexdec( $ret );
269
- }
270
- } elseif ( ( $this->flags & self::FLAG_NUMBER_APPROXIMATE ) || ( $this->flags & self::FLAG_NUMBER_FLOAT ) ) {
271
- $ret = (float) $ret;
272
- } elseif ( ! ( $this->flags & self::FLAG_NUMBER_BINARY ) ) {
273
- $ret = (int) $ret;
274
- }
275
-
276
- return $ret;
277
-
278
- case self::TYPE_STRING:
279
- // Trims quotes.
280
- $str = $this->token;
281
- $str = mb_substr( $str, 1, -1, 'UTF-8' );
282
-
283
- // Removes surrounding quotes.
284
- $quote = $this->token[0];
285
- $str = str_replace( $quote . $quote, $quote, $str );
286
-
287
- /*
288
- * Finally unescapes the string.
289
- *
290
- * `stripcslashes` replaces escape sequences with their
291
- * representation.
292
- */
293
- $str = stripcslashes( $str );
294
-
295
- return $str;
296
-
297
- case self::TYPE_SYMBOL:
298
- $str = $this->token;
299
- if ( isset( $str[0] ) && ( '@' === $str[0] ) ) {
300
- /*
301
- * `mb_strlen($str)` must be used instead of `null` because
302
- * in PHP 5.3- the `null` parameter isn't handled correctly.
303
- */
304
- $str = mb_substr(
305
- $str,
306
- ! empty( $str[1] ) && ( '@' === $str[1] ) ? 2 : 1,
307
- mb_strlen( $str ),
308
- 'UTF-8'
309
- );
310
- }
311
-
312
- if ( isset( $str[0] ) && ( ':' === $str[0] ) ) {
313
- $str = mb_substr( $str, 1, mb_strlen( $str ), 'UTF-8' );
314
- }
315
-
316
- if ( isset( $str[0] ) && ( ( '`' === $str[0] ) || ( '"' === $str[0] ) || ( '\'' === $str[0] ) ) ) {
317
- $quote = $str[0];
318
- $str = str_replace( $quote . $quote, $quote, $str );
319
- $str = mb_substr( $str, 1, -1, 'UTF-8' );
320
- }
321
-
322
- return $str;
323
- }
324
-
325
- return $this->token;
326
- }
327
- }