path2class.func.php 481 B

12345678910111213141516
  1. <?php
  2. function path2class($path)
  3. {
  4. $temp = $path;
  5. $temp = str_replace('./', '', $temp); // remove leading './'
  6. $temp = str_replace('.\\', '', $temp); // remove leading '.\'
  7. $temp = str_replace('\\', '_', $temp); // normalize \ to _
  8. $temp = str_replace('/', '_', $temp); // normalize / to _
  9. while(strpos($temp, '__') !== false) $temp = str_replace('__', '_', $temp);
  10. $temp = str_replace('.php', '', $temp);
  11. return $temp;
  12. }
  13. // vim: et sw=4 sts=4