HTML_Template_Flexy
[ class tree: HTML_Template_Flexy ] [ index: HTML_Template_Flexy ] [ all elements ]

Class: HTML_Template_Flexy_Compiler_Regex_SimpleTags

Source Location: /HTML_Template_Flexy-1.3.13/HTML/Template/Flexy/Compiler/Regex/SimpleTags.php

Class Overview


The Standard Tag filter


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods


Class Details

[line 37]
The Standard Tag filter
  • Abstract:

    does all the clever stuff...

    Security Notes: Templates should not originate from untrusted sources,

    • the method(#.....#) could be regarded as insecure.
    • there is no attempt to protect your from <script / <?php in templates.



[ Top ]


Class Variables

$engine =

[line 42]


Type:   mixed


[ Top ]

$error =  "@"

[line 55]


Type:   mixed


[ Top ]

$start =  '\{'

[line 46]


Type:   mixed


[ Top ]

$stop =  '\}'

[line 51]


Type:   mixed


[ Top ]



Method Detail

conditionals   [line 307]

string conditionals( string $input)

Conditional inclusion

This allows you to do conditional inclusion (eg. blocks!)

Maps conditions

{if:t.xxxx} => <?php if ($t->xxxx) { ?> {if:t.x_xxx()} => <?php if ($t->x_xxx()) { ?>

  • Return: the result of the filtering
  • Access: public

Parameters:

string   $input   —  the template

[ Top ]

include_template   [line 353]

string include_template( string $input)

sub template inclusion

This allows you to do include other files (either flat or generated templates.).

{include:t.abcdef} maps to <?php if($t->abcdef && file_exists($compileDir . "/". $t->abcdef . "en.php")) include($compileDir . "/". $t->abcdef . ".en.php"); ?>

include abcdef.en.php (Eg. hard coded compiled template {include:#abcdef#} => <?php if(file_exists($compileDir . "/abcdef.en.php")) include($compileDir . "/abcdef.en.php"); ?>

include raw {t_include:#abcdef.html#} => <?php if(file_exists($templateDir . "/abcdef.html")) include($compileDir . "/abcdef.html"); ?> Compile and include {q_include:#abcdef.html#} => <?php HTML_Template_Flexy::staticQuickTemplate('abcedef.html',$t); ?>

  • Return: the result of the filtering
  • Access: public

Parameters:

string   $input   —  the template

[ Top ]

looping   [line 276]

string looping( string $input)

Looping

This allows you to do loops on variables (eg. nested/ repeated blocks!)

Maps Methods {foreach:t.xyz,zzz} maps to <?php if ($i->xyz) foreach ($t->xyz as $zzz) { ?> {foreach:t.xyz,xxx,zzz} maps to <?php if ($i->xyz) foreach ($t->xyz as $xxx=>$zzz) { ?> {end:} maps to <?php }?> {else:} maps to <?php }else{?>

  • Return: the result of the filtering
  • Access: public

Parameters:

string   $input   —  the template

[ Top ]

methods   [line 202]

string methods( string $input)

Calling Methods

This allows you to call methods of your application

Maps Methods {t.xxxx_xxxx()} maps to <?php echo htmlspecialchars($t->xxxx_xxxx())?> {t.xxxx_xxxx():h} maps to <?php echo $t->xxxx_xxxx()?>

{t.xxxx_xxxx(sssss.dddd)} maps to <?php echo htmlspecialchars($t->xxxx_xxxx($ssss->dddd))?> {t.xxxx_xxxx(sssss.dddd):h} maps to <?php echo $t->xxxx_xxxx($ssss->dddd)?> {t.xxxx_xxxx(sssss.dddd):s} maps to <?php highlight_string($t->xxxx_xxxx($ssss->dddd))?>

{t.xxxx_xxxx(#XXXXX#)} maps to <?php echo htmlspecialchars($t->xxxx_xxxx('XXXXXX'))?> {t.xxxx_xxxx(#XXXXX#):h} maps to <?php echo $t->xxxx_xxxx('XXXXXX')?>

{t.xxxx_xxxx(sss.ddd,sss.ddd)} maps to <?php echo htmlspecialchars($t->xxxx_xxxx($sss->ddd,$sss->ddd))?> {t.xxxx_xxxx(#aaaa#,sss.ddd)} maps to <?php echo htmlspecialchars($t->xxxx_xxxx("aaaa",$sss->ddd))?> {t.xxxx_xxxx(sss.ddd,#aaaa#)} maps to <?php echo htmlspecialchars($t->xxxx_xxxx($sss->ddd,"aaaa"))?>

  • Return: the result of the filtering
  • Access: public

Parameters:

string   $input   —  the template

[ Top ]

urlencoded_variables   [line 148]

string urlencoded_variables( string $input)

Urlencoded Variable replacement

Often when you use a WYSISYG editor, it replaces { in the href="{somevar}" with the urlencoded version, this bit fixes it.

Maps variables %??i.xyz%?? maps to <?php echo htmlspecialchars($i->xyz)?> %??i.xyz:h%?? maps to <?php echo $i->xyz?> %??i.xyz:u%?? maps to <?php echo urlencode($i->xyz)?> %??i.xyz:ru%?? maps to <?php echo urlencode($i->xyz)?> THIS IS PROBABLY THE ONE TO USE!

%??i.xyz:uu%?? maps to <?php echo urlencode(urlencode($i->xyz))?>

  • Return: the result of the filtering
  • Access: public

Parameters:

string   $input   —  the template

[ Top ]

variables   [line 93]

string variables( string $input)

Standard Variable replacement

Maps variables {i.xyz} maps to <?php echo htmlspecialchars($i->xyz)?> {i.xyz:h} maps to <?php echo $i->xyz?> {i.xyz:u} maps to <?php echo urlencode($i->xyz)?> {i.xyz:ru} maps to <?php echo rawurlencode($i->xyz)?>

{i.xyz:r} maps to

xyz)?>
{i.xyz:n} maps to <?php echo nl2br(htmlspecialchars($i->xyz))?>

  • Return: the result of the filtering
  • Access: public

Parameters:

string   $input   —  the template

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:59:57 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.