Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $NG2=new NG2('../NG2PRIVATE/BootImage');
- Class NG2
- {
- public string $DefaultBootPath = '';
- public string $BootPath = '';
- public string $BootImage = '';
- public function __construct
- (
- string $argBootPath='../NG2PRIVATE/BootImage'
- )
- {
- $this->MkPath($argBootPath);
- $this->BootImage='[NUL]';
- $this->BootPath=
- implode
- (
- '/',
- [
- $argBootPath,
- 'NG2Setup.json'
- ]
- );
- if
- (
- is_file
- (
- $this->BootPath
- )
- )
- {
- $this->BootImage=
- file_get_contents
- (
- $this->BootPath
- );
- }
- var_dump($this->BootPath);
- var_dump($this->BootImage);
- }
- public function MkPath(string $argPath='')
- {
- if(substr($argPath,0,strlen($_SERVER['DOCUMENT_ROOT']))===$_SERVER['DOCUMENT_ROOT'])
- {
- $argPath=substr($argPath,strlen($_SERVER['DOCUMENT_ROOT']));
- }
- while(substr($argPath,0,2)==='//')
- {
- $argPath=substr($argPath,1);
- }
- $parts=
- explode
- (
- '/',
- $argPath
- );
- $p=[];
- $p[]=$_SERVER['DOCUMENT_ROOT'];
- $path='';
- for($index=0;$index<count($parts);$index++)
- {
- if($parts[$index]!==$_SERVER['DOCUMENT_ROOT'])
- {
- $p[]=$parts[$index];
- $path=
- implode
- (
- '/',
- $p
- );
- if(!is_file($path) and !is_dir($path) and (strlen($path)!==0))
- {
- mkdir
- (
- $path
- );
- }
- }
- }
- }
- function Boot()
- {
- $this->boot
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement