public function getGraphicUrl() { if (!$this->getGraphicFile()) { return null; } if (time() > strtotime($this->getReleaseDate())) { return rtrim(ProjectConfiguration::getApplicationAmazonCloudFrontUrl(), '/') . '/upload/' . $this->getGraphicFile(); } else { return rtrim(ProjectConfiguration::getApplicationAmazonBucketUrl(), '/') . '/upload/' . $this->getGraphicFile(); } }
protected function createFeedArray($episode_array, $title, $link, $atom_link, $description, $is_nsfw = false) { $feedArray = array('title' => ProjectConfiguration::getApplicationName() . ' - ' . $title, 'link' => $link, 'atom_link' => $atom_link, 'description' => $description, 'language' => 'en-us', 'charset' => sfConfig::get('sf_charset'), 'pubDate' => time(), 'is_nsfw' => $is_nsfw ? 'yes' : 'no', 'entries' => array()); /* get the data from the db or outher source */ foreach ($episode_array as $episode) { /* @var $episode Episode */ $new_entry = array('title' => $episode->getTitle(), 'link' => $this->getController()->genUrl('@episode_show?id=' . $episode->getIncremented(), true), 'guid' => $episode->getIncremented(), 'description' => html_entity_decode($this->getUser()->formatMarkdown($episode->getDescription())), 'content' => html_entity_decode($this->getUser()->formatMarkdown($episode->getDescription())), 'lastUpdate' => strtotime($episode->getReleaseDate()), 'modified' => strtotime($episode->getUpdatedAt()), 'released' => strtotime($episode->getReleaseDate()), 'author' => array('name' => $this->_users[$this->_assignments[$episode->getEpisodeAssignmentId()]->getSfGuardUserId()]->getUsername(), 'email' => $this->_users[$this->_assignments[$episode->getEpisodeAssignmentId()]->getSfGuardUserId()]->getEmailAddress(), 'uri' => $this->getController()->genUrl('@homepage', true)), 'audio_location' => $episode->getFileIsRemote() ? $episode->getRemoteUrl() : $this->getController()->genUrl('@episode_audio?id=' . $episode->getId() . '&format=' . substr($episode->getAudioFile(), -3, 3), true), 'thumbnail' => '', 'reddit_post_url' => $episode->getRedditPostUrl() ? $episode->getRedditPostUrl() : '', 'is_nsfw' => $episode->getIsNsfw() ? 'yes' : 'no'); if ($episode->getGraphicFile()) { $new_entry['thumbnail'] = rtrim(ProjectConfiguration::getApplicationAmazonCloudFrontUrl(), '/') . '/upload/' . $episode->getGraphicFile(); } $feedArray['entries'][] = $new_entry; } return $feedArray; }