public function testUsingFacade() { Shortcode::register('foo', function () { return 'bar'; }); $this->assertEquals('foo', Shortcode::compile('foo')); }
/** * Bootstrap any application services. * * @return void */ public function boot() { setlocale(LC_ALL, 'ru_RU.UTF-8'); Carbon::setLocale(config('app.locale')); \Shortcode::register('slider', '\\App\\Shortcode\\Slider'); \Shortcode::register('section', '\\App\\Shortcode\\Section'); \Shortcode::register('iframe', '\\App\\Shortcode\\Iframe'); \Shortcode::register('timeline', '\\App\\Shortcode\\Timeline'); if (\DB::getDoctrineSchemaManager()->tablesExist('options')) { Option::observe(new OptionObserver()); if (Option::has('vk-user-token')) { Vk::setAccessToken(Option::get('vk-user-token')); } } }
/** * Initiate shortcode. */ public function init() { $name = get_class($this); $sc = str_replace('shortcode', '', strtolower($name)); Shortcode::register($sc, array(&$this, 'render')); }