Skip to content

Commit 14c1f06

Browse files
committed
Merge branch 'release/4.1.1'
2 parents 6be4af9 + 8c0edf7 commit 14c1f06

31 files changed

+150
-81
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# v4.1.1
2+
## 04/23/2019
3+
4+
1. [](#improved)
5+
* Updated Core Thunderer Shortcode library to `0.7.2`
6+
17
# v4.1.0
28
## 04/14/2019
39

blueprints.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Shortcode Core
2-
version: 4.1.0
2+
version: 4.1.1
33
description: "This plugin provides the core functionality for shortcode plugins"
44
icon: code
55
author:

composer.lock

Lines changed: 8 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/composer/autoload_psr4.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@
66
$baseDir = dirname($vendorDir);
77

88
return array(
9-
'Thunder\\Shortcode\\Tests\\' => array($vendorDir . '/thunderer/shortcode/tests'),
109
'Thunder\\Shortcode\\' => array($vendorDir . '/thunderer/shortcode/src'),
1110
);

vendor/composer/autoload_static.php

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,11 @@ class ComposerStaticInitd0b6ad2d0f2308b1099bc12e8c596f66
99
public static $prefixLengthsPsr4 = array (
1010
'T' =>
1111
array (
12-
'Thunder\\Shortcode\\Tests\\' => 24,
1312
'Thunder\\Shortcode\\' => 18,
1413
),
1514
);
1615

1716
public static $prefixDirsPsr4 = array (
18-
'Thunder\\Shortcode\\Tests\\' =>
19-
array (
20-
0 => __DIR__ . '/..' . '/thunderer/shortcode/tests',
21-
),
2217
'Thunder\\Shortcode\\' =>
2318
array (
2419
0 => __DIR__ . '/..' . '/thunderer/shortcode/src',

vendor/composer/installed.json

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
[
22
{
33
"name": "thunderer/shortcode",
4-
"version": "v0.7.1",
5-
"version_normalized": "0.7.1.0",
4+
"version": "v0.7.2",
5+
"version_normalized": "0.7.2.0",
66
"source": {
77
"type": "git",
88
"url": "https://github.com/thunderer/Shortcode.git",
9-
"reference": "8f3a65f35de7f03e8c4a50e490c490888dc5b722"
9+
"reference": "d19ded97c7faf88d93bdfd93c7de358d57be9999"
1010
},
1111
"dist": {
1212
"type": "zip",
13-
"url": "https://api.github.com/repos/thunderer/Shortcode/zipball/8f3a65f35de7f03e8c4a50e490c490888dc5b722",
14-
"reference": "8f3a65f35de7f03e8c4a50e490c490888dc5b722",
13+
"url": "https://api.github.com/repos/thunderer/Shortcode/zipball/d19ded97c7faf88d93bdfd93c7de358d57be9999",
14+
"reference": "d19ded97c7faf88d93bdfd93c7de358d57be9999",
1515
"shasum": ""
1616
},
1717
"require": {
1818
"php": ">=5.3"
1919
},
2020
"require-dev": {
21-
"phpunit/phpunit": "^4.1|^5.0|^6.0",
22-
"symfony/yaml": "^2.0|^3.0"
21+
"phpunit/phpunit": ">=4.1",
22+
"symfony/yaml": ">=2.0"
2323
},
2424
"suggest": {
2525
"ext-dom": "if you want to use XML serializer",
2626
"ext-json": "if you want to use JSON serializer",
2727
"symfony/yaml": "if you want to use YAML serializer"
2828
},
29-
"time": "2019-02-03T22:50:59+00:00",
29+
"time": "2019-04-17T18:57:16+00:00",
3030
"type": "library",
3131
"installation-source": "dist",
3232
"autoload": {
3333
"psr-4": {
34-
"Thunder\\Shortcode\\": "src/",
35-
"Thunder\\Shortcode\\Tests\\": "tests/"
34+
"Thunder\\Shortcode\\": "src/"
3635
}
3736
},
3837
"notification-url": "https://packagist.org/downloads/",
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
rules:
2+
# RegularParser::parse() disables xdebug.max_nesting_level to avoid errors when XDebug is enabled
3+
php.dynamically_change_configuration:
4+
enabled: false

vendor/thunderer/shortcode/.travis.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
language: php
22

33
php:
4+
- 5.3
45
- 5.4
56
- 5.5
67
- 5.6
78
- 7.0
89
- 7.1
910
- 7.2
11+
- 7.3
1012
- hhvm
1113
- nightly
1214

@@ -24,4 +26,7 @@ after_script:
2426

2527
matrix:
2628
allow_failures:
29+
- php: 5.3
30+
- php: hhvm
2731
- php: nightly
32+
- php: hhvm

vendor/thunderer/shortcode/Makefile

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
PHP ?= 7.3
2+
3+
composer-update:
4+
docker-compose run --rm composer composer config platform.php ${PHP}
5+
docker-compose run --rm composer composer update
6+
docker-compose run --rm composer composer config --unset platform
7+
8+
test:
9+
docker-compose run --rm php-${PHP} php -v
10+
docker-compose run --rm php-${PHP} php /app/vendor/bin/phpunit -c /app/phpunit.xml.dist
11+
test-local:
12+
php -v
13+
php vendor/bin/phpunit

vendor/thunderer/shortcode/composer.json

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,22 @@
1313
"php": ">=5.3"
1414
},
1515
"require-dev": {
16-
"phpunit/phpunit": "^4.1|^5.0|^6.0",
17-
"symfony/yaml": "^2.0|^3.0"
18-
},
19-
"suggest": {
20-
"symfony/yaml": "if you want to use YAML serializer",
21-
"ext-dom": "if you want to use XML serializer",
22-
"ext-json": "if you want to use JSON serializer"
16+
"phpunit/phpunit": ">=4.1",
17+
"symfony/yaml": ">=2.0"
2318
},
2419
"autoload": {
2520
"psr-4": {
26-
"Thunder\\Shortcode\\": "src/",
21+
"Thunder\\Shortcode\\": "src/"
22+
}
23+
},
24+
"autoload-dev": {
25+
"psr-4": {
2726
"Thunder\\Shortcode\\Tests\\": "tests/"
2827
}
28+
},
29+
"suggest": {
30+
"symfony/yaml": "if you want to use YAML serializer",
31+
"ext-dom": "if you want to use XML serializer",
32+
"ext-json": "if you want to use JSON serializer"
2933
}
3034
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: '3'
2+
3+
services:
4+
5+
composer:
6+
image: 'composer:1.6'
7+
volumes: ['.:/app']
8+
9+
# PHP 5.3 contains neither mbstring extension nor docker-php-ext-install script
10+
# Original Dockerfile can be found here https://github.com/docker-library/php/pull/20/files
11+
# Unfortunately it fails to build now because GPG signatures do not exist anymore
12+
# php-5.3: { build: 'docker/php-5.3', volumes: ['.:/app'] }
13+
php-5.4: { build: 'docker/php-5.4', volumes: ['.:/app'] }
14+
php-5.5: { image: 'php:5.5', volumes: ['.:/app'] }
15+
php-5.6: { image: 'php:5.6', volumes: ['.:/app'] }
16+
php-7.0: { image: 'php:7.0', volumes: ['.:/app'] }
17+
php-7.1: { image: 'php:7.1', volumes: ['.:/app'] }
18+
php-7.2: { image: 'php:7.2', volumes: ['.:/app'] }
19+
php-7.3: { image: 'php:7.3', volumes: ['.:/app'] }
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM php:5.4
2+
3+
RUN docker-php-ext-install mbstring

vendor/thunderer/shortcode/phpunit.xml.dist

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
convertWarningsToExceptions = "true"
99
processIsolation = "false"
1010
stopOnFailure = "false"
11-
syntaxCheck = "false"
1211
bootstrap = "vendor/autoload.php"
1312
>
1413

@@ -19,8 +18,7 @@
1918
</testsuites>
2019

2120
<logging>
22-
<log type="coverage-html" target="coverage" charset="UTF-8"
23-
yui="true" highlight="false" lowUpperBound="50" highLowerBound="90"/>
21+
<log type="coverage-html" target="coverage" lowUpperBound="50" highLowerBound="90"/>
2422
<log type="coverage-clover" target="coverage.xml"/>
2523
</logging>
2624

vendor/thunderer/shortcode/src/Event/ReplaceShortcodesEvent.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ public function __construct($text, array $replacements, ShortcodeInterface $shor
2323
{
2424
$this->shortcode = $shortcode;
2525
$this->text = $text;
26-
$this->result = null;
2726

2827
$this->setReplacements($replacements);
2928
}

vendor/thunderer/shortcode/src/EventContainer/EventContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct()
1616

1717
public function addListener($event, $handler)
1818
{
19-
if(!in_array($event, Events::getEvents())) {
19+
if(!\in_array($event, Events::getEvents(), true)) {
2020
throw new \InvalidArgumentException(sprintf('Unsupported event %s!', $event));
2121
}
2222

vendor/thunderer/shortcode/src/EventHandler/FilterRawEventHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(array $names)
2525
public function __invoke(FilterShortcodesEvent $event)
2626
{
2727
$parent = $event->getParent();
28-
if($parent && in_array($parent->getName(), $this->names)) {
28+
if($parent && \in_array($parent->getName(), $this->names, true)) {
2929
$event->setShortcodes(array());
3030

3131
return;

vendor/thunderer/shortcode/src/HandlerContainer/HandlerContainer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function getNames()
6262

6363
public function get($name)
6464
{
65-
return $this->has($name) ? $this->handlers[$name] : ($this->default ?: null);
65+
return $this->has($name) ? $this->handlers[$name] : $this->default;
6666
}
6767

6868
public function has($name)

vendor/thunderer/shortcode/src/Parser/RegularParser.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,11 @@ public function parse($text)
5757
$names = array();
5858
$this->beginBacktrack();
5959
$matches = $this->shortcode($names);
60+
if(false === $matches) {
61+
$this->backtrack();
62+
$this->match(null, true);
63+
continue;
64+
}
6065
if(\is_array($matches)) {
6166
foreach($matches as $shortcode) {
6267
$shortcodes[] = $shortcode;
@@ -151,11 +156,13 @@ private function shortcode(array &$names)
151156
if(false === $content || $closingName !== $name) {
152157
$this->backtrack(false);
153158
$text = $this->backtrack(false);
159+
array_pop($names);
154160

155161
return array_merge(array($this->getObject($name, $parameters, $bbCode, $offset, null, $text)), $shortcodes);
156162
}
157163
$content = $this->getBacktrack();
158164
if(!$this->close($names)) { return false; }
165+
array_pop($names);
159166

160167
return array($this->getObject($name, $parameters, $bbCode, $offset, $content, $this->getBacktrack()));
161168
}

vendor/thunderer/shortcode/src/Parser/WordpressParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ private static function parseParameters($text)
9797
$parameters[strtolower($match[3])] = stripcslashes($match[4]);
9898
} elseif(!empty($match[5])) {
9999
$parameters[strtolower($match[5])] = stripcslashes($match[6]);
100-
} elseif(isset($match[7]) && strlen($match[7])) {
100+
} elseif(isset($match[7]) && $match[7] !== '') {
101101
$parameters[stripcslashes($match[7])] = null;
102102
} elseif(isset($match[8])) {
103103
$parameters[stripcslashes($match[8])] = null;

vendor/thunderer/shortcode/src/Processor/Processor.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ final class Processor implements ProcessorInterface
2323
/** @var EventContainerInterface */
2424
private $eventContainer;
2525

26-
private $recursionDepth = null; // infinite recursion
26+
/** @var int|null */
27+
private $recursionDepth; // infinite recursion
2728
private $maxIterations = 1; // one iteration
2829
private $autoProcessContent = true; // automatically process shortcode content
2930

@@ -144,7 +145,7 @@ private function processHandler(ParsedShortcodeInterface $parsed, ProcessorConte
144145
return mb_substr($state, 0, $offset, 'utf-8').$processed->getContent().mb_substr($state, $offset + $length, mb_strlen($state, 'utf-8'), 'utf-8');
145146
}
146147

147-
private function processRecursion(ParsedShortcodeInterface $shortcode, ProcessorContext $context)
148+
private function processRecursion(ProcessedShortcode $shortcode, ProcessorContext $context)
148149
{
149150
if ($this->autoProcessContent && null !== $shortcode->getContent()) {
150151
$context->recursionLevel++;

vendor/thunderer/shortcode/src/Processor/ProcessorContext.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@
99
final class ProcessorContext
1010
{
1111
/** @var ShortcodeInterface */
12-
public $shortcode = null;
12+
public $shortcode;
1313

1414
/** @var ShortcodeInterface */
15-
public $parent = null;
15+
public $parent;
1616

1717
/** @var ProcessorInterface */
18-
public $processor = null;
18+
public $processor;
1919

20-
public $textContent = null;
20+
public $textContent;
2121
public $position = 0;
2222
public $namePosition = array();
2323
public $text = '';
2424
public $shortcodeText = '';
2525
public $iterationNumber = 0;
2626
public $recursionLevel = 0;
27-
public $offset = null;
28-
public $baseOffset = null;
27+
public $offset;
28+
public $baseOffset;
2929
}

vendor/thunderer/shortcode/src/Serializer/TextSerializer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private function serializeValue($value)
5656
$delimiter = $this->syntax->getParameterValueDelimiter();
5757
$separator = $this->syntax->getParameterValueSeparator();
5858

59-
return $separator.(preg_match('/^\w+$/us', $value)
59+
return $separator.(preg_match('/^\w+$/u', $value)
6060
? $value
6161
: $delimiter.$value.$delimiter);
6262
}

vendor/thunderer/shortcode/src/Shortcode/Shortcode.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ final class Shortcode extends AbstractShortcode implements ShortcodeInterface
88
{
99
public function __construct($name, array $parameters, $content, $bbCode = null)
1010
{
11-
if(false === is_string($name) || (is_string($name) && !mb_strlen($name))) {
11+
if(false === is_string($name) || '' === $name) {
1212
throw new \InvalidArgumentException('Shortcode name must be a non-empty string!');
1313
}
1414

15-
$isStringOrNull = function($value) { return is_string($value) || is_null($value); };
15+
$isStringOrNull = function($value) { return is_string($value) || null === $value; };
1616
if(count(array_filter($parameters, $isStringOrNull)) !== count($parameters)) {
1717
throw new \InvalidArgumentException('Parameter values must be either string or empty (null)!');
1818
}

0 commit comments

Comments
 (0)