Файловый менеджер - Редактировать - /home/tuudkjt/globeasy/wp-includes/ID3/modules.zip
Назад
PK \P,]�� �� � doi-helper.phpnu ��� <?php /** * Double Opt-In Helper module * * @link https://contactform7.com/doi-helper/ */ add_action( 'wpcf7_doi', 'wpcf7_doihelper_start_session', 10, 3 ); /** * Starts a double opt-in session. */ function wpcf7_doihelper_start_session( $agent_name, $args, &$token ) { if ( isset( $token ) ) { return; } if ( ! function_exists( 'doihelper_start_session' ) ) { return; } $submission = WPCF7_Submission::get_instance(); if ( ! $submission ) { return; } $contact_form = $submission->get_contact_form(); $do_doi = apply_filters( 'wpcf7_do_doi', ! $contact_form->is_false( 'doi' ), $agent_name, $args ); if ( ! $do_doi ) { return; } $token = doihelper_start_session( $agent_name, $args ); } PK \P,]��,0 0 acceptance.phpnu ��� <?php /** ** A base module for [acceptance] **/ /* form_tag handler */ add_action( 'wpcf7_init', 'wpcf7_add_form_tag_acceptance', 10, 0 ); function wpcf7_add_form_tag_acceptance() { wpcf7_add_form_tag( 'acceptance', 'wpcf7_acceptance_form_tag_handler', array( 'name-attr' => true, 'selectable-values' => true, ) ); } function wpcf7_acceptance_form_tag_handler( $tag ) { if ( empty( $tag->name ) ) { return ''; } $validation_error = wpcf7_get_validation_error( $tag->name ); $class = wpcf7_form_controls_class( $tag->type ); if ( $validation_error ) { $class .= ' wpcf7-not-valid'; } if ( $tag->has_option( 'invert' ) ) { $class .= ' invert'; } if ( $tag->has_option( 'optional' ) ) { $class .= ' optional'; } $atts = array( 'class' => trim( $class ), ); $item_atts = array( 'type' => 'checkbox', 'name' => $tag->name, 'value' => '1', 'tabindex' => $tag->get_option( 'tabindex', 'signed_int', true ), 'checked' => $tag->has_option( 'default:on' ), 'class' => $tag->get_class_option() ? $tag->get_class_option() : null, 'id' => $tag->get_id_option(), ); if ( $validation_error ) { $item_atts['aria-invalid'] = 'true'; $item_atts['aria-describedby'] = wpcf7_get_validation_error_reference( $tag->name ); } else { $item_atts['aria-invalid'] = 'false'; } $item_atts = wpcf7_format_atts( $item_atts ); $content = empty( $tag->content ) ? (string) reset( $tag->values ) : $tag->content; $content = trim( $content ); if ( $content ) { if ( $tag->has_option( 'label_first' ) ) { $html = sprintf( '<span class="wpcf7-list-item-label">%2$s</span><input %1$s />', $item_atts, $content ); } else { $html = sprintf( '<input %1$s /><span class="wpcf7-list-item-label">%2$s</span>', $item_atts, $content ); } $html = sprintf( '<span class="wpcf7-list-item"><label>%s</label></span>', $html ); } else { $html = sprintf( '<span class="wpcf7-list-item"><input %1$s /></span>', $item_atts ); } $html = sprintf( '<span class="wpcf7-form-control-wrap" data-name="%1$s"><span %2$s>%3$s</span>%4$s</span>', esc_attr( $tag->name ), wpcf7_format_atts( $atts ), $html, $validation_error ); return $html; } /* Validation filter */ add_filter( 'wpcf7_validate_acceptance', 'wpcf7_acceptance_validation_filter', 10, 2 ); function wpcf7_acceptance_validation_filter( $result, $tag ) { if ( ! wpcf7_acceptance_as_validation() ) { return $result; } if ( $tag->has_option( 'optional' ) ) { return $result; } $value = wpcf7_superglobal_post( $tag->name ) ? 1 : 0; $invert = $tag->has_option( 'invert' ); if ( $invert and $value or ! $invert and ! $value ) { $result->invalidate( $tag, wpcf7_get_message( 'accept_terms' ) ); } return $result; } /* Acceptance filter */ add_filter( 'wpcf7_acceptance', 'wpcf7_acceptance_filter', 10, 2 ); function wpcf7_acceptance_filter( $accepted, $submission ) { $tags = wpcf7_scan_form_tags( array( 'type' => 'acceptance' ) ); foreach ( $tags as $tag ) { if ( empty( $tag->name ) ) { continue; } $value = wpcf7_superglobal_post( $tag->name ) ? 1 : 0; $content = empty( $tag->content ) ? (string) reset( $tag->values ) : $tag->content; $content = trim( $content ); if ( $value and $content ) { $submission->add_consent( $tag->name, $content ); } if ( $tag->has_option( 'optional' ) ) { continue; } $invert = $tag->has_option( 'invert' ); if ( $invert and $value or ! $invert and ! $value ) { $accepted = false; } } return $accepted; } add_filter( 'wpcf7_form_class_attr', 'wpcf7_acceptance_form_class_attr', 10, 1 ); function wpcf7_acceptance_form_class_attr( $class_attr ) { if ( wpcf7_acceptance_as_validation() ) { return $class_attr . ' wpcf7-acceptance-as-validation'; } return $class_attr; } function wpcf7_acceptance_as_validation() { if ( ! $contact_form = wpcf7_get_current_contact_form() ) { return false; } return $contact_form->is_true( 'acceptance_as_validation' ); } add_filter( 'wpcf7_mail_tag_replaced_acceptance', 'wpcf7_acceptance_mail_tag', 10, 4 ); function wpcf7_acceptance_mail_tag( $replaced, $submitted, $html, $mail_tag ) { $form_tag = $mail_tag->corresponding_form_tag(); if ( ! $form_tag ) { return $replaced; } if ( ! empty( $submitted ) ) { $replaced = __( 'Consented', 'contact-form-7' ); } else { $replaced = __( 'Not consented', 'contact-form-7' ); } $content = empty( $form_tag->content ) ? (string) reset( $form_tag->values ) : $form_tag->content; if ( ! $html ) { $content = wp_strip_all_tags( $content ); } $content = trim( $content ); if ( $content ) { $replaced = sprintf( /* translators: 1: 'Consented' or 'Not consented', 2: conditions */ _x( '%1$s: %2$s', 'mail output for acceptance checkboxes', 'contact-form-7' ), $replaced, $content ); } return $replaced; } /* Tag generator */ add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_acceptance', 35, 0 ); function wpcf7_add_tag_generator_acceptance() { $tag_generator = WPCF7_TagGenerator::get_instance(); $tag_generator->add( 'acceptance', __( 'acceptance', 'contact-form-7' ), 'wpcf7_tag_generator_acceptance', array( 'version' => '2' ) ); } function wpcf7_tag_generator_acceptance( $contact_form, $options ) { $field_types = array( 'acceptance' => array( 'display_name' => __( 'Acceptance checkbox', 'contact-form-7' ), 'heading' => __( 'Acceptance checkbox form-tag generator', 'contact-form-7' ), 'description' => __( 'Generates a form-tag for an <a href="https://contactform7.com/acceptance-checkbox/">acceptance checkbox</a>.', 'contact-form-7' ), ), ); $tgg = new WPCF7_TagGeneratorGenerator( $options['content'] ); $formatter = new WPCF7_HTMLFormatter(); $formatter->append_start_tag( 'header', array( 'class' => 'description-box', ) ); $formatter->append_start_tag( 'h3' ); $formatter->append_preformatted( esc_html( $field_types['acceptance']['heading'] ) ); $formatter->end_tag( 'h3' ); $formatter->append_start_tag( 'p' ); $formatter->append_preformatted( wp_kses_data( $field_types['acceptance']['description'] ) ); $formatter->end_tag( 'header' ); $formatter->append_start_tag( 'div', array( 'class' => 'control-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'field_type', array( 'with_optional' => true, 'select_options' => array( 'acceptance' => $field_types['acceptance']['display_name'], ), ) ); $tgg->print( 'field_name' ); $tgg->print( 'class_attr' ); } ); $formatter->append_start_tag( 'fieldset' ); $formatter->append_start_tag( 'legend', array( 'id' => $tgg->ref( 'value-legend' ), ) ); $formatter->append_preformatted( esc_html( __( 'Condition', 'contact-form-7' ) ) ); $formatter->end_tag( 'legend' ); $formatter->append_start_tag( 'input', array( 'type' => 'text', 'required' => true, 'value' => __( 'Put the condition for consent here.', 'contact-form-7' ), 'data-tag-part' => 'content', 'aria-labelledby' => $tgg->ref( 'value-legend' ), ) ); $formatter->end_tag( 'div' ); $formatter->append_start_tag( 'footer', array( 'class' => 'insert-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'insert_box_content' ); $tgg->print( 'mail_tag_tip' ); } ); $formatter->print(); } PK \P,]���� � number.phpnu ��� <?php /** ** A base module for the following types of tags: ** [number] and [number*] # Number ** [range] and [range*] # Range **/ /* form_tag handler */ add_action( 'wpcf7_init', 'wpcf7_add_form_tag_number', 10, 0 ); function wpcf7_add_form_tag_number() { wpcf7_add_form_tag( array( 'number', 'number*', 'range', 'range*' ), 'wpcf7_number_form_tag_handler', array( 'name-attr' => true, ) ); } function wpcf7_number_form_tag_handler( $tag ) { if ( empty( $tag->name ) ) { return ''; } $validation_error = wpcf7_get_validation_error( $tag->name ); $class = wpcf7_form_controls_class( $tag->type ); $class .= ' wpcf7-validates-as-number'; if ( $validation_error ) { $class .= ' wpcf7-not-valid'; } $atts = array(); $atts['class'] = $tag->get_class_option( $class ); $atts['id'] = $tag->get_id_option(); $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); $atts['min'] = $tag->get_option( 'min', 'signed_num', true ); $atts['max'] = $tag->get_option( 'max', 'signed_num', true ); $atts['step'] = $tag->get_option( 'step', 'num', true ); $atts['readonly'] = $tag->has_option( 'readonly' ); $atts['autocomplete'] = $tag->get_autocomplete_option(); if ( $tag->is_required() ) { $atts['aria-required'] = 'true'; } if ( $validation_error ) { $atts['aria-invalid'] = 'true'; $atts['aria-describedby'] = wpcf7_get_validation_error_reference( $tag->name ); } else { $atts['aria-invalid'] = 'false'; } $value = (string) reset( $tag->values ); if ( $tag->has_option( 'placeholder' ) or $tag->has_option( 'watermark' ) ) { $atts['placeholder'] = $value; $value = ''; } $value = $tag->get_default_option( $value ); $value = wpcf7_get_hangover( $tag->name, $value ); $atts['value'] = $value; if ( 'range' === $tag->basetype ) { if ( ! wpcf7_is_number( $atts['min'] ) ) { $atts['min'] = '0'; } if ( ! wpcf7_is_number( $atts['max'] ) ) { $atts['max'] = '100'; } if ( '' === $atts['value'] ) { if ( $atts['min'] < $atts['max'] ) { $atts['value'] = ( $atts['min'] + $atts['max'] ) / 2; } else { $atts['value'] = $atts['min']; } } } $atts['type'] = $tag->basetype; $atts['name'] = $tag->name; $html = sprintf( '<span class="wpcf7-form-control-wrap" data-name="%1$s"><input %2$s />%3$s</span>', esc_attr( $tag->name ), wpcf7_format_atts( $atts ), $validation_error ); return $html; } add_action( 'wpcf7_swv_create_schema', 'wpcf7_swv_add_number_rules', 10, 2 ); function wpcf7_swv_add_number_rules( $schema, $contact_form ) { $tags = $contact_form->scan_form_tags( array( 'basetype' => array( 'number', 'range' ), ) ); foreach ( $tags as $tag ) { if ( $tag->is_required() ) { $schema->add_rule( wpcf7_swv_create_rule( 'required', array( 'field' => $tag->name, 'error' => wpcf7_get_message( 'invalid_required' ), ) ) ); } $schema->add_rule( wpcf7_swv_create_rule( 'number', array( 'field' => $tag->name, 'error' => wpcf7_get_message( 'invalid_number' ), ) ) ); $min = $tag->get_option( 'min', 'signed_num', true ); $max = $tag->get_option( 'max', 'signed_num', true ); if ( 'range' === $tag->basetype ) { if ( ! wpcf7_is_number( $min ) ) { $min = '0'; } if ( ! wpcf7_is_number( $max ) ) { $max = '100'; } } if ( wpcf7_is_number( $min ) ) { $schema->add_rule( wpcf7_swv_create_rule( 'minnumber', array( 'field' => $tag->name, 'threshold' => $min, 'error' => wpcf7_get_message( 'number_too_small' ), ) ) ); } if ( wpcf7_is_number( $max ) ) { $schema->add_rule( wpcf7_swv_create_rule( 'maxnumber', array( 'field' => $tag->name, 'threshold' => $max, 'error' => wpcf7_get_message( 'number_too_large' ), ) ) ); } } } /* Messages */ add_filter( 'wpcf7_messages', 'wpcf7_number_messages', 10, 1 ); function wpcf7_number_messages( $messages ) { return array_merge( $messages, array( 'invalid_number' => array( 'description' => __( 'Number format that the sender entered is invalid', 'contact-form-7' ), 'default' => __( 'Please enter a number.', 'contact-form-7' ), ), 'number_too_small' => array( 'description' => __( 'Number is smaller than minimum limit', 'contact-form-7' ), 'default' => __( 'This field has a too small number.', 'contact-form-7' ), ), 'number_too_large' => array( 'description' => __( 'Number is larger than maximum limit', 'contact-form-7' ), 'default' => __( 'This field has a too large number.', 'contact-form-7' ), ), ) ); } /* Tag generator */ add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_number', 18, 0 ); function wpcf7_add_tag_generator_number() { $tag_generator = WPCF7_TagGenerator::get_instance(); $tag_generator->add( 'number', __( 'number', 'contact-form-7' ), 'wpcf7_tag_generator_number', array( 'version' => '2' ) ); } function wpcf7_tag_generator_number( $contact_form, $options ) { $field_types = array( 'number' => array( 'display_name' => __( 'Number field', 'contact-form-7' ), 'heading' => __( 'Number field form-tag generator', 'contact-form-7' ), 'description' => __( 'Generates a form-tag for a <a href="https://contactform7.com/number-fields/">number input field</a>.', 'contact-form-7' ), ), ); $tgg = new WPCF7_TagGeneratorGenerator( $options['content'] ); $formatter = new WPCF7_HTMLFormatter(); $formatter->append_start_tag( 'header', array( 'class' => 'description-box', ) ); $formatter->append_start_tag( 'h3' ); $formatter->append_preformatted( esc_html( $field_types['number']['heading'] ) ); $formatter->end_tag( 'h3' ); $formatter->append_start_tag( 'p' ); $formatter->append_preformatted( wp_kses_data( $field_types['number']['description'] ) ); $formatter->end_tag( 'header' ); $formatter->append_start_tag( 'div', array( 'class' => 'control-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'field_type', array( 'with_required' => true, 'select_options' => array( 'number' => __( 'Spinbox', 'contact-form-7' ), 'range' => __( 'Slider', 'contact-form-7' ), ), ) ); $tgg->print( 'field_name' ); $tgg->print( 'class_attr' ); $tgg->print( 'min_max', array( 'title' => __( 'Range', 'contact-form-7' ), 'min_option' => 'min:', 'max_option' => 'max:', ) ); $tgg->print( 'default_value', array( 'type' => 'number', 'with_placeholder' => false, ) ); } ); $formatter->end_tag( 'div' ); $formatter->append_start_tag( 'footer', array( 'class' => 'insert-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'insert_box_content' ); $tgg->print( 'mail_tag_tip' ); } ); $formatter->print(); } PK \P,]�ECӬ! �! flamingo.phpnu ��� <?php /** ** Module for Flamingo plugin. ** http://wordpress.org/extend/plugins/flamingo/ **/ add_action( 'wpcf7_submit', 'wpcf7_flamingo_submit', 10, 2 ); function wpcf7_flamingo_submit( $contact_form, $result ) { if ( ! class_exists( 'Flamingo_Contact' ) or ! class_exists( 'Flamingo_Inbound_Message' ) ) { return; } if ( $contact_form->in_demo_mode() ) { return; } $cases = (array) apply_filters( 'wpcf7_flamingo_submit_if', array( 'spam', 'mail_sent', 'mail_failed' ) ); if ( empty( $result['status'] ) or ! in_array( $result['status'], $cases, true ) ) { return; } $submission = WPCF7_Submission::get_instance(); if ( ! $submission or ! $posted_data = $submission->get_posted_data() ) { return; } if ( $submission->get_meta( 'do_not_store' ) ) { return; } // Exclude do-not-store form-tag values. $posted_data = array_filter( $posted_data, static function ( $name ) use ( $contact_form ) { return ! $contact_form->scan_form_tags( array( 'name' => $name, 'feature' => 'do-not-store', ) ); }, ARRAY_FILTER_USE_KEY ); $email = wpcf7_flamingo_get_value( 'email', $contact_form ); $name = wpcf7_flamingo_get_value( 'name', $contact_form ); $subject = wpcf7_flamingo_get_value( 'subject', $contact_form ); $meta = array(); $special_mail_tags = array( 'serial_number', 'remote_ip', 'user_agent', 'url', 'date', 'time', 'post_id', 'post_name', 'post_title', 'post_url', 'post_author', 'post_author_email', 'site_title', 'site_description', 'site_url', 'site_admin_email', 'user_login', 'user_email', 'user_display_name', ); foreach ( $special_mail_tags as $smt ) { $tagname = sprintf( '_%s', $smt ); $mail_tag = new WPCF7_MailTag( sprintf( '[%s]', $tagname ), $tagname, '' ); $meta[$smt] = apply_filters( 'wpcf7_special_mail_tags', null, $tagname, false, $mail_tag ); } $timestamp = $submission->get_meta( 'timestamp' ); if ( $timestamp and $datetime = date_create( '@' . $timestamp ) ) { $datetime->setTimezone( wp_timezone() ); $last_contacted = $datetime->format( 'Y-m-d H:i:s' ); } else { $last_contacted = '0000-00-00 00:00:00'; } if ( 'mail_sent' === $result['status'] ) { $flamingo_contact = Flamingo_Contact::add( array( 'email' => $email, 'name' => $name, 'last_contacted' => $last_contacted, ) ); } $post_meta = get_post_meta( $contact_form->id(), '_flamingo', true ); $channel_id = isset( $post_meta['channel'] ) ? (int) $post_meta['channel'] : wpcf7_flamingo_add_channel( $contact_form->name(), $contact_form->title() ); if ( $channel_id ) { if ( ! isset( $post_meta['channel'] ) or $post_meta['channel'] !== $channel_id ) { $post_meta = empty( $post_meta ) ? array() : (array) $post_meta; $post_meta = array_merge( $post_meta, array( 'channel' => $channel_id, ) ); update_post_meta( $contact_form->id(), '_flamingo', $post_meta ); } $channel = get_term( $channel_id, Flamingo_Inbound_Message::channel_taxonomy ); if ( ! $channel or is_wp_error( $channel ) ) { $channel = 'contact-form-7'; } else { $channel = $channel->slug; } } else { $channel = 'contact-form-7'; } $args = array( 'channel' => $channel, 'status' => $submission->get_status(), 'subject' => $subject, 'from' => trim( sprintf( '%s <%s>', $name, $email ) ), 'from_name' => $name, 'from_email' => $email, 'fields' => $posted_data, 'meta' => $meta, 'akismet' => $submission->pull( 'akismet' ), 'spam' => ( 'spam' === $result['status'] ), 'consent' => $submission->collect_consent(), 'timestamp' => $timestamp, 'posted_data_hash' => $submission->get_posted_data_hash(), ); if ( $args['spam'] ) { $args['spam_log'] = $submission->get_spam_log(); } $args['recaptcha'] = $submission->pull( 'recaptcha' ); $args = apply_filters( 'wpcf7_flamingo_inbound_message_parameters', $args ); $flamingo_inbound = Flamingo_Inbound_Message::add( $args ); if ( empty( $flamingo_contact ) ) { $flamingo_contact_id = 0; } elseif ( method_exists( $flamingo_contact, 'id' ) ) { $flamingo_contact_id = $flamingo_contact->id(); } else { $flamingo_contact_id = $flamingo_contact->id; } if ( empty( $flamingo_inbound ) ) { $flamingo_inbound_id = 0; } elseif ( method_exists( $flamingo_inbound, 'id' ) ) { $flamingo_inbound_id = $flamingo_inbound->id(); } else { $flamingo_inbound_id = $flamingo_inbound->id; } $result += array( 'flamingo_contact_id' => absint( $flamingo_contact_id ), 'flamingo_inbound_id' => absint( $flamingo_inbound_id ), ); do_action( 'wpcf7_after_flamingo', $result ); } function wpcf7_flamingo_get_value( $field, $contact_form ) { if ( empty( $field ) or empty( $contact_form ) ) { return false; } $value = ''; if ( in_array( $field, array( 'email', 'name', 'subject' ), true ) ) { $template = $contact_form->pref( 'flamingo_' . $field ); if ( null === $template ) { $template = sprintf( '[your-%s]', $field ); } else { $template = trim( wpcf7_strip_quote( $template ) ); } $value = wpcf7_mail_replace_tags( $template ); } $value = apply_filters( 'wpcf7_flamingo_get_value', $value, $field, $contact_form ); return $value; } function wpcf7_flamingo_add_channel( $slug, $name = '' ) { if ( ! class_exists( 'Flamingo_Inbound_Message' ) ) { return false; } $parent = term_exists( 'contact-form-7', Flamingo_Inbound_Message::channel_taxonomy ); if ( ! $parent ) { $parent = wp_insert_term( __( 'Contact Form 7', 'contact-form-7' ), Flamingo_Inbound_Message::channel_taxonomy, array( 'slug' => 'contact-form-7' ) ); if ( is_wp_error( $parent ) ) { return false; } } $parent = (int) $parent['term_id']; if ( ! is_taxonomy_hierarchical( Flamingo_Inbound_Message::channel_taxonomy ) ) { // backward compat for Flamingo 1.0.4 and lower return $parent; } if ( empty( $name ) ) { $name = $slug; } $channel = term_exists( $slug, Flamingo_Inbound_Message::channel_taxonomy, $parent ); if ( ! $channel ) { $channel = wp_insert_term( $name, Flamingo_Inbound_Message::channel_taxonomy, array( 'slug' => $slug, 'parent' => $parent ) ); if ( is_wp_error( $channel ) ) { return false; } } return (int) $channel['term_id']; } add_action( 'wpcf7_after_update', 'wpcf7_flamingo_update_channel', 10, 1 ); function wpcf7_flamingo_update_channel( $contact_form ) { if ( ! class_exists( 'Flamingo_Inbound_Message' ) ) { return false; } $post_meta = get_post_meta( $contact_form->id(), '_flamingo', true ); $channel = isset( $post_meta['channel'] ) ? get_term( $post_meta['channel'], Flamingo_Inbound_Message::channel_taxonomy ) : get_term_by( 'slug', $contact_form->name(), Flamingo_Inbound_Message::channel_taxonomy ); if ( ! $channel or is_wp_error( $channel ) ) { return; } if ( $channel->name !== wp_unslash( $contact_form->title() ) ) { wp_update_term( $channel->term_id, Flamingo_Inbound_Message::channel_taxonomy, array( 'name' => $contact_form->title(), 'slug' => $contact_form->name(), 'parent' => $channel->parent, ) ); } } add_filter( 'wpcf7_special_mail_tags', 'wpcf7_flamingo_serial_number', 10, 4 ); /** * Returns output string of a special mail-tag. * * @param string $output The string to be output. * @param string $name The tag name of the special mail-tag. * @param bool $html Whether the mail-tag is used in an HTML content. * @param WPCF7_MailTag $mail_tag An object representation of the mail-tag. * @return string Output of the given special mail-tag. */ function wpcf7_flamingo_serial_number( $output, $name, $html, $mail_tag = null ) { if ( ! $mail_tag instanceof WPCF7_MailTag ) { wpcf7_doing_it_wrong( sprintf( '%s()', __FUNCTION__ ), __( 'The fourth parameter ($mail_tag) must be an instance of the WPCF7_MailTag class.', 'contact-form-7' ), '5.2.2' ); } if ( '_serial_number' !== $name ) { return $output; } if ( ! class_exists( 'Flamingo_Inbound_Message' ) or ! method_exists( 'Flamingo_Inbound_Message', 'count' ) ) { return $output; } if ( ! $contact_form = WPCF7_ContactForm::get_current() ) { return $output; } $serial_number = 0; $post_meta = get_post_meta( $contact_form->id(), '_flamingo', true ); $channel_id = isset( $post_meta['channel'] ) ? (int) $post_meta['channel'] : wpcf7_flamingo_add_channel( $contact_form->name(), $contact_form->title() ); if ( $channel_id ) { $serial_number = 1 + Flamingo_Inbound_Message::count( array( 'channel_id' => $channel_id, ) ); } return (string) $serial_number; } PK \P,]~!)�W W disallowed-list.phpnu ��� <?php add_filter( 'wpcf7_spam', 'wpcf7_disallowed_list', 10, 2 ); function wpcf7_disallowed_list( $spam, $submission ) { if ( $spam ) { return $spam; } $target = wpcf7_array_flatten( $submission->get_posted_data() ); $target[] = $submission->get_meta( 'remote_ip' ); $target[] = $submission->get_meta( 'user_agent' ); $target = implode( "\n", $target ); $word = wpcf7_check_disallowed_list( $target ); $word = wpcf7_apply_filters_deprecated( 'wpcf7_submission_is_blacklisted', array( $word, $submission ), '5.3', 'wpcf7_submission_has_disallowed_words' ); $word = apply_filters( 'wpcf7_submission_has_disallowed_words', $word, $submission ); if ( $word ) { if ( is_bool( $word ) ) { $reason = __( 'Disallowed words are used.', 'contact-form-7' ); } else { $reason = sprintf( /* translators: %s: comma separated list of disallowed words */ __( 'Disallowed words (%s) are used.', 'contact-form-7' ), implode( ', ', (array) $word ) ); } $submission->add_spam_log( array( 'agent' => 'disallowed_list', 'reason' => $reason, ) ); } $spam = (bool) $word; return $spam; } function wpcf7_check_disallowed_list( $target ) { $mod_keys = get_option( 'disallowed_keys' ); if ( is_scalar( $mod_keys ) ) { $mod_keys = trim( $mod_keys ); } else { $mod_keys = ''; } if ( '' === $mod_keys ) { return false; } foreach ( explode( "\n", $mod_keys ) as $word ) { $word = trim( $word ); $length = strlen( $word ); if ( $length < 2 or 256 < $length ) { continue; } $pattern = sprintf( '#%s#i', preg_quote( $word, '#' ) ); if ( preg_match( $pattern, $target ) ) { return $word; } } return false; } function wpcf7_blacklist_check( $target ) { wpcf7_deprecated_function( __FUNCTION__, '5.3', 'wpcf7_check_disallowed_list' ); return wpcf7_check_disallowed_list( $target ); } PK \P,]�.y % constant-contact/constant-contact.phpnu ��� <?php /** * Constant Contact module main file * * @link https://contactform7.com/constant-contact-integration/ */ add_action( 'wpcf7_init', 'wpcf7_constant_contact_register_service', 120, 0 ); /** * Registers the Constant Contact service. */ function wpcf7_constant_contact_register_service() { $integration = WPCF7_Integration::get_instance(); $integration->add_service( 'constant_contact', WPCF7_ConstantContact::get_instance() ); } /** * The WPCF7_Service subclass for Constant Contact. */ class WPCF7_ConstantContact extends WPCF7_Service { const service_name = 'constant_contact'; private static $instance; protected $client_id = ''; protected $client_secret = ''; public static function get_instance() { if ( empty( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } private function __construct() { $option = (array) WPCF7::get_option( self::service_name ); $this->client_id = $option['client_id'] ?? ''; $this->client_secret = $option['client_secret'] ?? ''; } protected function reset_data() { WPCF7::update_option( self::service_name, array() ); } public function get_title() { return __( 'Constant Contact', 'contact-form-7' ); } public function is_active() { return $this->client_id || $this->client_secret; } public function get_categories() { return array( 'email_marketing' ); } public function icon() { } public function link() { } protected function menu_page_url( $args = '' ) { $args = wp_parse_args( $args, array() ); $url = add_query_arg( array( 'service' => self::service_name ), menu_page_url( 'wpcf7-integration', false ) ); if ( ! empty( $args ) ) { $url = add_query_arg( $args, $url ); } return $url; } public function load( $action = '' ) { if ( 'setup' === $action and 'POST' === wpcf7_superglobal_server( 'REQUEST_METHOD' ) ) { check_admin_referer( 'wpcf7-constant-contact-setup' ); if ( wpcf7_superglobal_post( 'reset' ) ) { $this->reset_data(); $message = 'reset'; } wp_safe_redirect( $this->menu_page_url( array( 'action' => 'setup', 'message' => $message ?? '', ) ) ); exit(); } } public function admin_notice( $message = '' ) { switch ( $message ) { case 'reset': wp_admin_notice( __( 'API configuration cleared.', 'contact-form-7' ), array( 'type' => 'success' ) ); break; } } public function display( $action = '' ) { $formatter = new WPCF7_HTMLFormatter( array( 'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array( 'form' => array( 'action' => true, 'method' => true, ), ) ), ) ); $formatter->append_start_tag( 'p' ); $formatter->append_preformatted( wpcf7_link( __( 'https://contactform7.com/2024/02/02/we-end-the-constant-contact-integration/', 'contact-form-7' ), __( 'The Constant Contact integration has been removed.', 'contact-form-7' ) ) ); $formatter->end_tag( 'p' ); if ( $this->is_active() ) { $formatter->append_start_tag( 'form', array( 'method' => 'post', 'action' => esc_url( $this->menu_page_url( 'action=setup' ) ), ) ); $formatter->call_user_func( static function () { wp_nonce_field( 'wpcf7-constant-contact-setup' ); } ); $formatter->append_start_tag( 'table', array( 'class' => 'form-table', ) ); $formatter->append_start_tag( 'tbody' ); $formatter->append_start_tag( 'tr' ); $formatter->append_start_tag( 'th', array( 'scope' => 'row', ) ); $formatter->append_start_tag( 'label', array( 'for' => 'client_id', ) ); $formatter->append_preformatted( esc_html( __( 'API Key', 'contact-form-7' ) ) ); $formatter->end_tag( 'th' ); $formatter->append_start_tag( 'td' ); $formatter->append_preformatted( esc_html( $this->client_id ) ); $formatter->end_tag( 'tr' ); $formatter->append_start_tag( 'tr' ); $formatter->append_start_tag( 'th', array( 'scope' => 'row', ) ); $formatter->append_start_tag( 'label', array( 'for' => 'client_secret', ) ); $formatter->append_preformatted( esc_html( __( 'App Secret', 'contact-form-7' ) ) ); $formatter->end_tag( 'th' ); $formatter->append_start_tag( 'td' ); $formatter->append_preformatted( esc_html( wpcf7_mask_password( $this->client_secret, 4, 4 ) ) ); $formatter->end_tag( 'table' ); $formatter->call_user_func( function () { submit_button( _x( 'Remove Keys', 'API keys', 'contact-form-7' ), 'small', 'reset' ); } ); } $formatter->print(); } } PK \P,]fZ�{B B quiz.phpnu ��� <?php /** ** A base module for [quiz] **/ /* form_tag handler */ add_action( 'wpcf7_init', 'wpcf7_add_form_tag_quiz', 10, 0 ); function wpcf7_add_form_tag_quiz() { wpcf7_add_form_tag( 'quiz', 'wpcf7_quiz_form_tag_handler', array( 'name-attr' => true, 'do-not-store' => true, 'not-for-mail' => true, ) ); } function wpcf7_quiz_form_tag_handler( $tag ) { if ( empty( $tag->name ) ) { return ''; } $validation_error = wpcf7_get_validation_error( $tag->name ); $class = wpcf7_form_controls_class( $tag->type ); if ( $validation_error ) { $class .= ' wpcf7-not-valid'; } $atts = array(); $atts['size'] = $tag->get_size_option( '40' ); $atts['maxlength'] = $tag->get_maxlength_option(); $atts['minlength'] = $tag->get_minlength_option(); if ( $atts['maxlength'] and $atts['minlength'] and $atts['maxlength'] < $atts['minlength'] ) { unset( $atts['maxlength'], $atts['minlength'] ); } $atts['class'] = $tag->get_class_option( $class ); $atts['id'] = $tag->get_id_option(); $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); $atts['autocomplete'] = 'off'; $atts['aria-required'] = 'true'; if ( $validation_error ) { $atts['aria-invalid'] = 'true'; $atts['aria-describedby'] = wpcf7_get_validation_error_reference( $tag->name ); } else { $atts['aria-invalid'] = 'false'; } $pipes = $tag->pipes; if ( $pipes instanceof WPCF7_Pipes and ! $pipes->zero() ) { $pipe = $pipes->random_pipe(); $question = $pipe->before; $answer = $pipe->after; } else { // default quiz $question = '1+1=?'; $answer = '2'; } $answer = wpcf7_canonicalize( $answer, array( 'strip_separators' => true, ) ); $atts['type'] = 'text'; $atts['name'] = $tag->name; $html = sprintf( '<span class="wpcf7-form-control-wrap" data-name="%1$s"><label><span class="wpcf7-quiz-label">%2$s</span> <input %3$s /></label><input type="hidden" name="_wpcf7_quiz_answer_%4$s" value="%5$s" />%6$s</span>', esc_attr( $tag->name ), esc_html( $question ), wpcf7_format_atts( $atts ), $tag->name, wp_hash( $answer, 'wpcf7_quiz' ), $validation_error ); return $html; } /* Validation filter */ add_filter( 'wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10, 2 ); function wpcf7_quiz_validation_filter( $result, $tag ) { $name = $tag->name; $answer = wpcf7_superglobal_post( $name ); $answer = wpcf7_canonicalize( $answer, array( 'strip_separators' => true, ) ); $answer_hash = wp_hash( $answer, 'wpcf7_quiz' ); $expected_hash = wpcf7_superglobal_post( '_wpcf7_quiz_answer_' . $name ); if ( ! hash_equals( $expected_hash, $answer_hash ) ) { $result->invalidate( $tag, wpcf7_get_message( 'quiz_answer_not_correct' ) ); } return $result; } /* Ajax echo filter */ add_filter( 'wpcf7_refill_response', 'wpcf7_quiz_ajax_refill', 10, 1 ); add_filter( 'wpcf7_feedback_response', 'wpcf7_quiz_ajax_refill', 10, 1 ); function wpcf7_quiz_ajax_refill( $items ) { if ( ! is_array( $items ) ) { return $items; } $fes = wpcf7_scan_form_tags( array( 'type' => 'quiz' ) ); if ( empty( $fes ) ) { return $items; } $refill = array(); foreach ( $fes as $fe ) { $name = $fe['name']; $pipes = $fe['pipes']; if ( empty( $name ) ) { continue; } if ( $pipes instanceof WPCF7_Pipes and ! $pipes->zero() ) { $pipe = $pipes->random_pipe(); $question = $pipe->before; $answer = $pipe->after; } else { // default quiz $question = '1+1=?'; $answer = '2'; } $answer = wpcf7_canonicalize( $answer, array( 'strip_separators' => true, ) ); $refill[$name] = array( $question, wp_hash( $answer, 'wpcf7_quiz' ) ); } if ( ! empty( $refill ) ) { $items['quiz'] = $refill; } return $items; } /* Messages */ add_filter( 'wpcf7_messages', 'wpcf7_quiz_messages', 10, 1 ); function wpcf7_quiz_messages( $messages ) { $messages = array_merge( $messages, array( 'quiz_answer_not_correct' => array( 'description' => __( "Sender does not enter the correct answer to the quiz", 'contact-form-7' ), 'default' => __( "The answer to the quiz is incorrect.", 'contact-form-7' ), ), ) ); return $messages; } /* Tag generator */ add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_quiz', 40, 0 ); function wpcf7_add_tag_generator_quiz() { $tag_generator = WPCF7_TagGenerator::get_instance(); $tag_generator->add( 'quiz', __( 'quiz', 'contact-form-7' ), 'wpcf7_tag_generator_quiz', array( 'version' => '2' ) ); } function wpcf7_tag_generator_quiz( $contact_form, $options ) { $field_types = array( 'quiz' => array( 'display_name' => __( 'Quiz', 'contact-form-7' ), 'heading' => __( 'Quiz form-tag generator', 'contact-form-7' ), 'description' => __( 'Generates a form-tag for a <a href="https://contactform7.com/quiz/">quiz</a>.', 'contact-form-7' ), ), ); $tgg = new WPCF7_TagGeneratorGenerator( $options['content'] ); $formatter = new WPCF7_HTMLFormatter(); $formatter->append_start_tag( 'header', array( 'class' => 'description-box', ) ); $formatter->append_start_tag( 'h3' ); $formatter->append_preformatted( esc_html( $field_types['quiz']['heading'] ) ); $formatter->end_tag( 'h3' ); $formatter->append_start_tag( 'p' ); $formatter->append_preformatted( wp_kses_data( $field_types['quiz']['description'] ) ); $formatter->end_tag( 'header' ); $formatter->append_start_tag( 'div', array( 'class' => 'control-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'field_type', array( 'select_options' => array( 'quiz' => $field_types['quiz']['display_name'], ), ) ); $tgg->print( 'field_name' ); $tgg->print( 'class_attr' ); } ); $formatter->append_start_tag( 'fieldset' ); $formatter->append_start_tag( 'legend', array( 'id' => $tgg->ref( 'selectable-values-legend' ), ) ); $formatter->append_preformatted( esc_html( __( 'Questions and answers', 'contact-form-7' ) ) ); $formatter->end_tag( 'legend' ); $formatter->append_start_tag( 'span', array( 'id' => $tgg->ref( 'selectable-values-description' ), ) ); $formatter->append_preformatted( esc_html( __( 'One pipe-separated question-answer pair (question|answer) per line.', 'contact-form-7' ) ) ); $formatter->end_tag( 'span' ); $formatter->append_start_tag( 'br' ); $formatter->append_start_tag( 'textarea', array( 'required' => true, 'data-tag-part' => 'value', 'aria-labelledby' => $tgg->ref( 'selectable-values-legend' ), 'aria-describedby' => $tgg->ref( 'selectable-values-description' ), ) ); $formatter->append_preformatted( esc_html( __( 'The capital of Brazil? | Rio', 'contact-form-7' ) ) ); $formatter->end_tag( 'textarea' ); $formatter->end_tag( 'div' ); $formatter->append_start_tag( 'footer', array( 'class' => 'insert-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'insert_box_content' ); } ); $formatter->print(); } PK \P,]�3P�� � file.phpnu ��� <?php /** ** A base module for [file] and [file*] **/ /* form_tag handler */ add_action( 'wpcf7_init', 'wpcf7_add_form_tag_file', 10, 0 ); function wpcf7_add_form_tag_file() { wpcf7_add_form_tag( array( 'file', 'file*' ), 'wpcf7_file_form_tag_handler', array( 'name-attr' => true, 'file-uploading' => true, ) ); } function wpcf7_file_form_tag_handler( $tag ) { if ( empty( $tag->name ) ) { return ''; } $validation_error = wpcf7_get_validation_error( $tag->name ); $class = wpcf7_form_controls_class( $tag->type ); if ( $validation_error ) { $class .= ' wpcf7-not-valid'; } $atts = array(); $atts['size'] = $tag->get_size_option( '40' ); $atts['class'] = $tag->get_class_option( $class ); $atts['id'] = $tag->get_id_option(); $atts['capture'] = $tag->get_option( 'capture', '(user|environment)', true ); $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); $atts['accept'] = wpcf7_acceptable_filetypes( $tag->get_option( 'filetypes' ), 'attr' ); if ( $tag->is_required() ) { $atts['aria-required'] = 'true'; } if ( $validation_error ) { $atts['aria-invalid'] = 'true'; $atts['aria-describedby'] = wpcf7_get_validation_error_reference( $tag->name ); } else { $atts['aria-invalid'] = 'false'; } $atts['type'] = 'file'; $atts['name'] = $tag->name; $html = sprintf( '<span class="wpcf7-form-control-wrap" data-name="%1$s"><input %2$s />%3$s</span>', esc_attr( $tag->name ), wpcf7_format_atts( $atts ), $validation_error ); return $html; } add_action( 'wpcf7_swv_create_schema', 'wpcf7_swv_add_file_rules', 10, 2 ); function wpcf7_swv_add_file_rules( $schema, $contact_form ) { $tags = $contact_form->scan_form_tags( array( 'basetype' => array( 'file' ), ) ); foreach ( $tags as $tag ) { if ( $tag->is_required() ) { $schema->add_rule( wpcf7_swv_create_rule( 'requiredfile', array( 'field' => $tag->name, 'error' => wpcf7_get_message( 'invalid_required' ), ) ) ); } $schema->add_rule( wpcf7_swv_create_rule( 'file', array( 'field' => $tag->name, 'accept' => explode( ',', wpcf7_acceptable_filetypes( $tag->get_option( 'filetypes' ), 'attr' ) ), 'error' => wpcf7_get_message( 'upload_file_type_invalid' ), ) ) ); $schema->add_rule( wpcf7_swv_create_rule( 'maxfilesize', array( 'field' => $tag->name, 'threshold' => $tag->get_limit_option(), 'error' => wpcf7_get_message( 'upload_file_too_large' ), ) ) ); } } add_filter( 'wpcf7_mail_tag_replaced_file', 'wpcf7_file_mail_tag', 10, 4 ); add_filter( 'wpcf7_mail_tag_replaced_file*', 'wpcf7_file_mail_tag', 10, 4 ); function wpcf7_file_mail_tag( $replaced, $submitted, $html, $mail_tag ) { $submission = WPCF7_Submission::get_instance(); $uploaded_files = $submission->uploaded_files(); $name = $mail_tag->field_name(); if ( ! empty( $uploaded_files[$name] ) ) { $paths = (array) $uploaded_files[$name]; $paths = array_map( 'wp_basename', $paths ); $replaced = wpcf7_flat_join( $paths, array( 'separator' => wp_get_list_item_separator(), ) ); } return $replaced; } /* Tag generator */ add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_file', 50, 0 ); function wpcf7_add_tag_generator_file() { $tag_generator = WPCF7_TagGenerator::get_instance(); $tag_generator->add( 'file', __( 'file', 'contact-form-7' ), 'wpcf7_tag_generator_file', array( 'version' => '2' ) ); } function wpcf7_tag_generator_file( $contact_form, $options ) { $field_types = array( 'file' => array( 'display_name' => __( 'File uploading field', 'contact-form-7' ), 'heading' => __( 'File uploading field form-tag generator', 'contact-form-7' ), 'description' => __( 'Generates a form-tag for a <a href="https://contactform7.com/file-uploading-and-attachment/">file uploading field</a>.', 'contact-form-7' ), ), ); $tgg = new WPCF7_TagGeneratorGenerator( $options['content'] ); $formatter = new WPCF7_HTMLFormatter(); $formatter->append_start_tag( 'header', array( 'class' => 'description-box', ) ); $formatter->append_start_tag( 'h3' ); $formatter->append_preformatted( esc_html( $field_types['file']['heading'] ) ); $formatter->end_tag( 'h3' ); $formatter->append_start_tag( 'p' ); $formatter->append_preformatted( wp_kses_data( $field_types['file']['description'] ) ); $formatter->end_tag( 'header' ); $formatter->append_start_tag( 'div', array( 'class' => 'control-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'field_type', array( 'with_required' => true, 'select_options' => array( 'file' => $field_types['file']['display_name'], ), ) ); $tgg->print( 'field_name' ); $tgg->print( 'class_attr' ); } ); $formatter->append_start_tag( 'fieldset' ); $formatter->append_start_tag( 'legend', array( 'id' => $tgg->ref( 'filetypes-option-legend' ), ) ); $formatter->append_preformatted( esc_html( __( 'Acceptable file types', 'contact-form-7' ) ) ); $formatter->end_tag( 'legend' ); $formatter->append_start_tag( 'label' ); $formatter->append_start_tag( 'span', array( 'id' => $tgg->ref( 'filetypes-option-description' ), ) ); $formatter->append_preformatted( esc_html( __( 'Pipe-separated file types list. You can use file extensions and MIME types.', 'contact-form-7' ) ) ); $formatter->end_tag( 'span' ); $formatter->append_start_tag( 'br' ); $formatter->append_start_tag( 'input', array( 'type' => 'text', 'pattern' => '[0-9a-z*\/\|]*', 'value' => 'audio/*|video/*|image/*', 'aria-labelledby' => $tgg->ref( 'filetypes-option-legend' ), 'aria-describedby' => $tgg->ref( 'filetypes-option-description' ), 'data-tag-part' => 'option', 'data-tag-option' => 'filetypes:', ) ); $formatter->end_tag( 'fieldset' ); $formatter->append_start_tag( 'fieldset' ); $formatter->append_start_tag( 'legend', array( 'id' => $tgg->ref( 'limit-option-legend' ), ) ); $formatter->append_preformatted( esc_html( __( 'File size limit', 'contact-form-7' ) ) ); $formatter->end_tag( 'legend' ); $formatter->append_start_tag( 'label' ); $formatter->append_start_tag( 'span', array( 'id' => $tgg->ref( 'limit-option-description' ), ) ); $formatter->append_preformatted( esc_html( __( 'In bytes. You can use kb and mb suffixes.', 'contact-form-7' ) ) ); $formatter->end_tag( 'span' ); $formatter->append_start_tag( 'br' ); $formatter->append_start_tag( 'input', array( 'type' => 'text', 'pattern' => '[1-9][0-9]*([kKmM]?[bB])?', 'value' => '1mb', 'aria-labelledby' => $tgg->ref( 'limit-option-legend' ), 'aria-describedby' => $tgg->ref( 'limit-option-description' ), 'data-tag-part' => 'option', 'data-tag-option' => 'limit:', ) ); $formatter->end_tag( 'fieldset' ); $formatter->end_tag( 'div' ); $formatter->append_start_tag( 'footer', array( 'class' => 'insert-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'insert_box_content' ); $tgg->print( 'mail_tag_tip' ); } ); $formatter->print(); } PK \P,]{�O�� � turnstile/service.phpnu ��� <?php /** * Turnstile service main file */ if ( ! class_exists( 'WPCF7_Service' ) ) { return; } class WPCF7_Turnstile extends WPCF7_Service { private static $instance; private $sitekeys; /** * Returns the singleton instance of the class. */ public static function get_instance() { if ( empty( self::$instance ) ) { self::$instance = new self(); } return self::$instance; } /** * The constructor. */ private function __construct() { $this->sitekeys = WPCF7::get_option( 'turnstile' ); } /** * Returns the service title. */ public function get_title() { return __( 'Turnstile', 'contact-form-7' ); } /** * Returns true if the service is active. */ public function is_active() { $sitekey = $this->get_sitekey(); $secret = $this->get_secret( $sitekey ); return $sitekey && $secret; } /** * Returns an array of categories to which the service belongs to. */ public function get_categories() { return array( 'spam_protection' ); } /** * Returns the icon that represents the service. */ public function icon() { } /** * Returns a link to the service provider. */ public function link() { echo wp_kses_data( wpcf7_link( 'https://www.cloudflare.com/application-services/products/turnstile/', 'cloudflare.com' ) ); } /** * Returns a sitekey. */ public function get_sitekey() { $sitekeys = (array) $this->sitekeys; $sitekey = array_key_first( $sitekeys ) ?? ''; return apply_filters( 'wpcf7_turnstile_sitekey', $sitekey ); } /** * Returns the secret key that is paired with the given sitekey. */ public function get_secret( $sitekey ) { $sitekeys = (array) $this->sitekeys; $secret = $sitekeys[$sitekey] ?? ''; return apply_filters( 'wpcf7_turnstile_secret', $secret ); } /** * Logs an API response. */ protected function log( $url, $request, $response ) { wpcf7_log_remote_request( $url, $request, $response ); } /** * Verifies a response token. */ public function verify( $token ) { $is_human = false; if ( empty( $token ) or ! $this->is_active() ) { return $is_human; } $endpoint = 'https://challenges.cloudflare.com/turnstile/v0/siteverify'; $sitekey = $this->get_sitekey(); $secret = $this->get_secret( $sitekey ); $request = array( 'body' => array( 'secret' => $secret, 'response' => $token, ), ); $response = wp_remote_post( sanitize_url( $endpoint ), $request ); if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { if ( WP_DEBUG ) { $this->log( $endpoint, $request, $response ); } return $is_human; } $response_body = wp_remote_retrieve_body( $response ); $response_body = json_decode( $response_body, true ); if ( $response_body['success'] ) { $is_human = true; } if ( $submission = WPCF7_Submission::get_instance() ) { $submission->push( 'turnstile', array( 'response' => $response_body, ) ); } return $is_human; } /** * Returns the menu page URL for the service configuration. */ protected function menu_page_url( $args = '' ) { $args = wp_parse_args( $args, array() ); $url = menu_page_url( 'wpcf7-integration', false ); $url = add_query_arg( array( 'service' => 'turnstile' ), $url ); if ( ! empty( $args ) ) { $url = add_query_arg( $args, $url ); } return $url; } /** * Saves the service configuration data. */ protected function save_data() { WPCF7::update_option( 'turnstile', $this->sitekeys ); } /** * Resets the service configuration data. */ protected function reset_data() { $this->sitekeys = null; $this->save_data(); } /** * The loading process of the service configuration page. */ public function load( $action = '' ) { if ( 'setup' === $action and 'POST' === wpcf7_superglobal_server( 'REQUEST_METHOD' ) ) { check_admin_referer( 'wpcf7-turnstile-setup' ); if ( wpcf7_superglobal_post( 'reset' ) ) { $this->reset_data(); $redirect_to = $this->menu_page_url( 'action=setup' ); } else { $sitekey = wpcf7_superglobal_post( 'sitekey' ); $secret = wpcf7_superglobal_post( 'secret' ); if ( $sitekey and $secret ) { $this->sitekeys = array( $sitekey => $secret ); $this->save_data(); $redirect_to = $this->menu_page_url( array( 'message' => 'success', ) ); } else { $redirect_to = $this->menu_page_url( array( 'action' => 'setup', 'message' => 'invalid', ) ); } } wp_safe_redirect( $redirect_to ); exit(); } } /** * Displays a notice on the integration page. */ public function admin_notice( $message = '' ) { if ( 'invalid' === $message ) { wp_admin_notice( __( '<strong>Error:</strong> Invalid key values.', 'contact-form-7' ), array( 'type' => 'error' ) ); } if ( 'success' === $message ) { wp_admin_notice( __( 'Settings saved.', 'contact-form-7' ), array( 'type' => 'success' ) ); } } /** * Displays the service configuration box. */ public function display( $action = '' ) { $formatter = new WPCF7_HTMLFormatter( array( 'allowed_html' => array_merge( wpcf7_kses_allowed_html(), array( 'form' => array( 'action' => true, 'method' => true, ), ) ), ) ); $formatter->append_start_tag( 'p' ); $formatter->append_preformatted( esc_html( __( 'Turnstile is Cloudflare’s smart CAPTCHA alternative, which confirms web visitors are real and blocks unwanted bots without slowing down web experiences for real users.', 'contact-form-7' ) ) ); $formatter->end_tag( 'p' ); $formatter->append_start_tag( 'p' ); $formatter->append_start_tag( 'strong' ); $formatter->append_preformatted( wpcf7_link( __( 'https://contactform7.com/turnstile-integration/', 'contact-form-7' ), __( 'Cloudflare Turnstile integration', 'contact-form-7' ) ) ); $formatter->end_tag( 'p' ); if ( $this->is_active() ) { $formatter->append_start_tag( 'p', array( 'class' => 'dashicons-before dashicons-yes', ) ); $formatter->append_preformatted( esc_html( __( 'Turnstile is active on this site.', 'contact-form-7' ) ) ); $formatter->end_tag( 'p' ); } if ( 'setup' === $action ) { $formatter->call_user_func( function () { $this->display_setup(); } ); } else { $formatter->append_start_tag( 'p' ); $formatter->append_start_tag( 'a', array( 'href' => esc_url( $this->menu_page_url( 'action=setup' ) ), 'class' => 'button', ) ); $formatter->append_preformatted( esc_html( __( 'Setup integration', 'contact-form-7' ) ) ); $formatter->end_tag( 'p' ); } $formatter->print(); } /** * Displays the service setup form. */ private function display_setup() { $sitekey = $this->is_active() ? $this->get_sitekey() : ''; $secret = $this->is_active() ? $this->get_secret( $sitekey ) : ''; ?> <form method="post" action="<?php echo esc_url( $this->menu_page_url( 'action=setup' ) ); ?>"> <?php wp_nonce_field( 'wpcf7-turnstile-setup' ); ?> <table class="form-table"> <tbody> <tr> <th scope="row"><label for="sitekey"><?php echo esc_html( __( 'Site Key', 'contact-form-7' ) ); ?></label></th> <td><?php if ( $this->is_active() ) { echo esc_html( $sitekey ); echo sprintf( '<input type="hidden" value="%1$s" id="sitekey" name="sitekey" />', esc_attr( $sitekey ) ); } else { echo sprintf( '<input type="text" aria-required="true" value="%1$s" id="sitekey" name="sitekey" class="regular-text code" />', esc_attr( $sitekey ) ); } ?></td> </tr> <tr> <th scope="row"><label for="secret"><?php echo esc_html( __( 'Secret Key', 'contact-form-7' ) ); ?></label></th> <td><?php if ( $this->is_active() ) { echo esc_html( wpcf7_mask_password( $secret, 4, 4 ) ); echo sprintf( '<input type="hidden" value="%1$s" id="secret" name="secret" />', esc_attr( $secret ) ); } else { echo sprintf( '<input type="text" aria-required="true" value="%1$s" id="secret" name="secret" class="regular-text code" />', esc_attr( $secret ) ); } ?></td> </tr> </tbody> </table> <?php if ( $this->is_active() ) { submit_button( _x( 'Remove Keys', 'API keys', 'contact-form-7' ), 'small', 'reset' ); } else { submit_button( __( 'Save Changes', 'contact-form-7' ) ); } ?> </form> <?php } } PK \P,]'UͰ� � turnstile/turnstile.phpnu ��� <?php /** * Turnstile module main file */ include_once path_join( __DIR__, 'service.php' ); add_action( 'wpcf7_init', 'wpcf7_turnstile_register_service', 35, 0 ); /** * Registers the Turnstile service. */ function wpcf7_turnstile_register_service() { $integration = WPCF7_Integration::get_instance(); $integration->add_service( 'turnstile', WPCF7_Turnstile::get_instance() ); } add_action( 'wp_enqueue_scripts', 'wpcf7_turnstile_enqueue_scripts', 10, 0 ); /** * Enqueues the Turnstile script. */ function wpcf7_turnstile_enqueue_scripts() { $service = WPCF7_Turnstile::get_instance(); if ( ! $service->is_active() ) { return; } wp_enqueue_script( 'cloudflare-turnstile', 'https://challenges.cloudflare.com/turnstile/v0/api.js', array(), null, array( 'strategy' => 'async', ) ); wp_add_inline_script( 'cloudflare-turnstile', "document.addEventListener( 'wpcf7submit', e => turnstile.reset() );" ); } add_action( 'wpcf7_init', 'wpcf7_add_form_tag_turnstile', 10, 0 ); /** * Registers the Turnstile form-tag type. */ function wpcf7_add_form_tag_turnstile() { $service = WPCF7_Turnstile::get_instance(); if ( ! $service->is_active() ) { wpcf7_add_form_tag( 'turnstile', '__return_empty_string', array( 'display-block' => true, ) ); return; } wpcf7_add_form_tag( 'turnstile', 'wpcf7_turnstile_form_tag_handler', array( 'display-block' => true, 'singular' => true, ) ); } /** * The Turnstile form-tag handler. */ function wpcf7_turnstile_form_tag_handler( $tag ) { $service = WPCF7_Turnstile::get_instance(); if ( ! $service->is_active() ) { return; } return sprintf( '<div %s></div>', wpcf7_format_atts( array( 'class' => 'wpcf7-turnstile cf-turnstile', 'data-sitekey' => $service->get_sitekey(), 'data-response-field-name' => '_wpcf7_turnstile_response', 'data-action' => $tag->get_option( 'action', '[-0-9a-zA-Z_]{1,32}', true ), 'data-appearance' => $tag->get_option( 'appearance', '(always|execute|interaction-only)', true ), 'data-size' => $tag->get_option( 'size', '(normal|flexible|compact)', true ), 'data-theme' => $tag->get_option( 'theme', '(light|dark|auto)', true ), 'data-language' => $tag->get_option( 'language', '[a-z-]{2,5}', true ), 'data-tabindex' => $tag->get_option( 'tabindex', 'signed_int', true ), ) ) ); } add_filter( 'wpcf7_form_elements', 'wpcf7_turnstile_prepend_widget', 10, 1 ); /** * Prepends a Turnstile widget to the form content if the form template * does not include a Turnstile form-tag. */ function wpcf7_turnstile_prepend_widget( $content ) { $service = WPCF7_Turnstile::get_instance(); if ( ! $service->is_active() ) { return $content; } $contact_form = WPCF7_ContactForm::get_current(); $manager = WPCF7_FormTagsManager::get_instance(); $tags = $contact_form->scan_form_tags( array( 'type' => 'turnstile', ) ); if ( empty( $tags ) ) { $content = $manager->replace_all( '[turnstile]' ) . "\n\n" . $content; } return $content; } add_filter( 'wpcf7_spam', 'wpcf7_turnstile_verify_response', 9, 2 ); /** * Verifies the Turnstile response token. * * @param bool $spam The spam/ham status inherited from preceding callbacks. * @param WPCF7_Submission $submission The submission object. * @return bool True if the submitter is a bot, false if a human. */ function wpcf7_turnstile_verify_response( $spam, $submission ) { if ( $spam ) { return $spam; } $service = WPCF7_Turnstile::get_instance(); if ( ! $service->is_active() ) { return $spam; } $token = wpcf7_superglobal_post( '_wpcf7_turnstile_response' ); if ( $service->verify( $token ) ) { // Human $spam = false; } else { // Bot $spam = true; if ( '' === $token ) { $submission->add_spam_log( array( 'agent' => 'turnstile', 'reason' => __( 'Turnstile token is empty.', 'contact-form-7' ), ) ); } else { $submission->add_spam_log( array( 'agent' => 'turnstile', 'reason' => __( 'Turnstile validation failed.', 'contact-form-7' ), ) ); } } return $spam; } add_filter( 'wpcf7_flamingo_inbound_message_parameters', 'wpcf7_flamingo_inbound_message_parameters_turnstile', 10, 1 ); /** * Passes response data from Turnstile siteverify API to Flamingo. */ function wpcf7_flamingo_inbound_message_parameters_turnstile( $params ) { $meta = null; if ( $submission = WPCF7_Submission::get_instance() ) { $meta = $submission->pull( 'turnstile' ); } if ( isset( $meta ) ) { $params['meta']['turnstile'] = wp_json_encode( $meta ); } return $params; } PK \P,]q ^gz z select.phpnu ��� <?php /** ** A base module for [select] and [select*] **/ /* form_tag handler */ add_action( 'wpcf7_init', 'wpcf7_add_form_tag_select', 10, 0 ); function wpcf7_add_form_tag_select() { wpcf7_add_form_tag( array( 'select', 'select*' ), 'wpcf7_select_form_tag_handler', array( 'name-attr' => true, 'selectable-values' => true, ) ); } function wpcf7_select_form_tag_handler( $tag ) { if ( empty( $tag->name ) ) { return ''; } $validation_error = wpcf7_get_validation_error( $tag->name ); $class = wpcf7_form_controls_class( $tag->type ); if ( $validation_error ) { $class .= ' wpcf7-not-valid'; } $atts = array(); $atts['class'] = $tag->get_class_option( $class ); $atts['id'] = $tag->get_id_option(); $atts['tabindex'] = $tag->get_option( 'tabindex', 'signed_int', true ); $atts['autocomplete'] = $tag->get_autocomplete_option(); if ( $tag->is_required() ) { $atts['aria-required'] = 'true'; } if ( $validation_error ) { $atts['aria-invalid'] = 'true'; $atts['aria-describedby'] = wpcf7_get_validation_error_reference( $tag->name ); } else { $atts['aria-invalid'] = 'false'; } $multiple = $tag->has_option( 'multiple' ); $include_blank = $tag->has_option( 'include_blank' ); $first_as_label = $tag->has_option( 'first_as_label' ); if ( $tag->has_option( 'size' ) ) { $size = $tag->get_option( 'size', 'int', true ); if ( $size ) { $atts['size'] = $size; } elseif ( $multiple ) { $atts['size'] = 4; } else { $atts['size'] = 1; } } if ( $data = (array) $tag->get_data_option() ) { $tag->values = array_merge( $tag->values, array_values( $data ) ); $tag->labels = array_merge( $tag->labels, array_values( $data ) ); } $values = $tag->values; $labels = $tag->labels; $default_choice = $tag->get_default_option( null, array( 'multiple' => $multiple, ) ); if ( $include_blank or empty( $values ) ) { array_unshift( $labels, __( '—Please choose an option—', 'contact-form-7' ) ); array_unshift( $values, '' ); } elseif ( $first_as_label ) { $values[0] = ''; } $html = ''; $hangover = wpcf7_get_hangover( $tag->name ); foreach ( $values as $key => $value ) { if ( $hangover ) { $selected = in_array( $value, (array) $hangover, true ); } else { $selected = in_array( $value, (array) $default_choice, true ); } $item_atts = array( 'value' => $value, 'selected' => $selected, ); $label = isset( $labels[$key] ) ? $labels[$key] : $value; $html .= sprintf( '<option %1$s>%2$s</option>', wpcf7_format_atts( $item_atts ), esc_html( $label ) ); } $atts['multiple'] = (bool) $multiple; $atts['name'] = $tag->name . ( $multiple ? '[]' : '' ); $html = sprintf( '<span class="wpcf7-form-control-wrap" data-name="%1$s"><select %2$s>%3$s</select>%4$s</span>', esc_attr( $tag->name ), wpcf7_format_atts( $atts ), $html, $validation_error ); return $html; } add_action( 'wpcf7_swv_create_schema', 'wpcf7_swv_add_select_rules', 10, 2 ); function wpcf7_swv_add_select_rules( $schema, $contact_form ) { $tags = $contact_form->scan_form_tags( array( 'type' => array( 'select*' ), ) ); foreach ( $tags as $tag ) { $schema->add_rule( wpcf7_swv_create_rule( 'required', array( 'field' => $tag->name, 'error' => wpcf7_get_message( 'invalid_required' ), ) ) ); } } add_action( 'wpcf7_swv_create_schema', 'wpcf7_swv_add_select_enum_rules', 20, 2 ); function wpcf7_swv_add_select_enum_rules( $schema, $contact_form ) { $tags = $contact_form->scan_form_tags( array( 'basetype' => array( 'select' ), ) ); $values = array_reduce( $tags, function ( $values, $tag ) { if ( ! isset( $values[$tag->name] ) ) { $values[$tag->name] = array(); } $tag_values = array_merge( (array) $tag->values, (array) $tag->get_data_option() ); if ( $tag->has_option( 'first_as_label' ) ) { $tag_values = array_slice( $tag_values, 1 ); } $values[$tag->name] = array_merge( $values[$tag->name], $tag_values ); return $values; }, array() ); foreach ( $values as $field => $field_values ) { $field_values = array_map( static function ( $value ) { return html_entity_decode( (string) $value, ENT_QUOTES | ENT_HTML5, 'UTF-8' ); }, $field_values ); $field_values = array_filter( array_unique( $field_values ), static function ( $value ) { return '' !== $value; } ); $schema->add_rule( wpcf7_swv_create_rule( 'enum', array( 'field' => $field, 'accept' => array_values( $field_values ), 'error' => $contact_form->filter_message( __( 'Undefined value was submitted through this field.', 'contact-form-7' ) ), ) ) ); } } /* Tag generator */ add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_menu', 25, 0 ); function wpcf7_add_tag_generator_menu() { $tag_generator = WPCF7_TagGenerator::get_instance(); $tag_generator->add( 'menu', __( 'drop-down menu', 'contact-form-7' ), 'wpcf7_tag_generator_menu', array( 'version' => '2' ) ); } function wpcf7_tag_generator_menu( $contact_form, $options ) { $field_types = array( 'select' => array( 'display_name' => __( 'Drop-down menu', 'contact-form-7' ), 'heading' => __( 'Drop-down menu form-tag generator', 'contact-form-7' ), 'description' => __( 'Generates a form-tag for a <a href="https://contactform7.com/checkboxes-radio-buttons-and-menus/">drop-down menu</a>.', 'contact-form-7' ), ), ); $tgg = new WPCF7_TagGeneratorGenerator( $options['content'] ); $formatter = new WPCF7_HTMLFormatter(); $formatter->append_start_tag( 'header', array( 'class' => 'description-box', ) ); $formatter->append_start_tag( 'h3' ); $formatter->append_preformatted( esc_html( $field_types['select']['heading'] ) ); $formatter->end_tag( 'h3' ); $formatter->append_start_tag( 'p' ); $formatter->append_preformatted( wp_kses_data( $field_types['select']['description'] ) ); $formatter->end_tag( 'header' ); $formatter->append_start_tag( 'div', array( 'class' => 'control-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'field_type', array( 'with_required' => true, 'select_options' => array( 'select' => $field_types['select']['display_name'], ), ) ); $tgg->print( 'field_name' ); $tgg->print( 'class_attr' ); $tgg->print( 'selectable_values', array( 'first_as_label' => true, ) ); } ); $formatter->end_tag( 'div' ); $formatter->append_start_tag( 'footer', array( 'class' => 'insert-box', ) ); $formatter->call_user_func( static function () use ( $tgg, $field_types ) { $tgg->print( 'insert_box_content' ); $tgg->print( 'mail_tag_tip' ); } ); $formatter->print(); } PK \P,]8ܤQ Q recaptcha/index.asset.phpnu ��� <?php return array( 'dependencies' => array(), 'version' => WPCF7_VERSION, ); PK \P,]fO�� � recaptcha/index.jsnu ��� document.addEventListener("DOMContentLoaded",(e=>{var t;wpcf7_recaptcha={...null!==(t=wpcf7_recaptcha)&&void 0!==t?t:{}};const c=wpcf7_recaptcha.sitekey,{homepage:n,contactform:a}=wpcf7_recaptcha.actions,o=e=>{const{action:t,func:n,params:a}=e;grecaptcha.execute(c,{action:t}).then((e=>{const c=new CustomEvent("wpcf7grecaptchaexecuted",{detail:{action:t,token:e}});document.dispatchEvent(c)})).then((()=>{"function"==typeof n&&n(...a)})).catch((e=>console.error(e)))};if(grecaptcha.ready((()=>{o({action:n})})),document.addEventListener("change",(e=>{o({action:a})})),"undefined"!=typeof wpcf7&&"function"==typeof wpcf7.submit){const e=wpcf7.submit;wpcf7.submit=(t,c={})=>{o({action:a,func:e,params:[t,c]})}}document.addEventListener("wpcf7grecaptchaexecuted",(e=>{const t=document.querySelectorAll('form.wpcf7-form input[name="_wpcf7_recaptcha_response"]');for(let c=0;c<t.length;c++)t[c].setAttribute("value",e.detail.token)}))}));PK \P,]w�[B�"