getMessage()}"); } }; add_action($tag, $callbackErrorHandler, $priority, $acceptedArgs); } /** * Function was copied from https://github.com/WordPress/wordpress-develop/blob/6.8.1/src/wp-includes/class-wp-plugin-dependencies.php#L872 * * @param string $pluginFile * @return string */ public static function convertFileNameToSlug($pluginFile) { return strpos($pluginFile, DIRECTORY_SEPARATOR) !== false ? dirname($pluginFile) : str_replace('.php', '', $pluginFile); } /** * @param string $minimalVersion * @return bool */ public static function isWpVersionSupported($minimalVersion) { // wp_get_wp_version return an unmodified WordPress version and is available since WordPress 6.7.0 // @link https://developer.wordpress.org/reference/functions/wp_get_wp_version/ if (function_exists('wp_get_wp_version')) { $currentWpVersion = wp_get_wp_version(); } else { $currentWpVersion = $GLOBALS['wp_version']; } return !is_null($currentWpVersion) && version_compare($currentWpVersion, $minimalVersion, '>='); } }