/** * Save the podcast * * @param array $data File data to upload, if null then we're just setting attribute * @return bool * * @throws InvalidPodcastFileException|IOException */ public function save($data = NULL) { if (!parent::save()) { return FALSE; } // New Podcast File Data if ($data) { $this->simpletype = "audio"; // Get mimetype $mime_type = ElggPodcast::detectMimeType($data['tmp_name'], $data['type']); // Check for valid mime type if (ElggPodcast::checkValidMimeType($mime_type)) { // Set it $this->setMimeType($mime_type); } else { // Invalid, fail $ex = elgg_echo('InvalidPodcastFileException:InvalidMimeType', array($mime_type)); throw new InvalidPodcastFileException($ex); } // Remove old file if it exists $old_file = $this->getFilenameOnFilestore(); if (file_exists($old_file) && !is_dir($old_file)) { unlink($old_file); } // Save the file data $this->savePodcastFile($data); // Populate metadata $this->populatePodcastMetadata(); } return TRUE; }
if ($comments_count != 0) { $text = elgg_echo("comments") . " ({$comments_count})"; $comments_link = elgg_view('output/url', array('href' => $file->getURL() . '#file-comments', 'text' => $text, 'is_trusted' => true)); } else { $comments_link = ''; } $metadata = elgg_view_menu('entity', array('entity' => $vars['entity'], 'handler' => 'file', 'sort_by' => 'priority', 'class' => 'elgg-menu-hz')); $subtitle = "{$author_text} {$date} {$comments_link} {$categories}"; // do not show the metadata and controls in widget view if (elgg_in_context('widgets')) { $metadata = ''; } // Check if this file is playable with podcast player elgg_load_library('elgg:podcasts'); $mimetype = podcasts_get_mime_type($file->getFilenameOnFilestore()); if (ElggPodcast::checkValidMimeType($mimetype)) { // Load JS/CSS elgg_load_js('elgg.podcasts'); elgg_load_js('soundmanager2'); elgg_load_css('elgg.podcasts'); if (!$file->duration) { podcasts_populate_file_info($file); } $player = elgg_view('podcasts/player', array('entity_guid' => $file->guid)); } if ($full && !elgg_in_context('gallery')) { $extra = ''; if (elgg_view_exists("file/specialcontent/{$mime}")) { $extra = elgg_view("file/specialcontent/{$mime}", $vars); } else { if (elgg_view_exists("file/specialcontent/{$base_type}/default")) {