fixed closure fail (use of $this)

This commit is contained in:
Steffen Schröder 2014-03-19 10:54:21 +01:00
parent 26c9024537
commit a3bc7bf1b0

View File

@ -218,15 +218,17 @@ class ManiaExchangeManager {
// compile search URL // compile search URL
$url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $string; $url = 'http://api.mania-exchange.com/' . $titlePrefix . '/maps/?ids=' . $string;
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($titlePrefix, $url) { $thisRef = $this;
$success = $this->maniaControl->fileReader->loadFile($url, function ($mapInfo, $error) use ($thisRef, $titlePrefix, $url) {
if ($error) { if ($error) {
trigger_error($error . " " . $url); trigger_error($error . " " . $url);
return null; return null;
} }
if ($mapInfo == '') { if (!$mapInfo) {
return null; return null;
} }
$mxMapList = json_decode($mapInfo); $mxMapList = json_decode($mapInfo);
if ($mxMapList === null) { if ($mxMapList === null) {
trigger_error('Cannot decode searched JSON data from ' . $url); trigger_error('Cannot decode searched JSON data from ' . $url);
@ -243,7 +245,7 @@ class ManiaExchangeManager {
} }
} }
$this->updateMapObjectsWithManiaExchangeIds($maps); $thisRef->updateMapObjectsWithManiaExchangeIds($maps);
return true; return true;
}, "application/json"); }, "application/json");