'; include($path.'/src/parsedown/Parsedown.php'); $Parsedown = new Parsedown(); echo $Parsedown->text(file_get_contents('README'.$language.'.md')); if (empty($_GET)) { // Load all the chapters $dirs = array_filter(glob('../*/'), 'is_dir'); foreach ($dirs as &$folder) { $chp = ''; preg_match("/\.\.\/(.+)\//", $folder, $matches); if (count($matches) > 0) { $chp = $matches[1]; } if (file_exists($folder.'TITLE'.$language.'.md') and file_exists($folder.'SUMMARY'.$language.'.md')) { if (file_exists($folder.'README.md')) { echo ''; echo $Parsedown->text(file_get_contents($folder.'TITLE'.$language.'.md')); echo ''; } else { echo $Parsedown->text(file_get_contents($folder.'TITLE'.$language.'.md')); } if (file_exists($folder.'SHORT_SUMMARY'.$language.'.md')) { echo $Parsedown->text(file_get_contents($folder.'SHORT_SUMMARY'.$language.'.md')); } else 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 '
'; } if (file_exists($folder.'featured_examples.php') and $shaderTotal == 0) { $featuredCode = file_get_contents($folder.'featured_examples.php'); preg_match_all("(\d+)", $featuredCode, $ids); if (count($ids) > 0) { echo ''; $shadersTotal = count($ids[0]); } } else if (file_exists($folder.'featured_examples.php') and file_exists('FEATURED'.$language.'.md')) { include($folder.'featured_examples.php'); $shadersTotal += 3; } if (count($shaders) > 3 or $shadersTotal > 3) { echo ''; } } } } elseif ( !empty($_GET['chapter'])) { $chp = $_GET['chapter']; $folder = '../'.$chp.'/'; 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 ''; } if (file_exists($folder.'featured_examples.php') and file_exists('FEATURED'.$language.'.md')) { if ($shadersTotal != 0) { echo $Parsedown->text(file_get_contents('FEATURED'.$language.'.md')); } include($folder.'featured_examples.php'); } } } echo '