= 4.7 ) { $get_locale = get_user_locale(); } // Traditional WordPress plugin locale filter $locale = apply_filters( 'plugin_locale', $get_locale, 'accept-authorize-net-payments-using-contact-form-7' ); $mofile = sprintf( '%1$s-%2$s.mo', 'accept-authorize-net-payments-using-contact-form-7', $locale ); // Setup paths to current locale file $mofile_global = WP_LANG_DIR . '/plugins/' . basename( CF7ADN_DIR ) . '/' . $mofile; if ( file_exists( $mofile_global ) ) { // Look in global /wp-content/languages/plugin-name folder load_textdomain( 'accept-authorize-net-payments-using-contact-form-7', $mofile_global ); } else { // Load the default language files load_plugin_textdomain( 'accept-authorize-net-payments-using-contact-form-7', false, $cf7adn_lang_dir ); } } function action__setup_theme() { if ( is_admin() ) { CF7ADN()->admin = new CF7ADN_Admin; CF7ADN()->admin->action = new CF7ADN_Admin_Action; CF7ADN()->admin->filter = new CF7ADN_Admin_Filter; } else { CF7ADN()->front = new CF7ADN_Front; CF7ADN()->front->action = new CF7ADN_Front_Action; CF7ADN()->front->filter = new CF7ADN_Front_Filter; } CF7ADN()->lib = new CF7ADN_Lib; } function action__wpcf7_admin_init() { $tag_generator = WPCF7_TagGenerator::get_instance(); $tag_generator->add( 'authorize', __( 'Authorize.Net', 'accept-authorize-net-payments-using-contact-form-7' ), array( $this, 'wpcf7_tag_generator_authorize_net' ) ); } /** * Load Text Domain * This gets the plugin ready for translation */ function action__init() { /* Initialize backend tags */ add_action( 'wpcf7_admin_init', array( $this, 'action__wpcf7_admin_init' ), 15, 0 ); add_action('wp_ajax_cf7_cf7adn_validation', array( $this, 'ajax__cf7_cf7adn_validation' ) ); add_action('wp_ajax_nopriv_cf7_cf7adn_validation', array( $this, 'ajax__cf7_cf7adn_validation' ) ); flush_rewrite_rules(); //phpcs:ignore /** * Post Type: Authorize.Net Add-on. */ $labels = array( 'name' => __( 'Authorize.Net Add-on', 'accept-authorize-net-payments-using-contact-form-7' ), 'singular_name' => __( 'Authorize.Net Add-on', 'accept-authorize-net-payments-using-contact-form-7' ), ); $args = array( 'label' => __( 'Authorize.Net Add-on', 'accept-authorize-net-payments-using-contact-form-7' ), 'labels' => $labels, 'description' => '', 'public' => false, 'publicly_queryable' => false, 'show_ui' => true, 'delete_with_user' => false, 'show_in_rest' => false, 'rest_base' => '', 'has_archive' => false, 'show_in_menu' => 'wpcf7', 'show_in_nav_menus' => false, 'exclude_from_search' => true, 'capability_type' => 'post', 'capabilities' => array( 'read' => true, 'create_posts' => false, 'publish_posts' => false, ), 'map_meta_cap' => true, 'hierarchical' => false, 'rewrite' => false, 'query_var' => false, 'supports' => array( 'title' ), ); register_post_type( 'cf7adn_data', $args ); } function action__admin_notices_deactive() { echo '
' . '

' . sprintf( /* translators: Contact Form 7 - Authorize.NET Add-on */ __( '

Contact Form 7 is required to use %s.

', 'contact-form-7-paypal-extension' ), //phpcs:ignore 'Contact Form 7 - Authorize.NET Add-on' ) . '

' . '
'; } function ajax__cf7_cf7adn_validation() { global $wpdb; if ( isset( $_POST[ '_wpcf7' ] ) ) { //phpcs:ignore $id = intval($_POST[ '_wpcf7' ]); //phpcs:ignore $unit_tag = wpcf7_sanitize_unit_tag( $_POST[ '_wpcf7_unit_tag' ] ); //phpcs:ignore $spam = false; if ( $contact_form = wpcf7_contact_form( $id ) ) { if ( WPCF7_VERIFY_NONCE && ! wpcf7_verify_nonce( sanitize_text_field($_POST['_wpnonce']), $contact_form->id() ) ) { //phpcs:ignore $spam = true; exit( esc_html__( 'Spam detected') ); } else { $items = array( 'mailSent' => false, 'into' => '#' . $unit_tag, 'captcha' => null ); /* Begin validation */ require_once WPCF7_PLUGIN_DIR . '/includes/validation.php'; $result = new WPCF7_Validation(); $tags = $contact_form->scan_form_tags(); $args = array(); foreach ( $tags as $tag ) { if($tag->basetype == 'file'){ $result = apply_filters( 'wpcf7_validate_' . $tag[ 'type' ], $result, $tag, $args ); }else{ $result = apply_filters( 'wpcf7_validate_' . $tag[ 'type' ], $result, $tag ); } } $result = apply_filters( 'wpcf7_validate', $result, $tags ); $invalid_fields = $result->get_invalid_fields(); $return = array( 'success' => $result->is_valid(), 'invalid_fields' => $invalid_fields ); if ( $return[ 'success' ] == false ) { $messages = $contact_form->prop( 'messages' ); $return[ 'message' ] = $messages[ 'validation_error' ]; if ( empty( $return[ 'message' ] ) ) { $default_messages = wpcf7_messages(); $return[ 'message' ] = $default_messages[ 'validation_error' ][ 'default' ]; } } else { $return[ 'message' ] = ''; } $json = wp_json_encode( $return ); exit( esc_js( $json ) ); } } } } /* ######## #### ## ######## ######## ######## ###### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ###### ## ## ## ###### ######## ###### ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #### ######## ## ######## ## ## ###### */ /* ######## ## ## ## ## ###### ######## #### ####### ## ## ###### ## ## ## ### ## ## ## ## ## ## ## ### ## ## ## ## ## ## #### ## ## ## ## ## ## #### ## ## ###### ## ## ## ## ## ## ## ## ## ## ## ## ## ###### ## ## ## ## #### ## ## ## ## ## ## #### ## ## ## ## ## ### ## ## ## ## ## ## ## ### ## ## ## ####### ## ## ###### ## #### ####### ## ## ###### */ /** * -Render CF7 Shortcode settings into backend. * * @method wpcf7_tag_generator_authorize_net * * @param object $contact_form * @param array $args */ function wpcf7_tag_generator_authorize_net( $contact_form, $args = '' ) { $args = wp_parse_args( $args, array() ); $type = $args['id']; $description = __( "Generate a form-tag for to display Authorize.Net payment form", 'accept-authorize-net-payments-using-contact-form-7' ); ?>