method load documentation in bbn\Appui\Ide
(Load)s a file.
function(string $url)
{
$real = $this->urlToReal($url, true);
if (
is_array($real)
&& !empty($real['file'])
&& !empty($real['mode'])
&& !empty($real['repository'])
) {
$this->_set_current_file($real['file']);
X::log([$url, $real['file'], self::$current_file, self::$current_id], 'load');
$f = [
'mode' => $real['mode'],
'tab' => $real['tab'],
'ssctrl' => $real['ssctrl'] ?? 0,
'extension' => Str::fileExt(self::$current_file),
'permissions' => false,
'selections' => false,
'line' => false,
'char' => false,
'marks' => false,
'repository' => $real['repository']['code'],
//'file' => self::$current_file
];
if ($this->fs->isFile(self::$current_file)) {
$f['value'] = $this->fs->getContents(self::$current_file);
$root = $this->getRootPath($real['repository']['name']);
$file = substr($real['file'], strlen($root));
$file_name = Str::fileExt($real['file'], 1)[0];
$file_path = substr($url, strlen($real['repository']['name']) + 1);
$file_path = substr($file_path, 0, strpos($file_path, $file_name) - 1);
$val = [
'repository' => $real['repository'],
'filePath' => X::dirname($file),
'ssctrl' => $real['ssctrl'] ?? 0,
'filename' => $file_name,
'component_vue' => $this->isComponentFromUrl($url),
'extension' => Str::fileExt($real['file'], 1)[1],
'full_path' => Str::parsePath($real['repository']['path'] . '/' . $file),
'path' => $file_path, // substr($file_path, strlen($real['repository']['path'])+1),
'tab' => $real['tab']
];
if ($preferences = $this->getFilePreferences($val)) {
$f = array_merge($f, $preferences);
}
if (($permissions = $this->getFilePermissions())
&& ($this->project === BBN_APP_NAME)
) {
$f = array_merge($f, $permissions);
/*if ( $id_opt = $this->optionId() ){
$val_opt = $this->options->option($id_opt);
}*/
/*if( !empty($val_opt) ){
foreach ( $f as $n => $v ){
if ( isset($val_opt[$n]) ){
$f[$n] = $val_opt[$n];
}
}
}*/
}
} elseif (
!empty($real['tab'])
&& (($i = \bbn\X::find($real['repository']['tabs'], ['url' => $real['tab']])) !== null)
) {
if (!empty($real['repository']['tabs'][$i]['extensions'][0]['default'])) {
$f['value'] = $real['repository']['tabs'][$i]['extensions'][0]['default'];
}
} elseif (!empty($real['repository']['extensions'][0]['default'])) {
$f['value'] = $real['repository']['extensions'][0]['default'];
} else {
$f['value'] = '';
}
$f['id'] = self::$current_id;
return $f;
}
return false;
}
(Load)s a file. 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.
© 2011-2023
BBN Solutions