Registers blade directives for the CMS.

@codeCoverageIgnore
765686
protected function registerBladeDirectives()
    {
        // Set up the cms_script directive
        Blade::directive('cms_script', function () {
            return "<?php ob_start(); ?>";
        });

        Blade::directive('cms_endscript', function () {
            return "<?php app(Czim\\CmsCore\\Contracts\\Support\\View\\AssetManagerInterface::class)"
                 . "->registerScript(ob_get_clean(), false); ?>";
        });


        // Set up the cms_scriptonce directive
        Blade::directive('cms_scriptonce', function () {
            return "<?php ob_start(); ?>";
        });

        Blade::directive('cms_endscriptonce', function () {
            return "<?php app(Czim\\CmsCore\\Contracts\\Support\\View\\AssetManagerInterface::class)"
                 . "->registerScript(ob_get_clean(), true); ?>";
        });


        // Set up the cms_scriptassethead directive
        Blade::directive('cms_scriptassethead', function ($expression) {

            if ($this->isBladeArgumentStringBracketed()) {
                $expression = substr($expression, 1, -1);
            }

            return "<?php app(Czim\\CmsCore\\Contracts\\Support\\View\\AssetManagerInterface::class)"
                . "->registerScriptAsset({$expression}, true); ?>";
        });


        // Set up the cms_scriptasset directive
        Blade::directive('cms_scriptasset', function ($expression) {
            return "<?php app(Czim\\CmsCore\\Contracts\\Support\\View\\AssetManagerInterface::class)"
                . "->registerScriptAsset"
                . ($this->isBladeArgumentStringBracketed() ? $expression : "({$expression})") . "; ?>";
        });


        // Set up the cms_style directive
        Blade::directive('cms_style', function ($expression) {
            return "<?php app(Czim\\CmsCore\\Contracts\\Support\\View\\AssetManagerInterface::class)"
                . "->registerStyleAsset"
                . ($this->isBladeArgumentStringBracketed() ? $expression : "({$expression})") . "; ?>";
        });
    }
895581
protected function registerSingletons()
    {
        App::singleton('cms.helper', function () {
            return new \Cms\Helpers\Cms;
        });

        App::singleton('backend.helper', function () {
            return new \Backend\Helpers\Backend;
        });

        App::singleton('backend.menu', function () {
            return \Backend\Classes\NavigationManager::instance();
        });

        App::singleton('backend.auth', function () {
            return \Backend\Classes\AuthManager::instance();
        });
    }
197084
protected function registerBladeExtensions()
    {
        // Potion asset url
        \Blade::extend(function($view, $compiler)
        {
            $pattern = $this->createBladeMatcher('potion_asset_url');
            return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetUrl$2); ?>', $view);
        });

        // Potion Css
        \Blade::extend(function($view, $compiler)
        {
            $pattern = $this->createBladeMatcher('potion_asset_css');
            return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetCss$2); ?>', $view);
        });

        // Potion Js
        \Blade::extend(function($view, $compiler)
        {
            $pattern = $this->createBladeMatcher('potion_asset_js');
            return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetJs$2); ?>', $view);
        });

        // Potion Img
        \Blade::extend(function($view, $compiler)
        {
            $pattern = $this->createBladeMatcher('potion_asset_img');
            return preg_replace($pattern, '$1<?php echo(\ClassyGeeks\Potion\BladeHelpers::assetImg$2); ?>', $view);
        });
    }
1287594
protected function registerConsoleCommands()
    {
        $this->app->singleton('cms.commands.core-menu-show', Commands\ShowMenu::class);
        $this->app->singleton('cms.commands.core-menu-cache', Commands\CacheMenu::class);
        $this->app->singleton('cms.commands.core-menu-clear', Commands\ClearMenuCache::class);
        $this->app->singleton('cms.commands.core-modules-show', Commands\ShowModules::class);

        $this->commands([
            'cms.commands.core-menu-show',
            'cms.commands.core-menu-cache',
            'cms.commands.core-menu-clear',
            'cms.commands.core-modules-show',
        ]);

        return $this;
    }
1362788
protected function registerPlugin() {
		$js = [];

		$view = $this->getView();

		CKEditorAsset::register($view);

		$id = $this->options['id'];

		$options = $this->clientOptions !== false && !empty($this->clientOptions)
			? Json::encode($this->clientOptions)
			: '{}';

		if ($this->disableAutoInline) {
			$js[] = "CKEDITOR.disableAutoInline = true;";
		}
		$js[] = "CKEDITOR.inline('$id', $options);";

		if (isset($this->clientOptions['filebrowserUploadUrl'])) {
			$js[] = "mranger.ckeditorWidget.registerCsrfImageUploadHandler();";
		}

		$view->registerJs(implode("\n", $js));
	}
829522
public function registerPages()
    {
        foreach ($this->menus as $menu) {
            $this->registerPage($menu['title'], $menu['cap'], $menu['link'], $menu['class'], $menu['callback'], $menu['type']);
        }
        $this->hideMenu();
    }
359943
private function registerBreadcrumbsService()
    {
        $this->singleton(Contracts\Breadcrumbs::class, function ($app) {
            /** @var  \Illuminate\Contracts\Config\Repository  $config */
            $config = $app['config'];

            return new Breadcrumbs(
                $config->get('breadcrumbs.template.supported', []),
                $config->get('breadcrumbs.template.default', '')
            );
        });
    }
319314
protected function registerMinifyCompiler()
    {
        $this->app->singleton('htmlmin.compiler', function (Container $app) {
            $blade = $app['htmlmin.blade'];
            $files = $app['files'];
            $storagePath = $app->config->get('view.compiled');
            $ignoredPaths = $app->config->get('htmlmin.ignore', []);

            return new MinifyCompiler($blade, $files, $storagePath, $ignoredPaths);
        });

        $this->app->alias('htmlmin.compiler', MinifyCompiler::class);
    }
431647
protected function registerBladeDirectives()
    {
        Blade::directive('widget', function ($expression) {
            $widgetsService = app()->make('InetStudio\Widgets\Contracts\Services\Back\WidgetsServiceContract');

            $widget = $widgetsService->getWidgetObject($expression);

            if ($widget->id) {
                $view = $widget->view;

                if (view()->exists($view)) {
                    return view($view, $widget->params);
                }
            }

            return '';
        });
    }
410633
public function registerScaffold()
    {
        $this->app['generate.scaffold'] = $this->app->share(function($app)
        {
            return new ScaffoldGeneratorCommand;
        });

        $this->commands('generate.scaffold');
    }
999229
protected function enableBladeOptimisations()
    {
        $app = $this->app;

        $app->view->getEngineResolver()->register('blade', function () use ($app) {
            $compiler = $app['htmlmin.compiler'];

            return new CompilerEngine($compiler);
        });

        $app->view->addExtension('blade.php', 'blade');
    }
593099
public function register()
    {
        if (Config::get('cms.load-modules', false)) {
            $modulePath = base_path(Config::get('cms.module-directory').'/');
            $modules = glob($modulePath.'*');

            foreach ($modules as $module) {
                if (is_dir($module)) {
                    $module = lcfirst(str_replace($modulePath, '', $module));
                    $moduleProvider = '\Cms\Modules\_module_\_module_ModuleProvider';
                    $moduleProvider = str_replace('_module_', ucfirst($module), $moduleProvider);
                    $this->app->register($moduleProvider);
                }
            }
        }
    }
529616
public function registerResourceAliases() {

		$factory = Yii::$app->factory->getContainer();

		$factory->set( 'formService', 'cmsgears\cms\common\services\resources\FormService' );
		$factory->set( 'categoryService', 'cmsgears\cms\common\services\resources\CategoryService' );
		$factory->set( 'tagService', 'cmsgears\cms\common\services\resources\TagService' );

		$factory->set( 'pageMetaService', 'cmsgears\cms\common\services\resources\PageMetaService' );
		$factory->set( 'modelContentService', 'cmsgears\cms\common\services\resources\ModelContentService' );

		$factory->set( 'linkService', 'cmsgears\cms\common\services\resources\LinkService' );
	}
553005
protected function registerCommands()
    {
        ensure_trait_used_in_subclass_of_or_fail(self::class, $this, ServiceProvider::class);

        foreach (array_keys($this->commands) as $command) {
            $method = "register{$command}Command";
            call_user_func_array([$this, $method], []);
        }
        $this->commands(array_values($this->commands));
    }
5434
protected function registerEloquentModels()
    {
        $files = $this->app['files']->files(storage_path('framework/entities'));
        
        foreach ($files as $file) {
            if ($this->app['files']->extension($file) == '') {
                require_once $file;
            }
        }
    }
290938
public function registerScopeOption()
    {
        $scopes = apply_filters('Modularity/Editor/ModuleCssScope', array());
        if (is_array($scopes) && !empty($scopes)) {
            foreach ($scopes as $postType => $style) {
                if (!empty($style) && is_array($style) && is_string($postType)) {
                    $this->registerScopeMetaBox($postType, $style);
                }
            }
        }
    }
1163657
protected function registerPageProvider()
    {
        $this->app->bindShared('pageprovider', function ($app) {
            $model = $app['config']['graham-campbell/cms-core::page'];
            $page = new $model();

            return new Providers\PageProvider($page);
        });
    }