Gestionnaire de fichiers - Editer - /home/wwgoat/public_html/blog/admin.tar
Arrière
includes/welcome-panel.php 0000644 00000020715 14720700167 0011624 0 ustar 00 <?php abstract class WPCF7_WelcomePanelColumn { abstract protected function icon(); abstract protected function title(); abstract protected function content(); public function print_content() { $icon = sprintf( '<span class="dashicons dashicons-%s" aria-hidden="true"></span>', esc_attr( $this->icon() ) ); $title = sprintf( '<h3>%1$s %2$s</h3>', $icon, $this->title() ); $content = $this->content(); if ( is_array( $content ) ) { $content = implode( "\n\n", $content ); } $content = wp_kses_post( $content ); $content = wptexturize( $content ); $content = convert_chars( $content ); $content = wpautop( $content ); echo "\n"; echo '<div class="welcome-panel-column">'; echo $title; echo $content; echo '</div>'; } } class WPCF7_WelcomePanelColumn_AntiSpam extends WPCF7_WelcomePanelColumn { protected function icon() { return 'shield'; } protected function title() { return esc_html( __( "Getting spammed? You have protection.", 'contact-form-7' ) ); } protected function content() { return array( esc_html( __( "Spammers target everything; your contact forms are not an exception. Before you get spammed, protect your contact forms with the powerful anti-spam features Contact Form 7 provides.", 'contact-form-7' ) ), sprintf( /* translators: links labeled 1: 'Akismet', 2: 'reCAPTCHA', 3: 'disallowed list' */ esc_html( __( 'Contact Form 7 supports spam-filtering with %1$s. Intelligent %2$s blocks annoying spambots. Plus, using %3$s, you can block messages containing specified keywords or those sent from specified IP addresses.', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/spam-filtering-with-akismet/', 'contact-form-7' ), __( 'Akismet', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), __( 'reCAPTCHA', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/comment-blacklist/', 'contact-form-7' ), __( 'disallowed list', 'contact-form-7' ) ) ), ); } } class WPCF7_WelcomePanelColumn_Donation extends WPCF7_WelcomePanelColumn { protected function icon() { return 'megaphone'; } protected function title() { return esc_html( __( "Contact Form 7 needs your support.", 'contact-form-7' ) ); } protected function content() { return array( esc_html( __( "It is hard to continue development and support for this plugin without contributions from users like you.", 'contact-form-7' ) ), sprintf( /* translators: %s: link labeled 'making a donation' */ esc_html( __( 'If you enjoy using Contact Form 7 and find it useful, please consider %s.', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/donate/', 'contact-form-7' ), __( 'making a donation', 'contact-form-7' ) ) ), esc_html( __( "Your donation will help encourage and support the plugin’s continued development and better user support.", 'contact-form-7' ) ), ); } } class WPCF7_WelcomePanelColumn_Flamingo extends WPCF7_WelcomePanelColumn { protected function icon() { return 'editor-help'; } protected function title() { return esc_html( __( "Before you cry over spilt mail…", 'contact-form-7' ) ); } protected function content() { return array( esc_html( __( "Contact Form 7 does not store submitted messages anywhere. Therefore, you may lose important messages forever if your mail server has issues or you make a mistake in mail configuration.", 'contact-form-7' ) ), sprintf( /* translators: %s: link labeled 'Flamingo' */ esc_html( __( 'Install a message storage plugin before this happens to you. %s saves all messages through contact forms into the database. Flamingo is a free WordPress plugin created by the same author as Contact Form 7.', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/save-submitted-messages-with-flamingo/', 'contact-form-7' ), __( 'Flamingo', 'contact-form-7' ) ) ), ); } } class WPCF7_WelcomePanelColumn_Integration extends WPCF7_WelcomePanelColumn { protected function icon() { return 'superhero-alt'; } protected function title() { return esc_html( __( "You have strong allies to back you up.", 'contact-form-7' ) ); } protected function content() { return array( sprintf( /* translators: 1: link labeled 'Brevo' */ esc_html( __( 'Your contact forms will become more powerful and versatile by integrating them with external APIs. With CRM and email marketing services, you can build your own contact lists (%1$s).', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/sendinblue-integration/', 'contact-form-7' ), __( 'Brevo', 'contact-form-7' ) ) ), sprintf( /* translators: 1: link labeled 'reCAPTCHA', 2: link labeled 'Stripe' */ esc_html( __( 'With help from cloud-based machine learning, anti-spam services will protect your forms (%1$s). Even payment services are natively supported (%2$s).', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), __( 'reCAPTCHA', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/stripe-integration/', 'contact-form-7' ), __( 'Stripe', 'contact-form-7' ) ) ), ); } } function wpcf7_welcome_panel() { $columns = array(); $flamingo_is_active = defined( 'FLAMINGO_VERSION' ); $sendinblue_is_active = false; if ( class_exists( 'WPCF7_Sendinblue' ) and $sendinblue = WPCF7_Sendinblue::get_instance() ) { $sendinblue_is_active = $sendinblue->is_active(); } if ( $flamingo_is_active and $sendinblue_is_active ) { $columns[] = new WPCF7_WelcomePanelColumn_AntiSpam(); $columns[] = new WPCF7_WelcomePanelColumn_Donation(); } elseif ( $flamingo_is_active ) { $columns[] = new WPCF7_WelcomePanelColumn_Integration(); $columns[] = new WPCF7_WelcomePanelColumn_AntiSpam(); } elseif ( $sendinblue_is_active ) { $columns[] = new WPCF7_WelcomePanelColumn_Flamingo(); $columns[] = new WPCF7_WelcomePanelColumn_AntiSpam(); } else { $columns[] = new WPCF7_WelcomePanelColumn_Flamingo(); $columns[] = new WPCF7_WelcomePanelColumn_Integration(); } $classes = 'wpcf7-welcome-panel'; $vers = (array) get_user_meta( get_current_user_id(), 'wpcf7_hide_welcome_panel_on', true ); if ( wpcf7_version_grep( wpcf7_version( 'only_major=1' ), $vers ) ) { $classes .= ' hidden'; } ?> <div id="wpcf7-welcome-panel" class="<?php echo esc_attr( $classes ); ?>"> <?php wp_nonce_field( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce', false ); ?> <a class="welcome-panel-close" href="<?php echo esc_url( menu_page_url( 'wpcf7', false ) ); ?>"><?php echo esc_html( __( 'Dismiss', 'contact-form-7' ) ); ?></a> <div class="welcome-panel-content"> <div class="welcome-panel-column-container"> <?php foreach ( $columns as $column ) { $column->print_content(); } ?> </div> </div> </div> <?php } add_action( 'wp_ajax_wpcf7-update-welcome-panel', 'wpcf7_admin_ajax_welcome_panel', 10, 0 ); function wpcf7_admin_ajax_welcome_panel() { check_ajax_referer( 'wpcf7-welcome-panel-nonce', 'welcomepanelnonce' ); $vers = get_user_meta( get_current_user_id(), 'wpcf7_hide_welcome_panel_on', true ); if ( empty( $vers ) or ! is_array( $vers ) ) { $vers = array(); } if ( empty( $_POST['visible'] ) ) { $vers[] = wpcf7_version( 'only_major=1' ); } else { $vers = array_diff( $vers, array( wpcf7_version( 'only_major=1' ) ) ); } $vers = array_unique( $vers ); update_user_meta( get_current_user_id(), 'wpcf7_hide_welcome_panel_on', $vers ); wp_die( 1 ); } add_filter( 'screen_settings', 'wpcf7_welcome_panel_screen_settings', 10, 2 ); function wpcf7_welcome_panel_screen_settings( $screen_settings, $screen ) { if ( 'toplevel_page_wpcf7' !== $screen->id ) { return $screen_settings; } $vers = (array) get_user_meta( get_current_user_id(), 'wpcf7_hide_welcome_panel_on', true ); $checkbox_id = 'wpcf7-welcome-panel-show'; $checked = ! in_array( wpcf7_version( 'only_major=1' ), $vers ); $checkbox = sprintf( '<input %s />', wpcf7_format_atts( array( 'id' => $checkbox_id, 'type' => 'checkbox', 'checked' => $checked, ) ) ); $screen_settings .= sprintf( ' <fieldset class="wpcf7-welcome-panel-options"> <legend>%1$s</legend> <label for="%2$s">%3$s %4$s</label> </fieldset>', esc_html( __( 'Welcome panel', 'contact-form-7' ) ), esc_attr( $checkbox_id ), $checkbox, esc_html( __( 'Show welcome panel', 'contact-form-7' ) ) ); return $screen_settings; } includes/css/styles-rtl.css 0000644 00000002174 14720700167 0012006 0 ustar 00 /* * Tabs */ #contact-form-editor-tabs { padding: 9px 10px 0 15px; } /* * Form Tab */ .tag-generator-panel { text-align: right; } .tag-generator-dialog > .close-button { right: auto; left: 8px; } form.tag-generator-panel[data-version="1"] { .control-box > fieldset > legend { border: 1px solid #dfdfdf; border-right: 4px solid #00a0d2; } .insert-box input.tag { float: right; } .insert-box .submitbox input[type="button"] { float: left; } } /* * Mail Tab */ .contact-form-editor-box-mail span.mailtag { margin: 0 4px 0 0; } /* * Welcome Panel */ .wpcf7-welcome-panel .welcome-panel-close { left: 10px; right: auto; padding: 10px 21px 10px 15px; } .wpcf7-welcome-panel .welcome-panel-close::before { right: 0; left: auto; } .wpcf7-welcome-panel .welcome-panel-content { margin-right: 13px; } .wpcf7-welcome-panel .welcome-panel-column { float: right; padding: 0 0 0 2%; } /* * Integration */ .card { border-left: 1px solid #e5e5e5; border-right: 4px solid #e5e5e5; } .card img.icon { float: right; margin: 8px -8px 8px 8px; } .card h2.title { float: right; } .card .infobox { float: left; } includes/css/styles.css 0000644 00000023763 14720700167 0011216 0 ustar 00 #titlediv .inside p.description { margin: 8px 2px 0; } #titlediv .inside p.description label { cursor: pointer; } span.shortcode { display: block; margin: 2px 0; } span.shortcode.old { background: #777; color: #fff; } span.shortcode input { font-size: 12px; border: none; box-shadow: none; padding: 4px 8px; margin: 0; } #wpcf7-contact-form-list-table span.shortcode input, #wpcf7-contact-form-editor span.shortcode input { background: transparent; } #wpcf7-contact-form-list-table span.shortcode input { color: #444; } #wpcf7-contact-form-editor span.shortcode input { color: #fff; } #submitpost input.copy { margin-bottom: 10px; } #submitpost input.delete { padding: 0; margin: 0; border: none; cursor: pointer; background: inherit; color: #a00; } #submitpost input.delete:hover { color: #dc3232; /* Red */ } #submitpost input.delete:focus { outline: thin dotted; } .postbox-container .postbox h3 { border-bottom: 1px solid transparent; } 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; } #misc-publishing-actions .config-error { line-height: 2; } [data-config-field][aria-invalid="true"] { border-color: #dc3232; } #contact-form-editor-tabs li a .icon-in-circle, #contact-form-editor .config-error .icon-in-circle, .wp-list-table .config-error .icon-in-circle, .icon-in-circle { display: inline-block; vertical-align: baseline; 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.active { 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.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.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 button { font-size: 12px; height: 26px; line-height: 24px; margin: 2px; padding: 0 8px 1px; } .tag-generator-dialog { padding: 12px; border: 1px solid #c3c4c7; box-shadow: 0 1px 1px rgba( 0, 0, 0, 0.04 ); min-height: 720px; /* needed for Safari */ } .tag-generator-dialog::backdrop { background: rgb( 0 0 0 / 50% ); } .tag-generator-dialog > .close-button { position: absolute; top: 8px; right: 8px; } form.tag-generator-panel { display: flex; flex-direction: column; height: 720px; width: 720px; max-height: 100%; max-width: 100%; margin-block-end: 0; } form.tag-generator-panel[data-version="2"] { &:invalid .mail-tag-tip { display: none; } .description-box { box-sizing: border-box; flex: none; margin-inline: -12px; padding-inline: 12px; border-bottom: 1px solid #dfdfdf; } .control-box { box-sizing: border-box; flex: auto; display: flex; flex-direction: column; gap: 12px 0; overflow: scroll; } .control-box > fieldset { margin-block: 8px; margin-inline-start: 10em; line-height: 2.25; } .control-box > fieldset > legend { font-weight: bolder; margin-block: 8px; margin-inline-start: -10em; line-height: 1.25; } .control-box input[type="text"] { width: 20rem; max-width: 88%; } .control-box input[type="number"] { width: 8rem; max-width: 44%; } .control-box textarea { height: 12ex; width: 20rem; max-width: 88%; } .control-box select { width: 20rem; max-width: 88%; } .control-box input:invalid, .control-box textarea:invalid { background-color: #ffe9de; } .insert-box { box-sizing: border-box; flex: none; margin-block-end: -12px; margin-inline: -12px; padding-block: 24px 12px; padding-inline: 12px; background-color: #fcfcfc; border-top: 1px solid #dfdfdf; } .insert-box .flex-container { display: flex; } .insert-box .flex-container > [data-tag-part="tag"] { flex: auto; margin-inline-end: 8px; } .insert-box .mail-tag-tip::before { font: 1.2rem dashicons; content: "\f348"; color: #646970; padding-inline-end: 4px; vertical-align: top; } } form.tag-generator-panel[data-version="1"] { .control-box { padding: 0; margin: 0; overflow: auto; flex-grow: 1; } .control-box > fieldset > legend { border: 1px solid #dfdfdf; border-left: 4px solid #00a0d2; background: #f7fcfe; padding: 4px 12px; margin: 4px 0; line-height: 1.4em; width: 100%; box-sizing: border-box; } table { width: 100%; } table.form-table th { width: 120px; padding: 4px 10px 4px 0; font-size: 13px; } table.form-table td { padding: 4px 10px; font-size: 13px; } .control-box input.oneline { width: 200px; } .control-box input.large-text { width: 400px; } .control-box textarea.values { width: 200px; height: 6em; } .control-box input[type="number"], .control-box input[type="date"] { width: 88px; } .control-box table caption { text-align: left; font-size: 110%; font-weight: bold; color: #777; margin: 10px 0 5px; } .control-box table.form-table td label { line-height: 1.1em; } .control-box table.form-table td label .description { line-height: 1.4em; } .insert-box { margin: 0 -15px -15px; padding: 8px 16px; background-color: #fcfcfc; border-top: 1px solid #dfdfdf; overflow: auto; } .insert-box input.tag { width: 510px; float: left; background-color: transparent; box-shadow: none; } .insert-box .submitbox { padding: 0; } .insert-box .submitbox input[type="button"] { float: right; } .insert-box .description label { cursor: text; } } /* * Mail Tab */ .contact-form-editor-box-mail span.mailtag { display: inline-block; margin: 0 0 0 4px; padding: 1px 2px; cursor: pointer; color: #000; } .contact-form-editor-box-mail span.mailtag.used { color: #666; } .contact-form-editor-box-mail span.mailtag.unused { font-weight: bold; } /* * Messages Tab */ #messages-panel p.description { margin: 5px 0 10px; } /* * Tabs for integration modules */ #ctct-panel table tr.inactive ~ tr, #sendinblue-panel table tr.inactive ~ tr { display: none; } #ctct-panel .dashicons, #sendinblue-panel .dashicons { text-decoration: none; } #ctct-panel td p, #sendinblue-panel td p { margin-top: 12px; } /* * List Table */ .fixed .column-title { width: 38%; } .fixed .column-shortcode { width: 38%; } /* * Welcome Panel */ .wpcf7-welcome-panel { position: relative; overflow: auto; margin: 16px 0; padding: 23px 10px 0; border: 1px solid #c3c4c7; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); background: #fff; font-size: 13px; line-height: 1.7; } .wpcf7-welcome-panel h3 { font-size: 16px; font-weight: 600; line-height: 2.1em; margin: 1em 0 1.2em; } .wpcf7-welcome-panel h3 .dashicons { position: relative; top: -2px; display: inline-block; width: 60px; color: #575757; font-size: 40px; } .wpcf7-welcome-panel p { color: #646970; } .wpcf7-welcome-panel p a { font-weight: bold; } .wpcf7-welcome-panel .welcome-panel-close { position: absolute; z-index: 2; top: 10px; right: 10px; padding: 10px 15px 10px 21px; font-size: 13px; line-height: 1.23076923; /* Chrome rounding, needs to be 16px equivalent */ text-decoration: none; } .wpcf7-welcome-panel .welcome-panel-close::before { background: 0 0; color: #787c82; content: "\f153"; display: block; font: normal 16px/20px dashicons; speak: never; height: 20px; text-align: center; width: 20px; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; position: absolute; top: 8px; left: 0; transition: all .1s ease-in-out; } .wpcf7-welcome-panel .welcome-panel-content { display: block; margin-left: 13px; max-width: 1500px; min-height: auto; } .wpcf7-welcome-panel .welcome-panel-column-container { clear: both; position: relative; } .wpcf7-welcome-panel .welcome-panel-column { display: block; width: 48%; min-width: 200px; float: left; padding: 0 2% 0 0; margin: 0 0 1em 0; } @media screen and (max-width: 870px) { .wpcf7-welcome-panel .welcome-panel-column { display: block; float: none; width: 100%; } } .wpcf7-welcome-panel .welcome-panel-column p { margin-top: 7px; color: #3c434a; } /* * Integration */ .card { background: #fff none repeat scroll 0 0; border: 1px solid #e5e5e5; border-left: 4px solid #e5e5e5; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04); margin-top: 20px; max-width: 520px; min-width: 255px; padding: 0.7em 2em 1em; position: relative; } .card.active { border-color: #00a0d2; } .card img.icon { float: left; margin: 8px 8px 8px -8px; } .card h2.title { float: left; max-width: 240px; font-size: 1.3em; font-weight: 600; } .card .infobox { float: right; font-size: 13px; color: #666; margin: 1em; line-height: 1.5; max-width: 240px; } .card .inside .form-table th { padding: 15px 10px 15px 0; width: 160px; } .card .inside .form-table td { padding: 10px 10px; } .card .checkboxes li { margin: 0; } includes/editor.php 0000644 00000023713 14720700167 0010363 0 ustar 00 <?php class WPCF7_Editor { private $contact_form; private $panels = array(); public function __construct( WPCF7_ContactForm $contact_form ) { $this->contact_form = $contact_form; } public function add_panel( $panel_id, $title, $callback ) { if ( wpcf7_is_name( $panel_id ) ) { $this->panels[$panel_id] = array( 'title' => $title, 'callback' => $callback, ); } } public function display() { if ( empty( $this->panels ) ) { return; } $active_panel_id = trim( $_GET['active-tab'] ?? '' ); if ( ! array_key_exists( $active_panel_id, $this->panels ) ) { $active_panel_id = array_key_first( $this->panels ); } echo '<nav>'; echo '<ul id="contact-form-editor-tabs">'; foreach ( $this->panels as $panel_id => $panel ) { $active = $panel_id === $active_panel_id; echo sprintf( '<li %1$s><a %2$s>%3$s</a></li>', wpcf7_format_atts( array( 'id' => sprintf( '%s-tab', $panel_id ), 'class' => $active ? 'active' : null, 'tabindex' => $active ? '0' : '-1', 'data-panel' => $panel_id, ) ), wpcf7_format_atts( array( 'href' => sprintf( '#%s', $panel_id ), ) ), esc_html( $panel['title'] ) ); } echo '</ul>'; echo '</nav>'; foreach ( $this->panels as $panel_id => $panel ) { $active = $panel_id === $active_panel_id; echo sprintf( '<section %s>', wpcf7_format_atts( array( 'id' => $panel_id, 'class' => 'contact-form-editor-panel' . ( $active ? ' active' : '' ), ) ) ); if ( is_callable( $panel['callback'] ) ) { call_user_func( $panel['callback'], $this->contact_form ); } echo '</section>'; } } } 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, $options = '' ) { $options = wp_parse_args( $options, array( 'id' => 'wpcf7-mail', 'name' => 'mail', 'title' => __( 'Mail', 'contact-form-7' ), 'use' => null, ) ); $id = esc_attr( $options['id'] ); $mail = wp_parse_args( $post->prop( $options['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 esc_attr( $id ); ?>"> <h2><?php echo esc_html( $options['title'] ); ?></h2> <?php if ( ! empty( $options['use'] ) ) { echo sprintf( '<label %1$s><input %2$s /> %3$s</label>', wpcf7_format_atts( array( 'for' => sprintf( '%s-active', $id ), ) ), wpcf7_format_atts( array( 'type' => 'checkbox', 'id' => sprintf( '%s-active', $id ), 'name' => sprintf( '%s[active]', $id ), 'data-config-field' => '', 'data-toggle' => sprintf( '%s-fieldset', $id ), 'value' => '1', 'checked' => $mail['active'], ) ), esc_html( $options['use'] ) ); echo sprintf( '<p class="description">%s</p>', esc_html( __( "Mail (2) is an additional mail template often used as an autoresponder.", 'contact-form-7' ) ) ); } ?> <fieldset id="<?php echo esc_attr( sprintf( '%s-fieldset', $id ) ); ?>"> <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( $options['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( $options['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( $options['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( $options['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( $options['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( $options['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( $options['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 } includes/tag-generator.php 0000644 00000030447 14720700167 0011636 0 ustar 00 <?php /** * The base class for form-tag generators management. */ class WPCF7_TagGenerator { private static $instance; private $panels = array(); private function __construct() {} /** * Returns the singleton instance of this class. */ public static function get_instance() { if ( empty( self::$instance ) ) { self::$instance = new self; } return self::$instance; } /** * Adds a form-tag generator instance. */ public function add( $id, $title, $callback, $options = '' ) { $id = trim( $id ); if ( '' === $id or ! wpcf7_is_name( $id ) or ! is_callable( $callback ) ) { return false; } $options = wp_parse_args( $options, array( 'version' => '1', ) ); $this->panels[$id] = array( 'title' => $title, 'content' => 'tag-generator-panel-' . $id, 'options' => $options, 'callback' => $callback, ); if ( version_compare( $options['version'], '2', '<' ) ) { $message = sprintf( /* translators: 1: version, 2: tag generator title */ __( 'Use of tag generator instances older than version 2 is deprecated. Version %1$s instance (%2$s) detected.', 'contact-form-7' ), $options['version'], $title ); wp_trigger_error( __METHOD__, $message, E_USER_DEPRECATED ); } return true; } /** * Renders form-tag generator calling buttons. */ public function print_buttons() { echo '<span id="tag-generator-list" class="hide-if-no-js">'; foreach ( (array) $this->panels as $panel ) { echo sprintf( '<button %1$s>%2$s</button>', wpcf7_format_atts( array( 'type' => 'button', 'data-taggen' => 'open-dialog', 'data-target' => $panel['content'], 'title' => sprintf( /* translators: %s: title of form-tag */ __( 'Form-tag Generator: %s', 'contact-form-7' ), $panel['title'] ), ) ), esc_html( $panel['title'] ) ); } echo '</span>'; } /** * Renders form-tag generator dialog panels (hidden until called). */ public function print_panels( WPCF7_ContactForm $contact_form ) { foreach ( (array) $this->panels as $id => $panel ) { $callback = $panel['callback']; $options = array_merge( $panel['options'], array( 'id' => $id, 'title' => $panel['title'], 'content' => $panel['content'], ) ); if ( is_callable( $callback ) ) { echo "\n"; echo sprintf( '<dialog id="%s" class="tag-generator-dialog">', esc_attr( $options['content'] ) ); echo "\n"; echo sprintf( '<button %1$s>%2$s</button>', wpcf7_format_atts( array( 'class' => 'close-button', 'title' => __( 'Close this dialog box', 'contact-form-7' ), 'data-taggen' => 'close-dialog', ) ), esc_html( __( 'Close', 'contact-form-7' ) ) ); echo "\n"; echo sprintf( '<form %s>', wpcf7_format_atts( array( 'method' => 'dialog', 'class' => 'tag-generator-panel', 'data-id' => $options['id'], 'data-version' => $options['version'], ) ) ); echo "\n"; call_user_func( $callback, $contact_form, $options ); echo "\n"; echo '</form>'; echo "\n"; echo '</dialog>'; echo "\n\n"; } } } } /** * Class helps to implement a form-tag generator content. */ class WPCF7_TagGeneratorGenerator { private $key = ''; /** * The constructor. */ public function __construct( $key ) { $this->key = $key; } /** * Returns a unique reference ID. */ public function ref( $suffix = '' ) { $ref = sprintf( '%s-%s', $this->key, $suffix ); $ref = strtolower( $ref ); $ref = preg_replace( '/[^0-9a-z-]/', '', $ref ); $ref = preg_replace( '/[-]+/', '-', $ref ); $ref = trim( $ref, '-' ); return $ref; } /** * Calls one of the template methods. */ public function print( $part, $options = '' ) { if ( is_callable( array( $this, $part ) ) ) { call_user_func( array( $this, $part ), $options ); } } /** * Template method for field type field. */ private function field_type( $options = '' ) { $options = wp_parse_args( $options, array( 'with_required' => false, 'select_options' => array(), ) ); ?> <fieldset> <legend id="<?php echo esc_attr( $this->ref( 'type-legend' ) ); ?>"><?php echo esc_html( __( 'Field type', 'contact-form-7' ) ); ?></legend> <select data-tag-part="basetype" aria-labelledby="<?php echo esc_attr( $this->ref( 'type-legend' ) ); ?>"><?php foreach ( (array) $options['select_options'] as $basetype => $title ) { echo sprintf( '<option %1$s>%2$s</option>', wpcf7_format_atts( array( 'value' => $basetype, ) ), esc_html( $title ) ); } ?></select> <?php if ( $options['with_required'] ) { ?> <br /> <label> <input type="checkbox" data-tag-part="type-suffix" value="*" /> <?php echo esc_html( __( "This is a required field.", 'contact-form-7' ) ); ?> </label> <?php } ?> </fieldset> <?php } /** * Template method for field name field. */ private function field_name( $options = '' ) { $options = wp_parse_args( $options, array( 'ask_if' => '', ) ); ?> <fieldset> <legend id="<?php echo esc_attr( $this->ref( 'name-legend' ) ); ?>"><?php echo esc_html( __( 'Field name', 'contact-form-7' ) ); ?></legend> <input type="text" data-tag-part="name" pattern="[A-Za-z][A-Za-z0-9_\-]*" aria-labelledby="<?php echo esc_attr( $this->ref( 'name-legend' ) ); ?>" /> <?php $tag_option = $label = ''; if ( 'author_name' === $options['ask_if'] ) { $tag_option = 'autocomplete:name'; if ( wpcf7_akismet_is_available() ) { $tag_option .= ' akismet:author'; } $label = __( "This field expects the submitter name.", 'contact-form-7' ); } elseif ( 'author_email' === $options['ask_if'] ) { $tag_option = 'autocomplete:email'; if ( wpcf7_akismet_is_available() ) { $tag_option .= ' akismet:author_email'; } $label = __( "This field expects the submitter email.", 'contact-form-7' ); } elseif ( 'author_url' === $options['ask_if'] ) { $tag_option = 'autocomplete:url'; if ( wpcf7_akismet_is_available() ) { $tag_option .= ' akismet:author_url'; } $label = __( "This field expects the submitter URL.", 'contact-form-7' ); } elseif ( 'author_tel' === $options['ask_if'] ) { $tag_option = 'autocomplete:tel'; $label = __( "This field expects the submitter telephone number.", 'contact-form-7' ); } if ( $tag_option ) { ?> <br /> <label> <input type="checkbox" data-tag-part="option" data-tag-option="<?php echo esc_attr( $tag_option ); ?>" /> <?php echo esc_html( $label ); ?> </label> <?php } ?> </fieldset> <?php } /** * Template method for ID attribute option field. */ private function id_attr( $options = '' ) { ?> <fieldset> <legend id="<?php echo esc_attr( $this->ref( 'id-legend' ) ); ?>"><?php echo esc_html( __( 'ID attribute', 'contact-form-7' ) ); ?></legend> <input type="text" data-tag-part="option" data-tag-option="id:" pattern="[A-Za-z][A-Za-z0-9_\-]*" aria-labelledby="<?php echo esc_attr( $this->ref( 'id-legend' ) ); ?>" /> </fieldset> <?php } /** * Template method for class attribute option field. */ private function class_attr( $options = '' ) { ?> <fieldset> <legend id="<?php echo esc_attr( $this->ref( 'class-legend' ) ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></legend> <input type="text" data-tag-part="option" data-tag-option="class:" pattern="[A-Za-z0-9_\-\s]*" aria-labelledby="<?php echo esc_attr( $this->ref( 'class-legend' ) ); ?>" /> </fieldset> <?php } /** * Template method for min/max options. */ private function min_max( $options = '' ) { $options = wp_parse_args( $options, array( 'type' => 'number', 'title' => __( 'Length', 'contact-form-7' ), 'min_option' => 'minlength:', 'max_option' => 'maxlength:', 'accept_minus' => false, ) ); ?> <fieldset> <legend><?php echo esc_html( $options['title'] ); ?></legend> <label><?php echo esc_html( __( 'Min', 'contact-form-7' ) ) . "\n"; echo sprintf( '<input %s />', wpcf7_format_atts( array( 'type' => $options['type'], 'data-tag-part' => 'option', 'data-tag-option' => $options['min_option'], 'min' => $options['accept_minus'] ? null : 0, ) ) ); ?></label> ⇔ <label><?php echo esc_html( __( 'Max', 'contact-form-7' ) ) . "\n"; echo sprintf( '<input %s />', wpcf7_format_atts( array( 'type' => $options['type'], 'data-tag-part' => 'option', 'data-tag-option' => $options['max_option'], 'min' => $options['accept_minus'] ? null : 0, ) ) ); ?></label> </fieldset> <?php } /** * Template method for default value field. */ private function default_value( $options = '' ) { $options = wp_parse_args( $options, array( 'type' => 'text', 'title' => __( 'Default value', 'contact-form-7' ), 'with_placeholder' => false, 'use_content' => false, ) ); ?> <fieldset> <legend id="<?php echo esc_attr( $this->ref( 'value-legend' ) ); ?>"><?php echo esc_html( $options['title'] ); ?></legend> <?php echo sprintf( '<input %s />', wpcf7_format_atts( array( 'type' => $options['type'], 'data-tag-part' => $options['use_content'] ? 'content' : 'value', 'aria-labelledby' => $this->ref( 'value-legend' ), ) ) ); ?> <?php if ( $options['with_placeholder'] ) { ?> <br /> <label> <input type="checkbox" data-tag-part="option" data-tag-option="placeholder" /> <?php echo esc_html( __( "Use this text as the placeholder.", 'contact-form-7' ) ); ?> </label> <?php } ?> </fieldset> <?php } /** * Template method for selectable values useful for checkboxes or a menu. */ private function selectable_values( $options = '' ) { $options = wp_parse_args( $options, array( 'first_as_label' => false, 'use_label_element' => false, ) ); ?> <fieldset> <legend id="<?php echo esc_attr( $this->ref( 'selectable-values-legend' ) ); ?>"><?php echo esc_html( __( 'Selectable values', 'contact-form-7' ) ); ?></legend> <?php echo sprintf( '<span %1$s>%2$s</span>', wpcf7_format_atts( array( 'id' => $this->ref( 'selectable-values-description' ), ) ), esc_html( __( "One item per line.", 'contact-form-7' ) ) ); ?> <br /> <?php echo sprintf( '<textarea %1$s>%2$s</textarea>', wpcf7_format_atts( array( 'required' => true, 'data-tag-part' => 'value', 'aria-labelledby' => $this->ref( 'selectable-values-legend' ), 'aria-describedby' => $this->ref( 'selectable-values-description' ), ) ), esc_html( __( "Option 1\nOption 2\nOption 3", 'contact-form-7' ) ) ); ?> <?php if ( $options['first_as_label'] ) { ?> <br /> <?php echo sprintf( '<label><input %1$s /> %2$s</label>', wpcf7_format_atts( array( 'type' => 'checkbox', 'checked' => 'checked' === $options['first_as_label'], 'data-tag-part' => 'option', 'data-tag-option' => 'first_as_label', ) ), esc_html( __( "Use the first item as a label.", 'contact-form-7' ) ) ); ?> <?php } ?> <?php if ( $options['use_label_element'] ) { ?> <br /> <?php echo sprintf( '<label><input %1$s /> %2$s</label>', wpcf7_format_atts( array( 'type' => 'checkbox', 'checked' => 'checked' === $options['use_label_element'], 'data-tag-part' => 'option', 'data-tag-option' => 'use_label_element', ) ), esc_html( __( "Wrap each item with a label element.", 'contact-form-7' ) ) ); ?> <?php } ?> </fieldset> <?php } /** * Template method for insert-box content including the result form-tag. */ private function insert_box_content( $options = '' ) { ?> <div class="flex-container"> <?php echo sprintf( '<input %s />', wpcf7_format_atts( array( 'type' => 'text', 'class' => 'code', 'readonly' => true, 'onfocus' => 'this.select();', 'data-tag-part' => 'tag', 'aria-label' => __( "The form-tag to be inserted into the form template", 'contact-form-7' ), ) ) ); ?> <button type="button" class="button button-primary" data-taggen="insert-tag"><?php echo esc_html( __( 'Insert Tag', 'contact-form-7' ) ); ?></button> </div> <?php } /** * Template method for a tip message about mail-tag. */ private function mail_tag_tip( $options = '' ) { $tip = sprintf( /* translators: %s: mail-tag corresponding to the form-tag */ esc_html( __( 'To use the user input in the email, insert the corresponding mail-tag %s into the email template.', 'contact-form-7' ) ), '<strong data-tag-part="mail-tag"></strong>' ); ?> <p class="mail-tag-tip"><?php echo $tip; ?></p> <?php } } includes/admin-functions.php 0000644 00000001104 14720700167 0012161 0 ustar 00 <?php function wpcf7_current_action() { if ( isset( $_REQUEST['action'] ) and -1 != $_REQUEST['action'] ) { return $_REQUEST['action']; } if ( isset( $_REQUEST['action2'] ) and -1 != $_REQUEST['action2'] ) { return $_REQUEST['action2']; } return false; } function wpcf7_admin_has_edit_cap() { return current_user_can( 'wpcf7_edit_contact_forms' ); } function wpcf7_add_tag_generator( $name, $title, $elm_id, $callback, $options = array() ) { $tag_generator = WPCF7_TagGenerator::get_instance(); return $tag_generator->add( $name, $title, $callback, $options ); } includes/help-tabs.php 0000644 00000015534 14720700167 0010756 0 ustar 00 <?php class WPCF7_Help_Tabs { private $screen; public function __construct( WP_Screen $screen ) { $this->screen = $screen; } public function set_help_tabs( $screen_type ) { switch ( $screen_type ) { case 'list': $this->screen->add_help_tab( array( 'id' => 'list_overview', 'title' => __( 'Overview', 'contact-form-7' ), 'content' => $this->content( 'list_overview' ), ) ); $this->screen->add_help_tab( array( 'id' => 'list_available_actions', 'title' => __( 'Available Actions', 'contact-form-7' ), 'content' => $this->content( 'list_available_actions' ), ) ); $this->sidebar(); return; case 'edit': $this->screen->add_help_tab( array( 'id' => 'edit_overview', 'title' => __( 'Overview', 'contact-form-7' ), 'content' => $this->content( 'edit_overview' ), ) ); $this->screen->add_help_tab( array( 'id' => 'edit_form_tags', 'title' => __( 'Form-tags', 'contact-form-7' ), 'content' => $this->content( 'edit_form_tags' ), ) ); $this->screen->add_help_tab( array( 'id' => 'edit_mail_tags', 'title' => __( 'Mail-tags', 'contact-form-7' ), 'content' => $this->content( 'edit_mail_tags' ), ) ); $this->sidebar(); return; case 'integration': $this->screen->add_help_tab( array( 'id' => 'integration_overview', 'title' => __( 'Overview', 'contact-form-7' ), 'content' => $this->content( 'integration_overview' ), ) ); $this->sidebar(); return; } } private function content( $name ) { $content = array(); $content['list_overview'] = '<p>' . __( "On this screen, you can manage contact forms provided by Contact Form 7. You can manage an unlimited number of contact forms. Each contact form has a unique ID and Contact Form 7 shortcode ([contact-form-7 ...]). To insert a contact form into a post or a text widget, insert the shortcode into the target.", 'contact-form-7' ) . '</p>'; $content['list_available_actions'] = '<p>' . __( "Hovering over a row in the contact forms list will display action links that allow you to manage your contact form. You can perform the following actions:", 'contact-form-7' ) . '</p>'; $content['list_available_actions'] .= '<p>' . __( "<strong>Edit</strong> - Navigates to the editing screen for that contact form. You can also reach that screen by clicking on the contact form title.", 'contact-form-7' ) . '</p>'; $content['list_available_actions'] .= '<p>' . __( "<strong>Duplicate</strong> - Clones that contact form. A cloned contact form inherits all content from the original, but has a different ID.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] = '<p>' . __( "On this screen, you can edit a contact form. A contact form is comprised of the following components:", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Title</strong> is the title of a contact form. This title is only used for labeling a contact form, and can be edited.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Form</strong> is a content of HTML form. You can use arbitrary HTML, which is allowed inside a form element. You can also use Contact Form 7’s form-tags here.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Mail</strong> manages a mail template (headers and message body) that this contact form will send when users submit it. You can use Contact Form 7’s mail-tags here.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Mail (2)</strong> is an additional mail template that works similar to Mail. Mail (2) is different in that it is sent only when Mail has been sent successfully.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "In <strong>Messages</strong>, you can edit various types of messages used for this contact form. These messages are relatively short messages, like a validation error message you see when you leave a required field blank.", 'contact-form-7' ) . '</p>'; $content['edit_overview'] .= '<p>' . __( "<strong>Additional Settings</strong> provides a place where you can customize the behavior of this contact form by adding code snippets.", 'contact-form-7' ) . '</p>'; $content['edit_form_tags'] = '<p>' . __( "A form-tag is a short code enclosed in square brackets used in a form content. A form-tag generally represents an input field, and its components can be separated into four parts: type, name, options, and values. Contact Form 7 supports several types of form-tags including text fields, number fields, date fields, checkboxes, radio buttons, menus, file-uploading fields, CAPTCHAs, and quiz fields.", 'contact-form-7' ) . '</p>'; $content['edit_form_tags'] .= '<p>' . __( "While form-tags have a comparatively complex syntax, you do not need to know the syntax to add form-tags because you can use the straightforward tag generator (<strong>Generate Tag</strong> button on this screen).", 'contact-form-7' ) . '</p>'; $content['edit_mail_tags'] = '<p>' . __( "A mail-tag is also a short code enclosed in square brackets that you can use in every Mail and Mail (2) field. A mail-tag represents a user input value through an input field of a corresponding form-tag.", 'contact-form-7' ) . '</p>'; $content['edit_mail_tags'] .= '<p>' . __( "There are also special mail-tags that have specific names, but do not have corresponding form-tags. They are used to represent meta information of form submissions like the submitter’s IP address or the URL of the page.", 'contact-form-7' ) . '</p>'; $content['integration_overview'] = '<p>' . __( "On this screen, you can manage services that are available through Contact Form 7. Using API will allow you to collaborate with any services that are available.", 'contact-form-7' ) . '</p>'; $content['integration_overview'] .= '<p>' . __( "You may need to first sign up for an account with the service that you plan to use. When you do so, you would need to authorize Contact Form 7 to access the service with your account.", 'contact-form-7' ) . '</p>'; $content['integration_overview'] .= '<p>' . __( "Any information you provide will not be shared with service providers without your authorization.", 'contact-form-7' ) . '</p>'; if ( ! empty( $content[$name] ) ) { return $content[$name]; } } public function sidebar() { $content = '<p><strong>' . __( 'For more information:', 'contact-form-7' ) . '</strong></p>'; $content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/docs/', 'contact-form-7' ), __( 'Docs', 'contact-form-7' ) ) . '</p>'; $content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/faq/', 'contact-form-7' ), __( 'FAQ', 'contact-form-7' ) ) . '</p>'; $content .= '<p>' . wpcf7_link( __( 'https://contactform7.com/support/', 'contact-form-7' ), __( 'Support', 'contact-form-7' ) ) . '</p>'; $this->screen->set_help_sidebar( $content ); } } includes/class-contact-forms-list-table.php 0000644 00000013323 14720700167 0015011 0 ustar 00 <?php if ( ! class_exists( 'WP_List_Table' ) ) { require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' ); } class WPCF7_Contact_Form_List_Table extends WP_List_Table { public static function define_columns() { $columns = array( 'cb' => '<input type="checkbox" />', 'title' => __( 'Title', 'contact-form-7' ), 'shortcode' => __( 'Shortcode', 'contact-form-7' ), 'author' => __( 'Author', 'contact-form-7' ), 'date' => __( 'Date', 'contact-form-7' ), ); return $columns; } public function __construct() { parent::__construct( array( 'singular' => 'post', 'plural' => 'posts', 'ajax' => false, ) ); } public function prepare_items() { $current_screen = get_current_screen(); $per_page = $this->get_items_per_page( 'wpcf7_contact_forms_per_page' ); $args = array( 'posts_per_page' => $per_page, 'orderby' => 'title', 'order' => 'ASC', 'offset' => ( $this->get_pagenum() - 1 ) * $per_page, ); if ( ! empty( $_REQUEST['s'] ) ) { $args['s'] = $_REQUEST['s']; } if ( ! empty( $_REQUEST['orderby'] ) ) { if ( 'title' == $_REQUEST['orderby'] ) { $args['orderby'] = 'title'; } elseif ( 'author' == $_REQUEST['orderby'] ) { $args['orderby'] = 'author'; } elseif ( 'date' == $_REQUEST['orderby'] ) { $args['orderby'] = 'date'; } } if ( ! empty( $_REQUEST['order'] ) ) { if ( 'asc' == strtolower( $_REQUEST['order'] ) ) { $args['order'] = 'ASC'; } elseif ( 'desc' == strtolower( $_REQUEST['order'] ) ) { $args['order'] = 'DESC'; } } $this->items = WPCF7_ContactForm::find( $args ); $total_items = WPCF7_ContactForm::count(); $total_pages = ceil( $total_items / $per_page ); $this->set_pagination_args( array( 'total_items' => $total_items, 'total_pages' => $total_pages, 'per_page' => $per_page, ) ); } public function get_columns() { return get_column_headers( get_current_screen() ); } protected function get_sortable_columns() { $columns = array( 'title' => array( 'title', true ), 'author' => array( 'author', false ), 'date' => array( 'date', false ), ); return $columns; } protected function get_bulk_actions() { $actions = array( 'delete' => __( 'Delete', 'contact-form-7' ), ); return $actions; } protected function column_default( $item, $column_name ) { return ''; } public function column_cb( $item ) { return sprintf( '<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item->id() ); } public function column_title( $item ) { $edit_link = add_query_arg( array( 'post' => absint( $item->id() ), 'action' => 'edit', ), menu_page_url( 'wpcf7', false ) ); $output = sprintf( '<a class="row-title" href="%1$s" aria-label="%2$s">%3$s</a>', esc_url( $edit_link ), esc_attr( sprintf( /* translators: %s: title of contact form */ __( 'Edit “%s”', 'contact-form-7' ), $item->title() ) ), esc_html( $item->title() ) ); $output = sprintf( '<strong>%s</strong>', $output ); if ( wpcf7_validate_configuration() and current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) { $config_validator = new WPCF7_ConfigValidator( $item ); $config_validator->restore(); if ( $count_errors = $config_validator->count_errors() ) { $error_notice = sprintf( _n( /* translators: %s: number of errors detected */ '%s configuration error detected', '%s configuration errors detected', $count_errors, 'contact-form-7' ), number_format_i18n( $count_errors ) ); $output .= sprintf( '<div class="config-error"><span class="icon-in-circle" aria-hidden="true">!</span> %s</div>', $error_notice ); } } return $output; } protected function handle_row_actions( $item, $column_name, $primary ) { if ( $column_name !== $primary ) { return ''; } $edit_link = add_query_arg( array( 'post' => absint( $item->id() ), 'action' => 'edit', ), menu_page_url( 'wpcf7', false ) ); $actions = array( 'edit' => wpcf7_link( $edit_link, __( 'Edit', 'contact-form-7' ) ), ); if ( current_user_can( 'wpcf7_edit_contact_form', $item->id() ) ) { $copy_link = add_query_arg( array( 'post' => absint( $item->id() ), 'action' => 'copy', ), menu_page_url( 'wpcf7', false ) ); $copy_link = wp_nonce_url( $copy_link, 'wpcf7-copy-contact-form_' . absint( $item->id() ) ); $actions = array_merge( $actions, array( 'copy' => wpcf7_link( $copy_link, __( 'Duplicate', 'contact-form-7' ) ), ) ); } return $this->row_actions( $actions ); } public function column_author( $item ) { $post = get_post( $item->id() ); if ( ! $post ) { return; } $author = get_userdata( $post->post_author ); if ( false === $author ) { return; } return esc_html( $author->display_name ); } public function column_shortcode( $item ) { $shortcodes = array( $item->shortcode() ); $output = ''; foreach ( $shortcodes as $shortcode ) { $output .= "\n" . '<span class="shortcode"><input type="text"' . ' onfocus="this.select();" readonly="readonly"' . ' value="' . esc_attr( $shortcode ) . '"' . ' class="large-text code" /></span>'; } return trim( $output ); } public function column_date( $item ) { $datetime = get_post_datetime( $item->id() ); if ( false === $datetime ) { return ''; } $t_time = sprintf( /* translators: 1: date, 2: time */ __( '%1$s at %2$s', 'contact-form-7' ), /* translators: date format, see https://www.php.net/date */ $datetime->format( __( 'Y/m/d', 'contact-form-7' ) ), /* translators: time format, see https://www.php.net/date */ $datetime->format( __( 'g:i a', 'contact-form-7' ) ) ); return $t_time; } } includes/js/index.js 0000644 00000031114 14720700167 0010437 0 ustar 00 (()=>{"use strict";var e={n:t=>{var a=t&&t.__esModule?()=>t.default:()=>t;return e.d(a,{a}),a},d:(t,a)=>{for(var r in a)e.o(a,r)&&!e.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:a[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const t=window.wp.i18n,a=e=>{e&&document.querySelector(`.contact-form-editor-panel#${e}`)&&(document.querySelector("#contact-form-editor")?.setAttribute("data-active-tab",e),document.querySelectorAll('input[name="active-tab"]').forEach((t=>{t.value=e})),document.querySelectorAll("#contact-form-editor-tabs li").forEach((t=>{t.dataset?.panel===e?(t.classList.add("active"),t.setAttribute("tabindex","0"),t.focus()):(t.classList.remove("active"),t.setAttribute("tabindex","-1"))})),document.querySelectorAll(".contact-form-editor-panel").forEach((t=>{t.id===e?(t.classList.add("active"),t.style.setProperty("display","block")):(t.classList.remove("active"),t.style.setProperty("display","none"))})))},r=window.wp.apiFetch;var c=e.n(r);const o=e=>{const t=document.createElement("span");return t.classList.add("icon-in-circle"),t.setAttribute("aria-hidden","true"),t.append(e),t},n=e=>e.replace(/[^0-9a-z]+/gi,"-"),l=e=>{const t=document.querySelector(`#${e.dataset?.toggle}`);t&&(e.checked?t.classList.remove("hidden"):t.classList.add("hidden"))},i=()=>{document.querySelectorAll("#contact-form-editor .config-error, #misc-publishing-actions .config-error").forEach((e=>{e.remove()})),document.querySelectorAll("#contact-form-editor [data-config-field]").forEach((e=>{const t=e.dataset.configField;d(t).length?(e.setAttribute("aria-invalid","true"),e.setAttribute("aria-describedby",n(`wpcf7-config-error-for-${t}`)),e.after(u(t))):e.removeAttribute("aria-invalid")})),document.querySelectorAll("#contact-form-editor-tabs [data-panel]").forEach((e=>{e.querySelectorAll(".icon-in-circle").forEach((e=>{e.remove()})),s(e.dataset.panel)&&e.querySelector("a")?.append(o("!"))}));let e=0;if(document.querySelectorAll("#contact-form-editor .contact-form-editor-panel").forEach((a=>{const r=s(a.id);if(r){e+=r;const c=document.createElement("div");c.classList.add("config-error"),c.append(o("!"),(0,t.sprintf)((0,t._n)("%d configuration error detected in this tab panel.","%d configuration errors detected in this tab panel.",r,"contact-form-7"),r)),a.prepend(c)}})),e){const a=document.createElement("div");a.classList.add("misc-pub-section","config-error");const r=document.createElement("a");r.setAttribute("href",wpcf7.configValidator.docUrl),r.append((0,t.__)("How to resolve?","contact-form-7")),a.append(o("!"),(0,t.sprintf)((0,t._n)("%d configuration error detected.","%d configuration errors detected.",e,"contact-form-7"),e),document.createElement("br"),r),document.querySelector("#misc-publishing-actions")?.append(a)}},s=e=>document.querySelectorAll(`#${e} ul.config-error li`)?.length,d=e=>{const t=[];for(const a in wpcf7.configValidator.errors)a===e&&t.push(...wpcf7.configValidator.errors[a]);return t},u=e=>{if(!e)return"";const t=document.createElement("ul");return t.setAttribute("id",n(`wpcf7-config-error-for-${e}`)),t.classList.add("config-error"),d(e).forEach((e=>{if(!e.message)return;const a=document.createElement("li");if(a.append(o("!")),e.link){const t=document.createElement("a");t.setAttribute("href",e.link),t.append(e.message),a.append(" ",t)}else a.append(" ",e.message);t.append(a)})),t},m=document.querySelector("#wpcf7-welcome-panel"),p=e=>{const t=m.querySelector("#welcomepanelnonce")?.value;if(!t)return;const a=new FormData;a.append("action","wpcf7-update-welcome-panel"),a.append("visible",e),a.append("welcomepanelnonce",t),fetch(new Request(ajaxurl,{method:"POST",body:a})),e?m.classList.remove("hidden"):m.classList.add("hidden")},f=e=>{var t;const a=e.dataset.id,r=e.querySelector('[name="name"]');let c=null!==(t=r?.value.trim())&&void 0!==t?t:"";r&&(c||(c=`${a}-${Math.floor(1e3*Math.random())}`),r.value=c),e.querySelectorAll(".tag").forEach((t=>{const a=e.querySelector('[name="tagtype"]')?.value||t.name;a&&(t.value=v(a,e))})),e.querySelectorAll("span.mail-tag").forEach((e=>{e.innerText=`[${c}]`})),e.querySelectorAll("input.mail-tag").forEach((e=>{e.value=`[${c}]`}))},v=(e,t)=>{var a,r,c;const o=null!==(a=t.querySelector(`.scope.${e}`))&&void 0!==a?a:t,n=e+(t.querySelector('[name="required"]:checked')?"*":""),l=null!==(r=t.querySelector('[name="name"]')?.value)&&void 0!==r?r:"",i=[];o.querySelectorAll(".option").forEach((e=>{"checkbox"===e.type?e.checked&&i.push(e.name):"radio"===e.type?e.checked&&!e.classList.contains("default")&&i.push(`${e.name}:${e.value}`):""!==e.value&&(e.classList.contains("filetype")?i.push(`${e.name}:${e.value.split(/[,|\s]+/).join("|")}`):e.classList.contains("color")?i.push(`${e.name}:#${e.value}`):"class"===e.name?e.value.split(" ").forEach((e=>{i.push(`class:${e}`)})):i.push(`${e.name}:${e.value}`))})),"radio"===e&&i.push("default:1");const s=null!==(c=o.querySelector('[name="values"]')?.value.split("\n").map((e=>e.trim())).filter((e=>""!==e)).map((e=>`"${e.replace(/["]/g,""")}"`)))&&void 0!==c?c:[],d=[n,l,i.join(" "),s.join(" ")].map((e=>e.trim())).filter((e=>""!==e)),u=o.querySelector('[name="content"]')?.value.trim();return u?`[${d.join(" ")}] ${u} [/${n}]`:`[${d.join(" ")}]`},g=e=>{const t=h(e);t?(e.querySelectorAll('[data-tag-part="tag"]').forEach((e=>{e.value=t})),e.querySelectorAll('[data-taggen="insert-tag"]').forEach((e=>{e.disabled=!1})),e.querySelectorAll('[data-tag-part="mail-tag"]').forEach((t=>{const a=e.querySelector('[data-tag-part="name"]');a&&(t.innerText=`[${a.value.trim()}]`)}))):(e.querySelectorAll('[data-tag-part="tag"]').forEach((e=>{e.value=""})),e.querySelectorAll('[data-taggen="insert-tag"]').forEach((e=>{e.disabled=!0})))},h=e=>{var t,a;const r=e.querySelector('[data-tag-part="basetype"]')?.value.trim();if(!r)return;if(e.querySelector(":invalid"))return;let c=r;const o=e.querySelector('[data-tag-part="type-suffix"]');o&&(["checkbox","radio"].includes(o?.type)?c+=o.checked?o.value.trim():"":c+=o.value.trim());const n=e.querySelector('[data-tag-part="name"]');let l=null!==(t=n?.value.trim())&&void 0!==t?t:"";n&&(l||(l=`${r}-${Math.floor(1e3*Math.random())}`),n.value=l);const i=[];e.querySelectorAll('[data-tag-part="option"]').forEach((e=>{const t=e.dataset.tagOption?.trim();t&&(["checkbox","radio"].includes(e?.type)&&!e.checked||t.split(" ").forEach((t=>{t.endsWith(":")?e.value?.split(" ").forEach((e=>{(e=e.trim())&&i.push(t+e)})):i.push(t)})))}));const s=null!==(a=e.querySelector('[data-tag-part="value"]')?.value.split("\n").map((e=>e.trim())).filter((e=>""!==e)).map((e=>`"${e.replace(/["]/g,""")}"`)))&&void 0!==a?a:[],d=[c,l,i.join(" "),s.join(" ")].map((e=>e.trim())).filter((e=>""!==e)),u=e.querySelector('[data-tag-part="content"]')?.value.trim();return u?`[${d.join(" ")}] ${u} [/${c}]`:`[${d.join(" ")}]`},y=e=>{const t=document.querySelector("#wpcf7-admin-form-element");if(!t)return;let a=!1;t.querySelectorAll("input, textarea, select").forEach((e=>{if(!a)switch(e.type){case"button":case"hidden":case"image":case"reset":case"search":case"submit":break;case"checkbox":case"radio":a=e.defaultChecked!==e.checked;break;case"select-multiple":case"select-one":e.querySelectorAll("option").forEach((e=>{a||e.defaultSelected===e.selected||(a=!0)}));break;default:a=e.defaultValue!==e.value}})),a&&e.preventDefault()};document.addEventListener("DOMContentLoaded",(e=>{document.querySelectorAll("#contact-form-editor-tabs li").forEach((e=>{e.addEventListener("click",(t=>{a(e.dataset?.panel),t.preventDefault()})),e.addEventListener("keyup",(t=>{if(["ArrowDown","ArrowRight"].includes(t.key)){const t=e.nextElementSibling;t&&a(t.dataset?.panel)}if(["ArrowUp","ArrowLeft"].includes(t.key)){const t=e.previousElementSibling;t&&a(t.dataset?.panel)}}))})),document.querySelectorAll(".contact-form-editor-panel").forEach((e=>{e.classList.contains("active")?document.querySelector("#contact-form-editor")?.setAttribute("data-active-tab",e.id):e.style.setProperty("display","none")})),document.querySelectorAll("#contact-form-editor [data-config-field]").forEach((e=>{e.addEventListener("change",(e=>{const t=document.querySelector('[name="post_ID"]')?.value;t&&0<t&&(e=>{const{namespace:t}=wpcf7.apiSettings,a=`/${t}/contact-forms/${e}`,r=new FormData;document.querySelectorAll("#contact-form-editor [data-config-field]").forEach((e=>{const t=e.name?.replace(/^wpcf7-/,"").replace(/-/g,"_");if(!t)return;let a;["checkbox","radio"].includes(e.type)?e.checked&&(a=e.value):a=e.value,void 0!==a&&(t.endsWith("[]")?r.append(t,a):r.set(t,a))})),r.set("context","dry-run"),c()({path:a,method:"POST",body:r}).then((e=>{wpcf7.configValidator.errors=e.config_errors,i()}))})(t)}))})),i(),(()=>{if(!m)return;const e=document.querySelector("#wpcf7-welcome-panel-show");m.querySelectorAll(".welcome-panel-close").forEach((t=>{t.addEventListener("click",(t=>{p(0),e?.removeAttribute("checked"),t.preventDefault()}))})),e?.addEventListener("click",(t=>{p(e?.checked?1:0)}))})(),document.querySelectorAll('[data-taggen="open-dialog"]').forEach((e=>{e.addEventListener("click",(t=>{const a=document.querySelector(`#${e.dataset.target}`);if(a){const e=a.querySelector("form.tag-generator-panel");e&&("1"===e.dataset.version?(e=>{f(e),e.querySelectorAll(".control-box").forEach((t=>{t.addEventListener("change",(t=>{var a;"name"===(a=t.target).name&&(a.value=a.value.replace(/[^0-9a-zA-Z:._-]/g,"").replace(/^[^a-zA-Z]+/,"")),a.classList.contains("numeric")&&(a.value=a.value.replace(/[^0-9.-]/g,"")),a.classList.contains("idvalue")&&(a.value=a.value.replace(/[^-0-9a-zA-Z_]/g,"")),a.classList.contains("classvalue")&&(a.value=a.value.split(" ").map((e=>e.replace(/[^-0-9a-zA-Z_]/g,""))).join(" ").replace(/\s+/g," ").trim()),a.classList.contains("color")&&(a.value=a.value.replace(/[^0-9a-fA-F]/g,"")),a.classList.contains("filesize")&&(a.value=a.value.replace(/[^0-9kKmMbB]/g,"")),a.classList.contains("filetype")&&(a.value=a.value.replace(/[^0-9a-zA-Z.,|\s]/g,"")),a.classList.contains("date")&&(a.value.match(/^\d{4}-\d{2}-\d{2}$/)||(a.value="")),"values"===a.name&&(a.value=a.value.trim()),f(e)}))}))})(e):"2"===e.dataset.version&&(e=>{var t;null!==(t=e.reset())&&void 0!==t||g(e),e.querySelectorAll(".control-box").forEach((t=>{t.addEventListener("change",(t=>{g(e)})),t.addEventListener("keyup",(t=>{var a;"text"!==(null!==(a=t.target.type)&&void 0!==a?a:"")&&"textarea"!==t.target.tagName?.toLowerCase()||g(e)}))}))})(e)),a.showModal()}}))})),document.querySelectorAll("dialog.tag-generator-dialog").forEach((e=>{e.querySelectorAll('[data-taggen="close-dialog"]').forEach((t=>{t.addEventListener("click",(t=>e.close("")))})),e.querySelectorAll('[data-taggen="insert-tag"], .insert-tag').forEach((t=>{t.addEventListener("click",(t=>{const a=e.querySelector('[data-tag-part="tag"], .tag');e.close(a?.value)}))})),e.addEventListener("close",(t=>{var a;const r=document.querySelector("textarea#wpcf7-form");if(null===r)return;if(""===e.returnValue)return;const c=null!==(a=r.selectionEnd)&&void 0!==a?a:0;0===c&&(e.returnValue+="\n\n"),r.value=r.value.substring(0,c)+e.returnValue+r.value.substring(c),r.selectionStart=c,r.selectionEnd=c+e.returnValue.length,r.focus()}))})),(()=>{const e=document.querySelector("#wpcf7-admin-form-element");e&&(window.addEventListener("beforeunload",y),e.addEventListener("submit",(e=>{e.submitter?.name&&"wpcf7-copy"===e.submitter.name||window.removeEventListener("beforeunload",y)})))})();const r=document.querySelector("input#title");r&&""===r.value&&r.focus(),document.querySelector("#wpcf7-admin-form-element")?.addEventListener("submit",(e=>{const a=document.querySelector('#wpcf7-admin-form-element [name="action"]'),r=document.querySelector('#wpcf7-admin-form-element [name="_wpnonce"]');"wpcf7-save"===e.submitter?.name&&(a&&(a.value="save"),r&&(r.value=wpcf7.nonce.save),document.querySelectorAll("#wpcf7-admin-form-element #publishing-action .spinner").forEach((e=>{e.classList.add("is-active")}))),"wpcf7-copy"===e.submitter?.name&&(a&&(a.value="copy"),r&&(r.value=wpcf7.nonce.copy)),"wpcf7-delete"===e.submitter?.name&&(window.confirm((0,t.__)("You are about to delete this contact form.\n 'Cancel' to stop, 'OK' to delete.","contact-form-7"))?(a&&(a.value="delete"),r&&(r.value=wpcf7.nonce.delete)):e.preventDefault())})),document.querySelectorAll(".contact-form-editor-box-mail span.mailtag").forEach((e=>{e.addEventListener("click",(t=>{const a=document.createRange();a.selectNodeContents(e),window.getSelection().addRange(a)}))})),document.querySelectorAll("[data-toggle]").forEach((e=>{l(e),e.addEventListener("change",(t=>{l(e)}))})),document.querySelectorAll("#wpcf7-ctct-enable-contact-list, #wpcf7-sendinblue-enable-contact-list, #wpcf7-sendinblue-enable-transactional-email").forEach((e=>{e.addEventListener("change",(t=>{e.checked?e.closest("tr").classList.remove("inactive"):e.closest("tr").classList.add("inactive")}))}))}))})(); includes/js/index.asset.php 0000644 00000000162 14720700167 0011727 0 ustar 00 <?php return array( 'dependencies' => array( 'wp-api-fetch', 'wp-i18n', ), 'version' => WPCF7_VERSION, ); includes/config-validator.php 0000644 00000006505 14720700167 0012325 0 ustar 00 <?php add_action( 'wpcf7_admin_menu', 'wpcf7_admin_init_bulk_cv', 10, 0 ); function wpcf7_admin_init_bulk_cv() { if ( ! wpcf7_validate_configuration() or ! current_user_can( 'wpcf7_edit_contact_forms' ) ) { return; } $result = WPCF7::get_option( 'bulk_validate' ); $last_important_update = WPCF7_ConfigValidator::last_important_update; if ( ! empty( $result['version'] ) and version_compare( $last_important_update, $result['version'], '<=' ) ) { return; } add_filter( 'wpcf7_admin_menu_change_notice', 'wpcf7_admin_menu_change_notice_bulk_cv', 10, 1 ); add_action( 'wpcf7_admin_warnings', 'wpcf7_admin_warnings_bulk_cv', 5, 3 ); } function wpcf7_admin_menu_change_notice_bulk_cv( $counts ) { $counts['wpcf7'] += 1; return $counts; } function wpcf7_admin_warnings_bulk_cv( $page, $action, $object ) { if ( 'wpcf7' === $page and 'validate' === $action ) { return; } $link = wpcf7_link( add_query_arg( array( 'action' => 'validate' ), menu_page_url( 'wpcf7', false ) ), __( 'Validate Contact Form 7 Configuration', 'contact-form-7' ) ); $message = __( "Misconfiguration leads to mail delivery failure or other troubles. Validate your contact forms now.", 'contact-form-7' ); wp_admin_notice( sprintf( '%1$s » %2$s', esc_html( $message ), $link ), 'type=warning' ); } add_action( 'wpcf7_admin_load', 'wpcf7_load_bulk_validate_page', 10, 2 ); function wpcf7_load_bulk_validate_page( $page, $action ) { if ( 'wpcf7' != $page or 'validate' != $action or ! wpcf7_validate_configuration() or 'POST' != $_SERVER['REQUEST_METHOD'] ) { return; } check_admin_referer( 'wpcf7-bulk-validate' ); if ( ! current_user_can( 'wpcf7_edit_contact_forms' ) ) { wp_die( __( "You are not allowed to validate configuration.", 'contact-form-7' ) ); } $contact_forms = WPCF7_ContactForm::find(); $result = array( 'timestamp' => time(), 'version' => WPCF7_VERSION, 'count_valid' => 0, 'count_invalid' => 0, ); foreach ( $contact_forms as $contact_form ) { $config_validator = new WPCF7_ConfigValidator( $contact_form ); $config_validator->validate(); $config_validator->save(); if ( $config_validator->is_valid() ) { $result['count_valid'] += 1; } else { $result['count_invalid'] += 1; } } WPCF7::update_option( 'bulk_validate', $result ); $redirect_to = add_query_arg( array( 'message' => 'validated', ), menu_page_url( 'wpcf7', false ) ); wp_safe_redirect( $redirect_to ); exit(); } function wpcf7_admin_bulk_validate_page() { $contact_forms = WPCF7_ContactForm::find(); $count = WPCF7_ContactForm::count(); $submit_text = sprintf( _n( /* translators: %s: number of contact forms */ "Validate %s contact form now", "Validate %s contact forms now", $count, 'contact-form-7' ), number_format_i18n( $count ) ); ?> <div class="wrap"> <h1><?php echo esc_html( __( 'Validate Configuration', 'contact-form-7' ) ); ?></h1> <form method="post" action=""> <input type="hidden" name="action" value="validate" /> <?php wp_nonce_field( 'wpcf7-bulk-validate' ); ?> <p><input type="submit" class="button" value="<?php echo esc_attr( $submit_text ); ?>" /></p> </form> <?php echo wpcf7_link( __( 'https://contactform7.com/configuration-validator-faq/', 'contact-form-7' ), __( 'FAQ about Configuration Validator', 'contact-form-7' ) ); ?> </div> <?php } edit-contact-form.php 0000644 00000020402 14720700167 0010576 0 ustar 00 <?php // don't load directly if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } $save_button = sprintf( '<input %s />', wpcf7_format_atts( array( 'type' => 'submit', 'class' => 'button-primary', 'name' => 'wpcf7-save', 'value' => __( 'Save', 'contact-form-7' ), ) ) ); ?> <div class="wrap" id="wpcf7-contact-form-editor"> <?php echo sprintf( '<h1 class="wp-heading-inline">%1$s</h1> %2$s', esc_html( $post->initial() ? __( 'Add New Contact Form', 'contact-form-7' ) : __( 'Edit Contact Form', 'contact-form-7' ) ), ( $post->initial() || ! current_user_can( 'wpcf7_edit_contact_forms' ) ) ? '' : 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 ); if ( $post ) : echo sprintf( '<form %s>', wpcf7_format_atts( array( 'method' => 'post', 'action' => esc_url( add_query_arg( array( 'post' => $post_id ), menu_page_url( 'wpcf7', false ) ) ), 'id' => 'wpcf7-admin-form-element', 'disabled' => ! current_user_can( 'wpcf7_edit_contact_form', $post_id ), ) ) ); 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 esc_attr( $_GET['active-tab'] ?? '' ); ?>" /> <div id="poststuff"> <div id="post-body" class="metabox-holder columns-2 wp-clearfix"> <div id="post-body-content"> <div id="titlediv"> <div id="titlewrap"> <?php echo sprintf( '<input %s />', wpcf7_format_atts( array( 'type' => 'text', 'name' => 'post_title', 'value' => $post->initial() ? '' : $post->title(), 'id' => 'title', 'spellcheck' => 'true', 'autocomplete' => 'off', 'disabled' => ! current_user_can( 'wpcf7_edit_contact_form', $post_id ), 'placeholder' => __( 'Enter title here', 'contact-form-7' ), 'aria-label' => __( 'Enter title here', 'contact-form-7' ), ) ) ); ?> </div><!-- #titlewrap --> <div class="inside"> <?php if ( ! $post->initial() ) { if ( $shortcode = $post->shortcode() ) { echo sprintf( '<p class="description"><label for="wpcf7-shortcode">%1$s</label> <span class="shortcode wp-ui-highlight"><input %2$s /></span></p>', esc_html( __( "Copy this shortcode and paste it into your post, page, or text widget content:", 'contact-form-7' ) ), wpcf7_format_atts( array( 'type' => 'text', 'id' => 'wpcf7-shortcode', 'onfocus' => 'this.select();', 'readonly' => true, 'class' => 'large-text code', 'value' => $shortcode, ) ) ); } if ( $shortcode = $post->shortcode( array( 'use_old_format' => true ) ) ) { echo sprintf( '<p class="description"><label for="wpcf7-shortcode-old">%1$s</label> <span class="shortcode old"><input %2$s /></span></p>', esc_html( __( "You can also use this old-style shortcode:", 'contact-form-7' ) ), wpcf7_format_atts( array( 'type' => 'text', 'id' => 'wpcf7-shortcode-old', 'onfocus' => 'this.select();', 'readonly' => true, 'class' => 'large-text code', 'value' => $shortcode, ) ) ); } } ?> </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 ) ) : ?> <section id="submitdiv" class="postbox"> <h2><?php echo esc_html( __( 'Status', 'contact-form-7' ) ); ?></h2> <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() ) { echo sprintf( '<input %s />', wpcf7_format_atts( array( 'type' => 'submit', 'name' => 'wpcf7-copy', 'class' => 'copy button', 'value' => __( 'Duplicate', 'contact-form-7' ), ) ) ); } ?> </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() ) { echo sprintf( '<div id="delete-action"><input %s /></div>', wpcf7_format_atts( array( 'type' => 'submit', 'name' => 'wpcf7-delete', 'class' => 'delete submitdelete', 'value' => __( 'Delete', 'contact-form-7' ), ) ) ); } ?> <div id="publishing-action"> <span class="spinner"></span> <?php echo $save_button; ?> </div> <div class="clear"></div> </div><!-- #major-publishing-actions --> </div><!-- #submitpost --> </div> </section><!-- #submitdiv --> <?php endif; ?> <section id="informationdiv" class="postbox"> <h2><?php echo esc_html( __( "Do you need help?", 'contact-form-7' ) ); ?></h2> <div class="inside"> <p><?php echo esc_html( __( "Here are some available options to help solve your problems.", 'contact-form-7' ) ); ?></p> <ol> <li><?php echo sprintf( /* translators: 1: FAQ, 2: Docs ("FAQ & Docs") */ __( '%1$s and %2$s', 'contact-form-7' ), wpcf7_link( __( 'https://contactform7.com/faq/', 'contact-form-7' ), __( 'FAQ', 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/docs/', 'contact-form-7' ), __( 'docs', 'contact-form-7' ) ) ); ?></li> <li><?php echo wpcf7_link( __( 'https://wordpress.org/support/plugin/contact-form-7/', 'contact-form-7' ), __( 'Support forums', 'contact-form-7' ) ); ?></li> <li><?php echo wpcf7_link( __( 'https://contactform7.com/custom-development/', 'contact-form-7' ), __( 'Professional services', 'contact-form-7' ) ); ?></li> </ol> </div> </section><!-- #informationdiv --> </div><!-- #postbox-container-1 --> <div id="postbox-container-2" class="postbox-container"> <div id="contact-form-editor" data-active-tab=""> <?php $editor = new WPCF7_Editor( $post ); $panels = array(); if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) { $panels = array( 'form-panel' => array( 'title' => __( 'Form', 'contact-form-7' ), 'callback' => 'wpcf7_editor_panel_form', ), 'mail-panel' => array( 'title' => __( 'Mail', 'contact-form-7' ), 'callback' => 'wpcf7_editor_panel_mail', ), 'messages-panel' => array( 'title' => __( 'Messages', 'contact-form-7' ), 'callback' => 'wpcf7_editor_panel_messages', ), ); $additional_settings = $post->prop( 'additional_settings' ); if ( ! is_scalar( $additional_settings ) ) { $additional_settings = ''; } $additional_settings = trim( $additional_settings ); $additional_settings = explode( "\n", $additional_settings ); $additional_settings = array_filter( $additional_settings ); $additional_settings = count( $additional_settings ); $panels['additional-settings-panel'] = array( 'title' => $additional_settings ? sprintf( /* translators: %d: number of additional settings */ __( 'Additional Settings (%d)', 'contact-form-7' ), $additional_settings ) : __( 'Additional Settings', 'contact-form-7' ), 'callback' => 'wpcf7_editor_panel_additional_settings', ); } $panels = apply_filters( 'wpcf7_editor_panels', $panels ); foreach ( $panels as $id => $panel ) { $editor->add_panel( $id, $panel['title'], $panel['callback'] ); } $editor->display(); ?> </div><!-- #contact-form-editor --> <?php if ( current_user_can( 'wpcf7_edit_contact_form', $post_id ) ) { echo sprintf( '<p class="submit">%s</p>', $save_button ); } ?> </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 ); admin.php 0000755 00000005436 14720700167 0006364 0 ustar 00 <?php defined('ABSPATH') || exit; add_action('admin_init', function () { global $hefo_options; if (isset($hefo_options['page_add_tags'])) { register_taxonomy_for_object_type('post_tag', 'page'); } if (isset($hefo_options['page_add_categories'])) { register_taxonomy_for_object_type('category', 'page'); } }); add_action('admin_menu', function() { add_options_page('Head and Footer', 'Head and Footer', 'manage_options', 'header-footer/admin/options.php'); }); if (isset($_GET['page']) && strpos($_GET['page'], 'header-footer/') === 0) { header('X-XSS-Protection: 0'); add_action('admin_enqueue_scripts', function () { wp_enqueue_script('jquery-ui-tabs'); wp_enqueue_style('hefo', plugins_url('header-footer') . '/admin/admin.css', [], time()); wp_enqueue_style('hefo-jquery-ui', plugins_url('header-footer') . '/vendor/jquery-ui/jquery-ui.min.css', [], time()); wp_enqueue_code_editor(['type' => 'php']); wp_enqueue_script('jquery-ui-tabs'); }); } add_action('add_meta_boxes', function () { add_meta_box('hefo', __('Head and Footer', 'header-footer'), 'hefo_meta_boxes_callback', ['post', 'page']); }); add_action('save_post', 'hefo_save_post'); function hefo_meta_boxes_callback($post) { // Use nonce for verification wp_nonce_field(plugin_basename(__FILE__), 'hefo'); // The actual fields for data entry // Use get_post_meta to retrieve an existing value from the database and use the value for the form $before = get_post_meta($post->ID, 'hefo_before', true); $after = get_post_meta($post->ID, 'hefo_after', true); echo '<label>'; echo '<input type="checkbox" id="hefo_before" name="hefo_before" ' . (empty($before) ? "" : "checked") . '> '; esc_html_e("Disable top injection", 'header-footer'); echo '</label> '; echo '<br>'; echo '<label>'; echo '<input type="checkbox" id="hefo_after" name="hefo_after]" ' . (empty($after) ? "" : "checked") . '> '; esc_html_e("Disable bottom injection", 'header-footer'); echo '</label> '; } function hefo_save_post($post_id) { if (!isset($_POST['hefo'])) return; // First we need to check if the current user is authorised to do this action. if (isset($_POST['post_type']) && 'page' == $_POST['post_type']) { if (!current_user_can('edit_page', $post_id)) return; } else { if (!current_user_can('edit_post', $post_id)) return; } // Secondly we need to check if the user intended to change this value. if (!wp_verify_nonce($_POST['hefo'], plugin_basename(__FILE__))) return; update_post_meta($post_id, 'hefo_before', isset($_REQUEST['hefo_before']) ? 1 : 0); update_post_meta($post_id, 'hefo_after', isset($_REQUEST['hefo_after']) ? 1 : 0); } controls.php 0000755 00000012522 14720702141 0007123 0 ustar 00 <?php defined('ABSPATH') || exit; function hefo_request($name, $default = null) { if (!isset($_REQUEST[$name])) { return $default; } return stripslashes_deep($_REQUEST[$name]); } function hefo_base_checkbox($name, $label = '') { global $options; echo '<label>'; echo '<input type="checkbox" name="options[' . esc_attr($name) . ']" value="1" ' . (isset($options[$name]) ? 'checked' : '') . '>'; echo esc_html($label); echo '</label>'; } function hefo_field_checkbox_only($name, $tips = '', $attrs = '', $link = null) { global $options; echo '<td><input type="checkbox" name="options[' . esc_attr($name) . ']" value="1" ' . (isset($options[$name]) ? 'checked' : '') . '/>'; echo ' ' . $tips; if ($link) { echo '<br><a href="' . esc_attr($link) . '" target="_blank">Read more</a>.'; } echo '</td>'; } function hefo_field_checkbox_only2($name, $tips = '', $attrs = '', $link = null) { global $options; echo '<td><input type="checkbox" name="options[' . esc_attr($name) . ']" value="1" ' . (!empty($options[$name]) ? 'checked' : '') . '/>'; echo ' ' . $tips; if ($link) { echo '<br><a href="' . esc_attr($link) . '" target="_blank">Read more</a>.'; } echo '</td>'; } function hefo_field_text($name, $label = '', $tips = '') { global $options; if (!isset($options[$name])) { $options[$name] = ''; } echo '<th scope="row">'; echo '<label>' . esc_html($label) . '</label></th>'; echo '<td><input type="text" name="options[' . esc_attr($name) . ']" value="' . esc_attr($options[$name]) . '" size="50"/>'; echo '<br /> ' . $tips; echo '</td>'; } function hefo_base_text($name) { global $options; if (!isset($options[$name])) { $options[$name] = ''; } echo '<input type="text" name="options[' . esc_attr($name) . ']" value="' . esc_attr($options[$name]) . '" size="30">'; } function hefo_field_textarea($name, $label = '', $tips = '') { global $options; if (!isset($options[$name])) { $options[$name] = ''; } if (is_array($options[$name])) { $options[$name] = implode("\n", $options[$name]); } echo '<th scope="row">'; echo '<label>' . esc_html($label) . '</label></th>'; echo '<td><textarea style="width: 100%; height: 100px" wrap="off" name="options[' . esc_attr($name) . ']">' . esc_html($options[$name]) . '</textarea>'; echo '<p class="description">' . esc_html($tips) . '</p>'; echo '</td>'; } function hefo_base_textarea_cm($name, $type = '', $tips = '') { global $options; if (!empty($type)) { $type = '-' . $type; } if (!isset($options[$name])) { $options[$name] = ''; } if (is_array($options[$name])) { $options[$name] = implode("\n", $options[$name]); } echo '<textarea class="hefo-cm' . esc_attr($type) . '" name="options[' . esc_attr($name) . ']" onfocus="hefo_cm_on(this)">'; echo esc_html($options[$name]); echo '</textarea>'; echo '<p class="description">' . $tips . '</p>'; } function hefo_field_select($name, $items) { global $options; echo '<select name="options[', esc_attr($name), ']">'; foreach ($items as $k => $v) { echo '<option value="', esc_attr($k), '"'; if (isset($options[$name]) && $options[$name] === $k) { echo ' selected'; } echo '>', esc_attr($v), '</option>'; } echo '</select>'; } function hefo_rule($number) { global $options; if (!isset($options['inner_pos_' . $number])) { $options['inner_pos_' . $number] = 'after'; } if (!isset($options['inner_skip_' . $number])) { $options['inner_skip_' . $number] = 0; } if (!isset($options['inner_tag_' . $number])) { $options['inner_tag_' . $number] = ''; } echo '<div class="rules">'; echo '<div style="float: left">Inject</div>'; echo '<select style="float: left" name="options[inner_pos_' . esc_attr($number) . ']">'; echo '<option value="after"'; echo $options['inner_pos_' . $number] == 'after' ? ' selected' : ''; echo '>after</option>'; echo '<option value="before"'; echo $options['inner_pos_' . $number] == 'before' ? ' selected' : ''; echo '>before</option>'; echo '</select>'; echo '<input style="float: left" type="text" placeholder="marker" name="options[inner_tag_' . esc_attr($number) . ']" value="'; echo esc_attr($options['inner_tag_' . $number]); echo '">'; echo '<div style="float: left">skipping</div>'; echo '<input style="float: left" type="text" size="5" name="options[inner_skip_' . esc_attr($number) . ']" value="'; echo esc_attr($options['inner_skip_' . $number]); echo '">'; echo '<div style="float: left">chars, on failure inject</div>'; echo '<select style="float: left" name="options[inner_alt_' . esc_attr($number) . ']">'; echo '<option value=""'; echo $options['inner_alt_' . $number] == 'after' ? ' selected' : ''; echo '>nowhere</option>'; echo '<option value="after"'; echo $options['inner_alt_' . $number] == 'after' ? ' selected' : ''; echo '>after the content</option>'; echo '<option value="before"'; echo $options['inner_alt_' . $number] == 'before' ? ' selected' : ''; echo '>before the content</option>'; echo '</select>'; echo '<div class="clearfix"></div></div>'; } admin.min.css 0000755 00000002741 14720702141 0007135 0 ustar 00 .form-table,.form-table td,.form-table th,.form-table td p,.form-wrap label{font-size:12px}.form-table th{font-weight:bold;font-size:12px;text-align:right;border-right:1px solid #ddd}.form-table td{font-size:12px}h3{font-weight:bold;margin-bottom:0;padding:0;text-transform:uppercase}.form-table textarea,.ui-widget textarea{font-family:Consolas,Monaco,monospace}.notice{position:relative}.hefo-dismiss{position:absolute;top:0;right:10px;text-decoration:none;font-size:20px}.CodeMirror{border:1px solid #eee;height:200px}.row{margin-left:-10px;margin-right:-10px;box-sizing:border-box}.col-1{width:100%;min-width:350px;float:left;padding:10px;box-sizing:border-box}.col-2{width:50%;min-width:350px;float:left;padding:10px;box-sizing:border-box}.clearfix{float:none;clear:both;display:table;content:""}.hefo-cm{width:100%;height:100px;box-sizing:border-box}@media all and (max-width:1200px){.col-2{width:100%;box-sizing:border-box}}.rules{margin-top:15px}.rules select{height:27px;display:block;margin-right:10px}.rules input{height:27px;display:block;margin-right:10px}.rules div{margin-right:10px;padding-top:5px}.hf-index-entry{display:block;background-color:#aaa;color:white;text-decoration:none;width:150px;box-sizing:border-box;border:2px solid #aaa}.hf-index-entry:hover{border-color:#ddd}.col-2 label{font-size:12px;text-transform:uppercase;display:block}a.readmore{display:inline-block;background-color:#007cba;padding:3px 10px;color:#fff;text-decoration:none;border-radius:5px;line-height:normal} admin.css 0000755 00000004003 14720702141 0006344 0 ustar 00 .form-table, .form-table td, .form-table th, .form-table td p, .form-wrap label { font-size: 12px; } .form-table th { font-weight: bold; font-size: 12px; text-align: right; border-right: 1px solid #ddd; } .form-table td { font-size: 12px; } h3 { font-weight: bold; margin-bottom: 0; padding: 0; text-transform: uppercase; } .form-table textarea, .ui-widget textarea { font-family: Consolas,Monaco,monospace; } .notice { position: relative; } .hefo-dismiss { position: absolute; top: 0px; right: 10px; text-decoration: none; font-size: 20px; } .CodeMirror { border: 1px solid #eee; height: 200px; } .row { margin-left: -10px; margin-right: -10px; box-sizing: border-box; } .col-1 { width: 100%; min-width: 350px; float: left; padding: 10px; box-sizing: border-box; } .col-2 { width: 50%; min-width: 350px; float: left; padding: 10px; box-sizing: border-box; } .clearfix { float: none; clear: both; display: table; content: ""; } .hefo-cm { width: 100%; height: 100px; box-sizing: border-box; } @media all and (max-width: 1200px) { .col-2 { width: 100%; box-sizing: border-box; } } .rules { margin-top: 15px; } .rules select { height: 27px; display: block; margin-right: 10px; } .rules input { height: 27px; display: block; margin-right: 10px; } .rules div { margin-right: 10px; padding-top: 5px; } .hf-index-entry { display: block; background-color: #aaa; color: white; text-decoration: none; width: 150px; box-sizing: border-box; border: 2px solid #aaa; } .hf-index-entry:hover { border-color: #ddd; } .col-2 label { font-size: 12px; text-transform: uppercase; display: block; } a.readmore { display: inline-block; background-color: #007cba; padding: 3px 10px; color: #fff; text-decoration: none; border-radius: 5px; line-height: normal; } options.php 0000755 00000055422 14720702141 0006761 0 ustar 00 <?php defined('ABSPATH') || exit; // Quick security patch, to be better integrated if (!current_user_can('administrator')) { die(); } load_plugin_textdomain('header-footer', false, 'header-footer/languages'); require_once __DIR__ . '/controls.php'; //update_option('hefo_dismissed', []); $dismissed = get_option('hefo_dismissed', []); if (isset($_REQUEST['dismiss']) && check_admin_referer('dismiss')) { $dismissed[$_REQUEST['dismiss']] = 1; update_option('hefo_dismissed', $dismissed); wp_redirect('?page=header-footer%2Fadmin%2Foptions.php'); exit(); } if (isset($_POST['save'])) { if (!wp_verify_nonce($_POST['_wpnonce'], 'save')) die('Page expired'); $options = hefo_request('options'); // Another thing to be improved... if (!isset($options['enable_php'])) { $options['enable_php'] = '0'; } if (empty($options['mobile_user_agents'])) { $options['mobile_user_agents'] = "phone\niphone\nipod\nandroid.+mobile\nxoom"; } $agents1 = explode("\n", $options['mobile_user_agents']); $agents2 = array(); foreach ($agents1 as &$agent) { $agent = trim($agent); if (empty($agent)) continue; $agents2[] = strtolower($agent); } $options['mobile_user_agents_parsed'] = implode('|', $agents2); update_option('hefo', $options); } else { $options = get_option('hefo'); } ?> <script> jQuery(function () { jQuery("textarea.hefo-cm").each(function () { wp.codeEditor.initialize(this); }); jQuery("#hefo-tabs").tabs(); }); </script> <div class="wrap"> <!--https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5PHGDGNHAYLJ8--> <h2>Head, Footer and Post Injections</h2> <?php if (!isset($dismissed['rate'])) { ?> <div class="notice notice-success"><p> I never asked before and I'm curious: <a href="http://wordpress.org/extend/plugins/header-footer/" target="_blank"><strong>would you rate this plugin</strong></a>? (takes only few seconds required - account on WordPress.org, every blog owner should have one...). <strong>Really appreciated, Stefano</strong>. <a class="hefo-dismiss" href="<?php echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=rate&noheader=1', 'dismiss') ?>">×</a> </p> </div> <?php } ?> <?php if (!isset($dismissed['newsletter'])) { ?> <div class="notice notice-success"><p> If you want to be informed of important updated of this plugin, you may want to subscribe to my (rare) newsletter<br> <form action="http://www.satollo.net/?na=s" target="_blank" method="post"> <input type="hidden" value="header-footer" name="nr"> <input type="hidden" value="2" name="nl[]"> <input type="email" name="ne" value="<?php echo esc_attr(get_option('admin_email')) ?>"> <input type="submit" value="Subscribe"> </form> <a class="hefo-dismiss" href="<?php echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=newsletter&noheader=1', 'dismiss') ?>">×</a> </p> </div> <?php } ?> <?php if (!isset($dismissed['automation'])) { ?> <div class="notice notice-success"><p> I'm developing a new plugin: <a href="https://automation.webagile.net" target="_blank">Welcome Email for Contact Form 7</a> (and more). Available for direct donwload until I wait the approvation to publish on WP.org. <a class="hefo-dismiss" href="<?php echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=automation&noheader=1', 'dismiss') ?>">×</a> </div> <?php } ?> <div style="padding: 15px; background-color: #fff; border: 1px solid #eee; font-size: 16px; line-height: 22px; margin-bottom: 10px;"> Did this plugin save you lot of time and troubles? <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5PHGDGNHAYLJ8" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('header-footer') ?>/images/donate.png"></a> To help children. Even <b>2$</b> help. <a href="http://www.satollo.net/donations" target="_blank">Please read more</a>. Thank you. <br> Are you profitably using this free plugin for your customers? One more reason to consider a <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5PHGDGNHAYLJ8" target="_blank">donation</a>. Thank you. </div> <div style="padding: 15px; background-color: #fff; border: 1px solid #eee; font-size: 16px; line-height: 22px"> <?php if (apply_filters('hefo_php_exec', $options['enable_php'])) { esc_html_e('PHP is allowed in your code.', 'header-footer'); } else { esc_html_e('PHP is NOT allowed in your code (disabled by your theme or a plugin)', 'header-footer'); } ?> <br> <?php esc_html_e('Mobile configuration is now deprecated', 'header-footer'); ?>. <a href="https://www.satollo.net/plugins/header-footer" target="_blank" class="readmore"><?php esc_html_e('Read more', 'header-footer'); ?></a> </div> <form method="post" action=""> <?php wp_nonce_field('save') ?> <p> <input type="submit" class="button-primary" name="save" value="<?php esc_attr_e('save', 'header-footer'); ?>"> </p> <div id="hefo-tabs"> <ul> <li><a href="#tabs-first"><?php esc_html_e('Head and footer', 'header-footer'); ?></a></li> <li><a href="#tabs-post"><?php esc_html_e('Posts', 'header-footer'); ?></a></li> <li><a href="#tabs-cpts"><?php esc_html_e('CPTs', 'header-footer'); ?></a></li> <li><a href="#tabs-post-inner"><?php esc_html_e('Inside posts', 'header-footer'); ?></a></li> <li><a href="#tabs-page"><?php esc_html_e('Pages', 'header-footer'); ?></a></li> <li><a href="#tabs-excerpt"><?php esc_html_e('Excerpts', 'header-footer'); ?></a></li> <li><a href="#tabs-5"><?php esc_html_e('Snippets', 'header-footer'); ?></a></li> <li><a href="#tabs-amp"><?php esc_html_e('AMP', 'header-footer'); ?></a></li> <li><a href="#tabs-generics"><?php esc_html_e('Generics', 'header-footer'); ?></a></li> <li><a href="#tabs-8"><?php esc_html_e('Advanced', 'header-footer'); ?></a></li> <li><a href="#tabs-7"><?php esc_html_e('Notes and...', 'header-footer'); ?></a></li> </ul> <div id="tabs-first"> <h3><?php esc_html_e('<HEAD> page section injection', 'header-footer') ?></h3> <div class="row"> <div class="col-2"> <label><?php esc_html_e('On every page', 'header-footer') ?></label> <?php hefo_base_textarea_cm('head'); ?> </div> <div class="col-2"> <label><?php esc_html_e('Only on the home page', 'header-footer') ?></label> <?php hefo_base_textarea_cm('head_home'); ?> </div> </div> <h3><?php esc_html_e('After the <BODY> tag', 'header-footer') ?></h3> <div class="row"> <div class="col-2"> <label><?php esc_html_e('Desktop', 'header-footer') ?>*</label> <?php hefo_base_textarea_cm('body'); ?> </div> <div class="col-2"> <?php hefo_base_checkbox('mobile_body_enabled', __('Mobile', 'header-footer')); ?> <?php hefo_base_textarea_cm('mobile_body'); ?> </div> </div> <h3><?php esc_html_e('Before the </BODY> closing tag (footer)', 'header-footer') ?></h3> <div class="row"> <div class="col-2"> <label><?php esc_html_e('Desktop', 'header-footer') ?>*</label> <?php hefo_base_textarea_cm('footer'); ?> </div> <div class="col-2"> <?php hefo_base_checkbox('mobile_footer_enabled', __('Mobile', 'header-footer')); ?> <?php hefo_base_textarea_cm('mobile_footer'); ?> </div> </div> <div class="clearfix"></div> </div> <div id="tabs-generics"> <?php for ($i = 1; $i <= 5; $i++) { ?> <h3>Generic injection <?php echo $i; ?></h3> <p>Inject before the <?php hefo_base_text('generic_tag_' . $i); ?> marker</p> <div class="row"> <div class="col-2"> <label><?php esc_html_e('Desktop', 'header-footer') ?>*</label> <?php hefo_base_textarea_cm('generic_' . $i); ?> </div> <div class="col-2"> <?php hefo_base_checkbox('mobile_generic_enabled_' . $i, __('Mobile', 'header-footer')); ?> <?php hefo_base_textarea_cm('mobile_generic_' . $i); ?> </div> </div> <div class="clearfix"></div> <?php } ?> <div class="clearfix"></div> </div> <div id="tabs-post"> <p> Please take the time to <a href="http://www.satollo.net/plugins/header-footer" target="_blank">read this page</a> to understand how the "mobile" configuration works. See the "advanced tab" to configure the mobile device detection. </p> <h3><?php esc_html_e('Before the post content', 'header-footer'); ?></h3> <div class="row"> <div class="col-2"> <label><?php esc_html_e('Desktop', 'header-footer') ?>*</label> <?php hefo_base_textarea_cm('before'); ?> </div> <div class="col-2"> <?php hefo_base_checkbox('mobile_before_enabled', __('Mobile', 'header-footer')); ?> <?php hefo_base_textarea_cm('mobile_before'); ?> </div> </div> <div class="clearfix"></div> <h3><?php esc_html_e('After the post content', 'header-footer'); ?></h3> <div class="row"> <div class="col-2"> <label><?php esc_html_e('Desktop', 'header-footer') ?>*</label> <?php hefo_base_textarea_cm('after'); ?> </div> <div class="col-2"> <?php hefo_base_checkbox('mobile_after_enabled', __('Mobile', 'header-footer')); ?> <?php hefo_base_textarea_cm('mobile_after'); ?> </div> </div> <div class="clearfix"></div> </div> <div id="tabs-cpts"> <?php $post_types = get_post_types(['public' => true], 'objects', 'and'); ?> <?php foreach ($post_types as $post_type) { ?> <?php if ($post_type->name === 'post' || $post_type->name === 'page' || $post_type->name === 'attachment') { continue; } ?> <h3><?php echo esc_html($post_type->label) ?></h3> <p> <?php hefo_field_select($post_type->name . '_mode', [''=>__('Use the post configuration', 'header-footer'), 'enabled'=>__('Enable injections below', 'header-footer'), 'disabled'=>__('Do not inject', 'header-footer')]); ?> </p> <div class="row"> <div class="col-2"> <label><?php esc_html_e('Before the post content', 'header-footer'); ?></label> <?php hefo_base_textarea_cm($post_type->name . '_before'); ?> </div> <div class="col-2"> <label><?php esc_html_e('After the post content', 'header-footer'); ?></label> <?php hefo_base_textarea_cm($post_type->name . '_after'); ?> </div> </div> <div class="clearfix"></div> <?php } ?> </div> <div id="tabs-post-inner"> <?php for ($i = 1; $i <= 5; $i++) { ?> <h3>Inner post injection <?php echo $i; ?></h3> <?php hefo_rule($i); ?> <div class="row"> <div class="col-2"> <label><?php esc_html_e('Desktop', 'header-footer') ?>*</label> <?php hefo_base_textarea_cm('inner_' . $i); ?> </div> <div class="col-2"> <?php hefo_base_checkbox('mobile_inner_enabled_' . $i, __('Mobile', 'header-footer')); ?> <?php hefo_base_textarea_cm('mobile_inner_' . $i); ?> </div> </div> <div class="clearfix"></div> <?php } ?> </div> <div id="tabs-page"> <?php hefo_base_checkbox('page_use_post', __('Use the post configurations', 'header-footer')); ?><br> <?php hefo_base_checkbox('page_add_tags', __('Let pages to have tags', 'header-footer')); ?><br> <?php hefo_base_checkbox('page_add_categories', __('Let pages to have categories', 'header-footer')); ?> <h3><?php esc_html_e('Before the page content', 'header-footer') ?></h3> <div class="row"> <div class="col-2"> <label><?php _e('Desktop', 'header-footer') ?>*</label> <?php hefo_base_textarea_cm('page_before'); ?> </div> <div class="col-2"> <?php hefo_base_checkbox('mobile_page_before_enabled', __('Mobile', 'header-footer')); ?><br> <?php hefo_base_textarea_cm('mobile_page_before'); ?> </div> </div> <div class="clearfix"></div> <h3><?php _e('After the page content', 'header-footer') ?></h3> <div class="row"> <div class="col-2"> <label><?php _e('Desktop', 'header-footer') ?>*</label> <?php hefo_base_textarea_cm('page_after'); ?> </div> <div class="col-2"> <?php hefo_base_checkbox('mobile_page_after_enabled', __('Mobile', 'header-footer')); ?><br> <?php hefo_base_textarea_cm('mobile_page_after'); ?> </div> </div> <div class="clearfix"></div> </div> <div id="tabs-excerpt"> <p><?php esc_html_e('It works only on category and tag pages.', 'header-footer'); ?></p> <table class="form-table"> <tr valign="top"><?php hefo_field_textarea('excerpt_before', __('Code to be inserted before each post excerpt', 'header-footer'), ''); ?></tr> <tr valign="top"><?php hefo_field_textarea('excerpt_after', __('Code to be inserted after each post excerpt', 'header-footer'), ''); ?></tr> </table> </div> <!-- AMP --> <div id="tabs-amp"> <p> You need the <a href="https://it.wordpress.org/plugins/amp/" target="_blank">AMP</a> plugin. Other AMP plugins could be supported in the near future. </p> <h3><?php esc_html_e('<HEAD> page section', 'header-footer') ?></h3> <div class="row"> <div class="col-1"> <?php hefo_base_textarea_cm('amp_head'); ?> </div> </div> <div class="clearfix"></div> <h3><?php esc_html_e('Extra CSS', 'header-footer') ?></h3> <div class="row"> <div class="col-1"> <?php hefo_base_textarea_cm('amp_css'); ?> </div> </div> <div class="clearfix"></div> <h3><?php esc_html_e('Just after the <BODY> tag', 'header-footer') ?></h3> <div class="row"> <div class="col-1"> <?php hefo_base_textarea_cm('amp_body'); ?> </div> </div> <div class="clearfix"></div> <h3><?php esc_html_e('Before the post content', 'header-footer') ?></h3> <div class="row"> <div class="col-1"> <?php hefo_base_textarea_cm('amp_post_before'); ?> </div> </div> <div class="clearfix"></div> <h3><?php esc_html_e('After the post content', 'header-footer') ?></h3> <div class="row"> <div class="col-1"> <?php hefo_base_textarea_cm('amp_post_after'); ?> </div> </div> <div class="clearfix"></div> <h3><?php esc_html_e('Footer', 'header-footer') ?></h3> <div class="row"> <div class="col-1"> <?php hefo_base_textarea_cm('amp_footer'); ?> </div> </div> <div class="clearfix"></div> </div> <div id="tabs-5"> <p> <?php esc_html_e('Common snippets that can be used in any header or footer area referring them as [snippet_N] where N is the snippet number from 1 to 5. Snippets are inserted before PHP evaluation.', 'header-footer'); ?><br /> <?php esc_html_e('Useful for social button to be placed before and after the post or in posts and pages.', 'header-footer'); ?> </p> <table class="form-table"> <?php for ($i = 1; $i <= 5; $i++) { ?> <tr valign="top"><?php hefo_field_textarea('snippet_' . $i, __('Snippet ' . $i, 'header-footer'), ''); ?></tr> <?php } ?> </table> <div class="clearfix"></div> </div> <div id="tabs-8"> <table class="form-table"> <tr valign="top"> <th scope="row">PHP</th> <?php hefo_field_checkbox_only2('enable_php', __('Enable PHP execution', 'header-footer'), ''); ?> </tr> </table> <table class="form-table"> <tr valign="top"> <?php hefo_field_textarea('mobile_user_agents', __('Mobile user agent strings', 'header-footer'), 'For coders: a regular expression is built with those values and the resulting code will be<br>' . '<code>preg_match(\'/' . $options['mobile_user_agents_parsed'] . '/\', ...);</code><br>' . '<a href="http://www.satollo.net/plugins/header-footer" target="_blank">Read this page</a> for more.'); ?> </tr> </table> <h3>Head meta links</h3> <p> WordPress automatically add some meta link on the head of the page, for example the RSS links, the previous and next post links and so on. Here you can disable those links if not of interest. </p> <table class="form-table"> <tr valign="top"> <th scope="row">Disable css link id</th> <?php hefo_field_checkbox_only('disable_css_id', __('Disable the id attribute on css links generated by WordPress', 'header-footer'), '', 'http://www.satollo.net/plugins/header-footer#disable_css_id'); ?> </tr> <tr valign="top"> <th scope="row">Disable css media</th> <?php hefo_field_checkbox_only('disable_css_media', __('Disable the media attribute on css links generated by WordPress, id the option above is enabled.', 'header-footer'), '', 'http://www.satollo.net/plugins/header-footer#disable_css_media'); ?> </tr> <tr valign="top"> <th scope="row">Extra feed links</th> <?php hefo_field_checkbox_only('disable_feed_links_extra', __('Disable extra feed links like category feeds or single post comments feeds', 'header-footer')); ?> </tr> <tr valign="top"> <th scope="row">Short link</th> <?php hefo_field_checkbox_only('disable_wp_shortlink_wp_head', __('Disable the short link for posts', 'header-footer')); ?> </tr> <tr valign="top"> <th scope="row">WLW Manifest</th> <?php hefo_field_checkbox_only('disable_wlwmanifest_link', __('Disable the Windows Live Writer manifest', 'header-footer')); ?> </tr> <tr valign="top"> <th scope="row">RSD link</th> <?php hefo_field_checkbox_only('disable_rsd_link', __('Disable RSD link', 'header-footer')); ?> </tr> <tr valign="top"> <th scope="row">Adjacent post links</th> <?php hefo_field_checkbox_only('disable_adjacent_posts_rel_link_wp_head', __('Disable adjacent post links', 'header-footer')); ?> </tr> </table> <div class="clearfix"></div> </div> <div id="tabs-7"> <table class="form-table"> <tr valign="top"><?php hefo_field_textarea('notes', __('Notes and parked codes', 'header-footer'), ''); ?></tr> </table> <div class="clearfix"></div> </div> </div> <p>* if no mobile alternative is activated</p> <p class="submit"><input type="submit" class="button-primary" name="save" value="<?php esc_attr_e('save', 'header-footer'); ?>"></p> </form> </div> fonts/template.php 0000644 00000012102 14720702367 0010225 0 ustar 00 <?php /** Don't load directly */ if ( ! defined( 'ABSPATH' ) ) { exit; } $settings = get_option( 'rb_adobe_font_settings', array() ); $font_options = rbSubPageAdobeFonts::get_instance()->font_selection( $fonts ); ?> <div class="rb-panel-wrap rb-fonts"> <div class="rb-panel-header"> <div class="rb-panel-heading"> <h1><?php echo esc_html__( 'Adobe (TypeKit) Fonts', 'foxiz-core' ); ?></h1> <p class="sub-heading"><?php echo esc_html__( 'The theme supports Adobe (TypeKit) Fonts. These settings below will override on Google Fonts settings in the Theme Options panel.', 'foxiz-core' ); ?></p> </div> </div> <div class="rb-panel"> <div class="rb-project-id-header"> <h2><?php esc_html_e( 'Project ID', 'foxiz-core' ); ?></h2> <p><?php printf( __( 'You can find the Project ID <a href=%1$s target="_blank" >here</a> from your Typekit Account.', 'foxiz-core' ), '//fonts.adobe.com/my_fonts?browse_mode=all#web_projects-section' ); ?></p> </div> <form name="rb-adobe-font" method="post" action=""> <?php wp_nonce_field( 'rb-fonts', 'rb-fonts-nonce' ); ?> <?php if ( ! empty( $project_id ) ) : ?> <input class="rb-panel-input-text" type="text" name="rb_fonts_project_id" id="rb-project-id" readonly value="<?php echo esc_attr( $project_id ); ?>"> <a href="#" id="rb-edit-project-id" class="rb-panel-button"><?php esc_html_e( 'Edit Project ID', 'foxiz-core' ); ?></a> <button type="submit" name="action" class="rb-panel-button" id="delete-project-id" value="delete"><?php echo esc_attr( $delete ); ?></button> <button type="submit" name="action" class="rb-panel-button is-hidden" id="submit-project-id" value="update"><?php echo esc_attr( $button ); ?></button> <?php else : ?> <input class="rb-panel-input-text" type="text" name="rb_fonts_project_id" id="rb-project-id" value=""> <button type="submit" name="action" class="rb-panel-button" id="submit-project-id" value="update"><?php echo esc_attr( $button ); ?></button> <?php endif; ?> </form> </div> <div class="rb-panel font-details-wrap"> <div class="rb-font-details-header"> <h2><?php esc_html_e( 'Adobe Font Details', 'foxiz-core' ); ?></h2> <p><?php esc_html_e( 'The list below will display all fonts in your Adobe fonts account.', 'foxiz-core' ); ?></p> </div> <div class="font-details"> <?php if ( empty( $project_id ) ) : ?> <p class="rb-font-notice"><?php esc_html_e( 'Emty project ID.', 'foxiz-core' ); ?></p> <?php elseif ( empty( $fonts ) ) : ?> <p class="rb-font-notice"><?php esc_html_e( 'No webfont found in your project.', 'foxiz-core' ); ?></p> <?php else : ?> <div class="rb-font-item is-top"> <p class="rb-font-detail"><?php esc_html_e( 'Fonts', 'foxiz-core' ); ?></p> <p class="rb-family-detail"><?php esc_html_e( 'Font Family', 'foxiz-core' ); ?></p> <p class="rb-weight-detail"><?php esc_html_e( 'Weight & Style', 'foxiz-core' ); ?></p> </div> <?php foreach ( $fonts as $font ) : ?> <div class="rb-font-item"> <p class="rb-font-detail"><?php echo esc_html( $font['family'] ); ?></p> <p class="rb-family-detail"><?php echo esc_html( $font['backup'] ); ?></p> <p class="rb-weight-detail"><?php echo esc_html( implode( ',', $font['variations'] ) ); ?></p> </div> <?php endforeach; endif; ?> </div> </div> <div class="rb-panel font-settings-wrap"> <div class="rb-font-details-header"> <h2><?php esc_html_e( 'Font Settings', 'foxiz-core' ); ?></h2> <p><?php esc_html_e( 'These settings below will override on Google Fonts settings in the Theme Options panel.', 'foxiz-core' ); ?></p> </div> <form name="rb-font-settings" method="post" action=""> <?php wp_nonce_field( 'rb-font-settings', 'rb-font-settings-nonce' ); ?> <div class="font-settings"> <?php /** @var settings elements $elements */ $elements = array( 'h1' => esc_html__( 'H1 Tag', 'foxiz-core' ), 'h2' => esc_html__( 'H2 Tag', 'foxiz-core' ), 'h3' => esc_html__( 'H3 Tag', 'foxiz-core' ), 'h4' => esc_html__( 'H4 Tag', 'foxiz-core' ), 'h5' => esc_html__( 'H5 Tag', 'foxiz-core' ), 'h6' => esc_html__( 'H6 Tag', 'foxiz-core' ), 'body' => esc_html__( 'Site Body', 'foxiz-core' ) ); foreach ( $elements as $element_id => $title ) : ?> <div class="font-setting-el"> <p class="font-setting-title"><?php echo esc_html( $title ); ?></p> <select class="rb-font-setting" name="rb_font_settings[<?php echo esc_html( $element_id ); ?>]"> <?php foreach ( $font_options as $id => $label ) { if ( isset( $settings[ $element_id ] ) && (string) $settings[ $element_id ] === (string)$id ) { echo '<option selected value="' . $id . '">' . $label . '</option>'; } else { echo '<option value="' . $id . '">' . $label . '</option>'; } } ?> </select> </div> <?php endforeach; ?> </div> <input id="submit-font-settings" class="rb-panel-button" type="submit" value="<?php esc_html_e( 'Save Changes', 'foxiz-core' ) ?> "> </form> </div> </div>