include(); add_action( 'admin_enqueue_scripts', array( $this, 'admin_enqueue_scripts' ) ); add_filter( 'post_smtp__new_dashboard', '__return_true' ); add_action( 'post_smtp__new_dashboard_content', array( $this, 'dashboard_content' ) ); if ( is_plugin_active( 'report-and-tracking-addon-premium/post-smtp-report-and-tracking.php' ) || is_plugin_active( 'post-smtp-pro/post-smtp-pro.php' ) ) { add_filter( 'post_smtp_dashboard_opened_emails_count', array( $this, 'opened_email_count' ), 10, 2 ); } } private function include() { require_once POST_SMTP_PATH . '/Postman/Dashboard/includes/rest-api/v1/class-psd-rest-api.php'; } public function admin_enqueue_scripts( $hook ) { $i18n = require_once POST_SMTP_PATH . '/Postman/Dashboard/includes/i18n.php'; if ( 'toplevel_page_postman' === $hook ) { wp_enqueue_script( 'post-smtp-dashboard', POST_SMTP_URL . '/Postman/Dashboard/assets/js/app.js', array( 'wp-i18n' ), POST_SMTP_VER, true ); wp_localize_script( 'post-smtp-dashboard', 'postSmtpNewDashboard', array( 'plugin_dir_url' => plugin_dir_url( __FILE__ ), 'json_url' => rest_url( 'psd/v1' ), 'nonce' => wp_create_nonce( 'wp_rest' ), 'admin_url' => admin_url( 'admin.php' ), 'page_hook' => $hook, 'is_bfcm' => postman_is_bfcm(), 'i18n' => $i18n, ) ); wp_enqueue_style( 'post-smtp-dashboard', POST_SMTP_URL . '/Postman/Dashboard/assets/css/app.css', array(), POST_SMTP_VER, 'all' ); wp_enqueue_style( 'post-smtp-dashboard-responsive', POST_SMTP_URL . '/Postman/Dashboard/assets/css/responsive-style.css', array(), POST_SMTP_VER, 'all' ); } } public function dashboard_content() { $transport = PostmanTransportRegistry::getInstance()->getActiveTransport(); $postman_options = get_option( 'postman_options', array() ); $app_connected = get_option( 'post_smtp_mobile_app_connection' ); $main_wp_configured = get_option( 'post_smtp_use_from_main_site' ); $configured = $transport->isConfiguredAndReady() ? 'true' : 'false'; $app_connected = empty( $app_connected ) ? 'false' : 'true'; $main_wp_configured = empty( $main_wp_configured ) ? 'false' : 'true'; $has_post_smtp_pro = apply_filters( 'active_plugins', get_option( 'active_plugins' ) ); $has_post_smtp_pro = in_array( 'post-smtp-pro/post-smtp-pro.php', $has_post_smtp_pro, true ) ? 'true' : 'false'; $log_only_mode = is_array( $postman_options ) && isset( $postman_options['run_mode'] ) && 'log_only' === $postman_options['run_mode'] ? 'true' : 'false' ; // Check if user has Professional or Basic plan $is_professional_or_basic = 'false'; if ( function_exists( 'pspro_fs' ) ) { if ( pspro_fs()->is_plan( 'professional', true ) || pspro_fs()->is_plan( 'basic', true ) ) { $is_professional_or_basic = 'true'; } } $ad_position = get_option('postman_dashboard_ad', 'maximize' ); echo '