TemplateConverter::read PHP Method

read() public method

Reads the original template file content.
public read ( string $p_filePath ) : boolean
$p_filePath string Full path to the template file
return boolean True on success, false on failure
    public function read($p_filePath)
    {
        if (!file_exists($p_filePath)) {
            return false;
        }
        if (strtolower(substr($p_filePath, -4)) != '.tpl' && strtolower(substr($p_filePath, -4)) != '.htm' && strtolower(substr($p_filePath, -5)) != '.html') {
            return false;
        }
        // sets the template full path directory and template file name
        $this->m_templatePathDirectory = dirname($p_filePath);
        $this->m_templateFileName = basename($p_filePath);
        // sets the relative template directory, if any
        $tplDirPos = strpos($this->m_templatePathDirectory, 'templates/');
        $tplDirLength = strlen('templates/');
        if ($tplDirPos && ($tplDir = substr($this->m_templatePathDirectory, $tplDirPos + $tplDirLength))) {
            $this->m_templateDirectory = $tplDir;
        } else {
            $this->m_templateDirectory = null;
        }
        // reads the template file content
        if (!($this->m_templateOriginalContent = @file_get_contents($p_filePath))) {
            return false;
        }
        return true;
    }