index.php 903 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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>';
  12. foreach($files AS $n=>$f) {
  13. echo '<p>'.$n.') '.$f[0].' &nbsp; <a href="'.$f[1].'">PDF</a> &nbsp; <small><a href="show_code.php?filename='.$f[1].'">PHP</a></small></p>';
  14. }
  15. echo '</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. }
  32. ?>