PHP8/Misc

* reduce redundancy after merge
This commit is contained in:
Sarjuuk
2021-10-24 17:31:16 +02:00
parent f9584f09b5
commit 557638b3fe

View File

@@ -114,12 +114,8 @@ switch ($pageCall)
catch (Exception $e) // no, apparently not.. catch (Exception $e) // no, apparently not..
{ {
$class = $cleanName.'Page'; $class = $cleanName.'Page';
if (is_callable([$class, 'display']))
(new $class($pageCall, $pageParam))->display();
else if (method_exists($class, 'display'))
{
// PHP 8 requires an instance of $class for is_callable to work
$classInstance = new $class($pageCall, $pageParam); $classInstance = new $class($pageCall, $pageParam);
if (is_callable([$classInstance, 'display'])) if (is_callable([$classInstance, 'display']))
$classInstance->display(); $classInstance->display();
else if (isset($_GET['power'])) else if (isset($_GET['power']))
@@ -127,11 +123,6 @@ switch ($pageCall)
else // in conjunction with a proper rewriteRule in .htaccess... else // in conjunction with a proper rewriteRule in .htaccess...
(new GenericPage($pageCall))->error(); (new GenericPage($pageCall))->error();
} }
else if (isset($_GET['power']))
die('$WowheadPower.register(0, '.User::$localeId.', {})');
else // in conjunction with a proper rewriteRule in .htaccess...
(new GenericPage($pageCall))->error();
}
break; break;
/* other pages */ /* other pages */