src/bbn/ide/directories.php
public function real_to_id($file){
    $timer = new bbn\util\timer();
    $timer->start('real_to_id');
    $url = self::real_to_url($file);
    $dir = self::dir(self::dir_from_url($url));
    if ( !empty($dir) &&
      \defined($dir['bbn_path'])
    ){
      $bbn_p = constant($dir['bbn_path']);
      if ( strpos($file, $bbn_p) === 0 ){
        $f = substr($file, \strlen($bbn_p));
        $timer->stop('real_to_id');
        bbn\x::log($timer->results(), "directories");
        return bbn\str::parse_path($dir['bbn_path'].'/'.$f);
      }
    }

    // OLD VERSION
    /*
    $dirs = $this->dirs();
    $len = 0;
    $bbn_path = '';
    $f = '';
    foreach ( $dirs as $i => $d ){
      if ( !empty($d['bbn_path']) ){
        $bbn_p = constant($d['bbn_path']);
        if ( strpos($file, $bbn_p) === 0 ){
          $p = substr($file, \strlen($bbn_p));
          if ( strpos($p, $d['code']) === 0 ){
            die(var_dump($file, $bbn_p, $p));
            $len_tmp = \count(explode('/', $d['code']));
            if ( $len_tmp > $len ){
              $len = $len_tmp;
              $bbn_path = $d['bbn_path'];
              $f = $p;
            }
          }
        }
      }
    }
    return bbn\str::parse_path($bbn_path.'/'.$f);
    */
  }
public function real_to_id($file){
    $timer = new bbn\util\timer();
    $timer->start('real_to_id');
    $url = self::real_to_url($file);
    $dir = self::dir(self::dir_from_url($url));
    if ( !empty($dir) &&
      \defined($dir['bbn_path'])
    ){
      $bbn_p = constant($dir['bbn_path']);
      if ( strpos($file, $bbn_p) === 0 ){
        $f = substr($file, \strlen($bbn_p));
        $timer->stop('real_to_id');
        bbn\x::log($timer->results(), "directories");
        return bbn\str::parse_path($dir['bbn_path'].'/'.$f);
      }
    }

    // OLD VERSION
    /*
    $dirs = $this->dirs();
    $len = 0;
    $bbn_path = '';
    $f = '';
    foreach ( $dirs as $i => $d ){
      if ( !empty($d['bbn_path']) ){
        $bbn_p = constant($d['bbn_path']);
        if ( strpos($file, $bbn_p) === 0 ){
          $p = substr($file, \strlen($bbn_p));
          if ( strpos($p, $d['code']) === 0 ){
            die(var_dump($file, $bbn_p, $p));
            $len_tmp = \count(explode('/', $d['code']));
            if ( $len_tmp > $len ){
              $len = $len_tmp;
              $bbn_path = $d['bbn_path'];
              $f = $p;
            }
          }
        }
      }
    }
    return bbn\str::parse_path($bbn_path.'/'.$f);
    */
  }
public function real_to_id ( $ file ) { $ timer = new bbn \ util \ timer ( ) ; $ timer -> start ( 'real_to_id' ) ; $ url = self :: real_to_url ( $ file ) ; $ dir = self :: dir ( self :: dir_from_url ( $ url ) ) ; if ( ! empty ( $ dir ) && \ defined ( $ dir [ 'bbn_path' ] ) ) { $ bbn_p = constant ( $ dir [ 'bbn_path' ] ) ; if ( strpos ( $ file , $ bbn_p ) === 0 ) { $ f = substr ( $ file , \ strlen ( $ bbn_p ) ) ; $ timer -> stop ( 'real_to_id' ) ; bbn \ x :: log ( $ timer -> results ( ) , "directories" ) ; return bbn \ str :: parse_path ( $ dir [ 'bbn_path' ] . '/' . $ f ) ; } } // OLD VERSION /*
    $dirs = $this->dirs();
    $len = 0;
    $bbn_path = '';
    $f = '';
    foreach ( $dirs as $i => $d ){
      if ( !empty($d['bbn_path']) ){
        $bbn_p = constant($d['bbn_path']);
        if ( strpos($file, $bbn_p) === 0 ){
          $p = substr($file, \strlen($bbn_p));
          if ( strpos($p, $d['code']) === 0 ){
            die(var_dump($file, $bbn_p, $p));
            $len_tmp = \count(explode('/', $d['code']));
            if ( $len_tmp > $len ){
              $len = $len_tmp;
              $bbn_path = $d['bbn_path'];
              $f = $p;
            }
          }
        }
      }
    }
    return bbn\str::parse_path($bbn_path.'/'.$f);
    */ }
Returns the file's ID from the real file's path.

@param string $file The real file's path
@todo Fix the slowness!
@return bool|string
Returns the file s ID from the real file s path .