示例#1
0
function wpcf7_editor_panel_messages($post)
{
    $messages = wpcf7_messages();
    if (!wpcf7_use_really_simple_captcha()) {
        unset($messages['captcha_not_match']);
    }
    $do_validate = wpcf7_validate_configuration();
    ?>
<h2><?php 
    echo esc_html(__('Messages', 'contact-form-7'));
    ?>
</h2>
<fieldset>
<legend><?php 
    echo esc_html(__('Edit messages used in the following situations.', 'contact-form-7'));
    ?>
</legend>
<?php 
    foreach ($messages as $key => $arr) {
        $field_name = 'wpcf7-message-' . strtr($key, '_', '-');
        $config_error = $do_validate ? $post->config_error(sprintf('messages.%s', $key)) : '';
        ?>
<p class="description">
<label for="<?php 
        echo $field_name;
        ?>
"><?php 
        echo esc_html($arr['description']);
        ?>
<br />
<input type="text" id="<?php 
        echo $field_name;
        ?>
" name="<?php 
        echo $field_name;
        ?>
" class="large-text" size="70" value="<?php 
        echo esc_attr($post->message($key, false));
        ?>
"<?php 
        echo $config_error ? ' aria-invalid="true"' : '';
        ?>
 />
<?php 
        if ($config_error) {
            echo sprintf('<br /><span role="alert" class="config-error">%s</span>', $config_error);
        }
        ?>
</label>
</p>
<?php 
    }
    ?>
</fieldset>
<?php 
}
function wpcf7_add_tag_generator_captcha()
{
    if (!wpcf7_use_really_simple_captcha()) {
        return;
    }
    $tag_generator = WPCF7_TagGenerator::get_instance();
    $tag_generator->add('captcha', __('CAPTCHA (Really Simple CAPTCHA)', 'contact-form-7'), 'wpcf7_tag_generator_captcha');
}
function wpcf7_editor_panel_messages($post)
{
    $messages = wpcf7_messages();
    if (!wpcf7_use_really_simple_captcha()) {
        unset($messages['captcha_not_match']);
    }
    ?>
<h3><?php 
    echo esc_html(__('Messages', 'contact-form-7'));
    ?>
</h3>
<fieldset>
<legend><?php 
    echo esc_html(__('Edit messages used in the following situations.', 'contact-form-7'));
    ?>
</legend>
<?php 
    foreach ($messages as $key => $arr) {
        $field_name = 'wpcf7-message-' . strtr($key, '_', '-');
        ?>
<p class="description">
<label for="<?php 
        echo $field_name;
        ?>
"><?php 
        echo esc_html($arr['description']);
        ?>
<br />
<input type="text" id="<?php 
        echo $field_name;
        ?>
" name="<?php 
        echo $field_name;
        ?>
" class="large-text" size="70" value="<?php 
        echo esc_attr($post->message($key, false));
        ?>
" />
</label>
</p>
<?php 
    }
    ?>
</fieldset>
<?php 
}
 public function validate_messages()
 {
     $messages = (array) $this->contact_form->prop('messages');
     if (!$messages) {
         return;
     }
     if (isset($messages['captcha_not_match']) && !wpcf7_use_really_simple_captcha()) {
         unset($messages['captcha_not_match']);
     }
     foreach ($messages as $key => $message) {
         $stripped = wp_strip_all_tags($message);
         if ($stripped != $message) {
             $this->add_error(sprintf('messages.%s', $key), self::error_html_in_message);
         }
     }
 }
示例#5
0
 public function validate_messages()
 {
     $messages = (array) $this->contact_form->prop('messages');
     if (!$messages) {
         return;
     }
     if (isset($messages['captcha_not_match']) && !wpcf7_use_really_simple_captcha()) {
         unset($messages['captcha_not_match']);
     }
     foreach ($messages as $key => $message) {
         $stripped = wp_strip_all_tags($message);
         if ($stripped != $message) {
             $this->add_error(sprintf('messages.%s', $key), self::error_html_in_message, array('link' => __('http://contactform7.com/configuration-errors/#messages:error_html_in_message', 'contact-form-7')));
         }
     }
 }