本文整理匯總了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();