Register the available parser extension.

@param  \Slim\Slim                $app       The application instance to register with.
@param  \Wowe\Recaptcha\Recaptcha $recaptcha The Recaptcha instance to inject into the extension.
@return void
494285
private static function registerViewExtension(Slim $app, Recaptcha $recaptcha)
    {
        $view = $app->view;
        if (!property_exists($view, 'parserExtensions')) {
            return;
        }

        $originalExtensions = $view->parserExtensions ?: [];
        $class = explode('\\', get_class($view));
        switch(end($class)) {
            case 'Twig':
                $view->parserExtensions = array_merge($originalExtensions, [new TwigExtension($recaptcha)]);
                break;
        }
    }
1253684
static function register(string $name, CaptchaInterface $captcha) {
        if (isset(self::$_captchaList[$name]))
            Console::warning("Overwriting captcha generator \"$name\".");
        self::$_captchaList[$name] = $captcha;
        self::enable($name);
    }
1029100
public function register(Application $app)
    {
        $app['redis'] = $app->share(function ($app) {
            $config = $app['config'];
            $redis = new \Redis();
            if (!$redis->connect($config['redis']['host'], $config['redis']['port'])) {
                throw new \RuntimeException('Unable to connect to redis server');
            }
            return $redis;
        });
    }
1118118
public function register(Application $app)
    {
        /** @var Translator $translator  */
        $translator = $app['translator'];

        /** @var Collection $writerCollection */
        $writerCollection = $app['transformer.writer.collection'];

        $writerCollection['twig'] = new Writer\Twig();
        $writerCollection['twig']->setTranslator($translator);
    }
1264792
public function register()
    {
        $this->app->singleton(Sequence::class, function ($app) {
            return new Sequence($app->make('config'), $app->make('request'), $app->make('view'));
        });

        $this->app->singleton(Recaptcha::class, function ($app) {
            return new Recaptcha($app->make('config'), $app->make('request'), $app->make('view'), new GuzzleClient());
        });
    }
52430
protected function registerMapperInitializer(Application $app)
    {
        $initializer = function ($mapper, $app) {
            $mapper->setSqlFactory(new SqlFactory);
        };

        $app->initializer('Synapse\Mapper\AbstractMapper', $initializer);
    }
1145297
public function boot()
  {

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

    $this->app->validator->extend('recaptcha', function($attribute, $value, $parameters, $validator) {
      $secret = config('recaptcha.secret');
      $recaptcha = new \ReCaptcha\ReCaptcha($secret);
      $remoteIp = app('request')->getClientIp();
      $response = $recaptcha->verify($value, $remoteIp);
      return $response->isSuccess();
    });
  }
403208
public function bootstrap($app)
    {
        $app->on(Application::EVENT_BEFORE_REQUEST, function () {
            $this->retrieveInfo();
            $this->retrieveLanguageFromGeo();
        });
        $app->on(Application::EVENT_BEFORE_ACTION, function () {
            $this->retrieveCookieLanguage();
        });
        $this->registerTranslations();
    }
1235951
def check_recaptcha(view_func):
    """"""
    @wraps(view_func)
    def _wrapped_view(request, *args, **kwargs):
        request.recaptcha_is_valid = None
        if request.method == 'POST':
            recaptcha_response = request.POST.get('g-recaptcha-response')
            data = {
                'secret': settings.GOOGLE_RECAPTCHA_SECRET_KEY,
                'response': recaptcha_response
            }
            r = requests.post(
                'https://www.google.com/recaptcha/api/siteverify',
                data=data
            )
            result = r.json()
            if result['success']:
                request.recaptcha_is_valid = True
            else:
                request.recaptcha_is_valid = False
                error_message = 'Invalid reCAPTCHA. Please try again. '
                error_message += str(result['error-codes'])
                print(error_message)
        return view_func(request, *args, **kwargs)
    return _wrapped_view
393725
public function register($app)
    {
        if (! $this->cache->get('telescope:dump-watcher')) {
            return;
        }

        VarDumper::setHandler(function ($var) {
            $this->recordDump((new HtmlDumper)->dump(
                (new VarCloner)->cloneVar($var), true
            ));
        });
    }
851846
public function validateReCaptcha()
    {
        if (is_user_logged_in()) {
            return;
        }

        $response = isset($_POST['g-recaptcha-response']) ? esc_attr($_POST['g-recaptcha-response']) : '';
        $reCaptcha = \Municipio\Helper\ReCaptcha::controlReCaptcha($response);

        if (!$reCaptcha) {
            wp_die(sprintf('<strong>%s</strong>:&nbsp;%s', __('Error', 'municipio'), __('reCaptcha verification failed', 'municipio')));
        }

        return;
    }
1088386
public function register(Application $app)
    {
        $app[Service::PASSWORD_HASH] = $app->share(function () use ($app) {
            return new Service\DefaultPasswordHashService();
        });
    }
1354977
public function register(Container $app)
    {
        $app[DataInterface::class] = $app->factory(Data::class);
        $app[ConfigInterface::class] = $app->factory(FileConfig::class);
    }
1041533
public function html()
    {
        if (!$this->getPublicKey()) {
            throw new Exception('You must set public key provided by reCaptcha');
        }

        $error = ($this->getError() ? '&amp;error=' . $this->getError() : null);

        $theme = null;

        // If user specified a reCaptcha theme, output it as one of the options
        if ($this->theme) {
            $theme = '<script> var RecaptchaOptions = {theme: "' . $this->theme . '"};</script>';
        }

        return $theme . '<script type="text/javascript" src="' . self::SERVER . '/challenge?k=' . $this->getPublicKey() . $error . '"></script>

        <noscript>
            <iframe src="' . self::SERVER . '/noscript?k=' . $this->getPublicKey() . $error . '" height="300" width="500" frameborder="0"></iframe><br/>
            <textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
            <input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
        </noscript>';
    }
596769
protected static function registerWatchers($app)
    {
        foreach (config('telescope.watchers') as $key => $watcher) {
            if (is_string($key) && $watcher === false) {
                continue;
            }

            if (is_array($watcher) && ! ($watcher['enabled'] ?? true)) {
                continue;
            }

            $watcher = $app->make(is_string($key) ? $key : $watcher, [
                'options' => is_array($watcher) ? $watcher : [],
            ]);

            static::$watchers[] = get_class($watcher);

            $watcher->register($app);
        }
    }
1071165
public function registerClientScript($gCaptchaParams = [])
    {
        $id = $this->id;
        $view = $this->view;
        ReCaptchaAsset::register($view);

        $options = Json::encode($gCaptchaParams);

        // Directly creating captcha widgets.
        // This code placed only one time irrespective of count of captcha-widgets
        $view->registerJs(<<<JS
if (typeof (renderReCaptchaCallback) === "undefined") {
    var reCaptchaWidgets = {};
    var renderReCaptchaCallback = function() {
        for (var widgetId in reCaptchaWidgets) {
            if (reCaptchaWidgets.hasOwnProperty(widgetId)) {
                grecaptcha.render(document.getElementById(widgetId), reCaptchaWidgets[widgetId]);
            }
        }
    };
}
JS
            , View::POS_HEAD, 'renderReCaptchaCallbackFunction');

        // Append new captcha widget info
        $view->registerJs(<<<JS
reCaptchaWidgets.$id = $options;
JS
            , View::POS_HEAD);
    }
400154
public function register(Application $app)
    {
        $app[self::TEMPLATE_FOLDER] = realpath(__DIR__ . '/data/templates/');
        $app[self::CONVERTERS] = array(
            '\phpDocumentor\Plugin\Scrybe\Converter\RestructuredText\ToHtml' => array(Format::RST, Format::HTML),
        );

        $app[self::FORMATS] = $app->share(
            function () {
                return new Converter\Format\Collection();
            }
        );
        $app[self::CONVERTER_DEFINITION_FACTORY] = $app->share(
            function ($container) {
                return new Factory($container[ServiceProvider::FORMATS]);
            }
        );
        $app[self::CONVERTER_FACTORY] = $app->share(
            function ($container) {
                return new Converter\Factory(
                    $container['converters'],
                    $container['converter_definition_factory'],
                    $container['monolog']
                );
            }
        );
        $app[self::TEMPLATE_FACTORY]  = $app->share(
            function ($app) {
                return new Template\Factory(
                    array('twig' => new Template\Twig($app[ServiceProvider::TEMPLATE_FOLDER]))
                );
            }
        );

        $this->addCommands($app);
    }