index.php 799 B

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. $ff = scandir('./');
  3. sort($ff);
  4. $files = array();
  5. foreach ($ff AS $f) {
  6. if (preg_match('/example[0]{0,1}(\d+)_(.*?)\.php/',$f,$m)) {
  7. $num = intval($m[1]);
  8. $files[$num] = array(ucfirst(preg_replace('/_/',' ',$m[2])), $m[0]);
  9. }
  10. }
  11. echo '<html><body><h3>mPDF Example Files</h3><ol>';
  12. foreach ($files AS $n => $f) {
  13. echo '<li value="'.$n.'"><a href="' . $f[1] . '">' . $f[0] . '</a>';
  14. }
  15. echo '</ol></body></html>';
  16. exit;
  17. // For PHP4 compatability
  18. if (!function_exists('scandir')) {
  19. function scandir($dir = './', $sort = 0) {
  20. $dir_open = @ opendir($dir);
  21. if (! $dir_open)
  22. return false;
  23. while (($dir_content = readdir($dir_open)) !== false)
  24. $files[] = $dir_content;
  25. if ($sort == 1)
  26. rsort($files, SORT_STRING);
  27. else
  28. sort($files, SORT_STRING);
  29. return $files;
  30. }
  31. }