protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'])->getConnection(); $t = new Twitter(sfConfig::get('twitter_username'), sfConfig::get('twitter_password')); $last_message = RawMessagePeer::getLastMessage($connection); $since = null; if ($last_message) { $since = $last_message->getMessageId(); } $messages = $t->getMentionsReplies($since); foreach ($messages as $message) { $rawmessage = RawMessagePeer::saveMessage($message, $connection); if ($rawmessage instanceof RawMessage) { $need = NeedPeer::convertMessage($rawmessage, $con); } else { var_dump($rawmessage); } } }
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ require_once 'twitter.php'; require_once 'function.resize.php'; require_once 'snoopy.class.php'; require_once 'htmlsql.class.php'; /** * 1. Get and cache mentions * 2. Parse twitpics * 3. Get images and crop */ // Instantiate Twitter class $twitter = new Twitter('<username>', '<password>'); // Get all tweets @hunt_and_gather $tweets = $twitter->getMentionsReplies(); // Instantiate HTMLSql $wsql = new htmlsql(); // Path to log file $cacheFile = 'cache/pics.log'; // Refresh always for now $cacheMinutes = 0; // Open log file $fh = fopen($cacheFile, 'a') or die("can't open file"); function parsePics($tweets) { $picUrls = array(); $twitpicPattern = '%(http://twitpic\\.com/\\w+)%i'; $yfrogPattern = '%(http://yfrog\\.com/\\w+)%i'; foreach ($tweets as $tweet) { if (preg_match($twitpicPattern, $tweet['text'], $matches) || preg_match($yfrogPattern, $tweet['text'], $matches)) {