/** * Updates the Authors list executing a Twitter search for the parameters * configured */ public function updateAuthors() { $results = Tweester_Twitter::getMaxSearchResults($this->coreManager->getSettingsManager()->getOption('query')->getValue(), 15); //Get list of excludes $excludes = $this->coreManager->getSettingsManager()->getOption('excludes')->getValue(); $excludedArray = explode(',', $excludes); $excludedArray = array_map('trim', $excludedArray); if ($results != false) { //Process, store supporters foreach ($results as $tweet) { //Get Username $username = $tweet->from_user; //Skip if in excluded if (in_array($username, $excludedArray)) { continue; } //Check if already in base $data = $this->coreManager->getDbManager()->get_row("SELECT * FROM " . $this->coreManager->getDbManager()->getTableNameFor('authors') . " WHERE twitter = '" . $username . "'"); //Add to base if not if ($data == null) { $this->coreManager->getDbManager()->insert($this->coreManager->getDbManager()->getTableNameFor('authors'), array('twitter' => $username, 'added_on' => date('Y-m-d H:i:s')), array('%s', '%s')); } } } //Update execution time $this->coreManager->getSettingsManager()->getOption('cron_run_time')->setValue(time()); }