本文整理汇总了PHP中GFAPI::update_form方法的典型用法代码示例。如果您正苦于以下问题:PHP GFAPI::update_form方法的具体用法?PHP GFAPI::update_form怎么用?PHP GFAPI::update_form使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFAPI
的用法示例。
在下文中一共展示了GFAPI::update_form方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fix
public function fix()
{
if ($this->can_fix()) {
$forms = GFAPI::get_forms();
foreach ($forms as $form) {
$form['enableHoneypot'] = 1;
GFAPI::update_form($form);
}
}
return $this->run();
}
示例2: set_post_content
function set_post_content($entry, $form)
{
//getting post
$post = get_post($entry['post_id']);
$posta = $wp_query->post;
$postid = $post->ID;
//setting grid variables
$petition_form_contain = '"container"';
$petition_form_row = '"row"';
$petition_form_col_1 = '"col-md-1"';
$petition_form_col_4_off_1 = '"col-md-4 col-md-offset-1"';
$petition_form_col_5 = '"col-md-5"';
$petition_form_col_6_off_1 = '"col-md-6 col-md-offset-1"';
//other variables
$petition_form = '"petition-privacy"';
$petition_form_petf = '"petfsize"';
$quoteone = '"';
//setting up the petition form
$formid = 1;
$form_count = RGFormsModel::get_form_counts($formid);
$form_count_disp = $form_count['total'];
$form_id_step = $form_count_disp + 32;
$form_id = 2;
$form = GFAPI::get_form($form_id);
$form_add_new = GFAPI::add_form($form);
$form_id = $form_id_step;
$form = GFAPI::get_form($form_id);
$form['title'] = 'Petition Form ID' . ' ' . $form_id;
$result = GFAPI::update_form($form);
//changing post content
$post->post_content = "<div class={$petition_form_col_4_off_1}>[gravityform id ={$quoteone}{$form_id_step}{$quoteone}]</div><div class={$petition_form_contain}><div class={$petition_form_row}>\r\n<div class={$petition_form_col_6_off_1}><div class={$petition_form_petf}>" . rgar($entry, '4') . "</div></div><div class={$petition_form_col_5}></div></div></div>";
//updating post
wp_update_post($post);
//adding form ID
$post_id = $postid;
$meta_key = 'field_petition_form_id';
$meta_value = $form_id_step;
add_post_meta($post_id, $meta_key, $meta_value);
}
示例3: update_gravity_form
public static function update_gravity_form($post_id)
{
if (self::$formID === false || self::$fieldID === false) {
return;
}
$formValues = get_field('contact_form_options', $post_id);
if ($post_id == self::$optionsID) {
$form = GFAPI::get_form(self::$formID);
$first = true;
foreach ($form['fields'] as $key => $value) {
if ($form['fields'][$key]->id == self::$fieldID) {
$form['fields'][$key]->choices = array();
foreach ($formValues as $key2 => $value2) {
$form['fields'][$key]->choices[] = array('text' => $value2['subject'], 'value' => self::encrypt($value2['email']), 'isSelected' => $first);
if ($first == true) {
$first = false;
}
}
}
}
GFAPI::update_form($form);
}
}
示例4: put_forms
public function put_forms($data, $form_id = null)
{
$this->authorize("gravityforms_create_form");
if (empty($form_id)) {
$result = GFAPI::update_forms($data);
} else {
$result = GFAPI::update_form($data, $form_id);
}
if (is_wp_error($result)) {
$response = $this->get_error_response($result);
$status = $this->get_error_status($result);
} else {
$status = 200;
$response = empty($form_id) ? __("Forms updated successfully", "gravityforms") : __("Form updated successfully", "gravityforms");
}
$this->end($status, $response);
}
示例5: put_forms
public function put_forms($data, $form_id = null)
{
$this->log_debug(__METHOD__ . '(): Running.');
$capability = apply_filters('gform_web_api_capability_put_forms', 'gravityforms_create_form');
$this->authorize($capability);
if (empty($form_id)) {
$result = GFAPI::update_forms($data);
} else {
$result = GFAPI::update_form($data, $form_id);
}
if (is_wp_error($result)) {
$response = $this->get_error_response($result);
$status = $this->get_error_status($result);
} else {
$status = 200;
$response = empty($form_id) ? __('Forms updated successfully', 'gravityforms') : __('Form updated successfully', 'gravityforms');
}
$this->end($status, $response);
}
示例6: aria_create_competition_form
function aria_create_competition_form()
{
$competition_creation_form = new GF_Form("ARIA: Create a Competition", "");
$field_id_array = aria_create_competition_field_id_array();
// Name Field
$competition_name_field = new GF_Field_Text();
$competition_name_field->label = "Name of Competition";
$competition_name_field->id = $field_id_array['competition_name'];
$competition_name_field->isRequired = true;
// Start Date of the competition
$competition_start_date_field = new GF_Field_Date();
$competition_start_date_field->label = "Date of Competition";
$competition_start_date_field->id = $field_id_array['competition_start_date'];
$competition_start_date_field->isRequired = false;
$competition_start_date_field->calendarIconType = 'calendar';
$competition_start_date_field->dateType = 'datepicker';
// End Date of the competition
$competition_end_date_field = new GF_Field_Date();
$competition_end_date_field->label = "Date of Competition";
$competition_end_date_field->id = $field_id_array['competition_end_date'];
$competition_end_date_field->isRequired = false;
$competition_end_date_field->calendarIconType = 'calendar';
$competition_end_date_field->dateType = 'datepicker';
// Location
$competition_location_field = new GF_Field_Address();
$competition_location_field->label = "Location of Competition";
$competition_location_field->id = $field_id_array['competition_location'];
$competition_location_field->isRequired = false;
$competition_location_field = aria_add_default_address_inputs($competition_location_field);
// Student Registration start date
$student_registration_start_date_field = new GF_Field_Date();
$student_registration_start_date_field->label = "Student Registration Start Date";
$student_registration_start_date_field->id = $field_id_array['student_registration_start_date'];
$student_registration_start_date_field->isRequired = false;
$student_registration_start_date_field->calendarIconType = 'calendar';
$student_registration_start_date_field->dateType = 'datepicker';
// Student Registration deadline
$student_registration_end_date_field = new GF_Field_Date();
$student_registration_end_date_field->label = "Student Registration End Date";
$student_registration_end_date_field->id = $field_id_array['student_registration_end_date'];
$student_registration_end_date_field->isRequired = false;
$student_registration_end_date_field->calendarIconType = 'calendar';
$student_registration_end_date_field->dateType = 'datepicker';
// Teacher Registration start date
$teacher_registration_start_date_field = new GF_Field_Date();
$teacher_registration_start_date_field->label = "Teacher Registration Start Date";
$teacher_registration_start_date_field->id = $field_id_array['teacher_registration_start_date'];
$teacher_registration_start_date_field->isRequired = false;
$teacher_registration_start_date_field->calendarIconType = 'calendar';
$teacher_registration_start_date_field->dateType = 'datepicker';
// Teacher Registration deadline
$teacher_registration_end_date_field = new GF_Field_Date();
$teacher_registration_end_date_field->label = "Teacher Registration End Date";
$teacher_registration_end_date_field->id = $field_id_array['teacher_registration_end_date'];
$teacher_registration_end_date_field->isRequired = false;
$teacher_registration_end_date_field->calendarIconType = 'calendar';
$teacher_registration_end_date_field->dateType = 'datepicker';
$competition_creation_form->fields[] = $competition_name_field;
$competition_creation_form->fields[] = $competition_start_date_field;
$competition_creation_form->fields[] = $competition_end_date_field;
$competition_creation_form->fields[] = $competition_location_field;
$competition_creation_form->fields[] = $student_registration_start_date_field;
$competition_creation_form->fields[] = $student_registration_end_date_field;
$competition_creation_form->fields[] = $teacher_registration_start_date_field;
$competition_creation_form->fields[] = $teacher_registration_end_date_field;
$result = GFAPI::add_form($competition_creation_form->createFormArray());
global $new_form_id;
$new_form_id = $result;
//static::$competition_creation_form_id = intval($result);
// This is done after the form has been added so that the initial confirmation
// hash has been added to the object.
$added_competition_creation_form = GFAPI::get_form(intval($result));
foreach ($added_competition_creation_form['confirmations'] as $key => $value) {
$added_competition_creation_form['confirmations'][$key]['message'] = "Thanks for contacting us! We will get in touch with you shortly.";
$added_competition_creation_form['confirmations'][$key]['type'] = "message";
break;
}
GFAPI::update_form($added_competition_creation_form);
//static::$competition_creation_form_id = intval($result);
return $result;
}
示例7: test_assignee_field
function test_assignee_field()
{
$form = GFAPI::get_form($this->form_id);
$assignee_field_properties_json = '{"type":"workflow_assignee_select","id":6,"label":"Assignee","adminLabel":"","isRequired":false,"size":"medium","errorMessage":"","inputs":null,"formId":93,"pageNumber":1,"choices":"","conditionalLogic":"","displayOnly":"","labelPlacement":"","descriptionPlacement":"","subLabelPlacement":"","placeholder":"","multipleFiles":false,"maxFiles":"","calculationFormula":"","calculationRounding":"","enableCalculation":"","disableQuantity":false,"displayAllCategories":false,"inputMask":false,"inputMaskValue":"","allowsPrepopulate":false,"gravityflowAssigneeFieldShowUsers":true,"gravityflowAssigneeFieldShowRoles":true,"gravityflowAssigneeFieldShowFields":true,"cssClass":""}';
$assignee_field_properties = json_decode($assignee_field_properties_json, true);
$assignee_field_properties['id'] = 999;
$assignee_field = new Gravity_Flow_Field_Assignee_Select($assignee_field_properties);
$form['fields'][] = $assignee_field;
GFAPI::update_form($form);
$step_settings = array('assignees' => array('assignee_field|999'));
$step1_id = $this->_add_user_input_step($step_settings);
$this->_create_entries();
$entries = GFAPI::get_entries($this->form_id);
$entry = $entries[0];
$entry_id = $entry['id'];
$entry[999] = 'user_id|1';
GFAPI::update_entry($entry);
// simulate submission
gravity_flow()->maybe_process_feed($entry, $form);
$this->api->process_workflow($entry_id);
$entry = GFAPI::get_entry($entry_id);
// Check status
$status = $this->api->get_status($entry);
$this->assertEquals('pending', $status);
// Complete
$step1 = $this->api->get_step($step1_id, $entry);
$step1->update_user_status(1, 'complete');
$this->api->process_workflow($entry_id);
// Refresh entry
$entry = GFAPI::get_entry($entry_id);
// Check status
$status = $this->api->get_status($entry);
$this->assertEquals('complete', $status);
}
示例8: update_object
function update_object($form_id, $form)
{
$form['id'] = $form_id;
return GFAPI::update_form($form);
}
示例9: save_form_title
public static function save_form_title()
{
check_admin_referer('gf_save_title', 'gf_save_title');
$form_title = json_decode(rgpost('title'));
$form_id = rgpost('formId');
$form = GFAPI::get_form($form_id);
$form['title'] = $form_title;
GFAPI::update_form($form, $form_id);
}
示例10: aria_create_teacher_and_student_forms
/**
* This function will create new registration forms for students and parents.
*
* This function is responsible for creating new registration forms for both
* students and parents. This function will only create new registration forms
* for students and parents if it is used ONLY in conjunction with the form
* used to create new music competitions.
*
* @param Entry Object $entry The entry that was just submitted
* @param Form Object $form The form used to submit entries
*
* @since 1.0.0
* @author KREW
*/
public static function aria_create_teacher_and_student_forms($confirmation, $form, $entry, $ajax)
{
// make sure the create competition form is calling this function
$competition_creation_form_id = ARIA_API::aria_get_create_competition_form_id();
if ($form['id'] === $competition_creation_form_id) {
/*
Calls wp_die and returns a value of 86?
self::aria_update_page_ids();
*/
$field_mapping = self::aria_get_competition_entry_meta();
$competition_name = $entry[$field_mapping['Name of Competition']];
// create the student and teacher forms
$student_form_id = self::aria_create_student_form($entry);
$teacher_form_id = self::aria_create_teacher_form($entry, unserialize($entry[(string) $field_mapping['Volunteer Times']]));
$student_form_url = self::aria_publish_form("{$competition_name} Student Registration", $student_form_id);
$teacher_form_url = self::aria_publish_form("{$competition_name} Teacher Registration", $teacher_form_id);
// create the sutdent and teacher (master) forms
$student_master_form_id = ARIA_Create_Master_Forms::aria_create_student_master_form($competition_name);
$teacher_master_form_id = ARIA_Create_Master_Forms::aria_create_teacher_master_form($competition_name);
$related_forms = array('student_public_form_id' => $student_form_id, 'teacher_public_form_id' => $teacher_form_id, 'student_master_form_id' => $student_master_form_id, 'teacher_master_form_id' => $teacher_master_form_id, 'student_public_form_url' => $student_form_url, 'teacher_public_form_url' => $teacher_form_url);
$student_public_form = GFAPI::get_form($student_form_id);
$teacher_public_form = GFAPI::get_form($teacher_form_id);
$student_master_form = GFAPI::get_form($student_master_form_id);
$teacher_master_form = GFAPI::get_form($teacher_master_form_id);
$student_public_form['aria_relations'] = $related_forms;
$teacher_public_form['aria_relations'] = $related_forms;
$student_master_form['aria_relations'] = $related_forms;
$teacher_master_form['aria_relations'] = $related_forms;
GFAPI::update_form($student_public_form);
GFAPI::update_form($teacher_public_form);
GFAPI::update_form($student_master_form);
GFAPI::update_form($teacher_master_form);
$teacher_public_form = GFAPI::get_form($teacher_form_id);
$confirmation = 'Congratulations! A new music competition has been ';
$confirmation .= 'created. The following forms are now available for ';
$confirmation .= ' students and teachers to use for registration: </br>';
$confirmation .= "<a href={$student_form_url}>{$competition_name} Student Registration</a>";
$confirmation .= " was published. </br>";
$confirmation .= "<a href={$teacher_form_url}> {$competition_name} Teacher Registration </a>";
$confirmation .= " was published.";
return $confirmation;
} else {
wp_die("ERROR: No form currently exists that allows the festival chairman\n to create a new music competition \n FormID: {$form[id]} \n func_call {$competition_creation_form_id}");
}
}
示例11: create_multi_table
/**
* Creates table that all Multi Entry data goes into
*/
public function create_multi_table($form)
{
global $wpdb;
$multi_entry_title = str_replace(' ', '_', $form['title']);
$table_name = $wpdb->prefix . 'me_' . strtolower($multi_entry_title);
if ($wpdb->get_var("SHOW TABLES LIKE '{$table_name}'") !== $table_name) {
$charset_collate = $wpdb->get_charset_collate();
$sql = "CREATE TABLE {$table_name} ( \n\t\t\t\t\tid INT NOT NULL AUTO_INCREMENT,\n\t\t\t\t\tentry_id VARCHAR(50) NOT NULL,\n";
$fields = $this->multi_get_fields($form);
/**
* Future feature
* - updated 06.17.15
* - On plugin page (not yet created) end user can specify text used in front of all multi entry fields
* -
* - for now just set our settings (identifier, multi_label)
*/
$settings = $this->get_multi_entry_settings();
if (!isset($settings['identifier'])) {
$settings['identifier'] = 'player';
}
if (!isset($settings['table_label'])) {
$settings['table_label'] = 'multi_label';
}
//get our array for creating main table
$fields_merge = $this->reorder_array($fields, $settings);
foreach ($fields_merge as $fm) {
//var_dump($fm);
$t_label = isset($fm[$settings['table_label']]) ? $fm[$settings['table_label']] : false;
if ($t_label == 1 || !$t_label) {
$fml = $fm['field_label'];
$sql .= " {$fml} VARCHAR(50) NOT NULL,\n";
}
}
//Add payment entries and other fluff
//$entry_fluff = array('date_created', 'payment_status', 'payment_date', 'transaction_id', 'payment_amount', 'payment_method', 'is_fulfulled', 'transaction_type', 'status');
$entry_fluff = $this->get_payment_addon_array();
foreach ($entry_fluff as $fluff) {
if ($fluff == 'id') {
$fluff = 'entry_id';
}
$sql .= "{$fluff} VARCHAR(50), \n";
}
//finish off the table definition
$sql .= " UNIQUE KEY id(id)) {$charset_collate};";
// -------- DEBUG ------------------
foreach ($fields as $field) {
$fields_input[] = $field['inputs'];
}
//echo 'Field Merge: ';
//var_dump($fields_merge);
//echo 'SQL: ';
//var_dump($sql);
// -------- END DEBUG ------------------
require_once ABSPATH . '/wp-admin/includes/upgrade.php';
dbDelta($sql);
//Create our meta table
$fields_meta = $this->reorder_array($fields, $settings, true);
$meta_table = $this->create_multi_meta_table($fields_meta, $form['id']);
//Add table name to form object to use later
$form['multiTableName'] = $table_name;
$result = GFAPI::update_form($form);
}
return $form;
}
示例12: aria_update_create_competition_validation
/**
* Trying to rename confirmation message.
*/
function aria_update_create_competition_validation($entry, $form)
{
// get the meta information obtained via creating a competition
$field_mapping = aria_get_competition_entry_meta();
$student_registration_form_name = $entry[$field_mapping['Name of Competition']];
$student_registration_form_name .= ' Student Registration';
$teacher_registration_form_name = $entry[$field_mapping['Name of Competition']];
$teacher_registration_form_name .= ' Teacher Registration';
// generate the successful submission message
$create_competition_form_id = aria_get_create_competition_form_id();
$create_competition_form = GFAPI::get_form($create_competition_form_id);
$successful_submission_message = 'Congratulations! A new music competition has been created.';
$successful_submission_message = 'There are now two new forms titled \'$student_registration_form_name\'';
$successful_submission_message = 'and \'$teacher_registration_form_name\' that students and teachers can';
$successful_submission_message = '(respectively) use to register.';
$create_competition_form['confirmation']['type'] = 'message';
$create_competition_form['confirmation']['message'] = $successful_submission_message;
// update the competition creation form
$result = GFAPI::update_form($create_competition_form);
if (is_wp_error($result)) {
wp_die('Could not update the competition creation form to have a custom message');
}
}
示例13: save_feed_order
public function save_feed_order($form_id, $feed_order)
{
/* Get the form object. */
$form = GFAPI::get_form($form_id);
/* If the form object doesn't exist, exit. */
if (!$form) {
return;
}
/* Add the feed order for this Add-On to the feed order array. */
$form['feedOrder'][$this->_slug] = $feed_order;
/* Save the form. */
GFAPI::update_form($form);
}