src/bbn/ide/directories.php
public function url_to_real($url){
    if ( ($dn = $this->dir_from_url($url)) &&
      ($dir = $this->dir($dn)) &&
      ($res = $this->get_root_path($dn))
    ){
      $bits = explode('/', substr($url, \strlen($dn), \strlen($url)));
      if ( !empty($dir['tabs']) && !empty($bits) ){
        // Tab's nane
        $tab = array_pop($bits);
        // File's name
        $fn = array_pop($bits);
        // File's path
        $fp = implode('/', $bits).'/';
        // Check if the file is a superior super-controller
        $ssc = $this->superior_sctrl($tab, $fp);
        $tab = $ssc['tab'];
        $fp = $ssc['path'];
        if ( !empty($dir['tabs'][$tab]) ){
          $tab = $dir['tabs'][$tab];
          $res .= $tab['path'];
          if ( !empty($tab['fixed']) ){
            $res .= $fp . $tab['fixed'];
          }
          else {
            $res .= $fp . $fn;
            $ext_ok = false;
            foreach ( $tab['extensions'] as $e ){
              $ext = '.' . $e['ext'];
              if ( is_file($res . $ext) ){
                $res .= $ext;
                $ext_ok = true;
                break;
              }
            }
            if ( empty($ext_ok) ){
              $res .= '.' . $tab['extensions'][0]['ext'];
            }
          }
        }
        else {
          return false;
        }
      }
      else {
        // Remove the last element of the path if it's 'code' (it's the tab's URL in a non MVC architecture)
        if ( end($bits) === 'code' ){
          array_pop($bits);
        }
        $res .= implode('/', $bits);
      }
      return bbn\str::parse_path($res);
    }
    return false;
  }
public function url_to_real($url){
    if ( ($dn = $this->dir_from_url($url)) &&
      ($dir = $this->dir($dn)) &&
      ($res = $this->get_root_path($dn))
    ){
      $bits = explode('/', substr($url, \strlen($dn), \strlen($url)));
      if ( !empty($dir['tabs']) && !empty($bits) ){
        // Tab's nane
        $tab = array_pop($bits);
        // File's name
        $fn = array_pop($bits);
        // File's path
        $fp = implode('/', $bits).'/';
        // Check if the file is a superior super-controller
        $ssc = $this->superior_sctrl($tab, $fp);
        $tab = $ssc['tab'];
        $fp = $ssc['path'];
        if ( !empty($dir['tabs'][$tab]) ){
          $tab = $dir['tabs'][$tab];
          $res .= $tab['path'];
          if ( !empty($tab['fixed']) ){
            $res .= $fp . $tab['fixed'];
          }
          else {
            $res .= $fp . $fn;
            $ext_ok = false;
            foreach ( $tab['extensions'] as $e ){
              $ext = '.' . $e['ext'];
              if ( is_file($res . $ext) ){
                $res .= $ext;
                $ext_ok = true;
                break;
              }
            }
            if ( empty($ext_ok) ){
              $res .= '.' . $tab['extensions'][0]['ext'];
            }
          }
        }
        else {
          return false;
        }
      }
      else {
        // Remove the last element of the path if it's 'code' (it's the tab's URL in a non MVC architecture)
        if ( end($bits) === 'code' ){
          array_pop($bits);
        }
        $res .= implode('/', $bits);
      }
      return bbn\str::parse_path($res);
    }
    return false;
  }
public function url_to_real ( $ url ) { if ( ( $ dn = $ this -> dir_from_url ( $ url ) ) && ( $ dir = $ this -> dir ( $ dn ) ) && ( $ res = $ this -> get_root_path ( $ dn ) ) ) { $ bits = explode ( '/' , substr ( $ url , \ strlen ( $ dn ) , \ strlen ( $ url ) ) ) ; if ( ! empty ( $ dir [ 'tabs' ] ) && ! empty ( $ bits ) ) { // Tab's nane $ tab = array_pop ( $ bits ) ; // File's name $ fn = array_pop ( $ bits ) ; // File's path $ fp = implode ( '/' , $ bits ) . '/' ; // Check if the file is a superior super-controller $ ssc = $ this -> superior_sctrl ( $ tab , $ fp ) ; $ tab = $ ssc [ 'tab' ] ; $ fp = $ ssc [ 'path' ] ; if ( ! empty ( $ dir [ 'tabs' ] [ $ tab ] ) ) { $ tab = $ dir [ 'tabs' ] [ $ tab ] ; $ res .= $ tab [ 'path' ] ; if ( ! empty ( $ tab [ 'fixed' ] ) ) { $ res .= $ fp . $ tab [ 'fixed' ] ; } else { $ res .= $ fp . $ fn ; $ ext_ok = false ; foreach ( $ tab [ 'extensions' ] as $ e ) { $ ext = '.' . $ e [ 'ext' ] ; if ( is_file ( $ res . $ ext ) ) { $ res .= $ ext ; $ ext_ok = true ; break ; } } if ( empty ( $ ext_ok ) ) { $ res .= '.' . $ tab [ 'extensions' ] [ 0 ] [ 'ext' ] ; } } } else { return false ; } } else { // Remove the last element of the path if it's 'code' (it's the tab's URL in a non MVC architecture) if ( end ( $ bits ) === 'code' ) { array_pop ( $ bits ) ; } $ res .= implode ( '/' , $ bits ) ; } return bbn \ str :: parse_path ( $ res ) ; } return false ; }
Gets the real file's path from an URL

@param string $url The file's URL
@return bool|string
Gets the real file s path from an URL