Sync plugins from current page
Signed-off-by: Adrian Nöthlich <git@promasu.tech>
This commit is contained in:
		
							
								
								
									
										603
									
								
								wp-content/plugins/contact-form-7/admin/admin.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										603
									
								
								wp-content/plugins/contact-form-7/admin/admin.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,603 @@ | ||||
| <?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', 'wpcf7_admin_init', 10, 0 ); | ||||
|  | ||||
| function wpcf7_admin_init() { | ||||
| 	do_action( 'wpcf7_admin_init' ); | ||||
| } | ||||
|  | ||||
| add_action( 'admin_menu', 'wpcf7_admin_menu', 9, 0 ); | ||||
|  | ||||
| function wpcf7_admin_menu() { | ||||
| 	global $_wp_last_object_menu; | ||||
|  | ||||
| 	$_wp_last_object_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', | ||||
| 		$_wp_last_object_menu ); | ||||
|  | ||||
| 	$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 Other Services', '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' => esc_url_raw( 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_action( 'doing_dark_mode', 'wpcf7_dark_mode_support', 10, 1 ); | ||||
|  | ||||
| function wpcf7_dark_mode_support( $user_id ) { | ||||
| 	wp_enqueue_style( 'contact-form-7-admin-dark-mode', | ||||
| 		wpcf7_plugin_url( 'admin/css/styles-dark-mode.css' ), | ||||
| 		array( 'contact-form-7-admin' ), WPCF7_VERSION, 'screen' ); | ||||
| } | ||||
|  | ||||
| add_filter( 'set-screen-option', 'wpcf7_set_screen_options', 10, 3 ); | ||||
|  | ||||
| function wpcf7_set_screen_options( $result, $option, $value ) { | ||||
| 	$wpcf7_screens = array( | ||||
| 		'cfseven_contact_forms_per_page', | ||||
| 	); | ||||
|  | ||||
| 	if ( in_array( $option, $wpcf7_screens ) ) { | ||||
| 		$result = $value; | ||||
| 	} | ||||
|  | ||||
| 	return $result; | ||||
| } | ||||
|  | ||||
| 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' => 'cfseven_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 Other Services', 'contact-form-7' ) ); ?></h1> | ||||
|  | ||||
| <?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 | ||||
| } | ||||
|  | ||||
| /* Misc */ | ||||
|  | ||||
| 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 is-dismissible"><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 is-dismissible"><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( | ||||
| 				/* translators: %s: number of contact forms */ | ||||
| 				_n( | ||||
| 					"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 is-dismissible"><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 is-dismissible"><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 | ||||
| 	/* translators: 1: version of Contact Form 7, 2: version of WordPress, 3: URL */ | ||||
| 	echo sprintf( __( '<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 ) ); | ||||
| } | ||||
| @@ -0,0 +1,72 @@ | ||||
| #wpcf7-contact-form-list-table span.shortcode input, | ||||
| #wpcf7-contact-form-editor span.shortcode input { | ||||
| 	color: #fff; | ||||
| } | ||||
|  | ||||
| div.config-error, span.config-error, ul.config-error { | ||||
| 	color: #bbc8d4; | ||||
| } | ||||
|  | ||||
| .keyboard-interaction { | ||||
| 	color: #bbc8d4; | ||||
| } | ||||
|  | ||||
| #contact-form-editor .contact-form-editor-panel { | ||||
| 	background-color: #32373c; | ||||
| } | ||||
|  | ||||
| #contact-form-editor-tabs { | ||||
| 	border-bottom: 1px solid #aaa; | ||||
| } | ||||
|  | ||||
| #contact-form-editor-tabs li { | ||||
| 	border: 1px solid #ccc; | ||||
| 	border-bottom: 1px solid #aaa; | ||||
| 	background-color: #37444c; | ||||
| } | ||||
|  | ||||
| #contact-form-editor-tabs li:hover { | ||||
| 	background-color: #000; | ||||
| } | ||||
|  | ||||
| #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 #32373c; | ||||
| 	background-color: #32373c; | ||||
| } | ||||
|  | ||||
| #contact-form-editor-tabs li a { | ||||
| 	color: #bbc8d4; | ||||
| } | ||||
|  | ||||
| #contact-form-editor-tabs li.ui-tabs-active a { | ||||
| 	color: #fff; | ||||
| } | ||||
|  | ||||
| #contact-form-editor-tabs li a:hover { | ||||
| 	color: #fff; | ||||
| } | ||||
|  | ||||
| .contact-form-editor-box-mail span.mailtag { | ||||
| 	color: #ddd; | ||||
| } | ||||
|  | ||||
| .contact-form-editor-box-mail span.mailtag.used { | ||||
| 	color: #999; | ||||
| } | ||||
|  | ||||
| #mail-panel .contact-form-editor-box-mail table.form-table tr th, | ||||
| #mail-panel .contact-form-editor-box-mail table.form-table tr td { | ||||
| 	background-color: #32373c; | ||||
| } | ||||
|  | ||||
| div.wrap#wpcf7-integration .card.active { | ||||
| 	border-color: #00a0d2; | ||||
| } | ||||
|  | ||||
| div.wrap#wpcf7-integration .card .infobox { | ||||
| 	color: #aaa; | ||||
| } | ||||
							
								
								
									
										62
									
								
								wp-content/plugins/contact-form-7/admin/css/styles-rtl.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										62
									
								
								wp-content/plugins/contact-form-7/admin/css/styles-rtl.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,62 @@ | ||||
| /* | ||||
|  * 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 | ||||
|  */ | ||||
| .welcome-panel .welcome-panel-column, | ||||
| .welcome-panel .welcome-panel-column:first-child { | ||||
| 	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; | ||||
| } | ||||
							
								
								
									
										439
									
								
								wp-content/plugins/contact-form-7/admin/css/styles.css
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										439
									
								
								wp-content/plugins/contact-form-7/admin/css/styles.css
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,439 @@ | ||||
| #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: #f00; | ||||
| } | ||||
|  | ||||
| #submitpost input.delete:focus { | ||||
| 	outline: thin dotted; | ||||
| } | ||||
|  | ||||
| .postbox-container .postbox h3 { | ||||
| 	border-bottom: 1px solid transparent; | ||||
| } | ||||
|  | ||||
| .keyboard-interaction { | ||||
| 	visibility: hidden; | ||||
| 	color: #23282d; | ||||
| } | ||||
|  | ||||
| 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: #d00; | ||||
| } | ||||
|  | ||||
| #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 { | ||||
| 	position: relative; | ||||
| 	height: 495px; | ||||
| } | ||||
|  | ||||
| .tag-generator-panel .control-box { | ||||
| 	padding: 0; | ||||
| 	margin: 0; | ||||
| 	height: 380px; | ||||
| 	overflow: auto; | ||||
| } | ||||
|  | ||||
| .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: 95%; | ||||
| } | ||||
|  | ||||
| .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 { | ||||
| 	position: absolute; | ||||
| 	left: -15px; | ||||
| 	right: -15px; | ||||
| 	bottom: -15px; | ||||
| 	width: 100%; | ||||
| 	height: 84px; | ||||
| 	margin: 0; | ||||
| 	padding: 8px 16px; | ||||
| 	background-color: #fcfcfc; | ||||
| 	border-top: 1px solid #dfdfdf; | ||||
| 	overflow: auto; | ||||
| } | ||||
|  | ||||
| .tag-generator-panel .insert-box input.tag { | ||||
| 	width: 480px; | ||||
| 	float: left; | ||||
| 	background-color: transparent; | ||||
| 	box-shadow: none; | ||||
| } | ||||
|  | ||||
| .tag-generator-panel .insert-box .submitbox { | ||||
| 	padding: 2px 4px; | ||||
| } | ||||
|  | ||||
| .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; | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * List Table | ||||
|  */ | ||||
| .fixed .column-title { | ||||
| 	width: 38%; | ||||
| } | ||||
|  | ||||
| .fixed .column-shortcode { | ||||
| 	width: 38%; | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * Welcome Panel | ||||
|  */ | ||||
| .welcome-panel .welcome-panel-column, | ||||
| .welcome-panel .welcome-panel-column:first-child { | ||||
| 	width: 48%; | ||||
| 	padding: 0 2% 0 0; | ||||
| 	margin: 0 0 1em 0; | ||||
| } | ||||
|  | ||||
| @media screen and (max-width: 870px) { | ||||
| 	.welcome-panel .welcome-panel-column, | ||||
| 	.welcome-panel .welcome-panel-column:first-child { | ||||
| 		display: block; | ||||
| 		float: none; | ||||
| 		width: 100%; | ||||
| 	} | ||||
| } | ||||
|  | ||||
| .welcome-panel h3 { | ||||
| 	font-size: 16px; | ||||
| 	font-weight: 600; | ||||
| 	line-height: 2.1em; | ||||
| 	margin: 1em 0 1.2em; | ||||
| } | ||||
|  | ||||
| .welcome-panel h3 .dashicons { | ||||
| 	position: relative; | ||||
| 	top: -2px; | ||||
| 	display: inline-block; | ||||
| 	width: 60px; | ||||
| 	color: #575757; | ||||
| 	font-size: 40px; | ||||
| } | ||||
|  | ||||
| .welcome-panel p a { | ||||
| 	font-weight: bold; | ||||
| } | ||||
|  | ||||
| .welcome-panel-close { | ||||
| 	z-index: 2; | ||||
| } | ||||
|  | ||||
| /* | ||||
|  * 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: 2px 0 5px; | ||||
| 	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; | ||||
| } | ||||
							
								
								
									
										296
									
								
								wp-content/plugins/contact-form-7/admin/edit-contact-form.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										296
									
								
								wp-content/plugins/contact-form-7/admin/edit-contact-form.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,296 @@ | ||||
| <?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 ) ? '' : 'disabled', | ||||
| 	); | ||||
|  | ||||
| 	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 & %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 = trim( $post->prop( '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 | ||||
| 				/* translators: %d: number of additional settings */ | ||||
| 				? sprintf( | ||||
| 					__( '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 ); | ||||
| @@ -0,0 +1,22 @@ | ||||
| <?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 ); | ||||
| } | ||||
| @@ -0,0 +1,253 @@ | ||||
| <?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( 'cfseven_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 ), | ||||
| 			/* translators: %s: title of contact form */ | ||||
| 			esc_attr( sprintf( __( '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( | ||||
| 					/* translators: %s: number of errors detected */ | ||||
| 					_n( | ||||
| 						'%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 ) { | ||||
| 		$post = get_post( $item->id() ); | ||||
|  | ||||
| 		if ( ! $post ) { | ||||
| 			return; | ||||
| 		} | ||||
|  | ||||
| 		$t_time = mysql2date( __( 'Y/m/d g:i:s A', 'contact-form-7' ), | ||||
| 			$post->post_date, true ); | ||||
| 		$m_time = $post->post_date; | ||||
| 		$time = mysql2date( 'G', $post->post_date ) | ||||
| 			- get_option( 'gmt_offset' ) * 3600; | ||||
|  | ||||
| 		$time_diff = time() - $time; | ||||
|  | ||||
| 		if ( $time_diff > 0 and $time_diff < 24*60*60 ) { | ||||
| 			$h_time = sprintf( | ||||
| 				/* translators: %s: time since the creation of the contact form */ | ||||
| 				__( '%s ago', 'contact-form-7' ), | ||||
| 				human_time_diff( $time ) | ||||
| 			); | ||||
| 		} else { | ||||
| 			$h_time = mysql2date( __( 'Y/m/d', 'contact-form-7' ), $m_time ); | ||||
| 		} | ||||
|  | ||||
| 		return sprintf( '<abbr title="%2$s">%1$s</abbr>', | ||||
| 			esc_html( $h_time ), | ||||
| 			esc_attr( $t_time ) | ||||
| 		); | ||||
| 	} | ||||
| } | ||||
| @@ -0,0 +1,135 @@ | ||||
| <?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 = '5.0.4'; | ||||
|  | ||||
| 	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' => current_time( 'timestamp' ), | ||||
| 		'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( | ||||
| 		/* translators: %s: number of contact forms */ | ||||
| 		_n( | ||||
| 			"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 | ||||
| } | ||||
							
								
								
									
										258
									
								
								wp-content/plugins/contact-form-7/admin/includes/editor.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										258
									
								
								wp-content/plugins/contact-form-7/admin/includes/editor.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,258 @@ | ||||
| <?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( $id, $title, $callback ) { | ||||
| 		if ( wpcf7_is_name( $id ) ) { | ||||
| 			$this->panels[$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 $id => $panel ) { | ||||
| 			echo sprintf( '<li id="%1$s-tab"><a href="#%1$s">%2$s</a></li>', | ||||
| 				esc_attr( $id ), esc_html( $panel['title'] ) ); | ||||
| 		} | ||||
|  | ||||
| 		echo '</ul>'; | ||||
|  | ||||
| 		foreach ( $this->panels as $id => $panel ) { | ||||
| 			echo sprintf( '<div class="contact-form-editor-panel" id="%1$s">', | ||||
| 				esc_attr( $id ) ); | ||||
|  | ||||
| 			if ( is_callable( $panel['callback'] ) ) { | ||||
| 				$this->notice( $id, $panel ); | ||||
| 				call_user_func( $panel['callback'], $this->contact_form ); | ||||
| 			} | ||||
|  | ||||
| 			echo '</div>'; | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| 	public function notice( $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 | ||||
| } | ||||
| @@ -0,0 +1,98 @@ | ||||
| <?php | ||||
|  | ||||
| class WPCF7_Help_Tabs { | ||||
|  | ||||
| 	private $screen; | ||||
|  | ||||
| 	public function __construct( WP_Screen $screen ) { | ||||
| 		$this->screen = $screen; | ||||
| 	} | ||||
|  | ||||
| 	public function set_help_tabs( $type ) { | ||||
| 		switch ( $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 don’t 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 don’t 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 ); | ||||
| 	} | ||||
| } | ||||
| @@ -0,0 +1,80 @@ | ||||
| <?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'] ), | ||||
| 				/* translators: %s: title of form-tag like 'email' or 'checkboxes' */ | ||||
| 				esc_attr( sprintf( | ||||
| 					__( '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>'; | ||||
| 			} | ||||
| 		} | ||||
| 	} | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,78 @@ | ||||
| <?php | ||||
|  | ||||
| function wpcf7_welcome_panel() { | ||||
| 	$classes = '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="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"> | ||||
|  | ||||
| 			<div class="welcome-panel-column"> | ||||
| 				<h3><span class="dashicons dashicons-shield" aria-hidden="true"></span> <?php echo esc_html( __( "Getting spammed? You have protection.", 'contact-form-7' ) ); ?></h3> | ||||
|  | ||||
| 				<p><?php echo esc_html( __( "Spammers target everything; your contact forms aren’t an exception. Before you get spammed, protect your contact forms with the powerful anti-spam features Contact Form 7 provides.", 'contact-form-7' ) ); ?></p> | ||||
|  | ||||
| 				<p><?php /* translators: links labeled 1: 'Akismet', 2: 'reCAPTCHA', 3: 'comment blacklist' */ echo sprintf( 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' ), __( 'comment blacklist', 'contact-form-7' ) ) ); ?></p> | ||||
| 			</div> | ||||
|  | ||||
| <?php if ( defined( 'FLAMINGO_VERSION' ) ) : ?> | ||||
| 			<div class="welcome-panel-column"> | ||||
| 				<h3><span class="dashicons dashicons-megaphone" aria-hidden="true"></span> <?php echo esc_html( __( "Contact Form 7 needs your support.", 'contact-form-7' ) ); ?></h3> | ||||
|  | ||||
| 				<p><?php echo esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you.", 'contact-form-7' ) ); ?></p> | ||||
|  | ||||
| 				<p><?php /* translators: %s: link labeled 'making a donation' */ echo sprintf( 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' ) ) ); ?></p> | ||||
|  | ||||
| 				<p><?php echo esc_html( __( "Your donation will help encourage and support the plugin’s continued development and better user support.", 'contact-form-7' ) ); ?></p> | ||||
| 			</div> | ||||
| <?php else: ?> | ||||
| 			<div class="welcome-panel-column"> | ||||
| 				<h3><span class="dashicons dashicons-editor-help" aria-hidden="true"></span> <?php echo esc_html( __( "Before you cry over spilt mail…", 'contact-form-7' ) ); ?></h3> | ||||
|  | ||||
| 				<p><?php echo esc_html( __( "Contact Form 7 doesn’t store submitted messages anywhere. Therefore, you may lose important messages forever if your mail server has issues or you make a mistake in mail configuration.", 'contact-form-7' ) ); ?></p> | ||||
|  | ||||
| 				<p><?php /* translators: %s: link labeled 'Flamingo' */ echo sprintf( 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' ) ) ); ?></p> | ||||
| 			</div> | ||||
| <?php endif; ?> | ||||
|  | ||||
| 		</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' ); | ||||
| 	} | ||||
|  | ||||
| 	$vers = array_unique( $vers ); | ||||
|  | ||||
| 	update_user_meta( get_current_user_id(), | ||||
| 		'wpcf7_hide_welcome_panel_on', $vers ); | ||||
|  | ||||
| 	wp_die( 1 ); | ||||
| } | ||||
							
								
								
									
										291
									
								
								wp-content/plugins/contact-form-7/admin/js/scripts.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										291
									
								
								wp-content/plugins/contact-form-7/admin/js/scripts.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,291 @@ | ||||
| ( function( $ ) { | ||||
|  | ||||
| 	'use strict'; | ||||
|  | ||||
| 	if ( typeof wpcf7 === 'undefined' || wpcf7 === null ) { | ||||
| 		return; | ||||
| 	} | ||||
|  | ||||
| 	$( function() { | ||||
| 		var welcomePanel = $( '#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 ); | ||||
| 		} ); | ||||
|  | ||||
| 		$( '#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.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' ); | ||||
|  | ||||
| 			if ( errors[ section ] ) { | ||||
| 				var $list = $( '<ul></ul>' ).attr( { | ||||
| 					'role': 'alert', | ||||
| 					'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 ); | ||||
							
								
								
									
										249
									
								
								wp-content/plugins/contact-form-7/admin/js/tag-generator.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										249
									
								
								wp-content/plugins/contact-form-7/admin/js/tag-generator.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,249 @@ | ||||
| ( 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 ); | ||||
		Reference in New Issue
	
	Block a user