protected function set_body_data() { $this->set_body('body_view', 'Resume'); $resumePath = Loader::getRootURL('portfolio') . "/jsonresume/{$this->resume}"; $resume = file_get_contents($resumePath); $resume = json_decode($resume, true); $this->set_body('body_data', $resume); parent::set_body_data(); }
protected function get_menu() { $menu = [['name' => 'About', 'link' => Loader::getRootURL()], ['name' => 'Projects', 'link' => Loader::getRootURL() . 'projects/'], ['name' => 'Résumé', 'link' => Loader::getRootURL() . 'resume/'], ['name' => 'Contact', 'link' => Loader::getRootURL() . 'contact/']]; if (!URLDecode::getPiece(1)) { $active_page = 'About'; } else { $active_page = ucfirst(URLDecode::getPiece(1)); } return array_map(function ($row) use($active_page) { $row = (object) $row; $row->active = $row->name == $active_page; return $row; }, $menu); }
private function get_thumb($string, $is_absolute, $size) { list($category, $file_name) = explode('/', $string); list($photo, $extension) = explode('.', $file_name); $file_path = $this->get_file_path($category, $photo, $size, $extension); $file_size = getimagesize($file_path); Loader::load('collector', 'image/PhotoCollector'); $photo_result = PhotoCollector::fetchRow($category, $photo); if ($photo_result == false) { return ''; } $height = $file_size[1]; $width = $file_size[0]; $description = $photo_result->description; $domain = '/'; if ($is_absolute) { $domain = Loader::getRootURL(URLDecode::getSite()); } return sprintf(self::$IMAGE_NODE, $domain, $category, $photo, $size, $extension, $height, $width, $description); }
<div id="top"> <h1><a href="<?php echo Loader::getRootURL(); ?> ">About</a><? if(isset($title)) : ?> <span>/</span> <?php echo $title; ?> <? endif ?></h1> </div>
private function get_log_introduction($log) { return array( 'title' => $log->title, 'url' => Loader::getRootURL('waterfalls') . self::$JOURNAL_DIRECTORY . '/' . $log->alias . '/', 'date' => $this->get_parsed_date($log->date), 'publish_date' => $this->get_parsed_date($log->publish_date), 'introduction' => $log->introduction, 'image' => sprintf( self::$MEDIUM_IMAGE_NODE, $log->image_category, $log->image_name, $log->image_description), 'author' => self::$AUTHOR, 'author_url' => self::$AUTHOR_URL, ); }
private function get_link($string, $is_absolute, $anchor = '') { list($type, $uri) = explode('/', $string, 2); $link = ''; switch($type) { case 'blog' : global $container; $repository = new Jacobemerick\Web\Domain\Blog\Post\MysqlPostRepository($container['db_connection_locator']); $post = $repository->findPostByPath($uri); if($post === NULL) return; $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; $link .= "{$post['category']}/{$post['path']}/"; if($anchor == '') $anchor = $post['title']; break; case 'blog-tag' : $link .= ($is_absolute) ? Loader::getRootURL('blog') : '/'; $link .= "tag/{$uri}/"; if($anchor == '') { $anchor = $uri; $anchor = str_replace('-', ' ', $anchor); $anchor = ucwords($anchor); } break; case 'journal' : Loader::load('collector', 'waterfall/LogCollector'); $log = LogCollector::getByAlias($uri); if($log === NULL) return; $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; $link .= "journal/{$log->alias}/"; if($anchor == '') $anchor = $log->title; break; case 'falls' : $pieces = explode('/', $uri); if (count($pieces) == 1) { Loader::load('collector', 'waterfall/WatercourseCollector'); list ($watercourse_alias) = $pieces; $watercourse = WatercourseCollector::getByAlias($watercourse_alias); if ($watercourse == null) { return; } $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; $link .= "{$watercourse->alias}/"; if ($anchor == '') { $anchor = $watercourse->name; } } else if (count($pieces) == 2) { Loader::load('collector', 'waterfall/WaterfallCollector'); list ($watercourse_alias, $waterfall_alias) = $pieces; $waterfall = WaterfallCollector::getByAlias($watercourse_alias, $waterfall_alias); if ($waterfall == null) { return; } $link .= ($is_absolute) ? Loader::getRootURL('waterfalls') : '/'; $link .= "{$waterfall->watercourse_alias}/{$waterfall->alias}/"; if ($anchor == '') { $anchor = $waterfall->name; } } break; default : break; } return sprintf(self::$LINK_CONTENT, $link, $anchor); }