Skip to content
This repository has been archived by the owner on Jul 13, 2018. It is now read-only.

Commit

Permalink
Remove the damn rate limit check finally
Browse files Browse the repository at this point in the history
  • Loading branch information
mbabker committed May 21, 2012
1 parent bb750c5 commit 1d0480c
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 64 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Expand Up @@ -14,6 +14,9 @@ $ - Language fix or change
- - Removed
! - Note

21-May-2012 Michael Babker
- Remove the damn rate limit check finally

27-February-2012 Michael Babker
^ [#35] Internationalize hover titles on Web Intent actions

Expand Down
2 changes: 1 addition & 1 deletion build.xml
Expand Up @@ -4,7 +4,7 @@
<property file="./build.properties" />
<property name="repo.dir" value="." />
<resolvepath propertyName="repo.dir.resolved" file="${repo.dir}" />
<property name="version" value="2.1.3" />
<property name="version" value="2.1.3+dev" />
<tstamp>
<format property="build.date" pattern="%Y-%m-%d" />
</tstamp>
Expand Down
50 changes: 2 additions & 48 deletions helper.php
Expand Up @@ -29,21 +29,6 @@ class ModTweetDisplayBackHelper
*/
static public function compileData($params)
{
// Initialize the object
$twitter = new stdClass;

// Check if we're bypassing the limit check
if ($params->get('bypassLimit', '0') == '0')
{
// Check the number of hits available
$hits = self::getLimit($params);
if ($hits == 0)
{
$twitter->hits = '';
return $twitter;
}
}

// Load the parameters
$uname = $params->get('twitterName', '');
$list = $params->get('twitterList', '');
Expand All @@ -59,8 +44,8 @@ static public function compileData($params)
// Get the user info
$twitter = self::prepareUser($params);

// Check to see if we have an error
if (isset ($twitter->error))
// Check to see if we have an error or are out of hits
if (isset($twitter->error) || isset($twitter->hits))
{
return $twitter;
}
Expand Down Expand Up @@ -178,37 +163,6 @@ static public function getJSON($req)
return $obj;
}

/**
* Function to get the rate limit of a Twitter user
*
* @param JRegistry $params The module parameters
*
* @return string The number of remaining hits on a user's rate limit
*
* @since 1.0
*/
static protected function getLimit($params)
{
// Load the parameters
$uname = $params->get('twitterName', '');
$req = 'http://api.twitter.com/1/account/rate_limit_status.json?screen_name=' . $uname;

// Fetch the decoded JSON
$obj = self::getJSON($req);

// Get the remaining hits count
if (isset($obj['remaining_hits']))
{
$hits = $obj['remaining_hits'];
}
else
{
$hits = '';
}

return $hits;
}

/**
* Function to fetch the user JSON and render it
*
Expand Down
2 changes: 0 additions & 2 deletions language/1.5/en-GB/en-GB.mod_tweetdisplayback.ini
Expand Up @@ -16,8 +16,6 @@ MOD_TWEETDISPLAYBACK_CREATE_WEEKS="%s weeks ago"
MOD_TWEETDISPLAYBACK_ERROR_NOCURL="PHP CURL is not installed or activated on this server. This module requires CURL to load data."
MOD_TWEETDISPLAYBACK_ERROR_NOHITS="This user has reached the maximum allowable queries against Twitter's API for the hour."
MOD_TWEETDISPLAYBACK_ERROR_UNABLETOLOAD="Due to an error, potentially a timed-out connection to Twitter, this user's tweets are unable to be displayed."
MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSINTENT_DESCRIPTION="Choose to bypass the Twitter Web Intents script when clicking user links. This will cause user links to go to twitter.com instead of being displayed in a popup. Actions links are unaffected."
MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSINTENT_LABEL="Bypass Web Intents for User Links"
MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSLIMIT_DESCRIPTION="Choose to bypass the Twitter API's limit check. Note that this does not guarantee that your tweet stream will render."
MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSLIMIT_LABEL="Bypass Limit Check"
MOD_TWEETDISPLAYBACK_FIELDSET_FILTER_MENTIONS_DESCRIPTION="Show tweets which contain user mentions. If set to no, @replies are still displayed."
Expand Down
2 changes: 0 additions & 2 deletions language/1.7/en-GB/en-GB.mod_tweetdisplayback.ini
Expand Up @@ -28,8 +28,6 @@ MOD_TWEETDISPLAYBACK_ERROR_NOHITS="This user has reached the maximum allowable q
MOD_TWEETDISPLAYBACK_ERROR_UNABLETOLOAD="Due to an error, potentially a timed-out connection to Twitter, this user's tweets are unable to be displayed."
MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSINTENT_DESCRIPTION="Choose to bypass the Twitter Web Intents script when clicking user links. This will cause user links to go to twitter.com instead of being displayed in a popup. Actions links are unaffected."
MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSINTENT_LABEL="Bypass Web Intents for User Links"
MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSLIMIT_DESCRIPTION="Choose to bypass the Twitter API's limit check. Note that this does not guarantee that your tweet stream will render."
MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSLIMIT_LABEL="Bypass Limit Check"
MOD_TWEETDISPLAYBACK_FIELDSET_FILTER_MENTIONS_DESCRIPTION="Show tweets which contain user mentions. If set to no, @replies are still displayed."
MOD_TWEETDISPLAYBACK_FIELDSET_FILTER_MENTIONS_LABEL="Show user mentions"
MOD_TWEETDISPLAYBACK_FIELDSET_FILTER_OVERRIDECOUNT_DESCRIPTION="If yes, then instead of retrieving the number of tweets defined in the "_QQ_"# of Tweets"_QQ_" field, the module will retrieve the number of tweets you specify below for processing. This is beneficial if filtering is enabled and you are not receiving the number of tweets you are expecting."
Expand Down
11 changes: 0 additions & 11 deletions mod_tweetdisplayback_17.xml
Expand Up @@ -658,17 +658,6 @@
type="text"
label="COM_MODULES_FIELD_MODULECLASS_SFX_LABEL"
description="COM_MODULES_FIELD_MODULECLASS_SFX_DESC" />
<field
name="bypassLimit"
type="radio"
default="0"
label="MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSLIMIT_LABEL"
description="MOD_TWEETDISPLAYBACK_FIELDSET_ADVANCED_BYPASSLIMIT_DESCRIPTION" >
<option
value="1">JYES</option>
<option
value="0">JNO</option>
</field>
<field
name="bypassIntent"
type="radio"
Expand Down

0 comments on commit 1d0480c

Please sign in to comment.