method insert documentation in bbn\Ide\Actions

function($data) { $dirs = $directories->dirs(); if ( isset($data['dir'], $data['name'], $data['path'], $data['type'], $dirs[$data['dir']]) && (strpos($data['path'], '../') === false) && bbn\Str::checkFilename($data['name']) ){ $cfg =& $dirs[$data['dir']]; $type = $data['type'] === 'file' ? 'file' : 'dir'; $wtype = $type === 'dir' ? 'directory' : 'file'; $dir = $this->isMvc($cfg) ? $cfg['files']['Controller']['fpath'] : $cfg['root_path']; $ext = $this->isMvc($cfg) ? $cfg['files']['Controller']['ext'] : $data['ext']; if ( ($type === 'file') && !$this->isMvc($cfg) && !empty($ext) ){ foreach ( $cfg['files'] as $f ){ if ( $ext === $f['ext'] ){ $dir = $f['fpath']; break; } } } //bbn\X::dump($cfg, $dir); $path = ''; if ( ($data['path'] !== './') ){ if ( is_dir($dir.$data['path']) ){ $path = $data['path'].'/'; } else{ return $this->error("The container directory doesn't exist"); } } $path .= $type === 'file' ? $data['name'].'.'.$ext : $data['name']; if ( file_exists($dir.$path) ){ return $this->error("The $wtype already exists"); } if ( $type === 'dir' ){ if ( !@mkdir($dir.$path) && !is_dir($dir.$path) ){ return $this->error("Impossible to create the $wtype"); } } else if ( $ext ){ $modes = $directories->modes(); if ( !file_put_contents($dir.$path, isset($modes[$ext]['code']) ? $modes[$ext]['code'] : ' ') ){ return $this->error("Impossible to create the $wtype"); } } return 1; } return $this->error("There is a problem in the name you entered"); }

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.