function wpcf7_contact_form($id) { global $wpdb; $table_name = wpcf7_table_name(); $id = (int) $id; $query = $wpdb->prepare("SELECT * FROM {$table_name} WHERE cf7_unit_id = %d", $id); if (!($row = $wpdb->get_row($query))) { return false; } // No data $contact_form = new WPCF7_ContactForm(); $contact_form->id = $row->cf7_unit_id; $contact_form->title = stripslashes_deep($row->title); $contact_form->form = stripslashes_deep(maybe_unserialize($row->form)); $contact_form->mail = stripslashes_deep(maybe_unserialize($row->mail)); $contact_form->mail_2 = stripslashes_deep(maybe_unserialize($row->mail_2)); $contact_form->messages = stripslashes_deep(maybe_unserialize($row->messages)); $contact_form->additional_settings = stripslashes_deep(maybe_unserialize($row->additional_settings)); $contact_form->upgrade(); return $contact_form; }
function wpcf7_contact_form($id) { $post = get_post($id); if (empty($post) || 'wpcf7_contact_form' != get_post_type($post)) { return false; } $contact_form = new WPCF7_ContactForm(); $contact_form->id = $post->ID; $contact_form->title = $post->post_title; $contact_form->form = get_post_meta($post->ID, 'form', true); $contact_form->mail = get_post_meta($post->ID, 'mail', true); $contact_form->mail_2 = get_post_meta($post->ID, 'mail_2', true); $contact_form->messages = get_post_meta($post->ID, 'messages', true); $contact_form->additional_settings = get_post_meta($post->ID, 'additional_settings', true); $contact_form->upgrade(); $contact_form = apply_filters_ref_array('wpcf7_contact_form', array(&$contact_form)); return $contact_form; }
function wpcf7_contact_form($id) { global $wpdb, $wpcf7; $query = $wpdb->prepare("SELECT * FROM {$wpcf7->contactforms} WHERE cf7_unit_id = %d", $id); if (!($row = $wpdb->get_row($query))) { return false; } // No data $contact_form = new WPCF7_ContactForm(); $contact_form->id = $row->cf7_unit_id; $contact_form->title = maybe_unserialize($row->title); $contact_form->form = maybe_unserialize($row->form); $contact_form->mail = maybe_unserialize($row->mail); $contact_form->mail_2 = maybe_unserialize($row->mail_2); $contact_form->messages = maybe_unserialize($row->messages); $contact_form->additional_settings = maybe_unserialize($row->additional_settings); $contact_form->upgrade(); return $contact_form; }