@@ -19,7 +19,7 @@ |
||
| 19 | 19 | FrmAppController::get_form_nav( $id, true, 'hide' ); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | - ?> |
|
| 22 | + ?> |
|
| 23 | 23 | <div class="frm_form_builder with_frm_style"> |
| 24 | 24 | |
| 25 | 25 | <p class="frm_hidden frm-no-margin"> |
@@ -1,5 +1,5 @@ |
||
| 1 | 1 | <div class="wrap"> |
| 2 | - <h2><?php echo ( $form->is_template ? __( 'Templates', 'formidable' ) : __( 'Build', 'formidable' )); ?> |
|
| 2 | + <h2><?php echo ( $form->is_template ? __( 'Templates', 'formidable' ) : __( 'Build', 'formidable' ) ); ?> |
|
| 3 | 3 | <a href="?page=formidable&frm_action=new" class="add-new-h2"><?php _e( 'Add New', 'formidable' ); ?></a> |
| 4 | 4 | </h2> |
| 5 | 5 | |
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <div class="posttypediv"> |
| 2 | 2 | <ul class="posttype-tabs add-menu-item-tabs"> |
| 3 | 3 | <li <?php echo ( 'default' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 4 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=default#tabs-panel-success-msg') ?>" class="nav-tab-link" data-type="tabs-panel-success-msg" ><?php _e( 'Success', 'formidable' ) ?></a> |
|
| 4 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=default#tabs-panel-success-msg' ) ?>" class="nav-tab-link" data-type="tabs-panel-success-msg" ><?php _e( 'Success', 'formidable' ) ?></a> |
|
| 5 | 5 | </li> |
| 6 | 6 | <li <?php echo ( 'error-msg' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 7 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=error-msge#page-error-msg') ?>" class="nav-tab-link" data-type="tabs-panel-error-msg" ><?php _e( 'Error', 'formidable' ) ?></a> |
|
| 7 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=error-msge#page-error-msg' ) ?>" class="nav-tab-link" data-type="tabs-panel-error-msg" ><?php _e( 'Error', 'formidable' ) ?></a> |
|
| 8 | 8 | </li> |
| 9 | 9 | </ul><!-- .posttype-tabs --> |
| 10 | 10 | |
@@ -14,19 +14,19 @@ discard block |
||
| 14 | 14 | <div class="field-group field-group-border clearfix"> |
| 15 | 15 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
| 16 | 16 | <div class="hasPicker"> |
| 17 | - <input name="<?php echo esc_attr( $frm_style->get_field_name('success_bg_color') ) ?>" id="frm_success_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_bg_color'] ) ?>" type="text" /></div> |
|
| 17 | + <input name="<?php echo esc_attr( $frm_style->get_field_name( 'success_bg_color' ) ) ?>" id="frm_success_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_bg_color'] ) ?>" type="text" /></div> |
|
| 18 | 18 | </div> |
| 19 | 19 | <div class="field-group clearfix"> |
| 20 | 20 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 21 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('success_border_color') ) ?>" id="frm_success_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_border_color'] ) ?>" /> |
|
| 21 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'success_border_color' ) ) ?>" id="frm_success_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_border_color'] ) ?>" /> |
|
| 22 | 22 | </div> |
| 23 | 23 | <div class="field-group clearfix"> |
| 24 | 24 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 25 | - <input name="<?php echo esc_attr( $frm_style->get_field_name('success_text_color') ) ?>" id="frm_success_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_text_color'] ) ?>" type="text" /> |
|
| 25 | + <input name="<?php echo esc_attr( $frm_style->get_field_name( 'success_text_color' ) ) ?>" id="frm_success_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['success_text_color'] ) ?>" type="text" /> |
|
| 26 | 26 | </div> |
| 27 | 27 | <div class="field-group clearfix"> |
| 28 | 28 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 29 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('success_font_size') ) ?>" id="frm_success_font_size" value="<?php echo esc_attr( $style->post_content['success_font_size'] ) ?>" size="3" /> |
|
| 29 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'success_font_size' ) ) ?>" id="frm_success_font_size" value="<?php echo esc_attr( $style->post_content['success_font_size'] ) ?>" size="3" /> |
|
| 30 | 30 | </div> |
| 31 | 31 | <div class="clear"></div> |
| 32 | 32 | </div><!-- /.tabs-panel --> |
@@ -37,21 +37,21 @@ discard block |
||
| 37 | 37 | <div class="field-group field-group-border clearfix"> |
| 38 | 38 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
| 39 | 39 | <div class="hasPicker"> |
| 40 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('error_bg') ) ?>" id="frm_error_bg" class="hex" value="<?php echo esc_attr($style->post_content['error_bg']) ?>" /></div> |
|
| 40 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'error_bg' ) ) ?>" id="frm_error_bg" class="hex" value="<?php echo esc_attr( $style->post_content['error_bg'] ) ?>" /></div> |
|
| 41 | 41 | </div> |
| 42 | 42 | <div class="field-group clearfix"> |
| 43 | 43 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 44 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('error_border') ) ?>" id="frm_error_border" class="hex" value="<?php echo esc_attr( $style->post_content['error_border'] ) ?>" /> |
|
| 44 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'error_border' ) ) ?>" id="frm_error_border" class="hex" value="<?php echo esc_attr( $style->post_content['error_border'] ) ?>" /> |
|
| 45 | 45 | </div> |
| 46 | 46 | <div class="field-group clearfix"> |
| 47 | 47 | |
| 48 | 48 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 49 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('error_text') ) ?>" id="frm_error_text" class="hex" value="<?php echo esc_attr( $style->post_content['error_text'] ) ?>" /> |
|
| 49 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'error_text' ) ) ?>" id="frm_error_text" class="hex" value="<?php echo esc_attr( $style->post_content['error_text'] ) ?>" /> |
|
| 50 | 50 | </div> |
| 51 | 51 | |
| 52 | 52 | <div class="field-group clearfix"> |
| 53 | 53 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 54 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('error_font_size') ) ?>" id="frm_error_font_size" value="<?php echo esc_attr( $style->post_content['error_font_size'] ) ?>" size="3" /> |
|
| 54 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'error_font_size' ) ) ?>" id="frm_error_font_size" value="<?php echo esc_attr( $style->post_content['error_font_size'] ) ?>" size="3" /> |
|
| 55 | 55 | </div> |
| 56 | 56 | <div class="clear"></div> |
| 57 | 57 | </div><!-- /.tabs-panel --> |
@@ -1,42 +1,42 @@ |
||
| 1 | 1 | <div class="field-group clearfix frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_font_size') ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_font_size' ) ) ?>" id="frm_field_font_size" value="<?php echo esc_attr( $style->post_content['field_font_size'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | |
| 6 | 6 | <div class="field-group clearfix frm-first-row"> |
| 7 | 7 | <label><?php _e( 'Height', 'formidable' ) ?></label> |
| 8 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_height') ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
| 8 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_height' ) ) ?>" id="frm_field_height" value="<?php echo esc_attr( $style->post_content['field_height'] ) ?>" /> |
|
| 9 | 9 | </div> |
| 10 | 10 | |
| 11 | 11 | <div class="field-group clearfix frm-first-row"> |
| 12 | 12 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
| 13 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_width') ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
| 13 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_width' ) ) ?>" id="frm_field_width" value="<?php echo esc_attr( $style->post_content['field_width'] ) ?>" /> |
|
| 14 | 14 | </div> |
| 15 | 15 | |
| 16 | 16 | <div class="clear"></div> |
| 17 | 17 | <p class="frm_no_bottom_margin"> |
| 18 | - <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('auto_width') ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
| 18 | + <label><input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'auto_width' ) ) ?>" id="frm_auto_width" value="1" <?php checked( $style->post_content['auto_width'], 1 ) ?> /> |
|
| 19 | 19 | <?php _e( 'Automatic Width for drop-down fields', 'formidable' ) ?></label> |
| 20 | 20 | </p> |
| 21 | 21 | |
| 22 | 22 | <div class="field-group clearfix"> |
| 23 | 23 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
| 24 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_pad') ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
| 24 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_pad' ) ) ?>" id="frm_field_pad" value="<?php echo esc_attr( $style->post_content['field_pad'] ) ?>" /> |
|
| 25 | 25 | </div> |
| 26 | 26 | |
| 27 | 27 | <div class="field-group clearfix"> |
| 28 | 28 | <label><?php _e( 'Margin', 'formidable' ) ?></label> |
| 29 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('field_margin') ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
| 29 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'field_margin' ) ) ?>" id="frm_field_margin" value="<?php echo esc_attr( $style->post_content['field_margin'] ) ?>" /> |
|
| 30 | 30 | </div> |
| 31 | 31 | |
| 32 | 32 | <div class="field-group clearfix"> |
| 33 | 33 | <label><?php _e( 'Corners', 'formidable' ) ?> <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Formidable uses CSS3 border-radius for corner rounding, which is not currently supported by Internet Explorer.', 'formidable' ) ?>" ></span></label> |
| 34 | - <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('border_radius') ) ?>" id="frm_border_radius" /> |
|
| 34 | + <input type="text" value="<?php echo esc_attr( $style->post_content['border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'border_radius' ) ) ?>" id="frm_border_radius" /> |
|
| 35 | 35 | </div> |
| 36 | 36 | |
| 37 | 37 | <div class="field-group clearfix frm-first-row"> |
| 38 | 38 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
| 39 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('field_weight') ) ?>" id="frm_field_weight"> |
|
| 39 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'field_weight' ) ) ?>" id="frm_field_weight"> |
|
| 40 | 40 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
| 41 | 41 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['field_weight'], $value ) ?>><?php echo esc_attr( $name ) ?></option> |
| 42 | 42 | <?php } ?> |
@@ -1,26 +1,26 @@ discard block |
||
| 1 | 1 | <div class="field-group clearfix frm-half frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Radio', 'formidable' ) ?></label> |
| 3 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('radio_align') ) ?>" id="frm_radio_align"> |
|
| 4 | - <option value="block" <?php selected($style->post_content['radio_align'], 'block') ?>><?php _e( 'Multiple Rows' , 'formidable' ) ?></option> |
|
| 5 | - <option value="inline" <?php selected($style->post_content['radio_align'], 'inline') ?>><?php _e( 'Single Row' , 'formidable' ) ?></option> |
|
| 3 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'radio_align' ) ) ?>" id="frm_radio_align"> |
|
| 4 | + <option value="block" <?php selected( $style->post_content['radio_align'], 'block' ) ?>><?php _e( 'Multiple Rows', 'formidable' ) ?></option> |
|
| 5 | + <option value="inline" <?php selected( $style->post_content['radio_align'], 'inline' ) ?>><?php _e( 'Single Row', 'formidable' ) ?></option> |
|
| 6 | 6 | </select> |
| 7 | 7 | </div> |
| 8 | 8 | |
| 9 | 9 | <div class="field-group clearfix frm-half frm-first-row"> |
| 10 | 10 | <label><?php _e( 'Check Box', 'formidable' ) ?></label> |
| 11 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('check_align') ) ?>" id="frm_check_align"> |
|
| 12 | - <option value="block" <?php selected($style->post_content['check_align'], 'block') ?>><?php _e( 'Multiple Rows' , 'formidable' ) ?></option> |
|
| 13 | - <option value="inline" <?php selected($style->post_content['check_align'], 'inline') ?>><?php _e( 'Single Row' , 'formidable' ) ?></option> |
|
| 11 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'check_align' ) ) ?>" id="frm_check_align"> |
|
| 12 | + <option value="block" <?php selected( $style->post_content['check_align'], 'block' ) ?>><?php _e( 'Multiple Rows', 'formidable' ) ?></option> |
|
| 13 | + <option value="inline" <?php selected( $style->post_content['check_align'], 'inline' ) ?>><?php _e( 'Single Row', 'formidable' ) ?></option> |
|
| 14 | 14 | </select> |
| 15 | 15 | </div> |
| 16 | 16 | |
| 17 | 17 | <div class="field-group field-group-background clearfix"> |
| 18 | 18 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 19 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('check_label_color') ) ?>" id="frm_check_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['check_label_color'] ) ?>" /> |
|
| 19 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'check_label_color' ) ) ?>" id="frm_check_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['check_label_color'] ) ?>" /> |
|
| 20 | 20 | </div> |
| 21 | 21 | <div class="field-group clearfix"> |
| 22 | 22 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
| 23 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('check_weight') ) ?>" id="frm_check_weight"> |
|
| 23 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'check_weight' ) ) ?>" id="frm_check_weight"> |
|
| 24 | 24 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
| 25 | 25 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['check_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
| 26 | 26 | <?php } ?> |
@@ -28,5 +28,5 @@ discard block |
||
| 28 | 28 | </div> |
| 29 | 29 | <div class="field-group clearfix"> |
| 30 | 30 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 31 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('check_font_size') ) ?>" id="frm_check_font_size" value="<?php echo esc_attr( $style->post_content['check_font_size'] ) ?>" size="3" /> |
|
| 31 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'check_font_size' ) ) ?>" id="frm_check_font_size" value="<?php echo esc_attr( $style->post_content['check_font_size'] ) ?>" size="3" /> |
|
| 32 | 32 | </div> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <p class="frm_no_top_margin"> |
| 2 | 2 | <label for="frm_submit_style"> |
| 3 | - <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name('submit_style') ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" /> |
|
| 3 | + <input type="checkbox" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_style' ) ) ?>" id="frm_submit_style" <?php checked( $style->post_content['submit_style'], 1 ) ?> value="1" /> |
|
| 4 | 4 | <?php esc_html_e( 'Disable submit button styling', 'formidable' ); ?> |
| 5 | 5 | <span class="frm_help frm_icon_font frm_tooltip_icon" title="<?php esc_attr_e( 'Note: If disabled, you may not see the change take effect until you make 2 more styling changes or click "Update Options".', 'formidable' ) ?>"></span> |
| 6 | 6 | </label> |
@@ -9,10 +9,10 @@ discard block |
||
| 9 | 9 | <div class="posttypediv"> |
| 10 | 10 | <ul class="posttype-tabs add-menu-item-tabs"> |
| 11 | 11 | <li <?php echo ( 'default' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 12 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=default#tabs-panel-button-default') ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a> |
|
| 12 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=default#tabs-panel-button-default' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-default" ><?php _e( 'Default', 'formidable' ) ?></a> |
|
| 13 | 13 | </li> |
| 14 | 14 | <li <?php echo ( 'button-hover' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 15 | - <a href="<?php echo esc_url('?page=formidable-styles&page-tab=button-hover#page-button-hover') ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a> |
|
| 15 | + <a href="<?php echo esc_url( '?page=formidable-styles&page-tab=button-hover#page-button-hover' ) ?>" class="nav-tab-link" data-type="tabs-panel-button-hover" ><?php _e( 'Hover', 'formidable' ) ?></a> |
|
| 16 | 16 | </li> |
| 17 | 17 | <li <?php echo ( 'button-click' == $current_tab ? ' class="tabs"' : '' ); ?>> |
| 18 | 18 | <a href="?page=formidable-styles&page-tab=button-click#tabs-panel-button-click" class="nav-tab-link" data-type="tabs-panel-button-click"><?php _e( 'Click', 'formidable' ) ?></a> |
@@ -24,22 +24,22 @@ discard block |
||
| 24 | 24 | ?>"> |
| 25 | 25 | <div class="field-group field-group-border clearfix"> |
| 26 | 26 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 27 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_font_size') ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>" size="3" /> |
|
| 27 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_font_size' ) ) ?>" id="frm_submit_font_size" value="<?php echo esc_attr( $style->post_content['submit_font_size'] ) ?>" size="3" /> |
|
| 28 | 28 | </div> |
| 29 | 29 | |
| 30 | 30 | <div class="field-group clearfix"> |
| 31 | 31 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
| 32 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_width') ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>" size="5" /> |
|
| 32 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_width' ) ) ?>" id="frm_submit_width" value="<?php echo esc_attr( $style->post_content['submit_width'] ) ?>" size="5" /> |
|
| 33 | 33 | </div> |
| 34 | 34 | |
| 35 | 35 | <div class="field-group clearfix"> |
| 36 | 36 | <label><?php _e( 'Height', 'formidable' ) ?></label> |
| 37 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_height') ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>" size="5" /> |
|
| 37 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_height' ) ) ?>" id="frm_submit_height" value="<?php echo esc_attr( $style->post_content['submit_height'] ) ?>" size="5" /> |
|
| 38 | 38 | </div> |
| 39 | 39 | |
| 40 | 40 | <div class="field-group clearfix"> |
| 41 | 41 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
| 42 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('submit_weight') ) ?>" id="frm_submit_weight"> |
|
| 42 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_weight' ) ) ?>" id="frm_submit_weight"> |
|
| 43 | 43 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
| 44 | 44 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['submit_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
| 45 | 45 | <?php } ?> |
@@ -48,48 +48,48 @@ discard block |
||
| 48 | 48 | |
| 49 | 49 | <div class="field-group clearfix"> |
| 50 | 50 | <label><?php _e( 'Corners', 'formidable' ) ?></label> |
| 51 | - <input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_radius') ) ?>" id="frm_submit_border_radius" size="4"/> |
|
| 51 | + <input type="text" value="<?php echo esc_attr( $style->post_content['submit_border_radius'] ) ?>" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_radius' ) ) ?>" id="frm_submit_border_radius" size="4"/> |
|
| 52 | 52 | </div> |
| 53 | 53 | |
| 54 | 54 | <div class="field-group field-group-border clearfix"> |
| 55 | 55 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
| 56 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_color') ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" /> |
|
| 56 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_color' ) ) ?>" id="frm_submit_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_bg_color'] ) ?>" /> |
|
| 57 | 57 | </div> |
| 58 | 58 | |
| 59 | 59 | <div class="field-group clearfix"> |
| 60 | 60 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 61 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_text_color') ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" /> |
|
| 61 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_text_color' ) ) ?>" id="frm_submit_text_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_text_color'] ) ?>" /> |
|
| 62 | 62 | </div> |
| 63 | 63 | |
| 64 | 64 | <div class="field-group field-group-border clearfix"> |
| 65 | 65 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 66 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_color') ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" /> |
|
| 66 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_color' ) ) ?>" id="frm_submit_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_border_color'] ) ?>" /> |
|
| 67 | 67 | </div> |
| 68 | 68 | |
| 69 | 69 | <div class="field-group clearfix"> |
| 70 | 70 | <label><?php _e( 'Thickness', 'formidable' ) ?></label> |
| 71 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_border_width') ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" /> |
|
| 71 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_border_width' ) ) ?>" id="frm_submit_border_width" value="<?php echo esc_attr( $style->post_content['submit_border_width'] ) ?>" size="4" /> |
|
| 72 | 72 | </div> |
| 73 | 73 | |
| 74 | 74 | <div class="field-group clearfix"> |
| 75 | 75 | <label><?php _e( 'Shadow', 'formidable' ) ?></label> |
| 76 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_shadow_color') ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" /> |
|
| 76 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_shadow_color' ) ) ?>" id="frm_submit_shadow_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_shadow_color'] ) ?>" /> |
|
| 77 | 77 | </div> |
| 78 | 78 | |
| 79 | 79 | <div class="clear"></div> |
| 80 | 80 | <div class="field-group field-group-border frm-full"> |
| 81 | 81 | <label><?php _e( 'BG Image', 'formidable' ) ?></label> |
| 82 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_bg_img') ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>" /> |
|
| 82 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_bg_img' ) ) ?>" id="frm_submit_bg_img" value="<?php echo esc_attr( $style->post_content['submit_bg_img'] ) ?>" /> |
|
| 83 | 83 | </div> |
| 84 | 84 | |
| 85 | 85 | <div class="field-group field-group-border clearfix"> |
| 86 | 86 | <label><?php _e( 'Margin', 'formidable' ) ?></label> |
| 87 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_margin') ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" /> |
|
| 87 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_margin' ) ) ?>" id="frm_submit_margin" value="<?php echo esc_attr( $style->post_content['submit_margin'] ) ?>" size="6" /> |
|
| 88 | 88 | </div> |
| 89 | 89 | |
| 90 | 90 | <div class="field-group clearfix"> |
| 91 | 91 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
| 92 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_padding') ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" /> |
|
| 92 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_padding' ) ) ?>" id="frm_submit_padding" value="<?php echo esc_attr( $style->post_content['submit_padding'] ) ?>" size="6" /> |
|
| 93 | 93 | </div> |
| 94 | 94 | <div class="clear"></div> |
| 95 | 95 | </div><!-- /.tabs-panel --> |
@@ -99,17 +99,17 @@ discard block |
||
| 99 | 99 | ?>"> |
| 100 | 100 | <div class="field-group clearfix"> |
| 101 | 101 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
| 102 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_bg_color') ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" /> |
|
| 102 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_bg_color' ) ) ?>" id="frm_submit_hover_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_bg_color'] ) ?>" /> |
|
| 103 | 103 | </div> |
| 104 | 104 | |
| 105 | 105 | <div class="field-group clearfix"> |
| 106 | 106 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 107 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_color') ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" /> |
|
| 107 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_color' ) ) ?>" id="frm_submit_hover_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_color'] ) ?>" /> |
|
| 108 | 108 | </div> |
| 109 | 109 | |
| 110 | 110 | <div class="field-group clearfix"> |
| 111 | 111 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 112 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_hover_border_color') ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" /> |
|
| 112 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_hover_border_color' ) ) ?>" id="frm_submit_hover_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_hover_border_color'] ) ?>" /> |
|
| 113 | 113 | </div> |
| 114 | 114 | |
| 115 | 115 | <div class="clear"></div> |
@@ -120,17 +120,17 @@ discard block |
||
| 120 | 120 | ?>"> |
| 121 | 121 | <div class="field-group clearfix"> |
| 122 | 122 | <label><?php _e( 'BG color', 'formidable' ) ?></label> |
| 123 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_bg_color') ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" /> |
|
| 123 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_bg_color' ) ) ?>" id="frm_submit_active_bg_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_bg_color'] ) ?>" /> |
|
| 124 | 124 | </div> |
| 125 | 125 | |
| 126 | 126 | <div class="field-group clearfix"> |
| 127 | 127 | <label><?php _e( 'Text', 'formidable' ) ?></label> |
| 128 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_color') ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" /> |
|
| 128 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_color' ) ) ?>" id="frm_submit_active_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_color'] ) ?>" /> |
|
| 129 | 129 | </div> |
| 130 | 130 | |
| 131 | 131 | <div class="field-group clearfix"> |
| 132 | 132 | <label><?php _e( 'Border', 'formidable' ) ?></label> |
| 133 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('submit_active_border_color') ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" /> |
|
| 133 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'submit_active_border_color' ) ) ?>" id="frm_submit_active_border_color" class="hex" value="<?php echo esc_attr( $style->post_content['submit_active_border_color'] ) ?>" /> |
|
| 134 | 134 | </div> |
| 135 | 135 | |
| 136 | 136 | <div class="clear"></div> |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <div id="form_entries_page" class="wrap"> |
| 2 | 2 | <h1><?php _e( 'Entries', 'formidable' ); ?> |
| 3 | - <?php do_action('frm_entry_inside_h2', $form); ?> |
|
| 3 | + <?php do_action( 'frm_entry_inside_h2', $form ); ?> |
|
| 4 | 4 | </h1> |
| 5 | 5 | |
| 6 | 6 | <?php require( FrmAppHelper::plugin_path() . '/classes/views/shared/errors.php' ); ?> |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | <div id="poststuff"> |
| 10 | 10 | <div id="post-body" class="metabox-holder columns-2"> |
| 11 | 11 | <div id="post-body-content"> |
| 12 | - <?php FrmAppController::get_form_nav($form, true, 'hide'); ?> |
|
| 12 | + <?php FrmAppController::get_form_nav( $form, true, 'hide' ); ?> |
|
| 13 | 13 | </div> |
| 14 | 14 | <div id="postbox-container-1" class="postbox-container"> |
| 15 | 15 | <input type="hidden" name="page" value="formidable-entries" /> |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $filepath = dirname(__FILE__); |
|
| 37 | + $filepath = dirname( __FILE__ ); |
|
| 38 | 38 | if ( preg_match( '/^FrmPro.+$/', $class_name ) ) { |
| 39 | 39 | $filepath .= '/pro'; |
| 40 | 40 | } |
@@ -50,25 +50,25 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $filepath .= $class_name . '.php'; |
| 52 | 52 | |
| 53 | - if ( file_exists($filepath) ) { |
|
| 54 | - include($filepath); |
|
| 53 | + if ( file_exists( $filepath ) ) { |
|
| 54 | + include( $filepath ); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // if __autoload is active, put it on the spl_autoload stack |
| 59 | -if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) { |
|
| 60 | - spl_autoload_register('__autoload'); |
|
| 59 | +if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { |
|
| 60 | + spl_autoload_register( '__autoload' ); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Add the autoloader |
| 64 | -spl_autoload_register('frm_forms_autoloader'); |
|
| 64 | +spl_autoload_register( 'frm_forms_autoloader' ); |
|
| 65 | 65 | |
| 66 | -$frm_path = dirname(__FILE__); |
|
| 67 | -if ( file_exists($frm_path . '/pro/formidable-pro.php') ) { |
|
| 66 | +$frm_path = dirname( __FILE__ ); |
|
| 67 | +if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
|
| 68 | 68 | include( $frm_path . '/pro/formidable-pro.php' ); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | FrmHooksController::trigger_load_hook(); |
| 72 | 72 | |
| 73 | 73 | include_once( $frm_path . '/deprecated.php' ); |
| 74 | -unset($frm_path); |
|
| 74 | +unset( $frm_path ); |
|
@@ -23,43 +23,43 @@ |
||
| 23 | 23 | |
| 24 | 24 | global $frm_vars; |
| 25 | 25 | $frm_vars = array( |
| 26 | - 'load_css' => false, 'forms_loaded' => array(), |
|
| 27 | - 'created_entries' => array(), |
|
| 28 | - 'pro_is_authorized' => false, |
|
| 26 | + 'load_css' => false, 'forms_loaded' => array(), |
|
| 27 | + 'created_entries' => array(), |
|
| 28 | + 'pro_is_authorized' => false, |
|
| 29 | 29 | ); |
| 30 | 30 | |
| 31 | 31 | function frm_forms_autoloader( $class_name ) { |
| 32 | - // Only load Frm classes here |
|
| 32 | + // Only load Frm classes here |
|
| 33 | 33 | if ( ! preg_match( '/^Frm.+$/', $class_name ) ) { |
| 34 | - return; |
|
| 35 | - } |
|
| 34 | + return; |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | - $filepath = dirname(__FILE__); |
|
| 37 | + $filepath = dirname(__FILE__); |
|
| 38 | 38 | if ( preg_match( '/^FrmPro.+$/', $class_name ) ) { |
| 39 | - $filepath .= '/pro'; |
|
| 40 | - } |
|
| 41 | - $filepath .= '/classes'; |
|
| 39 | + $filepath .= '/pro'; |
|
| 40 | + } |
|
| 41 | + $filepath .= '/classes'; |
|
| 42 | 42 | |
| 43 | 43 | if ( preg_match( '/^.+Helper$/', $class_name ) ) { |
| 44 | - $filepath .= '/helpers/'; |
|
| 44 | + $filepath .= '/helpers/'; |
|
| 45 | 45 | } else if ( preg_match( '/^.+Controller$/', $class_name ) ) { |
| 46 | - $filepath .= '/controllers/'; |
|
| 46 | + $filepath .= '/controllers/'; |
|
| 47 | 47 | } else if ( preg_match( '/^.+Factory$/', $class_name ) ) { |
| 48 | 48 | $filepath .= '/factories/'; |
| 49 | - } else { |
|
| 50 | - $filepath .= '/models/'; |
|
| 51 | - } |
|
| 49 | + } else { |
|
| 50 | + $filepath .= '/models/'; |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | $filepath .= $class_name . '.php'; |
| 54 | 54 | |
| 55 | - if ( file_exists($filepath) ) { |
|
| 56 | - include($filepath); |
|
| 57 | - } |
|
| 55 | + if ( file_exists($filepath) ) { |
|
| 56 | + include($filepath); |
|
| 57 | + } |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // if __autoload is active, put it on the spl_autoload stack |
| 61 | 61 | if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) { |
| 62 | - spl_autoload_register('__autoload'); |
|
| 62 | + spl_autoload_register('__autoload'); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | // Add the autoloader |
@@ -3,7 +3,7 @@ discard block |
||
| 3 | 3 | class FrmFieldsController { |
| 4 | 4 | |
| 5 | 5 | public static function load_field() { |
| 6 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 6 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 7 | 7 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 8 | 8 | |
| 9 | 9 | $fields = $_POST['field']; |
@@ -34,17 +34,17 @@ discard block |
||
| 34 | 34 | } |
| 35 | 35 | |
| 36 | 36 | $field_name = 'item_meta[' . $field_id . ']'; |
| 37 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
| 37 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
| 38 | 38 | |
| 39 | 39 | ob_start(); |
| 40 | 40 | include( $path . '/classes/views/frm-forms/add_field.php' ); |
| 41 | - $field_html[ $field_id ] = ob_get_contents(); |
|
| 41 | + $field_html[$field_id] = ob_get_contents(); |
|
| 42 | 42 | ob_end_clean(); |
| 43 | 43 | } |
| 44 | 44 | |
| 45 | - unset($path); |
|
| 45 | + unset( $path ); |
|
| 46 | 46 | |
| 47 | - echo json_encode($field_html); |
|
| 47 | + echo json_encode( $field_html ); |
|
| 48 | 48 | |
| 49 | 49 | wp_die(); |
| 50 | 50 | } |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | * Create a new field with ajax |
| 54 | 54 | */ |
| 55 | 55 | public static function create() { |
| 56 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 56 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 57 | 57 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 58 | 58 | |
| 59 | 59 | $field_type = FrmAppHelper::get_post_param( 'field_type', '', 'sanitize_text_field' ); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | $field = self::include_new_field( $field_type, $form_id ); |
| 63 | 63 | |
| 64 | 64 | // this hook will allow for multiple fields to be added at once |
| 65 | - do_action('frm_after_field_created', $field, $form_id); |
|
| 65 | + do_action( 'frm_after_field_created', $field, $form_id ); |
|
| 66 | 66 | |
| 67 | 67 | wp_die(); |
| 68 | 68 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | public static function include_new_field( $field_type, $form_id ) { |
| 78 | 78 | $values = array(); |
| 79 | 79 | if ( FrmAppHelper::pro_is_installed() ) { |
| 80 | - $values['post_type'] = FrmProFormsHelper::post_type($form_id); |
|
| 80 | + $values['post_type'] = FrmProFormsHelper::post_type( $form_id ); |
|
| 81 | 81 | } |
| 82 | 82 | |
| 83 | 83 | $field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id ); |
@@ -89,27 +89,27 @@ discard block |
||
| 89 | 89 | return false; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $field = self::include_single_field($field_id, $values, $form_id); |
|
| 92 | + $field = self::include_single_field( $field_id, $values, $form_id ); |
|
| 93 | 93 | |
| 94 | 94 | return $field; |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | public static function edit_name( $field = 'name', $id = '' ) { |
| 98 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 98 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 99 | 99 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 100 | 100 | |
| 101 | - if ( empty($field) ) { |
|
| 101 | + if ( empty( $field ) ) { |
|
| 102 | 102 | $field = 'name'; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( empty($id) ) { |
|
| 105 | + if ( empty( $id ) ) { |
|
| 106 | 106 | $id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
| 107 | 107 | $id = str_replace( 'field_label_', '', $id ); |
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ); |
| 111 | 111 | $value = trim( $value ); |
| 112 | - if ( trim(strip_tags($value)) == '' ) { |
|
| 112 | + if ( trim( strip_tags( $value ) ) == '' ) { |
|
| 113 | 113 | // set blank value if there is no content |
| 114 | 114 | $value = ''; |
| 115 | 115 | } |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | public static function update_ajax_option() { |
| 126 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 126 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 127 | 127 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 128 | 128 | |
| 129 | 129 | $field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' ); |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | if ( isset( $_POST['separate_value'] ) ) { |
| 137 | 137 | $new_val = FrmField::is_option_true( $field, 'separate_value' ) ? 0 : 1; |
| 138 | 138 | $field->field_options['separate_value'] = $new_val; |
| 139 | - unset($new_val); |
|
| 139 | + unset( $new_val ); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | FrmField::update( $field_id, array( |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | public static function duplicate() { |
| 150 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 150 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 151 | 151 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 152 | 152 | |
| 153 | 153 | global $wpdb; |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | wp_die(); |
| 178 | 178 | } |
| 179 | 179 | |
| 180 | - self::include_single_field($field_id, $values); |
|
| 180 | + self::include_single_field( $field_id, $values ); |
|
| 181 | 181 | |
| 182 | 182 | wp_die(); |
| 183 | 183 | } |
@@ -186,9 +186,9 @@ discard block |
||
| 186 | 186 | * Load a single field in the form builder along with all needed variables |
| 187 | 187 | */ |
| 188 | 188 | public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
| 189 | - $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id)); |
|
| 189 | + $field = FrmFieldsHelper::setup_edit_vars( FrmField::getOne( $field_id ) ); |
|
| 190 | 190 | $field_name = 'item_meta[' . $field_id . ']'; |
| 191 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
| 191 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
| 192 | 192 | $id = $form_id ? $form_id : $field['form_id']; |
| 193 | 193 | if ( $field['type'] == 'html' ) { |
| 194 | 194 | $field['stop_filter'] = true; |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | public static function destroy() { |
| 203 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 203 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 204 | 204 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 205 | 205 | |
| 206 | 206 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
@@ -212,14 +212,14 @@ discard block |
||
| 212 | 212 | |
| 213 | 213 | //Add Single Option or Other Option |
| 214 | 214 | public static function add_option() { |
| 215 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 215 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 216 | 216 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 217 | 217 | |
| 218 | 218 | $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 219 | 219 | $opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' ); |
| 220 | 220 | $opt_key = FrmAppHelper::get_post_param( 'opt_key', 0, 'absint' ); |
| 221 | 221 | |
| 222 | - $field = FrmField::getOne($id); |
|
| 222 | + $field = FrmField::getOne( $id ); |
|
| 223 | 223 | |
| 224 | 224 | if ( 'other' == $opt_type ) { |
| 225 | 225 | $opt = __( 'Other', 'formidable' ); |
@@ -289,9 +289,9 @@ discard block |
||
| 289 | 289 | |
| 290 | 290 | $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
| 291 | 291 | $prepop = array(); |
| 292 | - FrmFieldsHelper::get_bulk_prefilled_opts($prepop); |
|
| 292 | + FrmFieldsHelper::get_bulk_prefilled_opts( $prepop ); |
|
| 293 | 293 | |
| 294 | - $field = FrmField::getOne($field_id); |
|
| 294 | + $field = FrmField::getOne( $field_id ); |
|
| 295 | 295 | |
| 296 | 296 | wp_enqueue_script( 'utils' ); |
| 297 | 297 | wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' ); |
@@ -302,35 +302,35 @@ discard block |
||
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | public static function import_options() { |
| 305 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 305 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 306 | 306 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 307 | 307 | |
| 308 | - if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) { |
|
| 308 | + if ( ! is_admin() || ! current_user_can( 'frm_edit_forms' ) ) { |
|
| 309 | 309 | return; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | $field_id = absint( $_POST['field_id'] ); |
| 313 | - $field = FrmField::getOne($field_id); |
|
| 313 | + $field = FrmField::getOne( $field_id ); |
|
| 314 | 314 | |
| 315 | 315 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'select' ) ) ) { |
| 316 | 316 | return; |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | - $field = FrmFieldsHelper::setup_edit_vars($field); |
|
| 319 | + $field = FrmFieldsHelper::setup_edit_vars( $field ); |
|
| 320 | 320 | $opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' ); |
| 321 | 321 | $opts = explode( "\n", rtrim( $opts, "\n" ) ); |
| 322 | 322 | $opts = array_map( 'trim', $opts ); |
| 323 | 323 | |
| 324 | 324 | if ( $field['separate_value'] ) { |
| 325 | 325 | foreach ( $opts as $opt_key => $opt ) { |
| 326 | - if ( strpos($opt, '|') !== false ) { |
|
| 327 | - $vals = explode('|', $opt); |
|
| 326 | + if ( strpos( $opt, '|' ) !== false ) { |
|
| 327 | + $vals = explode( '|', $opt ); |
|
| 328 | 328 | if ( $vals[0] != $vals[1] ) { |
| 329 | - $opts[ $opt_key ] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
| 329 | + $opts[$opt_key] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
| 330 | 330 | } |
| 331 | - unset($vals); |
|
| 331 | + unset( $vals ); |
|
| 332 | 332 | } |
| 333 | - unset($opt_key, $opt); |
|
| 333 | + unset( $opt_key, $opt ); |
|
| 334 | 334 | } |
| 335 | 335 | } |
| 336 | 336 | |
@@ -339,12 +339,12 @@ discard block |
||
| 339 | 339 | $other_array = array(); |
| 340 | 340 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 341 | 341 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 342 | - $other_array[ $opt_key ] = $opt; |
|
| 342 | + $other_array[$opt_key] = $opt; |
|
| 343 | 343 | } |
| 344 | - unset($opt_key, $opt); |
|
| 344 | + unset( $opt_key, $opt ); |
|
| 345 | 345 | } |
| 346 | - if ( ! empty($other_array) ) { |
|
| 347 | - $opts = array_merge( $opts, $other_array); |
|
| 346 | + if ( ! empty( $other_array ) ) { |
|
| 347 | + $opts = array_merge( $opts, $other_array ); |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
@@ -358,14 +358,14 @@ discard block |
||
| 358 | 358 | |
| 359 | 359 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); |
| 360 | 360 | } else { |
| 361 | - FrmFieldsHelper::show_single_option($field); |
|
| 361 | + FrmFieldsHelper::show_single_option( $field ); |
|
| 362 | 362 | } |
| 363 | 363 | |
| 364 | 364 | wp_die(); |
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | public static function update_order() { |
| 368 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 368 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 369 | 369 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 370 | 370 | |
| 371 | 371 | $fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
@@ -382,8 +382,8 @@ discard block |
||
| 382 | 382 | 'rte' => 'textarea', |
| 383 | 383 | 'website' => 'url', |
| 384 | 384 | ); |
| 385 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 386 | - $type = $type_switch[ $type ]; |
|
| 385 | + if ( isset( $type_switch[$type] ) ) { |
|
| 386 | + $type = $type_switch[$type]; |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | $pro_fields = FrmField::pro_field_selection(); |
@@ -427,19 +427,19 @@ discard block |
||
| 427 | 427 | |
| 428 | 428 | public static function input_html( $field, $echo = true ) { |
| 429 | 429 | $class = array(); //$field['type']; |
| 430 | - self::add_input_classes($field, $class); |
|
| 430 | + self::add_input_classes( $field, $class ); |
|
| 431 | 431 | |
| 432 | 432 | $add_html = array(); |
| 433 | - self::add_html_size($field, $add_html); |
|
| 434 | - self::add_html_length($field, $add_html); |
|
| 435 | - self::add_html_placeholder($field, $add_html, $class); |
|
| 433 | + self::add_html_size( $field, $add_html ); |
|
| 434 | + self::add_html_length( $field, $add_html ); |
|
| 435 | + self::add_html_placeholder( $field, $add_html, $class ); |
|
| 436 | 436 | self::add_validation_messages( $field, $add_html ); |
| 437 | 437 | |
| 438 | - $class = apply_filters('frm_field_classes', implode(' ', $class), $field); |
|
| 438 | + $class = apply_filters( 'frm_field_classes', implode( ' ', $class ), $field ); |
|
| 439 | 439 | |
| 440 | 440 | FrmFormsHelper::add_html_attr( $class, 'class', $add_html ); |
| 441 | 441 | |
| 442 | - self::add_shortcodes_to_html($field, $add_html); |
|
| 442 | + self::add_shortcodes_to_html( $field, $add_html ); |
|
| 443 | 443 | |
| 444 | 444 | $add_html = apply_filters( 'frm_field_extra_html', $add_html, $field ); |
| 445 | 445 | $add_html = ' ' . implode( ' ', $add_html ) . ' '; |
@@ -452,7 +452,7 @@ discard block |
||
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | private static function add_input_classes( $field, array &$class ) { |
| 455 | - if ( isset($field['input_class']) && ! empty($field['input_class']) ) { |
|
| 455 | + if ( isset( $field['input_class'] ) && ! empty( $field['input_class'] ) ) { |
|
| 456 | 456 | $class[] = $field['input_class']; |
| 457 | 457 | } |
| 458 | 458 | |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | return; |
| 461 | 461 | } |
| 462 | 462 | |
| 463 | - if ( isset($field['size']) && $field['size'] > 0 ) { |
|
| 463 | + if ( isset( $field['size'] ) && $field['size'] > 0 ) { |
|
| 464 | 464 | $class[] = 'auto_width'; |
| 465 | 465 | } |
| 466 | 466 | } |
@@ -470,19 +470,19 @@ discard block |
||
| 470 | 470 | return; |
| 471 | 471 | } |
| 472 | 472 | |
| 473 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 473 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
| 474 | 474 | return; |
| 475 | 475 | } |
| 476 | 476 | |
| 477 | - if ( is_numeric($field['size']) ) { |
|
| 477 | + if ( is_numeric( $field['size'] ) ) { |
|
| 478 | 478 | $field['size'] .= 'px'; |
| 479 | 479 | } |
| 480 | 480 | |
| 481 | - $important = apply_filters('frm_use_important_width', 1, $field); |
|
| 481 | + $important = apply_filters( 'frm_use_important_width', 1, $field ); |
|
| 482 | 482 | // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
| 483 | 483 | $add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"'; |
| 484 | 484 | |
| 485 | - self::add_html_cols($field, $add_html); |
|
| 485 | + self::add_html_cols( $field, $add_html ); |
|
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | private static function add_html_cols( $field, array &$add_html ) { |
@@ -499,13 +499,13 @@ discard block |
||
| 499 | 499 | ); |
| 500 | 500 | |
| 501 | 501 | // include "col" for valid html |
| 502 | - $unit = trim(preg_replace('/[0-9]+/', '', $field['size'])); |
|
| 502 | + $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
|
| 503 | 503 | |
| 504 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 504 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 505 | 505 | return; |
| 506 | 506 | } |
| 507 | 507 | |
| 508 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 508 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
| 509 | 509 | |
| 510 | 510 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 511 | 511 | } |
@@ -516,7 +516,7 @@ discard block |
||
| 516 | 516 | return; |
| 517 | 517 | } |
| 518 | 518 | |
| 519 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 519 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
| 520 | 520 | // don't load on form builder page |
| 521 | 521 | return; |
| 522 | 522 | } |
@@ -548,7 +548,7 @@ discard block |
||
| 548 | 548 | if ( $frm_settings->use_html && ! in_array( $field['type'], array( 'select', 'radio', 'checkbox', 'hidden' ) ) ) { |
| 549 | 549 | // use HMTL5 placeholder with js fallback |
| 550 | 550 | $add_html['placeholder'] = 'placeholder="' . esc_attr( $field['default_value'] ) . '"'; |
| 551 | - wp_enqueue_script('jquery-placeholder'); |
|
| 551 | + wp_enqueue_script( 'jquery-placeholder' ); |
|
| 552 | 552 | } else if ( ! $frm_settings->use_html ) { |
| 553 | 553 | $val = str_replace( array( "\r\n", "\n" ), '\r', addslashes( str_replace( ''', "'", esc_attr( $field['default_value'] ) ) ) ); |
| 554 | 554 | $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $val ) . '"'; |
@@ -582,15 +582,15 @@ discard block |
||
| 582 | 582 | continue; |
| 583 | 583 | } |
| 584 | 584 | |
| 585 | - if ( is_numeric($k) && strpos($v, '=') ) { |
|
| 585 | + if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
|
| 586 | 586 | $add_html[] = $v; |
| 587 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 588 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 587 | + } else if ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 588 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 589 | 589 | } else { |
| 590 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 590 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | - unset($k, $v); |
|
| 593 | + unset( $k, $v ); |
|
| 594 | 594 | } |
| 595 | 595 | } |
| 596 | 596 | |
@@ -606,8 +606,8 @@ discard block |
||
| 606 | 606 | } |
| 607 | 607 | |
| 608 | 608 | public static function check_label( $opt ) { |
| 609 | - if ( is_array($opt) ) { |
|
| 610 | - $opt = (isset($opt['label']) ? $opt['label'] : reset($opt)); |
|
| 609 | + if ( is_array( $opt ) ) { |
|
| 610 | + $opt = ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | return $opt; |
@@ -2,129 +2,129 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class FrmFieldsController { |
| 4 | 4 | |
| 5 | - public static function load_field() { |
|
| 5 | + public static function load_field() { |
|
| 6 | 6 | FrmAppHelper::permission_check('frm_edit_forms'); |
| 7 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 7 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 8 | 8 | |
| 9 | - $fields = $_POST['field']; |
|
| 10 | - if ( empty( $fields ) ) { |
|
| 11 | - wp_die(); |
|
| 12 | - } |
|
| 9 | + $fields = $_POST['field']; |
|
| 10 | + if ( empty( $fields ) ) { |
|
| 11 | + wp_die(); |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - $_GET['page'] = 'formidable'; |
|
| 15 | - $fields = stripslashes_deep( $fields ); |
|
| 14 | + $_GET['page'] = 'formidable'; |
|
| 15 | + $fields = stripslashes_deep( $fields ); |
|
| 16 | 16 | |
| 17 | - $ajax = true; |
|
| 17 | + $ajax = true; |
|
| 18 | 18 | $values = array( 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ) ); |
| 19 | - $path = FrmAppHelper::plugin_path(); |
|
| 20 | - $field_html = array(); |
|
| 21 | - |
|
| 22 | - foreach ( $fields as $field ) { |
|
| 23 | - $field = htmlspecialchars_decode( nl2br( $field ) ); |
|
| 24 | - $field = json_decode( $field, true ); |
|
| 25 | - if ( ! isset( $field['id'] ) ) { |
|
| 26 | - // this field may have already been loaded |
|
| 27 | - continue; |
|
| 28 | - } |
|
| 19 | + $path = FrmAppHelper::plugin_path(); |
|
| 20 | + $field_html = array(); |
|
| 21 | + |
|
| 22 | + foreach ( $fields as $field ) { |
|
| 23 | + $field = htmlspecialchars_decode( nl2br( $field ) ); |
|
| 24 | + $field = json_decode( $field, true ); |
|
| 25 | + if ( ! isset( $field['id'] ) ) { |
|
| 26 | + // this field may have already been loaded |
|
| 27 | + continue; |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - $field_id = absint( $field['id'] ); |
|
| 30 | + $field_id = absint( $field['id'] ); |
|
| 31 | 31 | |
| 32 | - if ( ! isset( $field['value'] ) ) { |
|
| 33 | - $field['value'] = ''; |
|
| 34 | - } |
|
| 32 | + if ( ! isset( $field['value'] ) ) { |
|
| 33 | + $field['value'] = ''; |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | $field_name = 'item_meta[' . $field_id . ']'; |
| 37 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
| 37 | + $html_id = FrmFieldsHelper::get_html_id($field); |
|
| 38 | 38 | |
| 39 | - ob_start(); |
|
| 39 | + ob_start(); |
|
| 40 | 40 | include( $path . '/classes/views/frm-forms/add_field.php' ); |
| 41 | - $field_html[ $field_id ] = ob_get_contents(); |
|
| 42 | - ob_end_clean(); |
|
| 43 | - } |
|
| 41 | + $field_html[ $field_id ] = ob_get_contents(); |
|
| 42 | + ob_end_clean(); |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - unset($path); |
|
| 45 | + unset($path); |
|
| 46 | 46 | |
| 47 | - echo json_encode($field_html); |
|
| 47 | + echo json_encode($field_html); |
|
| 48 | 48 | |
| 49 | - wp_die(); |
|
| 50 | - } |
|
| 49 | + wp_die(); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | 52 | /** |
| 53 | 53 | * Create a new field with ajax |
| 54 | 54 | */ |
| 55 | - public static function create() { |
|
| 55 | + public static function create() { |
|
| 56 | 56 | FrmAppHelper::permission_check('frm_edit_forms'); |
| 57 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 57 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 58 | 58 | |
| 59 | 59 | $field_type = FrmAppHelper::get_post_param( 'field_type', '', 'sanitize_text_field' ); |
| 60 | 60 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
| 61 | 61 | |
| 62 | 62 | $field = self::include_new_field( $field_type, $form_id ); |
| 63 | 63 | |
| 64 | - // this hook will allow for multiple fields to be added at once |
|
| 65 | - do_action('frm_after_field_created', $field, $form_id); |
|
| 64 | + // this hook will allow for multiple fields to be added at once |
|
| 65 | + do_action('frm_after_field_created', $field, $form_id); |
|
| 66 | 66 | |
| 67 | - wp_die(); |
|
| 68 | - } |
|
| 67 | + wp_die(); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - /** |
|
| 71 | - * Set up and create a new field |
|
| 72 | - * |
|
| 73 | - * @param string $field_type |
|
| 74 | - * @param integer $form_id |
|
| 75 | - * @return array|bool |
|
| 76 | - */ |
|
| 70 | + /** |
|
| 71 | + * Set up and create a new field |
|
| 72 | + * |
|
| 73 | + * @param string $field_type |
|
| 74 | + * @param integer $form_id |
|
| 75 | + * @return array|bool |
|
| 76 | + */ |
|
| 77 | 77 | public static function include_new_field( $field_type, $form_id ) { |
| 78 | - $values = array(); |
|
| 79 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 80 | - $values['post_type'] = FrmProFormsHelper::post_type($form_id); |
|
| 81 | - } |
|
| 78 | + $values = array(); |
|
| 79 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 80 | + $values['post_type'] = FrmProFormsHelper::post_type($form_id); |
|
| 81 | + } |
|
| 82 | 82 | |
| 83 | 83 | $field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id ); |
| 84 | - $field_values = apply_filters( 'frm_before_field_created', $field_values ); |
|
| 84 | + $field_values = apply_filters( 'frm_before_field_created', $field_values ); |
|
| 85 | 85 | |
| 86 | - $field_id = FrmField::create( $field_values ); |
|
| 86 | + $field_id = FrmField::create( $field_values ); |
|
| 87 | 87 | |
| 88 | - if ( ! $field_id ) { |
|
| 89 | - return false; |
|
| 90 | - } |
|
| 88 | + if ( ! $field_id ) { |
|
| 89 | + return false; |
|
| 90 | + } |
|
| 91 | 91 | |
| 92 | - $field = self::include_single_field($field_id, $values, $form_id); |
|
| 92 | + $field = self::include_single_field($field_id, $values, $form_id); |
|
| 93 | 93 | |
| 94 | - return $field; |
|
| 95 | - } |
|
| 94 | + return $field; |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | 97 | public static function edit_name( $field = 'name', $id = '' ) { |
| 98 | 98 | FrmAppHelper::permission_check('frm_edit_forms'); |
| 99 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 99 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 100 | 100 | |
| 101 | - if ( empty($field) ) { |
|
| 102 | - $field = 'name'; |
|
| 103 | - } |
|
| 101 | + if ( empty($field) ) { |
|
| 102 | + $field = 'name'; |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - if ( empty($id) ) { |
|
| 105 | + if ( empty($id) ) { |
|
| 106 | 106 | $id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
| 107 | 107 | $id = str_replace( 'field_label_', '', $id ); |
| 108 | - } |
|
| 108 | + } |
|
| 109 | 109 | |
| 110 | 110 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ); |
| 111 | 111 | $value = trim( $value ); |
| 112 | - if ( trim(strip_tags($value)) == '' ) { |
|
| 113 | - // set blank value if there is no content |
|
| 114 | - $value = ''; |
|
| 115 | - } |
|
| 112 | + if ( trim(strip_tags($value)) == '' ) { |
|
| 113 | + // set blank value if there is no content |
|
| 114 | + $value = ''; |
|
| 115 | + } |
|
| 116 | 116 | |
| 117 | 117 | FrmField::update( $id, array( $field => $value ) ); |
| 118 | 118 | |
| 119 | 119 | do_action( 'frm_after_update_field_' . $field, compact( 'id', 'value' ) ); |
| 120 | 120 | |
| 121 | 121 | echo stripslashes( wp_kses_post( $value ) ); |
| 122 | - wp_die(); |
|
| 123 | - } |
|
| 122 | + wp_die(); |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | - public static function update_ajax_option() { |
|
| 125 | + public static function update_ajax_option() { |
|
| 126 | 126 | FrmAppHelper::permission_check('frm_edit_forms'); |
| 127 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 127 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 128 | 128 | |
| 129 | 129 | $field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' ); |
| 130 | 130 | if ( ! $field_id ) { |
@@ -139,26 +139,26 @@ discard block |
||
| 139 | 139 | unset($new_val); |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - FrmField::update( $field_id, array( |
|
| 143 | - 'field_options' => $field->field_options, |
|
| 142 | + FrmField::update( $field_id, array( |
|
| 143 | + 'field_options' => $field->field_options, |
|
| 144 | 144 | 'form_id' => $field->form_id, |
| 145 | - ) ); |
|
| 146 | - wp_die(); |
|
| 147 | - } |
|
| 145 | + ) ); |
|
| 146 | + wp_die(); |
|
| 147 | + } |
|
| 148 | 148 | |
| 149 | - public static function duplicate() { |
|
| 149 | + public static function duplicate() { |
|
| 150 | 150 | FrmAppHelper::permission_check('frm_edit_forms'); |
| 151 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 151 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 152 | 152 | |
| 153 | - global $wpdb; |
|
| 153 | + global $wpdb; |
|
| 154 | 154 | |
| 155 | 155 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 156 | 156 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
| 157 | 157 | |
| 158 | 158 | $copy_field = FrmField::getOne( $field_id ); |
| 159 | - if ( ! $copy_field ) { |
|
| 160 | - wp_die(); |
|
| 161 | - } |
|
| 159 | + if ( ! $copy_field ) { |
|
| 160 | + wp_die(); |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | 163 | do_action( 'frm_duplicate_field', $copy_field, $form_id ); |
| 164 | 164 | do_action( 'frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id ); |
@@ -172,214 +172,214 @@ discard block |
||
| 172 | 172 | wp_die(); |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | - self::include_single_field($field_id, $values); |
|
| 175 | + self::include_single_field($field_id, $values); |
|
| 176 | 176 | |
| 177 | - wp_die(); |
|
| 178 | - } |
|
| 177 | + wp_die(); |
|
| 178 | + } |
|
| 179 | 179 | |
| 180 | - /** |
|
| 181 | - * Load a single field in the form builder along with all needed variables |
|
| 182 | - */ |
|
| 183 | - public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
|
| 184 | - $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id)); |
|
| 180 | + /** |
|
| 181 | + * Load a single field in the form builder along with all needed variables |
|
| 182 | + */ |
|
| 183 | + public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
|
| 184 | + $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id)); |
|
| 185 | 185 | $field_name = 'item_meta[' . $field_id . ']'; |
| 186 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
| 187 | - $id = $form_id ? $form_id : $field['form_id']; |
|
| 188 | - if ( $field['type'] == 'html' ) { |
|
| 189 | - $field['stop_filter'] = true; |
|
| 190 | - } |
|
| 186 | + $html_id = FrmFieldsHelper::get_html_id($field); |
|
| 187 | + $id = $form_id ? $form_id : $field['form_id']; |
|
| 188 | + if ( $field['type'] == 'html' ) { |
|
| 189 | + $field['stop_filter'] = true; |
|
| 190 | + } |
|
| 191 | 191 | |
| 192 | 192 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-forms/add_field.php' ); |
| 193 | 193 | |
| 194 | - return $field; |
|
| 195 | - } |
|
| 194 | + return $field; |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | - public static function destroy() { |
|
| 197 | + public static function destroy() { |
|
| 198 | 198 | FrmAppHelper::permission_check('frm_edit_forms'); |
| 199 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 199 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 200 | 200 | |
| 201 | 201 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 202 | 202 | FrmField::destroy( $field_id ); |
| 203 | - wp_die(); |
|
| 204 | - } |
|
| 203 | + wp_die(); |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | - /* Field Options */ |
|
| 206 | + /* Field Options */ |
|
| 207 | 207 | |
| 208 | - //Add Single Option or Other Option |
|
| 209 | - public static function add_option() { |
|
| 208 | + //Add Single Option or Other Option |
|
| 209 | + public static function add_option() { |
|
| 210 | 210 | FrmAppHelper::permission_check('frm_edit_forms'); |
| 211 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 211 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 212 | 212 | |
| 213 | 213 | $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 214 | 214 | $opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' ); |
| 215 | 215 | $opt_key = FrmAppHelper::get_post_param( 'opt_key', 0, 'absint' ); |
| 216 | 216 | |
| 217 | - $field = FrmField::getOne($id); |
|
| 217 | + $field = FrmField::getOne($id); |
|
| 218 | 218 | |
| 219 | - if ( 'other' == $opt_type ) { |
|
| 219 | + if ( 'other' == $opt_type ) { |
|
| 220 | 220 | $opt = __( 'Other', 'formidable' ); |
| 221 | - $other_val = ''; |
|
| 222 | - $opt_key = 'other_' . $opt_key; |
|
| 223 | - } else { |
|
| 221 | + $other_val = ''; |
|
| 222 | + $opt_key = 'other_' . $opt_key; |
|
| 223 | + } else { |
|
| 224 | 224 | $opt = __( 'New Option', 'formidable' ); |
| 225 | - } |
|
| 226 | - $field_val = $opt; |
|
| 225 | + } |
|
| 226 | + $field_val = $opt; |
|
| 227 | 227 | |
| 228 | - $field_data = $field; |
|
| 228 | + $field_data = $field; |
|
| 229 | 229 | $field = (array) $field; |
| 230 | 230 | $field['separate_value'] = isset( $field_data->field_options['separate_value'] ) ? $field_data->field_options['separate_value'] : 0; |
| 231 | 231 | unset( $field_data ); |
| 232 | 232 | |
| 233 | 233 | $field_name = 'item_meta[' . $id . ']'; |
| 234 | 234 | $html_id = FrmFieldsHelper::get_html_id( $field ); |
| 235 | - $checked = ''; |
|
| 235 | + $checked = ''; |
|
| 236 | 236 | |
| 237 | - if ( 'other' == $opt_type ) { |
|
| 237 | + if ( 'other' == $opt_type ) { |
|
| 238 | 238 | include( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' ); |
| 239 | - } else { |
|
| 239 | + } else { |
|
| 240 | 240 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' ); |
| 241 | - } |
|
| 242 | - wp_die(); |
|
| 243 | - } |
|
| 241 | + } |
|
| 242 | + wp_die(); |
|
| 243 | + } |
|
| 244 | 244 | |
| 245 | - public static function edit_option() { |
|
| 245 | + public static function edit_option() { |
|
| 246 | 246 | _deprecated_function( __FUNCTION__, '2.3' ); |
| 247 | - } |
|
| 247 | + } |
|
| 248 | 248 | |
| 249 | - public static function delete_option() { |
|
| 249 | + public static function delete_option() { |
|
| 250 | 250 | _deprecated_function( __FUNCTION__, '2.3' ); |
| 251 | - } |
|
| 251 | + } |
|
| 252 | 252 | |
| 253 | - public static function import_choices() { |
|
| 254 | - FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
| 253 | + public static function import_choices() { |
|
| 254 | + FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
| 255 | 255 | |
| 256 | 256 | $field_id = absint( $_REQUEST['field_id'] ); |
| 257 | 257 | |
| 258 | - global $current_screen, $hook_suffix; |
|
| 258 | + global $current_screen, $hook_suffix; |
|
| 259 | 259 | |
| 260 | - // Catch plugins that include admin-header.php before admin.php completes. |
|
| 261 | - if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) { |
|
| 262 | - $hook_suffix = ''; |
|
| 263 | - set_current_screen(); |
|
| 264 | - } |
|
| 260 | + // Catch plugins that include admin-header.php before admin.php completes. |
|
| 261 | + if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) { |
|
| 262 | + $hook_suffix = ''; |
|
| 263 | + set_current_screen(); |
|
| 264 | + } |
|
| 265 | 265 | |
| 266 | - if ( function_exists( 'register_admin_color_schemes' ) ) { |
|
| 267 | - register_admin_color_schemes(); |
|
| 268 | - } |
|
| 266 | + if ( function_exists( 'register_admin_color_schemes' ) ) { |
|
| 267 | + register_admin_color_schemes(); |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | 270 | $hook_suffix = ''; |
| 271 | 271 | $admin_body_class = ''; |
| 272 | 272 | |
| 273 | - if ( get_user_setting( 'mfold' ) == 'f' ) { |
|
| 274 | - $admin_body_class .= ' folded'; |
|
| 275 | - } |
|
| 273 | + if ( get_user_setting( 'mfold' ) == 'f' ) { |
|
| 274 | + $admin_body_class .= ' folded'; |
|
| 275 | + } |
|
| 276 | 276 | |
| 277 | - if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) { |
|
| 278 | - $admin_body_class .= ' admin-bar'; |
|
| 279 | - } |
|
| 277 | + if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) { |
|
| 278 | + $admin_body_class .= ' admin-bar'; |
|
| 279 | + } |
|
| 280 | 280 | |
| 281 | - if ( is_rtl() ) { |
|
| 282 | - $admin_body_class .= ' rtl'; |
|
| 283 | - } |
|
| 281 | + if ( is_rtl() ) { |
|
| 282 | + $admin_body_class .= ' rtl'; |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | - $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
|
| 286 | - $prepop = array(); |
|
| 287 | - FrmFieldsHelper::get_bulk_prefilled_opts($prepop); |
|
| 285 | + $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
|
| 286 | + $prepop = array(); |
|
| 287 | + FrmFieldsHelper::get_bulk_prefilled_opts($prepop); |
|
| 288 | 288 | |
| 289 | - $field = FrmField::getOne($field_id); |
|
| 289 | + $field = FrmField::getOne($field_id); |
|
| 290 | 290 | |
| 291 | - wp_enqueue_script( 'utils' ); |
|
| 291 | + wp_enqueue_script( 'utils' ); |
|
| 292 | 292 | wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' ); |
| 293 | - FrmAppHelper::load_admin_wide_js(); |
|
| 293 | + FrmAppHelper::load_admin_wide_js(); |
|
| 294 | 294 | |
| 295 | 295 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/import_choices.php' ); |
| 296 | - wp_die(); |
|
| 297 | - } |
|
| 296 | + wp_die(); |
|
| 297 | + } |
|
| 298 | 298 | |
| 299 | - public static function import_options() { |
|
| 299 | + public static function import_options() { |
|
| 300 | 300 | FrmAppHelper::permission_check('frm_edit_forms'); |
| 301 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 301 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 302 | 302 | |
| 303 | - if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) { |
|
| 304 | - return; |
|
| 305 | - } |
|
| 303 | + if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) { |
|
| 304 | + return; |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | 307 | $field_id = absint( $_POST['field_id'] ); |
| 308 | - $field = FrmField::getOne($field_id); |
|
| 308 | + $field = FrmField::getOne($field_id); |
|
| 309 | 309 | |
| 310 | 310 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'select' ) ) ) { |
| 311 | - return; |
|
| 312 | - } |
|
| 311 | + return; |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - $field = FrmFieldsHelper::setup_edit_vars($field); |
|
| 314 | + $field = FrmFieldsHelper::setup_edit_vars($field); |
|
| 315 | 315 | $opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' ); |
| 316 | 316 | $opts = explode( "\n", rtrim( $opts, "\n" ) ); |
| 317 | 317 | $opts = array_map( 'trim', $opts ); |
| 318 | 318 | |
| 319 | - if ( $field['separate_value'] ) { |
|
| 320 | - foreach ( $opts as $opt_key => $opt ) { |
|
| 321 | - if ( strpos($opt, '|') !== false ) { |
|
| 322 | - $vals = explode('|', $opt); |
|
| 323 | - if ( $vals[0] != $vals[1] ) { |
|
| 324 | - $opts[ $opt_key ] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
| 325 | - } |
|
| 326 | - unset($vals); |
|
| 327 | - } |
|
| 328 | - unset($opt_key, $opt); |
|
| 329 | - } |
|
| 330 | - } |
|
| 331 | - |
|
| 332 | - //Keep other options after bulk update |
|
| 333 | - if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) { |
|
| 334 | - $other_array = array(); |
|
| 335 | - foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 319 | + if ( $field['separate_value'] ) { |
|
| 320 | + foreach ( $opts as $opt_key => $opt ) { |
|
| 321 | + if ( strpos($opt, '|') !== false ) { |
|
| 322 | + $vals = explode('|', $opt); |
|
| 323 | + if ( $vals[0] != $vals[1] ) { |
|
| 324 | + $opts[ $opt_key ] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
| 325 | + } |
|
| 326 | + unset($vals); |
|
| 327 | + } |
|
| 328 | + unset($opt_key, $opt); |
|
| 329 | + } |
|
| 330 | + } |
|
| 331 | + |
|
| 332 | + //Keep other options after bulk update |
|
| 333 | + if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) { |
|
| 334 | + $other_array = array(); |
|
| 335 | + foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 336 | 336 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 337 | 337 | $other_array[ $opt_key ] = $opt; |
| 338 | 338 | } |
| 339 | - unset($opt_key, $opt); |
|
| 340 | - } |
|
| 341 | - if ( ! empty($other_array) ) { |
|
| 342 | - $opts = array_merge( $opts, $other_array); |
|
| 343 | - } |
|
| 344 | - } |
|
| 339 | + unset($opt_key, $opt); |
|
| 340 | + } |
|
| 341 | + if ( ! empty($other_array) ) { |
|
| 342 | + $opts = array_merge( $opts, $other_array); |
|
| 343 | + } |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | - $field['options'] = $opts; |
|
| 346 | + $field['options'] = $opts; |
|
| 347 | 347 | |
| 348 | - if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
|
| 348 | + if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
|
| 349 | 349 | $field_name = 'item_meta[' . $field['id'] . ']'; |
| 350 | 350 | |
| 351 | 351 | // Get html_id which will be used in single-option.php |
| 352 | 352 | $html_id = FrmFieldsHelper::get_html_id( $field ); |
| 353 | 353 | |
| 354 | 354 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); |
| 355 | - } else { |
|
| 356 | - FrmFieldsHelper::show_single_option($field); |
|
| 357 | - } |
|
| 355 | + } else { |
|
| 356 | + FrmFieldsHelper::show_single_option($field); |
|
| 357 | + } |
|
| 358 | 358 | |
| 359 | - wp_die(); |
|
| 360 | - } |
|
| 359 | + wp_die(); |
|
| 360 | + } |
|
| 361 | 361 | |
| 362 | - public static function update_order() { |
|
| 362 | + public static function update_order() { |
|
| 363 | 363 | FrmAppHelper::permission_check('frm_edit_forms'); |
| 364 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 364 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 365 | 365 | |
| 366 | 366 | $fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
| 367 | 367 | foreach ( (array) $fields as $position => $item ) { |
| 368 | 368 | FrmField::update( absint( $item ), array( 'field_order' => absint( $position ) ) ); |
| 369 | 369 | } |
| 370 | - wp_die(); |
|
| 371 | - } |
|
| 370 | + wp_die(); |
|
| 371 | + } |
|
| 372 | 372 | |
| 373 | 373 | public static function change_type( $type ) { |
| 374 | - $type_switch = array( |
|
| 375 | - 'scale' => 'radio', |
|
| 376 | - '10radio' => 'radio', |
|
| 377 | - 'rte' => 'textarea', |
|
| 378 | - 'website' => 'url', |
|
| 379 | - ); |
|
| 380 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 381 | - $type = $type_switch[ $type ]; |
|
| 382 | - } |
|
| 374 | + $type_switch = array( |
|
| 375 | + 'scale' => 'radio', |
|
| 376 | + '10radio' => 'radio', |
|
| 377 | + 'rte' => 'textarea', |
|
| 378 | + 'website' => 'url', |
|
| 379 | + ); |
|
| 380 | + if ( isset( $type_switch[ $type ] ) ) { |
|
| 381 | + $type = $type_switch[ $type ]; |
|
| 382 | + } |
|
| 383 | 383 | |
| 384 | 384 | $pro_fields = FrmField::pro_field_selection(); |
| 385 | 385 | $types = array_keys( $pro_fields ); |
@@ -387,137 +387,137 @@ discard block |
||
| 387 | 387 | $type = 'text'; |
| 388 | 388 | } |
| 389 | 389 | |
| 390 | - return $type; |
|
| 391 | - } |
|
| 390 | + return $type; |
|
| 391 | + } |
|
| 392 | 392 | |
| 393 | 393 | public static function display_field_options( $display ) { |
| 394 | 394 | switch ( $display['type'] ) { |
| 395 | - case 'captcha': |
|
| 396 | - $display['required'] = false; |
|
| 397 | - $display['invalid'] = true; |
|
| 398 | - $display['default_blank'] = false; |
|
| 395 | + case 'captcha': |
|
| 396 | + $display['required'] = false; |
|
| 397 | + $display['invalid'] = true; |
|
| 398 | + $display['default_blank'] = false; |
|
| 399 | 399 | $display['captcha_size'] = true; |
| 400 | - break; |
|
| 401 | - case 'radio': |
|
| 402 | - $display['default_blank'] = false; |
|
| 403 | - break; |
|
| 404 | - case 'text': |
|
| 405 | - case 'textarea': |
|
| 406 | - $display['size'] = true; |
|
| 407 | - $display['clear_on_focus'] = true; |
|
| 408 | - break; |
|
| 409 | - case 'select': |
|
| 410 | - $display['size'] = true; |
|
| 411 | - break; |
|
| 412 | - case 'url': |
|
| 413 | - case 'website': |
|
| 414 | - case 'email': |
|
| 415 | - $display['size'] = true; |
|
| 416 | - $display['clear_on_focus'] = true; |
|
| 417 | - $display['invalid'] = true; |
|
| 418 | - } |
|
| 419 | - |
|
| 420 | - return $display; |
|
| 421 | - } |
|
| 422 | - |
|
| 423 | - public static function input_html( $field, $echo = true ) { |
|
| 424 | - $class = array(); //$field['type']; |
|
| 425 | - self::add_input_classes($field, $class); |
|
| 426 | - |
|
| 427 | - $add_html = array(); |
|
| 428 | - self::add_html_size($field, $add_html); |
|
| 429 | - self::add_html_length($field, $add_html); |
|
| 430 | - self::add_html_placeholder($field, $add_html, $class); |
|
| 400 | + break; |
|
| 401 | + case 'radio': |
|
| 402 | + $display['default_blank'] = false; |
|
| 403 | + break; |
|
| 404 | + case 'text': |
|
| 405 | + case 'textarea': |
|
| 406 | + $display['size'] = true; |
|
| 407 | + $display['clear_on_focus'] = true; |
|
| 408 | + break; |
|
| 409 | + case 'select': |
|
| 410 | + $display['size'] = true; |
|
| 411 | + break; |
|
| 412 | + case 'url': |
|
| 413 | + case 'website': |
|
| 414 | + case 'email': |
|
| 415 | + $display['size'] = true; |
|
| 416 | + $display['clear_on_focus'] = true; |
|
| 417 | + $display['invalid'] = true; |
|
| 418 | + } |
|
| 419 | + |
|
| 420 | + return $display; |
|
| 421 | + } |
|
| 422 | + |
|
| 423 | + public static function input_html( $field, $echo = true ) { |
|
| 424 | + $class = array(); //$field['type']; |
|
| 425 | + self::add_input_classes($field, $class); |
|
| 426 | + |
|
| 427 | + $add_html = array(); |
|
| 428 | + self::add_html_size($field, $add_html); |
|
| 429 | + self::add_html_length($field, $add_html); |
|
| 430 | + self::add_html_placeholder($field, $add_html, $class); |
|
| 431 | 431 | self::add_validation_messages( $field, $add_html ); |
| 432 | 432 | |
| 433 | - $class = apply_filters('frm_field_classes', implode(' ', $class), $field); |
|
| 433 | + $class = apply_filters('frm_field_classes', implode(' ', $class), $field); |
|
| 434 | 434 | |
| 435 | 435 | FrmFormsHelper::add_html_attr( $class, 'class', $add_html ); |
| 436 | 436 | |
| 437 | - self::add_shortcodes_to_html($field, $add_html); |
|
| 437 | + self::add_shortcodes_to_html($field, $add_html); |
|
| 438 | 438 | |
| 439 | 439 | $add_html = apply_filters( 'frm_field_extra_html', $add_html, $field ); |
| 440 | 440 | $add_html = ' ' . implode( ' ', $add_html ) . ' '; |
| 441 | 441 | |
| 442 | - if ( $echo ) { |
|
| 443 | - echo $add_html; |
|
| 444 | - } |
|
| 442 | + if ( $echo ) { |
|
| 443 | + echo $add_html; |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | - return $add_html; |
|
| 447 | - } |
|
| 446 | + return $add_html; |
|
| 447 | + } |
|
| 448 | 448 | |
| 449 | 449 | private static function add_input_classes( $field, array &$class ) { |
| 450 | - if ( isset($field['input_class']) && ! empty($field['input_class']) ) { |
|
| 451 | - $class[] = $field['input_class']; |
|
| 452 | - } |
|
| 450 | + if ( isset($field['input_class']) && ! empty($field['input_class']) ) { |
|
| 451 | + $class[] = $field['input_class']; |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | - if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) { |
|
| 455 | - return; |
|
| 456 | - } |
|
| 454 | + if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) { |
|
| 455 | + return; |
|
| 456 | + } |
|
| 457 | 457 | |
| 458 | - if ( isset($field['size']) && $field['size'] > 0 ) { |
|
| 459 | - $class[] = 'auto_width'; |
|
| 460 | - } |
|
| 461 | - } |
|
| 458 | + if ( isset($field['size']) && $field['size'] > 0 ) { |
|
| 459 | + $class[] = 'auto_width'; |
|
| 460 | + } |
|
| 461 | + } |
|
| 462 | 462 | |
| 463 | 463 | private static function add_html_size( $field, array &$add_html ) { |
| 464 | 464 | if ( ! isset( $field['size'] ) || $field['size'] <= 0 || in_array( $field['type'], array( 'select', 'data', 'time', 'hidden', 'file', 'lookup' ) ) ) { |
| 465 | - return; |
|
| 466 | - } |
|
| 465 | + return; |
|
| 466 | + } |
|
| 467 | 467 | |
| 468 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 469 | - return; |
|
| 470 | - } |
|
| 468 | + if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 469 | + return; |
|
| 470 | + } |
|
| 471 | 471 | |
| 472 | - if ( is_numeric($field['size']) ) { |
|
| 473 | - $field['size'] .= 'px'; |
|
| 474 | - } |
|
| 472 | + if ( is_numeric($field['size']) ) { |
|
| 473 | + $field['size'] .= 'px'; |
|
| 474 | + } |
|
| 475 | 475 | |
| 476 | - $important = apply_filters('frm_use_important_width', 1, $field); |
|
| 477 | - // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
|
| 476 | + $important = apply_filters('frm_use_important_width', 1, $field); |
|
| 477 | + // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
|
| 478 | 478 | $add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"'; |
| 479 | 479 | |
| 480 | - self::add_html_cols($field, $add_html); |
|
| 481 | - } |
|
| 480 | + self::add_html_cols($field, $add_html); |
|
| 481 | + } |
|
| 482 | 482 | |
| 483 | 483 | private static function add_html_cols( $field, array &$add_html ) { |
| 484 | 484 | if ( ! in_array( $field['type'], array( 'textarea', 'rte' ) ) ) { |
| 485 | - return; |
|
| 486 | - } |
|
| 485 | + return; |
|
| 486 | + } |
|
| 487 | 487 | |
| 488 | - // convert to cols for textareas |
|
| 489 | - $calc = array( |
|
| 490 | - '' => 9, |
|
| 491 | - 'px' => 9, |
|
| 492 | - 'rem' => 0.444, |
|
| 493 | - 'em' => 0.544, |
|
| 494 | - ); |
|
| 488 | + // convert to cols for textareas |
|
| 489 | + $calc = array( |
|
| 490 | + '' => 9, |
|
| 491 | + 'px' => 9, |
|
| 492 | + 'rem' => 0.444, |
|
| 493 | + 'em' => 0.544, |
|
| 494 | + ); |
|
| 495 | 495 | |
| 496 | - // include "col" for valid html |
|
| 497 | - $unit = trim(preg_replace('/[0-9]+/', '', $field['size'])); |
|
| 496 | + // include "col" for valid html |
|
| 497 | + $unit = trim(preg_replace('/[0-9]+/', '', $field['size'])); |
|
| 498 | 498 | |
| 499 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 500 | - return; |
|
| 501 | - } |
|
| 499 | + if ( ! isset( $calc[ $unit ] ) ) { |
|
| 500 | + return; |
|
| 501 | + } |
|
| 502 | 502 | |
| 503 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 503 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 504 | 504 | |
| 505 | 505 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 506 | - } |
|
| 506 | + } |
|
| 507 | 507 | |
| 508 | 508 | private static function add_html_length( $field, array &$add_html ) { |
| 509 | - // check for max setting and if this field accepts maxlength |
|
| 509 | + // check for max setting and if this field accepts maxlength |
|
| 510 | 510 | if ( FrmField::is_option_empty( $field, 'max' ) || in_array( $field['type'], array( 'textarea', 'rte', 'hidden', 'file' ) ) ) { |
| 511 | - return; |
|
| 512 | - } |
|
| 511 | + return; |
|
| 512 | + } |
|
| 513 | 513 | |
| 514 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 515 | - // don't load on form builder page |
|
| 516 | - return; |
|
| 517 | - } |
|
| 514 | + if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 515 | + // don't load on form builder page |
|
| 516 | + return; |
|
| 517 | + } |
|
| 518 | 518 | |
| 519 | 519 | $add_html['maxlength'] = 'maxlength="' . esc_attr( $field['max'] ) . '"'; |
| 520 | - } |
|
| 520 | + } |
|
| 521 | 521 | |
| 522 | 522 | private static function add_html_placeholder( $field, array &$add_html, array &$class ) { |
| 523 | 523 | if ( empty( $field['default_value'] ) || FrmAppHelper::is_admin_page( 'formidable' ) ) { |
@@ -525,35 +525,35 @@ discard block |
||
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | $default_value_array = is_array( $field['default_value'] ); |
| 528 | - if ( ! FrmField::is_option_true( $field, 'clear_on_focus' ) ) { |
|
| 528 | + if ( ! FrmField::is_option_true( $field, 'clear_on_focus' ) ) { |
|
| 529 | 529 | if ( $default_value_array ) { |
| 530 | 530 | $field['default_value'] = json_encode( $field['default_value'] ); |
| 531 | 531 | } |
| 532 | 532 | $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $field['default_value'] ) . '"'; |
| 533 | - return; |
|
| 534 | - } |
|
| 533 | + return; |
|
| 534 | + } |
|
| 535 | 535 | |
| 536 | 536 | if ( $default_value_array ) { |
| 537 | 537 | // don't include a json placeholder |
| 538 | 538 | return; |
| 539 | 539 | } |
| 540 | 540 | |
| 541 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 541 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 542 | 542 | |
| 543 | 543 | if ( $frm_settings->use_html && ! in_array( $field['type'], array( 'select', 'radio', 'checkbox', 'hidden' ) ) ) { |
| 544 | - // use HMTL5 placeholder with js fallback |
|
| 544 | + // use HMTL5 placeholder with js fallback |
|
| 545 | 545 | $add_html['placeholder'] = 'placeholder="' . esc_attr( $field['default_value'] ) . '"'; |
| 546 | - wp_enqueue_script('jquery-placeholder'); |
|
| 547 | - } else if ( ! $frm_settings->use_html ) { |
|
| 546 | + wp_enqueue_script('jquery-placeholder'); |
|
| 547 | + } else if ( ! $frm_settings->use_html ) { |
|
| 548 | 548 | $val = str_replace( array( "\r\n", "\n" ), '\r', addslashes( str_replace( ''', "'", esc_attr( $field['default_value'] ) ) ) ); |
| 549 | 549 | $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $val ) . '"'; |
| 550 | - $class[] = 'frm_toggle_default'; |
|
| 550 | + $class[] = 'frm_toggle_default'; |
|
| 551 | 551 | |
| 552 | - if ( $field['value'] == $field['default_value'] ) { |
|
| 553 | - $class[] = 'frm_default'; |
|
| 554 | - } |
|
| 555 | - } |
|
| 556 | - } |
|
| 552 | + if ( $field['value'] == $field['default_value'] ) { |
|
| 553 | + $class[] = 'frm_default'; |
|
| 554 | + } |
|
| 555 | + } |
|
| 556 | + } |
|
| 557 | 557 | |
| 558 | 558 | private static function add_validation_messages( $field, array &$add_html ) { |
| 559 | 559 | if ( FrmField::is_required( $field ) ) { |
@@ -567,44 +567,44 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | } |
| 569 | 569 | |
| 570 | - private static function add_shortcodes_to_html( $field, array &$add_html ) { |
|
| 571 | - if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) { |
|
| 572 | - return; |
|
| 573 | - } |
|
| 570 | + private static function add_shortcodes_to_html( $field, array &$add_html ) { |
|
| 571 | + if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) { |
|
| 572 | + return; |
|
| 573 | + } |
|
| 574 | 574 | |
| 575 | - foreach ( $field['shortcodes'] as $k => $v ) { |
|
| 576 | - if ( 'opt' === $k ) { |
|
| 577 | - continue; |
|
| 578 | - } |
|
| 575 | + foreach ( $field['shortcodes'] as $k => $v ) { |
|
| 576 | + if ( 'opt' === $k ) { |
|
| 577 | + continue; |
|
| 578 | + } |
|
| 579 | 579 | |
| 580 | - if ( is_numeric($k) && strpos($v, '=') ) { |
|
| 581 | - $add_html[] = $v; |
|
| 582 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 580 | + if ( is_numeric($k) && strpos($v, '=') ) { |
|
| 581 | + $add_html[] = $v; |
|
| 582 | + } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 583 | 583 | $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
| 584 | - } else { |
|
| 584 | + } else { |
|
| 585 | 585 | $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
| 586 | - } |
|
| 587 | - |
|
| 588 | - unset($k, $v); |
|
| 589 | - } |
|
| 590 | - } |
|
| 591 | - |
|
| 592 | - public static function check_value( $opt, $opt_key, $field ) { |
|
| 593 | - if ( is_array( $opt ) ) { |
|
| 594 | - if ( FrmField::is_option_true( $field, 'separate_value' ) ) { |
|
| 595 | - $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
| 596 | - } else { |
|
| 597 | - $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
| 598 | - } |
|
| 599 | - } |
|
| 600 | - return $opt; |
|
| 601 | - } |
|
| 586 | + } |
|
| 587 | + |
|
| 588 | + unset($k, $v); |
|
| 589 | + } |
|
| 590 | + } |
|
| 591 | + |
|
| 592 | + public static function check_value( $opt, $opt_key, $field ) { |
|
| 593 | + if ( is_array( $opt ) ) { |
|
| 594 | + if ( FrmField::is_option_true( $field, 'separate_value' ) ) { |
|
| 595 | + $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
| 596 | + } else { |
|
| 597 | + $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
| 598 | + } |
|
| 599 | + } |
|
| 600 | + return $opt; |
|
| 601 | + } |
|
| 602 | 602 | |
| 603 | 603 | public static function check_label( $opt ) { |
| 604 | - if ( is_array($opt) ) { |
|
| 605 | - $opt = (isset($opt['label']) ? $opt['label'] : reset($opt)); |
|
| 606 | - } |
|
| 604 | + if ( is_array($opt) ) { |
|
| 605 | + $opt = (isset($opt['label']) ? $opt['label'] : reset($opt)); |
|
| 606 | + } |
|
| 607 | 607 | |
| 608 | - return $opt; |
|
| 609 | - } |
|
| 608 | + return $opt; |
|
| 609 | + } |
|
| 610 | 610 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | 'entry' => $this->entry, |
| 96 | 96 | 'form' => $this->form, |
| 97 | 97 | ); |
| 98 | - $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 98 | + $to = apply_filters( 'frm_to_email', $to, $values, $this->form->id, $args ); |
|
| 99 | 99 | |
| 100 | 100 | $this->to = array_unique( (array) $to ); |
| 101 | 101 | |
@@ -433,7 +433,7 @@ discard block |
||
| 433 | 433 | * @return array |
| 434 | 434 | */ |
| 435 | 435 | private function package_header() { |
| 436 | - $header = array(); |
|
| 436 | + $header = array(); |
|
| 437 | 437 | |
| 438 | 438 | if ( ! empty( $this->cc ) ) { |
| 439 | 439 | $header[] = 'CC: ' . implode( ',', $this->cc ); |
@@ -546,12 +546,12 @@ discard block |
||
| 546 | 546 | $name = trim( str_replace( $email, '', $val ) ); |
| 547 | 547 | } else { |
| 548 | 548 | // If user enters a name without an email |
| 549 | - unset( $recipients[ $key ] ); |
|
| 549 | + unset( $recipients[$key] ); |
|
| 550 | 550 | continue; |
| 551 | 551 | } |
| 552 | 552 | } |
| 553 | 553 | |
| 554 | - $recipients[ $key ] = $name . ' <' . $email . '>'; |
|
| 554 | + $recipients[$key] = $name . ' <' . $email . '>'; |
|
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | return $recipients; |
@@ -668,7 +668,7 @@ discard block |
||
| 668 | 668 | ) ); |
| 669 | 669 | |
| 670 | 670 | // Remove phone number from to addresses |
| 671 | - unset( $this->to[ $key ] ); |
|
| 671 | + unset( $this->to[$key] ); |
|
| 672 | 672 | } |
| 673 | 673 | } |
| 674 | 674 | } |