get( GF_Save_Form_Service_Provider::GF_SAVE_FROM_HELPER );
$update_result = '';
if ( rgpost( 'operation' ) == 'trash' ) {
check_admin_referer( 'gforms_trash_form', 'gforms_trash_form' );
GFFormsModel::trash_form( $form_id );
?>
is_ajax_save_action() === false ) {
check_admin_referer( "gforms_update_form_{$form_id}", 'gforms_update_form' );
$update_result = self::save_form_info( $form_id, rgpost( 'gform_meta', false ) );
?>
var form = " . json_encode( $form ) . ';';
} else {
echo "";
}
?>
array(
'name' => 'standard_fields',
'label' => __( 'Standard Fields', 'gravityforms' ),
'tooltip_class' => 'tooltip_bottomleft',
'fields' => array(),
'fields' => array(
array( 'data-type' => 'text', 'value' => GFCommon::get_field_type_title( 'text' ) ),
array( 'data-type' => 'textarea', 'value' => GFCommon::get_field_type_title( 'textarea' ) ),
array( 'data-type' => 'select', 'value' => GFCommon::get_field_type_title( 'select' ) ),
array( 'data-type' => 'number', 'value' => GFCommon::get_field_type_title( 'number' ) ),
array( 'data-type' => 'checkbox', 'value' => GFCommon::get_field_type_title( 'checkbox' ) ),
array( 'data-type' => 'radio', 'value' => GFCommon::get_field_type_title( 'radio' ) ),
array( 'data-type' => 'hidden', 'value' => GFCommon::get_field_type_title( 'hidden' ) ),
array( 'data-type' => 'html', 'value' => GFCommon::get_field_type_title( 'html' ) ),
array( 'data-type' => 'section', 'value' => GFCommon::get_field_type_title( 'section' ) ),
array( 'data-type' => 'page', 'value' => GFCommon::get_field_type_title( 'page' ) ),
),
),
'advanced_fields' => array(
'name' => 'advanced_fields',
'label' => __( 'Advanced Fields', 'gravityforms' ),
'fields' => array(
array( 'data-type' => 'name', 'value' => GFCommon::get_field_type_title( 'name' ) ),
array( 'data-type' => 'date', 'value' => GFCommon::get_field_type_title( 'date' ) ),
array( 'data-type' => 'time', 'value' => GFCommon::get_field_type_title( 'time' ) ),
array( 'data-type' => 'phone', 'value' => GFCommon::get_field_type_title( 'phone' ) ),
array( 'data-type' => 'address', 'value' => GFCommon::get_field_type_title( 'address' ) ),
array( 'data-type' => 'website', 'value' => GFCommon::get_field_type_title( 'website' ) ),
array( 'data-type' => 'email', 'value' => GFCommon::get_field_type_title( 'email' ) ),
array( 'data-type' => 'fileupload', 'value' => GFCommon::get_field_type_title( 'fileupload' ) ),
array( 'data-type' => 'captcha', 'value' => GFCommon::get_field_type_title( 'captcha' ) ),
array( 'data-type' => 'list', 'value' => GFCommon::get_field_type_title( 'list' ) ),
array( 'data-type' => 'multiselect', 'value' => GFCommon::get_field_type_title( 'multiselect' ) ),
),
),
'post_fields' => array(
'name' => 'post_fields',
'label' => __( 'Post Fields', 'gravityforms' ),
'fields' => array(
array( 'data-type' => 'post_title', 'value' => GFCommon::get_field_type_title( 'post_title' ) ),
array( 'data-type' => 'post_content', 'value' => GFCommon::get_field_type_title( 'post_content' ) ),
array( 'data-type' => 'post_excerpt', 'value' => GFCommon::get_field_type_title( 'post_excerpt' ) ),
array( 'data-type' => 'post_tags', 'value' => GFCommon::get_field_type_title( 'post_tags' ) ),
array( 'data-type' => 'post_category', 'value' => GFCommon::get_field_type_title( 'post_category' ) ),
array( 'data-type' => 'post_image', 'value' => GFCommon::get_field_type_title( 'post_image' ) ),
array( 'data-type' => 'post_custom_field', 'value' => GFCommon::get_field_type_title( 'post_custom_field' ) ),
),
),
'pricing_fields' => array(
'name' => 'pricing_fields',
'label' => __( 'Pricing Fields', 'gravityforms' ),
'fields' => array(
array( 'data-type' => 'product', 'value' => GFCommon::get_field_type_title( 'product' ) ),
array( 'data-type' => 'quantity', 'value' => GFCommon::get_field_type_title( 'quantity' ) ),
array( 'data-type' => 'option', 'value' => GFCommon::get_field_type_title( 'option' ) ),
array( 'data-type' => 'shipping', 'value' => GFCommon::get_field_type_title( 'shipping' ) ),
array( 'data-type' => 'total', 'value' => GFCommon::get_field_type_title( 'total' ) ),
),
),
);
// If enabled insert the password field between the email and fileupload fields.
if ( apply_filters( 'gform_enable_password_field', false ) ) {
$password = array(
'data-type' => 'password',
'value' => GFCommon::get_field_type_title( 'password' )
);
array_splice( $field_groups['advanced_fields']['fields'], 7, 0, array( $password ) );
}
// Add credit card field, if enabled.
if ( apply_filters( 'gform_enable_credit_card_field', false ) ) {
$field_groups['pricing_fields']['fields'][] = array(
'data-type' => 'creditcard',
'value' => GFCommon::get_field_type_title( 'creditcard' )
);
}
/**
* Modify the field groups before fields are added.
*
* @since 2.2.6
*
* @param array $field_groups The field groups, including group name, label and fields.
*/
$field_groups = apply_filters( 'gform_field_groups_form_editor', $field_groups );
// Remove array keys from field groups array.
$field_groups = array_values( $field_groups );
// Add buttons to fields.
foreach ( GF_Fields::get_all() as $gf_field ) {
$field_groups = $gf_field->add_button( $field_groups );
}
/**
* Add/edit/remove "Add Field" buttons from the form editor's floating toolbox.
*
* @param array $field_groups The field groups, including group name, label and fields.
*/
return apply_filters( 'gform_add_field_buttons', $field_groups );
}
public static function color_picker( $field_name, $callback ) {
?>
0 );
if ( ! empty( $_POST['search'] ) )
$args['search'] = $_POST['search'];
$categories = get_categories( $args );
}
if ( ! $categories )
return false;
$children = self::_get_term_hierarchy( 'category' );
$start = ( $page - 1 ) * $per_page;
$end = $start + $per_page;
$i = - 1;
foreach ( $categories as $category ) {
if ( $count >= $end )
break;
$i ++;
if ( $category->parent != $parent )
continue;
// If the page starts in a subtree, print the parents.
if ( $count == $start && $category->parent > 0 ) {
$my_parents = array();
while ( $my_parent ) {
$my_parent = get_category( $my_parent );
$my_parents[] = $my_parent;
if ( ! $my_parent->parent )
break;
$my_parent = $my_parent->parent;
}
$num_parents = count( $my_parents );
while ( $my_parent = array_pop( $my_parents ) ) {
self::_cat_row( $my_parent, $level - $num_parents, $output );
$num_parents --;
}
}
if ( $count >= $start )
self::_cat_row( $category, $level, $output );
//unset($categories[ $i ]); // Prune the working set
$count ++;
if ( isset( $children[ $category->term_id ] ) )
self::_cat_rows( $categories, $count, $output, $category->term_id, $level + 1, $page, $per_page );
}
}
private static function _cat_row( $category, $level, &$output, $name_override = false ) {
static $row_class = '';
$cat = get_category( $category, OBJECT, 'display' );
$default_cat_id = (int) get_option( 'default_category' );
$pad = str_repeat( '— ', $level );
$name = ( $name_override ? $name_override : $pad . ' ' . $cat->name );
$cat->count = number_format_i18n( $cat->count );
$output .= "";
}
private static function _get_term_hierarchy( $taxonomy ) {
if ( ! is_taxonomy_hierarchical( $taxonomy ) )
return array();
$children = get_option( "{$taxonomy}_children" );
if ( is_array( $children ) )
return $children;
$children = array();
$terms = get_terms( $taxonomy, 'get=all' );
foreach ( $terms as $term ) {
if ( $term->parent > 0 )
$children[ $term->parent ][] = $term->term_id;
}
update_option( "{$taxonomy}_children", $children );
return $children;
}
private static function insert_variable_prepopulate( $element_id, $callback = '' ) {
?>