Documentation is available at Crafty_Exceptions.class.php
- <?php
- /**
- * Implementation file of the Crafty_Exception classes.
- *
- * <pre>
- * PROJECT : Crafty
- * Template Engine.
- * AUTHOR : Crafty Team <crafty@zulan.net>
- * COPYRIGHT : (c) Thomas Ilsche, 2004
- *
- * FILE : [ROOT]\Crafty_Exceptions.php
- * DESCRIPTION: Implementation file of the Crafty main class.
- * </pre>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
- * @package Crafty_Compiler
- * @author Crafty Team <crafty@zulan.net>
- * @copyright Copyright (c) Thomas Ilsche 2004
- * @version 1.0.4.2005.02.15
- * @link http://crafty.zulan.net
- * @license http://www.gnu.org/licenses/lgpl.html
- * GNU Lesser General Public License Version 2.1
- ***/
- /**
- * Crafty_Exception class implementation
- *
- * The compiler will throw this on really bad errors.
- * Crafty itsself will handle these exceptions.
- *
- * @package Crafty_Compiler
- * @author Crafty Team <crafty@zulan.net>
- * @copyright Copyright (c) Thomas Ilsche
- * @version 1.0.4.2005.02.15
- * @link http://crafty.zulan.net
- * @license http://www.gnu.org/licenses/lgpl.html
- * GNU Lesser General Public License Version 2.1
- ***/
- class Crafty_Exception extends Exception
- {
- public $file;
- public $line;
- protected $type = 'Crafty Exception';
- public function __construct($message, $file = '', $line = -1)
- {
- parent::__construct($message);
- $this->file = $file;
- $this->line = $line;
- }
- /**
- * Returns a formatted error message.
- *
- * Possible values for $type:<br/>
- * <ul><li>'TXT'</li>
- * <li>'HTML'</li>
- * <li>'HTML_FULL'</li></ul>
- *
- * @param string $type [optional, default='TXT'] Message format type
- * @return string The formatted error message
- ***/
- public function getFormattedMessage($type = 'TXT')
- {
- switch(strtoupper($type)) {
- case 'TXT' :
- return $this->getParsedMessage();
- case 'HTML' :
- return htmlspecialchars($this->getParsedMessage());
- case 'HTML_FULL' :
- $r = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"'
- . '"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
- . '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"'
- . ' lang="en">'
- . "<head><title>$this->type</title>"
- . "<body><b>$this->type:</b> "
- . htmlspecialchars($this->getParsedMessage());
- if (!empty($this->file)) {
- $r .= " in <b>$this->file</b>";
- if ($this->line > -1) {
- $r .= " on line <b>$this->line</b>";
- }
- }
- $r .= '</body></html>';
- return $r;
- /* I'm not a designer so don't blame me if it doesn't look nice. */
- }
- }
- public function getParsedMessage()
- {
- $msg = $this->getMessage();
- return preg_replace('/\s+/', ' ', $msg);
- }
- }
- /**
- * Crafty_Exception_Core class implementation
- *
- * This exception will be thrown on errors in the parsed template.
- * Crafty_Core will handle these exceptions.
- *
- * @package Crafty_Compiler
- * @author Crafty Team <crafty@zulan.net>
- * @copyright Copyright (c) Thomas Ilsche
- * @version 1.0.0.2004.09.15
- * @link http://crafty.zulan.net
- * @license http://www.gnu.org/licenses/lgpl.html
- * GNU Lesser General Public License Version 2.1
- ***/
- class Crafty_Exception_Core extends Crafty_Exception
- {
- protected $type = 'Crafty_Core Exception';
- }
- ?>
Documentation generated on Sat, 19 Feb 2005 01:43:48 +0100 by phpDocumentor 1.3.0RC3