2016-04-23 18:13:44 +00:00
|
|
|
|
|
|
|
<?php
|
|
|
|
$path = '..';
|
|
|
|
$subtitle = ': Gallery';
|
|
|
|
$language = '';
|
|
|
|
|
|
|
|
if ( !empty($_GET['lan']) ) {
|
|
|
|
if (file_exists('README-'.$_GET['lan'].'.md')) {
|
|
|
|
$language = '-'.$_GET['lan'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
include('../header.php');
|
|
|
|
include('../chap-header.php');
|
2016-04-24 18:02:16 +00:00
|
|
|
|
2016-04-23 20:21:36 +00:00
|
|
|
echo '<link type="text/css" rel="stylesheet" href="gallery.css">';
|
2016-04-23 18:13:44 +00:00
|
|
|
echo '<div id="content">';
|
|
|
|
|
|
|
|
include($path.'/src/parsedown/Parsedown.php');
|
|
|
|
$Parsedown = new Parsedown();
|
|
|
|
|
|
|
|
echo $Parsedown->text(file_get_contents('README'.$language.'.md'));
|
|
|
|
|
2016-04-23 23:57:01 +00:00
|
|
|
if (empty($_GET)) {
|
|
|
|
// Load all the chapters
|
|
|
|
$dirs = array_filter(glob('../??/'), 'is_dir');
|
|
|
|
foreach ($dirs as &$folder) {
|
|
|
|
$chp = '';
|
|
|
|
preg_match("/\.\.\/(\d\d)\//", $folder, $matches);
|
|
|
|
if (count($matches) > 0) {
|
|
|
|
$chp = $matches[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
if (file_exists($folder.'TITLE'.$language.'.md') and file_exists($folder.'SUMMARY'.$language.'.md')) {
|
|
|
|
echo '<a href="'.$folder.'">';
|
|
|
|
echo $Parsedown->text(file_get_contents($folder.'TITLE'.$language.'.md'));
|
|
|
|
echo '</a>';
|
|
|
|
|
|
|
|
if (file_exists($folder.'SUMMARY'.$language.'.md')) {
|
|
|
|
echo $Parsedown->text(file_get_contents($folder.'SUMMARY'.$language.'.md'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$shaders = array_reverse(glob($folder.'*.frag'));
|
|
|
|
$shadersTotal = min(count($shaders), 3);
|
|
|
|
|
|
|
|
if ($shadersTotal > 0) {
|
|
|
|
echo '<div class="glslGallery" data="';
|
|
|
|
for ($i = 0; $i < $shadersTotal; $i++) {
|
|
|
|
echo $chp.'/'.basename($shaders[$i], '.frag');
|
|
|
|
if ($i != $shadersTotal-1) {
|
|
|
|
echo ',';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo '" data-properties="clickRun:edior,hoverPreview:false,showAuthor:false,openFrameIcon:false"></div>';
|
|
|
|
}
|
2016-04-24 18:02:16 +00:00
|
|
|
|
2016-04-23 23:57:01 +00:00
|
|
|
if (file_exists($folder.'featured_examples.php') and file_exists('FEATURED'.$language.'.md')) {
|
|
|
|
include($folder.'featured_examples.php');
|
2016-04-24 19:35:58 +00:00
|
|
|
$shadersTotal += 3;
|
2016-04-23 23:57:01 +00:00
|
|
|
}
|
|
|
|
|
2016-04-24 19:35:58 +00:00
|
|
|
if ($shadersTotal > 3) {
|
|
|
|
echo '<p class="more"><a href="/examples/?chapter='.$chp.'">more</a></p>';
|
|
|
|
}
|
2016-04-23 23:57:01 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} elseif ( !empty($_GET['chapter'])) {
|
|
|
|
$chp = $_GET['chapter'];
|
|
|
|
$folder = '../'.$chp.'/';
|
2016-04-24 18:02:16 +00:00
|
|
|
|
2016-04-23 18:13:44 +00:00
|
|
|
if (file_exists($folder.'TITLE'.$language.'.md') and file_exists($folder.'SUMMARY'.$language.'.md')) {
|
|
|
|
echo $Parsedown->text(file_get_contents($folder.'TITLE'.$language.'.md'));
|
|
|
|
|
|
|
|
if (file_exists($folder.'SUMMARY'.$language.'.md')) {
|
|
|
|
echo $Parsedown->text(file_get_contents($folder.'SUMMARY'.$language.'.md'));
|
|
|
|
}
|
|
|
|
|
|
|
|
$shaders = array_reverse(glob($folder.'*.frag'));
|
|
|
|
$shadersTotal = count($shaders);
|
|
|
|
|
|
|
|
if ($shadersTotal > 0) {
|
|
|
|
echo '<div class="glslGallery" data="';
|
|
|
|
for ($i = 0; $i < $shadersTotal; $i++) {
|
2016-04-23 23:57:01 +00:00
|
|
|
echo $chp.'/'.basename($shaders[$i], '.frag');
|
|
|
|
if ($i != $shadersTotal-1) {
|
|
|
|
echo ',';
|
2016-04-23 18:13:44 +00:00
|
|
|
}
|
|
|
|
}
|
2016-04-23 23:57:01 +00:00
|
|
|
echo '" data-properties="clickRun:edior,showAuthor:false,openFrameIcon:false"></div>';
|
2016-04-23 18:13:44 +00:00
|
|
|
}
|
2016-04-24 18:02:16 +00:00
|
|
|
|
2016-04-23 18:13:44 +00:00
|
|
|
|
|
|
|
if (file_exists($folder.'featured_examples.php') and file_exists('FEATURED'.$language.'.md')) {
|
|
|
|
echo $Parsedown->text(file_get_contents('FEATURED'.$language.'.md'));
|
|
|
|
include($folder.'featured_examples.php');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2016-04-24 18:02:16 +00:00
|
|
|
|
2016-04-23 18:13:44 +00:00
|
|
|
echo '
|
|
|
|
</div>
|
|
|
|
<script>console.log();</script>
|
|
|
|
<hr>
|
|
|
|
<ul class="navigationBar" >
|
|
|
|
<li class="navigationBar" onclick="window.location.href=\'../\'"> Home </li>
|
|
|
|
</ul>';
|
|
|
|
|
|
|
|
include("../footer.php");
|
|
|
|
|
2015-07-15 12:12:44 +00:00
|
|
|
?>
|