VuFind API Documentation

Captcha extends AbstractHelper
in package
Uses ClassBasedTemplateRendererTrait

Captcha view helper

Tags
category

VuFind

author

Chris Hallberg crhallberg@gmail.com

author

Mario Trojan mario.trojan@uni-tuebingen.de

license

http://opensource.org/licenses/gpl-2.0.php GNU General Public License

link

Wiki

Table of Contents

$captchas  : array<string|int, mixed>
Captcha services
$config  : Config
Config
$templateCache  : array<string|int, mixed>
Cache for found templates
__construct()  : mixed
Constructor
__invoke()  : Captcha
Return this object
getHtmlForCaptcha()  : string
Generate HTML of a single CAPTCHA (redirect to template)
html()  : string
Generate HTML depending on CAPTCHA type (empty if not active).
js()  : array<string|int, mixed>
Get list of URLs with JS dependencies to load for the active CAPTCHA type.
active()  : bool
Return whether Captcha is active in the config
getBriefClass()  : string
Helper to grab the end of the class name
getCachedClassTemplate()  : string
Resolve the class template file unless already cached and return the file name.
getTemplateWithClass()  : string
Helper to put the template path and class name together
renderClassTemplate()  : string
Render a template associated with the provided class name, applying to specified context variables.
resolveClassTemplate()  : string
Recursively locate a template that matches the provided class name (or one of its parent classes); throw an exception if no match is found.

Properties

$captchas

Captcha services

protected array<string|int, mixed> $captchas = []

$config

Config

protected Config $config

Methods

__construct()

Constructor

public __construct(Config $config[, array<string|int, mixed> $captchas = [] ]) : mixed
Parameters
$config : Config

Config

$captchas : array<string|int, mixed> = []

Captchas

Return values
mixed

getHtmlForCaptcha()

Generate HTML of a single CAPTCHA (redirect to template)

public getHtmlForCaptcha(AbstractBase $captcha) : string
Parameters
$captcha : AbstractBase

Captcha

Return values
string

html()

Generate HTML depending on CAPTCHA type (empty if not active).

public html([bool $useCaptcha = true ][, bool $wrapHtml = true ]) : string
Parameters
$useCaptcha : bool = true

Boolean of active state, for compact templating

$wrapHtml : bool = true

Wrap in a form-group?

Return values
string

js()

Get list of URLs with JS dependencies to load for the active CAPTCHA type.

public js() : array<string|int, mixed>
Return values
array<string|int, mixed>

active()

Return whether Captcha is active in the config

protected active() : bool
Return values
bool

getBriefClass()

Helper to grab the end of the class name

protected getBriefClass(string $className) : string
Parameters
$className : string

Class name to abbreviate

Return values
string

getCachedClassTemplate()

Resolve the class template file unless already cached and return the file name.

protected getCachedClassTemplate(string $template, string $className) : string
Parameters
$template : string

Template path (with %s as class name placeholder)

$className : string

Name of class to apply to template.

Return values
string

getTemplateWithClass()

Helper to put the template path and class name together

protected getTemplateWithClass(string $template, string $className) : string
Parameters
$template : string

Template path (with %s as class name placeholder)

$className : string

Class name to abbreviate

Return values
string

renderClassTemplate()

Render a template associated with the provided class name, applying to specified context variables.

protected renderClassTemplate(string $template, string $className[, array<string|int, mixed> $context = [] ][, bool $throw = true ]) : string
Parameters
$template : string

Template path (with %s as class name placeholder)

$className : string

Name of class to apply to template.

$context : array<string|int, mixed> = []

Context for rendering template

$throw : bool = true

If true (default), an exception is thrown if the template is not found. Otherwise an empty string is returned.

Tags
throws
RuntimeException
Return values
string

resolveClassTemplate()

Recursively locate a template that matches the provided class name (or one of its parent classes); throw an exception if no match is found.

protected resolveClassTemplate(string $template, string $className, ResolverInterface $resolver[, string $topClassName = null ]) : string
Parameters
$template : string

Template path (with %s as class name placeholder)

$className : string

Name of class to apply to template.

$resolver : ResolverInterface

Resolver to use

$topClassName : string = null

Top-level parent class of $className (or null if $className is already the top level; used for recursion only).

Return values
string

Search results