Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. <?php
  2. namespace autoloader;
  3.  
  4. function _autoload( $is_admin = false ){
  5.  
  6. if( $is_admin == 1 )
  7. $is_admin = 'admin/';
  8.  
  9. foreach ( glob( self::$plugin_obj->include_path . $is_admin . '*.class.php' ) as $k => $file ) {
  10.  
  11. $s = self::$plugin_obj->include_path . $is_admin . "(#.*?).class.php";
  12.  
  13. preg_match_all( '/' . str_replace( array( '/', '.', '#\.' ), array( '\/', '\.', '.' ), $s ) . "$/" , $file, $match );
  14.  
  15. require_once( $match[0][0] );
  16.  
  17. $class = __NAMESPACE__ . '\\' . $match[1][0];
  18. new $class();
  19.  
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement