diff --git a/wp-allstars-plugin.php b/wp-allstars-plugin.php index 70a4e22..7f4c2aa 100644 --- a/wp-allstars-plugin.php +++ b/wp-allstars-plugin.php @@ -20,11 +20,21 @@ if ( ! defined( 'WPINC' ) ) { } // Define plugin version - extract from plugin header -function wp_allstars_get_plugin_version() { - $plugin_data = get_file_data(__FILE__, array('Version' => 'Version')); - return $plugin_data['Version']; +if (!function_exists('get_plugin_data')) { + require_once(ABSPATH . 'wp-admin/includes/plugin.php'); +} + +// Define the version constant - first try get_plugin_data() if available, +// otherwise fall back to direct string extraction +if (function_exists('get_plugin_data')) { + $plugin_data = get_plugin_data(__FILE__, false, false); + define('WP_ALLSTARS_VERSION', $plugin_data['Version']); +} else { + // Manual extraction as fallback + $plugin_file = file_get_contents(__FILE__); + preg_match('/Version:\s*([^\s]+)/i', $plugin_file, $matches); + define('WP_ALLSTARS_VERSION', isset($matches[1]) ? $matches[1] : '0.1.0 (Beta)'); } -define( 'WP_ALLSTARS_VERSION', wp_allstars_get_plugin_version() ); // Activation hook function wp_allstars_activate() {