| Server IP : 43.130.17.34 / Your IP : 216.73.217.6 Web Server : nginx/1.28.0 System : Linux VM-4-12-opencloudos 6.6.92-34.1.oc9.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Jun 25 21:32:13 CST 2025 x86_64 User : www ( 1000) PHP Version : 8.0.26 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/yespkg.com/wp-content/plugins/mail-manager-wpforms/includes/ |
Upload File : |
<?php
/**
* Class Notice
*
* Handles notices via the WP_Error class and displays them as admin notices.
*
* @link https://mmw.diviaccessories.com/
* @since 1.0.0
*
* @package mail-manager-wpforms
* @subpackage mail-manager-wpforms/notice
*/
namespace MMWPF\Core;
/**
* Handles notices using the WP_Error class and displays them as admin notices.
*/
class Notice {
use \MMWPF\TRT\Trait_Manager;
/**
* Notice Object.
*
* @since 1.0.0
* @access private
* @var object $notices WP_Error Object.
*/
private $notices;
/**
* Notice Type.
*
* @since 1.0.0
* @access private
* @var object $type Available types: 'success', 'info', 'warning', 'error'.
*/
private $type;
/**
* Constructor.
*
* Sets up the WP_Error instance for storing notices.
*/
public function __construct() {
$this->notices = new \WP_Error();
}
/**
* Sets a notice message.
*
* @param string $code The code for the notice.
* @param string $message The notice message.
* @param string $type The notice type. Available types: 'success', 'info', 'warning', 'error'.
*/
public function set_notice( $code, $message, $type = 'success' ) {
$this->notices->add( $code, $message );
$this->type = $type;
}
/**
* Retrieves all notice messages.
*
* @return \WP_Error The WP_Error instance containing notices.
*/
public function get_notices() {
return $this->notices;
}
/**
* Clears all notice messages.
*
* Resets the \WP_Error instance.
*/
public function clear_notices() {
$this->notices = new \WP_Error();
}
/**
* Display notice messages as admin notices.
*
* Outputs the notices and clears them after display.
*/
public function display_notices() {
if ( ! empty( $this->notices->get_error_messages() ) ) {
foreach ( $this->notices->get_error_messages() as $notice ) {
printf(
'<div class="notice notice-%s is-dismissible"><p>%s</p></div>',
esc_html( $this->type ),
esc_html( $notice )
);
}
// Clear messages after displaying.
$this->clear_notices();
}
}
/**
* Display an admin notice for the welcome message.
*
* @since 1.0.0
*/
public function mail_manager_wpf_notice() {
if ( get_transient( 'mmwpf_dependency' ) ) {
printf(
'<div class="notice notice-error"><p>%s<a style="text-decoration: none;" target="_blank" href="%s">WPForms</a> %s</p></div>',
esc_html__( 'Please install ', 'mail-manager-wpforms' ),
esc_url( 'https://wordpress.org/plugins/wpforms-lite/' ),
esc_html__( 'for track entries!', 'mail-manager-wpforms' ),
);
// Delete the transient to prevent the notice from showing again.
delete_transient( 'mmwpf_dependency' );
}
if ( get_transient( 'mmwpf_active_notice' ) ) {
printf(
'<div class="notice notice-success is-dismissible mmwpf-after-install-notice"><p>%1$s <b><a href="https://wordpress.org/plugins/mail-manager-wpforms/">Mail Manager for WPForms</a></b>! 🎉 %2$s <a href="%6$s">%3$s →</a> %4$s <a class="mmwpf-rating" href="https://wordpress.org/plugins/mail-manager-wpforms/#reviews">★★★★★</a>. %5$s 😎</p></div>',
/*1*/ esc_html__( 'Welcome to', 'mail-manager-wpforms' ),
/*2*/ esc_html__( 'Visit', 'mail-manager-wpforms' ),
/*3*/ esc_html__( 'Dashboard', 'mail-manager-wpforms' ),
/*4*/ esc_html__( 'If you find our plugin helpful, we would greatly appreciate it if you could leave us a', 'mail-manager-wpforms' ),
/*5*/ esc_html__( 'Thank you in advance!', 'mail-manager-wpforms' ),
/*6*/ esc_url( admin_url( 'admin.php?page=mail-manager-wpf' ) ),
);
// Delete the transient to prevent the notice from showing again.
delete_transient( 'mmwpf_active_notice' );
}
// if ( get_transient( 'mail_manager_wpf_deactivate_notice' ) ) {
// printf(
// '<div class="notice notice-success is-dismissible mmwpf-after-deactivate-notice"><p>%1$s <b><a href="#">Mail Manager for WPForms</a></b>! %2$s <a href="#">feedback</a> %3$s</p></div>',
// *1*/ esc_html__( 'We\'re sorry to see you go! Thank you for using, , ', 'mail-manager-wpforms' ),
// *2*/ esc_html__( 'and if you have any ', 'mail-manager-wpforms' ),
// *3*/ esc_html__( 'please let us know how we can improve.', 'mail-manager-wpforms' ),
// );
// Delete the transient to prevent the notice from showing again.
// delete_transient( 'mail_manager_wpf_deactivate_notice' );
// }
// Plugin review notice (7 days).
$time_unix = (int) get_user_meta( get_current_user_id(), 'mmwpf_install_time', true );
if ( ( time() - $time_unix ) >= ( 7 * 24 * 60 * 60 ) ) {
printf(
// Translators: %2$s is the name of plugin.
esc_html__( '%1$sYou have been using %2$s for a while now, and we hope you\'re enjoying it! If you do, please take a moment to leave us a %3$s rating to keep us motivated. If you\'d like to support us further, consider a cup of fuel ☕ to help us continue offering free features! %4$s Thank you! %5$s %6$s %7$s %8$s %9$s', 'mail-manager-wpforms' ),
/*1*/ '<div class="notice notice-info mmwpf-notice-review is-dismissible"><p>',
/*2*/ '<b><a href="https://wordpress.org/plugins/mail-manager-wpforms/" target="_blank">Mail Manager for WPForms</a></b>',
/*3*/ '<a href"https://wordpress.org/plugins/mail-manager-wpforms/#reviews">★★★★★</a>',
/*4*/ '😎',
/*5*/ '</p>',
/*6*/ '<p><a href="https://wordpress.org/plugins/mail-manager-wpforms/#reviews" class="mmwpf-review-write-btn" target="_blank">😀 Yes, you deserve it</a> ',
/*7*/ '<a href="#!" class="mmwpf-review-done-btn" data-wpfmmr="0">💗 Yes, I did.</a> ',
/*8*/ '<a href="#!" class="mmwpf-review-dismiss-btn" data-wpfmmr="1">😔 Maybe later</a> ',
/*9*/ '<a href="https://mmw.diviaccessories.com/" target="_blank" class="mmwpf-review-coffee-btn">☕ Help keep the code running</a> </p></div>',
);
}
}
/**
* Review rescheduled.
*
* @since 1.0.0
*/
public function mmwpf_review_dismiss_action() {
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( sanitize_key( wp_unslash( $_POST['nonce'] ) ), 'mmwpf_nonce' ) ) {
wp_send_json_error( 'Nonce verification failed!' );
}
$is_review_later = isset( $_POST['done'] ) ? absint( $_POST['done'] ) : null;
$time_reschedule = $is_review_later ? strtotime( '+1 month' ) : strtotime( '+1 year' );
update_user_meta( get_current_user_id(), 'mmwpf_install_time', $time_reschedule );
wp_die();
}
/**
* Check screen and add footer text.
*
* @since 1.0.0
*/
public function check_mail_manager_wpf_page() {
$screen = get_current_screen();
if ( 'toplevel_page_mail-manager-wpf' === $screen->id ) {
add_filter( 'admin_footer_text', array( $this, 'mail_manager_wpf_footer_notice' ), 99 );
}
}
/**
* Admin footer notice
*
* @since 1.0.0
*/
public function mail_manager_wpf_footer_notice() {
return __( 'Enjoying <b><a href="https://wordpress.org/plugins/mail-manager-wpforms/" target="_blank">Mail Manager for WPForms</a></b>? <a target="_blank" href="https://wordpress.org/plugins/mail-manager-wpforms/#reviews">Leave a ★★★★★ rating </a>! We\'re listening to your <a href="https://mmw.diviaccessories.com/">suggestions</a>. <a href="https://mmw.diviaccessories.com/">Fuel code with a ☕</a>. Thank you very much! 😎', 'mail-manager-wpforms' );
}
}