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 'plugins/API/Renderer/Php.php')
-rw-r--r--plugins/API/Renderer/Php.php85
1 files changed, 0 insertions, 85 deletions
diff --git a/plugins/API/Renderer/Php.php b/plugins/API/Renderer/Php.php
deleted file mode 100644
index 50836abea7..0000000000
--- a/plugins/API/Renderer/Php.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-/**
- * Piwik - free/libre analytics platform
- *
- * @link https://matomo.org
- * @license http://www.gnu.org/licenses/gpl-3.0.html GPL v3 or later
- *
- */
-namespace Piwik\Plugins\API\Renderer;
-
-use Piwik\API\ApiRenderer;
-use Piwik\Common;
-use Piwik\Piwik;
-
-class Php extends ApiRenderer
-{
- public function renderSuccess($message)
- {
- $success = array('result' => 'success', 'message' => $message);
-
- return $this->serializeIfNeeded($success);
- }
-
- /**
- * @param $message
- * @param \Exception|\Throwable $exception
- * @return string
- */
- public function renderException($message, $exception)
- {
- $message = array('result' => 'error', 'message' => $message);
-
- return $this->serializeIfNeeded($message);
- }
-
- public function renderDataTable($dataTable)
- {
- /** @var \Piwik\DataTable\Renderer\Php $tableRenderer */
- $tableRenderer = $this->buildDataTableRenderer($dataTable);
-
- $tableRenderer->setSerialize($this->shouldSerialize(1));
- $tableRenderer->setPrettyDisplay(Common::getRequestVar('prettyDisplay', false, 'int', $this->request));
-
- return $tableRenderer->render();
- }
-
- public function renderArray($array)
- {
- if (!Piwik::isMultiDimensionalArray($array)) {
- return $this->renderDataTable($array);
- }
-
- if ($this->shouldSerialize(1)) {
- return serialize($array);
- }
-
- return $array;
- }
-
- public function sendHeader()
- {
- Common::sendHeader('Content-Type: text/plain; charset=utf-8');
- }
-
- /**
- * Returns true if the user requested to serialize the output data (&serialize=1 in the request)
- *
- * @param mixed $defaultSerializeValue Default value in case the user hasn't specified a value
- * @return bool
- */
- private function shouldSerialize($defaultSerializeValue)
- {
- $serialize = Common::getRequestVar('serialize', $defaultSerializeValue, 'int', $this->request);
-
- return !empty($serialize);
- }
-
- private function serializeIfNeeded($response)
- {
- if ($this->shouldSerialize(1)) {
- return serialize($response);
- }
- return $response;
- }
-}