Reference - PAD functions - after


App: manual - Page: fragments/expressions_31


App: manual - Page: fragments/expressions_34


App: regression/framework - Page: functions/a_field_inside_a_quoted_literal_reaches_a_pipe_as_its_characters
PHP
functions/a_field_inside_a_quoted_literal_reaches_a_pipe_as_its_characters.php
HTML
functions/a_field_inside_a_quoted_literal_reaches_a_pipe_as_its_characters.pad
Result
<?php

$subject
= 'Order 12, shipped';

?>
1[{echo 'Re: {$subject}' | url}] 2[{echo 'Re: {$subject}' | contains(',')}] 3[{echo 'Re: {$subject}' | replace(', ', ' - ')}] 4[{echo 'Re: {$subject}' | after(',')}] 5[{echo 'Re: {$subject}' | escape('js')}]


App: regression/framework - Page: functions/after_drops_a_multi_character_delimiter_whole
PHP
HTML
functions/after_drops_a_multi_character_delimiter_whole.pad
Result
{echo 'a--b--c' | after('--')}


App: regression/framework - Page: functions/after_takes_what_follows_the_delimiter
PHP
HTML
functions/after_takes_what_follows_the_delimiter.pad
Result
{echo 'hello/world/test' | after('/')}


App: regression/framework - Page: functions/after_with_no_delimiter_gives_the_value_back
PHP
HTML
functions/after_with_no_delimiter_gives_the_value_back.pad
Result
{echo 'abc' | after('/')}


App: regression/framework - Page: functions/an_empty_delimiter_is_found_at_the_start_after_gives_everything
PHP
HTML
functions/an_empty_delimiter_is_found_at_the_start_after_gives_everything.pad
Result
{echo 'abc' | after('')}


App: regression/framework - Page: harness/a_test_url_carries_padInclude
PHP
HTML
harness/a_test_url_carries_padInclude.pad
Result
{echo '' | php:getSuiteUrl('regression/pages', 'pairing') | after('?')}


App: regression/framework - Page: harness/the_root_index_is_the_one_test_fetched_full
PHP
HTML
harness/the_root_index_is_the_one_test_fetched_full.pad
Result
{echo '' | php:getSuiteUrl('regression/common', 'index') | after('?')}


App: regression/framework - Page: helpers/strings_after_before_and_between_cut_as_the_pipes_do
PHP
helpers/strings_after_before_and_between_cut_as_the_pipes_do.php
HTML
helpers/strings_after_before_and_between_cut_as_the_pipes_do.pad
Result
<?php

$cuts
= [];

foreach ( [ [
'a/b/c', '/' ], [ 'a::b::c', '::' ], [ 'a/b/c', 'x' ], [ 'abc', '' ], [ 'één/twee/drie', '/' ],
[
NULL, 'x' ], [ 12345, 3 ], [ '0', '0' ] ] as [ $text, $search ] )
$cuts [] = [ padStrAfter ( $text, $search ), padStrAfterLast ( $text, $search ),
padStrBefore ( $text, $search ), padStrBeforeLast ( $text, $search ) ];

$r = json_encode ( $cuts, JSON_UNESCAPED_UNICODE );

$b = json_encode ( [
padStrBetween ( 'This is my name', 'This', 'name' ),
padStrBetween ( '[a] and [b]', '[', ']' ),
padStrBefore ( padStrAfter ( '[a] and [b]', '[' ), ']' ),
padStrBetween ( 'abc', 'x', 'y' ),
padStrBetween ( 'abc', 'a', 'y' ),
padStrBetween ( 'abc', '', '' ),
padStrBetween ( NULL, 'a', 'b' )
],
JSON_UNESCAPED_UNICODE );

$path = 'shop/orders/list.pad';

?>
{!r}
{!b}
[{$path | after('/')}|{$path | afterLast('/')}|{$path | before('/')}|{$path | beforeLast('/')}]
[{echo padStrAfter ( $path, '/' )}|{echo padStrAfterLast ( $path, '/' )}|{echo padStrBefore ( $path, '/' )}|{echo padStrBeforeLast ( $path, '/' )}]


App: regression/framework - Page: helpers/strings_the_slug_after_and_before_pipes_answer_as_they_did
PHP
helpers/strings_the_slug_after_and_before_pipes_answer_as_they_did.php
HTML
helpers/strings_the_slug_after_and_before_pipes_answer_as_they_did.pad
Result
<?php

$texts
= [ 'Crème Brûlée & Co.', ' Hello, World! ', 'a/b::c/d', '', '0', 'Ελληνικά & Ӄириллица', "tab\there", 'ÆØÅ æøå ß', '--a--b--', 'x/y' ];

?>
{texts}
[{$texts | slug}|{$texts | slug('_')}|{$texts | slug('')}|{$texts | after('/')}|{$texts | afterLast('/')}|{$texts | before('/')}|{$texts | beforeLast('/')}|{$texts | after('::')}|{$texts | beforeLast('zz')}]
{/texts}
[{echo 12345 | after(3)}|{echo 12345 | before(3)}|{echo 'abc' | after('')}|{echo 'abc' | afterLast('')}|{echo 'abc' | before('')}|{echo 'abc' | beforeLast('')}]


App: regression/framework - Page: lenient/a_list_handed_to_a_pipe_function_as_its_parameter_is_empty
PHP
lenient/a_list_handed_to_a_pipe_function_as_its_parameter_is_empty.php
HTML
lenient/a_list_handed_to_a_pipe_function_as_its_parameter_is_empty.pad
Result
<?php

// The lenient walk: a list where a pipe function wants a value as its parameter is empty.

$padCheckSyntax = FALSE;

?>
1[{echo 'abc' | contains(['a'])}] 2[{echo 'abc' like ['a']}] 3[{echo 'abc' | matches(['a'])}] 4[{echo 'abc' | after(['a'])}] 5[{echo 'abc' | left([1])}] 6[{echo 'abc' | truncate([2])}] 7[{echo 'abc' | escape(['js'])}] 8[{echo 'b' | between(['a'], 'z')}]


App: regression/framework - Page: tags/asset_takes_a_field_inside_its_quoted_name_as_its_characters
PHP
tags/asset_takes_a_field_inside_its_quoted_name_as_its_characters.php
HTML
tags/asset_takes_a_field_inside_its_quoted_name_as_its_characters.pad
Result
<?php

// A field written inside the quoted name of {asset} - and of {img} and {video}, which
// check their file the same way - is the name it holds: the @ of logo@2x.css came as its
// stand-in, and the name was refused as no file name below www/<application>/. The
// fixture is www/regression/framework/assets/logo@2x.css.

$f = 'logo@2x.css';

?>
{asset 'assets/{$f}' | after('framework/')} | {asset 'assets/{$f}', tag | after('framework/')}


App: regression/framework - Page: tags/asset_writes_the_address_with_a_hash_of_the_contents
PHP
tags/asset_writes_the_address_with_a_hash_of_the_contents.php
HTML
tags/asset_writes_the_address_with_a_hash_of_the_contents.pad
Result
<?php

// The fixtures are www/regression/framework/assets/case.css, case.js and case.mjs. The
// version is the start of the contents' hash; a policy that asks for a nonce gets it on
// the element. The addresses are shown from the application on: the mount prefix before
// it is the server's.

$same = ( padAsset ( 'assets/case.css' ) == $padRoot . 'regression/framework/assets/case.css?v='
. substr ( hash_file ( 'xxh128', dirname ( APPS ) . '/www/regression/framework/assets/case.css' ), 0, 10 ) )
?
'the hash of the contents' : 'another hash';

$cspWas = $padCsp;
$padCsp = "script-src 'nonce'";
$nonced = str_replace ( [ padNonce (), $padRoot ], [ 'NONCE', '/' ], padAssetTag ( 'assets/case.mjs' ) );
$padCsp = $cspWas;

?>
{$same} | {asset 'assets/case.css' | after('framework/')} | {asset 'assets/case.js', tag | after('framework/')} | {asset 'assets/case.css', tag | after('framework/')} | {!nonced}


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}