$options The plugin options. * @return string 'admin.php' or 'options-general.php'. */ public static function pageFile(array $options): string { $menuLocation = isset($options['menuLocation']) && is_string($options['menuLocation']) ? $options['menuLocation'] : ''; return $menuLocation === 'settingsLevel' ? self::FILE_TOP_LEVEL : self::FILE_UNDER_SETTINGS; } /** * An absolute, unescaped URL to one of the plugin's subpages. * * Returned raw (not run through esc_url) so callers can append a * `#fragment` and escape once, at the point the URL is written into * markup. * * @param string $subpage The subpage slug, e.g. 'abj404_options'. * @param array $queryArgs Extra query args, added in the * order given. Keys and values are both url-encoded. * @param array $options The plugin options. * @return string */ public static function subpageUrl(string $subpage, array $queryArgs, array $options): string { $path = self::pageFile($options) . '?page=' . rawurlencode(ABJ404_PP) . '&subpage=' . rawurlencode($subpage); foreach ($queryArgs as $key => $value) { $path .= '&' . rawurlencode((string)$key) . '=' . rawurlencode((string)$value); } return admin_url($path); } }