method urlToReal documentation in bbn\Ide\Directories

Gets the real file's path from an URL

function($url) { ($dir = $this->dir($dn)) && ($res = $this->getRootPath($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->superiorSctrl($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::parsePath($res); } return false; }

Gets the real file's path from an URL BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.