Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'core/DataTable/Renderer.php')
-rw-r--r--core/DataTable/Renderer.php54
1 files changed, 11 insertions, 43 deletions
diff --git a/core/DataTable/Renderer.php b/core/DataTable/Renderer.php
index 5f1a42671f..c9458f16a3 100644
--- a/core/DataTable/Renderer.php
+++ b/core/DataTable/Renderer.php
@@ -24,13 +24,8 @@
abstract class Piwik_DataTable_Renderer
{
protected $table;
- protected $exception;
protected $renderSubTables = false;
- public function __construct()
- {
- }
-
public function setRenderSubTables($enableRenderSubTable)
{
$this->renderSubTables = (bool)$enableRenderSubTable;
@@ -49,13 +44,6 @@ abstract class Piwik_DataTable_Renderer
abstract public function render();
/**
- * Computes the exception output and returns the string/binary
- *
- * @return string
- */
- abstract public function renderException();
-
- /**
* @see render()
* @return string
*/
@@ -79,19 +67,6 @@ abstract class Piwik_DataTable_Renderer
}
/**
- * Set the Exception to be rendered
- * @param Exception $exception to be rendered
- */
- public function setException($exception)
- {
- if(!($exception instanceof Exception))
- {
- throw new Exception("The exception renderer accepts only an Exception object.");
- }
- $this->exception = $exception;
- }
-
- /**
* Returns the DataTable associated to the output format $name
*
* @throws exception If the renderer is unknown
@@ -100,25 +75,18 @@ abstract class Piwik_DataTable_Renderer
static public function factory( $name )
{
$name = ucfirst(strtolower($name));
+ $path = PIWIK_INCLUDE_PATH .'/core/DataTable/Renderer/'.$name.'.php';
$className = 'Piwik_DataTable_Renderer_' . $name;
- try {
- Piwik_Loader::autoload($className);
+ if( Piwik_Common::isValidFilename($name)
+ && Zend_Loader::isReadable($path) )
+ {
+ require_once $path; // prefixed by PIWIK_INCLUDE_PATH
return new $className;
- } catch(Exception $e) {
- $availableRenderers = 'xml, json, csv, tsv, html, php, original';
- throw new Exception(Piwik_TranslateException('General_ExceptionInvalidRendererFormat', array($name, $availableRenderers)));
+ }
+ else
+ {
+ throw new Exception("Renderer format '$name' not valid. Try 'xml' or 'json' or 'csv' or 'html' or 'php' or 'original' instead.");
}
- }
-
- /**
- * Returns $rawData after all applicable characters have been converted to HTML entities.
- *
- * @param String $rawData to be converted
- * @return String
- */
- static protected function renderHtmlEntities( $rawData )
- {
- return htmlentities($rawData, ENT_COMPAT, "UTF-8");
- }
-} \ No newline at end of file
+ }
+}