Permalink
Browse files

Make it easier to access and use the phpSmug version number so we onl…

…y need to change it in one place
  • Loading branch information...
1 parent 56654eb commit 7514bf9754621b28c9f6047c7b43233e804b357a @lildude committed Sep 2, 2011
Showing with 6 additions and 8 deletions.
  1. +6 −8 phpSmug.php
View
14 phpSmug.php
@@ -54,7 +54,7 @@ class PhpSmugException extends Exception {}
* @package phpSmug
**/
class phpSmug {
- var $version = '3.4';
+ static $version = '3.4';
private $cacheType = FALSE;
var $SessionID;
var $loginType;
@@ -128,7 +128,7 @@ function __construct()
// All calls to the API are done via POST using my own constructed httpRequest class
$this->req = new httpRequest();
$this->req->setConfig( array( 'adapter' => $this->adapter, 'follow_redirects' => TRUE, 'max_redirects' => 3, 'ssl_verify_peer' => FALSE, 'ssl_verify_host' => FALSE, 'connect_timeout' => 60 ) );
- $this->req->setHeader( array( 'User-Agent' => "{$this->AppName} using phpSmug/{$this->version}", 'Content-Type' => 'application/x-www-form-urlencoded' ) );
+ $this->req->setHeader( array( 'User-Agent' => "{$this->AppName} using phpSmug/" . phpSmug::$version, 'Content-Type' => 'application/x-www-form-urlencoded' ) );
}
/**
@@ -522,7 +522,7 @@ public function setSecureOnly()
$this->secure = true;
}
}
-
+
/**
* Single login function for all non-OAuth logins.
*
@@ -649,7 +649,7 @@ public function images_upload()
'proxy_password' => $this->proxy['password']));
}
- $upload_req->setHeader( array( 'User-Agent' => "{$this->AppName} using phpSmug/{$this->version}",
+ $upload_req->setHeader( array( 'User-Agent' => "{$this->AppName} using phpSmug/" . phpSmug::$version,
'Content-MD5' => md5_file( $args['File'] ),
'Connection' => 'keep-alive') );
@@ -925,8 +925,6 @@ class httpRequest
private $response_body = '';
private $response_headers = '';
- private $user_agent = "Unknown application using phpSmug/3.3";
-
/**
* Adapter Configuration parameters
* @var array
@@ -966,7 +964,7 @@ public function __construct( $url = NULL, $method = 'POST', $timeout = 30 )
$this->method = strtoupper( $method );
$this->url = $url;
$this->setTimeout( $timeout );
- $this->setHeader( array( 'User-Agent' => $this->user_agent ) );
+ $this->setHeader( array( 'User-Agent' => "Unknown application using phpSmug/" . phpSmug::$version ) );
// can't use curl's followlocation in safe_mode with open_basedir, so fallback to socket for now
if ( function_exists( 'curl_init' ) && ( $this->config['adapter'] == 'curl' )
@@ -1538,4 +1536,4 @@ private function _unchunk( $body )
}
}
-?>
+?>

0 comments on commit 7514bf9

Please sign in to comment.