1
<?xml version="1.0" encoding="iso-8859-1"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml">
5
<!-- template designed by Marco Von Ballmoos -->
6
<title>Docs For Class Savant3</title>
7
<link rel="stylesheet" href="../media/stylesheet.css" />
8
<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'/>
11
<div class="page-body">
12
<h2 class="class-name">Class Savant3</h2>
14
<a name="sec-description"></a>
15
<div class="info-box">
16
<div class="info-box-title">Description</div>
18
<span class="disabled">Description</span> |
19
<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
20
| <a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
23
<div class="info-box-body">
24
<!-- ========== Info from phpDoc block ========= -->
25
<p class="short-description">Provides an object-oriented template system for PHP5.</p>
26
<p class="description"><p>Savant3 helps you separate business logic from presentation logic using PHP as the template language. By default, Savant3 does not compile templates. However, you may pass an optional compiler object to compile template source to include-able PHP code. It is E_STRICT compliant for PHP5.</p><p>Please see the documentation at <a href="http://phpsavant.com/">http://phpsavant.com/</a>, and be sure to donate! :-)</p></p>
28
<li><span class="field">author:</span> Paul M. Jones <<a href="mailto:pmjones@ciaweb.net">pmjones@ciaweb.net</a>></li>
29
<li><span class="field">version:</span> @package_version@</li>
32
Located in <a class="field" href="_lib---Savant3-3.0.0---Savant3.php.html">/lib/Savant3-3.0.0/Savant3.php</a> (line <span class="field">46</span>)
43
<a name="sec-var-summary"></a>
44
<div class="info-box">
45
<div class="info-box-title">Variable Summary</span></div>
47
<a href="#sec-description">Description</a> |
48
<span class="disabled">Vars</span> (<a href="#sec-vars">details</a>)
50
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
53
<div class="info-box-body">
54
<div class="var-summary">
55
<div class="var-title">
56
<span class="var-type">array</span>
57
<a href="#$__config" title="details" class="var-name">$__config</a>
63
<a name="sec-method-summary"></a>
64
<div class="info-box">
65
<div class="info-box-title">Method Summary</span></div>
67
<a href="#sec-description">Description</a> |
68
<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
71
<span class="disabled">Methods</span> (<a href="#sec-methods">details</a>)
73
<div class="info-box-body">
74
<div class="method-summary">
76
<div class="method-definition">
77
<span class="method-result"><a href="../Savant3/Savant3.html">object Savant3</a></span>
78
<a href="#__construct" title="details" class="method-name">__construct</a>
79
([<span class="var-type">array</span> <span class="var-name">$config</span> = <span class="var-default">null</span>])
81
<div class="method-definition">
82
<span class="method-result">void</span>
83
<a href="#addEscape" title="details" class="method-name">addEscape</a>
86
<div class="method-definition">
87
<span class="method-result">void</span>
88
<a href="#addFilters" title="details" class="method-name">addFilters</a>
89
(<span class="var-type">array</span> <span class="var-name">0</span>)
91
<div class="method-definition">
92
<span class="method-result">void</span>
93
<a href="#addPath" title="details" class="method-name">addPath</a>
94
(<span class="var-type"></span> <span class="var-name">$type</span>, <span class="var-type">string|array</span> <span class="var-name">$path</span>)
96
<div class="method-definition">
97
<span class="method-result">string</span>
98
<a href="#apiVersion" title="details" class="method-name">apiVersion</a>
101
<div class="method-definition">
102
<span class="method-result">void</span>
103
<a href="#applyFilters" title="details" class="method-name">applyFilters</a>
104
(<span class="var-type">string</span> <span class="var-name">$buffer</span>)
106
<div class="method-definition">
107
<span class="method-result">bool</span>
108
<a href="#assign" title="details" class="method-name">assign</a>
111
<div class="method-definition">
112
<span class="method-result">bool</span>
113
<a href="#assignRef" title="details" class="method-name">assignRef</a>
114
(<span class="var-type"></span> <span class="var-name">$key</span>, <span class="var-type"></span> <span class="var-name">&$val</span>)
116
<div class="method-definition">
117
<span class="method-result">void</span>
118
<a href="#display" title="details" class="method-name">display</a>
119
([<span class="var-type">string</span> <span class="var-name">$tpl</span> = <span class="var-default">null</span>])
121
<div class="method-definition">
122
<span class="method-result">void</span>
123
<a href="#eprint" title="details" class="method-name">eprint</a>
124
(<span class="var-type">mixed</span> <span class="var-name">$value</span>)
126
<div class="method-definition">
127
<span class="method-result"><a href="../Savant3/Savant3_Error.html">object Savant3_Error</a></span>
128
<a href="#error" title="details" class="method-name">error</a>
129
(<span class="var-type">string</span> <span class="var-name">$code</span>, [<span class="var-type">array</span> <span class="var-name">$info</span> = <span class="var-default">array()</span>], [<span class="var-type">int</span> <span class="var-name">$level</span> = <span class="var-default">E_USER_ERROR</span>], [<span class="var-type">bool</span> <span class="var-name">$trace</span> = <span class="var-default">true</span>])
131
<div class="method-definition">
132
<span class="method-result">mixed</span>
133
<a href="#escape" title="details" class="method-name">escape</a>
134
(<span class="var-type">mixed</span> <span class="var-name">$value</span>)
136
<div class="method-definition">
137
<span class="method-result">mixed</span>
138
<a href="#fetch" title="details" class="method-name">fetch</a>
139
([<span class="var-type">string</span> <span class="var-name">$tpl</span> = <span class="var-default">null</span>])
141
<div class="method-definition">
142
<span class="method-result">string|bool</span>
143
<a href="#findFile" title="details" class="method-name">findFile</a>
144
(<span class="var-type">array</span> <span class="var-name">$type</span>, <span class="var-type">string</span> <span class="var-name">$file</span>)
146
<div class="method-definition">
147
<span class="method-result">mixed</span>
148
<a href="#getConfig" title="details" class="method-name">getConfig</a>
149
([<span class="var-type">string</span> <span class="var-name">$key</span> = <span class="var-default">null</span>])
151
<div class="method-definition">
152
<span class="method-result">array</span>
153
<a href="#getEscape" title="details" class="method-name">getEscape</a>
156
<div class="method-definition">
157
<span class="method-result">boolean</span>
158
<a href="#isError" title="details" class="method-name">isError</a>
159
(<span class="var-type">object</span> <span class="var-name">$obj</span>)
161
<div class="method-definition">
162
<span class="method-result">mixed</span>
163
<a href="#plugin" title="details" class="method-name">plugin</a>
164
(<span class="var-type">string</span> <span class="var-name">$name</span>)
166
<div class="method-definition">
167
<span class="method-result">void</span>
168
<a href="#setAutoload" title="details" class="method-name">setAutoload</a>
169
(<span class="var-type">bool</span> <span class="var-name">$flag</span>)
171
<div class="method-definition">
172
<span class="method-result">void</span>
173
<a href="#setCompiler" title="details" class="method-name">setCompiler</a>
174
(<span class="var-type">mixed</span> <span class="var-name">$compiler</span>)
176
<div class="method-definition">
177
<span class="method-result">void</span>
178
<a href="#setErrorText" title="details" class="method-name">setErrorText</a>
179
(<span class="var-type">string</span> <span class="var-name">$text</span>)
181
<div class="method-definition">
182
<span class="method-result">void</span>
183
<a href="#setEscape" title="details" class="method-name">setEscape</a>
186
<div class="method-definition">
187
<span class="method-result">void</span>
188
<a href="#setExceptions" title="details" class="method-name">setExceptions</a>
189
(<span class="var-type">bool</span> <span class="var-name">$flag</span>)
191
<div class="method-definition">
192
<span class="method-result">void</span>
193
<a href="#setExtract" title="details" class="method-name">setExtract</a>
194
(<span class="var-type">bool</span> <span class="var-name">$flag</span>)
196
<div class="method-definition">
197
<span class="method-result">void</span>
198
<a href="#setFilters" title="details" class="method-name">setFilters</a>
199
(<span class="var-type">array</span> <span class="var-name">0</span>)
201
<div class="method-definition">
202
<span class="method-result">void</span>
203
<a href="#setPath" title="details" class="method-name">setPath</a>
204
(<span class="var-type">string</span> <span class="var-name">$type</span>, <span class="var-type">string|array</span> <span class="var-name">$path</span>)
206
<div class="method-definition">
207
<span class="method-result">void</span>
208
<a href="#setPluginConf" title="details" class="method-name">setPluginConf</a>
209
(<span class="var-type">string</span> <span class="var-name">$plugin</span>, [<span class="var-type">array</span> <span class="var-name">$config</span> = <span class="var-default">null</span>])
211
<div class="method-definition">
212
<span class="method-result">void</span>
213
<a href="#setTemplate" title="details" class="method-name">setTemplate</a>
214
(<span class="var-type">string</span> <span class="var-name">$template</span>)
216
<div class="method-definition">
217
<span class="method-result">string</span>
218
<a href="#template" title="details" class="method-name">template</a>
219
([<span class="var-type">string</span> <span class="var-name">$tpl</span> = <span class="var-default">null</span>])
221
<div class="method-definition">
222
<span class="method-result">mixed</span>
223
<a href="#__call" title="details" class="method-name">__call</a>
224
(<span class="var-type">string</span> <span class="var-name">$func</span>, <span class="var-type">array</span> <span class="var-name">$args</span>)
226
<div class="method-definition">
227
<span class="method-result">string</span>
228
<a href="#__toString" title="details" class="method-name">__toString</a>
229
([<span class="var-type">string</span> <span class="var-name">$tpl</span> = <span class="var-default">null</span>])
235
<a name="sec-vars"></a>
236
<div class="info-box">
237
<div class="info-box-title">Variables</div>
238
<div class="nav-bar">
239
<a href="#sec-description">Description</a> |
240
<a href="#sec-var-summary">Vars</a> (<span class="disabled">details</span>)
244
<a href="#sec-method-summary">Methods</a> (<a href="#sec-methods">details</a>)
247
<div class="info-box-body">
248
<a name="var$__config" id="$__config"><!-- --></A>
249
<div class="evenrow">
251
<div class="var-header">
252
<span class="var-title">
253
<span class="var-type">array</span>
254
<span class="var-name">$__config</span>
255
= <span class="var-default">array(<br /> 'template_path' => array(),'resource_path'=>array(),'error_text'=>"\n\ntemplate error, examine fetch() result\n\n",'exceptions'=>false,'autoload'=>false,'compiler'=>null,'filters'=>array(),'plugins'=>array(),'template'=>null,'plugin_conf'=>array(),'extract'=>false,'fetch'=>null,'escape'=>array('htmlspecialchars'),)</span> (line <span class="line-number">59</span>)
259
<!-- ========== Info from phpDoc block ========= -->
260
<p class="short-description">Array of configuration parameters.</p>
262
<li><span class="field">access:</span> protected</li>
274
<a name="sec-methods"></a>
275
<div class="info-box">
276
<div class="info-box-title">Methods</div>
277
<div class="nav-bar">
278
<a href="#sec-description">Description</a> |
279
<a href="#sec-var-summary">Vars</a> (<a href="#sec-vars">details</a>)
280
<a href="#sec-method-summary">Methods</a> (<span class="disabled">details</span>)
283
<div class="info-box-body">
284
<A NAME='method_detail'></A>
286
<a name="method__construct" id="__construct"><!-- --></a>
289
<div class="method-header">
290
<span class="method-title">Constructor __construct</span> (line <span class="line-number">96</span>)
293
<!-- ========== Info from phpDoc block ========= -->
294
<p class="short-description">Constructor.</p>
296
<li><span class="field">return:</span> A Savant3 instance.</li>
297
<li><span class="field">access:</span> public</li>
300
<div class="method-signature">
301
<span class="method-result"><a href="../Savant3/Savant3.html">object Savant3</a></span>
302
<span class="method-name">
305
([<span class="var-type">array</span> <span class="var-name">$config</span> = <span class="var-default">null</span>])
308
<ul class="parameters">
310
<span class="var-type">array</span>
311
<span class="var-name">$config</span><span class="var-description">: An associative array of configuration keys for the Savant3 object. Any, or none, of the keys may be set.</span> </li>
316
<a name="methodaddEscape" id="addEscape"><!-- --></a>
317
<div class="evenrow">
319
<div class="method-header">
320
<span class="method-title">addEscape</span> (line <span class="line-number">554</span>)
323
<!-- ========== Info from phpDoc block ========= -->
324
<p class="short-description">Adds to the callbacks used when calling $this->escape().</p>
325
<p class="description"><p>Each parameter passed to this function is treated as a separate callback. For example:</p><p><div class="src-code"><ol><li><div class="src-line"> <span class="src-var">$savant</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodaddEscape">addEscape</a><span class="src-sym">(</span></div></li>
326
<li><div class="src-line"> <span class="src-str">'stripslashes'</span><span class="src-sym">,</span></div></li>
327
<li><div class="src-line"> <span class="src-str">'htmlspecialchars'</span><span class="src-sym">,</span></div></li>
328
<li><div class="src-line"> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'StaticClass'</span><span class="src-sym">, </span><span class="src-str">'method'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
329
<li><div class="src-line"> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$object</span><span class="src-sym">, </span><span class="src-var">$method</span><span class="src-sym">)</span></div></li>
330
<li><div class="src-line"> <span class="src-sym">)</span><span class="src-sym">;</span></div></li>
333
<li><span class="field">access:</span> public</li>
336
<div class="method-signature">
337
<span class="method-result">void</span>
338
<span class="method-name">
347
<a name="methodaddFilters" id="addFilters"><!-- --></a>
350
<div class="method-header">
351
<span class="method-title">addFilters</span> (line <span class="line-number">1182</span>)
354
<!-- ========== Info from phpDoc block ========= -->
355
<p class="short-description">Adds filter callbacks to the stack of filters.</p>
357
<li><span class="field">access:</span> public</li>
360
<div class="method-signature">
361
<span class="method-result">void</span>
362
<span class="method-name">
365
(<span class="var-type">array</span> <span class="var-name">0</span>)
368
<ul class="parameters">
370
<span class="var-type">array</span>
371
<span class="var-name">0</span><span class="var-description">: An array of filter callbacks.</span> </li>
376
<a name="methodaddPath" id="addPath"><!-- --></a>
377
<div class="evenrow">
379
<div class="method-header">
380
<span class="method-title">addPath</span> (line <span class="line-number">760</span>)
383
<!-- ========== Info from phpDoc block ========= -->
384
<p class="short-description">Adds to the search path for templates and resources.</p>
386
<li><span class="field">access:</span> public</li>
389
<div class="method-signature">
390
<span class="method-result">void</span>
391
<span class="method-name">
394
(<span class="var-type"></span> <span class="var-name">$type</span>, <span class="var-type">string|array</span> <span class="var-name">$path</span>)
397
<ul class="parameters">
399
<span class="var-type">string|array</span>
400
<span class="var-name">$path</span><span class="var-description">: The directory or stream to search.</span> </li>
402
<span class="var-type"></span>
403
<span class="var-name">$type</span> </li>
408
<a name="methodapiVersion" id="apiVersion"><!-- --></a>
411
<div class="method-header">
412
<span class="method-title">apiVersion</span> (line <span class="line-number">254</span>)
415
<!-- ========== Info from phpDoc block ========= -->
416
<p class="short-description">Reports the API version for this class.</p>
418
<li><span class="field">return:</span> A PHP-standard version number.</li>
419
<li><span class="field">access:</span> public</li>
422
<div class="method-signature">
423
<span class="method-result">string</span>
424
<span class="method-name">
433
<a name="methodapplyFilters" id="applyFilters"><!-- --></a>
434
<div class="evenrow">
436
<div class="method-header">
437
<span class="method-title">applyFilters</span> (line <span class="line-number">1204</span>)
440
<!-- ========== Info from phpDoc block ========= -->
441
<p class="short-description">Runs all filter callbacks on buffered output.</p>
443
<li><span class="field">access:</span> protected</li>
446
<div class="method-signature">
447
<span class="method-result">void</span>
448
<span class="method-name">
451
(<span class="var-type">string</span> <span class="var-name">$buffer</span>)
454
<ul class="parameters">
456
<span class="var-type">string</span>
457
<span class="var-name">$buffer</span><span class="var-description">: The template output.</span> </li>
462
<a name="methodassign" id="assign"><!-- --></a>
465
<div class="method-header">
466
<span class="method-title">assign</span> (line <span class="line-number">905</span>)
469
<!-- ========== Info from phpDoc block ========= -->
470
<p class="short-description">Sets variables for the template (by copy).</p>
471
<p class="description"><p>This method is overloaded; you can assign all the properties of an object, an associative array, or a single value by name.</p><p>You are not allowed to assign any variable named '__config' as it would conflict with internal configuration tracking.</p><p>In the following examples, the template will have two variables assigned to it; the variables will be known inside the template as "$this->var1" and "$this->var2".</p><p><div class="src-code"><ol><li><div class="src-line"> <span class="src-var">$Savant3 </span>= <span class="src-key">new </span><span class="src-id"><a href="../Savant3/Savant3.html">Savant3</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
472
<li><div class="src-line"> </div></li>
473
<li><div class="src-line"> <span class="src-comm">// assign by object</span></div></li>
474
<li><div class="src-line"> <span class="src-var">$obj </span>= <span class="src-key">new </span><span class="src-id">stdClass</span><span class="src-sym">;</span></div></li>
475
<li><div class="src-line"> <span class="src-var">$obj</span><span class="src-sym">-></span><span class="src-id">var1 </span>= <span class="src-str">'something'</span><span class="src-sym">;</span></div></li>
476
<li><div class="src-line"> <span class="src-var">$obj</span><span class="src-sym">-></span><span class="src-id">var2 </span>= <span class="src-str">'else'</span><span class="src-sym">;</span></div></li>
477
<li><div class="src-line"> <span class="src-var">$Savant3</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodassign">assign</a><span class="src-sym">(</span><span class="src-var">$obj</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
478
<li><div class="src-line"> </div></li>
479
<li><div class="src-line"> <span class="src-comm">// assign by associative array</span></div></li>
480
<li><div class="src-line"> <span class="src-var">$ary </span>= <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'var1' </span>=> <span class="src-str">'something'</span><span class="src-sym">, </span><span class="src-str">'var2' </span>=> <span class="src-str">'else'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
481
<li><div class="src-line"> <span class="src-var">$Savant3</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodassign">assign</a><span class="src-sym">(</span><span class="src-var">$ary</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
482
<li><div class="src-line"> </div></li>
483
<li><div class="src-line"> <span class="src-comm">// assign by name and value</span></div></li>
484
<li><div class="src-line"> <span class="src-var">$Savant3</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodassign">assign</a><span class="src-sym">(</span><span class="src-str">'var1'</span><span class="src-sym">, </span><span class="src-str">'something'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
485
<li><div class="src-line"> <span class="src-var">$Savant3</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodassign">assign</a><span class="src-sym">(</span><span class="src-str">'var2'</span><span class="src-sym">, </span><span class="src-str">'else'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
486
<li><div class="src-line"> </div></li>
487
<li><div class="src-line"> <span class="src-comm">// assign directly</span></div></li>
488
<li><div class="src-line"> <span class="src-var">$Savant3</span><span class="src-sym">-></span><span class="src-id">var1 </span>= <span class="src-str">'something'</span><span class="src-sym">;</span></div></li>
489
<li><div class="src-line"> <span class="src-var">$Savant3</span><span class="src-sym">-></span><span class="src-id">var2 </span>= <span class="src-str">'else'</span><span class="src-sym">;</span></div></li>
492
<li><span class="field">return:</span> True on success, false on failure.</li>
493
<li><span class="field">access:</span> public</li>
496
<div class="method-signature">
497
<span class="method-result">bool</span>
498
<span class="method-name">
507
<a name="methodassignRef" id="assignRef"><!-- --></a>
508
<div class="evenrow">
510
<div class="method-header">
511
<span class="method-title">assignRef</span> (line <span class="line-number">968</span>)
514
<!-- ========== Info from phpDoc block ========= -->
515
<p class="short-description">Sets variables for the template (by reference).</p>
516
<p class="description"><p>You are not allowed to assign any variable named '__config' as it would conflict with internal configuration tracking.</p><p><div class="src-code"><ol><li><div class="src-line"> <span class="src-var">$Savant3 </span>= <span class="src-key">new </span><span class="src-id"><a href="../Savant3/Savant3.html">Savant3</a></span><span class="src-sym">(</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
517
<li><div class="src-line"> </div></li>
518
<li><div class="src-line"> <span class="src-comm">// assign by name and value</span></div></li>
519
<li><div class="src-line"> <span class="src-var">$Savant3</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodassignRef">assignRef</a><span class="src-sym">(</span><span class="src-str">'var1'</span><span class="src-sym">, </span><span class="src-var">$ref</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
520
<li><div class="src-line"> </div></li>
521
<li><div class="src-line"> <span class="src-comm">// assign directly</span></div></li>
522
<li><div class="src-line"> <span class="src-var">$Savant3</span><span class="src-sym">-></span><span class="src-id">ref </span>=<span class="src-sym">& </span><span class="src-var">$var1</span><span class="src-sym">;</span></div></li>
525
<li><span class="field">return:</span> True on success, false on failure.</li>
526
<li><span class="field">access:</span> public</li>
529
<div class="method-signature">
530
<span class="method-result">bool</span>
531
<span class="method-name">
534
(<span class="var-type"></span> <span class="var-name">$key</span>, <span class="var-type"></span> <span class="var-name">&$val</span>)
537
<ul class="parameters">
539
<span class="var-type"></span>
540
<span class="var-name">$key</span> </li>
542
<span class="var-type"></span>
543
<span class="var-name">&$val</span> </li>
548
<a name="methoddisplay" id="display"><!-- --></a>
551
<div class="method-header">
552
<span class="method-title">display</span> (line <span class="line-number">999</span>)
555
<!-- ========== Info from phpDoc block ========= -->
556
<p class="short-description">Displays a template directly (equivalent to <div class="src-code"><ol><li><div class="src-line">echo <span class="src-var">$tpl</span></div></li>
559
<li><span class="field">access:</span> public</li>
562
<div class="method-signature">
563
<span class="method-result">void</span>
564
<span class="method-name">
567
([<span class="var-type">string</span> <span class="var-name">$tpl</span> = <span class="var-default">null</span>])
570
<ul class="parameters">
572
<span class="var-type">string</span>
573
<span class="var-name">$tpl</span><span class="var-description">: The template source to compile and display.</span> </li>
578
<a name="methodeprint" id="eprint"><!-- --></a>
579
<div class="evenrow">
581
<div class="method-header">
582
<span class="method-title">eprint</span> (line <span class="line-number">684</span>)
585
<!-- ========== Info from phpDoc block ========= -->
586
<p class="short-description">Prints a value after escaping it for output.</p>
587
<p class="description"><p>You can override the predefined escaping callbacks by passing added parameters as replacement callbacks.</p><p><div class="src-code"><ol><li><div class="src-line"> <span class="src-comm">// use predefined callbacks</span></div></li>
588
<li><div class="src-line"> <span class="src-var">$this</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodeprint">eprint</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
589
<li><div class="src-line"> </div></li>
590
<li><div class="src-line"> <span class="src-comm">// use replacement callbacks</span></div></li>
591
<li><div class="src-line"> <span class="src-var">$this</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodeprint">eprint</a><span class="src-sym">(</span></div></li>
592
<li><div class="src-line"> <span class="src-var">$value</span><span class="src-sym">,</span></div></li>
593
<li><div class="src-line"> <span class="src-str">'stripslashes'</span><span class="src-sym">,</span></div></li>
594
<li><div class="src-line"> <span class="src-str">'htmlspecialchars'</span><span class="src-sym">,</span></div></li>
595
<li><div class="src-line"> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'StaticClass'</span><span class="src-sym">, </span><span class="src-str">'method'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
596
<li><div class="src-line"> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$object</span><span class="src-sym">, </span><span class="src-var">$method</span><span class="src-sym">)</span></div></li>
597
<li><div class="src-line"> <span class="src-sym">)</span><span class="src-sym">;</span></div></li>
600
<li><span class="field">access:</span> public</li>
603
<div class="method-signature">
604
<span class="method-result">void</span>
605
<span class="method-name">
608
(<span class="var-type">mixed</span> <span class="var-name">$value</span>)
611
<ul class="parameters">
613
<span class="var-type">mixed</span>
614
<span class="var-name">$value</span><span class="var-description">: The value to be escaped and printed.</span> </li>
619
<a name="methoderror" id="error"><!-- --></a>
622
<div class="method-header">
623
<span class="method-title">error</span> (line <span class="line-number">1259</span>)
626
<!-- ========== Info from phpDoc block ========= -->
627
<p class="short-description">Returns an error object or throws an exception.</p>
629
<li><span class="field">access:</span> public</li>
632
<div class="method-signature">
633
<span class="method-result"><a href="../Savant3/Savant3_Error.html">object Savant3_Error</a></span>
634
<span class="method-name">
637
(<span class="var-type">string</span> <span class="var-name">$code</span>, [<span class="var-type">array</span> <span class="var-name">$info</span> = <span class="var-default">array()</span>], [<span class="var-type">int</span> <span class="var-name">$level</span> = <span class="var-default">E_USER_ERROR</span>], [<span class="var-type">bool</span> <span class="var-name">$trace</span> = <span class="var-default">true</span>])
640
<ul class="parameters">
642
<span class="var-type">string</span>
643
<span class="var-name">$code</span><span class="var-description">: A Savant3 'ERR_*' string.</span> </li>
645
<span class="var-type">array</span>
646
<span class="var-name">$info</span><span class="var-description">: An array of error-specific information.</span> </li>
648
<span class="var-type">int</span>
649
<span class="var-name">$level</span><span class="var-description">: The error severity level, default is E_USER_ERROR (the most severe possible).</span> </li>
651
<span class="var-type">bool</span>
652
<span class="var-name">$trace</span><span class="var-description">: Whether or not to include a backtrace, default true.</span> </li>
657
<a name="methodescape" id="escape"><!-- --></a>
658
<div class="evenrow">
660
<div class="method-header">
661
<span class="method-title">escape</span> (line <span class="line-number">615</span>)
664
<!-- ========== Info from phpDoc block ========= -->
665
<p class="short-description">Applies escaping to a value.</p>
666
<p class="description"><p>You can override the predefined escaping callbacks by passing added parameters as replacement callbacks.</p><p><div class="src-code"><ol><li><div class="src-line"> <span class="src-comm">// use predefined callbacks</span></div></li>
667
<li><div class="src-line"> <span class="src-var">$result </span>= <span class="src-var">$savant</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodescape">escape</a><span class="src-sym">(</span><span class="src-var">$value</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
668
<li><div class="src-line"> </div></li>
669
<li><div class="src-line"> <span class="src-comm">// use replacement callbacks</span></div></li>
670
<li><div class="src-line"> <span class="src-var">$result </span>= <span class="src-var">$savant</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodescape">escape</a><span class="src-sym">(</span></div></li>
671
<li><div class="src-line"> <span class="src-var">$value</span><span class="src-sym">,</span></div></li>
672
<li><div class="src-line"> <span class="src-str">'stripslashes'</span><span class="src-sym">,</span></div></li>
673
<li><div class="src-line"> <span class="src-str">'htmlspecialchars'</span><span class="src-sym">,</span></div></li>
674
<li><div class="src-line"> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'StaticClass'</span><span class="src-sym">, </span><span class="src-str">'method'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
675
<li><div class="src-line"> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$object</span><span class="src-sym">, </span><span class="src-var">$method</span><span class="src-sym">)</span></div></li>
676
<li><div class="src-line"> <span class="src-sym">)</span><span class="src-sym">;</span></div></li>
677
</ol></div></p><p>Unfortunately, a call to "echo htmlspecialchars()" is twice as fast as a call to "echo $this->escape()" under the default escaping (which is htmlspecialchars). The benchmark showed 0.007 seconds for htmlspecialchars(), and 0.014 seconds for $this->escape(), on 300 calls each.</p></p>
679
<li><span class="field">access:</span> public</li>
682
<div class="method-signature">
683
<span class="method-result">mixed</span>
684
<span class="method-name">
687
(<span class="var-type">mixed</span> <span class="var-name">$value</span>)
690
<ul class="parameters">
692
<span class="var-type">mixed</span>
693
<span class="var-name">$value</span><span class="var-description">: The value to be escaped.</span> </li>
698
<a name="methodfetch" id="fetch"><!-- --></a>
701
<div class="method-header">
702
<span class="method-title">fetch</span> (line <span class="line-number">1018</span>)
705
<!-- ========== Info from phpDoc block ========= -->
706
<p class="short-description">Compiles, executes, and filters a template source.</p>
708
<li><span class="field">return:</span> The template output string, or a Savant3_Error.</li>
709
<li><span class="field">access:</span> public</li>
712
<div class="method-signature">
713
<span class="method-result">mixed</span>
714
<span class="method-name">
717
([<span class="var-type">string</span> <span class="var-name">$tpl</span> = <span class="var-default">null</span>])
720
<ul class="parameters">
722
<span class="var-type">string</span>
723
<span class="var-name">$tpl</span><span class="var-description">: The template to process; if null, uses the default template set with setTemplate().</span> </li>
728
<a name="methodfindFile" id="findFile"><!-- --></a>
729
<div class="evenrow">
731
<div class="method-header">
732
<span class="method-title">findFile</span> (line <span class="line-number">819</span>)
735
<!-- ========== Info from phpDoc block ========= -->
736
<p class="short-description">Searches the directory paths for a given file.</p>
738
<li><span class="field">return:</span> The full path and file name for the target file, or boolean false if the file is not found in any of the paths.</li>
739
<li><span class="field">access:</span> protected</li>
742
<div class="method-signature">
743
<span class="method-result">string|bool</span>
744
<span class="method-name">
747
(<span class="var-type">array</span> <span class="var-name">$type</span>, <span class="var-type">string</span> <span class="var-name">$file</span>)
750
<ul class="parameters">
752
<span class="var-type">array</span>
753
<span class="var-name">$type</span><span class="var-description">: The type of path to search (template or resource).</span> </li>
755
<span class="var-type">string</span>
756
<span class="var-name">$file</span><span class="var-description">: The file name to look for.</span> </li>
761
<a name="methodgetConfig" id="getConfig"><!-- --></a>
764
<div class="method-header">
765
<span class="method-title">getConfig</span> (line <span class="line-number">347</span>)
768
<!-- ========== Info from phpDoc block ========= -->
769
<p class="short-description">Returns a copy of the Savant3 configuration parameters.</p>
771
<li><span class="field">return:</span> A copy of the $this->__config array.</li>
772
<li><span class="field">access:</span> public</li>
775
<div class="method-signature">
776
<span class="method-result">mixed</span>
777
<span class="method-name">
780
([<span class="var-type">string</span> <span class="var-name">$key</span> = <span class="var-default">null</span>])
783
<ul class="parameters">
785
<span class="var-type">string</span>
786
<span class="var-name">$key</span><span class="var-description">: The specific configuration key to return. If null, returns the entire configuration array.</span> </li>
791
<a name="methodgetEscape" id="getEscape"><!-- --></a>
792
<div class="evenrow">
794
<div class="method-header">
795
<span class="method-title">getEscape</span> (line <span class="line-number">573</span>)
798
<!-- ========== Info from phpDoc block ========= -->
799
<p class="short-description">Gets the array of output-escaping callbacks.</p>
801
<li><span class="field">return:</span> The array of output-escaping callbacks.</li>
802
<li><span class="field">access:</span> public</li>
805
<div class="method-signature">
806
<span class="method-result">array</span>
807
<span class="method-name">
816
<a name="methodisError" id="isError"><!-- --></a>
819
<div class="method-header">
820
<span class="method-title">isError</span> (line <span class="line-number">1305</span>)
823
<!-- ========== Info from phpDoc block ========= -->
824
<p class="short-description">Tests if an object is of the Savant3_Error class.</p>
826
<li><span class="field">return:</span> True if $obj is an error object of the type Savant3_Error, or is a subclass that Savant3_Error. False if not.</li>
827
<li><span class="field">access:</span> public</li>
830
<div class="method-signature">
831
<span class="method-result">boolean</span>
832
<span class="method-name">
835
(<span class="var-type">object</span> <span class="var-name">$obj</span>)
838
<ul class="parameters">
840
<span class="var-type">object</span>
841
<span class="var-name">$obj</span><span class="var-description">: The object to be tested.</span> </li>
846
<a name="methodplugin" id="plugin"><!-- --></a>
847
<div class="evenrow">
849
<div class="method-header">
850
<span class="method-title">plugin</span> (line <span class="line-number">274</span>)
853
<!-- ========== Info from phpDoc block ========= -->
854
<p class="short-description">Returns an internal plugin object; creates it as needed.</p>
856
<li><span class="field">return:</span> The plugin object, or a Savant3_Error with an ERR_PLUGIN code if it can't find the plugin.</li>
857
<li><span class="field">access:</span> public</li>
860
<div class="method-signature">
861
<span class="method-result">mixed</span>
862
<span class="method-name">
865
(<span class="var-type">string</span> <span class="var-name">$name</span>)
868
<ul class="parameters">
870
<span class="var-type">string</span>
871
<span class="var-name">$name</span><span class="var-description">: The plugin name. If this plugin has not been created yet, this method creates it automatically.</span> </li>
876
<a name="methodsetAutoload" id="setAutoload"><!-- --></a>
879
<div class="method-header">
880
<span class="method-title">setAutoload</span> (line <span class="line-number">374</span>)
883
<!-- ========== Info from phpDoc block ========= -->
884
<p class="short-description">Sets __autoload() usage on or off.</p>
886
<li><span class="field">access:</span> public</li>
889
<div class="method-signature">
890
<span class="method-result">void</span>
891
<span class="method-name">
894
(<span class="var-type">bool</span> <span class="var-name">$flag</span>)
897
<ul class="parameters">
899
<span class="var-type">bool</span>
900
<span class="var-name">$flag</span><span class="var-description">: True to use __autoload(), false to not use it.</span> </li>
905
<a name="methodsetCompiler" id="setCompiler"><!-- --></a>
906
<div class="evenrow">
908
<div class="method-header">
909
<span class="method-title">setCompiler</span> (line <span class="line-number">397</span>)
912
<!-- ========== Info from phpDoc block ========= -->
913
<p class="short-description">Sets a custom compiler/pre-processor callback for template sources.</p>
914
<p class="description"><p>By default, Savant3 does not use a compiler; use this to set your own custom compiler (pre-processor) for template sources.</p></p>
916
<li><span class="field">access:</span> public</li>
919
<div class="method-signature">
920
<span class="method-result">void</span>
921
<span class="method-name">
924
(<span class="var-type">mixed</span> <span class="var-name">$compiler</span>)
927
<ul class="parameters">
929
<span class="var-type">mixed</span>
930
<span class="var-name">$compiler</span><span class="var-description">: A compiler callback value suitable for the first parameter of call_user_func(). Set to null/false/empty to use PHP itself as the template markup (i.e., no compiling).</span> </li>
935
<a name="methodsetErrorText" id="setErrorText"><!-- --></a>
938
<div class="method-header">
939
<span class="method-title">setErrorText</span> (line <span class="line-number">415</span>)
942
<!-- ========== Info from phpDoc block ========= -->
943
<p class="short-description">Sets the custom error text for __toString().</p>
945
<li><span class="field">access:</span> public</li>
948
<div class="method-signature">
949
<span class="method-result">void</span>
950
<span class="method-name">
953
(<span class="var-type">string</span> <span class="var-name">$text</span>)
956
<ul class="parameters">
958
<span class="var-type">string</span>
959
<span class="var-name">$text</span><span class="var-description">: The error text when a template is echoed.</span> </li>
964
<a name="methodsetEscape" id="setEscape"><!-- --></a>
965
<div class="evenrow">
967
<div class="method-header">
968
<span class="method-title">setEscape</span> (line <span class="line-number">526</span>)
971
<!-- ========== Info from phpDoc block ========= -->
972
<p class="short-description">Clears then sets the callbacks to use when calling $this->escape().</p>
973
<p class="description"><p>Each parameter passed to this function is treated as a separate callback. For example:</p><p><div class="src-code"><ol><li><div class="src-line"> <span class="src-var">$savant</span><span class="src-sym">-></span><a href="../Savant3/Savant3.html#methodsetEscape">setEscape</a><span class="src-sym">(</span></div></li>
974
<li><div class="src-line"> <span class="src-str">'stripslashes'</span><span class="src-sym">,</span></div></li>
975
<li><div class="src-line"> <span class="src-str">'htmlspecialchars'</span><span class="src-sym">,</span></div></li>
976
<li><div class="src-line"> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'StaticClass'</span><span class="src-sym">, </span><span class="src-str">'method'</span><span class="src-sym">)</span><span class="src-sym">,</span></div></li>
977
<li><div class="src-line"> <span class="src-key">array</span><span class="src-sym">(</span><span class="src-var">$object</span><span class="src-sym">, </span><span class="src-var">$method</span><span class="src-sym">)</span></div></li>
978
<li><div class="src-line"> <span class="src-sym">)</span><span class="src-sym">;</span></div></li>
981
<li><span class="field">access:</span> public</li>
984
<div class="method-signature">
985
<span class="method-result">void</span>
986
<span class="method-name">
995
<a name="methodsetExceptions" id="setExceptions"><!-- --></a>
998
<div class="method-header">
999
<span class="method-title">setExceptions</span> (line <span class="line-number">434</span>)
1002
<!-- ========== Info from phpDoc block ========= -->
1003
<p class="short-description">Sets whether or not exceptions will be thrown.</p>
1005
<li><span class="field">access:</span> public</li>
1008
<div class="method-signature">
1009
<span class="method-result">void</span>
1010
<span class="method-name">
1013
(<span class="var-type">bool</span> <span class="var-name">$flag</span>)
1016
<ul class="parameters">
1018
<span class="var-type">bool</span>
1019
<span class="var-name">$flag</span><span class="var-description">: True to turn on exception throwing, false to turn it off.</span> </li>
1024
<a name="methodsetExtract" id="setExtract"><!-- --></a>
1025
<div class="evenrow">
1027
<div class="method-header">
1028
<span class="method-title">setExtract</span> (line <span class="line-number">453</span>)
1031
<!-- ========== Info from phpDoc block ========= -->
1032
<p class="short-description">Sets whether or not variables will be extracted.</p>
1034
<li><span class="field">access:</span> public</li>
1037
<div class="method-signature">
1038
<span class="method-result">void</span>
1039
<span class="method-name">
1042
(<span class="var-type">bool</span> <span class="var-name">$flag</span>)
1045
<ul class="parameters">
1047
<span class="var-type">bool</span>
1048
<span class="var-name">$flag</span><span class="var-description">: True to turn on variable extraction, false to turn it off.</span> </li>
1053
<a name="methodsetFilters" id="setFilters"><!-- --></a>
1054
<div class="oddrow">
1056
<div class="method-header">
1057
<span class="method-title">setFilters</span> (line <span class="line-number">1164</span>)
1060
<!-- ========== Info from phpDoc block ========= -->
1061
<p class="short-description">Resets the filter stack to the provided list of callbacks.</p>
1063
<li><span class="field">access:</span> public</li>
1066
<div class="method-signature">
1067
<span class="method-result">void</span>
1068
<span class="method-name">
1071
(<span class="var-type">array</span> <span class="var-name">0</span>)
1074
<ul class="parameters">
1076
<span class="var-type">array</span>
1077
<span class="var-name">0</span><span class="var-description">: An array of filter callbacks.</span> </li>
1082
<a name="methodsetPath" id="setPath"><!-- --></a>
1083
<div class="evenrow">
1085
<div class="method-header">
1086
<span class="method-title">setPath</span> (line <span class="line-number">726</span>)
1089
<!-- ========== Info from phpDoc block ========= -->
1090
<p class="short-description">Sets an entire array of search paths for templates or resources.</p>
1092
<li><span class="field">access:</span> public</li>
1095
<div class="method-signature">
1096
<span class="method-result">void</span>
1097
<span class="method-name">
1100
(<span class="var-type">string</span> <span class="var-name">$type</span>, <span class="var-type">string|array</span> <span class="var-name">$path</span>)
1103
<ul class="parameters">
1105
<span class="var-type">string</span>
1106
<span class="var-name">$type</span><span class="var-description">: The type of path to set, typically 'template' or 'resource'.</span> </li>
1108
<span class="var-type">string|array</span>
1109
<span class="var-name">$path</span><span class="var-description">: The new set of search paths. If null or false, resets to the current directory only.</span> </li>
1114
<a name="methodsetPluginConf" id="setPluginConf"><!-- --></a>
1115
<div class="oddrow">
1117
<div class="method-header">
1118
<span class="method-title">setPluginConf</span> (line <span class="line-number">473</span>)
1121
<!-- ========== Info from phpDoc block ========= -->
1122
<p class="short-description">Sets config array for a plugin.</p>
1124
<li><span class="field">access:</span> public</li>
1127
<div class="method-signature">
1128
<span class="method-result">void</span>
1129
<span class="method-name">
1132
(<span class="var-type">string</span> <span class="var-name">$plugin</span>, [<span class="var-type">array</span> <span class="var-name">$config</span> = <span class="var-default">null</span>])
1135
<ul class="parameters">
1137
<span class="var-type">string</span>
1138
<span class="var-name">$plugin</span><span class="var-description">: The plugin to configure.</span> </li>
1140
<span class="var-type">array</span>
1141
<span class="var-name">$config</span><span class="var-description">: The configuration array for the plugin.</span> </li>
1146
<a name="methodsetTemplate" id="setTemplate"><!-- --></a>
1147
<div class="evenrow">
1149
<div class="method-header">
1150
<span class="method-title">setTemplate</span> (line <span class="line-number">491</span>)
1153
<!-- ========== Info from phpDoc block ========= -->
1154
<p class="short-description">Sets the template name to use.</p>
1156
<li><span class="field">access:</span> public</li>
1159
<div class="method-signature">
1160
<span class="method-result">void</span>
1161
<span class="method-name">
1164
(<span class="var-type">string</span> <span class="var-name">$template</span>)
1167
<ul class="parameters">
1169
<span class="var-type">string</span>
1170
<span class="var-name">$template</span><span class="var-description">: The template name.</span> </li>
1175
<a name="methodtemplate" id="template"><!-- --></a>
1176
<div class="oddrow">
1178
<div class="method-header">
1179
<span class="method-title">template</span> (line <span class="line-number">1097</span>)
1182
<!-- ========== Info from phpDoc block ========= -->
1183
<p class="short-description">Compiles a template and returns path to compiled script.</p>
1184
<p class="description"><p>By default, Savant does not compile templates, it uses PHP as the markup language, so the "compiled" template is the same as the source template.</p><p>Used inside a template script like so:</p><p><div class="src-code"><ol><li><div class="src-line"> <span class="src-inc">include </span><span class="src-var">$this</span><span class="src-sym">-></span><span class="src-id">template</span><span class="src-sym">(</span><span class="src-var">$tpl</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
1187
<li><span class="field">return:</span> The full path to the compiled template script.</li>
1188
<li><span class="field">throws:</span> object An error object with a 'ERR_TEMPLATE' code.</li>
1189
<li><span class="field">access:</span> protected</li>
1192
<div class="method-signature">
1193
<span class="method-result">string</span>
1194
<span class="method-name">
1197
([<span class="var-type">string</span> <span class="var-name">$tpl</span> = <span class="var-default">null</span>])
1200
<ul class="parameters">
1202
<span class="var-type">string</span>
1203
<span class="var-name">$tpl</span><span class="var-description">: The template source name to look for.</span> </li>
1208
<a name="method__call" id="__call"><!-- --></a>
1209
<div class="evenrow">
1211
<div class="method-header">
1212
<span class="method-title">__call</span> (line <span class="line-number">180</span>)
1215
<!-- ========== Info from phpDoc block ========= -->
1216
<p class="short-description">Executes a main plugin method with arbitrary parameters.</p>
1218
<li><span class="field">return:</span> The plugin output, or a Savant3_Error with an ERR_PLUGIN code if it can't find the plugin.</li>
1219
<li><span class="field">access:</span> public</li>
1222
<div class="method-signature">
1223
<span class="method-result">mixed</span>
1224
<span class="method-name">
1227
(<span class="var-type">string</span> <span class="var-name">$func</span>, <span class="var-type">array</span> <span class="var-name">$args</span>)
1230
<ul class="parameters">
1232
<span class="var-type">string</span>
1233
<span class="var-name">$func</span><span class="var-description">: The plugin method name.</span> </li>
1235
<span class="var-type">array</span>
1236
<span class="var-name">$args</span><span class="var-description">: The parameters passed to the method.</span> </li>
1241
<a name="method__toString" id="__toString"><!-- --></a>
1242
<div class="oddrow">
1244
<div class="method-header">
1245
<span class="method-title">__toString</span> (line <span class="line-number">232</span>)
1248
<!-- ========== Info from phpDoc block ========= -->
1249
<p class="short-description">Magic method to echo this object as template output.</p>
1250
<p class="description"><p>Note that if there is an error, this will output a simple error text string and will not return an error object. Use fetch() to get an error object when errors occur.</p></p>
1252
<li><span class="field">return:</span> The template output.</li>
1253
<li><span class="field">access:</span> public</li>
1256
<div class="method-signature">
1257
<span class="method-result">string</span>
1258
<span class="method-name">
1261
([<span class="var-type">string</span> <span class="var-name">$tpl</span> = <span class="var-default">null</span>])
1264
<ul class="parameters">
1266
<span class="var-type">string</span>
1267
<span class="var-name">$tpl</span><span class="var-description">: The template source to use.</span> </li>
1277
<p class="notes" id="credit">
1278
Documentation generated on Sun, 22 Jun 2008 00:40:54 +0100 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.1</a>
b'\\ No newline at end of file'