![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/demo.cartinsight.co/Corals/core/Foundation/Shortcodes/ |
<?php namespace Corals\Foundation\Shortcodes; use Illuminate\Support\ServiceProvider; class ShortcodesServiceProvider extends ServiceProvider { protected $defer = false; /** * Boot the application events. */ public function boot() { \Blade::directive('widget', function ($expression) { $segments = explode(',', preg_replace("/[\(\)\\\]/", '', $expression)); if (!array_key_exists(1, $segments)) { return '<?php echo (new \Corals\Foundation\Shortcodes\Service\Widget)->get(' . $segments[0] . '); ?>'; } return '<?php echo (new \Corals\Foundation\Shortcodes\Service\Widget)->get(' . $segments[0] . ',' . $segments[1] . '); ?>'; }); } /** * Register the service provider. */ public function register() { $this->registerShortcode(); } /** * Register the Shortcode */ public function registerShortcode() { $this->app->singleton('shortcode', function ($app) { return new Shortcode(); }); } /** * Get the services provided by the provider. * * @return array */ public function provides() { return array( 'shortcode', ); } }