uw Sat Mar 3 11:19:25 2001 EDT
Modified files:
/php4/pear/Cache Output.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.
*
* @param string dataset ID
+ * @param string 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.
*
* @param integer lifetime of the cached data in seconds - 0 for endless
+ * @param string 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]