本文整理汇总了PHP中GFFormDetail::save_form_info方法的典型用法代码示例。如果您正苦于以下问题:PHP GFFormDetail::save_form_info方法的具体用法?PHP GFFormDetail::save_form_info怎么用?PHP GFFormDetail::save_form_info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GFFormDetail
的用法示例。
在下文中一共展示了GFFormDetail::save_form_info方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: uninstall_addon
/**
* Removes all settings and deactivates the Add-On.
*
* Not intended to be overridden or called directly by Add-Ons.
*
* @ignore
*/
public function uninstall_addon()
{
if (!$this->current_user_can_any($this->_capabilities_uninstall)) {
die(__("You don't have adequate permission to uninstall this addon: " . $this->_title, "gravityforms"));
}
$continue = $this->uninstall();
if (false === $continue) {
return false;
}
global $wpdb;
$lead_meta_table = GFFormsModel::get_lead_meta_table_name();
$forms = GFFormsModel::get_forms();
$all_form_ids = array();
// remove entry meta
foreach ($forms as $form) {
$all_form_ids[] = $form->id;
$entry_meta = $this->get_entry_meta(array(), $form->id);
if (is_array($entry_meta)) {
foreach (array_keys($entry_meta) as $meta_key) {
$sql = $wpdb->prepare("DELETE from {$lead_meta_table} WHERE meta_key=%s", $meta_key);
$wpdb->query($sql);
}
}
}
//remove form settings
$form_metas = GFFormsModel::get_form_meta_by_id($all_form_ids);
require_once GFCommon::get_base_path() . '/form_detail.php';
foreach ($form_metas as $form_meta) {
if (isset($form_meta[$this->_slug])) {
unset($form_meta[$this->_slug]);
$form_json = json_encode($form_meta);
GFFormDetail::save_form_info($form_meta["id"], addslashes($form_json));
}
}
//removing options
delete_option("gravityformsaddon_" . $this->_slug . "_settings");
delete_option("gravityformsaddon_" . $this->_slug . "_version");
//Deactivating plugin
deactivate_plugins($this->_path);
update_option('recently_activated', array($this->_path => time()) + (array) get_option('recently_activated'));
return true;
}
示例2: form_settings_ui
public static function form_settings_ui()
{
require_once GFCommon::get_base_path() . '/form_detail.php';
require_once GFCommon::get_base_path() . '/currency.php';
$form_id = rgget('id');
$form = RGFormsModel::get_form_meta($form_id);
$update_result = array();
if (rgpost('gform_meta')) {
// die if not posted from correct page
check_admin_referer("gform_save_form_settings_{$form_id}", 'gform_save_form_settings');
$updated_form = json_decode(rgpost('gform_meta'), true);
$updated_form['fields'] = $form['fields'];
// -- standard form settings --
$updated_form['title'] = rgpost('form_title_input');
$updated_form['description'] = rgpost('form_description_input');
$updated_form['labelPlacement'] = rgpost('form_label_placement');
$updated_form['descriptionPlacement'] = rgpost('form_description_placement');
$updated_form['subLabelPlacement'] = rgpost('form_sub_label_placement');
// -- advanced form settings --
$updated_form['cssClass'] = rgpost('form_css_class');
$updated_form['enableHoneypot'] = rgpost('form_enable_honeypot');
$updated_form['enableAnimation'] = rgpost('form_enable_animation');
// form button settings
$updated_form['button']['type'] = rgpost('form_button');
$updated_form['button']['text'] = rgpost('form_button') == 'text' ? rgpost('form_button_text_input') : '';
$updated_form['button']['imageUrl'] = rgpost('form_button') == 'image' ? rgpost('form_button_image_url') : '';
// Save and Continue settings
$updated_form['save']['enabled'] = rgpost('form_save_enabled');
$updated_form['save']['button']['type'] = 'link';
$updated_form['save']['button']['text'] = rgpost('form_save_button_text');
// limit entries settings
$updated_form['limitEntries'] = rgpost('form_limit_entries');
$updated_form['limitEntriesCount'] = $updated_form['limitEntries'] ? rgpost('form_limit_entries_count') : '';
$updated_form['limitEntriesPeriod'] = $updated_form['limitEntries'] ? rgpost('form_limit_entries_period') : '';
$updated_form['limitEntriesMessage'] = $updated_form['limitEntries'] ? rgpost('form_limit_entries_message') : '';
// form scheduling settings
$updated_form['scheduleForm'] = rgpost('form_schedule_form');
$updated_form['scheduleStart'] = $updated_form['scheduleForm'] ? rgpost('gform_schedule_start') : '';
$updated_form['scheduleStartHour'] = $updated_form['scheduleForm'] ? rgpost('form_schedule_start_hour') : '';
$updated_form['scheduleStartMinute'] = $updated_form['scheduleForm'] ? rgpost('form_schedule_start_minute') : '';
$updated_form['scheduleStartAmpm'] = $updated_form['scheduleForm'] ? rgpost('form_schedule_start_ampm') : '';
$updated_form['scheduleEnd'] = $updated_form['scheduleForm'] ? rgpost('form_schedule_end') : '';
$updated_form['scheduleEndHour'] = $updated_form['scheduleForm'] ? rgpost('form_schedule_end_hour') : '';
$updated_form['scheduleEndMinute'] = $updated_form['scheduleForm'] ? rgpost('form_schedule_end_minute') : '';
$updated_form['scheduleEndAmpm'] = $updated_form['scheduleForm'] ? rgpost('form_schedule_end_ampm') : '';
$updated_form['schedulePendingMessage'] = $updated_form['scheduleForm'] ? rgpost('form_schedule_pending_message') : '';
$updated_form['scheduleMessage'] = $updated_form['scheduleForm'] ? rgpost('form_schedule_message') : '';
// require login settings
$updated_form['requireLogin'] = rgpost('form_require_login');
$updated_form['requireLoginMessage'] = $updated_form['requireLogin'] ? rgpost('form_require_login_message') : '';
$updated_form = GFFormsModel::maybe_sanitize_form_settings($updated_form);
if ($updated_form['save']['enabled']) {
$updated_form = self::activate_save($updated_form);
} else {
$updated_form = self::deactivate_save($updated_form);
}
$updated_form = apply_filters('gform_pre_form_settings_save', $updated_form);
$update_result = GFFormDetail::save_form_info($form_id, addslashes(json_encode($updated_form)));
// update working form object with updated form object
$form = $updated_form;
}
$form = gf_apply_filters('gform_admin_pre_render', $form_id, $form);
self::page_header(__('Form Settings', 'gravityforms'));
?>
<script type="text/javascript">
<?php
GFCommon::gf_global();
?>
var form = <?php
echo json_encode($form);
?>
;
var fieldSettings = [];
jQuery(document).ready(function ($) {
HandleUnsavedChanges('#gform_form_settings');
jQuery('.datepicker').datepicker({showOn: 'both', changeMonth: true, changeYear: true, buttonImage: "<?php
echo GFCommon::get_base_url();
?>
/images/calendar.png", buttonImageOnly: true});
ToggleConditionalLogic(true, 'form_button');
jQuery('tr:hidden .gf_animate_sub_settings').hide();
jQuery(document).trigger('gform_load_form_settings', [form]);
});
/**
* New Form Settings Functions
*/
function SaveFormSettings() {
//.........这里部分代码省略.........
示例3: save_new_form
public static function save_new_form()
{
if (!check_admin_referer('gf_save_new_form', 'gf_save_new_form')) {
die(json_encode(array('error' => __('There was an issue creating your form.', 'gravityforms'))));
}
GFFormsModel::ensure_tables_exist();
require_once GFCommon::get_base_path() . '/form_detail.php';
$form_json = rgpost('form');
$form = json_decode($form_json, true);
if (empty($form['title'])) {
$result = array('error' => __('Please enter a form title.', 'gravityforms'));
die(json_encode($result));
}
/*
* This is now added in JavaScript using jQuery.toJSON(). See the DocBlock GFFormDetail::save_form_info() for details.
*
$form['labelPlacement'] = 'top_label';
$form['descriptionPlacement'] = 'below';
$form['button'] = array(
'type' => 'text',
'text' => __("Submit", "gravityforms"),
'imageUrl' => ''
);
$form['fields'] = array();
*/
$result = GFFormDetail::save_form_info(0, $form_json);
switch (rgar($result, 'status')) {
case 'invalid_json':
$result['error'] = __('There was an issue creating your form.', 'gravityforms');
die(json_encode($result));
case 'duplicate_title':
$result['error'] = __('Please enter a unique form title.', 'gravityforms');
die(json_encode($result));
default:
$form_id = abs($result['status']);
die(json_encode(array('redirect' => admin_url("admin.php?page=gf_edit_forms&id={$form_id}"))));
}
}
示例4: save_new_form
public static function save_new_form()
{
if (!check_admin_referer('gf_save_new_form', 'gf_save_new_form')) {
die(json_encode(array('error' => __('There was an issue creating your form.', 'gravityforms'))));
}
GFFormsModel::ensure_tables_exist();
require_once GFCommon::get_base_path() . '/form_detail.php';
$form_json = rgpost('form');
$form = json_decode($form_json, true);
if (empty($form['title'])) {
$result = array('error' => __('Please enter a form title.', 'gravityforms'));
die(json_encode($result));
}
$result = GFFormDetail::save_form_info(0, $form_json);
switch (rgar($result, 'status')) {
case 'invalid_json':
$result['error'] = __('There was an issue creating your form.', 'gravityforms');
die(json_encode($result));
case 'duplicate_title':
$result['error'] = __('Please enter a unique form title.', 'gravityforms');
die(json_encode($result));
default:
$form_id = absint($result['status']);
die(json_encode(array('redirect' => admin_url("admin.php?page=gf_edit_forms&id={$form_id}"))));
}
}