Runs `lessc` against any files that match the configured extension.

@param string $filename The name of the input file.
@param string $input The content of the file.
@return string
@throws \Exception
336923
public function input($filename, $input)
    {
        if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
            return $input;
        }
        if (!class_exists('\Less_Parser')) {
            throw new \Exception('Cannot not load "\Less_Parser" class. Make sure https://github.com/oyejorge/less.php is installed.');
        }

        $parser = new \Less_Parser();

        return $parser->parseFile($filename)->getCss();
    }
1021494
public function validExt($filename){
        $exts = $this->config['ext'];
        $ext = $this->getExtension($filename);
        if(array_search($ext,$exts)===false){
            return false;
        }else{
            return true;
        }


    }
723079
protected function handleFileDelete(array $input = [])
    {
        if (array_key_exists(Field::FILE_DELETE_FLAG, $input)) {
            $input[Field::FILE_DELETE_FLAG] = $input['key'];
            unset($input['key']);
        }

        Input::replace($input);

        return $input;
    }
1056751
public static function load( $fileName )
	{
		$file	= new FS_File_Reader( $fileName );
		if( !$file->exists() )
			throw new Exception( "File '".$fileName."' is not existing." );
		$xml	= $file->readString();
		$parser	= new XML_OPML_Parser();
		return $parser->parse( $xml );
	}
669353
public static function saveFile($input, $fileName)
    {
        $fh = fopen($fileName, 'w') or die('cant open file');
        fwrite($fh, $input);
        fclose($fh);
    }
744950
public static function load( $fileName )
	{
		if( !file_exists( $fileName ) )
			throw new Exception( 'File "'.$fileName.'" is not existing.' );

		$reader	= new FS_File_Reader( $fileName );
		$lines	= $reader->readArray();
		
		$list	= array();
		foreach( $lines as $line )
		{
			$line = trim( $line );
			if( !$line )
				continue;
			if( preg_match( self::$commentPattern, $line ) )
				continue;
					
			if( preg_match( self::$sectionPattern, $line ) )
			{
				$section = substr( $line, 1, -1 );
				if( !isset( $list[$section] ) )
					$list[$section]	= array();
			}
			else if( $section )
				$list[$section][]	= $line;
		}
		return $list;
	}
702948
protected function cleanFilename($filename)
    {
        /** @var FileIDHelper $helper */
        $helper = Injector::inst()->get(HashFileIDHelper::class);
        return $helper->cleanFilename($filename);
    }
628039
public function input($filename, $input)
    {
        if (substr($filename, strlen($this->_settings['ext']) * -1) !== $this->_settings['ext']) {
            return $input;
        }
        if (!class_exists('Leafo\\ScssPhp\\Compiler')) {
            throw new \Exception(sprintf('Cannot not load filter class "%s".', 'Leafo\\ScssPhp\\Compiler'));
        }
        $sc = new Compiler();
        $sc->addImportPath(dirname($filename));
        return $sc->compile($input);
    }
803187
public static function removeExtension($fileName) {
		$ext = strrchr($fileName, '.');
		if($ext !== false) {
			$fileName = substr($fileName, 0, -strlen($ext));
		}
		return $fileName;
	}
1289788
public function fileExists($fileName, $storageName = '')
    {
        //check whether file is set or not
        if ($fileName == '') {
            AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
            throw new Exception(Exception::MSG_NO_FILENAME);
        }

        //build URI
        $strURI = $this->strURIExist . $fileName;
        if ($storageName != '') {
            $strURI .= '?storage=' . $storageName;
        }
        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = json_decode(Utils::processCommand($signedURI, 'GET', '', ''));
        if (!$responseStream->FileExist->IsExist) {
            return FALSE;
        }
        return TRUE;
    }
401615
private function run($command, $input)
    {
        $process = proc_open($command, [
            ['pipe', 'r'], // stdin
            ['pipe', 'w'], // stdout
            ['pipe', 'w'], // stderr
        ], $pipes);

        fwrite($pipes[0], $input);
        fclose($pipes[0]);

        $result = stream_get_contents($pipes[1]);
        fclose($pipes[1]);

        $errors = stream_get_contents($pipes[2]);
        fclose($pipes[2]);

        $code = proc_close($process);

        if (0 != $code) {
            $errors = trim($errors) ?: 'unknown';
            throw SignException::signFailedAsOf($errors, $code);
        }

        return $result;
    }
594697
public static function getFileNameWithoutExtension($fileName, $shortExtensionMode = TRUE)
    {
        $dotPos = $shortExtensionMode ? strrpos( $fileName, '.' ) : strpos( $fileName, '.' );
        if (false === $dotPos) {
            return $fileName;
        }

        return substr($fileName, 0, $dotPos);
    }
1135566
protected function checkFileType($filename) {

        if ( $this->config['allow_ext'] == '*' ) {
            return true;
        }
		$_ext = strtolower(self::getFileExt($filename));
        $_allow_ext = explode("|", $this->config['allow_ext']);
		if ( !in_array($_ext, $_allow_ext) ) {
			$this->errNum = 5;
            return false;
		}
        return true;
	}
1023428
private function validateFileExtension($filename)
    {
        // no UNIX-hidden files
        if ($filename[0] === '.') {
            return false;
        }
        // only whitelisted extensions
        $extension = pathinfo($filename, PATHINFO_EXTENSION);
        $allowedExtensions = $this->getAllowedUploadExtensions();

        return $extension === '' || in_array(mb_strtolower($extension), $allowedExtensions);
    }
495667
public function input($filename, $content)
    {
        $this->_filename = $filename;
        $content = preg_replace_callback($this->_backgroundPattern, array($this, '_replace'), $content);
        $content = preg_replace_callback($this->_backgroundImagePattern, array($this, '_replace'), $content);
        return $content;
    }
211806
public function replaceExtension($filename, $extension)
    {
        $parts = $this->splitFilename($filename);
        $newFilename = $parts[0] . $parts[1];
        if (is_string($extension) && ($extension !== '')) {
            $newFilename .= '.' . $extension;
        }

        return $newFilename;
    }
464367
public static function from($filename)
    {
        $extension = strtok(pathinfo($filename, PATHINFO_EXTENSION), '?');

        return self::getMimeTypeFromExtension($extension);
    }