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


PHP WPCF7_Submission类代码示例

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


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

示例1: save_form

/**
  * [nombre_del_formulario] [Esto ocupo para comparar el nombre del formulario para guardar en la tabla correcta]
  * 
  * [nombre_de_la_tabla] [se concatena con el prefijo seleccionado en la instalacion que por defecto es wp_ + nombre de la tabla a guardar]
  *
  *	[$submited['posted_data']['nombre_campo_form']] [Para jalar datos del formulario lo sacamos de un array $submited['posted_data'] seguido del nombre del campo ingresado en el form ['nombre_campo_form']]
  * 
  * [save_form Guarda en base cualquier formulario enviado por contact form 7]
  * @param  [type] $wpcf7 [variable global de wp que se utiliza para guardar datos en esta funcion]
  * @return [type]        [description]
*/
function save_form($wpcf7)
{
    global $wpdb;
    /*
     Note: since version 3.9 Contact Form 7 has removed $wpcf7->posted_data
     and now we use an API to get the posted data.
    */
    $submission = WPCF7_Submission::get_instance();
    if ($submission) {
        $submited = array();
        $submited['title'] = $wpcf7->title();
        $submited['posted_data'] = $submission->get_posted_data();
    }
    /**
     * Uso de la mayoría de formularios acerca de suscribirse o no
     */
    if ($submited['posted_data']['info'] == 'on') {
        $info = 'Si quiero recibir informacion';
    } else {
        $info = 'No quiero recibir informacion';
    }
    if ($submited['title'] == 'nombre_del_formulario') {
        $wpdb->insert($wpdb->prefix . 'nombre_de_la_tabla', array('nombre' => $submited['posted_data']['your-name'], 'apellido' => $submited['posted_data']['last-name'], 'email' => $submited['posted_data']['email-gana'], 'artista' => $submited['posted_data']['artist-fav'], 'info' => $info, 'fecha' => date('Y-m-d')));
    }
}
开发者ID:SHIFT-EC,项目名称:shift-press,代码行数:36,代码来源:save-contact-form.php

示例2: notification_email

 /**
  * Set the notification email when sending an email.
  *
  * @since WP Job Manager - Contact Listing 1.0.0
  *
  * @return string The email to notify.
  */
 public function notification_email($components, $cf7, $three = null)
 {
     $submission = WPCF7_Submission::get_instance();
     $unit_tag = $submission->get_meta('unit_tag');
     if (!preg_match('/^wpcf7-f(\\d+)-p(\\d+)-o(\\d+)$/', $unit_tag, $matches)) {
         return $components;
     }
     $post_id = (int) $matches[2];
     $object = get_post($post_id);
     // Prevent issues when the form is not submitted via a listing/resume page
     if (!isset($this->forms[$object->post_type])) {
         return $components;
     }
     if (!array_search($cf7->id(), $this->forms[$object->post_type])) {
         return $components;
     }
     // Bail if this is the second mail
     if (isset($three) && 'mail_2' == $three->name()) {
         return $components;
     }
     $recipient = $object->_application ? $object->_application : $object->_candidate_email;
     //if we couldn't find the email by now, get it from the listing owner/author
     if (empty($recipient)) {
         //just get the email of the listing author
         $owner_ID = $object->post_author;
         //retrieve the owner user data to get the email
         $owner_info = get_userdata($owner_ID);
         if (false !== $owner_info) {
             $recipient = $owner_info->user_email;
         }
     }
     $components['recipient'] = $recipient;
     return $components;
 }
开发者ID:durichitayat,项目名称:befolio-wp,代码行数:41,代码来源:cf7.php

示例3: wpcf7_do_before_send

function wpcf7_do_before_send($wpcf7)
{
    $submission = WPCF7_Submission::get_instance();
    $data = $submission->get_posted_data();
    $_SESSION['posted_data'] = $data;
    return true;
}
开发者ID:rodsilver83,项目名称:victoria,代码行数:7,代码来源:functions.php

示例4: beforeSendEmail

 function beforeSendEmail($cf7)
 {
     $submission = WPCF7_Submission::get_instance();
     if ($submission) {
         $data = $submission->get_posted_data();
         $dataArr = array_merge($data, array('created_date' => current_time('mysql')));
         add_post_meta($data['_wpcf7'], 'cf7-adb-data', $dataArr);
     }
 }
开发者ID:DjKarui,项目名称:powerhouse,代码行数:9,代码来源:cf7_adb.class.php

示例5: ip_wpcf7_mail_sent

function ip_wpcf7_mail_sent($wpcf7){
		$submission = WPCF7_Submission::get_instance();
			if ( $submission ) {
				$formdata = $submission->get_posted_data();
				$email = $formdata['your-email'];
				$first_name = $formdata['your-first-name'];
				$last_name = $formdata['your-last-name'];
				$tel = $formdata['your-tel'];
				$plan = $formdata['your-plan'];
			}
			$time = $today = date("F j, Y, g:i a");
        // Open Agent:
        $curl = curl_init();
        curl_setopt_array($curl, array(
                CURLOPT_RETURNTRANSFER => 1,
                CURLOPT_URL => 'http://ag.panda8.co/api?action=createAgentPph&creditAgent=1000&credit=100&currency=USD&masterId=DEMVI&numOfUser=1&email='.$email.'&key=BBBAB3NzaC1yc2EAAAABJQAAAIEAhCdDMhGHdaw1uj9MH2xCB4jktwIgm4Al7S8rxvovMJBAuFKkMDd0vW5gpurUAB0PEPkxh6QFoBNazvio7Q03f90tSP9qpJMGwZid9hJEElplW8p43D3DdxXykLays2M8V2viYGLbiXvAbOECzwD4IaviOpylX0PaFznSR4ssXd0Int',
                CURLOPT_USERAGENT => 'PPH186',
                CURLOPT_FOLLOWLOCATION => 1,
        ));
		$resp = curl_exec($curl);
        $variables = json_decode($resp,true);
        $agent = strtoupper($variables['agentId']);
        $password = $variables['password'];
        curl_close($curl); 
        // Send Info to bot
		$text = urlencode("-- Sign up -- \n".$time."\n"."First Name: ".$first_name."\n"."Last Name: ".$last_name."\n"."Email: ".$email."\n"."Tel: ".$tel."\n"."Plan: ".$plan."\nAgent ID: ".$agent);
        $curl = curl_init();
        // Set some options - we are passing in a useragent too here
        curl_setopt_array($curl, array(
                CURLOPT_RETURNTRANSFER => 1,
                CURLOPT_URL => 'http://pph186.com/bot.php?key=b6fbc59dea1f5c41551f895886edbee5&msg='.$text.'&agent_id=sa',
                CURLOPT_USERAGENT => 'PPH186'
        ));
		// Send the request & save response to $resp
        $resp = curl_exec($curl);
        // Close request to clear up some resources
        curl_close($curl);
        $params = array(
   					"first_name" => $first_name,
 					"last_name" => $last_name,
  					"phone_mobile" => $tel,
  					"email1" => $email,
  					"account_name" => $agent,
  					"account_description" => $plan,
  					"campaign_id" => "c78e72d1-bfaa-b060-be8e-56cb258c33e6",
  					"assigned_user_id" => "1",
		);
 		echo httpPost("http://crm.pph186.com/index.php?entryPoint=WebToLeadCapture",$params);
 		$_SESSION["first_name"] = $first_name;
 		$_SESSION["last_name"] = $last_name;
 		$_SESSION["account_name"] = $agent;

       
}
开发者ID:kyborg,项目名称:OneBet-Skin,代码行数:54,代码来源:contact_fỏm.php

示例6: action_wpcf7_mail_sent

function action_wpcf7_mail_sent($contact_form)
{
    $submission = WPCF7_Submission::get_instance();
    if ($submission) {
        $posted_data = $submission->get_posted_data();
        $to = $posted_data['your-email'];
        $subject = 'Thank you for your interest in GVCO';
        $body = 'Thank you for your interest in the future of the Great Valley Community Organization. A member of our Building Connections Campaign Committee will be in touch with you shortly. In the meantime, be sure to follow us on social media for the latest news and updates.';
        wp_mail($to, $subject, $body);
    }
}
开发者ID:aaronfrey,项目名称:PepperLillie-GVCO,代码行数:11,代码来源:functions.php

示例7: tcb_mail_sent_function

function tcb_mail_sent_function($contact_form)
{
    $title = $contact_form->title;
    $submission = WPCF7_Submission::get_instance();
    if ($submission) {
        $posted_data = $submission->get_posted_data();
    }
    if ('referralForm' == $title) {
        $current_user = wp_get_current_user();
        for ($i = 1; $i <= 3; $i++) {
            add_filter('wp_mail_content_type', 'set_html_content_type');
            add_filter('wp_mail_from', 'tcb_website_email');
            add_filter('wp_mail_from_name', 'tcb_website_name');
            if (!$posted_data["email_" . $i]) {
                continue;
            }
            ob_start();
            include TCP_TEMPLATE_PATH . "referral_email.php";
            $message = ob_get_contents();
            ob_end_clean();
            wp_mail($posted_data["email_" . $i], 'e-Voucher from ' . $current_user->user_firstname . " " . $current_user->user_lastname, $message);
            remove_filter('wp_mail_content_type', 'set_html_content_type');
            remove_filter('wp_mail_from_name', 'tcb_website_name');
            remove_filter('wp_mail_from', 'tcb_website_email');
        }
    }
}
开发者ID:ntnvu,项目名称:tcb_online,代码行数:27,代码来源:functions.php

示例8: wpcf7_flamingo_submit

function wpcf7_flamingo_submit($contactform, $result)
{
    if (!class_exists('Flamingo_Contact') || !class_exists('Flamingo_Inbound_Message')) {
        return;
    }
    if ($contactform->in_demo_mode() || $contactform->is_true('do_not_store')) {
        return;
    }
    $cases = (array) apply_filters('wpcf7_flamingo_submit_if', array('spam', 'mail_sent', 'mail_failed'));
    if (empty($result['status']) || !in_array($result['status'], $cases)) {
        return;
    }
    $submission = WPCF7_Submission::get_instance();
    if (!$submission || !($posted_data = $submission->get_posted_data())) {
        return;
    }
    $fields_senseless = $contactform->form_scan_shortcode(array('type' => array('captchar', 'quiz', 'acceptance')));
    $exclude_names = array();
    foreach ($fields_senseless as $tag) {
        $exclude_names[] = $tag['name'];
    }
    $exclude_names[] = 'g-recaptcha-response';
    foreach ($posted_data as $key => $value) {
        if ('_' == substr($key, 0, 1) || in_array($key, $exclude_names)) {
            unset($posted_data[$key]);
        }
    }
    $email = wpcf7_flamingo_get_value('email', $contactform);
    $name = wpcf7_flamingo_get_value('name', $contactform);
    $subject = wpcf7_flamingo_get_value('subject', $contactform);
    $meta = array();
    $special_mail_tags = array('remote_ip', 'user_agent', 'url', 'date', 'time', 'post_id', 'post_name', 'post_title', 'post_url', 'post_author', 'post_author_email');
    foreach ($special_mail_tags as $smt) {
        $meta[$smt] = apply_filters('wpcf7_special_mail_tags', '', '_' . $smt, false);
    }
    $akismet = isset($submission->akismet) ? (array) $submission->akismet : null;
    if ('mail_sent' == $result['status']) {
        Flamingo_Contact::add(array('email' => $email, 'name' => $name));
    }
    $channel_id = wpcf7_flamingo_add_channel($contactform->name(), $contactform->title());
    if ($channel_id) {
        $channel = get_term($channel_id, Flamingo_Inbound_Message::channel_taxonomy);
        if (!$channel || is_wp_error($channel)) {
            $channel = 'contact-form-7';
        } else {
            $channel = $channel->slug;
        }
    } else {
        $channel = 'contact-form-7';
    }
    $args = array('channel' => $channel, 'subject' => $subject, 'from' => trim(sprintf('%s <%s>', $name, $email)), 'from_name' => $name, 'from_email' => $email, 'fields' => $posted_data, 'meta' => $meta, 'akismet' => $akismet, 'spam' => 'spam' == $result['status']);
    Flamingo_Inbound_Message::add($args);
}
开发者ID:idies,项目名称:escience-2016-wp,代码行数:53,代码来源:flamingo.php

示例9: beforeSendEmail

 function beforeSendEmail($cf7)
 {
     $submission = WPCF7_Submission::get_instance();
     if ($submission) {
         $data = $submission->get_posted_data();
         $dataArr = array_merge($data, array('created_date' => current_time('mysql')));
         add_post_meta($data['_wpcf7'], 'cf7-adb-data', $dataArr);
         $unread_messages = get_post_meta($data['_wpcf7'], 'cf7-adb-data-unread', true);
         update_post_meta($data['_wpcf7'], 'cf7-adb-data-unread', intval($unread_messages) + 1);
         //status 1= show notification | 2 = hide notofication
         update_option('cf7-adb-data-show-notif', 1);
     }
 }
开发者ID:etuannv,项目名称:xkld,代码行数:13,代码来源:cf7_adb.class.php

示例10: your_wpcf7_mail_sent_function

function your_wpcf7_mail_sent_function($contact_form)
{
    $title = $contact_form->title;
    $submission = WPCF7_Submission::get_instance();
    if ($submission) {
        $posted_data = $submission->get_posted_data();
    }
    if ('Send a Gift 2' == $title) {
        $usergiftBudget = $posted_data['giftBudget'];
        setcookie("CustomBudget", $usergiftBudget, strtotime('+10 minutes'), "/");
        // sleep(10);
    }
}
开发者ID:JaneJieYing,项目名称:ookiddo_v1,代码行数:13,代码来源:ok_cf7budget_to_cart.php

示例11: create_user_from_registration

function create_user_from_registration($cfdata)
{
    if (!isset($cfdata->posted_data) && class_exists('WPCF7_Submission')) {
        // Contact Form 7 version 3.9 removed $cfdata->posted_data and now
        // we have to retrieve it from an API
        $submission = WPCF7_Submission::get_instance();
        if ($submission) {
            $formdata = $submission->get_posted_data();
        }
    } elseif (isset($cfdata->posted_data)) {
        // For pre-3.9 versions of Contact Form 7
        $formdata = $cfdata->posted_data;
    } else {
        // We can't retrieve the form data
        return $cfdata;
    }
    // Check this is the user registration form
    switch ($cfdata->id()) {
        case 268:
            $ruolo = "hw2_client";
            break;
        case 716:
            $ruolo = "hw2_contributor";
            break;
        case 733:
            $ruolo = "hw2_partner";
            break;
        default:
            $ruolo = "subscriber";
            break;
    }
    $password = wp_generate_password(12, false);
    $email = $formdata['Email'];
    $first = $formdata['First'];
    $last = $formdata['Last'];
    // Construct a username from the user's name
    $username = strtolower(str_replace(' ', '', $first));
    if (!email_exists($email)) {
        // Find an unused username
        $username_tocheck = $username;
        $i = 1;
        while (username_exists($username_tocheck)) {
            $username_tocheck = $username . $i++;
        }
        $username = $username_tocheck;
        // Create the user
        $userdata = array('user_login' => $username, 'user_pass' => $password, 'user_email' => $email, 'nickname' => $first, 'display_name' => $first, 'first_name' => $first, 'last_name' => $last, 'role' => $ruolo);
        $user_id = wp_insert_user($userdata);
    }
    return $cfdata;
}
开发者ID:hyperweb2,项目名称:contract-form,代码行数:51,代码来源:cf7.php

示例12: tcb_custom_mail_components

function tcb_custom_mail_components($WPCF7_ContactForm)
{
    $title = $WPCF7_ContactForm->title;
    if ('referralForm' == $title) {
        $submission = WPCF7_Submission::get_instance();
        if ($submission) {
            $posted_data = $submission->get_posted_data();
        }
        $mail = $WPCF7_ContactForm->prop('mail');
        ob_start();
        include TCP_TEMPLATE_PATH . "referral_email_to_admin.php";
        $message = ob_get_contents();
        ob_end_clean();
        $mail['body'] = str_replace('[referral_content]', $message, $mail['body']);
        $WPCF7_ContactForm->set_properties(array('mail' => $mail));
    }
    if ('Warranty form' == $title) {
        $submission = WPCF7_Submission::get_instance();
        if ($submission) {
            $posted_data = $submission->get_posted_data();
        }
        $password = $posted_data["nric_fin"];
        $user_email = $posted_data["email"];
        $mail = $WPCF7_ContactForm->prop('mail_2');
        $user_id = username_exists($user_email);
        if (!$user_id and email_exists($user_email) == false) {
            $userdata = array('user_login' => $user_email, 'user_pass' => $password, 'user_email' => $user_email, 'first_name' => $posted_data["surname"], 'last_name' => $posted_data["given_name"], 'display_name' => $posted_data["given_name"]);
            $user_id = wp_insert_user($userdata);
            //update extra info for customer
            update_user_meta($user_id, 'salutation', $posted_data['title'], get_the_author_meta('salutation', $user_id));
            update_user_meta($user_id, 'nric_fin_user', $posted_data['nric_fin'], get_the_author_meta('nric_fin', $user_id));
            update_user_meta($user_id, 'dob', $posted_data['date_of_birth'], get_the_author_meta('dob', $user_id));
            update_user_meta($user_id, 'address_user', $posted_data['block'] . " " . $posted_data['street_name'], get_the_author_meta('address', $user_id));
            update_user_meta($user_id, 'postal_code', $posted_data['postal_code'], get_the_author_meta('postal_code', $user_id));
            update_user_meta($user_id, 'phone', $posted_data['contact'], get_the_author_meta('phone', $user_id));
            $message = "<div>Username: " . $user_email . "</div><div>Password: " . $password . "</div>";
            $mail['body'] = str_replace('[user_pass]', $message, $mail['body']);
            $WPCF7_ContactForm->set_properties(array('mail_2' => $mail));
            global $wpdb;
            $sql = "INSERT INTO {$wpdb->wrranty_db_table} (invoiceId, address, contact, date_of_installation, wrranty_date, user_id) ";
            $sql .= " VALUES ('" . $posted_data["invoice_no"] . "', '" . $posted_data['block'] . " " . $posted_data['street_name'] . "' , '" . $posted_data['contact'] . "' , '" . $posted_data["date_of_installation"] . "', '', '" . $user_id . "') ";
            $wpdb->query($sql);
        } else {
            //            $WPCF7_ContactForm->skip_mail = true;
            $mail['body'] = "";
            $WPCF7_ContactForm->set_properties(array('mail_2' => $mail));
        }
    }
}
开发者ID:ntnvu,项目名称:tcb_online,代码行数:49,代码来源:functions.php

示例13: contact_form_7

 public function contact_form_7($cf7)
 {
     $forms = $this->get_forms('rdcf7_integrations');
     foreach ($forms as $form) {
         $form_id = get_post_meta($form->ID, 'form_id', true);
         if ($form_id == $cf7->id()) {
             $submission = WPCF7_Submission::get_instance();
             if ($submission) {
                 $this->form_data = $submission->get_posted_data();
             }
             $this->generate_static_fields($form->ID, 'Plugin Contact Form 7');
             $this->conversion($this->form_data);
         }
     }
 }
开发者ID:ResultadosDigitais,项目名称:rdstation-wp,代码行数:15,代码来源:lead-conversion.php

示例14: create_user_from_registration

function create_user_from_registration($cfdata)
{
    if (!isset($cfdata->posted_data) && class_exists('WPCF7_Submission')) {
        // Contact Form 7 version 3.9 removed $cfdata->posted_data and now
        // we have to retrieve it from an API
        $submission = WPCF7_Submission::get_instance();
        if ($submission) {
            $formdata = $submission->get_posted_data();
        }
    } elseif (isset($cfdata->posted_data)) {
        // For pre-3.9 versions of Contact Form 7
        $formdata = $cfdata->posted_data;
    } else {
        // We can't retrieve the form data
        return $cfdata;
    }
    // Check this is the user registration form
    if ($cfdata->title() == 'Your Registration Form Title') {
        $password = wp_generate_password(12, false);
        $email = $formdata['form-email-field'];
        $name = $formdata['form-name-field'];
        // Construct a username from the user's name
        $username = strtolower(str_replace(' ', '', $name));
        $name_parts = explode(' ', $name);
        if (!email_exists($email)) {
            // Find an unused username
            $username_tocheck = $username;
            $i = 1;
            while (username_exists($username_tocheck)) {
                $username_tocheck = $username . $i++;
            }
            $username = $username_tocheck;
            // Create the user
            $userdata = array('user_login' => $username, 'user_pass' => $password, 'user_email' => $email, 'nickname' => reset($name_parts), 'display_name' => $name, 'first_name' => reset($name_parts), 'last_name' => end($name_parts), 'role' => 'subscriber');
            $user_id = wp_insert_user($userdata);
            if (!is_wp_error($user_id)) {
                // Email login details to user
                $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
                $message = "Welcome! Your login details are as follows:" . "\r\n";
                $message .= sprintf(__('Username: %s'), $username) . "\r\n";
                $message .= sprintf(__('Password: %s'), $password) . "\r\n";
                $message .= wp_login_url() . "\r\n";
                wp_mail($email, sprintf(__('[%s] Your username and password'), $blogname), $message);
            }
        }
    }
    return $cfdata;
}
开发者ID:srinivasulurao,项目名称:transcharity,代码行数:48,代码来源:functions.php

示例15: insert_question

function insert_question($question_form)
{
    $submission = WPCF7_Submission::get_instance();
    if ($submission) {
        $posted_data = $submission->get_posted_data();
    }
    if ($posted_data['checktype'] == 'question') {
        $taxonomy = 'department';
        $term = get_term_by('slug', $posted_data['post_name'], $taxonomy);
        $term_id = $term->term_id;
        // Создание пользователя - автора вопроса
        if ($posted_data['your-email']) {
            $user_email = $posted_data['your-email'];
            $user_name = $posted_data['your-name'];
            $user_id = email_exists($user_email);
            if (!$user_id and email_exists($user_email) == false) {
                $random_password = wp_generate_password($length = 12, $include_standard_special_chars = false);
                $user_id = wp_create_user($user_name, $random_password, $user_email);
            }
        }
        $question = $posted_data['your-question'];
        // Добавление вопроса
        $question_id = wp_insert_post(array('post_content' => '', 'post_type' => 'question', 'post_title' => $user_name, 'post_excerpt' => $question, 'post_author' => $user_id));
        wp_set_object_terms($question_id, $term_id, $taxonomy);
        // Уведомление специалисту
        $doctors = get_posts(array('post_type' => 'doctor', 'tax_query' => array(array('taxonomy' => $taxonomy, 'field' => 'id', 'terms' => $term_id))));
        if ($doctors) {
            if ($posted_data['post_name'] == 'departments') {
                $page_url = get_site_url() . '/departments';
            } else {
                $page_url = get_site_url() . '/departments/' . $posted_data['post_name'];
            }
            $emails = array();
            $subject = 'Вопрос с сайта ' . get_site_url();
            $message = $posted_data['your-name'] . ' оставил(а) вопрос на странице: ' . $page_url;
            $headers = 'From: ' . get_bloginfo() . ' <no-reply@' . $_SERVER['SERVER_NAME'] . '>' . "\r\n";
            foreach ($doctors as $post) {
                setup_postdata($post);
                $author = get_user_by('login', get_the_author());
                $author_email = $author->user_email;
                array_push($emails, $author_email);
            }
            wp_reset_postdata();
            wp_mail($emails, $subject, $message, $headers);
        }
    }
    return $posted_data;
}
开发者ID:valerol,项目名称:artempol,代码行数:48,代码来源:departments.php


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