* @copyright 2004 by gERD Schaufelberger * @package wbSite * @subpackage extension */ /** * Extension TxtReader * * Read text files and displays them as preformated text. * Makes README-files accessaböe quick and easy * * @version 1.0.0 * @package wbSite * @subpackage extension */ class wbExtension_TxtReader extends wbExtension { /** * some parameter * * @access private * @var array $_params */ var $_params = array( 'docdir' => 'doc', 'file' => 'README', 'ext' => 'txt' ); /** * getMaincontent * * @access public * @return string $html */ function getMaincontent() { $file = wbFactory::getParam( 'baseDir' ) . '/' . $this->_params['docdir'] . '/' . $this->_params['file'] . '.' . $this->_params['ext']; if( !file_exists( $file ) ) { return patErrorManager::raiseWarning( 'wbExtension:TxtReader:1', 'Could not read file', 'File: "'. $file .'" does not exist.' ); } $txt = file_get_contents( $file ); return '
' . htmlspecialchars( $txt ) . ''; } /** * getTitle * * @access public * @return string $html */ function getTitle() { return $this->_params['file']; } /** * getHead * * @access public * @return string $html */ function getHead() { return $this->_params['docdir'] . '/' . $this->_params['file'] . '.' . $this->_params['ext']; } } ?>