当前位置: 首页>>代码示例>>PHP>>正文


PHP wpcf7_get_current_contact_form函数代码示例

本文整理汇总了PHP中wpcf7_get_current_contact_form函数的典型用法代码示例。如果您正苦于以下问题:PHP wpcf7_get_current_contact_form函数的具体用法?PHP wpcf7_get_current_contact_form怎么用?PHP wpcf7_get_current_contact_form使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了wpcf7_get_current_contact_form函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: compose

 private function compose($send = true)
 {
     $template = $this->template;
     $use_html = (bool) $template['use_html'];
     $subject = $this->replace_tags($template['subject']);
     $sender = $this->replace_tags($template['sender']);
     $recipient = $this->replace_tags($template['recipient']);
     $additional_headers = $this->replace_tags($template['additional_headers']);
     if ($use_html) {
         $body = $this->replace_tags($template['body'], true);
         $body = wpautop($body);
     } else {
         $body = $this->replace_tags($template['body']);
     }
     $attachments = $this->attachments($template['attachments']);
     $components = compact('subject', 'sender', 'body', 'recipient', 'additional_headers', 'attachments');
     $components = apply_filters('wpcf7_mail_components', $components, wpcf7_get_current_contact_form());
     extract($components);
     $subject = wpcf7_strip_newline($subject);
     $sender = wpcf7_strip_newline($sender);
     $recipient = wpcf7_strip_newline($recipient);
     $headers = "From: {$sender}\n";
     if ($use_html) {
         $headers .= "Content-Type: text/html\n";
     }
     $additional_headers = trim($additional_headers);
     if ($additional_headers) {
         $headers .= $additional_headers . "\n";
     }
     if ($send) {
         return @wp_mail($recipient, $subject, $body, $headers, $attachments);
     }
     $components = compact('subject', 'sender', 'body', 'recipient', 'headers', 'attachments');
     return $components;
 }
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:35,代码来源:mail.php

示例2: wpcf7_response_shortcode_handler

function wpcf7_response_shortcode_handler($tag)
{
    if ($contact_form = wpcf7_get_current_contact_form()) {
        $contact_form->responses_count += 1;
        return $contact_form->form_response_output();
    }
}
开发者ID:jhonrsalcedo,项目名称:sitio,代码行数:7,代码来源:response.php

示例3: compose

 private function compose($send = true)
 {
     $components = array('subject' => $this->get('subject', true), 'sender' => $this->get('sender', true), 'body' => $this->get('body', true), 'recipient' => $this->get('recipient', true), 'additional_headers' => $this->get('additional_headers', true), 'attachments' => $this->attachments());
     $components = apply_filters('wpcf7_mail_components', $components, wpcf7_get_current_contact_form(), $this);
     if (!$send) {
         return $components;
     }
     $subject = wpcf7_strip_newline($components['subject']);
     $sender = wpcf7_strip_newline($components['sender']);
     $recipient = wpcf7_strip_newline($components['recipient']);
     $body = $components['body'];
     $additional_headers = trim($components['additional_headers']);
     $attachments = $components['attachments'];
     $headers = "From: {$sender}\n";
     if ($this->use_html) {
         $headers .= "Content-Type: text/html\n";
         $headers .= "X-WPCF7-Content-Type: text/html\n";
     } else {
         $headers .= "X-WPCF7-Content-Type: text/plain\n";
     }
     if ($additional_headers) {
         $headers .= $additional_headers . "\n";
     }
     return wp_mail($recipient, $subject, $body, $headers, $attachments);
 }
开发者ID:netmagik,项目名称:netmagik,代码行数:25,代码来源:mail.php

示例4: load_hw_wpcf7_form_settings

 /**
  * show contact form settings
  */
 public function load_hw_wpcf7_form_settings($oAdminPage)
 {
     if ($post = wpcf7_get_current_contact_form()) {
         $post_id = $post->initial() ? -1 : $post->id();
     }
     //register section
     $this->addSettingSections('hw_wpcf7_form_settings', array('section_id' => 'general', 'title' => 'Cấu hình', 'description' => 'Cài đặt chung.'));
     //get list of pages
     $pages = get_pages();
     $list = array('__all__' => 'Tất cả', '__home__' => 'Trang Chủ');
     foreach ($pages as $page) {
         $list[$page->post_name] = $page->post_title;
     }
     $this->addSettingFields('general', array('field_id' => 'enable_wpcf7_css', 'type' => 'checkbox', 'title' => __('Kích hoạt WPCF7 CSS', 'hwcf'), 'description' => __('Kích hoạt CSS mặc định.', 'hwcf'), 'value' => '1'), array('field_id' => 'enable_wpcf7_js', 'type' => 'checkbox', 'title' => __('Kích hoạt WPCF7 JS', 'hwcf'), 'description' => __('Kích hoạt tính năng ajax trong WPCF7', 'hwcf'), 'value' => '1'), array('field_id' => 'exclude_pages', 'type' => 'select', 'title' => __('Loại trừ pages'), 'description' => __('Chọn các pages bạn sẽ sử dụng tính năng ajax của Contact Form 7'), 'is_multiple' => true, 'attributes' => array('select' => array('size' => 5)), 'label' => $list), array('field_id' => 'loadingImg', 'type' => 'hw_skin_link', 'title' => __('Chọn ảnh loading khi sử lý lưu contact form'), 'description' => __('Chọn ảnh loading khi sử lý lưu contact form'), 'label' => '', 'external_skins_folder' => 'hw_wpcf7_ajax_images', 'skin_filename' => 'hw-wcf7-ajax-image.php', 'enable_external_callback' => false, 'skins_folder' => 'skins', 'apply_current_path' => HW_WPCF7_PATH, 'plugin_url' => HW_WPCF7_URL, 'files_skin_folder' => 'ajaxLoading'), array('type' => 'submit', 'field_id' => 'submit_button', 'show_title_column' => false));
     //webhook API
     $this->addSettingFields('webhook', array('field_id' => 'webhook_url', 'type' => 'text', 'title' => 'URL nhận dữ liệu qua POST', 'description' => 'Điền URL (bắt đầu với http://) nhận dữ liệu qua phương thức POST sau khi người dùng nhấn submit form.'), array('type' => 'submit', 'field_id' => 'submit_button', 'show_title_column' => false));
 }
开发者ID:hoangsoft90,项目名称:hw-hoangweb-plugin,代码行数:20,代码来源:hw-cf-form-settings.php

示例5: wpcf7_listo

function wpcf7_listo($data, $options, $args)
{
    if (!function_exists('listo')) {
        return $data;
    }
    $args = wp_parse_args($args, array());
    $contact_form = wpcf7_get_current_contact_form();
    $args['locale'] = $contact_form->locale;
    foreach ((array) $options as $option) {
        $option = explode('.', $option);
        $type = $option[0];
        $args['group'] = isset($option[1]) ? $option[1] : null;
        if ($list = listo($type, $args)) {
            $data = array_merge((array) $data, $list);
        }
    }
    return $data;
}
开发者ID:netmagik,项目名称:netmagik,代码行数:18,代码来源:listo.php

示例6: form_class_attr

/**
 * Add cf7skins classes to the CF7 HTML form class
 * 
 * Based on selected template & style
 * eg. class="wpcf7-form cf7t-fieldset cf7s-wild-west"
 * 
 * @uses 'wpcf7_form_class_attr' filter in WPCF7_ContactForm->form_html()
 * @uses wpcf7_get_current_contact_form()
 * @file wp-content\plugins\contact-form-7\includes\contact-form.php
 * 
 * @param $class is the CF7 HTML form class
 * @since 0.0.1
 */
function form_class_attr($class, $id)
{
    // Get the current CF7 form ID
    $cf7 = wpcf7_get_current_contact_form();
    // Current contact form 7 object
    $form_id = get_form_id($cf7);
    $template_class = '';
    $cf7_style_id = get_post_meta($form_id, 'cf7_style_id');
    if (isset($cf7_style_id[0])) {
        $cf7_style_data = get_post($cf7_style_id[0], OBJECT);
        if (has_term('custom-style', 'style_category', $cf7_style_data)) {
            $template_class = "cf7-style-" . $cf7_style_id[0];
        } else {
            $template_class = $cf7_style_data->post_name;
        }
    }
    // Return the modified class
    return $template_class;
}
开发者ID:jigen7,项目名称:redrocketdigital,代码行数:32,代码来源:cf7-style.php

示例7: wpcf7_file_validation_filter

function wpcf7_file_validation_filter($result, $tag)
{
    $tag = new WPCF7_Shortcode($tag);
    $name = $tag->name;
    $file = isset($_FILES[$name]) ? $_FILES[$name] : null;
    if ($file['error'] && UPLOAD_ERR_NO_FILE != $file['error']) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('upload_failed_php_error');
        return $result;
    }
    if (empty($file['tmp_name']) && $tag->is_required()) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('invalid_required');
        return $result;
    }
    if (!is_uploaded_file($file['tmp_name'])) {
        return $result;
    }
    $allowed_file_types = array();
    if ($file_types_a = $tag->get_option('filetypes')) {
        foreach ($file_types_a as $file_types) {
            $file_types = explode('|', $file_types);
            foreach ($file_types as $file_type) {
                $file_type = trim($file_type, '.');
                $file_type = str_replace(array('.', '+', '*', '?'), array('\\.', '\\+', '\\*', '\\?'), $file_type);
                $allowed_file_types[] = $file_type;
            }
        }
    }
    $allowed_file_types = array_unique($allowed_file_types);
    $file_type_pattern = implode('|', $allowed_file_types);
    $allowed_size = 1048576;
    // default size 1 MB
    if ($file_size_a = $tag->get_option('limit')) {
        $limit_pattern = '/^([1-9][0-9]*)([kKmM]?[bB])?$/';
        foreach ($file_size_a as $file_size) {
            if (preg_match($limit_pattern, $file_size, $matches)) {
                $allowed_size = (int) $matches[1];
                if (!empty($matches[2])) {
                    $kbmb = strtolower($matches[2]);
                    if ('kb' == $kbmb) {
                        $allowed_size *= 1024;
                    } elseif ('mb' == $kbmb) {
                        $allowed_size *= 1024 * 1024;
                    }
                }
                break;
            }
        }
    }
    /* File type validation */
    // Default file-type restriction
    if ('' == $file_type_pattern) {
        $file_type_pattern = 'jpg|jpeg|png|gif|pdf|doc|docx|ppt|pptx|odt|avi|ogg|m4a|mov|mp3|mp4|mpg|wav|wmv';
    }
    $file_type_pattern = trim($file_type_pattern, '|');
    $file_type_pattern = '(' . $file_type_pattern . ')';
    $file_type_pattern = '/\\.' . $file_type_pattern . '$/i';
    if (!preg_match($file_type_pattern, $file['name'])) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('upload_file_type_invalid');
        return $result;
    }
    /* File size validation */
    if ($file['size'] > $allowed_size) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('upload_file_too_large');
        return $result;
    }
    $uploads_dir = wpcf7_upload_tmp_dir();
    wpcf7_init_uploads();
    // Confirm upload dir
    $filename = $file['name'];
    // If you get script file, it's a danger. Make it TXT file.
    if (preg_match('/\\.(php|pl|py|rb|cgi)\\d?$/', $filename)) {
        $filename .= '.txt';
    }
    $filename = wp_unique_filename($uploads_dir, $filename);
    $new_file = trailingslashit($uploads_dir) . $filename;
    if (false === @move_uploaded_file($file['tmp_name'], $new_file)) {
        $result['valid'] = false;
        $result['reason'][$name] = wpcf7_get_message('upload_failed');
        return $result;
    }
    // Make sure the uploaded file is only readable for the owner process
    @chmod($new_file, 0400);
    if ($contact_form = wpcf7_get_current_contact_form()) {
        $contact_form->uploaded_files[$name] = $new_file;
        if (empty($contact_form->posted_data[$name])) {
            $contact_form->posted_data[$name] = $filename;
        }
    }
    return $result;
}
开发者ID:KurtMakesWeb,项目名称:CandG,代码行数:94,代码来源:file.php

示例8: wpcf7_file_display_warning_message

function wpcf7_file_display_warning_message()
{
    if (!($contact_form = wpcf7_get_current_contact_form())) {
        return;
    }
    $has_tags = (bool) $contact_form->form_scan_shortcode(array('type' => array('file', 'file*')));
    if (!$has_tags) {
        return;
    }
    $uploads_dir = wpcf7_upload_tmp_dir();
    wpcf7_init_uploads();
    if (!is_dir($uploads_dir) || !wp_is_writable($uploads_dir)) {
        $message = sprintf(__('This contact form contains file uploading fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'contact-form-7'), $uploads_dir);
        echo '<div class="error"><p>' . esc_html($message) . '</p></div>';
    }
}
开发者ID:flasomm,项目名称:Montkailash,代码行数:16,代码来源:file.php

示例9: wpcf7_not_allowed_to_edit

function wpcf7_not_allowed_to_edit()
{
    if (!($contact_form = wpcf7_get_current_contact_form())) {
        return;
    }
    $post_id = $contact_form->id();
    if (current_user_can('wpcf7_edit_contact_form', $post_id)) {
        return;
    }
    $message = __("You are not allowed to edit this contact form.", 'contact-form-7');
    echo sprintf('<div class="notice notice-warning is-dismissible"><p>%s</p></div>', esc_html($message));
}
开发者ID:ArtistryandFunction,项目名称:contact-form-7,代码行数:12,代码来源:admin.php

示例10: wpcf7_acceptance_as_validation

function wpcf7_acceptance_as_validation()
{
    if (!($contact_form = wpcf7_get_current_contact_form())) {
        return false;
    }
    return $contact_form->is_true('acceptance_as_validation');
}
开发者ID:jhonrsalcedo,项目名称:sitio,代码行数:7,代码来源:acceptance.php

示例11: wpcf7_get_message

function wpcf7_get_message($status)
{
    if (!($contact_form = wpcf7_get_current_contact_form())) {
        return '';
    }
    return $contact_form->message($status);
}
开发者ID:netmagik,项目名称:netmagik,代码行数:7,代码来源:contact-form.php

示例12: wpcf7_admin_add_new_page

function wpcf7_admin_add_new_page()
{
    if ($post = wpcf7_get_current_contact_form()) {
        $post_id = -1;
        require_once WPCF7_PLUGIN_DIR . '/admin/includes/meta-boxes.php';
        require_once WPCF7_PLUGIN_DIR . '/admin/edit-contact-form.php';
        return;
    }
    $available_locales = wpcf7_l10n();
    $default_locale = get_locale();
    if (!isset($available_locales[$default_locale])) {
        $default_locale = 'en_US';
    }
    ?>
<div class="wrap">

<h2><?php 
    echo esc_html(__('Add New Contact Form', 'contact-form-7'));
    ?>
</h2>

<?php 
    do_action('wpcf7_admin_notices');
    ?>

<h3><?php 
    echo esc_html(sprintf(__('Use the default language (%s)', 'contact-form-7'), $available_locales[$default_locale]));
    ?>
</h3>
<p><a href="<?php 
    echo esc_url(add_query_arg(array('locale' => $default_locale), menu_page_url('wpcf7-new', false)));
    ?>
" class="button button-primary" /><?php 
    echo esc_html(__('Add New', 'contact-form-7'));
    ?>
</a></p>

<?php 
    unset($available_locales[$default_locale]);
    ?>
<h3><?php 
    echo esc_html(__('Or', 'contact-form-7'));
    ?>
</h3>
<form action="" method="get">
<input type="hidden" name="page" value="wpcf7-new" />
<select name="locale">
<option value="" selected="selected"><?php 
    echo esc_html(__('(select language)', 'contact-form-7'));
    ?>
</option>
<?php 
    foreach ($available_locales as $code => $locale) {
        ?>
<option value="<?php 
        echo esc_attr($code);
        ?>
"><?php 
        echo esc_html($locale);
        ?>
</option>
<?php 
    }
    ?>
</select>
<input type="submit" class="button" value="<?php 
    echo esc_attr(__('Add New', 'contact-form-7'));
    ?>
" />
</form>
</div>
<?php 
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:73,代码来源:admin.php

示例13: wpcf7_notice_config_errors

function wpcf7_notice_config_errors()
{
    if (!($contact_form = wpcf7_get_current_contact_form())) {
        return;
    }
    if (!wpcf7_validate_configuration() || !current_user_can('wpcf7_edit_contact_form', $contact_form->id())) {
        return;
    }
    $config_validator = new WPCF7_ConfigValidator($contact_form);
    if ($count_errors = $config_validator->count_errors()) {
        $message = sprintf(_n('%s configuration error found', '%s configuration errors found', $count_errors, 'contact-form-7'), number_format_i18n($count_errors));
        $link = wpcf7_link(__('http://contactform7.com/configuration-validator-faq/', 'contact-form-7'), __("What's this?", 'contact-form-7'), array('class' => 'external'));
        echo sprintf('<div class="misc-pub-section warning">%1$s<br />%2$s</div>', $message, $link);
    }
}
开发者ID:jesusmarket,项目名称:jesusmarket,代码行数:15,代码来源:admin.php

示例14: wpcf7_notice_config_errors

function wpcf7_notice_config_errors()
{
    if (!($contact_form = wpcf7_get_current_contact_form())) {
        return;
    }
    if (!wpcf7_validate_configuration() || !current_user_can('wpcf7_edit_contact_form', $contact_form->id())) {
        return;
    }
    if ($config_errors = $contact_form->get_config_errors()) {
        $message = sprintf(_n("This contact form has a configuration error.", "This contact form has %s configuration errors.", count($config_errors), 'contact-form-7'), number_format_i18n(count($config_errors)));
        $link = wpcf7_link(__('http://contactform7.com/configuration-errors/', 'contact-form-7'), __('How to Resolve Configuration Errors', 'contact-form-7'));
        echo sprintf('<div class="notice notice-warning is-dismissible"><p>%s &raquo; %s</p></div>', esc_html($message), $link);
    }
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:14,代码来源:admin.php

示例15: wpcf7_response_form_tag_handler

function wpcf7_response_form_tag_handler($tag)
{
    if ($contact_form = wpcf7_get_current_contact_form()) {
        return $contact_form->form_response_output();
    }
}
开发者ID:netmagik,项目名称:netmagik,代码行数:6,代码来源:response.php


注:本文中的wpcf7_get_current_contact_form函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。