isPluginAdmin(); } catch (Throwable $e) { // Failing closed to non-admin is deliberate. Losing the reason is // not: this runs only after something upstream already threw, so // swallowing it turns an admin-access outage into "the page shows // less" with nothing linking the two. $logger = abj_service('logging'); if (is_object($logger) && method_exists($logger, 'debugMessage')) { $logger->debugMessage( 'Admin-status re-check threw; failing closed to non-admin. ' . get_class($e) . ' (code ' . (string)$e->getCode() . '): ' . $e->getMessage(), $e ); } return false; } } /** * The weakest rungs: the current WordPress user, then network super-admin. * * @return bool */ private static function askWordPress(): bool { if (function_exists('wp_get_current_user')) { $user = ABJ_404_Solution_UserRef::fromWpUser(wp_get_current_user()); if ($user !== null && $user->isAdministrator()) { return true; } } return function_exists('is_super_admin') && is_super_admin(); } }