- Added experimental PEAR package.xml.
- Added AlbumPhoto widget.
- Added AlbumPhoto to the example.
- Fixed some bugs.
--- /dev/null
+<?xml version="1.0"?>
+
+<project name="BIFE" default="dist" basedir=".">
+
+ <property name="poner directorio build en propiedad"/>
+
+ <fileset dir="src/BIFE" id="files.src.core">
+ <include name="Parser.php"/>
+ <include name="Widget.php"/>
+ <include name="Container.php"/>
+ <include name="Fallback.php"/>
+ <include name="Root.php"/>
+ </fileset>
+
+ <fileset dir="build/BIFE" id="files.build.core">
+ <include name="Parser.php"/>
+ <include name="Widget.php"/>
+ <include name="Container.php"/>
+ <include name="Fallback.php"/>
+ <include name="Root.php"/>
+ </fileset>
+
+ <target name="prepare">
+ <echo msg="Preparing build..."/>
+ <mkdir dir="build/BIFE"/>
+ </target>
+
+ <target name="build" depends="prepare">
+ <echo msg="Building..."/>
+ <copy todir="build/BIFE">
+ <fileset refid="files.src.core"/>
+ </copy>
+ <chmod mode="644">
+ <fileset refid="files.build.core"/>
+ </chmod>
+ </target>
+
+ <target name="dist" depends="build">
+ <echo msg="Creating archive..."/>
+ <tar name="bife.tar.gz" usegzip="true">
+ <fileset dir="build">
+ <include name="**/**"/>
+ </fileset>
+ </tar>
+ </target>
+
+ <target name="clean">
+ <echo msg="Cleaning up..."/>
+ <delete file="build"/>
+ </target>
+
+</project>
<XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
</XMI.header>
<XMI.content>
- <docsettings viewid="2" documentation="" uniqueid="102" />
+ <docsettings viewid="2" documentation="" uniqueid="109" />
<umlobjects>
<UML:Class stereotype="" package="BIFE" xmi.id="3" abstract="1" documentation="Base widget class." name="Widget" static="0" scope="200" >
<UML:Operation stereotype="" package="" xmi.id="4" type="string" abstract="1" documentation="Renders the widget using a template returning a string with the results." name="render" static="0" scope="200" >
<UML:Parameter stereotype="" package="" xmi.id="1" value="" type="string" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
</UML:Operation>
</UML:Class>
+ <UML:Class stereotype="" package="BIFE" xmi.id="103" abstract="0" documentation="Photo widget." name="AlbumPhoto" static="0" scope="200" >
+ <UML:Operation stereotype="" package="" xmi.id="106" type="void" abstract="0" documentation="Constructor." name="BIFE_AlbumPhoto" static="0" scope="200" >
+ <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
+ </UML:Operation>
+ <UML:Operation stereotype="" package="" xmi.id="107" type="void" abstract="0" documentation="Constructor." name="__construct" static="0" scope="200" >
+ <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="array" abstract="0" documentation="Attributes." name="attrs" static="0" scope="200" />
+ </UML:Operation>
+ <UML:Operation stereotype="" package="" xmi.id="108" type="string" abstract="0" documentation="Renders the widget using a template returning a string with the results." name="render" static="0" scope="200" >
+ <UML:Parameter stereotype="" package="" xmi.id="1" value="" type="&HTML_Template_Sigma" abstract="0" documentation="Template to use to render the widget." name="template" static="0" scope="200" />
+ </UML:Operation>
+ <UML:Attribute stereotype="" package="" xmi.id="104" value="" type="string" abstract="0" documentation="Photo filename." name="file" static="0" scope="202" />
+ <UML:Attribute stereotype="" package="" xmi.id="105" value="" type="string" abstract="0" documentation="Photo Description." name="desc" static="0" scope="202" />
+ </UML:Class>
</umlobjects>
<diagrams>
- <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" showgrid="1" showopsig="1" usefillcolor="1" snapx="10" snapy="10" showatts="1" xmi.id="2" documentation="" type="402" showops="1" showpackage="1" name="Class Diagram" localid="30000" showstereotype="0" showscope="1" font="Helvetica,10,-1,5,48,0,0,0,0,0" linecolor="#ff0000" >
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" showgrid="1" showopsig="0" usefillcolor="1" snapx="10" snapy="10" showatts="1" xmi.id="2" documentation="" type="402" showops="1" showpackage="1" name="Class Diagram" localid="30000" showstereotype="0" showscope="1" font="Helvetica,9,-1,5,48,0,0,0,0,0" linecolor="#ff0000" >
<widgets>
- <UML:ConceptWidget usesdiagramfillcolour="0" width="104" showattsigs="601" usesdiagramusefillcolour="0" x="211" linecolour="#ff0000" y="22" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="45" usefillcolor="1" showattributes="1" xmi.id="3" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
- <UML:ConceptWidget usesdiagramfillcolour="0" width="145" showattsigs="601" usesdiagramusefillcolour="0" x="191" linecolour="#ff0000" y="132" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="5" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
- <UML:ConceptWidget usesdiagramfillcolour="0" width="131" showattsigs="601" usesdiagramusefillcolour="0" x="41" linecolour="#ff0000" y="322" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="7" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
- <UML:ConceptWidget usesdiagramfillcolour="0" width="127" showattsigs="601" usesdiagramusefillcolour="0" x="352" linecolour="#ff0000" y="436" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="14" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
- <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="600" usesdiagramusefillcolour="0" x="46" linecolour="#ff0000" y="481" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="17" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
- <UML:ConceptWidget usesdiagramfillcolour="0" width="169" showattsigs="601" usesdiagramusefillcolour="0" x="420" linecolour="#ff0000" y="92" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="180" usefillcolor="1" showattributes="1" xmi.id="20" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
- <UML:ConceptWidget usesdiagramfillcolour="0" width="134" showattsigs="601" usesdiagramusefillcolour="0" x="196" linecolour="#ff0000" y="322" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="61" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
- <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="203" linecolour="#ff0000" y="436" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="76" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
- <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="355" linecolour="#ff0000" y="321" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="85" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,10,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="104" showattsigs="601" usesdiagramusefillcolour="0" x="235" linecolour="#ff0000" y="23" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="45" usefillcolor="1" showattributes="1" xmi.id="3" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="145" showattsigs="601" usesdiagramusefillcolour="0" x="215" linecolour="#ff0000" y="133" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="5" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="131" showattsigs="601" usesdiagramusefillcolour="0" x="67" linecolour="#ff0000" y="357" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="7" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="127" showattsigs="601" usesdiagramusefillcolour="0" x="379" linecolour="#ff0000" y="471" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="14" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="72" linecolour="#ff0000" y="514" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="17" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="169" showattsigs="601" usesdiagramusefillcolour="0" x="432" linecolour="#ff0000" y="103" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="180" usefillcolor="1" showattributes="1" xmi.id="20" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="134" showattsigs="601" usesdiagramusefillcolour="0" x="220" linecolour="#ff0000" y="357" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="61" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="227" linecolour="#ff0000" y="471" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="76" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="120" showattsigs="601" usesdiagramusefillcolour="0" x="382" linecolour="#ff0000" y="357" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="63" usefillcolor="1" showattributes="1" xmi.id="85" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
+ <UML:ConceptWidget usesdiagramfillcolour="0" width="160" showattsigs="601" usesdiagramusefillcolour="0" x="7" linecolour="#ff0000" y="132" showopsigs="600" usesdiagramlinecolour="0" fillcolour="#ffffc0" height="108" usefillcolor="1" showattributes="1" xmi.id="103" showoperations="1" showpackage="1" showscope="1" showstereotype="0" font="Helvetica,9,-1,5,48,0,0,0,0,0" />
</widgets>
<messages/>
<associations>
<UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="3" widgetaid="5" documentation="" type="500" >
<linepath>
- <startpoint startx="263" starty="132" />
- <endpoint endx="263" endy="67" />
+ <startpoint startx="287" starty="133" />
+ <endpoint endx="287" endy="68" />
</linepath>
</UML:AssocWidget>
<UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="1" widgetbid="5" widgetaid="7" documentation="" type="500" >
<linepath>
- <startpoint startx="106" starty="322" />
- <endpoint endx="227" endy="240" />
- <point x="167" y="281" />
+ <startpoint startx="132" starty="357" />
+ <endpoint endx="251" endy="241" />
</linepath>
</UML:AssocWidget>
<UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="7" widgetaid="17" documentation="" type="500" >
<linepath>
- <startpoint startx="106" starty="481" />
- <endpoint endx="106" endy="430" />
+ <startpoint startx="132" starty="514" />
+ <endpoint endx="132" endy="465" />
</linepath>
</UML:AssocWidget>
<UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="3" widgetaid="20" documentation="" type="500" >
<linepath>
- <startpoint startx="504" starty="92" />
- <endpoint endx="315" endy="44" />
- <point x="418" y="44" />
+ <startpoint startx="432" starty="193" />
+ <endpoint endx="339" endy="45" />
</linepath>
</UML:AssocWidget>
<UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="2" widgetbid="5" widgetaid="61" documentation="" type="500" >
<linepath>
- <startpoint startx="263" starty="322" />
- <endpoint endx="263" endy="240" />
+ <startpoint startx="287" starty="357" />
+ <endpoint endx="287" endy="241" />
</linepath>
</UML:AssocWidget>
<UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="61" widgetaid="76" documentation="" type="500" >
<linepath>
- <startpoint startx="263" starty="436" />
- <endpoint endx="263" endy="385" />
+ <startpoint startx="287" starty="471" />
+ <endpoint endx="287" endy="420" />
</linepath>
</UML:AssocWidget>
<UML:AssocWidget totalcounta="2" indexa="1" totalcountb="4" indexb="3" widgetbid="5" widgetaid="85" documentation="" type="500" >
<linepath>
- <startpoint startx="415" starty="321" />
- <endpoint endx="299" endy="240" />
+ <startpoint startx="442" starty="357" />
+ <endpoint endx="323" endy="241" />
</linepath>
</UML:AssocWidget>
<UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="85" widgetaid="14" documentation="" type="500" >
<linepath>
- <startpoint startx="415" starty="436" />
- <endpoint endx="415" endy="384" />
+ <startpoint startx="442" starty="471" />
+ <endpoint endx="442" endy="420" />
+ </linepath>
+ </UML:AssocWidget>
+ <UML:AssocWidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" widgetbid="3" widgetaid="103" documentation="" type="500" >
+ <linepath>
+ <startpoint startx="87" starty="132" />
+ <endpoint endx="235" endy="45" />
</linepath>
</UML:AssocWidget>
</associations>
<listitem open="0" type="814" id="47" label="contents" />
<listitem open="0" type="815" id="59" label="render" />
</listitem>
- <listitem open="1" type="813" id="76" label="Copy" >
+ <listitem open="0" type="813" id="76" label="Copy" >
<listitem open="0" type="815" id="79" label="BIFE_Copy" />
<listitem open="0" type="815" id="80" label="__construct" />
<listitem open="0" type="814" id="77" label="attrs" />
<listitem open="0" type="814" id="89" label="attrs" />
<listitem open="0" type="815" id="90" label="render" />
</listitem>
+ <listitem open="1" type="813" id="103" label="AlbumPhoto" >
+ <listitem open="0" type="815" id="106" label="BIFE_AlbumPhoto" />
+ <listitem open="0" type="815" id="107" label="__construct" />
+ <listitem open="0" type="814" id="105" label="desc" />
+ <listitem open="0" type="814" id="104" label="file" />
+ <listitem open="0" type="815" id="108" label="render" />
+ </listitem>
<listitem open="0" type="813" id="85" label="Root" >
<listitem open="0" type="815" id="87" label="BIFE_Root" />
<listitem open="0" type="815" id="88" label="__construct" />
--- /dev/null
+<?
+// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
+// +--------------------------------------------------------------------+
+// | BIFE - Buil It FastEr |
+// +--------------------------------------------------------------------+
+// | This file is part of BIFE. |
+// | |
+// | BIFE is free software; you can redistribute it and/or modify it |
+// | under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation; either version 2 of the License, or |
+// | (at your option) any later version. |
+// | |
+// | BIFE is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | 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 |
+// | Authors: Leandro Lucarella <luca@lugmen.org.ar> |
+// +--------------------------------------------------------------------+
+//
+// $Id$
+//
+
+$tmp = ini_get('include_path');
+ini_set('include_path', "../src:$tmp");
+unset($tmp);
+
+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';
+
+$file = 'photo.xbf';
+
+$template =& new HTML_Template_Sigma('templates');
+$template->setErrorHandling(PEAR_ERROR_PRINT);
+
+$parser =& new BIFE_Parser('BIFE_Copy');
+$page =& $parser->parseFile($file);
+$parser->__destruct();
+echo $page->render($template);
+
+?>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<Page title="Foto" use="AlbumPhoto">
+ <AlbumPhoto/>
+</Page>
<TD class="albumitem">
- <A class="albumitem" href="photo?photo={PHOTO}" title="{DESC}"><IMG alt="{DESC}" src="{THUMB}" class="albumitem"></A>
+ <A class="albumitem" href="photo?BIFE_AlbumPhoto_FILE={PHOTO}" title="{DESC}"><IMG alt="{DESC}" src="{THUMB}" class="albumitem"></A>
</TD>
--- /dev/null
+<A href="./"><IMG class="albumphoto" alt="{DESC}" src="{FILE}"/></A>
+<DIV class="albumphoto">{DESC}</DIV>
--- /dev/null
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE package SYSTEM "../package.dtd">
+<package version="1.0">
+ <name>BIFE</name>
+ <summary>Build It FastEr</summary>
+ <description>BIFE - Build It FastEr:
+BIFE is a framwork to separate the logic, contents and looks of a PHP
+application, inspired on BIF (Buil It Fast) but with speed in mind.
+One of the main goals of BIFE is to be fast.
+ </description>
+ <license>GPL</license>
+ <maintainers>
+ <maintainer>
+ <user>luca</user>
+ <name>Leandro Lucarella</name>
+ <email>luca@lugmen.org.ar</email>
+ <role>lead</role>
+ </maintainer>
+ </maintainers>
+
+ <release>
+ <version>0.8</version>
+ <date>2003-05-23</date>
+ <state>alpha</state>
+ <notes>
+ - Added a root blah... <!-- TODO completar -->
+ </notes>
+ <filelist>
+ <dir role="php" name="/" baseinstalldir="BIFE">
+ <file role="php" install-as="Parser.php">src/BIFE/Parser.php</file>
+ <file role="php" install-as="Widget.php">src/BIFE/Widget.php</file>
+ <file role="php" install-as="Container.php">src/BIFE/Container.php</file>
+ <file role="php" install-as="Root.php">src/BIFE/Root.php</file>
+ <file role="php" install-as="Fallback.php">src/BIFE/Fallback.php</file>
+ <file role="php" install-as="Page.php">src/BIFE/Page.php</file>
+ <file role="php" install-as="Copy.php">src/BIFE/Copy.php</file>
+ <file role="php" install-as="Generic.php">src/BIFE/Generic.php</file>
+ <file role="php" install-as="Title.php">src/BIFE/Title.php</file>
+ <file role="php" install-as="Album.php">src/BIFE/Album.php</file>
+ </dir>
+ <file role="doc" install-as="bife.xmi">doc/bife.xmi</file>
+ <file role="doc">examples/index.php</file>
+ <file role="doc">examples/simple.xbf</file>
+ <file role="doc">examples/templates/bife_page.html</file>
+ <file role="doc">examples/templates/bife_title.html</file>
+ <file role="doc">examples/templates/bife_album.html</file>
+ <file role="doc">examples/templates/bife_album_item.html</file>
+ <file role="doc">examples/templates/bife_album_emptyitem.html</file>
+ </filelist>
+ </release>
+ <deps>
+ <dep type="php" rel="ge">4.2.3</dep>
+ <dep type="pkg" rel="ge" version="1.0">HTML_Template_Sigma</dep>
+ </deps>
+</package>
+++ /dev/null
-<?php
-// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
-// +--------------------------------------------------------------------+
-// | Hooks |
-// +--------------------------------------------------------------------+
-// | This file is part of Hooks. |
-// | |
-// | Hooks is free software; you can redistribute it and/or modify it |
-// | under the terms of the GNU General Public License as published by |
-// | the Free Software Foundation; either version 2 of the License, or |
-// | (at your option) any later version. |
-// | |
-// | Hooks is distributed in the hope that it will be useful, but |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
-// | General Public License for more details. |
-// | |
-// | You should have received a copy of the GNU General Public License |
-// | along with Hooks; if not, write to the Free Software Foundation, |
-// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
-// +--------------------------------------------------------------------+
-// | Created: 2000 |
-// | Authors: Harpo Maxx <harpo@lugmen.org.ar> |
-// | Groucho Marx <groucho@lugmen.org.ar> |
-// | Leandro Lucarella <luca@lugmen.org.ar> |
-// +--------------------------------------------------------------------+
-//
-// $Id$
-//
-
-require_once 'Image/Transform.php';
-require_once 'HTML/Template/Sigma.php';
-
-/**
- * Generates a photo album.
- *
- * This library generates a photo album dinamically.
- *
- * @package Hooks
- * @subpackage Album
- * @author Leandro Lucarella <luca@lugmen.org.ar>
- * @author Harpo Maxx <harpo@lugmen.org.ar>
- * @author Groucho Marx <groucho@lugmen.org.ar>
- * @version $Rev$
- * @since rev 130
- * @access public
- */
-class Hook_Album {
-
- var $root;
- var $recursive;
- var $thumbsdir;
- var $thumbsformat;
- var $exts;
-
- /**
- * Constructor.
- *
- * @param string $root Root directory.
- * same row.
- * @param bool $recursive True if subdirectories must be
- * proccessed.
- * @param string $thumbsdir Directory where the thumbnails are (or
- * will be generated).
- * @param array $exts Comma separated extensions of photo files.
- *
- * @access public
- */
- function Hook_Album($root = '.', $recursive = true, $thumbsformat = 'jpeg', $thumbsdir = '.thumbs', $exts = 'png,jpg,jpeg,gif') {
- $this->root = $root ? $root : '.';
- $this->recursive = $recursive;
- $this->thumbsdir = $thumbsdir;
- $this->thumbsformat = $thumbsformat;
- $this->exts = preg_split('/\s*,\s*/', $exts);
- }
-
- /**
- * Shows the photo album.
- *
- * Shows the photo album.
- *
- * @param string $photo Selected photo.
- * @param int $max Maximum quantity of thumbnails to show. 0 for
- * unlimited.
- * @param int $cols How many thumbnails are shown in the
- *
- * @access public
- * @todo Implement the 'max' feature!
- * @todo Make the thumbs cache before showing the images so the
- * browser can find the with having to refresh.
- */
- function album(&$tpl, $photo = '', $max = 0, $cols = 4) {
- $tpl->loadTemplateFile('bife_album.html');
- $tpl->addBlockFile('ITEMS', 'ITEM', 'bife_album_item.html');
-
- $root = $this->root;
- $list = $this->getList();
- $tot = count($list);
- $rows = ceil($tot / $cols);
-
- for ($row = 0; $row < $rows; $row++) {
- for ($col = 0; $col < $cols; $col++) {
- $cur = $row*$cols+$col;
- if ($photo = @$list[$cur]) {
- $selected = ($photo['file'] === $photo);
- if (is_null($photo['thumb'])) {
- $photo['thumb'] = $this->makeThumb($photo['file']);
- }
- $tpl->setVariable(
- array(
- 'PHOTO' => $photo['file'],
- 'DESC' => $photo['desc'],
- 'THUMB' => $photo['thumb'],
- )
- );
- $tpl->parse('ITEM');
- } else {
- if (!@$empty) {
- $tpl->replaceBlockFile('ITEM',
- 'bife_album_emptyitem.html', true);
- $empty = true;
- }
- $tpl->touchBlock('ITEM');
- $tpl->parse('ITEM');
- }
- }
- $tpl->parse('FILA');
- }
- $tpl->setVariable('DESC', $this->getDescription());
- return $tpl->get();
- }
-
- /**
- * Shows a photo.
- *
- * Shows a photo.
- *
- * @param string $photo Photo to show.
- *
- * @access public
- * @since rev 131
- */
- function photo($photo) {
- list($path, $name, $ext) = File_Util::splitFilename($photo);
- $tpl =& new HTML_Template_Sigma('.');
- $tpl->loadTemplateFile('bife_album_photo.html');
- $tpl->setVariable(
- array(
- 'DESC' => $name,
- 'PHOTO' => $photo,
- )
- );
- $tpl->show();
- }
-
- /**
- * Makes a photo thumbnail.
- *
- * @param string $photo Source photo to create the thumbnail.
- * @param int $size Maximum thumbnail size.
- *
- * @return bool True on success, false on failure.
- *
- * @access public
- * @since rev 131
- */
- function makeThumb($photo, $size = 100) {
- $format = $this->thumbsformat;
- $thumb = $this->getThumbName($photo);
- list($path, $name, $ext) = File_Util::splitFilename($thumb);
-
- $img =& Image_Transform::factory('GD');
-
- $img->load($photo);
- // If image is larger than the maximum size, we resize it.
- if ($img->img_x > $size or $img->img_y > $size ) {
- if (!@is_dir($path) and !@mkdir($path)) {
- return false;
- }
- if (PEAR::isError($img)) {
- return false;
- }
- if (!$img->scale($size)) {
- return false;
- }
- }
- $img->save("$path/$name.$format", $format);
- $img->free();
-
- return true;
- }
-
- /**
- * Gets a list of photos with their descriptions and thumbnails.
- *
- * Returns an array of associative arrays with this keys:
- * <ul>
- * <li><b>file:</b> Photo filename.</li>
- * <li><b>desc:</b> Photo Description.</li>
- * <li><b>thumb:</b> Photo thumbnail filename.</li>
- * </ul>
- *
- * @return array Array of associative arrays with file, desc and
- * thumb.
- *
- * @access public
- */
- function getList() {
- $root = $this->root;
- $exts = $this->exts;
- $format = $this->thumbsformat;
- $return = array();
-
- $d = dir($root);
- while (($file = $d->read()) !== false) {
- list($path, $name, $ext) = File_Util::splitFilename("$root/$file");
- if (is_readable("$root/$file") and in_array($ext, $exts)) {
- $thumb = $this->getThumbName("$root/$file");
- $return[] = array(
- 'file' => "$root/$file",
- 'desc' => $name,
- 'thumb' => is_readable($thumb) ? $thumb : null,
- );
- }
- }
- $d->close();
-
- return $return;
- }
-
- /**
- * Gets a photo thumbnail name.
- *
- * @param string $photo Source photo to create the thumbnail.
- *
- * @return string Thumbnail name.
- *
- * @access public
- * @since rev 131
- */
- function getThumbName($photo) {
- $root = $this->root;
- $format = $this->thumbsformat;
- $thumbsdir = $this->thumbsdir;
-
- list($path, $name, $ext) = File_Util::splitFilename($photo);
-
- return "$root/$thumbsdir/$name.$format";
- }
-
- /**
- * Creates album thumbnails.
- *
- * @since rev 147
- * @access public
- */
- function createThumbs() {
- foreach ($this->getList() as $photo) {
- if (is_null($photo['thumb'])) {
- $photo['thumb'] = $this->makeThumb($photo['file']);
- }
- }
- }
-
- /**
- * Sets the album description.
- *
- * @param string $desc New album description.
- *
- * @returns bool True on success, false on failure.
- *
- * @since rev 147
- * @access public
- */
- function setDescription($desc) {
- $root = $this->root;
- $out = fopen("$root/.album", 'w');
- $ret = fputs($out, $desc);
- fclose($out);
- return $ret ? true : false;
- }
-
- /**
- * Gets the album description.
- *
- * @returns string Album description.
- *
- * @since rev 149
- * @access public
- */
- function getDescription() {
- $root = $this->root;
- return file_get_contents("$root/.album");
- }
-
-}
-
-// $Id$
-?>
require_once 'BIFE/Widget.php';
// ~X2C
+require_once 'Image/Transform.php';
+
// +X2C Class 20 :Album
/**
* Photo album widget. [TODO: Make a better explanation]
'SELECTED' => '',
'MAXROWS' => 0,
'COLUMNS' => 4,
+ // TODO - agregar atributo para el LINK, ver de hacer el
+ // widget de un link.
);
$this->attrs = array_merge($defaults, $attrs);
$this->attrs['EXTENSIONS'] = explode(',', $this->attrs['EXTENSIONS']);
$exts = $this->attrs['EXTENSIONS'];
$format = $this->attrs['THUMBSFORMAT'];
$return = array();
-
$d = dir($root);
- while (($file = $d->read()) !== false) {
- list($path, $name, $ext) = $this->splitFilename("$root/$file");
- if (is_readable("$root/$file") and in_array($ext, $exts)) {
- $thumb = $this->getThumbFilename("$root/$file");
- $return[] = array(
- 'file' => "$root/$file",
- 'desc' => $name,
- 'thumb' => is_readable($thumb) ? $thumb : null,
- );
- }
+ if ($d) {
+ while (($file = $d->read()) !== false) {
+ list($path, $name, $ext) = $this->splitFilename("$root/$file");
+ if (is_readable("$root/$file") and in_array($ext, $exts)) {
+ $thumb = $this->getThumbFilename("$root/$file");
+ $return[] = array(
+ 'file' => "$root/$name",
+ 'desc' => $name,
+ 'thumb' => is_readable($thumb) ? $thumb : null,
+ );
+ }
+ }
+ $d->close();
}
- $d->close();
-
return $return;
}
// -X2C
--- /dev/null
+<?php
+// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
+// +--------------------------------------------------------------------+
+// | BIFE - Buil It FastEr |
+// +--------------------------------------------------------------------+
+// | This file is part of BIFE. |
+// | |
+// | BIFE is free software; you can redistribute it and/or modify it |
+// | under the terms of the GNU General Public License as published by |
+// | the Free Software Foundation; either version 2 of the License, or |
+// | (at your option) any later version. |
+// | |
+// | BIFE is distributed in the hope that it will be useful, but |
+// | WITHOUT ANY WARRANTY; without even the implied warranty of |
+// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
+// | General Public License for more details. |
+// | |
+// | You should have received a copy of the GNU General Public License |
+// | along with Hooks; if not, write to the Free Software Foundation, |
+// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
+// +--------------------------------------------------------------------+
+// | Created: Sat May 24 00:54:15 2003 |
+// | Authors: Leandro Lucarella <luca@lugmen.org.ar> |
+// +--------------------------------------------------------------------+
+//
+// $Id$
+//
+
+// +X2C includes
+require_once 'BIFE/Widget.php';
+// ~X2C
+
+// +X2C Class 103 :AlbumPhoto
+/**
+ * Photo widget.
+ *
+ * @access public
+ */
+class BIFE_AlbumPhoto extends BIFE_Widget {
+ /**
+ * Photo filename.
+ *
+ * @var string $file
+ * @access protected
+ */
+ var $file;
+
+ /**
+ * Photo Description.
+ *
+ * @var string $desc
+ * @access protected
+ */
+ var $desc;
+
+ // ~X2C
+
+ // +X2C Operation 106
+ /**
+ * Constructor.
+ *
+ * @param array $attrs Attributes.
+ *
+ * @return void
+ * @access public
+ */
+ function BIFE_AlbumPhoto($attrs) // ~X2C
+ {
+ $this->__construct($attrs);
+ }
+ // -X2C
+
+ // +X2C Operation 107
+ /**
+ * Constructor.
+ *
+ * @param array $attrs Attributes.
+ *
+ * @return void
+ * @access public
+ */
+ function __construct($attrs) // ~X2C
+ {
+ $this->file = @$attrs['FILE'] ? $attrs['FILE'] : @$_REQUEST['BIFE_AlbumPhoto_FILE'];
+ $this->desc = @$attrs['DESC'] ? $attrs['DESC'] : basename($this->file);
+ }
+ // -X2C
+
+ // +X2C Operation 108
+ /**
+ * Renders the widget using a template returning a string with the results.
+ *
+ * @param HTML_Template_Sigma &$template Template to use to render the widget.
+ *
+ * @return string
+ * @access public
+ */
+ function render(&$template) // ~X2C
+ {
+ $template->loadTemplateFile('bife_albumphoto.html');
+ $template->setVariable(
+ array(
+ 'FILE' => $this->file,
+ 'DESC' => $this->desc,
+ )
+ );
+ return $template->get();
+ }
+ // -X2C
+
+} // -X2C Class :AlbumPhoto
+
+?>
+++ /dev/null
-<?php
-// vim: set expandtab tabstop=4 softtabstop=4 shiftwidth=4:
-// +--------------------------------------------------------------------+
-// | Hooks |
-// +--------------------------------------------------------------------+
-// | This file is part of Hooks. |
-// | |
-// | Hooks is free software; you can redistribute it and/or modify it |
-// | under the terms of the GNU General Public License as published by |
-// | the Free Software Foundation; either version 2 of the License, or |
-// | (at your option) any later version. |
-// | |
-// | Hooks is distributed in the hope that it will be useful, but |
-// | WITHOUT ANY WARRANTY; without even the implied warranty of |
-// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
-// | General Public License for more details. |
-// | |
-// | You should have received a copy of the GNU General Public License |
-// | along with Hooks; if not, write to the Free Software Foundation, |
-// | Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
-// +--------------------------------------------------------------------+
-// | Created: lun ene 6 17:22:31 ART 2003 |
-// | Authors: Leandro Lucarella <luca@lugmen.org.ar> |
-// +--------------------------------------------------------------------+
-//
-// $Id$
-//
-
-/**
- * General file utilities functions.
- *
- * This is a group of static functions for getting file info and other
- * stuff.
- *
- * @package Hooks
- * @author Leandro Lucarella <luca@lugmen.org.ar>
- * @version $Rev$
- * @since rev 122
- * @access public
- */
-class File_Util {
-
- /**
- * Splits a filename into path, filename and extension.
- *
- * @param string $file Filename to split.
- *
- * @return array Array where the first element (index 0) is the
- * path, the second is the name and the third is the
- * extension.
- *
- * @access public
- * @since rev 122
- */
- function splitFilename($file)
- {
- $path = preg_split('|/|', $file);
- $file = array_pop($path);
- $ext = '';
- if (strstr($file, '.')) {
- preg_match('|([^/]+?)(\.([^\.]*))?$|', $file, $m);
- $file = @$m[1] . ((@$m[2] == '.' ) ? '.' : '');
- $ext = @$m[3];
- }
- $dir = count($path) ? join('/', $path) : '';
- return array($dir, $file, $ext);
- }
-
- /**
- * Tells if a file is readable looking in the include path.
- *
- * @param string $file Name of the file to look for.
- *
- * @return bool True if file is readable, false if not.
- *
- * @access public
- * @since rev 122
- */
- function isReadableInclude($file)
- {
- list($dir, $page, $ext) = File_Util::splitFilename($file);
- if (is_readable($file)) {
- return true;
- }
- $include_path = array_unique(preg_split('/:/', ini_get('include_path')));
- foreach ($include_path as $path) {
- if (is_readable("$path/$file")) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Gets the last modification date/time for a file.
- *
- * @param string $file Name of the file to get the last modification
- * date/time.
- * @param string $format Format (see strftime).
- *
- * @return string Formated string with the last modification
- * date/time.
- *
- * @see strftime()
- * @access public
- * @since rev 142
- */
- function lastModified($file, $format = '%c')
- {
- return strftime($format, filemtime($file));
- }
-
-}
-
-// This is a workarround to live until PHP 4.3 is out and we can use the
-// native get_file_contents() function. We don't care about
-// $use_include_file option.
-function file_get_contents($file, $use_include_file = false)
-{
- if (@is_readable($file)) {
- $var = join('', file($file));
- } else {
- $var = '';
- }
- return $var;
-}
-
-?>