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:
authorMatthieu Napoli <matthieu@mnapoli.fr>2014-11-14 06:45:35 +0300
committerMatthieu Napoli <matthieu@mnapoli.fr>2014-11-14 06:45:35 +0300
commita91388d2b1b3c60733ce19f35a4675a1ba6467df (patch)
tree77256a0a24b6085541d73ba19f277fe88a7d0866
parentc7295c121b94489edf2800c6b220ee86e7b4c496 (diff)
Replaced usage of deprecated Common::json_encode to json_encode
-rw-r--r--core/Common.php2
-rw-r--r--core/Plugin/MetadataLoader.php2
-rw-r--r--core/Tracker.php4
-rw-r--r--core/Translate.php2
-rw-r--r--core/Updates/1.8.3-b1.php4
-rw-r--r--plugins/CustomVariables/Archiver.php2
-rw-r--r--plugins/Dashboard/Controller.php10
-rw-r--r--plugins/Dashboard/Dashboard.php4
-rw-r--r--plugins/Goals/Controller.php2
-rw-r--r--plugins/MobileMessaging/API.php4
-rw-r--r--plugins/Overlay/Controller.php2
-rw-r--r--plugins/SEO/MajesticClient.php2
-rw-r--r--plugins/ScheduledReports/API.php10
-rw-r--r--plugins/ScheduledReports/Controller.php2
-rw-r--r--plugins/UserCountry/Controller.php16
-rw-r--r--plugins/UserCountryMap/Controller.php6
-rw-r--r--plugins/Widgetize/Controller.php2
-rw-r--r--tests/PHPUnit/Fixtures/UITestFixture.php4
-rw-r--r--tests/PHPUnit/TestingEnvironment.php2
19 files changed, 41 insertions, 41 deletions
diff --git a/core/Common.php b/core/Common.php
index 823e884af1..a3e7515a24 100644
--- a/core/Common.php
+++ b/core/Common.php
@@ -462,7 +462,7 @@ class Common
// we deal w/ json differently
if ($varType == 'json') {
$value = self::undoMagicQuotes($requestArrayToUse[$varName]);
- $value = self::json_decode($value, $assoc = true);
+ $value = json_decode($value, $assoc = true);
return self::sanitizeInputValues($value, $alreadyStripslashed = true);
}
diff --git a/core/Plugin/MetadataLoader.php b/core/Plugin/MetadataLoader.php
index 34bb90dcdc..e75bc58338 100644
--- a/core/Plugin/MetadataLoader.php
+++ b/core/Plugin/MetadataLoader.php
@@ -95,7 +95,7 @@ class MetadataLoader
return array();
}
- $info = Common::json_decode($json, $assoc = true);
+ $info = json_decode($json, $assoc = true);
if (!is_array($info)
|| empty($info)
) {
diff --git a/core/Tracker.php b/core/Tracker.php
index 38467fc65d..a84afd9632 100644
--- a/core/Tracker.php
+++ b/core/Tracker.php
@@ -436,7 +436,7 @@ class Tracker
$result['message'] = $this->getMessageFromException($e);
}
Common::sendHeader('Content-Type: application/json');
- echo Common::json_encode($result);
+ echo json_encode($result);
die(1);
exit;
}
@@ -496,7 +496,7 @@ class Tracker
$this->outputAccessControlHeaders();
Common::sendHeader('Content-Type: application/json');
- echo Common::json_encode($result);
+ echo json_encode($result);
exit;
}
switch ($this->getState()) {
diff --git a/core/Translate.php b/core/Translate.php
index 65381c0a2d..c29d0f0339 100644
--- a/core/Translate.php
+++ b/core/Translate.php
@@ -173,7 +173,7 @@ class Translate
$clientSideTranslations[$key] = $translations[$plugin][$stringName];
}
- $js = 'var translations = ' . Common::json_encode($clientSideTranslations) . ';';
+ $js = 'var translations = ' . json_encode($clientSideTranslations) . ';';
$js .= "\n" . 'if (typeof(piwik_translations) == \'undefined\') { var piwik_translations = new Object; }' .
'for(var i in translations) { piwik_translations[i] = translations[i];} ';
return $js;
diff --git a/core/Updates/1.8.3-b1.php b/core/Updates/1.8.3-b1.php
index 7a00ec20b3..ee8e6c4d00 100644
--- a/core/Updates/1.8.3-b1.php
+++ b/core/Updates/1.8.3-b1.php
@@ -98,8 +98,8 @@ class Updates_1_8_3_b1 extends Updates
is_null($period) ? ScheduledReports::DEFAULT_PERIOD : $period,
ScheduledReports::EMAIL_TYPE,
is_null($format) ? ScheduledReports::DEFAULT_REPORT_FORMAT : $format,
- Common::json_encode(preg_split('/,/', $reports)),
- Common::json_encode($parameters),
+ json_encode(preg_split('/,/', $reports)),
+ json_encode($parameters),
$ts_created,
$ts_last_sent,
$deleted
diff --git a/plugins/CustomVariables/Archiver.php b/plugins/CustomVariables/Archiver.php
index 47e1363dc4..704038b0a1 100644
--- a/plugins/CustomVariables/Archiver.php
+++ b/plugins/CustomVariables/Archiver.php
@@ -154,7 +154,7 @@ class Archiver extends \Piwik\Plugin\Archiver
if (substr($value, -2) != '"]') {
$value .= '"]';
}
- $decoded = @Common::json_decode($value);
+ $decoded = json_decode($value);
if (is_array($decoded)) {
$count = 0;
foreach ($decoded as $category) {
diff --git a/plugins/Dashboard/Controller.php b/plugins/Dashboard/Controller.php
index c7a89a75a5..4c7d0c53f4 100644
--- a/plugins/Dashboard/Controller.php
+++ b/plugins/Dashboard/Controller.php
@@ -39,7 +39,7 @@ class Controller extends \Piwik\Plugin\Controller
$view = new View($template);
$this->setGeneralVariablesView($view);
- $view->availableWidgets = Common::json_encode(WidgetsList::get());
+ $view->availableWidgets = json_encode(WidgetsList::get());
$view->availableLayouts = $this->getAvailableLayouts();
$view->dashboardId = Common::getRequestVar('idDashboard', 1, 'int');
@@ -75,7 +75,7 @@ class Controller extends \Piwik\Plugin\Controller
$this->checkTokenInUrl();
Json::sendHeaderJSON();
- return Common::json_encode(WidgetsList::get());
+ return json_encode(WidgetsList::get());
}
public function getDashboardLayout($checkToken = true)
@@ -148,7 +148,7 @@ class Controller extends \Piwik\Plugin\Controller
$dashboards = $this->dashboard->getAllDashboards($login);
Json::sendHeaderJSON();
- return Common::json_encode($dashboards);
+ return json_encode($dashboards);
}
/**
@@ -175,7 +175,7 @@ class Controller extends \Piwik\Plugin\Controller
$nextId = $this->getModel()->createNewDashboardForUser($login, $name, $layout);
Json::sendHeaderJSON();
- return Common::json_encode($nextId);
+ return json_encode($nextId);
}
public function copyDashboardToUser()
@@ -197,7 +197,7 @@ class Controller extends \Piwik\Plugin\Controller
$nextId = $this->getModel()->createNewDashboardForUser($user, $name, $layout);
Json::sendHeaderJSON();
- return Common::json_encode($nextId);
+ return json_encode($nextId);
}
}
diff --git a/plugins/Dashboard/Dashboard.php b/plugins/Dashboard/Dashboard.php
index 1ff5a98182..a0a12985c3 100644
--- a/plugins/Dashboard/Dashboard.php
+++ b/plugins/Dashboard/Dashboard.php
@@ -193,12 +193,12 @@ class Dashboard extends \Piwik\Plugin
$layout = str_replace("\\\"", "\"", $layout);
$layout = str_replace("\n", "", $layout);
- return Common::json_decode($layout, $assoc = false);
+ return json_decode($layout, $assoc = false);
}
public function encodeLayout($layout)
{
- return Common::json_encode($layout);
+ return json_encode($layout);
}
public function getJsFiles(&$jsFiles)
diff --git a/plugins/Goals/Controller.php b/plugins/Goals/Controller.php
index e7af6d6243..3e61eb06e3 100644
--- a/plugins/Goals/Controller.php
+++ b/plugins/Goals/Controller.php
@@ -168,7 +168,7 @@ class Controller extends \Piwik\Plugin\Controller
$goal['pattern'] = Common::unsanitizeInputValue($goal['pattern']);
}
}
- $view->goalsJSON = Common::json_encode($goals);
+ $view->goalsJSON = json_encode($goals);
$view->userCanEditGoals = Piwik::isUserHasAdminAccess($this->idSite);
$view->ecommerceEnabled = $this->site->isEcommerceEnabled();
diff --git a/plugins/MobileMessaging/API.php b/plugins/MobileMessaging/API.php
index c8268c76a7..aaf30e6a64 100644
--- a/plugins/MobileMessaging/API.php
+++ b/plugins/MobileMessaging/API.php
@@ -365,7 +365,7 @@ class API extends \Piwik\Plugin\API
{
Option::set(
$user . MobileMessaging::USER_SETTINGS_POSTFIX_OPTION,
- Common::json_encode($settings)
+ json_encode($settings)
);
}
@@ -392,7 +392,7 @@ class API extends \Piwik\Plugin\API
if (empty($userSettings)) {
$userSettings = array();
} else {
- $userSettings = Common::json_decode($userSettings, true);
+ $userSettings = json_decode($userSettings, true);
}
return $userSettings;
diff --git a/plugins/Overlay/Controller.php b/plugins/Overlay/Controller.php
index ea540c6e14..7ddfde1e41 100644
--- a/plugins/Overlay/Controller.php
+++ b/plugins/Overlay/Controller.php
@@ -160,7 +160,7 @@ class Controller extends \Piwik\Plugin\Controller
var urlToRedirect = window.location.hash.substr(1);
var urlToRedirectWithoutPrefix = removeUrlPrefix(urlToRedirect);
- var knownUrls = ' . Common::json_encode($urls) . ';
+ var knownUrls = ' . json_encode($urls) . ';
for (var i = 0; i < knownUrls.length; i++) {
var testUrl = removeUrlPrefix(knownUrls[i]);
if (urlToRedirectWithoutPrefix.substr(0, testUrl.length) == testUrl) {
diff --git a/plugins/SEO/MajesticClient.php b/plugins/SEO/MajesticClient.php
index 5031958209..b7a7eeddc8 100644
--- a/plugins/SEO/MajesticClient.php
+++ b/plugins/SEO/MajesticClient.php
@@ -65,7 +65,7 @@ class MajesticClient
'referrer_domains_count' => false
);
- $apiResponse = Common::json_decode($apiResponse, $assoc = true);
+ $apiResponse = json_decode($apiResponse, $assoc = true);
if (!empty($apiResponse)
&& !empty($apiResponse['Data'])
) {
diff --git a/plugins/ScheduledReports/API.php b/plugins/ScheduledReports/API.php
index 66eb55a235..e8a105114b 100644
--- a/plugins/ScheduledReports/API.php
+++ b/plugins/ScheduledReports/API.php
@@ -236,10 +236,10 @@ class API extends \Piwik\Plugin\API
foreach ($reports as &$report) {
// decode report parameters
- $report['parameters'] = Common::json_decode($report['parameters'], true);
+ $report['parameters'] = json_decode($report['parameters'], true);
// decode report list
- $report['reports'] = Common::json_decode($report['reports'], true);
+ $report['reports'] = json_decode($report['reports'], true);
}
// static cache
@@ -294,7 +294,7 @@ class API extends \Piwik\Plugin\API
}
// override and/or validate report parameters
- $report['parameters'] = Common::json_decode(
+ $report['parameters'] = json_decode(
self::validateReportParameters($reportType, empty($parameters) ? $report['parameters'] : $parameters),
true
);
@@ -624,7 +624,7 @@ class API extends \Piwik\Plugin\API
*/
Piwik::postEvent(self::VALIDATE_PARAMETERS_EVENT, array(&$parameters, $reportType));
- return Common::json_encode($parameters);
+ return json_encode($parameters);
}
private static function validateAndTruncateDescription(&$description)
@@ -653,7 +653,7 @@ class API extends \Piwik\Plugin\API
}
}
- return Common::json_encode($requestedReports);
+ return json_encode($requestedReports);
}
private static function validateCommonReportAttributes($period, $hour, &$description, &$idSegment, $reportType, $reportFormat)
diff --git a/plugins/ScheduledReports/Controller.php b/plugins/ScheduledReports/Controller.php
index 2bb64b8faf..2ae16cc410 100644
--- a/plugins/ScheduledReports/Controller.php
+++ b/plugins/ScheduledReports/Controller.php
@@ -66,7 +66,7 @@ class Controller extends \Piwik\Plugin\Controller
}
}
$view->reports = $reports;
- $view->reportsJSON = Common::json_encode($reportsById);
+ $view->reportsJSON = json_encode($reportsById);
$view->downloadOutputType = API::OUTPUT_INLINE;
diff --git a/plugins/UserCountry/Controller.php b/plugins/UserCountry/Controller.php
index a6ed712dbe..145f981cc3 100644
--- a/plugins/UserCountry/Controller.php
+++ b/plugins/UserCountry/Controller.php
@@ -135,9 +135,9 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
$result['next_screen'] = $this->getGeoIpUpdaterManageScreen();
}
- return Common::json_encode($result);
+ return json_encode($result);
} catch (Exception $ex) {
- return Common::json_encode(array('error' => $ex->getMessage()));
+ return json_encode(array('error' => $ex->getMessage()));
}
}
}
@@ -207,15 +207,15 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
// the browser so it can download it next
$info = $this->getNextMissingDbUrlInfo();
if ($info !== false) {
- return Common::json_encode($info);
+ return json_encode($info);
} else {
$view = new View("@UserCountry/_updaterNextRunTime");
$view->nextRunTime = GeoIPAutoUpdater::getNextRunTime();
$nextRunTimeHtml = $view->render();
- return Common::json_encode(array('nextRunTime' => $nextRunTimeHtml));
+ return json_encode(array('nextRunTime' => $nextRunTimeHtml));
}
} catch (Exception $ex) {
- return Common::json_encode(array('error' => $ex->getMessage()));
+ return json_encode(array('error' => $ex->getMessage()));
}
}
}
@@ -270,13 +270,13 @@ class Controller extends \Piwik\Plugin\ControllerAdmin
$info = $this->getNextMissingDbUrlInfo();
if ($info !== false) {
- return Common::json_encode($info);
+ return json_encode($info);
}
}
- return Common::json_encode($result);
+ return json_encode($result);
} catch (Exception $ex) {
- return Common::json_encode(array('error' => $ex->getMessage()));
+ return json_encode(array('error' => $ex->getMessage()));
}
}
}
diff --git a/plugins/UserCountryMap/Controller.php b/plugins/UserCountryMap/Controller.php
index e5f845d80a..914835439e 100644
--- a/plugins/UserCountryMap/Controller.php
+++ b/plugins/UserCountryMap/Controller.php
@@ -63,7 +63,7 @@ class Controller extends \Piwik\Plugin\Controller
$view->defaultMetric = 'nb_visits';
// some translations
- $view->localeJSON = Common::json_encode(array(
+ $view->localeJSON = json_encode(array(
'nb_visits' => Piwik::translate('General_NVisits'),
'one_visit' => Piwik::translate('General_OneVisit'),
'no_visit' => Piwik::translate('UserCountryMap_NoVisit'),
@@ -90,7 +90,7 @@ class Controller extends \Piwik\Plugin\Controller
$view->metrics = $config['metrics'] = $this->getMetrics($idSite, $period, $date, $token_auth);
$config['svgBasePath'] = 'plugins/UserCountryMap/svg/';
$config['mapCssPath'] = 'plugins/UserCountryMap/stylesheets/map.css';
- $view->config = Common::json_encode($config);
+ $view->config = json_encode($config);
$view->noData = empty($config['visitsSummary']['nb_visits']);
return $view->render();
@@ -198,7 +198,7 @@ class Controller extends \Piwik\Plugin\Controller
}
if ($encode) {
- $params = Common::json_encode($params);
+ $params = json_encode($params);
}
return $params;
}
diff --git a/plugins/Widgetize/Controller.php b/plugins/Widgetize/Controller.php
index 043ff8134d..5b1d31b586 100644
--- a/plugins/Widgetize/Controller.php
+++ b/plugins/Widgetize/Controller.php
@@ -22,7 +22,7 @@ class Controller extends \Piwik\Plugin\Controller
public function index()
{
$view = new View('@Widgetize/index');
- $view->availableWidgets = Common::json_encode(WidgetsList::get());
+ $view->availableWidgets = json_encode(WidgetsList::get());
$this->setGeneralVariablesView($view);
return $view->render();
}
diff --git a/tests/PHPUnit/Fixtures/UITestFixture.php b/tests/PHPUnit/Fixtures/UITestFixture.php
index 8ff2282402..5eb6cf2610 100644
--- a/tests/PHPUnit/Fixtures/UITestFixture.php
+++ b/tests/PHPUnit/Fixtures/UITestFixture.php
@@ -249,7 +249,7 @@ class UITestFixture extends SqlDump
} else {
$_GET['name'] = 'dashboard name' . $id;
}
- $_GET['layout'] = Common::json_encode($layout);
+ $_GET['layout'] = json_encode($layout);
$_GET['idDashboard'] = $id + 1;
FrontController::getInstance()->fetchDispatch('Dashboard', 'saveLayout');
}
@@ -271,7 +271,7 @@ class UITestFixture extends SqlDump
);
$_GET['name'] = 'D4';
- $_GET['layout'] = Common::json_encode($dashboard);
+ $_GET['layout'] = json_encode($dashboard);
$_GET['idDashboard'] = 5;
$_GET['idSite'] = 2;
FrontController::getInstance()->fetchDispatch('Dashboard', 'saveLayout');
diff --git a/tests/PHPUnit/TestingEnvironment.php b/tests/PHPUnit/TestingEnvironment.php
index c52556fa7d..98e1566c5d 100644
--- a/tests/PHPUnit/TestingEnvironment.php
+++ b/tests/PHPUnit/TestingEnvironment.php
@@ -249,7 +249,7 @@ class Piwik_TestingEnvironment
'contents' => $outputContent
);
- file_put_contents($outputFile, Common::json_encode($outputContents));
+ file_put_contents($outputFile, json_encode($outputContents));
});
}