Last active
January 26, 2018 13:52
-
-
Save thunderer/862b87b0cd26916387510ab81f2c418b to your computer and use it in GitHub Desktop.
Shortcode Issue #56 and #57
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vendor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ "require": { "thunderer/shortcode": "^0.6" } } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"_readme": [ | |
"This file locks the dependencies of your project to a known state", | |
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", | |
"This file is @generated automatically" | |
], | |
"content-hash": "664cb89ee55a1e677c5222dd71f71586", | |
"packages": [ | |
{ | |
"name": "thunderer/shortcode", | |
"version": "v0.6.5", | |
"source": { | |
"type": "git", | |
"url": "https://github.com/thunderer/Shortcode.git", | |
"reference": "997418e71f997de98a73a41cf102b3310372ac64" | |
}, | |
"dist": { | |
"type": "zip", | |
"url": "https://api.github.com/repos/thunderer/Shortcode/zipball/997418e71f997de98a73a41cf102b3310372ac64", | |
"reference": "997418e71f997de98a73a41cf102b3310372ac64", | |
"shasum": "" | |
}, | |
"require": { | |
"php": ">=5.3" | |
}, | |
"require-dev": { | |
"phpunit/phpunit": "^4.1|^5.0" | |
}, | |
"suggest": { | |
"ext-dom": "if you want to use XML serializer", | |
"ext-json": "if you want to use JSON serializer", | |
"symfony/yaml": "if you want to use YAML serializer" | |
}, | |
"type": "library", | |
"autoload": { | |
"psr-4": { | |
"Thunder\\Shortcode\\": "src/", | |
"Thunder\\Shortcode\\Tests\\": "tests/" | |
} | |
}, | |
"notification-url": "https://packagist.org/downloads/", | |
"license": [ | |
"MIT" | |
], | |
"authors": [ | |
{ | |
"name": "Tomasz Kowalczyk", | |
"email": "tomasz@kowalczyk.cc" | |
} | |
], | |
"description": "Advanced shortcode (BBCode) parser and engine for PHP", | |
"keywords": [ | |
"bbcode", | |
"engine", | |
"library", | |
"parser", | |
"shortcode" | |
], | |
"time": "2017-01-08T00:22:37+00:00" | |
} | |
], | |
"packages-dev": [], | |
"aliases": [], | |
"minimum-stability": "stable", | |
"stability-flags": [], | |
"prefer-stable": false, | |
"prefer-lowest": false, | |
"platform": { | |
"php": "^7.1" | |
}, | |
"platform-dev": [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'vendor/autoload.php'; | |
use Thunder\Shortcode\ShortcodeFacade; | |
use Thunder\Shortcode\Shortcode\ShortcodeInterface; | |
$facade = new ShortcodeFacade(); | |
$facade->addHandler('hello', function(ShortcodeInterface $s) { | |
return sprintf('Hello, %s!', $s->getParameter('name')); | |
}); | |
$text = ' | |
<div class="users"> | |
[hello name="Thomas"] | |
[hello name="Peter"] | |
</div> | |
'; | |
echo $facade->process($text); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include 'vendor/autoload.php'; | |
use Thunder\Shortcode\ShortcodeFacade; | |
use Thunder\Shortcode\Shortcode\ShortcodeInterface; | |
$facade = new ShortcodeFacade(); | |
$facade->addHandler('hello', function(ShortcodeInterface $s) { | |
return sprintf('Hello, %s!' . $s->getContent(), $s->getParameter('name')); | |
}); | |
$text = ' | |
<p>Start</p> | |
[hello name="Thomas"] | |
[hello name="Peter"] | |
[/hello] | |
<p>End</p> | |
'; | |
echo $facade->process($text); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment