From 841f0061692944f40661b459e50b6a44fac345e6 Mon Sep 17 00:00:00 2001 From: Awilum Date: Tue, 18 Jun 2019 15:37:13 +0300 Subject: [PATCH] Flextype Core: Shortcodes - BaseUrlShortcode added. #154 --- flextype/shortcodes/BaseUrlShortcode.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 flextype/shortcodes/BaseUrlShortcode.php diff --git a/flextype/shortcodes/BaseUrlShortcode.php b/flextype/shortcodes/BaseUrlShortcode.php new file mode 100644 index 00000000..d3dcb99e --- /dev/null +++ b/flextype/shortcodes/BaseUrlShortcode.php @@ -0,0 +1,21 @@ + + * @link http://romanenko.digital + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Flextype; + +use Thunder\Shortcode\ShortcodeFacade; +use Thunder\Shortcode\Shortcode\ShortcodeInterface; + +// Shortcode: [base_url] +$flextype['shortcodes']->addHandler('base_url', function () { + return \Slim\Http\Uri::createFromEnvironment(new \Slim\Http\Environment($_SERVER))->getBaseUrl(); +});