Reference - Parms functions - html


App: regression/framework - Page: escaping/a_quote_stand_in_from_the_request_is_escaped_as_the_quote
PHP
escaping/a_quote_stand_in_from_the_request_is_escaped_as_the_quote.php
HTML
escaping/a_quote_stand_in_from_the_request_is_escaped_as_the_quote.pad
Result
<?php

// A value as a request brings it: U+E022 and U+E027 are the stand-ins of the two quotes
// and U+E05C the one of the backslash (lib/encoding.php), which exits.php turns back into
// the characters as the page is written out - after every escaper has run.

$name = "x\u{E022} on=\u{E027}y\u{E05C}";

?>
<a title="{$name}">
{echo $name | html}
{$name | escape}
{echo $name | escape('attr')}
'{echo $name | slashes}'
<a data-p="{^name}">


App: regression/framework - Page: escaping/html_escaping_survives_the_pipe
PHP
HTML
escaping/html_escaping_survives_the_pipe.pad
Result
{echo '<b>' | html}


App: regression/framework - Page: escaping/ignore_as_a_pipe_on_a_field
PHP
escaping/ignore_as_a_pipe_on_a_field.php
HTML
escaping/ignore_as_a_pipe_on_a_field.pad
Result
<?php

$x
= '{"a": 1, "b": "x|y=z@w"}';

?>
1[{$x | ignore}] 2[{$x | html | ignore}] 3[{echo $x | ignore}]


App: regression/framework - Page: functions/a_null_handed_along_a_pipe_chain_is_empty_to_the_next_function
PHP
HTML
functions/a_null_handed_along_a_pipe_chain_is_empty_to_the_next_function.pad
Result
[{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | trim}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | html}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | left(3)}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | replace('a', 'b')}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | url}][{echo 'https://example.com/page' | php:parse_url(@, PHP_URL_QUERY) | default('none')}]


App: regression/framework - Page: functions/html_escapes_quotes
PHP
HTML
functions/html_escapes_quotes.pad
Result
{echo '"q"' | html}


App: regression/framework - Page: functions/html_escapes_the_ampersand
PHP
HTML
functions/html_escapes_the_ampersand.pad
Result
{echo 'a&b' | html}


App: regression/framework - Page: functions/html_escapes_the_angle_brackets
PHP
HTML
functions/html_escapes_the_angle_brackets.pad
Result
{echo '<script>' | html}


App: regression/pages - Page: catalog/functions
PHP
catalog/functions.php
HTML
catalog/functions.pad
Result
<?php

// The value the stripLow line cleans: printable letters around two control characters.

$catLow = "a\x01b\x02c";

?>
after:      {echo 'a/b' | after('/')}
afterLast: {echo 'a/b/c' | afterLast('/')}
before: {echo 'a/b' | before('/')}
beforeLast: {echo 'a.b.c' | beforeLast('.')}
between: {echo 17 | between(10, 66)}.
bold: {echo 'important' | bold}
close: {echo 'items' | close | ignore}
contains: {echo 12345 | contains('34')}.
cut: {echo 'banana' | cut('an')}
encodeHigh: {echo 'café' | encodeHigh}
exists: {echo 'hello/index.pad' | exists}.
html: {echo '<b>' | html}
in: {echo 'a' | in('a')}.
left: {echo 'abcdef' | left(2)}
like: {echo 'abc' | like('a%')}.
max_len: {echo 'abcdef' | max_len(4)}
mid: {echo 'abcdef' | mid(2, 3)}
nbsp: {echo 'hello world' | nbsp}
open: {echo 'items' | open | ignore}
optional: {$catNoSuch | optional}ok
range: {echo 50 | range(0, 100)}.
replace: {echo 'abc' | replace('b', 'x')}
right: {echo 'abcdef' | right(2)}
sanitize: {echo '<b>x</b>' | sanitize}
slashes: {echo "it's" | slashes}
stripLow: {echo $catLow | stripLow}
stripslashes: {echo "it's" | slashes | stripslashes}
tag: {echo 'items' | tag | ignore}
time: {echo 1702483200 | time('Y')}
timestamp: {echo 1702483200 | timestamp('Y')}
trim: {echo ' a b ' | trim}
ucwords: {echo 'hello world' | ucwords}
white: {echo 'a b' | white}