| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* Plugin Name: Product Specifications for WooCommerce |
| 5 |
* Plugin URI: https://github.com/dornaweb/product-specifications/ |
| 6 |
* Description: This plugin adds a product specifications table to your woocommerce products. |
| 7 |
* Version: 0.8.6 |
| 8 |
* Author: Amin Abdolrezapoor |
| 9 |
* Author URI: https://amin.nz |
| 10 |
* License: GPL-2.0+ |
| 11 |
* Requires Plugins: woocommerce |
| 12 |
* Requires PHP: 7.4 |
| 13 |
* Requires at least: 5.9 |
| 14 |
* WC tested up to: 9.3.3 |
| 15 |
* WC requires at least: 8.0.0 |
| 16 |
*/ |
| 17 |
declare (strict_types=1); |
| 18 |
namespace Amiut\ProductSpecs; |
| 19 |
|
| 20 |
// phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols |
| 21 |
use ProductSpecifications\Vendor\Inpsyde\Modularity\Package; |
| 22 |
use ProductSpecifications\Vendor\Inpsyde\Modularity\Properties\PluginProperties; |
| 23 |
use Throwable; |
| 24 |
defined('ABSPATH') || exit; |
| 25 |
if (!defined('DWSPECS_PLUGIN_FILE')) { |
| 26 |
define('DWSPECS_PLUGIN_FILE', __FILE__); |
| 27 |
} |
| 28 |
function handleFailure(Throwable $throwable): void |
| 29 |
{ |
| 30 |
add_action('all_admin_notices', static function () use ($throwable) { |
| 31 |
$class = 'notice notice-error'; |
| 32 |
printf('<div class="%s"><p>%s</p></div>', esc_attr($class), wp_kses_post(sprintf('<strong>Error:</strong> %s <br><pre>%s</pre>', $throwable->getMessage(), $throwable->getTraceAsString()))); |
| 33 |
}); |
| 34 |
} |
| 35 |
function setupAutoLoader(): void |
| 36 |
{ |
| 37 |
if (class_exists(\Amiut\ProductSpecs\Content\Module::class)) { |
| 38 |
return; |
| 39 |
} |
| 40 |
if (is_readable(__DIR__ . '/vendor/autoload.php')) { |
| 41 |
require_once __DIR__ . '/vendor/autoload.php'; |
| 42 |
} |
| 43 |
} |
| 44 |
function bootstrap(): void |
| 45 |
{ |
| 46 |
try { |
| 47 |
setupAutoLoader(); |
| 48 |
$plugin = Package::new(PluginProperties::new(__FILE__)); |
| 49 |
\Amiut\ProductSpecs\App::instance(); |
| 50 |
$plugin->addModule(new \Amiut\ProductSpecs\Assets\Module())->addModule(new \Amiut\ProductSpecs\Template\Module())->addModule(new \Amiut\ProductSpecs\Repository\Module())->addModule(new \Amiut\ProductSpecs\Content\Module())->addModule(new \Amiut\ProductSpecs\Admin\Module())->addModule(new \Amiut\ProductSpecs\AttributesListUi\Module())->addModule(new \Amiut\ProductSpecs\AttributeGroupsListUi\Module())->addModule(new \Amiut\ProductSpecs\ImportExport\Module())->addModule(new \Amiut\ProductSpecs\Settings\Module())->addModule(new \Amiut\ProductSpecs\Integration\Module())->addModule(new \Amiut\ProductSpecs\Attribute\Module())->addModule(new \Amiut\ProductSpecs\Shortcode\Module())->addModule(new \Amiut\ProductSpecs\Metabox\Module())->addModule(new \Amiut\ProductSpecs\EntityUpdater\Module())->addModule(new \Amiut\ProductSpecs\EntityUpdaterUi\Module())->addModule(new \Amiut\ProductSpecs\ProductSpecifications\Module())->addModule(new \Amiut\ProductSpecs\SpecificationsTable\Module())->boot(); |
| 51 |
} catch (Throwable $throwable) { |
| 52 |
handleFailure($throwable); |
| 53 |
} |
| 54 |
} |
| 55 |
add_action('plugins_loaded', __NAMESPACE__ . '\bootstrap'); |
| 56 |
|