core/src/PlufTemplate.php

Classes

Pluf_Template Render a template file.

Functions

Pluf_Template_unsafe()

Pluf_Template_unsafe(  $string) : string

Set a string to be safe for display.

Parameters

$string

Returns

string —

Pluf_Template_SafeString

Pluf_Template_htmlspecialchars()

Pluf_Template_htmlspecialchars(  $string) : string

Special htmlspecialchars that can handle the objects.

Parameters

$string

Returns

string —

String like if htmlspecialchars was not applied

Pluf_Template_dateFormat()

Pluf_Template_dateFormat(string  $date, string  $format = '%b %e, %Y') : string

Modifier plugin: Convert the date from GMT to local and format it.

This is used as all the datetime are stored in GMT in the database.

Parameters

string $date

input date string considered GMT

string $format

strftime format for output ('%b %e, %Y')

Returns

string —

date in localtime

Pluf_Template_timeFormat()

Pluf_Template_timeFormat(integer  $time, string  $format = 'Y-m-d H:i:s') : string

Modifier plugin: Format a unix time.

Warning: date format is directly to be used, not consideration of GMT or local time.

Parameters

integer $time

input date string considered GMT

string $format

strftime format for output ('Y-m-d H:i:s')

Returns

string —

formated time

Pluf_Template_safeEcho()

Pluf_Template_safeEcho(  $mixed,   $echo = true) : string

Special echo function that checks if the string to output is safe or not, if not it is escaped.

Parameters

$mixed
$echo

Returns

string —

Safe to display in HTML.

Pluf_Template_nl2br()

Pluf_Template_nl2br(  $mixed) : string

New line to <br /> returning a safe string.

Parameters

$mixed

Returns

string —

Safe to display in HTML.

Pluf_Template_varExport()

Pluf_Template_varExport(  $mixed) : string

Var export returning a safe string.

Parameters

$mixed

Returns

string —

Safe to display in HTML.

Pluf_Template_dateAgo()

Pluf_Template_dateAgo(  $date,   $f = 'withal') 

Display the date in a "6 days, 23 hours ago" style.

Parameters

$date
$f

Pluf_Template_timeAgo()

Pluf_Template_timeAgo(  $date,   $f = "withal") 

Display the time in a "6 days, 23 hours ago" style.

Parameters

$date
$f

Pluf_Template_safeEmail()

Pluf_Template_safeEmail(  $email) 

Hex encode an email excluding the "mailto:".

Parameters

$email

Pluf_Template_first()

Pluf_Template_first(array  $array) : mixed

Returns the first item in the given array.

Parameters

array $array

Returns

mixed —

An empty string if $array is not an array.

Pluf_Template_last()

Pluf_Template_last(array  $array) : mixed

Returns the last item in the given array.

Parameters

array $array

Returns

mixed —

An empty string if $array is not an array.