1) { $class_name = array_pop($parts); $sub_dir = strtolower(implode('/', $parts)); $file = $base_dir . $sub_dir . '/' . $class_name . '.php'; } } if (file_exists($file)) { require_once $file; } }); require_once OUTERWHISPER_PLUGIN_PATH . 'includes/Core.php'; if (!function_exists('outerwhisper_activate')) { function outerwhisper_activate() { if (!function_exists('is_plugin_active')) { require_once(ABSPATH . 'wp-admin/includes/plugin.php'); } if (is_plugin_active('outerwhisper-premium/outerwhisper.php')) { wp_die('The Pro version of OuterWhisper is already active. Please deactivate the Pro version first before activating the free version.'); } if (!class_exists('\OuterWhisper\Core')) { require_once OUTERWHISPER_PLUGIN_PATH . 'includes/Core.php'; } \OuterWhisper\Core::plugin_activation(); } } register_activation_hook( __FILE__, 'outerwhisper_activate' ); add_filter('load_script_translation_file', function ($file, $handle, $domain) { if ($domain !== 'outerwhisper') { return $file; } // If WordPress did not find a translation file for the active locale if (!$file || !file_exists($file)) { // Construct the path to the en_GB fallback file // Replaces any locale in the filename (or empty) with en_GB $locale = determine_locale(); $fallback_file = str_replace("-{$locale}-", '-en_GB-', (string) $file); if ($fallback_file && file_exists($fallback_file)) { return $fallback_file; } } return $file; }, 10, 3); // Start add_action('init', function() { $languageHelper = new \OuterWhisper\Helper\LanguageHelper(); $languageHelper->load_textdomain(); $plugin = new \OuterWhisper\Core(); $plugin->run(); }, 5);