Register Antispam to Nette Forms
@return void
187745
public static function register()
	{
		Form::extensionMethod('addAntispam', function(Form $form, $name = 'spam', $label = 'Toto pole vymažte', $msg = 'Bol odhalený pokus o zaslanie spamu.')
		{
			// "All filled" protection
			$form[$name] = new AntispamControl($label, NULL, NULL, $msg);

			// "Send delay" protection
			$form->addHidden('form_created', strtr(time(), '0123456789', 'jihgfedcba'))
				->addRule(
					function($item)
				{
					if (AntispamControl::$minDelay <= 0)
						return TRUE;  // turn off "Send delay protection"

					$value = (int) strtr($item->value, 'jihgfedcba', '0123456789');
					return $value <= (time() - AntispamControl::$minDelay);
				}, $msg
			);

			return $form;
		});
	}
30927
private function registerNtrust()
    {
        $this->app->bind('ntrust', function ($app) {
            return new Ntrust($app);
        });
        
        $this->app->alias('ntrust', 'Klaravel\Ntrust');
    }
914230
public function register()
    {
        // Register the HtmlServiceProvider
        App::register('Illuminate\Html\HtmlServiceProvider');

        // Add aliases to Form/Html Facade
        $loader = AliasLoader::getInstance();
        $loader->alias('Form', 'Illuminate\Html\FormFacade');
        $loader->alias('HTML', 'Illuminate\Html\HtmlFacade');

        // Register the acl:fill-permissions command
        $this->app['acl:fill-permissions'] = $this->app->share(function($app) {
            return new AclFill();
        });
        $this->commands('acl:fill-permissions');
    }
1085643
public function registerAction() {
        $this->view->title = __('register page title');
        $authVars = Garp_Auth::getInstance()->getConfigValues();

        if (!$this->getRequest()->isPost()) {
            return;
        }
        $errors = array();
        $postData = $this->getRequest()->getPost();
        $this->view->postData = $postData;

        // Apply some mild validation
        $password = $this->getRequest()->getPost('password');
        if (!$password) {
            $errors[] = sprintf(__('%s is a required field'), __('Password'));
        }

        $checkRepeatPassword = !empty($authVars['register']['repeatPassword']) &&
            $authVars['register']['repeatPassword'];
        if ($checkRepeatPassword) {
            $repeatPasswordField = $this->getRequest()->getPost(
                $authVars['register']['repeatPasswordField']
            );
            unset($postData[$authVars['register']['repeatPasswordField']]);
            if ($password != $repeatPasswordField) {
                $errors[] = __('the passwords do not match');
            }
        }

        if (count($errors)) {
            $this->view->errors = $errors;
            return;
        }

        // Save the new user
        $userModel = new Model_User();
        try {
            // Before register hook

            $this->_beforeRegister($postData);

            // Extract columns that are not part of the user model
            $userData = $userModel->filterColumns($postData);
            $insertId = $userModel->insert($userData);
            $this->_helper->flashMessenger(__($authVars['register']['successMessage']));

            // Store new user directly thru Garp_Auth so that they're logged in immediately
            $newUser = $userModel->find($insertId)->current();

            $auth = Garp_Auth::getInstance();
            $auth->store($newUser->toArray(), 'db');

            // After register hook
            $this->_afterRegister();

            // Determine targetUrl.
            // This is the URL the user was trying to access before registering, or a default URL.
            $router = Zend_Controller_Front::getInstance()->getRouter();
            if (!empty($authVars['register']['successRoute'])) {
                $targetUrl = $router->assemble(array(), $authVars['register']['successRoute']);
            } elseif (!empty($authVars['register']['successUrl'])) {
                $targetUrl = $authVars['register']['successUrl'];
            } else {
                $targetUrl = '/';
            }
            $store = Garp_Auth::getInstance()->getStore();
            if ($store->targetUrl) {
                $targetUrl = $store->targetUrl;
                unset($store->targetUrl);
            }

            $this->_redirect($targetUrl);
            // Check for duplication errors in order to show
            // a helpful error to the user.
        } catch (Zend_Db_Statement_Exception $e) {
            if (strpos($e->getMessage(), 'Duplicate entry') !== false
                && strpos($e->getMessage(), 'email_unique') !== false
            ) {
                $errors[] = __('this email address already exists');
            } else {
                throw $e;
            }
            // Validation errors should be safe to show to the user (note: translation
            // must be done in the validator itself)
        } catch (Garp_Model_Validator_Exception $e) {
            $errors[] = $e->getMessage();

            // Unknown error? Yikes... Show to developers, but show a
            // generic error to the general public.
        } catch (Exception $e) {
            $error = APPLICATION_ENV === 'development' ? $e->getMessage() : __('register error');
            $errors[] = $error;
        }
        $this->view->errors = $errors;
    }
274114
public function register()
    {
        $this->app->bind('\ReCaptcha\ReCaptcha', function ($app) {
            $config = config('recaptcha');

            return new ReCaptcha(
                $config['secret']
            );
        });

        $this->app->bind('recaptcha', function ($app) {
            $config = config('recaptcha');

            return new RecaptchaClient(
                $config['site_key'],
                $app['\ReCaptcha\ReCaptcha'],
                $app['Illuminate\Http\Request'],
                $app['Illuminate\Contracts\Logging\Log']
            );
        });
    }
491361
protected function registerFormHelper()
    {
        $this->app->singleton('laravel-form-helper', function ($app) {

            $configuration = $app['config']->get('laravel-form-builder');

            return new FormHelper($app['view'], $app['translator'], $configuration);
        });

        $this->app->alias('laravel-form-helper', 'Kris\LaravelFormBuilder\FormHelper');
    }
845309
protected function registerBladeDirectives()
    {
        Blade::directive('form', function ($expression) {
            $expression = $this->addParenthesis($expression); 
            return "<?php app('Activisme_BE')->model{$expression}; ?>"; 
        });

        Blade::directive('input', function ($expression) {
            $expression = $this->addParenthesis($expression);
            return "<?php echo app('Activisme_BE')->input{$expression}; ?>";
        });

        Blade::directive('text', function ($expression) {
            $expression = $this->addParenthesis($expression);
            return "<?php echo app('Activisme_BE')->text{$expression}; ?>";
        });

        Blade::directive('checkbox', function ($expression) {
            $expression = $this->addParenthesis($expression);
            return "<?php echo app('Activisme_BE')->checkbox{$expression}; ?>";
        });

        Blade::directive('radio', function ($expression) {
            $expression = $this->addParenthesis($expression);
            return "<?php echo app('Activisme_BE')->radio{$expression}; ?>";
        });

        Blade::directive('options', function ($expression) {
            $expression = $this->addParenthesis($expression);
            return "<?php echo app('Activisme_BE')->options{$expression}; ?>";
        });

        Blade::directive('error', function ($expression) {
            $expression = $this->addParenthesis($expression);
            return "<?php echo app('Activisme_BE')->error{$expression}; ?>";
        });
    }
238103
private function registerFormIfHeeded()
    {
        if (!$this->app->offsetExists('form')) {

            $this->app->singleton('form', function($app) {

                // LaravelCollective\HtmlBuilder 5.2 is not backward compatible and will throw an exception
                $version = substr(Application::VERSION, 0, 3);

                if(Str::is('5.4', $version)) {
                    $form = new LaravelForm($app[ 'html' ], $app[ 'url' ], $app[ 'view' ], $app[ 'session.store' ]->token());
                }
                else if (Str::is('5.0', $version) || Str::is('5.1', $version)) {
                    $form = new LaravelForm($app[ 'html' ], $app[ 'url' ], $app[ 'session.store' ]->token());
                }
                else {
                    $form = new LaravelForm($app['html'], $app['url'], $app['view'], $app['session.store']->token());
                }

                return $form->setSessionStore($app['session.store']);
            });

            if (! $this->aliasExists('Form')) {

                AliasLoader::getInstance()->alias(
                    'Form',
                    'Collective\Html\FormFacade'
                );
            }
        }
    }
1175519
public function registerAll()
    {
        /** @var LanguageService $service */
        $service   = resolve(LanguageService::class);
        $languages = $service->getAllEnabled();
        foreach ($this->routes['ml'] as $value) {
            foreach ($languages as $language) {
                $prefix = null;
                if (!$language->is_default) {
                    $prefix = $language->code;
                }
                Route::group(
                    array_merge(['prefix' => $prefix], $value['groupArgs']),
                    function ($router) use ($value, $language) {
                        $value['closure']($router, $language->code);
                    }
                );
            }
        }
        foreach ($this->routes['regular'] as $value) {
            Route::group(
                $value['groupArgs'],
                function ($router) use ($value) {
                    $value['closure']($router);
                }
            );
        }
        if (!empty($this->routes['catchAll'])) {
            Route::group(
                $this->routes['catchAll']['groupArgs'],
                function ($router) {
                    $this->routes['catchAll']['closure']($router);
                }
            );
        }

        $router = resolve('router');
        $router->getRoutes()->refreshActionLookups();
        $router->getRoutes()->refreshNameLookups();
    }
438913
public function register()
    {
        $this->commands('LarsJanssen\UnderConstruction\Commands\SetCodeCommand');
        $this->mergeConfigFrom(__DIR__.'/../config/under-construction.php', 'under-construction');

        $this->app->bind('TransFormer', function ($app) {
            return new TransFormer();
        });

        $routeConfig = [
            'namespace'  => 'LarsJanssen\UnderConstruction\Controllers',
            'prefix'     => 'under',
            'middleware' => [
                'web',
            ],
        ];

        $this->getRouter()->group($routeConfig, function ($router) {
            $router->post('check', [
                'uses' => 'CodeController@check',
                'as'   => 'underconstruction.check',
            ]);

            $router->post('checkiflimited', [
                'uses' => 'CodeController@checkIfLimited',
                'as' => 'underconstruction.checkiflimited',
            ]);

            $router->get('construction', [
                'uses' => 'CodeController@index',
                'as'   => 'underconstruction.index',
            ]);

            $router->get('js', [
                'uses' => 'AssetController@js',
                'as'   => 'underconstruction.js',
            ]);
        });
    }
113990
protected function registerDirectives()
    {
        if (version_compare($this->app->version(), '5.5', '>=')) {
            // Workaround to support the PHP5.6 syntax.
            // Even tho the laravel version will lock to 7.0 >=
            // but the code is still complied and throws syntax error on 5.6.
            $blade = Blade::getFacadeRoot();
            $if    = 'if';

            foreach (['desktop', 'tablet', 'mobile'] as $key) {
                $blade->$if($key, function () use ($key) {
                    $fn = 'is' . $key;
                    return app()->make('browser-detect')->detect()->$fn();
                });
            }

            $blade->$if('browser', function ($fn) {
                return app()->make('browser-detect')->detect()->$fn();
            });
        }
    }
749454
protected function addBasicPurgeFilters() {
        if ($this->purgeFiltersInitialized) {
            return;
        }

        $this->purgeFilters[] = function ($attributeKey) {
            // disallow password confirmation fields
            if (Str::endsWith($attributeKey, '_confirmation')) {
                return false;
            }

            // "_method" is used by Fly\Routing\Router to simulate custom HTTP verbs
            if (strcmp($attributeKey, '_method') === 0) {
                return false;
            }

            // "_token" is used by Fly\Html\FormBuilder to add CSRF protection
            if (strcmp($attributeKey, '_token') === 0) {
                return false;
            }

            return true;
        };

        $this->purgeFiltersInitialized = true;
    }
1326244
protected function registerOrchestraFormBuilder(): void
    {
        $this->app->singleton(FormControlContract::class, Control::class);

        $this->app->singleton(TemplateContract::class, function (Application $app) {
            $namespace = $this->hasPackageRepository() ? 'orchestra/html::form' : 'orchestra.form';

            $class = $app->make('config')->get("{$namespace}.presenter", BootstrapThreePresenter::class);

            return $app->make($class);
        });

        $this->app->singleton('orchestra.form', function (Application $app) {
            return new FormFactory($app);
        });
    }
871320
protected function registerRoutes()
    {
        $http = Arr::get($this->triggers, 'http');
        if (is_null($http)) {
            return;
        }

        // Validar
        try {
            Validator::validate($http, ['route' => 'required', 'methods' => 'required', 'function' => 'required']);
        } catch (ExceptionAttrs $e) {
            throw new \Exception($e->toMessageStr());
        }

        // Validar função
        $function = $http['function'];
        if (! array_key_exists($function, $this->functions)) {
            throw new \Exception(sprintf('Function %s not found', $function));
        }

        $class = $this->functions[$function];
        $methods = explode(',', Arr::get($http, 'methods', 'get'));

        foreach ($methods as $method) {
            // Validar metodo
            if (! in_array($method, ['get', 'post', 'delete', 'put'])) {
                throw new \Exception(sprintf('Method %s invalid', $method));
            }

            $args = [];
            $args['prefix'] = $this->getName();
            $args['uses'] = sprintf('%s@execute', $class);
            $args['middleware'] = 'api';
            call_user_func_array([router(), $method], [$http['route'], $args]);
        }
    }
997485
protected function registerAlertComponents()
    {
        $components = ['title', 'text', 'button'];

        foreach ($components as $component) {
            $class = 'LaravelAdminPanel\\Alert\\Components\\'.ucfirst(camel_case($component)).'Component';

            $this->app->bind("admin.alert.components.{$component}", $class);
        }
    }
1152793
public function register()
    {
        /*
        |--------------------------------------------------------------------------
        | Providers
        |--------------------------------------------------------------------------
        */

        $this->app->register(\Collective\Html\HtmlServiceProvider::class);

        /*
        |--------------------------------------------------------------------------
        | Register the Utilities
        |--------------------------------------------------------------------------
        */

        $this->app->singleton('FormMaker', function () {
            return new FormMaker();
        });

        $this->app->singleton('InputMaker', function () {
            return new InputMaker();
        });

        $loader = AliasLoader::getInstance();

        $loader->alias('FormMaker', \Grafite\FormMaker\Facades\FormMaker::class);
        $loader->alias('InputMaker', \Grafite\FormMaker\Facades\InputMaker::class);

        // Thrid party
        $loader->alias('Form', \Collective\Html\FormFacade::class);
        $loader->alias('HTML', \Collective\Html\HtmlFacade::class);

        /*
        |--------------------------------------------------------------------------
        | Blade Directives
        |--------------------------------------------------------------------------
        */

        // Form Maker
        Blade::directive('form_maker_table', function ($expression) {
            return "<?php echo FormMaker::fromTable($expression); ?>";
        });

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

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

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

        // Label Maker
        Blade::directive('input_maker_label', function ($expression) {
            return "<?php echo InputMaker::label($expression); ?>";
        });

        Blade::directive('input_maker_create', function ($expression) {
            return "<?php echo InputMaker::create($expression); ?>";
        });
    }
1309155
public function register()
    {
        $this->app['FilterManager'] = $this->app->share(function () {
                return FilterManager::create(Input::all())->setBlackList(['page']);
            });
    }