method urlToReal documentation in bbn\Appui\Ide

Gets the real file's path from an URL

function(string $url, bool $obj = false) { //get reposiotry of the url if (($rep = $this->repositoryFromUrl($url, true)) && ($res = $this->getRootPath($rep['name'])) ) { //for analyze url for get tab , type etc.. $bits = explode('/', substr($url, \strlen($rep['name']) + 1)); //if is project get tabs or if is components or is mvc if ($rep['alias_code'] === 'bbn-project') { if ( !empty($this->isComponentFromUrl($url)) && !empty($ptype = $this->getType('components')) ) { $rep['tabs'] = $ptype['tabs']; } if ( !empty($this->isMVCFromUrl($url)) && !empty($ptype = $this->getType('mvc')) ) { $rep['tabs'] = $ptype['tabs']; } } /* elseif (!empty($rep['tabs'])) { $rep['tabs'] = $rep['tabs']; }*/ $o = [ 'mode' => false, 'repository' => $rep, 'tab' => false ]; $tab = array_pop($bits); $end = array_pop($bits); $file_name = array_pop($bits); if ($end === '_end_') { // Tab's nane //case component or mvc if (!empty($rep['tabs']) && (end($bits) !== 'code')) { // Tab's nane // File's name if ($rep['alias_code'] === 'bbn-project') { array_shift($bits); } // File's path $file_path = implode('/', $bits); // Check if the file is a superior super-controller $ssc = $this->_superior_sctrl($tab, $file_path); $tab = $ssc['tab']; $o['tab'] = $tab; $file_path = $ssc['path'] . '/'; $i = X::find($rep['tabs'], ['url' => $tab]); if ($i !== null) { if (!isset($rep['tabs'][$i])) { throw new \Error("No index corresponding to $i"); } $tab = $rep['tabs'][$i]; if (!empty($this->isMVCFromUrl($url))) { $res .= 'mvc/'; } if (!isset($rep['type']) || ($rep['type'] !== 'components')) { if (empty($this->isComponentFromUrl($url))) { $res .= $tab['path']; } else { $res .= 'components/'; } } if (!empty($tab['fixed'])) { $res .= $file_path . $tab['fixed']; $o['mode'] = $tab['extensions'][0]['mode']; $o['ssctrl'] = $ssc['ssctrl']; } else { $res .= $file_path . $file_name; $ext_ok = false; foreach ($tab['extensions'] as $e) { if ($this->fs->isFile("$res.$e[ext]")) { $res .= ".$e[ext]"; $ext_ok = true; $o['mode'] = $e['mode']; break; } } if (empty($ext_ok)) { $res .= '.' . $tab['extensions'][0]['ext']; $o['mode'] = $tab['extensions'][0]['mode']; } } } /*else { return false; }*/ } else { // File's name $res .= '/' . implode('/', $bits) . '/' . $file_name; if (is_array($rep)) { //temporaney for lib plugin if (!empty($rep['extensions'])) { foreach ($rep['extensions'] as $ext) { if ($this->fs->isFile("$res.$ext[ext]")) { $res .= ".$ext[ext]"; $o['mode'] = $ext['mode']; } } } else { if ($this->fs->isFile($res . '.php')) { $res .= ".php"; $o['mode'] = 'php'; } } } if (empty($o['mode']) && !empty($rep['extensions'])) { $res .= '.' . $rep['extensions'][0]['ext']; $o['mode'] = $rep['extensions'][0]['mode']; } } $res = Str::parsePath($res); //X::ddump($res, $tab, $bits, $rep); if ($obj) { $o['file'] = $res; return $o; } return $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.