@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | return; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - $filepath = dirname(__FILE__); |
|
| 37 | + $filepath = dirname( __FILE__ ); |
|
| 38 | 38 | if ( preg_match( '/^FrmPro.+$/', $class_name ) || 'FrmUpdatesController' == $class_name ) { |
| 39 | 39 | $filepath .= '/pro'; |
| 40 | 40 | } |
@@ -50,25 +50,25 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | $filepath .= $class_name . '.php'; |
| 52 | 52 | |
| 53 | - if ( file_exists($filepath) ) { |
|
| 54 | - include($filepath); |
|
| 53 | + if ( file_exists( $filepath ) ) { |
|
| 54 | + include( $filepath ); |
|
| 55 | 55 | } |
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | // if __autoload is active, put it on the spl_autoload stack |
| 59 | -if ( is_array(spl_autoload_functions()) && in_array( '__autoload', spl_autoload_functions()) ) { |
|
| 60 | - spl_autoload_register('__autoload'); |
|
| 59 | +if ( is_array( spl_autoload_functions() ) && in_array( '__autoload', spl_autoload_functions() ) ) { |
|
| 60 | + spl_autoload_register( '__autoload' ); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Add the autoloader |
| 64 | -spl_autoload_register('frm_forms_autoloader'); |
|
| 64 | +spl_autoload_register( 'frm_forms_autoloader' ); |
|
| 65 | 65 | |
| 66 | -$frm_path = dirname(__FILE__); |
|
| 67 | -if ( file_exists($frm_path . '/pro/formidable-pro.php') ) { |
|
| 66 | +$frm_path = dirname( __FILE__ ); |
|
| 67 | +if ( file_exists( $frm_path . '/pro/formidable-pro.php' ) ) { |
|
| 68 | 68 | include( $frm_path . '/pro/formidable-pro.php' ); |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | FrmHooksController::trigger_load_hook(); |
| 72 | 72 | |
| 73 | 73 | include_once( $frm_path . '/deprecated.php' ); |
| 74 | -unset($frm_path); |
|
| 74 | +unset( $frm_path ); |
|
@@ -1,33 +1,33 @@ discard block |
||
| 1 | 1 | <?php if ( in_array( $display['type'], array( 'text', 'website', 'email', 'url' ) ) ) { ?> |
| 2 | - <input type="text" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" value="<?php echo esc_attr( $field['default_value'] ); ?>" <?php echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '') . ';"' ) : ''; ?> class="dyn_default_value" /> |
|
| 2 | + <input type="text" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" value="<?php echo esc_attr( $field['default_value'] ); ?>" <?php echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '' ) . ';"' ) : ''; ?> class="dyn_default_value" /> |
|
| 3 | 3 | <?php } else if ( $field['type'] == 'textarea' ) { ?> |
| 4 | 4 | <textarea name="<?php echo esc_attr( $field_name ) ?>" <?php |
| 5 | 5 | echo ( FrmField::is_option_true( $field, 'size' ) ) ? esc_attr( 'style="width:' . $field['size'] . ( is_numeric( $field['size'] ) ? 'px' : '' ) . ';"' ) : ''; |
| 6 | - ?> rows="<?php echo esc_attr( $field['max'] ); ?>" id="<?php echo esc_attr( $html_id ) ?>" class="dyn_default_value"><?php echo FrmAppHelper::esc_textarea(force_balance_tags($field['default_value'])); ?></textarea> |
|
| 6 | + ?> rows="<?php echo esc_attr( $field['max'] ); ?>" id="<?php echo esc_attr( $html_id ) ?>" class="dyn_default_value"><?php echo FrmAppHelper::esc_textarea( force_balance_tags( $field['default_value'] ) ); ?></textarea> |
|
| 7 | 7 | |
| 8 | 8 | <?php |
| 9 | 9 | |
| 10 | 10 | } else if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
| 11 | - $field['default_value'] = maybe_unserialize($field['default_value']); |
|
| 12 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 11 | + $field['default_value'] = maybe_unserialize( $field['default_value'] ); |
|
| 12 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
| 13 | 13 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
| 14 | 14 | } else { |
| 15 | - do_action('frm_add_multiple_opts_labels', $field); ?> |
|
| 16 | - <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts frm_clear<?php echo (count($field['options']) > 10) ? ' frm_field_opts_list' : ''; ?>"> |
|
| 15 | + do_action( 'frm_add_multiple_opts_labels', $field ); ?> |
|
| 16 | + <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts frm_clear<?php echo ( count( $field['options'] ) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
|
| 17 | 17 | <?php include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); ?> |
| 18 | 18 | </ul> |
| 19 | 19 | <?php |
| 20 | 20 | } |
| 21 | 21 | } else if ( $field['type'] == 'select' ) { |
| 22 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 22 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
| 23 | 23 | echo FrmFieldsHelper::dropdown_categories( array( 'name' => $field_name, 'field' => $field ) ); |
| 24 | 24 | } else { ?> |
| 25 | 25 | <select name="<?php echo esc_attr( $field_name ) . ( FrmField::is_option_true( $field, 'multiple' ) ? '[]' : '' ); ?>" <?php |
| 26 | 26 | echo FrmField::is_option_true( $field, 'size' ) ? 'class="auto_width"' : ''; |
| 27 | 27 | echo FrmField::is_option_true( $field, 'multiple' ) ? ' multiple="multiple"' : ''; ?> > |
| 28 | 28 | <?php foreach ( $field['options'] as $opt_key => $opt ) { |
| 29 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 30 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 29 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
| 30 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); |
|
| 31 | 31 | $selected = ( $field['default_value'] == $field_val || FrmFieldsHelper::get_other_val( array( 'opt_key', 'field' ) ) ) ? ' selected="selected"' : ''; ?> |
| 32 | 32 | <option value="<?php echo esc_attr( $field_val ) ?>"<?php echo $selected ?>><?php echo esc_html( $opt ) ?> </option> |
| 33 | 33 | <?php } ?> |
@@ -45,17 +45,17 @@ discard block |
||
| 45 | 45 | <?php |
| 46 | 46 | |
| 47 | 47 | if ( ! isset( $field['post_field'] ) || ! in_array( $field['post_field'], array( 'post_category' ) ) ) { ?> |
| 48 | - <?php do_action('frm_add_multiple_opts_labels', $field); ?> |
|
| 49 | - <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count($field['options']) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
|
| 50 | - <?php FrmFieldsHelper::show_single_option($field); ?> |
|
| 48 | + <?php do_action( 'frm_add_multiple_opts_labels', $field ); ?> |
|
| 49 | + <ul id="frm_field_<?php echo esc_attr( $field['id'] ) ?>_opts" class="frm_sortable_field_opts<?php echo ( count( $field['options'] ) > 10 ) ? ' frm_field_opts_list' : ''; ?>"> |
|
| 50 | + <?php FrmFieldsHelper::show_single_option( $field ); ?> |
|
| 51 | 51 | </ul> |
| 52 | 52 | <?php |
| 53 | 53 | } ?> |
| 54 | 54 | </div> |
| 55 | 55 | <?php |
| 56 | 56 | } else if ( $field['type'] == 'captcha' ) { |
| 57 | - if ( empty($frm_settings->pubkey) ) { ?> |
|
| 58 | - <div class="howto frm_no_captcha_text"><?php printf(__( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Private Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>') ?></div> |
|
| 57 | + if ( empty( $frm_settings->pubkey ) ) { ?> |
|
| 58 | + <div class="howto frm_no_captcha_text"><?php printf( __( 'Your captcha will not appear on your form until you %1$sset up%2$s the Site and Private Keys', 'formidable' ), '<a href="?page=formidable-settings">', '</a>' ) ?></div> |
|
| 59 | 59 | <?php |
| 60 | 60 | } ?> |
| 61 | 61 | <img src="<?php echo esc_url( FrmAppHelper::plugin_url() . '/images/recaptcha.png' ) ?>" class="recaptcha_placeholder" alt="reCaptcha"/> |
@@ -10,41 +10,41 @@ discard block |
||
| 10 | 10 | <?php |
| 11 | 11 | |
| 12 | 12 | } else if ( $field['type'] == 'radio' ) { |
| 13 | - $read_only = false; |
|
| 13 | + $read_only = false; |
|
| 14 | 14 | if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) { |
| 15 | - $read_only = true; ?> |
|
| 15 | + $read_only = true; ?> |
|
| 16 | 16 | <input type="hidden" value="<?php echo esc_attr( $field['value'] ) ?>" name="<?php echo esc_attr( $field_name ) ?>" /> |
| 17 | 17 | <?php |
| 18 | - } |
|
| 18 | + } |
|
| 19 | 19 | |
| 20 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 20 | + if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 21 | 21 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
| 22 | - } else if ( is_array($field['options']) ) { |
|
| 23 | - foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 22 | + } else if ( is_array($field['options']) ) { |
|
| 23 | + foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 24 | 24 | if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) { |
| 25 | - continue; |
|
| 26 | - } |
|
| 25 | + continue; |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 29 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?> |
|
| 28 | + $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 29 | + $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?> |
|
| 30 | 30 | <div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>"><?php |
| 31 | 31 | |
| 32 | 32 | if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
| 33 | 33 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
| 34 | - } |
|
| 35 | - $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' '; |
|
| 34 | + } |
|
| 35 | + $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' '; |
|
| 36 | 36 | |
| 37 | - $other_opt = false; |
|
| 38 | - $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked ); |
|
| 39 | - ?> |
|
| 37 | + $other_opt = false; |
|
| 38 | + $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked ); |
|
| 39 | + ?> |
|
| 40 | 40 | <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php |
| 41 | - echo $checked; |
|
| 42 | - do_action('frm_field_input_html', $field); |
|
| 41 | + echo $checked; |
|
| 42 | + do_action('frm_field_input_html', $field); |
|
| 43 | 43 | ?>/><?php |
| 44 | 44 | |
| 45 | 45 | if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
| 46 | 46 | echo ' ' . $opt . '</label>'; |
| 47 | - } |
|
| 47 | + } |
|
| 48 | 48 | |
| 49 | 49 | FrmFieldsHelper::include_other_input( array( |
| 50 | 50 | 'other_opt' => $other_opt, 'read_only' => $read_only, |
@@ -53,14 +53,14 @@ discard block |
||
| 53 | 53 | 'html_id' => $html_id, 'opt_key' => $opt_key, |
| 54 | 54 | ) ); |
| 55 | 55 | |
| 56 | - unset( $other_opt, $other_args ); |
|
| 56 | + unset( $other_opt, $other_args ); |
|
| 57 | 57 | ?></div> |
| 58 | 58 | <?php |
| 59 | - } |
|
| 60 | - } |
|
| 59 | + } |
|
| 60 | + } |
|
| 61 | 61 | } else if ( $field['type'] == 'select' ) { |
| 62 | - $read_only = false; |
|
| 63 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 62 | + $read_only = false; |
|
| 63 | + if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 64 | 64 | echo FrmFieldsHelper::dropdown_categories( array( 'name' => $field_name, 'field' => $field ) ); |
| 65 | 65 | } else { |
| 66 | 66 | if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) { |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | ?> |
| 94 | 94 | <option value="<?php echo esc_attr($field_val) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : '';?>><?php echo ($opt == '') ? ' ' : $opt; ?></option> |
| 95 | 95 | <?php |
| 96 | - } ?> |
|
| 96 | + } ?> |
|
| 97 | 97 | </select> |
| 98 | 98 | <?php |
| 99 | 99 | FrmFieldsHelper::include_other_input( array( |
@@ -102,52 +102,52 @@ discard block |
||
| 102 | 102 | 'value' => $other_args['value'], 'field' => $field, |
| 103 | 103 | 'html_id' => $html_id, 'opt_key' => false, |
| 104 | 104 | ) ); |
| 105 | - } |
|
| 105 | + } |
|
| 106 | 106 | } else if ( $field['type'] == 'checkbox' ) { |
| 107 | - $checked_values = $field['value']; |
|
| 108 | - $read_only = false; |
|
| 107 | + $checked_values = $field['value']; |
|
| 108 | + $read_only = false; |
|
| 109 | 109 | |
| 110 | 110 | if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) { |
| 111 | - $read_only = true; |
|
| 112 | - if ( $checked_values ) { |
|
| 113 | - foreach ( (array) $checked_values as $checked_value ) { ?> |
|
| 111 | + $read_only = true; |
|
| 112 | + if ( $checked_values ) { |
|
| 113 | + foreach ( (array) $checked_values as $checked_value ) { ?> |
|
| 114 | 114 | <input type="hidden" value="<?php echo esc_attr( $checked_value ) ?>" name="<?php echo esc_attr( $field_name ) ?>[]" /> |
| 115 | 115 | <?php |
| 116 | - } |
|
| 117 | - } else { ?> |
|
| 116 | + } |
|
| 117 | + } else { ?> |
|
| 118 | 118 | <input type="hidden" value="" name="<?php echo esc_attr( $field_name ) ?>[]" /> |
| 119 | 119 | <?php |
| 120 | - } |
|
| 121 | - } |
|
| 120 | + } |
|
| 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 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
| 125 | - } else if ( $field['options'] ) { |
|
| 126 | - foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 127 | - if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) { |
|
| 128 | - continue; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 132 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 133 | - $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : ''; |
|
| 134 | - |
|
| 135 | - // Check if other opt, and get values for other field if needed |
|
| 136 | - $other_opt = false; |
|
| 125 | + } else if ( $field['options'] ) { |
|
| 126 | + foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 127 | + if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) { |
|
| 128 | + continue; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 132 | + $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 133 | + $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : ''; |
|
| 134 | + |
|
| 135 | + // Check if other opt, and get values for other field if needed |
|
| 136 | + $other_opt = false; |
|
| 137 | 137 | $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field', 'field_name', 'opt_key' ), $other_opt, $checked ); |
| 138 | 138 | |
| 139 | - ?> |
|
| 139 | + ?> |
|
| 140 | 140 | <div class="<?php echo esc_attr( apply_filters( 'frm_checkbox_class', 'frm_checkbox', $field, $field_val ) ) ?>" id="frm_checkbox_<?php echo esc_attr( $field['id'] ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
| 141 | 141 | |
| 142 | - if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
|
| 143 | - ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
|
| 144 | - } |
|
| 142 | + if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
|
| 143 | + ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
|
| 144 | + } |
|
| 145 | 145 | |
| 146 | - ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php |
|
| 146 | + ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php |
|
| 147 | 147 | |
| 148 | - if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
|
| 148 | + if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
|
| 149 | 149 | echo ' ' . $opt . '</label>'; |
| 150 | - } |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | 152 | FrmFieldsHelper::include_other_input( array( |
| 153 | 153 | 'other_opt' => $other_opt, 'read_only' => $read_only, |
@@ -156,17 +156,17 @@ discard block |
||
| 156 | 156 | 'html_id' => $html_id, 'opt_key' => $opt_key, |
| 157 | 157 | ) ); |
| 158 | 158 | |
| 159 | - unset( $other_opt, $other_args, $checked ); |
|
| 159 | + unset( $other_opt, $other_args, $checked ); |
|
| 160 | 160 | |
| 161 | - ?></div> |
|
| 161 | + ?></div> |
|
| 162 | 162 | <?php |
| 163 | - } |
|
| 164 | - } |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | 165 | } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) { |
| 166 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 167 | - if ( ! empty($frm_settings->pubkey) ) { |
|
| 168 | - FrmFieldsHelper::display_recaptcha($field); |
|
| 169 | - } |
|
| 166 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 167 | + if ( ! empty($frm_settings->pubkey) ) { |
|
| 168 | + FrmFieldsHelper::display_recaptcha($field); |
|
| 169 | + } |
|
| 170 | 170 | } else { |
| 171 | 171 | do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) ); |
| 172 | 172 | do_action( 'frm_form_field_' . $field['type'], $field, $field_name, compact( 'errors', 'html_id' ) ); |
@@ -1,12 +1,12 @@ discard block |
||
| 1 | 1 | <?php if ( in_array( $field['type'], array( 'email', 'url', 'text' ) ) ) { ?> |
| 2 | -<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action('frm_field_input_html', $field) ?>/> |
|
| 2 | +<input type="<?php echo ( $frm_settings->use_html || $field['type'] == 'password' ) ? $field['type'] : 'text'; ?>" id="<?php echo esc_attr( $html_id ) ?>" name="<?php echo esc_attr( $field_name ) ?>" value="<?php echo esc_attr( $field['value'] ) ?>" <?php do_action( 'frm_field_input_html', $field ) ?>/> |
|
| 3 | 3 | <?php } else if ( $field['type'] == 'textarea' ) { ?> |
| 4 | 4 | <textarea name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php |
| 5 | 5 | if ( $field['max'] ) { |
| 6 | 6 | echo 'rows="' . esc_attr( $field['max'] ) . '" '; |
| 7 | 7 | } |
| 8 | -do_action('frm_field_input_html', $field); |
|
| 9 | -?>><?php echo FrmAppHelper::esc_textarea($field['value']) ?></textarea> |
|
| 8 | +do_action( 'frm_field_input_html', $field ); |
|
| 9 | +?>><?php echo FrmAppHelper::esc_textarea( $field['value'] ) ?></textarea> |
|
| 10 | 10 | <?php |
| 11 | 11 | |
| 12 | 12 | } else if ( $field['type'] == 'radio' ) { |
@@ -17,29 +17,29 @@ discard block |
||
| 17 | 17 | <?php |
| 18 | 18 | } |
| 19 | 19 | |
| 20 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 20 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
| 21 | 21 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
| 22 | - } else if ( is_array($field['options']) ) { |
|
| 22 | + } else if ( is_array( $field['options'] ) ) { |
|
| 23 | 23 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 24 | 24 | if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) { |
| 25 | 25 | continue; |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 29 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); ?> |
|
| 28 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
| 29 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); ?> |
|
| 30 | 30 | <div class="<?php echo esc_attr( apply_filters( 'frm_radio_class', 'frm_radio', $field, $field_val ) ) ?>"><?php |
| 31 | 31 | |
| 32 | 32 | if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
| 33 | 33 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
| 34 | 34 | } |
| 35 | - $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' '; |
|
| 35 | + $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' '; |
|
| 36 | 36 | |
| 37 | 37 | $other_opt = false; |
| 38 | 38 | $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked ); |
| 39 | 39 | ?> |
| 40 | 40 | <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php |
| 41 | 41 | echo $checked; |
| 42 | - do_action('frm_field_input_html', $field); |
|
| 42 | + do_action( 'frm_field_input_html', $field ); |
|
| 43 | 43 | ?>/><?php |
| 44 | 44 | |
| 45 | 45 | if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | } |
| 61 | 61 | } else if ( $field['type'] == 'select' ) { |
| 62 | 62 | $read_only = false; |
| 63 | - if ( isset($field['post_field']) && $field['post_field'] == 'post_category' ) { |
|
| 63 | + if ( isset( $field['post_field'] ) && $field['post_field'] == 'post_category' ) { |
|
| 64 | 64 | echo FrmFieldsHelper::dropdown_categories( array( 'name' => $field_name, 'field' => $field ) ); |
| 65 | 65 | } else { |
| 66 | 66 | if ( FrmField::is_read_only( $field ) && ! FrmAppHelper::is_admin() ) { |
@@ -71,12 +71,12 @@ discard block |
||
| 71 | 71 | <input type="hidden" value="<?php echo esc_attr( $selected_value ) ?>" name="<?php echo esc_attr( $field_name ) ?>[]" /> <?php |
| 72 | 72 | } |
| 73 | 73 | } else { ?> |
| 74 | - <input type="hidden" value="<?php echo esc_attr($field['value']) ?>" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" /> <?php |
|
| 74 | + <input type="hidden" value="<?php echo esc_attr( $field['value'] ) ?>" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" /> <?php |
|
| 75 | 75 | } ?> |
| 76 | - <select disabled="disabled" <?php do_action('frm_field_input_html', $field) ?>> <?php |
|
| 76 | + <select disabled="disabled" <?php do_action( 'frm_field_input_html', $field ) ?>> <?php |
|
| 77 | 77 | |
| 78 | 78 | } else { ?> |
| 79 | -<select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action('frm_field_input_html', $field) ?>> |
|
| 79 | +<select name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id ) ?>" <?php do_action( 'frm_field_input_html', $field ) ?>> |
|
| 80 | 80 | <?php } |
| 81 | 81 | |
| 82 | 82 | $other_opt = $other_checked = false; |
@@ -91,7 +91,7 @@ discard block |
||
| 91 | 91 | } |
| 92 | 92 | } |
| 93 | 93 | ?> |
| 94 | - <option value="<?php echo esc_attr($field_val) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : '';?>><?php echo ($opt == '') ? ' ' : $opt; ?></option> |
|
| 94 | + <option value="<?php echo esc_attr( $field_val ) ?>" <?php echo $selected ? ' selected="selected"' : ''; ?><?php echo ( FrmFieldsHelper::is_other_opt( $opt_key ) ) ? ' class="frm_other_trigger"' : ''; ?>><?php echo ( $opt == '' ) ? ' ' : $opt; ?></option> |
|
| 95 | 95 | <?php |
| 96 | 96 | } ?> |
| 97 | 97 | </select> |
@@ -120,17 +120,17 @@ discard block |
||
| 120 | 120 | } |
| 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 | do_action( 'frm_after_checkbox', array( 'field' => $field, 'field_name' => $field_name, 'type' => $field['type'] ) ); |
| 125 | 125 | } else if ( $field['options'] ) { |
| 126 | 126 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 127 | - if ( isset($atts) && isset($atts['opt']) && ($atts['opt'] != $opt_key) ) { |
|
| 127 | + if ( isset( $atts ) && isset( $atts['opt'] ) && ( $atts['opt'] != $opt_key ) ) { |
|
| 128 | 128 | continue; |
| 129 | 129 | } |
| 130 | 130 | |
| 131 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 132 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 133 | - $checked = FrmAppHelper::check_selected($checked_values, $field_val) ? ' checked="checked"' : ''; |
|
| 131 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
| 132 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); |
|
| 133 | + $checked = FrmAppHelper::check_selected( $checked_values, $field_val ) ? ' checked="checked"' : ''; |
|
| 134 | 134 | |
| 135 | 135 | // Check if other opt, and get values for other field if needed |
| 136 | 136 | $other_opt = false; |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php |
|
| 146 | + ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> /><?php |
|
| 147 | 147 | |
| 148 | 148 | if ( ! isset( $atts ) || ! isset( $atts['label'] ) || $atts['label'] ) { |
| 149 | 149 | echo ' ' . $opt . '</label>'; |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | } else if ( $field['type'] == 'captcha' && ! FrmAppHelper::is_admin() ) { |
| 166 | 166 | $frm_settings = FrmAppHelper::get_settings(); |
| 167 | - if ( ! empty($frm_settings->pubkey) ) { |
|
| 168 | - FrmFieldsHelper::display_recaptcha($field); |
|
| 167 | + if ( ! empty( $frm_settings->pubkey ) ) { |
|
| 168 | + FrmFieldsHelper::display_recaptcha( $field ); |
|
| 169 | 169 | } |
| 170 | 170 | } else { |
| 171 | 171 | do_action( 'frm_form_fields', $field, $field_name, compact( 'errors', 'html_id' ) ); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | <ul id="category-tabs" class="category-tabs frm-category-tabs"> |
| 18 | 18 | <li class="tabs" ><a href="#frm-insert-fields" id="frm_insert_fields_tab"><?php _e( 'Fields', 'formidable' ); ?></a></li> |
| 19 | 19 | <li class="hide-if-no-js"><a href="#frm-layout-classes" id="frm_layout_classes_tab" class="frm_help" title="<?php esc_attr_e( 'Open the Field Options and click on the CSS Layout Classes option to enable this tab', 'formidable' ) ?>"><?php _e( 'Layout', 'formidable' ); ?></a></li> |
| 20 | -<?php do_action('frm_extra_form_instruction_tabs'); ?> |
|
| 20 | +<?php do_action( 'frm_extra_form_instruction_tabs' ); ?> |
|
| 21 | 21 | </ul> |
| 22 | 22 | |
| 23 | 23 | <div id="frm-insert-fields" class="tabs-panel"> |
@@ -78,13 +78,13 @@ discard block |
||
| 78 | 78 | <?php |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | - $col_class = empty($col_class) ? 'frm_col_one' : ''; |
|
| 82 | - unset($field_key, $field_type, $field_label); |
|
| 81 | + $col_class = empty( $col_class ) ? 'frm_col_one' : ''; |
|
| 82 | + unset( $field_key, $field_type, $field_label ); |
|
| 83 | 83 | } ?> |
| 84 | 84 | </ul> |
| 85 | 85 | <div class="clear"></div> |
| 86 | 86 | </div> |
| 87 | - <?php do_action('frm_extra_form_instructions'); ?> |
|
| 87 | + <?php do_action( 'frm_extra_form_instructions' ); ?> |
|
| 88 | 88 | |
| 89 | 89 | <div id="frm-layout-classes" class="tabs-panel"> |
| 90 | 90 | <p class="howto"><?php _e( 'Add classes in the "CSS layout classes" field option', 'formidable' ) ?></p> |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | <a href="javascript:void(0);" class="frmbutton frm_insert_code button show_frm_classes<?php |
| 136 | 136 | if ( ! empty( $title ) ) { |
| 137 | 137 | echo ' frm_help'; |
| 138 | - } ?>" data-code="<?php echo esc_attr($c) ?>" <?php |
|
| 138 | + } ?>" data-code="<?php echo esc_attr( $c ) ?>" <?php |
|
| 139 | 139 | if ( ! empty( $title ) ) { |
| 140 | - ?>title="<?php echo esc_attr($title); ?>"<?php |
|
| 140 | + ?>title="<?php echo esc_attr( $title ); ?>"<?php |
|
| 141 | 141 | } ?>> |
| 142 | 142 | <?php |
| 143 | 143 | if ( empty( $d ) ) { |
@@ -162,14 +162,14 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | <div class="submitbox" id="major-publishing-actions"> |
| 164 | 164 | <div id="delete-action"> |
| 165 | - <?php echo FrmFormsHelper::delete_trash_link($id, $values['status']); ?> |
|
| 165 | + <?php echo FrmFormsHelper::delete_trash_link( $id, $values['status'] ); ?> |
|
| 166 | 166 | </div> |
| 167 | 167 | |
| 168 | 168 | <div id="publishing-action"> |
| 169 | 169 | <form method="post" id="frm_js_build_form"> |
| 170 | 170 | <span class="spinner"></span> |
| 171 | 171 | <input type="hidden" id="frm_compact_fields" name="frm_compact_fields" value="" /> |
| 172 | - <input type="button" value="<?php echo esc_attr($button) ?>" class="frm_submit_form frm_submit_<?php echo ( isset($values['ajax_load']) && $values['ajax_load'] ) ? '': 'no_'; ?>ajax button-primary button-large" id="frm_submit_side" /> |
|
| 172 | + <input type="button" value="<?php echo esc_attr( $button ) ?>" class="frm_submit_form frm_submit_<?php echo ( isset( $values['ajax_load'] ) && $values['ajax_load'] ) ? '' : 'no_'; ?>ajax button-primary button-large" id="frm_submit_side" /> |
|
| 173 | 173 | </form> |
| 174 | 174 | </div> |
| 175 | 175 | <div class="clear"></div> |
@@ -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,7 +8,7 @@ discard block |
||
| 8 | 8 | static $transient_size = 200; |
| 9 | 9 | |
| 10 | 10 | public static function field_selection() { |
| 11 | - $fields = apply_filters('frm_available_fields', array( |
|
| 11 | + $fields = apply_filters( 'frm_available_fields', array( |
|
| 12 | 12 | 'text' => __( 'Single Line Text', 'formidable' ), |
| 13 | 13 | 'textarea' => __( 'Paragraph Text', 'formidable' ), |
| 14 | 14 | 'checkbox' => __( 'Checkboxes', 'formidable' ), |
@@ -17,13 +17,13 @@ discard block |
||
| 17 | 17 | 'email' => __( 'Email Address', 'formidable' ), |
| 18 | 18 | 'url' => __( 'Website/URL', 'formidable' ), |
| 19 | 19 | 'captcha' => __( 'reCAPTCHA', 'formidable' ), |
| 20 | - )); |
|
| 20 | + ) ); |
|
| 21 | 21 | |
| 22 | 22 | return $fields; |
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | public static function pro_field_selection() { |
| 26 | - return apply_filters('frm_pro_available_fields', array( |
|
| 26 | + return apply_filters( 'frm_pro_available_fields', array( |
|
| 27 | 27 | 'end_divider' => array( |
| 28 | 28 | 'name' => __( 'End Section', 'formidable' ), |
| 29 | 29 | 'switch_from' => 'divider', |
@@ -47,36 +47,36 @@ discard block |
||
| 47 | 47 | 'tag' => __( 'Tags', 'formidable' ), |
| 48 | 48 | 'credit_card' => __( 'Credit Card', 'formidable' ), |
| 49 | 49 | 'address' => __( 'Address', 'formidable' ), |
| 50 | - )); |
|
| 50 | + ) ); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | public static function create( $values, $return = true ) { |
| 54 | 54 | global $wpdb, $frm_duplicate_ids; |
| 55 | 55 | |
| 56 | 56 | $new_values = array(); |
| 57 | - $key = isset($values['field_key']) ? $values['field_key'] : $values['name']; |
|
| 57 | + $key = isset( $values['field_key'] ) ? $values['field_key'] : $values['name']; |
|
| 58 | 58 | $new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 59 | 59 | |
| 60 | 60 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 61 | - $new_values[ $col ] = $values[ $col ]; |
|
| 61 | + $new_values[$col] = $values[$col]; |
|
| 62 | 62 | } |
| 63 | 63 | |
| 64 | 64 | $new_values['options'] = $values['options']; |
| 65 | 65 | |
| 66 | - $new_values['field_order'] = isset($values['field_order']) ? (int) $values['field_order'] : null; |
|
| 67 | - $new_values['required'] = isset($values['required']) ? (int) $values['required'] : 0; |
|
| 68 | - $new_values['form_id'] = isset($values['form_id']) ? (int) $values['form_id'] : null; |
|
| 66 | + $new_values['field_order'] = isset( $values['field_order'] ) ? (int) $values['field_order'] : null; |
|
| 67 | + $new_values['required'] = isset( $values['required'] ) ? (int) $values['required'] : 0; |
|
| 68 | + $new_values['form_id'] = isset( $values['form_id'] ) ? (int) $values['form_id'] : null; |
|
| 69 | 69 | $new_values['field_options'] = $values['field_options']; |
| 70 | - $new_values['created_at'] = current_time('mysql', 1); |
|
| 70 | + $new_values['created_at'] = current_time( 'mysql', 1 ); |
|
| 71 | 71 | |
| 72 | 72 | if ( isset( $values['id'] ) ) { |
| 73 | - $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
|
| 74 | - $new_values = apply_filters('frm_duplicated_field', $new_values); |
|
| 73 | + $frm_duplicate_ids[$values['field_key']] = $new_values['field_key']; |
|
| 74 | + $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | foreach ( $new_values as $k => $v ) { |
| 78 | 78 | if ( is_array( $v ) ) { |
| 79 | - $new_values[ $k ] = serialize( $v ); |
|
| 79 | + $new_values[$k] = serialize( $v ); |
|
| 80 | 80 | } |
| 81 | 81 | unset( $k, $v ); |
| 82 | 82 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | |
| 98 | 98 | if ( $query_results ) { |
| 99 | 99 | if ( isset( $values['id'] ) ) { |
| 100 | - $frm_duplicate_ids[ $values['id'] ] = $new_id; |
|
| 100 | + $frm_duplicate_ids[$values['id']] = $new_id; |
|
| 101 | 101 | } |
| 102 | 102 | return $new_id; |
| 103 | 103 | } else { |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | $fields = self::getAll( $where, 'field_order', '', $blog_id ); |
| 113 | 113 | |
| 114 | 114 | foreach ( (array) $fields as $field ) { |
| 115 | - $new_key = ($copy_keys) ? $field->field_key : ''; |
|
| 116 | - if ( $copy_keys && substr($field->field_key, -1) == 2 ) { |
|
| 117 | - $new_key = rtrim($new_key, 2); |
|
| 115 | + $new_key = ( $copy_keys ) ? $field->field_key : ''; |
|
| 116 | + if ( $copy_keys && substr( $field->field_key, -1 ) == 2 ) { |
|
| 117 | + $new_key = rtrim( $new_key, 2 ); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | $values = array(); |
@@ -137,11 +137,11 @@ discard block |
||
| 137 | 137 | $values['form_id'] = $new_repeat_form_id; |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $values = apply_filters('frm_duplicated_field', $values); |
|
| 141 | - $new_id = self::create($values); |
|
| 142 | - $frm_duplicate_ids[ $field->id ] = $new_id; |
|
| 143 | - $frm_duplicate_ids[ $field->field_key ] = $new_id; |
|
| 144 | - unset($field); |
|
| 140 | + $values = apply_filters( 'frm_duplicated_field', $values ); |
|
| 141 | + $new_id = self::create( $values ); |
|
| 142 | + $frm_duplicate_ids[$field->id] = $new_id; |
|
| 143 | + $frm_duplicate_ids[$field->field_key] = $new_id; |
|
| 144 | + unset( $field ); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | $values['field_key'] = FrmAppHelper::get_unique_key( $values['field_key'], $wpdb->prefix . 'frm_fields', 'field_key', $id ); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - if ( isset($values['required']) ) { |
|
| 157 | + if ( isset( $values['required'] ) ) { |
|
| 158 | 158 | $values['required'] = (int) $values['required']; |
| 159 | 159 | } |
| 160 | 160 | |
@@ -162,8 +162,8 @@ discard block |
||
| 162 | 162 | |
| 163 | 163 | // serialize array values |
| 164 | 164 | foreach ( array( 'default_value', 'field_options', 'options' ) as $opt ) { |
| 165 | - if ( isset( $values[ $opt ] ) && is_array( $values[ $opt ] ) ) { |
|
| 166 | - $values[ $opt ] = serialize( $values[ $opt ] ); |
|
| 165 | + if ( isset( $values[$opt] ) && is_array( $values[$opt] ) ) { |
|
| 166 | + $values[$opt] = serialize( $values[$opt] ); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | |
@@ -173,18 +173,18 @@ discard block |
||
| 173 | 173 | if ( isset( $values['form_id'] ) ) { |
| 174 | 174 | $form_id = absint( $values['form_id'] ); |
| 175 | 175 | } else { |
| 176 | - $field = self::getOne($id); |
|
| 176 | + $field = self::getOne( $id ); |
|
| 177 | 177 | if ( $field ) { |
| 178 | 178 | $form_id = $field->form_id; |
| 179 | 179 | } |
| 180 | - unset($field); |
|
| 180 | + unset( $field ); |
|
| 181 | 181 | } |
| 182 | - unset($values); |
|
| 182 | + unset( $values ); |
|
| 183 | 183 | |
| 184 | 184 | if ( $query_results ) { |
| 185 | 185 | wp_cache_delete( $id, 'frm_field' ); |
| 186 | 186 | if ( $form_id ) { |
| 187 | - self::delete_form_transient($form_id); |
|
| 187 | + self::delete_form_transient( $form_id ); |
|
| 188 | 188 | } |
| 189 | 189 | } |
| 190 | 190 | |
@@ -231,12 +231,12 @@ discard block |
||
| 231 | 231 | $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->options . ' WHERE option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s OR option_name LIKE %s', '_transient_timeout_frm_form_fields_' . $form_id . 'ex%', '_transient_frm_form_fields_' . $form_id . 'ex%', '_transient_timeout_frm_form_fields_' . $form_id . 'in%', '_transient_frm_form_fields_' . $form_id . 'in%' ) ); |
| 232 | 232 | |
| 233 | 233 | $cache_key = serialize( array( 'fi.form_id' => $form_id ) ) . 'field_orderlb'; |
| 234 | - wp_cache_delete($cache_key, 'frm_field'); |
|
| 234 | + wp_cache_delete( $cache_key, 'frm_field' ); |
|
| 235 | 235 | |
| 236 | 236 | // this cache key is autogenerated in FrmDb::get_var |
| 237 | 237 | wp_cache_delete( '(__fi.form_id=%d_OR_fr.parent_form_id=%d_)__' . $form_id . '_' . $form_id . '_ORDER_BY_field_orderfi.*__fr.name_as_form_name_results', 'frm_field' ); |
| 238 | 238 | |
| 239 | - $form = FrmForm::getOne($form_id); |
|
| 239 | + $form = FrmForm::getOne( $form_id ); |
|
| 240 | 240 | if ( $form && $form->parent_form_id ) { |
| 241 | 241 | self::delete_form_transient( $form->parent_form_id ); |
| 242 | 242 | } |
@@ -258,16 +258,16 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | global $wpdb; |
| 260 | 260 | |
| 261 | - $where = is_numeric($id) ? 'id=%d' : 'field_key=%s'; |
|
| 261 | + $where = is_numeric( $id ) ? 'id=%d' : 'field_key=%s'; |
|
| 262 | 262 | $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'frm_fields WHERE ' . $where, $id ); |
| 263 | 263 | |
| 264 | 264 | $results = FrmAppHelper::check_cache( $id, 'frm_field', $query, 'get_row', 0 ); |
| 265 | 265 | |
| 266 | - if ( empty($results) ) { |
|
| 266 | + if ( empty( $results ) ) { |
|
| 267 | 267 | return $results; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - if ( is_numeric($id) ) { |
|
| 270 | + if ( is_numeric( $id ) ) { |
|
| 271 | 271 | wp_cache_set( $results->field_key, $results, 'frm_field' ); |
| 272 | 272 | } else if ( $results ) { |
| 273 | 273 | wp_cache_set( $results->id, $results, 'frm_field' ); |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | self::prepare_options( $results ); |
| 277 | 277 | |
| 278 | - return stripslashes_deep($results); |
|
| 278 | + return stripslashes_deep( $results ); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | /** |
@@ -308,20 +308,20 @@ discard block |
||
| 308 | 308 | continue; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - $fields[ $result->id ] = $result; |
|
| 312 | - $count++; |
|
| 311 | + $fields[$result->id] = $result; |
|
| 312 | + $count ++; |
|
| 313 | 313 | if ( $limit == 1 ) { |
| 314 | 314 | $fields = $result; |
| 315 | 315 | break; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - if ( ! empty($limit) && $count >= $limit ) { |
|
| 318 | + if ( ! empty( $limit ) && $count >= $limit ) { |
|
| 319 | 319 | break; |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - unset($result); |
|
| 322 | + unset( $result ); |
|
| 323 | 323 | } |
| 324 | - return stripslashes_deep($fields); |
|
| 324 | + return stripslashes_deep( $fields ); |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | self::$use_cache = false; |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | self::maybe_include_repeating_fields( $inc_sub, $where ); |
| 331 | 331 | $results = self::getAll( $where, 'field_order', $limit ); |
| 332 | 332 | self::$use_cache = true; |
| 333 | - self::include_sub_fields($results, $inc_sub, $type); |
|
| 333 | + self::include_sub_fields( $results, $inc_sub, $type ); |
|
| 334 | 334 | |
| 335 | 335 | return $results; |
| 336 | 336 | } |
@@ -342,15 +342,15 @@ discard block |
||
| 342 | 342 | |
| 343 | 343 | $results = self::get_fields_from_transients( $form_id, array( 'inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat ) ); |
| 344 | 344 | if ( ! empty( $results ) ) { |
| 345 | - if ( empty($limit) ) { |
|
| 345 | + if ( empty( $limit ) ) { |
|
| 346 | 346 | return $results; |
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | $fields = array(); |
| 350 | 350 | $count = 0; |
| 351 | 351 | foreach ( $results as $result ) { |
| 352 | - $fields[ $result->id ] = $result; |
|
| 353 | - if ( ! empty($limit) && $count >= $limit ) { |
|
| 352 | + $fields[$result->id] = $result; |
|
| 353 | + if ( ! empty( $limit ) && $count >= $limit ) { |
|
| 354 | 354 | break; |
| 355 | 355 | } |
| 356 | 356 | } |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | |
| 369 | 369 | self::include_sub_fields( $results, $inc_embed, 'all' ); |
| 370 | 370 | |
| 371 | - if ( empty($limit) ) { |
|
| 371 | + if ( empty( $limit ) ) { |
|
| 372 | 372 | self::set_field_transient( $results, $form_id, 0, array( 'inc_embed' => $inc_embed, 'inc_repeat' => $inc_repeat ) ); |
| 373 | 373 | } |
| 374 | 374 | |
@@ -397,22 +397,22 @@ discard block |
||
| 397 | 397 | $form_fields = $results; |
| 398 | 398 | $index_offset = 1; |
| 399 | 399 | foreach ( $form_fields as $k => $field ) { |
| 400 | - if ( 'form' != $field->type || ! isset($field->field_options['form_select']) ) { |
|
| 400 | + if ( 'form' != $field->type || ! isset( $field->field_options['form_select'] ) ) { |
|
| 401 | 401 | continue; |
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | if ( $type == 'all' ) { |
| 405 | 405 | $sub_fields = self::get_all_for_form( $field->field_options['form_select'] ); |
| 406 | 406 | } else { |
| 407 | - $sub_fields = self::get_all_types_in_form($field->form_id, $type); |
|
| 407 | + $sub_fields = self::get_all_types_in_form( $field->form_id, $type ); |
|
| 408 | 408 | } |
| 409 | 409 | |
| 410 | - if ( ! empty($sub_fields) ) { |
|
| 410 | + if ( ! empty( $sub_fields ) ) { |
|
| 411 | 411 | $index = $k + $index_offset; |
| 412 | 412 | $index_offset += count( $sub_fields ); |
| 413 | - array_splice($results, $index, 0, $sub_fields); |
|
| 413 | + array_splice( $results, $index, 0, $sub_fields ); |
|
| 414 | 414 | } |
| 415 | - unset($field, $sub_fields); |
|
| 415 | + unset( $field, $sub_fields ); |
|
| 416 | 416 | } |
| 417 | 417 | } |
| 418 | 418 | |
@@ -420,9 +420,9 @@ discard block |
||
| 420 | 420 | $cache_key = maybe_serialize( $where ) . $order_by . 'l' . $limit . 'b' . $blog_id; |
| 421 | 421 | if ( self::$use_cache ) { |
| 422 | 422 | // make sure old cache doesn't get saved as a transient |
| 423 | - $results = wp_cache_get($cache_key, 'frm_field'); |
|
| 423 | + $results = wp_cache_get( $cache_key, 'frm_field' ); |
|
| 424 | 424 | if ( false !== $results ) { |
| 425 | - return stripslashes_deep($results); |
|
| 425 | + return stripslashes_deep( $results ); |
|
| 426 | 426 | } |
| 427 | 427 | } |
| 428 | 428 | |
@@ -447,16 +447,16 @@ discard block |
||
| 447 | 447 | $order_by = ' ORDER BY ' . $order_by; |
| 448 | 448 | } |
| 449 | 449 | |
| 450 | - $limit = FrmAppHelper::esc_limit($limit); |
|
| 450 | + $limit = FrmAppHelper::esc_limit( $limit ); |
|
| 451 | 451 | |
| 452 | 452 | $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"; |
| 453 | 453 | $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
| 454 | 454 | |
| 455 | - if ( is_array($where) ) { |
|
| 455 | + if ( is_array( $where ) ) { |
|
| 456 | 456 | $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 ); |
| 457 | 457 | } else { |
| 458 | 458 | // if the query is not an array, then it has already been prepared |
| 459 | - $query .= FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
| 459 | + $query .= FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
|
| 460 | 460 | |
| 461 | 461 | $function_name = ( $query_type == 'row' ) ? 'get_row' : 'get_results'; |
| 462 | 462 | $results = $wpdb->$function_name( $query ); |
@@ -479,9 +479,9 @@ discard block |
||
| 479 | 479 | wp_cache_set( $result->id, $result, 'frm_field' ); |
| 480 | 480 | wp_cache_set( $result->field_key, $result, 'frm_field' ); |
| 481 | 481 | |
| 482 | - $results[ $r_key ]->field_options = maybe_unserialize( $result->field_options ); |
|
| 483 | - $results[ $r_key ]->options = maybe_unserialize( $result->options ); |
|
| 484 | - $results[ $r_key ]->default_value = maybe_unserialize( $result->default_value ); |
|
| 482 | + $results[$r_key]->field_options = maybe_unserialize( $result->field_options ); |
|
| 483 | + $results[$r_key]->options = maybe_unserialize( $result->options ); |
|
| 484 | + $results[$r_key]->default_value = maybe_unserialize( $result->default_value ); |
|
| 485 | 485 | |
| 486 | 486 | unset( $r_key, $result ); |
| 487 | 487 | } |
@@ -500,8 +500,8 @@ discard block |
||
| 500 | 500 | private static function prepare_options( &$results ) { |
| 501 | 501 | $results->field_options = maybe_unserialize( $results->field_options ); |
| 502 | 502 | |
| 503 | - $results->options = maybe_unserialize($results->options); |
|
| 504 | - $results->default_value = maybe_unserialize($results->default_value); |
|
| 503 | + $results->options = maybe_unserialize( $results->options ); |
|
| 504 | + $results->default_value = maybe_unserialize( $results->default_value ); |
|
| 505 | 505 | } |
| 506 | 506 | |
| 507 | 507 | /** |
@@ -528,7 +528,7 @@ discard block |
||
| 528 | 528 | |
| 529 | 529 | if ( count( $next_fields ) >= self::$transient_size ) { |
| 530 | 530 | // if this transient is full, check for another |
| 531 | - $next++; |
|
| 531 | + $next ++; |
|
| 532 | 532 | self::get_next_transient( $fields, $base_name, $next ); |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -554,14 +554,14 @@ discard block |
||
| 554 | 554 | return; |
| 555 | 555 | } |
| 556 | 556 | |
| 557 | - $next++; |
|
| 557 | + $next ++; |
|
| 558 | 558 | } |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | public static function getIds( $where = '', $order_by = '', $limit = '' ) { |
| 562 | 562 | _deprecated_function( __FUNCTION__, '2.0' ); |
| 563 | 563 | global $wpdb; |
| 564 | - if ( ! empty($order_by) && ! strpos($order_by, 'ORDER BY') !== false ) { |
|
| 564 | + if ( ! empty( $order_by ) && ! strpos( $order_by, 'ORDER BY' ) !== false ) { |
|
| 565 | 565 | $order_by = ' ORDER BY ' . $order_by; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -571,7 +571,7 @@ discard block |
||
| 571 | 571 | |
| 572 | 572 | $method = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'get_var' : 'get_col'; |
| 573 | 573 | $cache_key = 'getIds_' . maybe_serialize( $where ) . $order_by . $limit; |
| 574 | - $results = FrmAppHelper::check_cache($cache_key, 'frm_field', $query, $method); |
|
| 574 | + $results = FrmAppHelper::check_cache( $cache_key, 'frm_field', $query, $method ); |
|
| 575 | 575 | |
| 576 | 576 | return $results; |
| 577 | 577 | } |
@@ -598,9 +598,9 @@ discard block |
||
| 598 | 598 | } |
| 599 | 599 | |
| 600 | 600 | if ( is_array( $field ) ) { |
| 601 | - return $field['type'] == 'checkbox' || ( $field['type'] == 'data' && isset($field['data_type']) && $field['data_type'] == 'checkbox' ) || self::is_multiple_select( $field ); |
|
| 601 | + return $field['type'] == 'checkbox' || ( $field['type'] == 'data' && isset( $field['data_type'] ) && $field['data_type'] == 'checkbox' ) || self::is_multiple_select( $field ); |
|
| 602 | 602 | } else { |
| 603 | - return $field->type == 'checkbox' || ( $field->type == 'data' && isset( $field->field_options['data_type'] ) && $field->field_options['data_type'] == 'checkbox' ) || self::is_multiple_select($field); |
|
| 603 | + return $field->type == 'checkbox' || ( $field->type == 'data' && isset( $field->field_options['data_type'] ) && $field->field_options['data_type'] == 'checkbox' ) || self::is_multiple_select( $field ); |
|
| 604 | 604 | } |
| 605 | 605 | } |
| 606 | 606 | |
@@ -612,9 +612,9 @@ discard block |
||
| 612 | 612 | */ |
| 613 | 613 | public static function is_multiple_select( $field ) { |
| 614 | 614 | if ( is_array( $field ) ) { |
| 615 | - return self::is_option_true( $field, 'multiple' ) && ( ( $field['type'] == 'select' || ( $field['type'] == 'data' && isset( $field['data_type'] ) && $field['data_type'] == 'select') ) ); |
|
| 615 | + return self::is_option_true( $field, 'multiple' ) && ( ( $field['type'] == 'select' || ( $field['type'] == 'data' && isset( $field['data_type'] ) && $field['data_type'] == 'select' ) ) ); |
|
| 616 | 616 | } else { |
| 617 | - return self::is_option_true( $field, 'multiple' ) && ( ( $field->type == 'select' || ( $field->type == 'data' && isset($field->field_options['data_type'] ) && $field->field_options['data_type'] == 'select') ) ); |
|
| 617 | + return self::is_option_true( $field, 'multiple' ) && ( ( $field->type == 'select' || ( $field->type == 'data' && isset( $field->field_options['data_type'] ) && $field->field_options['data_type'] == 'select' ) ) ); |
|
| 618 | 618 | } |
| 619 | 619 | } |
| 620 | 620 | |
@@ -661,23 +661,23 @@ discard block |
||
| 661 | 661 | } |
| 662 | 662 | |
| 663 | 663 | public static function is_option_true_in_array( $field, $option ) { |
| 664 | - return isset( $field[ $option ] ) && $field[ $option ]; |
|
| 664 | + return isset( $field[$option] ) && $field[$option]; |
|
| 665 | 665 | } |
| 666 | 666 | |
| 667 | 667 | public static function is_option_true_in_object( $field, $option ) { |
| 668 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ]; |
|
| 668 | + return isset( $field->field_options[$option] ) && $field->field_options[$option]; |
|
| 669 | 669 | } |
| 670 | 670 | |
| 671 | 671 | public static function is_option_empty_in_array( $field, $option ) { |
| 672 | - return ! isset( $field[ $option ] ) || empty( $field[ $option ] ); |
|
| 672 | + return ! isset( $field[$option] ) || empty( $field[$option] ); |
|
| 673 | 673 | } |
| 674 | 674 | |
| 675 | 675 | public static function is_option_empty_in_object( $field, $option ) { |
| 676 | - return ! isset( $field->field_options[ $option ] ) || empty( $field->field_options[ $option ] ); |
|
| 676 | + return ! isset( $field->field_options[$option] ) || empty( $field->field_options[$option] ); |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | public static function is_option_value_in_object( $field, $option ) { |
| 680 | - return isset( $field->field_options[ $option ] ) && $field->field_options[ $option ] != ''; |
|
| 680 | + return isset( $field->field_options[$option] ) && $field->field_options[$option] != ''; |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | /** |
@@ -693,11 +693,11 @@ discard block |
||
| 693 | 693 | } |
| 694 | 694 | |
| 695 | 695 | public static function get_option_in_array( $field, $option ) { |
| 696 | - return $field[ $option ]; |
|
| 696 | + return $field[$option]; |
|
| 697 | 697 | } |
| 698 | 698 | |
| 699 | 699 | public static function get_option_in_object( $field, $option ) { |
| 700 | - return isset( $field->field_options[ $option ] ) ? $field->field_options[ $option ] : ''; |
|
| 700 | + return isset( $field->field_options[$option] ) ? $field->field_options[$option] : ''; |
|
| 701 | 701 | } |
| 702 | 702 | |
| 703 | 703 | /** |
@@ -37,20 +37,20 @@ discard block |
||
| 37 | 37 | $atts['id'] = $atts['entry']->id; |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - if ( ! $atts['fields'] || ! is_array($atts['fields']) ) { |
|
| 40 | + if ( ! $atts['fields'] || ! is_array( $atts['fields'] ) ) { |
|
| 41 | 41 | $atts['fields'] = FrmField::get_all_for_form( $atts['form_id'], '', 'include' ); |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | $values = array(); |
| 45 | 45 | foreach ( $atts['fields'] as $f ) { |
| 46 | 46 | self::fill_entry_values( $atts, $f, $values ); |
| 47 | - unset($f); |
|
| 47 | + unset( $f ); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | self::fill_entry_user_info( $atts, $values ); |
| 51 | 51 | |
| 52 | 52 | if ( $atts['format'] == 'json' ) { |
| 53 | - return json_encode($values); |
|
| 53 | + return json_encode( $values ); |
|
| 54 | 54 | } else if ( $atts['format'] == 'array' ) { |
| 55 | 55 | return $values; |
| 56 | 56 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | self::convert_entry_to_content( $values, $atts, $content ); |
| 60 | 60 | |
| 61 | 61 | if ( 'text' == $atts['format'] ) { |
| 62 | - $content = implode('', $content); |
|
| 62 | + $content = implode( '', $content ); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | if ( $atts['clickable'] ) { |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | $field_id_string = reset( $f->field_options['hide_field'] ) . ' show=' . $f->field_options['form_select']; |
| 86 | - $values[ $f->id ] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $field_id_string . ']' ); |
|
| 86 | + $values[$f->id] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $field_id_string . ']' ); |
|
| 87 | 87 | } else { |
| 88 | - $values[ $f->id ] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $f->id . ']' ); |
|
| 88 | + $values[$f->id] = array( 'label' => '[' . $f->id . ' show=field_label]', 'val' => '[' . $f->id . ']' ); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | return; |
| 100 | 100 | } |
| 101 | 101 | |
| 102 | - if ( $atts['entry'] && ! isset( $atts['entry']->metas[ $f->id ] ) ) { |
|
| 102 | + if ( $atts['entry'] && ! isset( $atts['entry']->metas[$f->id] ) ) { |
|
| 103 | 103 | // In case include_blank is set |
| 104 | - $atts['entry']->metas[ $f->id ] = ''; |
|
| 104 | + $atts['entry']->metas[$f->id] = ''; |
|
| 105 | 105 | |
| 106 | 106 | if ( FrmAppHelper::pro_is_installed() ) { |
| 107 | 107 | FrmProEntryMeta::add_post_value_to_entry( $f, $atts['entry'] ); |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | $val = ''; |
| 113 | 113 | if ( $atts['entry'] ) { |
| 114 | - $prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] ); |
|
| 114 | + $prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] ); |
|
| 115 | 115 | $meta = array( 'item_id' => $atts['id'], 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type ); |
| 116 | 116 | |
| 117 | 117 | //This filter applies to the default-message shortcode and frm-show-entry shortcode only |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | self::maybe_strip_html( $atts['plain_text'], $val ); |
| 137 | 137 | |
| 138 | 138 | if ( $atts['format'] != 'text' ) { |
| 139 | - $values[ $f->field_key ] = $val; |
|
| 139 | + $values[$f->field_key] = $val; |
|
| 140 | 140 | if ( isset( $prev_val ) && $prev_val != $val && $f->type != 'textarea' ) { |
| 141 | - $values[ $f->field_key . '-value' ] = $prev_val; |
|
| 141 | + $values[$f->field_key . '-value'] = $prev_val; |
|
| 142 | 142 | } |
| 143 | 143 | } else { |
| 144 | - $values[ $f->id ] = array( 'label' => $f->name, 'val' => $val ); |
|
| 144 | + $values[$f->id] = array( 'label' => $f->name, 'val' => $val ); |
|
| 145 | 145 | } |
| 146 | 146 | } |
| 147 | 147 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | return; |
| 188 | 188 | } |
| 189 | 189 | |
| 190 | - $data = self::get_entry_description_data( $atts ); |
|
| 190 | + $data = self::get_entry_description_data( $atts ); |
|
| 191 | 191 | |
| 192 | 192 | if ( $atts['default_email'] ) { |
| 193 | 193 | $atts['entry']->ip = '[ip]'; |
@@ -274,7 +274,7 @@ discard block |
||
| 274 | 274 | preg_match_all( $pattern, $u_agent, $matches ); // get the matching numbers |
| 275 | 275 | |
| 276 | 276 | // see how many we have |
| 277 | - $i = count($matches['browser']); |
|
| 277 | + $i = count( $matches['browser'] ); |
|
| 278 | 278 | if ( $i != 1 ) { |
| 279 | 279 | //we will have two since we are not using 'other' argument yet |
| 280 | 280 | //see if version is before or after the name |
@@ -311,15 +311,15 @@ discard block |
||
| 311 | 311 | |
| 312 | 312 | // merge defaults, global settings, and shortcode options |
| 313 | 313 | foreach ( $default_settings as $key => $setting ) { |
| 314 | - if ( $atts[ $key ] != '' ) { |
|
| 314 | + if ( $atts[$key] != '' ) { |
|
| 315 | 315 | continue; |
| 316 | 316 | } |
| 317 | 317 | |
| 318 | - $atts[ $key ] = $setting; |
|
| 318 | + $atts[$key] = $setting; |
|
| 319 | 319 | unset( $key, $setting ); |
| 320 | 320 | } |
| 321 | 321 | |
| 322 | - unset($default_settings); |
|
| 322 | + unset( $default_settings ); |
|
| 323 | 323 | |
| 324 | 324 | $content[] = '<table cellspacing="0" style="font-size:' . $atts['font_size'] . ';line-height:135%; border-bottom:' . $atts['border_width'] . ' solid #' . $atts['border_color'] . ';"><tbody>' . "\r\n"; |
| 325 | 325 | $atts['bg_color'] = ' style="background-color:#' . $atts['bg_color'] . ';"'; |
@@ -342,7 +342,7 @@ discard block |
||
| 342 | 342 | continue; |
| 343 | 343 | } |
| 344 | 344 | |
| 345 | - if ( $atts['default_email'] && is_numeric($id) ) { |
|
| 345 | + if ( $atts['default_email'] && is_numeric( $id ) ) { |
|
| 346 | 346 | $content[] = '[if ' . $id . ']<tr style="[frm-alt-color]">'; |
| 347 | 347 | } else { |
| 348 | 348 | $content[] = '<tr' . ( $odd ? $atts['bg_color'] : $bg_color_alt ) . '>'; |
@@ -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 | |
@@ -20,10 +20,10 @@ discard block |
||
| 20 | 20 | 'meta_value' => is_array( $meta_value ) ? serialize( array_filter( $meta_value, 'FrmAppHelper::is_not_empty_value' ) ) : trim( $meta_value ), |
| 21 | 21 | 'item_id' => $entry_id, |
| 22 | 22 | 'field_id' => $field_id, |
| 23 | - 'created_at' => current_time('mysql', 1), |
|
| 23 | + 'created_at' => current_time( 'mysql', 1 ), |
|
| 24 | 24 | ); |
| 25 | 25 | |
| 26 | - $new_values = apply_filters('frm_add_entry_meta', $new_values); |
|
| 26 | + $new_values = apply_filters( 'frm_add_entry_meta', $new_values ); |
|
| 27 | 27 | |
| 28 | 28 | $query_results = $wpdb->insert( $wpdb->prefix . 'frm_item_metas', $new_values ); |
| 29 | 29 | |
@@ -49,13 +49,13 @@ discard block |
||
| 49 | 49 | |
| 50 | 50 | $values = $where_values = array( 'item_id' => $entry_id, 'field_id' => $field_id ); |
| 51 | 51 | $values['meta_value'] = $meta_value; |
| 52 | - $values = apply_filters('frm_update_entry_meta', $values); |
|
| 53 | - if ( is_array($values['meta_value']) ) { |
|
| 52 | + $values = apply_filters( 'frm_update_entry_meta', $values ); |
|
| 53 | + if ( is_array( $values['meta_value'] ) ) { |
|
| 54 | 54 | $values['meta_value'] = array_filter( $values['meta_value'], 'FrmAppHelper::is_not_empty_value' ); |
| 55 | 55 | } |
| 56 | - $meta_value = maybe_serialize($values['meta_value']); |
|
| 56 | + $meta_value = maybe_serialize( $values['meta_value'] ); |
|
| 57 | 57 | |
| 58 | - wp_cache_delete( $entry_id, 'frm_entry'); |
|
| 58 | + wp_cache_delete( $entry_id, 'frm_entry' ); |
|
| 59 | 59 | self::clear_cache(); |
| 60 | 60 | |
| 61 | 61 | return $wpdb->update( $wpdb->prefix . 'frm_item_metas', array( 'meta_value' => $meta_value ), $where_values ); |
@@ -70,11 +70,11 @@ discard block |
||
| 70 | 70 | // set the value for the file upload field and add new tags (in Pro version) |
| 71 | 71 | $meta_value = apply_filters( 'frm_prepare_data_before_db', $meta_value, $field_id, $entry_id ); |
| 72 | 72 | |
| 73 | - if ( $prev_values && in_array($field_id, $prev_values) ) { |
|
| 73 | + if ( $prev_values && in_array( $field_id, $prev_values ) ) { |
|
| 74 | 74 | |
| 75 | 75 | if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) == '' ) ) { |
| 76 | 76 | // remove blank fields |
| 77 | - unset( $values[ $field_id ] ); |
|
| 77 | + unset( $values[$field_id] ); |
|
| 78 | 78 | } else { |
| 79 | 79 | // if value exists, then update it |
| 80 | 80 | self::update_entry_meta( $entry_id, $field_id, '', $meta_value ); |
@@ -85,13 +85,13 @@ discard block |
||
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | - if ( empty($prev_values) ) { |
|
| 88 | + if ( empty( $prev_values ) ) { |
|
| 89 | 89 | return; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | - $prev_values = array_diff($prev_values, array_keys($values)); |
|
| 92 | + $prev_values = array_diff( $prev_values, array_keys( $values ) ); |
|
| 93 | 93 | |
| 94 | - if ( empty($prev_values) ) { |
|
| 94 | + if ( empty( $prev_values ) ) { |
|
| 95 | 95 | return; |
| 96 | 96 | } |
| 97 | 97 | |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | } |
| 106 | 106 | |
| 107 | 107 | public static function duplicate_entry_metas( $old_id, $new_id ) { |
| 108 | - $metas = self::get_entry_meta_info($old_id); |
|
| 108 | + $metas = self::get_entry_meta_info( $old_id ); |
|
| 109 | 109 | foreach ( $metas as $meta ) { |
| 110 | - self::add_entry_meta($new_id, $meta->field_id, null, $meta->meta_value); |
|
| 111 | - unset($meta); |
|
| 110 | + self::add_entry_meta( $new_id, $meta->field_id, null, $meta->meta_value ); |
|
| 111 | + unset( $meta ); |
|
| 112 | 112 | } |
| 113 | 113 | self::clear_cache(); |
| 114 | 114 | } |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | public static function delete_entry_meta( $entry_id, $field_id ) { |
| 117 | 117 | global $wpdb; |
| 118 | 118 | self::clear_cache(); |
| 119 | - return $wpdb->query($wpdb->prepare("DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id)); |
|
| 119 | + return $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}frm_item_metas WHERE field_id=%d AND item_id=%d", $field_id, $entry_id ) ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | */ |
| 136 | 136 | public static function get_meta_value( $entry, $field_id ) { |
| 137 | 137 | if ( isset( $entry->metas ) ) { |
| 138 | - return isset( $entry->metas[ $field_id ] ) ? $entry->metas[ $field_id ] : false; |
|
| 138 | + return isset( $entry->metas[$field_id] ) ? $entry->metas[$field_id] : false; |
|
| 139 | 139 | } else { |
| 140 | 140 | return self::get_entry_meta_by_field( $entry->id, $field_id ); |
| 141 | 141 | } |
@@ -153,14 +153,14 @@ discard block |
||
| 153 | 153 | $cached = FrmAppHelper::check_cache( $entry_id, 'frm_entry' ); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) { |
|
| 157 | - $result = $cached->metas[ $field_id ]; |
|
| 158 | - return stripslashes_deep($result); |
|
| 156 | + if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) { |
|
| 157 | + $result = $cached->metas[$field_id]; |
|
| 158 | + return stripslashes_deep( $result ); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | $get_table = $wpdb->prefix . 'frm_item_metas'; |
| 162 | 162 | $query = array( 'item_id' => $entry_id ); |
| 163 | - if ( is_numeric($field_id) ) { |
|
| 163 | + if ( is_numeric( $field_id ) ) { |
|
| 164 | 164 | $query['field_id'] = $field_id; |
| 165 | 165 | } else { |
| 166 | 166 | $get_table .= ' it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $result = FrmDb::get_var( $get_table, $query, 'meta_value' ); |
| 171 | - $result = maybe_unserialize($result); |
|
| 172 | - $result = stripslashes_deep($result); |
|
| 171 | + $result = maybe_unserialize( $result ); |
|
| 172 | + $result = stripslashes_deep( $result ); |
|
| 173 | 173 | |
| 174 | 174 | return $result; |
| 175 | 175 | } |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | public static function get_entry_metas( $entry_id ) { |
| 183 | - _deprecated_function( __FUNCTION__, '1.07.10'); |
|
| 183 | + _deprecated_function( __FUNCTION__, '1.07.10' ); |
|
| 184 | 184 | |
| 185 | 185 | global $wpdb; |
| 186 | 186 | return FrmDb::get_col( $wpdb->prefix . 'frm_item_metas', array( 'item_id' => $entry_id ), 'meta_value' ); |
@@ -191,22 +191,22 @@ discard block |
||
| 191 | 191 | $args = wp_parse_args( $args, $defaults ); |
| 192 | 192 | |
| 193 | 193 | $query = array(); |
| 194 | - self::meta_field_query($field_id, $order, $limit, $args, $query); |
|
| 195 | - $query = implode(' ', $query); |
|
| 194 | + self::meta_field_query( $field_id, $order, $limit, $args, $query ); |
|
| 195 | + $query = implode( ' ', $query ); |
|
| 196 | 196 | |
| 197 | 197 | $cache_key = 'entry_metas_for_field_' . $field_id . $order . $limit . maybe_serialize( $args ); |
| 198 | - $values = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, 'get_col'); |
|
| 198 | + $values = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, 'get_col' ); |
|
| 199 | 199 | |
| 200 | 200 | if ( ! $args['stripslashes'] ) { |
| 201 | 201 | return $values; |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | foreach ( $values as $k => $v ) { |
| 205 | - $values[ $k ] = maybe_unserialize( $v ); |
|
| 206 | - unset($k, $v); |
|
| 205 | + $values[$k] = maybe_unserialize( $v ); |
|
| 206 | + unset( $k, $v ); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - return stripslashes_deep($values); |
|
| 209 | + return stripslashes_deep( $values ); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | /** |
@@ -223,8 +223,8 @@ discard block |
||
| 223 | 223 | $query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=em.item_id)'; |
| 224 | 224 | } |
| 225 | 225 | |
| 226 | - if ( is_numeric($field_id) ) { |
|
| 227 | - $query[] = $wpdb->prepare('WHERE em.field_id=%d', $field_id); |
|
| 226 | + if ( is_numeric( $field_id ) ) { |
|
| 227 | + $query[] = $wpdb->prepare( 'WHERE em.field_id=%d', $field_id ); |
|
| 228 | 228 | } else { |
| 229 | 229 | $query[] = $wpdb->prepare( 'LEFT JOIN ' . $wpdb->prefix . 'frm_fields fi ON (em.field_id = fi.id) WHERE fi.field_key=%s', $field_id ); |
| 230 | 230 | } |
@@ -234,7 +234,7 @@ discard block |
||
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | if ( $args['value'] ) { |
| 237 | - $query[] = $wpdb->prepare(' AND meta_value=%s', $args['value']); |
|
| 237 | + $query[] = $wpdb->prepare( ' AND meta_value=%s', $args['value'] ); |
|
| 238 | 238 | } |
| 239 | 239 | $query[] = $order . $limit; |
| 240 | 240 | } |
@@ -248,18 +248,18 @@ discard block |
||
| 248 | 248 | $query = 'SELECT it.*, fi.type as field_type, fi.field_key as field_key, |
| 249 | 249 | fi.required as required, fi.form_id as field_form_id, fi.name as field_name, fi.options as fi_options |
| 250 | 250 | FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id' . |
| 251 | - FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
| 251 | + FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
|
| 252 | 252 | |
| 253 | 253 | $cache_key = 'all_' . maybe_serialize( $where ) . $order_by . $limit; |
| 254 | - $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_row' : 'get_results')); |
|
| 254 | + $results = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, ( $limit == ' LIMIT 1' ? 'get_row' : 'get_results' ) ); |
|
| 255 | 255 | |
| 256 | 256 | if ( ! $results || ! $stripslashes ) { |
| 257 | 257 | return $results; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | foreach ( $results as $k => $result ) { |
| 261 | - $results[ $k ]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) ); |
|
| 262 | - unset($k, $result); |
|
| 261 | + $results[$k]->meta_value = stripslashes_deep( maybe_unserialize( $result->meta_value ) ); |
|
| 262 | + unset( $k, $result ); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | return $results; |
@@ -271,14 +271,14 @@ discard block |
||
| 271 | 271 | 'user_id' => '', |
| 272 | 272 | 'group_by' => '', |
| 273 | 273 | ); |
| 274 | - $args = wp_parse_args($args, $defaults); |
|
| 274 | + $args = wp_parse_args( $args, $defaults ); |
|
| 275 | 275 | |
| 276 | 276 | $query = array(); |
| 277 | - self::get_ids_query($where, $order_by, $limit, $unique, $args, $query ); |
|
| 278 | - $query = implode(' ', $query); |
|
| 277 | + self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query ); |
|
| 278 | + $query = implode( ' ', $query ); |
|
| 279 | 279 | |
| 280 | 280 | $cache_key = 'ids_' . maybe_serialize( $where ) . $order_by . 'l' . $limit . 'u' . $unique . maybe_serialize( $args ); |
| 281 | - $results = FrmAppHelper::check_cache($cache_key, 'frm_entry', $query, ($limit == ' LIMIT 1' ? 'get_var' : 'get_col')); |
|
| 281 | + $results = FrmAppHelper::check_cache( $cache_key, 'frm_entry', $query, ( $limit == ' LIMIT 1' ? 'get_var' : 'get_col' ) ); |
|
| 282 | 282 | |
| 283 | 283 | return $results; |
| 284 | 284 | } |
@@ -304,17 +304,17 @@ discard block |
||
| 304 | 304 | $query[] = 'FROM ' . $wpdb->prefix . 'frm_item_metas it LEFT OUTER JOIN ' . $wpdb->prefix . 'frm_fields fi ON it.field_id=fi.id'; |
| 305 | 305 | |
| 306 | 306 | $query[] = 'INNER JOIN ' . $wpdb->prefix . 'frm_items e ON (e.id=it.item_id)'; |
| 307 | - if ( is_array($where) ) { |
|
| 307 | + if ( is_array( $where ) ) { |
|
| 308 | 308 | if ( ! $args['is_draft'] ) { |
| 309 | 309 | $where['e.is_draft'] = 0; |
| 310 | 310 | } else if ( $args['is_draft'] == 1 ) { |
| 311 | 311 | $where['e.is_draft'] = 1; |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | - if ( ! empty($args['user_id']) ) { |
|
| 314 | + if ( ! empty( $args['user_id'] ) ) { |
|
| 315 | 315 | $where['e.user_id'] = $args['user_id']; |
| 316 | 316 | } |
| 317 | - $query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
| 317 | + $query[] = FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
|
| 318 | 318 | |
| 319 | 319 | if ( $args['group_by'] ) { |
| 320 | 320 | $query[] = ' GROUP BY ' . sanitize_text_field( $args['group_by'] ); |
@@ -329,13 +329,13 @@ discard block |
||
| 329 | 329 | $draft_where = $wpdb->prepare( ' AND e.is_draft=%d', 1 ); |
| 330 | 330 | } |
| 331 | 331 | |
| 332 | - if ( ! empty($args['user_id']) ) { |
|
| 333 | - $user_where = $wpdb->prepare(' AND e.user_id=%d', $args['user_id']); |
|
| 332 | + if ( ! empty( $args['user_id'] ) ) { |
|
| 333 | + $user_where = $wpdb->prepare( ' AND e.user_id=%d', $args['user_id'] ); |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | - if ( strpos($where, ' GROUP BY ') ) { |
|
| 336 | + if ( strpos( $where, ' GROUP BY ' ) ) { |
|
| 337 | 337 | // don't inject WHERE filtering after GROUP BY |
| 338 | - $parts = explode(' GROUP BY ', $where); |
|
| 338 | + $parts = explode( ' GROUP BY ', $where ); |
|
| 339 | 339 | $where = $parts[0]; |
| 340 | 340 | $where .= $draft_where . $user_where; |
| 341 | 341 | $where .= ' GROUP BY ' . $parts[1]; |
@@ -344,12 +344,12 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | // The query has already been prepared |
| 347 | - $query[] = FrmAppHelper::prepend_and_or_where(' WHERE ', $where) . $order_by . $limit; |
|
| 347 | + $query[] = FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ) . $order_by . $limit; |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | public static function search_entry_metas( $search, $field_id = '', $operator ) { |
| 351 | 351 | $cache_key = 'search_' . maybe_serialize( $search ) . $field_id . $operator; |
| 352 | - $results = wp_cache_get($cache_key, 'frm_entry'); |
|
| 352 | + $results = wp_cache_get( $cache_key, 'frm_entry' ); |
|
| 353 | 353 | if ( false !== $results ) { |
| 354 | 354 | return $results; |
| 355 | 355 | } |
@@ -372,19 +372,19 @@ discard block |
||
| 372 | 372 | case 'day': |
| 373 | 373 | $value = '%' . $value . '%'; |
| 374 | 374 | } |
| 375 | - $where .= $wpdb->prepare(' meta_value ' . $operator . ' %s and', $value ); |
|
| 375 | + $where .= $wpdb->prepare( ' meta_value ' . $operator . ' %s and', $value ); |
|
| 376 | 376 | } |
| 377 | - $where .= $wpdb->prepare(' field_id=%d', $field_id); |
|
| 377 | + $where .= $wpdb->prepare( ' field_id=%d', $field_id ); |
|
| 378 | 378 | $query = 'SELECT DISTINCT item_id FROM ' . $wpdb->prefix . 'frm_item_metas' . FrmAppHelper::prepend_and_or_where( ' WHERE ', $where ); |
| 379 | 379 | } else { |
| 380 | 380 | if ( $operator == 'LIKE' ) { |
| 381 | 381 | $search = '%' . $search . '%'; |
| 382 | 382 | } |
| 383 | - $query = $wpdb->prepare("SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id); |
|
| 383 | + $query = $wpdb->prepare( "SELECT DISTINCT item_id FROM {$wpdb->prefix}frm_item_metas WHERE meta_value {$operator} %s and field_id = %d", $search, $field_id ); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | - $results = $wpdb->get_col($query, 0); |
|
| 387 | - wp_cache_set($cache_key, $results, 'frm_entry', 300); |
|
| 386 | + $results = $wpdb->get_col( $query, 0 ); |
|
| 387 | + wp_cache_set( $cache_key, $results, 'frm_entry', 300 ); |
|
| 388 | 388 | |
| 389 | 389 | return $results; |
| 390 | 390 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | public static function menu() { |
| 6 | 6 | FrmAppHelper::force_capability( 'frm_view_entries' ); |
| 7 | 7 | |
| 8 | - add_submenu_page('formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
| 8 | + add_submenu_page( 'formidable', 'Formidable | ' . __( 'Entries', 'formidable' ), __( 'Entries', 'formidable' ), 'frm_view_entries', 'formidable-entries', 'FrmEntriesController::route' ); |
|
| 9 | 9 | |
| 10 | 10 | if ( ! in_array( FrmAppHelper::simple_get( 'frm_action', 'sanitize_title' ), array( 'edit', 'show' ) ) ) { |
| 11 | 11 | $menu_name = FrmAppHelper::get_menu_name(); |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'id' => 'formidable-entries-tab', |
| 54 | 54 | 'title' => __( 'Overview', 'formidable' ), |
| 55 | 55 | 'content' => '<p>' . esc_html__( 'This screen provides access to all of your entries. You can customize the display of this screen to suit your workflow.', 'formidable' ) . '</p> <p>' . esc_html__( 'Hovering over a row in the entries list will display action links that allow you to manage your entry.', 'formidable' ) . '</p>', |
| 56 | - )); |
|
| 56 | + ) ); |
|
| 57 | 57 | |
| 58 | 58 | $screen->set_help_sidebar( |
| 59 | 59 | '<p><strong>' . esc_html__( 'For more information:', 'formidable' ) . '</strong></p>' . |
@@ -68,14 +68,14 @@ discard block |
||
| 68 | 68 | global $frm_vars, $wpdb; |
| 69 | 69 | $form_id = FrmForm::get_current_form_id(); |
| 70 | 70 | |
| 71 | - $columns[ $form_id . '_id' ] = 'ID'; |
|
| 72 | - $columns[ $form_id . '_item_key' ] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 71 | + $columns[$form_id . '_id'] = 'ID'; |
|
| 72 | + $columns[$form_id . '_item_key'] = esc_html__( 'Entry Key', 'formidable' ); |
|
| 73 | 73 | |
| 74 | 74 | if ( ! $form_id ) { |
| 75 | 75 | return $columns; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | - $form_cols = FrmField::get_all_for_form($form_id, '', 'include'); |
|
| 78 | + $form_cols = FrmField::get_all_for_form( $form_id, '', 'include' ); |
|
| 79 | 79 | |
| 80 | 80 | foreach ( $form_cols as $form_col ) { |
| 81 | 81 | if ( FrmField::is_no_save_field( $form_col->type ) ) { |
@@ -88,30 +88,30 @@ discard block |
||
| 88 | 88 | if ( $sub_form_cols ) { |
| 89 | 89 | foreach ( $sub_form_cols as $k => $sub_form_col ) { |
| 90 | 90 | if ( FrmField::is_no_save_field( $sub_form_col->type ) ) { |
| 91 | - unset( $sub_form_cols[ $k ] ); |
|
| 91 | + unset( $sub_form_cols[$k] ); |
|
| 92 | 92 | continue; |
| 93 | 93 | } |
| 94 | - $columns[ $form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id ] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 95 | - unset($sub_form_col); |
|
| 94 | + $columns[$form_id . '_' . $sub_form_col->field_key . '-_-' . $form_col->id] = FrmAppHelper::truncate( $sub_form_col->name, 35 ); |
|
| 95 | + unset( $sub_form_col ); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | - unset($sub_form_cols); |
|
| 98 | + unset( $sub_form_cols ); |
|
| 99 | 99 | } else { |
| 100 | 100 | $col_id = $form_col->field_key; |
| 101 | 101 | if ( $form_col->form_id != $form_id ) { |
| 102 | 102 | $col_id .= '-_-form' . $form_col->form_id; |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - if ( isset($form_col->field_options['separate_value']) && $form_col->field_options['separate_value'] ) { |
|
| 106 | - $columns[ $form_id . '_frmsep_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 105 | + if ( isset( $form_col->field_options['separate_value'] ) && $form_col->field_options['separate_value'] ) { |
|
| 106 | + $columns[$form_id . '_frmsep_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 107 | 107 | } |
| 108 | - $columns[ $form_id . '_' . $col_id ] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 108 | + $columns[$form_id . '_' . $col_id] = FrmAppHelper::truncate( $form_col->name, 35 ); |
|
| 109 | 109 | } |
| 110 | 110 | } |
| 111 | 111 | |
| 112 | - $columns[ $form_id . '_created_at' ] = __( 'Entry creation date', 'formidable' ); |
|
| 113 | - $columns[ $form_id . '_updated_at' ] = __( 'Entry update date', 'formidable' ); |
|
| 114 | - $columns[ $form_id . '_ip' ] = 'IP'; |
|
| 112 | + $columns[$form_id . '_created_at'] = __( 'Entry creation date', 'formidable' ); |
|
| 113 | + $columns[$form_id . '_updated_at'] = __( 'Entry update date', 'formidable' ); |
|
| 114 | + $columns[$form_id . '_ip'] = 'IP'; |
|
| 115 | 115 | |
| 116 | 116 | $frm_vars['cols'] = $columns; |
| 117 | 117 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | |
| 137 | 137 | global $frm_vars; |
| 138 | 138 | //add a check so we don't create a loop |
| 139 | - $frm_vars['prev_hidden_cols'] = ( isset($frm_vars['prev_hidden_cols']) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
| 139 | + $frm_vars['prev_hidden_cols'] = ( isset( $frm_vars['prev_hidden_cols'] ) && $frm_vars['prev_hidden_cols'] ) ? false : $prev_value; |
|
| 140 | 140 | |
| 141 | 141 | return $check; |
| 142 | 142 | } |
@@ -151,19 +151,19 @@ discard block |
||
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | global $frm_vars; |
| 154 | - if ( ! isset($frm_vars['prev_hidden_cols']) || ! $frm_vars['prev_hidden_cols'] ) { |
|
| 154 | + if ( ! isset( $frm_vars['prev_hidden_cols'] ) || ! $frm_vars['prev_hidden_cols'] ) { |
|
| 155 | 155 | return; //don't continue if there's no previous value |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | foreach ( $meta_value as $mk => $mv ) { |
| 159 | 159 | //remove blank values |
| 160 | - if ( empty( $mv ) ) { |
|
| 161 | - unset( $meta_value[ $mk ] ); |
|
| 160 | + if ( empty( $mv ) ) { |
|
| 161 | + unset( $meta_value[$mk] ); |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | - $cur_form_prefix = reset($meta_value); |
|
| 166 | - $cur_form_prefix = explode('_', $cur_form_prefix); |
|
| 165 | + $cur_form_prefix = reset( $meta_value ); |
|
| 166 | + $cur_form_prefix = explode( '_', $cur_form_prefix ); |
|
| 167 | 167 | $cur_form_prefix = $cur_form_prefix[0]; |
| 168 | 168 | $save = false; |
| 169 | 169 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | |
| 183 | 183 | $meta_value[] = $prev_hidden; |
| 184 | 184 | $save = true; |
| 185 | - unset($form_prefix); |
|
| 185 | + unset( $form_prefix ); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | if ( $save ) { |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | foreach ( $fields as $field ) { |
| 215 | 215 | if ( $field->type != 'checkbox' && ( ! isset( $field->field_options['post_field'] ) || $field->field_options['post_field'] == '' ) ) { |
| 216 | 216 | // Can't sort on checkboxes because they are stored serialized, or post fields |
| 217 | - $columns[ $form_id . '_' . $field->field_key ] = 'meta_' . $field->id; |
|
| 217 | + $columns[$form_id . '_' . $field->field_key] = 'meta_' . $field->id; |
|
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | |
@@ -237,7 +237,7 @@ discard block |
||
| 237 | 237 | break; |
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - unset($form_prefix); |
|
| 240 | + unset( $form_prefix ); |
|
| 241 | 241 | } |
| 242 | 242 | } |
| 243 | 243 | |
@@ -245,36 +245,36 @@ discard block |
||
| 245 | 245 | return $result; |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - $i = isset($frm_vars['cols']) ? count($frm_vars['cols']) : 0; |
|
| 248 | + $i = isset( $frm_vars['cols'] ) ? count( $frm_vars['cols'] ) : 0; |
|
| 249 | 249 | $max_columns = 8; |
| 250 | 250 | if ( $i <= $max_columns ) { |
| 251 | 251 | return $result; |
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | global $frm_vars; |
| 255 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] ) { |
|
| 256 | - $frm_vars['current_form']->options = maybe_unserialize($frm_vars['current_form']->options); |
|
| 255 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] ) { |
|
| 256 | + $frm_vars['current_form']->options = maybe_unserialize( $frm_vars['current_form']->options ); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - if ( isset($frm_vars['current_form']) && $frm_vars['current_form'] && isset($frm_vars['current_form']->options['hidden_cols']) && ! empty($frm_vars['current_form']->options['hidden_cols']) ) { |
|
| 259 | + if ( isset( $frm_vars['current_form'] ) && $frm_vars['current_form'] && isset( $frm_vars['current_form']->options['hidden_cols'] ) && ! empty( $frm_vars['current_form']->options['hidden_cols'] ) ) { |
|
| 260 | 260 | $result = $frm_vars['current_form']->options['hidden_cols']; |
| 261 | 261 | } else { |
| 262 | 262 | $cols = $frm_vars['cols']; |
| 263 | - $cols = array_reverse($cols, true); |
|
| 263 | + $cols = array_reverse( $cols, true ); |
|
| 264 | 264 | |
| 265 | 265 | $result[] = $form_id . '_id'; |
| 266 | - $i--; |
|
| 266 | + $i --; |
|
| 267 | 267 | |
| 268 | 268 | $result[] = $form_id . '_item_key'; |
| 269 | - $i--; |
|
| 269 | + $i --; |
|
| 270 | 270 | |
| 271 | 271 | foreach ( $cols as $col_key => $col ) { |
| 272 | 272 | if ( $i > $max_columns ) { |
| 273 | 273 | $result[] = $col_key; |
| 274 | 274 | } |
| 275 | 275 | //remove some columns by default |
| 276 | - $i--; |
|
| 277 | - unset($col_key, $col); |
|
| 276 | + $i --; |
|
| 277 | + unset( $col_key, $col ); |
|
| 278 | 278 | } |
| 279 | 279 | } |
| 280 | 280 | |
@@ -311,14 +311,14 @@ discard block |
||
| 311 | 311 | if ( $pagenum > $total_pages && $total_pages > 0 ) { |
| 312 | 312 | $url = add_query_arg( 'paged', $total_pages ); |
| 313 | 313 | if ( headers_sent() ) { |
| 314 | - echo FrmAppHelper::js_redirect($url); |
|
| 314 | + echo FrmAppHelper::js_redirect( $url ); |
|
| 315 | 315 | } else { |
| 316 | 316 | wp_redirect( esc_url_raw( $url ) ); |
| 317 | 317 | } |
| 318 | 318 | die(); |
| 319 | 319 | } |
| 320 | 320 | |
| 321 | - if ( empty($message) && isset($_GET['import-message']) ) { |
|
| 321 | + if ( empty( $message ) && isset( $_GET['import-message'] ) ) { |
|
| 322 | 322 | $message = __( 'Your import is complete', 'formidable' ); |
| 323 | 323 | } |
| 324 | 324 | |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | /* Back End CRUD */ |
| 329 | 329 | public static function show( $id = 0 ) { |
| 330 | - FrmAppHelper::permission_check('frm_view_entries'); |
|
| 330 | + FrmAppHelper::permission_check( 'frm_view_entries' ); |
|
| 331 | 331 | |
| 332 | 332 | if ( ! $id ) { |
| 333 | 333 | $id = FrmAppHelper::get_param( 'id', 0, 'get', 'absint' ); |
@@ -337,9 +337,9 @@ discard block |
||
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | - $entry = FrmEntry::getOne($id, true); |
|
| 340 | + $entry = FrmEntry::getOne( $id, true ); |
|
| 341 | 341 | |
| 342 | - $data = maybe_unserialize($entry->description); |
|
| 342 | + $data = maybe_unserialize( $entry->description ); |
|
| 343 | 343 | if ( ! is_array( $data ) || ! isset( $data['referrer'] ) ) { |
| 344 | 344 | $data = array( 'referrer' => $data ); |
| 345 | 345 | } |
@@ -351,11 +351,11 @@ discard block |
||
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | public static function destroy() { |
| 354 | - FrmAppHelper::permission_check('frm_delete_entries'); |
|
| 354 | + FrmAppHelper::permission_check( 'frm_delete_entries' ); |
|
| 355 | 355 | |
| 356 | 356 | $params = FrmForm::get_admin_params(); |
| 357 | 357 | |
| 358 | - if ( isset($params['keep_post']) && $params['keep_post'] ) { |
|
| 358 | + if ( isset( $params['keep_post'] ) && $params['keep_post'] ) { |
|
| 359 | 359 | //unlink entry from post |
| 360 | 360 | global $wpdb; |
| 361 | 361 | $wpdb->update( $wpdb->prefix . 'frm_items', array( 'post_id' => '' ), array( 'id' => $params['id'] ) ); |
@@ -433,9 +433,9 @@ discard block |
||
| 433 | 433 | if ( ! isset( $frm_vars['form_params'] ) ) { |
| 434 | 434 | $frm_vars['form_params'] = array(); |
| 435 | 435 | } |
| 436 | - $frm_vars['form_params'][ $form->id ] = $params; |
|
| 436 | + $frm_vars['form_params'][$form->id] = $params; |
|
| 437 | 437 | |
| 438 | - if ( isset( $frm_vars['created_entries'][ $form_id ] ) ) { |
|
| 438 | + if ( isset( $frm_vars['created_entries'][$form_id] ) ) { |
|
| 439 | 439 | return; |
| 440 | 440 | } |
| 441 | 441 | |
@@ -450,13 +450,13 @@ discard block |
||
| 450 | 450 | */ |
| 451 | 451 | $errors = apply_filters( 'frm_entries_before_create', $errors, $form ); |
| 452 | 452 | |
| 453 | - $frm_vars['created_entries'][ $form_id ] = array( 'errors' => $errors ); |
|
| 453 | + $frm_vars['created_entries'][$form_id] = array( 'errors' => $errors ); |
|
| 454 | 454 | |
| 455 | 455 | if ( empty( $errors ) ) { |
| 456 | 456 | $_POST['frm_skip_cookie'] = 1; |
| 457 | 457 | if ( $params['action'] == 'create' ) { |
| 458 | - if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][ $form_id ]['entry_id'] ) ) { |
|
| 459 | - $frm_vars['created_entries'][ $form_id ]['entry_id'] = FrmEntry::create( $_POST ); |
|
| 458 | + if ( apply_filters( 'frm_continue_to_create', true, $form_id ) && ! isset( $frm_vars['created_entries'][$form_id]['entry_id'] ) ) { |
|
| 459 | + $frm_vars['created_entries'][$form_id]['entry_id'] = FrmEntry::create( $_POST ); |
|
| 460 | 460 | } |
| 461 | 461 | } |
| 462 | 462 | |
@@ -491,28 +491,28 @@ discard block |
||
| 491 | 491 | } |
| 492 | 492 | |
| 493 | 493 | public static function &filter_email_value( $value, $meta, $entry, $atts = array() ) { |
| 494 | - $field = FrmField::getOne($meta->field_id); |
|
| 494 | + $field = FrmField::getOne( $meta->field_id ); |
|
| 495 | 495 | if ( ! $field ) { |
| 496 | 496 | return $value; |
| 497 | 497 | } |
| 498 | 498 | |
| 499 | - $value = self::filter_display_value($value, $field, $atts); |
|
| 499 | + $value = self::filter_display_value( $value, $field, $atts ); |
|
| 500 | 500 | return $value; |
| 501 | 501 | } |
| 502 | 502 | |
| 503 | 503 | public static function &filter_shortcode_value( $value, $tag, $atts, $field ) { |
| 504 | - $plain_text = add_filter('frm_plain_text_email', true); |
|
| 504 | + $plain_text = add_filter( 'frm_plain_text_email', true ); |
|
| 505 | 505 | FrmEntryFormat::textarea_display_value( $field->type, $plain_text, $value ); |
| 506 | 506 | |
| 507 | - if ( isset($atts['show']) && $atts['show'] == 'value' ) { |
|
| 507 | + if ( isset( $atts['show'] ) && $atts['show'] == 'value' ) { |
|
| 508 | 508 | return $value; |
| 509 | 509 | } |
| 510 | 510 | |
| 511 | - return self::filter_display_value($value, $field, $atts); |
|
| 511 | + return self::filter_display_value( $value, $field, $atts ); |
|
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | public static function &filter_display_value( $value, $field, $atts = array() ) { |
| 515 | - $saved_value = ( isset($atts['saved_value']) && $atts['saved_value'] ) ? true : false; |
|
| 515 | + $saved_value = ( isset( $atts['saved_value'] ) && $atts['saved_value'] ) ? true : false; |
|
| 516 | 516 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'radio', 'select' ) ) || ! FrmField::is_option_true( $field, 'separate_value' ) || $saved_value ) { |
| 517 | 517 | return $value; |
| 518 | 518 | } |
@@ -520,29 +520,29 @@ discard block |
||
| 520 | 520 | $f_values = $f_labels = array(); |
| 521 | 521 | |
| 522 | 522 | foreach ( $field->options as $opt_key => $opt ) { |
| 523 | - if ( ! is_array($opt) ) { |
|
| 523 | + if ( ! is_array( $opt ) ) { |
|
| 524 | 524 | continue; |
| 525 | 525 | } |
| 526 | 526 | |
| 527 | - $f_labels[ $opt_key ] = isset( $opt['label'] ) ? $opt['label'] : reset($opt); |
|
| 528 | - $f_values[ $opt_key ] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[ $opt_key ]; |
|
| 529 | - if ( $f_labels[ $opt_key ] == $f_values[ $opt_key ] ) { |
|
| 530 | - unset( $f_values[ $opt_key ], $f_labels[ $opt_key ] ); |
|
| 527 | + $f_labels[$opt_key] = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
| 528 | + $f_values[$opt_key] = isset( $opt['value'] ) ? $opt['value'] : $f_labels[$opt_key]; |
|
| 529 | + if ( $f_labels[$opt_key] == $f_values[$opt_key] ) { |
|
| 530 | + unset( $f_values[$opt_key], $f_labels[$opt_key] ); |
|
| 531 | 531 | } |
| 532 | - unset($opt_key, $opt); |
|
| 532 | + unset( $opt_key, $opt ); |
|
| 533 | 533 | } |
| 534 | 534 | |
| 535 | - if ( ! empty($f_values) ) { |
|
| 535 | + if ( ! empty( $f_values ) ) { |
|
| 536 | 536 | foreach ( (array) $value as $v_key => $val ) { |
| 537 | - if ( in_array($val, $f_values) ) { |
|
| 538 | - $opt = array_search($val, $f_values); |
|
| 539 | - if ( is_array($value) ) { |
|
| 540 | - $value[ $v_key ] = $f_labels[ $opt ]; |
|
| 537 | + if ( in_array( $val, $f_values ) ) { |
|
| 538 | + $opt = array_search( $val, $f_values ); |
|
| 539 | + if ( is_array( $value ) ) { |
|
| 540 | + $value[$v_key] = $f_labels[$opt]; |
|
| 541 | 541 | } else { |
| 542 | - $value = $f_labels[ $opt ]; |
|
| 542 | + $value = $f_labels[$opt]; |
|
| 543 | 543 | } |
| 544 | 544 | } |
| 545 | - unset($v_key, $val); |
|
| 545 | + unset( $v_key, $val ); |
|
| 546 | 546 | } |
| 547 | 547 | } |
| 548 | 548 | |
@@ -555,9 +555,9 @@ discard block |
||
| 555 | 555 | } |
| 556 | 556 | |
| 557 | 557 | public static function entry_sidebar( $entry ) { |
| 558 | - $data = maybe_unserialize($entry->description); |
|
| 559 | - $date_format = get_option('date_format'); |
|
| 560 | - $time_format = get_option('time_format'); |
|
| 558 | + $data = maybe_unserialize( $entry->description ); |
|
| 559 | + $date_format = get_option( 'date_format' ); |
|
| 560 | + $time_format = get_option( 'time_format' ); |
|
| 561 | 561 | if ( isset( $data['browser'] ) ) { |
| 562 | 562 | $browser = FrmEntryFormat::get_browser( $data['browser'] ); |
| 563 | 563 | } |
@@ -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,32 +34,32 @@ 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 | } |
| 51 | 51 | |
| 52 | 52 | public static function create() { |
| 53 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 53 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 54 | 54 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 55 | 55 | |
| 56 | 56 | $field_type = FrmAppHelper::get_post_param( 'field', '', 'sanitize_text_field' ); |
| 57 | 57 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
| 58 | 58 | |
| 59 | - $field = self::include_new_field($field_type, $form_id); |
|
| 59 | + $field = self::include_new_field( $field_type, $form_id ); |
|
| 60 | 60 | |
| 61 | 61 | // this hook will allow for multiple fields to be added at once |
| 62 | - do_action('frm_after_field_created', $field, $form_id); |
|
| 62 | + do_action( 'frm_after_field_created', $field, $form_id ); |
|
| 63 | 63 | |
| 64 | 64 | wp_die(); |
| 65 | 65 | } |
@@ -70,23 +70,23 @@ discard block |
||
| 70 | 70 | public static function include_new_field( $field_type, $form_id ) { |
| 71 | 71 | $values = array(); |
| 72 | 72 | if ( FrmAppHelper::pro_is_installed() ) { |
| 73 | - $values['post_type'] = FrmProFormsHelper::post_type($form_id); |
|
| 73 | + $values['post_type'] = FrmProFormsHelper::post_type( $form_id ); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - $field_values = apply_filters('frm_before_field_created', FrmFieldsHelper::setup_new_vars($field_type, $form_id)); |
|
| 76 | + $field_values = apply_filters( 'frm_before_field_created', FrmFieldsHelper::setup_new_vars( $field_type, $form_id ) ); |
|
| 77 | 77 | $field_id = FrmField::create( $field_values ); |
| 78 | 78 | |
| 79 | 79 | if ( ! $field_id ) { |
| 80 | 80 | return false; |
| 81 | 81 | } |
| 82 | 82 | |
| 83 | - $field = self::include_single_field($field_id, $values, $form_id); |
|
| 83 | + $field = self::include_single_field( $field_id, $values, $form_id ); |
|
| 84 | 84 | |
| 85 | 85 | return $field; |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | public static function update_form_id() { |
| 89 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 89 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 90 | 90 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 91 | 91 | |
| 92 | 92 | $field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' ); |
@@ -103,21 +103,21 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | public static function edit_name( $field = 'name', $id = '' ) { |
| 106 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 106 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 107 | 107 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 108 | 108 | |
| 109 | - if ( empty($field) ) { |
|
| 109 | + if ( empty( $field ) ) { |
|
| 110 | 110 | $field = 'name'; |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ( empty($id) ) { |
|
| 113 | + if ( empty( $id ) ) { |
|
| 114 | 114 | $id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
| 115 | 115 | $id = str_replace( 'field_label_', '', $id ); |
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ); |
| 119 | 119 | $value = trim( $value ); |
| 120 | - if ( trim(strip_tags($value)) == '' ) { |
|
| 120 | + if ( trim( strip_tags( $value ) ) == '' ) { |
|
| 121 | 121 | // set blank value if there is no content |
| 122 | 122 | $value = ''; |
| 123 | 123 | } |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | public static function update_ajax_option() { |
| 134 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 134 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 135 | 135 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 136 | 136 | |
| 137 | 137 | $field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' ); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | if ( isset( $_POST['separate_value'] ) ) { |
| 145 | 145 | $new_val = FrmField::is_option_true( $field, 'separate_value' ) ? 0 : 1; |
| 146 | 146 | $field->field_options['separate_value'] = $new_val; |
| 147 | - unset($new_val); |
|
| 147 | + unset( $new_val ); |
|
| 148 | 148 | } |
| 149 | 149 | |
| 150 | 150 | FrmField::update( $field_id, array( |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | public static function duplicate() { |
| 158 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 158 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 159 | 159 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 160 | 160 | |
| 161 | 161 | global $wpdb; |
@@ -178,11 +178,11 @@ discard block |
||
| 178 | 178 | |
| 179 | 179 | $values['field_order'] = $field_count + 1; |
| 180 | 180 | |
| 181 | - if ( ! $field_id = FrmField::create($values) ) { |
|
| 181 | + if ( ! $field_id = FrmField::create( $values ) ) { |
|
| 182 | 182 | wp_die(); |
| 183 | 183 | } |
| 184 | 184 | |
| 185 | - self::include_single_field($field_id, $values); |
|
| 185 | + self::include_single_field( $field_id, $values ); |
|
| 186 | 186 | |
| 187 | 187 | wp_die(); |
| 188 | 188 | } |
@@ -191,9 +191,9 @@ discard block |
||
| 191 | 191 | * Load a single field in the form builder along with all needed variables |
| 192 | 192 | */ |
| 193 | 193 | public static function include_single_field( $field_id, $values, $form_id = 0 ) { |
| 194 | - $field = FrmFieldsHelper::setup_edit_vars(FrmField::getOne($field_id)); |
|
| 194 | + $field = FrmFieldsHelper::setup_edit_vars( FrmField::getOne( $field_id ) ); |
|
| 195 | 195 | $field_name = 'item_meta[' . $field_id . ']'; |
| 196 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
| 196 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
| 197 | 197 | $id = $form_id ? $form_id : $field['form_id']; |
| 198 | 198 | if ( $field['type'] == 'html' ) { |
| 199 | 199 | $field['stop_filter'] = true; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | public static function destroy() { |
| 208 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 208 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 209 | 209 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 210 | 210 | |
| 211 | 211 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
@@ -217,14 +217,14 @@ discard block |
||
| 217 | 217 | |
| 218 | 218 | //Add Single Option or Other Option |
| 219 | 219 | public static function add_option() { |
| 220 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 220 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 221 | 221 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 222 | 222 | |
| 223 | 223 | $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 224 | 224 | $opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' ); |
| 225 | 225 | |
| 226 | 226 | //Get the field |
| 227 | - $field = FrmField::getOne($id); |
|
| 227 | + $field = FrmField::getOne( $id ); |
|
| 228 | 228 | |
| 229 | 229 | if ( ! empty( $field->options ) ) { |
| 230 | 230 | $keys = array_keys( $field->options ); |
@@ -247,13 +247,13 @@ discard block |
||
| 247 | 247 | $first_opt = reset( $field->options ); |
| 248 | 248 | $next_opt = count( $field->options ); |
| 249 | 249 | if ( $first_opt != '' ) { |
| 250 | - $next_opt++; |
|
| 250 | + $next_opt ++; |
|
| 251 | 251 | } |
| 252 | 252 | $opt = esc_html__( 'Option', 'formidable' ) . ' ' . $next_opt; |
| 253 | - unset($next_opt); |
|
| 253 | + unset( $next_opt ); |
|
| 254 | 254 | } |
| 255 | 255 | $field_val = $opt; |
| 256 | - $field->options[ $opt_key ] = $opt; |
|
| 256 | + $field->options[$opt_key] = $opt; |
|
| 257 | 257 | |
| 258 | 258 | //Update options in DB |
| 259 | 259 | FrmField::update( $id, array( 'options' => $field->options ) ); |
@@ -262,13 +262,13 @@ discard block |
||
| 262 | 262 | $field = array( |
| 263 | 263 | 'type' => $field_data->type, |
| 264 | 264 | 'id' => $id, |
| 265 | - 'separate_value' => isset($field_data->field_options['separate_value']) ? $field_data->field_options['separate_value'] : 0, |
|
| 265 | + 'separate_value' => isset( $field_data->field_options['separate_value'] ) ? $field_data->field_options['separate_value'] : 0, |
|
| 266 | 266 | 'form_id' => $field_data->form_id, |
| 267 | 267 | 'field_key' => $field_data->field_key, |
| 268 | 268 | ); |
| 269 | 269 | |
| 270 | 270 | $field_name = 'item_meta[' . $id . ']'; |
| 271 | - $html_id = FrmFieldsHelper::get_html_id($field); |
|
| 271 | + $html_id = FrmFieldsHelper::get_html_id( $field ); |
|
| 272 | 272 | $checked = ''; |
| 273 | 273 | |
| 274 | 274 | if ( 'other' == $opt_type ) { |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | public static function edit_option() { |
| 283 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 283 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 284 | 284 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 285 | 285 | |
| 286 | 286 | $element_id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
@@ -294,28 +294,28 @@ discard block |
||
| 294 | 294 | $new_label = $update_value; |
| 295 | 295 | } |
| 296 | 296 | |
| 297 | - $field = FrmField::getOne($id); |
|
| 297 | + $field = FrmField::getOne( $id ); |
|
| 298 | 298 | $separate_values = FrmField::is_option_true( $field, 'separate_value' ); |
| 299 | 299 | |
| 300 | - $this_opt_id = end($ids); |
|
| 301 | - $this_opt = (array) $field->options[ $this_opt_id ]; |
|
| 302 | - $other_opt = ( $this_opt_id && strpos( $this_opt_id, 'other') !== false ); |
|
| 300 | + $this_opt_id = end( $ids ); |
|
| 301 | + $this_opt = (array) $field->options[$this_opt_id]; |
|
| 302 | + $other_opt = ( $this_opt_id && strpos( $this_opt_id, 'other' ) !== false ); |
|
| 303 | 303 | |
| 304 | - $label = isset($this_opt['label']) ? $this_opt['label'] : reset($this_opt); |
|
| 305 | - $value = isset($this_opt['value']) ? $this_opt['value'] : ''; |
|
| 304 | + $label = isset( $this_opt['label'] ) ? $this_opt['label'] : reset( $this_opt ); |
|
| 305 | + $value = isset( $this_opt['value'] ) ? $this_opt['value'] : ''; |
|
| 306 | 306 | |
| 307 | 307 | if ( ! isset( $new_label ) ) { |
| 308 | 308 | $new_label = $label; |
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if ( isset($new_value) || isset($value) ) { |
|
| 312 | - $update_value = isset($new_value) ? $new_value : $value; |
|
| 311 | + if ( isset( $new_value ) || isset( $value ) ) { |
|
| 312 | + $update_value = isset( $new_value ) ? $new_value : $value; |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | if ( $update_value != $new_label && $other_opt === false && $separate_values ) { |
| 316 | - $field->options[ $this_opt_id ] = array( 'value' => $update_value, 'label' => $new_label ); |
|
| 316 | + $field->options[$this_opt_id] = array( 'value' => $update_value, 'label' => $new_label ); |
|
| 317 | 317 | } else { |
| 318 | - $field->options[ $this_opt_id ] = $orig_update_value; |
|
| 318 | + $field->options[$this_opt_id] = $orig_update_value; |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | FrmField::update( $field->id, array( 'options' => $field->options ) ); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | public static function delete_option() { |
| 327 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 327 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 328 | 328 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 329 | 329 | |
| 330 | 330 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | $opt_key = FrmAppHelper::get_post_param( 'opt_key', 0, 'sanitize_title' ); |
| 334 | 334 | |
| 335 | 335 | $options = $field->options; |
| 336 | - unset( $options[ $opt_key ] ); |
|
| 336 | + unset( $options[$opt_key] ); |
|
| 337 | 337 | $response = array( 'other' => true ); |
| 338 | 338 | |
| 339 | 339 | //If the deleted option is an "other" option |
@@ -399,9 +399,9 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
| 401 | 401 | $prepop = array(); |
| 402 | - FrmFieldsHelper::get_bulk_prefilled_opts($prepop); |
|
| 402 | + FrmFieldsHelper::get_bulk_prefilled_opts( $prepop ); |
|
| 403 | 403 | |
| 404 | - $field = FrmField::getOne($field_id); |
|
| 404 | + $field = FrmField::getOne( $field_id ); |
|
| 405 | 405 | |
| 406 | 406 | wp_enqueue_script( 'utils' ); |
| 407 | 407 | wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' ); |
@@ -412,33 +412,33 @@ discard block |
||
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | public static function import_options() { |
| 415 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 415 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 416 | 416 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 417 | 417 | |
| 418 | - if ( ! is_admin() || ! current_user_can('frm_edit_forms') ) { |
|
| 418 | + if ( ! is_admin() || ! current_user_can( 'frm_edit_forms' ) ) { |
|
| 419 | 419 | return; |
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | $field_id = absint( $_POST['field_id'] ); |
| 423 | - $field = FrmField::getOne($field_id); |
|
| 423 | + $field = FrmField::getOne( $field_id ); |
|
| 424 | 424 | |
| 425 | 425 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'select' ) ) ) { |
| 426 | 426 | return; |
| 427 | 427 | } |
| 428 | 428 | |
| 429 | - $field = FrmFieldsHelper::setup_edit_vars($field); |
|
| 430 | - $opts = stripslashes_deep($_POST['opts']); |
|
| 431 | - $opts = explode("\n", rtrim($opts, "\n")); |
|
| 429 | + $field = FrmFieldsHelper::setup_edit_vars( $field ); |
|
| 430 | + $opts = stripslashes_deep( $_POST['opts'] ); |
|
| 431 | + $opts = explode( "\n", rtrim( $opts, "\n" ) ); |
|
| 432 | 432 | if ( $field['separate_value'] ) { |
| 433 | 433 | foreach ( $opts as $opt_key => $opt ) { |
| 434 | - if ( strpos($opt, '|') !== false ) { |
|
| 435 | - $vals = explode('|', $opt); |
|
| 434 | + if ( strpos( $opt, '|' ) !== false ) { |
|
| 435 | + $vals = explode( '|', $opt ); |
|
| 436 | 436 | if ( $vals[0] != $vals[1] ) { |
| 437 | - $opts[ $opt_key ] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
| 437 | + $opts[$opt_key] = array( 'label' => trim( $vals[0] ), 'value' => trim( $vals[1] ) ); |
|
| 438 | 438 | } |
| 439 | - unset($vals); |
|
| 439 | + unset( $vals ); |
|
| 440 | 440 | } |
| 441 | - unset($opt_key, $opt); |
|
| 441 | + unset( $opt_key, $opt ); |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | |
@@ -447,12 +447,12 @@ discard block |
||
| 447 | 447 | $other_array = array(); |
| 448 | 448 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 449 | 449 | if ( $opt_key && strpos( $opt_key, 'other' ) !== false ) { |
| 450 | - $other_array[ $opt_key ] = $opt; |
|
| 450 | + $other_array[$opt_key] = $opt; |
|
| 451 | 451 | } |
| 452 | - unset($opt_key, $opt); |
|
| 452 | + unset( $opt_key, $opt ); |
|
| 453 | 453 | } |
| 454 | - if ( ! empty($other_array) ) { |
|
| 455 | - $opts = array_merge( $opts, $other_array); |
|
| 454 | + if ( ! empty( $other_array ) ) { |
|
| 455 | + $opts = array_merge( $opts, $other_array ); |
|
| 456 | 456 | } |
| 457 | 457 | } |
| 458 | 458 | |
@@ -467,14 +467,14 @@ discard block |
||
| 467 | 467 | if ( $field['type'] == 'radio' || $field['type'] == 'checkbox' ) { |
| 468 | 468 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/radio.php' ); |
| 469 | 469 | } else { |
| 470 | - FrmFieldsHelper::show_single_option($field); |
|
| 470 | + FrmFieldsHelper::show_single_option( $field ); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | wp_die(); |
| 474 | 474 | } |
| 475 | 475 | |
| 476 | 476 | public static function update_order() { |
| 477 | - FrmAppHelper::permission_check('frm_edit_forms'); |
|
| 477 | + FrmAppHelper::permission_check( 'frm_edit_forms' ); |
|
| 478 | 478 | check_ajax_referer( 'frm_ajax', 'nonce' ); |
| 479 | 479 | |
| 480 | 480 | $fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
@@ -491,13 +491,13 @@ discard block |
||
| 491 | 491 | 'rte' => 'textarea', |
| 492 | 492 | 'website' => 'url', |
| 493 | 493 | ); |
| 494 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 495 | - $type = $type_switch[ $type ]; |
|
| 494 | + if ( isset( $type_switch[$type] ) ) { |
|
| 495 | + $type = $type_switch[$type]; |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | $frm_field_selection = FrmField::field_selection(); |
| 499 | - $types = array_keys($frm_field_selection); |
|
| 500 | - if ( ! in_array($type, $types) && $type != 'captcha' ) { |
|
| 499 | + $types = array_keys( $frm_field_selection ); |
|
| 500 | + if ( ! in_array( $type, $types ) && $type != 'captcha' ) { |
|
| 501 | 501 | $type = 'text'; |
| 502 | 502 | } |
| 503 | 503 | |
@@ -536,19 +536,19 @@ discard block |
||
| 536 | 536 | |
| 537 | 537 | public static function input_html( $field, $echo = true ) { |
| 538 | 538 | $class = array(); //$field['type']; |
| 539 | - self::add_input_classes($field, $class); |
|
| 539 | + self::add_input_classes( $field, $class ); |
|
| 540 | 540 | |
| 541 | 541 | $add_html = array(); |
| 542 | - self::add_html_size($field, $add_html); |
|
| 543 | - self::add_html_length($field, $add_html); |
|
| 544 | - self::add_html_placeholder($field, $add_html, $class); |
|
| 542 | + self::add_html_size( $field, $add_html ); |
|
| 543 | + self::add_html_length( $field, $add_html ); |
|
| 544 | + self::add_html_placeholder( $field, $add_html, $class ); |
|
| 545 | 545 | self::add_validation_messages( $field, $add_html ); |
| 546 | 546 | |
| 547 | - $class = apply_filters('frm_field_classes', implode(' ', $class), $field); |
|
| 547 | + $class = apply_filters( 'frm_field_classes', implode( ' ', $class ), $field ); |
|
| 548 | 548 | |
| 549 | 549 | FrmFormsHelper::add_html_attr( $class, 'class', $add_html ); |
| 550 | 550 | |
| 551 | - self::add_shortcodes_to_html($field, $add_html); |
|
| 551 | + self::add_shortcodes_to_html( $field, $add_html ); |
|
| 552 | 552 | |
| 553 | 553 | $add_html = apply_filters( 'frm_field_extra_html', $add_html, $field ); |
| 554 | 554 | $add_html = ' ' . implode( ' ', $add_html ) . ' '; |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | private static function add_input_classes( $field, array &$class ) { |
| 564 | - if ( isset($field['input_class']) && ! empty($field['input_class']) ) { |
|
| 564 | + if ( isset( $field['input_class'] ) && ! empty( $field['input_class'] ) ) { |
|
| 565 | 565 | $class[] = $field['input_class']; |
| 566 | 566 | } |
| 567 | 567 | |
@@ -574,7 +574,7 @@ discard block |
||
| 574 | 574 | $class[] = 'dyn_default_value'; |
| 575 | 575 | } |
| 576 | 576 | |
| 577 | - if ( isset($field['size']) && $field['size'] > 0 ) { |
|
| 577 | + if ( isset( $field['size'] ) && $field['size'] > 0 ) { |
|
| 578 | 578 | $class[] = 'auto_width'; |
| 579 | 579 | } |
| 580 | 580 | } |
@@ -584,19 +584,19 @@ discard block |
||
| 584 | 584 | return; |
| 585 | 585 | } |
| 586 | 586 | |
| 587 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 587 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
| 588 | 588 | return; |
| 589 | 589 | } |
| 590 | 590 | |
| 591 | - if ( is_numeric($field['size']) ) { |
|
| 591 | + if ( is_numeric( $field['size'] ) ) { |
|
| 592 | 592 | $field['size'] .= 'px'; |
| 593 | 593 | } |
| 594 | 594 | |
| 595 | - $important = apply_filters('frm_use_important_width', 1, $field); |
|
| 595 | + $important = apply_filters( 'frm_use_important_width', 1, $field ); |
|
| 596 | 596 | // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
| 597 | 597 | $add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"'; |
| 598 | 598 | |
| 599 | - self::add_html_cols($field, $add_html); |
|
| 599 | + self::add_html_cols( $field, $add_html ); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | private static function add_html_cols( $field, array &$add_html ) { |
@@ -613,13 +613,13 @@ discard block |
||
| 613 | 613 | ); |
| 614 | 614 | |
| 615 | 615 | // include "col" for valid html |
| 616 | - $unit = trim(preg_replace('/[0-9]+/', '', $field['size'])); |
|
| 616 | + $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
|
| 617 | 617 | |
| 618 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 618 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 619 | 619 | return; |
| 620 | 620 | } |
| 621 | 621 | |
| 622 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 622 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
| 623 | 623 | |
| 624 | 624 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 625 | 625 | } |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | return; |
| 631 | 631 | } |
| 632 | 632 | |
| 633 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 633 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
| 634 | 634 | // don't load on form builder page |
| 635 | 635 | return; |
| 636 | 636 | } |
@@ -662,7 +662,7 @@ discard block |
||
| 662 | 662 | if ( $frm_settings->use_html && ! in_array( $field['type'], array( 'select', 'radio', 'checkbox', 'hidden' ) ) ) { |
| 663 | 663 | // use HMTL5 placeholder with js fallback |
| 664 | 664 | $add_html['placeholder'] = 'placeholder="' . esc_attr( $field['default_value'] ) . '"'; |
| 665 | - wp_enqueue_script('jquery-placeholder'); |
|
| 665 | + wp_enqueue_script( 'jquery-placeholder' ); |
|
| 666 | 666 | } else if ( ! $frm_settings->use_html ) { |
| 667 | 667 | $val = str_replace( array( "\r\n", "\n" ), '\r', addslashes( str_replace( ''', "'", esc_attr( $field['default_value'] ) ) ) ); |
| 668 | 668 | $add_html['data-frmval'] = 'data-frmval="' . esc_attr( $val ) . '"'; |
@@ -689,7 +689,7 @@ discard block |
||
| 689 | 689 | $format = FrmEntryValidate::phone_format( $field ); |
| 690 | 690 | $format = substr( $format, 2, -2 ); |
| 691 | 691 | $key = 'pattern'; |
| 692 | - $add_html[ $key ] = $key . '="' . esc_attr( $format ) . '"'; |
|
| 692 | + $add_html[$key] = $key . '="' . esc_attr( $format ) . '"'; |
|
| 693 | 693 | } |
| 694 | 694 | } |
| 695 | 695 | |
@@ -703,15 +703,15 @@ discard block |
||
| 703 | 703 | continue; |
| 704 | 704 | } |
| 705 | 705 | |
| 706 | - if ( is_numeric($k) && strpos($v, '=') ) { |
|
| 706 | + if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
|
| 707 | 707 | $add_html[] = $v; |
| 708 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 709 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 708 | + } else if ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 709 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 710 | 710 | } else { |
| 711 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 711 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 712 | 712 | } |
| 713 | 713 | |
| 714 | - unset($k, $v); |
|
| 714 | + unset( $k, $v ); |
|
| 715 | 715 | } |
| 716 | 716 | } |
| 717 | 717 | |
@@ -727,8 +727,8 @@ discard block |
||
| 727 | 727 | } |
| 728 | 728 | |
| 729 | 729 | public static function check_label( $opt ) { |
| 730 | - if ( is_array($opt) ) { |
|
| 731 | - $opt = (isset($opt['label']) ? $opt['label'] : reset($opt)); |
|
| 730 | + if ( is_array( $opt ) ) { |
|
| 731 | + $opt = ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
| 732 | 732 | } |
| 733 | 733 | |
| 734 | 734 | return $opt; |