Namespaces

  • Latte
    • Loaders
    • Macros
    • Runtime
  • Nette
    • Application
      • Responses
      • Routers
      • UI
    • Bridges
      • ApplicationDI
      • ApplicationLatte
      • ApplicationTracy
      • CacheDI
      • CacheLatte
      • DatabaseDI
      • DatabaseTracy
      • DITracy
      • FormsDI
      • FormsLatte
      • Framework
      • HttpDI
      • HttpTracy
      • MailDI
      • ReflectionDI
      • SecurityDI
      • SecurityTracy
    • Caching
      • Storages
    • ComponentModel
    • Database
      • Conventions
      • Drivers
      • Table
    • DI
      • Config
        • Adapters
      • Extensions
    • Forms
      • Controls
      • Rendering
    • Http
    • Iterators
    • Loaders
    • Localization
    • Mail
    • Neon
    • PhpGenerator
      • Traits
    • Reflection
    • Security
    • Tokenizer
    • Utils
  • Tracy
    • Bridges
      • Nette
  • none

Classes

  • CachingIterator
  • FilterExecutor
  • FilterInfo
  • Filters
  • Html
  • SnippetDriver
  • Template

Interfaces

  • IHtmlString
  • ISnippetBridge
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Other releases

Class Filters

Template filters. Uses UTF-8 only.

Namespace: Latte\Runtime
Internal
Located at Latte/Runtime/Filters.php
Methods summary
public static string
# escapeHtml( mixed $s )

Escapes string for use inside HTML.

Escapes string for use inside HTML.

Parameters

$s
text

Returns

string
HTML
public static string
# escapeHtmlText( mixed $s )

Escapes string for use inside HTML.

Escapes string for use inside HTML.

Parameters

$s
text or IHtmlString

Returns

string
HTML
public static string
# escapeHtmlAttr( string $s, $double = true )

Escapes string for use inside HTML attribute value.

Escapes string for use inside HTML attribute value.

Parameters

$s
text
$double

Returns

string
HTML
public static string
# escapeHtmlAttrConv( mixed $s )

Escapes HTML for use inside HTML attribute.

Escapes HTML for use inside HTML attribute.

Parameters

$s
text

Returns

string
HTML
public static string
# escapeHtmlAttrUnquoted( string $s )

Escapes string for use inside HTML attribute name.

Escapes string for use inside HTML attribute name.

Parameters

$s
text

Returns

string
HTML
public static string
# escapeHtmlComment( string $s )

Escapes string for use inside HTML comments.

Escapes string for use inside HTML comments.

Parameters

$s
text

Returns

string
HTML
public static string
# escapeXml( string $s )

Escapes string for use inside XML 1.0 template.

Escapes string for use inside XML 1.0 template.

Parameters

$s
text

Returns

string
XML
public static string
# escapeXmlAttrUnquoted( string $s )

Escapes string for use inside XML attribute name.

Escapes string for use inside XML attribute name.

Parameters

$s
text

Returns

string
XML
public static string
# escapeCss( string $s )

Escapes string for use inside CSS template.

Escapes string for use inside CSS template.

Parameters

$s
text

Returns

string
CSS
public static string
# escapeJs( mixed $s )

Escapes variables for use inside <script>.

Escapes variables for use inside <script>.

Parameters

$s
text

Returns

string
JSON
public static string
# escapeICal( string $s )

Escapes string for use inside iCal template.

Escapes string for use inside iCal template.

Parameters

$s
text

Returns

string
string
public static string
# escapeHtmlRawText( string $s )

Escapes CSS/JS for usage in <script> and <style>..

Escapes CSS/JS for usage in <script> and <style>..

Parameters

$s
CSS/JS

Returns

string
HTML RAWTEXT
public static string
# stripHtml( Latte\Runtime\FilterInfo $info, string $s )

Converts HTML to plain text.

Converts HTML to plain text.

Parameters

$info
$s
HTML

Returns

string
plain text
public static string
# stripTags( Latte\Runtime\FilterInfo $info, string $s )

Removes tags from HTML (but remains HTML entites).

Removes tags from HTML (but remains HTML entites).

Parameters

$info
$s
HTML

Returns

string
HTML
public static string
# convertTo( Latte\Runtime\FilterInfo $info, $dest, $s )

Converts ... to ...

Converts ... to ...

Returns

string
string
public static callable|null
# getConvertor( $source, $dest )

Returns

callable|null
callable|null
public static string
# safeUrl( string $s )

Sanitizes string for use inside href attribute.

Sanitizes string for use inside href attribute.

Parameters

$s
text

Returns

string
plain text
public static string
# strip( Latte\Runtime\FilterInfo $info, string $s )

Replaces all repeated white spaces with a single space.

Replaces all repeated white spaces with a single space.

Parameters

$info
$s
text|HTML

Returns

string
text|HTML
public static string
# spacelessHtml( string $s, integer $phase = null, boolean & $strip = true )

Replaces all repeated white spaces with a single space.

Replaces all repeated white spaces with a single space.

Parameters

$s
HTML
$phase
buffering phase
$strip
mode

Returns

string
HTML
public static string
# spacelessText( string $s )

Replaces all repeated white spaces with a single space.

Replaces all repeated white spaces with a single space.

Parameters

$s
text

Returns

string
text
public static string
# indent( Latte\Runtime\FilterInfo $info, string $s, integer $level = 1, string $chars = "\t" )

Indents the content from the left.

Indents the content from the left.

Parameters

$info
$s
text|HTML
$level
$chars

Returns

string
text|HTML
public static string
# repeat( Latte\Runtime\FilterInfo $info, string $s, integer $count )

Repeats text.

Repeats text.

Parameters

$info
$s
$count

Returns

string
plain text
public static string|null
# date( string|integer|DateTime|DateTimeInterface|DateInterval $time, string $format = null )

Date/time formatting.

Date/time formatting.

Parameters

$time
$format

Returns

string|null
string|null
public static string
# bytes( float $bytes, integer $precision = 2 )

Converts to human readable file size.

Converts to human readable file size.

Parameters

$bytes
$precision

Returns

string
plain text
public static string
# replace( Latte\Runtime\FilterInfo $info, string $subject, string $search, string $replacement = '' )

Performs a search and replace.

Performs a search and replace.

Parameters

$info
$subject
$search
$replacement

Returns

string
string
public static string
# replaceRe( string $subject, string $pattern, $replacement = '' )

Perform a regular expression search and replace.

Perform a regular expression search and replace.

Parameters

$subject
$pattern
$replacement

Returns

string
string
public static string
# dataStream( string $data, string $type = null )

The data: URI generator.

The data: URI generator.

Parameters

$data
text
$type

Returns

string
plain text
public static string
# nl2br( string $value )

Parameters

$value

Returns

string
string
public static Latte\Runtime\Html
# breaklines( string $s )

Parameters

$s
text

Returns

Latte\Runtime\Html
Html
public static string
# substring( string $s, integer $start, integer $length = null )

Returns a part of string.

Returns a part of string.

Parameters

$s
$start
$length

Returns

string
string
public static string
# truncate( string $s, integer $maxLen, string $append = "\xE2\x80\xA6" )

Truncates string to maximal length.

Truncates string to maximal length.

Parameters

$s
text
$maxLen
$append
text

Returns

string
plain text
public static string
# lower( string $s )

Convert to lower case.

Convert to lower case.

Parameters

$s
text

Returns

string
plain text
public static string
# upper( string $s )

Convert to upper case.

Convert to upper case.

Parameters

$s
text

Returns

string
plain text
public static string
# firstUpper( string $s )

Convert first character to upper case.

Convert first character to upper case.

Parameters

$s
text

Returns

string
plain text
public static string
# capitalize( string $s )

Capitalize string.

Capitalize string.

Parameters

$s
text

Returns

string
plain text
public static integer
# length( array|Countable|Traversable|string $val )

Returns length of string or iterable.

Returns length of string or iterable.

Parameters

$val

Returns

integer
int
public static string
# trim( Latte\Runtime\FilterInfo $info, string $s, $charlist = " \t\n\r\0\x0B\xC2\xA0" )

Strips whitespace.

Strips whitespace.

Parameters

$info
$s
$charlist

Returns

string
string
public static string
# padLeft( string $s, integer $length, string $pad = ' ' )

Pad a string to a certain length with another string.

Pad a string to a certain length with another string.

Parameters

$s
text
$length
$pad

Returns

string
string
public static string
# padRight( string $s, integer $length, string $pad = ' ' )

Pad a string to a certain length with another string.

Pad a string to a certain length with another string.

Parameters

$s
text
$length
$pad

Returns

string
string
public static
# reverse( string|array|Traversable $val, $preserveKeys = false )

Reverses string or array.

Reverses string or array.

Parameters

$val
$preserveKeys
public static string
# htmlAttributes( $attrs )

Returns element's attributes.

Returns element's attributes.

Returns

string
string
Properties summary
public static string $dateFormat

Deprecated

#'%x'
public static boolean $xhtml

Internal

@var bool use XHTML syntax?
#false
Nette 2.4-20180918 API API documentation generated by ApiGen 2.8.0