-
Notifications
You must be signed in to change notification settings - Fork 18
Addition of getbyid function #46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -143,6 +143,39 @@ public function search() | |
| return $this->render_tweets($statuses, $prefix, $userprefix); | ||
| } | ||
|
|
||
| public function getbyid() | ||
| { | ||
| // Fetch parameters | ||
| $this->refresh = $this->EE->TMPL->fetch_param('twitter_refresh', $this->refresh); | ||
| $this->limit = $this->EE->TMPL->fetch_param('limit', '1'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think we need limit to be a parameter anymore. Lets just remove this parameter, and hardcode |
||
| $this->use_stale = $this->EE->TMPL->fetch_param('use_stale_cache', 'yes'); | ||
| $this->target = $this->EE->TMPL->fetch_param('target', ''); | ||
| $query = $this->EE->TMPL->fetch_param('id'); | ||
| $prefix = $this->EE->TMPL->fetch_param('prefix', ''); | ||
| $userprefix = $this->EE->TMPL->fetch_param('userprefix', NULL); | ||
|
|
||
| if (!$query) | ||
| { | ||
| $this->EE->TMPL->log_item("Parameter query was not provided"); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. "Parameter id was not provided." |
||
| return; | ||
| } | ||
|
|
||
| // timeline type | ||
| $timeline = 'getbyid'; | ||
| $log_extra = "Get by id:{$query}"; | ||
|
|
||
| $this->EE->TMPL->log_item("Using '{$timeline}' Twitter Timeline {$log_extra}"); | ||
|
|
||
| $url = "statuses/show"; | ||
| $params = array('id' => $query); | ||
|
|
||
| // retrieve statuses | ||
| $statuses = $this->_fetch_data($url, $params); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well now I'm just getting picky, so you can ignore this one. But maybe this is better written: |
||
| $statuses = array($statuses); | ||
|
|
||
| return $this->render_tweets($statuses, $prefix, $userprefix); | ||
| } | ||
|
|
||
| public function get_list() | ||
| { | ||
| // Fetch parameters | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would this be better as
{exp:twitter:tweet id="..."}or{exp:twitter:single_tweet id="..."}?{exp:twitter:getbyid}doesn't seem to have much flow to it. What am I getting by ID?