id ) {
return;
}
/* translators: %s: the PHP version of the site. */
echo '
' . esc_html( sprintf( __( '23h Product Features needs PHP 7.4 or newer. This site runs PHP %s. Ask your host to update PHP.', '23h-product-features' ), PHP_VERSION ) ) . '
';
}
);
return;
}
add_action(
'before_woocommerce_init',
static function () {
if ( class_exists( '\Automattic\WooCommerce\Utilities\FeaturesUtil' ) ) {
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', H23PF_FILE, true );
\Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'cart_checkout_blocks', H23PF_FILE, true );
}
}
);
add_action(
'plugins_loaded',
static function () {
if ( ! class_exists( 'WooCommerce', false ) ) {
add_action(
'admin_notices',
static function () {
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
if ( ! $screen || 'plugins' !== $screen->id ) {
return;
}
echo '' . esc_html__( '23h Product Features needs WooCommerce. Install and activate WooCommerce to use it.', '23h-product-features' ) . '
';
}
);
return;
}
$h23pf_files = array( 'settings', 'admin', 'features', 'forms', 'product-admin', 'submission', 'frontend', 'quantity' );
foreach ( $h23pf_files as $h23pf_file ) {
require_once H23PF_DIR . 'includes/class-' . $h23pf_file . '.php';
}
H23PF_Settings::init();
H23PF_Admin::init();
H23PF_Features::init();
H23PF_Forms::init();
H23PF_Product_Admin::init();
H23PF_Frontend::init();
H23PF_Quantity::init();
},
20
);
add_filter(
'plugin_action_links_' . plugin_basename( __FILE__ ),
static function ( $links ) {
array_unshift( $links, '' . esc_html__( 'Settings', '23h-product-features' ) . '' );
return $links;
}
);