service.php
87 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! class_exists( 'WPCF7_Service' ) ) { |
| 4 | return; |
| 5 | } |
| 6 | |
| 7 | class WPCF7_Akismet extends WPCF7_Service { |
| 8 | |
| 9 | private static $instance; |
| 10 | |
| 11 | |
| 12 | public static function get_instance() { |
| 13 | if ( empty( self::$instance ) ) { |
| 14 | self::$instance = new self(); |
| 15 | } |
| 16 | |
| 17 | return self::$instance; |
| 18 | } |
| 19 | |
| 20 | |
| 21 | public function get_title() { |
| 22 | return __( 'Akismet', 'contact-form-7' ); |
| 23 | } |
| 24 | |
| 25 | |
| 26 | public function is_active() { |
| 27 | return wpcf7_akismet_is_available(); |
| 28 | } |
| 29 | |
| 30 | |
| 31 | public function get_categories() { |
| 32 | return array( 'spam_protection' ); |
| 33 | } |
| 34 | |
| 35 | |
| 36 | public function icon() { |
| 37 | } |
| 38 | |
| 39 | |
| 40 | public function link() { |
| 41 | echo wp_kses_data( wpcf7_link( |
| 42 | 'https://akismet.com/', |
| 43 | 'akismet.com' |
| 44 | ) ); |
| 45 | } |
| 46 | |
| 47 | |
| 48 | public function display( $action = '' ) { |
| 49 | $formatter = new WPCF7_HTMLFormatter(); |
| 50 | |
| 51 | $formatter->append_start_tag( 'p' ); |
| 52 | |
| 53 | $formatter->append_preformatted( |
| 54 | esc_html( __( 'CAPTCHAs are designed to distinguish spambots from humans, and are therefore helpless against human spammers. In contrast to CAPTCHAs, Akismet checks form submissions against the global database of spam; this means Akismet is a comprehensive solution against spam. This is why we consider Akismet to be the centerpiece of the spam prevention strategy.', 'contact-form-7' ) ) |
| 55 | ); |
| 56 | |
| 57 | $formatter->end_tag( 'p' ); |
| 58 | |
| 59 | $formatter->append_start_tag( 'p' ); |
| 60 | $formatter->append_start_tag( 'strong' ); |
| 61 | |
| 62 | $formatter->append_preformatted( |
| 63 | wpcf7_link( |
| 64 | __( 'https://contactform7.com/spam-filtering-with-akismet/', 'contact-form-7' ), |
| 65 | __( 'Spam filtering with Akismet', 'contact-form-7' ) |
| 66 | ) |
| 67 | ); |
| 68 | |
| 69 | $formatter->end_tag( 'p' ); |
| 70 | |
| 71 | if ( $this->is_active() ) { |
| 72 | $formatter->append_start_tag( 'p', array( |
| 73 | 'class' => 'dashicons-before dashicons-yes', |
| 74 | ) ); |
| 75 | |
| 76 | $formatter->append_preformatted( |
| 77 | esc_html( __( 'Akismet is active on this site.', 'contact-form-7' ) ) |
| 78 | ); |
| 79 | |
| 80 | $formatter->end_tag( 'p' ); |
| 81 | } |
| 82 | |
| 83 | $formatter->print(); |
| 84 | } |
| 85 | |
| 86 | } |
| 87 |