From 7def21f2ac2c6b2490cde980e9efa94116fce1ef Mon Sep 17 00:00:00 2001 From: jrconlin Date: Mon, 25 Oct 2010 10:05:00 -0700 Subject: [PATCH] changed code to always call set parameters (to make calling simpler) --- js/OAuthSimple.js | 2 -- php/OAuthSimple.php | 11 +++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/js/OAuthSimple.js b/js/OAuthSimple.js index 58ab9bf..9949820 100644 --- a/js/OAuthSimple.js +++ b/js/OAuthSimple.js @@ -260,9 +260,7 @@ if (OAuthSimple === undefined) this.setSignatureMethod(args['method']); } this.setTokensAndSecrets(args['signatures']); - if (args['parameters'] !== undefined){ this.setParameters(args['parameters']); - } // check the parameters var normParams = this._normalizedParameters(); this._parameters['oauth_signature']=this._generateSignature(normParams); diff --git a/php/OAuthSimple.php b/php/OAuthSimple.php index 9fa3d2b..7e1b071 100644 --- a/php/OAuthSimple.php +++ b/php/OAuthSimple.php @@ -220,7 +220,7 @@ class OAuthSimple { $this->_parameters['oauth_signature_method']=$method; break; default: - throw new OAuthSimpleException ('Unknown signing method specified for OAuthSimple.setSignatureMethod'); + throw new OAuthSimpleException ("Unknown signing method $method specified for OAuthSimple.setSignatureMethod"); } return $this; } @@ -243,8 +243,7 @@ class OAuthSimple { $this->setSignatureMethod($args['method']); if (!empty($args['signatures'])) $this->setTokensAndSecrets($args['signatures']); - if (!empty($args['parameters'])) - $this->setParameters($args['parameters']); + $this->setParameters($args['parameters']); $normParams = $this->_normalizedParameters(); $this->_parameters['oauth_signature'] = $this->_generateSignature($normParams); return Array( @@ -278,15 +277,15 @@ class OAuthSimple { { foreach ($pValue as $val) { - $result .= $pName .'="' . $this->_oauthEscape($val) . '" '; + $result .= $pName .'="' . $this->_oauthEscape($val) . '", '; } } else { - $result .= $pName . '="' . $this->_oauthEscape($pValue) . '" '; + $result .= $pName . '="' . $this->_oauthEscape($pValue) . '", '; } } - return $result; + return preg_replace('/, $/','',$result); } // Start private methods. Here be Dragons.