method realToUrl documentation in bbn\Appui\Project

Returns the file's URL from the real file's path.

function(string $file) { foreach ($this->repositories as $i => $d) { $root = isset($d['root_path']) ? $d['root_path'] : $this->getRootPath($d['name']); if ( $root && (strpos($file, $root) === 0) ) { $rep = $i; break; } } if (isset($rep)) { X::log([561, $file, $rep, $root], 'real'); $res = $rep . '/'; $bits = explode('/', substr($file, \strlen($root))); $filename = array_pop($bits); $extension = \bbn\Str::fileExt($filename); $basename = \bbn\Str::fileExt($filename, 1)[0]; // MVC if (!empty($d['tabs'])) { // URL is interverted if ($d['type'] === 'components') { foreach ($d['tabs'] as $tab) { foreach ($tab['extensions'] as $ext) { if ($extension === $ext['ext']) { $tab_path = $tab['url']; break; } } if (isset($tab_path)) { break; } } } else { $tab_path = array_shift($bits); X::log([$tab_path, $bits], 'real'); } $res .= implode('/', $bits); foreach ($d['tabs'] as $t) { if ( empty($t['fixed']) && ($t['path'] === $tab_path . '/') ) { $res .= "/$filename"; break; } } } // Normal file else { $res .= implode('/', $bits) . '/' . $basename . '.' . $extension; } return \bbn\Str::parsePath($res); } return false; }

Returns the file's URL from the real file's path. 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.