HtmlBuilder
Html builder
class Winter\Storm\Html\HtmlBuilder
Extension of illuminate/html, injects a session key to each form opening.
Traits
Trait | Description |
---|---|
Illuminate\Support\Traits\Macroable
|
Properties
protected $url : Illuminate\Routing\UrlGenerator
The URL generator instance.
Methods
public
__construct (Illuminate\Routing\UrlGenerator $url = null
)
: void
Create a new HTML builder instance.
Property | Type | Description |
---|---|---|
$url | Illuminate\Routing\UrlGenerator |
Illuminate\Routing\UrlGenerator
|
public attributes (array $attributes) : string
Build an HTML attribute string from an array.
Property | Type | Description |
---|---|---|
$attributes | array |
array
|
public static clean (string $html) : string
Cleans HTML to prevent most XSS attacks.
Property | Type | Description |
---|---|---|
$html | string |
string
HTML |
Cleaned HTML
public decode (string $value) : string
Convert entities to HTML characters.
Property | Type | Description |
---|---|---|
$value | string |
string
|
public email (string $email) : string
Obfuscate an e-mail address to prevent spam-bots from sniffing it.
Property | Type | Description |
---|---|---|
string |
string
|
public entities (string $value) : string
Convert an HTML string to entities.
Property | Type | Description |
---|---|---|
$value | string |
string
|
public
image (string $url, string $alt = null
, array $attributes = []
, bool $secure = null
)
: string
Generate an HTML image element.
Property | Type | Description |
---|---|---|
$url | string |
string
|
$alt | string |
string
|
$attributes | array |
array
|
$secure | bool |
bool
|
public
static
limit (string $html, integer $maxLength = 100
, string $end = "..."
)
: string
Limits HTML with specific length with a proper tag handling.
Property | Type | Description |
---|---|---|
$html | string |
string
HTML string to limit |
$maxLength | integer |
integer
String length to truncate at |
$end | string |
string
|
public
link (string $url, string | false | null $title = null
, array $attributes = []
, bool $secure = null
)
: string
Generate a HTML link.
Property | Type | Description |
---|---|---|
$url | string |
string
|
$title | string | false | null |
string | false | null
|
$attributes | array |
array
|
$secure | bool |
bool
|
public
linkAction (string $action, string $title = null
, array $parameters = []
, array $attributes = []
)
: string
Generate a HTML link to a controller action.
Property | Type | Description |
---|---|---|
$action | string |
string
|
$title | string |
string
|
$parameters | array |
array
|
$attributes | array |
array
|
public
linkAsset (string $url, string $title = null
, array $attributes = []
, bool $secure = null
)
: string
Generate a HTML link to an asset.
Property | Type | Description |
---|---|---|
$url | string |
string
|
$title | string |
string
|
$attributes | array |
array
|
$secure | bool |
bool
|
public
linkRoute (string $name, string $title = null
, array $parameters = []
, array $attributes = []
)
: string
Generate a HTML link to a named route.
Property | Type | Description |
---|---|---|
$name | string |
string
|
$title | string |
string
|
$parameters | array |
array
|
$attributes | array |
array
|
public
linkSecureAsset (string $url, string $title = null
, array $attributes = []
)
: string
Generate a HTTPS HTML link to an asset.
Property | Type | Description |
---|---|---|
$url | string |
string
|
$title | string |
string
|
$attributes | array |
array
|
public
mailto (string $email, string $title = null
, array $attributes = []
)
: string
Generate a HTML link to an email address.
Property | Type | Description |
---|---|---|
string |
string
|
|
$title | string |
string
|
$attributes | array |
array
|
public obfuscate (string $value) : string
Obfuscate a string to prevent spam-bots from sniffing it.
Property | Type | Description |
---|---|---|
$value | string |
string
|
public
ol (array $list, array $attributes = []
)
: string
Generate an ordered list of items.
Property | Type | Description |
---|---|---|
$list | array |
array
|
$attributes | array |
array
|
public
script (string $url, array $attributes = []
, bool $secure = null
)
: string
Generate a link to a JavaScript file.
Property | Type | Description |
---|---|---|
$url | string |
string
|
$attributes | array |
array
|
$secure | bool |
bool
|
public
secureLink (string $url, string $title = null
, array $attributes = []
)
: string
Generate a HTTPS HTML link.
Property | Type | Description |
---|---|---|
$url | string |
string
|
$title | string |
string
|
$attributes | array |
array
|
public static strip (string $string) : string
Removes HTML from a string
Property | Type | Description |
---|---|---|
$string | string |
string
String to strip HTML from |
public
style (string $url, array $attributes = []
, bool $secure = null
)
: string
Generate a link to a CSS file.
Property | Type | Description |
---|---|---|
$url | string |
string
|
$attributes | array |
array
|
$secure | bool |
bool
|
public
ul (array $list, array $attributes = []
)
: string
Generate an un-ordered list of items.
Property | Type | Description |
---|---|---|
$list | array |
array
|
$attributes | array |
array
|
protected
attributeElement (string $key, string | array | null $value = null
)
: string | null
Build a single attribute element.
Property | Type | Description |
---|---|---|
$key | string |
string
|
$value | string | array | null |
string | array | null
|
protected static getReadableLength (string $str) : int
Gets the readable length of a string for limit calculations.
Considers multiple spaces and line breaks to be 1 character, regardless of OS.
Property | Type | Description |
---|---|---|
$str | string |
string
|
protected
listing (string $type, array $list, array $attributes = []
)
: string
Create a listing HTML element.
Property | Type | Description |
---|---|---|
$type | string |
string
|
$list | array |
array
|
$attributes | array |
array
|
protected listingElement (mixed $key, string $type, string | array $value) : string
Create the HTML for a listing element.
Property | Type | Description |
---|---|---|
$key | mixed |
mixed
|
$type | string |
string
|
$value | string | array |
string | array
|
protected nestedListing (mixed $key, string $type, array $value) : string
Create the HTML for a nested listing attribute.
Property | Type | Description |
---|---|---|
$key | mixed |
mixed
|
$type | string |
string
|
$value | array |
array
|