diff --git a/composer.json b/composer.json index 618b1eb..cce3d6c 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ } ], "require": { - "php": "~7.4.0 || ~8.0.0", + "php": "~7.4.0 || ^8.0", "composer-runtime-api": "^2.2" }, "require-dev": { diff --git a/src/ModuleLoader.php b/src/ModuleLoader.php index 098bcef..05e1271 100644 --- a/src/ModuleLoader.php +++ b/src/ModuleLoader.php @@ -6,6 +6,7 @@ use RuntimeException; use SzepeViktor\TestMode\Modules\Module; +use SzepeViktor\TestMode\ThirdPartyModules as ThirdParties; use function apply_filters; @@ -37,12 +38,29 @@ static function (string $fqcn): bool { ); } + /** + * @return list + */ + public static function getThirdParties(): array + { + $modules = []; + + if (class_exists(\MakeCommerce::class)) { + $modules[] = ThirdParties\MakeCommerce::class; + } + + return $modules; + } + /** * @return list */ public static function getAll(): array { - $modules = apply_filters('szepeviktor/test-mode/modules', self::getBuiltins()); + $modules = apply_filters( + 'szepeviktor/test-mode/modules', + array_merge(self::getBuiltins(), self::getThirdParties()) + ); return array_filter( $modules, diff --git a/src/Plugin.php b/src/Plugin.php index 0641611..96cb43b 100644 --- a/src/Plugin.php +++ b/src/Plugin.php @@ -34,7 +34,7 @@ public static function loadTextDomain() { /** @var string */ $pluginBasename = Config::get('baseName'); - load_plugin_textdomain('plugin-slug', false, sprintf('%s/%s', dirname($pluginBasename), 'languages')); + load_plugin_textdomain('szv-test-mode', false, sprintf('%s/%s', dirname($pluginBasename), 'languages')); } /** @@ -77,10 +77,10 @@ public static function printRequirementsNotice() printf( '

%1$s %3$s %4$s

', - esc_html__('Plugin Name activation failed! Please read', 'plugin-slug'), + esc_html__('Plugin Name activation failed! Please read', 'szv-test-mode'), esc_url('https://github.com/szepeviktor/starter-plugin#installation'), - esc_html__('the Installation instructions', 'plugin-slug'), - esc_html__('for list of requirements.', 'plugin-slug') + esc_html__('the Installation instructions', 'szv-test-mode'), + esc_html__('for list of requirements.', 'szv-test-mode') ); } diff --git a/src/ThirdPartyModules/MakeCommerce.php b/src/ThirdPartyModules/MakeCommerce.php new file mode 100644 index 0000000..c094074 --- /dev/null +++ b/src/ThirdPartyModules/MakeCommerce.php @@ -0,0 +1,45 @@ +