Re: [PHP] Writing IPTC tags
Dirk Bonenkamp - Bean IT wrote: Just wanted to know if it's possible to write iptc tags with php, and, if so, how? http://www.php.net/manual/en/function.iptcembed.php Ulf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Template class
Wolfram Kriesing wrote: i just wanted to say what i had to write, because i didnt see any of the existing template classes/engines provide me with that Go for Smarty or use PHP. Ulf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Smarty: Modifiers and $smarty
Hi, is there a way to access the calling smarty object from withing a modifier callback function? Regular smarty callback functions get passed a list of parameters of the function call as a first argument and a reference to the calling smarty object as a second argument. function my_smary_func($params, $smarty) { ... if (my_smarty_check_params($params, $allowed)) { return true; } $smarty-assign(); ... } That way you can not only modify the smarty object but access properties of the object. Two of them help me to generate error messages: $smarty-_current_line_no and $smarty-_current_file (btw. one should make them public). function my_smarty_check_params($params, $allowed, $smarty) { if (...) { return sprintf(Error on %s %d, $smarty-_current_file, ...); } ... } Can I do something similar with modifiers, which seem to have this format. Is there a way to access the calling smarty object? function my_smarty_modifier($value, $option = '', ...) { ??? $smarty-... ??? } Ulf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Standalone PHP Application
Shane Wright wrote: mm, thats true - there is no compiler as such. PHP probably isnt the right language for you in this case :( Dirty windows hack: http://www.deskcode.com/phpcompiler/ Ulf -- NetUSE AG Dr.-Hell-Straße Fon: +49 431 386 436 00 http://www.netuse.de/ D-24107 Kiel Fax: +49 431 386 435 99 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Standalone PHP Application
Ulf Wendel wrote: Shane Wright wrote: mm, thats true - there is no compiler as such. PHP probably isnt the right language for you in this case :( Dirty windows hack: http://www.deskcode.com/phpcompiler/ Uuups, that one is broken. But there's somethink like that. I once downloaded it. It's integrating the PHP script and the PHP interpreting into one .exe-File. Ulf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Standalone PHP Application
Ulf Wendel wrote: Dirty windows hack: http://www.deskcode.com/phpcompiler/ Uuups, that one is broken. But there's somethink like that. I once downloaded it. It's integrating the PHP script and the PHP interpreting into one .exe-File. Here's the announcement: http://www.phpbuilder.com/mail/php-developer-list/2001031/1305.php and there some more attempts e.g. http://sourceforge.net/projects/pbc/ Ulf -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] OOP and Future of PHP
Rasmus Lerdorf schrieb: If anyone has any idea, or tricks to hide information in a variables or method in a class, or in other words, make a variable or method a private, I would really like to know. Thanks for any comments. PHP also doesn't have introspection, so there isn't a good way for people to see what is in your API so a bit of obscurity should hide things for you. Hmm, the old, dirty hack print_r($obj). And the new functions: http://www.php.net/manual/en/function.get-class.php http://www.php.net/manual/en/function.get-class-vars.php http://www.php.net/manual/en/function.get-object-vars.php http://www.php.net/manual/en/function.get-class-methods.php ... I'd call these not only debugging function but functions that can be used for introspection. Anyway, people should not use parts of the API your documentation does not mention as public. Whoever does so, should reread the book on OOP. Yes, it could be better, but think of the zillions of PHP scripts that will break and all the beginners - PHP is quite often a beginners language - will ask you, Reuben, for support ;). Ulf -- Neu: PEAR Cache Erweiterung OutputCompression http://www.ulf-wendel.de/php/show_source.php?file=out_cache_com http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] OOP and Future of PHP
Yasuo Ohgaki schrieb: I don't use GDB, but it seems it supports traceback. How about Zend Debugger? Does it support? Anyone? http://dd.cron.ru/dbg/ ? Ulf -- Neu: PEAR Cache Erweiterung OutputCompression http://www.ulf-wendel.de/php/show_source.php?file=out_cache_com http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Global variables
Aaron Tuller schrieb: At 1:16 AM + 4/19/01, Philip Olson wrote: pre ?php var_dump($GLOBALS) ? /pre don't do that, at least I think it will recursively traverse the $GLOBALS arrary (since $GLOBALS itself is $GLOBAL) and you will never end. print_r() does have that bug, not var_dump(). http://www.php.net/manual/en/function.print-r.php Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variable variable
Jacky schrieb: !-- I got the value $id from a table and looping them and assign them to the check box name-- input type="checkbox" name ="$id" value="on" and when I submit the form to page foo.php4, at that page, I use Variable variable to call the value of the check box to see if it checked like this $quey = "select id from table"; $result = .. ( assumeing it is done and i got value for $id for all records from table) if ($$id =="on"){ echo "on"; }else{ echo "off"; } What's the value of $id in the second snippet? Generally speaking using $GLOBALS[$id] gives you more readable code but variable variables. Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Time needed for a SQL-statement
"B. Tenhumberg" schrieb: Is there a way to get the time the database needed for execution a statement? I use MySQL and PHP... Hmm, how about metering the overall time required by mysql_query() using microtime(), http://www.php.net/manual/en/function.microtime.php. As long as there's no network bottleneck between the database (server) and the application (server) you should be able to use that time as an approximate value. Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] variables empty
Dennis Haller schrieb: I've got this problem with variables. In the code below I've got the variables: $jaar and $vak, if I echo them they r displayed correctly, but if the function unlink is called it doesnt seem to know what $jaar and $vak are. If I do $the_path = "/home/H0RNET/ftp/jaar1/PRO/"; then the function unlink works just fine. Do I have to declare the 2 variables again? What is the problem here? Thx, H0RNET ?php $the_path = "/home/H0RNET/ftp/$jaar/$vak/"; if ($d) { unlink ("$the_path$d"); } What's the value of $d is unlink ever executed? Try unlink($the_path . $d). Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PEAR
Boget, Chris" schrieb: Unless I'm missing something, I've looked all over the PHP site for a link to PEAR but have been unable to find one (including in the PEAR section of the manual, where you would think it would be...). Could someone please provide a link? http://pear.php.net/ Don't be too disappointed about the website, some work on it is in progress and I'm sure there will soon be a website. For the moment you're requested to subscribe to the mailinglists listed on php.net top get help. Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] resource id #2
Greg K schrieb: I am trying to run a query and in my log I am getting a message the message resource id #2. $query=mysql_query("Select pass from members where uname='$username'"); $result = mysql_query($query) or die("You are not authorized to be here."); Can someone tell me what I am doing wrong and guide me in the right direction Please check the docs http://www.php.net/manual/en/ref.mysql.php / http://www.php.net/manual/en/function.mysql-fetch-row.php (don't forget to read the user comments!) and the usual sites for tutorials e.g. http://www.phpbuilder.com . Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PEAR
"Boget, Chris" schrieb: Unless I'm missing something, I've looked all over the PHP site for a link to PEAR but have been unable to find one (including in the PEAR section of the manual, where you would think it would be...). Could someone please provide a link? http://www.php.net/manual/en/pear.php Ok, where on the above page is a link to the actual code? The PEAR base class that is references all over that section of the manual? I read through that section of the manual http://cvs.php.net/viewcvs.cgi/php4/pear/, every PHP 4 source distribution contains the PEAR sources in the directory pear/. Check the README for install notes. Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] include path per script
Martn Marqus schrieb: Is it posible to change the value of include_path in a php script without changing it in php.ini? Try ini_set() friends, http://www.php.net/manual/en/function.ini-set.php . Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Want a Good Book for Ref on PHP
Christian Reiniger schrieb: On Monday 16 April 2001 08:23, you wrote: Personally, I never even bought a PHP book. I learned from the web only...hehe. Same here. Well, actually I *did* buy a book - "Core PHP programming". I started reading it, saw that it basically only covers (a) introductory programming in general (what is a 'while' loop?) and (b) a PHP3 function reference (copied from the online manual), and I immediately went back to the web resources. That doesn't mean you shouldn't buy any book - the cookbook for example certainly is very useful both as starter (giving examples) and later on (giving more complex examples :). Hmm, although Sterlings book is cool, german readers can save the money an check the german FAQ on http://www.koehntopp.de/php. It covers most of Sterlings book except the PHP core hacking. The advanced book I like best is "Web application development with PHP 4.0" written by TillTobel. Don't expect a PHP only book, the authors did very well not to copy the online reference or the usual tutorials. TillTobel wrote a book for those that have a solid basic programming knowledge but lack some more advanced skills like API design or certain web development strategies (CVS, staging server, development process, ...). Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Variables not getting passed when I post info
Brandon Orther schrieb: I made a GD script that made an image with the name of whatever page I was in in my web site. I would post info to it like this: http://www.domain.com/jpeg-out.php?title=FrontPage what ever I put for title it would make the image. After reinstalling php4 on my win2000 box with apache it doesn't seem to get the $title variable. Does anyone know what might be going wrong? Check register_globals, http://www.php.net/manual/en/html/configuration.html#ini.register-globals and make sure you're not trying to access a global variable from within a function. BTW, does your script contain img src="button.php?label=whatever" ? If you you've written a perfect killer application. The webserver has to handle your script ( 1st request = 1 process on the webserver) and all the img src="button.php... (another request = 2. process on the webserver). In case you embed 10 images that way, you'll get 10 + 1 processes on the webserver for 1 request done by the user. Image creation should be done in the skript, never use button.php - throw away all books and tutorials that tell you to do so. Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PEAR_Error
"Boget, Chris" schrieb: Is there any sample code for the above PEAR class around anywhere? You should ask this on the dedicated pear-general list. Examples are all over in the PEAR source. I preferr to use a simple wrapper for it like http://cvs.php.net/viewcvs.cgi/php4/pear/Cache/Error.php as I don't need all of the features for simple code. Stig's DB classes make more intensive use of it's features. Well, have a look at the source and keep on asking on the pear-general and/or pear-dev lists. Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Link to a html in PHP Code
Johannes Rumpf schrieb: I'm a pretty newby, so I have a question: How can I make a link to html or php or any other page in the internet in my PHP code? should be like Command ( "Http://www.xyz.com") Just like a link in a html site would be clicked. print 'a href="http://www.circle.ch"The engaged PHP portal of Urs Gehring/a'; BTW Johannes, there's a german language mailinglist on http://www.php-center.de and - what I preferr cause it's better ;) - the newsgroup de.comp.lang.php . Ulf -- Neu: PEAR Menu 3 - Navigationsstrukturen dynamisch dargestellt http://www.ulf-wendel.de/projekte/menu/tutorial.php | http://www.phpdoc.de -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear Cache.xml
uw Thu Mar 29 07:01:16 2001 EDT Added files: /php4/pear Cache.xml Log: - package XML for the Cache I'm not sure how to use the package.dtd to document packages and if at all the Cache can be it's own package, but one has to start with it... Sterling, Stig can you give me a hint? Index: php4/pear/Cache.xml +++ php4/pear/Cache.xml ?xml version="1.0" encoding="UTF-8"? !DOCTYPE Package SYSTEM "F:\cvs\php4\pear\package.dtd" Package Type="Source" NameCache/Name SummaryThe PEAR Cache Package is a generic data/content cache that can be used to cache data, output, function calls and dynamic graphic generation. /Summary Maintainer Initialschregu/Initials NameChristian Stocker/Name Email[EMAIL PROTECTED]/Email /Maintainer Release Version1.1/Version Date2001/03/27/Date Notesstable Code, SHM Implementation missing/Notes /Release FileList File Role="php"Cache.php/File DirCache//Dir /FileList /Package -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu_Browser.php
uw Thu Mar 29 12:58:37 2001 EDT Modified files: /php4/pear/Experimental/HTMLMenu_Browser.php Log: - Added an optional prefix for menu entries Index: php4/pear/Experimental/HTML/Menu_Browser.php diff -u php4/pear/Experimental/HTML/Menu_Browser.php:1.2 php4/pear/Experimental/HTML/Menu_Browser.php:1.3 --- php4/pear/Experimental/HTML/Menu_Browser.php:1.2Thu Mar 22 10:38:32 2001 +++ php4/pear/Experimental/HTML/Menu_Browser.phpThu Mar 29 12:58:37 2001 @@ -16,7 +16,7 @@ // | Authors: Ulf Wendel [EMAIL PROTECTED] | // +--+ // -// $Id: Menu_Browser.php,v 1.2 2001/03/22 18:38:32 uw Exp $ +// $Id: Menu_Browser.php,v 1.3 2001/03/29 20:58:37 uw Exp $ /** * Simple filesystem browser that can be used to generated menu (3) hashes based on the directory structure. @@ -45,7 +45,7 @@ * (title!). Subclass exploreFile() depending on your file format. * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Menu_Browser.php,v 1.2 2001/03/22 18:38:32 uw Exp $ +* @version $Id: Menu_Browser.php,v 1.3 2001/03/29 20:58:37 uw Exp $ */ class menubrowser { @@ -95,6 +95,19 @@ /** +* Prefix for every menu hash entry. +* +* Set the ID prefix if you want to merge the browser menu +* hash with another (static) menu hash so that there're no +* name clashes with the ids. +* +* @var string +* @see setIDPrefix() +*/ +var $id_prefix = ""; + + +/** * Menu (3)'s setMenu() hash. * * @var array @@ -103,7 +116,7 @@ /** -* Creates the object and optionally sets the directoryto scan. +* Creates the object and optionally sets the directory to scan. * * @paramstring * @see $dir @@ -137,16 +150,32 @@ /** +* Sets the prefix for every id in the menu hash. +* +* @paramstring +* @access public +*/ +function setIDPrefix($prefix) { + +$this-id_prefix = $prefix; + +} // end func setIDPrefix + + +/** * Returns a hash to be used with menu(3)'s setMenu(). * * @paramstring directory to scan +* @paramstring id prefix * @access public */ -function getMenu($dir = "") { +function getMenu($dir = "", $prefix = "") { if ($dir) $this-setDirectory($dir); - +if ($prefix) +$this-setIDPrefix($prefix); + // drop the result of previous runs $this-files = array(); @@ -181,11 +210,11 @@ if (file_exists($ffile . $this-index_file)) { $id++; -$struct[$id]["url"] = $ffile . $this-index_file; +$struct[$this-id_prefix . $id]["url"] = $ffile . $this-index_file; $sub = $this-browse($ffile, $id + 1, true); if (0 != count($sub)) - $struct[$id]["sub"] = $sub; + $struct[$this-id_prefix . $id]["sub"] = $sub; } @@ -194,7 +223,7 @@ if ($this-file_suffix == substr($file, strlen($file) - $this-file_suffix_length, $this-file_suffix_length) !($noindex $this-index_file == $file) ) { $id++; -$struct[$id]["url"] = $dir . $file; +$struct[$this-id_prefix . $id]["url"] = $dir . $file; } } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/XML fo2pdf.php sql2xml.php sql2xml_ext.php
uw Thu Mar 29 13:26:53 2001 EDT Modified files: /php4/pear/Experimental/XML fo2pdf.php sql2xml.php sql2xml_ext.php Log: - added basic phpdoc doc comments - lots of whitespaces - renamed functions from get_xy to the PEAR getXY Chregu, sorry for this commit in case it breaks your code, I don't like all of the coding guides myself but we should follow them, even if they break the code in our companies. Index: php4/pear/Experimental/XML/fo2pdf.php diff -u php4/pear/Experimental/XML/fo2pdf.php:1.3 php4/pear/Experimental/XML/fo2pdf.php:1.4 --- php4/pear/Experimental/XML/fo2pdf.php:1.3 Thu Mar 29 02:13:50 2001 +++ php4/pear/Experimental/XML/fo2pdf.php Thu Mar 29 13:26:53 2001 @@ -15,7 +15,7 @@ // | Authors: Christian Stocker [EMAIL PROTECTED] | // +--+ // -// $Id: fo2pdf.php,v 1.3 2001/03/29 10:13:50 chregu Exp $ +// $Id: fo2pdf.php,v 1.4 2001/03/29 21:26:53 uw Exp $ /** @@ -62,9 +62,9 @@ *$fop = new xml_fo2pdf("simple.fo"); *//print pdf to the outputbuffer, *// including correct Header ("Content-type: application/pdf") -*$fop-print_pdf(); +*$fop-printPDF(); *//delete the temporary pdf file -*$fop-delete_pdf(); +*$fop-deletePDF(); * * With Cache: *require_once("XML/fo2pdf.php"); @@ -79,12 +79,12 @@ * die(); *} *$fop = new xml_fo2pdf("simple.fo"); -*$fop-print_pdf(); -*$fop-delete_pdf(); +*$fop-printPDF(); +*$fop-deletePDF(); *print $cache-end("+30"); * * @author Christian Stocker [EMAIL PROTECTED] -* @version $Id: fo2pdf.php,v 1.3 2001/03/29 10:13:50 chregu Exp $ +* @version $Id: fo2pdf.php,v 1.4 2001/03/29 21:26:53 uw Exp $ * @package XML */ @@ -95,14 +95,14 @@ * * @var string */ - var $fo; + var $fo = ""; /** * pdf-file used in this class * * @var string */ - var $pdf; + var $pdf = ""; /** * Where the temporary fo and pdf files should be stored @@ -122,22 +122,21 @@ /** * constructor * One can pass an input fo-file already here (the other possibility - * is with the run or run_from_string method). + * is with the run or runFromString method). * and if the pdf should be stored permanently, a filename/path for * that can also be passed here. * - * @params string file input fo-file - * @params string file output pdf-file - * @return Null - * @see run(), run_from_string(), run_from_file() + * @paramstring file input fo-file + * @paramstring file output pdf-file + * @see run(), runFromString(), runFromFile() */ - function xml_fo2pdf($fo="", $pdf="") + function xml_fo2pdf($fo = "", $pdf = "") { - if ($fo) { $this-run($fo, $pdf); } } + /** * Calls the Main Fop-Java-Programm * @@ -147,14 +146,12 @@ * if the pdf is not passed or empty/false, a temporary pdf-file * will be created * - * @params string file input fo-file - * @params string file output pdf-file - * @params Boolean if the fo should be deleted after execution - * @return Null - * @see run_from_string() + * @paramstring file input fo-file + * @paramstring file output pdf-file + * @paramboolean if the fo should be deleted after execution + * @see runFromString() */ - - function run($fo, $pdf="", $DelFo=False) + function run($fo, $pdf = "", $DelFo = False) { if (!$pdf) $pdf = tempnam($this-tmpdir, $this-tmppdfprefix); @@ -165,7 +162,7 @@ $java = new Java("org.apache.fop.apps.CommandLine", $options); $java-run(); if ($DelFo) { - $this-delete_fo ($fo); + $this-deleteFo($fo); } } @@ -179,12 +176,11 @@ * temporary fo-file is created here (and will be deleted * in the run() function.) * - * @params string fo input fo-string - * @params string file output pdf-file - * @return Null + * @paramstring fo input fo-string + * @paramstring file output pdf-file * @see run() */ - function run_from_string($fostring, $pdf="") + function runFromString($fostring, $pdf = "") { $fo = tempnam($this-tmpdir, $this-tmppdfprefix); $fp = fopen($fo, "w+"); @@ -197,12 +193,11 @@ * * This method just calls run * - * @params string fo input fo-string - * @params string file output pdf-file - * @return Null + * @param
[PHP-CVS] cvs: php4 /pear/HTML IT.php ITX.php IT_Error.php
uw Thu Mar 29 13:49:15 2001 EDT Added files: /php4/pear/HTML IT_Error.php Modified files: /php4/pear/HTML IT.php ITX.php Log: - Pearified the error handling Index: php4/pear/HTML/IT.php diff -u php4/pear/HTML/IT.php:1.4 php4/pear/HTML/IT.php:1.5 --- php4/pear/HTML/IT.php:1.4 Thu Feb 8 14:19:59 2001 +++ php4/pear/HTML/IT.php Thu Mar 29 13:49:15 2001 @@ -16,8 +16,11 @@ // | Authors: Ulf Wendel [EMAIL PROTECTED] | // +--+ // -// $Id: IT.php,v 1.4 2001/02/08 22:19:59 chagenbu Exp $ +// $Id: IT.php,v 1.5 2001/03/29 21:49:15 uw Exp $ // + +require_once("HTML/IT_Error.php"); + /** * Integrated Template - IT * @@ -108,55 +111,40 @@ * $tpl-get(); * /code * -* @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: IT.php,v 1.4 2001/02/08 22:19:59 chagenbu Exp $ -* @accesspublic +* @author Ulf Wendel [EMAIL PROTECTED] +* @version $Id: IT.php,v 1.5 2001/03/29 21:49:15 uw Exp $ +* @access public +* @package IX[X] */ class IntegratedTemplate { /** * Contains the error objects -* @vararray -* @accesspublic -* @seehalt(), $printError, $haltOnError +* @var array +* @access public +* @see halt(), $printError, $haltOnError */ var $err = array(); /** -* Print error messages? -* @varboolean -* @accesspublic -* @seehalt(), $haltOnError, $err -*/ -var $printError = false; - -/** -* Call die() on error? -* @varboolean -* @accesspublic -* @seehalt(), $printError, $err -*/ -var $haltOnError = false; - -/** * Clear cache on get()? -* @varboolean +* @var boolean */ var $clearCache = false; /** * First character of a variable placeholder ( _{_VARIABLE} ). -* @varstring -* @accesspublic -* @see$closingDelimiter, $blocknameRegExp, $variablenameRegExp +* @var string +* @access public +* @see $closingDelimiter, $blocknameRegExp, $variablenameRegExp */ var $openingDelimiter = "{"; /** * Last character of a variable placeholder ( {VARIABLE_}_ ). -* @varstring -* @accesspublic -* @see$openingDelimiter, $blocknameRegExp, $variablenameRegExp +* @var string +* @access public +* @see $openingDelimiter, $blocknameRegExp, $variablenameRegExp */ var $closingDelimiter = "}"; @@ -164,9 +152,9 @@ * RegExp matching a block in the template. * Per default "sm" is used as the regexp modifier, "i" is missing. * That means a case sensitive search is done. -* @varstring -* @accesspublic -* @see$variablenameRegExp, $openingDelimiter, $closingDelimiter +* @var string +* @access public +* @see $variablenameRegExp, $openingDelimiter, $closingDelimiter */ var $blocknameRegExp= "[0-9A-Za-z_-]+"; @@ -174,83 +162,83 @@ * RegExp matching a variable placeholder in the template. * Per default "sm" is used as the regexp modifier, "i" is missing. * That means a case sensitive search is done. -* @varstring -* @accesspublic -* @see$blocknameRegExp, $openingDelimiter, $closingDelimiter +* @var string +* @access public +* @see $blocknameRegExp, $openingDelimiter, $closingDelimiter */ var $variablenameRegExp= "[0-9A-Za-z_-]+"; /** * RegExp used to find variable placeholder, filled by the constructor. * @var stringLooks somewhat like @(delimiter varname delimiter)@ - * @access public -* @seeIntegratedTemplate() +* @access public +* @see IntegratedTemplate() */ var $variablesRegExp = ""; /** * RegExp used to strip unused variable placeholder. -* @brother$variablesRegExp +* @brother $variablesRegExp */ var $removeVariablesRegExp = ""; /** * Controls the handling of unknown variables, default is remove. -* @varboolean -* @access public +* @var boolean +* @access public */ var $removeUnknownVariables = true; /** * Controls the handling of empty blocks, default is remove. -* @varboolean -* @access public +* @var boolean +* @access public */ var $removeEmptyBlocks = true; /** * RegExp used to find blocks an their content, filled by the constructor. -* @varstring -* @seeIntegratedTemplate() +* @var string +* @see Integra
[PHP-CVS] cvs: php4 /pear IT[X].xml package.dtd
uw Thu Mar 29 13:54:27 2001 EDT Added files: /php4/pear IT[X].xml Modified files: /php4/pear package.dtd Log: - Added a package xml file for IT[X] templates Index: php4/pear/package.dtd diff -u php4/pear/package.dtd:1.2 php4/pear/package.dtd:1.3 --- php4/pear/package.dtd:1.2 Tue Jan 9 17:01:52 2001 +++ php4/pear/package.dtd Thu Mar 29 13:54:27 2001 @@ -1,5 +1,5 @@ !-- - $Id: package.dtd,v 1.2 2001/01/10 01:01:52 ssb Exp $ + $Id: package.dtd,v 1.3 2001/03/29 21:54:27 uw Exp $ This is the PEAR package description, version 1.0. It should be used with the informal public identifier: @@ -20,68 +20,81 @@ Stig S. Bakken [EMAIL PROTECTED] -- +!ENTITY nbsp "test" !--== attributes present in all elements ==-- -!ENTITY % global.atts "id ID #IMPLIED" - +!ENTITY % global.atts "id ID #IMPLIED" !--== attributes common to several elements ===-- -!ENTITY % role.atts "Role (php|ext|test|doc) 'php'" -!ENTITY % extension.atts "Debug (on|off) 'off' +!ENTITY % role.atts "Role (php|ext|test|doc) 'php'" +!ENTITY % extension.atts "Debug (on|off) 'off' ThreadSafe (on|off) 'off'" -!ENTITY % format.atts "Format CDATA #IMPLIED" - +!ENTITY % format.atts "Format CDATA #IMPLIED" !--=== ELEMENT: Package ===-- -!ELEMENT Package (Name,Summary,Maintainer,Release,FileList) -!ATTLIST Package %global.atts; - Type(Source|Binary) 'Binary' - +!ELEMENT Package (Name, Summary, Maintainer, Release, FileList) +!ATTLIST Package + %global.atts; + Type (Source | Binary) "Binary" + !--=== ELEMENT: Name ==-- -!ELEMENT Name (#PCDATA) -!ATTLIST Name %global.atts; - +!ELEMENT Name (#PCDATA) +!ATTLIST Name + %global.atts; + !--=== ELEMENT: Summary ===-- -!ELEMENT Summary (#PCDATA) -!ATTLIST Summary %global.atts; - +!ELEMENT Summary (#PCDATA) +!ATTLIST Summary + %global.atts; + !--=== ELEMENT: Maintainer -- -!ELEMENT Maintainer (Initials,Name,Email) -!ATTLIST Maintainer %global.atts; - +!ELEMENT Maintainer (Initials, Name, Email) +!ATTLIST Maintainer + %global.atts; + !--=== ELEMENT: Initials ==-- -!ELEMENT Initials (#PCDATA) -!ATTLIST Initials %global.atts; - +!ELEMENT Initials (#PCDATA) +!ATTLIST Initials + %global.atts; + !--=== ELEMENT: Email =-- -!ELEMENT Email(#PCDATA) -!ATTLIST Email%global.atts; - +!ELEMENT Email (#PCDATA) +!ATTLIST Email + %global.atts; + !--=== ELEMENT: Release ===-- -!ELEMENT Release (Version,Date,Notes?) -!ATTLIST Release %global.atts; - +!ELEMENT Release (Version, Date, Notes?) +!ATTLIST Release + %global.atts; + !--=== ELEMENT: Version ===-- -!ELEMENT Version (#PCDATA) -!ATTLIST Version %global.atts; - +!ELEMENT Version (#PCDATA) +!ATTLIST Version + %global.atts; + !--=== ELEMENT: Date =-- -!ELEMENT Date (#PCDATA) -!ATTLIST Date %global.atts; - +!ELEMENT Date (#PCDATA) +!ATTLIST Date + %global.atts; + !--=== ELEMENT: Notes =-- -!ELEMENT Notes(#PCDATA) -!ATTLIST Notes%global.atts; - +!ELEMENT Notes (#PCDATA) +!ATTLIST Notes + %global.atts; + !--=== ELEMENT: FileList ==-- -!ELEMENT FileList (Dir | File)* -!ATTLIST FileList %global.atts; - +!ELEMENT FileList (Dir | File)* +!ATTLIST FileList + %global.atts; + !--=== ELEMENT: Dir ===-- -!ELEMENT Dir (#PCDATA) -!ATTLIST Dir %global.atts; - +!ELEMENT Dir (#PCDATA) +!ATTLIST Dir + %global.atts; + !--=== ELEMENT: File ==-- -!ELEMENT File (#PCDATA) -!ATTLIST File %global.atts; -%role.atts; -%extension.atts; -%format.atts; +!ELEMENT File (#PCDATA) +!ATTLIST File + %global.atts;
[PHP-CVS] cvs: php4 /pear package.dtd
uw Thu Mar 29 14:01:52 2001 EDT Modified files: /php4/pear package.dtd Log: - uuups, modified the package.dtd, undo Index: php4/pear/package.dtd diff -u php4/pear/package.dtd:1.3 php4/pear/package.dtd:1.4 --- php4/pear/package.dtd:1.3 Thu Mar 29 13:54:27 2001 +++ php4/pear/package.dtd Thu Mar 29 14:01:52 2001 @@ -1,5 +1,5 @@ !-- - $Id: package.dtd,v 1.3 2001/03/29 21:54:27 uw Exp $ + $Id: package.dtd,v 1.4 2001/03/29 22:01:52 uw Exp $ This is the PEAR package description, version 1.0. It should be used with the informal public identifier: @@ -20,8 +20,6 @@ Stig S. Bakken [EMAIL PROTECTED] -- -!ENTITY nbsp "test" - !--== attributes present in all elements ==-- !ENTITY % global.atts "id ID #IMPLIED" !--== attributes common to several elements ===-- -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/Image color_helper.php
uw Wed Mar 28 01:51:11 2001 EDT Added files: /php4/pear/Experimental/Image color_helper.php Log: Widget functions to deal with colors when creating images. I'm not sure where I should place this, lets wait for the next classes (gtext, gbutton) before we take care on the correct directory structure so we can see if it's worth it's own directory. Index: php4/pear/Experimental/Image/color_helper.php +++ php4/pear/Experimental/Image/color_helper.php ?php /** * Widget stuff: color translation, ... * * Several widget functions to deal with images especially simple * functions to convert userdefined colors into RGB colors. * * @author Ulf Wendel [EMAIL PROTECTED] * @version $Id: color_helper.php,v 1.1 2001/03/28 09:51:11 uw Exp $ */ class ColorHelper { /** * Mapping from named colors to RGB values. * * @var array * @see color2RGB() */ var $colornames = array( "white"= array(255, 255, 255), "black"= array(0, 0, 0), "red" = array(255, 0, 0), "green"= array(0, 255, 0), "blue" = array(0, 0, 255) ); /** * Translates a userdefined color specification into an array of RGB integer values. * * Several formats can be handled. HTML like hexadecimal colors like #f0ff00, * names colors, arrays of RGB integer values and strings with percentage values * like %100,%50,%20. If the format is unknown black gets returned [0, 0, 0]. * * @var mixed Color in various formats: #f0f0f0, %20,%100,%0, * named - black, white..., [int 0 - 255, int 0 - 255, int 0 - 255] * @return array RGB color [int red, int green, int blue] * @access public * @see $colornames, HTMLColor2RGB(), PercentageColor2RGB(), NamedColor2RGB() */ function color2RGB($color) { if (is_array($color)) { // looks good... if (3 == count($color)) { // check the range foreach ($color as $k = $v) { if ($v 0) $color[$k] = 0; else if ($v 255) $color[$k] = 255; else $color[$k] = (int)$v; } return $color; } // unknown format - return black return array(0, 0 , 0); } // #f0f0f0 if ("#" == $color{0}) return $this-HTMLColor2RGB($color); // %50,%100,%50 if ("%" == $color{0}) return $this-PercentageColor2RGB($color); // might be a color name return $this-NamedColor2RGB($color); } // end func color2RGB /** * Allocates a color in the given image. * * Userdefined color specifications get translated into * an array of rgb values. * * @paramresourceImage handle * @parammixed (Userdefined) color specification * @return resourceImage color handle * @see color2RGB() * @access public */ function allocateColor($img, $color) { $color = $this-color2RGB($color); return ImageColorAllocate($img, $color[0], $color[1], $color[2]); } // end func allocateColor /** * Returns the RGB integer values of an HTML like hexadecimal color like #00ff00. * * @paramstring HTML like hexadecimal color like #00ff00 * @return array [int red, int green, int blue], * returns black [0, 0, 0] for invalid strings. * @access public */ function HTMLColor2RGB($color) { if (strlen($color) != 7) return array(0, 0, 0); return array( hexdec(substr($color, 1, 2)), hexdec(substr($color, 3, 2)), hexdec(substr($color, 5, 2)) ); } // end func HTMLColor2RGB /** * Returns the RGB interger values of a named color, [0,0,0] if unknown. * * The class variable $colornames is used to resolve * the color names. Modify it if neccessary. * * @paramstring Case insensitive color name. * @return array [int red, int green, int blue], * returns black [0, 0, 0] if the color is unknown. * @access public * @see $colornames */ function NamedColor2RGB($color) { $color = strtolower($color); if (!isset($this-colornames[
[PHP-CVS] cvs: php4 /pear/Experimental/Image gtext.php
uw Wed Mar 28 04:48:36 2001 EDT Added files: /php4/pear/Experimental/Image gtext.php Log: Creates graphical text images using Cache/Graphics. Although it's unlikely that the API will changed use it with care some features seen to be broken :/. Index: php4/pear/Experimental/Image/gtext.php +++ php4/pear/Experimental/Image/gtext.php ?php // +--+ // | PHP version 4.0 | // +--+ // | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | // +--+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is| // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | [EMAIL PROTECTED] so we can mail you a copy immediately. | // +--+ // | Authors: Ulf Wendel [EMAIL PROTECTED] | // +--+ require_once("Image/color_helper.php"); /** * Creates graphical texts. * * FIXME - Usage example missing - FIXME * * @author Ulf Wendel [EMAIL PROTECTED] * @version $Id: gtext.php,v 1.1 2001/03/28 12:48:36 uw Exp $ */ class gtext extends ColorHelper { /** * Characters with descenders. * * ImageTTFBox() gives you the correct width of a text but not the correct height. * It does not return the body size but the size from the baseline to the ascender. * For correct vertical alignment of texts that contain characters which have * descenders (font dependend) you must perform an extra test to get the correct * height. * * The string is used as a regular expression. Make sure, that you escaped all * special characters. * * @var string All characters with descenders in the font you use. * Default should work with Arial. * @access public */ var $descenders = "fgjpqßyGJYµ|´,;{}\[\]§_@¢µ¶çýÿþ¿Ç"; /** * String used to measure the size of descenders. * * buildImage() uses a dirty hack to measure the size of descenders. * It generates an image with the descender sign and scans the image... * * @var string String used to draw a test image to find the size of * descenders. */ var $descender_string = "gG"; /** * Graphics cache object used to create the images * * FIXME - description missing * * @var object Cache_Graphics */ var $cache; /** * Properties of the gtext image. * * * @var array */ var $properties = array( "fontsize" = 20, "fgcolor" = "black", "fontdir" = "", "font" = "arial", "transparent" = "white", "bgcolor" = "white", "padding" = 4 ); /** * Unused list of allowed properties * * FIXME - It's does not have any meaning - just to give you an idea on the features. * * @var array */ var $allowed = array( "fontsize" = "integer", "fgcolor" = "mixed", "fontdir" = "strint", "bold" = "boolean", "italic"= "boolean", "transparent" = "mixed", "padding" = "integer", "bgcolor" = "mixed", "background"= "string", "bgstrech" = "boolean", "bgcenter"
[PHP-CVS] cvs: php4 /pear/HTML Menu.php
uw Wed Mar 28 04:58:24 2001 EDT Added files: /php4/pear/HTML Menu.php Log: Moved menu.php to the stable code. I didn't get any bug reports and it works for me... Index: php4/pear/HTML/Menu.php +++ php4/pear/HTML/Menu.php ?php // // +--+ // | PHP version 4.0 | // +--+ // | Copyright (c) 1997-2001 The PHP Group| // +--+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is| // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | [EMAIL PROTECTED] so we can mail you a copy immediately. | // +--+ // | Authors: Ulf Wendel [EMAIL PROTECTED]| // +--+ // // $Id: Menu.php,v 1.1 2001/03/28 12:58:23 uw Exp $$ // /** * Generates a HTML menu from a multidimensional hash. * * Special thanks to the original author: Alex Vorobiev [EMAIL PROTECTED]. * * @version $Id: Menu.php,v 1.1 2001/03/28 12:58:23 uw Exp $ * @author Ulf Wendel [EMAIL PROTECTED] * @access public * @package HTML */ class menu { /** * Menu structure as a multidimensional hash. * * @var array * @see setMenu(), Menu() */ var $menu = array(); /** * Mapping from URL to menu path. * * @var array * @see getPath() */ var $urlmap = array(); /** * Menu type: tree, rows, you-are-here. * * @var array * @see setMenuType() */ var $menu_type = "tree"; /** * Path to a certain menu item. * * Internal class variable introduced to save some recursion overhead. * * @var array * @see get(), getPath() */ var $path = array(); /** * Generated HTML menu. * * @var string * @see get() */ var $html = ""; /** * URL of the current page. * * This can be the URL of the current page but it must not be exactly the * return value of getCurrentURL(). If there's no entry for the return value * in the menu hash getPath() tries to find the menu item that fits best * by shortening the URL sign by sign until it finds an entry that fits. * * @see getCurrentURL(), getPath() */ var $current_url = ""; /** * Initializes the menu, sets the type and menu structure. * * @paramarray * @paramstring * @see setMenuType(), setMenu() */ function menu($menu = "", $type = "tree") { if (is_array($menu)) $this-setMenu($menu); $this-setMenuType($type); } // end constructor /** * Sets the menu structure. * * The menu structure is defined by a multidimensional hash. This is * quite "dirty" but simple and easy to traverse. An example * show the structure. To get the following menu: * * 1 - Projects * 11 - Projects = PHPDoc * 12 - Projects = Forms * 2 - Stuff * * you need the array: * * $menu = array( * 1 = array( * "title" = "Projects", * "url" = "/projects/index.php", * "sub" = array( * 11 = array( * "title" = "PHPDoc", * ... * ), * 12 = array( ... ), * ) * ), * 2 = array( "title" = "Stuff", "url" = "/stuff/index.php" ) *) * * Note the index "sub" and the nesting. Note also that 1, 11, 12, 2 * must be unique. The class uses them as ID's. * * @paramarray * @access public * @see append(), update(), delete() */ function setMenu($menu) { $this-menu = $menu; $this-urlmap = array(); } // end func setMenu /** * Sets the type / format of the menu: tree, rows or urhere. * * @paramstring "t
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu.php
uw Wed Mar 28 04:58:58 2001 EDT Removed files: /php4/pear/Experimental/HTMLMenu.php Log: Moved it to the stable code. -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/Image gbutton.php
uw Wed Mar 28 05:07:16 2001 EDT Added files: /php4/pear/Experimental/Image gbutton.php Log: Very much the same like gtext but this one can be used to render graphical buttons. Index: php4/pear/Experimental/Image/gbutton.php +++ php4/pear/Experimental/Image/gbutton.php ?php // // +--+ // | PHP version 4.0 | // +--+ // | Copyright (c) 1997-2001 The PHP Group| // +--+ // | This source file is subject to version 2.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is| // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | [EMAIL PROTECTED] so we can mail you a copy immediately. | // +--+ // | Authors: Ulf Wendel [EMAIL PROTECTED]| // +--+ // // $Id: gbutton.php,v 1.1 2001/03/28 13:07:16 uw Exp $ // /** * Creates graphical buttons. * * @author Ulf Wendel [EMAIL PROTECTED] * @version $Id: gbutton.php,v 1.1 2001/03/28 13:07:16 uw Exp $ */ class gbutton extends gtext { var $properties = array( "fontsize" = 20, "fgcolor" = "black", "fontdir" = "c:/www/apache/gtext/", "font" = "arial", "border"= 1, "bordercolor" = "black", "padding" = 2 ); var $allowed = array( "fontsize" = "integer", "fgcolor" = "mixed", "fontdir" = "strint", "bold" = "boolean", "italic"= "boolean", "transparent" = "mixed", "padding" = "integer", "bgcolor" = "mixed", "background"= "string", "bgstrech" = "boolean", "bgcenter" = "boolean", "border"= "integer", "bordercolor" = "mixed", "3d"= "integer", "3dlightcolor" = "mixed", "3ddarkcolor" = "mixed", "statusbar" = "string", "name" = "string", "submit"= "boolean", "href" = "string", "align" = "string", "valign"= "string", "width" = "integer", "height"= "integer" ); function createImageTag($id, $text, $properties, $link) { $size = getImageSize($link[0]); $name = (isset($properties["name"])) ? $properties["name"] : ""; $js_over = ""; $js_out = ""; if (isset($properties["statusbar"])) { $name = $id; $js_over .= sprintf(
[PHP-CVS] cvs: php4 /pear/Experimental/Image gtext.php
uw Wed Mar 28 05:56:35 2001 EDT Modified files: /php4/pear/Experimental/Image gtext.php Log: - fixed the vertical alignment bug Index: php4/pear/Experimental/Image/gtext.php diff -u php4/pear/Experimental/Image/gtext.php:1.1 php4/pear/Experimental/Image/gtext.php:1.2 --- php4/pear/Experimental/Image/gtext.php:1.1 Wed Mar 28 04:48:36 2001 +++ php4/pear/Experimental/Image/gtext.php Wed Mar 28 05:56:33 2001 @@ -23,7 +23,7 @@ * FIXME - Usage example missing - FIXME * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: gtext.php,v 1.1 2001/03/28 12:48:36 uw Exp $ +* @version $Id: gtext.php,v 1.2 2001/03/28 13:56:33 uw Exp $ */ class gtext extends ColorHelper { @@ -304,7 +304,7 @@ $descender_height = 2 * $font_height; -// temporary image to draw on +// temporary image to draw on $tmp_img = @ImageCreate($descender_width, $descender_height); $bg_color = $this-allocateColor($tmp_img, "white"); $fg_color = $this-allocateColor($tmp_img, "black"); @@ -318,16 +318,14 @@ // scanning the height of a descender // search the lower right edge for ($yb = $descender_height; $yb = 0; $yb--) -for ($x = $descender_width; $x = 0; $x--) -if (ImageColorAt($tmp_img, $x, $yb) == $fg_color) -break 2; - -for ($yt = 0; $yt = $descender_height; $yt++) -for ($x = $descender_width; $x = 0; $x--) -if (ImageColorAt($tmp_img, $x, $yt) == $fg_color) -break 2; +if (ImageColorAt($tmp_img, 2, $yb) == $fg_color) +break; -$descender_diff = abs($yb - $yt); +for ($yt = $yb - 1; $yt = 0; $yt--) +if (ImageColorAt($tmp_img, 2, $yt) != $fg_color) +break; + +$descender_diff = $yb - $yt; $font_height += $descender_diff; // cache the result -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear Cache.php
uw Wed Mar 28 10:32:20 2001 EDT Modified files: /php4/pear Cache.php Log: Added a simple usage example Index: php4/pear/Cache.php diff -u php4/pear/Cache.php:1.8 php4/pear/Cache.php:1.9 --- php4/pear/Cache.php:1.8 Sat Mar 17 08:06:31 2001 +++ php4/pear/Cache.php Wed Mar 28 10:32:20 2001 @@ -16,21 +16,49 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: Cache.php,v 1.8 2001/03/17 16:06:31 chregu Exp $ +// $Id: Cache.php,v 1.9 2001/03/28 18:32:20 uw Exp $ require_once "Cache/Error.php"; /** * Cache is a base class for cache implementations. * -* TODO: Simple usage example goes here. +* The pear cache module is a generic data cache which can be used to +* cache script runs. The idea behind the cache is quite simple. If you have +* the same input parameters for whatever tasks/algorithm you use you'll +* usually get the same output. So why not caching templates, functions calls, +* graphic generation etc. Caching certain actions e.g. XSLT tranformations +* saves you lots of time. * +* The design of the cache reminds of PHPLibs session implementation. A +* (PHPLib: session) controller uses storage container (PHPLib: ct_*.inc) to save +* certain data (PHPLib: session data). In contrast to the session stuff it's up to +* you to generate an ID for the data to cache. If you're using the output cache +* you might use the script name as a seed for cache::generateID(), if your using the +* function cache you'd use an array with all function parameters. +* +* Usage example of the generic data cache: +* +* require_once("Cache.php"); +* +* $cache = new Cache("file", array("cache_dir" = "cache/") ); +* $id = $cache-generateID("testentry"); +* +* if ($data = $cache-get($id)) { +*print "Cache hit.brData: $data"; +* +* } else { +* $data = "data of any kind"; +* $cache-save($id, $data); +* print "Cache miss.br"; +* } +* * WARNING: No File/DB-Table-Row locking is implemented yet, * it's possible, that you get corrupted data-entries under * bad circumstances (especially with the file container) * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Cache.php,v 1.8 2001/03/17 16:06:31 chregu Exp $ +* @version $Id: Cache.php,v 1.9 2001/03/28 18:32:20 uw Exp $ * @package Cache * @access public */ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache/Container dbx.php
uw Thu Mar 22 06:57:45 2001 EDT Modified files: /php4/pear/Cache/Container dbx.php Log: - connection data typo - whitespaces Index: php4/pear/Cache/Container/dbx.php diff -u php4/pear/Cache/Container/dbx.php:1.1 php4/pear/Cache/Container/dbx.php:1.2 --- php4/pear/Cache/Container/dbx.php:1.1 Thu Mar 22 06:29:01 2001 +++ php4/pear/Cache/Container/dbx.php Thu Mar 22 06:57:44 2001 @@ -15,7 +15,7 @@ // | Authors: Christian Stocker [EMAIL PROTECTED] | // +--+ // -// $Id: dbx.php,v 1.1 2001/03/22 14:29:01 chregu Exp $ +// $Id: dbx.php,v 1.2 2001/03/22 14:57:44 uw Exp $ require_once 'Cache/Container.php'; @@ -50,7 +50,7 @@ * ) * * @author Christian Stocker [EMAIL PROTECTED] -* @version $Id: dbx.php,v 1.1 2001/03/22 14:29:01 chregu Exp $ +* @version $Id: dbx.php,v 1.2 2001/03/22 14:57:44 uw Exp $ * @package Cache */ class Cache_Container_dbx extends Cache_Container { @@ -69,7 +69,6 @@ * * @var string */ - var $module = ''; /** @@ -91,7 +90,6 @@ * * @var string */ - var $username = ''; /** @@ -119,7 +117,7 @@ if (!$this-module) return new Cache_Error('No module specified!', __FILE__, __LINE__); -$this-db = dbx_connect($this-module,$thos-host,$this-db,$this-username,$this-password); +$this-db = dbx_connect($this-module, $this-host, $this-db, +$this-username, $this-password); if (dbx_error($this-db)) { return new Cache_Error('DBx connect failed: ' . dbx_error($this-db), __FILE__, __LINE__); @@ -168,7 +166,7 @@ addslashes($group) ); -$res = dbx_query($this-db,$query); +$res = dbx_query($this-db, $query); if (dbx_error($this-db)) { return new Cache_Error('DBx query failed: ' . dbx_error($this-db) , __FILE__, __LINE__); @@ -185,7 +183,7 @@ addslashes($group) ); -$res = dbx_query($this-db,$query); +$res = dbx_query($this-db, $query); if (dbx_error($this-db)) return new Cache_Error('DBx query failed: ' . dbx_error($this-db), __FILE__, __LINE__); @@ -215,7 +213,7 @@ addslashes($group) ); -$res = dbx_query($this-db,$query); +$res = dbx_query($this-db, $query); if (dbx_error($this-db)) return new Cache_Error('DBx query failed: ' . dbx_error($this-db), __FILE__, __LINE__); @@ -237,7 +235,7 @@ time()); -$res = dbx_query($this-db,$query); +$res = dbx_query($this-db, $query); if (dbx_error($this-db)) return new Cache_Error('DBx query failed: ' . dbx_error($this-db), __FILE__, __LINE__); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache/Container dbx.php
uw Thu Mar 22 07:09:22 2001 EDT Modified files: /php4/pear/Cache/Container dbx.php Log: - added support for persistent connections Index: php4/pear/Cache/Container/dbx.php diff -u php4/pear/Cache/Container/dbx.php:1.2 php4/pear/Cache/Container/dbx.php:1.3 --- php4/pear/Cache/Container/dbx.php:1.2 Thu Mar 22 06:57:44 2001 +++ php4/pear/Cache/Container/dbx.php Thu Mar 22 07:09:21 2001 @@ -15,7 +15,7 @@ // | Authors: Christian Stocker [EMAIL PROTECTED] | // +--+ // -// $Id: dbx.php,v 1.2 2001/03/22 14:57:44 uw Exp $ +// $Id: dbx.php,v 1.3 2001/03/22 15:09:21 uw Exp $ require_once 'Cache/Container.php'; @@ -50,7 +50,7 @@ * ) * * @author Christian Stocker [EMAIL PROTECTED] -* @version $Id: dbx.php,v 1.2 2001/03/22 14:57:44 uw Exp $ +* @version $Id: dbx.php,v 1.3 2001/03/22 15:09:21 uw Exp $ * @package Cache */ class Cache_Container_dbx extends Cache_Container { @@ -100,11 +100,20 @@ var $password = ''; /** -* PEAR DB object +* DBx handle object * -* @var object PEAR_DB +* @var object DBx handle */ var $db; + + +/** +* Establish a persistent connection? +* +* @var boolean +*/ +var $persistent = true; + function Cache_Container_dbx($options) { @@ -112,12 +121,12 @@ return new Cache_Error('No options specified!', __FILE__, __LINE__); } -$this-setOptions($options, array('module','host','db','username','password', 'cache_table')); +$this-setOptions($options, array('module','host','db','username','password', +'cache_table', 'persistent')); if (!$this-module) return new Cache_Error('No module specified!', __FILE__, __LINE__); -$this-db = dbx_connect($this-module, $this-host, $this-db, $this-username, $this-password); +$this-db = dbx_connect($this-module, $this-host, $this-db, +$this-username, $this-password, $this-persistent); if (dbx_error($this-db)) { return new Cache_Error('DBx connect failed: ' . dbx_error($this-db), __FILE__, __LINE__); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu_Browser.php
uw Thu Mar 22 10:38:33 2001 EDT Modified files: /php4/pear/Experimental/HTMLMenu_Browser.php Log: Finished it, works for me. Index: php4/pear/Experimental/HTML/Menu_Browser.php diff -u php4/pear/Experimental/HTML/Menu_Browser.php:1.1 php4/pear/Experimental/HTML/Menu_Browser.php:1.2 --- php4/pear/Experimental/HTML/Menu_Browser.php:1.1Tue Mar 20 15:45:31 2001 +++ php4/pear/Experimental/HTML/Menu_Browser.phpThu Mar 22 10:38:32 2001 @@ -16,16 +16,36 @@ // | Authors: Ulf Wendel [EMAIL PROTECTED] | // +--+ // -// $Id: Menu_Browser.php,v 1.1 2001/03/20 23:45:31 uw Exp $ +// $Id: Menu_Browser.php,v 1.2 2001/03/22 18:38:32 uw Exp $ /** -* Simple filesystem browser that can be used to generated menu (3) hashes. +* Simple filesystem browser that can be used to generated menu (3) hashes based on +the directory structure. * -* Together with menu (3) you can use this browser to generate simple -* fusebox like systems. +* Together with menu (3) and the (userland) cache you can use this +* browser to generate simple fusebox like applications / content systems. * +* Let the menubrowser scan your document root and generate a menu (3) structure +* hash which maps the directory structure, pass it to menu's setMethod() and +optionally +* wrap the cache around all this to save script runs. If you do so, it looks +* like this: +* +* // document root directory +* define("DOC_ROOT", "/home/server/www.example.com/"); +* +* // instantiate the menubrowser +* $browser = new menubrowser(DOC_ROOT); +* +* // instantiate menu (3) +* $menu = new menu($browser-getMenu()); +* +* // output the sitemap +* $menu-show("sitemap"); +* +* Now, use e.g. simple XML files to store your content and additional menu +informations +* (title!). Subclass exploreFile() depending on your file format. +* * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Menu_Browser.php,v 1.1 2001/03/20 23:45:31 uw Exp $ +* @version $Id: Menu_Browser.php,v 1.2 2001/03/22 18:38:32 uw Exp $ */ class menubrowser { @@ -83,14 +103,6 @@ /** -* List of files in the menu hash. -* -* @var array -*/ -var $files = array(); - - -/** * Creates the object and optionally sets the directoryto scan. * * @paramstring @@ -139,7 +151,7 @@ $this-files = array(); $this-menu = $this-browse($this-dir); -$this-addFileInfo(); +$this-menu = $this-addFileInfo($this-menu); return $this-menu; } // end func getMenu @@ -154,8 +166,8 @@ * @return array */ function browse($dir, $id = 0, $noindex = false) { + $struct = array(); - $dh = opendir($dir); while ($file = readdir($dh)) { if ("." == $file || ".." == $file) @@ -170,8 +182,7 @@ $id++; $struct[$id]["url"] = $ffile . $this-index_file; - -$this-files[] = $ffile . $this-index_file; + $sub = $this-browse($ffile, $id + 1, true); if (0 != count($sub)) $struct[$id]["sub"] = $sub; @@ -184,7 +195,6 @@ !($noindex $this-index_file == $file) ) { $id++; $struct[$id]["url"] = $dir . $file; -$this-files[] = $dir . $file; } } @@ -195,17 +205,52 @@ } // end func browse -function addFileInfo() { - -foreach ($this-files as $k = $file) { -$this-exploreFile($file); +/** +* Adds further informations to the menu hash gathered from the files in it +* +* @var array Menu hash to examine +* @return array Modified menu hash with the new informations +*/ +function addFileInfo($menu) { + +// no foreach - it works on a copy - the recursive +// structure requires already lots of memory +reset($menu); +while (list($id, $data) = each($menu)) { + +$menu[$id] = array_merge($data, $this-exploreFile($data["url"])); +if (isset($data["sub"])) +$menu[$id]["sub"] = $this-addFileInfo($data["sub"]); + } + +return $menu; +} // end func addFileInfo + + +/** +* Returns additional menu informations decoded in the file that appears in the +menu. +* +* You should subclass this method to make it work with your own +* file formats. I used a simple XML format to store the content. +* +* @paramstring filename +*/ +function exploreFile($file) { + +$xml = join("", @file($file)); +if (!$xml) +
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu_Browser.php
uw Tue Mar 20 15:45:33 2001 EDT Added files: /php4/pear/Experimental/HTMLMenu_Browser.php Log: Warning: alpha code! A simple filesystem scanner/browser that maps the filesystem structure into a menu hash so that you can build simple fusebox (?) like systems. Sebastian can you help me with the coding guides etc ? Index: php4/pear/Experimental/HTML/Menu_Browser.php +++ php4/pear/Experimental/HTML/Menu_Browser.php ?php // // +--+ // | PHP version 4.0 | // +--+ // | Copyright (c) 1997-2001 The PHP Group| // +--+ // | This source file is subject to version 2.02 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is| // | available at through the world-wide-web at | // | http://www.php.net/license/2_02.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | [EMAIL PROTECTED] so we can mail you a copy immediately. | // +--+ // | Authors: Ulf Wendel [EMAIL PROTECTED] | // +--+ // // $Id: Menu_Browser.php,v 1.1 2001/03/20 23:45:31 uw Exp $ /** * Simple filesystem browser that can be used to generated menu (3) hashes. * * Together with menu (3) you can use this browser to generate simple * fusebox like systems. * * @author Ulf Wendel [EMAIL PROTECTED] * @version $Id: Menu_Browser.php,v 1.1 2001/03/20 23:45:31 uw Exp $ */ class menubrowser { /** * Filesuffix of your XML files. * * @var string * @see menubrowser() */ var $file_suffix = "xml"; /** * Number of characters of the file suffix. * * @var int * @see menubrowser() */ var $file_suffix_length = 3; /** * Filename (without suffix) of your index / start pages. * * @var string * @see menubrowser() */ var $index = "index"; /** * Full filename of your index / start pages. * * @var string * @see $file_suffix, $index */ var $index_file = ""; /** * Directory to scan. * * @var string * @see setDirectory() */ var $dir = ""; /** * Menu (3)'s setMenu() hash. * * @var array */ var $menu = array(); /** * List of files in the menu hash. * * @var array */ var $files = array(); /** * Creates the object and optionally sets the directoryto scan. * * @paramstring * @see $dir */ function menubrowser($dir = "", $index = "", $file_suffix = "") { if ($dir) $this-dir = $dir; if ($index) $this-index = $index; if ($file_suffix) $this-file_suffix = $file_suffix; $this-index_file = $this-index . "." . $this-file_suffix; $this-file_suffix_length = strlen($this-file_suffix); } // end constructor /** * Sets the directory to scan. * * @paramstring directory to scan * @access public */ function setDirectory($dir) { $this-dir = $dir; } // end func setDirectory /** * Returns a hash to be used with menu(3)'s setMenu(). * * @paramstring directory to scan * @access public */ function getMenu($dir = "") { if ($dir) $this-setDirectory($dir); // drop the result of previous runs $this-files = array(); $this-menu = $this-browse($this-dir); $this-addFileInfo(); return $this-menu; } // end func getMenu /** * Recursive function that does the scan and builds the menu (3) hash. * * @paramstring directory to scan * @paraminteger entry id - used only for recursion * @paramboolean ??? - used only for recursion * @return array */ function browse($dir, $id = 0, $noindex = false) { $struct = array(); $dh = opendir($dir); while ($file = readdir($dh)) { if ("." == $file || ".." == $file) continue; $ffile = $dir . $file; if (is_
[PHP-CVS] cvs: php4 /pear/Cache Output.php
uw Fri Mar 16 00:40:40 2001 EDT Modified files: /php4/pear/CacheOutput.php Log: Usage example changes should answer peoples FAQs. Index: php4/pear/Cache/Output.php diff -u php4/pear/Cache/Output.php:1.12 php4/pear/Cache/Output.php:1.13 --- php4/pear/Cache/Output.php:1.12 Thu Mar 15 23:58:35 2001 +++ php4/pear/Cache/Output.php Fri Mar 16 00:40:39 2001 @@ -17,7 +17,7 @@ // | Vinai Kopp [EMAIL PROTECTED] | // +--+ // -// $Id: Output.php,v 1.12 2001/03/16 07:58:35 sbergmann Exp $ +// $Id: Output.php,v 1.13 2001/03/16 08:40:39 uw Exp $ require_once 'Cache.php'; @@ -36,10 +36,10 @@ * * // place this somewhere in a central config file * define(CACHE_STORAGE_CLASS, "file"); -* // file storage needs a dir to put the cache files -* define(CACHE_DIR, "/var/tmp/"); +* // file storage needs a dir to put the cache files +* define(CACHE_DIR, "/var/tmp/"); * -* // get a cache object +* // get a cache object * $cache = new Cache_Output(CACHE_STORAGE_CLASS, array("cache_dir" = CACHE_DIR)); * * // compute the unique handle. @@ -50,12 +50,20 @@ * // "post" = $HTTP_POST_VAS" * // "cookie" = $HTTP_COOKIE_VARS * //); + Output.php +* // But be warned, using all GET or POST Variables as a seed +* // can be used for a DOS attack. Calling +http://www.example.com/example.php?whatever +* // where whatever is a random text might be used to flood your cache. * $cache_handle = $cache-generateID($REQUEST_URI); +=== +* $cache_handle = $cache-generateID($REQUEST_URI); + 1.12 * * // now the magic happens: if cached call die() * // to end the time consumptiong script script execution and use the cached value! * if ($content = $cache-start($cache_handle)) { * print $content; +* print "pCache hit/p"; * die(); * } * @@ -63,17 +71,27 @@ * * // store the output of the cache into the cache and print the output. * print $cache-end(); +* print "pCache miss, stored using the ID '$id'./p"; +* +* If you do not want to cache a whole page - no problem: * -* If you do not want to cache a whole page - no problem: +* if (!($content = $cache-start($cache_handle))) { +* // do the computation here +* print $cache-end() +* } else { + print $content; +* } * -* if (!($content = $cache-start($cache_handle))) { -*// do the computation here -*print $cache-end() -* } else { -print $content; -* } +* If you need an example script check the (auto_)prepend and (auto_)append +* files of my homepage: +* +*http://www.ulf-wendel.de/php/show_source.php?file=prepend +*http://www.ulf-wendel.de/php/show_source.php?file=append +* +* Don't know how to use it or you need profiling informations?` +* Ask Christian he was patient with me and he'll be so with your questions ;). * -* Have fun! +* Have fun! * * @authors Ulf Wendel [EMAIL PROTECTED] * @version $ID: $ -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] JavaDoc?
Jonathan Sharp schrieb: So i've heard bits and pieces that JavaDoc can parse out comments about php... That's wrong. JavaDoc utilizes the Java Compiler. Check the PEAR repository there's a JavaDoc like tool in it. Ulf -- Ulf Wendel, NetUSE AG Siemenswall, D-24107 Kiel Tel: +49 431 386 436 00, Fax: +49 431 386 435 99 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/XML Parser.php
uw Thu Mar 15 09:30:02 2001 EDT Modified files: /php4/pear/XML Parser.php Log: - lots of whitespace (tabs vs. spaces) - added basic inline docs - added error handling to the constructor Index: php4/pear/XML/Parser.php diff -u php4/pear/XML/Parser.php:1.5 php4/pear/XML/Parser.php:1.6 --- php4/pear/XML/Parser.php:1.5Tue Jan 9 17:01:58 2001 +++ php4/pear/XML/Parser.phpThu Mar 15 09:30:01 2001 @@ -35,155 +35,255 @@ * XML Parser class. This is an XML parser based on PHP's "xml" extension, * based on the bundled expat library. * - * @author Stig Bakken [EMAIL PROTECTED] - * + * @author Stig Bakken [EMAIL PROTECTED] + * @version $id $ */ class XML_Parser extends PEAR { // {{{ properties +/** +* XML parser handle +* +* @var resource xml_parser +*/ var $parser; + +/** +* +* @var resourcefopen +*/ var $fp; + +/** +* +* @var boolean +*/ var $folding = true; + +/** +* +* @var string +*/ var $mode; + // }}} // {{{ constructor() +/** +* Creates a xml parser. +* +* @paramstring character set - see the xml_parser_create() PHP docs. +* @paramstring +* @throws XML_Parser_Error +*/ function XML_Parser($charset = 'UTF-8', $mode = "event") { - $this-PEAR(); - $xp = @xml_parser_create($charset); - if (is_resource($xp)) { - $this-parser = $xp; - $this-setMode($mode); - xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, - $this-folding); - } + +$this-PEAR(); + +$xp = @xml_parser_create($charset); +if (is_resource($xp)) { + +$this-parser = $xp; +$this-setMode($mode); +xml_parser_set_option($xp, XML_OPTION_CASE_FOLDING, $this-folding); + +} else { + +return new XML_Parser_Error("Can't create xml parser"); + +} + } - // }}} // {{{ setMode() +/** +* +* @paramstring +* @access public +*/ function setMode($mode) { - $this-mode = $mode; - $xp = $this-parser; - xml_set_object($xp, $this); - switch ($mode) { - case "func": - xml_set_element_handler($xp, "funcStartHandler", "funcEndHandler"); - break; - case "event": - if (method_exists($this, "startHandler") || - method_exists($this, "endHandler")) { - xml_set_element_handler($xp, "startHandler", "endHandler"); - } - } - if (method_exists($this, "cdataHandler")) { - xml_set_character_data_handler($xp, "cdataHandler"); - } else { - xml_set_character_data_handler($xp, ""); - } - if (method_exists($this, "defaultHandler")) { - xml_set_default_handler($xp, "defaultHandler"); - } else { - xml_set_default_handler($xp, ""); - } - if (method_exists($this, "piHandler")) { - xml_set_processing_instruction_handler($xp, "piHandler"); - } else { - xml_set_processing_instruction_handler($xp, ""); - } - if (method_exists($this, "unparsedHandler")) { - xml_set_unparsed_entity_decl_handler($xp, "unparsedHandler"); - } else { - xml_set_unparsed_entity_decl_handler($xp, ""); - } - if (method_exists($this, "notationHandler")) { - xml_set_notation_decl_handler($xp, "notationHandler"); - } else { - xml_set_notation_decl_handler($xp, ""); - } - if (method_exists($this, "entityrefHandler")) { - xml_set_external_entity_ref_handler($xp, "entityrefHandler"); - } else { - xml_set_external_entity_ref_handler($xp, ""); - } + +$this-mode = $mode; + +$xp = $this-parser; +xml_set_object($xp, $this); + +switch ($mode) { + +case "func": +xml_set_element_handler($xp, "funcStartHandler", "funcEndHandler"); +break; + +case "event": +if (method_exists($this, "startHandler") || +method_exists($this, "endHandler")) { +xml_set_element_handler($xp, "startHandler", "endHandler"); +} +break; +} + +if (method_exists($this, "cdataHandler")) { +xml_set_character_data_handler($xp, "cdataHandler"); +} else { +xml_set_character_data_handler($xp, ""); +} + +if (method_exists($this, "defaultHandler")) { +xml_set_default_handler($xp, "defaultHandler"); +} else { +xml_set_default_handler($xp, ""); +} + +
[PHP-CVS] cvs: php4 /pear/XML Render.php
uw Thu Mar 15 11:44:47 2001 EDT Modified files: /php4/pear/XML Render.php Log: - removed all methods that did the same like the (parent) methods in XML/Parse.php - added todo to the inline docs After this there's only one method left at all which tries to instantiate non existant classes. Can I move this code to the Experimental/ directory? Index: php4/pear/XML/Render.php diff -u php4/pear/XML/Render.php:1.2 php4/pear/XML/Render.php:1.3 --- php4/pear/XML/Render.php:1.2Mon Jan 15 16:27:34 2001 +++ php4/pear/XML/Render.phpThu Mar 15 11:44:47 2001 @@ -1,5 +1,4 @@ ?php - /* vim: set expandtab tabstop=4 shiftwidth=4; */ // +-+ // | PHP version 4.0| @@ -17,7 +16,7 @@ // | Authors: Sean Grimes [EMAIL PROTECTED]| // +-+ // -// $Id: Render.php,v 1.2 2001/01/16 00:27:34 metallic Exp $ +// $Id: Render.php,v 1.3 2001/03/15 19:44:47 uw Exp $ /** * Render class for rendering from XML. @@ -28,77 +27,20 @@ * will make it possible to take a document from * HTML to PDF, but this is unlikely. * -* @author Sean Grimes [EMAIL PROTECTED] +* @author Sean Grimes [EMAIL PROTECTED] +* @version $Id: Render.php,v 1.3 2001/03/15 19:44:47 uw Exp $ +* @todo - Implement the HTML and PDF rendering modes +* - Extend the parse() function to what is needed +* - Implement filesystem commands +* - Come up with the XML language syntax +* - Provide a better class interface +* - Do some debugging */ -/*** Todo *** - ** - Implement the HTML and PDF rendering modes - ** - Extend the parse() function to what is needed - ** - Implement filesystem commands - ** - Come up with the XML language syntax - ** - Provide a better class interface - ** - Do some debugging -***/ - require_once "Parser.php"; class XML_Render extends XML_Parser { -var $data; // holds the file contents - - function XML_Render($charset = 'UTF-8', $mode = "event") { - $this-XML_Parser($charset, $mode); - - } - - /** - * Set the input file. - * - * This overrides XML_Parser::setInputFile(), - * and creates a wrapper around XML_Parser::setInputFile() - * and XML_Parser::inputFile(). The functions are so similar - * that its confusing me(hint: document XML_Parser). - * - * @access public - * @param $file file to be input - */ - function setInputFile($file) { - $fp = @fopen($file, "r"); - if (is_resource($fp)) { - $this-fp = $fp; - return $this-setInput($file); - } else { - return new XML_Parser_Error($php_errormsg); // ?? - } - } - -/** -* Parses the document -* -* This function extends the capabilities of the -* parse function in XML/Parser.php. The only real -* notable change is the addition of a command to -* store the contents of the file to a variable to -* make it available to the entire class -*/ -function parse() { -if(!is_resource($this-fp)) { -return new XML_Parser_Error("no input"); -} -if (!is_resource($this-parser)) { -return new XML_Parser_Error("no parser"); -} -while ($data = fread($this-fp, 2048)) { -$err = $this-parseString($data, $feof($this-fp)); -if (PEAR::isError($err)) { -return $err; -} -} -$this-data = $data; -return $true; -} - - /** * Renders the XML document. * @@ -124,4 +66,5 @@ new PEAR_Error($message, 0, PEAR_ERROR_RETURN, E_USER_NOTIFY); } } + } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/XML Parser.php
uw Thu Mar 15 12:39:14 2001 EDT Modified files: /php4/pear/XML Parser.php Log: - put the todo list into the inline docs Index: php4/pear/XML/Parser.php diff -u php4/pear/XML/Parser.php:1.9 php4/pear/XML/Parser.php:1.10 --- php4/pear/XML/Parser.php:1.9Thu Mar 15 11:34:13 2001 +++ php4/pear/XML/Parser.phpThu Mar 15 12:39:14 2001 @@ -20,24 +20,19 @@ require_once "PEAR.php"; -/* - -Tests that need to be made: -- error class -- mixing character encodings -- a test using all expat handlers -- options (folding, output charset) -- different parsing modes - -*/ - /** * XML Parser class. This is an XML parser based on PHP's "xml" extension, * based on the bundled expat library. * * @author Stig Bakken [EMAIL PROTECTED] * @version $id $ - */ + * @todoTests that need to be made: + * - error class + * - mixing character encodings + * - a test using all expat handlers + * - options (folding, output charset) + * - different parsing modes +*/ class XML_Parser extends PEAR { // {{{ properties @@ -264,6 +259,7 @@ } } + /** * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu.php
uw Wed Mar 14 14:33:58 2001 EDT Modified files: /php4/pear/Experimental/HTMLMenu.php Log: - code beatifiying - minor inline doc update Index: php4/pear/Experimental/HTML/Menu.php diff -u php4/pear/Experimental/HTML/Menu.php:1.8 php4/pear/Experimental/HTML/Menu.php:1.9 --- php4/pear/Experimental/HTML/Menu.php:1.8Tue Mar 13 14:03:28 2001 +++ php4/pear/Experimental/HTML/Menu.phpWed Mar 14 14:33:58 2001 @@ -206,13 +206,13 @@ switch ($this-menu_type) { case "rows": case "prevnext": -$html .= "table bordertr"; +$html .= 'table bordertr'; break; case "tree": case "urhere": case "sitemap": -$html .= "table border"; +$html .= 'table border'; break; } @@ -232,13 +232,13 @@ switch ($this-menu_type) { case "rows": case "prevnext": -$html .="/tr/table"; +$html .= '/tr/table'; break; case "tree": case "urhere": case "sitemap": -$html = "/table"; +$html .= '/table'; break; } @@ -462,7 +462,7 @@ * * @paramarray menu item data (node data) * @paraminteger level in the menu tree -* @paramstring menu item type: 0, 1, 2. 0 = plain menu item, +* @paraminteger menu item type: 0, 1, 2. 0 = plain menu item, * 1 = selected (active) menu item, 2 = item * is a member of the path to the selected (active) menu item * 3 = previous entry, 4 = next entry @@ -475,11 +475,11 @@ if ("tree" == $this-menu_type) { // tree menu -$html .= "tr"; +$html .= 'tr'; $indent = ""; if ($level) for ($i = 0; $i $level; $i++) -$indent .= "nbsp;nbsp;nbsp;"; +$indent .= 'nbsp;nbsp;nbsp;'; } // draw the td/td cell depending on the type of the menu item @@ -541,7 +541,7 @@ } if ("tree" == $this-menu_type) -$html .= "/tr"; +$html .= '/tr'; return $html; } // end func getEnty -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu.php
uw Tue Mar 13 13:49:04 2001 EDT Modified files: /php4/pear/Experimental/HTMLMenu.php Log: - fixed a rows bug - removed all \n Index: php4/pear/Experimental/HTML/Menu.php diff -u php4/pear/Experimental/HTML/Menu.php:1.6 php4/pear/Experimental/HTML/Menu.php:1.7 --- php4/pear/Experimental/HTML/Menu.php:1.6Mon Mar 12 16:18:38 2001 +++ php4/pear/Experimental/HTML/Menu.phpTue Mar 13 13:49:04 2001 @@ -1,22 +1,4 @@ ?php -// +--+ -// | PHP version 4.0 | -// +--+ -// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | -// +--+ -// | This source file is subject to version 2.0 of the PHP license, | -// | that is bundled with this package in the file LICENSE, and is| -// | available at through the world-wide-web at | -// | http://www.php.net/license/2_02.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | [EMAIL PROTECTED] so we can mail you a copy immediately. | -// +--+ -// | Authors: Ulf Wendel [EMAIL PROTECTED] | -// +--+ -// -// $Id: Menu.php,v 1.6 2001/03/13 00:18:38 uw Exp $ - /** * Generates a HTML menu from a multidimensional hash. * @@ -83,7 +65,7 @@ * This can be the URL of the current page but it must not be exactly the * return value of getCurrentURL(). If there's no entry for the return value * in the menu hash getPath() tries to find the menu item that fits best -* by shortening the URL sign by sign until it find an entry that fits. +* by shortening the URL sign by sign until it finds an entry that fits. * * @see getCurrentURL(), getPath() */ @@ -177,15 +159,15 @@ $this-html = ""; -// buildMenu for rows cares on this itself -if ("rows" != $this-menu_type) +// buildMenu for rows cares on this itself +if ("rows" != $this-menu_type) $this-html .= $this-getStart(); // storing to a class variable saves some recursion overhead $this-path = $this-getPath(); $this-buildMenu($this-menu); -if ("rows" != $this-menu_typ) +if ("rows" != $this-menu_type) $this-html .= $this-getEnd(); return $this-html; @@ -315,6 +297,7 @@ // every (sub)menu has it's own table $this-html .= $this-getStart(); + $submenu = false; // loop through the (sub)menu @@ -534,13 +517,13 @@ $indent, $node["url"], $node["title"], -("urhere" == $this-menu_type) ? " " : "" +("urhere" == $this-menu_type) ? " gt;gt; " : "" ); break; case 3: // previous url -$html .= sprintf('td%sa href="%s" %s/a/td', +$html .= sprintf('td%sa href="%s"lt;lt; %s/a/td', $indent, $node["url"], $node["title"] @@ -549,7 +532,7 @@ case 4: // next url -$html .= sprintf('td%sa href="%s"%s /a/td', +$html .= sprintf('td%sa href="%s"%s gt;gt;/a/td', $indent, $node["url"], $node["title"] @@ -563,12 +546,12 @@ $node["url"], $node["title"] ); -break; +break; } if ("tree" == $this-menu_type) -$html .= "/tr\n"; +$html .= "/tr"; return $html; } // end func getEnty @@ -582,13 +565,13 @@ */ function getPath() { -$this-c
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu.php
uw Tue Mar 13 14:03:29 2001 EDT Modified files: /php4/pear/Experimental/HTMLMenu.php Log: API change: replaced getSitemap() with get("sitemap") Index: php4/pear/Experimental/HTML/Menu.php diff -u php4/pear/Experimental/HTML/Menu.php:1.7 php4/pear/Experimental/HTML/Menu.php:1.8 --- php4/pear/Experimental/HTML/Menu.php:1.7Tue Mar 13 13:49:04 2001 +++ php4/pear/Experimental/HTML/Menu.phpTue Mar 13 14:03:28 2001 @@ -149,7 +149,7 @@ /** * Returns the HTML menu. * -* @paramstring Menu type: tree, urhere, rows, prevnext +* @paramstring Menu type: tree, urhere, rows, prevnext, sitemap * @return string HTML of the menu * @access public */ @@ -165,8 +165,17 @@ // storing to a class variable saves some recursion overhead $this-path = $this-getPath(); -$this-buildMenu($this-menu); - + +if ("sitemap" == $this-menu_type) { + +$this-setMenuType("tree"); +$this-buildSitemap($this-menu); +$this-setMenuType("sitemap"); + +} else { +$this-buildMenu($this-menu); +} + if ("rows" != $this-menu_type) $this-html .= $this-getEnd(); @@ -184,28 +193,7 @@ print $this-get($menu_type); } // end func show -/** -* Returns a sitemap. -* -* @return string HTML code -* @access public -*/ -function getSitemap() { - - $oldtype = $this-menu_type; - $this-setMenuType("tree"); - - $this-html = $this-getStart(); - - $this-path = $this-getPath(); - $this-buildSitemap($this-menu); - $this-setMenuType($oldtype); - - return $this-html . $this-getEnd(); -} // end func getSitemap - - /** * Returns the prefix of the HTML menu items. * @@ -223,6 +211,7 @@ case "tree": case "urhere": +case "sitemap": $html .= "table border"; break; } @@ -248,6 +237,7 @@ case "tree": case "urhere": +case "sitemap": $html = "/table"; break; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu.php
uw Mon Mar 12 12:22:13 2001 EDT Modified files: /php4/pear/Experimental/HTMLMenu.php Log: - made the URL check independend from $PHP_SELF - removed homepage specific code Index: php4/pear/Experimental/HTML/Menu.php diff -u php4/pear/Experimental/HTML/Menu.php:1.1 php4/pear/Experimental/HTML/Menu.php:1.2 --- php4/pear/Experimental/HTML/Menu.php:1.1Fri Mar 9 00:54:01 2001 +++ php4/pear/Experimental/HTML/Menu.phpMon Mar 12 12:22:13 2001 @@ -251,13 +251,9 @@ */ function buildMenu($menu, $level = 0, $flag_stop_level = -1) { static $last_node = array(); -global $PHP_SELF; + +$current_url = $this-getCurrentURL(); -// WARNING: dirty redsys.de Hack -if ("" != HOME "/" . HOME == substr($PHP_SELF, 0, strlen(HOME) + 1)) -$PHP_SELF = substr($PHP_SELF, strlen(HOME) + 1); - - // the recursion goes slightly different for every menu type switch ($this-menu_type) { @@ -266,7 +262,7 @@ // loop through the (sub)menu foreach ($menu as $node_id = $node) { -if ($PHP_SELF == $node["url"]) { +if ($current_url == $node["url"]) { // menu item that fits to this url - "active" menu item $type = 1; } else if (isset($this-path[$level]) $this-path[$level] == $node_id) { @@ -294,7 +290,7 @@ // loop through the (sub)menu foreach ($menu as $node_id = $node) { -if ($PHP_SELF == $node["url"]) { +if ($current_url == $node["url"]) { // menu item that fits to this url - "active" menu item $type = 1; } else if (isset($this-path[$level]) $this-path[$level] == $node_id) { @@ -327,7 +323,7 @@ // loop through the (sub)menu foreach ($menu as $node_id = $node) { -if ($PHP_SELF == $node["url"]) { +if ($current_url == $node["url"]) { // menu item that fits to this url - "active" menu item $type = 1; } else if (isset($this-path[$level]) $this-path[$level] == $node_id) { @@ -366,7 +362,7 @@ break; -} else if ($PHP_SELF == $node["url"]) { +} else if ($current_url == $node["url"]) { // menu item that fits to this url - "active" menu item $type = 1; @@ -419,12 +415,13 @@ * @paramint level of recursion, current depth in the tree structure */ function buildSitemap($menu, $level = 0) { -global $PHP_SELF; - + +$current_url = $this-getCurrentURL(); + // loop through the (sub)menu foreach ($menu as $node_id = $node) { -if ($PHP_SELF == $node["url"]) { +if ($current_url == $node["url"]) { // menu item that fits to this url - "active" menu item $type = 1; } else if (isset($this-path[$level]) $this-path[$level] == $node_id) { @@ -530,15 +527,13 @@ * Returns the path of the current page in the menu "tree". * * @return arraypath to the selected menu item -* @global $PHP_SELF * @see buildPath(), $urlmap */ function getPath() { -global $PHP_SELF; $this-buildPath($this-menu, array()); -return $this-urlmap[$PHP_SELF]; +return $this-urlmap[$this-currentURL()]; } // end func getPath @@ -553,8 +548,9 @@ * @see getPath(), $urlmap */ function buildPath($menu, $path) { -global $PHP_SELF; - + +$current_url = $this-getCurrentURL(); + // loop through the (sub)menu foreach ($menu as $node_id = $node) { @@ -562,7 +558,7 @@ $this-urlmap[$node["url"]] = $path; // we got'em - stop the search by returning true -if ($node["url"] == $PHP_SELF) +if ($node["url"] == $current_url) return true; // current node has a submenu @@ -573,7 +569,7 @@ $subpath[] = $node_id; // continue search recursivly - return is the inner loop finds the -// node that belongs to $PHP_SELF +// node that belongs to the current url if ($this-buildPath($node["sub"], $subpath)) return true; } @@ -583,6 +579,19 @@
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu.php
uw Mon Mar 12 12:30:44 2001 EDT Modified files: /php4/pear/Experimental/HTMLMenu.php Log: - made 'tree' the default redering type Index: php4/pear/Experimental/HTML/Menu.php diff -u php4/pear/Experimental/HTML/Menu.php:1.2 php4/pear/Experimental/HTML/Menu.php:1.3 --- php4/pear/Experimental/HTML/Menu.php:1.2Mon Mar 12 12:22:13 2001 +++ php4/pear/Experimental/HTML/Menu.phpMon Mar 12 12:30:44 2001 @@ -36,7 +36,7 @@ * @var array * @see setMenuType() */ -var $menu_type = ""; +var $menu_type = "tree"; /** -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu.php
uw Mon Mar 12 15:26:16 2001 EDT Modified files: /php4/pear/Experimental/HTMLMenu.php Log: - extended "prevnext" mode to show the previous, up and next item (up is new) Index: php4/pear/Experimental/HTML/Menu.php diff -u php4/pear/Experimental/HTML/Menu.php:1.4 php4/pear/Experimental/HTML/Menu.php:1.5 --- php4/pear/Experimental/HTML/Menu.php:1.4Mon Mar 12 14:03:51 2001 +++ php4/pear/Experimental/HTML/Menu.phpMon Mar 12 15:26:15 2001 @@ -264,7 +264,7 @@ * @paraminteger prevnext flag */ function buildMenu($menu, $level = 0, $flag_stop_level = -1) { -static $last_node = array(); +static $last_node = array(), $up_node = array(); // the recursion goes slightly different for every menu type switch ($this-menu_type) { @@ -377,6 +377,7 @@ } else if ($this-current_url == $node["url"]) { // menu item that fits to this url - "active" menu item $type = 1; +$flag_stop_level = $level; if (0 != count($last_node)) { @@ -392,7 +393,18 @@ } -$flag_stop_level = $level; +if (0 != count($up_node)) { + + $this-html .= $this-getEntry($up_node, $level, 5); + +} else { + +// WARNING: if there's no up take the first menu entry - +you might not like this rule! +reset($this-menu); +list($node_id, $first_node) = each($this-menu); +$this-html .= $this-getEntry($first_node, $level, 5); + +} } else if (isset($this-path[$level]) $this-path[$level] == $node_id) { // processed menu item is part of the path to the active menu item @@ -408,8 +420,10 @@ $last_node = $node; // follow the subtree if the active menu item is in it -if ($type isset($node["sub"])) +if ($type isset($node["sub"])) { +$up_node = $node; $flag_stop_level = $this-buildMenu($node["sub"], $level + 1, (-1 != $flag_stop_level) ? $flag_stop_level + 1 : -1); +} } break; @@ -523,6 +537,15 @@ $node["title"] ); break; + +case 5: +// up url ^^ +$html .= sprintf('td%sa href="%s"^ %s ^/a/td', +$indent, +$node["url"], +$node["title"] + ); +break; } -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental/HTML Menu.php
uw Mon Mar 12 16:18:39 2001 EDT Modified files: /php4/pear/Experimental/HTMLMenu.php Log: - added the PPHP licence text - final structure, seems to be bug free - usage example missing, I'm writing on a german language tutorial, will add the usage example as soon as the tutorial is finished Index: php4/pear/Experimental/HTML/Menu.php diff -u php4/pear/Experimental/HTML/Menu.php:1.5 php4/pear/Experimental/HTML/Menu.php:1.6 --- php4/pear/Experimental/HTML/Menu.php:1.5Mon Mar 12 15:26:15 2001 +++ php4/pear/Experimental/HTML/Menu.phpMon Mar 12 16:18:38 2001 @@ -1,4 +1,22 @@ ?php +// +--+ +// | PHP version 4.0 | +// +--+ +// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | +// +--+ +// | This source file is subject to version 2.0 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is| +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | [EMAIL PROTECTED] so we can mail you a copy immediately. | +// +--+ +// | Authors: Ulf Wendel [EMAIL PROTECTED] | +// +--+ +// +// $Id: Menu.php,v 1.6 2001/03/13 00:18:38 uw Exp $ + /** * Generates a HTML menu from a multidimensional hash. * -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Experimental README /pear/Experimental/HTML Menu.php
uw Fri Mar 9 00:54:01 2001 EDT Added files: /php4/pear/Experimental README /php4/pear/Experimental/HTMLMenu.php Log: Added a directory Experimental/ as no one said "no" on the PEAR list... - added a PHPlib menu2.inc rewrite - added a README for the directory with a policy for Experimental/ Index: php4/pear/Experimental/HTML/Menu.php +++ php4/pear/Experimental/HTML/Menu.php ?php /** * Generates a HTML menu from a multidimensional hash. * * Special thanks to the original author: Alex Vorobiev [EMAIL PROTECTED] * * @version $id: $ * @author Ulf Wendel [EMAIL PROTECTED] * @access public * @package HTML */ class menu { /** * Menu structure as a multidimensional hash. * * @var array * @see setMenu(), Menu() */ var $menu = array(); /** * Mapping from URL to menu path. * * @var array * @see getPath() */ var $urlmap = array(); /** * Menu type: tree, rows, you-are-here. * * @var array * @see setMenuType() */ var $menu_type = ""; /** * Path to a certain menu item. * * Internal class variable introduced to save some recursion overhead. * * @var array * @see get(), getPath() */ var $path = array(); /** * Generated HTML menu. * * @var string * @see get() */ var $html = ""; /** * Initializes the menu, sets the type and menu structure. * * @paramarray * @paramstring * @see setMenuType(), setMenu() */ function menu($menu = "", $type = "tree") { if (is_array($menu)) $this-setMenu($menu); $this-setMenuType($type); } // end constructor /** * Sets the menu structure. * * The menu structure is defined by a multidimensional hash. This is * quite "dirty" but simple and easy to traverse. An example * show the structure. To get the following menu: * * 1 - Projects * 11 - Projects = PHPDoc * 12 - Projects = Forms * 2 - Stuff * * you need the array: * * $menu = array( * 1 = array( * "title" = "Projects", * "url" = "/projects/index.php", * "sub" = array( * 11 = array( * "title" = "PHPDoc", * ... * ), * 12 = array( ... ), * ) * ), * 2 = array( "title" = "Stuff", "url" = "/stuff/index.php" ) *) * * Note the index "sub" and the nesting. Note also that 1, 11, 12, 2 * must be unique. The class uses them as ID's. * * @paramarray * @access public * @see append(), update(), delete() */ function setMenu($menu) { $this-menu = $menu; $this-urlmap = array(); } // end func setMenu /** * Sets the type / format of the menu: tree, rows or urhere. * * @paramstring "tree", "rows", "urhere" * @access public */ function setMenuType($menu_type) { $this-menu_type = strtolower($menu_type); } // end func setMenuType /** * Returns the HTML menu. * * @paramstring Menu type: tree, urhere, rows, prevnext * @return string HTML of the menu * @access public */ function get($menu_type = "") { if ("" != $menu_type) $this-setMenuType($menu_type); $this-html = ""; // buildMenu for rows cares on this itself if ("rows" != $this-menu_type) $this-html .= $this-getStart(); // storing to a class variable saves some recursion overhead $this-path = $this-getPath(); $this-buildMenu($this-menu); if ("rows" != $this-menu_typ) $this-html .= $this-getEnd(); return $this-html . $this-getEnd(); } // end func get /** * Prints the HTML menu. * * @brother get() * @return void */ function show($menu_type = "") { print $this-get($menu_type); } // end func show /** * Returns a sitemap. * * @return string HTML code * @access public */ function getSitemap() { $oldtype = $this-menu_type; $this-setMenuType("tree"); $this
[PHP-CVS] cvs: php4 /pear Cache.php /pear/Cache Container.php Error.php /pear/Cache/Container db.php file.php phplib.php
uw Thu Mar 8 12:39:17 2001 EDT Added files: /php4/pear/CacheError.php Modified files: /php4/pear Cache.php /php4/pear/CacheContainer.php /php4/pear/Cache/Container db.php file.php phplib.php Log: Added a basic Cache_Error class. Index: php4/pear/Cache.php diff -u php4/pear/Cache.php:1.5 php4/pear/Cache.php:1.6 --- php4/pear/Cache.php:1.5 Tue Mar 6 07:27:30 2001 +++ php4/pear/Cache.php Thu Mar 8 12:39:15 2001 @@ -16,15 +16,17 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: Cache.php,v 1.5 2001/03/06 15:27:30 sbergmann Exp $ +// $Id: Cache.php,v 1.6 2001/03/08 20:39:15 uw Exp $ +require_once "Cache/Error.php"; + /** * Cache is a base class for cache implementations. * * TODO: Simple usage example goes here. * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Cache.php,v 1.5 2001/03/06 15:27:30 sbergmann Exp $ +* @version $Id: Cache.php,v 1.6 2001/03/08 20:39:15 uw Exp $ * @package Cache * @access public */ @@ -136,7 +138,7 @@ * @parammixed userdefined expire date * @paramstring cache group * @return boolean -* @throws CacheError +* @throws Cache_Error * @access public * @see getUserdata() */ Index: php4/pear/Cache/Container.php diff -u php4/pear/Cache/Container.php:1.7 php4/pear/Cache/Container.php:1.8 --- php4/pear/Cache/Container.php:1.7 Thu Mar 8 03:57:15 2001 +++ php4/pear/Cache/Container.php Thu Mar 8 12:39:15 2001 @@ -17,8 +17,10 @@ // | Christian Stocker [EMAIL PROTECTED] | // +--+ // -// $Id: Container.php,v 1.7 2001/03/08 11:57:15 chregu Exp $ +// $Id: Container.php,v 1.8 2001/03/08 20:39:15 uw Exp $ +require_once "Cache/Error.php"; + /** * Common base class of all cache storage container. * @@ -37,7 +39,7 @@ * not recommended! * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Container.php,v 1.7 2001/03/08 11:57:15 chregu Exp $ +* @version $Id: Container.php,v 1.8 2001/03/08 20:39:15 uw Exp $ * @package Cache * @access public * @abstract @@ -208,7 +210,7 @@ * @paramstring dataset ID * @paramstring cache group * @return array format: [expire date, cached data, user data] -* @throws CacheError +* @throws Cache_Error * @abstract */ function fetch($id, $group) { @@ -224,7 +226,7 @@ * @paramstring cache group * @paramstring additional userdefined data * @return boolean -* @throws CacheError +* @throws Cache_Error * @access public * @abstract */ Index: php4/pear/Cache/Container/db.php diff -u php4/pear/Cache/Container/db.php:1.8 php4/pear/Cache/Container/db.php:1.9 --- php4/pear/Cache/Container/db.php:1.8Thu Mar 8 03:57:16 2001 +++ php4/pear/Cache/Container/db.phpThu Mar 8 12:39:16 2001 @@ -17,7 +17,7 @@ // | Chuck Hagenbuch [EMAIL PROTECTED] | // +--+ // -// $Id: db.php,v 1.8 2001/03/08 11:57:16 chregu Exp $ +// $Id: db.php,v 1.9 2001/03/08 20:39:16 uw Exp $ require_once 'DB.php'; require_once 'Cache/Container.php'; @@ -52,7 +52,7 @@ * ) * * @author Sebastian Bergmann [EMAIL PROTECTED] -* @version $Id: db.php,v 1.8 2001/03/08 11:57:16 chregu Exp $ +* @version $Id: db.php,v 1.9 2001/03/08 20:39:16 uw Exp $ * @package Cache */ class Cache_Container_db extends Cache_Container { @@ -81,17 +81,17 @@ function Cache_Container_db($options) { if (!is_array($options) || !isset($options['dsn'])) { -return new CacheError('No dsn specified!', __FILE__, __LINE__); +return new Cache_Error('No dsn specified!', __FILE__, __LINE__); } $this-setOptions($options, array('dsn', 'cache_table')); if (!$this-dsn) -return new CacheError('No dsn specified!', __FILE__, __LINE__); +return new Cache_Error('No dsn specified!', __FILE__, __LINE__); $this-db = DB::connect($this-dsn, true); if (DB::isError($this-db)) { -return new CacheError('DB::connect failed: ' . DB::errorMessage($this-db), __FILE__, __LINE__); +return new Cache_Error('DB::connect failed: ' . +DB::errorMessage($this-db), __FILE__, __LINE__); } else { $this-db-setFetchMode(DB_FETCHMODE_ASSOC); } @@ -108,7 +108,7 @@ $res = $this-db-query($query); if (DB::isError($res)) -return new CacheError('DB::query failed: ' . DB::errorMessage($res), __FILE__, __LINE__); +return new Cache_Error('DB::query failed: ' . DB::errorMessage($res), +__FILE__, __LINE__);
[PHP-CVS] cvs: php4 /pear Cache.php /pear/Cache Container.php
uw Thu Mar 8 12:41:40 2001 EDT Modified files: /php4/pear Cache.php /php4/pear/CacheContainer.php Log: Formatting and minor inline doc changes. Index: php4/pear/Cache.php diff -u php4/pear/Cache.php:1.6 php4/pear/Cache.php:1.7 --- php4/pear/Cache.php:1.6 Thu Mar 8 12:39:15 2001 +++ php4/pear/Cache.php Thu Mar 8 12:41:39 2001 @@ -16,7 +16,7 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: Cache.php,v 1.6 2001/03/08 20:39:15 uw Exp $ +// $Id: Cache.php,v 1.7 2001/03/08 20:41:39 uw Exp $ require_once "Cache/Error.php"; @@ -26,7 +26,7 @@ * TODO: Simple usage example goes here. * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Cache.php,v 1.6 2001/03/08 20:39:15 uw Exp $ +* @version $Id: Cache.php,v 1.7 2001/03/08 20:41:39 uw Exp $ * @package Cache * @access public */ @@ -281,5 +281,6 @@ $last_run = time(); } } // end func garbageCollection + } // end class cache ? Index: php4/pear/Cache/Container.php diff -u php4/pear/Cache/Container.php:1.8 php4/pear/Cache/Container.php:1.9 --- php4/pear/Cache/Container.php:1.8 Thu Mar 8 12:39:15 2001 +++ php4/pear/Cache/Container.php Thu Mar 8 12:41:39 2001 @@ -17,7 +17,7 @@ // | Christian Stocker [EMAIL PROTECTED] | // +--+ // -// $Id: Container.php,v 1.8 2001/03/08 20:39:15 uw Exp $ +// $Id: Container.php,v 1.9 2001/03/08 20:41:39 uw Exp $ require_once "Cache/Error.php"; @@ -39,7 +39,7 @@ * not recommended! * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Container.php,v 1.8 2001/03/08 20:39:15 uw Exp $ +* @version $Id: Container.php,v 1.9 2001/03/08 20:41:39 uw Exp $ * @package Cache * @access public * @abstract @@ -364,6 +364,7 @@ return serialize($data); } // end func encode + /** * Decodes the data from the storage container. * @@ -376,19 +377,19 @@ return unserialize($data); } // end func decode + /** * Translates human readable/relative times in unixtime * -* @var mixed can be in the following formats: +* @param mixed can be in the following formats: * human readable : mmddhhmm[ss]] eg: 20010308095100 * relative in seconds (1) : +xx eg: +10 * relative in seconds (2) : x 946681200 eg: 10 * absolute unixtime : x 2147483648 eg: 2147483648 * see comments in code for details +* @return integer unix timestamp */ - function getExpiresAbsolute($expires) - { if (!$expires) return 0; @@ -416,6 +417,8 @@ $second = substr($expires, 12, 2); return mktime($hour, $minute, $second, $month, $day, $year); } -} -} + +} // end func getExpireAbsolute + +} // end class Container ? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache/Container phplib.php
uw Sat Mar 3 03:46:19 2001 EDT Modified files: /php4/pear/Cache/Container phplib.php Log: bugfix: idExists(), inline Doc changes: class doc Index: php4/pear/Cache/Container/phplib.php diff -u php4/pear/Cache/Container/phplib.php:1.4 php4/pear/Cache/Container/phplib.php:1.5 --- php4/pear/Cache/Container/phplib.php:1.4Fri Mar 2 06:16:38 2001 +++ php4/pear/Cache/Container/phplib.phpSat Mar 3 03:46:19 2001 @@ -16,29 +16,42 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: phplib.php,v 1.4 2001/03/02 14:16:38 uw Exp $ +// $Id: phplib.php,v 1.5 2001/03/03 11:46:19 uw Exp $ -require_once 'Cache/Container.php'; +require_once '/Cache/Container.php'; -/* -CREATE TABLE cache ( - id CHAR(32) NOT NULL DEFAULT '', - content MEDIUMTEXT NOT NULL DEFAULT '', - expires INT(9) NOT NULL DEFAULT 0, - - changed TIMESTAMP(14), - - INDEX (expires), - PRIMARY KEY (id) -) -*/ - /** * Stores cache data into a database table. +* +* WARNING: Other systems might or might not support certain datatypes of +* the tables shown. As far as I know there's no large binary +* type in SQL-92 or SQL-99. Postgres seems to lack any +* BLOB or TEXT type, for MS-SQL you could use IMAGE, don't know +* about other databases. Please add sugestions for other databases to +* the inline docs. +* +* The field 'changed' has no meaning for the Cache itself. It's just there +* because it's a good idea to have an automatically updated timestamp +* field for debugging in all of your tables. +* +* For _MySQL_ you need this DB table: +* +* CREATE TABLE cache ( +* idCHAR(32) NOT NULL DEFAULT '', +* content BLOB NOT NULL DEFAULT '', +* expires INT(9) NOT NULL DEFAULT 0, +* +* changed TIMSTAMP(14) NOT NULL, +* +* INDEX (expires), +* PRIMARY KEY (id) +* ) +* * * @author Ulf Wendel [EMAIL PROTECTED], Sebastian Bergmann [EMAIL PROTECTED] -* @version $Id: phplib.php,v 1.4 2001/03/02 14:16:38 uw Exp $ +* @version $Id: phplib.php,v 1.5 2001/03/03 11:46:19 uw Exp $ * @package Cache +* @see save() */ class Cache_Container_phplib extends Cache_Container { @@ -115,10 +128,13 @@ return new CacheError("No database class specified.", __FILE__, __LINE__); // include the required files +if ($this-db_file) +include_once($this-db_path . $this-db_file); + if ($this-local_file) include_once($this-local_path . $this-local_file); - -// create a db object + +// create a db object $this-db = new $this-db_class; } // end constructor @@ -164,12 +180,12 @@ function delete($id) { $this-flushPreload($id); - -$query = sprintf("DELETE FROM %s WHERE id = '%s'", +$this-db-query( +sprintf("DELETE FROM %s WHERE id = '%s'", $this-cache_table, $id - ); -$this-db-query($query); + ) +); return (boolean)$this-db-affected_rows(); } // end func delete @@ -178,9 +194,7 @@ function flush() { $this-flushPreload(); - -$query = sprintf("DELETE FROM %s", $this-cache_table); -$this-db-query($query); +$this-db-query(sprintf("DELETE FROM %s", $this-cache_table)); return $this-db-affected_rows(); } // end func flush @@ -188,11 +202,14 @@ function idExists($id) { -$query = sprintf("SELECT id FROM %s WHERE ID = '%s'", +$this-db-query( +sprintf("SELECT id FROM %s WHERE ID = '%s'", $this-cache_table, $id - ); - +) +); + +return $this-db-nf(); } // end func isExists @@ -200,11 +217,12 @@ $this-flushPreload(); -$query = sprintf("DELETE FORM %s WHERE expires = %d AND expires 0", +$this-db-query( +sprintf("DELETE FORM %s WHERE expires = %d AND expires 0", $this-cache_table, time() - ); -$this-db-query($query); +) +); } // end func garbageCollection -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache/Container db.php
uw Sat Mar 3 11:01:03 2001 EDT Modified files: /php4/pear/Cache/Container db.php Log: Changes for the new cache structure - extended inline docs - extended calls to the still not existant call CacheError - several changed for the new cache structure WARNING: the code is untested, I don't have PEAR installed - Windows user. Index: php4/pear/Cache/Container/db.php diff -u php4/pear/Cache/Container/db.php:1.4 php4/pear/Cache/Container/db.php:1.5 --- php4/pear/Cache/Container/db.php:1.4Fri Mar 2 06:16:38 2001 +++ php4/pear/Cache/Container/db.phpSat Mar 3 11:01:03 2001 @@ -17,25 +17,42 @@ // | Chuck Hagenbuch [EMAIL PROTECTED] | // +--+ // -// $Id: db.php,v 1.4 2001/03/02 14:16:38 uw Exp $ +// $Id: db.php,v 1.5 2001/03/03 19:01:03 uw Exp $ require_once 'DB.php'; require_once 'Cache/Container.php'; /** - * PEAR/DB Cache Container. - * - * CREATE TABLE cache ( - * id varchar(32) NOT NULL DEFAULT '', - * content mediumtext NOT NULL DEFAULT '', - * expires int(9) NOT NULL DEFAULT 0, - * changed timestamp(14), - * INDEX(expires), - * PRIMARY KEY(id) - * ) - * +* PEAR/DB Cache Container. +* +* WARNING: Other systems might or might not support certain datatypes of +* the tables shown. As far as I know there's no large binary +* type in SQL-92 or SQL-99. Postgres seems to lack any +* BLOB or TEXT type, for MS-SQL you could use IMAGE, don't know +* about other databases. Please add sugestions for other databases to +* the inline docs. +* +* The field 'changed' has no meaning for the Cache itself. It's just there +* because it's a good idea to have an automatically updated timestamp +* field for debugging in all of your tables. +* +* For _MySQL_ you need this DB table: +* +* CREATE TABLE cache ( +* id CHAR(32) NOT NULL DEFAULT '', +* cachegroup VARCHAR(127) NOT NULL DEFAULT '', +* cachedata BLOB NOT NULL DEFAULT '', +* userdataVARCHAR(255) NOT NULL DEFAUL '', +* expires INT(9) NOT NULL DEFAULT 0, +* +* changed TIMESTAMP(14) NOT NULL, +* +* INDEX (expires), +* PRIMARY KEY (id, cachegroup) +* ) + * @author Sebastian Bergmann [EMAIL PROTECTED] - * @version $Id: db.php,v 1.4 2001/03/02 14:16:38 uw Exp $ + * @version $Id: db.php,v 1.5 2001/03/03 19:01:03 uw Exp $ * @package Cache */ class Cache_Container_db extends Cache_Container { @@ -79,28 +96,30 @@ $this-db = DB::connect($this-dsn, true); if (DB::isError($this-db)) { -return new CacheError('DB::connect failed: ' . DB::errorMessage($this-db)); +return new CacheError('DB::connect failed: ' . +DB::errorMessage($this-db), __FILE__, __LINE__); } else { $this-db-setFetchMode(DB_FETCHMODE_ASSOC); } } -function fetch($id) +function fetch($id, $group) { -$query = sprintf('SELECT content, expires FROM %s WHERE id = %s', +$query = sprintf("SELECT cachedata, userdata, expires FROM %s WHERE id = '%s' +AND cachegroup = '%s'", $this-cache_table, - "'" . $this-db-quoteString($id) . "'"); + $this-db-quoteString($id), + $this-db-quoteString($group) + ); $res = $this-db-query($query); if (DB::isError($res)) -return new CacheError('DB::query failed: ' . DB::errorMessage($res)); +return new CacheError('DB::query failed: ' . DB::errorMessage($res), +__FILE__, __LINE__); $row = $res-fetchRow(); if (is_array($row)) -return array($row['expires'], $this-decode($row['content'])); +return array($row['expires'], $this-decode($row['cachedata']), +$row['userdata']); } /** @@ -110,61 +129,80 @@ * MySQL specific. As MySQL is very popular the method should * work fine for 95% of you. */ -function save($id, $data, $expires = 0) +function save($id, $data, $expires, $group, $userdata) { -$query = sprintf('REPLACE INTO %s (content, expires, id) VALUES (%s, %d, %s)', + +$this-flushPreload($id, $group); + +$query = sprintf("REPLACE INTO %s (userdata, cachedata, expires, id, +cachegroup) VALUES ('%s', '%s', %d, '%s', '%s')", $this-cache_table, - "'" . $this-db-quoteString($this-encode(($data))) . "'", + $this-db-quoteString($userdata), + $this-db-quoteString($this-encode(($data))), ($expires) ? $expires + time() : 0, - "'" . $this-db-quoteString($id) . "'"); + $this-db-quoteString($id), +
[PHP-CVS] cvs: php4 /pear/Cache/Container file.php
uw Sat Mar 3 11:02:54 2001 EDT Modified files: /php4/pear/Cache/Container file.php Log: Changes for the new cache structure / features. - added delDirectory() as a helper function for flush - new file format Index: php4/pear/Cache/Container/file.php diff -u php4/pear/Cache/Container/file.php:1.3 php4/pear/Cache/Container/file.php:1.4 --- php4/pear/Cache/Container/file.php:1.3 Fri Mar 2 06:00:43 2001 +++ php4/pear/Cache/Container/file.php Sat Mar 3 11:02:54 2001 @@ -16,7 +16,7 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: file.php,v 1.3 2001/03/02 14:00:43 uw Exp $ +// $Id: file.php,v 1.4 2001/03/03 19:02:54 uw Exp $ require_once 'Cache/Container.php'; @@ -24,7 +24,7 @@ * Stores cache contents in a file. * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: file.php,v 1.3 2001/03/02 14:00:43 uw Exp $ +* @version $Id: file.php,v 1.4 2001/03/03 19:02:54 uw Exp $ */ class Cache_Container_file extends Cache_Container { @@ -64,17 +64,19 @@ if (is_array($options)) $this-setOptions($options, array("cache_dir", "filename_prefix")); +clearstatcache(); + if (!file_exists($this-cache_dir) || !is_dir($this-cache_dir)) mkdir($this-cache_dir, 0755); } // end func contructor -function fetch($id) { +function fetch($id, $group) { -$file = $this-getFilename($id); +$file = $this-getFilename($id, $group); if (!file_exists($file)) -return array(NULL, NULL); +return array(NULL, NULL, NULL); // retrive the content if (!($fh = @fopen($file, "rb"))) @@ -82,30 +84,39 @@ // file format: // 1st line: expiration date -// 2nd+ lines: cache data +// 2nd line: user data +// 3rd+ lines: cache data $expire = trim(fgets($fh, 11)); -$data = $this-decode(fread($fh, filesize($file))); - +$userdata = trim(fgets($fh, 257)); +$cachedata = $this-decode(fread($fh, filesize($file))); fclose($fh); -return array($expire, $data); +return array($expire, $cachedata, $userdata); } // end func fetch -function save($id, $data, $expire = 0) { +/** +* Stores a dataset. +* +* WARNING: If you supply userdata it must not contain any linebreaks, +* otherwise it will break the filestructure. +*/ +function save($id, $cachedata, $expires, $group, $userdata) { -$this-flushPreload($id); +$this-flushPreload($id, $group); -$file = $this-getFilename($id); +$file = $this-getFilename($id, $group); if (!($fh = @fopen($file, "wb"))) return new CacheError("Can't access '$file' to store cache data. Check access rights and path.", __FILE__, __LINE__); // file format: // 1st line: expiration date -// 2nd+ lines: cache data -$expire = ($expire) ? $expire + time() : 0; -fwrite($fh, $expire . "\r\n"); -fwrite($fh, $this-encode($data)); +// 2nd line: user data +// 3rd+ lines: cache data +$expires = ($expires) ? $expires + time() : 0; +fwrite($fh, $expires . "\n"); +fwrite($fh, $userdata . "\n"); +fwrite($fh, $this-encode($cachedata)); fclose($fh); @@ -114,50 +125,39 @@ return true; } // end func save - -function delete($id) { +function delete($id, $group) { -$this-flushPreload($id); +$this-flushPreload($id, $group); -$file = $this-getFilename($id); +$file = $this-getFilename($id, $group); if (file_exists($file)) { - -unlink($file); + +$ok = unlink($file); clearstatcache(); -return true; +return $ok; } return false; } // end func delete -function flush() { +function flush($group) { $this-flushPreload(); - -if (!($dh = opendir($this-cache_dir))) -return new CacheError("Can't access the cache directory '$this-cache_dir'. Check access rights and path", __FILE__, __LINE__); - -$num_removed = 0; -while ($file = readdir($dh)) { -if ("." == $file || ".." == $file) -continue; - -unlink($this-cache_dir . $file); -$num_removed++; -} +$dir = ($group) ? $this-cache_dir . $group . "/" : $this-cache_dir;
[PHP-CVS] cvs: php4 /pear/Cache Container.php
uw Sat Mar 3 11:14:36 2001 EDT Modified files: /php4/pear/CacheContainer.php Log: PR: What does PR mean - Public Relations? Anyway: new cache structure/features - allowed to group cache datasets in a group - allowed to add userdata [CHAR(255)] to a dataset in the cache More explanations will follow on the PEAR list. Submitted by: Ulf Wendel [EMAIL PROTECTED] Reviewed by: myself ;-) works on my development system and my homepage Index: php4/pear/Cache/Container.php diff -u php4/pear/Cache/Container.php:1.3 php4/pear/Cache/Container.php:1.4 --- php4/pear/Cache/Container.php:1.3 Fri Mar 2 06:30:03 2001 +++ php4/pear/Cache/Container.php Sat Mar 3 11:14:36 2001 @@ -16,7 +16,7 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: Container.php,v 1.3 2001/03/02 14:30:03 uw Exp $ +// $Id: Container.php,v 1.4 2001/03/03 19:14:36 uw Exp $ /** * Common base class of all cache storage container. @@ -36,7 +36,7 @@ * not recommended! * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Container.php,v 1.3 2001/03/02 14:30:03 uw Exp $ +* @version $Id: Container.php,v 1.4 2001/03/03 19:14:36 uw Exp $ * @package Cache * @access public * @abstract @@ -59,6 +59,15 @@ */ var $id = ""; + +/** +* Cache group of a preloaded dataset +* +* @var string +*/ +var $group = ""; + + /** * Expiration timestamp of a preloaded dataset. * @@ -66,66 +75,108 @@ */ var $expires = 0; + /** * Value of a preloaded dataset. * * @var string */ -var $data = ""; +var $cachedata = ""; + /** +* Preloaded userdata field. +* +* @var string +*/ +var $userdata = ""; + + +/** * Flag indicating that the dataset requested for preloading is unknown. * * @var boolean */ var $unknown = true; + /** * Encoding mode for cache data: base64 or addslashes() (slash). * * @var string base64 or slash */ var $encoding_mode = "base64"; + /** * Loads a dataset from the cache. * * @paramstring dataset ID +* @paramstring cache group * @return mixed dataset value or NULL on failure * @access public */ -function load($id) { +function load($id, $group) { if ($this-preload) { -if ($this-id != $id) -$this-preload($id); +if ($this-id != $id || $this-group != $group) +$this-preload($id, $group); -return $this-data; +return $this-cachedata; } else { -list( , $data) = $this-fetch($id); +list( , $data, ) = $this-fetch($id, $group); return $data; } } // end func load + +/** +* Returns the userdata field of a cached data set. +* +* @paramstring dataset ID +* @paramstring cache group +* @return string userdata +* @access public +*/ +function getUserdata($id, $group) { + +if ($this-preload) { + +if ($this-id != $id || $this-group != $group) +$this-preload($id, $group); + +return $this-userdata; + +} else { + +list( , , $userdata) = $this-fetch($id, $group); +return $userdata; + +} + +} // end func getUserdata + + /** * Checks if a dataset is expired. * * @paramstring dataset ID +* @paramstring cache group * @paraminteger maximum age timestamp * @return boolean * @access public */ -function isExpired($id, $max_age = 0) { +function isExpired($id, $group, $max_age) { if ($this-preload) { - if ($this-id != $id) -$this-preload($id); + if ($this-id != $id || $this-group != $group) +$this-preload($id, $group); if ($this-unknown) return false; @@ -133,11 +184,11 @@ } else { // check if at all it is cached -if (!$this-isCached($id)) +if (!$this-isCached($id, $group)) return false; // I'm lazy... -list($this-expires, ) = $this-fetch($id); +list($this-expires, , ) = $this-fetch($id, $group); } // endless @@ -147,7 +198,7 @@ // you feel fine, Ulf? if ($expired = ($th
[PHP-CVS] cvs: php4 /pear/Cache Function.php
uw Sat Mar 3 11:17:20 2001 EDT Modified files: /php4/pear/CacheFunction.php Log: Changed the order of the inline module comment and the copyright stuff. Ok, I know this will lead to some discussion. But please let me change it so that PHPDoc works with it. Future version of PHPDoc will be able to handle the other order but this version... I'll redo my changed as well as soon as there is a new PHPDoc version. Index: php4/pear/Cache/Function.php diff -u php4/pear/Cache/Function.php:1.5 php4/pear/Cache/Function.php:1.6 --- php4/pear/Cache/Function.php:1.5Fri Mar 2 00:27:43 2001 +++ php4/pear/Cache/Function.phpSat Mar 3 11:17:20 2001 @@ -1,24 +1,4 @@ ?php -// +--+ -// | PHP version 4.0 | -// +--+ -// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | -// +--+ -// | This source file is subject to version 2.0 of the PHP license, | -// | that is bundled with this package in the file LICENSE, and is| -// | available at through the world-wide-web at | -// | http://www.php.net/license/2_02.txt. | -// | If you did not receive a copy of the PHP license and are unable to | -// | obtain it through the world-wide-web, please send a note to | -// | [EMAIL PROTECTED] so we can mail you a copy immediately. | -// +--+ -// | Authors: Sebastian Bergmann [EMAIL PROTECTED] | -// +--+ -// -// $Id: Function.php,v 1.5 2001/03/02 08:27:43 sbergmann Exp $ - -require_once 'Cache.php'; - /** * Function_Cache * @@ -51,19 +31,40 @@ * global or static variables, don't rely on database queries or * files, and so on. * -* @author Sebastian Bergmann [EMAIL PROTECTED] -* @module Function_Cache -* @version $Revision: 1.5 $ -* @access public +* @author Sebastian Bergmann [EMAIL PROTECTED] +* @module Function_Cache +* @modulegroup Function_Cache +* @package Cache +* @version $Revision: 1.6 $ +* @access public */ +// +--+ +// | PHP version 4.0 | +// +--+ +// | Copyright (c) 1997, 1998, 1999, 2000, 2001 The PHP Group | +// +--+ +// | This source file is subject to version 2.0 of the PHP license, | +// | that is bundled with this package in the file LICENSE, and is| +// | available at through the world-wide-web at | +// | http://www.php.net/license/2_02.txt. | +// | If you did not receive a copy of the PHP license and are unable to | +// | obtain it through the world-wide-web, please send a note to | +// | [EMAIL PROTECTED] so we can mail you a copy immediately. | +// +--+ +// | Authors: Sebastian Bergmann [EMAIL PROTECTED] | +// +--+ +// +// $Id: Function.php,v 1.6 2001/03/03 19:17:20 uw Exp $ + +require_once 'Cache.php'; + /** * Calls a cacheable function or method. * * @return mixed $result * @access public */ - function cached_function_call() { global $FUNCTION_CACHE_CONTAINER, $FUNCTION_CACHE_CONTAINER_OPTIONS; -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache Graphics.php
uw Sat Mar 3 11:18:31 2001 EDT Modified files: /php4/pear/CacheGraphics.php Log: Renamed the class to follow PEAR's guides. Index: php4/pear/Cache/Graphics.php diff -u php4/pear/Cache/Graphics.php:1.3 php4/pear/Cache/Graphics.php:1.4 --- php4/pear/Cache/Graphics.php:1.3Fri Mar 2 08:16:00 2001 +++ php4/pear/Cache/Graphics.phpSat Mar 3 11:18:31 2001 @@ -15,7 +15,7 @@ // | Authors: Ulf Wendel [EMAIL PROTECTED] | // +--+ // -// $Id: Graphics.php,v 1.3 2001/03/02 16:16:00 sbergmann Exp $ +// $Id: Graphics.php,v 1.4 2001/03/03 19:18:31 uw Exp $ require_once 'Cache.php'; @@ -66,9 +66,10 @@ * the output buffer. Modify it if required! * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Graphics.php,v 1.3 2001/03/02 16:16:00 sbergmann Exp $ +* @version $Id: Graphics.php,v 1.4 2001/03/03 19:18:31 uw Exp $ +* @package Cache */ -class graphics_cache extends cache { +class Cache_Graphics extends Cache { /** * Cache URL prefix. @@ -319,5 +320,5 @@ } // end func setCacheDir -} // end class graphics_cache +} // end class Cache_Graphics ? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache Output.php
uw Sat Mar 3 11:19:25 2001 EDT Modified files: /php4/pear/CacheOutput.php Log: Made Output use the new features. Index: php4/pear/Cache/Output.php diff -u php4/pear/Cache/Output.php:1.7 php4/pear/Cache/Output.php:1.8 --- php4/pear/Cache/Output.php:1.7 Fri Mar 2 08:16:00 2001 +++ php4/pear/Cache/Output.php Sat Mar 3 11:19:25 2001 @@ -17,7 +17,7 @@ // | Vinai Kopp [EMAIL PROTECTED] | // +--+ // -// $Id: Output.php,v 1.7 2001/03/02 16:16:00 sbergmann Exp $ +// $Id: Output.php,v 1.8 2001/03/03 19:19:25 uw Exp $ require_once 'Cache.php'; @@ -90,25 +90,35 @@ */ var $output_id = ""; +/** +* Group passed to start() +* +* @var string +* @see start(), end() +*/ +var $output_group = ""; + /** * starts the output buffering and returns an empty string or returns the cached output from the cache. * * @paramstring dataset ID +* @paramstring cache group * @return string * @access public */ -function start($id) { +function start($id, $group = "default") { if ($this-no_cache) return ""; // this is already cached return it from the cache so that the user // can use the cache content and stop script execution -if ($content = $this-get($id)) +if ($content = $this-get($id, $group)) return $content; // remember some data to be able to fill the cache on calling end() $this-output_id = $id; +$this-output_group = $group; // WARNING: we need the output buffer - possible clashes ob_start(); @@ -122,18 +132,19 @@ * Stores the content of the output buffer into the cache and returns the content. * * @paraminteger lifetime of the cached data in seconds - 0 for endless +* @paramstring additional userdefined data * @return string cached output * @access public * @see endPrint(), endGet() */ -function end($expire = 0) { +function end($expire = 0, $userdata = "") { $content = ob_get_contents(); ob_end_clean(); // store in the cache if (!$this-no_cache) -$this-container-save($this-output_id, $content, $expire); +$this-container-save($this-output_id, $content, $expire, +$this-output_group, $userdata); return $content; } // end func end() @@ -142,11 +153,11 @@ /** * Stores the content of the output buffer into the cache and prints the content. * -* @brother end(), endGet() +* @brother end() */ -function endPrint($expire = 0) { +function endPrint($expire = 0, $userdata = "") { -print $this-end($expire); +print $this-end($expire, $userdata); } // end func endPrint @@ -168,10 +179,11 @@ ob_end_clean(); $this-output_id = ""; +$this-output_group = ""; return $content; } // end func endGet - + } // end class output ? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear Cache.php
uw Sat Mar 3 11:21:50 2001 EDT Modified files: /php4/pear Cache.php Log: The main file with new features. - added support for cache dataset groups - added extSave() - see my next PEAR list posting - added getUserdata() Index: php4/pear/Cache.php diff -u php4/pear/Cache.php:1.2 php4/pear/Cache.php:1.3 --- php4/pear/Cache.php:1.2 Fri Mar 2 02:29:34 2001 +++ php4/pear/Cache.php Sat Mar 3 11:21:49 2001 @@ -16,7 +16,7 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: Cache.php,v 1.2 2001/03/02 10:29:34 sbergmann Exp $ +// $Id: Cache.php,v 1.3 2001/03/03 19:21:49 uw Exp $ /** * Cache is a base class for cache implementations. @@ -24,7 +24,7 @@ * TODO: Simple usage example goes here. * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Cache.php,v 1.2 2001/03/02 10:29:34 sbergmann Exp $ +* @version $Id: Cache.php,v 1.3 2001/03/03 19:21:49 uw Exp $ * @package Cache * @access public */ @@ -79,115 +79,163 @@ * * @paramstring Name of storage container class * @paramarray Array with storage class dependend config options -* @see setOptions() */ function Cache($storage_driver, $storage_options = "") { $storage_driver = strtolower($storage_driver); $storage_class = 'Cache_Container_' . $storage_driver; $storage_classfile = 'Cache/Container/' . $storage_driver . '.php'; - -if (@include_once $storage_classfile) { -$this-container = new $storage_class($storage_options); -$this-garbageCollection(); -} else { -return null; -} + +include_once $storage_classfile +$this-container = new $storage_class($storage_options); +$this-garbageCollection(); + } /** * Returns the requested dataset it if exists and is not expired * * @paramstring dataset ID +* @paramstring cache group * @return mixed cached data or NULL on failure * @access public */ -function get($id) { +function get($id, $group = "default") { if ($this-no_cache) return ""; -if ($this-isCached($id) !$this-isExpired($id)) -return $this-load($id); +if ($this-isCached($id, $group) !$this-isExpired($id, $group)) +return $this-load($id, $group); return NULL; } // end func get + /** * Stores the given data in the cache. * * @paramstring dataset ID used as cache identifier * @parammixed data to cache * @paraminteger lifetime of the cached data in seconds - 0 for endless +* @paramstring cache group * @return boolean * @access public */ -function save($id, $data, $expires = 0) { +function save($id, $data, $expires = 0, $group = "default") { if ($this-no_cache) return true; -return $this-container-save($id, $data, $expires); +return $this-container-save($id, $data, $expires, $group, ""); } // end func save + +/** +* Stores a dataset without additional userdefined data. +* +* @paramstring dataset ID +* @parammixed data to store +* @paramstring additional userdefined data +* @parammixed userdefined expire date +* @paramstring cache group +* @return boolean +* @throws CacheError +* @access public +* @see getUserdata() +*/ +function extSave($id, $cachedata, $userdata, $expires = 0, $group = "default") { +if ($this-no_cache) +return true; + +return $this-container-save($id, $cachedata, $expires, $group, $userdata); +} // end func extSave + + /** * Loads the given ID from the cache. * * @paramstring dataset ID +* @paramstring cache group * @return mixed cached data or NULL on failure * @access public */ -function load($id) { +function load($id, $group = "default") { if ($this-no_cache) return ""; -return $this-container-load($id); +return $this-container-load($id, $group); } // end func load + +/** +* Returns the userdata field of a cached data set. +* +* @paramstring dataset ID +* @paramstring cache group +* @return string userdata +* @access public +* @see extSave() +*/ +function getUserdata($id, $group = "default") { +if ($this-no_cache) +return ""; + +return $this-container-getUserdata($id, $group); +
[PHP-CVS] cvs: php4 /pear/Cache/Container file.php
uw Fri Mar 2 06:00:43 2001 EDT Modified files: /php4/pear/Cache/Container file.php Log: Fixed expire date bug. Index: php4/pear/Cache/Container/file.php diff -u php4/pear/Cache/Container/file.php:1.2 php4/pear/Cache/Container/file.php:1.3 --- php4/pear/Cache/Container/file.php:1.2 Thu Mar 1 09:18:23 2001 +++ php4/pear/Cache/Container/file.php Fri Mar 2 06:00:43 2001 @@ -16,7 +16,7 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: file.php,v 1.2 2001/03/01 17:18:23 sbergmann Exp $ +// $Id: file.php,v 1.3 2001/03/02 14:00:43 uw Exp $ require_once 'Cache/Container.php'; @@ -24,7 +24,7 @@ * Stores cache contents in a file. * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: file.php,v 1.2 2001/03/01 17:18:23 sbergmann Exp $ +* @version $Id: file.php,v 1.3 2001/03/02 14:00:43 uw Exp $ */ class Cache_Container_file extends Cache_Container { @@ -103,6 +103,7 @@ // file format: // 1st line: expiration date // 2nd+ lines: cache data +$expire = ($expire) ? $expire + time() : 0; fwrite($fh, $expire . "\r\n"); fwrite($fh, $this-encode($data)); @@ -116,7 +117,7 @@ function delete($id) { - + $this-flushPreload($id); $file = $this-getFilename($id); @@ -133,7 +134,7 @@ function flush() { - + $this-flushPreload(); if (!($dh = opendir($this-cache_dir))) @@ -218,4 +219,4 @@ } // end func getFilename } -? +? \ No newline at end of file -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache/Container phplib.php
uw Fri Mar 2 06:10:29 2001 EDT Modified files: /php4/pear/Cache/Container phplib.php Log: Fixed: MySQL data, expire, garbageCollection - forgot to mention for db.php and this file changed suggested SQL column type for content (data) from text to mediumtext Index: php4/pear/Cache/Container/phplib.php diff -u php4/pear/Cache/Container/phplib.php:1.2 php4/pear/Cache/Container/phplib.php:1.3 --- php4/pear/Cache/Container/phplib.php:1.2Thu Mar 1 09:18:23 2001 +++ php4/pear/Cache/Container/phplib.phpFri Mar 2 06:10:29 2001 @@ -16,14 +16,14 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: phplib.php,v 1.2 2001/03/01 17:18:23 sbergmann Exp $ +// $Id: phplib.php,v 1.3 2001/03/02 14:10:29 uw Exp $ require_once 'Cache/Container.php'; /* CREATE TABLE cache ( id CHAR(32) NOT NULL DEFAULT '', - data TEXT NOT NULL DEFAULT '', + content MEDIUMTEXT NOT NULL DEFAULT '', expires INT(9) NOT NULL DEFAULT 0, changed TIMESTAMP(14), @@ -37,7 +37,7 @@ * Stores cache data into a database table. * * @author Ulf Wendel [EMAIL PROTECTED], Sebastian Bergmann [EMAIL PROTECTED] -* @version $Id: phplib.php,v 1.2 2001/03/01 17:18:23 sbergmann Exp $ +* @version $Id: phplib.php,v 1.3 2001/03/02 14:10:29 uw Exp $ * @package Cache */ class Cache_Container_phplib extends Cache_Container { @@ -79,11 +79,11 @@ /** * Include path for you local.inc * -* HINT: If your're not using prepend.php you must +* HINT: If your're not using PHPLib's prepend.php you must * take care that all classes (files) references by you * local.inc are included automatically. So you might * want to write a new local2.inc that only referrs to -* the database class (file) you're using and includes all required files! +* the database class (file) you're using and includes all required files. * * @var string path to your local.inc - make sure to add a trailing slash * @see $local_file @@ -92,9 +92,20 @@ /** +* Creates an instance of a phplib db class to use it for storage. * -* @parammixed -*/ +* @parammixed If empty the object tries to used the +* preconfigured class variables. If given it +* must be an array with: +* db_class = name of the DB class to use +* optional: +* db_file = filename of the DB class +* db_path = path to the DB class +* local_file = kind of local.inc +* local_patk = path to the local.inc +* see $local_path for some hints.s +* @see $local_path +*/ function Cache_Container_phplib($options = "") { if (is_array($options)) @@ -103,8 +114,9 @@ if (!$this-db_class) return new CacheError("No database class specified.", __FILE__, __LINE__); -// include the required files -include_once($this-local_path . $this-local_file); +// include the required files +if ($this-local_file) +include_once($this-local_path . $this-local_file); // create a db object $this-db = new $this-db_class; @@ -114,7 +126,7 @@ function fetch($id) { -$query = sprintf("SELECT expires, data FROM %s WHERE id = '%s'", +$query = sprintf("SELECT expires, content FROM %s WHERE id = '%s'", $this-cache_table, $id ); @@ -122,7 +134,7 @@ if (!$this-db-Next_Record()) return array(NULL, NULL); -return array($this-db-f("expires"), $this-decode($this-db-f("data"))); +return array($this-db-f("expires"), $this-decode($this-db-f("content"))); } // end func fetch @@ -130,15 +142,15 @@ $this-flushPreload($id); -$query = sprintf("REPLACE INTO %s (data, expires, id) VALUES ('%s', %d, '%s')", +$query = sprintf("REPLACE INTO %s (content, expires, id) VALUES ('%s', %d, +'%s')", $this-cache_table, $this-encode($data), -$expires, +($expires) ? $expires + time() : 0, $id ); -$this-db-query($query); +$this-db-query($query); -return (boolean)$this-db-affected_rows(); +return (boolean)$this-db-affected_rows(); } // end func save @@ -152,
[PHP-CVS] cvs: php4 /pear/Cache/Container db.php phplib.php
uw Fri Mar 2 06:16:38 2001 EDT Modified files: /php4/pear/Cache/Container db.php phplib.php Log: Added a warning on the usage of REPLACE INTO to the inline docs. Index: php4/pear/Cache/Container/db.php diff -u php4/pear/Cache/Container/db.php:1.3 php4/pear/Cache/Container/db.php:1.4 --- php4/pear/Cache/Container/db.php:1.3Fri Mar 2 05:58:46 2001 +++ php4/pear/Cache/Container/db.phpFri Mar 2 06:16:38 2001 @@ -17,7 +17,7 @@ // | Chuck Hagenbuch [EMAIL PROTECTED] | // +--+ // -// $Id: db.php,v 1.3 2001/03/02 13:58:46 uw Exp $ +// $Id: db.php,v 1.4 2001/03/02 14:16:38 uw Exp $ require_once 'DB.php'; require_once 'Cache/Container.php'; @@ -35,7 +35,7 @@ * ) * * @author Sebastian Bergmann [EMAIL PROTECTED] - * @version $Id: db.php,v 1.3 2001/03/02 13:58:46 uw Exp $ + * @version $Id: db.php,v 1.4 2001/03/02 14:16:38 uw Exp $ * @package Cache */ class Cache_Container_db extends Cache_Container { @@ -103,6 +103,13 @@ return array($row['expires'], $this-decode($row['content'])); } +/** +* Stores a dataset. +* +* WARNING: we use the SQL command REPLACE INTO this might be +* MySQL specific. As MySQL is very popular the method should +* work fine for 95% of you. +*/ function save($id, $data, $expires = 0) { $query = sprintf('REPLACE INTO %s (content, expires, id) VALUES (%s, %d, %s)', Index: php4/pear/Cache/Container/phplib.php diff -u php4/pear/Cache/Container/phplib.php:1.3 php4/pear/Cache/Container/phplib.php:1.4 --- php4/pear/Cache/Container/phplib.php:1.3Fri Mar 2 06:10:29 2001 +++ php4/pear/Cache/Container/phplib.phpFri Mar 2 06:16:38 2001 @@ -16,7 +16,7 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: phplib.php,v 1.3 2001/03/02 14:10:29 uw Exp $ +// $Id: phplib.php,v 1.4 2001/03/02 14:16:38 uw Exp $ require_once 'Cache/Container.php'; @@ -37,7 +37,7 @@ * Stores cache data into a database table. * * @author Ulf Wendel [EMAIL PROTECTED], Sebastian Bergmann [EMAIL PROTECTED] -* @version $Id: phplib.php,v 1.3 2001/03/02 14:10:29 uw Exp $ +* @version $Id: phplib.php,v 1.4 2001/03/02 14:16:38 uw Exp $ * @package Cache */ class Cache_Container_phplib extends Cache_Container { @@ -138,6 +138,13 @@ } // end func fetch +/** +* Stores a dataset. +* +* WARNING: we use the SQL command REPLACE INTO this might be +* MySQL specific. As MySQL is very popular the method should +* work fine for 95% of you. +*/ function save($id, $data, $expires = 0) { $this-flushPreload($id); -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache Container.php
uw Fri Mar 2 06:30:04 2001 EDT Modified files: /php4/pear/CacheContainer.php Log: - changed $max_age to an absolute timestamp value Index: php4/pear/Cache/Container.php diff -u php4/pear/Cache/Container.php:1.2 php4/pear/Cache/Container.php:1.3 --- php4/pear/Cache/Container.php:1.2 Thu Mar 1 09:18:22 2001 +++ php4/pear/Cache/Container.php Fri Mar 2 06:30:03 2001 @@ -16,7 +16,7 @@ // | Sebastian Bergmann [EMAIL PROTECTED] | // +--+ // -// $Id: Container.php,v 1.2 2001/03/01 17:18:22 sbergmann Exp $ +// $Id: Container.php,v 1.3 2001/03/02 14:30:03 uw Exp $ /** * Common base class of all cache storage container. @@ -36,7 +36,7 @@ * not recommended! * * @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: Container.php,v 1.2 2001/03/01 17:18:22 sbergmann Exp $ +* @version $Id: Container.php,v 1.3 2001/03/02 14:30:03 uw Exp $ * @package Cache * @access public * @abstract @@ -100,6 +100,7 @@ if ($this-id != $id) $this-preload($id); + return $this-data; } else { @@ -115,7 +116,7 @@ * Checks if a dataset is expired. * * @paramstring dataset ID -* @paraminteger maximum age in seconds of the data set +* @paraminteger maximum age timestamp * @return boolean * @access public */ @@ -144,7 +145,7 @@ return false; // you feel fine, Ulf? -if ($expired = ($this-expires = time() || ($max_age $this-expires = time() + $max_age)) ) { +if ($expired = ($this-expires = time() || ($max_age ($this-expires = +$max_age))) ) { $this-delete($id); $this-flushPreload(); @@ -167,7 +168,7 @@ if ($this-id != $id) $this-preload($id); -return !($this-unknown); +return !($this-unknown); } else { @@ -270,6 +271,7 @@ $this-id = $id; list($this-expires, $this-data) = $this-fetch($id); + if (NULL === $this-data) { // Uuups, unknown ID -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache Output.php
uw Fri Mar 2 07:17:23 2001 EDT Modified files: /php4/pear/CacheOutput.php Log: ... must forgot this commit - endGet(), $cache_id = $output_id - added endGet() which returns the output buffering content - changed $cache_id to $output_id seems to be a better name as the class is named Cache_Output Index: php4/pear/Cache/Output.php diff -u php4/pear/Cache/Output.php:1.4 php4/pear/Cache/Output.php:1.5 --- php4/pear/Cache/Output.php:1.4 Fri Mar 2 06:46:01 2001 +++ php4/pear/Cache/Output.php Fri Mar 2 07:17:22 2001 @@ -17,9 +17,9 @@ // | Vinai Kopp [EMAIL PROTECTED] | // +--+ // -// $Id: Output.php,v 1.4 2001/03/02 14:46:01 chregu Exp $ +// $Id: Output.php,v 1.5 2001/03/02 15:17:22 uw Exp $ -require_once'Cache.php'; +require_once SHOP_INCLUDE_DIR . 'Cache/Cache.php'; /** * Class to cache the output of a script using the output buffering functions @@ -36,9 +36,11 @@ * * // place this somewhere in a central config file * define(CACHE_STORAGE_CLASS, "cache_container_file"); +* // file storage needs a dir to put the cache files +* define(CACHE_DIR, "/var/tmp/"); * * // get a cache object -* $cache = new Cache_Output(CACHE_STORAGE_CLASS) +* $cache = new Cache_Output(CACHE_STORAGE_CLASS, array("cache_dir" = CACHE_DIR)); * * // compute the unique handle. * // if your script depends on Cookie and HTTP Post data as well @@ -86,8 +88,9 @@ * @var string * @see start(), end() */ -var $cache_id = ""; +var $output_id = ""; + /** * starts the output buffering and returns an empty string or returns the cached output from the cache. * @@ -98,14 +101,14 @@ function start($id) { if ($this-no_cache) return ""; - -// this is already cached return it from the cache so that the user + +// this is already cached return it from the cache so that the user // can use the cache content and stop script execution if ($content = $this-get($id)) return $content; - + // remember some data to be able to fill the cache on calling end() -$this-cache_id = $id; +$this-output_id = $id; // WARNING: we need the output buffer - possible clashes ob_start(); @@ -113,6 +116,7 @@ return ""; } // end func start + /* * Stores the content of the output buffer into the cache and returns the content. @@ -120,7 +124,7 @@ * @paraminteger lifetime of the cached data in seconds - 0 for endless * @return string cached output * @access public -* @see endPrint() +* @see endPrint(), endGet() */ function end($expire = 0) { @@ -129,22 +133,45 @@ // store in the cache if (!$this-no_cache) -$this-container-save($this-cache_id,$content, $expire); - +$this-container-save($this-output_id, $content, $expire); + return $content; } // end func end() + /** * Stores the content of the output buffer into the cache and prints the content. * -* @brother end() +* @brother end(), endGet() */ function endPrint($expire = 0) { -print $this-end($expire); +print $this-end($expire); } // end func endPrint +/** +* Returns the content of the output buffer but does not store it into the cache. +* +* Use this method if the content of your script is markup (XML) +* that has to be parsed/converted (XSLT) before you can output +* and store it into the cache using save(). +* +* @return string +* @access public +* @see endPrint(), end() +*/ +function endGet() { + +$content = ob_get_contents(); +ob_end_clean(); + +$this-output_id = ""; + +return $content; +} // end func endGet + + } // end class output -? \ No newline at end of file +? -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/Cache Output.php
uw Fri Mar 2 07:18:39 2001 EDT Modified files: /php4/pear/CacheOutput.php Log: Sorry, removed my local settings. Will take some sleep before commiting again! Index: php4/pear/Cache/Output.php diff -u php4/pear/Cache/Output.php:1.5 php4/pear/Cache/Output.php:1.6 --- php4/pear/Cache/Output.php:1.5 Fri Mar 2 07:17:22 2001 +++ php4/pear/Cache/Output.php Fri Mar 2 07:18:39 2001 @@ -17,9 +17,9 @@ // | Vinai Kopp [EMAIL PROTECTED] | // +--+ // -// $Id: Output.php,v 1.5 2001/03/02 15:17:22 uw Exp $ +// $Id: Output.php,v 1.6 2001/03/02 15:18:39 uw Exp $ -require_once SHOP_INCLUDE_DIR . 'Cache/Cache.php'; +require_once 'Cache/Cache.php'; /** * Class to cache the output of a script using the output buffering functions -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP-CVS] cvs: php4 /pear/PHPDoc/parser PhpdocClassParser.php PhpdocConstantParser.php PhpdocFunctionParser.php PhpdocModuleParser.php PhpdocParser.php PhpdocParserCore.php PhpdocParserRegExp.php PhpdocParserTags.php PhpdocUseParser.php PhpdocVariableParser.php
rray( optional, default, type, name ). - * @see getVariableTypeAndValue() - */ - function getFunctionArgs($code) { - - $args = array(); - while (preg_match($this-PHP_COMPLEX["argument"], $code, $regs)) { - - $type = ""; - $value = ""; - $optional = false; - - if (!isset($regs[3])) { - - $len_of_value = strlen($regs[1]); - - } else if ("=" == $regs[3]) { - - $find = $regs[1].$regs[2]; - $code = substr($code, strpos($code, $find)+strlen($find) ); - - list ($type, $value, $raw_value) = $this-getVariableTypeAndValue($code); - $len_of_value = strlen($raw_value); - $optional = true; - - } else { - - $len_of_value = strlen($regs[1].$regs[2]); - - } - - $code = substr($code, $len_of_value); - $args[] = array( - "optional" = $optional, - "default" = $value, - "type" = $type, - "name" = $regs[1] - ); - - } - - return $args; - } // end func getFunctionArgs - +/** +* Internal structur of a function. +* +* @vararray$emptyFunction +*/ +var $emptyFunction = array( +"name" = "", +"undoc" = true, + +"args" = array() + ); + +/** +* Array of tags that are allowed in front of the function keyword +* +* @vararray$functionTags +* @seeanalyseFunctionParagraph() +*/ +var $functionTags = array( +"parameter" = true, +"param" = true, + +"return"= true, + +"access"= true, +"abstract" = true, +"static"= true, + +"throws"= true, + +"see" = true, +"link" = true, + +"global"= true, + +"version" = true, +"since" = true, + +"deprecated"= true, +"deprec"= true, + +"brother" = true, +"sister"= true, + +"exclude" = true, +"magic" = true, + +"author"= true, +"copyright" = true, + +"todo" = true + ); + +/** +* Analyses a function doc comment. +* @paramarray +* @return array +*/ +function analyseFunction($para) { + +$function = $this-emptyFunction; +$function["name"]
[PHP-CVS] cvs: php4 /pear/PHPDoc/accessor PhpdocAccessor.php PhpdocClassAccessor.php PhpdocDocumentAccessor.php PhpdocIndexAccessor.php PhpdocModuleAccessor.php PhpdocWarningAccessor.php
his function to call the functions +* it needs to reorganize the data from the PhpdocXMLReader in a +* way that it needs. +* +* @abstract +* @see$xml, $data +*/ +function init() { +} // end func init } // end class PhpdocAccessor ? Index: php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php diff -u php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php:1.1 php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php:1.2 --- php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php:1.1 Sun Oct 8 03:03:18 2000 +++ php4/pear/PHPDoc/accessor/PhpdocClassAccessor.php Sun Feb 18 07:03:05 2001 @@ -2,238 +2,245 @@ /** * Provides functions to access phpdoc xml documents that contain classes. * -* @author Ulf Wendel [EMAIL PROTECTED] -* @version 1.0 -* @package PHPDoc +* @author Ulf Wendel [EMAIL PROTECTED] +* @version$Id: PhpdocClassAccessor.php,v 1.2 2001/02/18 15:03:05 uw Exp $ */ class PhpdocClassAccessor extends PhpdocDocumentAccessor { - var $xmlkey = "class"; - - /** - * Array of inherited elements - * @var array $inherited - */ - var $inherited = array(); - - /** - * Returns an array with the data of a class (no functions etc, just the class docs). - * @return array $class - * @access public - */ - function getClassdata() { - - $class = $this-xml["class"]; - - unset($class["variable"]); - unset($class["function"]); - unset($class["uses"]); - unset($class["constant"]); - unset($class["inherited"]); - unset($class["overriden"]); - unset($class["path"]); - - return $class; - } // end func getClassdata - - /** - * Returns an array of inherited functions. - * @return array - * @access public - * @see getInheritedVariables(), getInheritedUses(), getInheritedConstants() - */ - function getInheritedFunctions() { - return $this-inherited["functions"]; - } // end func getInheritedFunctions - - /** - * Returns an array of inherited variables. - * @return array - * @access public - * @see getInheritedFunctions(), getInheritedUses(), getInheritedConstants() - */ - function getInheritedVariables() { - return $this-inherited["variables"]; - } // end func getInheritedVariables - - /** - * Returns an array of inherited included files. - * @return array - * @access public - * @see getInheritedFunctions(), getInheritedUses(), getInheritedConstants() - */ - function getInheritedUses() { - return $this-inherited["uses"]; - } // end func getInheritedUses() - - /** - * Returns an array of inherited constants. - * @return array - * @access public - * @see getInheritedFunctions(), getInheritedVariables(), getInheritedUses() - */ - function getInheritedConstants() { - return $this-inherited["constants"]; - } // end func getInheritedConstants - - /** - * Returns an array with the "path" of a class. - * @return array $path - * @access public - * @see getSubclasses() - */ - function getClasstree() { - - if (isset($this-xml["class"]["path"])) - return $this-convertPath($this-xml["class"]["path"]); - else - return array(); - - } // end func getClasstree - - /** - * Returns an array with all subclasses of a class. - * @return array - * @access public - * @see getClasstree() - */ - function getSubclasses() { - return $this-data["subclasses"]; - } // end func getSubclasses - - - /** - * Converts a xml path array to a path that can be passed to the user. - * - * The path is an array like path[0..n] = classname where path[0] is the - * directs parent (extends path[0]) and path[n] is the baseclass. - * - * @paramarray $xmlpath - * @return array $path - */ - function convertPath($xmlpath) { - - $path = array(); - - if (!isset($xmlpath["parent"][0])) { - - $path[0] = $xmlpath["parent"]["value"]; -
[PHP-CVS] cvs: php4 /pear/PHPDoc/core Phpdoc.php PhpdocArgvHandler.php PhpdocObject.php PhpdocSetupHandler.php
bstr($file, $len, 6)) { +if ("class_" == substr($file, $len, 6)) { - $renderer-render(substr($file, $len), "class"); +$renderer-render(substr($file, $len), "class"); - } else if ("module_" == substr($file, $len, 7)) { +} else if ("module_" == substr($file, $len, 7)) { - $renderer-render(substr($file, $len), "module"); +$renderer-render(substr($file, $len), "module"); - } else if ("classtree_" == substr($file, $len, 10)) { +} else if ("classtree_" == substr($file, $len, 10)) { - $renderer-render(substr($file, $len), "classtree"); +$renderer-render(substr($file, $len), "classtree"); - } else if ("modulegroup_" == substr($file, $len, 12)) { +}else if ("modulegroup_" == substr($file, $len, 12)) { - $renderer-render(substr($file, $len), "modulegroup"); +$renderer-render(substr($file, $len), "modulegroup"); - } else if ("warnings_" == substr($file, $len, 9)) { +} else if ("warnings_" == substr($file, $len, 9)) { - $renderer-render(substr($file, $len), "warning"); +$renderer-render(substr($file, $len), "warning"); - } +} - } +} - $renderer-finish(); - $fileHandler-createFile($target."phpdoc_xmlfiles".$this-targetFileSuffix, $tpl-get()); +$renderer-finish(); +$fileHandler-createFile($target."phpdoc_xmlfiles".$this-targetFileSuffix, +$tpl-get()); - $this-outl($this-finishInstructions); - return true; - } // end func render + $this-outl($this-finishInstructions); +return true; +} // end func render } // end class Phpdoc ? Index: php4/pear/PHPDoc/core/PhpdocArgvHandler.php diff -u php4/pear/PHPDoc/core/PhpdocArgvHandler.php:1.2 php4/pear/PHPDoc/core/PhpdocArgvHandler.php:1.3 --- php4/pear/PHPDoc/core/PhpdocArgvHandler.php:1.2 Sun Dec 3 12:30:42 2000 +++ php4/pear/PHPDoc/core/PhpdocArgvHandler.php Sun Feb 18 07:29:29 2001 @@ -5,157 +5,157 @@ * Be careful the source has not been tested yet, it's probably very buggy. * Any help and comments are welcome... * -* @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: PhpdocArgvHandler.php,v 1.2 2000/12/03 20:30:42 uw Exp $ +* @author Ulf Wendel [EMAIL PROTECTED] +* @version $Id: PhpdocArgvHandler.php,v 1.3 2001/02/18 15:29:29 uw Exp $ */ class PhpdocArgvHandler extends PhpdocObject { - - /** - * Message explaining the usage of phpdoc on the command line. - * - * Actually it's not the message itself but an array containing - * the instructions. The array is indexed by the command line option e.g. "-h". - * The array values hold a short message describing the usage of the option. - * - * @var array - * @access private - */ - var $COMMANDS = array( - "-f filename [, filename]" = "name of files to parse", - "-d directory" = "name of a directory to parse", - "-p path" = "path of the files", - "-t target" = "path where to save the generated files, default is the current path", - "-h" = "show this help message" - ); - - - /** - * Handle the command line values - * - * handleArgv() looks for command line values and - * interprets them. If there're unknown command it prints - * a message and calls die() - */ - function handleArgv() { -
[PHP-CVS] cvs: php4 /pear/PHPDoc/exceptions PhpdocError.php
uw Sun Feb 18 07:36:33 2001 EDT Modified files: /php4/pear/PHPDoc/exceptionsPhpdocError.php Log: Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces. Index: php4/pear/PHPDoc/exceptions/PhpdocError.php diff -u php4/pear/PHPDoc/exceptions/PhpdocError.php:1.2 php4/pear/PHPDoc/exceptions/PhpdocError.php:1.3 --- php4/pear/PHPDoc/exceptions/PhpdocError.php:1.2 Sun Dec 3 14:37:36 2000 +++ php4/pear/PHPDoc/exceptions/PhpdocError.php Sun Feb 18 07:36:32 2001 @@ -2,6 +2,8 @@ /** * PHPDoc Error Handling class * +* TODO: make this 100% PEAR compatible +* * PHPDoc "throws" an error class derived from this class whenever * an error occurs. PHPDoc saves the error object to the public array * $this-err[] which exists in every PHPDoc class and tries to return @@ -9,118 +11,124 @@ * * The class is widely equal to the PEAR error handling class PEAR_ERROR. * -* @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: PhpdocError.php,v 1.2 2000/12/03 22:37:36 uw Exp $ -* @package PHPDoc +* @author Ulf Wendel [EMAIL PROTECTED] +* @version $Id: PhpdocError.php,v 1.3 2001/02/18 15:36:32 uw Exp $ +* @package PHPDoc */ class PhpdocError { - - /** - * Name of the error object class used to construct the error message - * @var string $classname - */ - var $classname = "PhpdocError"; - - /** - * Error message prefix. - * @var string $error_message_prefix - */ - var $error_message_prefix = ""; + +/** +* Name of the error object class used to construct the error message +* +* @var string $classname +*/ +var $classname = "PhpdocError"; + +/** +* Error message prefix. +* +* @var string $error_message_prefix +*/ +var $error_message_prefix = ""; - /** - * Error prepend, used for HTML formatting. - * @var string $error_prepend - */ - var $error_prepend = "b"; - - /** - * Error append, used for HTML formatting. - * @var string $error_append - */ - var $error_append = "/b"; - - /** - * The error message itself. - * - * Use getMessage() to access it. - * - * @var string $message - * @see PhpdocError() - */ - var $message = ""; - - /** - * File where the error occured. - * @var string $file - * @see PhpdocError() - */ - var $file = ""; - - /** - * Line number where the error occured. - * @var integer $line - * @see PhpdocError() - */ - var $line = 0; - - /** - * Array that describes how an error gets handled. - * @var array $errorHandling - * @see PhpdocError() - */ - var $errorHandling = array( - "print" = false, - "trigger" = false, - "die" = false - ); - - /** - * Sets the error message, filename and linenumber. - * - * @paramstring Errormessage - * @paramstring Name of the file where the error occured, use __FILE__ for this - * @paramstring Linenumber where the error occured, use __LINE__ for this - */ - function PhpdocError($message, $file, $line) { - - $this-message = $message; - $this-file = $file; - $this-line = $line; +/** +* Error prepend, used for HTML formatting. +* +* @var string $error_prepend +*/ +var $error_prepend = "b"; + +/** +* Error append, used for HTML formatting. +* +* @var string $error_append +*/ +var $error_append = "/b"; + +/** +* The error message itself. +* +* Use getMessage() to access it. +* +* @var string $message +* @see PhpdocError() +*/ +var $message = ""; + +/** +* File where the error occured. +* +* @var string $file +* @see PhpdocError() +*/ +var $file = ""; + +/** +* Line number where the error occured. +* +* @var integer $line +* @see Php
[PHP-CVS] cvs: php4 /pear/PHPDoc/filehandler PhpdocFileHandler.php
uw Sun Feb 18 07:40:34 2001 EDT Modified files: /php4/pear/PHPDoc/filehandler PhpdocFileHandler.php Log: Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces. Index: php4/pear/PHPDoc/filehandler/PhpdocFileHandler.php diff -u php4/pear/PHPDoc/filehandler/PhpdocFileHandler.php:1.2 php4/pear/PHPDoc/filehandler/PhpdocFileHandler.php:1.3 --- php4/pear/PHPDoc/filehandler/PhpdocFileHandler.php:1.2 Sun Dec 3 14:37:36 2000 +++ php4/pear/PHPDoc/filehandler/PhpdocFileHandler.php Sun Feb 18 07:40:33 2001 @@ -2,208 +2,207 @@ /** * File handling functions in phpdoc. * -* @version $Id $ -* @author Ulf Wendel [EMAIL PROTECTED] +* @version $Id: PhpdocFileHandler.php,v 1.3 2001/02/18 15:40:33 uw Exp $ +* @author Ulf Wendel [EMAIL PROTECTED] */ class PhpdocFileHandler extends PhpdocObject { - - /** - * Filepath. The path is automatically added in front of all filenames - * - * @var string $path - * @see setFilePath() - */ - var $path = ""; - - /** - * Reads a list of files or one file. - * - * @parammixed Filename or an array filenames, $k = $filename - * @throws PhpdocError - * @access public - */ - function get($files) { - if ("" == $files) { - $this-err[] = new PhpdocError("No files specified.", __FILE__, __LINE__); - return array("", ""); - } - - if (!is_array($files)) - $files = array($files); - - $contents = array(); - $together = ""; - - reset($files); - while (list($k, $filename) = each($files)) - $contents[$filename] = $this-getFile($filename); - - return $contents; - } // end func get - - /** - * Sets the filepath. The path is automatically added in front of all filenames - * - * @paramstring $path - * @return bool$ok - * @access public - */ - function setFilePath($path) { - $this-path = $path; - } // end func setFilePath - - /** - * Reads a file. - * - * @paramstring $filename - * @return string $content - * @throws PhpdocError - */ - function getFile($filename) { - if ("" == $filename) { - $this-err[] = new PhpdocError("getFile(), no filename specified.", __FILE__, __LINE__); - return ""; - } - if (!file_exists($filename)) { - $this-err[] = new PhpdocError("getFile(), unknown file '$filename'.", __FILE__, __LINE__); - return ""; - } - if (!$fh = @fopen($filename, "r")) { - $this-err[] = new PhpdocError("getFile(), can't open file '$filename' for reading.", __FILE__, __LINE__); - return ""; - } + +/** +* Filepath. The path is automatically added in front of all filenames +* +* @var string $path +* @see setFilePath() +*/ +var $path = ""; + +/** +* Reads a list of files or one file. +* +* @parammixed Filename or an array filenames, $k = $filename +* @throws PhpdocError +* @access public +*/ +function get($files) { +if ("" == $files) { +$this-err[] = new PhpdocError("No files specified.", __FILE__, __LINE__); +return array("", ""); +} + +if (!is_array($files)) +$files = array($files); + +$contents = array(); +$together = ""; + +reset($files); +while (list($k, $filename) = each($files)) +$contents[$filename] = $this-getFile($filename); + +return $contents; +} // end func get + +/** +* Sets the filepath. The path is automatically added in front of all filenames +* +* @paramstring $path +* @return bool$ok +* @access public +*/ +function setFilePath($path) { +$this-path = $path; +} // end func setFilePath + +/** +* Reads a file. +* +* @paramstring $filename +* @return string $content +* @throws PhpdocError +*/ +function getFile($filename) { +if ("&q
[PHP-CVS] cvs: php4 /pear/PHPDoc/indexer PhpdocIndexer.php
uw Sun Feb 18 07:48:48 2001 EDT Modified files: /php4/pear/PHPDoc/indexer PhpdocIndexer.php Log: Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces. Index: php4/pear/PHPDoc/indexer/PhpdocIndexer.php diff -u php4/pear/PHPDoc/indexer/PhpdocIndexer.php:1.2 php4/pear/PHPDoc/indexer/PhpdocIndexer.php:1.3 --- php4/pear/PHPDoc/indexer/PhpdocIndexer.php:1.2 Sun Dec 3 14:37:37 2000 +++ php4/pear/PHPDoc/indexer/PhpdocIndexer.php Sun Feb 18 07:48:48 2001 @@ -2,195 +2,195 @@ /** * Builds Indexlists with the result from the * -* @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: PhpdocIndexer.php,v 1.2 2000/12/03 22:37:37 uw Exp $ +* @author Ulf Wendel [EMAIL PROTECTED] +* @version $Id: PhpdocIndexer.php,v 1.3 2001/02/18 15:48:48 uw Exp $ */ class PhpdocIndexer extends PhpdocObject { - /** - * Array of all packages. - * - * @var array - */ - var $packages = array(); - - /** - * Current classtree. - * - * @var array - */ - var $classtree = array(); - - /** - * Current modulegroup. - * - * @var array - */ - var $modulegroup = array(); - - /** - * Array of all elements (functions, variables, constant, included files, classes, packages). - * - * @var array - */ - var $elements = array(); - - /** - * Array of fields that get added to the elementlist - * - * @var array - */ - var $elementFields = array("functions", "variables", "consts", "uses"); - - /** - * Adds a class to the index lists (elements, packages, classtree). - * - * @paramarray - * @access public - * @see addModule() - */ - function addClass($class) { - - $package = isset($class["package"]) ? $class["package"] : "No Package specified"; - $this-packages[$package]["classes"][] = $class["name"]; - $this-classtree[$class["name"]] = (isset($class["subclasses"])) ? $class["subclasses"] : array(); - $this-addElements($class, "class"); - - } // end func addClass - - /** - * Adds a module to the index lists (elements, packages, classtree). - * - * @paramarray - * @access public - * @see addClass() - */ - function addModule($module) { - - $package = isset($module["package"]) ? $module["package"] : "No Package specified"; - $this-packages[$package]["modules"][] = $module["name"]; - $this-modulegroup[$module["group"]][] = $module["name"]; - $this-addElements($module, "module"); - - } // end func addModule +/** +* Array of all packages. +* +* @var array +*/ +var $packages = array(); + +/** +* Current classtree. +* +* @var array +*/ +var $classtree = array(); + +/** +* Current modulegroup. +* +* @var array +*/ +var $modulegroup = array(); + +/** +* Array of all elements (functions, variables, constant, included files, classes, +packages). +* +* @var array +*/ +var $elements = array(); + +/** +* Array of fields that get added to the elementlist +* +* @var array +*/ +var $elementFields = array("functions", "variables", "consts", "uses"); + +/** +* Adds a class to the index lists (elements, packages, classtree). +* +* @paramarray +* @access public +* @see addModule() +*/ +function addClass($class) { + +$package = isset($class["package"]) ? $class["package"] : "No Package +specified"; +$this-packages[$package]["classes"][] = $class["name"]; +$this-classtree[$class["name"]] = (isset($class["subclasses"])) ? +$class["subclasses"] : array(); +$this-addElements($class, "class"); + +} // end func addClass + +/** +* Adds a module to the index lists (elements, packages, classtree). +* +* @paramarray +* @access public +* @see addClass() +*/ +function addModule($module) { + +$package = isset($module["package"]) ? $module["package"] : "No Package +specified"; +$this-packages[$package]["modules"][] = $module[&qu
[PHP-CVS] cvs: php4 /pear/PHPDoc/renderer PhpdocRendererObject.php /pear/PHPDoc/renderer/html PhpdocHTMLClassRenderer.php PhpdocHTMLDocumentRenderer.php PhpdocHTMLIndexRenderer.php PhpdocHTMLModuleRenderer.php PhpdocHTMLRenderer.php PhpdocHTMLRendererManager.php PhpdocHTMLWarningRenderer.php
uw Sun Feb 18 08:29:22 2001 EDT Modified files: /php4/pear/PHPDoc/renderer PhpdocRendererObject.php /php4/pear/PHPDoc/renderer/html PhpdocHTMLClassRenderer.php PhpdocHTMLDocumentRenderer.php PhpdocHTMLIndexRenderer.php PhpdocHTMLModuleRenderer.php PhpdocHTMLRenderer.php PhpdocHTMLRendererManager.php PhpdocHTMLWarningRenderer.php Log: Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces. Index: php4/pear/PHPDoc/renderer/PhpdocRendererObject.php diff -u php4/pear/PHPDoc/renderer/PhpdocRendererObject.php:1.3 php4/pear/PHPDoc/renderer/PhpdocRendererObject.php:1.4 --- php4/pear/PHPDoc/renderer/PhpdocRendererObject.php:1.3 Sun Dec 3 06:36:00 2000 +++ php4/pear/PHPDoc/renderer/PhpdocRendererObject.php Sun Feb 18 08:29:20 2001 @@ -4,18 +4,19 @@ * * Derive all custom renderer from this class. * +* @version $Id: PhpdocRendererObject.php,v 1.4 2001/02/18 16:29:20 uw Exp $ */ class PhpdocRendererObject extends PhpdocObject { - var $warn; +var $warn; - var $accessor; +var $accessor; - /** - * Extension for generated files. - * @var string $file_extension - */ - var $file_extension = ".html"; +/** +* Extension for generated files. +* @var string +*/ +var $file_extension = ".html"; } // end class PhpdocRendererObject ? Index: php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php diff -u php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php:1.4 php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php:1.5 --- php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php:1.4 Sun Dec 3 14:37:37 2000 +++ php4/pear/PHPDoc/renderer/html/PhpdocHTMLClassRenderer.php Sun Feb 18 08:29:21 +2001 @@ -2,391 +2,388 @@ /** * Renders classes. * -* @version $Id: PhpdocHTMLClassRenderer.php,v 1.4 2000/12/03 22:37:37 uw Exp $ +* @version $Id: PhpdocHTMLClassRenderer.php,v 1.5 2001/02/18 16:29:21 uw Exp $ */ class PhpdocHTMLClassRenderer extends PhpdocHTMLDocumentRenderer { - /** - * Internal array of "nbsp;" strings to format HTML output. - * - * @var array $indent - */ - var $indent = array(); - - /** - * Array of variables found in the xml document. - * - * @var array $variables - */ - var $variables = array(); - - /** - * Sets the xml and template root directory. - * - * @paramstring XML file path - * @paramstring Template file path - * @paramstring Name of the current application - * @paramstring Filename extension - * @see setPath(), setTemplateRoot() - */ - function PhpdocHTMLClassRenderer($path, $templateRoot, $application, $extension = ".html") { - - $this-setPath($path); - $this-setTemplateRoot($templateRoot); - $this-application = $application; - $this-file_extension = $extension; - - $this-accessor = new PhpdocClassAccessor; - $this-tpl = new IntegratedTemplate($this-templateRoot); - $this-fileHandler = new PhpdocFileHandler; - - } // end constructor - - /** - * Renders a class. - * - * @paramstring XML source file - * @paramstring Name of the HTML target file. - * @access public - */ - function renderClass($xmlfile, $htmlfile = "") { - - $this-tpl-loadTemplatefile("class.html"); - if ("" == $htmlfile) - $htmlfile = substr($xmlfile, 6, -4) . $this-file_extension; - - $this-accessor-loadXMLFile($this-path.$xmlfile); - - $this-renderSubclasses(); - $this-renderInherited(); - $this-renderFunctions(); - $this-renderVariables(); - $this-renderUses(); - $this-renderConstants(); - - $class = $this-accessor-getClassdata(); - $tplvars = array(); - - $tplvars["CLASS_FILE"] = $class["file"]["value"]; - $tplvars["CLASS_NAME"] = $class["name"]; - $tplvars["CLASS_ACCESS"]= $class["access"]; - $tplvars["CLASS_PACKAGE"] = $class["package"]; - - if ("" != $class["extends"]) - $tplvars["CLASS_EXTENDS"] = sprintf('extends a href="%s"%s/a', -
[PHP-CVS] cvs: php4 /pear/PHPDoc/warning PhpdocWarning.php
uw Sun Feb 18 08:31:09 2001 EDT Modified files: /php4/pear/PHPDoc/warning PhpdocWarning.php Log: Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces. Index: php4/pear/PHPDoc/warning/PhpdocWarning.php diff -u php4/pear/PHPDoc/warning/PhpdocWarning.php:1.2 php4/pear/PHPDoc/warning/PhpdocWarning.php:1.3 --- php4/pear/PHPDoc/warning/PhpdocWarning.php:1.2 Sun Dec 3 14:37:38 2000 +++ php4/pear/PHPDoc/warning/PhpdocWarning.php Sun Feb 18 08:31:09 2001 @@ -5,62 +5,65 @@ * The base of the report generator module is this container. It's currently * pretty simple and will change later on... * -* @version $Id: PhpdocWarning.php,v 1.2 2000/12/03 22:37:38 uw Exp $ +* @version $Id: PhpdocWarning.php,v 1.3 2001/02/18 16:31:09 uw Exp $ */ class PhpdocWarning extends PhpdocObject { - - /** - * Hash of documentation failures. - * @var array - */ - var $doc_warnings = array(); - - /** - * Counter containing the number of documentation warnings. - * @var integer - * @see getNumDocWarnings(), getNumWarnings() - */ - var $num_doc_warnings = 0; - - /** - * Adds a warning to the list of class documentation failures. - * @paramstring Name of the file that containts the error - * @paramstring Kind of the element that caused the error: module, class, function, variable, use, const - * @paramstring Name of the class/function/... that caused the warning - * @paramstring Warning message itself - * @paramstring Type of the error: missing, mismatch, syntax, ... - * @access public - * @see addDocWarning() - */ - function addDocWarning($file, $elementtype, $elementname, $warning, $type="missing") { + +/** +* Hash of documentation failures. +* +* @var array +*/ +var $doc_warnings = array(); + +/** +* Counter containing the number of documentation warnings. +* +* @var integer +* @see getNumDocWarnings(), getNumWarnings() +*/ +var $num_doc_warnings = 0; + +/** +* Adds a warning to the list of class documentation failures. +* +* @paramstring Name of the file that containts the error +* @paramstring Kind of the element that caused the error: module, class, +function, variable, use, const +* @paramstring Name of the class/function/... that caused the warning +* @paramstring Warning message itself +* @paramstring Type of the error: missing, mismatch, syntax, ... +* @access public +* @see addDocWarning() +*/ +function addDocWarning($file, $elementtype, $elementname, $warning, $type = +"missing") { - $this-doc_warnings[$file][$elementtype][] =array( - "name" = $elementname, - "type" = $type, - "msg" = $warning - ); - $this-num_doc_warnings++; - - } // end func addDocWarning +$this-doc_warnings[$file][$elementtype][] =array( +"name"= +$elementname, +"type"= $type, +"msg"= +$warning + ); +$this-num_doc_warnings++; + +} // end func addDocWarning - /** - * Returns a list of warnings. - * - * @return array $warnings - * @access public - */ - function getWarnings() { - return $this-doc_warnings; - } // end func getParserWarnings - - /** - * Returns the total number of documentation warnings. - * @access public - * @see getNumParserWarnings(), getNumWarnings() - */ - function getNumDocWarnings() { -
[PHP-CVS] cvs: php4 /pear/PHPDoc/xmlexporter PhpdocXMLClassExporter.php PhpdocXMLDocumentExporter.php PhpdocXMLExporter.php PhpdocXMLIndexExporter.php PhpdocXMLModuleExporter.php PhpdocXMLWarningExporter.php
uw Sun Feb 18 08:53:01 2001 EDT Modified files: /php4/pear/PHPDoc/xmlexporter PhpdocXMLClassExporter.php PhpdocXMLDocumentExporter.php PhpdocXMLExporter.php PhpdocXMLIndexExporter.php PhpdocXMLModuleExporter.php PhpdocXMLWarningExporter.php Log: Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces. Index: php4/pear/PHPDoc/xmlexporter/PhpdocXMLClassExporter.php diff -u php4/pear/PHPDoc/xmlexporter/PhpdocXMLClassExporter.php:1.2 php4/pear/PHPDoc/xmlexporter/PhpdocXMLClassExporter.php:1.3 --- php4/pear/PHPDoc/xmlexporter/PhpdocXMLClassExporter.php:1.2 Sun Dec 3 14:37:38 2000 +++ php4/pear/PHPDoc/xmlexporter/PhpdocXMLClassExporter.php Sun Feb 18 08:53:00 +2001 @@ -2,180 +2,182 @@ /** * Exports the data of a class as an xml file. * -* @version $Id: PhpdocXMLClassExporter.php,v 1.2 2000/12/03 22:37:38 uw Exp $ +* @version $Id: PhpdocXMLClassExporter.php,v 1.3 2001/02/18 16:53:00 uw Exp $ */ class PhpdocXMLClassExporter extends PhpdocXMLDocumentExporter { - /** - * Variable container attributes. - * @var array $variableAttributes - */ - var $variableAttributes = array( - "name" = "CDATA", - "access"= "CDATA", - "type" = "CDATA", - "abstract" = "Boolean", - "static"= "Boolean", - "final" = "Boolean" - ); - /** - * Class container attributes. - * @var array $classAttributes - */ - var $classAttributes = array( - "name" = "CDATA", - "extends" = "CDATA", - "undoc" = "Boolean", - "access"= "CDATA", - "abstract" = "Boolean", - "static"= "Boolean", - "final" = "Boolean", - "package" = "CDATA" - ); +/** +* Variable container attributes. +* +* @var array $variableAttributes +*/ +var $variableAttributes = array( +"name" = "CDATA", +"access"= "CDATA", +"type" = "CDATA", +"abstract" = "Boolean", +"static"= "Boolean", +"final" = "Boolean" +); +/** +* Class container attributes. +* +* @var array $classAttributes +*/ +var
[PHP-CVS] cvs: php4 /pear/PHPDoc/xmlreader PhpdocXMLReader.php
uw Sun Feb 18 08:56:18 2001 EDT Modified files: /php4/pear/PHPDoc/xmlreader PhpdocXMLReader.php Log: Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces. Index: php4/pear/PHPDoc/xmlreader/PhpdocXMLReader.php diff -u php4/pear/PHPDoc/xmlreader/PhpdocXMLReader.php:1.3 php4/pear/PHPDoc/xmlreader/PhpdocXMLReader.php:1.4 --- php4/pear/PHPDoc/xmlreader/PhpdocXMLReader.php:1.3 Thu Jan 11 13:17:56 2001 +++ php4/pear/PHPDoc/xmlreader/PhpdocXMLReader.php Sun Feb 18 08:56:18 2001 @@ -2,224 +2,224 @@ /** * Reads XML documents into a multi dimensional Array. * -* @version $Id: PhpdocXMLReader.php,v 1.3 2001/01/11 21:17:56 chagenbu Exp $ +* @version $Id: PhpdocXMLReader.php,v 1.4 2001/02/18 16:56:18 uw Exp $ */ class PhpdocXMLReader extends PhpdocObject { - - /** - * PHPDocFileHandler object. - * - * @var object PhpdocFileHandler - * @see createFileHandler() - */ - var $filehandler; - - /** - * Values array from xml_parse_into_struct(). - * - * @var array - * @see parse(), stripCloseFromStructvalues(), importXML() - */ - var $structvalues = array(); - - /** - * Parses a given XML file and returns the data as a hash. - * - * Please do not ask me for a in detail explanation of how it is done, - * the documentation is in the source... - * - * @paramstring $filename Name of the xml document - * @access public - * @throws PhpdocError - * @see importXML() - */ - function parse($filename) { - - if (""==$filename) { - $this-err[] = new PhpdocError("No filename given.", __FILE__, __LINE__); - return array(); - } - - $parser = @xml_parser_create(); - if (!$parser) { - $this-err = PhpdocError("Can't create a XML Parser.", __FILE__, __LINE__); - return array(); - } - xml_parser_set_option($parser, XML_OPTION_CASE_FOLDING, 0); - - $this-createFileHandler(); - $xml = $this-filehandler-getFile($filename); - - $values = array(); - $index = array(); - xml_parse_into_struct($parser, $xml, $values, $index); - - xml_parser_free($parser); - - $this-structvalues = $values; - $this-stripCloseFromStructvalues(); - list($data, $last) = $this-importXML(); - $this-structvalues = array(); - - return $data; - } // end func parse - - /** - * Creates a PhpdocFileHandler object and saves it to $filehandler if it does not already exist. - * - * @see $filehandler - */ - function createFilehandler() { - - if (!isset($this-filehandler)) - $this-filehandler = new PhpdocFileHandler; - - } // end func createFilehandler - - /** - * Strips all values out of the xml_parse_intro_struct() values array with the type "open". - * - * @see $structvalues - */ - function stripCloseFromStructvalues() { - - $values = array(); - - reset($this-structvalues); - while (list($k, $v) = each($this-structvalues)) - if ("close" != $v["type"]) - $values[] = $v; - - $this-structvalues = $values; - } // end func stripCloseFromStructvalues - - /** - * Converts an xml_parse_into_struct value array to an array that's simmilar to phpdocs internal arrays. - * - * Well, don't ask me to explain this hack. Just take it as it. For those who want to unterstand and optimize - * it: - * - PHP3 compatibility is a must - * - no XML DOM - * - no eval(), this can't be optimized by the compiler - * - * @paraminteger - * @paraminteger - * @return array $data[0] = daten, $data[1] = some index value used for the recursion - * @see addToArray() - */ - function importXML($start = 0, $allowed_level = 1) { - - $data = array(); - $last = 0; - - for ($i=$start; $icount($this-structvalues); $i++) { - if ($allowed_level != $this-structvalues[$i]["level"]) - break; - - $value = (isset($this-structvalues[$i]["value"])) ? $this-structvalues[$i]["value"] : ""; -
[PHP-CVS] cvs: php4 /pear/PHPDoc/xmlwriter PhpdocXMLWriter.php
uw Sun Feb 18 08:59:52 2001 EDT Modified files: /php4/pear/PHPDoc/xmlwriter PhpdocXMLWriter.php Log: Sorry, whitespace only changes to follow the PEAR Coding conventions. Replaced tabs with spaces. Index: php4/pear/PHPDoc/xmlwriter/PhpdocXMLWriter.php diff -u php4/pear/PHPDoc/xmlwriter/PhpdocXMLWriter.php:1.3 php4/pear/PHPDoc/xmlwriter/PhpdocXMLWriter.php:1.4 --- php4/pear/PHPDoc/xmlwriter/PhpdocXMLWriter.php:1.3 Sun Dec 3 14:37:39 2000 +++ php4/pear/PHPDoc/xmlwriter/PhpdocXMLWriter.php Sun Feb 18 08:59:52 2001 @@ -6,170 +6,169 @@ * not much what this class can do but it provides some simple * functions to handle attributes and hides file handling tasks. * -* @author Ulf Wendel [EMAIL PROTECTED] -* @version $Id: PhpdocXMLWriter.php,v 1.3 2000/12/03 22:37:39 uw Exp $ +* @version$Id: PhpdocXMLWriter.php,v 1.4 2001/02/18 16:59:52 uw Exp $ */ class PhpdocXMLWriter extends PhpdocObject { - - /** - * Generated XML document. - * - * @var string $xml - */ - var $xml = ""; - - /** - * PHPDoc Warning object - * - * @var object PhpdocWarning - */ - var $warn; - - /** - * Filehandler used for IO operations - * - * @var object PhpdocFilehandler - * @see PhpdocXMLWriter() - */ - var $fileHandler; - - /** - * Creates a new PhpdocFileHandler - * - * @see $filehandler - */ - function PhpdocXMLWriter() { - $this-fileHandler = new PhpdocFileHandler; - } // end constructor - - /** - * Clears the internal xml data buffer so that a new document can be passed to the object. - * @access public - */ - function free() { - $this-xml = ""; - } // end func free - - /** - * Adds xml to the generated xml. - * - * @paramstring xml to append - * @access public - */ - function addXML($xml) { - - $this-xml.= $xml; - - } // end func addXML + +/** +* Generated XML document. +* +* @var string $xml +*/ +var $xml = ""; + +/** +* PHPDoc Warning object +* +* @var object PhpdocWarning +*/ +var $warn; + +/** +* Filehandler used for IO operations +* +* @var object PhpdocFilehandler +* @see PhpdocXMLWriter() +*/ +var $fileHandler; + +/** +* Creates a new PhpdocFileHandler +* +* @see $filehandler +*/ +function PhpdocXMLWriter() { +$this-fileHandler = new PhpdocFileHandler; +} // end constructor + +/** +* Clears the internal xml data buffer so that a new document can be passed to the +object. +* @accesspublic +*/ +function free() { +$this-xml = ""; +} // end func free + +/** +* Adds xml to the generated xml. +* +* @paramstring xml to append +* @access public +*/ +function addXML($xml) { + +$this-xml.= $xml; + +} // end func addXML - /** - * Saves the xml to the specified file. - * - * @paramstring Name of the target file - * @access public - */ - function export($filename) { - return $this-fileHandler-createFile($filename, $this-xml); - } // end func export - - /** - * Adds an open (or single) xml tag to the generated xml. - * - * Use this function to add new elements/tags to the xml document. - * The tagname and all attributenames will be converted to lowercase. - * - * @paramstring elementname (tagname) - * @param string value of the container: namevalue - * @paramarray Array of attributes: $attribs[n][type] = boolean|cdata, $attribs[n][value] = value - * @paramboolean Flag indication that you want an empty tag like name/. - * @access public - * @see endElement() - */ - function startElement($name, $value="", $attribs="", $close = false) { - - $xml = "".strtolower($name); - - if (is_array($attribs)) { - - reset($attribs); - while (list($attrib, $data)=each($attribs)) { - - $attrib = strtolower($attrib); - $type = strtolower($data["type"]); - - switch($type) { - case "boolean": -
[PHP-CVS] cvs: php4 /pear/HTML ITX.php
uw Thu Jan 18 12:52:33 2001 EDT Modified files: /php4/pear/HTML ITX.php Log: Current version from the PHPLib CVS. Converted Tabs to spaces. Error handling must be pearified. Index: php4/pear/HTML/ITX.php diff -u php4/pear/HTML/ITX.php:1.1 php4/pear/HTML/ITX.php:1.2 --- php4/pear/HTML/ITX.php:1.1 Wed Jan 17 08:15:17 2001 +++ php4/pear/HTML/ITX.php Thu Jan 18 12:52:33 2001 @@ -13,14 +13,11 @@ // | obtain it through the world-wide-web, please send a note to | // | [EMAIL PROTECTED] so we can mail you a copy immediately. | // +--+ -// | Authors: Ulf Wendel [EMAIL PROTECTED] | +// | Authors: Ulf Wendel [EMAIL PROTECTED] | // +--+ // -// $Id: ITX.php,v 1.1 2001/01/17 16:15:17 sbergmann Exp $ +// $Id: ITX.php,v 1.2 2001/01/18 20:52:33 uw Exp $ // - -require_once "HTML/IT.php"; - /** * Integrated Template Extension - ITX * @@ -33,283 +30,627 @@ * Note that you can replace an existing block and add new blocks add runtime. * Adding new blocks means changing a variable placeholder to a block. * -* @author Ulf Wendel [EMAIL PROTECTED] -* @access public -* @version $ID: $ -* @package PHPDoc +* @author Ulf Wendel [EMAIL PROTECTED] +* @accesspublic +* @version $Id: ITX.php,v 1.2 2001/01/18 20:52:33 uw Exp $ */ class IntegratedTemplateExtension extends IntegratedTemplate { + +/** +* Array with all warnings. +* @var array +* @accesspublic +* @see $printWarning, $haltOnWarning, warning() +*/ +var $warn = array(); + +/** +* Print warnings? +* @var array +* @accesspublic +* @see $haltOnWarning, $warn, warning() +*/ +var $printWarning = false; + +/** +* Call die() on warning? +* @var boolean +* @accesspublic +* @see $warn, $printWarning, warning() +*/ +var $haltOnWarning = false; + +/** +* RegExp used to test for a valid blockname. +* @varstring +*/ +var $checkblocknameRegExp = ""; + +/** +* Functionnameprefix used when searching function calls in the template. +* @varstring +*/ +var $functionPrefix = "func_"; + +/** +* Functionname RegExp. +* @varstring +*/ +var $functionnameRegExp = "[_a-zA-Z]+[A-Za-z_0-9]*"; + +/** +* RegExp used to grep function calls in the template. +* +* The variable gets set by the constructor. +* +* @varstring +* @seeIntegratedTemplateExtension() +*/ +var $functionRegExp = ""; + +/** +* List of functions found in the template. +* +* @vararray +*/ +var $functions = array(); + +/** +* List of callback functions specified by the user. +* +* @vararray +*/ +var $callback = array(); + +/** +* Builds some complex regexps and calls the constructor of the parent class. +* +* Make sure that you call this constructor if you derive you own +* template class from this one. +* +* @seeIntegratedTemplate() +*/ +function IntegratedTemplateExtension($root = "") { + +$this-checkblocknameRegExp = "@" . $this-blocknameRegExp . "@"; +$this-functionRegExp = "@" . $this-functionPrefix . "(" . +$this-functionnameRegExp . ")\s*\(@sm"; + +$this-IntegratedTemplate($root); + + +} // end func constructor + +function init() { + +$this-free(); +$this-buildFunctionlist(); +$this-findBlocks($this-template); +$this-buildBlockvariablelist(); + +} // end func init + + +/** +* Replaces an existing block with new content. Warning: not implemented yet. +* +* The Replacement does not affect previously added variables. All data is cached. +* In case the new block does contain less or other variable placeholder the +previously +* passed data that is no longer referenced will be deleted. The internal list +* of allowed variables gets updated as well. +* +* In case the original block contains other blocks it must eighter have +placeholder +* for the inner blocks or contain them. If you want to use placeholder the +placeholder must +* look like openingDelimiter."__".blockname."__".closingDelimiter . +* +* Due to the cache updates replaceBlock() and replaceBlockfile() are "expensive" +operations +* which means extensive usage will
[PHP] Layout Manager
Hi, has anybody of you ever thought of a Layout Manager for PHP, somewhat like Java's Swing Layout Managers? If so, design hints are very much welcome. Thanks in advice! Ulf -- Ulf Wendel, NetUSE AG Siemenswall, D-24107 Kiel Tel: +49 431 386 436 00, Fax: +49 431 386 435 99 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]