Beispiel #1
0
function wpcf7_submit_shortcode_handler($tag)
{
    if (!is_array($tag)) {
        return '';
    }
    $options = (array) $tag['options'];
    $values = (array) $tag['values'];
    $atts = '';
    $id_att = '';
    $class_att = '';
    foreach ($options as $option) {
        if (preg_match('%^id:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $id_att = $matches[1];
        } elseif (preg_match('%^class:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $class_att .= ' ' . $matches[1];
        }
    }
    if ($id_att) {
        $atts .= ' id="' . trim($id_att) . '"';
    }
    if ($class_att) {
        $atts .= ' class="' . trim($class_att) . '"';
    }
    $value = $values[0];
    if (empty($value)) {
        $value = __('Send', 'wpcf7');
    }
    $ajax_loader_image_url = wpcf7_plugin_url('images/ajax-loader.gif');
    $html = '<input type="submit" value="' . esc_attr($value) . '"' . $atts . ' />';
    $html .= ' <img class="ajax-loader" style="visibility: hidden;" alt="ajax loader" src="' . $ajax_loader_image_url . '" />';
    return $html;
}
function wpcf7_ajax_loader()
{
    $url = wpcf7_plugin_url('images/ajax-loader.gif');
    if (is_ssl() && 'http:' == substr($url, 0, 5)) {
        $url = 'https:' . substr($url, 5);
    }
    return apply_filters('wpcf7_ajax_loader', $url);
}
function wpcf7_submit_shortcode_handler($tag)
{
    if (!is_array($tag)) {
        return '';
    }
    $options = (array) $tag['options'];
    $values = (array) $tag['values'];
    $atts = '';
    $id_att = '';
    $class_att = '';
    $tabindex_att = '';
    $class_att .= ' wpcf7-submit';
    foreach ($options as $option) {
        if (preg_match('%^id:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $id_att = $matches[1];
        } elseif (preg_match('%^class:([-0-9a-zA-Z_]+)$%', $option, $matches)) {
            $class_att .= ' ' . $matches[1];
        } elseif (preg_match('%^tabindex:(\\d+)$%', $option, $matches)) {
            $tabindex_att = (int) $matches[1];
        }
    }
    if ($id_att) {
        $atts .= ' id="' . trim($id_att) . '"';
    }
    if ($class_att) {
        $atts .= ' class="' . trim($class_att) . '"';
    }
    if ('' !== $tabindex_att) {
        $atts .= sprintf(' tabindex="%d"', $tabindex_att);
    }
    $value = isset($values[0]) ? $values[0] : '';
    if (empty($value)) {
        $value = __('Send', 'wpcf7');
    }
    $html = '<input type="submit" value="' . esc_attr($value) . '"' . $atts . ' />';
    if (wpcf7_script_is()) {
        $src = apply_filters('wpcf7_ajax_loader', wpcf7_plugin_url('images/ajax-loader.gif'));
        $html .= '<img class="ajax-loader" style="visibility: hidden;" alt="' . esc_attr(__('Sending ...', 'wpcf7')) . '" src="' . esc_url_raw($src) . '" />';
    }
    return $html;
}
function wpcf7_enqueue_styles()
{
    wp_enqueue_style('contact-form-7', wpcf7_plugin_url('includes/css/styles.css'), array(), WPCF7_VERSION, 'all');
    if (wpcf7_is_rtl()) {
        wp_enqueue_style('contact-form-7-rtl', wpcf7_plugin_url('includes/css/styles-rtl.css'), array(), WPCF7_VERSION, 'all');
    }
    do_action('wpcf7_enqueue_styles');
}
function wpcf7_admin_enqueue_scripts()
{
    global $plugin_page, $wpcf7_tag_generators;
    if (!isset($plugin_page) || 'wpcf7' != $plugin_page) {
        return;
    }
    wp_enqueue_script('thickbox');
    wp_enqueue_script('postbox');
    wp_enqueue_script('wpcf7-admin-taggenerator', wpcf7_plugin_url('admin/taggenerator.js'), array('jquery'), WPCF7_VERSION, true);
    wp_enqueue_script('wpcf7-admin', wpcf7_plugin_url('admin/scripts.js'), array('jquery', 'wpcf7-admin-taggenerator'), WPCF7_VERSION, true);
    $taggenerators = array();
    foreach ((array) $wpcf7_tag_generators as $name => $tg) {
        $taggenerators[$name] = array_merge((array) $tg['options'], array('title' => $tg['title'], 'content' => $tg['content']));
    }
    wp_localize_script('wpcf7-admin', '_wpcf7', array('generateTag' => __('Generate Tag', 'wpcf7'), 'pluginUrl' => wpcf7_plugin_url(), 'tagGenerators' => $taggenerators));
}
Beispiel #6
0
function wpcf7_admin_footer()
{
    global $plugin_page;
    if (!isset($plugin_page) || 'wpcf7' != $plugin_page) {
        return;
    }
    ?>
<script type="text/javascript">
/* <![CDATA[ */
var _wpcf7 = {
	pluginUrl: '<?php 
    echo wpcf7_plugin_url();
    ?>
',
	tagGenerators: {
<?php 
    wpcf7_print_tag_generators();
    ?>
	}
};
/* ]]> */
</script>
<?php 
}
function wpcf7_enqueue_styles()
{
    wp_enqueue_style('contact-form-7', wpcf7_plugin_url('styles.css'), array(), WPCF7_VERSION, 'all');
    if ('rtl' == get_bloginfo('text_direction')) {
        wp_enqueue_style('contact-form-7-rtl', wpcf7_plugin_url('styles-rtl.css'), array(), WPCF7_VERSION, 'all');
    }
    do_action('wpcf7_enqueue_styles');
}
Beispiel #8
0
function wpcf7_admin_enqueue_scripts($hook_suffix)
{
    if (false === strpos($hook_suffix, 'wpcf7')) {
        return;
    }
    wp_enqueue_style('contact-form-7-admin', wpcf7_plugin_url('admin/css/styles.css'), array('thickbox'), WPCF7_VERSION, 'all');
    if (wpcf7_is_rtl()) {
        wp_enqueue_style('contact-form-7-admin-rtl', wpcf7_plugin_url('admin/css/styles-rtl.css'), array(), WPCF7_VERSION, 'all');
    }
    wp_enqueue_script('wpcf7-admin-taggenerator', wpcf7_plugin_url('admin/js/taggenerator.js'), array('jquery'), WPCF7_VERSION, true);
    wp_enqueue_script('wpcf7-admin', wpcf7_plugin_url('admin/js/scripts.js'), array('jquery', 'thickbox', 'postbox', 'wpcf7-admin-taggenerator'), WPCF7_VERSION, true);
    wp_localize_script('wpcf7-admin', '_wpcf7', array('generateTag' => __('Generate Tag', 'wpcf7'), 'pluginUrl' => wpcf7_plugin_url(), 'tagGenerators' => wpcf7_tag_generators()));
}
<?php

wp_enqueue_style('jquery-ui-popup', wpcf7_plugin_url('/plugins/jquery-ui-popup/styles.css'), array(), WPCF7_VERSION, 'all');
Beispiel #10
0
function wpcf7_ajax_loader()
{
    $url = wpcf7_plugin_url('images/ajax-loader.gif');
    return apply_filters('wpcf7_ajax_loader', $url);
}
Beispiel #11
0
function wpcf7_admin_load_js()
{
    global $pagenow;
    if (!is_admin()) {
        return;
    }
    if ('admin.php' != $pagenow) {
        return;
    }
    if (false === strpos($_GET['page'], 'contact-form-7')) {
        return;
    }
    wp_enqueue_script('wpcf7-admin', wpcf7_plugin_url('admin/wpcf7-admin.js'), array('jquery'), WPCF8_VERSION, true);
    wp_localize_script('wpcf7-admin', '_wpcf7L10n', array('optional' => __('optional', 'wpcf7'), 'generateTag' => __('Generate Tag', 'wpcf7'), 'textField' => __('Text field', 'wpcf7'), 'emailField' => __('Email field', 'wpcf7'), 'textArea' => __('Text area', 'wpcf7'), 'menu' => __('Drop-down menu', 'wpcf7'), 'checkboxes' => __('Checkboxes', 'wpcf7'), 'radioButtons' => __('Radio buttons', 'wpcf7'), 'acceptance' => __('Acceptance', 'wpcf7'), 'isAcceptanceDefaultOn' => __("Make this checkbox checked by default?", 'wpcf7'), 'isAcceptanceInvert' => __("Make this checkbox work inversely?", 'wpcf7'), 'isAcceptanceInvertMeans' => __("* That means visitor who accepts the term unchecks it.", 'wpcf7'), 'captcha' => __('CAPTCHA', 'wpcf7'), 'quiz' => __('Quiz', 'wpcf7'), 'quizzes' => __('Quizzes', 'wpcf7'), 'quizFormatDesc' => __("* quiz|answer (e.g. 1+1=?|2)", 'wpcf7'), 'fileUpload' => __('File upload', 'wpcf7'), 'bytes' => __('bytes', 'wpcf7'), 'submit' => __('Submit button', 'wpcf7'), 'tagName' => __('Name', 'wpcf7'), 'isRequiredField' => __('Required field?', 'wpcf7'), 'allowsMultipleSelections' => __('Allow multiple selections?', 'wpcf7'), 'insertFirstBlankOption' => __('Insert a blank item as the first option?', 'wpcf7'), 'makeCheckboxesExclusive' => __('Make checkboxes exclusive?', 'wpcf7'), 'menuChoices' => __('Choices', 'wpcf7'), 'label' => __('Label', 'wpcf7'), 'defaultValue' => __('Default value', 'wpcf7'), 'akismet' => __('Akismet', 'wpcf7'), 'akismetAuthor' => __("This field requires author's name", 'wpcf7'), 'akismetAuthorUrl' => __("This field requires author's URL", 'wpcf7'), 'akismetAuthorEmail' => __("This field requires author's email address", 'wpcf7'), 'generatedTag' => __("Copy this code and paste it into the form left.", 'wpcf7'), 'fgColor' => __("Foreground color", 'wpcf7'), 'bgColor' => __("Background color", 'wpcf7'), 'imageSize' => __("Image size", 'wpcf7'), 'imageSizeSmall' => __("Small", 'wpcf7'), 'imageSizeMedium' => __("Medium", 'wpcf7'), 'imageSizeLarge' => __("Large", 'wpcf7'), 'imageSettings' => __("Image settings", 'wpcf7'), 'inputFieldSettings' => __("Input field settings", 'wpcf7'), 'tagForImage' => __("For image", 'wpcf7'), 'tagForInputField' => __("For input field", 'wpcf7'), 'oneChoicePerLine' => __("* One choice per line.", 'wpcf7'), 'show' => __("Show", 'wpcf7'), 'hide' => __("Hide", 'wpcf7'), 'fileSizeLimit' => __("File size limit", 'wpcf7'), 'acceptableFileTypes' => __("Acceptable file types", 'wpcf7'), 'needReallySimpleCaptcha' => __("Note: To use CAPTCHA, you need Really Simple CAPTCHA plugin installed.", 'wpcf7')));
}
Beispiel #12
0
function wpcf7_admin_enqueue_scripts($hook_suffix)
{
    if (false === strpos($hook_suffix, 'wpcf7')) {
        return;
    }
    wp_enqueue_style('contact-form-7-admin', wpcf7_plugin_url('admin/css/styles.css'), array(), WPCF7_VERSION, 'all');
    if (wpcf7_is_rtl()) {
        wp_enqueue_style('contact-form-7-admin-rtl', wpcf7_plugin_url('admin/css/styles-rtl.css'), array(), WPCF7_VERSION, 'all');
    }
    wp_enqueue_script('wpcf7-admin', wpcf7_plugin_url('admin/js/scripts.js'), array('jquery', 'jquery-ui-tabs'), WPCF7_VERSION, true);
    $args = array('pluginUrl' => wpcf7_plugin_url(), 'saveAlert' => __("The changes you made will be lost if you navigate away from this page.", 'contact-form-7'), 'activeTab' => isset($_GET['active-tab']) ? (int) $_GET['active-tab'] : 0, 'howToCorrectLink' => __("How to correct this?", 'contact-form-7'), 'configErrors' => array());
    if (($post = wpcf7_get_current_contact_form()) && current_user_can('wpcf7_edit_contact_form', $post->id()) && wpcf7_validate_configuration()) {
        $config_validator = new WPCF7_ConfigValidator($post);
        $error_messages = $config_validator->collect_error_messages();
        foreach ($error_messages as $section => $errors) {
            $args['configErrors'][$section] = array();
            foreach ($errors as $error) {
                $args['configErrors'][$section][] = array('message' => esc_html($error['message']), 'link' => esc_url($error['link']));
            }
        }
    }
    wp_localize_script('wpcf7-admin', '_wpcf7', $args);
    add_thickbox();
    wp_enqueue_script('wpcf7-admin-taggenerator', wpcf7_plugin_url('admin/js/tag-generator.js'), array('jquery', 'thickbox', 'wpcf7-admin'), WPCF7_VERSION, true);
}
<?php

wp_register_script('jquery-ui-position', wpcf7_plugin_url('/plugins/jquery-ui-popup/position.js'), array('jquery', 'jquery-ui-core'), WPCF7_VERSION, $in_footer);
wp_register_script('jquery-ui-popup', wpcf7_plugin_url('/plugins/jquery-ui-popup/jquery-ui-popup.js'), array('jquery', 'jquery-ui-core', 'jquery-ui-position'), WPCF7_VERSION, $in_footer);
wp_enqueue_script('popup-adapter', wpcf7_plugin_url('/plugins/jquery-ui-popup/popup-adapter.js'), array('jquery', 'jquery-ui-core', 'jquery-ui-position', 'jquery-ui-popup'), WPCF7_VERSION, $in_footer);
function wpcf7_ajax_loader()
{
    $url = wpcf7_plugin_url('');
    return apply_filters('wpcf7_ajax_loader', $url);
}
function wpcf7_enqueue_scripts()
{
    $in_footer = true;
    if ('header' === WPCF7_LOAD_JS) {
        $in_footer = false;
    }
    wp_enqueue_script('contact-form-7', wpcf7_plugin_url('contact-form-7.js'), array('jquery', 'jquery-form'), WPCF7_VERSION, $in_footer);
}
function wpcf7_html5_fallback()
{
    if (!wpcf7_support_html5_fallback()) {
        return;
    }
    if (WPCF7_LOAD_JS) {
        wp_enqueue_script('jquery-ui-datepicker');
        wp_enqueue_script('jquery-ui-spinner');
    }
    if (WPCF7_LOAD_CSS) {
        wp_enqueue_style('jquery-ui-smoothness', wpcf7_plugin_url('includes/js/jquery-ui/themes/smoothness/jquery-ui.min.css'), array(), '1.10.3', 'screen');
    }
}
function wpcf7_admin_enqueue_scripts($hook_suffix)
{
    if (false === strpos($hook_suffix, 'wpcf7')) {
        return;
    }
    wp_enqueue_style('contact-form-7-admin', wpcf7_plugin_url('admin/css/styles.css'), array(), WPCF7_VERSION, 'all');
    if (wpcf7_is_rtl()) {
        wp_enqueue_style('contact-form-7-admin-rtl', wpcf7_plugin_url('admin/css/styles-rtl.css'), array(), WPCF7_VERSION, 'all');
    }
    wp_enqueue_script('wpcf7-admin', wpcf7_plugin_url('admin/js/scripts.js'), array('jquery', 'jquery-ui-tabs'), WPCF7_VERSION, true);
    wp_localize_script('wpcf7-admin', '_wpcf7', array('pluginUrl' => wpcf7_plugin_url(), 'saveAlert' => __("The changes you made will be lost if you navigate away from this page.", 'contact-form-7'), 'activeTab' => isset($_GET['active-tab']) ? (int) $_GET['active-tab'] : 0));
    add_thickbox();
    wp_enqueue_script('wpcf7-admin-taggenerator', wpcf7_plugin_url('admin/js/tag-generator.js'), array('jquery', 'thickbox', 'wpcf7-admin'), WPCF7_VERSION, true);
}
 public function icon()
 {
     $icon = sprintf('<img src="%1$s" alt="%2$s" width="%3$d" height="%4$d" class="icon" />', wpcf7_plugin_url('images/service-icons/recaptcha-72x72.png'), esc_attr(__('reCAPTCHA Logo', 'contact-form-7')), 36, 36);
     echo $icon;
 }