]> git.llucax.com Git - software/bife/bife-all.git/blob - src/BIFE/Link.php
- Added a new simple template system: Hooks + IT = HIT.
[software/bife/bife-all.git] / src / BIFE / Link.php
1 <?php
2 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
3 // +--------------------------------------------------------------------+
4 // |                       BIFE - Buil It FastEr                        |
5 // +--------------------------------------------------------------------+
6 // | This file is part of BIFE.                                         |
7 // |                                                                    |
8 // | BIFE is free software; you can redistribute it and/or modify it    |
9 // | under the terms of the GNU General Public License as published by  |
10 // | the Free Software Foundation; either version 2 of the License, or  |
11 // | (at your option) any later version.                                |
12 // |                                                                    |
13 // | BIFE is distributed in the hope that it will be useful, but        |
14 // | WITHOUT ANY WARRANTY; without even the implied warranty of         |
15 // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU   |
16 // | General Public License for more details.                           |
17 // |                                                                    |
18 // | You should have received a copy of the GNU General Public License  |
19 // | along with Hooks; if not, write to the Free Software Foundation,   |
20 // | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      |
21 // +--------------------------------------------------------------------+
22 // | Created: Sun Jun 1 20:00:20 2003                                   |
23 // | Authors: Leandro Lucarella <luca@lugmen.org.ar>                    |
24 // +--------------------------------------------------------------------+
25 //
26 // $Id$
27 //
28
29 // +X2C includes
30 require_once 'BIFE/Generic.php';
31 // ~X2C
32
33 // +X2C Class 110 :Link
34 /**
35  * Link to another page.
36  *
37  * @access public
38  */
39 class BIFE_Link extends BIFE_Generic {
40     // ~X2C
41
42     // +X2C Operation 111
43     /**
44      * Constructor.
45      *
46      * @param  array $attrs Attributes.
47      *
48      * @return void
49      * @access public
50      */
51     function BIFE_Link($attrs) // ~X2C
52     {
53         $this->__construct($attrs);
54     }
55     // -X2C
56
57     // +X2C Operation 112
58     /**
59      * Constructor.
60      *
61      * @param  array $attrs Attributes.
62      *
63      * @return void
64      * @access public
65      */
66     function __construct($attrs) // ~X2C
67     {
68         $link_attrs['URL'] = @$attrs['URL'];
69         unset($attrs['URL']);
70         $link_attrs['DESC'] = @$attrs['DESC'];
71         unset($attrs['DESC']);
72         if (isset($attrs['BIFE'])) {
73             $link_attrs['BIFE'] = $attrs['BIFE'];
74             $attrs['DATA-BIFE']  = $attrs['BIFE'];
75             unset($attrs['BIFE']);
76         }
77         $query = array();
78         foreach($attrs as $name => $value) {
79             if (substr($name, 0, 5) === 'DATA-') {
80                 if ($name = substr($name, 5)) {
81                     $query[] = urlencode($name) . '=' . urlencode($value);
82                 }
83             }
84         }
85         if ($query) {
86             $link_attrs['URL'] .= '?' . join('&', $query);
87         }
88         parent::__construct($link_attrs);
89     }
90     // -X2C
91
92 } // -X2C Class :Link
93
94 ?>