]> git.llucax.com Git - software/bife/bife-all.git/blobdiff - src/BIFE/Link.php
Added new Widget, Link:
[software/bife/bife-all.git] / src / BIFE / Link.php
similarity index 51%
rename from examples/photo.php
rename to src/BIFE/Link.php
index ca803c793c0c3e4fe030193590995e80df3dab96..ab21616bb48095b22bee09814aa47bf67c3a912a 100644 (file)
@@ -1,4 +1,4 @@
-<?
+<?php
 // vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
 // +--------------------------------------------------------------------+
 // |                       BIFE - Buil It FastEr                        |
 // | along with Hooks; if not, write to the Free Software Foundation,   |
 // | Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA      |
 // +--------------------------------------------------------------------+
-// | Created: Wed May 17 18:16:54 ART 2003                              |
+// | Created: Sun Jun 1 20:00:20 2003                                   |
 // | Authors: Leandro Lucarella <luca@lugmen.org.ar>                    |
 // +--------------------------------------------------------------------+
 //
 // $Id$
 //
 
-$tmp = ini_get('include_path');
-ini_set('include_path', "../src:$tmp");
-unset($tmp);
+// +X2C includes
+require_once 'BIFE/Generic.php';
+// ~X2C
 
-require_once 'HTML/Template/Sigma.php';
-require_once 'BIFE/Parser.php';
-require_once 'BIFE/Copy.php';
-require_once 'BIFE/Page.php';
-require_once 'BIFE/Title.php';
-#require_once 'BIFE/Album.php';
-#require_once 'BIFE.php';
+// +X2C Class 110 :Link
+/**
+ * Link to another page.
+ *
+ * @access public
+ */
+class BIFE_Link extends BIFE_Generic {
+    // ~X2C
 
-$file = 'photo.xbf';
+    // +X2C Operation 111
+    /**
+     * Constructor.
+     *
+     * @param  array $attrs Attributes.
+     *
+     * @return void
+     * @access public
+     */
+    function BIFE_Link($attrs) // ~X2C
+    {
+        $this->__construct($attrs);
+    }
+    // -X2C
 
-$template =& new HTML_Template_Sigma('templates');
-$template->setErrorHandling(PEAR_ERROR_PRINT);
+    // +X2C Operation 112
+    /**
+     * Constructor.
+     *
+     * @param  array $attrs Attributes.
+     *
+     * @return void
+     * @access public
+     */
+    function __construct($attrs) // ~X2C
+    {
+        if (isset($attrs['URL'])) {
+            $this->attrs['URL'] = $attrs['URL'];
+            unset($attrs['URL']);
+        } else {
+            $this->attrs['URL'] = '';
+        }
+        if (isset($attrs['BIFE'])) {
+            $this->attrs['BIFE'] = $attrs['BIFE'];
+            $attrs['DATA-BIFE']  = $attrs['BIFE'];
+            unset($attrs['BIFE']);
+        }
+        $query = array();
+        foreach($attrs as $name => $value) {
+            if (substr($name, 0, 5) === 'DATA-') {
+                if ($name = substr($name, 5)) {
+                    $query[] = urlencode($name) . '=' . urlencode($value);
+                }
+            }
+        }
+        if ($query) {
+            $this->attrs['QUERY'] = '?' . join('&', $query);
+        } else {
+            $this->attrs['QUERY'] = '';
+        }
+    }
+    // -X2C
 
-$parser =& new BIFE_Parser('BIFE_Copy');
-$page =& $parser->parseFile($file);
-$parser->__destruct();
-echo $page->render($template);
+} // -X2C Class :Link
 
 ?>