Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PS 8] Tools::jsonDecode change to json_decode #20

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions ps_emailsmanager.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ public function getEmailsTranslations($iso_lang)
$translations = Tools::file_get_contents(
'http://api.addons.prestashop.com/index.php?version=1&method=translations&type=emails&iso_lang='.$iso_lang
);
$translations = Tools::jsonDecode($translations, true);
$translations = json_decode($translations, true);

if (is_null($translations) || !$translations) {
return false;
Expand Down Expand Up @@ -310,7 +310,7 @@ public function saveTemplateConf()
$this->context->smarty->assign($this->getTplVariables());

// ... and add a record in the database
Configuration::updateGlobalValue('MAILMANAGER_CURRENT_CONF_'.$this->getCurrentThemeId(), Tools::jsonEncode($userSettings));
Configuration::updateGlobalValue('MAILMANAGER_CURRENT_CONF_'.$this->getCurrentThemeId(), json_encode($userSettings));

// Change smarty delimiters to ease the parsing process
$this->context->smarty->left_delimiter = '{{';
Expand Down Expand Up @@ -670,9 +670,9 @@ public function getCurrentTemplate()
{
$currentTpl = Configuration::getGlobalValue('MAILMANAGER_CURRENT_CONF_'.$this->getCurrentThemeId());
if ($currentTpl) {
$currentTpl = Tools::jsonDecode($currentTpl, true);
$currentTpl = json_decode($currentTpl, true);
$path = $this->importsPath.$currentTpl['name'];
$settings = Tools::jsonDecode(Tools::file_get_contents($path.DIRECTORY_SEPARATOR.'settings.json'), true);
$settings = json_decode(Tools::file_get_contents($path.DIRECTORY_SEPARATOR.'settings.json'), true);
return is_null($settings) ? false : $settings;
} else {
return array(
Expand All @@ -686,7 +686,7 @@ public function getCurrentTemplate()
public function getTemplateSettings($name)
{
$path = $this->importsPath.$name;
$settings = Tools::jsonDecode(Tools::file_get_contents($path.DIRECTORY_SEPARATOR.'settings.json'), true);
$settings = json_decode(Tools::file_get_contents($path.DIRECTORY_SEPARATOR.'settings.json'), true);

if (is_null($settings)) {
$this->_errors[] = $this->l('Invalid settings.json');
Expand Down Expand Up @@ -788,7 +788,7 @@ public function displayForm($tplName)
public function getFieldsValue(array $settings)
{
$fieldsValue = array();
$userSettings = Tools::jsonDecode(Configuration::getGlobalValue('MAILMANAGER_CURRENT_CONF_'.$this->getCurrentThemeId()), true);
$userSettings = json_decode(Configuration::getGlobalValue('MAILMANAGER_CURRENT_CONF_'.$this->getCurrentThemeId()), true);

// If the template currently installed is not the same that the one that
// is being configured, load the default values
Expand Down Expand Up @@ -844,7 +844,7 @@ public function getAvailableTemplates()
if (file_exists($settings)) {
$settings = Tools::file_get_contents($settings);
if ($settings) {
$template = Tools::jsonDecode($settings, true);
$template = json_decode($settings, true);
$template['folder'] = $tpl;
$templates[] = $template;
}
Expand Down Expand Up @@ -985,7 +985,7 @@ public function unpackTemplates($zipPath, $filename)

$settingsPath = $destPath.DIRECTORY_SEPARATOR.'settings.json';
$settings = Tools::file_get_contents($settingsPath);
$settings = Tools::jsonDecode($settings, true);
$settings = json_decode($settings, true);
if (!$settings || is_null($settings)) {
$this->_errors[] = $this->l('Settings file is missing');
} elseif (!isset($settings['name']) || empty($settings['name'])) {
Expand Down