PDF rausgenommen

This commit is contained in:
aschwarz
2023-01-23 11:03:31 +01:00
parent 82d562a322
commit a6523903eb
28078 changed files with 4247552 additions and 2 deletions

View File

@ -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 );
}

View File

@ -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 &#8220;%s&#8221;', '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 )
);
}
}

View File

@ -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 &raquo; %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
}

View 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
}

View File

@ -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&#8217;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&#8217;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&#8217;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&#8217;t have corresponding form-tags. They are used to represent meta information of form submissions like the submitter&#8217;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 );
}
}

View File

@ -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>';
}
}
}
}

View File

@ -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&#8217;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&#8217;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&#8230;", 'contact-form-7' ) ); ?></h3>
<p><?php echo esc_html( __( "Contact Form 7 doesn&#8217;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 );
}