[9.3.00] renommage de variables de fonctions

This commit is contained in:
fredtempez 2019-08-11 16:18:16 +02:00
parent 5617ab6558
commit f63ee3e13a
1 changed files with 14 additions and 15 deletions

View File

@ -317,9 +317,9 @@ class common {
$googlePagespeedData = json_decode($googlePagespeedData, true); $googlePagespeedData = json_decode($googlePagespeedData, true);
$screenshot = $googlePagespeedData['screenshot']['data']; $screenshot = $googlePagespeedData['screenshot']['data'];
$screenshot = str_replace(array('_','-'),array('/','+'),$screenshot); $screenshot = str_replace(array('_','-'),array('/','+'),$screenshot);
$data = 'data:image/jpeg;base64,'.$screenshot; $tempData = 'data:image/jpeg;base64,'.$screenshot;
$data = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $data)); $tempData = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $tempData));
file_put_contents( self::FILE_DIR.'source/screenshot.png',$data); file_put_contents( self::FILE_DIR.'source/screenshot.png',$tempData);
} }
} }
} }
@ -337,20 +337,20 @@ class common {
if($keys === null) { if($keys === null) {
return $this->data; return $this->data;
} }
// Décent dans les niveaux de la variable $data // Descend dans les niveaux de la variable data
$data = $this->data; $tempData = $this->data;
foreach($keys as $key) { foreach($keys as $key) {
// Si aucune donnée n'existe retourne null // Si aucune donnée n'existe retourne null
if(isset($data[$key]) === false) { if(isset($tempData[$key]) === false) {
return null; return null;
} }
// Sinon décent dans les niveaux // Sinon décent dans les niveaux
else { else {
$data = $data[$key]; $tempData = $tempData[$key];
} }
} }
// Retourne les données // Retourne les données
return $data; return $tempData;
} }
/** /**
@ -488,7 +488,6 @@ class common {
* nombre de clés supérieur à 1 : écriture clé à clé. * nombre de clés supérieur à 1 : écriture clé à clé.
*/ */
public function saveData($keys = []) { public function saveData($keys = []) {
// Langue du frontend en cours d'édition // Langue du frontend en cours d'édition
// $lang = $this->readI18nData('frontend'); // $lang = $this->readI18nData('frontend');
$lang = 'fr'; $lang = 'fr';
@ -567,7 +566,7 @@ class common {
public function readData() { public function readData() {
// reset du tableau // reset du tableau
$lang = 'fr'; $lang = 'fr';
$data = []; $tempData = [];
// Boucle des modules // Boucle des modules
foreach (self::$dataStage as $stageId) { foreach (self::$dataStage as $stageId) {
@ -579,14 +578,14 @@ class common {
'dir' => $folder, 'dir' => $folder,
'template' => self::TEMP_DIR . 'data.template.json' 'template' => self::TEMP_DIR . 'data.template.json'
]); ]);
$tempData = $db[$stageId]->get($stageId); $dbData = $db[$stageId]->get($stageId);
if ($tempData) { if ($dbData) {
$data [$stageId] = $tempData; $tempData [$stageId] = $dbData;
} else { } else {
$data [$stageId] = []; $tempData [$stageId] = [];
} }
} }
$this->data = $data; $this->data = $tempData;
} }
/** /**