Skip to content

Commit

Permalink
Updated image order
Browse files Browse the repository at this point in the history
Pushed app updates
  • Loading branch information
kolber committed Sep 15, 2009
1 parent 1a2c902 commit c5fbb1a
Show file tree
Hide file tree
Showing 59 changed files with 10 additions and 48 deletions.
54 changes: 8 additions & 46 deletions app/stacey.inc.php
Expand Up @@ -22,13 +22,13 @@ function render_404() {
}

function handle_redirects() {
// if page does not end in a trailing slash, add one
if(preg_match("/index\/?$/", $_SERVER["REQUEST_URI"])) {
header("HTTP/1.1 301 Moved Permanently");
header('Location: ../');
return true;
}

// if page does not end in a trailing slash, add one
if(!preg_match("/\/$/", $_SERVER["REQUEST_URI"])) {
header("HTTP/1.1 301 Moved Permanently");
header('Location:'.$_SERVER["REQUEST_URI"]."/");
Expand All @@ -47,6 +47,7 @@ function handle_redirects() {

function render() {
if($this->handle_redirects()) return;

if(!$this->page->content_file || !$this->page->template_file) {
if($this->page->public_file) echo file_get_contents($this->page->public_file);
else $this->render_404();
Expand Down Expand Up @@ -358,15 +359,15 @@ function preparse($text) {
'/\\\x02/',
# automatically link http:// websites
'/(?<!")http&#58;\/\/([\S]+\.[\S]*\.?[A-Za-z0-9]{2,4})/',
# automatically link email addresses
'/(?<![;>])\b([A-Za-z0-9.-]+)@([A-Za-z0-9.-]+\.[A-Za-z]{2,4})/',
# convert lists
'/\n?-(.+?)(?=\n)/',
'/(<li>.*<\/li>)/',
# wrap multi-line text in paragraphs
'/([^\n]+?)(?=\n)/',
'/<p>(.+):(.+)<\/p>/',
'/: (.+)(?=\n<p>)/',
# automatically link email addresses
'/([A-Za-z0-9.-]+)@([A-Za-z0-9.-]+\.[A-Za-z]{2,4})/',
);
$replacements = array(
# replace inline colons
Expand All @@ -379,15 +380,15 @@ function preparse($text) {
'-',
# automatically link http:// websites
'<a href="http&#58;//$1">http&#58;//$1</a>',
# automatically link email addresses
'<a href="mailto&#58;$1&#64;$2">$1&#64;$2</a>',
# convert lists
'<li>$1</li>',
'<ul>$1</ul>',
# wrap multi-line text in paragraphs
'<p>$1</p>',
'$1:$2',
':<p>$1</p>',
# automatically link email addresses
'<a href="mailto&#58;$1&#64;$2">$1&#64;$2</a>',
);
$parsed_text = preg_replace($patterns, $replacements, $text);
return $parsed_text;
Expand Down Expand Up @@ -436,7 +437,7 @@ class TemplateParser {
var $replacements;

function create_replacement_partials() {
$p = new aeProjectsPartial;
$p = new ProjectsPartial;
$i = new ImagesPartial;
$n = new NavigationPartial;
$partials[] = $p->render($this->page);
Expand Down Expand Up @@ -508,7 +509,7 @@ function render($page) {

asort($files, SORT_NUMERIC);
$html .= $wrappers[0];
#$p = new aeProjectsPartial;
#$p = new ProjectsPartial;
foreach($files as $key => $file) {
$html .= preg_replace(array_keys($file_vars[$key]), array_values($file_vars[$key]), $wrappers[1]);
#if(preg_match('/projects$/', $file)) $html .= $p->render($this->page);
Expand Down Expand Up @@ -555,45 +556,6 @@ function render($page) {

}

class aeProjectsPartial extends ProjectsPartial {

function render($page) {
$this->page = $page;
$this->dir = "../content/".$page->projects_folder_unclean;
$wrappers = $this->parse($this->partial_file);

$html = array('<div class="column delimit"><h4>Column 1</h4>', '<div class="column delimit"><h4>Column 2</h4>', '<div class="column delimit"><h4>Column 3</h4>');

if(is_dir($this->dir)) {
if($dh = opendir($this->dir)) {
while (($file = readdir($dh)) !== false) {
if(!is_dir($file) && file_exists($this->dir."/".$file."/content.txt")) {
$files[] = $file;
$vars = array(
"/@url/" => $this->page->link_path."projects/".preg_replace('/^\d+?\./', '', $file)."/",
"/@thumb/" => $this->check_thumb($this->dir, $file)
);
$c = new ContentParser;
$project_page = new MockProject($file);
$file_vars[] = array_merge($vars, $c->parse($project_page));
}
}
}
closedir($dh);
asort($files, SORT_NUMERIC);
foreach($html as $key => $html_item) $html[$key] = $html_item .= $wrappers[0];
$i = 0;
foreach($files as $key => $file) {
$html[($i % 3)] .= preg_replace(array_keys($file_vars[$key]), array_values($file_vars[$key]), $wrappers[1]);
$i++;
}
foreach($html as $key => $html_item) $html[$key] = $html_item .= $wrappers[2]."</div>";
}

return "${html[0]} ${html[1]} ${html[2]}";
}
}

class ProjectsPartial extends Partial {

var $dir;
Expand Down
Diff not rendered.
Diff not rendered.
4 changes: 2 additions & 2 deletions templates/index.html
@@ -1,8 +1,8 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Aesthetically Loyal - The Graphic Design Portfolio of @name</title>
<meta name="description" content="A collection of the Graphic Design work of @name (Melbourne, Australia) created between 2005 and @Year.">
<title>The Graphic Design Portfolio of @name</title>
<meta name="description" content="A Graphic Design portfolio from Melbourne, Australia. Features selected graphic design projects created between 2005 and 2007. Holla.">
<meta name="keywords" content="portfolio, design, graphic design, print, web, melbourne, australia">
<meta name="designer" content="Anthony Kolber">
<meta name="robots" content="index, follow">
Expand Down

0 comments on commit c5fbb1a

Please sign in to comment.