What? Parse error: syntax error, unexpected T_STRING in /file/path

I am getting this error for the following line:

CodebirdCodebird::setConsumerKey( $auth_args['consumer_key'], $auth_args['consumer_secret'] );

This is a wordpress template i just installed on a server. It works on my WAMP home server but not on the non self hosted server. Not sure if different PHP versions are the problem.

Read More

It is line 9 here:

class Jed_Widget_Latest_Tweets extends WP_Widget {
function __construct() {
    parent::__construct(false, $name = 'Jednotka Twitter Widget', array( 'description' => 'Twitter profile widget for your site.' ) );
}

function retrieve_tweets( $widget_id, $instance, $auth_args ) {

    if ( !empty($auth_args['consumer_key']) && !empty($auth_args['consumer_secret']) ) {
        CodebirdCodebird::setConsumerKey( $auth_args['consumer_key'], $auth_args['consumer_secret'] );
        $cb = CodebirdCodebird::getInstance();
        $cb->setToken( $auth_args['access_token'], $auth_args['access_secret'] );
        $timeline = $cb->statuses_userTimeline( 'screen_name=' . $instance['screen_name']. '&count=' . $instance['num_tweets'] . '&exclude_replies=true' );
        return $timeline;
    }
    else {
        return 'Authentication to twitter server failed. Please make sure that your "consumer key" and "consumer secret" are not empty';
    }

}

function save_tweets( $widget_id, $instance, $auth_args ) {
    $timeline = $this->retrieve_tweets( $widget_id, $instance, $auth_args );
    $tweets = array( 'tweets' => $timeline, 'update_time' => time() + ( 60 * 5 ) );
    update_option( 'my_tweets_' . $widget_id, $tweets );
    return $tweets;
}

function get_tweets( $widget_id, $instance, $auth_args ) {
    $tweets = get_option( 'my_tweets_' . $widget_id );
    if( empty( $tweets ) OR time() > $tweets['update_time'] ) {
        $tweets = $this->save_tweets( $widget_id, $instance, $auth_args );
    }
    return $tweets;
}

Related posts

Leave a Reply

1 comment

  1. Ensure you are using PHP 5.3 or higher, and that the namespace is declared, otherwise the interpreter is going to think CodebirdCodebird is a random set of characters