本文整理汇总了PHP中Tweet::find方法的典型用法代码示例。如果您正苦于以下问题:PHP Tweet::find方法的具体用法?PHP Tweet::find怎么用?PHP Tweet::find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tweet
的用法示例。
在下文中一共展示了Tweet::find方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: do_update_if_needed
function do_update_if_needed($twitster)
{
if (time_for_refresh()) {
if (file_exists(UPDATE_PID_FILE)) {
twitlog("Time for an update, but one is already in progress. Skipping.");
} else {
twitlog("It is time to refresh the cache, beginning now.");
$tweets = Tweet::find();
$since = is_array($tweets) && $tweets[0] ? $tweets[0]->id : false;
$twitster->refresh($since);
}
}
}
示例2: store
public function store(Request $request)
{
$type = $request->get('type');
$tweet = Tweet::find($id);
if (!$tweet) {
$tweet = new Tweet();
$tweet[$type] = 1;
}
$tweet->id = $request->get('id');
$tweet->text = $request->get('text');
$tweet->increment($type);
$tweet->save();
return $request->all();
}
示例3: healthcheck
public function healthcheck()
{
// Check we have data from Mandrill
$data = json_decode($this->PostData('mandrill_events'));
if (!$data) {
echo 'OK - No Data';
die;
}
// We need to check if we've sent an alert in the past
// 8 hours, if not, send another one.
$content = "Exchange Alert: Delivery Delay";
$cutoff = time() - 3600 * 8;
$lastTweet = Tweet::find("tweets.message = '{$content}'", "publish_at DESC");
if ($lastTweet && $lastTweet->publish_at > $cutoff) {
echo 'OK - Alert Already Sent';
die;
}
$account = TwitterAccount::find_by_code('site');
$account->add_tweet($content);
echo 'OK - Alert Sent';
die;
}
示例4: twitster
$twitster = new twitster();
$twitster->init();
$offset = isset($_REQUEST['offset']) ? $_REQUEST['offset'] : 0;
$tag = $_REQUEST['tag'];
if (!isset($_REQUEST['tag']) && HASHTAG) {
$tag = HASHTAG;
}
$feed_link = 'rss.php?tag=' . urlencode($tag);
$options = array();
$options['tag'] = $tag;
$options['offset'] = $offset;
$options['limit'] = PAGE_LIMIT;
if ($offset == 0) {
do_update_if_needed($twitster);
}
$tweets = Tweet::find($options);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<title><?php
echo SITE_TITLE;
?>
: <?php
echo SITE_SUBTITLE;
?>
</title>
<meta name="description" content="<?php
echo SITE_SUBTITLE;