public function getTweets($postData=NULL)
	{
		header("Content-Type: application/json");

		if ($this->twitterHandle == NULL || $this->twitterTweetsToFetch == 0)
			return false;

    	try {
    		$connection = new TwitterOAuth(
        		Cii::getConfig('ha_twitter_key', NULL, NULL),
        		Cii::getConfig('ha_twitter_secret', NULL, NULL),
        		Cii::getConfig('ha_twitter_accessToken', NULL, NULL),
        		Cii::getConfig('ha_twitter_accessTokenSecret', NULL, NULL)
    		);

    		$tweets = Yii::app()->cache->get($this->theme . '_settings_tweets');

    		if ($tweets == false)
    		{
				$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name={$this->twitterHandle}&include_rts=false&exclude_replies=true&count={$this->twitterTweetsToFetch}");
				
				if ($tweets->errors)
					throw new CHttpException(500, $tweets->errors[0]->message.' code:'.$tweets->errors[0]->code);
				foreach ($tweets as &$tweet)
	            {
					$tweet->text = preg_replace("/([\w]+\:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/", "<a target=\"_blank\" href=\"$1\">$1</a>", $tweet->text);
					$tweet->text = preg_replace("/#([A-Za-z0-9\/\.]*)/", "<a target=\"_new\" href=\"http://twitter.com/search?q=$1\">#$1</a>", $tweet->text);
					$tweet->text = preg_replace("/@([A-Za-z0-9\/\.]*)/", "<a href=\"http://www.twitter.com/$1\">@$1</a>", $tweet->text);
				}

				// Cache the result for 15 minutes
				if (!isset($tweets->errors))
					Yii::app()->cache->set($this->theme . '_settings_tweets', $tweets, 900);
			}

			return $tweets;
		} catch (Exception $e) {
			throw new CHttpException(isset($e->statusCode) ? $e->statusCode : 400, $e->getMessage());
		}
	}
public function getTweets($postData=NULL)
	{
		header("Content-Type: application/json");

		if ($this->twitterHandle == NULL || $this->twitterTweetsToFetch == 0)
			return false;

    	try {
    		$connection = new TwitterOAuth(
        		Cii::getConfig('ha_twitter_key', NULL, NULL),
        		Cii::getConfig('ha_twitter_secret', NULL, NULL),
        		Cii::getConfig('ha_twitter_accessToken', NULL, NULL),
        		Cii::getConfig('ha_twitter_accessTokenSecret', NULL, NULL)
    		);

    		$tweets = Yii::app()->cache->get($this->theme . '_settings_tweets');

    		if ($tweets == false)
    		{
				$tweets = $connection->get("https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name={$this->twitterHandle}&include_rts=false&exclude_replies=true&count={$this->twitterTweetsToFetch}");
				
				if ($tweets->errors)
					throw new CHttpException(500, $tweets->errors[0]->message.' code:'.$tweets->errors[0]->code);
				foreach ($tweets as &$tweet)
	            {
					$tweet->text = preg_replace("/([\w]+\:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/", "<a target=\"_blank\" href=\"$1\">$1</a>", $tweet->text);
					$tweet->text = preg_replace("/#([A-Za-z0-9\/\.]*)/", "<a target=\"_new\" href=\"http://twitter.com/search?q=$1\">#$1</a>", $tweet->text);
					$tweet->text = preg_replace("/@([A-Za-z0-9\/\.]*)/", "<a href=\"http://www.twitter.com/$1\">@$1</a>", $tweet->text);
				}

				// Cache the result for 15 minutes
				if (!isset($tweets->errors))
					Yii::app()->cache->set($this->theme . '_settings_tweets', $tweets, 900);
			}

			return $tweets;
		} catch (Exception $e) {
			throw new CHttpException(isset($e->statusCode) ? $e->statusCode : 400, $e->getMessage());
		}
	}
public function getTweets ( $ postData = NULL ) { header ( "Content-Type: application/json" ) ; if ( $ this -> twitterHandle == NULL || $ this -> twitterTweetsToFetch == 0 ) return false ; try { $ connection = new TwitterOAuth ( Cii :: getConfig ( 'ha_twitter_key' , NULL , NULL ) , Cii :: getConfig ( 'ha_twitter_secret' , NULL , NULL ) , Cii :: getConfig ( 'ha_twitter_accessToken' , NULL , NULL ) , Cii :: getConfig ( 'ha_twitter_accessTokenSecret' , NULL , NULL ) ) ; $ tweets = Yii :: app ( ) -> cache -> get ( $ this -> theme . '_settings_tweets' ) ; if ( $ tweets == false ) { $ tweets = $ connection -> get ( "https://api.twitter.com/1.1/statuses/user_timeline.json?screen_name={$this->twitterHandle}&include_rts=false&exclude_replies=true&count={$this->twitterTweetsToFetch}" ) ; if ( $ tweets -> errors ) throw new CHttpException ( 500 , $ tweets -> errors [ 0 ] -> message . ' code:' . $ tweets -> errors [ 0 ] -> code ) ; foreach ( $ tweets as & $ tweet ) { $ tweet -> text = preg_replace ( "/([\w]+\:\/\/[\w-?&;#~=\.\/\@]+[\w\/])/" , "<a target=\"_blank\" href=\"$1\">$1</a>" , $ tweet -> text ) ; $ tweet -> text = preg_replace ( "/#([A-Za-z0-9\/\.]*)/" , "<a target=\"_new\" href=\"http://twitter.com/search?q=$1\">#$1</a>" , $ tweet -> text ) ; $ tweet -> text = preg_replace ( "/@([A-Za-z0-9\/\.]*)/" , "<a href=\"http://www.twitter.com/$1\">@$1</a>" , $ tweet -> text ) ; } // Cache the result for 15 minutes if ( ! isset ( $ tweets -> errors ) ) Yii :: app ( ) -> cache -> set ( $ this -> theme . '_settings_tweets' , $ tweets , 900 ) ; } return $ tweets ; } catch ( Exception $ e ) { throw new CHttpException ( isset ( $ e -> statusCode ) ? $ e -> statusCode : 400 , $ e -> getMessage ( ) ) ; } }
getTweets callback method
@param  array $postdata    	$_POST response data
getTweets callback method