PluginProbe
Product Specifications for Woocommerce / 0.8.3
Product Specifications for Woocommerce v0.8.3
0.8.10 trunk 0.4.0 0.4.1 0.4.2 0.4.3 0.5.0 0.5.1 0.5.2 0.5.3 0.6.0 0.7.0 0.7.1 0.7.2 0.7.3 0.7.4 0.8.0 0.8.1 0.8.2 0.8.3 0.8.4 0.8.5 0.8.6 0.8.7 0.8.9
product-specifications / product-specifications.php

product-specifications.php in Product Specifications for Woocommerce 0.8.3, at product-specifications.php

52 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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.3
8 * Author: Amin Abdolrezapoor
9 * Author URI: https://amin.nz
10 * License: GPL-2.0+
11 * Requires Plugins: woocommerce
12 */
13 declare (strict_types=1);
14 namespace Amiut\ProductSpecs;
15
16 // phpcs:disable PSR1.Files.SideEffects.FoundWithSymbols
17 use ProductSpecifications\Vendor\Inpsyde\Modularity\Package;
18 use ProductSpecifications\Vendor\Inpsyde\Modularity\Properties\PluginProperties;
19 use Throwable;
20 defined('ABSPATH') || exit;
21 if (!defined('DWSPECS_PLUGIN_FILE')) {
22 define('DWSPECS_PLUGIN_FILE', __FILE__);
23 }
24 function handleFailure(Throwable $throwable): void
25 {
26 add_action('all_admin_notices', static function () use ($throwable) {
27 $class = 'notice notice-error';
28 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())));
29 });
30 }
31 function setupAutoLoader(): void
32 {
33 if (class_exists(\Amiut\ProductSpecs\Content\Module::class)) {
34 return;
35 }
36 if (is_readable(__DIR__ . '/vendor/autoload.php')) {
37 require_once __DIR__ . '/vendor/autoload.php';
38 }
39 }
40 function bootstrap(): void
41 {
42 try {
43 setupAutoLoader();
44 $plugin = Package::new(PluginProperties::new(__FILE__));
45 \Amiut\ProductSpecs\App::instance();
46 $plugin->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();
47 } catch (Throwable $throwable) {
48 handleFailure($throwable);
49 }
50 }
51 add_action('plugins_loaded', __NAMESPACE__ . '\bootstrap');
52