Fix public status location (#10526)

* Fix public status location
Implementing __toString() seemed to be the most elegant way to fix it.
Added pre-loading for locations too

* Take advantage of new __toString function
This commit is contained in:
Tony Murray
2019-08-19 22:52:21 -05:00
committed by GitHub
parent 610afac9e7
commit d3243bd32e
4 changed files with 10 additions and 11 deletions

View File

@@ -251,15 +251,9 @@ class DeviceController extends TableController
*/
private function getLocation($device)
{
if ($device->location) {
if (extension_loaded('mbstring')) {
return mb_substr($device->location->location, 0, 32, 'utf8');
} else {
return substr($device->location->location, 0, 32);
}
}
return '';
return extension_loaded('mbstring')
? mb_substr($device->location, 0, 32, 'utf8')
: substr($device->location, 0, 32);
}
/**