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


PHP WPCF7_ContactForm类代码示例

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


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

示例1: yith_ypop_wpcf7_get_contact_forms

 function yith_ypop_wpcf7_get_contact_forms()
 {
     if (!function_exists('wpcf7_contact_form')) {
         return array('' => __('Plugin not activated or not installed', 'ypop'));
     }
     $posts = WPCF7_ContactForm::find();
     foreach ($posts as $post) {
         $array[$post->id()] = $post->title();
     }
     if (empty($array)) {
         return array('' => __('No contact form found', 'ypop'));
     }
     return $array;
 }
开发者ID:JacerOmri,项目名称:yith-woocommerce-popup,代码行数:14,代码来源:functions.yith-popup.php

示例2: process

 /**
  * Subscribe from Contact Form 7 Forms
  *
  * @todo improve smart guessing based on selected MailChimp lists
  *
  * @param WPCF7_ContactForm $cf7_form
  * @return bool
  */
 public function process($cf7_form)
 {
     // was sign-up checkbox checked?
     if (!$this->checkbox_was_checked()) {
         return false;
     }
     $parser = new MC4WP_Field_Guesser($this->get_data());
     $data = $parser->combine(array('guessed', 'namespaced'));
     // do nothing if no email was found
     if (empty($data['EMAIL'])) {
         return false;
     }
     return $this->subscribe($data['EMAIL'], $data, $cf7_form->id());
 }
开发者ID:aaronfrey,项目名称:PepperLillie-TAT,代码行数:22,代码来源:class-contact-form-7.php

示例3: prepare_items

 function prepare_items()
 {
     $current_screen = get_current_screen();
     $per_page = $this->get_items_per_page('cfseven_contact_forms_per_page');
     $this->_column_headers = $this->get_column_info();
     $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));
 }
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:30,代码来源:class-contact-forms-list-table.php

示例4: get_instance

 public static function get_instance(WPCF7_ContactForm $contact_form = null)
 {
     if (empty(self::$instance)) {
         if (null == $contact_form) {
             return null;
         }
         self::$instance = new self();
         self::$instance->contact_form = $contact_form;
         self::$instance->skip_mail = $contact_form->in_demo_mode();
         self::$instance->setup_posted_data();
         self::$instance->submit();
     } elseif (null != $contact_form) {
         return null;
     }
     return self::$instance;
 }
开发者ID:StefanBonilla,项目名称:CoupSoup,代码行数:16,代码来源:submission.php

示例5: cf7bs_get_form_property

function cf7bs_get_form_property($property, $form_id = 0)
{
    global $current_form_id, $current_form_properties;
    if ($form_id == 0) {
        if (is_callable(array('WPCF7_ContactForm', 'get_current'))) {
            $current_form = WPCF7_ContactForm::get_current();
            if (is_a($current_form, 'WPCF7_ContactForm') && is_callable(array($current_form, 'id'))) {
                $form_id = $current_form->id();
            }
        }
    }
    if ($form_id == 0) {
        return false;
    }
    if ($current_form_id != $form_id) {
        $current_form_id = $form_id;
        $properties = cf7bs_get_default_form_properties();
        if (is_a($current_form, 'WPCF7_ContactForm') && is_callable(array($current_form, 'additional_setting'))) {
            foreach ($properties as $key => &$value) {
                $setting = $current_form->additional_setting($key);
                if (isset($setting[0])) {
                    $value = $setting[0];
                }
            }
            unset($key);
            unset($value);
        }
        $current_form_properties = apply_filters('cf7bs_form_' . $form_id . '_properties', $properties);
    }
    if (isset($current_form_properties[$property])) {
        return $current_form_properties[$property];
    }
    return false;
}
开发者ID:kevinreilly,项目名称:envirotronics-wp,代码行数:34,代码来源:bootstrap-for-contact-form-7.php

示例6: wpcf7_scan_form_tags

function wpcf7_scan_form_tags($cond = null)
{
    $contact_form = WPCF7_ContactForm::get_current();
    if ($contact_form) {
        return $contact_form->scan_form_tags($cond);
    }
    return array();
}
开发者ID:netmagik,项目名称:netmagik,代码行数:8,代码来源:form-tags-manager.php

示例7: send_mail_for_form

function send_mail_for_form($cf7_posted_data)
{
    $wpcf7 = WPCF7_ContactForm::get_current();
    if ($wpcf7->id() == 596) {
        $wpcf7->skip_mail = false;
    }
    return $cf7_posted_data;
}
开发者ID:damonmaldonado,项目名称:appstack-child,代码行数:8,代码来源:functions.php

示例8: get_items

 /**
  * Get dropdown items.
  *
  * @return array
  */
 protected function get_items()
 {
     $forms = WPCF7_ContactForm::find();
     return array_reduce($forms, function ($result, $form) {
         $result[$form->title] = $form->id;
         return $result;
     }, array());
 }
开发者ID:entr,项目名称:papi-property-contact-form7-select,代码行数:13,代码来源:class-papi-property-CF7-select.php

示例9: submitForm

 /**
  * Handler for wpcf7_submit hook.
  *
  * @param \WPCF7_ContactForm $contactform
  */
 public function submitForm($contactform)
 {
     if ($contactform->in_demo_mode()) {
         return;
     }
     $submission = \WPCF7_Submission::get_instance();
     $posted = $submission->get_posted_data();
     $groovehq_copy_email = $contactform->additional_setting("groovehq_copy_email");
     $groovehq_tags = $contactform->additional_setting("groovehq_tags");
     $groovehq_inbox = $contactform->additional_setting("groovehq_inbox");
     if (!$submission || !$posted) {
         return;
     }
     if (!isset($posted['your-email'])) {
         $sender = get_option('admin_email');
     } else {
         $sender = $posted['your-email'];
     }
     $ticket = array('state' => 'pending', 'to' => $sender, 'subject' => sprintf('%s: %s', $contactform->title(), $sender), 'from' => $this->getOption("inbox", "Inbox"), 'note' => true, 'body' => $this->getMessage($posted, $contactform->prop('form')));
     if (!is_null($groovehq_tags)) {
         $ticket = array_merge($ticket, array("tags" => explode(",", $groovehq_tags[0])));
     }
     if (!is_null($groovehq_inbox)) {
         $ticket["from"] = $groovehq_inbox[0];
     }
     if (!is_null($groovehq_copy_email)) {
         add_filter('wp_mail_content_type', array(&$this, "set_html_content_type"));
         wp_mail($groovehq_copy_email[0], $ticket["subject"], $ticket["body"]);
         remove_filter('wp_mail_content_type', array(&$this, "set_html_content_type"));
     }
     $res = $this->postAPI("/tickets", $ticket);
     if ($res && $this->getOption("to_pending", false)) {
         $this->setPendingTicket($res->ticket->number);
     }
 }
开发者ID:niteoweb,项目名称:CF7GHQ,代码行数:40,代码来源:index.php

示例10: gd_quicksetup_setup_contact_form_7

/**
 * Set up the contact form 7 plugin.
 * Set up the default contact form with the user's e-mail address, and create a
 * contact page to contain the form.
 * @global type $gd_quicksetup_plugin
 * @return null
 */
function gd_quicksetup_setup_contact_form_7()
{
    global $gd_quicksetup_plugin;
    $options = $gd_quicksetup_plugin->get_current_plugin_options();
    // Get email address
    $email = '';
    foreach ((array) $_POST['type'] as $k => $v) {
        if (!$_POST['enabled'][$k] || 'false' === $_POST['enabled'][$k]) {
            continue;
        }
        if ('contact' === $v) {
            $email = sanitize_email(stripslashes_deep($_POST['contact_email'][$k]));
            break;
        }
    }
    if (empty($email)) {
        return;
    }
    // Update the contact form
    $post_content = '';
    $posts = get_posts(array('post_type' => 'wpcf7_contact_form', 'numberposts' => 1));
    if (class_exists('WPCF7_ContactForm') && is_array($posts) && !empty($posts[0]) && $posts[0] instanceof WP_Post) {
        // Use Contact Form 7's API
        $post = $posts[0];
        $contact_form = new WPCF7_ContactForm($post);
        // Add CAPTCHA
        $search = '[textarea your-message] </p>';
        $cid = rand(0, 1000);
        $contact_form->form = str_replace($search, $search . "\n\n<p>Please enter the text below<br />\n    [captchac captcha-{$cid}]<br />\n    [captchar captcha-{$cid}]<br /></p>", $contact_form->form);
        // Change title
        $contact_form->title = isset($options['page_title']) ? $options['page_title'] : __('Contact', 'gd_quicksetup');
        if (!empty($email)) {
            $contact_form->mail['recipient'] = $email;
        }
        // Save
        $contact_form->save();
        // New tag for the contact page
        $post_content = '[contact-form-7 id="' . $post->ID . '" title="' . $post->post_title . '"]';
    }
    // Create a Contact page
    wp_insert_post(array('comment_status' => 'closed', 'ping_status' => 'closed', 'post_content' => $post_content, 'post_name' => 'contact', 'post_title' => isset($options['page_title']) ? $options['page_title'] : __('Contact Us', 'gd_quicksetup'), 'post_type' => 'page', 'post_status' => 'publish', 'menu_order' => 800));
}
开发者ID:kat-scott,项目名称:broadpoint,代码行数:49,代码来源:contact-form-7.php

示例11: prepare_body

 /**
  * Takes the body of the mail, evaluates it and sets it back.
  * 
  * @param [Object] The $WPCF7_ContactForm object.
  * @return void
  */
 public function prepare_body($cf7)
 {
     // Get the object.
     $wpcf = WPCF7_ContactForm::get_current();
     // Now we get the mail body and evaluate it.
     $mail = $wpcf->prop('mail');
     $mail['body'] = $this->evaluate($mail['body']);
     // Set the new body.
     $wpcf->set_properties(array('mail' => $mail));
     return $wpcf;
 }
开发者ID:kailn,项目名称:Mail-Conditions-for-Contact-Form-7,代码行数:17,代码来源:mail_conditions_for_contact_form_7.php

示例12: wpcf7gpg_encrypt_mail

function wpcf7gpg_encrypt_mail($wpcf7gpg_mailcomponents)
{
    $wpcf7gpg_contactform = WPCF7_ContactForm::get_current();
    $wpcf7gpg_publickey = $wpcf7gpg_contactform->additional_setting('wpcf7gpg_publickey');
    if ($wpcf7gpg_publickey) {
        // A public key has been defined (element 0 in array), sanitize as required by GPG library
        $wpcf7gpg_publickey = str_replace('|', "\n", $wpcf7gpg_publickey[0]);
        // Replace body of mail with encrypted body text
        $wpcf7gpg_mailcomponents['body'] = wpcf7gpg_encrypt_text($wpcf7gpg_mailcomponents['body'], $wpcf7gpg_publickey);
    } else {
        // No public key has been defined, we can skip encryption
    }
    return $wpcf7gpg_mailcomponents;
}
开发者ID:JanRei,项目名称:contact-form-7-gpg-hook,代码行数:14,代码来源:contact-form-7-gpg-hook.php

示例13: __construct

 public function __construct(WPCF7_ContactForm $contact_form)
 {
     $this->contact_form = $contact_form;
     $config_errors = get_post_meta($contact_form->id(), '_config_errors', true);
     foreach ((array) $config_errors as $section => $errors) {
         if (empty($errors)) {
             continue;
         }
         if (!is_array($errors)) {
             // for back-compat
             $code = $errors;
             $this->add_error($section, $code);
         } else {
             foreach ((array) $errors as $error) {
                 if (!empty($error['code'])) {
                     $code = $error['code'];
                     $args = isset($error['args']) ? $error['args'] : '';
                     $this->add_error($section, $code, $args);
                 }
             }
         }
     }
 }
开发者ID:netmagik,项目名称:netmagik,代码行数:23,代码来源:config-validator.php

示例14: wpcf7_install

function wpcf7_install()
{
    if ($opt = get_option('wpcf7')) {
        return;
    }
    wpcf7_load_textdomain();
    wpcf7_register_post_types();
    wpcf7_upgrade();
    if (get_posts(array('post_type' => 'wpcf7_contact_form'))) {
        return;
    }
    $contact_form = WPCF7_ContactForm::get_template(array('title' => sprintf(__('Contact form %d', 'contact-form-7'), 1)));
    $contact_form->save();
}
开发者ID:aim-web-projects,项目名称:kobe-chuoh,代码行数:14,代码来源:settings.php

示例15: render

 public function render($atts)
 {
     extract($atts);
     $shortcode = '';
     // Hookup the shortcode
     if ($this->is_active()) {
         $items = WPCF7_ContactForm::find(array('p' => $form_id));
     }
     if (!empty($items)) {
         $item = $items[0];
         $shortcode = sprintf('[contact-form-7 id="%1$d" title="%2$s"]', $item->id(), $item->title());
     }
     return $shortcode;
 }
开发者ID:nayabbukhari,项目名称:circulocristiano,代码行数:14,代码来源:contact-form-7.php


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