Bootstrap PHP Mig
551157
public function bootstrap()
    {
        $this->app->bind('phpmig.adapter', function() {
            return new Adapter\Illuminate\Database($this->app['Sun\Contracts\Database\Database']->getCapsuleInstance(), 'migrations');
        });

        $this->app->bind('phpmig.migrations_path', function() {
            return $this->app->migrations_path();
        });

        $this->app->bind('phpmig.migrations_template_path', function() {
            return __DIR__ . '/../Console/stubs/MigrateGenerate.txt';
        });

        $this->app->bind('schema', function() {
            return $this->app['Sun\Contracts\Database\Database']->getCapsuleInstance()->schema();
        });
    }
265036
public function bootstrap()
    {

        // register the default autoloader
        require SERVER_AUTOLOADER;

        // synchronize the application instance and register the class loaders
        $application = $this->application;
        $application->registerClassLoaders();

        // register the applications annotation registries
        $application->registerAnnotationRegistries();

        // add the application instance to the environment
        Environment::singleton()->setAttribute(EnvironmentKeys::APPLICATION, $application);

        // create s simulated request/session ID whereas session equals request ID
        Environment::singleton()->setAttribute(EnvironmentKeys::SESSION_ID, $sessionId = SessionUtils::generateRandomString());
        Environment::singleton()->setAttribute(EnvironmentKeys::REQUEST_ID, $sessionId);

        // try to load the profile logger
        if ($this->profileLogger = $application->getInitialContext()->getLogger(\AppserverIo\Logger\LoggerUtils::PROFILE)) {
            $this->profileLogger->appendThreadContext(sprintf('queue-worker-%s', $this->priorityKey));
        }
    }
444773
public function bootstrap($app)
    {
        if (!$app instanceof \yii\web\Application) {
            return;
        }

        $app->on(Application::EVENT_BEFORE_ACTION, function (ActionEvent $event) use ($app) {
            if ($app->user->getIsGuest()) {
                return;
            }

            if ($app->request->getIsAjax()) {
                return;
            }

            $action = $event->action->getUniqueId();
            if (
                strpos($action, 'client/') === 0
                || strpos($action, 'monitoring/') === 0
                || strpos($action, 'site/logout') === 0
            ) {
                return;
            }

            $session = $app->session;
            if ($session->get('contact.gdpr.accepted')) {
                return;
            }

            $contact = Contact::findOne(['id' => $app->user->getId()]);
            if ($contact->gdpr_consent && $contact->policy_consent) {
                $app->session->set('contact.gdpr.accepted', true);

                return;
            }

            $app->response->redirect(Url::to(['@contact/update', 'id' => $app->user->getId()]));
            Yii::$app->end();
        });
    }
1110926
public function bootstrap()
    {
        $path = JPATH_LIBRARIES.'/joomlatools/library/koowa.php';
        if (file_exists($path))
        {
            /**
             * Koowa Bootstrapping
             *
             * If KOOWA is defined assume it was already loaded and bootstrapped
             */
            if (!defined('KOOWA'))
            {
                require_once $path;

                $application = JFactory::getApplication()->getName();

                /**
                 * Find Composer Vendor Directory
                 */
                $vendor_path = false;
                if(file_exists(JPATH_ROOT.'/composer.json'))
                {
                    $content  = file_get_contents(JPATH_ROOT.'/composer.json');
                    $composer = json_decode($content);

                    if(isset($composer->config->vendor_dir)) {
                        $vendor_path = JPATH_ROOT.'/'.$composer->config->vendor_dir;
                    } else {
                        $vendor_path = JPATH_ROOT.'/vendor';
                    }
                }

                /**
                 * Framework Bootstrapping
                 */
                Koowa::getInstance(array(
                    'debug'           => JDEBUG,
                    'cache'           => false, //JFactory::getApplication()->getCfg('caching')
                    'cache_namespace' => 'koowa-' . $application . '-' . md5(JFactory::getApplication()->getCfg('secret')),
                    'root_path'       => JPATH_ROOT,
                    'base_path'       => JPATH_BASE,
                    'vendor_path'     => $vendor_path
                ));

                /**
                 * Component Bootstrapping
                 */
                $bootstrapper = KObjectManager::getInstance()->getObject('object.bootstrapper')
                    ->registerComponents(JPATH_LIBRARIES . '/joomlatools/component', 'koowa')
                    ->registerApplication('site', JPATH_SITE . '/components', JFactory::getApplication()->isSite())
                    ->registerApplication('admin', JPATH_ADMINISTRATOR . '/components', JFactory::getApplication()->isAdmin());

                if (is_dir(JPATH_LIBRARIES . '/joomlatools-components')) {
                    $bootstrapper->registerComponents(JPATH_LIBRARIES . '/joomlatools-components', 'koowa');
                }

                $bootstrapper->bootstrap();
            }

            $manager = KObjectManager::getInstance();
            $loader  = $manager->getClassLoader();

            //Module Locator
            $loader->registerLocator(new ComKoowaClassLocatorModule(array(
                'namespaces' => array(
                    '\\'     => JPATH_BASE.'/modules',
                    'Koowa'  => JPATH_LIBRARIES.'/joomlatools/module',
                )
            )));

            /**
             * Module Bootstrapping
             */
            $manager->registerLocator('com:koowa.object.locator.module');

            /**
             * Plugin Bootstrapping
             */
            $loader->registerLocator(new ComKoowaClassLocatorPlugin(array(
                'namespaces' => array(
                    '\\'     => JPATH_PLUGINS,
                    'Koowa'  => JPATH_LIBRARIES.'/joomlatools/plugin',
                )
            )));

            $manager->registerLocator('com:koowa.object.locator.plugin');

            /**
             * Context Boostrapping
             */
            $request = $manager->getObject('request');

            // Get the URL from Joomla if live_site is set
            if (JFactory::getApplication()->getCfg('live_site'))
            {
                $request->setBasePath(rtrim(JURI::base(true), '/\\'));
                $request->setBaseUrl($manager->getObject('lib:http.url', array('url' => rtrim(JURI::base(), '/\\'))));
            }

            //Exception Handling
            if (PHP_SAPI !== 'cli') {
                $manager->getObject('event.publisher')->addListener('onException', array($this, 'onException'), KEvent::PRIORITY_LOW);
            }

            /**
             * Plugin Bootstrapping
             */
            JPluginHelper::importPlugin('koowa', null, true);

            // Load and bootstrap custom vendor directory if it exists
            $custom_vendor = dirname(dirname($path)).'/vendor';
            if (is_dir($custom_vendor) && file_exists($custom_vendor.'/autoload.php')) {
                require_once $custom_vendor.'/autoload.php';
            }

            return true;
        }

        return false;
    }
651999
public function boot()
	{
		include __DIR__.'/../../routes.php';

		// include __DIR__.'/../../helpers.php';

		$this->loadViewsFrom(__DIR__.'/../../views', 'decima-file');

		$this->loadTranslationsFrom(__DIR__.'/../../lang', 'decima-file');

		$this->publishes([
				__DIR__ . '/../../config/config.php' => config_path('file-general.php'),
		], 'config');

		$this->mergeConfigFrom(
				__DIR__ . '/../../config/config.php', 'file-general'
		);

		$this->publishes([
				__DIR__ . '/../../config/extensions.php' => config_path('file-extensions.php'),
		], 'config');

		$this->mergeConfigFrom(
				__DIR__ . '/../../config/extensions.php', 'file-extensions'
		);

		$this->publishes([
				__DIR__ . '/../../config/journal.php' => config_path('file-journal.php'),
		], 'config');

		$this->mergeConfigFrom(
				__DIR__ . '/../../config/journal.php', 'file-journal'
		);

		$this->publishes([
   				__DIR__.'/../../migrations/' => database_path('/migrations')
		], 'migrations');

		$this->registerJournalConfiguration();

		$this->registrerSecurityFileInterface();

		$this->registrerFileInterface();

		$this->registerFileManagementInterface();
	}
323104
public function boot()
    {
        parent::boot();

        // add scripts and styles to be used globally.
        $this->codex()->theme
            ->addStylesheet('codex.phpdoc', asset('/vendor/codex/styles/codex.phpdoc.document.css'), [ 'codex' ])
            ->addJavascript('codex.phpdoc', asset('/vendor/codex/js/codex.phpdoc.js'), [ 'codex.page.document', 'codex' ])
            ->addJavascript('codex.page.phpdoc', asset('/vendor/codex/js/codex.page.phpdoc.js'), [ 'codex.phpdoc' ]);


        // 1. Ensure both the Codex plugin and CodexPhpdoc plugin are loaded for documents. This enables all phpdoc components for use in documents.
        // 2. Then make it so that the original init script (and its depends) run AFTER loading the plugins, by adding it as a dependency
        $this->hook('controller:document', function ($controller, Document $document) {
            if ( false === $document->getProject()->config('phpdoc.enabled', false) ) {
                return;
            }
            $this->codex()->theme
                ->set('phpdoc.url', $document->getProject()->url($document->getProject()->config('phpdoc.document_slug'), $document->getRef()->getName()));
        });

        // If the current document is the PHPDoc document viewer, add the required assets and add the proper init script
        $this->hook('controller:document', function ($controller, Document $document) {
            if (
                $document->getPathName() !== $document->getProject()->config('phpdoc.document_slug')
                || false === $document->getProject()->config('phpdoc.enabled', false)
            ) {
                return;
            }
            $this->codex()->theme
                ->addJavascript('jstree', asset('/vendor/codex/vendor/jstree/jstree.js'), [ 'jquery' ])
                ->addStylesheet('codex.page.phpdoc', asset('/vendor/codex/styles/codex.page.phpdoc.css'), [ 'codex' ]);
        });
    }
642983
public function boot()
    {
        $this->publishes([
            __DIR__.'/../config/columnsortable.php' => config_path('columnsortable.php'),
        ], 'config');

        Blade::directive('sortablelink', function ($expression) {
            $expression = ($expression[0] === '(') ? substr($expression, 1, -1) : $expression;

            return "<?php echo \Kyslik\ColumnSortable\SortableLink::render(array ({$expression}));?>";
        });

        request()->macro('allFilled', function (array $keys) {
            foreach ($keys as $key) {
                if ( ! $this->filled($key)) {
                    return false;
                }
            }

            return true;
        });
    }
168212
public function bootstrap(): void
    {
        // Show all errors and warnings in development, fewer in production.
        error_reporting(self::ERROR_REPORTING);

        set_error_handler($this->phpErrorHandler());
        set_exception_handler($this->phpExceptionHandler());
    }
805790
private function bootstrap()
    {
        if (Configuration::read('bootstrap.enable') === true) {
            $applicationNamespace = Configuration::read('application.namespace');
            $bootstrapNamespace = $applicationNamespace . '\Bootstrap';
            if (!class_exists($bootstrapNamespace)) {
                throw new \Exception('Bootstrap "' . $bootstrapNamespace . '" doesn\' exist.');
                return false;
            }
            $bootstrap = new $bootstrapNamespace();
            if (!method_exists($bootstrap, 'initialize')) {
                $errorMessage = 'initialize() method isn\'t available in Bootstrap "' . $bootstrapNamespace . '".<br />';
                $errorMessage .= 'Your bootstrap may not extends \Pabana\Core\Bootstrap.';
                throw new \Exception($errorMessage);
                return false;
            }
            $bootstrap->initialize();
            return true;
        }
        return false;
    }
782422
protected function registerBootstrap()
    {
        $directory = $this->getBootstrapPath();

        if (! is_dir($directory)) {
            return;
        }

        $files = Finder::create()
            ->files()
            ->name('/^.+\.php$/')
            ->notName('routes.php')
            ->notName('navigation.php')
            ->in($directory)
            ->sort(function (SplFileInfo $a) {
                return $a->getFilename() != 'bootstrap.php';
            });

        foreach ($files as $file) {
            require_once $file;
        }
    }
1006482
public function boot()
    {
        Relation::morphMap([
            'articles' => \BBCMS\Models\Article::class,
            'categories' => \BBCMS\Models\Category::class,
            'comments' => \BBCMS\Models\Comment::class,
            'files' => \BBCMS\Models\File::class,
            'images' => \BBCMS\Models\Image::class,
            'notes' => \BBCMS\Models\Note::class,
            'tags' => \BBCMS\Models\Tag::class,
            'users' => \BBCMS\Models\User::class,
        ], true);

        Blade::if('setting', function (string $environment) {
            return setting($environment);
        });

        Blade::if('role', function (string $environment) {
            return $environment == user('role');
        });

        Blade::directive('captcha', function ($expression) {
            return "<?php echo get_captcha($expression); ?>";
        });

        Blade::directive('widget', function ($expression) {
            return "<?php echo app('widget')->make($expression); ?>";
        });
    }
1156044
public function bootstrap()
    {

        // Start the rudimental system
        try {

            // Load settingsfile
            $this->loadSettings();

            // From here starts output buffering
            ob_start();

            // Registe PSR classloader
            $this->registerClassloader();

            // Create core DI container instance and map the instance to comntainer
            $this->di = \Core\DI\DI::getInstance();
            $this->di->mapValue('core.di', $this->di);

            $this->initLogger();

            // Run inits
            $this->initDatabase();
            $this->initMessageHandler();
            $this->initDependencies();
            $this->initHttp();
            $this->initSession();
            $this->initConfig();
            $this->initMailer();
            $this->initRouter();

            // Get an instance of Core app
            $this->getAppInstance('Core');

            $this->initSecurity();
            $this->initPage();
            $this->initAssetManager();

            // Run highlevel system
            $this->autodiscoverApps();

            // Match request against the generic routes to get the ajax request flag and to match a fallback result.
            $this->router->match();

            // Initiate apps
            $this->initApps();

            // Match routes again as now possible app routes are available
            $this->router->match();

            // Run dispatcher
            $result = $this->dispatch();

            // Send mails
            $this->mailer->send();

            // Process all assets
            $this->processAssets();

            // Send cookies
            $this->http->cookies->send();

            // Redirect requested?
            if (!empty($_SESSION['Core']['redirect'])) {

                $this->http->header->location($_SESSION['Core']['redirect']['location'], $_SESSION['Core']['redirect']['permanent']);
                $this->http->header->send();

                // Important: Clear redirect from session!
                unset($_SESSION['Core']['redirect']);

                return;
            }

            switch ($this->router->getFormat()) {

                case 'file':
                    $sendfile = new Sendfile($result);
                    $sendfile->send();

                    break;

                case 'html':

                    $this->http->header->contentType('text/html', 'utf-8');

                    $language = $this->getAppInstance('Core')->language;

                    // Add logoff button for logged in users
                    if ($this->user->isGuest()) {
                        $this->page->menu->createItem('register', $language->get('menu.register'), $this->router->generate('core.register'));
                        $this->page->menu->createItem('login', $language->get('menu.login'), $this->router->generate('core.login', [
                            'action' => 'login'
                        ]));
                    }

                    // or add login and register buttons. But not when current user is currently on banlist
                    else {

                        $usermenu = $this->page->menu->createItem('login', $this->user->getDisplayname());

                        // Show admin menu?
                        if ($this->user->getAdmin()) {
                            $usermenu->createItem('admin', $language->get('menu.admin'), $this->router->generate('core.admin'));
                        }

                        $usermenu->createItem('logout', $language->get('menu.logout'), $this->router->generate('core.login', [
                            'action' => 'logout'
                        ]));
                    }

                    $this->page->setHome($this->config->get('Core', 'url.home'));
                    $this->page->setContent($result);

                    $result = $this->page->render();
            }

            // Send headers so far
            $this->http->header->send();
        }
        catch (\Throwable $t) {

            $error = new ErrorHandler($t);
            $error->setAjax(isset($_REQUEST['ajax']));
            $error->setPublic(isset($this->user) && $this->user->getAdmin());
            $error->setPublic(true);

            if (isset($this->logger)) {
                $error->setLogger($this->logger);
            }

            http_response_code(500);

            $result = $error->handle();
        }

        echo $result;

        ob_end_flush();
    }
1250629
protected function bootstrap()
    {
        parent::bootstrap();

        $this->viewPath = __DIR__ . '/views';

        if (!isset($this->i18n->translations['colibri'])) {
            $this->i18n->translations['colibri'] = [
                'class' => 'yii\i18n\PhpMessageSource',
                'basePath' => __DIR__ . '/messages'
            ];
        }

        // Look in @app/messages directory for all categories
        if (!isset($this->i18n->translations['*'])) {
            $this->i18n->translations['*'] = [
                'class' => 'yii\i18n\PhpMessageSource',
                'basePath' => '@app/messages'
            ];
        }

        if (!file_exists($this->basePath . '/.env')) {
            // Remove query part
            $url = preg_replace('/\?.*$/', '', $this->getRequest()->url);

            if ($url != '/install') {
                $this->getResponse()->redirect(['/install']);
            }

            /* Now the route is install.
             *
             * Set the minimal layout to avoid potential db queries in the main layout
             */
            $this->layout = 'minimal';
        }
    }
738837
public function boot()
	{
		$translator = $this->app['language'];

		$language = null;

		// If a language was specified it has priority
		if (!$language && $this->app->has('request') && $this->app->isSite())
		{
			$lang = $this->app['request']->getString('language', null);

			if ($lang && $translator->exists($lang))
			{
				$language = $lang;
			}
		}

		// Detect user specified language
		if (!$language && $this->app->has('user'))
		{
			$lang = \User::getParam($this->app['client']->alias . '_language');

			if ($lang && $translator->exists($lang))
			{
				$language = $lang;
			}
		}

		// Detect browser language
		if (!$language && $this->app->has('browser') && $this->app->isSite())
		{
			$lang = $translator->detectLanguage();

			if ($lang && $translator->exists($lang))
			{
				$language = $lang;
			}
		}

		// Detect default language
		if (!$language && $this->app->has('component'))
		{
			$params = $this->app['component']->params('com_languages');

			$language = $params->get(
				$this->app['client']->name,
				$this->app['config']->get('language', 'en-GB')
			);
		}

		// One last check to make sure we have something
		if (!$language || !$translator->exists($language))
		{
			$lang = $this->app['config']->get('language', 'en-GB');

			if ($translator->exists($lang))
			{
				$language = $lang;
			}
		}

		if ($language)
		{
			$translator->setLanguage($language);
		}

		$boot = DS . 'bootstrap' . DS . ucfirst($this->app['client']->name);

		$translator->load('lib_joomla', PATH_APP . $boot, null, false, true) ||
		$translator->load('lib_joomla', PATH_CORE . $boot, null, false, true);
	}
41433
public function boot()
    {
        $templatePath = config('generators.template_path', base_path('resources/pingpong/generators/stubs'));

        $this->publishes([
            __DIR__ . '/Stubs/' => $templatePath
        ], 'stubs');

        $configPath = config_path('generators.php');
       
        $this->publishes([
            __DIR__.'/config.php' => $configPath,
        ], 'config');

        if (file_exists($configPath)) {
            $this->mergeConfigFrom($configPath, 'generators');
        }
    }
638459
public function bootstrap()
    {
        $providers = Zilf::$container->getShare('config')->get('services');

        foreach ($providers as $provider) {
            $instance = $this->createProvider($provider);
            $instance->register();
        }
    }
1017915
public static function bootstrap()
    {
        on('install',        'Pyrite\Users::install');
        on('user_fromemail', 'Pyrite\Users::fromEmail');
        on('user_resolve',   'Pyrite\Users::resolve');
        on('authenticate',   'Pyrite\Users::login');
        on('user_update',    'Pyrite\Users::update');
        on('user_create',    'Pyrite\Users::create');
        on('user_search',    'Pyrite\Users::search');
        on('ban_user',       'Pyrite\Users::ban');
        on('unban_user',     'Pyrite\Users::unban');
        on('clean_userids',  'Pyrite\Users::cleanList');
        on('all_users',      'Pyrite\Users::listAll');
    }