本文整理汇总了PHP中GFFormDetail类的典型用法代码示例。如果您正苦于以下问题:PHP GFFormDetail类的具体用法?PHP GFFormDetail怎么用?PHP GFFormDetail使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GFFormDetail类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_custom_choice
public static function save_custom_choice()
{
require_once GFCommon::get_base_path() . '/form_detail.php';
GFFormDetail::save_custom_choice();
}
示例2: 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}"))));
}
}
示例3: 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;
}
示例4: 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() {
//.........这里部分代码省略.........
示例5: field_settings
public function field_settings($position, $form_id)
{
//create settings on position 25 (right after Field Label)
if ($position == 25) {
?>
<li class="background_color_setting field_setting gform_setting_left_half">
<label for="field_signature_background_color">
<?php
_e('Background Color', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_background_color');
?>
</label>
<?php
GFFormDetail::color_picker('field_signature_background_color', 'SetSignatureBackColor');
?>
</li>
<li class="border_color_setting field_setting gform_setting_right_half">
<label for="field_signature_border_color">
<?php
_e('Border Color', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_border_color');
?>
</label>
<?php
GFFormDetail::color_picker('field_signature_border_color', 'SetSignatureBorderColor');
?>
</li>
<li class="border_width_setting field_setting gform_setting_left_half">
<label for="field_signature_border_width">
<?php
_e('Border Width', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_border_width');
?>
</label>
<select id="field_signature_border_width" onchange="SetSignatureBorderWidth(jQuery(this).val());">
<option value="0">None</option>
<option value="1">Small</option>
<option value="2">Medium</option>
<option value="3">Large</option>
</select>
</li>
<li class="border_style_setting field_setting gform_setting_right_half">
<label for="field_signature_border_style">
<?php
_e('Border Style', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_border_style');
?>
</label>
<select id="field_signature_border_style" onchange="SetSignatureBorderStyle(jQuery(this).val());">
<option>Dotted</option>
<option>Dashed</option>
<option>Groove</option>
<option>Ridge</option>
<option>Inset</option>
<option>Outset</option>
<option>Double</option>
<option>Solid</option>
</select>
</li>
<li class="pen_color_setting field_setting gform_setting_left_half">
<label for="field_signature_pen_color">
<?php
_e('Pen Color', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_pen_color');
?>
</label>
<?php
GFFormDetail::color_picker('field_signature_pen_color', 'SetSignaturePenColor');
?>
</li>
<li class="pen_size_setting field_setting gform_setting_right_half">
<label for="field_signature_pen_size">
<?php
_e('Pen Size', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_pen_size');
?>
</label>
<select id="field_signature_pen_size" onchange="SetSignaturePenSize(jQuery(this).val());">
<option value="1">Small</option>
<option value="2">Medium</option>
<option value="3">Large</option>
</select>
</li>
<?php
}
}
示例6: 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}"))));
}
}
示例7: change_input_type
public static function change_input_type()
{
require_once GFCommon::get_base_path() . "/form_detail.php";
GFFormDetail::change_input_type();
}
示例8: field_settings
/**
* Add the custom settings for the Signature field to the Appearance tab.
*
* @param int $position The position the settings should be located at.
* @param int $form_id The ID of the form currently being edited.
*/
public function field_settings($position, $form_id)
{
if ($position == 0) {
?>
<li class="background_color_setting field_setting gform_setting_left_half">
<label for="field_signature_background_color" class="section_label">
<?php
esc_html_e('Background Color', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_background_color');
?>
</label>
<?php
GFFormDetail::color_picker('field_signature_background_color', 'SetSignatureBackColor');
?>
</li>
<li class="border_color_setting field_setting gform_setting_right_half">
<label for="field_signature_border_color" class="section_label">
<?php
esc_html_e('Border Color', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_border_color');
?>
</label>
<?php
GFFormDetail::color_picker('field_signature_border_color', 'SetSignatureBorderColor');
?>
</li>
<li class="border_width_setting field_setting gform_setting_left_half">
<label for="field_signature_border_width" class="section_label">
<?php
esc_html_e('Border Width', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_border_width');
?>
</label>
<select id="field_signature_border_width" onchange="SetSignatureBorderWidth(jQuery(this).val());">
<option value="0"><?php
esc_html_e('None', 'gravityformssignature');
?>
</option>
<option value="1"><?php
esc_html_e('Small', 'gravityformssignature');
?>
</option>
<option value="2"><?php
esc_html_e('Medium', 'gravityformssignature');
?>
</option>
<option value="3"><?php
esc_html_e('Large', 'gravityformssignature');
?>
</option>
</select>
</li>
<li class="border_style_setting field_setting gform_setting_right_half">
<label for="field_signature_border_style" class="section_label">
<?php
esc_html_e('Border Style', 'gravityformssignature');
?>
<?php
gform_tooltip('signature_border_style');
?>
</label>
<select id="field_signature_border_style" onchange="SetSignatureBorderStyle(jQuery(this).val());">
<option value="dotted"><?php
esc_html_e('Dotted', 'gravityformssignature');
?>
</option>
<option value="dashed"><?php
esc_html_e('Dashed', 'gravityformssignature');
?>
</option>
<option value="groove"><?php
esc_html_e('Groove', 'gravityformssignature');
?>
</option>
<option value="ridge"><?php
esc_html_e('Ridge', 'gravityformssignature');
?>
</option>
<option value="inset"><?php
esc_html_e('Inset', 'gravityformssignature');
?>
</option>
<option value="outset"><?php
esc_html_e('Outset', 'gravityformssignature');
?>
</option>
<option value="double"><?php
esc_html_e('Double', 'gravityformssignature');
//.........这里部分代码省略.........