Esempio n. 1
0
File: routes.php Progetto: nob/joi
     // actual file exists
 } elseif (File::exists("{$content_root}/{$path}.{$content_type}")) {
     $add_prev_next = true;
     $template_list[] = 'post';
     $page = basename($path);
     $data = Content::get($complete_current_url);
     $data['current_url'] = $current_url;
     $data['slug'] = basename($current_url);
     if ($path !== "404") {
         $content_found = true;
     }
     // url is taxonomy-based
 } elseif (Taxonomy::isTaxonomyURL($path)) {
     list($type, $slug) = Taxonomy::getCriteria($path);
     // create data array
     $data = array_merge(Config::getAll(), array('homepage' => Config::getSiteRoot(), 'raw_url' => Request::getResourceURI(), 'page_url' => Request::getResourceURI(), 'taxonomy_slug' => urldecode($slug), 'taxonomy_name' => Taxonomy::getTaxonomyName($type, $slug)));
     $template_list[] = "taxonomies";
     $template_list[] = $type;
     $content_found = true;
     // this is a directory,so we look for page.md
 } elseif (is_dir("{$content_root}/{$path}")) {
     $data = Content::get($complete_current_url);
     $content_found = true;
 }
 // Nothing found. 404 O'Clock.
 if (!$content_found || $requesting_xml && (!isset($data['_type']) || $data['_type'] != 'xml')) {
     // determine where user came from for log message
     if (strstr($path, 'favicon.ico')) {
         // Favicons are annoying.
         Log::info("The site favicon could not be found.", "site", "favicon");
     } else {
Esempio n. 2
0
        if ($path !== "/404") {
            $content_found = true;
        }

    // url is taxonomy-based
    } elseif (Taxonomy::isTaxonomyURL($path)) {
        list($type, $slug) = Taxonomy::getCriteria($path);

        // create data array
        $data = array_merge(Config::getAll(), array(
            'homepage'       => Config::getSiteRoot(),
            'raw_url'        => Request::getResourceURI(),
            'page_url'       => Request::getResourceURI(),
            'taxonomy_slug'  => urldecode($slug),
            'taxonomy_name'  => Taxonomy::getTaxonomyName($type, $slug)
        ));

        $template_list[] = "taxonomies";
        $template_list[] = $type;
        $content_found = true;
    }

    
    // content was found
    if ($content_found) {
        // mark milestone for debug panel
        Debug::markMilestone('content found');
        
        // protect
        if (is_array($data) && $data) {
     $page = basename($path);
     $data['current_url'] = $current_url;
     $data['slug'] = basename($current_url);
     // if this is an entry, default to the `post` template
     if ($data['_is_entry']) {
         $template_list[] = array_get($data, '_template', 'default');
         $template_list[] = "post";
     }
     if ($path !== "/404") {
         $content_found = true;
     }
     // url is taxonomy-based
 } elseif (Taxonomy::isTaxonomyURL($path)) {
     $taxonomy = Taxonomy::getCriteria($path);
     // create data array
     $data = array_merge(Config::getAll(), array('homepage' => Config::getSiteRoot(), 'raw_url' => Request::getResourceURI(), 'page_url' => Request::getResourceURI(), 'taxonomy_slug' => $taxonomy['slug'], 'taxonomy_name' => Taxonomy::getTaxonomyName($taxonomy['type'], $taxonomy['slug'])));
     $template_list[] = "taxonomies";
     $template_list[] = $taxonomy['type'];
     if (!$taxonomy['slug']) {
         $template_list[] = "taxonomy-index";
         $template_list[] = $taxonomy['type'] . "-index";
     }
     $content_found = true;
 }
 // content was found
 if ($content_found) {
     // mark milestone for debug panel
     Debug::markMilestone('content found');
     // protect
     if (is_array($data) && $data) {
         try {