/home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Integrations/WooCommerce
Edit: /home/vianto5/heredit.mx/wp-content/plugins/wpforms/src/Integrations/WooCommerce/Notifications.php (5381B)
Emails page.
if ( ! $this->is_woocommerce_email_settings_page() ) {
return false;
}
// Do not show the notification if any SMTP plugin is active.
return ! $this->has_smtp_plugin();
}
/**
* Load integration.
*
* @since 1.8.9
*/
public function load() {
$this->hooks();
}
/**
* Register hooks.
*
* @since 1.8.9
*/
private function hooks() {
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_assets' ], 20 );
add_action( 'woocommerce_admin_field_email_notification' , [ $this, 'add_notification' ] );
add_action( 'wp_ajax_wpforms_woocommerce_dismiss', [ $this, 'dismiss' ] );
}
/**
* Enqueue assets.
*
* @since 1.8.9
*/
public function enqueue_assets() {
$min = wpforms_get_min_suffix();
wp_enqueue_style(
self::HANDLE,
WPFORMS_PLUGIN_URL . "/assets/css/integrations/woocommerce/notifications{$min}.css",
[],
WPFORMS_VERSION
);
wp_enqueue_script(
self::HANDLE,
WPFORMS_PLUGIN_URL . "/assets/js/integrations/woocommerce/notifications{$min}.js",
[ 'jquery' ],
WPFORMS_VERSION,
true
);
wp_localize_script(
self::HANDLE,
'wpforms_woocommerce_notifications',
[
'ajax_url' => admin_url( 'admin-ajax.php' ),
'nonce' => wp_create_nonce( self::HANDLE ),
]
);
}
/**
* Add notification.
*
* @since 1.8.9
*/
public function add_notification() {
?>
Emails page.
*
* @since 1.8.9
*
* @return bool
*/
private function is_woocommerce_email_settings_page(): bool {
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
return isset( $_GET['page'], $_GET['tab'] ) && $_GET['page'] === 'wc-settings' && $_GET['tab'] === 'email';
}
/**
* Check if the site has any active SMTP plugins.
*
* @since 1.8.9
*
* @return bool
*/
private function has_smtp_plugin(): bool {
$smtp_plugins = [
'wp-mail-smtp-pro/wp_mail_smtp.php',
'wp-mail-smtp/wp_mail_smtp.php',
'easy-wp-smtp/easy-wp-smtp.php',
'smtp-settings-for-gravity-forms/smtp-settings-gravity-forms.php',
'post-smtp/postman-smtp.php',
'fluent-smtp/fluent-smtp.php',
'gosmtp/gosmtp.php',
'smtp-mailer/main.php',
'wp-smtp/wp-smtp.php',
'gmail-smtp/main.php',
'simple-smtp/wp-simple-smtp.php',
'bws-smtp/bws-smtp.php',
'wp-mail-smtp-mailer/wp-mail-smtp-mailer.php',
'welcome-email-editor/sb_welcome_email_editor.php',
'bit-smtp/bit_smtp.php',
'sar-friendly-smtp/sar-friendly-smtp.php',
'smtp-mailer/main.php',
'yaysmtp/yay-smtp.php',
'smtp2go/smtp2go-wordpress-plugin.php',
'mailersend-official-smtp-integration/mailersend-wordpress.php',
'cf7-smtp/cf7-smtp.php',
'smtp-mail/index.php',
'mailpoet/mailpoet.php',
];
foreach ( $smtp_plugins as $plugin ) {
// Check if plugin is active or installed.
if ( is_plugin_active( $plugin ) || file_exists( WP_PLUGIN_DIR . '/' . dirname( $plugin ) ) ) {
return true;
}
}
return false;
}
}