public function getContent($refresh = false)
    {
        if ($this->content === null || $refresh) {
            try{
                switch ($this->sourceType) {
                    case self::SOURCE_FILE:
                        //check file
                        if(!file_exists($this->source)){
                            throw new Exception("File {$this->source} not found.");
                        }
                        if(!is_readable($this->source)){
                            throw new Exception("Unable to read file {$this->source}.");
                        }
                        if(!preg_match("/\.{$this->fileExtension}$/", basename($this->source))){
                            throw new Exception("Wrong file extension in ".basename($this->source).", {$this->fileExtension} extension is expected");
                        }
                        if(!tao_helpers_File::securityCheck($this->source)){
                            throw new Exception("{$this->source} seems to contain some security issues");
                        }
                        $this->content = file_get_contents($this->source);
                        break;
                    case self::SOURCE_URL:
                        //only same domain
                        if(!preg_match("/^".preg_quote(BASE_URL, '/')."/", $this->source)){
                            throw new Exception("The given uri must be in the domain {$_SERVER['HTTP_HOST']}");
                        }
                        $this->content = tao_helpers_Request::load($this->source, true);
                        break;
                    case self::SOURCE_STRING:
                        $this->content = $this->source;
                        break;
                    case self::SOURCE_FLYFILE:
                        if (! $this->source->exists()) {
                            throw new Exception('Source file does not exists ("' . $this->source->getBasename() . '").');
                        }
                        if (! $this->content = $this->source->read()) {
                            throw new Exception('Unable to read file ("' . $this->source->getBasename() . '").');
                        }
                        break;
                }
            } catch(Exception $e) {
                $this->addError($e);
            }
        }
        
        return $this->content;
    }
public function getContent($refresh = false)
    {
        if ($this->content === null || $refresh) {
            try{
                switch ($this->sourceType) {
                    case self::SOURCE_FILE:
                        //check file
                        if(!file_exists($this->source)){
                            throw new Exception("File {$this->source} not found.");
                        }
                        if(!is_readable($this->source)){
                            throw new Exception("Unable to read file {$this->source}.");
                        }
                        if(!preg_match("/\.{$this->fileExtension}$/", basename($this->source))){
                            throw new Exception("Wrong file extension in ".basename($this->source).", {$this->fileExtension} extension is expected");
                        }
                        if(!tao_helpers_File::securityCheck($this->source)){
                            throw new Exception("{$this->source} seems to contain some security issues");
                        }
                        $this->content = file_get_contents($this->source);
                        break;
                    case self::SOURCE_URL:
                        //only same domain
                        if(!preg_match("/^".preg_quote(BASE_URL, '/')."/", $this->source)){
                            throw new Exception("The given uri must be in the domain {$_SERVER['HTTP_HOST']}");
                        }
                        $this->content = tao_helpers_Request::load($this->source, true);
                        break;
                    case self::SOURCE_STRING:
                        $this->content = $this->source;
                        break;
                    case self::SOURCE_FLYFILE:
                        if (! $this->source->exists()) {
                            throw new Exception('Source file does not exists ("' . $this->source->getBasename() . '").');
                        }
                        if (! $this->content = $this->source->read()) {
                            throw new Exception('Unable to read file ("' . $this->source->getBasename() . '").');
                        }
                        break;
                }
            } catch(Exception $e) {
                $this->addError($e);
            }
        }
        
        return $this->content;
    }
public function getContent ( $ refresh = false ) { if ( $ this -> content === null || $ refresh ) { try { switch ( $ this -> sourceType ) { case self :: SOURCE_FILE : //check file if ( ! file_exists ( $ this -> source ) ) { throw new Exception ( "File {$this->source} not found." ) ; } if ( ! is_readable ( $ this -> source ) ) { throw new Exception ( "Unable to read file {$this->source}." ) ; } if ( ! preg_match ( "/\.{$this->fileExtension}$/" , basename ( $ this -> source ) ) ) { throw new Exception ( "Wrong file extension in " . basename ( $ this -> source ) . ", {$this->fileExtension} extension is expected" ) ; } if ( ! tao_helpers_File :: securityCheck ( $ this -> source ) ) { throw new Exception ( "{$this->source} seems to contain some security issues" ) ; } $ this -> content = file_get_contents ( $ this -> source ) ; break ; case self :: SOURCE_URL : //only same domain if ( ! preg_match ( "/^" . preg_quote ( BASE_URL , '/' ) . "/" , $ this -> source ) ) { throw new Exception ( "The given uri must be in the domain {$_SERVER['HTTP_HOST']}" ) ; } $ this -> content = tao_helpers_Request :: load ( $ this -> source , true ) ; break ; case self :: SOURCE_STRING : $ this -> content = $ this -> source ; break ; case self :: SOURCE_FLYFILE : if ( ! $ this -> source -> exists ( ) ) { throw new Exception ( 'Source file does not exists ("' . $ this -> source -> getBasename ( ) . '").' ) ; } if ( ! $ this -> content = $ this -> source -> read ( ) ) { throw new Exception ( 'Unable to read file ("' . $ this -> source -> getBasename ( ) . '").' ) ; } break ; } } catch ( Exception $ e ) { $ this -> addError ( $ e ) ; } } return $ this -> content ; }
Get XML content.

@access protected
@author Aleh Hutnikau, <hutnikau@1pt.com>
@param boolean $refresh load content again.
@return string
Get XML content .