protected function addModesFromFile($dir,$file)
    {
        $dir = $this->parseDir($dir);

        $jsContent = $file->getContents();
        preg_match_all('#defineMIME\(\s*(\'|")([^\'"]+)(\'|")#', $jsContent, $modes);
        if (count($modes[2])) {
            foreach ($modes[2] as $mode) {
                $this->addMode($mode, $dir."/".$file->getRelativePathname());
            }
        }
        $this->addMode($file->getRelativePath(), $dir."/".$file->getRelativePathname());

                #save to cache if env prod
        if ($this->env == 'prod') {
            $this->cacheDriver->save(static::CACHE_MODES_NAME, $this->getThemes());
        }
    }
protected function addModesFromFile($dir,$file)
    {
        $dir = $this->parseDir($dir);

        $jsContent = $file->getContents();
        preg_match_all('#defineMIME\(\s*(\'|")([^\'"]+)(\'|")#', $jsContent, $modes);
        if (count($modes[2])) {
            foreach ($modes[2] as $mode) {
                $this->addMode($mode, $dir."/".$file->getRelativePathname());
            }
        }
        $this->addMode($file->getRelativePath(), $dir."/".$file->getRelativePathname());

                #save to cache if env prod
        if ($this->env == 'prod') {
            $this->cacheDriver->save(static::CACHE_MODES_NAME, $this->getThemes());
        }
    }
protected function addModesFromFile ( $ dir , $ file ) { $ dir = $ this -> parseDir ( $ dir ) ; $ jsContent = $ file -> getContents ( ) ; preg_match_all ( '#defineMIME\(\s*(\'|")([^\'"]+)(\'|")#' , $ jsContent , $ modes ) ; if ( count ( $ modes [ 2 ] ) ) { foreach ( $ modes [ 2 ] as $ mode ) { $ this -> addMode ( $ mode , $ dir . "/" . $ file -> getRelativePathname ( ) ) ; } } $ this -> addMode ( $ file -> getRelativePath ( ) , $ dir . "/" . $ file -> getRelativePathname ( ) ) ; #save to cache if env prod if ( $ this -> env == 'prod' ) { $ this -> cacheDriver -> save ( static :: CACHE_MODES_NAME , $ this -> getThemes ( ) ) ; } }
Parse editor modes from dir
Parse editor modes from dir