本文整理汇总了PHP中Cron::post_tweets方法的典型用法代码示例。如果您正苦于以下问题:PHP Cron::post_tweets方法的具体用法?PHP Cron::post_tweets怎么用?PHP Cron::post_tweets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cron
的用法示例。
在下文中一共展示了Cron::post_tweets方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: post_to
$recipients = array();
$email_config = get_config('swiftmailer');
if (filter_var($current_user->email, FILTER_VALIDATE_EMAIL) !== FALSE) {
$recipients[] = $current_user->email;
}
$recipients[] = $email_config['support'];
$mailer = new Swiftmailer();
$mailer->send('Warbble notification', array('email' => 'support@w.gregfurlong.ie', 'title' => 'Support'), $recipients, $mailer->get_html_tweet_message($tweet, $this->path));
$tweet->status = Tweets_Model::STATUS_FILED;
$tweet->save();
}
}
}
}
}
public function post_to($tweet)
{
$current_user = $tweet->user;
if ($current_user && ($current_user->type == Users_Model::USER_TYPE_HAS_TWITTER || $current_user->type == Users_Model::USER_TYPE_TWITTER)) {
$verifier = array('oauth_token' => $current_user->twitter_oauth_token, 'oauth_token_secret' => $current_user->twitter_oauth_token_secret);
$twitter_config = get_config('twitter');
$connection = new TwitterOAuth($twitter_config['key'], $twitter_config['secret'], $verifier['oauth_token'], $verifier['oauth_token_secret']);
$status = $connection->post('statuses/update', array('status' => $tweet->text));
return $status;
}
return false;
}
}
$cron = new Cron();
$cron->post_tweets();