diff --git a/favicon.png b/favicon.png new file mode 100644 index 0000000..35ab5e1 Binary files /dev/null and b/favicon.png differ diff --git a/image/background-acrobatics.jpg b/image/background-acrobatics.jpg new file mode 100644 index 0000000..f9ff12a Binary files /dev/null and b/image/background-acrobatics.jpg differ diff --git a/image/background-archery.jpg b/image/background-archery.jpg new file mode 100644 index 0000000..7c9f8a1 Binary files /dev/null and b/image/background-archery.jpg differ diff --git a/image/background-edged-weapons.jpg b/image/background-edged-weapons.jpg new file mode 100644 index 0000000..bce80ce Binary files /dev/null and b/image/background-edged-weapons.jpg differ diff --git a/image/background-join.jpg b/image/background-join.jpg new file mode 100644 index 0000000..1b840f9 Binary files /dev/null and b/image/background-join.jpg differ diff --git a/image/background-martial-art-for-kids.jpg b/image/background-martial-art-for-kids.jpg new file mode 100644 index 0000000..d7f428a Binary files /dev/null and b/image/background-martial-art-for-kids.jpg differ diff --git a/image/background-martial-art.jpg b/image/background-martial-art.jpg new file mode 100644 index 0000000..f7bdaf0 Binary files /dev/null and b/image/background-martial-art.jpg differ diff --git a/image/background-pakua.jpg b/image/background-pakua.jpg new file mode 100644 index 0000000..394afc3 Binary files /dev/null and b/image/background-pakua.jpg differ diff --git a/image/background-school.jpg b/image/background-school.jpg new file mode 100644 index 0000000..f931d7e Binary files /dev/null and b/image/background-school.jpg differ diff --git a/image/people-alejandro_perez.jpg b/image/people-alejandro_perez.jpg new file mode 100644 index 0000000..c067a98 Binary files /dev/null and b/image/people-alejandro_perez.jpg differ diff --git a/image/people-john_waugh.jpg b/image/people-john_waugh.jpg new file mode 100644 index 0000000..d1026c5 Binary files /dev/null and b/image/people-john_waugh.jpg differ diff --git a/image/people-kasia_bukowska.jpg b/image/people-kasia_bukowska.jpg new file mode 100644 index 0000000..137daf8 Binary files /dev/null and b/image/people-kasia_bukowska.jpg differ diff --git a/image/people-rodolfo_oliva.jpg b/image/people-rodolfo_oliva.jpg new file mode 100644 index 0000000..29bfca0 Binary files /dev/null and b/image/people-rodolfo_oliva.jpg differ diff --git a/image/people-simon_lamb.jpg b/image/people-simon_lamb.jpg new file mode 100644 index 0000000..a8b1c1f Binary files /dev/null and b/image/people-simon_lamb.jpg differ diff --git a/image/people-tom_winch.jpg b/image/people-tom_winch.jpg new file mode 100644 index 0000000..df6ada1 Binary files /dev/null and b/image/people-tom_winch.jpg differ diff --git a/index.php b/index.php index bf73124..2de93f9 100644 --- a/index.php +++ b/index.php @@ -1,29 +1,14 @@
@@ -38,8 +23,11 @@ if (!file_exists($try_html) or !file_exists($try_json)) { '); } +function make_gallery() { + if(file_exists('gallery.html')) { + return True; + } -if(!file_exists('gallery.html')) { $flickr = json_decode(file_get_contents('flickr.json'), TRUE); $flickr['method'] = "flickr.photosets.getPhotos"; $flickr['extras'] = "media,url_m,url_l"; @@ -66,17 +54,24 @@ if(!file_exists('gallery.html')) { } $gs = ' + + + + + '; $t = sprintf( @@ -104,28 +100,81 @@ if(!file_exists('gallery.html')) { file_put_contents('gallery.html', $t); } -$stat = stat($try_html); -$meta = json_decode(file_get_contents($try_json), TRUE); -$meta['author'] = &$org; -$meta['publisher'] = &$org; -$meta['dateModified'] = date("c", $stat['mtime']); -$meta['datePublished'] = date("c", $stat['ctime']); -$meta['copyrightYear'] = date("Y", $stat['mtime']); -$meta['url'] = ('index' == $maybe) ? $site['url'] : sprintf("%s?%s", $site['url'], $maybe); -$meta['@id'] = $meta['url']; -$meta['mainEntityOfPage'] = sprintf("%s#main", $meta['url']); -if (!isset($meta['image']) or empty($meta['image'])) { - $meta['image'] = 'https://static.wixstatic.com/media/80d0c2_39d26f9a66974eadbe85d107a0bb971d~mv2.png'; +class Page { + public $name; + private $html; + private $json; + private $inserts; + + public function __construct($name) { + $this->name = $name; + $this->html = sprintf("page/%s.html", $name); + $this->json = sprintf("page/%s.json", $name); + $this->inserts = array( + 'INSERT_GALLERY_HERE' => 'gallery.html' + ); + } + + public function exists() { + if (file_exists($this->html) && file_exists($this->json)) { + return True; + } + enotfound(); + } + + public function meta() { + global $org; + global $site; + + $stat = stat($self->html); + $meta = json_decode(file_get_contents($self->json), TRUE); + print_r($meta); + $meta['author'] = &$org; + $meta['publisher'] = &$org; + $meta['dateModified'] = date("c", $stat['mtime']); + $meta['datePublished'] = date("c", $stat['ctime']); + $meta['copyrightYear'] = date("Y", $stat['mtime']); + $meta['url'] = ('index' == $maybe) ? $site['url'] : sprintf("%s?%s", $site['url'], $maybe); + $meta['@id'] = $meta['url']; + $meta['mainEntityOfPage'] = sprintf("%s#main", $meta['url']); + if (!isset($meta['image']) or empty($meta['image'])) { + $meta['image'] = $site['image']; + } + return $meta; + } + + public function content(){ + $c = file_get_contents($this->html); + foreach($this->inserts as $insert => $fname ) { + if (file_exists($fname)) { + $c = str_replace($insert, file_get_contents($fname), $c); + } + } + return $c; + } } -$content = file_get_contents($try_html); -$content = str_replace("INSERT_GALLERY_HERE", file_get_contents('gallery.html'), $content); -$meta['text'] = $content; +/* --- */ +if(empty($_GET)) { + $maybe = 'index'; +} +else { + $maybe = array_pop(array_keys($_GET)); +} +$org = json_decode(file_get_contents('org.json'), TRUE); +$site = json_decode(file_get_contents('site.json'), TRUE); $site['author'] = &$org; $site['publisher'] = &$org; $site['url'] = sprintf("%s/", rtrim($site['url'], '/')); +make_gallery(); + +$page = new Page($maybe); +$page->exists(); +$meta = $page->meta(); +$content = $page->content(); $site['mainEntity'] = &$meta; +/* --- */ ?> @@ -155,9 +204,6 @@ $site['mainEntity'] = &$meta; - - - @@ -166,63 +212,29 @@ $site['mainEntity'] = &$meta;