cvs: pear /Net_Curl package.xml /Net_Curl/Net Curl.php

[email protected] ("Joe Stump")
Newsgroups php.pear.cvs
Message-ID <cvsjstump1209843684@cvsserver>
jstump		Sat May  3 19:41:24 2008 UTC

  Modified files:              
    /pear/Net_Curl	package.xml 
    /pear/Net_Curl/Net	Curl.php 
  Log:
  - Removed deprecated cURL option CURLOPT_MUTE (Bug #13489) 
  - Changed the license to the New BSD License (Bug #13831)
  - Cleaned up code to (mostly) comply with phpcs
jstump-20080503194124.txt (text/plain, 15.3 KB)
http://cvs.php.net/viewvc.cgi/pear/Net_Curl/package.xml?r1=1.9&r2=1.10&diff_format=u
Index: pear/Net_Curl/package.xml
diff -u pear/Net_Curl/package.xml:1.9 pear/Net_Curl/package.xml:1.10
--- pear/Net_Curl/package.xml:1.9	Thu Nov 23 19:04:03 2006
+++ pear/Net_Curl/package.xml	Sat May  3 19:41:24 2008
@@ -3,7 +3,7 @@
     <name>Net_Curl</name>
     <summary>Net_Curl provides an OO interface to PHP's cURL extension</summary>
     <description>Provides an OO interface to PHP's curl extension</description>
-    <license>PHP</license>
+    <license>New BSD License</license>
     <maintainers>
         <maintainer>
             <user>jstump</user>
@@ -19,10 +19,12 @@
         </maintainer>
     </maintainers>
     <release>
-        <version>1.2.4</version>
-        <date>2006-11-23</date>
+        <version>1.2.5</version>
+        <date>2008-05-03</date>
         <notes>
-            - Fixed bug #9427 POST-FileUpload
+            - Removed deprecated cURL option CURLOPT_MUTE (Bug #13489) 
+            - Changed the license to the New BSD License (Bug #13831)
+            - Cleaned up code to (mostly) comply with phpcs
         </notes>
         <state>stable</state>
         <filelist>
@@ -40,6 +42,26 @@
     </release>
     <changelog>
         <release>
+            <version>1.2.4</version>
+            <date>2006-11-23</date>
+            <notes>
+                - Fixed bug #9427 POST-FileUpload
+            </notes>
+            <state>stable</state>
+            <filelist>
+                <dir name="Net">
+                    <file role="php">Curl.php</file>
+                </dir>
+                <dir name="examples" baseinstalldir="docs/Net_Curl">
+                    <file role="doc">fetchPage.php</file>
+                </dir>
+            </filelist>
+            <deps>
+                <dep type="php" rel="ge" version="4.2.0" />
+                <dep type="ext" rel="has">curl</dep>
+            </deps>
+        </release>
+        <release>
             <version>1.2.3</version>
             <date>2006-06-16</date>
             <notes>
http://cvs.php.net/viewvc.cgi/pear/Net_Curl/Net/Curl.php?r1=1.14&r2=1.15&diff_format=u
Index: pear/Net_Curl/Net/Curl.php
diff -u pear/Net_Curl/Net/Curl.php:1.14 pear/Net_Curl/Net/Curl.php:1.15
--- pear/Net_Curl/Net/Curl.php:1.14	Tue Mar 25 15:58:21 2008
+++ pear/Net_Curl/Net/Curl.php	Sat May  3 19:41:24 2008
@@ -1,39 +1,66 @@
 <?php
 
-/* vim: set expandtab tabstop=4 shiftwidth=4: */
-
 /**
- * Net_Curl
+ * An Object Oriented interface to PHP's cURL extension
+ *
+ * PHP version 5.1.0+
+ *
+ * Copyright (c) 2007, The PEAR Group
+ * 
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without 
+ * modification, are permitted provided that the following conditions are met:
+ *
+ *  - Redistributions of source code must retain the above copyright notice,
+ *    this list of conditions and the following disclaimer.
+ *  - Redistributions in binary form must reproduce the above copyright notice,
+ *    this list of conditions and the following disclaimer in the documentation
+ *    and/or other materials provided with the distribution.
+ *  - Neither the name of the The PEAR Group nor the names of its contributors 
+ *    may be used to endorse or promote products derived from this software 
+ *    without specific prior written permission.
  *
- * LICENSE: This source file is subject to version 3.0 of the PHP license
- * that is available through the world-wide-web at the following URI:
- * http://www.php.net/license/3_0.txt.  If you did not receive a copy of
- * the PHP License and are unable to obtain it through the web, please
- * send a note to [email protected] so we can mail you a copy immediately.
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
+ * POSSIBILITY OF SUCH DAMAGE.
  *
- * @category   Net
- * @package    Net_Curl
- * @author     David Costa <[email protected]>
- * @author     Sterling Hughes <[email protected]>
- * @author     Joe Stump <[email protected]>
- * @author     Philippe Jausions <[email protected]>
- * @copyright  1997-2005 The PHP Group
- * @license    http://www.php.net/license/3_0.txt  PHP License 3.0
- * @version    CVS: $Revision: 1.14 $
- * @link       http://pear.php.net/package/Net_Curl
+ * @category  Net
+ * @package   Net_Curl
+ * @author    David Costa <[email protected]>
+ * @author    Sterling Hughes <[email protected]>
+ * @author    Joe Stump <[email protected]>
+ * @author    Philippe Jausions <[email protected]>
+ * @copyright 1997-2008 The PHP Group
+ * @license   http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @version   CVS: $Revision: 1.15 $
+ * @link      http://pear.php.net/package/Net_Curl
  */
 
 /**
  * Include PEAR package for error handling
  */
-require_once('PEAR.php');
+require_once 'PEAR.php';
 
 /**
  * Object-oriented implementation of the Curl extension
  *
- * @category   Net
- * @package    Net_Curl
- * @link       http://pear.php.net/package/Net_Curl
+ * @category Net
+ * @package  Net_Curl
+ * @author   David Costa <[email protected]>
+ * @author   Sterling Hughes <[email protected]>
+ * @author   Joe Stump <[email protected]>
+ * @author   Philippe Jausions <[email protected]>
+ * @license  http://www.opensource.org/licenses/bsd-license.php New BSD License
+ * @link     http://pear.php.net/package/Net_Curl
  */
 class Net_Curl
 {
@@ -346,10 +373,14 @@
      * The Net_Curl PHP 5.x constructor, called when a new Net_Curl object
      * is initialized (also called via 4.x constructor)
      *
-     * @param string $url The URL to fetch (can be set using the $url property as well)
-     * @param string $userAgent The userAgent string (can be set using the $userAgent property as well)
+     * @param string $url       The URL to fetch (can be set using the $url 
+     *                          property as well)
+     * @param string $userAgent The userAgent string (can be set using the 
+     *                          $userAgent property as well)
+     *
      * @access public
      * @author Joe Stump <[email protected]>
+     * @return void
      */
     function __construct($url = '', $userAgent = '')
     {
@@ -369,8 +400,13 @@
      *
      * PHP 4.x constructor.
      *
+     * @param string $url       The URL to fetch (can be set using the $url 
+     *                          property as well)
+     * @param string $userAgent The userAgent string (can be set using the 
+     *                          $userAgent property as well)
+     *
      * @access public
-     * @author Joe Stump <[email protected]>
+     * @return void
      */
     function Net_Curl($url = '', $userAgent = '')
     {
@@ -423,7 +459,7 @@
         $ret = true;
 
         // Basic stuff
-        $ret = curl_setopt($this->_ch, CURLOPT_URL,    $this->url);
+        $ret = curl_setopt($this->_ch, CURLOPT_URL, $this->url);
         $ret = curl_setopt($this->_ch, CURLOPT_HEADER, $this->header);
 
         // Whether or not to return the transfer contents
@@ -433,12 +469,16 @@
 
         // HTTP Authentication
         if ($this->username != '') {
-            $ret = curl_setopt($this->_ch, CURLOPT_USERPWD, $this->username . ':' . $this->password);
+            $ret = curl_setopt($this->_ch, 
+                               CURLOPT_USERPWD, 
+                               $this->username . ':' . $this->password);
         }
 
         // SSL Checks
         if (isset($this->sslVersion)) {
-            $ret = curl_setopt($this->_ch, CURLOPT_SSLVERSION, $this->sslVersion);
+            $ret = curl_setopt($this->_ch, 
+                               CURLOPT_SSLVERSION, 
+                               $this->sslVersion);
         }
 
         if (isset($this->sslCert)) {
@@ -446,7 +486,9 @@
         }
 
         if (isset($this->sslCertPasswd)) {
-            $ret = curl_setopt($this->_ch, CURLOPT_SSLCERTPASSWD, $this->sslCertPasswd);
+            $ret = curl_setopt($this->_ch, 
+                               CURLOPT_SSLCERTPASSWD, 
+                               $this->sslCertPasswd);
         }
 
         // Proxy Related checks
@@ -455,18 +497,20 @@
         }
 
         if (isset($this->proxyUser) || isset($this->proxyPassword)) {
-            $ret = curl_setopt($this->_ch, CURLOPT_PROXYUSERPWD, $this->proxyUser . ':' . $this->proxyPassword);
+            $ret = curl_setopt($this->_ch, 
+                               CURLOPT_PROXYUSERPWD, 
+                               $this->proxyUser . ':' . $this->proxyPassword);
         }
 
         if (is_bool($this->verifyPeer)) {
-            if(!$this->setOption(CURLOPT_SSL_VERIFYPEER,$this->verifyPeer)) {
+            if (!$this->setOption(CURLOPT_SSL_VERIFYPEER, $this->verifyPeer)) {
                 return PEAR::raiseError('Error setting CURLOPT_SSL_VERIFYPEER');
             }
         }
 
         if (is_numeric($this->verifyHost) && $this->verifyHost >= 0 &&
             $this->verifyHost <= 2) {
-            if(!$this->setOption(CURLOPT_SSL_VERIFYHOST,$this->verifyHost)) {
+            if (!$this->setOption(CURLOPT_SSL_VERIFYHOST, $this->verifyHost)) {
                 return PEAR::raiseError('Error setting CURLOPT_SSL_VERIFYPEER');
             }
         }
@@ -474,16 +518,17 @@
         if (is_bool($this->verifyPeer) && $this->verifyPeer == true) {
             if (isset($this->caInfo) && strlen($this->caInfo)) {
                 if (file_exists($this->caInfo)) {
-                    if (!$this->setOption(CURLOPT_CAINFO,$this->caInfo)) {
+                    if (!$this->setOption(CURLOPT_CAINFO, $this->caInfo)) {
                         return PEAR::raiseError('Error setting CURLOPT_CAINFO');
                     }
                 } else {
-                    return PEAR::raiseError('Could not find CA info: '.$this->caInfo);
+                    return PEAR::raiseError('Could not find CA info: '.
+                                            $this->caInfo);
                 }
             }
 
             if (isset($this->caPath) && is_string($this->caPath)) {
-                if (!$this->setOption(CURLOPT_CAPATH,$this->caPath)) {
+                if (!$this->setOption(CURLOPT_CAPATH, $this->caPath)) {
                     return PEAR::raiseError('Error setting CURLOPT_CAPATH');
                 }
             }
@@ -507,7 +552,7 @@
                 return PEAR::raiseError('File does not exist: '.$this->file);
             }
 
-            $this->_fp = fopen($this->file,'r');
+            $this->_fp = fopen($this->file, 'r');
             if (!is_resource($this->_fp)) {
                 return PEAR::raiseError('Could not open file: '.$this->file);
             }
@@ -525,7 +570,7 @@
             $sets = null;
             if (!isset($this->type)) {
                 $this->type = 'post';
-                $ret = curl_setopt($this->_ch, CURLOPT_POST, true);
+                $ret        = curl_setopt($this->_ch, CURLOPT_POST, true);
             }
 
             // If fields is an array then turn it into a string. Sometimes
@@ -565,7 +610,9 @@
         }
 
         // If a Location: header is passed then follow it
-        $ret = curl_setopt($this->_ch, CURLOPT_FOLLOWLOCATION, $this->followLocation);
+        $ret = curl_setopt($this->_ch, 
+                           CURLOPT_FOLLOWLOCATION, 
+                           $this->followLocation);
 
         // If a timeout is set and is greater then zero then set it
         if (is_numeric($this->timeout) && $this->timeout > 0) {
@@ -589,7 +636,9 @@
         // Other HTTP headers
         if ($this->httpHeaders !== null) {
             if (is_array($this->httpHeaders)) {
-                $ret = curl_setopt($this->_ch, CURLOPT_HTTPHEADER, $this->httpHeaders);
+                $ret = curl_setopt($this->_ch, 
+                                   CURLOPT_HTTPHEADER, 
+                                   $this->httpHeaders);
             } else {
                 return PEAR::raiseError('Net_Curl::$httpHeaders must be an array');
             }
@@ -611,9 +660,10 @@
         if (!isset($info['http_code'])) {
             return PEAR::raiseError('Unknown or invalid HTTP response');
         } else {
-            $type = substr($info['http_code'],0,1);
+            $type = substr($info['http_code'], 0, 1);
             if ($type != 2 && $type != 3) {
-                return PEAR::raiseError('Unexpected HTTP code: '.$info['http_code']);
+                return PEAR::raiseError('Unexpected HTTP code: ' .
+                                        $info['http_code']);
             }
         }
 
@@ -644,10 +694,11 @@
      * ?>
      * </code>
      *
+     * @param int   $option cURL constant (ie. CURLOPT_URL)
+     * @param mixed $value  The option's value
+     * 
      * @author Joe Stump <[email protected]>
      * @access public
-     * @param int $option cURL constant (ie. CURLOPT_URL)
-     * @param mixed $value
      * @return boolean
      */
     function setOption($option, $value)
@@ -718,9 +769,9 @@
      */
     function verboseAll()
     {
-        $this->verbose = true;
-        $this->mute = false;
-        $this->header = true;
+        $this->verbose  = true;
+        $this->mute     = false;
+        $this->header   = true;
         $this->progress = true;
     }
     // }}}
@@ -731,13 +782,13 @@
      *
      * @access public
      * @author David Costa <[email protected]>
+     * @return void
      * @deprecated
      */
     function verbose_all()
     {
         $this->verboseAll();
-        PEAR::raiseError('Net_Curl::verbose_all() is deprecated! Please use Net_Curl::verboseAll()'." <br />\n",null,PEAR_ERROR_PRINT);
-
+        PEAR::raiseError('Net_Curl::verbose_all() is deprecated! Please use Net_Curl::verboseAll()'." <br />\n", null, PEAR_ERROR_PRINT);
     }
     // }}}
 
@@ -767,7 +818,8 @@
      * @access private
      * @return void
      */
-    function _mapDeprecatedVariables() {
+    function _mapDeprecatedVariables() 
+    {
         $bad = array();
         if ($this->follow_location !== false) {
             if ($this->follow_location > 0) {
@@ -791,16 +843,16 @@
 
         if ($this->file_size !== false) {
             $this->fileSize = $this->file_size;
-            $bad[] = array('file_size','fileSize');
+            $bad[]          = array('file_size', 'fileSize');
         }
 
         if ($this->http_headers !== false) {
             $this->httpHeaders = $this->http_headers;
-            $bad[] = array('http_headers','httpHeaders');
+            $bad[]             = array('http_headers', 'httpHeaders');
         }
 
         foreach ($bad as $map) {
-            PEAR::raiseError('Net_Curl::$'.$map[0].' is deprecated! Please use Net_Curl::$'.$map[1]." instead! <br />\n", null, PEAR_ERROR_PRINT);
+            PEAR::raiseError('Net_Curl::$'. $map[0]. ' is deprecated! Please use Net_Curl::$'.$map[1]." instead! <br />\n", null, PEAR_ERROR_PRINT);
         }
     }
     // }}}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.