Project

General

Profile

« Previous | Next » 

Revision 1374

Added by Dietmar almost 14 years ago

fixed headerinfos

View differences:

template.inc
72 72
 /**
73 73
  * Serialization helper, the name of this class.
74 74
  *
75
  * @var       string
76
  * @access    public
75
 * @var       string
76
 * @access    public
77 77
  */
78 78
  var $classname = "Template";
79 79

  
......
88 88
  * Note: setting $this->debug = true will enable debugging of variable
89 89
  * assignments only which is the same behaviour as versions up to release 7.2d.
90 90
  *
91
  * @var       int
92
  * @access    public
91
 * @var       int
92
 * @access    public
93 93
  */
94 94
  var $debug    = false;
95 95

  
......
98 98
  * false = no filename outputs
99 99
  * true = HTML comments (e.g. <!-- START FILE $filename -->) placed in output
100 100
  *
101
  * @var       int
102
  * @access    public
101
 * @var       int
102
 * @access    public
103 103
  */
104 104
  var $filename_comments = false;
105 105

  
......
110 110
  *              ("loose" has a nasty habit of deleting JavaScript RegEx components)
111 111
  *              (should future major version releases of PHPLib default this "strict"?)
112 112
  *
113
  * @var       string
114
  * @access    public
113
 * @var       string
114
 * @access    public
115 115
  */
116 116
  var $unknown_regexp = "loose";
117 117

  
118 118
 /**
119 119
  * The base directory from which template files are loaded.
120 120
  *
121
  * @var       string
122
  * @access    private
123
  * @see       set_root
121
 * @var       string
122
 * @access    private
123
 * @see       set_root
124 124
  */
125 125
  var $root     = ".";
126 126

  
......
129 129
  * into names of files containing the variable content.
130 130
  * $file[varname] = "filename";
131 131
  *
132
  * @var       array
133
  * @access    private
134
  * @see       set_file
132
 * @var       array
133
 * @access    private
134
 * @see       set_file
135 135
  */
136 136
  var $file     = array();
137 137

  
......
140 140
  * into regular expressions for themselves.
141 141
  * $varkeys[varname] = "/varname/"
142 142
  *
143
  * @var       array
144
  * @access    private
145
  * @see       set_var
143
 * @var       array
144
 * @access    private
145
 * @see       set_var
146 146
  */
147 147
  var $varkeys  = array();
148 148

  
......
151 151
  * into values for their respective varkeys.
152 152
  * $varvals[varname] = "value"
153 153
  *
154
  * @var       array
155
  * @access    private
156
  * @see       set_var
154
 * @var       array
155
 * @access    private
156
 * @see       set_var
157 157
  */
158 158
  var $varvals  = array();
159 159

  
160 160
 /**
161 161
  * Determines how to output variable tags with no assigned value in templates.
162 162
  *
163
  * @var       string
164
  * @access    private
165
  * @see       set_unknowns
163
 * @var       string
164
 * @access    private
165
 * @see       set_unknowns
166 166
  */
167 167
  var $unknowns = "remove";
168 168

  
......
172 172
  * "report"   = the error is reported, then execution continues by returning "false"
173 173
  * "no"       = errors are silently ignored, and execution resumes reporting "false"
174 174
  *
175
  * @var       string
176
  * @access    public
177
  * @see       halt
175
 * @var       string
176
 * @access    public
177
 * @see       halt
178 178
  */
179 179
  var $halt_on_error  = "yes";
180 180

  
181 181
 /**
182 182
  * The last error message is retained in this variable.
183 183
  *
184
  * @var       string
185
  * @access    public
186
  * @see       halt
184
 * @var       string
185
 * @access    public
186
 * @see       halt
187 187
  */
188 188
  var $last_error     = "";
189 189

  
......
194 194
  *
195 195
  * usage: Template([string $root = "."], [string $unknowns = "remove"])
196 196
  *
197
  * @param     $root        path to template directory
198
  * @param     $string      what to do with undefined variables
199
  * @see       set_root
200
  * @see       set_unknowns
201
  * @access    public
202
  * @return    void
197
 * @param     $root        path to template directory
198
 * @param     $string      what to do with undefined variables
199
 * @see       set_root
200
 * @see       set_unknowns
201
 * @access    public
202
 * @return    void
203 203
  */
204 204
  function Template($root = ".", $unknowns = "remove") {
205 205
    if ($this->debug & 4) {
......
219 219
  *
220 220
  * usage: set_root(string $root)
221 221
  *
222
  * @param     $root         string containing new template directory
223
  * @see       root
224
  * @access    public
225
  * @return    boolean
222
 * @param     $root         string containing new template directory
223
 * @see       root
224
 * @access    public
225
 * @return    boolean
226 226
  */
227 227
  function set_root($root) {
228 228
    if(preg_match ('/\/$/', $root)) {
......
254 254
  *
255 255
  * usage: set_unknowns(string $unknowns)
256 256
  *
257
  * @param     $unknowns         new value for unknowns
258
  * @see       unknowns
259
  * @access    public
260
  * @return    void
257
 * @param     $unknowns         new value for unknowns
258
 * @see       unknowns
259
 * @access    public
260
 * @return    void
261 261
  */
262 262
  function set_unknowns($unknowns = "remove") {
263 263
    if ($this->debug & 4) {
......
283 283
  * or
284 284
  * usage: set_file(string $varname, string $filename)
285 285
  *
286
  * @param     $varname      either a string containing a varname or a hash of varname/file name pairs.
287
  * @param     $filename     if varname is a string this is the filename otherwise filename is not required
288
  * @access    public
289
  * @return    boolean
286
 * @param     $varname      either a string containing a varname or a hash of varname/file name pairs.
287
 * @param     $filename     if varname is a string this is the filename otherwise filename is not required
288
 * @access    public
289
 * @return    boolean
290 290
  */
291 291
  function set_file($varname, $filename = "") {
292 292
    if (!is_array($varname)) {
......
329 329
  *
330 330
  * usage: set_block(string $parent, string $varname, [string $name = ""])
331 331
  *
332
  * @param     $parent       a string containing the name of the parent variable
333
  * @param     $varname      a string containing the name of the block to be extracted
334
  * @param     $name         the name of the variable in which to store the block
335
  * @access    public
336
  * @return    boolean
332
 * @param     $parent       a string containing the name of the parent variable
333
 * @param     $varname      a string containing the name of the block to be extracted
334
 * @param     $name         the name of the variable in which to store the block
335
 * @access    public
336
 * @return    boolean
337 337
  */
338 338
  function set_block($parent, $varname, $name = "") {
339 339
    if ($this->debug & 4) {
......
383 383
  * or
384 384
  * usage: set_var(array $varname = (string $varname => string $value), [mixed $dummy_var], [boolean $append = false])
385 385
  *
386
  * @param     $varname      either a string containing a varname or a hash of varname/value pairs.
387
  * @param     $value        if $varname is a string this contains the new value for the variable otherwise this parameter is ignored
388
  * @param     $append       if true, the value is appended to the variable's existing value
389
  * @access    public
390
  * @return    void
386
 * @param     $varname      either a string containing a varname or a hash of varname/value pairs.
387
 * @param     $value        if $varname is a string this contains the new value for the variable otherwise this parameter is ignored
388
 * @param     $append       if true, the value is appended to the variable's existing value
389
 * @access    public
390
 * @return    void
391 391
  */
392 392
  function set_var($varname, $value = "", $append = false) {
393 393
    if (!is_array($varname)) {
......
436 436
  * or
437 437
  * usage: clear_var(array $varname = (string $varname))
438 438
  *
439
  * @param     $varname      either a string containing a varname or an array of varnames.
440
  * @access    public
441
  * @return    void
439
 * @param     $varname      either a string containing a varname or an array of varnames.
440
 * @access    public
441
 * @return    void
442 442
  */
443 443
  function clear_var($varname) {
444 444
    if (!is_array($varname)) {
......
477 477
  * or
478 478
  * usage: unset_var(array $varname = (string $varname))
479 479
  *
480
  * @param     $varname      either a string containing a varname or an array of varnames.
481
  * @access    public
482
  * @return    void
480
 * @param     $varname      either a string containing a varname or an array of varnames.
481
 * @access    public
482
 * @return    void
483 483
  */
484 484
  function unset_var($varname) {
485 485
    if (!is_array($varname)) {
......
516 516
  *
517 517
  * usage: subst(string $varname)
518 518
  *
519
  * @param     $varname      the name of the variable within which variables are to be substituted
520
  * @access    public
521
  * @return    string
519
 * @param     $varname      the name of the variable within which variables are to be substituted
520
 * @access    public
521
 * @return    string
522 522
  */
523 523
  function subst($varname) {
524 524
    $varvals_quoted = array();
......
550 550
  *
551 551
  * usage: psubst(string $varname)
552 552
  *
553
  * @param     $varname      the name of the variable within which variables are to be substituted
554
  * @access    public
555
  * @return    false
556
  * @see       subst
553
 * @param     $varname      the name of the variable within which variables are to be substituted
554
 * @access    public
555
 * @return    false
556
 * @see       subst
557 557
  */
558 558
  function psubst($varname) {
559 559
    if ($this->debug & 4) {
......
598 598
  * or
599 599
  * usage: parse(string $target, array $varname = (string $varname), [boolean $append])
600 600
  *
601
  * @param     $target      a string containing the name of the variable into which substituted $varnames are to be stored
602
  * @param     $varname     if a string, the name the name of the variable to substitute or if an array a list of variables to be substituted
603
  * @param     $append      if true, the substituted variables are appended to $target otherwise the existing value of $target is replaced
604
  * @access    public
605
  * @return    string
606
  * @see       subst
601
 * @param     $target      a string containing the name of the variable into which substituted $varnames are to be stored
602
 * @param     $varname     if a string, the name the name of the variable to substitute or if an array a list of variables to be substituted
603
 * @param     $append      if true, the substituted variables are appended to $target otherwise the existing value of $target is replaced
604
 * @access    public
605
 * @return    string
606
 * @see       subst
607 607
  */
608 608
  function parse($target, $varname, $append = false) {
609 609
    if (!is_array($varname)) {
......
648 648
  * or
649 649
  * usage: pparse(string $target, array $varname = (string $varname), [boolean $append])
650 650
  *
651
  * @param     $target      a string containing the name of the variable into which substituted $varnames are to be stored
652
  * @param     $varname     if a string, the name the name of the variable to substitute or if an array a list of variables to be substituted
653
  * @param     $append      if true, the substituted variables are appended to $target otherwise the existing value of $target is replaced
654
  * @access    public
655
  * @return    false
656
  * @see       parse
651
 * @param     $target      a string containing the name of the variable into which substituted $varnames are to be stored
652
 * @param     $varname     if a string, the name the name of the variable to substitute or if an array a list of variables to be substituted
653
 * @param     $append      if true, the substituted variables are appended to $target otherwise the existing value of $target is replaced
654
 * @access    public
655
 * @return    false
656
 * @see       parse
657 657
  */
658 658
  function pparse($target, $varname, $append = false, $clear = true) { // added $clear: whether to delete undefined vars or not (needed for wb-module code) - thorn
659 659
    if ($this->debug & 4) {
......
682 682
  *
683 683
  * usage: get_vars()
684 684
  *
685
  * @access    public
686
  * @return    array
687
  * @see       $debug
685
 * @access    public
686
 * @return    array
687
 * @see       $debug
688 688
  */
689 689
  function get_vars() {
690 690
    if ($this->debug & 4) {
......
712 712
  * or
713 713
  * usage: get_var(array $varname)
714 714
  *
715
  * @param     $varname     if a string, the name the name of the variable to get the value of, or if an array a list of variables to return the value of
716
  * @access    public
717
  * @return    string or array
715
 * @param     $varname     if a string, the name the name of the variable to get the value of, or if an array a list of variables to return the value of
716
 * @access    public
717
 * @return    string or array
718 718
  */
719 719
  function get_var($varname) {
720 720
    if (!is_array($varname)) {
......
753 753
  *
754 754
  * usage: get_undefined(string $varname)
755 755
  *
756
  * @param     $varname     a string containing the name the name of the variable to scan for unresolved variables
757
  * @access    public
758
  * @return    array
756
 * @param     $varname     a string containing the name the name of the variable to scan for unresolved variables
757
 * @access    public
758
 * @return    array
759 759
  */
760 760
  function get_undefined($varname) {
761 761
    if ($this->debug & 4) {
......
801 801
  *
802 802
  * usage: finish(string $str)
803 803
  *
804
  * @param     $str         a string to which to apply the unresolved variable policy
805
  * @access    public
806
  * @return    string
807
  * @see       set_unknowns
804
 * @param     $str         a string to which to apply the unresolved variable policy
805
 * @access    public
806
 * @return    string
807
 * @see       set_unknowns
808 808
  */
809 809
  function finish($str) {
810 810
    switch ($this->unknowns) {
......
837 837
  *
838 838
  * usage: p(string $varname)
839 839
  *
840
  * @param     $varname     a string containing the name of the variable to finish and print
841
  * @access    public
842
  * @return    void
843
  * @see       set_unknowns
844
  * @see       finish
840
 * @param     $varname     a string containing the name of the variable to finish and print
841
 * @access    public
842
 * @return    void
843
 * @see       set_unknowns
844
 * @see       finish
845 845
  */
846 846
  function p($varname) {
847 847
    print $this->finish($this->get_var($varname));
......
857 857
  *
858 858
  * usage: get(string $varname)
859 859
  *
860
  * @param     $varname     a string containing the name of the variable to finish
861
  * @access    public
862
  * @return    void
863
  * @see       set_unknowns
864
  * @see       finish
860
 * @param     $varname     a string containing the name of the variable to finish
861
 * @access    public
862
 * @return    void
863
 * @see       set_unknowns
864
 * @see       finish
865 865
  */
866 866
  function get($varname) {
867 867
    return $this->finish($this->get_var($varname));
......
876 876
  *
877 877
  * usage: filename(string $filename)
878 878
  *
879
  * @param     $filename    a string containing a filename
880
  * @access    private
881
  * @return    string
882
  * @see       set_root
879
 * @param     $filename    a string containing a filename
880
 * @access    private
881
 * @return    string
882
 * @see       set_root
883 883
  */
884 884
  function filename($filename) {
885 885
    if ($this->debug & 4) {
......
908 908
  *
909 909
  * usage: varname(string $varname)
910 910
  *
911
  * @param     $varname    a string containing a variable name
912
  * @access    private
913
  * @return    string
911
 * @param     $varname    a string containing a variable name
912
 * @access    private
913
 * @return    string
914 914
  */
915 915
  function varname($varname) {
916 916
    return preg_quote("{" . $varname . "}");
......
932 932
  *
933 933
  * usage: loadfile(string $varname)
934 934
  *
935
  * @param     $varname    a string containing the name of a variable to load
936
  * @access    private
937
  * @return    boolean
938
  * @see       set_file
935
 * @param     $varname    a string containing the name of a variable to load
936
 * @access    private
937
 * @return    boolean
938
 * @see       set_file
939 939
  */
940 940
  function loadfile($varname) {
941 941
    if ($this->debug & 4) {
......
988 988
  *
989 989
  * usage: halt(string $msg)
990 990
  *
991
  * @param     $msg         a string containing an error message
992
  * @access    private
993
  * @return    void
994
  * @see       $halt_on_error
991
 * @param     $msg         a string containing an error message
992
 * @access    private
993
 * @return    void
994
 * @see       $halt_on_error
995 995
  */
996 996
  function halt($msg) {
997 997
    $this->last_error = $msg;
......
1015 1015
  *
1016 1016
  * usage: haltmsg(string $msg)
1017 1017
  *
1018
  * @param     $msg         a string containing the error message to display
1019
  * @access    public
1020
  * @return    void
1021
  * @see       halt
1018
 * @param     $msg         a string containing the error message to display
1019
 * @access    public
1020
 * @return    void
1021
 * @see       halt
1022 1022
  */
1023 1023
  function haltmsg($msg) {
1024 1024
    printf("<b>Template Error:</b> %s<br>\n", $msg);

Also available in: Unified diff