@@ -148,24 +148,21 @@ discard block |
||
| 148 | 148 | { |
| 149 | 149 | //Manage the modifiers |
| 150 | 150 | $new_string_split[count($new_string_split) - 1] .= $str_split_unicode[$i]; //Apppend the modifier to the previous char |
| 151 | - } |
|
| 152 | - else |
|
| 151 | + } else |
|
| 153 | 152 | { |
| 154 | 153 | if ($codepoint == "200d") |
| 155 | 154 | { |
| 156 | 155 | //Manage the Zero Width Joiner |
| 157 | 156 | $new_string_split[count($new_string_split) - 1] .= $str_split_unicode[$i]; //Apppend the ZWJ to the previous char |
| 158 | 157 | $joiner = true; |
| 159 | - } |
|
| 160 | - else |
|
| 158 | + } else |
|
| 161 | 159 | { |
| 162 | 160 | if ($joiner) |
| 163 | 161 | { |
| 164 | 162 | //If previous one was a ZWJ |
| 165 | 163 | $new_string_split[count($new_string_split) - 1] .= $str_split_unicode[$i]; //Apppend to the previous char |
| 166 | 164 | $joiner = false; |
| 167 | - } |
|
| 168 | - else |
|
| 165 | + } else |
|
| 169 | 166 | { |
| 170 | 167 | $new_string_split[] = $str_split_unicode[$i]; //New char |
| 171 | 168 | } |
@@ -194,38 +191,31 @@ discard block |
||
| 194 | 191 | if ($char == $this->getEntityStartString($entity)) |
| 195 | 192 | { |
| 196 | 193 | return $char."\\".$char.$char; |
| 197 | - } |
|
| 198 | - else |
|
| 194 | + } else |
|
| 199 | 195 | { |
| 200 | 196 | return $char; |
| 201 | 197 | } |
| 202 | - } |
|
| 203 | - else |
|
| 198 | + } else |
|
| 204 | 199 | { |
| 205 | 200 | return $char; |
| 206 | 201 | } |
| 207 | - } |
|
| 208 | - else |
|
| 202 | + } else |
|
| 209 | 203 | { |
| 210 | 204 | if ($char == '*' || $char == '_' || $char == '[' || $char == '`') |
| 211 | 205 | { |
| 212 | 206 | return "\\".$char; |
| 213 | - } |
|
| 214 | - else |
|
| 207 | + } else |
|
| 215 | 208 | { |
| 216 | 209 | return $char; |
| 217 | 210 | } |
| 218 | 211 | } |
| 219 | - } |
|
| 220 | - else if ($this->style == 'HTML') |
|
| 212 | + } else if ($this->style == 'HTML') |
|
| 221 | 213 | { |
| 222 | 214 | return ($char == '<' ? '<' : ($char == '>' ? '>' : ($char == '&' ? '&' : $char))); |
| 223 | - } |
|
| 224 | - else if ($this->style == 'MarkdownV2') |
|
| 215 | + } else if ($this->style == 'MarkdownV2') |
|
| 225 | 216 | { |
| 226 | 217 | return (in_array($char, array('_', '*', '[', ']', '(', ')', '~', '`', '>', '#', '+', '-', '=', '|', '{', '}', '.', '!', '\\')) ? '\\'.$char : $char); |
| 227 | - } |
|
| 228 | - else |
|
| 218 | + } else |
|
| 229 | 219 | { |
| 230 | 220 | return $char; |
| 231 | 221 | } |
@@ -272,8 +262,7 @@ discard block |
||
| 272 | 262 | break; |
| 273 | 263 | } |
| 274 | 264 | } |
| 275 | - } |
|
| 276 | - else if ($this->style == 'HTML') |
|
| 265 | + } else if ($this->style == 'HTML') |
|
| 277 | 266 | { |
| 278 | 267 | switch ($entity->type) |
| 279 | 268 | { |
@@ -327,8 +316,7 @@ discard block |
||
| 327 | 316 | break; |
| 328 | 317 | } |
| 329 | 318 | } |
| 330 | - } |
|
| 331 | - else if ($this->style == 'MarkdownV2') |
|
| 319 | + } else if ($this->style == 'MarkdownV2') |
|
| 332 | 320 | { |
| 333 | 321 | switch ($entity->type) |
| 334 | 322 | { |
@@ -378,8 +366,7 @@ discard block |
||
| 378 | 366 | break; |
| 379 | 367 | } |
| 380 | 368 | } |
| 381 | - } |
|
| 382 | - else |
|
| 369 | + } else |
|
| 383 | 370 | { |
| 384 | 371 | throw new Exception("Wrong style name"); |
| 385 | 372 | } |
@@ -402,10 +389,11 @@ discard block |
||
| 402 | 389 | } |
| 403 | 390 | } |
| 404 | 391 | } |
| 405 | - if (count($entities) > 0) |
|
| 406 | - return $entities; |
|
| 407 | - else |
|
| 408 | - return false; |
|
| 392 | + if (count($entities) > 0) { |
|
| 393 | + return $entities; |
|
| 394 | + } else { |
|
| 395 | + return false; |
|
| 396 | + } |
|
| 409 | 397 | } |
| 410 | 398 | |
| 411 | 399 | /** |
@@ -449,8 +437,7 @@ discard block |
||
| 449 | 437 | break; |
| 450 | 438 | } |
| 451 | 439 | } |
| 452 | - } |
|
| 453 | - else if ($this->style == 'HTML') |
|
| 440 | + } else if ($this->style == 'HTML') |
|
| 454 | 441 | { |
| 455 | 442 | switch ($entity->type) |
| 456 | 443 | { |
@@ -500,8 +487,7 @@ discard block |
||
| 500 | 487 | break; |
| 501 | 488 | } |
| 502 | 489 | } |
| 503 | - } |
|
| 504 | - else if ($this->style == 'MarkdownV2') |
|
| 490 | + } else if ($this->style == 'MarkdownV2') |
|
| 505 | 491 | { |
| 506 | 492 | switch ($entity->type) |
| 507 | 493 | { |
@@ -551,8 +537,7 @@ discard block |
||
| 551 | 537 | break; |
| 552 | 538 | } |
| 553 | 539 | } |
| 554 | - } |
|
| 555 | - else |
|
| 540 | + } else |
|
| 556 | 541 | { |
| 557 | 542 | throw new Exception("Wrong style name"); |
| 558 | 543 | } |
@@ -575,10 +560,11 @@ discard block |
||
| 575 | 560 | } |
| 576 | 561 | } |
| 577 | 562 | } |
| 578 | - if (count($entities) > 0) |
|
| 579 | - return array_reverse($entities); |
|
| 580 | - else |
|
| 581 | - return false; |
|
| 563 | + if (count($entities) > 0) { |
|
| 564 | + return array_reverse($entities); |
|
| 565 | + } else { |
|
| 566 | + return false; |
|
| 567 | + } |
|
| 582 | 568 | } |
| 583 | 569 | |
| 584 | 570 | /** |