/** * Build basic metadata object * * @return mixed */ public function defaults() { $this->set('name', basename($this->get('localPath'))); // Directory path within repo if (dirname($this->get('localPath')) !== '.') { $this->set('dirname', dirname($this->get('localPath'))); } if ($this->exists() && is_dir($this->get('fullPath'))) { $this->set('type', 'folder'); } else { $this->set('type', 'file'); $this->set('ext', Helpers\Html::getFileExtension($this->get('localPath'))); } }
// Archival package? if (file_exists($archive) && $publication->base == 'databases') { $supli[] = ' <li class="archival-package"><a href="' . Route::url($publication->link('serve') . '&render=archive') . '" title="' . Lang::txt('COM_PUBLICATIONS_DOWNLOAD_ARCHIVE_PACKAGE') . '">' . Lang::txt('COM_PUBLICATIONS_ARCHIVE_PACKAGE') . '</a></li>' . "\n"; $docs++; } if ($children) { foreach ($children as $child) { $docs++; $child->title = $child->title ? stripslashes($child->title) : ''; $child->title = str_replace('"', '"', $child->title); $child->title = str_replace('&', '&', $child->title); $child->title = str_replace('&', '&', $child->title); $child->title = str_replace('&quot;', '"', $child->title); $params = new \Hubzero\Config\Registry($child->params); $serveas = $params->get('serveas'); $ftype = $child->type == 'file' ? \Components\Projects\Helpers\Html::getFileExtension($child->path) : 'supporting'; $class = $params->get('class', $ftype); $doctitle = $params->get('title', $child->title); // Things we want to highlight $toShow = array('iTunes', 'iTunes U', 'Syllabus', 'Audio', 'Video', 'Slides'); $url = Route::url($publication->link('serve') . '&a=' . $child->id); $extra = ''; switch ($serveas) { case 'download': default: break; case 'external': $extra = ' rel="external"'; break; case 'inlineview': $class = 'play';
/** * Check for required formats * * @return object */ public function checkRequired($attachments, $formats = array()) { if (empty($attachments)) { return true; } if (empty($formats)) { return true; } $i = 0; foreach ($attachments as $attach) { $file = isset($attach->path) ? $attach->path : $attach; $ext = \Components\Projects\Helpers\Html::getFileExtension($file); if ($ext && in_array(strtolower($ext), $formats)) { $i++; } } if ($i < count($formats)) { return false; } return true; }
/** * Is tar zip? * * @return boolean */ protected function _isTar($file) { $ext = Helpers\Html::getFileExtension($file); return in_array($ext, array('tar', 'gz')) ? true : false; }