/** * {xhub:image component="component" filename="filename"} * * @param string $options Tag options (e.g. 'component="support"') * @return string */ private function _image($options) { $regex = "/filename\\s*=\\s*(\"|")([^\"&]+)(\"|")/i"; if (!preg_match($regex, $options, $file)) { return ''; } $regex = "/component\\s*=\\s*(\"|")([^\"&]+)(\"|")/i"; if (!preg_match($regex, $options, $component)) { $regex = "/module\\s*=\\s*(\"|")([^\"&]+)(\"|")/i"; preg_match($regex, $options, $module); } if (empty($component) && empty($module)) { return ''; //substr(\Hubzero\Document\Assets::getHubImage($file[2]),1); } else { if (!empty($component)) { return substr(\Hubzero\Document\Assets::getComponentImage($component[2], $file[2]), 1); } else { if (!empty($module)) { return substr(\Hubzero\Document\Assets::getModuleImage($module[2], $file[2]), 1); } } } return ''; }
/** * Display the FORGE logo * * @return void */ public function imageTask() { $image = JPATH_SITE . \Hubzero\Document\Assets::getComponentImage($this->_option, 'forge.png', 1); if (is_readable($image)) { ob_clean(); header("Content-Type: image/png"); readfile($image); ob_end_flush(); exit; } }
/** * Display the landing page * * @return void */ public function displayTask() { include_once dirname(dirname(__DIR__)) . DS . 'models' . DS . 'tools.php'; $model = new \Components\Tools\Models\Tools(); // Get the tool list $this->view->apps = $model->getApplicationTools(); // Get the forge image $this->view->image = \Hubzero\Document\Assets::getComponentImage($this->_option, 'forge.png', 1); // Get some vars to fill in text $this->view->title = $this->_title; $live_site = rtrim(Request::base(), '/'); $slive_site = preg_replace('/^http:\\/\\//', 'https://', $live_site, 1); $this->view->forgeName = Config::get('sitename') . ' FORGE'; // Set the page title $this->_buildTitle($this->view->forgeName); // Set the pathway $this->_buildPathway(); foreach ($this->getErrors() as $error) { $this->view->setError($error); } $this->view->display(); }