public function obfuscate($filePath)
    {
        if (trim($filePath) == "") {
            $this->_errors[] = "File Name cannot be blank in function: " .
                __FUNCTION__;
            return false;
        }
        if (!is_readable($filePath)) {
            $this->_errors[] = "Failed to open file: $filePath in the function: " .
                __FUNCTION__;
            return false;
        }

        $this->_fileName = trim($filePath);
        $name = explode(".", $this->_fileName);
        $ext = end($name);
        $pos = strrpos($this->_fileName, ".");

        $filePath = substr($this->_fileName, 0, $pos);

        $this->_obfuscateFileName = $obfuscateFileName = $filePath . "." .
            $this->_obfuscatedFileSuffix . "." . $ext;

        if (($fp = fopen($obfuscateFileName, "w+")) === false) {
            $this->_errors[] = "Failed to open file: $obfuscateFileName " .
                "for writing in the function: " . __FUNCTION__;
            return false;
        } else {

            fwrite($fp, "<?php \r\n");
            $line = php_strip_whitespace($this->_fileName);

            $line = $this->preProcessString($line);
            $line = $this->encodeString($line);
            $line .= "\r\n";
            fwrite($fp, $line);
        }

        fclose($fp);

        return $obfuscateFileName;
    }
public function obfuscate($filePath)
    {
        if (trim($filePath) == "") {
            $this->_errors[] = "File Name cannot be blank in function: " .
                __FUNCTION__;
            return false;
        }
        if (!is_readable($filePath)) {
            $this->_errors[] = "Failed to open file: $filePath in the function: " .
                __FUNCTION__;
            return false;
        }

        $this->_fileName = trim($filePath);
        $name = explode(".", $this->_fileName);
        $ext = end($name);
        $pos = strrpos($this->_fileName, ".");

        $filePath = substr($this->_fileName, 0, $pos);

        $this->_obfuscateFileName = $obfuscateFileName = $filePath . "." .
            $this->_obfuscatedFileSuffix . "." . $ext;

        if (($fp = fopen($obfuscateFileName, "w+")) === false) {
            $this->_errors[] = "Failed to open file: $obfuscateFileName " .
                "for writing in the function: " . __FUNCTION__;
            return false;
        } else {

            fwrite($fp, "<?php \r\n");
            $line = php_strip_whitespace($this->_fileName);

            $line = $this->preProcessString($line);
            $line = $this->encodeString($line);
            $line .= "\r\n";
            fwrite($fp, $line);
        }

        fclose($fp);

        return $obfuscateFileName;
    }
public function obfuscate ( $ filePath ) { if ( trim ( $ filePath ) == "" ) { $ this -> _errors [ ] = "File Name cannot be blank in function: " . __FUNCTION__ ; return false ; } if ( ! is_readable ( $ filePath ) ) { $ this -> _errors [ ] = "Failed to open file: $filePath in the function: " . __FUNCTION__ ; return false ; } $ this -> _fileName = trim ( $ filePath ) ; $ name = explode ( "." , $ this -> _fileName ) ; $ ext = end ( $ name ) ; $ pos = strrpos ( $ this -> _fileName , "." ) ; $ filePath = substr ( $ this -> _fileName , 0 , $ pos ) ; $ this -> _obfuscateFileName = $ obfuscateFileName = $ filePath . "." . $ this -> _obfuscatedFileSuffix . "." . $ ext ; if ( ( $ fp = fopen ( $ obfuscateFileName , "w+" ) ) === false ) { $ this -> _errors [ ] = "Failed to open file: $obfuscateFileName " . "for writing in the function: " . __FUNCTION__ ; return false ; } else { fwrite ( $ fp , "<?php \r\n" ) ; $ line = php_strip_whitespace ( $ this -> _fileName ) ; $ line = $ this -> preProcessString ( $ line ) ; $ line = $ this -> encodeString ( $ line ) ; $ line .= "\r\n" ; fwrite ( $ fp , $ line ) ; } fclose ( $ fp ) ; return $ obfuscateFileName ; }
Obfuscates a file

@param string $filePath Path to file

@return bool|string
Obfuscates a file