Permalink
Browse files

HTTP_Download -> HTTP_Download2

  • Loading branch information...
CloCkWeRX committed Jan 10, 2012
1 parent 55c63fd commit acdc114226cff9a5e80d2150a882e96640d7705a
Showing with 107 additions and 107 deletions.
  1. +27 −27 HTTP/Download.php
  2. +19 −19 HTTP/Download/Archive.php
  3. +39 −39 HTTP/Download/PgLOB.php
  4. +6 −6 tests/AllTests.php
  5. +12 −12 tests/HTTP_DownloadTest.php
  6. +4 −4 tests/send.php
View
@@ -2,17 +2,17 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
- * HTTP::Download
+ * HTTP::Download2
*
* PHP versions 4 and 5
*
* @category HTTP
- * @package HTTP_Download
+ * @package HTTP_Download2
* @author Michael Wallner <mike@php.net>
* @copyright 2003-2005 Michael Wallner
* @license BSD, revised
* @version CVS: $Id$
- * @link http://pear.php.net/package/HTTP_Download
+ * @link http://pear.php.net/package/HTTP_Download2
*/
// {{{ includes
@@ -28,7 +28,7 @@
// }}}
// {{{ constants
-/**#@+ Use with HTTP_Download::setContentDisposition() **/
+/**#@+ Use with HTTP_Download2::setContentDisposition() **/
/**
* Send data as attachment
*/
@@ -88,13 +88,13 @@
* @access public
* @version $Revision$
*/
-class HTTP_Download
+class HTTP_Download2
{
// {{{ protected member variables
/**
* Path to file for download
*
- * @see HTTP_Download::setFile()
+ * @see HTTP_Download2::setFile()
* @access protected
* @var string
*/
@@ -103,7 +103,7 @@ class HTTP_Download
/**
* Data for download
*
- * @see HTTP_Download::setData()
+ * @see HTTP_Download2::setData()
* @access protected
* @var string
*/
@@ -112,7 +112,7 @@ class HTTP_Download
/**
* Resource handle for download
*
- * @see HTTP_Download::setResource()
+ * @see HTTP_Download2::setResource()
* @access protected
* @var int
*/
@@ -161,7 +161,7 @@ class HTTP_Download
'Pragma' => 'cache',
'Cache-Control' => 'public, must-revalidate, max-age=0',
'Accept-Ranges' => 'bytes',
- 'X-Sent-By' => 'PEAR::HTTP::Download'
+ 'X-Sent-By' => 'PEAR::HTTP::Download2'
);
/**
@@ -245,9 +245,9 @@ class HTTP_Download
* It looks like this:
* "Content-Disposition: attachment; filename=example.tgz".
*
- * @see HTTP_Download::setContentDisposition()
+ * @see HTTP_Download2::setContentDisposition()
*/
- function HTTP_Download($params = array())
+ function HTTP_Download2($params = array())
{
$this->HTTP = &new HTTP_Header;
$this->_error = $this->setParams($params);
@@ -264,7 +264,7 @@ function HTTP_Download($params = array())
* @return mixed Returns true on success or PEAR_Error on failure.
* @param array $params associative array of parameters
*
- * @see HTTP_Download::HTTP_Download()
+ * @see HTTP_Download2::HTTP_Download2()
*/
function setParams($params)
{
@@ -460,7 +460,7 @@ function setCacheControl($cache = 'public', $maxage = 0)
* Set ETag
*
* Sets a user-defined ETag for cache-validation. The ETag is usually
- * generated by HTTP_Download through its payload information.
+ * generated by HTTP_Download2 through its payload information.
*
* @access public
* @return void
@@ -508,7 +508,7 @@ function setBufferSize($bytes = 2097152)
* Set the amount of seconds to sleep after each chunck that has been
* sent. One can implement some sort of throttle through adjusting the
* buffer size and the throttle delay. With the following settings
- * HTTP_Download will sleep a second after each 25 K of data sent.
+ * HTTP_Download2 will sleep a second after each 25 K of data sent.
*
* <code>
* Array(
@@ -534,8 +534,8 @@ function setThrottleDelay($seconds = 0)
/**
* Set "Last-Modified"
*
- * This is usually determined by filemtime() in HTTP_Download::setFile()
- * If you set raw data for download with HTTP_Download::setData() and you
+ * This is usually determined by filemtime() in HTTP_Download2::setFile()
+ * If you set raw data for download with HTTP_Download2::setData() and you
* want do send an appropiate "Last-Modified" header, you should call this
* method.
*
@@ -551,7 +551,7 @@ function setLastModified($last_modified)
/**
* Set Content-Disposition header
*
- * @see HTTP_Download::HTTP_Download
+ * @see HTTP_Download2::HTTP_Download2
*
* @access public
* @return void
@@ -562,7 +562,7 @@ function setLastModified($last_modified)
*
* <b>Example:</b>
* <code>
- * $HTTP_Download->setContentDisposition(
+ * $HTTP_Download2->setContentDisposition(
* HTTP_DOWNLOAD_ATTACHMENT,
* 'download.tgz'
* );
@@ -751,19 +751,19 @@ function send($autoSetContentDisposition = true)
/**
* Static send
*
- * @see HTTP_Download::HTTP_Download()
- * @see HTTP_Download::send()
+ * @see HTTP_Download2::HTTP_Download2()
+ * @see HTTP_Download2::send()
*
* @static
* @access public
* @return mixed Returns true on success or PEAR_Error on failure.
* @param array $params associative array of parameters
- * @param bool $guess whether HTTP_Download::guessContentType()
+ * @param bool $guess whether HTTP_Download2::guessContentType()
* should be called
*/
function staticSend($params, $guess = false)
{
- $d = &new HTTP_Download();
+ $d = &new HTTP_Download2();
$e = $d->setParams($params);
if (PEAR::isError($e)) {
return $e;
@@ -782,8 +782,8 @@ function staticSend($params, $guess = false)
*
* Example:
* <code>
- * require_once 'HTTP/Download.php';
- * HTTP_Download::sendArchive(
+ * require_once 'HTTP/Download2.php';
+ * HTTP_Download2::sendArchive(
* 'myArchive.tgz',
* '/var/ftp/pub/mike',
* HTTP_DOWNLOAD_TGZ,
@@ -793,7 +793,7 @@ function staticSend($params, $guess = false)
* </code>
*
* @see Archive_Tar::createModify()
- * @deprecated use HTTP_Download_Archive::send()
+ * @deprecated use HTTP_Download2_Archive::send()
* @static
* @access public
* @return mixed Returns true on success or PEAR_Error on failure.
@@ -809,8 +809,8 @@ function sendArchive( $name,
$add_path = '',
$strip_path = '')
{
- require_once 'HTTP/Download/Archive.php';
- return HTTP_Download_Archive::send($name, $files, $type,
+ require_once 'HTTP/Download2/Archive.php';
+ return HTTP_Download2_Archive::send($name, $files, $type,
$add_path, $strip_path);
}
// }}}
View
@@ -2,46 +2,46 @@
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
/**
- * HTTP::Download::Archive
- *
+ * HTTP::Download2::Archive
+ *
* PHP versions 4 and 5
*
* @category HTTP
- * @package HTTP_Download
+ * @package HTTP_Download2
* @author Michael Wallner <mike@php.net>
* @copyright 2003-2005 Michael Wallner
* @license BSD, revisewd
* @version CVS: $Id$
- * @link http://pear.php.net/package/HTTP_Download
+ * @link http://pear.php.net/package/HTTP_Download2
*/
/**
- * Requires HTTP_Download
+ * Requires HTTP_Download2
*/
-require_once 'HTTP/Download.php';
+require_once 'HTTP/Download2.php';
/**
* Requires System
*/
require_once 'System.php';
-/**
- * HTTP_Download_Archive
- *
+/**
+ * HTTP_Download2_Archive
+ *
* Helper class for sending Archives.
*
* @access public
* @version $Revision$
*/
-class HTTP_Download_Archive
+class HTTP_Download2_Archive
{
/**
* Send a bunch of files or directories as an archive
- *
+ *
* Example:
* <code>
- * require_once 'HTTP/Download/Archive.php';
- * HTTP_Download_Archive::send(
+ * require_once 'HTTP/Download2/Archive.php';
+ * HTTP_Download2_Archive::send(
* 'myArchive.tgz',
* '/var/ftp/pub/mike',
* HTTP_DOWNLOAD_BZ2,
@@ -63,7 +63,7 @@ class HTTP_Download_Archive
function send($name, $files, $type = HTTP_DOWNLOAD_TGZ, $add_path = '', $strip_path = '')
{
$tmp = System::mktemp();
-
+
switch ($type = strToUpper($type))
{
case HTTP_DOWNLOAD_TAR:
@@ -89,16 +89,16 @@ function send($name, $files, $type = HTTP_DOWNLOAD_TGZ, $add_path = '', $strip_p
$arc = &new Archive_Zip($tmp);
$content_type = 'x-zip';
break;
-
+
default:
return PEAR::raiseError(
'Archive type not supported: ' . $type,
HTTP_DOWNLOAD_E_INVALID_ARCHIVE_TYPE
);
}
-
+
if ($type == HTTP_DOWNLOAD_ZIP) {
- $options = array( 'add_path' => $add_path,
+ $options = array( 'add_path' => $add_path,
'remove_path' => $strip_path);
if (!$arc->create($files, $options)) {
return PEAR::raiseError('Archive creation failed.');
@@ -112,8 +112,8 @@ function send($name, $files, $type = HTTP_DOWNLOAD_TGZ, $add_path = '', $strip_p
}
}
unset($arc);
-
- $dl = &new HTTP_Download(array('file' => $tmp));
+
+ $dl = &new HTTP_Download2(array('file' => $tmp));
$dl->setContentType('application/' . $content_type);
$dl->setContentDisposition(HTTP_DOWNLOAD_ATTACHMENT, $name);
return $dl->send();
Oops, something went wrong.

0 comments on commit acdc114

Please sign in to comment.