From 78b74fbfdfb4bf5747d59c4ba883da42d252fb46 Mon Sep 17 00:00:00 2001 From: Alexandre Faustino Date: Wed, 16 Oct 2024 15:55:36 +0100 Subject: [PATCH] New: Add notice about dropping support for PHP versions below 7.4 (#890) --- woocommerce-pdf-invoices-packingslips.php | 44 +++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/woocommerce-pdf-invoices-packingslips.php b/woocommerce-pdf-invoices-packingslips.php index 6041bb9a..abb5fe0a 100644 --- a/woocommerce-pdf-invoices-packingslips.php +++ b/woocommerce-pdf-invoices-packingslips.php @@ -76,6 +76,7 @@ public function __construct() { add_action( 'admin_notices', array( $this, 'nginx_detected' ) ); add_action( 'admin_notices', array( $this, 'mailpoet_mta_detected' ) ); add_action( 'admin_notices', array( $this, 'rtl_detected' ) ); + add_action( 'admin_notices', array( $this, 'php_below_7_4_drop' ) ); add_action( 'admin_notices', array( $this, 'legacy_addon_notices' ) ); add_action( 'init', array( '\\WPO\\WC\\PDF_Invoices\\Updraft_Semaphore_3_0', 'init_cleanup' ), 999 ); // wait AS to initialize @@ -452,6 +453,49 @@ public function rtl_detected() { } } } + + /** + * PHP below 7.4 notice + * + * @return void + */ + public function php_below_7_4_drop(): void { + if ( ! is_super_admin() ) { + return; + } + + if ( version_compare( PHP_VERSION, '7.4', '<' ) && ! get_option( 'wpo_wcpdf_hide_php_below_7_4_drop_notice' ) ) { + ob_start(); + ?> +
+

+ PDF Invoices & Packing Slips for WooCommerce' + ); + ?> +

+

+
+