Файловый менеджер - Редактировать - /home/infrafs/INFRABIKEIT/wp-content/plugins/contact-form-7.tar
Назад
admin/admin.php 0000644 00000042664 15133152050 0007444 0 ustar 00 <?php require_once WPCF7_PLUGIN_DIR . '/admin/includes/admin-functions.php'; require_once WPCF7_PLUGIN_DIR . '/admin/includes/help-tabs.php'; require_once WPCF7_PLUGIN_DIR . '/admin/includes/tag-generator.php'; require_once WPCF7_PLUGIN_DIR . '/admin/includes/welcome-panel.php'; require_once WPCF7_PLUGIN_DIR . '/admin/includes/config-validator.php'; add_action( 'admin_init', static function () { do_action( 'wpcf7_admin_init' ); }, 10, 0 ); add_action( 'admin_menu', 'wpcf7_admin_menu', 9, 0 ); function wpcf7_admin_menu() { do_action( 'wpcf7_admin_menu' ); add_menu_page( __( 'Contact Form 7', 'contact-form-7' ), __( 'Contact', 'contact-form-7' ) . wpcf7_admin_menu_change_notice(), 'wpcf7_read_contact_forms', 'wpcf7', 'wpcf7_admin_management_page', 'dashicons-email', 30 ); $edit = add_submenu_page( 'wpcf7', __( 'Edit Contact Form', 'contact-form-7' ), __( 'Contact Forms', 'contact-form-7' ) . wpcf7_admin_menu_change_notice( 'wpcf7' ), 'wpcf7_read_contact_forms', 'wpcf7', 'wpcf7_admin_management_page' ); add_action( 'load-' . $edit, 'wpcf7_load_contact_form_admin', 10, 0 ); $addnew = add_submenu_page( 'wpcf7', __( 'Add New Contact Form', 'contact-form-7' ), __( 'Add New', 'contact-form-7' ) . wpcf7_admin_menu_change_notice( 'wpcf7-new' ), 'wpcf7_edit_contact_forms', 'wpcf7-new', 'wpcf7_admin_add_new_page' ); add_action( 'load-' . $addnew, 'wpcf7_load_contact_form_admin', 10, 0 ); $integration = WPCF7_Integration::get_instance(); if ( $integration->service_exists() ) { $integration = add_submenu_page( 'wpcf7', __( 'Integration with External API', 'contact-form-7' ), __( 'Integration', 'contact-form-7' ) . wpcf7_admin_menu_change_notice( 'wpcf7-integration' ), 'wpcf7_manage_integration', 'wpcf7-integration', 'wpcf7_admin_integration_page' ); add_action( 'load-' . $integration, 'wpcf7_load_integration_page', 10, 0 ); } } function wpcf7_admin_menu_change_notice( $menu_slug = '' ) { $counts = apply_filters( 'wpcf7_admin_menu_change_notice', array( 'wpcf7' => 0, 'wpcf7-new' => 0, 'wpcf7-integration' => 0, ) ); if ( empty( $menu_slug ) ) { $count = absint( array_sum( $counts ) ); } elseif ( isset( $counts[$menu_slug] ) ) { $count = absint( $counts[$menu_slug] ); } else { $count = 0; } if ( $count ) { return sprintf( ' <span class="update-plugins %1$d"><span class="plugin-count">%2$s</span></span>', $count, esc_html( number_format_i18n( $count ) ) ); } return ''; } add_action( 'admin_enqueue_scripts', 'wpcf7_admin_enqueue_scripts', 10, 1 ); function wpcf7_admin_enqueue_scripts( $hook_suffix ) { if ( false === strpos( $hook_suffix, 'wpcf7' ) ) { return; } wp_enqueue_style( 'contact-form-7-admin', wpcf7_plugin_url( 'admin/css/styles.css' ), array(), WPCF7_VERSION, 'all' ); if ( wpcf7_is_rtl() ) { wp_enqueue_style( 'contact-form-7-admin-rtl', wpcf7_plugin_url( 'admin/css/styles-rtl.css' ), array(), WPCF7_VERSION, 'all' ); } wp_enqueue_script( 'wpcf7-admin', wpcf7_plugin_url( 'admin/js/scripts.js' ), array( 'jquery', 'jquery-ui-tabs' ), WPCF7_VERSION, true ); $args = array( 'apiSettings' => array( 'root' => sanitize_url( rest_url( 'contact-form-7/v1' ) ), 'namespace' => 'contact-form-7/v1', 'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ), ), 'pluginUrl' => wpcf7_plugin_url(), 'saveAlert' => __( "The changes you made will be lost if you navigate away from this page.", 'contact-form-7' ), 'activeTab' => isset( $_GET['active-tab'] ) ? (int) $_GET['active-tab'] : 0, 'configValidator' => array( 'errors' => array(), 'howToCorrect' => __( "How to resolve?", 'contact-form-7' ), 'oneError' => __( '1 configuration error detected', 'contact-form-7' ), 'manyErrors' => __( '%d configuration errors detected', 'contact-form-7' ), 'oneErrorInTab' => __( '1 configuration error detected in this tab panel', 'contact-form-7' ), 'manyErrorsInTab' => __( '%d configuration errors detected in this tab panel', 'contact-form-7' ), 'docUrl' => WPCF7_ConfigValidator::get_doc_link(), /* translators: screen reader text */ 'iconAlt' => __( '(configuration error)', 'contact-form-7' ), ), ); if ( $post = wpcf7_get_current_contact_form() and current_user_can( 'wpcf7_edit_contact_form', $post->id() ) and wpcf7_validate_configuration() ) { $config_validator = new WPCF7_ConfigValidator( $post ); $config_validator->restore(); $args['configValidator']['errors'] = $config_validator->collect_error_messages(); } wp_localize_script( 'wpcf7-admin', 'wpcf7', $args ); add_thickbox(); wp_enqueue_script( 'wpcf7-admin-taggenerator', wpcf7_plugin_url( 'admin/js/tag-generator.js' ), array( 'jquery', 'thickbox', 'wpcf7-admin' ), WPCF7_VERSION, true ); } add_filter( 'set_screen_option_wpcf7_contact_forms_per_page', static function ( $result, $option, $value ) { $wpcf7_screens = array( 'wpcf7_contact_forms_per_page', ); if ( in_array( $option, $wpcf7_screens ) ) { $result = $value; } return $result; }, 10, 3 ); function wpcf7_load_contact_form_admin() { global $plugin_page; $action = wpcf7_current_action(); do_action( 'wpcf7_admin_load', isset( $_GET['page'] ) ? trim( $_GET['page'] ) : '', $action ); if ( 'save' == $action ) { $id = isset( $_POST['post_ID'] ) ? $_POST['post_ID'] : '-1'; check_admin_referer( 'wpcf7-save-contact-form_' . $id ); if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) { wp_die( __( "You are not allowed to edit this item.", 'contact-form-7' ) ); } $args = $_REQUEST; $args['id'] = $id; $args['title'] = isset( $_POST['post_title'] ) ? $_POST['post_title'] : null; $args['locale'] = isset( $_POST['wpcf7-locale'] ) ? $_POST['wpcf7-locale'] : null; $args['form'] = isset( $_POST['wpcf7-form'] ) ? $_POST['wpcf7-form'] : ''; $args['mail'] = isset( $_POST['wpcf7-mail'] ) ? $_POST['wpcf7-mail'] : array(); $args['mail_2'] = isset( $_POST['wpcf7-mail-2'] ) ? $_POST['wpcf7-mail-2'] : array(); $args['messages'] = isset( $_POST['wpcf7-messages'] ) ? $_POST['wpcf7-messages'] : array(); $args['additional_settings'] = isset( $_POST['wpcf7-additional-settings'] ) ? $_POST['wpcf7-additional-settings'] : ''; $contact_form = wpcf7_save_contact_form( $args ); if ( $contact_form and wpcf7_validate_configuration() ) { $config_validator = new WPCF7_ConfigValidator( $contact_form ); $config_validator->validate(); $config_validator->save(); } $query = array( 'post' => $contact_form ? $contact_form->id() : 0, 'active-tab' => isset( $_POST['active-tab'] ) ? (int) $_POST['active-tab'] : 0, ); if ( ! $contact_form ) { $query['message'] = 'failed'; } elseif ( -1 == $id ) { $query['message'] = 'created'; } else { $query['message'] = 'saved'; } $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) ); wp_safe_redirect( $redirect_to ); exit(); } if ( 'copy' == $action ) { $id = empty( $_POST['post_ID'] ) ? absint( $_REQUEST['post'] ) : absint( $_POST['post_ID'] ); check_admin_referer( 'wpcf7-copy-contact-form_' . $id ); if ( ! current_user_can( 'wpcf7_edit_contact_form', $id ) ) { wp_die( __( "You are not allowed to edit this item.", 'contact-form-7' ) ); } $query = array(); if ( $contact_form = wpcf7_contact_form( $id ) ) { $new_contact_form = $contact_form->copy(); $new_contact_form->save(); $query['post'] = $new_contact_form->id(); $query['message'] = 'created'; } $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) ); wp_safe_redirect( $redirect_to ); exit(); } if ( 'delete' == $action ) { if ( ! empty( $_POST['post_ID'] ) ) { check_admin_referer( 'wpcf7-delete-contact-form_' . $_POST['post_ID'] ); } elseif ( ! is_array( $_REQUEST['post'] ) ) { check_admin_referer( 'wpcf7-delete-contact-form_' . $_REQUEST['post'] ); } else { check_admin_referer( 'bulk-posts' ); } $posts = empty( $_POST['post_ID'] ) ? (array) $_REQUEST['post'] : (array) $_POST['post_ID']; $deleted = 0; foreach ( $posts as $post ) { $post = WPCF7_ContactForm::get_instance( $post ); if ( empty( $post ) ) { continue; } if ( ! current_user_can( 'wpcf7_delete_contact_form', $post->id() ) ) { wp_die( __( "You are not allowed to delete this item.", 'contact-form-7' ) ); } if ( ! $post->delete() ) { wp_die( __( "Error in deleting.", 'contact-form-7' ) ); } $deleted += 1; } $query = array(); if ( ! empty( $deleted ) ) { $query['message'] = 'deleted'; } $redirect_to = add_query_arg( $query, menu_page_url( 'wpcf7', false ) ); wp_safe_redirect( $redirect_to ); exit(); } $post = null; if ( 'wpcf7-new' == $plugin_page ) { $post = WPCF7_ContactForm::get_template( array( 'locale' => isset( $_GET['locale'] ) ? $_GET['locale'] : null, ) ); } elseif ( ! empty( $_GET['post'] ) ) { $post = WPCF7_ContactForm::get_instance( $_GET['post'] ); } $current_screen = get_current_screen(); $help_tabs = new WPCF7_Help_Tabs( $current_screen ); if ( $post and current_user_can( 'wpcf7_edit_contact_form', $post->id() ) ) { $help_tabs->set_help_tabs( 'edit' ); } else { $help_tabs->set_help_tabs( 'list' ); if ( ! class_exists( 'WPCF7_Contact_Form_List_Table' ) ) { require_once WPCF7_PLUGIN_DIR . '/admin/includes/class-contact-forms-list-table.php'; } add_filter( 'manage_' . $current_screen->id . '_columns', array( 'WPCF7_Contact_Form_List_Table', 'define_columns' ), 10, 0 ); add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'wpcf7_contact_forms_per_page', ) ); } } function wpcf7_admin_management_page() { if ( $post = wpcf7_get_current_contact_form() ) { $post_id = $post->initial() ? -1 : $post->id(); require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php'; require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php'; return; } if ( 'validate' == wpcf7_current_action() and wpcf7_validate_configuration() and current_user_can( 'wpcf7_edit_contact_forms' ) ) { wpcf7_admin_bulk_validate_page(); return; } $list_table = new WPCF7_Contact_Form_List_Table(); $list_table->prepare_items(); ?> <div class="wrap" id="wpcf7-contact-form-list-table"> <h1 class="wp-heading-inline"><?php echo esc_html( __( 'Contact Forms', 'contact-form-7' ) ); ?></h1> <?php if ( current_user_can( 'wpcf7_edit_contact_forms' ) ) { echo wpcf7_link( menu_page_url( 'wpcf7-new', false ), __( 'Add New', 'contact-form-7' ), array( 'class' => 'page-title-action' ) ); } if ( ! empty( $_REQUEST['s'] ) ) { echo sprintf( '<span class="subtitle">' /* translators: %s: search keywords */ . __( 'Search results for “%s”', 'contact-form-7' ) . '</span>', esc_html( $_REQUEST['s'] ) ); } ?> <hr class="wp-header-end"> <?php do_action( 'wpcf7_admin_warnings', 'wpcf7', wpcf7_current_action(), null ); wpcf7_welcome_panel(); do_action( 'wpcf7_admin_notices', 'wpcf7', wpcf7_current_action(), null ); ?> <form method="get" action=""> <input type="hidden" name="page" value="<?php echo esc_attr( $_REQUEST['page'] ); ?>" /> <?php $list_table->search_box( __( 'Search Contact Forms', 'contact-form-7' ), 'wpcf7-contact' ); ?> <?php $list_table->display(); ?> </form> </div> <?php } function wpcf7_admin_add_new_page() { $post = wpcf7_get_current_contact_form(); if ( ! $post ) { $post = WPCF7_ContactForm::get_template(); } $post_id = -1; require_once WPCF7_PLUGIN_DIR . '/admin/includes/editor.php'; require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php'; } function wpcf7_load_integration_page() { do_action( 'wpcf7_admin_load', isset( $_GET['page'] ) ? trim( $_GET['page'] ) : '', wpcf7_current_action() ); $integration = WPCF7_Integration::get_instance(); if ( isset( $_REQUEST['service'] ) and $integration->service_exists( $_REQUEST['service'] ) ) { $service = $integration->get_service( $_REQUEST['service'] ); $service->load( wpcf7_current_action() ); } $help_tabs = new WPCF7_Help_Tabs( get_current_screen() ); $help_tabs->set_help_tabs( 'integration' ); } function wpcf7_admin_integration_page() { $integration = WPCF7_Integration::get_instance(); $service = isset( $_REQUEST['service'] ) ? $integration->get_service( $_REQUEST['service'] ) : null; ?> <div class="wrap" id="wpcf7-integration"> <h1><?php echo esc_html( __( 'Integration with External API', 'contact-form-7' ) ); ?></h1> <p><?php echo sprintf( /* translators: %s: link labeled 'Integration with external APIs' */ esc_html( __( "You can expand the possibilities of your contact forms by integrating them with external services. For details, see %s.", 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/integration-with-external-apis/', 'contact-form-7' ), __( 'Integration with external APIs', 'contact-form-7' ) ) ); ?></p> <?php do_action( 'wpcf7_admin_warnings', 'wpcf7-integration', wpcf7_current_action(), $service ); do_action( 'wpcf7_admin_notices', 'wpcf7-integration', wpcf7_current_action(), $service ); if ( $service ) { $message = isset( $_REQUEST['message'] ) ? $_REQUEST['message'] : ''; $service->admin_notice( $message ); $integration->list_services( array( 'include' => $_REQUEST['service'], ) ); } else { $integration->list_services(); } ?> </div> <?php } add_action( 'wpcf7_admin_notices', 'wpcf7_admin_updated_message', 10, 3 ); function wpcf7_admin_updated_message( $page, $action, $object ) { if ( ! in_array( $page, array( 'wpcf7', 'wpcf7-new' ) ) ) { return; } if ( empty( $_REQUEST['message'] ) ) { return; } if ( 'created' == $_REQUEST['message'] ) { $updated_message = __( "Contact form created.", 'contact-form-7' ); } elseif ( 'saved' == $_REQUEST['message'] ) { $updated_message = __( "Contact form saved.", 'contact-form-7' ); } elseif ( 'deleted' == $_REQUEST['message'] ) { $updated_message = __( "Contact form deleted.", 'contact-form-7' ); } if ( ! empty( $updated_message ) ) { echo sprintf( '<div id="message" class="notice notice-success"><p>%s</p></div>', esc_html( $updated_message ) ); return; } if ( 'failed' == $_REQUEST['message'] ) { $updated_message = __( "There was an error saving the contact form.", 'contact-form-7' ); echo sprintf( '<div id="message" class="notice notice-error"><p>%s</p></div>', esc_html( $updated_message ) ); return; } if ( 'validated' == $_REQUEST['message'] ) { $bulk_validate = WPCF7::get_option( 'bulk_validate', array() ); $count_invalid = isset( $bulk_validate['count_invalid'] ) ? absint( $bulk_validate['count_invalid'] ) : 0; if ( $count_invalid ) { $updated_message = sprintf( _n( /* translators: %s: number of contact forms */ "Configuration validation completed. %s invalid contact form was found.", "Configuration validation completed. %s invalid contact forms were found.", $count_invalid, 'contact-form-7' ), number_format_i18n( $count_invalid ) ); echo sprintf( '<div id="message" class="notice notice-warning"><p>%s</p></div>', esc_html( $updated_message ) ); } else { $updated_message = __( "Configuration validation completed. No invalid contact form was found.", 'contact-form-7' ); echo sprintf( '<div id="message" class="notice notice-success"><p>%s</p></div>', esc_html( $updated_message ) ); } return; } } add_filter( 'plugin_action_links', 'wpcf7_plugin_action_links', 10, 2 ); function wpcf7_plugin_action_links( $links, $file ) { if ( $file != WPCF7_PLUGIN_BASENAME ) { return $links; } if ( ! current_user_can( 'wpcf7_read_contact_forms' ) ) { return $links; } $settings_link = wpcf7_link( menu_page_url( 'wpcf7', false ), __( 'Settings', 'contact-form-7' ) ); array_unshift( $links, $settings_link ); return $links; } add_action( 'wpcf7_admin_warnings', 'wpcf7_old_wp_version_error', 10, 3 ); function wpcf7_old_wp_version_error( $page, $action, $object ) { $wp_version = get_bloginfo( 'version' ); if ( ! version_compare( $wp_version, WPCF7_REQUIRED_WP_VERSION, '<' ) ) { return; } ?> <div class="notice notice-warning"> <p><?php echo sprintf( /* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */ __( '<strong>Contact Form 7 %1$s requires WordPress %2$s or higher.</strong> Please <a href="%3$s">update WordPress</a> first.', 'contact-form-7' ), WPCF7_VERSION, WPCF7_REQUIRED_WP_VERSION, admin_url( 'update-core.php' ) ); ?></p> </div> <?php } add_action( 'wpcf7_admin_warnings', 'wpcf7_not_allowed_to_edit', 10, 3 ); function wpcf7_not_allowed_to_edit( $page, $action, $object ) { if ( $object instanceof WPCF7_ContactForm ) { $contact_form = $object; } else { return; } if ( current_user_can( 'wpcf7_edit_contact_form', $contact_form->id() ) ) { return; } $message = __( "You are not allowed to edit this contact form.", 'contact-form-7' ); echo sprintf( '<div class="notice notice-warning"><p>%s</p></div>', esc_html( $message ) ); } add_action( 'wpcf7_admin_warnings', 'wpcf7_outdated_php_warning', 10, 3 ); function wpcf7_outdated_php_warning( $page, $action, $object ) { if ( ! version_compare( PHP_VERSION, '7.4', '<' ) ) { return; } $message = __( "The next major release of Contact Form 7 will discontinue support for outdated PHP versions. If you don't upgrade PHP, you will not be able to upgrade the plugin.", 'contact-form-7' ); echo sprintf( '<div class="notice notice-warning"><p>%s</p></div>', esc_html( $message ) ); } admin/css/styles-rtl.css 0000644 00000002075 15133152050 0011257 0 ustar 00 /* * Tabs */ #contact-form-editor-tabs { padding: 9px 10px 0 15px; } /* * Form Tab */ .tag-generator-panel { text-align: right; } .tag-generator-panel .control-box > fieldset > legend { border: 1px solid #dfdfdf; border-right: 4px solid #00a0d2; } .tag-generator-panel .insert-box input.tag { float: right; } .tag-generator-panel .insert-box .submitbox input[type="button"] { float: left; } /* * Mail Tab */ .contact-form-editor-box-mail span.mailtag { margin: 0 4px 0 0; } /* * Welcome Panel */ .wpcf7-welcome-panel .welcome-panel-close { left: 10px; right: auto; padding: 10px 21px 10px 15px; } .wpcf7-welcome-panel .welcome-panel-close::before { right: 0; left: auto; } .wpcf7-welcome-panel .welcome-panel-content { margin-right: 13px; } .wpcf7-welcome-panel .welcome-panel-column { float: right; padding: 0 0 0 2%; } /* * Integration */ .card { border-left: 1px solid #e5e5e5; border-right: 4px solid #e5e5e5; } .card img.icon { float: right; margin: 8px -8px 8px 8px; } .card h2.title { float: right; } .card .infobox { float: left; } admin/css/styles.css 0000644 00000021020 15133152050 0010447 0 ustar 00 #titlediv .inside p.description { margin: 8px 2px 0; } #titlediv .inside p.description label { cursor: pointer; } span.shortcode { display: block; margin: 2px 0; } span.shortcode.old { background: #777; color: #fff; } span.shortcode input { font-size: 12px; border: none; box-shadow: none; padding: 4px 8px; margin: 0; } #wpcf7-contact-form-list-table span.shortcode input, #wpcf7-contact-form-editor span.shortcode input { background: transparent; } #wpcf7-contact-form-list-table span.shortcode input { color: #444; } #wpcf7-contact-form-editor span.shortcode input { color: #fff; } #submitpost input.copy { margin-bottom: 10px; } #submitpost input.delete { padding: 0; margin: 0; border: none; cursor: pointer; background: inherit; color: #a00; } #submitpost input.delete:hover { color: #dc3232; /* Red */ } #submitpost input.delete:focus { outline: thin dotted; } .postbox-container .postbox h3 { border-bottom: 1px solid transparent; } .keyboard-interaction { visibility: hidden; color: #23282d; /* Dark Gray 800 */ } div.config-error, span.config-error, ul.config-error { color: #444; font-style: normal; font-size: 13px; } ul.config-error { margin: 2px 0; } ul.config-error li { list-style: none; padding: 2px 2px; margin: 0; } [data-config-field][aria-invalid="true"] { border-color: #dc3232; } #contact-form-editor-tabs li a .icon-in-circle, #contact-form-editor .config-error .icon-in-circle, .wp-list-table .config-error .icon-in-circle, .icon-in-circle { display: inline-block; vertical-align: text-top; margin: 1px 6px 0; padding: 0 5px; min-width: 7px; height: 17px; border-radius: 11px; background-color: #ca4a1f; color: #fff; font-size: 12px; font-weight: bold; line-height: 17px; text-align: center; z-index: 26; } /* * Tabs */ #contact-form-editor-tabs { border-bottom: 1px solid #aaa; padding: 9px 15px 0 10px; margin: 0; } #contact-form-editor-tabs li { display: inline-block; list-style: none; border: 1px solid #ccc; border-bottom: 1px solid #aaa; padding: 0; margin: 0 4px -1px; background-color: #e4e4e4; } #contact-form-editor-tabs li:hover { background-color: #fff; } #contact-form-editor-tabs li.ui-tabs-active, #contact-form-editor-tabs li.ui-tabs-active:hover { border-top: 1px solid #aaa; border-right: 1px solid #aaa; border-left: 1px solid #aaa; border-bottom: 1px solid #f5f5f5; background-color: #f5f5f5; } #contact-form-editor-tabs li a { padding: 6px 10px; font-size: 14px; font-weight: normal; line-height: 30px; color: #333; text-decoration: none; } #contact-form-editor-tabs li.ui-tabs-active a { color: #000; font-size: 14px; font-weight: bold; } #contact-form-editor-tabs li a:hover { color: #000; } #contact-form-editor .contact-form-editor-panel > div.config-error { margin-bottom: 1.4em; } #contact-form-editor-tabs li.ui-tabs-active a .icon-in-circle { display: none; } #contact-form-editor .contact-form-editor-panel h2 { font-size: 18px; font-weight: 400; line-height: 24px; margin: 8px 0; padding: 0; } #contact-form-editor .contact-form-editor-panel { background-color: #f5f5f5; border: 1px solid #aaa; border-top: none; padding: 16px; } #contact-form-editor .form-table th { width: 100px; } #contact-form-editor .contact-form-editor-panel fieldset legend { line-height: 1.5; margin: .6em 0 .4em; } /* * Form Tab */ #tag-generator-list a.button { font-size: 12px; height: 26px; line-height: 24px; margin: 2px; padding: 0 8px 1px; } .tag-generator-panel { height: 495px; display: flex; flex-direction: column; } .tag-generator-panel .control-box { padding: 0; margin: 0; overflow: auto; flex-grow: 1; } .tag-generator-panel .control-box > fieldset > legend { border: 1px solid #dfdfdf; border-left: 4px solid #00a0d2; background: #f7fcfe; padding: 4px 12px; margin: 4px 0; line-height: 1.4em; width: 100%; box-sizing: border-box; } .tag-generator-panel table { width: 100%; } .tag-generator-panel table.form-table th { width: 120px; padding: 4px 10px 4px 0; font-size: 13px; } .tag-generator-panel table.form-table td { padding: 4px 10px; font-size: 13px; } .tag-generator-panel .control-box input.oneline { width: 200px; } .tag-generator-panel .control-box input.large-text { width: 400px; } .tag-generator-panel .control-box textarea.values { width: 200px; height: 6em; } .tag-generator-panel .control-box input[type="number"], .tag-generator-panel .control-box input[type="date"] { width: 88px; } .tag-generator-panel .control-box table caption { text-align: left; font-size: 110%; font-weight: bold; color: #777; margin: 10px 0 5px; } .tag-generator-panel .control-box table.form-table td label { line-height: 1.1em; } .tag-generator-panel .control-box table.form-table td label .description { line-height: 1.4em; } .tag-generator-panel .insert-box { margin: 0 -15px -15px; padding: 8px 16px; background-color: #fcfcfc; border-top: 1px solid #dfdfdf; overflow: auto; } .tag-generator-panel .insert-box input.tag { width: 510px; float: left; background-color: transparent; box-shadow: none; } .tag-generator-panel .insert-box .submitbox { padding: 0; } .tag-generator-panel .insert-box .submitbox input[type="button"] { float: right; } .tag-generator-panel .insert-box .description label { cursor: text; } /* * Mail Tab */ .contact-form-editor-box-mail span.mailtag { display: inline-block; margin: 0 0 0 4px; padding: 1px 2px; cursor: pointer; color: #000; } .contact-form-editor-box-mail span.mailtag.used { color: #666; } .contact-form-editor-box-mail span.mailtag.unused { font-weight: bold; } /* * Messages Tab */ #messages-panel p.description { margin: 5px 0 10px; } /* * Tabs for integration modules */ #ctct-panel table tr.inactive ~ tr, #sendinblue-panel table tr.inactive ~ tr { display: none; } #ctct-panel .dashicons, #sendinblue-panel .dashicons { text-decoration: none; } #ctct-panel td p, #sendinblue-panel td p { margin-top: 12px; } /* * List Table */ .fixed .column-title { width: 38%; } .fixed .column-shortcode { width: 38%; } /* * Welcome Panel */ .wpcf7-welcome-panel { position: relative; overflow: auto; margin: 16px 0; padding: 23px 10px 0; border: 1px solid #c3c4c7; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); background: #fff; font-size: 13px; line-height: 1.7; } .wpcf7-welcome-panel h3 { font-size: 16px; font-weight: 600; line-height: 2.1em; margin: 1em 0 1.2em; } .wpcf7-welcome-panel h3 .dashicons { position: relative; top: -2px; display: inline-block; width: 60px; color: #575757; font-size: 40px; } .wpcf7-welcome-panel p { color: #646970; } .wpcf7-welcome-panel p a { font-weight: bold; } .wpcf7-welcome-panel .welcome-panel-close { position: absolute; z-index: 2; top: 10px; right: 10px; padding: 10px 15px 10px 21px; font-size: 13px; line-height: 1.23076923; /* Chrome rounding, needs to be 16px equivalent */ text-decoration: none; } .wpcf7-welcome-panel .welcome-panel-close::before { background: 0 0; color: #787c82; content: "\f153"; display: block; font: normal 16px/20px dashicons; speak: never; height: 20px; text-align: center; width: 20px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; position: absolute; top: 8px; left: 0; transition: all .1s ease-in-out; } .wpcf7-welcome-panel .welcome-panel-content { display: block; margin-left: 13px; max-width: 1500px; min-height: auto; } .wpcf7-welcome-panel .welcome-panel-column-container { clear: both; position: relative; } .wpcf7-welcome-panel .welcome-panel-column { display: block; width: 48%; min-width: 200px; float: left; padding: 0 2% 0 0; margin: 0 0 1em 0; } @media screen and (max-width: 870px) { .wpcf7-welcome-panel .welcome-panel-column { display: block; float: none; width: 100%; } } .wpcf7-welcome-panel .welcome-panel-column p { margin-top: 7px; color: #3c434a; } /* * Integration */ .card { background: #fff none repeat scroll 0 0; border: 1px solid #e5e5e5; border-left: 4px solid #e5e5e5; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); margin-top: 20px; max-width: 520px; min-width: 255px; padding: 0.7em 2em 1em; position: relative; } .card.active { border-color: #00a0d2; } .card img.icon { float: left; margin: 8px 8px 8px -8px; } .card h2.title { float: left; max-width: 240px; font-size: 1.3em; font-weight: 600; } .card .infobox { float: right; font-size: 13px; color: #666; margin: 1em; line-height: 1.5; max-width: 240px; } .card .inside .form-table th { padding: 15px 10px 15px 0; width: 160px; } .card .inside .form-table td { padding: 10px 10px; } .card .checkboxes li { margin: 0; } admin/js/tag-generator.js 0000644 00000013577 15133152050 0011355 0 ustar 00 ( function( $ ) { 'use strict'; if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) { return; } wpcf7.taggen = {}; $( function() { $( 'form.tag-generator-panel' ).each( function() { wpcf7.taggen.update( $( this ) ); } ); } ); $( 'form.tag-generator-panel' ).submit( function() { return false; } ); $( 'form.tag-generator-panel .control-box :input' ).change( function() { var $form = $( this ).closest( 'form.tag-generator-panel' ); wpcf7.taggen.normalize( $( this ) ); wpcf7.taggen.update( $form ); } ); $( 'input.insert-tag' ).click( function() { var $form = $( this ).closest( 'form.tag-generator-panel' ); var tag = $form.find( 'input.tag' ).val(); wpcf7.taggen.insert( tag ); tb_remove(); // close thickbox return false; } ); wpcf7.taggen.update = function( $form ) { var id = $form.attr( 'data-id' ); var name = ''; var name_fields = $form.find( 'input[name="name"]' ); if ( name_fields.length ) { name = name_fields.val(); if ( '' === name ) { name = id + '-' + Math.floor( Math.random() * 1000 ); name_fields.val( name ); } } if ( $.isFunction( wpcf7.taggen.update[ id ] ) ) { return wpcf7.taggen.update[ id ].call( this, $form ); } $form.find( 'input.tag' ).each( function() { var tag_type = $( this ).attr( 'name' ); if ( $form.find( ':input[name="tagtype"]' ).length ) { tag_type = $form.find( ':input[name="tagtype"]' ).val(); } if ( $form.find( ':input[name="required"]' ).is( ':checked' ) ) { tag_type += '*'; } var components = wpcf7.taggen.compose( tag_type, $form ); $( this ).val( components ); } ); $form.find( 'span.mail-tag' ).text( '[' + name + ']' ); $form.find( 'input.mail-tag' ).each( function() { $( this ).val( '[' + name + ']' ); } ); }; wpcf7.taggen.update.captcha = function( $form ) { var captchac = wpcf7.taggen.compose( 'captchac', $form ); var captchar = wpcf7.taggen.compose( 'captchar', $form ); $form.find( 'input.tag' ).val( captchac + ' ' + captchar ); }; wpcf7.taggen.compose = function( tagType, $form ) { var name = $form.find( 'input[name="name"]' ).val(); var scope = $form.find( '.scope.' + tagType ); if ( ! scope.length ) { scope = $form; } var options = []; scope.find( 'input.option' ).not( ':checkbox,:radio' ).each( function( i ) { var val = $( this ).val(); if ( ! val ) { return; } if ( $( this ).hasClass( 'filetype' ) ) { val = val.split( /[,|\s]+/ ).join( '|' ); } if ( $( this ).hasClass( 'color' ) ) { val = '#' + val; } if ( 'class' == $( this ).attr( 'name' ) ) { $.each( val.split( ' ' ), function( i, n ) { options.push( 'class:' + n ); } ); } else { options.push( $( this ).attr( 'name' ) + ':' + val ); } } ); scope.find( 'input:checkbox.option' ).each( function( i ) { if ( $( this ).is( ':checked' ) ) { options.push( $( this ).attr( 'name' ) ); } } ); scope.find( 'input:radio.option' ).each( function( i ) { if ( $( this ).is( ':checked' ) && ! $( this ).hasClass( 'default' ) ) { options.push( $( this ).attr( 'name' ) + ':' + $( this ).val() ); } } ); if ( 'radio' == tagType ) { options.push( 'default:1' ); } options = ( options.length > 0 ) ? options.join( ' ' ) : ''; var value = ''; if ( scope.find( ':input[name="values"]' ).val() ) { $.each( scope.find( ':input[name="values"]' ).val().split( "\n" ), function( i, n ) { value += ' "' + n.replace( /["]/g, '"' ) + '"'; } ); } var components = []; $.each( [ tagType, name, options, value ], function( i, v ) { v = $.trim( v ); if ( '' != v ) { components.push( v ); } } ); components = $.trim( components.join( ' ' ) ); components = '[' + components + ']'; var content = scope.find( ':input[name="content"]' ).val(); content = $.trim( content ); if ( content ) { components += ' ' + content + ' [/' + tagType + ']'; } return components; }; wpcf7.taggen.normalize = function( $input ) { var val = $input.val(); if ( $input.is( 'input[name="name"]' ) ) { val = val.replace( /[^0-9a-zA-Z:._-]/g, '' ).replace( /^[^a-zA-Z]+/, '' ); } if ( $input.is( '.numeric' ) ) { val = val.replace( /[^0-9.-]/g, '' ); } if ( $input.is( '.idvalue' ) ) { val = val.replace( /[^-0-9a-zA-Z_]/g, '' ); } if ( $input.is( '.classvalue' ) ) { val = $.map( val.split( ' ' ), function( n ) { return n.replace( /[^-0-9a-zA-Z_]/g, '' ); } ).join( ' ' ); val = $.trim( val.replace( /\s+/g, ' ' ) ); } if ( $input.is( '.color' ) ) { val = val.replace( /[^0-9a-fA-F]/g, '' ); } if ( $input.is( '.filesize' ) ) { val = val.replace( /[^0-9kKmMbB]/g, '' ); } if ( $input.is( '.filetype' ) ) { val = val.replace( /[^0-9a-zA-Z.,|\s]/g, '' ); } if ( $input.is( '.date' ) ) { // 'yyyy-mm-dd' ISO 8601 format if ( ! val.match( /^\d{4}-\d{2}-\d{2}$/ ) ) { val = ''; } } if ( $input.is( ':input[name="values"]' ) ) { val = $.trim( val ); } $input.val( val ); if ( $input.is( ':checkbox.exclusive' ) ) { wpcf7.taggen.exclusiveCheckbox( $input ); } }; wpcf7.taggen.exclusiveCheckbox = function( $cb ) { if ( $cb.is( ':checked' ) ) { $cb.siblings( ':checkbox.exclusive' ).prop( 'checked', false ); } }; wpcf7.taggen.insert = function( content ) { $( 'textarea#wpcf7-form' ).each( function() { this.focus(); if ( document.selection ) { // IE var selection = document.selection.createRange(); selection.text = content; } else if ( this.selectionEnd || 0 === this.selectionEnd ) { var val = $( this ).val(); var end = this.selectionEnd; $( this ).val( val.substring( 0, end ) + content + val.substring( end, val.length ) ); this.selectionStart = end + content.length; this.selectionEnd = end + content.length; } else { $( this ).val( $( this ).val() + content ); } this.focus(); } ); }; } )( jQuery ); admin/js/scripts.js 0000644 00000020212 15133152050 0010265 0 ustar 00 ( function( $ ) { 'use strict'; if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) { return; } $( function() { var welcomePanel = $( '#wpcf7-welcome-panel' ); var updateWelcomePanel; updateWelcomePanel = function( visible ) { $.post( ajaxurl, { action: 'wpcf7-update-welcome-panel', visible: visible, welcomepanelnonce: $( '#welcomepanelnonce' ).val() } ); }; $( 'a.welcome-panel-close', welcomePanel ).click( function( event ) { event.preventDefault(); welcomePanel.addClass( 'hidden' ); updateWelcomePanel( 0 ); $( '#wpcf7-welcome-panel-show' ).prop( 'checked', false ); } ); $( '#wpcf7-welcome-panel-show' ).click( function( event ) { if ( this.checked ) { welcomePanel.removeClass( 'hidden' ); updateWelcomePanel( 1 ); } else { welcomePanel.addClass( 'hidden' ); updateWelcomePanel( 0 ); } } ); $( '#contact-form-editor' ).tabs( { active: wpcf7.activeTab, activate: function( event, ui ) { $( '#active-tab' ).val( ui.newTab.index() ); } } ); $( '#contact-form-editor-tabs' ).focusin( function( event ) { $( '#contact-form-editor .keyboard-interaction' ).css( 'visibility', 'visible' ); } ).focusout( function( event ) { $( '#contact-form-editor .keyboard-interaction' ).css( 'visibility', 'hidden' ); } ); wpcf7.toggleMail2( 'input:checkbox.toggle-form-table' ); $( 'input:checkbox.toggle-form-table' ).click( function( event ) { wpcf7.toggleMail2( this ); } ); if ( '' === $( '#title' ).val() ) { $( '#title' ).focus(); } wpcf7.titleHint(); $( '.contact-form-editor-box-mail span.mailtag' ).click( function( event ) { var range = document.createRange(); range.selectNodeContents( this ); window.getSelection().addRange( range ); } ); wpcf7.updateConfigErrors(); $( '[data-config-field]' ).change( function() { var postId = $( '#post_ID' ).val(); if ( ! postId || -1 == postId ) { return; } var data = []; $( this ).closest( 'form' ).find( '[data-config-field]' ).each( function() { data.push( { 'name': $( this ).attr( 'name' ).replace( /^wpcf7-/, '' ).replace( /-/g, '_' ), 'value': $( this ).val() } ); } ); data.push( { 'name': 'context', 'value': 'dry-run' } ); $.ajax( { method: 'POST', url: wpcf7.apiSettings.getRoute( '/contact-forms/' + postId ), beforeSend: function( xhr ) { xhr.setRequestHeader( 'X-WP-Nonce', wpcf7.apiSettings.nonce ); }, data: data } ).done( function( response ) { wpcf7.configValidator.errors = response.config_errors; wpcf7.updateConfigErrors(); } ); } ); $( window ).on( 'beforeunload', function( event ) { var changed = false; $( '#wpcf7-admin-form-element :input[type!="hidden"]' ).each( function() { if ( $( this ).is( ':checkbox, :radio' ) ) { if ( this.defaultChecked != $( this ).is( ':checked' ) ) { changed = true; } } else if ( $( this ).is( 'select' ) ) { $( this ).find( 'option' ).each( function() { if ( this.defaultSelected != $( this ).is( ':selected' ) ) { changed = true; } } ); } else { if ( this.defaultValue != $( this ).val() ) { changed = true; } } } ); if ( changed ) { event.returnValue = wpcf7.saveAlert; return wpcf7.saveAlert; } } ); $( '#wpcf7-admin-form-element' ).submit( function() { if ( 'copy' != this.action.value ) { $( window ).off( 'beforeunload' ); } if ( 'save' == this.action.value ) { $( '#publishing-action .spinner' ).addClass( 'is-active' ); } } ); $( '#wpcf7-ctct-enable-contact-list, #wpcf7-sendinblue-enable-contact-list, #wpcf7-sendinblue-enable-transactional-email' ).on( 'change', function() { if ( $( this ).is( ':checked' ) ) { $( this ).closest( 'tr' ).removeClass( 'inactive' ); } else { $( this ).closest( 'tr' ).addClass( 'inactive' ); } } ); } ); wpcf7.toggleMail2 = function( checkbox ) { var $checkbox = $( checkbox ); var $fieldset = $( 'fieldset', $checkbox.closest( '.contact-form-editor-box-mail' ) ); if ( $checkbox.is( ':checked' ) ) { $fieldset.removeClass( 'hidden' ); } else { $fieldset.addClass( 'hidden' ); } }; wpcf7.updateConfigErrors = function() { var errors = wpcf7.configValidator.errors; var errorCount = { total: 0 }; $( '[data-config-field]' ).each( function() { $( this ).removeAttr( 'aria-invalid' ); $( this ).next( 'ul.config-error' ).remove(); var section = $( this ).attr( 'data-config-field' ); $( this ).attr( 'aria-describedby', 'wpcf7-config-error-for-' + section ); if ( errors[ section ] ) { var $list = $( '<ul></ul>' ).attr( { 'id': 'wpcf7-config-error-for-' + section, 'class': 'config-error' } ); $.each( errors[ section ], function( i, val ) { var $li = $( '<li></li>' ).append( wpcf7.iconInCircle( '!' ) ).append( $( '<span class="screen-reader-text"></span>' ).text( wpcf7.configValidator.iconAlt ) ).append( ' ' ); if ( val.link ) { $li.append( $( '<a></a>' ).attr( 'href', val.link ).text( val.message ) ); } else { $li.text( val.message ); } $li.appendTo( $list ); var tab = section .replace( /^mail_\d+\./, 'mail.' ).replace( /\..*$/, '' ); if ( ! errorCount[ tab ] ) { errorCount[ tab ] = 0; } errorCount[ tab ] += 1; errorCount.total += 1; } ); $( this ).after( $list ).attr( { 'aria-invalid': 'true' } ); } } ); $( '#contact-form-editor-tabs > li' ).each( function() { var $item = $( this ); $item.find( '.icon-in-circle' ).remove(); var tab = $item.attr( 'id' ).replace( /-panel-tab$/, '' ); $.each( errors, function( key, val ) { key = key.replace( /^mail_\d+\./, 'mail.' ); if ( key.replace( /\..*$/, '' ) == tab.replace( '-', '_' ) ) { var $mark = wpcf7.iconInCircle( '!' ); $item.find( 'a.ui-tabs-anchor' ).first().append( $mark ); return false; } } ); var $tabPanelError = $( '#' + tab + '-panel > div.config-error:first' ); $tabPanelError.empty(); if ( errorCount[ tab.replace( '-', '_' ) ] ) { $tabPanelError.append( wpcf7.iconInCircle( '!' ) ); if ( 1 < errorCount[ tab.replace( '-', '_' ) ] ) { var manyErrorsInTab = wpcf7.configValidator.manyErrorsInTab .replace( '%d', errorCount[ tab.replace( '-', '_' ) ] ); $tabPanelError.append( manyErrorsInTab ); } else { $tabPanelError.append( wpcf7.configValidator.oneErrorInTab ); } } } ); $( '#misc-publishing-actions .misc-pub-section.config-error' ).remove(); if ( errorCount.total ) { var $warning = $( '<div></div>' ) .addClass( 'misc-pub-section config-error' ) .append( wpcf7.iconInCircle( '!' ) ); if ( 1 < errorCount.total ) { $warning.append( wpcf7.configValidator.manyErrors.replace( '%d', errorCount.total ) ); } else { $warning.append( wpcf7.configValidator.oneError ); } $warning.append( '<br />' ).append( $( '<a></a>' ) .attr( 'href', wpcf7.configValidator.docUrl ) .text( wpcf7.configValidator.howToCorrect ) ); $( '#misc-publishing-actions' ).append( $warning ); } }; /** * Copied from wptitlehint() in wp-admin/js/post.js */ wpcf7.titleHint = function() { var $title = $( '#title' ); var $titleprompt = $( '#title-prompt-text' ); if ( '' === $title.val() ) { $titleprompt.removeClass( 'screen-reader-text' ); } $titleprompt.click( function() { $( this ).addClass( 'screen-reader-text' ); $title.focus(); } ); $title.blur( function() { if ( '' === $(this).val() ) { $titleprompt.removeClass( 'screen-reader-text' ); } } ).focus( function() { $titleprompt.addClass( 'screen-reader-text' ); } ).keydown( function( e ) { $titleprompt.addClass( 'screen-reader-text' ); $( this ).unbind( e ); } ); }; wpcf7.iconInCircle = function( icon ) { var $span = $( '<span class="icon-in-circle" aria-hidden="true"></span>' ); return $span.text( icon ); }; wpcf7.apiSettings.getRoute = function( path ) { var url = wpcf7.apiSettings.root; url = url.replace( wpcf7.apiSettings.namespace, wpcf7.apiSettings.namespace + path ); return url; }; } )( jQuery ); admin/includes/tag-generator.php 0000644 00000003447 15133152050 0012715 0 ustar 00 <?php class WPCF7_TagGenerator { private static $instance; private $panels = array(); private function __construct() {} public static function get_instance() { if ( empty( self::$instance ) ) { self::$instance = new self; } return self::$instance; } public function add( $id, $title, $callback, $options = array() ) { $id = trim( $id ); if ( '' === $id or ! wpcf7_is_name( $id ) ) { return false; } $this->panels[$id] = array( 'title' => $title, 'content' => 'tag-generator-panel-' . $id, 'options' => $options, 'callback' => $callback, ); return true; } public function print_buttons() { echo '<span id="tag-generator-list">'; foreach ( (array) $this->panels as $panel ) { echo sprintf( '<a href="#TB_inline?width=900&height=500&inlineId=%1$s" class="thickbox button" title="%2$s">%3$s</a>', esc_attr( $panel['content'] ), esc_attr( sprintf( /* translators: %s: title of form-tag like 'email' or 'checkboxes' */ __( 'Form-tag Generator: %s', 'contact-form-7' ), $panel['title'] ) ), esc_html( $panel['title'] ) ); } echo '</span>'; } public function print_panels( WPCF7_ContactForm $contact_form ) { foreach ( (array) $this->panels as $id => $panel ) { $callback = $panel['callback']; $options = wp_parse_args( $panel['options'], array() ); $options = array_merge( $options, array( 'id' => $id, 'title' => $panel['title'], 'content' => $panel['content'], ) ); if ( is_callable( $callback ) ) { echo sprintf( '<div id="%s" class="hidden">', esc_attr( $options['content'] ) ); echo sprintf( '<form action="" class="tag-generator-panel" data-id="%s">', $options['id'] ); call_user_func( $callback, $contact_form, $options ); echo '</form></div>'; } } } } admin/includes/class-contact-forms-list-table.php 0000644 00000013323 15133152050 0016070 0 ustar 00 <?php if ( ! class_exists( 'WP_List_Table' ) ) { require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); } class WPCF7_Contact_Form_List_Table extends WP_List_Table { public static function define_columns() { $columns = array( 'cb' => '<input type="checkbox" />', 'title' => __( 'Title', 'contact-form-7' ), 'shortcode' => __( 'Shortcode', 'contact-form-7' ), 'author' => __( 'Author', 'contact-form-7' ), 'date' => __( 'Date', 'contact-form-7' ), ); return $columns; } public function __construct() { parent::__construct( array( 'singular' => 'post', 'plural' => 'posts', 'ajax' => false, ) ); } public function prepare_items() { $current_screen = get_current_screen(); $per_page = $this->get_items_per_page( 'wpcf7_contact_forms_per_page' ); $args = array( 'posts_per_page' => $per_page, 'orderby' => 'title', 'order' => 'ASC', 'offset' => ( $this->get_pagenum() - 1 ) * $per_page, ); if ( ! empty( $_REQUEST['s'] ) ) { $args['s'] = $_REQUEST['s']; } if ( ! empty( $_REQUEST['orderby'] ) ) { if ( 'title' == $_REQUEST['orderby'] ) { $args['orderby'] = 'title'; } elseif ( 'author' == $_REQUEST['orderby'] ) { $args['orderby'] = 'author'; } elseif ( 'date' == $_REQUEST['orderby'] ) { $args['orderby'] = 'date'; } } if ( ! empty( $_REQUEST['order'] ) ) { if ( 'asc' == strtolower( $_REQUEST['order'] ) ) { $args['order'] = 'ASC'; } elseif ( 'desc' == strtolower( $_REQUEST['order'] ) ) { $args['order'] = 'DESC'; } } $this->items = WPCF7_ContactForm::find( $args ); $total_items = WPCF7_ContactForm::count(); $total_pages = ceil( $total_items / $per_page ); $this->set_pagination_args( array( 'total_items' => $total_items, 'total_pages' => $total_pages, 'per_page' => $per_page, ) ); } public function get_columns() { return get_column_headers( get_current_screen() ); } protected function get_sortable_columns() { $columns = array( 'title' => array( 'title', true ), 'author' => array( 'author', false ), 'date' => array( 'date', false ), ); return $columns; } protected function get_bulk_actions() { $actions = array( 'delete' => __( 'Delete', 'contact-form-7' ), ); return $actions; } protected function column_default( $item, $column_name ) { return ''; } public function column_cb( $item ) { return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item->id() ); } public function column_title( $item ) { $edit_link = add_query_arg( array( 'post' => absint( $item->id() ), 'action' => 'edit', ), menu_page_url( 'wpcf7', false ) ); $output = sprintf( '<a class="row-title" href="%1$s" aria-label="%2$s">%3$s</a>', esc_url( $edit_link ), esc_attr( sprintf( /* translators: %s: title of contact form */ __( 'Edit “%s”', 'contact-form-7' ), $item->title() ) ), esc_html( $item->title() ) ); $output = sprintf( '<strong>%s</strong>', $output ); if ( wpcf7_validate_configuration() and current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) { $config_validator = new WPCF7_ConfigValidator( $item ); $config_validator->restore(); if ( $count_errors = $config_validator->count_errors() ) { $error_notice = sprintf( _n( /* translators: %s: number of errors detected */ '%s configuration error detected', '%s configuration errors detected', $count_errors, 'contact-form-7' ), number_format_i18n( $count_errors ) ); $output .= sprintf( '<div class="config-error"><span class="icon-in-circle" aria-hidden="true">!</span> %s</div>', $error_notice ); } } return $output; } protected function handle_row_actions( $item, $column_name, $primary ) { if ( $column_name !== $primary ) { return ''; } $edit_link = add_query_arg( array( 'post' => absint( $item->id() ), 'action' => 'edit', ), menu_page_url( 'wpcf7', false ) ); $actions = array( 'edit' => wpcf7_link( $edit_link, __( 'Edit', 'contact-form-7' ) ), ); if ( current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) { $copy_link = add_query_arg( array( 'post' => absint( $item->id() ), 'action' => 'copy', ), menu_page_url( 'wpcf7', false ) ); $copy_link = wp_nonce_url( $copy_link, 'wpcf7-copy-contact-form_' . absint( $item->id() ) ); $actions = array_merge( $actions, array( 'copy' => wpcf7_link( $copy_link, __( 'Duplicate', 'contact-form-7' ) ), ) ); } return $this->row_actions( $actions ); } public function column_author( $item ) { $post = get_post( $item->id() ); if ( ! $post ) { return; } $author = get_userdata( $post->post_author ); if ( false === $author ) { return; } return esc_html( $author->display_name ); } public function column_shortcode( $item ) { $shortcodes = array( $item->shortcode() ); $output = ''; foreach ( $shortcodes as $shortcode ) { $output .= "\n" . '<span class="shortcode"><input type="text"' . ' onfocus="this.select();" readonly="readonly"' . ' value="' . esc_attr( $shortcode ) . '"' . ' class="large-text code" /></span>'; } return trim( $output ); } public function column_date( $item ) { $datetime = get_post_datetime( $item->id() ); if ( false === $datetime ) { return ''; } $t_time = sprintf( /* translators: 1: date, 2: time */ __( '%1$s at %2$s', 'contact-form-7' ), /* translators: date format, see https://www.php.net/date */ $datetime->format( __( 'Y/m/d', 'contact-form-7' ) ), /* translators: time format, see https://www.php.net/date */ $datetime->format( __( 'g:i a', 'contact-form-7' ) ) ); return $t_time; } } admin/includes/welcome-panel.php 0000644 00000021230 15133152050 0012674 0 ustar 00 <?php abstract class WPCF7_WelcomePanelColumn { abstract protected function icon(); abstract protected function title(); abstract protected function content(); public function print_content() { $icon = sprintf( '<span class="dashicons dashicons-%s" aria-hidden="true"></span>', esc_attr( $this->icon() ) ); $title = sprintf( '<h3>%1$s %2$s</h3>', $icon, $this->title() ); $content = $this->content(); if ( is_array( $content ) ) { $content = implode( "\n\n", $content ); } $content = wp_kses_post( $content ); $content = wptexturize( $content ); $content = convert_chars( $content ); $content = wpautop( $content ); echo "\n"; echo '<div class="welcome-panel-column">'; echo $title; echo $content; echo '</div>'; } } class WPCF7_WelcomePanelColumn_AntiSpam extends WPCF7_WelcomePanelColumn { protected function icon() { return 'shield'; } protected function title() { return esc_html( __( "Getting spammed? You have protection.", 'contact-form-7' ) ); } protected function content() { return array( esc_html( __( "Spammers target everything; your contact forms are not an exception. Before you get spammed, protect your contact forms with the powerful anti-spam features Contact Form 7 provides.", 'contact-form-7' ) ), sprintf( /* translators: links labeled 1: 'Akismet', 2: 'reCAPTCHA', 3: 'disallowed list' */ 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' ) ), wpcf7_link( __( 'https://contactform7.com/spam-filtering-with-akismet/', 'contact-form-7' ), __( 'Akismet', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), __( 'reCAPTCHA', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/comment-blacklist/', 'contact-form-7' ), __( 'disallowed list', 'contact-form-7' ) ) ), ); } } class WPCF7_WelcomePanelColumn_Donation extends WPCF7_WelcomePanelColumn { protected function icon() { return 'megaphone'; } protected function title() { return esc_html( __( "Contact Form 7 needs your support.", 'contact-form-7' ) ); } protected function content() { return array( esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you.", 'contact-form-7' ) ), sprintf( /* translators: %s: link labeled 'making a donation' */ esc_html( __( 'If you enjoy using Contact Form 7 and find it useful, please consider %s.', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/donate/', 'contact-form-7' ), __( 'making a donation', 'contact-form-7' ) ) ), esc_html( __( "Your donation will help encourage and support the plugin’s continued development and better user support.", 'contact-form-7' ) ), ); } } class WPCF7_WelcomePanelColumn_Flamingo extends WPCF7_WelcomePanelColumn { protected function icon() { return 'editor-help'; } protected function title() { return esc_html( __( "Before you cry over spilt mail…", 'contact-form-7' ) ); } protected function content() { return array( esc_html( __( "Contact Form 7 does not 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' ) ), sprintf( /* translators: %s: link labeled 'Flamingo' */ 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' ) ), wpcf7_link( __( 'https://contactform7.com/save-submitted-messages-with-flamingo/', 'contact-form-7' ), __( 'Flamingo', 'contact-form-7' ) ) ), ); } } class WPCF7_WelcomePanelColumn_Integration extends WPCF7_WelcomePanelColumn { protected function icon() { return 'superhero-alt'; } protected function title() { return esc_html( __( "You have strong allies to back you up.", 'contact-form-7' ) ); } protected function content() { return array( sprintf( /* translators: 1: link labeled 'Brevo', 2: link labeled 'Constant Contact' */ esc_html( __( 'Your contact forms will become more powerful and versatile by integrating them with external APIs. With CRM and email marketing services, you can build your own contact lists (%1$s and %2$s).', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/sendinblue-integration/', 'contact-form-7' ), __( 'Brevo', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/constant-contact-integration/', 'contact-form-7' ), __( 'Constant Contact', 'contact-form-7' ) ) ), sprintf( /* translators: 1: link labeled 'reCAPTCHA', 2: link labeled 'Stripe' */ esc_html( __( 'With help from cloud-based machine learning, anti-spam services will protect your forms (%1$s). Even payment services are natively supported (%2$s).', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), __( 'reCAPTCHA', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/stripe-integration/', 'contact-form-7' ), __( 'Stripe', 'contact-form-7' ) ) ), ); } } function wpcf7_welcome_panel() { $columns = array(); $flamingo_is_active = defined( 'FLAMINGO_VERSION' ); $sendinblue_is_active = false; if ( class_exists( 'WPCF7_Sendinblue' ) and $sendinblue = WPCF7_Sendinblue::get_instance() ) { $sendinblue_is_active = $sendinblue->is_active(); } if ( $flamingo_is_active and $sendinblue_is_active ) { $columns[] = new WPCF7_WelcomePanelColumn_AntiSpam(); $columns[] = new WPCF7_WelcomePanelColumn_Donation(); } elseif ( $flamingo_is_active ) { $columns[] = new WPCF7_WelcomePanelColumn_Integration(); $columns[] = new WPCF7_WelcomePanelColumn_AntiSpam(); } elseif ( $sendinblue_is_active ) { $columns[] = new WPCF7_WelcomePanelColumn_Flamingo(); $columns[] = new WPCF7_WelcomePanelColumn_AntiSpam(); } else { $columns[] = new WPCF7_WelcomePanelColumn_Flamingo(); $columns[] = new WPCF7_WelcomePanelColumn_Integration(); } $classes = 'wpcf7-welcome-panel'; $vers = (array) get_user_meta( get_current_user_id(), 'wpcf7_hide_welcome_panel_on', true ); if ( wpcf7_version_grep( wpcf7_version( 'only_major=1' ), $vers ) ) { $classes .= ' hidden'; } ?> <div id="wpcf7-welcome-panel" class="<?php echo esc_attr( $classes ); ?>"> <?php wp_nonce_field( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce', false ); ?> <a class="welcome-panel-close" href="<?php echo esc_url( menu_page_url( 'wpcf7', false ) ); ?>"><?php echo esc_html( __( 'Dismiss', 'contact-form-7' ) ); ?></a> <div class="welcome-panel-content"> <div class="welcome-panel-column-container"> <?php foreach ( $columns as $column ) { $column->print_content(); } ?> </div> </div> </div> <?php } add_action( 'wp_ajax_wpcf7-update-welcome-panel', 'wpcf7_admin_ajax_welcome_panel', 10, 0 ); function wpcf7_admin_ajax_welcome_panel() { check_ajax_referer( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce' ); $vers = get_user_meta( get_current_user_id(), 'wpcf7_hide_welcome_panel_on', true ); if ( empty( $vers ) or ! is_array( $vers ) ) { $vers = array(); } if ( empty( $_POST['visible'] ) ) { $vers[] = wpcf7_version( 'only_major=1' ); } else { $vers = array_diff( $vers, array( wpcf7_version( 'only_major=1' ) ) ); } $vers = array_unique( $vers ); update_user_meta( get_current_user_id(), 'wpcf7_hide_welcome_panel_on', $vers ); wp_die( 1 ); } add_filter( 'screen_settings', 'wpcf7_welcome_panel_screen_settings', 10, 2 ); function wpcf7_welcome_panel_screen_settings( $screen_settings, $screen ) { if ( 'toplevel_page_wpcf7' !== $screen->id ) { return $screen_settings; } $vers = (array) get_user_meta( get_current_user_id(), 'wpcf7_hide_welcome_panel_on', true ); $checkbox_id = 'wpcf7-welcome-panel-show'; $checked = ! in_array( wpcf7_version( 'only_major=1' ), $vers ); $checkbox = sprintf( '<input %s />', wpcf7_format_atts( array( 'id' => $checkbox_id, 'type' => 'checkbox', 'checked' => $checked, ) ) ); $screen_settings .= sprintf( ' <fieldset class="wpcf7-welcome-panel-options"> <legend>%1$s</legend> <label for="%2$s">%3$s %4$s</label> </fieldset>', esc_html( __( 'Welcome panel', 'contact-form-7' ) ), esc_attr( $checkbox_id ), $checkbox, esc_html( __( 'Show welcome panel', 'contact-form-7' ) ) ); return $screen_settings; } admin/includes/help-tabs.php 0000644 00000015534 15133152050 0012035 0 ustar 00 <?php class WPCF7_Help_Tabs { private $screen; public function __construct( WP_Screen $screen ) { $this->screen = $screen; } public function set_help_tabs( $screen_type ) { switch ( $screen_type ) { case 'list': $this->screen->add_help_tab( array( 'id' => 'list_overview', 'title' => __( 'Overview', 'contact-form-7' ), 'content' => $this->content( 'list_overview' ), ) ); $this->screen->add_help_tab( array( 'id' => 'list_available_actions', 'title' => __( 'Available Actions', 'contact-form-7' ), 'content' => $this->content( 'list_available_actions' ), ) ); $this->sidebar(); return; case 'edit': $this->screen->add_help_tab( array( 'id' => 'edit_overview', 'title' => __( 'Overview', 'contact-form-7' ), 'content' => $this->content( 'edit_overview' ), ) ); $this->screen->add_help_tab( array( 'id' => 'edit_form_tags', 'title' => __( 'Form-tags', 'contact-form-7' ), 'content' => $this->content( 'edit_form_tags' ), ) ); $this->screen->add_help_tab( array( 'id' => 'edit_mail_tags', 'title' => __( 'Mail-tags', 'contact-form-7' ), 'content' => $this->content( 'edit_mail_tags' ), ) ); $this->sidebar(); return; case 'integration': $this->screen->add_help_tab( array( 'id' => 'integration_overview', 'title' => __( 'Overview', 'contact-form-7' ), 'content' => $this->content( 'integration_overview' ), ) ); $this->sidebar(); return; } } private function content( $name ) { $content = array(); $content['list_overview'] = '<p>' . __( "On this screen, you can manage contact forms provided by Contact Form 7. You can manage an unlimited number of contact forms. Each contact form has a unique ID and Contact Form 7 shortcode ([contact-form-7 ...]). To insert a contact form into a post or a text widget, insert the shortcode into the target.", 'contact-form-7' ) . '</p>'; $content['list_available_actions'] = '<p>' . __( "Hovering over a row in the contact forms list will display action links that allow you to manage your contact form. You can perform the following actions:", 'contact-form-7' ) . '</p>'; $content['list_available_actions'] .= '<p>' . __( "<strong>Edit</strong> - Navigates to the editing screen for that contact form. You can also reach that screen by clicking on the contact form title.", 'contact-form-7' ) . '</p>'; $content['list_available_actions'] .= '<p>' . __( "<strong>Duplicate</strong> - Clones that contact form. A cloned contact form inherits all content from the original, but has a different ID.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] = '<p>' . __( "On this screen, you can edit a contact form. A contact form is comprised of the following components:", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Title</strong> is the title of a contact form. This title is only used for labeling a contact form, and can be edited.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Form</strong> is a content of HTML form. You can use arbitrary HTML, which is allowed inside a form element. You can also use Contact Form 7’s form-tags here.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Mail</strong> manages a mail template (headers and message body) that this contact form will send when users submit it. You can use Contact Form 7’s mail-tags here.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Mail (2)</strong> is an additional mail template that works similar to Mail. Mail (2) is different in that it is sent only when Mail has been sent successfully.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "In <strong>Messages</strong>, you can edit various types of messages used for this contact form. These messages are relatively short messages, like a validation error message you see when you leave a required field blank.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Additional Settings</strong> provides a place where you can customize the behavior of this contact form by adding code snippets.", 'contact-form-7' ) . '</p>'; $content['edit_form_tags'] = '<p>' . __( "A form-tag is a short code enclosed in square brackets used in a form content. A form-tag generally represents an input field, and its components can be separated into four parts: type, name, options, and values. Contact Form 7 supports several types of form-tags including text fields, number fields, date fields, checkboxes, radio buttons, menus, file-uploading fields, CAPTCHAs, and quiz fields.", 'contact-form-7' ) . '</p>'; $content['edit_form_tags'] .= '<p>' . __( "While form-tags have a comparatively complex syntax, you do not need to know the syntax to add form-tags because you can use the straightforward tag generator (<strong>Generate Tag</strong> button on this screen).", 'contact-form-7' ) . '</p>'; $content['edit_mail_tags'] = '<p>' . __( "A mail-tag is also a short code enclosed in square brackets that you can use in every Mail and Mail (2) field. A mail-tag represents a user input value through an input field of a corresponding form-tag.", 'contact-form-7' ) . '</p>'; $content['edit_mail_tags'] .= '<p>' . __( "There are also special mail-tags that have specific names, but do not have corresponding form-tags. They are used to represent meta information of form submissions like the submitter’s IP address or the URL of the page.", 'contact-form-7' ) . '</p>'; $content['integration_overview'] = '<p>' . __( "On this screen, you can manage services that are available through Contact Form 7. Using API will allow you to collaborate with any services that are available.", 'contact-form-7' ) . '</p>'; $content['integration_overview'] .= '<p>' . __( "You may need to first sign up for an account with the service that you plan to use. When you do so, you would need to authorize Contact Form 7 to access the service with your account.", 'contact-form-7' ) . '</p>'; $content['integration_overview'] .= '<p>' . __( "Any information you provide will not be shared with service providers without your authorization.", 'contact-form-7' ) . '</p>'; if ( ! empty( $content[$name] ) ) { return $content[$name]; } } public function sidebar() { $content = '<p><strong>' . __( 'For more information:', 'contact-form-7' ) . '</strong></p>'; $content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/docs/', 'contact-form-7' ), __( 'Docs', 'contact-form-7' ) ) . '</p>'; $content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/faq/', 'contact-form-7' ), __( 'FAQ', 'contact-form-7' ) ) . '</p>'; $content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/support/', 'contact-form-7' ), __( 'Support', 'contact-form-7' ) ) . '</p>'; $this->screen->set_help_sidebar( $content ); } } admin/includes/editor.php 0000644 00000022254 15133152050 0011441 0 ustar 00 <?php class WPCF7_Editor { private $contact_form; private $panels = array(); public function __construct( WPCF7_ContactForm $contact_form ) { $this->contact_form = $contact_form; } public function add_panel( $panel_id, $title, $callback ) { if ( wpcf7_is_name( $panel_id ) ) { $this->panels[$panel_id] = array( 'title' => $title, 'callback' => $callback, ); } } public function display() { if ( empty( $this->panels ) ) { return; } echo '<ul id="contact-form-editor-tabs">'; foreach ( $this->panels as $panel_id => $panel ) { echo sprintf( '<li id="%1$s-tab"><a href="#%1$s">%2$s</a></li>', esc_attr( $panel_id ), esc_html( $panel['title'] ) ); } echo '</ul>'; foreach ( $this->panels as $panel_id => $panel ) { echo sprintf( '<div class="contact-form-editor-panel" id="%1$s">', esc_attr( $panel_id ) ); if ( is_callable( $panel['callback'] ) ) { $this->notice( $panel_id, $panel ); call_user_func( $panel['callback'], $this->contact_form ); } echo '</div>'; } } public function notice( $panel_id, $panel ) { echo '<div class="config-error"></div>'; } } function wpcf7_editor_panel_form( $post ) { $desc_link = wpcf7_link( __( 'https://contactform7.com/editing-form-template/', 'contact-form-7' ), __( 'Editing form template', 'contact-form-7' ) ); $description = __( "You can edit the form template here. For details, see %s.", 'contact-form-7' ); $description = sprintf( esc_html( $description ), $desc_link ); ?> <h2><?php echo esc_html( __( 'Form', 'contact-form-7' ) ); ?></h2> <fieldset> <legend><?php echo $description; ?></legend> <?php $tag_generator = WPCF7_TagGenerator::get_instance(); $tag_generator->print_buttons(); ?> <textarea id="wpcf7-form" name="wpcf7-form" cols="100" rows="24" class="large-text code" data-config-field="form.body"><?php echo esc_textarea( $post->prop( 'form' ) ); ?></textarea> </fieldset> <?php } function wpcf7_editor_panel_mail( $post ) { wpcf7_editor_box_mail( $post ); echo '<br class="clear" />'; wpcf7_editor_box_mail( $post, array( 'id' => 'wpcf7-mail-2', 'name' => 'mail_2', 'title' => __( 'Mail (2)', 'contact-form-7' ), 'use' => __( 'Use Mail (2)', 'contact-form-7' ), ) ); } function wpcf7_editor_box_mail( $post, $args = '' ) { $args = wp_parse_args( $args, array( 'id' => 'wpcf7-mail', 'name' => 'mail', 'title' => __( 'Mail', 'contact-form-7' ), 'use' => null, ) ); $id = esc_attr( $args['id'] ); $mail = wp_parse_args( $post->prop( $args['name'] ), array( 'active' => false, 'recipient' => '', 'sender' => '', 'subject' => '', 'body' => '', 'additional_headers' => '', 'attachments' => '', 'use_html' => false, 'exclude_blank' => false, ) ); ?> <div class="contact-form-editor-box-mail" id="<?php echo $id; ?>"> <h2><?php echo esc_html( $args['title'] ); ?></h2> <?php if ( ! empty( $args['use'] ) ) : ?> <label for="<?php echo $id; ?>-active"><input type="checkbox" id="<?php echo $id; ?>-active" name="<?php echo $id; ?>[active]" class="toggle-form-table" value="1"<?php echo ( $mail['active'] ) ? ' checked="checked"' : ''; ?> /> <?php echo esc_html( $args['use'] ); ?></label> <p class="description"><?php echo esc_html( __( "Mail (2) is an additional mail template often used as an autoresponder.", 'contact-form-7' ) ); ?></p> <?php endif; ?> <fieldset> <legend> <?php $desc_link = wpcf7_link( __( 'https://contactform7.com/setting-up-mail/', 'contact-form-7' ), __( 'Setting up mail', 'contact-form-7' ) ); $description = __( "You can edit the mail template here. For details, see %s.", 'contact-form-7' ); $description = sprintf( esc_html( $description ), $desc_link ); echo $description; echo '<br />'; echo esc_html( __( "In the following fields, you can use these mail-tags:", 'contact-form-7' ) ); echo '<br />'; $post->suggest_mail_tags( $args['name'] ); ?> </legend> <table class="form-table"> <tbody> <tr> <th scope="row"> <label for="<?php echo $id; ?>-recipient"><?php echo esc_html( __( 'To', 'contact-form-7' ) ); ?></label> </th> <td> <input type="text" id="<?php echo $id; ?>-recipient" name="<?php echo $id; ?>[recipient]" class="large-text code" size="70" value="<?php echo esc_attr( $mail['recipient'] ); ?>" data-config-field="<?php echo sprintf( '%s.recipient', esc_attr( $args['name'] ) ); ?>" /> </td> </tr> <tr> <th scope="row"> <label for="<?php echo $id; ?>-sender"><?php echo esc_html( __( 'From', 'contact-form-7' ) ); ?></label> </th> <td> <input type="text" id="<?php echo $id; ?>-sender" name="<?php echo $id; ?>[sender]" class="large-text code" size="70" value="<?php echo esc_attr( $mail['sender'] ); ?>" data-config-field="<?php echo sprintf( '%s.sender', esc_attr( $args['name'] ) ); ?>" /> </td> </tr> <tr> <th scope="row"> <label for="<?php echo $id; ?>-subject"><?php echo esc_html( __( 'Subject', 'contact-form-7' ) ); ?></label> </th> <td> <input type="text" id="<?php echo $id; ?>-subject" name="<?php echo $id; ?>[subject]" class="large-text code" size="70" value="<?php echo esc_attr( $mail['subject'] ); ?>" data-config-field="<?php echo sprintf( '%s.subject', esc_attr( $args['name'] ) ); ?>" /> </td> </tr> <tr> <th scope="row"> <label for="<?php echo $id; ?>-additional-headers"><?php echo esc_html( __( 'Additional headers', 'contact-form-7' ) ); ?></label> </th> <td> <textarea id="<?php echo $id; ?>-additional-headers" name="<?php echo $id; ?>[additional_headers]" cols="100" rows="4" class="large-text code" data-config-field="<?php echo sprintf( '%s.additional_headers', esc_attr( $args['name'] ) ); ?>"><?php echo esc_textarea( $mail['additional_headers'] ); ?></textarea> </td> </tr> <tr> <th scope="row"> <label for="<?php echo $id; ?>-body"><?php echo esc_html( __( 'Message body', 'contact-form-7' ) ); ?></label> </th> <td> <textarea id="<?php echo $id; ?>-body" name="<?php echo $id; ?>[body]" cols="100" rows="18" class="large-text code" data-config-field="<?php echo sprintf( '%s.body', esc_attr( $args['name'] ) ); ?>"><?php echo esc_textarea( $mail['body'] ); ?></textarea> <p><label for="<?php echo $id; ?>-exclude-blank"><input type="checkbox" id="<?php echo $id; ?>-exclude-blank" name="<?php echo $id; ?>[exclude_blank]" value="1"<?php echo ( ! empty( $mail['exclude_blank'] ) ) ? ' checked="checked"' : ''; ?> /> <?php echo esc_html( __( 'Exclude lines with blank mail-tags from output', 'contact-form-7' ) ); ?></label></p> <p><label for="<?php echo $id; ?>-use-html"><input type="checkbox" id="<?php echo $id; ?>-use-html" name="<?php echo $id; ?>[use_html]" value="1"<?php echo ( $mail['use_html'] ) ? ' checked="checked"' : ''; ?> /> <?php echo esc_html( __( 'Use HTML content type', 'contact-form-7' ) ); ?></label></p> </td> </tr> <tr> <th scope="row"> <label for="<?php echo $id; ?>-attachments"><?php echo esc_html( __( 'File attachments', 'contact-form-7' ) ); ?></label> </th> <td> <textarea id="<?php echo $id; ?>-attachments" name="<?php echo $id; ?>[attachments]" cols="100" rows="4" class="large-text code" data-config-field="<?php echo sprintf( '%s.attachments', esc_attr( $args['name'] ) ); ?>"><?php echo esc_textarea( $mail['attachments'] ); ?></textarea> </td> </tr> </tbody> </table> </fieldset> </div> <?php } function wpcf7_editor_panel_messages( $post ) { $desc_link = wpcf7_link( __( 'https://contactform7.com/editing-messages/', 'contact-form-7' ), __( 'Editing messages', 'contact-form-7' ) ); $description = __( "You can edit messages used in various situations here. For details, see %s.", 'contact-form-7' ); $description = sprintf( esc_html( $description ), $desc_link ); $messages = wpcf7_messages(); if ( isset( $messages['captcha_not_match'] ) and ! wpcf7_use_really_simple_captcha() ) { unset( $messages['captcha_not_match'] ); } ?> <h2><?php echo esc_html( __( 'Messages', 'contact-form-7' ) ); ?></h2> <fieldset> <legend><?php echo $description; ?></legend> <?php foreach ( $messages as $key => $arr ) { $field_id = sprintf( 'wpcf7-message-%s', strtr( $key, '_', '-' ) ); $field_name = sprintf( 'wpcf7-messages[%s]', $key ); ?> <p class="description"> <label for="<?php echo $field_id; ?>"><?php echo esc_html( $arr['description'] ); ?><br /> <input type="text" id="<?php echo $field_id; ?>" name="<?php echo $field_name; ?>" class="large-text" size="70" value="<?php echo esc_attr( $post->message( $key, false ) ); ?>" data-config-field="<?php echo sprintf( 'messages.%s', esc_attr( $key ) ); ?>" /> </label> </p> <?php } ?> </fieldset> <?php } function wpcf7_editor_panel_additional_settings( $post ) { $desc_link = wpcf7_link( __( 'https://contactform7.com/additional-settings/', 'contact-form-7' ), __( 'Additional settings', 'contact-form-7' ) ); $description = __( "You can add customization code snippets here. For details, see %s.", 'contact-form-7' ); $description = sprintf( esc_html( $description ), $desc_link ); ?> <h2><?php echo esc_html( __( 'Additional Settings', 'contact-form-7' ) ); ?></h2> <fieldset> <legend><?php echo $description; ?></legend> <textarea id="wpcf7-additional-settings" name="wpcf7-additional-settings" cols="100" rows="8" class="large-text" data-config-field="additional_settings.body"><?php echo esc_textarea( $post->prop( 'additional_settings' ) ); ?></textarea> </fieldset> <?php } admin/includes/admin-functions.php 0000644 00000001104 15133152050 0013240 0 ustar 00 <?php function wpcf7_current_action() { if ( isset( $_REQUEST['action'] ) and -1 != $_REQUEST['action'] ) { return $_REQUEST['action']; } if ( isset( $_REQUEST['action2'] ) and -1 != $_REQUEST['action2'] ) { return $_REQUEST['action2']; } return false; } function wpcf7_admin_has_edit_cap() { return current_user_can( 'wpcf7_edit_contact_forms' ); } function wpcf7_add_tag_generator( $name, $title, $elm_id, $callback, $options = array() ) { $tag_generator = WPCF7_TagGenerator::get_instance(); return $tag_generator->add( $name, $title, $callback, $options ); } admin/includes/config-validator.php 0000644 00000006516 15133152050 0013406 0 ustar 00 <?php add_action( 'wpcf7_admin_menu', 'wpcf7_admin_init_bulk_cv', 10, 0 ); function wpcf7_admin_init_bulk_cv() { if ( ! wpcf7_validate_configuration() or ! current_user_can( 'wpcf7_edit_contact_forms' ) ) { return; } $result = WPCF7::get_option( 'bulk_validate' ); $last_important_update = WPCF7_ConfigValidator::last_important_update; if ( ! empty( $result['version'] ) and version_compare( $last_important_update, $result['version'], '<=' ) ) { return; } add_filter( 'wpcf7_admin_menu_change_notice', 'wpcf7_admin_menu_change_notice_bulk_cv', 10, 1 ); add_action( 'wpcf7_admin_warnings', 'wpcf7_admin_warnings_bulk_cv', 5, 3 ); } function wpcf7_admin_menu_change_notice_bulk_cv( $counts ) { $counts['wpcf7'] += 1; return $counts; } function wpcf7_admin_warnings_bulk_cv( $page, $action, $object ) { if ( 'wpcf7' === $page and 'validate' === $action ) { return; } $link = wpcf7_link( add_query_arg( array( 'action' => 'validate' ), menu_page_url( 'wpcf7', false ) ), __( 'Validate Contact Form 7 Configuration', 'contact-form-7' ) ); $message = __( "Misconfiguration leads to mail delivery failure or other troubles. Validate your contact forms now.", 'contact-form-7' ); echo sprintf( '<div class="notice notice-warning"><p>%1$s » %2$s</p></div>', esc_html( $message ), $link ); } add_action( 'wpcf7_admin_load', 'wpcf7_load_bulk_validate_page', 10, 2 ); function wpcf7_load_bulk_validate_page( $page, $action ) { if ( 'wpcf7' != $page or 'validate' != $action or ! wpcf7_validate_configuration() or 'POST' != $_SERVER['REQUEST_METHOD'] ) { return; } check_admin_referer( 'wpcf7-bulk-validate' ); if ( ! current_user_can( 'wpcf7_edit_contact_forms' ) ) { wp_die( __( "You are not allowed to validate configuration.", 'contact-form-7' ) ); } $contact_forms = WPCF7_ContactForm::find(); $result = array( 'timestamp' => time(), 'version' => WPCF7_VERSION, 'count_valid' => 0, 'count_invalid' => 0, ); foreach ( $contact_forms as $contact_form ) { $config_validator = new WPCF7_ConfigValidator( $contact_form ); $config_validator->validate(); $config_validator->save(); if ( $config_validator->is_valid() ) { $result['count_valid'] += 1; } else { $result['count_invalid'] += 1; } } WPCF7::update_option( 'bulk_validate', $result ); $redirect_to = add_query_arg( array( 'message' => 'validated', ), menu_page_url( 'wpcf7', false ) ); wp_safe_redirect( $redirect_to ); exit(); } function wpcf7_admin_bulk_validate_page() { $contact_forms = WPCF7_ContactForm::find(); $count = WPCF7_ContactForm::count(); $submit_text = sprintf( _n( /* translators: %s: number of contact forms */ "Validate %s contact form now", "Validate %s contact forms now", $count, 'contact-form-7' ), number_format_i18n( $count ) ); ?> <div class="wrap"> <h1><?php echo esc_html( __( 'Validate Configuration', 'contact-form-7' ) ); ?></h1> <form method="post" action=""> <input type="hidden" name="action" value="validate" /> <?php wp_nonce_field( 'wpcf7-bulk-validate' ); ?> <p><input type="submit" class="button" value="<?php echo esc_attr( $submit_text ); ?>" /></p> </form> <?php echo wpcf7_link( __( 'https://contactform7.com/configuration-validator-faq/', 'contact-form-7' ), __( 'FAQ about Configuration Validator', 'contact-form-7' ) ); ?> </div> <?php } admin/edit-contact-form.php 0000644 00000022570 15133152050 0011665 0 ustar 00 <?php // don't load directly if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } function wpcf7_admin_save_button( $post_id ) { static $button = ''; if ( ! empty( $button ) ) { echo $button; return; } $nonce = wp_create_nonce( 'wpcf7-save-contact-form_' . $post_id ); $onclick = sprintf( "this.form._wpnonce.value = '%s';" . " this.form.action.value = 'save';" . " return true;", $nonce ); $button = sprintf( '<input type="submit" class="button-primary" name="wpcf7-save" value="%1$s" onclick="%2$s" />', esc_attr( __( 'Save', 'contact-form-7' ) ), $onclick ); echo $button; } ?><div class="wrap" id="wpcf7-contact-form-editor"> <h1 class="wp-heading-inline"><?php if ( $post->initial() ) { echo esc_html( __( 'Add New Contact Form', 'contact-form-7' ) ); } else { echo esc_html( __( 'Edit Contact Form', 'contact-form-7' ) ); } ?></h1> <?php if ( ! $post->initial() and current_user_can( 'wpcf7_edit_contact_forms' ) ) { echo wpcf7_link( menu_page_url( 'wpcf7-new', false ), __( 'Add New', 'contact-form-7' ), array( 'class' => 'page-title-action' ) ); } ?> <hr class="wp-header-end"> <?php do_action( 'wpcf7_admin_warnings', $post->initial() ? 'wpcf7-new' : 'wpcf7', wpcf7_current_action(), $post ); do_action( 'wpcf7_admin_notices', $post->initial() ? 'wpcf7-new' : 'wpcf7', wpcf7_current_action(), $post ); ?> <?php if ( $post ) : if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) { $disabled = ''; } else { $disabled = ' disabled="disabled"'; } ?> <form method="post" action="<?php echo esc_url( add_query_arg( array( 'post' => $post_id ), menu_page_url( 'wpcf7', false ) ) ); ?>" id="wpcf7-admin-form-element"<?php do_action( 'wpcf7_post_edit_form_tag' ); ?>> <?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) { wp_nonce_field( 'wpcf7-save-contact-form_' . $post_id ); } ?> <input type="hidden" id="post_ID" name="post_ID" value="<?php echo (int) $post_id; ?>" /> <input type="hidden" id="wpcf7-locale" name="wpcf7-locale" value="<?php echo esc_attr( $post->locale() ); ?>" /> <input type="hidden" id="hiddenaction" name="action" value="save" /> <input type="hidden" id="active-tab" name="active-tab" value="<?php echo isset( $_GET['active-tab'] ) ? (int) $_GET['active-tab'] : '0'; ?>" /> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2"> <div id="post-body-content"> <div id="titlediv"> <div id="titlewrap"> <label class="screen-reader-text" id="title-prompt-text" for="title"><?php echo esc_html( __( 'Enter title here', 'contact-form-7' ) ); ?></label> <?php $posttitle_atts = array( 'type' => 'text', 'name' => 'post_title', 'size' => 30, 'value' => $post->initial() ? '' : $post->title(), 'id' => 'title', 'spellcheck' => 'true', 'autocomplete' => 'off', 'disabled' => ! current_user_can( 'wpcf7_edit_contact_form', $post_id ), ); echo sprintf( '<input %s />', wpcf7_format_atts( $posttitle_atts ) ); ?> </div><!-- #titlewrap --> <div class="inside"> <?php if ( ! $post->initial() ) : ?> <p class="description"> <label for="wpcf7-shortcode"><?php echo esc_html( __( "Copy this shortcode and paste it into your post, page, or text widget content:", 'contact-form-7' ) ); ?></label> <span class="shortcode wp-ui-highlight"><input type="text" id="wpcf7-shortcode" onfocus="this.select();" readonly="readonly" class="large-text code" value="<?php echo esc_attr( $post->shortcode() ); ?>" /></span> </p> <?php if ( $old_shortcode = $post->shortcode( array( 'use_old_format' => true ) ) ) : ?> <p class="description"> <label for="wpcf7-shortcode-old"><?php echo esc_html( __( "You can also use this old-style shortcode:", 'contact-form-7' ) ); ?></label> <span class="shortcode old"><input type="text" id="wpcf7-shortcode-old" onfocus="this.select();" readonly="readonly" class="large-text code" value="<?php echo esc_attr( $old_shortcode ); ?>" /></span> </p> <?php endif; endif; ?> </div> </div><!-- #titlediv --> </div><!-- #post-body-content --> <div id="postbox-container-1" class="postbox-container"> <?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) : ?> <div id="submitdiv" class="postbox"> <h3><?php echo esc_html( __( 'Status', 'contact-form-7' ) ); ?></h3> <div class="inside"> <div class="submitbox" id="submitpost"> <div id="minor-publishing-actions"> <div class="hidden"> <input type="submit" class="button-primary" name="wpcf7-save" value="<?php echo esc_attr( __( 'Save', 'contact-form-7' ) ); ?>" /> </div> <?php if ( ! $post->initial() ) : $copy_nonce = wp_create_nonce( 'wpcf7-copy-contact-form_' . $post_id ); ?> <input type="submit" name="wpcf7-copy" class="copy button" value="<?php echo esc_attr( __( 'Duplicate', 'contact-form-7' ) ); ?>" <?php echo "onclick=\"this.form._wpnonce.value = '$copy_nonce'; this.form.action.value = 'copy'; return true;\""; ?> /> <?php endif; ?> </div><!-- #minor-publishing-actions --> <div id="misc-publishing-actions"> <?php do_action( 'wpcf7_admin_misc_pub_section', $post_id ); ?> </div><!-- #misc-publishing-actions --> <div id="major-publishing-actions"> <?php if ( ! $post->initial() ) : $delete_nonce = wp_create_nonce( 'wpcf7-delete-contact-form_' . $post_id ); ?> <div id="delete-action"> <input type="submit" name="wpcf7-delete" class="delete submitdelete" value="<?php echo esc_attr( __( 'Delete', 'contact-form-7' ) ); ?>" <?php echo "onclick=\"if (confirm('" . esc_js( __( "You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.", 'contact-form-7' ) ) . "')) {this.form._wpnonce.value = '$delete_nonce'; this.form.action.value = 'delete'; return true;} return false;\""; ?> /> </div><!-- #delete-action --> <?php endif; ?> <div id="publishing-action"> <span class="spinner"></span> <?php wpcf7_admin_save_button( $post_id ); ?> </div> <div class="clear"></div> </div><!-- #major-publishing-actions --> </div><!-- #submitpost --> </div> </div><!-- #submitdiv --> <?php endif; ?> <div id="informationdiv" class="postbox"> <h3><?php echo esc_html( __( "Do you need help?", 'contact-form-7' ) ); ?></h3> <div class="inside"> <p><?php echo esc_html( __( "Here are some available options to help solve your problems.", 'contact-form-7' ) ); ?></p> <ol> <li><?php echo sprintf( /* translators: 1: FAQ, 2: Docs ("FAQ & Docs") */ __( '%1$s and %2$s', 'contact-form-7' ), wpcf7_link( __( 'https://contactform7.com/faq/', 'contact-form-7' ), __( 'FAQ', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/docs/', 'contact-form-7' ), __( 'docs', 'contact-form-7' ) ) ); ?></li> <li><?php echo wpcf7_link( __( 'https://wordpress.org/support/plugin/contact-form-7/', 'contact-form-7' ), __( 'Support forums', 'contact-form-7' ) ); ?></li> <li><?php echo wpcf7_link( __( 'https://contactform7.com/custom-development/', 'contact-form-7' ), __( 'Professional services', 'contact-form-7' ) ); ?></li> </ol> </div> </div><!-- #informationdiv --> </div><!-- #postbox-container-1 --> <div id="postbox-container-2" class="postbox-container"> <div id="contact-form-editor"> <div class="keyboard-interaction"><?php echo sprintf( /* translators: 1: ◀ ▶ dashicon, 2: screen reader text for the dashicon */ esc_html( __( '%1$s %2$s keys switch panels', 'contact-form-7' ) ), '<span class="dashicons dashicons-leftright" aria-hidden="true"></span>', sprintf( '<span class="screen-reader-text">%s</span>', /* translators: screen reader text */ esc_html( __( '(left and right arrow)', 'contact-form-7' ) ) ) ); ?></div> <?php $editor = new WPCF7_Editor( $post ); $panels = array(); if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) { $panels = array( 'form-panel' => array( 'title' => __( 'Form', 'contact-form-7' ), 'callback' => 'wpcf7_editor_panel_form', ), 'mail-panel' => array( 'title' => __( 'Mail', 'contact-form-7' ), 'callback' => 'wpcf7_editor_panel_mail', ), 'messages-panel' => array( 'title' => __( 'Messages', 'contact-form-7' ), 'callback' => 'wpcf7_editor_panel_messages', ), ); $additional_settings = $post->prop( 'additional_settings' ); if ( ! is_scalar( $additional_settings ) ) { $additional_settings = ''; } $additional_settings = trim( $additional_settings ); $additional_settings = explode( "\n", $additional_settings ); $additional_settings = array_filter( $additional_settings ); $additional_settings = count( $additional_settings ); $panels['additional-settings-panel'] = array( 'title' => $additional_settings ? sprintf( /* translators: %d: number of additional settings */ __( 'Additional Settings (%d)', 'contact-form-7' ), $additional_settings ) : __( 'Additional Settings', 'contact-form-7' ), 'callback' => 'wpcf7_editor_panel_additional_settings', ); } $panels = apply_filters( 'wpcf7_editor_panels', $panels ); foreach ( $panels as $id => $panel ) { $editor->add_panel( $id, $panel['title'], $panel['callback'] ); } $editor->display(); ?> </div><!-- #contact-form-editor --> <?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) : ?> <p class="submit"><?php wpcf7_admin_save_button( $post_id ); ?></p> <?php endif; ?> </div><!-- #postbox-container-2 --> </div><!-- #post-body --> <br class="clear" /> </div><!-- #poststuff --> </form> <?php endif; ?> </div><!-- .wrap --> <?php $tag_generator = WPCF7_TagGenerator::get_instance(); $tag_generator->print_panels( $post ); do_action( 'wpcf7_admin_footer', $post ); uninstall.php 0000644 00000000767 15133152050 0007273 0 ustar 00 <?php if ( ! defined( 'WP_UNINSTALL_PLUGIN' ) ) { exit(); } function wpcf7_delete_plugin() { global $wpdb; delete_option( 'wpcf7' ); $posts = get_posts( array( 'numberposts' => -1, 'post_type' => 'wpcf7_contact_form', 'post_status' => 'any', ) ); foreach ( $posts as $post ) { wp_delete_post( $post->ID, true ); } $wpdb->query( sprintf( "DROP TABLE IF EXISTS %s", $wpdb->prefix . 'contact_form_7' ) ); } if ( ! defined( 'WPCF7_VERSION' ) ) { wpcf7_delete_plugin(); } languages/readme.txt 0000644 00000000200 15133152050 0010473 0 ustar 00 Translations have moved to https://translate.wordpress.org/projects/wp-plugins/contact-form-7 Thank you for your contribution. license.txt 0000644 00000045313 15133152050 0006730 0 ustar 00 Contact Form 7 WordPress Plugin, 2007-2023 Takayuki Miyoshi Contact Form 7 is distributed under the terms of the GNU GPL This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Contact Form 7 WordPress Plugin bundles the following third-party resources: The official icon designed by Cheung Vong https://contactform7.com/2020/04/08/new-official-logo/ =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Lesser General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. <signature of Ty Coon>, 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. load.php 0000644 00000013130 15133152050 0006165 0 ustar 00 <?php require_once WPCF7_PLUGIN_DIR . '/includes/l10n.php'; require_once WPCF7_PLUGIN_DIR . '/includes/capabilities.php'; require_once WPCF7_PLUGIN_DIR . '/includes/functions.php'; require_once WPCF7_PLUGIN_DIR . '/includes/formatting.php'; require_once WPCF7_PLUGIN_DIR . '/includes/pipe.php'; require_once WPCF7_PLUGIN_DIR . '/includes/pocket-holder.php'; require_once WPCF7_PLUGIN_DIR . '/includes/form-tag.php'; require_once WPCF7_PLUGIN_DIR . '/includes/form-tags-manager.php'; require_once WPCF7_PLUGIN_DIR . '/includes/shortcodes.php'; require_once WPCF7_PLUGIN_DIR . '/includes/swv/swv.php'; require_once WPCF7_PLUGIN_DIR . '/includes/contact-form-functions.php'; require_once WPCF7_PLUGIN_DIR . '/includes/contact-form-template.php'; require_once WPCF7_PLUGIN_DIR . '/includes/contact-form.php'; require_once WPCF7_PLUGIN_DIR . '/includes/mail.php'; require_once WPCF7_PLUGIN_DIR . '/includes/special-mail-tags.php'; require_once WPCF7_PLUGIN_DIR . '/includes/file.php'; require_once WPCF7_PLUGIN_DIR . '/includes/validation-functions.php'; require_once WPCF7_PLUGIN_DIR . '/includes/validation.php'; require_once WPCF7_PLUGIN_DIR . '/includes/submission.php'; require_once WPCF7_PLUGIN_DIR . '/includes/upgrade.php'; require_once WPCF7_PLUGIN_DIR . '/includes/integration.php'; require_once WPCF7_PLUGIN_DIR . '/includes/config-validator.php'; require_once WPCF7_PLUGIN_DIR . '/includes/rest-api.php'; require_once WPCF7_PLUGIN_DIR . '/includes/block-editor/block-editor.php'; require_once WPCF7_PLUGIN_DIR . '/includes/html-formatter.php'; if ( is_admin() ) { require_once WPCF7_PLUGIN_DIR . '/admin/admin.php'; } else { require_once WPCF7_PLUGIN_DIR . '/includes/controller.php'; } class WPCF7 { /** * Loads modules from the modules directory. */ public static function load_modules() { self::load_module( 'acceptance' ); self::load_module( 'akismet' ); self::load_module( 'checkbox' ); self::load_module( 'constant-contact' ); self::load_module( 'count' ); self::load_module( 'date' ); self::load_module( 'disallowed-list' ); self::load_module( 'doi-helper' ); self::load_module( 'file' ); self::load_module( 'flamingo' ); self::load_module( 'hidden' ); self::load_module( 'listo' ); self::load_module( 'number' ); self::load_module( 'quiz' ); self::load_module( 'really-simple-captcha' ); self::load_module( 'recaptcha' ); self::load_module( 'reflection' ); self::load_module( 'response' ); self::load_module( 'select' ); self::load_module( 'sendinblue' ); self::load_module( 'stripe' ); self::load_module( 'submit' ); self::load_module( 'text' ); self::load_module( 'textarea' ); } /** * Loads the specified module. * * @param string $mod Name of module. * @return bool True on success, false on failure. */ protected static function load_module( $mod ) { return false || wpcf7_include_module_file( $mod . '/' . $mod . '.php' ) || wpcf7_include_module_file( $mod . '.php' ); } /** * Retrieves a named entry from the option array of Contact Form 7. * * @param string $name Array item key. * @param mixed $default_value Optional. Default value to return if the entry * does not exist. Default false. * @return mixed Array value tied to the $name key. If nothing found, * the $default_value value will be returned. */ public static function get_option( $name, $default_value = false ) { $option = get_option( 'wpcf7' ); if ( false === $option ) { return $default_value; } if ( isset( $option[$name] ) ) { return $option[$name]; } else { return $default_value; } } /** * Update an entry value on the option array of Contact Form 7. * * @param string $name Array item key. * @param mixed $value Option value. */ public static function update_option( $name, $value ) { $option = get_option( 'wpcf7' ); $option = ( false === $option ) ? array() : (array) $option; $option = array_merge( $option, array( $name => $value ) ); update_option( 'wpcf7', $option ); } } add_action( 'plugins_loaded', 'wpcf7', 10, 0 ); /** * Loads modules and registers WordPress shortcodes. */ function wpcf7() { WPCF7::load_modules(); add_shortcode( 'contact-form-7', 'wpcf7_contact_form_tag_func' ); add_shortcode( 'contact-form', 'wpcf7_contact_form_tag_func' ); } add_action( 'init', 'wpcf7_init', 10, 0 ); /** * Registers post types for contact forms. */ function wpcf7_init() { wpcf7_get_request_uri(); wpcf7_register_post_types(); do_action( 'wpcf7_init' ); } add_action( 'admin_init', 'wpcf7_upgrade', 10, 0 ); /** * Upgrades option data when necessary. */ function wpcf7_upgrade() { $old_ver = WPCF7::get_option( 'version', '0' ); $new_ver = WPCF7_VERSION; if ( $old_ver == $new_ver ) { return; } do_action( 'wpcf7_upgrade', $new_ver, $old_ver ); WPCF7::update_option( 'version', $new_ver ); } add_action( 'activate_' . WPCF7_PLUGIN_BASENAME, 'wpcf7_install', 10, 0 ); /** * Callback tied to plugin activation action hook. Attempts to create * initial user dataset. */ function wpcf7_install() { if ( $opt = get_option( 'wpcf7' ) ) { return; } wpcf7_register_post_types(); wpcf7_upgrade(); if ( get_posts( array( 'post_type' => 'wpcf7_contact_form' ) ) ) { return; } $contact_form = WPCF7_ContactForm::get_template( array( 'title' => /* translators: title of your first contact form. %d: number fixed to '1' */ sprintf( __( 'Contact form %d', 'contact-form-7' ), 1 ), ) ); $contact_form->save(); WPCF7::update_option( 'bulk_validate', array( 'timestamp' => time(), 'version' => WPCF7_VERSION, 'count_valid' => 1, 'count_invalid' => 0, ) ); } readme.txt 0000644 00000012225 15133152050 0006537 0 ustar 00 === Contact Form 7 === Contributors: takayukister Donate link: https://contactform7.com/donate/ Tags: contact, form, contact form, feedback, email, ajax, captcha, akismet, multilingual Requires at least: 6.0 Tested up to: 6.2 Stable tag: 5.7.7 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Just another contact form plugin. Simple but flexible. == Description == Contact Form 7 can manage multiple contact forms, plus you can customize the form and the mail contents flexibly with simple markup. The form supports Ajax-powered submitting, CAPTCHA, Akismet spam filtering and so on. = Docs and support = You can find [docs](https://contactform7.com/docs/), [FAQ](https://contactform7.com/faq/) and more detailed information about Contact Form 7 on [contactform7.com](https://contactform7.com/). When you cannot find the answer to your question on the FAQ or in any of the documentation, check the [support forum](https://wordpress.org/support/plugin/contact-form-7/) on WordPress.org. If you cannot locate any topics that pertain to your particular issue, post a new topic for it. = Contact Form 7 needs your support = It is hard to continue development and support for this free plugin without contributions from users like you. If you enjoy using Contact Form 7 and find it useful, please consider [making a donation](https://contactform7.com/donate/). Your donation will help encourage and support the plugin's continued development and better user support. = Privacy notices = With the default configuration, this plugin, in itself, does not: * track users by stealth; * write any user personal data to the database; * send any data to external servers; * use cookies. If you activate certain features in this plugin, the contact form submitter's personal data, including their IP address, may be sent to the service provider. Thus, confirming the provider's privacy policy is recommended. These features include: * reCAPTCHA ([Google](https://policies.google.com/?hl=en)) * Akismet ([Automattic](https://automattic.com/privacy/)) * Constant Contact ([Endurance International Group](https://www.endurance.com/privacy)) * [Brevo (formerly Sendinblue)](https://www.brevo.com/legal/privacypolicy/) * [Stripe](https://stripe.com/privacy) = Recommended plugins = The following plugins are recommended for Contact Form 7 users: * [Flamingo](https://wordpress.org/plugins/flamingo/) by Takayuki Miyoshi - With Flamingo, you can save submitted messages via contact forms in the database. * [Bogo](https://wordpress.org/plugins/bogo/) by Takayuki Miyoshi - Bogo is a straight-forward multilingual plugin that does not cause headaches. = Translations = You can [translate Contact Form 7](https://contactform7.com/translating-contact-form-7/) on [translate.wordpress.org](https://translate.wordpress.org/projects/wp-plugins/contact-form-7). == Installation == 1. Upload the entire `contact-form-7` folder to the `/wp-content/plugins/` directory. 1. Activate the plugin through the **Plugins** screen (**Plugins > Installed Plugins**). You will find **Contact** menu in your WordPress admin screen. For basic usage, have a look at the [plugin's website](https://contactform7.com/). == Frequently Asked Questions == Do you have questions or issues with Contact Form 7? Use these support channels appropriately. 1. [Docs](https://contactform7.com/docs/) 1. [FAQ](https://contactform7.com/faq/) 1. [Support forum](https://wordpress.org/support/plugin/contact-form-7/) [Support](https://contactform7.com/support/) == Screenshots == 1. screenshot-1.png == Changelog == For more information, see [Releases](https://contactform7.com/category/releases/). = 5.7.7 = [https://contactform7.com/contact-form-7-577/](https://contactform7.com/contact-form-7-577/) = 5.7.6 = [https://contactform7.com/contact-form-7-576/](https://contactform7.com/contact-form-7-576/) = 5.7.5.1 = * Fixes an old PHP compatibility issue. = 5.7.5 = [https://contactform7.com/contact-form-7-575/](https://contactform7.com/contact-form-7-575/) = 5.7.4 = [https://contactform7.com/contact-form-7-574/](https://contactform7.com/contact-form-7-574/) = 5.7.3 = [https://contactform7.com/contact-form-7-573/](https://contactform7.com/contact-form-7-573/) = 5.7.2 = [https://contactform7.com/contact-form-7-572/](https://contactform7.com/contact-form-7-572/) = 5.7.1 = [https://contactform7.com/contact-form-7-571/](https://contactform7.com/contact-form-7-571/) = 5.7 = [https://contactform7.com/contact-form-7-57/](https://contactform7.com/contact-form-7-57/) = 5.6.4 = [https://contactform7.com/contact-form-7-564/](https://contactform7.com/contact-form-7-564/) = 5.6.3 = [https://contactform7.com/contact-form-7-563/](https://contactform7.com/contact-form-7-563/) = 5.6.2 = [https://contactform7.com/contact-form-7-562/](https://contactform7.com/contact-form-7-562/) = 5.6.1 = [https://contactform7.com/contact-form-7-561/](https://contactform7.com/contact-form-7-561/) = 5.6 = [https://contactform7.com/contact-form-7-56/](https://contactform7.com/contact-form-7-56/) == Upgrade Notice == includes/form-tags-manager.php 0000644 00000034354 15133152050 0012376 0 ustar 00 <?php /** * Wrapper function of WPCF7_FormTagsManager::add(). */ function wpcf7_add_form_tag( $tag_types, $callback, $features = '' ) { $manager = WPCF7_FormTagsManager::get_instance(); return $manager->add( $tag_types, $callback, $features ); } /** * Wrapper function of WPCF7_FormTagsManager::remove(). */ function wpcf7_remove_form_tag( $tag_type ) { $manager = WPCF7_FormTagsManager::get_instance(); return $manager->remove( $tag_type ); } /** * Wrapper function of WPCF7_FormTagsManager::replace_all(). */ function wpcf7_replace_all_form_tags( $content ) { $manager = WPCF7_FormTagsManager::get_instance(); return $manager->replace_all( $content ); } /** * Wrapper function of WPCF7_ContactForm::scan_form_tags(). */ function wpcf7_scan_form_tags( $cond = null ) { $contact_form = WPCF7_ContactForm::get_current(); if ( $contact_form ) { return $contact_form->scan_form_tags( $cond ); } return array(); } /** * Wrapper function of WPCF7_FormTagsManager::tag_type_supports(). */ function wpcf7_form_tag_supports( $tag_type, $feature ) { $manager = WPCF7_FormTagsManager::get_instance(); return $manager->tag_type_supports( $tag_type, $feature ); } /** * The singleton instance of this class manages the collection of form-tags. */ class WPCF7_FormTagsManager { private static $instance; private $tag_types = array(); private $scanned_tags = null; // Tags scanned at the last time of scan() private $placeholders = array(); private function __construct() {} /** * Returns the singleton instance. * * @return WPCF7_FormTagsManager The singleton manager. */ public static function get_instance() { if ( empty( self::$instance ) ) { self::$instance = new self; } return self::$instance; } /** * Returns scanned form-tags. * * @return array Array of WPCF7_FormTag objects. */ public function get_scanned_tags() { return $this->scanned_tags; } /** * Registers form-tag types to the manager. * * @param string|array $tag_types The name of the form-tag type or * an array of the names. * @param callable $callback The callback to generates a form control HTML * for a form-tag in this type. * @param string|array $features Optional. Features a form-tag * in this type supports. */ public function add( $tag_types, $callback, $features = '' ) { if ( ! is_callable( $callback ) ) { return; } if ( true === $features ) { // for back-compat $features = array( 'name-attr' => true ); } $features = wp_parse_args( $features, array() ); $tag_types = array_filter( array_unique( (array) $tag_types ) ); foreach ( $tag_types as $tag_type ) { $tag_type = $this->sanitize_tag_type( $tag_type ); if ( ! $this->tag_type_exists( $tag_type ) ) { $this->tag_types[$tag_type] = array( 'function' => $callback, 'features' => $features, ); } } } /** * Returns true if the given tag type exists. */ public function tag_type_exists( $tag_type ) { return isset( $this->tag_types[$tag_type] ); } /** * Returns true if the tag type supports the features. * * @param string $tag_type The name of the form-tag type. * @param array|string $features The feature to check or an array of features. * @return bool True if the form-tag type supports at least one of * the given features, false otherwise. */ public function tag_type_supports( $tag_type, $features ) { $features = array_filter( (array) $features ); if ( isset( $this->tag_types[$tag_type]['features'] ) ) { return (bool) array_intersect( array_keys( array_filter( $this->tag_types[$tag_type]['features'] ) ), $features ); } return false; } /** * Returns form-tag types that support the given features. * * @param array|string $features Optional. The feature to check or * an array of features. Default empty array. * @param bool $invert Optional. If this value is true, returns form-tag * types that do not support the given features. Default false. * @return array An array of form-tag types. If the $features param is empty, * returns all form-tag types that have been registered. */ public function collect_tag_types( $features = array(), $invert = false ) { $tag_types = array_keys( $this->tag_types ); if ( empty( $features ) ) { return $tag_types; } $output = array(); foreach ( $tag_types as $tag_type ) { if ( ! $invert && $this->tag_type_supports( $tag_type, $features ) || $invert && ! $this->tag_type_supports( $tag_type, $features ) ) { $output[] = $tag_type; } } return $output; } /** * Sanitizes the form-tag type name. */ private function sanitize_tag_type( $tag_type ) { $tag_type = preg_replace( '/[^a-zA-Z0-9_*]+/', '_', $tag_type ); $tag_type = rtrim( $tag_type, '_' ); $tag_type = strtolower( $tag_type ); return $tag_type; } /** * Deregisters the form-tag type. */ public function remove( $tag_type ) { unset( $this->tag_types[$tag_type] ); } /** * Normalizes the text content that includes form-tags. */ public function normalize( $content ) { if ( empty( $this->tag_types ) ) { return $content; } $content = preg_replace_callback( '/' . $this->tag_regex() . '/s', array( $this, 'normalize_callback' ), $content ); return $content; } /** * The callback function used within normalize(). */ private function normalize_callback( $matches ) { // allow [[foo]] syntax for escaping a tag if ( $matches[1] == '[' and $matches[6] == ']' ) { return $matches[0]; } $tag = $matches[2]; $attr = trim( preg_replace( '/[\r\n\t ]+/', ' ', $matches[3] ) ); $attr = strtr( $attr, array( '<' => '<', '>' => '>' ) ); $content = trim( $matches[5] ); $content = str_replace( "\n", '<WPPreserveNewline />', $content ); $result = $matches[1] . '[' . $tag . ( $attr ? ' ' . $attr : '' ) . ( $matches[4] ? ' ' . $matches[4] : '' ) . ']' . ( $content ? $content . '[/' . $tag . ']' : '' ) . $matches[6]; return $result; } /** * Replace all form-tags in the given text with placeholders. */ public function replace_with_placeholders( $content ) { if ( empty( $this->tag_types ) ) { return $content; } $this->placeholders = array(); $callback = function ( $matches ) { // Allow [[foo]] syntax for escaping a tag. if ( '[' === $matches[1] and ']' === $matches[6] ) { return $matches[0]; } $tag = $matches[0]; $tag_type = $matches[2]; $block_or_hidden = $this->tag_type_supports( $tag_type, array( 'display-block', 'display-hidden' ) ); if ( $block_or_hidden ) { $placeholder_tag_name = WPCF7_HTMLFormatter::placeholder_block; } else { $placeholder_tag_name = WPCF7_HTMLFormatter::placeholder_inline; } $placeholder = sprintf( '<%1$s id="%2$s" />', $placeholder_tag_name, sha1( $tag ) ); list( $placeholder ) = WPCF7_HTMLFormatter::normalize_start_tag( $placeholder ); $this->placeholders[$placeholder] = $tag; return $placeholder; }; return preg_replace_callback( '/' . $this->tag_regex() . '/s', $callback, $content ); } /** * Replace placeholders in the given text with original form-tags. */ public function restore_from_placeholders( $content ) { return str_replace( array_keys( $this->placeholders ), array_values( $this->placeholders ), $content ); } /** * Replaces all form-tags in the text content. * * @param string $content The text content including form-tags. * @return string The result of replacements. */ public function replace_all( $content ) { return $this->scan( $content, true ); } /** * Scans form-tags in the text content. * * @param string $content The text content including form-tags. * @param bool $replace Optional. Whether scanned form-tags will be * replaced. Default false. * @return array|string An array of scanned form-tags if $replace is false. * Otherwise text that scanned form-tags are replaced. */ public function scan( $content, $replace = false ) { $this->scanned_tags = array(); if ( empty( $this->tag_types ) ) { if ( $replace ) { return $content; } else { return $this->scanned_tags; } } if ( $replace ) { $content = preg_replace_callback( '/' . $this->tag_regex() . '/s', array( $this, 'replace_callback' ), $content ); return $content; } else { preg_replace_callback( '/' . $this->tag_regex() . '/s', array( $this, 'scan_callback' ), $content ); return $this->scanned_tags; } } /** * Filters form-tags based on a condition array argument. * * @param array|string $input The original form-tags collection. * If it is a string, scans form-tags from it. * @param array $cond The conditions that filtering will be based on. * @return array The filtered form-tags collection. */ public function filter( $input, $cond ) { if ( is_array( $input ) ) { $tags = $input; } elseif ( is_string( $input ) ) { $tags = $this->scan( $input ); } else { $tags = $this->scanned_tags; } $cond = wp_parse_args( $cond, array( 'type' => array(), 'basetype' => array(), 'name' => array(), 'feature' => array(), ) ); $cond = array_map( static function ( $c ) { return array_filter( array_map( 'trim', (array) $c ) ); }, $cond ); $tags = array_filter( (array) $tags, function ( $tag ) use ( $cond ) { $tag = new WPCF7_FormTag( $tag ); if ( $cond['type'] and ! in_array( $tag->type, $cond['type'], true ) ) { return false; } if ( $cond['basetype'] and ! in_array( $tag->basetype, $cond['basetype'], true ) ) { return false; } if ( $cond['name'] and ! in_array( $tag->name, $cond['name'], true ) ) { return false; } foreach ( $cond['feature'] as $feature ) { if ( '!' === substr( $feature, 0, 1 ) ) { // Negation $feature = trim( substr( $feature, 1 ) ); if ( $this->tag_type_supports( $tag->type, $feature ) ) { return false; } } else { if ( ! $this->tag_type_supports( $tag->type, $feature ) ) { return false; } } } return true; } ); return array_values( $tags ); } /** * Returns the regular expression for a form-tag. */ private function tag_regex() { $tagnames = array_keys( $this->tag_types ); $tagregexp = implode( '|', array_map( 'preg_quote', $tagnames ) ); return '(\[?)' . '\[(' . $tagregexp . ')(?:[\r\n\t ](.*?))?(?:[\r\n\t ](\/))?\]' . '(?:([^[]*?)\[\/\2\])?' . '(\]?)'; } /** * The callback function for the form-tag replacement. */ private function replace_callback( $matches ) { return $this->scan_callback( $matches, true ); } /** * The callback function for the form-tag scanning. */ private function scan_callback( $matches, $replace = false ) { // allow [[foo]] syntax for escaping a tag if ( $matches[1] == '[' and $matches[6] == ']' ) { return substr( $matches[0], 1, -1 ); } $tag_type = $matches[2]; $tag_basetype = trim( $tag_type, '*' ); $attr = $this->parse_atts( $matches[3] ); $scanned_tag = array( 'type' => $tag_type, 'basetype' => $tag_basetype, 'raw_name' => '', 'name' => '', 'options' => array(), 'raw_values' => array(), 'values' => array(), 'pipes' => null, 'labels' => array(), 'attr' => '', 'content' => '', ); if ( $this->tag_type_supports( $tag_type, 'singular' ) ) { $tags_in_same_basetype = $this->filter( $this->scanned_tags, array( 'basetype' => $tag_basetype ) ); if ( $tags_in_same_basetype ) { // Another tag in the same base type already exists. Ignore this one. return $matches[0]; } } if ( $this->tag_type_supports( $tag_type, 'name-attr' ) ) { if ( ! is_array( $attr ) ) { return $matches[0]; // Invalid form-tag. } $scanned_tag['raw_name'] = (string) array_shift( $attr['options'] ); if ( ! wpcf7_is_name( $scanned_tag['raw_name'] ) ) { return $matches[0]; // Invalid name is used. Ignore this tag. } $scanned_tag['name'] = strtr( $scanned_tag['raw_name'], '.', '_' ); } if ( is_array( $attr ) ) { $scanned_tag['options'] = (array) $attr['options']; $scanned_tag['raw_values'] = (array) $attr['values']; if ( WPCF7_USE_PIPE ) { $pipes = new WPCF7_Pipes( $scanned_tag['raw_values'] ); $scanned_tag['values'] = $pipes->collect_befores(); $scanned_tag['pipes'] = $pipes; } else { $scanned_tag['values'] = $scanned_tag['raw_values']; } $scanned_tag['labels'] = $scanned_tag['values']; } else { $scanned_tag['attr'] = $attr; } $scanned_tag['values'] = array_map( 'trim', $scanned_tag['values'] ); $scanned_tag['labels'] = array_map( 'trim', $scanned_tag['labels'] ); $content = trim( $matches[5] ); $content = preg_replace( "/<br[\r\n\t ]*\/?>$/m", '', $content ); $scanned_tag['content'] = $content; $scanned_tag = apply_filters( 'wpcf7_form_tag', $scanned_tag, $replace ); $scanned_tag = new WPCF7_FormTag( $scanned_tag ); $this->scanned_tags[] = $scanned_tag; if ( $replace ) { $callback = $this->tag_types[$tag_type]['function']; return $matches[1] . call_user_func( $callback, $scanned_tag ) . $matches[6]; } else { return $matches[0]; } } /** * Parses the attributes of a form-tag to extract the name, * options, and values. * * @param string $text Attributes of a form-tag. * @return array|string An associative array of the options and values * if the input is in the correct syntax, * otherwise the input text itself. */ private function parse_atts( $text ) { $atts = array( 'options' => array(), 'values' => array() ); $text = preg_replace( "/[\x{00a0}\x{200b}]+/u", " ", $text ); $text = trim( $text ); $pattern = '%^([-+*=0-9a-zA-Z:.!?#$&@_/|\%\r\n\t ]*?)((?:[\r\n\t ]*"[^"]*"|[\r\n\t ]*\'[^\']*\')*)$%'; if ( preg_match( $pattern, $text, $matches ) ) { if ( ! empty( $matches[1] ) ) { $atts['options'] = preg_split( '/[\r\n\t ]+/', trim( $matches[1] ) ); } if ( ! empty( $matches[2] ) ) { preg_match_all( '/"[^"]*"|\'[^\']*\'/', $matches[2], $matched_values ); $atts['values'] = wpcf7_strip_quote_deep( $matched_values[0] ); } } else { $atts = $text; } return $atts; } } includes/upgrade.php 0000644 00000004062 15133152050 0010507 0 ustar 00 <?php add_action( 'wpcf7_upgrade', 'wpcf7_convert_to_cpt', 10, 2 ); function wpcf7_convert_to_cpt( $new_ver, $old_ver ) { global $wpdb; if ( ! version_compare( $old_ver, '3.0-dev', '<' ) ) { return; } $old_rows = array(); $table_name = $wpdb->prefix . "contact_form_7"; if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) ) { $old_rows = $wpdb->get_results( "SELECT * FROM $table_name" ); } elseif ( $opt = get_option( 'wpcf7' ) and ! empty( $opt['contact_forms'] ) ) { foreach ( (array) $opt['contact_forms'] as $key => $value ) { $old_rows[] = (object) array_merge( $value, array( 'cf7_unit_id' => $key ) ); } } foreach ( (array) $old_rows as $row ) { $q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'" . $wpdb->prepare( " AND meta_value = %d", $row->cf7_unit_id ); if ( $wpdb->get_var( $q ) ) { continue; } $postarr = array( 'post_type' => 'wpcf7_contact_form', 'post_status' => 'publish', 'post_title' => maybe_unserialize( $row->title ), ); $post_id = wp_insert_post( $postarr ); if ( $post_id ) { update_post_meta( $post_id, '_old_cf7_unit_id', $row->cf7_unit_id ); $metas = array( 'form', 'mail', 'mail_2', 'messages', 'additional_settings' ); foreach ( $metas as $meta ) { update_post_meta( $post_id, '_' . $meta, wpcf7_normalize_newline_deep( maybe_unserialize( $row->{$meta} ) ) ); } } } } add_action( 'wpcf7_upgrade', 'wpcf7_prepend_underscore', 10, 2 ); function wpcf7_prepend_underscore( $new_ver, $old_ver ) { if ( version_compare( $old_ver, '3.0-dev', '<' ) ) { return; } if ( ! version_compare( $old_ver, '3.3-dev', '<' ) ) { return; } $posts = WPCF7_ContactForm::find( array( 'post_status' => 'any', 'posts_per_page' => -1, ) ); foreach ( $posts as $post ) { $props = $post->get_properties(); foreach ( $props as $prop => $value ) { if ( metadata_exists( 'post', $post->id(), '_' . $prop ) ) { continue; } update_post_meta( $post->id(), '_' . $prop, $value ); delete_post_meta( $post->id(), $prop ); } } } includes/file.php 0000644 00000024204 15133152050 0007777 0 ustar 00 <?php /** * Validates uploaded files and moves them to the temporary directory. * * @param array $file An item of `$_FILES`. * @param string|array $args Optional. Arguments to control behavior. * @return array|WP_Error Array of file paths, or WP_Error if validation fails. */ function wpcf7_unship_uploaded_file( $file, $args = '' ) { $args = wp_parse_args( $args, array( 'required' => false, 'filetypes' => '', 'limit' => MB_IN_BYTES, ) ); foreach ( array( 'name', 'size', 'tmp_name', 'error' ) as $key ) { if ( ! isset( $file[$key] ) ) { $file[$key] = array(); } } $names = wpcf7_array_flatten( $file['name'] ); $sizes = wpcf7_array_flatten( $file['size'] ); $tmp_names = wpcf7_array_flatten( $file['tmp_name'] ); $errors = wpcf7_array_flatten( $file['error'] ); foreach ( $errors as $error ) { if ( ! empty( $error ) and UPLOAD_ERR_NO_FILE !== $error ) { return new WP_Error( 'wpcf7_upload_failed_php_error', wpcf7_get_message( 'upload_failed_php_error' ) ); } } if ( isset( $args['schema'] ) and isset( $args['name'] ) ) { $result = $args['schema']->validate( array( 'file' => true, 'field' => $args['name'], ) ); if ( is_wp_error( $result ) ) { return $result; } } // Move uploaded file to tmp dir $uploads_dir = wpcf7_upload_tmp_dir(); $uploads_dir = wpcf7_maybe_add_random_dir( $uploads_dir ); $uploaded_files = array(); foreach ( $names as $key => $name ) { $tmp_name = $tmp_names[$key]; if ( empty( $tmp_name ) or ! is_uploaded_file( $tmp_name ) ) { continue; } $filename = $name; $filename = wpcf7_canonicalize( $filename, array( 'strto' => 'as-is' ) ); $filename = wpcf7_antiscript_file_name( $filename ); $filename = apply_filters( 'wpcf7_upload_file_name', $filename, $name, $args ); $filename = wp_unique_filename( $uploads_dir, $filename ); $new_file = path_join( $uploads_dir, $filename ); if ( false === @move_uploaded_file( $tmp_name, $new_file ) ) { return new WP_Error( 'wpcf7_upload_failed', wpcf7_get_message( 'upload_failed' ) ); } // Make sure the uploaded file is only readable for the owner process chmod( $new_file, 0400 ); $uploaded_files[] = $new_file; } return $uploaded_files; } add_filter( 'wpcf7_messages', 'wpcf7_file_messages', 10, 1 ); /** * A wpcf7_messages filter callback that adds messages for * file-uploading fields. */ function wpcf7_file_messages( $messages ) { return array_merge( $messages, array( 'upload_failed' => array( 'description' => __( "Uploading a file fails for any reason", 'contact-form-7' ), 'default' => __( "There was an unknown error uploading the file.", 'contact-form-7' ), ), 'upload_file_type_invalid' => array( 'description' => __( "Uploaded file is not allowed for file type", 'contact-form-7' ), 'default' => __( "You are not allowed to upload files of this type.", 'contact-form-7' ), ), 'upload_file_too_large' => array( 'description' => __( "Uploaded file is too large", 'contact-form-7' ), 'default' => __( "The uploaded file is too large.", 'contact-form-7' ), ), 'upload_failed_php_error' => array( 'description' => __( "Uploading a file fails for PHP error", 'contact-form-7' ), 'default' => __( "There was an error uploading the file.", 'contact-form-7' ), ), ) ); } add_filter( 'wpcf7_form_enctype', 'wpcf7_file_form_enctype_filter', 10, 1 ); /** * A wpcf7_form_enctype filter callback that sets the enctype attribute * to multipart/form-data if the form has file-uploading fields. */ function wpcf7_file_form_enctype_filter( $enctype ) { $multipart = (bool) wpcf7_scan_form_tags( array( 'feature' => 'file-uploading', ) ); if ( $multipart ) { $enctype = 'multipart/form-data'; } return $enctype; } /** * Converts a MIME type string to an array of corresponding file extensions. * * @param string $mime MIME type. * Wildcard (*) is available for the subtype part. * @return array Corresponding file extensions. */ function wpcf7_convert_mime_to_ext( $mime ) { static $mime_types = array(); $mime_types = wp_get_mime_types(); $results = array(); if ( preg_match( '%^([a-z]+)/([*]|[a-z0-9.+-]+)$%i', $mime, $matches ) ) { foreach ( $mime_types as $key => $val ) { if ( '*' === $matches[2] and str_starts_with( $val, $matches[1] . '/' ) or $val === $matches[0] ) { $results = array_merge( $results, explode( '|', $key ) ); } } } $results = array_unique( $results ); $results = array_filter( $results ); $results = array_values( $results ); return $results; } /** * Returns a formatted list of acceptable filetypes. * * @param string|array $types Optional. Array of filetypes. * @param string $format Optional. Pre-defined format designator. * @return string Formatted list of acceptable filetypes. */ function wpcf7_acceptable_filetypes( $types = 'default', $format = 'regex' ) { if ( 'default' === $types or empty( $types ) ) { $types = array( 'audio/*', 'video/*', 'image/*', ); } else { $types = array_map( static function ( $type ) { if ( is_string( $type ) ) { return preg_split( '/[\s|,]+/', strtolower( $type ) ); } }, (array) $types ); $types = wpcf7_array_flatten( $types ); $types = array_filter( array_unique( $types ) ); } if ( 'attr' === $format or 'attribute' === $format ) { $types = array_map( static function ( $type ) { if ( false === strpos( $type, '/' ) ) { return sprintf( '.%s', trim( $type, '.' ) ); } elseif ( preg_match( '%^([a-z]+)/[*]$%i', $type, $matches ) ) { if ( in_array( $matches[1], array( 'audio', 'video', 'image' ) ) ) { return $type; } else { return ''; } } elseif ( wpcf7_convert_mime_to_ext( $type ) ) { return $type; } }, $types ); $types = array_filter( $types ); return implode( ',', $types ); } elseif ( 'regex' === $format ) { $types = array_map( static function ( $type ) { if ( false === strpos( $type, '/' ) ) { return preg_quote( trim( $type, '.' ) ); } elseif ( $type = wpcf7_convert_mime_to_ext( $type ) ) { return $type; } }, $types ); $types = wpcf7_array_flatten( $types ); $types = array_filter( array_unique( $types ) ); return implode( '|', $types ); } return ''; } add_action( 'wpcf7_init', 'wpcf7_init_uploads', 10, 0 ); /** * Initializes the temporary directory for uploaded files. */ function wpcf7_init_uploads() { $dir = wpcf7_upload_tmp_dir(); if ( is_dir( $dir ) and is_writable( $dir ) ) { $htaccess_file = path_join( $dir, '.htaccess' ); if ( file_exists( $htaccess_file ) ) { list( $first_line_comment ) = (array) file( $htaccess_file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES ); if ( '# Apache 2.4+' === $first_line_comment ) { return; } } if ( $handle = @fopen( $htaccess_file, 'w' ) ) { fwrite( $handle, "# Apache 2.4+\n" ); fwrite( $handle, "<IfModule authz_core_module>\n" ); fwrite( $handle, " Require all denied\n" ); fwrite( $handle, "</IfModule>\n" ); fwrite( $handle, "\n" ); fwrite( $handle, "# Apache 2.2\n" ); fwrite( $handle, "<IfModule !authz_core_module>\n" ); fwrite( $handle, " Deny from all\n" ); fwrite( $handle, "</IfModule>\n" ); fclose( $handle ); } } } /** * Creates a child directory with a randomly generated name. * * @param string $dir The parent directory path. * @return string The child directory path if created, otherwise the parent. */ function wpcf7_maybe_add_random_dir( $dir ) { do { $rand_max = mt_getrandmax(); $rand = zeroise( mt_rand( 0, $rand_max ), strlen( $rand_max ) ); $dir_new = path_join( $dir, $rand ); } while ( file_exists( $dir_new ) ); if ( wp_mkdir_p( $dir_new ) ) { return $dir_new; } return $dir; } /** * Returns the directory path for uploaded files. * * @return string Directory path. */ function wpcf7_upload_tmp_dir() { if ( defined( 'WPCF7_UPLOADS_TMP_DIR' ) ) { $dir = path_join( WP_CONTENT_DIR, WPCF7_UPLOADS_TMP_DIR ); wp_mkdir_p( $dir ); if ( wpcf7_is_file_path_in_content_dir( $dir ) ) { return $dir; } } $dir = path_join( wpcf7_upload_dir( 'dir' ), 'wpcf7_uploads' ); wp_mkdir_p( $dir ); return $dir; } add_action( 'shutdown', 'wpcf7_cleanup_upload_files', 20, 0 ); /** * Cleans up files in the temporary directory for uploaded files. * * @param int $seconds Files older than this are removed. Default 60. * @param int $max Maximum number of files to be removed in a function call. * Default 100. */ function wpcf7_cleanup_upload_files( $seconds = 60, $max = 100 ) { $dir = trailingslashit( wpcf7_upload_tmp_dir() ); if ( ! is_dir( $dir ) or ! is_readable( $dir ) or ! wp_is_writable( $dir ) ) { return; } $seconds = absint( $seconds ); $max = absint( $max ); $count = 0; if ( $handle = opendir( $dir ) ) { while ( false !== ( $file = readdir( $handle ) ) ) { if ( '.' == $file or '..' == $file or '.htaccess' == $file ) { continue; } $mtime = @filemtime( path_join( $dir, $file ) ); if ( $mtime and time() < $mtime + $seconds ) { // less than $seconds old continue; } wpcf7_rmdir_p( path_join( $dir, $file ) ); $count += 1; if ( $max <= $count ) { break; } } closedir( $handle ); } } add_action( 'wpcf7_admin_warnings', 'wpcf7_file_display_warning_message', 10, 3 ); /** * Displays warning messages about file-uploading fields. */ function wpcf7_file_display_warning_message( $page, $action, $object ) { if ( $object instanceof WPCF7_ContactForm ) { $contact_form = $object; } else { return; } $has_tags = (bool) $contact_form->scan_form_tags( array( 'feature' => 'file-uploading', ) ); if ( ! $has_tags ) { return; } $uploads_dir = wpcf7_upload_tmp_dir(); if ( ! is_dir( $uploads_dir ) or ! wp_is_writable( $uploads_dir ) ) { $message = sprintf( /* translators: %s: the path of the temporary folder */ __( 'This contact form has file uploading fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'contact-form-7' ), $uploads_dir ); echo sprintf( '<div class="notice notice-warning"><p>%s</p></div>', esc_html( $message ) ); } } includes/shortcodes.php 0000644 00000005226 15133152050 0011240 0 ustar 00 <?php /** * All the functions and classes in this file are deprecated. * You should not use them. The functions and classes will be * removed in a later version. */ function wpcf7_add_shortcode( $tag, $callback, $has_name = false ) { wpcf7_deprecated_function( __FUNCTION__, '4.6', 'wpcf7_add_form_tag' ); return wpcf7_add_form_tag( $tag, $callback, $has_name ); } function wpcf7_remove_shortcode( $tag ) { wpcf7_deprecated_function( __FUNCTION__, '4.6', 'wpcf7_remove_form_tag' ); return wpcf7_remove_form_tag( $tag ); } function wpcf7_do_shortcode( $content ) { wpcf7_deprecated_function( __FUNCTION__, '4.6', 'wpcf7_replace_all_form_tags' ); return wpcf7_replace_all_form_tags( $content ); } function wpcf7_scan_shortcode( $cond = null ) { wpcf7_deprecated_function( __FUNCTION__, '4.6', 'wpcf7_scan_form_tags' ); return wpcf7_scan_form_tags( $cond ); } class WPCF7_ShortcodeManager { private static $form_tags_manager; private function __construct() {} public static function get_instance() { wpcf7_deprecated_function( __METHOD__, '4.6', 'WPCF7_FormTagsManager::get_instance' ); self::$form_tags_manager = WPCF7_FormTagsManager::get_instance(); return new self; } public function get_scanned_tags() { wpcf7_deprecated_function( __METHOD__, '4.6', 'WPCF7_FormTagsManager::get_scanned_tags' ); return self::$form_tags_manager->get_scanned_tags(); } public function add_shortcode( $tag, $callback, $has_name = false ) { wpcf7_deprecated_function( __METHOD__, '4.6', 'WPCF7_FormTagsManager::add' ); return self::$form_tags_manager->add( $tag, $callback, $has_name ); } public function remove_shortcode( $tag ) { wpcf7_deprecated_function( __METHOD__, '4.6', 'WPCF7_FormTagsManager::remove' ); return self::$form_tags_manager->remove( $tag ); } public function normalize_shortcode( $content ) { wpcf7_deprecated_function( __METHOD__, '4.6', 'WPCF7_FormTagsManager::normalize' ); return self::$form_tags_manager->normalize( $content ); } public function do_shortcode( $content, $exec = true ) { wpcf7_deprecated_function( __METHOD__, '4.6', 'WPCF7_FormTagsManager::replace_all' ); if ( $exec ) { return self::$form_tags_manager->replace_all( $content ); } else { return self::$form_tags_manager->scan( $content ); } } public function scan_shortcode( $content ) { wpcf7_deprecated_function( __METHOD__, '4.6', 'WPCF7_FormTagsManager::scan' ); return self::$form_tags_manager->scan( $content ); } } class WPCF7_Shortcode extends WPCF7_FormTag { public function __construct( $tag ) { wpcf7_deprecated_function( 'WPCF7_Shortcode', '4.6', 'WPCF7_FormTag' ); parent::__construct( $tag ); } } includes/l10n.php 0000644 00000006576 15133152050 0007646 0 ustar 00 <?php /** * Retrieves an associative array of languages to which * this plugin is translated. * * @return array Array of languages. */ function wpcf7_l10n() { static $l10n = array(); if ( ! empty( $l10n ) ) { return $l10n; } if ( ! is_admin() ) { return $l10n; } require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); $api = translations_api( 'plugins', array( 'slug' => 'contact-form-7', 'version' => WPCF7_VERSION, ) ); if ( is_wp_error( $api ) or empty( $api['translations'] ) ) { return $l10n; } foreach ( (array) $api['translations'] as $translation ) { if ( ! empty( $translation['language'] ) and ! empty( $translation['english_name'] ) ) { $l10n[$translation['language']] = $translation['english_name']; } } return $l10n; } /** * Returns true if the given locale code looks valid. * * @param string $locale Locale code. */ function wpcf7_is_valid_locale( $locale ) { if ( ! is_string( $locale ) ) { return false; } $pattern = '/^[a-z]{2,3}(?:_[a-zA-Z_]{2,})?$/'; return (bool) preg_match( $pattern, $locale ); } /** * Returns true if the given locale is an RTL language. */ function wpcf7_is_rtl( $locale = '' ) { static $rtl_locales = array( 'ar' => 'Arabic', 'ary' => 'Moroccan Arabic', 'azb' => 'South Azerbaijani', 'fa_IR' => 'Persian', 'haz' => 'Hazaragi', 'he_IL' => 'Hebrew', 'ps' => 'Pashto', 'ug_CN' => 'Uighur', ); if ( empty( $locale ) and function_exists( 'is_rtl' ) ) { return is_rtl(); } if ( empty( $locale ) ) { $locale = determine_locale(); } return isset( $rtl_locales[$locale] ); } /** * Loads a translation file into the plugin's text domain. * * @param string $locale Locale code. * @return bool True on success, false on failure. */ function wpcf7_load_textdomain( $locale = '' ) { $mofile = path_join( WP_LANG_DIR . '/plugins/', sprintf( '%s-%s.mo', WPCF7_TEXT_DOMAIN, $locale ) ); return load_textdomain( WPCF7_TEXT_DOMAIN, $mofile, $locale ); } /** * Unloads translations for the plugin's text domain. * * @param bool $reloadable Whether the text domain can be loaded * just-in-time again. * @return bool True on success, false on failure. */ function wpcf7_unload_textdomain( $reloadable = false ) { return unload_textdomain( WPCF7_TEXT_DOMAIN, $reloadable ); } /** * Switches translation locale, calls the callback, then switches back * to the original locale. * * @param string $locale Locale code. * @param callable $callback The callable to be called. * @param mixed $args Parameters to be passed to the callback. * @return mixed The return value of the callback. */ function wpcf7_switch_locale( $locale, callable $callback, ...$args ) { static $available_locales = null; if ( ! isset( $available_locales ) ) { $available_locales = array_merge( array( 'en_US' ), get_available_languages() ); } $previous_locale = determine_locale(); $do_switch_locale = ( $locale !== $previous_locale && in_array( $locale, $available_locales, true ) && in_array( $previous_locale, $available_locales, true ) ); if ( $do_switch_locale ) { wpcf7_unload_textdomain(); switch_to_locale( $locale ); wpcf7_load_textdomain( $locale ); } $result = call_user_func( $callback, ...$args ); if ( $do_switch_locale ) { wpcf7_unload_textdomain( true ); restore_previous_locale(); wpcf7_load_textdomain( $previous_locale ); } return $result; } includes/contact-form-functions.php 0000644 00000022333 15133152050 0013463 0 ustar 00 <?php /** * Contact form helper functions */ /** * Wrapper function of WPCF7_ContactForm::get_instance(). * * @param WPCF7_ContactForm|WP_Post|int $post Object or post ID. * @return WPCF7_ContactForm|null Contact form object. Null if unset. */ function wpcf7_contact_form( $post ) { return WPCF7_ContactForm::get_instance( $post ); } /** * Searches for a contact form by an old unit ID. * * @param int $old_id Old unit ID. * @return WPCF7_ContactForm Contact form object. */ function wpcf7_get_contact_form_by_old_id( $old_id ) { global $wpdb; $q = "SELECT post_id FROM $wpdb->postmeta WHERE meta_key = '_old_cf7_unit_id'" . $wpdb->prepare( " AND meta_value = %d", $old_id ); if ( $new_id = $wpdb->get_var( $q ) ) { return wpcf7_contact_form( $new_id ); } } /** * Searches for a contact form by title. * * @param string $title Title of contact form. * @return WPCF7_ContactForm|null Contact form object if found, null otherwise. */ function wpcf7_get_contact_form_by_title( $title ) { if ( ! is_string( $title ) or '' === $title ) { return null; } $contact_forms = WPCF7_ContactForm::find( array( 'title' => $title, 'posts_per_page' => 1, ) ); if ( $contact_forms ) { return wpcf7_contact_form( reset( $contact_forms ) ); } } /** * Wrapper function of WPCF7_ContactForm::get_current(). * * @return WPCF7_ContactForm Contact form object. */ function wpcf7_get_current_contact_form() { if ( $current = WPCF7_ContactForm::get_current() ) { return $current; } } /** * Returns true if it is in the state that a non-Ajax submission is accepted. */ function wpcf7_is_posted() { if ( ! $contact_form = wpcf7_get_current_contact_form() ) { return false; } return $contact_form->is_posted(); } /** * Retrieves the user input value through a non-Ajax submission. * * @param string $name Name of form control. * @param string $default_value Optional default value. * @return string The user input value through the form-control. */ function wpcf7_get_hangover( $name, $default_value = null ) { if ( ! wpcf7_is_posted() ) { return $default_value; } $submission = WPCF7_Submission::get_instance(); if ( ! $submission or $submission->is( 'mail_sent' ) ) { return $default_value; } return isset( $_POST[$name] ) ? wp_unslash( $_POST[$name] ) : $default_value; } /** * Retrieves an HTML snippet of validation error on the given form control. * * @param string $name Name of form control. * @return string Validation error message in a form of HTML snippet. */ function wpcf7_get_validation_error( $name ) { if ( ! $contact_form = wpcf7_get_current_contact_form() ) { return ''; } return $contact_form->validation_error( $name ); } /** * Returns a reference key to a validation error message. * * @param string $name Name of form control. * @param string $unit_tag Optional. Unit tag of the contact form. * @return string Reference key code. */ function wpcf7_get_validation_error_reference( $name, $unit_tag = '' ) { if ( '' === $unit_tag ) { $contact_form = wpcf7_get_current_contact_form(); if ( $contact_form and $contact_form->validation_error( $name ) ) { $unit_tag = $contact_form->unit_tag(); } else { return null; } } return preg_replace( '/[^0-9a-z_-]+/i', '', sprintf( '%1$s-ve-%2$s', $unit_tag, $name ) ); } /** * Retrieves a message for the given status. */ function wpcf7_get_message( $status ) { if ( ! $contact_form = wpcf7_get_current_contact_form() ) { return ''; } return $contact_form->message( $status ); } /** * Returns a class names list for a form-tag of the specified type. * * @param string $type Form-tag type. * @param string $default_classes Optional default classes. * @return string Whitespace-separated list of class names. */ function wpcf7_form_controls_class( $type, $default_classes = '' ) { $type = trim( $type ); $default_classes = array_filter( explode( ' ', $default_classes ) ); $classes = array_merge( array( 'wpcf7-form-control' ), $default_classes ); $typebase = rtrim( $type, '*' ); $required = ( '*' == substr( $type, -1 ) ); $classes[] = 'wpcf7-' . $typebase; if ( $required ) { $classes[] = 'wpcf7-validates-as-required'; } $classes = array_unique( $classes ); return implode( ' ', $classes ); } /** * Callback function for the contact-form-7 shortcode. */ function wpcf7_contact_form_tag_func( $atts, $content = null, $code = '' ) { if ( is_feed() ) { return '[contact-form-7]'; } if ( 'contact-form-7' == $code ) { $atts = shortcode_atts( array( 'id' => 0, 'title' => '', 'html_id' => '', 'html_name' => '', 'html_title' => '', 'html_class' => '', 'output' => 'form', ), $atts, 'wpcf7' ); $id = (int) $atts['id']; $title = trim( $atts['title'] ); if ( ! $contact_form = wpcf7_contact_form( $id ) ) { $contact_form = wpcf7_get_contact_form_by_title( $title ); } } else { if ( is_string( $atts ) ) { $atts = explode( ' ', $atts, 2 ); } $id = (int) array_shift( $atts ); $contact_form = wpcf7_get_contact_form_by_old_id( $id ); } if ( ! $contact_form ) { return sprintf( '<p class="wpcf7-contact-form-not-found"><strong>%1$s</strong> %2$s</p>', esc_html( __( 'Error:', 'contact-form-7' ) ), esc_html( __( "Contact form not found.", 'contact-form-7' ) ) ); } $callback = static function ( $contact_form, $atts ) { return $contact_form->form_html( $atts ); }; return wpcf7_switch_locale( $contact_form->locale(), $callback, $contact_form, $atts ); } /** * Saves the contact form data. */ function wpcf7_save_contact_form( $args = '', $context = 'save' ) { $args = wp_parse_args( $args, array( 'id' => -1, 'title' => null, 'locale' => null, 'form' => null, 'mail' => null, 'mail_2' => null, 'messages' => null, 'additional_settings' => null, ) ); $args = wp_unslash( $args ); $args['id'] = (int) $args['id']; if ( -1 == $args['id'] ) { $contact_form = WPCF7_ContactForm::get_template(); } else { $contact_form = wpcf7_contact_form( $args['id'] ); } if ( empty( $contact_form ) ) { return false; } if ( null !== $args['title'] ) { $contact_form->set_title( $args['title'] ); } if ( null !== $args['locale'] ) { $contact_form->set_locale( $args['locale'] ); } $properties = array(); if ( null !== $args['form'] ) { $properties['form'] = wpcf7_sanitize_form( $args['form'] ); } if ( null !== $args['mail'] ) { $properties['mail'] = wpcf7_sanitize_mail( $args['mail'] ); $properties['mail']['active'] = true; } if ( null !== $args['mail_2'] ) { $properties['mail_2'] = wpcf7_sanitize_mail( $args['mail_2'] ); } if ( null !== $args['messages'] ) { $properties['messages'] = wpcf7_sanitize_messages( $args['messages'] ); } if ( null !== $args['additional_settings'] ) { $properties['additional_settings'] = wpcf7_sanitize_additional_settings( $args['additional_settings'] ); } $contact_form->set_properties( $properties ); do_action( 'wpcf7_save_contact_form', $contact_form, $args, $context ); if ( 'save' == $context ) { $contact_form->save(); } return $contact_form; } /** * Sanitizes the form property data. */ function wpcf7_sanitize_form( $input, $default_template = '' ) { if ( null === $input ) { return $default_template; } $output = trim( $input ); if ( ! current_user_can( 'unfiltered_html' ) ) { $output = wpcf7_kses( $output, 'form' ); } return $output; } /** * Sanitizes the mail property data. */ function wpcf7_sanitize_mail( $input, $defaults = array() ) { $input = wp_parse_args( $input, array( 'active' => false, 'subject' => '', 'sender' => '', 'recipient' => '', 'body' => '', 'additional_headers' => '', 'attachments' => '', 'use_html' => false, 'exclude_blank' => false, ) ); $input = wp_parse_args( $input, $defaults ); $output = array(); $output['active'] = (bool) $input['active']; $output['subject'] = trim( $input['subject'] ); $output['sender'] = trim( $input['sender'] ); $output['recipient'] = trim( $input['recipient'] ); $output['body'] = trim( $input['body'] ); if ( ! current_user_can( 'unfiltered_html' ) ) { $output['body'] = wpcf7_kses( $output['body'], 'mail' ); } $output['additional_headers'] = ''; $headers = str_replace( "\r\n", "\n", $input['additional_headers'] ); $headers = explode( "\n", $headers ); foreach ( $headers as $header ) { $header = trim( $header ); if ( '' !== $header ) { $output['additional_headers'] .= $header . "\n"; } } $output['additional_headers'] = trim( $output['additional_headers'] ); $output['attachments'] = trim( $input['attachments'] ); $output['use_html'] = (bool) $input['use_html']; $output['exclude_blank'] = (bool) $input['exclude_blank']; return $output; } /** * Sanitizes the messages property data. */ function wpcf7_sanitize_messages( $input, $defaults = array() ) { $output = array(); foreach ( wpcf7_messages() as $key => $val ) { if ( isset( $input[$key] ) ) { $output[$key] = trim( $input[$key] ); } elseif ( isset( $defaults[$key] ) ) { $output[$key] = $defaults[$key]; } } return $output; } /** * Sanitizes the additional settings property data. */ function wpcf7_sanitize_additional_settings( $input, $default_template = '' ) { if ( null === $input ) { return $default_template; } $output = trim( $input ); return $output; } includes/contact-form-template.php 0000644 00000013061 15133152050 0013264 0 ustar 00 <?php class WPCF7_ContactFormTemplate { public static function get_default( $prop = 'form' ) { if ( 'form' == $prop ) { $template = self::form(); } elseif ( 'mail' == $prop ) { $template = self::mail(); } elseif ( 'mail_2' == $prop ) { $template = self::mail_2(); } elseif ( 'messages' == $prop ) { $template = self::messages(); } else { $template = null; } return apply_filters( 'wpcf7_default_template', $template, $prop ); } public static function form() { $template = sprintf( ' <label> %2$s [text* your-name autocomplete:name] </label> <label> %3$s [email* your-email autocomplete:email] </label> <label> %4$s [text* your-subject] </label> <label> %5$s %1$s [textarea your-message] </label> [submit "%6$s"]', __( '(optional)', 'contact-form-7' ), __( 'Your name', 'contact-form-7' ), __( 'Your email', 'contact-form-7' ), __( 'Subject', 'contact-form-7' ), __( 'Your message', 'contact-form-7' ), __( 'Submit', 'contact-form-7' ) ); return trim( $template ); } public static function mail() { $template = array( 'subject' => sprintf( /* translators: 1: blog name, 2: [your-subject] */ _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ), '[_site_title]', '[your-subject]' ), 'sender' => sprintf( '%s <%s>', '[_site_title]', self::from_email() ), 'body' => sprintf( /* translators: %s: [your-name] [your-email] */ __( 'From: %s', 'contact-form-7' ), '[your-name] [your-email]' ) . "\n" . sprintf( /* translators: %s: [your-subject] */ __( 'Subject: %s', 'contact-form-7' ), '[your-subject]' ) . "\n\n" . __( 'Message Body:', 'contact-form-7' ) . "\n" . '[your-message]' . "\n\n" . '-- ' . "\n" . sprintf( /* translators: 1: blog name, 2: blog URL */ __( 'This e-mail was sent from a contact form on %1$s (%2$s)', 'contact-form-7' ), '[_site_title]', '[_site_url]' ), 'recipient' => '[_site_admin_email]', 'additional_headers' => 'Reply-To: [your-email]', 'attachments' => '', 'use_html' => 0, 'exclude_blank' => 0, ); return $template; } public static function mail_2() { $template = array( 'active' => false, 'subject' => sprintf( /* translators: 1: blog name, 2: [your-subject] */ _x( '%1$s "%2$s"', 'mail subject', 'contact-form-7' ), '[_site_title]', '[your-subject]' ), 'sender' => sprintf( '%s <%s>', '[_site_title]', self::from_email() ), 'body' => __( 'Message Body:', 'contact-form-7' ) . "\n" . '[your-message]' . "\n\n" . '-- ' . "\n" . sprintf( /* translators: 1: blog name, 2: blog URL */ __( 'This e-mail was sent from a contact form on %1$s (%2$s)', 'contact-form-7' ), '[_site_title]', '[_site_url]' ), 'recipient' => '[your-email]', 'additional_headers' => sprintf( 'Reply-To: %s', '[_site_admin_email]' ), 'attachments' => '', 'use_html' => 0, 'exclude_blank' => 0, ); return $template; } public static function from_email() { $admin_email = get_option( 'admin_email' ); if ( wpcf7_is_localhost() ) { return $admin_email; } $sitename = wp_parse_url( network_home_url(), PHP_URL_HOST ); $sitename = strtolower( $sitename ); if ( 'www.' === substr( $sitename, 0, 4 ) ) { $sitename = substr( $sitename, 4 ); } if ( strpbrk( $admin_email, '@' ) === '@' . $sitename ) { return $admin_email; } return 'wordpress@' . $sitename; } public static function messages() { $messages = array(); foreach ( wpcf7_messages() as $key => $arr ) { $messages[$key] = $arr['default']; } return $messages; } } function wpcf7_messages() { $messages = array( 'mail_sent_ok' => array( 'description' => __( "Sender's message was sent successfully", 'contact-form-7' ), 'default' => __( "Thank you for your message. It has been sent.", 'contact-form-7' ), ), 'mail_sent_ng' => array( 'description' => __( "Sender's message failed to send", 'contact-form-7' ), 'default' => __( "There was an error trying to send your message. Please try again later.", 'contact-form-7' ), ), 'validation_error' => array( 'description' => __( "Validation errors occurred", 'contact-form-7' ), 'default' => __( "One or more fields have an error. Please check and try again.", 'contact-form-7' ), ), 'spam' => array( 'description' => __( "Submission was referred to as spam", 'contact-form-7' ), 'default' => __( "There was an error trying to send your message. Please try again later.", 'contact-form-7' ), ), 'accept_terms' => array( 'description' => __( "There are terms that the sender must accept", 'contact-form-7' ), 'default' => __( "You must accept the terms and conditions before sending your message.", 'contact-form-7' ), ), 'invalid_required' => array( 'description' => __( "There is a field that the sender must fill in", 'contact-form-7' ), 'default' => __( "Please fill out this field.", 'contact-form-7' ), ), 'invalid_too_long' => array( 'description' => __( "There is a field with input that is longer than the maximum allowed length", 'contact-form-7' ), 'default' => __( "This field has a too long input.", 'contact-form-7' ), ), 'invalid_too_short' => array( 'description' => __( "There is a field with input that is shorter than the minimum allowed length", 'contact-form-7' ), 'default' => __( "This field has a too short input.", 'contact-form-7' ), ), ); return apply_filters( 'wpcf7_messages', $messages ); } includes/block-editor/block-editor.php 0000644 00000003067 15133152050 0014020 0 ustar 00 <?php add_action( 'init', 'wpcf7_init_block_editor_assets', 10, 0 ); function wpcf7_init_block_editor_assets() { $assets = array(); $asset_file = wpcf7_plugin_path( 'includes/block-editor/index.asset.php' ); if ( file_exists( $asset_file ) ) { $assets = include( $asset_file ); } $assets = wp_parse_args( $assets, array( 'dependencies' => array( 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n', 'wp-url', ), 'version' => WPCF7_VERSION, ) ); wp_register_script( 'contact-form-7-block-editor', wpcf7_plugin_url( 'includes/block-editor/index.js' ), $assets['dependencies'], $assets['version'] ); wp_set_script_translations( 'contact-form-7-block-editor', 'contact-form-7' ); register_block_type( wpcf7_plugin_path( 'includes/block-editor' ), array( 'editor_script' => 'contact-form-7-block-editor', ) ); } add_action( 'enqueue_block_editor_assets', 'wpcf7_enqueue_block_editor_assets', 10, 0 ); function wpcf7_enqueue_block_editor_assets() { $contact_forms = array_map( static function ( $contact_form ) { return array( 'id' => $contact_form->id(), 'slug' => $contact_form->name(), 'title' => $contact_form->title(), 'locale' => $contact_form->locale(), ); }, WPCF7_ContactForm::find( array( 'posts_per_page' => 20, 'orderby' => 'modified', 'order' => 'DESC', ) ) ); wp_add_inline_script( 'contact-form-7-block-editor', sprintf( 'window.wpcf7 = {contactForms:%s};', json_encode( $contact_forms ) ), 'before' ); } includes/block-editor/index.js 0000644 00000012511 15133152050 0012370 0 ustar 00 (()=>{"use strict";var e={n:t=>{var l=t&&t.__esModule?()=>t.default:()=>t;return e.d(l,{a:l}),l},d:(t,l)=>{for(var a in l)e.o(l,a)&&!e.o(t,a)&&Object.defineProperty(t,a,{enumerable:!0,get:l[a]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.element,l=window.wp.i18n,a=window.wp.blocks,r=window.wp.blockEditor,o=(0,t.createElement)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 242.5 239.46"},(0,t.createElement)("defs",null,(0,t.createElement)("clipPath",{id:"clip-path",transform:"translate(1.72)"},(0,t.createElement)("circle",{className:"cls-1",cx:"119.73",cy:"119.73",r:"116.15",fill:"none"}))),(0,t.createElement)("g",{id:"Layer_2","data-name":"Layer 2"},(0,t.createElement)("g",{id:"Layer_1","data-name":"Layer 1"},(0,t.createElement)("g",{className:"cls-2",clipPath:"url(#clip-path)"},(0,t.createElement)("circle",{className:"cls-3",cx:"121.45",cy:"119.73",r:"116.15",fill:"#33c6f4"}),(0,t.createElement)("path",{className:"cls-4",d:"M239.32,167.79c-53.41-24-108.37-91.46-113-94.55s-10.84.77-10.84.77c-3.87-6.19-10.06.77-10.06.77C76.77,123.55.14,170.11.14,170.11S36.94,237.79,122,237.79C208.48,237.79,239.32,167.79,239.32,167.79Z",transform:"translate(1.72)",fill:"#1b447e"}),(0,t.createElement)("path",{className:"cls-5",d:"M67.48,116.58s15.48-7,12.38,4.65-15.48,28.64-11.61,29.41S83,140.58,86.06,142.12s5.42.78,3.87,6.2-3.1,9.29,0,9.29,5.42-7,9.29-13.94,10.06-3.87,12.38-1.55,9.29,15.49,14.71,13.94,8.51-8.52,6.19-24,1.55-20.12,1.55-20.12,4.64-2.32,13.16,8.51,24,27.09,26.31,26.32-10.83-17.8-7.74-19.35,15.48,2.32,21.68,7.74c0,0,2.12,8.87,2.12.36L126.31,73.24,115.47,74l-10.06.77S80.64,111.94,67.48,116.58Z",transform:"translate(1.72)",fill:"#fff"}),(0,t.createElement)("path",{className:"cls-6",d:"M239.32,170.11c-53.41-24-108.37-93.78-113-96.87s-10.84.77-10.84.77c-3.87-6.19-10.06.77-10.06.77C76.77,123.55.14,170.11.14,170.11",transform:"translate(1.72)",fill:"none",stroke:"#221e1f",strokeMiterlimit:"10",strokeWidth:"8px"})),(0,t.createElement)("circle",{className:"cls-6",cx:"121.45",cy:"119.73",r:"116.15",fill:"none",stroke:"#1b447e",strokeMiterlimit:"10",strokeWidth:"8px"})))),n=window.wp.components,c=window.wp.apiFetch;var s=e.n(c);const m=window.wp.url,i=e=>{let t="[contact-form-7]";return e.id&&(t=t.replace(/\]$/,` id="${e.id}"]`)),e.title&&(t=t.replace(/\]$/,` title="${e.title}"]`)),e.htmlId&&(t=t.replace(/\]$/,` html_id="${e.htmlId}"]`)),e.htmlName&&(t=t.replace(/\]$/,` html_name="${e.htmlName}"]`)),e.htmlTitle&&(t=t.replace(/\]$/,` html_title="${e.htmlTitle}"]`)),e.htmlClass&&(t=t.replace(/\]$/,` html_class="${e.htmlClass}"]`)),"raw_form"===e.output&&(t=t.replace(/\]$/,` output="${e.output}"]`)),t},d=e=>{const t=ajaxurl.replace(/\/admin-ajax\.php$/,"/admin.php");return(0,m.addQueryArgs)(t,{page:"wpcf7",post:e.id,action:"edit"})},p={from:[{type:"shortcode",tag:"contact-form-7",attributes:{id:{type:"integer",shortcode:e=>{let{named:{id:t}}=e;return parseInt(t)}},title:{type:"string",shortcode:e=>{let{named:{title:t}}=e;return t}}}}],to:[{type:"block",blocks:["core/shortcode"],transform:e=>{const t=i(e);return(0,a.createBlock)("core/shortcode",{text:t})}}]};var h;window.wpcf7=null!==(h=window.wpcf7)&&void 0!==h?h:{contactForms:[]},(0,a.registerBlockType)("contact-form-7/contact-form-selector",{icon:o,transforms:p,edit:function(e){let{attributes:a,setAttributes:o}=e;const c=e=>e.reduce(((e,t)=>e.set(t.id,t)),new Map),[i,p]=(0,t.useState)((()=>{var e;return c(null!==(e=window.wpcf7.contactForms)&&void 0!==e?e:[])}));return(0,t.createElement)(t.Fragment,null,(0,t.createElement)(r.InspectorControls,null,a.id&&(0,t.createElement)(n.PanelBody,{title:a.title},(0,t.createElement)(n.ExternalLink,{href:d(a)},(0,l.__)("Edit this contact form","contact-form-7"))),a.id&&(0,t.createElement)(n.PanelBody,{title:(0,l.__)("Form attributes","contact-form-7"),initialOpen:!1},(0,t.createElement)(n.TextControl,{label:(0,l.__)("ID","contact-form-7"),value:a.htmlId,onChange:e=>o({htmlId:e}),help:(0,l.__)("Used for the id attribute value of the form element.","contact-form-7")}),(0,t.createElement)(n.TextControl,{label:(0,l.__)("Name","contact-form-7"),value:a.htmlName,onChange:e=>o({htmlName:e}),help:(0,l.__)("Used for the name attribute value of the form element.","contact-form-7")}),(0,t.createElement)(n.TextControl,{label:(0,l.__)("Title","contact-form-7"),value:a.htmlTitle,onChange:e=>o({htmlTitle:e}),help:(0,l.__)("Used for the aria-label attribute value of the form element.","contact-form-7")}),(0,t.createElement)(n.TextControl,{label:(0,l.__)("Class","contact-form-7"),value:a.htmlClass,onChange:e=>o({htmlClass:e}),help:(0,l.__)("Used for the class attribute value of the form element.","contact-form-7")}))),(0,t.createElement)("div",(0,r.useBlockProps)({className:"components-placeholder",style:{marginTop:"28px",marginBottom:"28px"}}),(0,t.createElement)(n.ComboboxControl,{label:(0,l.__)("Select a contact form:","contact-form-7"),options:(e=>{const t=[];for(const[l,a]of e)t.push({value:l,label:a.title});return t})(i),value:a.id,onChange:e=>{var t;return o({id:parseInt(e),title:null===(t=i.get(parseInt(e)))||void 0===t?void 0:t.title})},onFilterValueChange:e=>{(async e=>s()({path:(0,m.addQueryArgs)("/contact-form-7/v1/contact-forms",{posts_per_page:20,orderby:"modified",order:"DESC",...e})}).then((e=>e)))({search:e}).then((e=>{p(c(e))}))}})))},save:e=>{let{attributes:l}=e;const a=i(l);return(0,t.createElement)("div",r.useBlockProps.save(),a)}})})(); includes/js/jquery-ui/themes/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png 0000644 00000000504 15133152050 0022777 0 ustar 00 �PNG IHDR � ��D gAMA ���a cHRM z&