Skip to content

Commit

Permalink
Merge branch 'refs/heads/main' into 689-section-settings
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamadNateqi committed Oct 17, 2024
2 parents 64a945c + 78b74fb commit 6620528
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions woocommerce-pdf-invoices-packingslips.php
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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();
?>
<div class="notice notice-warning">
<p>
<?php
printf(
/* translators: plugin name */
__( 'Soon, our %s plugin and its extensions will no longer support PHP versions below 7.4. To ensure uninterrupted use and continued access to updates, please update your PHP version to 7.4 or higher as soon as possible. If you need assistance, please contact your hosting provider for support with the update.', 'woocommerce-pdf-invoices-packing-slips' ),
'<strong>PDF Invoices & Packing Slips for WooCommerce</strong>'
);
?>
</p>
<p><a href="<?php echo esc_url( wp_nonce_url( add_query_arg( 'wpo_wcpdf_hide_php_below_7_4_drop_notice', 'true' ), 'hide_php_below_7_4_drop_notice_nonce' ) ); ?>"><?php _e( 'Hide this message', 'woocommerce-pdf-invoices-packing-slips' ); ?></a></p>
</div>
<?php
echo wp_kses_post( ob_get_clean() );
}

// save option to hide notice
if ( isset( $_REQUEST['wpo_wcpdf_hide_php_below_7_4_drop_notice'] ) && isset( $_REQUEST['_wpnonce'] ) ) {
// validate nonce
if ( ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'hide_php_below_7_4_drop_notice_nonce' ) ) {
wcpdf_log_error( 'You do not have sufficient permissions to perform this action: wpo_wcpdf_hide_php_below_7_4_drop_notice' );
} else {
update_option( 'wpo_wcpdf_hide_php_below_7_4_drop_notice', true );
}

wp_redirect( 'admin.php?page=wpo_wcpdf_options_page' );
exit;
}
}

/**
* Get an array of all active plugins, including multisite
Expand Down

0 comments on commit 6620528

Please sign in to comment.