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(); +});