| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
|
|---|
| 10 |
|
|---|
| 11 |
|
|---|
| 12 |
|
|---|
| 13 |
|
|---|
| 14 |
define( 'PATXMLPRETTY_RENDERER_ERROR_ABSTRACT_METHOD', 'patXMLPretty_Renderer:01' ); |
|---|
| 15 |
|
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
|
|---|
| 19 |
|
|---|
| 20 |
|
|---|
| 21 |
|
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 |
|
|---|
| 26 |
class patXMLPretty_Renderer extends patXMLPretty_Module |
|---|
| 27 |
{ |
|---|
| 28 |
|
|---|
| 29 |
* Stores the configuration reader object used to load |
|---|
| 30 |
* and access tag syntax definitions. |
|---|
| 31 |
* |
|---|
| 32 |
* @access private |
|---|
| 33 |
* @var object patXMLReader_ConfigReader |
|---|
| 34 |
* @see setConfigReader() |
|---|
| 35 |
*/ |
|---|
| 36 |
var $configReader = null; |
|---|
| 37 |
|
|---|
| 38 |
|
|---|
| 39 |
* Stores user-safe error messages. These are used in error |
|---|
| 40 |
* objects as the message displayed to the user and are meant |
|---|
| 41 |
* not to disclose any critical application information. |
|---|
| 42 |
* |
|---|
| 43 |
* The detailed error message is stored separately for developers |
|---|
| 44 |
* to use for debugging purposes. |
|---|
| 45 |
* |
|---|
| 46 |
* @access private |
|---|
| 47 |
* @var array |
|---|
| 48 |
* @see patError |
|---|
| 49 |
*/ |
|---|
| 50 |
var $userMessages = array( |
|---|
| 51 |
'error' => 'XML rendering engine could not start.', |
|---|
| 52 |
'warning' => 'XML rendering engine could not be initialized properly', |
|---|
| 53 |
'notice' => 'XML rendering engine misconfiguration' |
|---|
| 54 |
); |
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
* Sets the configuration reader to use to load and access the tag |
|---|
| 58 |
* coloring and syntax definitions. |
|---|
| 59 |
* |
|---|
| 60 |
* @access public |
|---|
| 61 |
* @param object patXMLPretty_ConfigReader |
|---|
| 62 |
* @see $configReader |
|---|
| 63 |
*/ |
|---|
| 64 |
function setConfigReader( &$configReader ) |
|---|
| 65 |
{ |
|---|
| 66 |
$this->configReader =& $configReader; |
|---|
| 67 |
} |
|---|
| 68 |
|
|---|
| 69 |
|
|---|
| 70 |
* Main render method that patXMLPretty automatically |
|---|
| 71 |
* calls to trigger the highlighting of the elements |
|---|
| 72 |
* tree collected by the selected parsing engine. |
|---|
| 73 |
* |
|---|
| 74 |
* @abstract |
|---|
| 75 |
* @access public |
|---|
| 76 |
* @param array |
|---|
| 77 |
* @param array |
|---|
| 78 |
* @param array|null |
|---|
| 79 |
* @return string|patError |
|---|
| 80 |
*/ |
|---|
| 81 |
function render( $documentInfo, $elementsTree, $doctype ) |
|---|
| 82 |
{ |
|---|
| 83 |
$error = patErrorManager::raiseError( |
|---|
| 84 |
PATXMLPRETTY_RENDERER_ERROR_ABSTRACT_METHOD, |
|---|
| 85 |
$this->userMessages['error'], |
|---|
| 86 |
'The [render] renderer method is an abstract method that cannot be called directly. '. |
|---|
| 87 |
'Chances are you either tried to call this method on the base class or the renderer '. |
|---|
| 88 |
'class you are using does not implement it. For reference, my class name is ['.get_class( $this ).'].' |
|---|
| 89 |
); |
|---|
| 90 |
|
|---|
| 91 |
return $error; |
|---|
| 92 |
} |
|---|
| 93 |
} |
|---|
| 94 |
|
|---|
| 95 |
?> |
|---|