Title: cannot redeclare error
Last modified: August 21, 2016

---

# cannot redeclare error

 *  Resolved [sso7575](https://wordpress.org/support/users/sso7575/)
 * (@sso7575)
 * [12 years, 9 months ago](https://wordpress.org/support/topic/cannot-redeclare-error/)
 * Hi,
 * I installed the Yelp widget but it is conflicting with the Juiz Last Tweet Widget.
   I am getting cannot re-declare the authentication classes from the oauth file.
   I tried to comment out what it was complaining about but it just jumps down the
   next on and complains about it. This is a great plug-in I would really like to
   use. Any ideas?
 * Thanks!
 * [http://wordpress.org/plugins/yelp-widget-pro/](http://wordpress.org/plugins/yelp-widget-pro/)

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [Devin Walker](https://wordpress.org/support/users/dlocc/)
 * (@dlocc)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/cannot-redeclare-error/#post-4026392)
 * Sorry for the late reply. I will check into this conflict. Just curious, have
   you tried Twitter Widget Pro?
 *  [flaviodj](https://wordpress.org/support/users/flaviodj/)
 * (@flaviodj)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/cannot-redeclare-error/#post-4026394)
 * It is because the same class has already been instated.
    An easy fix would (for
   future proofing against other widgets/plugins using the yelp oauth api), (for
   the dev) go into the “lib/” folder Find the file oauth.php find the code
 * >  Line 7: class OAuthException extends Exception {
   >  Line 13: class OAuthConsumer{
   > Line 29: class OAuthToken { Line 49: OAuthUtil::urlencode_rfc3986($this->key).
   > Line 51: OAuthUtil::urlencode_rfc3986($this->secret); Line 63: abstract class
   > OAuthSignatureMethod { Line 104: class OAuthSignatureMethod_HMAC_SHA1 extends
   > OAuthSignatureMethod { Line 118: $key_parts = OAuthUtil::urlencode_rfc3986(
   > $key_parts); Line 131: class OAuthSignatureMethod_PLAINTEXT extends OAuthSignatureMethod{
   > Line 151: $key_parts = OAuthUtil::urlencode_rfc3986($key_parts); Line 167: 
   > abstract class OAuthSignatureMethod_RSA_SHA1 extends OAuthSignatureMethod {
   > Line 227: class OAuthRequest { Line 238: $parameters = array_merge( OAuthUtil::
   > parse_parameters(parse_url($http_url, PHP_URL_QUERY)), $parameters); Line 265:
   > $request_headers = OAuthUtil::get_headers(); Line 268: $parameters = OAuthUtil::
   > parse_parameters($_SERVER[‘QUERY_STRING’]); Line 286: $header_parameters = 
   > OAuthUtil::split_header( Line 294: return new OAuthRequest($http_method, $http_url,
   > $parameters); Line 302: $defaults = array(“oauth_version” => OAuthRequest::
   > $version, Line 303: “oauth_nonce” => OAuthRequest::generate_nonce(), Line 304:“
   > oauth_timestamp” => OAuthRequest::generate_timestamp(), Line 311: return new
   > OAuthRequest($http_method, $http_url, $parameters); Line 355: return OAuthUtil::
   > build_http_query($params); Line 372: $parts = OAuthUtil::urlencode_rfc3986(
   > $parts); Line 419: return OAuthUtil::build_http_query($this->parameters); Line
   > 428: $out = ‘Authorization: OAuth realm=”‘ . OAuthUtil::urlencode_rfc3986($
   > realm) . ‘”‘; Line 431: $out = ‘Authorization: OAuth’; Line 437: throw new 
   > OAuthException(‘Arrays not supported in headers’); Line 440: $out .= OAuthUtil::
   > urlencode_rfc3986($k) . Line 442: OAuthUtil::urlencode_rfc3986($v) . Line 488:
   > class OAuthServer { Line 571: throw new OAuthException(“OAuth version ‘$version’
   > not supported”); Line 580: $signature_method = $request instanceof OAuthRequest
   > Line 587: throw new OAuthException(‘No signature method parameter. This parameter
   > is required’); Line 593: throw new OAuthException( Line 606: $consumer_key 
   > = $request instanceof OAuthRequest Line 611: throw new OAuthException(“Invalid
   > consumer key”); Line 616: throw new OAuthException(“Invalid consumer”); Line
   > 626: $token_field = $request instanceof OAuthRequest Line 634: throw new OAuthException(“
   > Invalid $token_type token: $token_field”); Line 645: $timestamp = $request 
   > instanceof OAuthRequest Line 648: $nonce = $request instanceof OAuthRequest
   > Line 666: throw new OAuthException(“Invalid signature”); Line 676: throw new
   > OAuthException( Line 684: throw new OAuthException( Line 696: throw new OAuthException(
   > Line 708: throw new OAuthException(“Nonce already used: $nonce”); Line 715:
   > class OAuthDataStore { Line 742: class OAuthUtil { Line 774: $params[$h] = 
   > OAuthUtil::urldecode_rfc3986(empty($matches[3][$i]) ? $matches[4][$i] : $matches[
   > 3][$i]); Line 840: $parameter = OAuthUtil::urldecode_rfc3986($split[0]); Line
   > 841: $value = isset($split[1]) ? OAuthUtil::urldecode_rfc3986($split[1]) : ”;
   > Line 865: $keys = OAuthUtil::urlencode_rfc3986(array_keys($params)); Line 866:
   > $values = OAuthUtil::urlencode_rfc3986(array_values($params));
 * Replacce the “OAuth…” with say “YWPOAuth…” like this:
 * >  Line 7: class YWPYWPOAuthException extends Exception {
   >  Line 13: class YWPYWPOAuthConsumer{
   > Line 29: class YWPYWPOAuthToken { Line 49: YWPOAuthUtil::urlencode_rfc3986(
   > $this->key) . Line 51: YWPOAuthUtil::urlencode_rfc3986($this->secret); Line
   > 63: abstract class YWPOAuthSignatureMethod { Line 104: class YWPOAuthSignatureMethod_HMAC_SHA1
   > extends YWPOAuthSignatureMethod { Line 118: $key_parts = YWPOAuthUtil::urlencode_rfc3986(
   > $key_parts); Line 131: class YWPOAuthSignatureMethod_PLAINTEXT extends YWPOAuthSignatureMethod{
   > Line 151: $key_parts = YWPOAuthUtil::urlencode_rfc3986($key_parts); Line 167:
   > abstract class YWPOAuthSignatureMethod_RSA_SHA1 extends YWPOAuthSignatureMethod{
   > Line 227: class YWPOAuthRequest { Line 238: $parameters = array_merge( YWPOAuthUtil::
   > parse_parameters(parse_url($http_url, PHP_URL_QUERY)), $parameters); Line 265:
   > $request_headers = YWPOAuthUtil::get_headers(); Line 268: $parameters = YWPOAuthUtil::
   > parse_parameters($_SERVER[‘QUERY_STRING’]); Line 286: $header_parameters = 
   > YWPOAuthUtil::split_header( Line 294: return new YWPOAuthRequest($http_method,
   > $http_url, $parameters); Line 302: $defaults = array(“YWPOAuth_version” => 
   > YWPOAuthRequest::$version, Line 303: “YWPOAuth_nonce” => YWPOAuthRequest::generate_nonce(),
   > Line 304: “YWPOAuth_timestamp” => YWPOAuthRequest::generate_timestamp(), Line
   > 311: return new YWPOAuthRequest($http_method, $http_url, $parameters); Line
   > 355: return YWPOAuthUtil::build_http_query($params); Line 372: $parts = YWPOAuthUtil::
   > urlencode_rfc3986($parts); Line 419: return YWPOAuthUtil::build_http_query(
   > $this->parameters); Line 428: $out = ‘Authorization: YWPOAuth realm=”‘ . YWPOAuthUtil::
   > urlencode_rfc3986($realm) . ‘”‘; Line 431: $out = ‘Authorization: YWPOAuth’;
   > Line 437: throw new YWPOAuthException(‘Arrays not supported in headers’); Line
   > 440: $out .= YWPOAuthUtil::urlencode_rfc3986($k) . Line 442: YWPOAuthUtil::
   > urlencode_rfc3986($v) . Line 488: class YWPOAuthServer { Line 571: throw new
   > YWPOAuthException(“YWPOAuth version ‘$version’ not supported”); Line 580: $
   > signature_method = $request instanceof YWPOAuthRequest Line 587: throw new 
   > YWPOAuthException(‘No signature method parameter. This parameter is required’);
   > Line 593: throw new YWPOAuthException( Line 606: $consumer_key = $request instanceof
   > YWPOAuthRequest Line 611: throw new YWPOAuthException(“Invalid consumer key”);
   > Line 616: throw new YWPOAuthException(“Invalid consumer”); Line 626: $token_field
   > = $request instanceof YWPOAuthRequest Line 634: throw new YWPOAuthException(“
   > Invalid $token_type token: $token_field”); Line 645: $timestamp = $request 
   > instanceof YWPOAuthRequest Line 648: $nonce = $request instanceof YWPOAuthRequest
   > Line 666: throw new YWPOAuthException(“Invalid signature”); Line 676: throw
   > new YWPOAuthException( Line 684: throw new YWPOAuthException( Line 696: throw
   > new YWPOAuthException( Line 708: throw new YWPOAuthException(“Nonce already
   > used: $nonce”); Line 715: class YWPOAuthDataStore { Line 742: class YWPOAuthUtil{
   > Line 774: $params[$h] = YWPOAuthUtil::urldecode_rfc3986(empty($matches[3][$
   > i]) ? $matches[4][$i] : $matches[3][$i]); Line 840: $parameter = YWPOAuthUtil::
   > urldecode_rfc3986($split[0]); Line 841: $value = isset($split[1]) ? YWPOAuthUtil::
   > urldecode_rfc3986($split[1]) : ”; Line 865: $keys = YWPOAuthUtil::urlencode_rfc3986(
   > array_keys($params)); Line 866: $values = YWPOAuthUtil::urlencode_rfc3986(array_values(
   > $params));
 * now go into the file in the root of the plugin widget.php
 * find this:
 * >  Line 45: $token = new OAuthToken($yelp_widget_token, $yelp_widget_token_secret);
   > 
   > Line 51: $consumer = new OAuthConsumer($yelp_widget_consumer_key, $yelp_widget_consumer_secret);
   > Line 54: $signature_method = new OAuthSignatureMethod_HMAC_SHA1(); Line 98:
   > $oauthrequest = OAuthRequest::from_consumer_and_token($consumer, $token, ‘GET’,
   > $unsigned_url, $urlparams); Line 98: $oauthrequest = OAuthRequest::from_consumer_and_token(
   > $consumer, $token, ‘GET’, $unsigned_url, $urlparams);
 * replace it by:
 * >  Line 45: $token = new YWPOAuthToken($yelp_widget_token, $yelp_widget_token_secret);
   > 
   > Line 51: $consumer = new YWPOAuthConsumer($yelp_widget_consumer_key, $yelp_widget_consumer_secret);
   > Line 54: $signature_method = new YWPOAuthSignatureMethod_HMAC_SHA1(); Line 
   > 98: $oauthrequest = YWPOAuthRequest::from_consumer_and_token($consumer, $token,‘
   > GET’, $unsigned_url, $urlparams); Line 98: $oauthrequest = YWPOAuthRequest::
   > from_consumer_and_token($consumer, $token, ‘GET’, $unsigned_url, $urlparams);
 * That should take care of any other class conflicts, even if someone alters the
   oauth.php in another plugin
 *  Plugin Author [Devin Walker](https://wordpress.org/support/users/dlocc/)
 * (@dlocc)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/cannot-redeclare-error/#post-4026395)
 * Thanks – will look into this for a future release!
 *  Plugin Author [Devin Walker](https://wordpress.org/support/users/dlocc/)
 * (@dlocc)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/cannot-redeclare-error/#post-4026416)
 * I haven’t forgotten about this request!
 *  Plugin Author [Devin Walker](https://wordpress.org/support/users/dlocc/)
 * (@dlocc)
 * [12 years, 1 month ago](https://wordpress.org/support/topic/cannot-redeclare-error/#post-4026421)
 * This is fixed as of the latest release. Setting as resolved.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘cannot redeclare error’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/yelp-widget-pro_98b4c1.svg)
 * [Reviews Block for Yelp](https://wordpress.org/plugins/yelp-widget-pro/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/yelp-widget-pro/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/yelp-widget-pro/)
 * [Active Topics](https://wordpress.org/support/plugin/yelp-widget-pro/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/yelp-widget-pro/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/yelp-widget-pro/reviews/)

## Tags

 * [redeclare](https://wordpress.org/support/topic-tag/redeclare/)

 * 5 replies
 * 3 participants
 * Last reply from: [Devin Walker](https://wordpress.org/support/users/dlocc/)
 * Last activity: [12 years, 1 month ago](https://wordpress.org/support/topic/cannot-redeclare-error/#post-4026421)
 * Status: resolved