コード例 #1
0
ファイル: ClassLoader.php プロジェクト: runeimp/stf
 public static function load($name)
 {
     // echo __METHOD__."('$name')\n";
     self::$load_trace = debug_backtrace();
     $name = str_replace('\\', '/', $name);
     $pathInfo = pathinfo($name);
     // print_r($pathInfo); echo "\n";
     $namespace = $pathInfo['dirname'];
     $class = $pathInfo['filename'];
     if ($namespace == '.') {
         $namespace = '';
     } else {
         if ($namespace[0] == '/') {
             $namespace = substr($namespace, 1);
         }
     }
     if (strlen($namespace) > 1 || $namespace == '.') {
         $namespace .= '/';
     }
     // echo '$namespace: '.$namespace."<br>\n";
     // echo '$class: '.$class."<br>\n";
     $fixes = array('class', 'lib', 'inc');
     $extensions = array('.php');
     // , '.inc', '.php3' etc.
     $result = self::cache_check($name);
     if ($result === false) {
         $result = self::search($namespace, $class, $fixes, $extensions, $name);
     }
     if ($result === false) {
         $lowerClass = strtolower($class);
         if ($class != $lowerClass) {
             $result = self::search($namespace, $lowerClass, $fixes, $extensions, $name);
         }
     }
     if ($result === false) {
         $upperClass = strtoupper($class);
         if ($class != $upperClass) {
             $result = self::search($namespace, $upperClass, $fixes, $extensions, $name);
         }
     }
     if ($result === false) {
         $msg = "Unable to load \"{$name}\".\n";
         $msg .= Util::loop(self::$load_trace);
         // header('Content-Type: text/plain');
         // throw new ClassLoader_Exception($msg);
     } else {
         include $result;
     }
 }
コード例 #2
0
ファイル: STURL.php プロジェクト: runeimp/stf
 public function __toString()
 {
     // return $this->signature.' - Data: '.substr(Util::loop($this->data), 6)."\nHTTP Method: {$this->http_method}\n";
     return $this->signature . ' - Data: ' . Util::loop($this->data) . "\nHTTP Method: " . $this->getMethod() . "\n";
 }