PHP Class LaravelBook\Laravel4Powerpack\HTML

Show file Open project: laravelbook/laravel4-powerpack Class Usage Examples

Protected Properties

Property Type Description
$encoding string The encoding to use
$macros array Custom macros registered by the user
$url Illuminate\Routing\UrlGenerator The url generator instance

Public Methods

Method Description
__call ( string $method, array $parameters ) : mixed Dynamically handle calls to custom macros.
__construct ( UrlGenerator $urlGenerator = null ) Build a new instance of HTML
action ( string $action, string $title = null, array $parameters = [], array $attributes = [], $absolute = true ) : string Generate a HTML link to a controller action
asset ( string $url, string $title = null, array $attributes = [], boolean $https = null ) : string Generate a HTML link to an asset
attributes ( array $attributes ) : string Build a list of HTML attributes from an array
decode ( string $value ) : string Convert HTML entities to HTML characters
dl ( array $list, array $attributes = [] ) : string Generate a definition list.
email ( string $email ) : string Obfuscate an e-mail address to prevent spam-bots from sniffing it.
entities ( string $value ) : string Convert HTML characters to HTML entities
getUrlGenerator ( )
image ( string $url, string $alt = null, array $attributes = [] ) : string Generate an HTML image element.
link ( string $url, string $title = null, array $attributes = [], $parameters = [], boolean $https = null ) : string Generate a HTML link
macro ( string $name, Callable $callback ) : void Register a new macro with the HTML class
mailto ( string $email, string $title = null, array $attributes = [] ) : string Generate an HTML mailto link.
ol ( array $list, array $attributes = [] ) : string Generate an ordered list of items.
route ( string $name, string $title = null, array $parameters = [], array $attributes = [], $absolute = true ) : string Generate a HTML link to a route
script ( string $url, array $attributes = [] ) : string Generate a link to a JS file
script_tag ( string $script, array $attributes = [] ) : string Generate a script tag with embed javascript
secure ( string $url, string $title = null, $parameters = [], array $attributes = [] ) : string Generate a HTTPS HTML link
secureAsset ( string $url, string $title = null, array $attributes = [] ) : string Generate a HTTPS HTML link to an asset
span ( string $value, array $attributes = [] ) : string Generate a HTML span
specialchars ( string $value ) : string Convert HTML special characters
style ( string $url, array $attributes = [] ) : string Generate a link to a CSS file.
to ( string $url, string $title = null, array $attributes = [], $parameters = [], boolean $https = null ) : string Generate a HTML link
ul ( array $list, array $attributes = [] ) : string Generate an un-ordered list of items.
wrapHTMLTag ( string $value, string $tag ) : string Wraps opening and closing HTML tags around the given input.

Protected Methods

Method Description
obfuscate ( string $value ) : string Obfuscate a string to prevent spam-bots from sniffing it

Private Methods

Method Description
listing ( string $type, array $list, array $attributes = [] ) : string Generate an ordered or un-ordered list.

Method Details

__call() public method

Dynamically handle calls to custom macros.
public __call ( string $method, array $parameters ) : mixed
$method string
$parameters array
return mixed

__construct() public method

Build a new instance of HTML
public __construct ( UrlGenerator $urlGenerator = null )
$urlGenerator Illuminate\Routing\UrlGenerator

action() public method

An array of parameters may be specified to fill in URI segment wildcards.
public action ( string $action, string $title = null, array $parameters = [], array $attributes = [], $absolute = true ) : string
$action string
$title string
$parameters array
$attributes array
return string

asset() public method

Generate a HTML link to an asset
public asset ( string $url, string $title = null, array $attributes = [], boolean $https = null ) : string
$url string
$title string
$attributes array
$https boolean
return string

attributes() public method

Build a list of HTML attributes from an array
public attributes ( array $attributes ) : string
$attributes array
return string

decode() public method

The encoding in $encoding will be used
public decode ( string $value ) : string
$value string
return string

dl() public method

Generate a definition list.
public dl ( array $list, array $attributes = [] ) : string
$list array
$attributes array
return string

email() public method

Obfuscate an e-mail address to prevent spam-bots from sniffing it.
public email ( string $email ) : string
$email string
return string

entities() public method

The encoding in $encoding will be used
public entities ( string $value ) : string
$value string
return string

getUrlGenerator() public method

public getUrlGenerator ( )

image() public method

Generate an HTML image element.
public image ( string $url, string $alt = null, array $attributes = [] ) : string
$url string
$alt string
$attributes array
return string

macro() public method

Register a new macro with the HTML class
public macro ( string $name, Callable $callback ) : void
$name string Its name
$callback Callable A closure to use
return void

mailto() public method

The E-Mail address will be obfuscated to protect it from spam bots.
public mailto ( string $email, string $title = null, array $attributes = [] ) : string
$email string
$title string
$attributes array
return string

obfuscate() protected method

Obfuscate a string to prevent spam-bots from sniffing it
protected obfuscate ( string $value ) : string
$value string
return string

ol() public method

Generate an ordered list of items.
public ol ( array $list, array $attributes = [] ) : string
$list array
$attributes array
return string

route() public method

An array of parameters may be specified to fill in URI segment wildcards.
public route ( string $name, string $title = null, array $parameters = [], array $attributes = [], $absolute = true ) : string
$name string
$title string
$parameters array
$attributes array
return string

script() public method

Generate a link to a JS file
public script ( string $url, array $attributes = [] ) : string
$url string
$attributes array
return string

script_tag() public method

Generate a script tag with embed javascript
public script_tag ( string $script, array $attributes = [] ) : string
$script string
$attributes array
return string

secure() public method

Generate a HTTPS HTML link
public secure ( string $url, string $title = null, $parameters = [], array $attributes = [] ) : string
$url string
$title string
$attributes array
return string

secureAsset() public method

Generate a HTTPS HTML link to an asset
public secureAsset ( string $url, string $title = null, array $attributes = [] ) : string
$url string
$title string
$attributes array
return string

span() public method

Generate a HTML span
public span ( string $value, array $attributes = [] ) : string
$value string
$attributes array
return string

specialchars() public method

The encoding in $encoding will be used
public specialchars ( string $value ) : string
$value string
return string

style() public method

If no media type is selected, "all" will be used
public style ( string $url, array $attributes = [] ) : string
$url string
$attributes array
return string

to() public method

Generate a HTML link
public to ( string $url, string $title = null, array $attributes = [], $parameters = [], boolean $https = null ) : string
$url string
$title string
$attributes array
$https boolean
return string

ul() public method

Generate an un-ordered list of items.
public ul ( array $list, array $attributes = [] ) : string
$list array
$attributes array
return string

wrapHTMLTag() public method

Wraps opening and closing HTML tags around the given input.
public wrapHTMLTag ( string $value, string $tag ) : string
$value string
$tag string
return string

Property Details

$encoding protected property

The encoding to use
protected string $encoding
return string

$macros protected property

Custom macros registered by the user
protected array $macros
return array

$url protected property

The url generator instance
protected UrlGenerator,Illuminate\Routing $url
return Illuminate\Routing\UrlGenerator