當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。