preparation release

This commit is contained in:
nojhan 2008-01-31 21:24:09 +00:00
commit f5e3a62ee8
196 changed files with 64314 additions and 0 deletions

View file

@ -0,0 +1,32 @@
<?php
/* Mini test suite */
require_once 'HTML/Template/Flexy.php';
//print_r($_SERVER['argv']);
if (!isset($_SERVER['argv'][1])) {
$files = array(dirname(__FILE__) . '/index.tpl');
} else {
$files =$_SERVER['argv'];
array_shift($files);
}
//print_r($files);
foreach($files as $file) {
$dir = dirname($file);
$x = new HTML_Template_Flexy(array(
'compileDir' => dirname(__FILE__) , // where do you want to write to..
'templateDir' => $dir , // where are your templates
'locale' => 'en', // works with gettext
'forceCompile' => true, // only suggested for debugging
'debug' => false, // prints a few errors
'nonHTML' => false, // dont parse HTML tags (eg. email templates)
'allowPHP' => false, // allow PHP in template
'compiler' => 'SmartyConvertor', // which compiler to use.
'compileToString' => true, // returns the converted template (rather than actually
// converting to PHP.
'filters' => array(), // used by regex compiler..
'numberFormat' => ",2,'.',','", // default number format = eg. 1,200.00 ( {xxx:n} )
'flexyIgnore' => 0 // turn on/off the tag to element code
));
echo $x->compile(basename($file));
}

View file

@ -0,0 +1,11 @@
<span id="block1">
This is block 1
</span>
<span id="block2">
This is block 2
</span>

View file

@ -0,0 +1,122 @@
-------------------------
Dear Administrator,
-- Automatically Generated Email from XXXXXXXXXX --
{if:hasmessage}
*NOTE*: {message:h}.
{end:}
O R D E R A W A I T I N G A U T H O R I S A T I O N
_________________________________________________________________
ORDER:
ID: {order.h}
*Edit*: http://{host}/admin/sales/orders/edit?id={order}
_________________________________________________________________
CUSTOMER DETAILS:
Name: {customer.firstname:h} {customer.lastname:h}
Email: mailto:{customer.email:h}
*Edit*: http://{host}/admin/sales/customers/edit?id={customer.id}
_________________________________________________________________
SHIPPING TO:
*{deliveryname:h}*
{deliveryaddress:h}
_________________________________________________________________
XXXXXXXXXXXXXXXXXXX:
*{post.transactionstatus:h}*
{if:post.dubious}
*WARNING*! - This may not be a bona fide order! - *WARNING*!
*Reason*: {post.dubiousreason:h}
/Contact tech support/ before proceeding with this order!
{end:}
Total (currency?): {post.total:h}
Client ID (XXXXXXXX): {post.clientid:h}
Order ID: {post.oid:h}
Charge type: {post.chargetype:h}
Timestamp (from XXXXXXXX): {post.datetime:h}
VbV Status: {post.ecistatus:h}
https://XXXXX.XXXXXXXX.XXXXXX.com/XXXXX/XXXXXXX/XXXXXx
_________________________________________________________________
{foreach:orderlines,i,o}
{if:i}
- - - - - - - - - - - - - - - - - - - - - - - -
{end:}
*PRODUCT*:{o.productname:h}
({o.producttypename:h})
*Edit*: http://{host}/admin/catalog/products/edit?id={o.product:u}
FABRIC: {o.fabricname:h}
SIZE: {o.sizename:h}
Eurostop: {o.altid:h}
QUANTITY: {o.quantity:h}
Price ea: {o.eachprice:h}
Tax each: {o.eachtax:h}
Sub-total: {o.totalinctax:h}
{if:o.isgift}
*GIFT MESSAGE* FOR THIS ITEM:
{o.giftmessage}{end:}{end:}
_________________________________________________________________
Item total (ex tax): {totals.itemstotal:h}
Item taxes: {totals.itemstax:h}
Shipping:
{totals.shippingcharges:h}
Tax on shipping: {totals.shippingtax:h}
*GRAND TOTAL*: {totals.grandtotal:h}
_________________________________________________________________
{totals.itemsdiscountinfo:h}
{totals.itemstaxinfo:h}
{totals.shippinginfo:h}
{totals.shippingtaxinfo:h}
_________________________________________________________________
blah blah
--------------------------

View file

@ -0,0 +1,46 @@
<H2>Conditions</H2>
<p>a condition {if:condition} hello {else:} world {end:}</p>
<p>a negative condition {if:!condition} hello {else:} world {end:}</p>
<p>a conditional method {if:condition()} hello {else:} world {end:}</p>
<p>a negative conditional method {if:!condition()} hello {else:} world {end:}</p>
<span flexy:if="test">test</span>
<span flexy:if="test()">test</span>
<span flexy:if="test(#aaa bbb#,ccc,#asdfasdf asdf #)">test</span>
<H2>Notices and errros</H2>
<table flexy:if="notices" class="tablenotice" width="70%" align="center">
<tbody>
<tr>
<td class="tdheadernotice" height="20" width="526">Thanks</td>
</tr>
<tr>
<td class="tdbodynotice" height="33">
<p flexy:if="notices[ok]">Submitted data is ok</p>
</td>
</tr>
</tbody>
</table>
<table flexy:if="errors" class="tablewarning" width="100%">
<tbody>
<tr>
<td class="tdheaderwarning" height="20" width="526">Sorry</td>
</tr>
<tr>
<td class="tdbodywarning">
<li flexy:if="errors[lastname]">Please fill in your last name</li>
</td>
</tr>
</tbody>
</table>

View file

@ -0,0 +1,8 @@
<!-- Bugs: 739
<td flexy:foreach="xxxx">xxx</td>
{foreach:xxxx} {end:}
-->

View file

@ -0,0 +1,40 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<flexy:toJavascript
flexy:prefix="test_abc_"
abcg="xyz"
abcd="xyz"
srcXxx="xyz"
>
<script type="text/javascript">
var test_abc_abcg = '123';
var test_abc_abcd = '123';
var test_abc_srcXxx = '123';
</script>
</flexy:toJavascript>
<flexy:toJavascript abcg="xyz">
<script type="text/javascript">
var xyz = '123';
</script>
</flexy:toJavascript>
<body>
<p>Example of flexy:toJavascript with default values.</p>
</body></html>

View file

@ -0,0 +1,107 @@
<h2>Form Not Parsed</h2>
<form name="test" flexy:ignore>
<input name=test123>
<select name="aaa">
<option>bb</option>
</select>
</form>
<h2>Parsed</h2>
<form name="test">
Input<input name=test123>
Checkbox <input name=test123a id=test123ab type='checkbox' checked>
Hidden <input name=test123ab type='hidden' value='123'>
<textarea name="fred">some text</textarea>
<select name="aaa1">
<option>aa</option>
<option selected>bb</option>
<option>cc</option>
</select>
<select name="aaa2" flexy:ignore>
<option>aa</option>
<option selected>bb</option>
<option>cc</option>
</select>
<select name="aaa3">
<option>aa</option>
<option selected>bb</option>
<option>cc</option>
</select>
<!-- bug 5267 -->
<input id="opt_1" type="checkbox" name="opt[]" value="1" />
<label for="opt_1">option 1</label>
<input id="opt_2" type="checkbox" name="opt[]" value="2" />
<label for="opt_3">option 2</label>
<input id="opt_3" type="checkbox" name="opt[]" value="3" />
<label for="opt_3">option 3</label>
<select name="List">
<option value="2000">2000</option>
<option value="2001">2001</option>
<option value="2002">2002</option>
</select>
<input type="submit" name="_submit[4]" value="Next >>">
<input type="submit" name="_submit[5]" value="Next &gt;&gt;">
<input type="file" name="testupload">
#bug bug6058
<br /><input type="radio" name="payment_1_type" id="1" value="cc" />
Credit card
<br /><input type="radio" name="payment_1_type" id="2" value="cq" />
Cheque
<br /><input type="radio" name="payment_2_type" id="3" value="cc" />
Credit card
<br /><input type="radio" name="payment_2_type" id="4" value="cq" />
Cheque
</form>
<img name="picture" id="picture" flexy:dynamic>
<h2>Bug 1120:</h2>
<form action="test">
<input name="testing" value="test">
<input type="submit" value="x" name="_submit[2]">
</form>
<form action="{someurl}">
<input name="testing2" value="{somevalue}">
<input type="submit" name="_submit[1]">
</form>
<H2> Bug 1275 XHTML output </H2>
<input type="checkbox" name="testingxhtml" flexy:xhtml="true" checked>
<select name="xhtmllisttest" flexy:xhtml="true">
</select>
<H2> Bug 4005 Checkboxes </H2>
<input type="checkbox" name="testingcheckbox" value="123">
<form name="test_mix" action="{someurl}">
<input name="testing5" value="{somevalue}">
<input type="submit" name="_submit[3]">
</form>

View file

@ -0,0 +1,17 @@
<H1>Example of function block definitions</H1>
<table flexy:if="false">
<tr><td>
<flexy:function name="test1">this is the contents of test1</flexy:function>
</td></tr>
</table>
<table>
<tr><td>
<flexy:function call="test1"></flexy:function>
<flexy:function call="{a_value}"></flexy:function>
</td></tr>
</table>

View file

@ -0,0 +1,26 @@
<H2>GLOBALS:</H2>
{_SESSION[hello]} <BR>
{_GET[fred]} <BR>
{GLOBALS[abc]} <BR>
<H2>Privates:</H2>
{_somemethod()} <BR>
{_somevar} <BR>
<H2>Global methods </H2>
{GLOBALS.date(#d/m/y#)} <BR>
{if:GLOBALS.is_array(test)} <BR>
{end:} <BR>
<BR>
{foreach:atest,k,v} <BR>
{if:GLOBALS.is_array(v)} <BR>
{end:} <BR>
{end:} <BR>

View file

@ -0,0 +1,22 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"><title>image_view.html</title></head>
<body flexy:startchildren="yes">
<table cellpadding="2" cellspacing="2" border="0" bgcolor="black" style="text-align: left; width: 100%;">
<tbody>
<tr flexy:foreach="images,row">
<td flexy:foreach="row,col" align="center" valign="middle"
background="{rootURL}/FlexyWiki/templates/negative.jpg"><a
href="%7Bcol.link%7D"><img
border="0" height="{col.info[1]}" width="{col.info[0]}" src="%7Bcol.url%7D"></a><br>
<font color="white">[{col.name}] {col.size}Mb</font>
</td>
</tr>
</tbody>
</table>
</body></html>

View file

@ -0,0 +1,13 @@
<html>
<body>
the variable is {foo}
<table>
<tr flexy:foreach="range,key,value">
<flexy:include src="include_block.html" />
</tr>
</table>
</body>
</html>

View file

@ -0,0 +1,78 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src='somefile/{js_file}'></script>
</head>
<script language="javascript">
// some sample javascript that might cause problemss
function CheckDuplicates (AddListContainer, RemoveListContainer) {
var AddList = eval('document.main_form.'+AddListContainer);
var RemoveList = eval('document.main_form.'+RemoveListContainer);
var TempAddList = AddList.value;
var TempRemoveList = RemoveList.value;
if (TempAddList>''&&TempRemoveList>'') {
TempAddList = TempAddList.substring(0,TempAddList.length-1);
}
}
//<!--
function CheckDuplicates2 (AddListContainer, RemoveListContainer) {
var AddList = eval('document.main_form.'+AddListContainer);
var RemoveList = eval('document.main_form.'+RemoveListContainer);
var TempAddList = AddList.value;
var TempRemoveList = RemoveList.value;
if (TempAddList>''&&TempRemoveList>'') {
TempAddList = TempAddList.substring(0,TempAddList.length-1);
}
}
-->
</script>
<!--
// and now just commented out stuff.. that may cause problems
function CheckDuplicates (AddListContainer, RemoveListContainer) {
var AddList = eval('document.main_form.'+AddListContainer);
var RemoveList = eval('document.main_form.'+RemoveListContainer);
var TempAddList = AddList.value;
var TempRemoveList = RemoveList.value;
if (TempAddList>''&&TempRemoveList>'') {
TempAddList = TempAddList.substring(0,TempAddList.length-1);
}
}
-->
<script type="application/x-javascript" src="js/common.js"></script>
<script type="application/x-javascript" src="../searchjs.php"></script>
<script type="application/x-javascript" src="js/catctrl.js"></script>
<script type="application/x-javascript">
function productAddApply() {
req = new phpRequest(URI_CONTROL + "/New/product");
req.add("product_category", get_value("listProdCat"));
req.add("item_category", get_value("listItemCat"));
req.add("item_subcategory", get_value("listItemSubCat"));
req.add("supplier_id", get_value("listSupplier"));
req.add("supplier_model_numb", get_value("txtSupModelNo"));
req.add("article", get_value("txtArtDescr"));
req.add("material", get_value("txtMaterial"));
req.add("color", get_value("txtColor"));
}
</script>
<body>
</body>
</html>

View file

@ -0,0 +1,59 @@
<h2>Looping</h2>
<p>a loop {foreach:loop,a} {a} {end:}</p>
<p>a loop with 2 vars {foreach:loop,a,b}
{a} ,
{b}
{end:}</p>
Bug #84
{foreach:list,i}
{method(i)}
{end:}
{foreach:list,i,j}
{i}:{j}
{end:}
<table>
<tr flexy:foreach="xyz,abcd,def">
<td>{abcd}, {test(def)}</td>
</tr>
</table>
<h2>HTML tags example using foreach=&quot;loop,a,b&quot; or the tr</h2>
<table width="100%" border="0">
<tr flexy:foreach="loop,a,b">
<td>{a}</td>
<td>{b}</td>
</tr>
</table>
<h2>HTML tags example using foreach=&quot;loop,a&quot; or the tr using a highlight class.</h2>
<table width="100%" border="0">
<tr flexy:foreach="loop,a" class="{a.hightlight}">
<td>a is</td>
<td flexy:if="a.showtext">{a.text}</td>
<td flexy:if="!a.showtext">{a.price:n}</td>
</tr>
</table>
<h2>HTML tags example using foreach=&quot;loop,a,b&quot; or the tr</h2>
<table width="100%" border="0">
<tr flexy:foreach="loop,a,b">
<td flexy:foreach="b,c,d">{d}</td>
</tr>
</table>
<h2>Looping in CDATA</h2>
Dont forget that php strips line breaks!
<![CDATA[
{foreach:list,i,j}
{i}:{j}
{end:}
]]>

View file

@ -0,0 +1,69 @@
<h2>Methods</H2>
<p>Calling a method {a.helloWorld()}</p>
<p>or {includeBody():h}</P>
<img src="%7bgetImageDir()%7D/someimage.jpg">
<img src="%7bgetImageDir():h%7D/someimage.jpg">
<img src="%7bgetImageDir():u%7D/someimage.jpg">
<img src="%7bgetImageDir()}/someimage.jpg">
<img src="{getImageDir()%7D/someimage.jpg">
<span class="{t.getBgnd(valueArr[isConfigurable])}"></span>
<h2>Full Method testing</h2>
{abc(abc,def,hij)}
{abc(abc,#def#,#hij#)}
{abc(abc,def,#hij#)}
{abc(#abc#,def,hij)}
{abc(abc,def,hij):h}
{abc(abc,#def#,#hij#):h}
{abc(abc,def,#hij#):h}
{abc(#abc#,def,hij):h}
{abc(abc,def,hij):u}
{abc(abc,#def#,#hij#):u}
{abc(abc,def,#hij#):u}
{abc(#abc#,def,hij):u}
{abc(123,def,hij)}
{abc(abc,#123#,123):u}
{abc(abc,def,123)}
{abc(#abc#,123,hij):u}
<h2>Real life method testing </h2>
Invoice number: {t.getelem(t.invoice,#number#)} Place:
{t.getelem(t.invoice,#place#)} Date: {t.getelem(t.invoice,#date#)} Payment:
{t.getelem(t.invoice,#payment#)} Payment date:
{t.getelem(t.invoice,#payment_date#)} Seller: Name 1:
{t.getelem(t.seller,#name1#)} Name 2: {t.getelem(t.seller,#name2#)} NIP:
{t.getelem(t.seller,#nip#)} Street: {t.getelem(t.seller,#street#)} City:
{t.getelem(t.seller,#code#)} {t.getelem(t.seller,#city#)} Buyer: Name 1:
{t.getelem(t.buyer,#name1#)} Name 2: {t.getelem(t.buyer,#name2#)} NIP:
{t.getelem(t.buyer,#nip#)} Street: {t.getelem(t.buyer,#street#)} City:
{t.getelem(t.buyer,#code#)} {t.getelem(t.buyer,#city#)}
# Name {if:t.show_pkwiu} PKWIU{end:} Count Netto VAT Brutto
{foreach:t.positions,position} {t.getelem(position,#nr#)}
{t.getelem(position,#name#)} {if:t.show_pkwiu}
{t.getelem(position,#pkwiu#)}{end:} {t.getelem(position,#count#)}
{t.getelem(position,#netto#)} {t.getelem(position,#vat#)}
{t.getelem(position,#brutto#)}
{end:} {if:t.edit_positions} # Name {if:t.show_pkwiu} PKWIU{end:} Count
{if:t.getelem(position,#netto_mode#)} Netto{else:} {end:} VAT
{if:t.getelem(position,#netto_mode#)} {else:} Brutto{end:}
{foreach:t.edit_positions,k,position} {t.getelem(position,#nr#)}
{if:t.show_pkwiu} {end:} {if:t.getelem(position,#netto_mode#)} {else:}
{end:} {if:t.getelem(position,#netto_mode#)} {else:} {end:}
{end:} {end:} #
{foreach:t.sum,sum} {t.getelem(sum,#nr#)} {t.getelem(sum,#netto#)}
{t.getelem(sum,#vat#)} {t.getelem(sum,#brutto#)}
{end:}

View file

@ -0,0 +1,68 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="images/css/test.css" type="text/css"?>
<window id="wndUserResults"
title="User Search Results"
persist="screenX screenY width height"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<tree id="userSearchResults" flex="1" height="300" enableColumnDrag="true" ondblclick="parent.parent.userEditPopup();">
<treecols>
<treecol flex="2" id="trcName" label="Name" primary="true" persist="width ordinal hidden"/>
<splitter class="tree-splitter"/>
<treecol flex="1" id="trcGroupName" label="Group Name" persist="width ordinal hidden"/>
</treecols>
<treechildren>
<treeitem flexy:foreach="sresult,id,data">
<treerow>
<treecell label="{data.name}"/>
<treecell label="{data.group_name}"/>
<treecell label="{data.user_id}"/>
</treerow>
</treeitem>
</treechildren>
</tree>
<html:form name="test">
<html:input name="test2">
<html:table>
<html:tr>
<html:td>
<label style="text-align: left;" control="listItemSubCat" value="Item Subcategory"/>
</html:td>
</html:tr>
</html:table>
</html:form>
<html:select name="atest">
<html:option flexy:foreach="categories,data" value="{data.value}"
onselect="parent.onSelect_ProdCat();">{data.name}</html:option>
</html:select>
<!-- example of how to make the above work correctly.. -->
<html:select name="atest" flexy:ignore="yes">
<html:option flexy:foreach="categories,data" value="{data.value}"
onselect="parent.onSelect_ProdCat();">{data.name}</html:option>
</html:select>
<!-- test toElement -->
<menulist id="supplier_id">
<menupopup>
<menuitem id="itemSubCatAll" label="-- Select --" value="0"/>
</menupopup>
</menulist>
<!-- test using flexy stuff -->
<menulist id="supplier_id2">
<menupopup>
<menuitem flexy:foreach="x,y" id="itemSubCatAll" label="{y.name}" value="{y.value}"/>
</menupopup>
</menulist>
<!-- test args on menupopup -->
<menulist id="product_category">
<menupopup onpopuphiding="cTree.categorySelect(this.parentNode.value,1);">
<menuitem id="prodCatAll" label="-- All --" value="0" />
</menupopup>
</menulist>
</window>

View file

@ -0,0 +1,14 @@
<H1>Testing Plugin Modifiers</H1>
{datetest:dateformat}
{numbertest:numberformat}
Bug #3946 - inside raw!
<input type="checkbox" name="useTextarea3" flexy:ignore="yes"
flexy:raw="{person.useTextarea():checked}">

View file

@ -0,0 +1,12 @@
<? for($i=0;$i<10;$i++) { ?>
number: <?=$i?>
<?php } ?>
<script language="php">
for($i=0;$i<10;$i++) {
echo "hello world\n";
}
</script>

View file

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<body>
<h2>Example Template for HTML_Template_Flexy</h2>
a full string example ~!@#$%^&*() |": ?\][;'/.,=-_+ ~` abcd....
asfasfdas
<h2>Bugs: 809 Comments:</h2>
<!--- this is a comment with alot of stuff.. --# ---->
<!-- this is a comment with alot of stuff.. --# -- -->
</body>
</html>

View file

@ -0,0 +1,31 @@
<link rel="stylesheet" type="text/css" media="print"
href="{ROOT_CSS}/print.css">
<link rel="stylesheet" type="text/css" media="screen"
href="{ROOT_CSS}/compatible.css">
<style type="text/css" media="screen">
<!--
@import url({ROOT_CSS}/main.css);
.tdbodywarningCopy {
background-color: #eecccc;
FONT-FAMILY: arial, geneva, helvetica, sans-serif;
font-size : 10px;
COLOR: #000000;
padding: 0px;
border: 0px dashed #000000;
}
-->
</style>

View file

@ -0,0 +1,39 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<body>
<p>Example Template for HTML_Template_Flexy</p>
<h2>Variables</H2>
<p>Standard variables
{hello}
{world:h}
{test:u}
{object.var}
{array[0]}
{array[entry]}
{multi[array][0]}
{object.var[array][1]}
{object.var[array][1]:r}
{object.var[array][1]:h}
{object.var[array][-1]:h}
{object[array].with[objects]}
Long string with NL2BR + HTMLSPECIALCHARS
{longstring:b}
Everything: {t:r}
an Object: {object:r}
<img src="%7bgetImageDir%7D/someimage.jpg">
<img src="%7bgetImageDir:h%7D/someimage.jpg">
<img src="%7bgetImageDir:u%7D/someimage.jpg">
<img src="%7bgetImageDir}/someimage.jpg">
<img src="{getImageDir%7D/someimage.jpg">
</p>
</body>
</html>

View file

@ -0,0 +1,39 @@
--TEST--
Template Test: blocks.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('blocks.html');
--EXPECTF--
===Compiling blocks.html===
===Compiled file: blocks.html===
<span id="block1">
This is block 1
</span>
<span id="block2">
This is block 2
</span>
===With data file: blocks.html===
<span id="block1">
This is block 1
</span>
<span id="block2">
This is block 2
</span>

View file

@ -0,0 +1,197 @@
--TEST--
Template Test: bug_2959.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('bug_2959.html');
--EXPECTF--
===Compiling bug_2959.html===
===Compiled file: bug_2959.html===
-------------------------
Dear Administrator,
-- Automatically Generated Email from XXXXXXXXXX --
<?php if ($t->hasmessage) {?>
*NOTE*: <?php echo $t->message;?>.
<?php }?>
O R D E R A W A I T I N G A U T H O R I S A T I O N
_________________________________________________________________
ORDER:
ID: <?php echo htmlspecialchars($t->order->h);?>
*Edit*: http://<?php echo htmlspecialchars($t->host);?>/admin/sales/orders/edit?id=<?php echo htmlspecialchars($t->order);?>
_________________________________________________________________
CUSTOMER DETAILS:
Name: <?php echo $t->customer->firstname;?> <?php echo $t->customer->lastname;?>
Email: mailto:<?php echo $t->customer->email;?>
*Edit*: http://<?php echo htmlspecialchars($t->host);?>/admin/sales/customers/edit?id=<?php echo htmlspecialchars($t->customer->id);?>
_________________________________________________________________
SHIPPING TO:
*<?php echo $t->deliveryname;?>*
<?php echo $t->deliveryaddress;?>
_________________________________________________________________
XXXXXXXXXXXXXXXXXXX:
*<?php echo $t->post->transactionstatus;?>*
<?php if ($t->post->dubious) {?>
*WARNING*! - This may not be a bona fide order! - *WARNING*!
*Reason*: <?php echo $t->post->dubiousreason;?>
/Contact tech support/ before proceeding with this order!
<?php }?>
Total (currency?): <?php echo $t->post->total;?>
Client ID (XXXXXXXX): <?php echo $t->post->clientid;?>
Order ID: <?php echo $t->post->oid;?>
Charge type: <?php echo $t->post->chargetype;?>
Timestamp (from XXXXXXXX): <?php echo $t->post->datetime;?>
VbV Status: <?php echo $t->post->ecistatus;?>
https://XXXXX.XXXXXXXX.XXXXXX.com/XXXXX/XXXXXXX/XXXXXx
_________________________________________________________________
<?php if ($this->options['strict'] || (is_array($t->orderlines) || is_object($t->orderlines))) foreach($t->orderlines as $i => $o) {?>
<?php if ($i) {?>
- - - - - - - - - - - - - - - - - - - - - - - -
<?php }?>
*PRODUCT*:<?php echo $o->productname;?>
(<?php echo $o->producttypename;?>)
*Edit*: http://<?php echo htmlspecialchars($t->host);?>/admin/catalog/products/edit?id=<?php echo urlencode($o->product);?>
FABRIC: <?php echo $o->fabricname;?>
SIZE: <?php echo $o->sizename;?>
Eurostop: <?php echo $o->altid;?>
QUANTITY: <?php echo $o->quantity;?>
Price ea: <?php echo $o->eachprice;?>
Tax each: <?php echo $o->eachtax;?>
Sub-total: <?php echo $o->totalinctax;?>
<?php if ($o->isgift) {?>
*GIFT MESSAGE* FOR THIS ITEM:
<?php echo htmlspecialchars($o->giftmessage);?><?php }?><?php }?>
_________________________________________________________________
Item total (ex tax): <?php echo $t->totals->itemstotal;?>
Item taxes: <?php echo $t->totals->itemstax;?>
Shipping:
<?php echo $t->totals->shippingcharges;?>
Tax on shipping: <?php echo $t->totals->shippingtax;?>
*GRAND TOTAL*: <?php echo $t->totals->grandtotal;?>
_________________________________________________________________
<?php echo $t->totals->itemsdiscountinfo;?>
<?php echo $t->totals->itemstaxinfo;?>
<?php echo $t->totals->shippinginfo;?>
<?php echo $t->totals->shippingtaxinfo;?>
_________________________________________________________________
blah blah
--------------------------
===With data file: bug_2959.html===
-------------------------
Dear Administrator,
-- Automatically Generated Email from XXXXXXXXXX --
O R D E R A W A I T I N G A U T H O R I S A T I O N
_________________________________________________________________
ORDER:
ID:
*Edit*: http:///admin/sales/orders/edit?id=
_________________________________________________________________
CUSTOMER DETAILS:
Name:
Email: mailto:
*Edit*: http:///admin/sales/customers/edit?id=
_________________________________________________________________
SHIPPING TO:
**
_________________________________________________________________
XXXXXXXXXXXXXXXXXXX:
**
Total (currency?):
Client ID (XXXXXXXX):
Order ID:
Charge type:
Timestamp (from XXXXXXXX):
VbV Status:
https://XXXXX.XXXXXXXX.XXXXXX.com/XXXXX/XXXXXXX/XXXXXx
_________________________________________________________________
_________________________________________________________________
Item total (ex tax):
Item taxes:
Shipping:
Tax on shipping:
*GRAND TOTAL*:
_________________________________________________________________
_________________________________________________________________
blah blah
--------------------------

View file

@ -0,0 +1,75 @@
--TEST--
Template Test: conditions.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('conditions.html');
--EXPECTF--
===Compiling conditions.html===
===Compiled file: conditions.html===
<H2>Conditions</H2>
<p>a condition <?php if ($t->condition) {?> hello <?php } else {?> world <?php }?></p>
<p>a negative condition <?php if (!$t->condition) {?> hello <?php } else {?> world <?php }?></p>
<p>a conditional method <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'condition'))) if ($t->condition()) { ?> hello <?php } else {?> world <?php }?></p>
<p>a negative conditional method <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'condition'))) if (!$t->condition()) { ?> hello <?php } else {?> world <?php }?></p>
<?php if ($t->test) {?><span>test</span><?php }?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'test'))) if ($t->test()) { ?><span>test</span><?php }?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'test'))) if ($t->test("aaa bbb",$t->ccc,"asdfasdf asdf ")) { ?><span>test</span><?php }?>
<H2>Notices and errros</H2>
<?php if ($t->notices) {?><table class="tablenotice" width="70%" align="center">
<tbody>
<tr>
<td class="tdheadernotice" height="20" width="526">Thanks</td>
</tr>
<tr>
<td class="tdbodynotice" height="33">
<?php if ($t->notices['ok']) {?><p>Submitted data is ok</p><?php }?>
</td>
</tr>
</tbody>
</table><?php }?>
<?php if ($t->errors) {?><table class="tablewarning" width="100%">
<tbody>
<tr>
<td class="tdheaderwarning" height="20" width="526">Sorry</td>
</tr>
<tr>
<td class="tdbodywarning">
<?php if ($t->errors['lastname']) {?><li>Please fill in your last name</li><?php }?>
</td>
</tr>
</tbody>
</table><?php }?>
===With data file: conditions.html===
<H2>Conditions</H2>
<p>a condition world </p>
<p>a negative condition hello </p>
<p>a conditional method </p>
<p>a negative conditional method </p>
<H2>Notices and errros</H2>

View file

@ -0,0 +1,31 @@
--TEST--
Template Test: error_foreach.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('error_foreach.html');
--EXPECTF--
===Compiling error_foreach.html===
===Compiled file: error_foreach.html===
<!-- Bugs: 739
<td flexy:foreach="xxxx">xxx</td>
{foreach:xxxx} {end:}
-->
===With data file: error_foreach.html===
<!-- Bugs: 739
<td flexy:foreach="xxxx">xxx</td>
{foreach:xxxx} {end:}
-->

View file

@ -0,0 +1,73 @@
--TEST--
Template Test: flexy_tojavascript.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('flexy_tojavascript.html');
--EXPECTF--
===Compiling flexy_tojavascript.html===
===Compiled file: flexy_tojavascript.html===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php require_once 'HTML/Javascript/Convert.php';?>
<script type='text/javascript'>
<?php $__tmp = HTML_Javascript_Convert::convertVar($t->xyz,'test_abc_abcg',true);echo (is_a($__tmp,"PEAR_Error")) ? ("<pre>".print_r($__tmp,true)."</pre>") : $__tmp;?>
<?php $__tmp = HTML_Javascript_Convert::convertVar($t->xyz,'test_abc_abcd',true);echo (is_a($__tmp,"PEAR_Error")) ? ("<pre>".print_r($__tmp,true)."</pre>") : $__tmp;?>
<?php $__tmp = HTML_Javascript_Convert::convertVar($t->xyz,'test_abc_srcXxx',true);echo (is_a($__tmp,"PEAR_Error")) ? ("<pre>".print_r($__tmp,true)."</pre>") : $__tmp;?>
</script>
<?php require_once 'HTML/Javascript/Convert.php';?>
<script type='text/javascript'>
<?php $__tmp = HTML_Javascript_Convert::convertVar($t->xyz,'abcg',true);echo (is_a($__tmp,"PEAR_Error")) ? ("<pre>".print_r($__tmp,true)."</pre>") : $__tmp;?>
</script>
<body>
<p>Example of flexy:toJavascript with default values.</p>
</body></html>
===With data file: flexy_tojavascript.html===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type='text/javascript'>
test_abc_abcg = null;
test_abc_abcd = null;
test_abc_srcXxx = null;
</script>
<script type='text/javascript'>
abcg = null;
</script>
<body>
<p>Example of flexy:toJavascript with default values.</p>
</body></html>

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,43 @@
--TEST--
Template Test: function.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('function.html');
--EXPECTF--
===Compiling function.html===
===Compiled file: function.html===
<?php
function _html_template_flexy_compiler_flexy_flexy_test1($t,$this) {
?>this is the contents of test1<?php
}
?>
<H1>Example of function block definitions</H1>
<?php if ($t->false) {?><table>
<tr><td>
</td></tr>
</table><?php }?>
<table>
<tr><td>
<?php if (function_exists('_html_template_flexy_compiler_flexy_flexy_test1')) _html_template_flexy_compiler_flexy_flexy_test1($t,$this);?>
<?php if (function_exists('_html_template_flexy_compiler_flexy_flexy_'.$t->a_value)) call_user_func_array('_html_template_flexy_compiler_flexy_flexy_'.$t->a_value,array($t,$this));?>
</td></tr>
</table>
===With data file: function.html===
<H1>Example of function block definitions</H1>
<table>
<tr><td>
this is the contents of test1 </td></tr>
</table>

View file

@ -0,0 +1,12 @@
--TEST--
Template Test: globals.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('globals.html');
--EXPECTF--
===Compiling globals.html===
===Compile failure==
[pear_error: message="HTML_Template_Flexy fatal error:HTML_Template_Flexy::Attempt to access private variable: on line %d of %s, Use options[privates] to allow this." code=-1 mode=return level=notice prefix="" info=""]

View file

@ -0,0 +1,37 @@
--TEST--
Template Test: image_view.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('image_view.html');
--EXPECTF--
===Compiling image_view.html===
===Compiled file: image_view.html===
<table cellpadding="2" cellspacing="2" border="0" bgcolor="black" style="text-align: left; width: 100%;">
<tbody>
<?php if ($this->options['strict'] || (is_array($t->images) || is_object($t->images))) foreach($t->images as $row) {?><tr>
<?php if ($this->options['strict'] || (is_array($row) || is_object($row))) foreach($row as $col) {?><td align="center" valign="middle" background="<?php echo htmlspecialchars($t->rootURL);?>/FlexyWiki/templates/negative.jpg"><a href="<?php echo htmlspecialchars($col->link);?>"><img border="0" height="<?php echo htmlspecialchars($col->info[1]);?>" width="<?php echo htmlspecialchars($col->info[0]);?>" src="<?php echo htmlspecialchars($col->url);?>"></a><br>
<font color="white">[<?php echo htmlspecialchars($col->name);?>] <?php echo htmlspecialchars($col->size);?>Mb</font>
</td><?php }?>
</tr><?php }?>
</tbody>
</table>
===With data file: image_view.html===
<table cellpadding="2" cellspacing="2" border="0" bgcolor="black" style="text-align: left; width: 100%;">
<tbody>
</tbody>
</table>

View file

@ -0,0 +1,107 @@
--TEST--
Template Test: include.html
--FILE--
<?php
require_once 'testsuite.php';
require_once 'HTML/Template/Flexy/Factory.php';
compilefile('include.html',
array(
'range' => range('a', 'z'),
'foo' => 'bar',
)
);
--EXPECTF--
===Compiling include.html===
===Compiled file: include.html===
<html>
<body>
the variable is <?php echo htmlspecialchars($t->foo);?>
<table>
<?php if ($this->options['strict'] || (is_array($t->range) || is_object($t->range))) foreach($t->range as $key => $value) {?><tr>
<?php
$x = new HTML_Template_Flexy($this->options);
$x->compile('include_block.html');
$_t = function_exists('clone') ? clone($t) : $t;
foreach(get_defined_vars() as $k=>$v) {
if ($k != 't') { $_t->$k = $v; }
}
$x->outputObject($_t, $this->elements);
?>
</tr><?php }?>
</table>
</body>
</html>
===With data file: include.html===
<html>
<body>
the variable is bar
<table>
<tr>
<td width="60">0</td>
<td><a href="#foo">a</a></td> </tr><tr>
<td width="60">1</td>
<td><a href="#foo">b</a></td> </tr><tr>
<td width="60">2</td>
<td><a href="#foo">c</a></td> </tr><tr>
<td width="60">3</td>
<td><a href="#foo">d</a></td> </tr><tr>
<td width="60">4</td>
<td><a href="#foo">e</a></td> </tr><tr>
<td width="60">5</td>
<td><a href="#foo">f</a></td> </tr><tr>
<td width="60">6</td>
<td><a href="#foo">g</a></td> </tr><tr>
<td width="60">7</td>
<td><a href="#foo">h</a></td> </tr><tr>
<td width="60">8</td>
<td><a href="#foo">i</a></td> </tr><tr>
<td width="60">9</td>
<td><a href="#foo">j</a></td> </tr><tr>
<td width="60">10</td>
<td><a href="#foo">k</a></td> </tr><tr>
<td width="60">11</td>
<td><a href="#foo">l</a></td> </tr><tr>
<td width="60">12</td>
<td><a href="#foo">m</a></td> </tr><tr>
<td width="60">13</td>
<td><a href="#foo">n</a></td> </tr><tr>
<td width="60">14</td>
<td><a href="#foo">o</a></td> </tr><tr>
<td width="60">15</td>
<td><a href="#foo">p</a></td> </tr><tr>
<td width="60">16</td>
<td><a href="#foo">q</a></td> </tr><tr>
<td width="60">17</td>
<td><a href="#foo">r</a></td> </tr><tr>
<td width="60">18</td>
<td><a href="#foo">s</a></td> </tr><tr>
<td width="60">19</td>
<td><a href="#foo">t</a></td> </tr><tr>
<td width="60">20</td>
<td><a href="#foo">u</a></td> </tr><tr>
<td width="60">21</td>
<td><a href="#foo">v</a></td> </tr><tr>
<td width="60">22</td>
<td><a href="#foo">w</a></td> </tr><tr>
<td width="60">23</td>
<td><a href="#foo">x</a></td> </tr><tr>
<td width="60">24</td>
<td><a href="#foo">y</a></td> </tr><tr>
<td width="60">25</td>
<td><a href="#foo">z</a></td> </tr> </table>
</body>
</html>

View file

@ -0,0 +1,171 @@
--TEST--
Template Test: javascript.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('javascript.html');
--EXPECTF--
===Compiling javascript.html===
===Compiled file: javascript.html===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src='somefile/<?php echo htmlspecialchars($t->js_file);?>'></script>
</head>
<script language="javascript">
// some sample javascript that might cause problemss
function CheckDuplicates (AddListContainer, RemoveListContainer) {
var AddList = eval('document.main_form.'+AddListContainer);
var RemoveList = eval('document.main_form.'+RemoveListContainer);
var TempAddList = AddList.value;
var TempRemoveList = RemoveList.value;
if (TempAddList>''&&TempRemoveList>'') {
TempAddList = TempAddList.substring(0,TempAddList.length-1);
}
}
//<!--
function CheckDuplicates2 (AddListContainer, RemoveListContainer) {
var AddList = eval('document.main_form.'+AddListContainer);
var RemoveList = eval('document.main_form.'+RemoveListContainer);
var TempAddList = AddList.value;
var TempRemoveList = RemoveList.value;
if (TempAddList>''&&TempRemoveList>'') {
TempAddList = TempAddList.substring(0,TempAddList.length-1);
}
}
-->
</script>
<!--
// and now just commented out stuff.. that may cause problems
function CheckDuplicates (AddListContainer, RemoveListContainer) {
var AddList = eval('document.main_form.'+AddListContainer);
var RemoveList = eval('document.main_form.'+RemoveListContainer);
var TempAddList = AddList.value;
var TempRemoveList = RemoveList.value;
if (TempAddList>''&&TempRemoveList>'') {
TempAddList = TempAddList.substring(0,TempAddList.length-1);
}
}
-->
<script type="application/x-javascript" src="js/common.js"></script>
<script type="application/x-javascript" src="../searchjs.php"></script>
<script type="application/x-javascript" src="js/catctrl.js"></script>
<script type="application/x-javascript">
function productAddApply() {
req = new phpRequest(URI_CONTROL + "/New/product");
req.add("product_category", get_value("listProdCat"));
req.add("item_category", get_value("listItemCat"));
req.add("item_subcategory", get_value("listItemSubCat"));
req.add("supplier_id", get_value("listSupplier"));
req.add("supplier_model_numb", get_value("txtSupModelNo"));
req.add("article", get_value("txtArtDescr"));
req.add("material", get_value("txtMaterial"));
req.add("color", get_value("txtColor"));
}
</script>
<body>
</body>
</html>
===With data file: javascript.html===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src='somefile/'></script>
</head>
<script language="javascript">
// some sample javascript that might cause problemss
function CheckDuplicates (AddListContainer, RemoveListContainer) {
var AddList = eval('document.main_form.'+AddListContainer);
var RemoveList = eval('document.main_form.'+RemoveListContainer);
var TempAddList = AddList.value;
var TempRemoveList = RemoveList.value;
if (TempAddList>''&&TempRemoveList>'') {
TempAddList = TempAddList.substring(0,TempAddList.length-1);
}
}
//<!--
function CheckDuplicates2 (AddListContainer, RemoveListContainer) {
var AddList = eval('document.main_form.'+AddListContainer);
var RemoveList = eval('document.main_form.'+RemoveListContainer);
var TempAddList = AddList.value;
var TempRemoveList = RemoveList.value;
if (TempAddList>''&&TempRemoveList>'') {
TempAddList = TempAddList.substring(0,TempAddList.length-1);
}
}
-->
</script>
<!--
// and now just commented out stuff.. that may cause problems
function CheckDuplicates (AddListContainer, RemoveListContainer) {
var AddList = eval('document.main_form.'+AddListContainer);
var RemoveList = eval('document.main_form.'+RemoveListContainer);
var TempAddList = AddList.value;
var TempRemoveList = RemoveList.value;
if (TempAddList>''&&TempRemoveList>'') {
TempAddList = TempAddList.substring(0,TempAddList.length-1);
}
}
-->
<script type="application/x-javascript" src="js/common.js"></script>
<script type="application/x-javascript" src="../searchjs.php"></script>
<script type="application/x-javascript" src="js/catctrl.js"></script>
<script type="application/x-javascript">
function productAddApply() {
req = new phpRequest(URI_CONTROL + "/New/product");
req.add("product_category", get_value("listProdCat"));
req.add("item_category", get_value("listItemCat"));
req.add("item_subcategory", get_value("listItemSubCat"));
req.add("supplier_id", get_value("listSupplier"));
req.add("supplier_model_numb", get_value("txtSupModelNo"));
req.add("article", get_value("txtArtDescr"));
req.add("material", get_value("txtMaterial"));
req.add("color", get_value("txtColor"));
}
</script>
<body>
</body>
</html>

View file

@ -0,0 +1,109 @@
--TEST--
Template Test: looping.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('looping.html',array('list'=>array(1,2,3,4)));
--EXPECTF--
===Compiling looping.html===
===Compiled file: looping.html===
<h2>Looping</h2>
<p>a loop <?php if ($this->options['strict'] || (is_array($t->loop) || is_object($t->loop))) foreach($t->loop as $a) {?> <?php echo htmlspecialchars($a);?> <?php }?></p>
<p>a loop with 2 vars <?php if ($this->options['strict'] || (is_array($t->loop) || is_object($t->loop))) foreach($t->loop as $a => $b) {?>
<?php echo htmlspecialchars($a);?> ,
<?php echo htmlspecialchars($b);?>
<?php }?></p>
Bug #84
<?php if ($this->options['strict'] || (is_array($t->list) || is_object($t->list))) foreach($t->list as $i) {?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'method'))) echo htmlspecialchars($t->method($i));?>
<?php }?>
<?php if ($this->options['strict'] || (is_array($t->list) || is_object($t->list))) foreach($t->list as $i => $j) {?>
<?php echo htmlspecialchars($i);?>:<?php echo htmlspecialchars($j);?>
<?php }?>
<table>
<?php if ($this->options['strict'] || (is_array($t->xyz) || is_object($t->xyz))) foreach($t->xyz as $abcd => $def) {?><tr>
<td><?php echo htmlspecialchars($abcd);?>, <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'test'))) echo htmlspecialchars($t->test($def));?></td>
</tr><?php }?>
</table>
<h2>HTML tags example using foreach=&quot;loop,a,b&quot; or the tr</h2>
<table width="100%" border="0">
<?php if ($this->options['strict'] || (is_array($t->loop) || is_object($t->loop))) foreach($t->loop as $a => $b) {?><tr>
<td><?php echo htmlspecialchars($a);?></td>
<td><?php echo htmlspecialchars($b);?></td>
</tr><?php }?>
</table>
<h2>HTML tags example using foreach=&quot;loop,a&quot; or the tr using a highlight class.</h2>
<table width="100%" border="0">
<?php if ($this->options['strict'] || (is_array($t->loop) || is_object($t->loop))) foreach($t->loop as $a) {?><tr class="<?php echo htmlspecialchars($a->hightlight);?>">
<td>a is</td>
<?php if ($a->showtext) {?><td><?php echo htmlspecialchars($a->text);?></td><?php }?>
<?php if (!$a->showtext) {?><td><?php echo number_format($a->price,2,'.',',');?></td><?php }?>
</tr><?php }?>
</table>
<h2>HTML tags example using foreach=&quot;loop,a,b&quot; or the tr</h2>
<table width="100%" border="0">
<?php if ($this->options['strict'] || (is_array($t->loop) || is_object($t->loop))) foreach($t->loop as $a => $b) {?><tr>
<?php if ($this->options['strict'] || (is_array($b) || is_object($b))) foreach($b as $c => $d) {?><td><?php echo htmlspecialchars($d);?></td><?php }?>
</tr><?php }?>
</table>
<h2>Looping in CDATA</h2>
Dont forget that php strips line breaks!
<![CDATA[
<?php if ($this->options['strict'] || (is_array($t->list) || is_object($t->list))) foreach($t->list as $i => $j) {?>
<?php echo htmlspecialchars($i);?>:<?php echo htmlspecialchars($j);?>
<?php }?>
]]>
===With data file: looping.html===
<h2>Looping</h2>
<p>a loop </p>
<p>a loop with 2 vars </p>
Bug #84
0:1 1:2 2:3 3:4
<table>
</table>
<h2>HTML tags example using foreach=&quot;loop,a,b&quot; or the tr</h2>
<table width="100%" border="0">
</table>
<h2>HTML tags example using foreach=&quot;loop,a&quot; or the tr using a highlight class.</h2>
<table width="100%" border="0">
</table>
<h2>HTML tags example using foreach=&quot;loop,a,b&quot; or the tr</h2>
<table width="100%" border="0">
</table>
<h2>Looping in CDATA</h2>
Dont forget that php strips line breaks!
<![CDATA[
0:1
1:2
2:3
3:4
]]>

View file

@ -0,0 +1,123 @@
--TEST--
Template Test: methods.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('methods.html');
--EXPECTF--
===Compiling methods.html===
===Compiled file: methods.html===
<h2>Methods</H2>
<p>Calling a method <?php if ($this->options['strict'] || (isset($t->a) && method_exists($t->a,'helloWorld'))) echo htmlspecialchars($t->a->helloWorld());?></p>
<p>or <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'includeBody'))) echo $t->includeBody();?></P>
<img src="<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getImageDir'))) echo htmlspecialchars($t->getImageDir());?>/someimage.jpg">
<img src="<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getImageDir'))) echo $t->getImageDir();?>/someimage.jpg">
<img src="<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getImageDir'))) echo urlencode($t->getImageDir());?>/someimage.jpg">
<img src="<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getImageDir'))) echo htmlspecialchars($t->getImageDir());?>/someimage.jpg">
<img src="<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getImageDir'))) echo htmlspecialchars($t->getImageDir());?>/someimage.jpg">
<span class="<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getBgnd'))) echo htmlspecialchars($t->getBgnd($t->valueArr['isConfigurable']));?>"></span>
<h2>Full Method testing</h2>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo htmlspecialchars($t->abc($t->abc,$t->def,$t->hij));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo htmlspecialchars($t->abc($t->abc,"def","hij"));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo htmlspecialchars($t->abc($t->abc,$t->def,"hij"));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo htmlspecialchars($t->abc("abc",$t->def,$t->hij));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo $t->abc($t->abc,$t->def,$t->hij);?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo $t->abc($t->abc,"def","hij");?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo $t->abc($t->abc,$t->def,"hij");?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo $t->abc("abc",$t->def,$t->hij);?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo urlencode($t->abc($t->abc,$t->def,$t->hij));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo urlencode($t->abc($t->abc,"def","hij"));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo urlencode($t->abc($t->abc,$t->def,"hij"));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo urlencode($t->abc("abc",$t->def,$t->hij));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo htmlspecialchars($t->abc(123,$t->def,$t->hij));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo urlencode($t->abc($t->abc,123,123));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo htmlspecialchars($t->abc($t->abc,$t->def,123));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'abc'))) echo urlencode($t->abc("abc",123,$t->hij));?>
<h2>Real life method testing </h2>
Invoice number: <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->invoice,"number"));?> Place:
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->invoice,"place"));?> Date: <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->invoice,"date"));?> Payment:
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->invoice,"payment"));?> Payment date:
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->invoice,"payment_date"));?> Seller: Name 1:
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->seller,"name1"));?> Name 2: <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->seller,"name2"));?> NIP:
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->seller,"nip"));?> Street: <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->seller,"street"));?> City:
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->seller,"code"));?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->seller,"city"));?> Buyer: Name 1:
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->buyer,"name1"));?> Name 2: <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->buyer,"name2"));?> NIP:
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->buyer,"nip"));?> Street: <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->buyer,"street"));?> City:
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->buyer,"code"));?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($t->buyer,"city"));?>
# Name <?php if ($t->show_pkwiu) {?> PKWIU<?php }?> Count Netto VAT Brutto
<?php if ($this->options['strict'] || (is_array($t->positions) || is_object($t->positions))) foreach($t->positions as $position) {?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($position,"nr"));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($position,"name"));?> <?php if ($t->show_pkwiu) {?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($position,"pkwiu"));?><?php }?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($position,"count"));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($position,"netto"));?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($position,"vat"));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($position,"brutto"));?>
<?php }?> <?php if ($t->edit_positions) {?> # Name <?php if ($t->show_pkwiu) {?> PKWIU<?php }?> Count
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) if ($t->getelem($t->position,"netto_mode")) { ?> Netto<?php } else {?> <?php }?> VAT
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) if ($t->getelem($t->position,"netto_mode")) { ?> <?php } else {?> Brutto<?php }?>
<?php if ($this->options['strict'] || (is_array($t->edit_positions) || is_object($t->edit_positions))) foreach($t->edit_positions as $k => $position) {?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($position,"nr"));?>
<?php if ($t->show_pkwiu) {?> <?php }?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) if ($t->getelem($position,"netto_mode")) { ?> <?php } else {?>
<?php }?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) if ($t->getelem($position,"netto_mode")) { ?> <?php } else {?> <?php }?>
<?php }?> <?php }?> #
<?php if ($this->options['strict'] || (is_array($t->sum) || is_object($t->sum))) foreach($t->sum as $sum) {?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($sum,"nr"));?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($sum,"netto"));?>
<?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($sum,"vat"));?> <?php if ($this->options['strict'] || (isset($t) && method_exists($t,'getelem'))) echo htmlspecialchars($t->getelem($sum,"brutto"));?>
<?php }?>
===With data file: methods.html===
<h2>Methods</H2>
<p>Calling a method </p>
<p>or </P>
<img src="/someimage.jpg">
<img src="/someimage.jpg">
<img src="/someimage.jpg">
<img src="/someimage.jpg">
<img src="/someimage.jpg">
<span class=""></span>
<h2>Full Method testing</h2>
<h2>Real life method testing </h2>
Invoice number: Place:
Date: Payment:
Payment date:
Seller: Name 1:
Name 2: NIP:
Street: City:
Buyer: Name 1:
Name 2: NIP:
Street: City:
# Name Count Netto VAT Brutto
#

View file

@ -0,0 +1,121 @@
--TEST--
Template Test: namespaces.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('namespaces.html');
--EXPECTF--
===Compiling namespaces.html===
===Compiled file: namespaces.html===
<?php echo "<"; ?>?xml version="1.0" ?>
<?php echo "<"; ?>?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
<?php echo "<"; ?>?xml-stylesheet href="/myproject/images/css/test.css" type="text/css" ?>
<window id="wndUserResults" title="User Search Results" persist="screenX screenY width height" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<tree id="userSearchResults" flex="1" height="300" enableColumnDrag="true" ondblclick="parent.parent.userEditPopup();">
<treecols>
<treecol flex="2" id="trcName" label="Name" primary="true" persist="width ordinal hidden" />
<splitter class="tree-splitter" />
<treecol flex="1" id="trcGroupName" label="Group Name" persist="width ordinal hidden" />
</treecols>
<treechildren>
<?php if ($this->options['strict'] || (is_array($t->sresult) || is_object($t->sresult))) foreach($t->sresult as $id => $data) {?><treeitem>
<treerow>
<treecell label="<?php echo htmlspecialchars($data->name);?>" />
<treecell label="<?php echo htmlspecialchars($data->group_name);?>" />
<treecell label="<?php echo htmlspecialchars($data->user_id);?>" />
</treerow>
</treeitem><?php }?>
</treechildren>
</tree>
<?php echo $this->elements['test']->toHtmlnoClose();?>
<?php echo $this->elements['test2']->toHtml();?>
<html:table>
<html:tr>
<html:td>
<label style="text-align: left;" control="listItemSubCat" value="Item Subcategory" />
</html:td>
</html:tr>
</html:table>
</html:form>
<?php $_attributes_used = array();
echo $this->elements['atest']->toHtml();
if (isset($_attributes_used)) { foreach($_attributes_used as $_a) {
unset($this->elements['atest']->attributes[$_a]);
}}
?>
<!-- example of how to make the above work correctly.. -->
<html:select name="atest">
<?php if ($this->options['strict'] || (is_array($t->categories) || is_object($t->categories))) foreach($t->categories as $data) {?><html:option value="<?php echo htmlspecialchars($data->value);?>" onselect="parent.onSelect_ProdCat();"><?php echo htmlspecialchars($data->name);?></html:option><?php }?>
</html:select>
<!-- test toElement -->
<?php echo $this->elements['supplier_id']->toHtml();?>
<!-- test using flexy stuff -->
<menulist id="supplier_id2">
<menupopup>
<?php if ($this->options['strict'] || (is_array($t->x) || is_object($t->x))) foreach($t->x as $y) {?><menuitem id="itemSubCatAll" label="<?php echo htmlspecialchars($y->name);?>" value="<?php echo htmlspecialchars($y->value);?>" /><?php }?>
</menupopup>
</menulist>
<!-- test args on menupopup -->
<?php echo $this->elements['product_category']->toHtml();?>
</window>
===With data file: namespaces.html===
<?xml version="1.0" ?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css" ?>
<?xml-stylesheet href="/myproject/images/css/test.css" type="text/css" ?>
<window id="wndUserResults" title="User Search Results" persist="screenX screenY width height" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:html="http://www.w3.org/1999/xhtml">
<tree id="userSearchResults" flex="1" height="300" enableColumnDrag="true" ondblclick="parent.parent.userEditPopup();">
<treecols>
<treecol flex="2" id="trcName" label="Name" primary="true" persist="width ordinal hidden" />
<splitter class="tree-splitter" />
<treecol flex="1" id="trcGroupName" label="Group Name" persist="width ordinal hidden" />
</treecols>
<treechildren>
</treechildren>
</tree>
<html:form name="test"> <html:input name="test2"> <html:table>
<html:tr>
<html:td>
<label style="text-align: left;" control="listItemSubCat" value="Item Subcategory" />
</html:td>
</html:tr>
</html:table>
</html:form>
<html:select name="atest">
<html:option onselect="parent.onSelect_ProdCat();">data.name</html:option>
</html:select> <!-- example of how to make the above work correctly.. -->
<html:select name="atest">
</html:select>
<!-- test toElement -->
<menulist id="supplier_id">
<menupopup>
<menuitem id="itemSubCatAll" label="-- Select --" value="0" />
</menupopup>
</menulist>
<!-- test using flexy stuff -->
<menulist id="supplier_id2">
<menupopup>
</menupopup>
</menulist>
<!-- test args on menupopup -->
<menulist id="product_category">
<menupopup onpopuphiding="cTree.categorySelect(this.parentNode.value,1);">
<menuitem id="prodCatAll" label="-- All --" value="0" />
</menupopup>
</menulist>
</window>

View file

@ -0,0 +1,56 @@
--TEST--
Template Test: plugin_modifiers.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('plugin_modifiers.html',
array(
'numbertest' => 10000.123,
'datetest' => '2004-01-12'
),
array('plugins'=>array('Savant'))
);
compilefile('flexy_raw_with_element.html',
array( ),
array( )
);
--EXPECTF--
<<<<<<< test_plugin_modifiers.html.phpt
=======
===Compiling plugin_modifiers.html===
===Compiled file: plugin_modifiers.html===
<H1>Testing Plugin Modifiers</H1>
<?php echo $this->plugin("dateformat",$t->datetest);?>
<?php echo $this->plugin("numberformat",$t->numbertest);?>
Bug #3946 - inside raw!
<input type="checkbox" name="useTextarea3" <?php if ($this->options['strict'] || (isset($t->person) && method_exists($t->person,'useTextarea'))) echo $this->plugin("checked",$t->person->useTextarea());?>>
===With data file: plugin_modifiers.html===
<H1>Testing Plugin Modifiers</H1>
12 Jan 2004
10,000.12
Bug #3946 - inside raw!
<input type="checkbox" name="useTextarea3" >
===Compiling flexy_raw_with_element.html===
Error:/var/svn_live/pear/HTML_Template_Flexy/tests/templates/flexy_raw_with_element.html on Line 5 in Tag &lt;INPUT&gt;:<BR>Flexy:raw can only be used with flexy:ignore, to prevent conversion of html elements to flexy elements>>>>>>> 1.3

View file

@ -0,0 +1,68 @@
--TEST--
Template Test: raw_php.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('raw_php.html');
compilefile('raw_php.html',array(), array('allowPHP'=>true));
compilefile('raw_php.html',array(), array('allowPHP'=>'delete'));
--EXPECTF--
===Compiling raw_php.html===
===Compile failure==
[pear_error: message="HTML_Template_Flexy fatal error:PHP code found in script (Token)" code=-1 mode=return level=notice prefix="" info=""]
===Compiling raw_php.html===
===Compiled file: raw_php.html===
<? for($i=0;$i<10;$i++) { ?>
number: <?=$i?>
<?php } ?>
<script language="php">
for($i=0;$i<10;$i++) {
echo "hello world\n";
}
</script>
===With data file: raw_php.html===
number: 0number: 1number: 2number: 3number: 4number: 5number: 6number: 7number: 8number: 9
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world
===Compiling raw_php.html===
===Compiled file: raw_php.html===
number:
===With data file: raw_php.html===
number:

View file

@ -0,0 +1,64 @@
--TEST--
Template Test: raw_text.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('raw_text.html');
--EXPECTF--
===Compiling raw_text.html===
===Compiled file: raw_text.html===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<body>
<h2>Example Template for HTML_Template_Flexy</h2>
a full string example ~!@#$%^&*() |": ?\][;'/.,=-_+ ~` abcd....
asfasfdas
<h2>Bugs: 809 Comments:</h2>
<!--- this is a comment with alot of stuff.. --# ---->
<!-- this is a comment with alot of stuff.. --# -- -->
</body>
</html>
===With data file: raw_text.html===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<body>
<h2>Example Template for HTML_Template_Flexy</h2>
a full string example ~!@#$%^&*() |": ?\][;'/.,=-_+ ~` abcd....
asfasfdas
<h2>Bugs: 809 Comments:</h2>
<!--- this is a comment with alot of stuff.. --# ---->
<!-- this is a comment with alot of stuff.. --# -- -->
</body>
</html>

View file

@ -0,0 +1,69 @@
--TEST--
Template Test: style.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('style.html');
--EXPECTF--
===Compiling style.html===
===Compiled file: style.html===
<link rel="stylesheet" type="text/css" media="print" href="<?php echo htmlspecialchars($t->ROOT_CSS);?>/print.css">
<link rel="stylesheet" type="text/css" media="screen" href="<?php echo htmlspecialchars($t->ROOT_CSS);?>/compatible.css">
<style type="text/css" media="screen">
<!--
@import url(<?php echo htmlspecialchars($t->ROOT_CSS);?>/main.css);
.tdbodywarningCopy {
background-color: #eecccc;
FONT-FAMILY: arial, geneva, helvetica, sans-serif;
font-size : 10px;
COLOR: #000000;
padding: 0px;
border: 0px dashed #000000;
}
-->
</style>
===With data file: style.html===
<link rel="stylesheet" type="text/css" media="print" href="/print.css">
<link rel="stylesheet" type="text/css" media="screen" href="/compatible.css">
<style type="text/css" media="screen">
<!--
@import url(/main.css);
.tdbodywarningCopy {
background-color: #eecccc;
FONT-FAMILY: arial, geneva, helvetica, sans-serif;
font-size : 10px;
COLOR: #000000;
padding: 0px;
border: 0px dashed #000000;
}
-->
</style>

View file

@ -0,0 +1,83 @@
--TEST--
Template Test: variables.html
--FILE--
<?php
require_once 'testsuite.php';
compilefile('variables.html');
--EXPECTF--
===Compiling variables.html===
===Compiled file: variables.html===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<body>
<p>Example Template for HTML_Template_Flexy</p>
<h2>Variables</H2>
<p>Standard variables
<?php echo htmlspecialchars($t->hello);?>
<?php echo $t->world;?>
<?php echo urlencode($t->test);?>
<?php echo htmlspecialchars($t->object->var);?>
<?php echo htmlspecialchars($t->array[0]);?>
<?php echo htmlspecialchars($t->array['entry']);?>
<?php echo htmlspecialchars($t->multi['array'][0]);?>
<?php echo htmlspecialchars($t->object->var['array'][1]);?>
<?php echo '<pre>'; echo htmlspecialchars(print_r($t->object->var['array'][1],true)); echo '</pre>';;?>
<?php echo $t->object->var['array'][1];?>
<?php echo $t->object->var['array'][-1];?>
<?php echo htmlspecialchars($t->object['array']->with['objects']);?>
Long string with NL2BR + HTMLSPECIALCHARS
<?php echo nl2br(htmlspecialchars($t->longstring));?>
Everything: <?php echo '<pre>'; echo htmlspecialchars(print_r($t,true)); echo '</pre>';;?>
an Object: <?php echo '<pre>'; echo htmlspecialchars(print_r($t->object,true)); echo '</pre>';;?>
<img src="<?php echo htmlspecialchars($t->getImageDir);?>/someimage.jpg">
<img src="<?php echo $t->getImageDir;?>/someimage.jpg">
<img src="<?php echo urlencode($t->getImageDir);?>/someimage.jpg">
<img src="<?php echo htmlspecialchars($t->getImageDir);?>/someimage.jpg">
<img src="<?php echo htmlspecialchars($t->getImageDir);?>/someimage.jpg">
</p>
</body>
</html>
===With data file: variables.html===
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled Document</title>
<body>
<p>Example Template for HTML_Template_Flexy</p>
<h2>Variables</H2>
<p>Standard variables
<pre></pre>Long string with NL2BR + HTMLSPECIALCHARS
Everything: <pre>stdClass Object
(
)
</pre>an Object: <pre></pre>
<img src="/someimage.jpg">
<img src="/someimage.jpg">
<img src="/someimage.jpg">
<img src="/someimage.jpg">
<img src="/someimage.jpg">
</p>
</body>
</html>