@@ -1,22 +1,22 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$display = apply_filters('frm_display_field_options', array( |
|
| 3 | +$display = apply_filters( 'frm_display_field_options', array( |
|
| 4 | 4 | 'type' => $field['type'], 'field_data' => $field, |
| 5 | 5 | 'required' => true, 'unique' => false, 'read_only' => false, |
| 6 | 6 | 'description' => true, 'options' => true, 'label_position' => true, |
| 7 | 7 | 'invalid' => false, 'size' => false, 'clear_on_focus' => false, |
| 8 | 8 | 'default_blank' => true, 'css' => true, 'conf_field' => false, |
| 9 | 9 | 'max' => true, 'captcha_size' => false, |
| 10 | -)); |
|
| 10 | +) ); |
|
| 11 | 11 | |
| 12 | 12 | $li_classes = 'form-field edit_form_item frm_field_box frm_top_container frm_not_divider edit_field_type_' . $display['type']; |
| 13 | -$li_classes = apply_filters('frm_build_field_class', $li_classes, $field ); |
|
| 13 | +$li_classes = apply_filters( 'frm_build_field_class', $li_classes, $field ); |
|
| 14 | 14 | |
| 15 | 15 | if ( isset( $values ) && isset( $values['ajax_load'] ) && $values['ajax_load'] && isset( $count ) && $count > 10 && ! in_array( $field['type'], array( 'divider', 'end_divider' ) ) ) { |
| 16 | 16 | ?> |
| 17 | 17 | <li id="frm_field_id_<?php echo esc_attr( $field['id'] ); ?>" class="<?php echo esc_attr( $li_classes ) ?> frm_field_loading" data-fid="<?php echo esc_attr( $field['id'] ) ?>" data-formid="<?php echo esc_attr( 'divider' == $field['type'] ? $field['form_select'] : $field['form_id'] ); ?>" data-ftype="<?php echo esc_attr( $display['type'] ) ?>"> |
| 18 | 18 | <img src="<?php echo FrmAppHelper::plugin_url() ?>/images/ajax_loader.gif" alt="<?php esc_attr_e( 'Loading', 'formidable' ) ?>" /> |
| 19 | -<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars(json_encode($field)) ?></span> |
|
| 19 | +<span class="frm_hidden_fdata frm_hidden"><?php echo htmlspecialchars( json_encode( $field ) ) ?></span> |
|
| 20 | 20 | </li> |
| 21 | 21 | <?php |
| 22 | 22 | return; |
@@ -25,8 +25,8 @@ discard block |
||
| 25 | 25 | $frm_settings = FrmAppHelper::get_settings(); |
| 26 | 26 | |
| 27 | 27 | if ( ! isset( $frm_all_field_selection ) ) { |
| 28 | - if ( isset($frm_field_selection) && isset($pro_field_selection) ) { |
|
| 29 | - $frm_all_field_selection = array_merge($frm_field_selection, $pro_field_selection); |
|
| 28 | + if ( isset( $frm_field_selection ) && isset( $pro_field_selection ) ) { |
|
| 29 | + $frm_all_field_selection = array_merge( $frm_field_selection, $pro_field_selection ); |
|
| 30 | 30 | } else { |
| 31 | 31 | $pro_field_selection = FrmField::pro_field_selection(); |
| 32 | 32 | $frm_all_field_selection = array_merge( FrmField::field_selection(), $pro_field_selection ); |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | <a href="javascript:void(0);" class="frm_bstooltip alignright frm-show-hover frm-move frm-hover-icon frm_icon_font frm_move_icon" title="<?php esc_attr_e( 'Move Field', 'formidable' ) ?>"> </a> |
| 52 | 52 | <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_delete_icon frm_delete_field" title="<?php esc_attr_e( 'Delete Field', 'formidable' ) ?>"> </a> |
| 53 | 53 | <a href="#" class="frm_bstooltip alignright frm-show-hover frm-hover-icon frm_icon_font frm_duplicate_icon" title="<?php ( $field['type'] == 'divider' ) ? esc_attr_e( 'Duplicate Section', 'formidable' ) : esc_attr_e( 'Duplicate Field', 'formidable' ) ?>"> </a> |
| 54 | - <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr($field['id']) ?>" /> |
|
| 55 | - <?php do_action('frm_extra_field_actions', $field['id']); ?> |
|
| 54 | + <input type="hidden" name="frm_fields_submitted[]" value="<?php echo esc_attr( $field['id'] ) ?>" /> |
|
| 55 | + <?php do_action( 'frm_extra_field_actions', $field['id'] ); ?> |
|
| 56 | 56 | <?php if ( $display['required'] ) { ?> |
| 57 | 57 | <span id="require_field_<?php echo esc_attr( $field['id'] ); ?>"> |
| 58 | 58 | <a href="javascript:void(0);" class="frm_req_field frm_action_icon frm_required_icon frm_icon_font alignleft frm_required<?php echo (int) $field['required'] ?>" id="req_field_<?php echo esc_attr( $field['id'] ); ?>" title="Click to Mark as <?php echo FrmField::is_required( $field ) ? 'not ' : ''; ?>Required"></a> |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | <?php } |
| 61 | 61 | |
| 62 | 62 | ?> |
| 63 | - <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button': ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
|
| 63 | + <label class="<?php echo ( $field['type'] == 'end_divider' ) ? '' : 'frm_ipe_field_label'; ?> frm_primary_label <?php echo ( $field['type'] == 'break' ) ? 'button' : ''; ?>" id="field_label_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['name'] == '' ) ? __( '(no label)', 'formidable' ) : force_balance_tags( $field['name'] ); ?></label> |
|
| 64 | 64 | |
| 65 | 65 | |
| 66 | 66 | <div id="field_<?php echo esc_attr( $field['id'] ) ?>_inner_container" class="frm_inner_field_container"> |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | </div> |
| 79 | 79 | <?php |
| 80 | 80 | if ( $display['description'] ) { ?> |
| 81 | - <div class="frm_ipe_field_desc description <?php echo ($field['description'] == '') ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ($field['description'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div> |
|
| 81 | + <div class="frm_ipe_field_desc description <?php echo ( $field['description'] == '' ) ? 'frm-show-click' : '' ?>" id="field_description_<?php echo esc_attr( $field['id'] ); ?>"><?php echo ( $field['description'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['description'] ); ?></div> |
|
| 82 | 82 | <input type="hidden" name="field_options[description_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['description'] ); ?>" /> |
| 83 | 83 | |
| 84 | 84 | <?php } ?> |
@@ -90,8 +90,8 @@ discard block |
||
| 90 | 90 | <div class="frm_form_fields"> |
| 91 | 91 | <input type="text" id="conf_field_<?php echo esc_attr( $field['field_key'] ) ?>" name="field_options[conf_input_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_input'] ); ?>" class="dyn_default_value" /> |
| 92 | 92 | </div> |
| 93 | - <div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ($field['conf_desc'] == '') ? 'frm-show-click' : '' ?>"><?php |
|
| 94 | - echo ($field['conf_desc'] == '') ? __( '(Click to add description)', 'formidable' ) : force_balance_tags($field['conf_desc']); ?></div> |
|
| 93 | + <div id="conf_field_description_<?php echo esc_attr( $field['id'] ) ?>" class="frm_ipe_field_conf_desc description <?php echo ( $field['conf_desc'] == '' ) ? 'frm-show-click' : '' ?>"><?php |
|
| 94 | + echo ( $field['conf_desc'] == '' ) ? __( '(Click to add description)', 'formidable' ) : force_balance_tags( $field['conf_desc'] ); ?></div> |
|
| 95 | 95 | <input type="hidden" name="field_options[conf_desc_<?php echo esc_attr( $field['id'] ) ?>]" value="<?php echo esc_attr( $field['conf_desc'] ); ?>" /> |
| 96 | 96 | </div> |
| 97 | 97 | <?php if ( $display['clear_on_focus'] ) { ?> |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | if ( in_array( $field['type'], array( 'select', 'radio', 'checkbox' ) ) ) { ?> |
| 107 | 107 | <div class="frm-show-click frm_small_top_margin"><?php |
| 108 | 108 | |
| 109 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 109 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
| 110 | 110 | echo '<p class="howto">' . FrmFieldsHelper::get_term_link( $field['taxonomy'] ) . '</p>'; |
| 111 | 111 | } else if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { |
| 112 | 112 | ?> |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | <?php |
| 121 | 121 | } |
| 122 | 122 | |
| 123 | - if ( ! isset($field['post_field']) || $field['post_field'] != 'post_category' ) { ?> |
|
| 123 | + if ( ! isset( $field['post_field'] ) || $field['post_field'] != 'post_category' ) { ?> |
|
| 124 | 124 | <a href="<?php echo esc_url( admin_url( 'admin-ajax.php?action=frm_import_choices&field_id=' . $field['id'] . '&TB_iframe=1' ) ) ?>" title="<?php echo esc_attr( FrmAppHelper::truncate( strip_tags( str_replace( '"', '"', $field['name'] ) ), 20 ) . ' ' . __( 'Field Choices', 'formidable' ) ); ?>" class="thickbox frm_orange"> |
| 125 | 125 | <?php _e( 'Bulk Edit Options', 'formidable' ) ?> |
| 126 | 126 | </a> |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | <?php |
| 134 | 134 | } |
| 135 | 135 | |
| 136 | -do_action('frm_before_field_options', $field); |
|
| 136 | +do_action( 'frm_before_field_options', $field ); |
|
| 137 | 137 | |
| 138 | 138 | if ( $display['options'] ) { ?> |
| 139 | 139 | <div class="widget"> |
@@ -143,13 +143,13 @@ discard block |
||
| 143 | 143 | </div> |
| 144 | 144 | <div class="widget-inside"> |
| 145 | 145 | <table class="form-table frm_clear_none"> |
| 146 | - <?php $field_types = FrmFieldsHelper::get_field_types($field['type']); ?> |
|
| 146 | + <?php $field_types = FrmFieldsHelper::get_field_types( $field['type'] ); ?> |
|
| 147 | 147 | <tr><td class="frm_150_width"><label><?php _e( 'Field Type', 'formidable' ) ?></label></td> |
| 148 | 148 | <td> |
| 149 | - <select <?php if ( count($field_types) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>> |
|
| 149 | + <select <?php if ( count( $field_types ) == 1 ) { ?>disabled="disabled"<?php } else { ?>name="field_options[type_<?php echo esc_attr( $field['id'] ) ?>]"<?php } ?>> |
|
| 150 | 150 | <?php |
| 151 | 151 | foreach ( $field_types as $fkey => $ftype ) { ?> |
| 152 | - <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists($fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array($ftype) ? $ftype['name'] : $ftype ?> </option> |
|
| 152 | + <option value="<?php echo esc_attr( $fkey ) ?>" <?php echo ( $fkey == $field['type'] ) ? ' selected="selected"' : ''; ?> <?php echo array_key_exists( $fkey, $disabled_fields ) ? 'disabled="disabled"' : ''; ?>><?php echo is_array( $ftype ) ? $ftype['name'] : $ftype ?> </option> |
|
| 153 | 153 | <?php |
| 154 | 154 | unset( $fkey, $ftype ); |
| 155 | 155 | } ?> |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | </label> |
| 185 | 185 | <?php } |
| 186 | 186 | |
| 187 | - do_action('frm_field_options_form_top', $field, $display, $values); |
|
| 187 | + do_action( 'frm_field_options_form_top', $field, $display, $values ); |
|
| 188 | 188 | |
| 189 | 189 | ?> |
| 190 | 190 | <?php |
@@ -223,7 +223,7 @@ discard block |
||
| 223 | 223 | <td class="frm_150_width"><label><?php _e( 'Label Position', 'formidable' ) ?></label></td> |
| 224 | 224 | <td> |
| 225 | 225 | <select name="field_options[label_<?php echo esc_attr( $field['id'] ) ?>]"> |
| 226 | - <option value=""<?php selected($field['label'], ''); ?>> |
|
| 226 | + <option value=""<?php selected( $field['label'], '' ); ?>> |
|
| 227 | 227 | <?php _e( 'Default', 'formidable' ) ?> |
| 228 | 228 | </option> |
| 229 | 229 | <?php foreach ( FrmStylesHelper::get_sigle_label_postitions() as $pos => $pos_label ) { ?> |
@@ -281,7 +281,7 @@ discard block |
||
| 281 | 281 | do_action( 'frm_field_options_form', $field, $display, $values ); |
| 282 | 282 | |
| 283 | 283 | if ( $display['required'] || $display['invalid'] || $display['unique'] || $display['conf_field'] ) { ?> |
| 284 | - <tr class="frm_validation_msg <?php echo ($display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
|
| 284 | + <tr class="frm_validation_msg <?php echo ( $display['invalid'] || $field['required'] || FrmField::is_option_true( $field, 'unique' ) || FrmField::is_option_true( $field, 'conf_field' ) ) ? '' : 'frm_hidden'; ?>"> |
|
| 285 | 285 | <td colspan="2"> |
| 286 | 286 | <div class="menu-settings"> |
| 287 | 287 | <h3 class="frm_no_bg"><?php _e( 'Validation', 'formidable' ) ?></h3> |
@@ -345,4 +345,4 @@ discard block |
||
| 345 | 345 | <?php |
| 346 | 346 | } |
| 347 | 347 | |
| 348 | -unset($display); |
|
| 348 | +unset( $display ); |
|
@@ -1,10 +1,10 @@ discard block |
||
| 1 | 1 | <div class="field-group field-group-background clearfix frm-first-row"> |
| 2 | 2 | <label><?php _e( 'Color', 'formidable' ) ?></label> |
| 3 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('label_color') ) ?>" id="frm_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['label_color'] ) ?>" /> |
|
| 3 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'label_color' ) ) ?>" id="frm_label_color" class="hex" value="<?php echo esc_attr( $style->post_content['label_color'] ) ?>" /> |
|
| 4 | 4 | </div> |
| 5 | 5 | <div class="field-group clearfix frm-first-row"> |
| 6 | 6 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
| 7 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('weight') ) ?>" id="frm_weight"> |
|
| 7 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'weight' ) ) ?>" id="frm_weight"> |
|
| 8 | 8 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
| 9 | 9 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
| 10 | 10 | <?php } ?> |
@@ -12,45 +12,45 @@ discard block |
||
| 12 | 12 | </div> |
| 13 | 13 | <div class="field-group clearfix frm-first-row"> |
| 14 | 14 | <label><?php _e( 'Size', 'formidable' ) ?></label> |
| 15 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('font_size') ) ?>" id="frm_font_size" value="<?php echo esc_attr($style->post_content['font_size']) ?>" size="3" /> |
|
| 15 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'font_size' ) ) ?>" id="frm_font_size" value="<?php echo esc_attr( $style->post_content['font_size'] ) ?>" size="3" /> |
|
| 16 | 16 | </div> |
| 17 | 17 | |
| 18 | 18 | <div class="field-group clearfix frm_clear"> |
| 19 | 19 | <label><?php _e( 'Position', 'formidable' ) ?></label> |
| 20 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('position') ) ?>" id="frm_position"> |
|
| 20 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'position' ) ) ?>" id="frm_position"> |
|
| 21 | 21 | <?php foreach ( FrmStylesHelper::get_css_label_positions() as $pos => $pos_label ) { ?> |
| 22 | - <option value="<?php echo esc_attr( $pos ) ?>" <?php selected($style->post_content['position'], $pos) ?>><?php echo esc_html( $pos_label ) ?></option> |
|
| 22 | + <option value="<?php echo esc_attr( $pos ) ?>" <?php selected( $style->post_content['position'], $pos ) ?>><?php echo esc_html( $pos_label ) ?></option> |
|
| 23 | 23 | <?php } ?> |
| 24 | 24 | </select> |
| 25 | 25 | </div> |
| 26 | 26 | |
| 27 | 27 | <div class="field-group clearfix"> |
| 28 | 28 | <label><?php _e( 'Align', 'formidable' ) ?></label> |
| 29 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('align') ) ?>" id="frm_align"> |
|
| 30 | - <option value="left" <?php selected($style->post_content['align'], 'left') ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 31 | - <option value="right" <?php selected($style->post_content['align'], 'right') ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 29 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'align' ) ) ?>" id="frm_align"> |
|
| 30 | + <option value="left" <?php selected( $style->post_content['align'], 'left' ) ?>><?php _e( 'left', 'formidable' ) ?></option> |
|
| 31 | + <option value="right" <?php selected( $style->post_content['align'], 'right' ) ?>><?php _e( 'right', 'formidable' ) ?></option> |
|
| 32 | 32 | </select> |
| 33 | 33 | </div> |
| 34 | 34 | |
| 35 | 35 | <div class="field-group clearfix"> |
| 36 | 36 | <label><?php _e( 'Width', 'formidable' ) ?></label> |
| 37 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('width') ) ?>" id="frm_width" value="<?php echo esc_attr( $style->post_content['width'] ) ?>" /> |
|
| 37 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'width' ) ) ?>" id="frm_width" value="<?php echo esc_attr( $style->post_content['width'] ) ?>" /> |
|
| 38 | 38 | </div> |
| 39 | 39 | |
| 40 | 40 | <div class="field-group clearfix frm_clear"> |
| 41 | 41 | <label><?php _e( 'Padding', 'formidable' ) ?></label> |
| 42 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('label_padding') ) ?>" id="frm_label_padding" value="<?php echo esc_attr( $style->post_content['label_padding'] ) ?>" /> |
|
| 42 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'label_padding' ) ) ?>" id="frm_label_padding" value="<?php echo esc_attr( $style->post_content['label_padding'] ) ?>" /> |
|
| 43 | 43 | </div> |
| 44 | 44 | |
| 45 | 45 | <div class="clear"></div> |
| 46 | 46 | <h3><?php _e( 'Required Indicator', 'formidable' ) ?></h3> |
| 47 | 47 | <div class="field-group field-group-border clearfix after-h3"> |
| 48 | 48 | <label class="background"><?php _e( 'Color', 'formidable' ) ?></label> |
| 49 | - <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name('required_color') ) ?>" id="frm_required_color" class="hex" value="<?php echo esc_attr( $style->post_content['required_color'] ) ?>" /> |
|
| 49 | + <input type="text" name="<?php echo esc_attr( $frm_style->get_field_name( 'required_color' ) ) ?>" id="frm_required_color" class="hex" value="<?php echo esc_attr( $style->post_content['required_color'] ) ?>" /> |
|
| 50 | 50 | </div> |
| 51 | 51 | <div class="field-group clearfix after-h3"> |
| 52 | 52 | <label><?php _e( 'Weight', 'formidable' ) ?></label> |
| 53 | - <select name="<?php echo esc_attr( $frm_style->get_field_name('required_weight') ) ?>" id="frm_required_weight"> |
|
| 53 | + <select name="<?php echo esc_attr( $frm_style->get_field_name( 'required_weight' ) ) ?>" id="frm_required_weight"> |
|
| 54 | 54 | <?php foreach ( FrmStyle::get_bold_options() as $value => $name ) { ?> |
| 55 | 55 | <option value="<?php echo esc_attr( $value ) ?>" <?php selected( $style->post_content['required_weight'], $value ) ?>><?php echo esc_html( $name ) ?></option> |
| 56 | 56 | <?php } ?> |
@@ -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; |
@@ -172,7 +172,7 @@ 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 | 177 | wp_die(); |
| 178 | 178 | } |
@@ -181,9 +181,9 @@ discard block |
||
| 181 | 181 | * Load a single field in the form builder along with all needed variables |
| 182 | 182 | */ |
| 183 | 183 | public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
| 184 | - $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id)); |
|
| 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); |
|
| 186 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
| 187 | 187 | $id = $form_id ? $form_id : $field['form_id']; |
| 188 | 188 | if ( $field['type'] == 'html' ) { |
| 189 | 189 | $field['stop_filter'] = true; |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | public static function destroy() { |
| 198 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 198 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 199 | 199 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 200 | 200 | |
| 201 | 201 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
@@ -207,14 +207,14 @@ discard block |
||
| 207 | 207 | |
| 208 | 208 | //Add Single Option or Other Option |
| 209 | 209 | public static function add_option() { |
| 210 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 210 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 211 | 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 | 219 | if ( 'other' == $opt_type ) { |
| 220 | 220 | $opt = __( 'Other', 'formidable' ); |
@@ -284,9 +284,9 @@ discard block |
||
| 284 | 284 | |
| 285 | 285 | $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
| 286 | 286 | $prepop = array(); |
| 287 | - FrmFieldsHelper::get_bulk_prefilled_opts($prepop); |
|
| 287 | + FrmFieldsHelper::get_bulk_prefilled_opts( $prepop ); |
|
| 288 | 288 | |
| 289 | - $field = FrmField::getOne($field_id); |
|
| 289 | + $field = FrmField::getOne( $field_id ); |
|
| 290 | 290 | |
| 291 | 291 | wp_enqueue_script( 'utils' ); |
| 292 | 292 | wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' ); |
@@ -297,35 +297,35 @@ discard block |
||
| 297 | 297 | } |
| 298 | 298 | |
| 299 | 299 | public static function import_options() { |
| 300 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 300 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 301 | 301 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 302 | 302 | |
| 303 | - if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) { |
|
| 303 | + if ( ! is_admin() || ! current_user_can( 'frm_edit_forms' ) ) { |
|
| 304 | 304 | return; |
| 305 | 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 | 311 | return; |
| 312 | 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 | 319 | if ( $field['separate_value'] ) { |
| 320 | 320 | foreach ( $opts as $opt_key => $opt ) { |
| 321 | - if ( strpos($opt, '|') !== false ) { |
|
| 322 | - $vals = explode('|', $opt); |
|
| 321 | + if ( strpos( $opt, '|' ) !== false ) { |
|
| 322 | + $vals = explode( '|', $opt ); |
|
| 323 | 323 | if ( $vals[0] != $vals[1] ) { |
| 324 | - $opts[ $opt_key ] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
| 324 | + $opts[$opt_key] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
| 325 | 325 | } |
| 326 | - unset($vals); |
|
| 326 | + unset( $vals ); |
|
| 327 | 327 | } |
| 328 | - unset($opt_key, $opt); |
|
| 328 | + unset( $opt_key, $opt ); |
|
| 329 | 329 | } |
| 330 | 330 | } |
| 331 | 331 | |
@@ -334,12 +334,12 @@ discard block |
||
| 334 | 334 | $other_array = array(); |
| 335 | 335 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 336 | 336 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 337 | - $other_array[ $opt_key ] = $opt; |
|
| 337 | + $other_array[$opt_key] = $opt; |
|
| 338 | 338 | } |
| 339 | - unset($opt_key, $opt); |
|
| 339 | + unset( $opt_key, $opt ); |
|
| 340 | 340 | } |
| 341 | - if ( ! empty($other_array) ) { |
|
| 342 | - $opts = array_merge( $opts, $other_array); |
|
| 341 | + if ( ! empty( $other_array ) ) { |
|
| 342 | + $opts = array_merge( $opts, $other_array ); |
|
| 343 | 343 | } |
| 344 | 344 | } |
| 345 | 345 | |
@@ -353,14 +353,14 @@ discard block |
||
| 353 | 353 | |
| 354 | 354 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); |
| 355 | 355 | } else { |
| 356 | - FrmFieldsHelper::show_single_option($field); |
|
| 356 | + FrmFieldsHelper::show_single_option( $field ); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | wp_die(); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | public static function update_order() { |
| 363 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 363 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 364 | 364 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 365 | 365 | |
| 366 | 366 | $fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
@@ -377,8 +377,8 @@ discard block |
||
| 377 | 377 | 'rte' => 'textarea', |
| 378 | 378 | 'website' => 'url', |
| 379 | 379 | ); |
| 380 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 381 | - $type = $type_switch[ $type ]; |
|
| 380 | + if ( isset( $type_switch[$type] ) ) { |
|
| 381 | + $type = $type_switch[$type]; |
|
| 382 | 382 | } |
| 383 | 383 | |
| 384 | 384 | $pro_fields = FrmField::pro_field_selection(); |
@@ -422,19 +422,19 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | public static function input_html( $field, $echo = true ) { |
| 424 | 424 | $class = array(); //$field['type']; |
| 425 | - self::add_input_classes($field, $class); |
|
| 425 | + self::add_input_classes( $field, $class ); |
|
| 426 | 426 | |
| 427 | 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); |
|
| 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 ) . ' '; |
@@ -447,7 +447,7 @@ discard block |
||
| 447 | 447 | } |
| 448 | 448 | |
| 449 | 449 | private static function add_input_classes( $field, array &$class ) { |
| 450 | - if ( isset($field['input_class']) && ! empty($field['input_class']) ) { |
|
| 450 | + if ( isset( $field['input_class'] ) && ! empty( $field['input_class'] ) ) { |
|
| 451 | 451 | $class[] = $field['input_class']; |
| 452 | 452 | } |
| 453 | 453 | |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | return; |
| 456 | 456 | } |
| 457 | 457 | |
| 458 | - if ( isset($field['size']) && $field['size'] > 0 ) { |
|
| 458 | + if ( isset( $field['size'] ) && $field['size'] > 0 ) { |
|
| 459 | 459 | $class[] = 'auto_width'; |
| 460 | 460 | } |
| 461 | 461 | } |
@@ -465,19 +465,19 @@ discard block |
||
| 465 | 465 | return; |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 468 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
| 469 | 469 | return; |
| 470 | 470 | } |
| 471 | 471 | |
| 472 | - if ( is_numeric($field['size']) ) { |
|
| 472 | + if ( is_numeric( $field['size'] ) ) { |
|
| 473 | 473 | $field['size'] .= 'px'; |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | - $important = apply_filters('frm_use_important_width', 1, $field); |
|
| 476 | + $important = apply_filters( 'frm_use_important_width', 1, $field ); |
|
| 477 | 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); |
|
| 480 | + self::add_html_cols( $field, $add_html ); |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | private static function add_html_cols( $field, array &$add_html ) { |
@@ -494,13 +494,13 @@ discard block |
||
| 494 | 494 | ); |
| 495 | 495 | |
| 496 | 496 | // include "col" for valid html |
| 497 | - $unit = trim(preg_replace('/[0-9]+/', '', $field['size'])); |
|
| 497 | + $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
|
| 498 | 498 | |
| 499 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 499 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 500 | 500 | return; |
| 501 | 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 | } |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | return; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 514 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
| 515 | 515 | // don't load on form builder page |
| 516 | 516 | return; |
| 517 | 517 | } |
@@ -591,7 +591,7 @@ discard block |
||
| 591 | 591 | private static function add_placeholder_to_input( $field, &$add_html ) { |
| 592 | 592 | if ( FrmFieldsHelper::is_placeholder_field_type( $field['type'] ) ) { |
| 593 | 593 | $add_html['placeholder'] = 'placeholder="' . esc_attr( $field['default_value'] ) . '"'; |
| 594 | - wp_enqueue_script('jquery-placeholder'); |
|
| 594 | + wp_enqueue_script( 'jquery-placeholder' ); |
|
| 595 | 595 | } |
| 596 | 596 | } |
| 597 | 597 | |
@@ -624,15 +624,15 @@ discard block |
||
| 624 | 624 | continue; |
| 625 | 625 | } |
| 626 | 626 | |
| 627 | - if ( is_numeric($k) && strpos($v, '=') ) { |
|
| 627 | + if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
|
| 628 | 628 | $add_html[] = $v; |
| 629 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 630 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 629 | + } else if ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 630 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 631 | 631 | } else { |
| 632 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 632 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | - unset($k, $v); |
|
| 635 | + unset( $k, $v ); |
|
| 636 | 636 | } |
| 637 | 637 | } |
| 638 | 638 | |
@@ -648,8 +648,8 @@ discard block |
||
| 648 | 648 | } |
| 649 | 649 | |
| 650 | 650 | public static function check_label( $opt ) { |
| 651 | - if ( is_array($opt) ) { |
|
| 652 | - $opt = (isset($opt['label']) ? $opt['label'] : reset($opt)); |
|
| 651 | + if ( is_array( $opt ) ) { |
|
| 652 | + $opt = ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
| 653 | 653 | } |
| 654 | 654 | |
| 655 | 655 | return $opt; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined('ABSPATH') ) { |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -8,12 +8,12 @@ discard block |
||
| 8 | 8 | public static function setup_new_vars( $fields, $form = '', $reset = false, $args = array() ) { |
| 9 | 9 | $values = array(); |
| 10 | 10 | foreach ( array( 'name' => '', 'description' => '', 'item_key' => '' ) as $var => $default ) { |
| 11 | - $values[ $var ] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' ); |
|
| 11 | + $values[$var] = FrmAppHelper::get_post_param( $var, $default, 'wp_kses_post' ); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | 14 | $values['fields'] = array(); |
| 15 | - if ( empty($fields) ) { |
|
| 16 | - return apply_filters('frm_setup_new_entry', $values); |
|
| 15 | + if ( empty( $fields ) ) { |
|
| 16 | + return apply_filters( 'frm_setup_new_entry', $values ); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | foreach ( (array) $fields as $field ) { |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | 'default_value' => $field->default_value, |
| 27 | 27 | 'name' => $field->name, |
| 28 | 28 | 'description' => $field->description, |
| 29 | - 'type' => apply_filters('frm_field_type', $field->type, $field, $new_value), |
|
| 29 | + 'type' => apply_filters( 'frm_field_type', $field->type, $field, $new_value ), |
|
| 30 | 30 | 'options' => $field->options, |
| 31 | 31 | 'required' => $field->required, |
| 32 | 32 | 'field_key' => $field->field_key, |
@@ -37,43 +37,43 @@ discard block |
||
| 37 | 37 | 'in_embed_form' => isset( $args['in_embed_form'] ) ? $args['in_embed_form'] : '0', |
| 38 | 38 | ); |
| 39 | 39 | |
| 40 | - $opt_defaults = FrmFieldsHelper::get_default_field_opts($field_array['type'], $field, true); |
|
| 40 | + $opt_defaults = FrmFieldsHelper::get_default_field_opts( $field_array['type'], $field, true ); |
|
| 41 | 41 | $opt_defaults['required_indicator'] = ''; |
| 42 | 42 | $opt_defaults['original_type'] = $field->type; |
| 43 | 43 | |
| 44 | 44 | foreach ( $opt_defaults as $opt => $default_opt ) { |
| 45 | - $field_array[ $opt ] = ( isset( $field->field_options[ $opt ] ) && $field->field_options[ $opt ] != '' ) ? $field->field_options[ $opt ] : $default_opt; |
|
| 46 | - unset($opt, $default_opt); |
|
| 45 | + $field_array[$opt] = ( isset( $field->field_options[$opt] ) && $field->field_options[$opt] != '' ) ? $field->field_options[$opt] : $default_opt; |
|
| 46 | + unset( $opt, $default_opt ); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - unset($opt_defaults); |
|
| 49 | + unset( $opt_defaults ); |
|
| 50 | 50 | |
| 51 | 51 | if ( $field_array['custom_html'] == '' ) { |
| 52 | - $field_array['custom_html'] = FrmFieldsHelper::get_default_html($field->type); |
|
| 52 | + $field_array['custom_html'] = FrmFieldsHelper::get_default_html( $field->type ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | - $field_array = apply_filters('frm_setup_new_fields_vars', $field_array, $field, $args ); |
|
| 55 | + $field_array = apply_filters( 'frm_setup_new_fields_vars', $field_array, $field, $args ); |
|
| 56 | 56 | $field_array = array_merge( $field->field_options, $field_array ); |
| 57 | 57 | |
| 58 | 58 | $values['fields'][] = $field_array; |
| 59 | 59 | |
| 60 | - if ( ! $form || ! isset($form->id) ) { |
|
| 61 | - $form = FrmForm::getOne($field->form_id); |
|
| 60 | + if ( ! $form || ! isset( $form->id ) ) { |
|
| 61 | + $form = FrmForm::getOne( $field->form_id ); |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $form->options = maybe_unserialize($form->options); |
|
| 66 | - if ( is_array($form->options) ) { |
|
| 65 | + $form->options = maybe_unserialize( $form->options ); |
|
| 66 | + if ( is_array( $form->options ) ) { |
|
| 67 | 67 | foreach ( $form->options as $opt => $value ) { |
| 68 | - $values[ $opt ] = FrmAppHelper::get_post_param( $opt, $value ); |
|
| 69 | - unset($opt, $value); |
|
| 68 | + $values[$opt] = FrmAppHelper::get_post_param( $opt, $value ); |
|
| 69 | + unset( $opt, $value ); |
|
| 70 | 70 | } |
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | $form_defaults = FrmFormsHelper::get_default_opts(); |
| 74 | 74 | |
| 75 | 75 | $frm_settings = FrmAppHelper::get_settings(); |
| 76 | - $form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
| 76 | + $form_defaults['custom_style'] = ( $frm_settings->load_style != 'none' ); |
|
| 77 | 77 | |
| 78 | 78 | $values = array_merge( $form_defaults, $values ); |
| 79 | 79 | |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | if ( ! is_array( $new_value ) ) { |
| 123 | - $new_value = str_replace('"', '"', $new_value); |
|
| 123 | + $new_value = str_replace( '"', '"', $new_value ); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | return $new_value; |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | if ( $_POST ) { |
| 140 | 140 | $repeating = isset( $args['repeating'] ) && $args['repeating']; |
| 141 | 141 | if ( $repeating ) { |
| 142 | - if ( isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] ) ) { |
|
| 142 | + if ( isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] ) ) { |
|
| 143 | 143 | $value_is_posted = true; |
| 144 | 144 | } |
| 145 | - } else if ( isset( $_POST['item_meta'][ $field->id ] ) ) { |
|
| 145 | + } else if ( isset( $_POST['item_meta'][$field->id] ) ) { |
|
| 146 | 146 | $value_is_posted = true; |
| 147 | 147 | } |
| 148 | 148 | } |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | $values['item_key'] = FrmAppHelper::get_post_param( 'item_key', $record->item_key, 'sanitize_title' ); |
| 154 | 154 | $values['form_id'] = $record->form_id; |
| 155 | 155 | $values['is_draft'] = $record->is_draft; |
| 156 | - return apply_filters('frm_setup_edit_entry_vars', $values, $record); |
|
| 156 | + return apply_filters( 'frm_setup_edit_entry_vars', $values, $record ); |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | public static function get_admin_params( $form = null ) { |
@@ -182,22 +182,22 @@ discard block |
||
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | public static function replace_default_message( $message, $atts ) { |
| 185 | - if ( strpos($message, '[default-message') === false && |
|
| 186 | - strpos($message, '[default_message') === false && |
|
| 185 | + if ( strpos( $message, '[default-message' ) === false && |
|
| 186 | + strpos( $message, '[default_message' ) === false && |
|
| 187 | 187 | ! empty( $message ) ) { |
| 188 | 188 | return $message; |
| 189 | 189 | } |
| 190 | 190 | |
| 191 | - if ( empty($message) ) { |
|
| 191 | + if ( empty( $message ) ) { |
|
| 192 | 192 | $message = '[default-message]'; |
| 193 | 193 | } |
| 194 | 194 | |
| 195 | - preg_match_all("/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER); |
|
| 195 | + preg_match_all( "/\[(default-message|default_message)\b(.*?)(?:(\/))?\]/s", $message, $shortcodes, PREG_PATTERN_ORDER ); |
|
| 196 | 196 | |
| 197 | 197 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 198 | - $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 198 | + $add_atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 199 | 199 | if ( ! empty( $add_atts ) ) { |
| 200 | - $this_atts = array_merge($atts, $add_atts); |
|
| 200 | + $this_atts = array_merge( $atts, $add_atts ); |
|
| 201 | 201 | } else { |
| 202 | 202 | $this_atts = $atts; |
| 203 | 203 | } |
@@ -205,32 +205,32 @@ discard block |
||
| 205 | 205 | $default = FrmEntriesController::show_entry_shortcode( $this_atts ); |
| 206 | 206 | |
| 207 | 207 | // Add the default message |
| 208 | - $message = str_replace( $shortcodes[0][ $short_key ], $default, $message ); |
|
| 208 | + $message = str_replace( $shortcodes[0][$short_key], $default, $message ); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | return $message; |
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | public static function prepare_display_value( $entry, $field, $atts ) { |
| 215 | - $field_value = isset( $entry->metas[ $field->id ] ) ? $entry->metas[ $field->id ] : false; |
|
| 215 | + $field_value = isset( $entry->metas[$field->id] ) ? $entry->metas[$field->id] : false; |
|
| 216 | 216 | |
| 217 | 217 | if ( FrmAppHelper::pro_is_installed() ) { |
| 218 | 218 | FrmProEntriesHelper::get_dynamic_list_values( $field, $entry, $field_value ); |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - if ( $field->form_id == $entry->form_id || empty($atts['embedded_field_id']) ) { |
|
| 222 | - return self::display_value($field_value, $field, $atts); |
|
| 221 | + if ( $field->form_id == $entry->form_id || empty( $atts['embedded_field_id'] ) ) { |
|
| 222 | + return self::display_value( $field_value, $field, $atts ); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | // this is an embeded form |
| 226 | 226 | $val = ''; |
| 227 | 227 | |
| 228 | - if ( strpos($atts['embedded_field_id'], 'form') === 0 ) { |
|
| 228 | + if ( strpos( $atts['embedded_field_id'], 'form' ) === 0 ) { |
|
| 229 | 229 | //this is a repeating section |
| 230 | 230 | $child_entries = FrmEntry::getAll( array( 'it.parent_item_id' => $entry->id ) ); |
| 231 | 231 | } else { |
| 232 | 232 | // get all values for this field |
| 233 | - $child_values = isset( $entry->metas[ $atts['embedded_field_id'] ] ) ? $entry->metas[ $atts['embedded_field_id'] ] : false; |
|
| 233 | + $child_values = isset( $entry->metas[$atts['embedded_field_id']] ) ? $entry->metas[$atts['embedded_field_id']] : false; |
|
| 234 | 234 | |
| 235 | 235 | if ( $child_values ) { |
| 236 | 236 | $child_entries = FrmEntry::getAll( array( 'it.id' => (array) $child_values ) ); |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | |
| 240 | 240 | $field_value = array(); |
| 241 | 241 | |
| 242 | - if ( ! isset($child_entries) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
| 242 | + if ( ! isset( $child_entries ) || ! $child_entries || ! FrmAppHelper::pro_is_installed() ) { |
|
| 243 | 243 | return $val; |
| 244 | 244 | } |
| 245 | 245 | |
@@ -248,17 +248,17 @@ discard block |
||
| 248 | 248 | $atts['post_id'] = $child_entry->post_id; |
| 249 | 249 | |
| 250 | 250 | // get the value for this field -- check for post values as well |
| 251 | - $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value($child_entry, $field); |
|
| 251 | + $entry_val = FrmProEntryMetaHelper::get_post_or_meta_value( $child_entry, $field ); |
|
| 252 | 252 | |
| 253 | 253 | if ( $entry_val ) { |
| 254 | 254 | // foreach entry get display_value |
| 255 | - $field_value[] = self::display_value($entry_val, $field, $atts); |
|
| 255 | + $field_value[] = self::display_value( $entry_val, $field, $atts ); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - unset($child_entry); |
|
| 258 | + unset( $child_entry ); |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | - $val = implode(', ', (array) $field_value ); |
|
| 261 | + $val = implode( ', ', (array) $field_value ); |
|
| 262 | 262 | $val = wp_kses_post( $val ); |
| 263 | 263 | |
| 264 | 264 | return $val; |
@@ -278,22 +278,22 @@ discard block |
||
| 278 | 278 | ); |
| 279 | 279 | |
| 280 | 280 | $atts = wp_parse_args( $atts, $defaults ); |
| 281 | - $atts = apply_filters('frm_display_value_atts', $atts, $field, $value); |
|
| 281 | + $atts = apply_filters( 'frm_display_value_atts', $atts, $field, $value ); |
|
| 282 | 282 | |
| 283 | - if ( ! isset($field->field_options['post_field']) ) { |
|
| 283 | + if ( ! isset( $field->field_options['post_field'] ) ) { |
|
| 284 | 284 | $field->field_options['post_field'] = ''; |
| 285 | 285 | } |
| 286 | 286 | |
| 287 | - if ( ! isset($field->field_options['custom_field']) ) { |
|
| 287 | + if ( ! isset( $field->field_options['custom_field'] ) ) { |
|
| 288 | 288 | $field->field_options['custom_field'] = ''; |
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | if ( FrmAppHelper::pro_is_installed() && $atts['post_id'] && ( $field->field_options['post_field'] || $atts['type'] == 'tag' ) ) { |
| 292 | 292 | $atts['pre_truncate'] = $atts['truncate']; |
| 293 | 293 | $atts['truncate'] = true; |
| 294 | - $atts['exclude_cat'] = isset($field->field_options['exclude_cat']) ? $field->field_options['exclude_cat'] : 0; |
|
| 294 | + $atts['exclude_cat'] = isset( $field->field_options['exclude_cat'] ) ? $field->field_options['exclude_cat'] : 0; |
|
| 295 | 295 | |
| 296 | - $value = FrmProEntryMetaHelper::get_post_value($atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts); |
|
| 296 | + $value = FrmProEntryMetaHelper::get_post_value( $atts['post_id'], $field->field_options['post_field'], $field->field_options['custom_field'], $atts ); |
|
| 297 | 297 | $atts['truncate'] = $atts['pre_truncate']; |
| 298 | 298 | } |
| 299 | 299 | |
@@ -301,39 +301,39 @@ discard block |
||
| 301 | 301 | return $value; |
| 302 | 302 | } |
| 303 | 303 | |
| 304 | - $value = apply_filters('frm_display_value_custom', maybe_unserialize($value), $field, $atts); |
|
| 304 | + $value = apply_filters( 'frm_display_value_custom', maybe_unserialize( $value ), $field, $atts ); |
|
| 305 | 305 | $value = apply_filters( 'frm_display_' . $field->type . '_value_custom', $value, compact( 'field', 'atts' ) ); |
| 306 | 306 | |
| 307 | 307 | $new_value = ''; |
| 308 | 308 | |
| 309 | - if ( is_array($value) && $atts['type'] != 'file' ) { |
|
| 309 | + if ( is_array( $value ) && $atts['type'] != 'file' ) { |
|
| 310 | 310 | foreach ( $value as $val ) { |
| 311 | - if ( is_array($val) ) { |
|
| 311 | + if ( is_array( $val ) ) { |
|
| 312 | 312 | //TODO: add options for display (li or ,) |
| 313 | - $new_value .= implode($atts['sep'], $val); |
|
| 313 | + $new_value .= implode( $atts['sep'], $val ); |
|
| 314 | 314 | if ( $atts['type'] != 'data' ) { |
| 315 | 315 | $new_value .= '<br/>'; |
| 316 | 316 | } |
| 317 | 317 | } |
| 318 | - unset($val); |
|
| 318 | + unset( $val ); |
|
| 319 | 319 | } |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - if ( ! empty($new_value) ) { |
|
| 322 | + if ( ! empty( $new_value ) ) { |
|
| 323 | 323 | $value = $new_value; |
| 324 | - } else if ( is_array($value) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
| 325 | - $value = implode($atts['sep'], $value); |
|
| 324 | + } else if ( is_array( $value ) && $atts['type'] != 'file' && ! $atts['return_array'] ) { |
|
| 325 | + $value = implode( $atts['sep'], $value ); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | if ( $atts['truncate'] && $atts['type'] != 'image' ) { |
| 329 | - $value = FrmAppHelper::truncate($value, 50); |
|
| 329 | + $value = FrmAppHelper::truncate( $value, 50 ); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | if ( ! $atts['keepjs'] && ! is_array( $value ) ) { |
| 333 | 333 | $value = wp_kses_post( $value ); |
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - return apply_filters('frm_display_value', $value, $field, $atts); |
|
| 336 | + return apply_filters( 'frm_display_value', $value, $field, $atts ); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | public static function set_posted_value( $field, $value, $args ) { |
@@ -341,20 +341,20 @@ discard block |
||
| 341 | 341 | if ( isset( $args['other'] ) && $args['other'] ) { |
| 342 | 342 | $value = $args['temp_value']; |
| 343 | 343 | } |
| 344 | - if ( empty($args['parent_field_id']) ) { |
|
| 345 | - $_POST['item_meta'][ $field->id ] = $value; |
|
| 344 | + if ( empty( $args['parent_field_id'] ) ) { |
|
| 345 | + $_POST['item_meta'][$field->id] = $value; |
|
| 346 | 346 | } else { |
| 347 | - $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field->id ] = $value; |
|
| 347 | + $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field->id] = $value; |
|
| 348 | 348 | } |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | public static function get_posted_value( $field, &$value, $args ) { |
| 352 | 352 | $field_id = is_object( $field ) ? $field->id : $field; |
| 353 | 353 | |
| 354 | - if ( empty($args['parent_field_id']) ) { |
|
| 355 | - $value = isset( $_POST['item_meta'][ $field_id ] ) ? $_POST['item_meta'][ $field_id ] : ''; |
|
| 354 | + if ( empty( $args['parent_field_id'] ) ) { |
|
| 355 | + $value = isset( $_POST['item_meta'][$field_id] ) ? $_POST['item_meta'][$field_id] : ''; |
|
| 356 | 356 | } else { |
| 357 | - $value = isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] ) ? $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ][ $field_id ] : ''; |
|
| 357 | + $value = isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] ) ? $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']][$field_id] : ''; |
|
| 358 | 358 | } |
| 359 | 359 | FrmAppHelper::sanitize_value( 'wp_kses_post', $value ); |
| 360 | 360 | $value = stripslashes_deep( $value ); |
@@ -379,12 +379,12 @@ discard block |
||
| 379 | 379 | self::set_other_repeating_vals( $field, $value, $args ); |
| 380 | 380 | |
| 381 | 381 | // Check if there are any posted "Other" values |
| 382 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][ $field->id ] ) ) { |
|
| 382 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta']['other'][$field->id] ) ) { |
|
| 383 | 383 | |
| 384 | 384 | // Save original value |
| 385 | 385 | $args['temp_value'] = $value; |
| 386 | 386 | $args['other'] = true; |
| 387 | - $other_vals = stripslashes_deep( $_POST['item_meta']['other'][ $field->id ] ); |
|
| 387 | + $other_vals = stripslashes_deep( $_POST['item_meta']['other'][$field->id] ); |
|
| 388 | 388 | |
| 389 | 389 | // Set the validation value now |
| 390 | 390 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -406,12 +406,12 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | // Check if there are any other posted "other" values for this field |
| 409 | - if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ] ) ) { |
|
| 409 | + if ( FrmField::is_option_true( $field, 'other' ) && isset( $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id] ) ) { |
|
| 410 | 410 | // Save original value |
| 411 | 411 | $args['temp_value'] = $value; |
| 412 | 412 | $args['other'] = true; |
| 413 | 413 | |
| 414 | - $other_vals = $_POST['item_meta'][ $args['parent_field_id'] ][ $args['key_pointer'] ]['other'][ $field->id ]; |
|
| 414 | + $other_vals = $_POST['item_meta'][$args['parent_field_id']][$args['key_pointer']]['other'][$field->id]; |
|
| 415 | 415 | |
| 416 | 416 | // Set the validation value now |
| 417 | 417 | self::set_other_validation_val( $value, $other_vals, $field, $args ); |
@@ -443,27 +443,27 @@ discard block |
||
| 443 | 443 | } |
| 444 | 444 | } else { |
| 445 | 445 | // Radio and dropdowns |
| 446 | - $other_key = array_filter( array_keys($field->options), 'is_string'); |
|
| 446 | + $other_key = array_filter( array_keys( $field->options ), 'is_string' ); |
|
| 447 | 447 | $other_key = reset( $other_key ); |
| 448 | 448 | |
| 449 | 449 | // Multi-select dropdown |
| 450 | 450 | if ( is_array( $value ) ) { |
| 451 | - $o_key = array_search( $field->options[ $other_key ], $value ); |
|
| 451 | + $o_key = array_search( $field->options[$other_key], $value ); |
|
| 452 | 452 | |
| 453 | 453 | if ( $o_key !== false ) { |
| 454 | 454 | // Modify the original value so other key will be preserved |
| 455 | - $value[ $other_key ] = $value[ $o_key ]; |
|
| 455 | + $value[$other_key] = $value[$o_key]; |
|
| 456 | 456 | |
| 457 | 457 | // By default, the array keys will be numeric for multi-select dropdowns |
| 458 | 458 | // If going backwards and forwards between pages, the array key will match the other key |
| 459 | 459 | if ( $o_key != $other_key ) { |
| 460 | - unset( $value[ $o_key ] ); |
|
| 460 | + unset( $value[$o_key] ); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | $args['temp_value'] = $value; |
| 464 | - $value[ $other_key ] = reset( $other_vals ); |
|
| 464 | + $value[$other_key] = reset( $other_vals ); |
|
| 465 | 465 | } |
| 466 | - } else if ( $field->options[ $other_key ] == $value ) { |
|
| 466 | + } else if ( $field->options[$other_key] == $value ) { |
|
| 467 | 467 | $value = $other_vals; |
| 468 | 468 | } |
| 469 | 469 | } |
@@ -482,7 +482,7 @@ discard block |
||
| 482 | 482 | $content .= "\n\n"; |
| 483 | 483 | } |
| 484 | 484 | |
| 485 | - if ( is_array($val) ) { |
|
| 485 | + if ( is_array( $val ) ) { |
|
| 486 | 486 | $val = FrmAppHelper::array_flatten( $val ); |
| 487 | 487 | $val = implode( ', ', $val ); |
| 488 | 488 | } |
@@ -546,7 +546,7 @@ discard block |
||
| 546 | 546 | preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers |
| 547 | 547 | |
| 548 | 548 | // see how many we have |
| 549 | - $i = count($matches['browser']); |
|
| 549 | + $i = count( $matches['browser'] ); |
|
| 550 | 550 | |
| 551 | 551 | if ( $i > 1 ) { |
| 552 | 552 | //we will have two since we are not using 'other' argument yet |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined('ABSPATH') ) { |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -9,7 +9,7 @@ discard block |
||
| 9 | 9 | static $transient_size = 200; |
| 10 | 10 | |
| 11 | 11 | public static function field_selection() { |
| 12 | - $fields = apply_filters('frm_available_fields', array( |
|
| 12 | + $fields = apply_filters( 'frm_available_fields', array( |
|
| 13 | 13 | 'text' => __( 'Single Line Text', 'formidable' ), |
| 14 | 14 | 'textarea' => __( 'Paragraph Text', 'formidable' ), |
| 15 | 15 | 'checkbox' => __( 'Checkboxes', 'formidable' ), |
@@ -18,13 +18,13 @@ discard block |
||
| 18 | 18 | 'email' => __( 'Email Address', 'formidable' ), |
| 19 | 19 | 'url' => __( 'Website/URL', 'formidable' ), |
| 20 | 20 | 'captcha' => __( 'reCAPTCHA', 'formidable' ), |
| 21 | - )); |
|
| 21 | + ) ); |
|
| 22 | 22 | |
| 23 | 23 | return $fields; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | public static function pro_field_selection() { |
| 27 | - return apply_filters('frm_pro_available_fields', array( |
|
| 27 | + return apply_filters( 'frm_pro_available_fields', array( |
|
| 28 | 28 | 'end_divider' => array( |
| 29 | 29 | 'name' => __( 'End Section', 'formidable' ), |
| 30 | 30 | 'switch_from' => 'divider', |
@@ -49,36 +49,36 @@ discard block |
||
| 49 | 49 | 'tag' => __( 'Tags', 'formidable' ), |
| 50 | 50 | 'credit_card' => __( 'Credit Card', 'formidable' ), |
| 51 | 51 | 'address' => __( 'Address', 'formidable' ), |
| 52 | - )); |
|
| 52 | + ) ); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | public static function create( $values, $return = true ) { |
| 56 | 56 | global $wpdb, $frm_duplicate_ids; |
| 57 | 57 | |
| 58 | 58 | $new_values = array(); |
| 59 | - $key = isset($values['field_key']) ? $values['field_key'] : $values['name']; |
|
| 59 | + $key = isset( $values['field_key'] ) ? $values['field_key'] : $values['name']; |
|
| 60 | 60 | $new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 61 | 61 | |
| 62 | 62 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 63 | - $new_values[ $col ] = $values[ $col ]; |
|
| 63 | + $new_values[$col] = $values[$col]; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | $new_values['options'] = $values['options']; |
| 67 | 67 | |
| 68 | - $new_values['field_order'] = isset($values['field_order']) ? (int) $values['field_order'] : null; |
|
| 69 | - $new_values['required'] = isset($values['required']) ? (int) $values['required'] : 0; |
|
| 70 | - $new_values['form_id'] = isset($values['form_id']) ? (int) $values['form_id'] : null; |
|
| 68 | + $new_values['field_order'] = isset( $values['field_order'] ) ? (int) $values['field_order'] : null; |
|
| 69 | + $new_values['required'] = isset( $values['required'] ) ? (int) $values['required'] : 0; |
|
| 70 | + $new_values['form_id'] = isset( $values['form_id'] ) ? (int) $values['form_id'] : null; |
|
| 71 | 71 | $new_values['field_options'] = $values['field_options']; |
| 72 | - $new_values['created_at'] = current_time('mysql', 1); |
|
| 72 | + $new_values['created_at'] = current_time( 'mysql', 1 ); |
|
| 73 | 73 | |
| 74 | 74 | if ( isset( $values['id'] ) ) { |
| 75 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 76 | - $new_values = apply_filters('frm_duplicated_field', $new_values); |
|
| 75 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 76 | + $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | foreach ( $new_values as $k => $v ) { |
| 80 | 80 | if ( is_array( $v ) ) { |
| 81 | - $new_values[ $k ] = serialize( $v ); |
|
| 81 | + $new_values[$k] = serialize( $v ); |
|
| 82 | 82 | } |
| 83 | 83 | unset( $k, $v ); |
| 84 | 84 | } |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | |
| 100 | 100 | if ( $query_results ) { |
| 101 | 101 | if ( isset( $values['id'] ) ) { |
| 102 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 102 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 103 | 103 | } |
| 104 | 104 | return $new_id; |
| 105 | 105 | } else { |
@@ -114,9 +114,9 @@ discard block |
||
| 114 | 114 | $fields = self::getAll( $where, 'field_order', '', $blog_id ); |
| 115 | 115 | |
| 116 | 116 | foreach ( (array) $fields as $field ) { |
| 117 | - $new_key = ($copy_keys) ? $field->field_key : ''; |
|
| 118 | - if ( $copy_keys && substr($field->field_key, -1) == 2 ) { |
|
| 119 | - $new_key = rtrim($new_key, 2); |
|
| 117 | + $new_key = ( $copy_keys ) ? $field->field_key : ''; |
|
| 118 | + if ( $copy_keys && substr( $field->field_key, -1 ) == 2 ) { |
|
| 119 | + $new_key = rtrim( $new_key, 2 ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | $values = array(); |
@@ -139,11 +139,11 @@ discard block |
||
| 139 | 139 | $values['form_id'] = $new_repeat_form_id; |
| 140 | 140 | } |
| 141 | 141 | |
| 142 | - $values = apply_filters('frm_duplicated_field', $values); |
|
| 143 | - $new_id = self::create($values); |
|
| 144 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 145 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 146 | - unset($field); |
|
| 142 | + $values = apply_filters( 'frm_duplicated_field', $values ); |
|
| 143 | + $new_id = self::create( $values ); |
|
| 144 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 145 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 146 | + unset( $field ); |
|
| 147 | 147 | } |
| 148 | 148 | } |
| 149 | 149 | |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | $values['field_key'] = FrmAppHelper::get_unique_key( $values['field_key'], $wpdb->prefix . 'frm_fields', 'field_key', $id ); |
| 157 | 157 | } |
| 158 | 158 | |
| 159 | - if ( isset($values['required']) ) { |
|
| 159 | + if ( isset( $values['required'] ) ) { |
|
| 160 | 160 | $values['required'] = (int) $values['required']; |
| 161 | 161 | } |
| 162 | 162 | |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | // serialize array values |
| 170 | 170 | foreach ( array( 'default_value', 'field_options', 'options' ) as $opt ) { |
| 171 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 172 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 171 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 172 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 173 | 173 | } |
| 174 | 174 | } |
| 175 | 175 | |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | if ( isset( $values['form_id'] ) ) { |
| 180 | 180 | $form_id = absint( $values['form_id'] ); |
| 181 | 181 | } else { |
| 182 | - $field = self::getOne($id); |
|
| 182 | + $field = self::getOne( $id ); |
|
| 183 | 183 | if ( $field ) { |
| 184 | 184 | $form_id = $field->form_id; |
| 185 | 185 | } |
| 186 | - unset($field); |
|
| 186 | + unset( $field ); |
|
| 187 | 187 | } |
| 188 | - unset($values); |
|
| 188 | + unset( $values ); |
|
| 189 | 189 | |
| 190 | 190 | if ( $query_results ) { |
| 191 | 191 | wp_cache_delete( $id, 'frm_field' ); |
@@ -238,7 +238,7 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | FrmAppHelper::cache_delete_group( 'frm_field' ); |
| 240 | 240 | |
| 241 | - $form = FrmForm::getOne($form_id); |
|
| 241 | + $form = FrmForm::getOne( $form_id ); |
|
| 242 | 242 | if ( $form && $form->parent_form_id && $form->parent_form_id != $form_id ) { |
| 243 | 243 | self::delete_form_transient( $form->parent_form_id ); |
| 244 | 244 | } |
@@ -260,16 +260,16 @@ discard block |
||
| 260 | 260 | |
| 261 | 261 | global $wpdb; |
| 262 | 262 | |
| 263 | - $where = is_numeric($id) ? 'id=%d' : 'field_key=%s'; |
|
| 263 | + $where = is_numeric( $id ) ? 'id=%d' : 'field_key=%s'; |
|
| 264 | 264 | $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'frm_fields WHERE ' . $where, $id ); |
| 265 | 265 | |
| 266 | 266 | $results = FrmAppHelper::check_cache( $id, 'frm_field', $query, 'get_row', 0 ); |
| 267 | 267 | |
| 268 | - if ( empty($results) ) { |
|
| 268 | + if ( empty( $results ) ) { |
|
| 269 | 269 | return $results; |
| 270 | 270 | } |
| 271 | 271 | |
| 272 | - if ( is_numeric($id) ) { |
|
| 272 | + if ( is_numeric( $id ) ) { |
|
| 273 | 273 | FrmAppHelper::set_cache( $results->field_key, $results, 'frm_field' ); |
| 274 | 274 | } else if ( $results ) { |
| 275 | 275 | FrmAppHelper::set_cache( $results->id, $results, 'frm_field' ); |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | |
| 278 | 278 | self::prepare_options( $results ); |
| 279 | 279 | |
| 280 | - return stripslashes_deep($results); |
|
| 280 | + return stripslashes_deep( $results ); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | /** |
@@ -310,20 +310,20 @@ discard block |
||
| 310 | 310 | continue; |
| 311 | 311 | } |
| 312 | 312 | |
| 313 | - $fields[ $result->id ] = $result; |
|
| 314 | - $count++; |
|
| 313 | + $fields[$result->id] = $result; |
|
| 314 | + $count ++; |
|
| 315 | 315 | if ( $limit == 1 ) { |
| 316 | 316 | $fields = $result; |
| 317 | 317 | break; |
| 318 | 318 | } |
| 319 | 319 | |
| 320 | - if ( ! empty($limit) && $count >= $limit ) { |
|
| 320 | + if ( ! empty( $limit ) && $count >= $limit ) { |
|
| 321 | 321 | break; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - unset($result); |
|
| 324 | + unset( $result ); |
|
| 325 | 325 | } |
| 326 | - return stripslashes_deep($fields); |
|
| 326 | + return stripslashes_deep( $fields ); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | 329 | self::$use_cache = false; |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | self::maybe_include_repeating_fields( $inc_sub, $where ); |
| 333 | 333 | $results = self::getAll( $where, 'field_order', $limit ); |
| 334 | 334 | self::$use_cache = true; |
| 335 | - self::include_sub_fields($results, $inc_sub, $type); |
|
| 335 | + self::include_sub_fields( $results, $inc_sub, $type ); |
|
| 336 | 336 | |
| 337 | 337 | return $results; |
| 338 | 338 | } |
@@ -344,15 +344,15 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | $results = self::get_fields_from_transients( $form_id, array( 'inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat ) ); |
| 346 | 346 | if ( ! empty( $results ) ) { |
| 347 | - if ( empty($limit) ) { |
|
| 347 | + if ( empty( $limit ) ) { |
|
| 348 | 348 | return $results; |
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | $fields = array(); |
| 352 | 352 | $count = 0; |
| 353 | 353 | foreach ( $results as $result ) { |
| 354 | - $fields[ $result->id ] = $result; |
|
| 355 | - if ( ! empty($limit) && $count >= $limit ) { |
|
| 354 | + $fields[$result->id] = $result; |
|
| 355 | + if ( ! empty( $limit ) && $count >= $limit ) { |
|
| 356 | 356 | break; |
| 357 | 357 | } |
| 358 | 358 | } |
@@ -370,7 +370,7 @@ discard block |
||
| 370 | 370 | |
| 371 | 371 | self::include_sub_fields( $results, $inc_embed, 'all' ); |
| 372 | 372 | |
| 373 | - if ( empty($limit) ) { |
|
| 373 | + if ( empty( $limit ) ) { |
|
| 374 | 374 | self::set_field_transient( $results, $form_id, 0, array( 'inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat ) ); |
| 375 | 375 | } |
| 376 | 376 | |
@@ -399,22 +399,22 @@ discard block |
||
| 399 | 399 | $form_fields = $results; |
| 400 | 400 | $index_offset = 1; |
| 401 | 401 | foreach ( $form_fields as $k => $field ) { |
| 402 | - if ( 'form' != $field->type || ! isset($field->field_options['form_select']) ) { |
|
| 402 | + if ( 'form' != $field->type || ! isset( $field->field_options['form_select'] ) ) { |
|
| 403 | 403 | continue; |
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | if ( $type == 'all' ) { |
| 407 | 407 | $sub_fields = self::get_all_for_form( $field->field_options['form_select'] ); |
| 408 | 408 | } else { |
| 409 | - $sub_fields = self::get_all_types_in_form($field->form_id, $type); |
|
| 409 | + $sub_fields = self::get_all_types_in_form( $field->form_id, $type ); |
|
| 410 | 410 | } |
| 411 | 411 | |
| 412 | - if ( ! empty($sub_fields) ) { |
|
| 412 | + if ( ! empty( $sub_fields ) ) { |
|
| 413 | 413 | $index = $k + $index_offset; |
| 414 | 414 | $index_offset += count( $sub_fields ); |
| 415 | - array_splice($results, $index, 0, $sub_fields); |
|
| 415 | + array_splice( $results, $index, 0, $sub_fields ); |
|
| 416 | 416 | } |
| 417 | - unset($field, $sub_fields); |
|
| 417 | + unset( $field, $sub_fields ); |
|
| 418 | 418 | } |
| 419 | 419 | } |
| 420 | 420 | |
@@ -422,9 +422,9 @@ discard block |
||
| 422 | 422 | $cache_key = maybe_serialize( $where ) . $order_by . 'l' . $limit . 'b' . $blog_id; |
| 423 | 423 | if ( self::$use_cache ) { |
| 424 | 424 | // make sure old cache doesn't get saved as a transient |
| 425 | - $results = wp_cache_get($cache_key, 'frm_field'); |
|
| 425 | + $results = wp_cache_get( $cache_key, 'frm_field' ); |
|
| 426 | 426 | if ( false !== $results ) { |
| 427 | - return stripslashes_deep($results); |
|
| 427 | + return stripslashes_deep( $results ); |
|
| 428 | 428 | } |
| 429 | 429 | } |
| 430 | 430 | |
@@ -449,16 +449,16 @@ discard block |
||
| 449 | 449 | $order_by = ' ORDER BY ' . $order_by; |
| 450 | 450 | } |
| 451 | 451 | |
| 452 | - $limit = FrmAppHelper::esc_limit($limit); |
|
| 452 | + $limit = FrmAppHelper::esc_limit( $limit ); |
|
| 453 | 453 | |
| 454 | 454 | $query = "SELECT fi.*, fr.name as form_name FROM {$table_name} fi LEFT OUTER JOIN {$form_table_name} fr ON fi.form_id=fr.id"; |
| 455 | 455 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
| 456 | 456 | |
| 457 | - if ( is_array($where) ) { |
|
| 457 | + if ( is_array( $where ) ) { |
|
| 458 | 458 | $results = FrmDb::get_var( $table_name . ' fi LEFT OUTER JOIN ' . $form_table_name . ' fr ON fi.form_id=fr.id', $where, 'fi.*, fr.name as form_name', array( 'order_by' => $order_by, 'limit' => $limit ), '', $query_type ); |
| 459 | 459 | } else { |
| 460 | 460 | // if the query is not an array, then it has already been prepared |
| 461 | - $query .= FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
| 461 | + $query .= FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
|
| 462 | 462 | |
| 463 | 463 | $function_name = ( $query_type == 'row' ) ? 'get_row' : 'get_results'; |
| 464 | 464 | $results = $wpdb->$function_name( $query ); |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | FrmAppHelper::set_cache( $result->id, $result, 'frm_field' ); |
| 482 | 482 | FrmAppHelper::set_cache( $result->field_key, $result, 'frm_field' ); |
| 483 | 483 | |
| 484 | - $results[ $r_key ]->field_options = maybe_unserialize( $result->field_options ); |
|
| 485 | - $results[ $r_key ]->options = maybe_unserialize( $result->options ); |
|
| 486 | - $results[ $r_key ]->default_value = maybe_unserialize( $result->default_value ); |
|
| 484 | + $results[$r_key]->field_options = maybe_unserialize( $result->field_options ); |
|
| 485 | + $results[$r_key]->options = maybe_unserialize( $result->options ); |
|
| 486 | + $results[$r_key]->default_value = maybe_unserialize( $result->default_value ); |
|
| 487 | 487 | |
| 488 | 488 | unset( $r_key, $result ); |
| 489 | 489 | } |
@@ -502,8 +502,8 @@ discard block |
||
| 502 | 502 | private static function prepare_options( &$results ) { |
| 503 | 503 | $results->field_options = maybe_unserialize( $results->field_options ); |
| 504 | 504 | |
| 505 | - $results->options = maybe_unserialize($results->options); |
|
| 506 | - $results->default_value = maybe_unserialize($results->default_value); |
|
| 505 | + $results->options = maybe_unserialize( $results->options ); |
|
| 506 | + $results->default_value = maybe_unserialize( $results->default_value ); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
@@ -530,7 +530,7 @@ discard block |
||
| 530 | 530 | |
| 531 | 531 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 532 | 532 | // if this transient is full, check for another |
| 533 | - $next++; |
|
| 533 | + $next ++; |
|
| 534 | 534 | self::get_next_transient( $fields, $base_name, $next ); |
| 535 | 535 | } |
| 536 | 536 | } |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | return; |
| 557 | 557 | } |
| 558 | 558 | |
| 559 | - $next++; |
|
| 559 | + $next ++; |
|
| 560 | 560 | } |
| 561 | 561 | } |
| 562 | 562 | |
@@ -610,7 +610,7 @@ discard block |
||
| 610 | 610 | $field_type = is_array( $field ) ? $field['type'] : $field->type; |
| 611 | 611 | $data_type = self::get_option( $field, 'data_type' ); |
| 612 | 612 | |
| 613 | - return self::is_option_true( $field, 'multiple' ) && ( ( $field_type == 'select' || ( $field_type == 'data' && $data_type == 'select') ) ); |
|
| 613 | + return self::is_option_true( $field, 'multiple' ) && ( ( $field_type == 'select' || ( $field_type == 'data' && $data_type == 'select' ) ) ); |
|
| 614 | 614 | } |
| 615 | 615 | |
| 616 | 616 | /** |
@@ -656,23 +656,23 @@ discard block |
||
| 656 | 656 | } |
| 657 | 657 | |
| 658 | 658 | public static function is_option_true_in_array( $field, $option ) { |
| 659 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
| 659 | + return isset( $field[$option] ) && $field[$option]; |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | public static function is_option_true_in_object( $field, $option ) { |
| 663 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 663 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 664 | 664 | } |
| 665 | 665 | |
| 666 | 666 | public static function is_option_empty_in_array( $field, $option ) { |
| 667 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
| 667 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
| 668 | 668 | } |
| 669 | 669 | |
| 670 | 670 | public static function is_option_empty_in_object( $field, $option ) { |
| 671 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
| 671 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
| 672 | 672 | } |
| 673 | 673 | |
| 674 | 674 | public static function is_option_value_in_object( $field, $option ) { |
| 675 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 675 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | /** |
@@ -688,11 +688,11 @@ discard block |
||
| 688 | 688 | } |
| 689 | 689 | |
| 690 | 690 | public static function get_option_in_array( $field, $option ) { |
| 691 | - return $field[ $option ]; |
|
| 691 | + return $field[$option]; |
|
| 692 | 692 | } |
| 693 | 693 | |
| 694 | 694 | public static function get_option_in_object( $field, $option ) { |
| 695 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 695 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 696 | 696 | } |
| 697 | 697 | |
| 698 | 698 | /** |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | ) ); |
| 84 | 84 | |
| 85 | 85 | foreach ( $this->style_settings as $key => $setting ) { |
| 86 | - if ( isset( $atts[ $key ] ) && $atts[ $key ] !== '' ) { |
|
| 87 | - $this->style_settings[ $key ] = $atts[ $key ]; |
|
| 86 | + if ( isset( $atts[$key] ) && $atts[$key] !== '' ) { |
|
| 87 | + $this->style_settings[$key] = $atts[$key]; |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | if ( $this->is_color_setting( $key ) ) { |
| 91 | - $this->style_settings[ $key ] = $this->get_color_markup( $this->style_settings[ $key ] ); |
|
| 91 | + $this->style_settings[$key] = $this->get_color_markup( $this->style_settings[$key] ); |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * |
| 159 | 159 | * @return boolean |
| 160 | 160 | */ |
| 161 | - private function is_color_setting ( $setting_key ) { |
|
| 161 | + private function is_color_setting( $setting_key ) { |
|
| 162 | 162 | return strpos( $setting_key, 'color' ) !== false; |
| 163 | 163 | } |
| 164 | 164 | |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | $join_form_in_query = true; |
| 24 | 24 | } |
| 25 | 25 | |
| 26 | - $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
|
| 26 | + $s = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; |
|
| 27 | 27 | |
| 28 | 28 | if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
| 29 | 29 | $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | $s_query = apply_filters( 'frm_entries_list_query', $s_query, compact( 'form_id' ) ); |
| 34 | 34 | |
| 35 | 35 | $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
| 36 | - if ( strpos($orderby, 'meta') !== false ) { |
|
| 36 | + if ( strpos( $orderby, 'meta' ) !== false ) { |
|
| 37 | 37 | $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
| 38 | 38 | $orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : ''; |
| 39 | 39 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page ); |
| 46 | 46 | |
| 47 | 47 | $this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, $join_form_in_query ); |
| 48 | - $total_items = FrmEntry::getRecordCount($s_query); |
|
| 48 | + $total_items = FrmEntry::getRecordCount( $s_query ); |
|
| 49 | 49 | |
| 50 | 50 | $this->set_pagination_args( array( |
| 51 | 51 | 'total_items' => $total_items, |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | |
| 56 | 56 | public function no_items() { |
| 57 | 57 | $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
| 58 | - if ( ! empty($s) ) { |
|
| 58 | + if ( ! empty( $s ) ) { |
|
| 59 | 59 | _e( 'No Entries Found', 'formidable' ); |
| 60 | 60 | return; |
| 61 | 61 | } |
@@ -64,7 +64,7 @@ discard block |
||
| 64 | 64 | $form = $this->params['form']; |
| 65 | 65 | |
| 66 | 66 | if ( $form_id ) { |
| 67 | - $form = FrmForm::getOne($form_id); |
|
| 67 | + $form = FrmForm::getOne( $form_id ); |
|
| 68 | 68 | } |
| 69 | 69 | $colspan = $this->get_column_count(); |
| 70 | 70 | |
@@ -122,7 +122,7 @@ discard block |
||
| 122 | 122 | |
| 123 | 123 | $r = "<tr id='item-action-{$item->id}'$style>"; |
| 124 | 124 | |
| 125 | - list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
|
| 125 | + list( $columns, $hidden,, $primary ) = $this->get_column_info(); |
|
| 126 | 126 | $action_col = false; |
| 127 | 127 | |
| 128 | 128 | foreach ( $columns as $column_name => $column_display_name ) { |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | $attributes = 'class="' . esc_attr( $class ) . '"'; |
| 142 | - unset($class); |
|
| 142 | + unset( $class ); |
|
| 143 | 143 | $attributes .= ' data-colname="' . $column_display_name . '"'; |
| 144 | 144 | |
| 145 | 145 | $form_id = $this->params['form'] ? $this->params['form'] : 0; |
@@ -158,24 +158,24 @@ discard block |
||
| 158 | 158 | break; |
| 159 | 159 | case 'name': |
| 160 | 160 | case 'description': |
| 161 | - $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
| 161 | + $val = FrmAppHelper::truncate( strip_tags( $item->{$col_name}), 100 ); |
|
| 162 | 162 | break; |
| 163 | 163 | case 'created_at': |
| 164 | 164 | case 'updated_at': |
| 165 | - $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
| 165 | + $date = FrmAppHelper::get_formatted_time( $item->{$col_name}); |
|
| 166 | 166 | $val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>'; |
| 167 | 167 | break; |
| 168 | 168 | case 'is_draft': |
| 169 | - $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
| 169 | + $val = empty( $item->is_draft ) ? __( 'No' ) : __( 'Yes' ); |
|
| 170 | 170 | break; |
| 171 | 171 | case 'form_id': |
| 172 | - $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
| 172 | + $val = FrmFormsHelper::edit_form_link( $item->form_id ); |
|
| 173 | 173 | break; |
| 174 | 174 | case 'post_id': |
| 175 | - $val = FrmAppHelper::post_edit_link($item->post_id); |
|
| 175 | + $val = FrmAppHelper::post_edit_link( $item->post_id ); |
|
| 176 | 176 | break; |
| 177 | 177 | case 'user_id': |
| 178 | - $user = get_userdata($item->user_id); |
|
| 178 | + $user = get_userdata( $item->user_id ); |
|
| 179 | 179 | $val = $user ? $user->user_login : ''; |
| 180 | 180 | break; |
| 181 | 181 | case 'parent_item_id': |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | $r .= '</td>'; |
| 202 | 202 | } |
| 203 | - unset($val); |
|
| 203 | + unset( $val ); |
|
| 204 | 204 | } |
| 205 | 205 | $r .= '</tr>'; |
| 206 | 206 | |
@@ -213,12 +213,12 @@ discard block |
||
| 213 | 213 | private function get_actions( &$actions, $item, $view_link ) { |
| 214 | 214 | $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; |
| 215 | 215 | |
| 216 | - if ( current_user_can('frm_delete_entries') ) { |
|
| 216 | + if ( current_user_can( 'frm_delete_entries' ) ) { |
|
| 217 | 217 | $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
| 218 | 218 | $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>'; |
| 219 | 219 | } |
| 220 | 220 | |
| 221 | - $actions = apply_filters('frm_row_actions', $actions, $item); |
|
| 221 | + $actions = apply_filters( 'frm_row_actions', $actions, $item ); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | private function get_column_value( $item, &$val ) { |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined('ABSPATH') ) { |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public static function setup_new_vars( $type = '', $form_id = '' ) { |
| 9 | 9 | |
| 10 | - if ( strpos($type, '|') ) { |
|
| 11 | - list($type, $setting) = explode('|', $type); |
|
| 10 | + if ( strpos( $type, '|' ) ) { |
|
| 11 | + list( $type, $setting ) = explode( '|', $type ); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - $defaults = self::get_default_field_opts($type, $form_id); |
|
| 15 | - $defaults['field_options']['custom_html'] = self::get_default_html($type); |
|
| 14 | + $defaults = self::get_default_field_opts( $type, $form_id ); |
|
| 15 | + $defaults['field_options']['custom_html'] = self::get_default_html( $type ); |
|
| 16 | 16 | |
| 17 | 17 | $values = array(); |
| 18 | 18 | |
@@ -20,20 +20,20 @@ discard block |
||
| 20 | 20 | if ( $var == 'field_options' ) { |
| 21 | 21 | $values['field_options'] = array(); |
| 22 | 22 | foreach ( $default as $opt_var => $opt_default ) { |
| 23 | - $values['field_options'][ $opt_var ] = $opt_default; |
|
| 24 | - unset($opt_var, $opt_default); |
|
| 23 | + $values['field_options'][$opt_var] = $opt_default; |
|
| 24 | + unset( $opt_var, $opt_default ); |
|
| 25 | 25 | } |
| 26 | 26 | } else { |
| 27 | - $values[ $var ] = $default; |
|
| 27 | + $values[$var] = $default; |
|
| 28 | 28 | } |
| 29 | - unset($var, $default); |
|
| 29 | + unset( $var, $default ); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if ( isset( $setting ) && ! empty( $setting ) ) { |
| 33 | 33 | if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
| 34 | 34 | $values['field_options']['data_type'] = $setting; |
| 35 | 35 | } else { |
| 36 | - $values['field_options'][ $setting ] = 1; |
|
| 36 | + $values['field_options'][$setting] = 1; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $fields = FrmField::field_selection(); |
| 60 | - $fields = array_merge($fields, FrmField::pro_field_selection()); |
|
| 60 | + $fields = array_merge( $fields, FrmField::pro_field_selection() ); |
|
| 61 | 61 | |
| 62 | - if ( isset( $fields[ $type ] ) ) { |
|
| 63 | - $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ]; |
|
| 62 | + if ( isset( $fields[$type] ) ) { |
|
| 63 | + $values['name'] = is_array( $fields[$type] ) ? $fields[$type]['name'] : $fields[$type]; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - unset($fields); |
|
| 66 | + unset( $fields ); |
|
| 67 | 67 | |
| 68 | 68 | return $values; |
| 69 | 69 | } |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | $values['form_name'] = ''; |
| 90 | 90 | } else { |
| 91 | 91 | foreach ( $defaults as $var => $default ) { |
| 92 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 93 | - unset($var, $default); |
|
| 92 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 93 | + unset( $var, $default ); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : ''; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $values['options'] = $record->options; |
| 102 | 102 | $values['field_options'] = $record->field_options; |
| 103 | 103 | |
| 104 | - $defaults = self::get_default_field_opts($values['type'], $record, true); |
|
| 104 | + $defaults = self::get_default_field_opts( $values['type'], $record, true ); |
|
| 105 | 105 | |
| 106 | 106 | if ( $values['type'] == 'captcha' ) { |
| 107 | 107 | $frm_settings = FrmAppHelper::get_settings(); |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | foreach ( $defaults as $opt => $default ) { |
| 112 | - $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default; |
|
| 113 | - unset($opt, $default); |
|
| 112 | + $values[$opt] = isset( $record->field_options[$opt] ) ? $record->field_options[$opt] : $default; |
|
| 113 | + unset( $opt, $default ); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type); |
|
| 116 | + $values['custom_html'] = ( isset( $record->field_options['custom_html'] ) ) ? $record->field_options['custom_html'] : self::get_default_html( $record->type ); |
|
| 117 | 117 | |
| 118 | 118 | return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) ); |
| 119 | 119 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | global $wpdb; |
| 134 | 134 | |
| 135 | - $form_id = (is_numeric($field)) ? $field : $field->form_id; |
|
| 135 | + $form_id = ( is_numeric( $field ) ) ? $field : $field->form_id; |
|
| 136 | 136 | |
| 137 | 137 | $key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key; |
| 138 | 138 | |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 156 | 156 | $values['form_id'] = $form_id; |
| 157 | - $values['options'] = maybe_serialize($field->options); |
|
| 158 | - $values['default_value'] = maybe_serialize($field->default_value); |
|
| 157 | + $values['options'] = maybe_serialize( $field->options ); |
|
| 158 | + $values['default_value'] = maybe_serialize( $field->default_value ); |
|
| 159 | 159 | |
| 160 | 160 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 161 | - $values[ $col ] = $field->{$col}; |
|
| 161 | + $values[$col] = $field->{$col}; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
@@ -172,14 +172,14 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $conf_msg = __( 'The entered values do not match', 'formidable' ); |
| 174 | 174 | $defaults = array( |
| 175 | - 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ), |
|
| 176 | - 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ), |
|
| 175 | + 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ), |
|
| 176 | + 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ), |
|
| 177 | 177 | 'blank' => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ), |
| 178 | 178 | 'conf_msg' => array( 'full' => $conf_msg, 'part' => $conf_msg ), |
| 179 | 179 | ); |
| 180 | 180 | |
| 181 | 181 | $msg = FrmField::get_option( $field, $error ); |
| 182 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 182 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 183 | 183 | $msg = do_shortcode( $msg ); |
| 184 | 184 | return $msg; |
| 185 | 185 | } |
@@ -209,14 +209,14 @@ discard block |
||
| 209 | 209 | </div> |
| 210 | 210 | DEFAULT_HTML; |
| 211 | 211 | } else { |
| 212 | - $default_html = apply_filters('frm_other_custom_html', '', $type); |
|
| 212 | + $default_html = apply_filters( 'frm_other_custom_html', '', $type ); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - return apply_filters('frm_custom_html', $default_html, $type); |
|
| 215 | + return apply_filters( 'frm_custom_html', $default_html, $type ); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) { |
| 219 | - $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form); |
|
| 219 | + $html = apply_filters( 'frm_before_replace_shortcodes', $html, $field, $errors, $form ); |
|
| 220 | 220 | |
| 221 | 221 | $defaults = array( |
| 222 | 222 | 'field_name' => 'item_meta[' . $field['id'] . ']', |
@@ -224,42 +224,42 @@ discard block |
||
| 224 | 224 | 'field_plus_id' => '', |
| 225 | 225 | 'section_id' => '', |
| 226 | 226 | ); |
| 227 | - $args = wp_parse_args($args, $defaults); |
|
| 227 | + $args = wp_parse_args( $args, $defaults ); |
|
| 228 | 228 | $field_name = $args['field_name']; |
| 229 | 229 | $field_id = $args['field_id']; |
| 230 | - $html_id = self::get_html_id($field, $args['field_plus_id']); |
|
| 230 | + $html_id = self::get_html_id( $field, $args['field_plus_id'] ); |
|
| 231 | 231 | |
| 232 | - if ( FrmField::is_multiple_select($field) ) { |
|
| 232 | + if ( FrmField::is_multiple_select( $field ) ) { |
|
| 233 | 233 | $field_name .= '[]'; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | //replace [id] |
| 237 | - $html = str_replace('[id]', $field_id, $html); |
|
| 237 | + $html = str_replace( '[id]', $field_id, $html ); |
|
| 238 | 238 | |
| 239 | 239 | // Remove the for attribute for captcha |
| 240 | 240 | if ( $field['type'] == 'captcha' ) { |
| 241 | - $html = str_replace(' for="field_[key]"', '', $html); |
|
| 241 | + $html = str_replace( ' for="field_[key]"', '', $html ); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // set the label for |
| 245 | - $html = str_replace('field_[key]', $html_id, $html); |
|
| 245 | + $html = str_replace( 'field_[key]', $html_id, $html ); |
|
| 246 | 246 | |
| 247 | 247 | //replace [key] |
| 248 | - $html = str_replace('[key]', $field['field_key'], $html); |
|
| 248 | + $html = str_replace( '[key]', $field['field_key'], $html ); |
|
| 249 | 249 | |
| 250 | 250 | //replace [description] and [required_label] and [error] |
| 251 | 251 | $required = FrmField::is_required( $field ) ? $field['required_indicator'] : ''; |
| 252 | 252 | if ( ! is_array( $errors ) ) { |
| 253 | 253 | $errors = array(); |
| 254 | 254 | } |
| 255 | - $error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false; |
|
| 255 | + $error = isset( $errors['field' . $field_id] ) ? $errors['field' . $field_id] : false; |
|
| 256 | 256 | |
| 257 | 257 | //If field type is section heading, add class so a bottom margin can be added to either the h3 or description |
| 258 | 258 | if ( $field['type'] == 'divider' ) { |
| 259 | 259 | if ( FrmField::is_option_true( $field, 'description' ) ) { |
| 260 | 260 | $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html ); |
| 261 | 261 | } else { |
| 262 | - $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html); |
|
| 262 | + $html = str_replace( '[label_position]', '[label_position] frm_section_spacing', $html ); |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | |
@@ -269,52 +269,52 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | //replace [required_class] |
| 271 | 271 | $required_class = FrmField::is_required( $field ) ? ' frm_required_field' : ''; |
| 272 | - $html = str_replace('[required_class]', $required_class, $html); |
|
| 272 | + $html = str_replace( '[required_class]', $required_class, $html ); |
|
| 273 | 273 | |
| 274 | 274 | //replace [label_position] |
| 275 | 275 | $field['label'] = self::label_position( $field['label'], $field, $form ); |
| 276 | 276 | self::add_class_to_label( $field, $html ); |
| 277 | 277 | |
| 278 | 278 | //replace [field_name] |
| 279 | - $html = str_replace('[field_name]', $field['name'], $html); |
|
| 279 | + $html = str_replace( '[field_name]', $field['name'], $html ); |
|
| 280 | 280 | |
| 281 | 281 | self::add_field_div_classes( $field_id, $field, $errors, $html ); |
| 282 | 282 | |
| 283 | 283 | //replace [entry_key] |
| 284 | 284 | $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); |
| 285 | - $html = str_replace('[entry_key]', $entry_key, $html); |
|
| 285 | + $html = str_replace( '[entry_key]', $entry_key, $html ); |
|
| 286 | 286 | |
| 287 | 287 | if ( $form ) { |
| 288 | 288 | $form = (array) $form; |
| 289 | 289 | |
| 290 | 290 | //replace [form_key] |
| 291 | - $html = str_replace('[form_key]', $form['form_key'], $html); |
|
| 291 | + $html = str_replace( '[form_key]', $form['form_key'], $html ); |
|
| 292 | 292 | |
| 293 | 293 | //replace [form_name] |
| 294 | - $html = str_replace('[form_name]', $form['name'], $html); |
|
| 294 | + $html = str_replace( '[form_name]', $form['name'], $html ); |
|
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | self::process_wp_shortcodes( $html ); |
| 298 | 298 | |
| 299 | 299 | //replace [input] |
| 300 | - preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
| 300 | + preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER ); |
|
| 301 | 301 | global $frm_vars; |
| 302 | 302 | $frm_settings = FrmAppHelper::get_settings(); |
| 303 | 303 | |
| 304 | 304 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 305 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 305 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 306 | 306 | $tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) ); |
| 307 | 307 | |
| 308 | 308 | $replace_with = ''; |
| 309 | 309 | |
| 310 | 310 | if ( $tag == 'input' ) { |
| 311 | - if ( isset($atts['opt']) ) { |
|
| 312 | - $atts['opt']--; |
|
| 311 | + if ( isset( $atts['opt'] ) ) { |
|
| 312 | + $atts['opt'] --; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | - $field['input_class'] = isset($atts['class']) ? $atts['class'] : ''; |
|
| 316 | - if ( isset($atts['class']) ) { |
|
| 317 | - unset($atts['class']); |
|
| 315 | + $field['input_class'] = isset( $atts['class'] ) ? $atts['class'] : ''; |
|
| 316 | + if ( isset( $atts['class'] ) ) { |
|
| 317 | + unset( $atts['class'] ); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | $field['shortcodes'] = $atts; |
@@ -323,24 +323,24 @@ discard block |
||
| 323 | 323 | $replace_with = ob_get_contents(); |
| 324 | 324 | ob_end_clean(); |
| 325 | 325 | } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) { |
| 326 | - $replace_with = FrmProEntriesController::entry_delete_link($atts); |
|
| 326 | + $replace_with = FrmProEntriesController::entry_delete_link( $atts ); |
|
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html ); |
|
| 329 | + $html = str_replace( $shortcodes[0][$short_key], $replace_with, $html ); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | $html .= "\n"; |
| 333 | 333 | |
| 334 | 334 | //Return html if conf_field to prevent loop |
| 335 | - if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) { |
|
| 335 | + if ( isset( $field['conf_field'] ) && $field['conf_field'] == 'stop' ) { |
|
| 336 | 336 | return $html; |
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | //If field is in repeating section |
| 340 | 340 | if ( $args['section_id'] ) { |
| 341 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] )); |
|
| 341 | + $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ) ); |
|
| 342 | 342 | } else { |
| 343 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form )); |
|
| 343 | + $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ) ); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | self::remove_collapse_shortcode( $html ); |
@@ -438,14 +438,14 @@ discard block |
||
| 438 | 438 | */ |
| 439 | 439 | private static function get_field_div_classes( $field_id, $field, $errors, $html ) { |
| 440 | 440 | // Add error class |
| 441 | - $classes = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : ''; |
|
| 441 | + $classes = isset( $errors['field' . $field_id] ) ? ' frm_blank_field' : ''; |
|
| 442 | 442 | |
| 443 | 443 | // Add label position class |
| 444 | 444 | $classes .= ' frm_' . $field['label'] . '_container'; |
| 445 | 445 | |
| 446 | 446 | // Add CSS layout classes |
| 447 | 447 | if ( ! empty( $field['classes'] ) ) { |
| 448 | - if ( ! strpos( $html, 'frm_form_field ') ) { |
|
| 448 | + if ( ! strpos( $html, 'frm_form_field ' ) ) { |
|
| 449 | 449 | $classes .= ' frm_form_field'; |
| 450 | 450 | } |
| 451 | 451 | $classes .= ' ' . $field['classes']; |
@@ -484,15 +484,15 @@ discard block |
||
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | $with_tags = $args['conditional_check'] ? 3 : 2; |
| 487 | - if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
|
| 488 | - $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
|
| 489 | - $tag = str_replace(']', '', $tag); |
|
| 490 | - $tags = explode(' ', $tag); |
|
| 491 | - if ( is_array($tags) ) { |
|
| 487 | + if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) { |
|
| 488 | + $tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] ); |
|
| 489 | + $tag = str_replace( ']', '', $tag ); |
|
| 490 | + $tags = explode( ' ', $tag ); |
|
| 491 | + if ( is_array( $tags ) ) { |
|
| 492 | 492 | $tag = $tags[0]; |
| 493 | 493 | } |
| 494 | 494 | } else { |
| 495 | - $tag = $shortcodes[ $with_tags - 1 ][ $short_key ]; |
|
| 495 | + $tag = $shortcodes[$with_tags - 1][$short_key]; |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | return $tag; |
@@ -552,10 +552,10 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | public static function show_single_option( $field ) { |
| 554 | 554 | $field_name = $field['name']; |
| 555 | - $html_id = self::get_html_id($field); |
|
| 555 | + $html_id = self::get_html_id( $field ); |
|
| 556 | 556 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 557 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 558 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 557 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
| 558 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); |
|
| 559 | 559 | |
| 560 | 560 | // If this is an "Other" option, get the HTML for it |
| 561 | 561 | if ( self::is_other_opt( $opt_key ) ) { |
@@ -569,7 +569,7 @@ discard block |
||
| 569 | 569 | } |
| 570 | 570 | |
| 571 | 571 | public static function get_term_link( $tax_id ) { |
| 572 | - $tax = get_taxonomy($tax_id); |
|
| 572 | + $tax = get_taxonomy( $tax_id ); |
|
| 573 | 573 | if ( ! $tax ) { |
| 574 | 574 | return; |
| 575 | 575 | } |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
| 579 | 579 | '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>' |
| 580 | 580 | ); |
| 581 | - unset($tax); |
|
| 581 | + unset( $tax ); |
|
| 582 | 582 | |
| 583 | 583 | return $link; |
| 584 | 584 | } |
@@ -587,8 +587,8 @@ discard block |
||
| 587 | 587 | $hide_opt = self::get_value_for_comparision( $hide_opt ); |
| 588 | 588 | $observed_value = self::get_value_for_comparision( $observed_value ); |
| 589 | 589 | |
| 590 | - if ( is_array($observed_value) ) { |
|
| 591 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
| 590 | + if ( is_array( $observed_value ) ) { |
|
| 591 | + return self::array_value_condition( $observed_value, $cond, $hide_opt ); |
|
| 592 | 592 | } |
| 593 | 593 | |
| 594 | 594 | $m = false; |
@@ -601,7 +601,7 @@ discard block |
||
| 601 | 601 | } else if ( $cond == '<' ) { |
| 602 | 602 | $m = $observed_value < $hide_opt; |
| 603 | 603 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
| 604 | - $m = stripos($observed_value, $hide_opt); |
|
| 604 | + $m = stripos( $observed_value, $hide_opt ); |
|
| 605 | 605 | if ( $cond == 'not LIKE' ) { |
| 606 | 606 | $m = ( $m === false ) ? true : false; |
| 607 | 607 | } else { |
@@ -627,23 +627,23 @@ discard block |
||
| 627 | 627 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
| 628 | 628 | $m = false; |
| 629 | 629 | if ( $cond == '==' ) { |
| 630 | - if ( is_array($hide_opt) ) { |
|
| 631 | - $m = array_intersect($hide_opt, $observed_value); |
|
| 632 | - $m = empty($m) ? false : true; |
|
| 630 | + if ( is_array( $hide_opt ) ) { |
|
| 631 | + $m = array_intersect( $hide_opt, $observed_value ); |
|
| 632 | + $m = empty( $m ) ? false : true; |
|
| 633 | 633 | } else { |
| 634 | - $m = in_array($hide_opt, $observed_value); |
|
| 634 | + $m = in_array( $hide_opt, $observed_value ); |
|
| 635 | 635 | } |
| 636 | 636 | } else if ( $cond == '!=' ) { |
| 637 | - $m = ! in_array($hide_opt, $observed_value); |
|
| 637 | + $m = ! in_array( $hide_opt, $observed_value ); |
|
| 638 | 638 | } else if ( $cond == '>' ) { |
| 639 | - $min = min($observed_value); |
|
| 639 | + $min = min( $observed_value ); |
|
| 640 | 640 | $m = $min > $hide_opt; |
| 641 | 641 | } else if ( $cond == '<' ) { |
| 642 | - $max = max($observed_value); |
|
| 642 | + $max = max( $observed_value ); |
|
| 643 | 643 | $m = $max < $hide_opt; |
| 644 | 644 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
| 645 | 645 | foreach ( $observed_value as $ob ) { |
| 646 | - $m = strpos($ob, $hide_opt); |
|
| 646 | + $m = strpos( $ob, $hide_opt ); |
|
| 647 | 647 | if ( $m !== false ) { |
| 648 | 648 | $m = true; |
| 649 | 649 | break; |
@@ -664,27 +664,27 @@ discard block |
||
| 664 | 664 | * @return string |
| 665 | 665 | */ |
| 666 | 666 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
| 667 | - if ( strpos($value, '[sitename]') !== false ) { |
|
| 667 | + if ( strpos( $value, '[sitename]' ) !== false ) { |
|
| 668 | 668 | $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
| 669 | - $value = str_replace('[sitename]', $new_value, $value); |
|
| 669 | + $value = str_replace( '[sitename]', $new_value, $value ); |
|
| 670 | 670 | } |
| 671 | 671 | |
| 672 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
| 673 | - $value = do_shortcode($value); |
|
| 672 | + $value = apply_filters( 'frm_content', $value, $form, $entry ); |
|
| 673 | + $value = do_shortcode( $value ); |
|
| 674 | 674 | |
| 675 | 675 | return $value; |
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | public static function get_shortcodes( $content, $form_id ) { |
| 679 | 679 | if ( FrmAppHelper::pro_is_installed() ) { |
| 680 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
| 680 | + return FrmProDisplaysHelper::get_shortcodes( $content, $form_id ); |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
| 684 | 684 | |
| 685 | - $tagregexp = self::allowed_shortcodes($fields); |
|
| 685 | + $tagregexp = self::allowed_shortcodes( $fields ); |
|
| 686 | 686 | |
| 687 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
| 687 | + preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER ); |
|
| 688 | 688 | |
| 689 | 689 | return $matches; |
| 690 | 690 | } |
@@ -702,7 +702,7 @@ discard block |
||
| 702 | 702 | $tagregexp[] = $field->field_key; |
| 703 | 703 | } |
| 704 | 704 | |
| 705 | - $tagregexp = implode('|', $tagregexp); |
|
| 705 | + $tagregexp = implode( '|', $tagregexp ); |
|
| 706 | 706 | return $tagregexp; |
| 707 | 707 | } |
| 708 | 708 | |
@@ -718,28 +718,28 @@ discard block |
||
| 718 | 718 | continue; |
| 719 | 719 | } |
| 720 | 720 | |
| 721 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 721 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 722 | 722 | |
| 723 | - if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
| 724 | - $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] ); |
|
| 725 | - $tags = explode(' ', $tag); |
|
| 726 | - if ( is_array($tags) ) { |
|
| 723 | + if ( ! empty( $shortcodes[3][$short_key] ) ) { |
|
| 724 | + $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] ); |
|
| 725 | + $tags = explode( ' ', $tag ); |
|
| 726 | + if ( is_array( $tags ) ) { |
|
| 727 | 727 | $tag = $tags[0]; |
| 728 | 728 | } |
| 729 | 729 | } else { |
| 730 | - $tag = $shortcodes[2][ $short_key ]; |
|
| 730 | + $tag = $shortcodes[2][$short_key]; |
|
| 731 | 731 | } |
| 732 | 732 | |
| 733 | 733 | switch ( $tag ) { |
| 734 | 734 | case 'id': |
| 735 | 735 | case 'key': |
| 736 | 736 | case 'ip': |
| 737 | - $replace_with = $shortcode_values[ $tag ]; |
|
| 737 | + $replace_with = $shortcode_values[$tag]; |
|
| 738 | 738 | break; |
| 739 | 739 | |
| 740 | 740 | case 'user_agent': |
| 741 | 741 | case 'user-agent': |
| 742 | - $entry->description = maybe_unserialize($entry->description); |
|
| 742 | + $entry->description = maybe_unserialize( $entry->description ); |
|
| 743 | 743 | $replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] ); |
| 744 | 744 | break; |
| 745 | 745 | |
@@ -747,25 +747,25 @@ discard block |
||
| 747 | 747 | case 'created-at': |
| 748 | 748 | case 'updated_at': |
| 749 | 749 | case 'updated-at': |
| 750 | - if ( isset($atts['format']) ) { |
|
| 750 | + if ( isset( $atts['format'] ) ) { |
|
| 751 | 751 | $time_format = ' '; |
| 752 | 752 | } else { |
| 753 | - $atts['format'] = get_option('date_format'); |
|
| 753 | + $atts['format'] = get_option( 'date_format' ); |
|
| 754 | 754 | $time_format = ''; |
| 755 | 755 | } |
| 756 | 756 | |
| 757 | - $this_tag = str_replace('-', '_', $tag); |
|
| 758 | - $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
| 759 | - unset($this_tag); |
|
| 757 | + $this_tag = str_replace( '-', '_', $tag ); |
|
| 758 | + $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format ); |
|
| 759 | + unset( $this_tag ); |
|
| 760 | 760 | break; |
| 761 | 761 | |
| 762 | 762 | case 'created_by': |
| 763 | 763 | case 'created-by': |
| 764 | 764 | case 'updated_by': |
| 765 | 765 | case 'updated-by': |
| 766 | - $this_tag = str_replace('-', '_', $tag); |
|
| 766 | + $this_tag = str_replace( '-', '_', $tag ); |
|
| 767 | 767 | $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
| 768 | - unset($this_tag); |
|
| 768 | + unset( $this_tag ); |
|
| 769 | 769 | break; |
| 770 | 770 | |
| 771 | 771 | case 'admin_email': |
@@ -782,16 +782,16 @@ discard block |
||
| 782 | 782 | break; |
| 783 | 783 | } |
| 784 | 784 | |
| 785 | - $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
| 785 | + $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
|
| 786 | 786 | |
| 787 | 787 | $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
| 788 | 788 | |
| 789 | 789 | $atts['entry_id'] = $entry->id; |
| 790 | 790 | $atts['entry_key'] = $entry->item_key; |
| 791 | 791 | |
| 792 | - if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
| 792 | + if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) { |
|
| 793 | 793 | $replace_with = $field->name; |
| 794 | - } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
| 794 | + } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) { |
|
| 795 | 795 | $replace_with = $field->description; |
| 796 | 796 | } else { |
| 797 | 797 | $string_value = $replace_with; |
@@ -806,15 +806,15 @@ discard block |
||
| 806 | 806 | } |
| 807 | 807 | } |
| 808 | 808 | |
| 809 | - unset($field); |
|
| 809 | + unset( $field ); |
|
| 810 | 810 | break; |
| 811 | 811 | } |
| 812 | 812 | |
| 813 | - if ( isset($replace_with) ) { |
|
| 814 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 813 | + if ( isset( $replace_with ) ) { |
|
| 814 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 815 | 815 | } |
| 816 | 816 | |
| 817 | - unset($atts, $conditional, $replace_with); |
|
| 817 | + unset( $atts, $conditional, $replace_with ); |
|
| 818 | 818 | } |
| 819 | 819 | |
| 820 | 820 | return $content; |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | $new_value = ''; |
| 831 | 831 | switch ( $tag ) { |
| 832 | 832 | case 'admin_email': |
| 833 | - $new_value = get_option('admin_email'); |
|
| 833 | + $new_value = get_option( 'admin_email' ); |
|
| 834 | 834 | break; |
| 835 | 835 | case 'siteurl': |
| 836 | 836 | $new_value = FrmAppHelper::site_url(); |
@@ -856,28 +856,28 @@ discard block |
||
| 856 | 856 | * @return string|array |
| 857 | 857 | */ |
| 858 | 858 | public static function process_get_shortcode( $atts, $return_array = false ) { |
| 859 | - if ( ! isset($atts['param']) ) { |
|
| 859 | + if ( ! isset( $atts['param'] ) ) { |
|
| 860 | 860 | return ''; |
| 861 | 861 | } |
| 862 | 862 | |
| 863 | - if ( strpos($atts['param'], '[') ) { |
|
| 864 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
| 865 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
| 863 | + if ( strpos( $atts['param'], '[' ) ) { |
|
| 864 | + $atts['param'] = str_replace( '[', '[', $atts['param'] ); |
|
| 865 | + $atts['param'] = str_replace( ']', ']', $atts['param'] ); |
|
| 866 | 866 | } |
| 867 | 867 | |
| 868 | - $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
| 868 | + $new_value = FrmAppHelper::get_param( $atts['param'], '' ); |
|
| 869 | 869 | $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
| 870 | 870 | |
| 871 | 871 | if ( $new_value == '' ) { |
| 872 | - if ( ! isset($atts['prev_val']) ) { |
|
| 872 | + if ( ! isset( $atts['prev_val'] ) ) { |
|
| 873 | 873 | $atts['prev_val'] = ''; |
| 874 | 874 | } |
| 875 | 875 | |
| 876 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
| 876 | + $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val']; |
|
| 877 | 877 | } |
| 878 | 878 | |
| 879 | - if ( is_array($new_value) && ! $return_array ) { |
|
| 880 | - $new_value = implode(', ', $new_value); |
|
| 879 | + if ( is_array( $new_value ) && ! $return_array ) { |
|
| 880 | + $new_value = implode( ', ', $new_value ); |
|
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | return $new_value; |
@@ -890,17 +890,17 @@ discard block |
||
| 890 | 890 | $replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts ); |
| 891 | 891 | |
| 892 | 892 | if ( $field->type == 'textarea' || $field->type == 'rte' ) { |
| 893 | - $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true; |
|
| 894 | - if ( apply_filters('frm_use_wpautop', $autop) ) { |
|
| 895 | - if ( is_array($replace_with) ) { |
|
| 896 | - $replace_with = implode("\n", $replace_with); |
|
| 893 | + $autop = isset( $atts['wpautop'] ) ? $atts['wpautop'] : true; |
|
| 894 | + if ( apply_filters( 'frm_use_wpautop', $autop ) ) { |
|
| 895 | + if ( is_array( $replace_with ) ) { |
|
| 896 | + $replace_with = implode( "\n", $replace_with ); |
|
| 897 | 897 | } |
| 898 | - $replace_with = wpautop($replace_with); |
|
| 898 | + $replace_with = wpautop( $replace_with ); |
|
| 899 | 899 | } |
| 900 | 900 | unset( $autop ); |
| 901 | 901 | } else if ( is_array( $replace_with ) ) { |
| 902 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $replace_with[ $atts['show'] ] ) ) { |
|
| 903 | - $replace_with = $replace_with[ $atts['show'] ]; |
|
| 902 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $replace_with[$atts['show']] ) ) { |
|
| 903 | + $replace_with = $replace_with[$atts['show']]; |
|
| 904 | 904 | } else { |
| 905 | 905 | $replace_with = implode( $sep, $replace_with ); |
| 906 | 906 | } |
@@ -921,14 +921,14 @@ discard block |
||
| 921 | 921 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
| 922 | 922 | |
| 923 | 923 | $field_types = array(); |
| 924 | - if ( in_array($type, $single_input) ) { |
|
| 924 | + if ( in_array( $type, $single_input ) ) { |
|
| 925 | 925 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 926 | - } else if ( in_array($type, $multiple_input) ) { |
|
| 926 | + } else if ( in_array( $type, $multiple_input ) ) { |
|
| 927 | 927 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 928 | - } else if ( in_array($type, $other_type) ) { |
|
| 928 | + } else if ( in_array( $type, $other_type ) ) { |
|
| 929 | 929 | self::field_types_for_input( $other_type, $field_selection, $field_types ); |
| 930 | - } else if ( isset( $field_selection[ $type ] ) ) { |
|
| 931 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 930 | + } else if ( isset( $field_selection[$type] ) ) { |
|
| 931 | + $field_types[$type] = $field_selection[$type]; |
|
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
@@ -937,8 +937,8 @@ discard block |
||
| 937 | 937 | |
| 938 | 938 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
| 939 | 939 | foreach ( $inputs as $input ) { |
| 940 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 941 | - unset($input); |
|
| 940 | + $field_types[$input] = $fields[$input]; |
|
| 941 | + unset( $input ); |
|
| 942 | 942 | } |
| 943 | 943 | } |
| 944 | 944 | |
@@ -983,21 +983,21 @@ discard block |
||
| 983 | 983 | // Check posted vals before checking saved values |
| 984 | 984 | |
| 985 | 985 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 986 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
| 986 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
| 987 | 987 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 988 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
| 988 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) : ''; |
|
| 989 | 989 | } else { |
| 990 | - $other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ); |
|
| 990 | + $other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ); |
|
| 991 | 991 | } |
| 992 | 992 | return $other_val; |
| 993 | 993 | |
| 994 | - } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
| 994 | + } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
| 995 | 995 | // For normal fields |
| 996 | 996 | |
| 997 | 997 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 998 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
| 998 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : ''; |
|
| 999 | 999 | } else { |
| 1000 | - $other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] ); |
|
| 1000 | + $other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] ); |
|
| 1001 | 1001 | } |
| 1002 | 1002 | return $other_val; |
| 1003 | 1003 | } |
@@ -1006,8 +1006,8 @@ discard block |
||
| 1006 | 1006 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
| 1007 | 1007 | // Check if there is an "other" val in saved value and make sure the |
| 1008 | 1008 | // "other" val is not equal to the Other checkbox option |
| 1009 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 1010 | - $other_val = $field['value'][ $opt_key ]; |
|
| 1009 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 1010 | + $other_val = $field['value'][$opt_key]; |
|
| 1011 | 1011 | } |
| 1012 | 1012 | } else { |
| 1013 | 1013 | /** |
@@ -1019,8 +1019,8 @@ discard block |
||
| 1019 | 1019 | // Multi-select dropdowns - key is not preserved |
| 1020 | 1020 | if ( is_array( $field['value'] ) ) { |
| 1021 | 1021 | $o_key = array_search( $temp_val, $field['value'] ); |
| 1022 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 1023 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 1022 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 1023 | + unset( $field['value'][$o_key], $o_key ); |
|
| 1024 | 1024 | } |
| 1025 | 1025 | } else if ( $temp_val == $field['value'] ) { |
| 1026 | 1026 | // For radio and regular dropdowns |
@@ -1077,7 +1077,7 @@ discard block |
||
| 1077 | 1077 | private static function set_other_name( $args, &$other_args ) { |
| 1078 | 1078 | //Set up name for other field |
| 1079 | 1079 | $other_args['name'] = str_replace( '[]', '', $args['field_name'] ); |
| 1080 | - $other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']); |
|
| 1080 | + $other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] ); |
|
| 1081 | 1081 | $other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']'; |
| 1082 | 1082 | |
| 1083 | 1083 | //Converts item_meta[field_id] => item_meta[other][field_id] and |
@@ -1104,7 +1104,7 @@ discard block |
||
| 1104 | 1104 | // Count should only be greater than 3 if inside of a repeating section |
| 1105 | 1105 | if ( count( $temp_array ) > 3 ) { |
| 1106 | 1106 | $parent = str_replace( ']', '', $temp_array[1] ); |
| 1107 | - $pointer = str_replace( ']', '', $temp_array[2]); |
|
| 1107 | + $pointer = str_replace( ']', '', $temp_array[2] ); |
|
| 1108 | 1108 | } |
| 1109 | 1109 | |
| 1110 | 1110 | // Get text for "other" text field |
@@ -1223,15 +1223,15 @@ discard block |
||
| 1223 | 1223 | $replace_with[] = '[' . $new . ']'; |
| 1224 | 1224 | $replace[] = '[' . $old . ' '; |
| 1225 | 1225 | $replace_with[] = '[' . $new . ' '; |
| 1226 | - unset($old, $new); |
|
| 1226 | + unset( $old, $new ); |
|
| 1227 | 1227 | } |
| 1228 | 1228 | if ( is_array( $val ) ) { |
| 1229 | 1229 | foreach ( $val as $k => $v ) { |
| 1230 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1231 | - unset($k, $v); |
|
| 1230 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1231 | + unset( $k, $v ); |
|
| 1232 | 1232 | } |
| 1233 | 1233 | } else { |
| 1234 | - $val = str_replace($replace, $replace_with, $val); |
|
| 1234 | + $val = str_replace( $replace, $replace_with, $val ); |
|
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | return $val; |
@@ -1244,7 +1244,7 @@ discard block |
||
| 1244 | 1244 | 'DC' => 'District of Columbia', |
| 1245 | 1245 | 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
| 1246 | 1246 | 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
| 1247 | - 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
| 1247 | + 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', |
|
| 1248 | 1248 | 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
| 1249 | 1249 | 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
| 1250 | 1250 | 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
@@ -1335,35 +1335,35 @@ discard block |
||
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1338 | - $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
|
| 1338 | + $prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries(); |
|
| 1339 | 1339 | |
| 1340 | 1340 | $states = FrmFieldsHelper::get_us_states(); |
| 1341 | - $state_abv = array_keys($states); |
|
| 1342 | - sort($state_abv); |
|
| 1343 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1341 | + $state_abv = array_keys( $states ); |
|
| 1342 | + sort( $state_abv ); |
|
| 1343 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1344 | 1344 | |
| 1345 | - $states = array_values($states); |
|
| 1346 | - sort($states); |
|
| 1347 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1348 | - unset($state_abv, $states); |
|
| 1345 | + $states = array_values( $states ); |
|
| 1346 | + sort( $states ); |
|
| 1347 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1348 | + unset( $state_abv, $states ); |
|
| 1349 | 1349 | |
| 1350 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
| 1350 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
| 1351 | 1351 | __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
| 1352 | 1352 | __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
| 1353 | 1353 | __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
| 1354 | 1354 | ); |
| 1355 | 1355 | |
| 1356 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
| 1356 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
| 1357 | 1357 | __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
| 1358 | 1358 | __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
| 1359 | 1359 | ); |
| 1360 | 1360 | |
| 1361 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
| 1361 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
| 1362 | 1362 | __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
| 1363 | 1363 | __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
| 1364 | 1364 | ); |
| 1365 | 1365 | |
| 1366 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
| 1366 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
| 1367 | 1367 | __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
| 1368 | 1368 | __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
| 1369 | 1369 | ); |
@@ -285,7 +285,7 @@ |
||
| 285 | 285 | 'type' => $field->type, |
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | - $this->array_content[ $field->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field ); |
|
| 288 | + $this->array_content[$field->id] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $array, $field ); |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |