@@ -154,12 +154,12 @@ discard block |
||
| 154 | 154 | * @return array |
| 155 | 155 | */ |
| 156 | 156 | private function prepare_array_property( $index, $atts ) { |
| 157 | - if ( isset( $atts[ $index ] ) && ! empty( $atts[ $index ] ) ) { |
|
| 157 | + if ( isset( $atts[$index] ) && ! empty( $atts[$index] ) ) { |
|
| 158 | 158 | |
| 159 | - if ( is_array( $atts[ $index ] ) ) { |
|
| 160 | - $property = $atts[ $index ]; |
|
| 159 | + if ( is_array( $atts[$index] ) ) { |
|
| 160 | + $property = $atts[$index]; |
|
| 161 | 161 | } else { |
| 162 | - $property = explode( ',', $atts[ $index ] ); |
|
| 162 | + $property = explode( ',', $atts[$index] ); |
|
| 163 | 163 | } |
| 164 | 164 | } else { |
| 165 | 165 | $property = array(); |
@@ -292,6 +292,6 @@ discard block |
||
| 292 | 292 | * @param stdClass $field |
| 293 | 293 | */ |
| 294 | 294 | protected function add_field_values( $field ) { |
| 295 | - $this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry, array( 'source' => $this->source ) ); |
|
| 295 | + $this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry, array( 'source' => $this->source ) ); |
|
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | \ No newline at end of file |
@@ -151,6 +151,7 @@ |
||
| 151 | 151 | |
| 152 | 152 | /** |
| 153 | 153 | * @deprecated 2.04 |
| 154 | + * @param string $val |
|
| 154 | 155 | */ |
| 155 | 156 | private static function get_field_value( $atts, &$val ) { |
| 156 | 157 | _deprecated_function( __FUNCTION__, '2.04', 'instance of FrmEntryValues or FrmProEntryValues' ); |
@@ -98,15 +98,15 @@ discard block |
||
| 98 | 98 | self::prepare_field_output( $atts, $val ); |
| 99 | 99 | |
| 100 | 100 | if ( $atts['format'] != 'text' ) { |
| 101 | - $values[ $f->field_key ] = $val; |
|
| 101 | + $values[$f->field_key] = $val; |
|
| 102 | 102 | if ( $atts['entry'] && $f->type != 'textarea' ) { |
| 103 | - $prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] ); |
|
| 103 | + $prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] ); |
|
| 104 | 104 | if ( $prev_val != $val ) { |
| 105 | - $values[ $f->field_key . '-value' ] = $prev_val; |
|
| 105 | + $values[$f->field_key . '-value'] = $prev_val; |
|
| 106 | 106 | } |
| 107 | 107 | } |
| 108 | 108 | } else { |
| 109 | - $values[ $f->id ] = array( 'label' => $f->name, 'val' => $val, 'type' => $f->type ); |
|
| 109 | + $values[$f->id] = array( 'label' => $f->name, 'val' => $val, 'type' => $f->type ); |
|
| 110 | 110 | } |
| 111 | 111 | } |
| 112 | 112 | |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | private static function fill_missing_fields( $atts, &$values ) { |
| 117 | 117 | _deprecated_function( __FUNCTION__, '2.04', 'instance of FrmEntryValues or FrmProEntryValues' ); |
| 118 | 118 | |
| 119 | - if ( $atts['entry'] && ! isset( $atts['entry']->metas[ $atts['field']->id ] ) ) { |
|
| 119 | + if ( $atts['entry'] && ! isset( $atts['entry']->metas[$atts['field']->id] ) ) { |
|
| 120 | 120 | // In case include_blank is set |
| 121 | - $atts['entry']->metas[ $atts['field']->id ] = ''; |
|
| 121 | + $atts['entry']->metas[$atts['field']->id] = ''; |
|
| 122 | 122 | $atts['entry'] = apply_filters( 'frm_prepare_entry_content', $atts['entry'], array( 'field' => $atts['field'] ) ); |
| 123 | 123 | self::fill_values_from_entry( $atts, $values ); |
| 124 | 124 | } |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | 'type' => $f->type, |
| 147 | 147 | ); |
| 148 | 148 | |
| 149 | - $values[ $f->id ] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $field_shortcodes, $f ); |
|
| 149 | + $values[$f->id] = apply_filters( 'frm_field_shortcodes_for_default_html_email', $field_shortcodes, $f ); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | $f = $atts['field']; |
| 159 | 159 | if ( $atts['entry'] ) { |
| 160 | - $prev_val = maybe_unserialize( $atts['entry']->metas[ $f->id ] ); |
|
| 160 | + $prev_val = maybe_unserialize( $atts['entry']->metas[$f->id] ); |
|
| 161 | 161 | $meta = array( 'item_id' => $atts['id'], 'field_id' => $f->id, 'meta_value' => $prev_val, 'field_type' => $f->type ); |
| 162 | 162 | |
| 163 | 163 | //This filter applies to the default-message shortcode and frm-show-entry shortcode only |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @since 2.04 |
| 81 | 81 | */ |
| 82 | 82 | protected function init_saved_value() { |
| 83 | - if ( isset( $this->entry->metas[ $this->field->id ] ) ) { |
|
| 84 | - $this->saved_value = $this->entry->metas[ $this->field->id ]; |
|
| 83 | + if ( isset( $this->entry->metas[$this->field->id] ) ) { |
|
| 84 | + $this->saved_value = $this->entry->metas[$this->field->id]; |
|
| 85 | 85 | } else { |
| 86 | 86 | $this->saved_value = ''; |
| 87 | 87 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | if ( $this->source === 'entry_formatter' ) { |
| 156 | 156 | // Deprecated frm_email_value hook |
| 157 | - $meta = array( |
|
| 157 | + $meta = array( |
|
| 158 | 158 | 'item_id' => $this->entry->id, |
| 159 | 159 | 'field_id' => $this->field->id, |
| 160 | 160 | 'meta_value' => $this->saved_value, |
@@ -7,72 +7,72 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public static function setup_new_vars( $type = '', $form_id = '' ) { |
| 9 | 9 | |
| 10 | - if ( strpos($type, '|') ) { |
|
| 11 | - list($type, $setting) = explode('|', $type); |
|
| 12 | - } |
|
| 13 | - |
|
| 14 | - $defaults = self::get_default_field_opts($type, $form_id); |
|
| 15 | - $defaults['field_options']['custom_html'] = self::get_default_html($type); |
|
| 16 | - |
|
| 17 | - $values = array(); |
|
| 18 | - |
|
| 19 | - foreach ( $defaults as $var => $default ) { |
|
| 20 | - if ( $var == 'field_options' ) { |
|
| 21 | - $values['field_options'] = array(); |
|
| 22 | - foreach ( $default as $opt_var => $opt_default ) { |
|
| 23 | - $values['field_options'][ $opt_var ] = $opt_default; |
|
| 24 | - unset($opt_var, $opt_default); |
|
| 25 | - } |
|
| 26 | - } else { |
|
| 27 | - $values[ $var ] = $default; |
|
| 28 | - } |
|
| 29 | - unset($var, $default); |
|
| 30 | - } |
|
| 31 | - |
|
| 32 | - if ( isset( $setting ) && ! empty( $setting ) ) { |
|
| 33 | - if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
|
| 34 | - $values['field_options']['data_type'] = $setting; |
|
| 35 | - } else { |
|
| 36 | - $values['field_options'][ $setting ] = 1; |
|
| 37 | - } |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - if ( $type == 'radio' || $type == 'checkbox' ) { |
|
| 41 | - $values['options'] = serialize( array( |
|
| 42 | - __( 'Option 1', 'formidable' ), |
|
| 43 | - __( 'Option 2', 'formidable' ), |
|
| 44 | - ) ); |
|
| 45 | - } else if ( $type == 'select' ) { |
|
| 46 | - $values['options'] = serialize( array( |
|
| 47 | - '', __( 'Option 1', 'formidable' ), |
|
| 48 | - ) ); |
|
| 49 | - } else if ( $type == 'textarea' ) { |
|
| 50 | - $values['field_options']['max'] = '5'; |
|
| 51 | - } else if ( $type == 'captcha' ) { |
|
| 52 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 53 | - $values['invalid'] = $frm_settings->re_msg; |
|
| 10 | + if ( strpos($type, '|') ) { |
|
| 11 | + list($type, $setting) = explode('|', $type); |
|
| 12 | + } |
|
| 13 | + |
|
| 14 | + $defaults = self::get_default_field_opts($type, $form_id); |
|
| 15 | + $defaults['field_options']['custom_html'] = self::get_default_html($type); |
|
| 16 | + |
|
| 17 | + $values = array(); |
|
| 18 | + |
|
| 19 | + foreach ( $defaults as $var => $default ) { |
|
| 20 | + if ( $var == 'field_options' ) { |
|
| 21 | + $values['field_options'] = array(); |
|
| 22 | + foreach ( $default as $opt_var => $opt_default ) { |
|
| 23 | + $values['field_options'][ $opt_var ] = $opt_default; |
|
| 24 | + unset($opt_var, $opt_default); |
|
| 25 | + } |
|
| 26 | + } else { |
|
| 27 | + $values[ $var ] = $default; |
|
| 28 | + } |
|
| 29 | + unset($var, $default); |
|
| 30 | + } |
|
| 31 | + |
|
| 32 | + if ( isset( $setting ) && ! empty( $setting ) ) { |
|
| 33 | + if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
|
| 34 | + $values['field_options']['data_type'] = $setting; |
|
| 35 | + } else { |
|
| 36 | + $values['field_options'][ $setting ] = 1; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + if ( $type == 'radio' || $type == 'checkbox' ) { |
|
| 41 | + $values['options'] = serialize( array( |
|
| 42 | + __( 'Option 1', 'formidable' ), |
|
| 43 | + __( 'Option 2', 'formidable' ), |
|
| 44 | + ) ); |
|
| 45 | + } else if ( $type == 'select' ) { |
|
| 46 | + $values['options'] = serialize( array( |
|
| 47 | + '', __( 'Option 1', 'formidable' ), |
|
| 48 | + ) ); |
|
| 49 | + } else if ( $type == 'textarea' ) { |
|
| 50 | + $values['field_options']['max'] = '5'; |
|
| 51 | + } else if ( $type == 'captcha' ) { |
|
| 52 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 53 | + $values['invalid'] = $frm_settings->re_msg; |
|
| 54 | 54 | $values['field_options']['label'] = 'none'; |
| 55 | - } else if ( 'url' == $type ) { |
|
| 56 | - $values['name'] = __( 'Website', 'formidable' ); |
|
| 57 | - } |
|
| 55 | + } else if ( 'url' == $type ) { |
|
| 56 | + $values['name'] = __( 'Website', 'formidable' ); |
|
| 57 | + } |
|
| 58 | 58 | |
| 59 | 59 | $fields = FrmField::field_selection(); |
| 60 | - $fields = array_merge($fields, FrmField::pro_field_selection()); |
|
| 60 | + $fields = array_merge($fields, FrmField::pro_field_selection()); |
|
| 61 | 61 | |
| 62 | - if ( isset( $fields[ $type ] ) ) { |
|
| 63 | - $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ]; |
|
| 64 | - } |
|
| 62 | + if ( isset( $fields[ $type ] ) ) { |
|
| 63 | + $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ]; |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - unset($fields); |
|
| 66 | + unset($fields); |
|
| 67 | 67 | |
| 68 | - return $values; |
|
| 69 | - } |
|
| 68 | + return $values; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | 71 | public static function get_html_id( $field, $plus = '' ) { |
| 72 | 72 | return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field ); |
| 73 | - } |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - public static function setup_edit_vars( $record, $doing_ajax = false ) { |
|
| 75 | + public static function setup_edit_vars( $record, $doing_ajax = false ) { |
|
| 76 | 76 | $values = array( 'id' => $record->id, 'form_id' => $record->form_id ); |
| 77 | 77 | $defaults = array( |
| 78 | 78 | 'name' => $record->name, |
@@ -85,86 +85,86 @@ discard block |
||
| 85 | 85 | ); |
| 86 | 86 | |
| 87 | 87 | if ( $doing_ajax ) { |
| 88 | - $values = $values + $defaults; |
|
| 89 | - $values['form_name'] = ''; |
|
| 88 | + $values = $values + $defaults; |
|
| 89 | + $values['form_name'] = ''; |
|
| 90 | 90 | } else { |
| 91 | 91 | foreach ( $defaults as $var => $default ) { |
| 92 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 93 | - unset($var, $default); |
|
| 94 | - } |
|
| 92 | + $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 93 | + unset($var, $default); |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | $values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : ''; |
| 97 | - } |
|
| 97 | + } |
|
| 98 | 98 | |
| 99 | 99 | unset( $defaults ); |
| 100 | 100 | |
| 101 | - $values['options'] = $record->options; |
|
| 102 | - $values['field_options'] = $record->field_options; |
|
| 101 | + $values['options'] = $record->options; |
|
| 102 | + $values['field_options'] = $record->field_options; |
|
| 103 | 103 | |
| 104 | - $defaults = self::get_default_field_opts($values['type'], $record, true); |
|
| 104 | + $defaults = self::get_default_field_opts($values['type'], $record, true); |
|
| 105 | 105 | |
| 106 | 106 | if ( $values['type'] == 'captcha' ) { |
| 107 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 108 | - $defaults['invalid'] = $frm_settings->re_msg; |
|
| 109 | - } |
|
| 107 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 108 | + $defaults['invalid'] = $frm_settings->re_msg; |
|
| 109 | + } |
|
| 110 | 110 | |
| 111 | 111 | foreach ( $defaults as $opt => $default ) { |
| 112 | - $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default; |
|
| 113 | - unset($opt, $default); |
|
| 114 | - } |
|
| 112 | + $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default; |
|
| 113 | + unset($opt, $default); |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | - $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type); |
|
| 116 | + $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type); |
|
| 117 | 117 | |
| 118 | 118 | return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) ); |
| 119 | - } |
|
| 119 | + } |
|
| 120 | 120 | |
| 121 | - public static function get_default_field_opts( $type, $field, $limit = false ) { |
|
| 122 | - $field_options = array( |
|
| 123 | - 'size' => '', 'max' => '', 'label' => '', 'blank' => '', |
|
| 124 | - 'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0, |
|
| 125 | - 'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '', |
|
| 121 | + public static function get_default_field_opts( $type, $field, $limit = false ) { |
|
| 122 | + $field_options = array( |
|
| 123 | + 'size' => '', 'max' => '', 'label' => '', 'blank' => '', |
|
| 124 | + 'required_indicator' => '*', 'invalid' => '', 'separate_value' => 0, |
|
| 125 | + 'clear_on_focus' => 0, 'default_blank' => 0, 'classes' => '', |
|
| 126 | 126 | 'custom_html' => '', 'captcha_size' => 'normal', 'captcha_theme' => 'light', |
| 127 | - ); |
|
| 127 | + ); |
|
| 128 | 128 | |
| 129 | 129 | if ( $limit ) { |
| 130 | - return $field_options; |
|
| 130 | + return $field_options; |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | - global $wpdb; |
|
| 133 | + global $wpdb; |
|
| 134 | 134 | |
| 135 | - $form_id = (is_numeric($field)) ? $field : $field->form_id; |
|
| 135 | + $form_id = (is_numeric($field)) ? $field : $field->form_id; |
|
| 136 | 136 | |
| 137 | 137 | $key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key; |
| 138 | 138 | |
| 139 | - $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) ); |
|
| 139 | + $field_count = FrmDb::get_var( 'frm_fields', array( 'form_id' => $form_id ), 'field_order', array( 'order_by' => 'field_order DESC' ) ); |
|
| 140 | 140 | |
| 141 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 142 | - return array( |
|
| 143 | - 'name' => __( 'Untitled', 'formidable' ), 'description' => '', |
|
| 141 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 142 | + return array( |
|
| 143 | + 'name' => __( 'Untitled', 'formidable' ), 'description' => '', |
|
| 144 | 144 | 'field_key' => $key, 'type' => $type, 'options' => '', 'default_value' => '', |
| 145 | 145 | 'field_order' => $field_count + 1, 'required' => false, |
| 146 | - 'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg, |
|
| 147 | - 'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id, |
|
| 146 | + 'blank' => $frm_settings->blank_msg, 'unique_msg' => $frm_settings->unique_msg, |
|
| 147 | + 'invalid' => __( 'This field is invalid', 'formidable' ), 'form_id' => $form_id, |
|
| 148 | 148 | 'field_options' => $field_options, |
| 149 | - ); |
|
| 150 | - } |
|
| 149 | + ); |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { |
|
| 153 | - global $wpdb; |
|
| 152 | + public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { |
|
| 153 | + global $wpdb; |
|
| 154 | 154 | |
| 155 | 155 | $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 156 | - $values['form_id'] = $form_id; |
|
| 157 | - $values['options'] = maybe_serialize($field->options); |
|
| 158 | - $values['default_value'] = maybe_serialize($field->default_value); |
|
| 159 | - |
|
| 160 | - foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
|
| 161 | - $values[ $col ] = $field->{$col}; |
|
| 162 | - } |
|
| 163 | - } |
|
| 164 | - |
|
| 165 | - /** |
|
| 166 | - * @since 2.0 |
|
| 167 | - */ |
|
| 156 | + $values['form_id'] = $form_id; |
|
| 157 | + $values['options'] = maybe_serialize($field->options); |
|
| 158 | + $values['default_value'] = maybe_serialize($field->default_value); |
|
| 159 | + |
|
| 160 | + foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
|
| 161 | + $values[ $col ] = $field->{$col}; |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + |
|
| 165 | + /** |
|
| 166 | + * @since 2.0 |
|
| 167 | + */ |
|
| 168 | 168 | public static function get_error_msg( $field, $error ) { |
| 169 | 169 | $frm_settings = FrmAppHelper::get_settings(); |
| 170 | 170 | $default_settings = $frm_settings->default_options(); |
@@ -193,12 +193,12 @@ discard block |
||
| 193 | 193 | public static function get_default_html( $type = 'text' ) { |
| 194 | 194 | if ( apply_filters( 'frm_normal_field_type_html', true, $type ) ) { |
| 195 | 195 | $input = ( in_array( $type, array( 'radio', 'checkbox', 'data' ) ) ) ? '<div class="frm_opt_container">[input]</div>' : '[input]'; |
| 196 | - $for = ''; |
|
| 196 | + $for = ''; |
|
| 197 | 197 | if ( ! in_array( $type, array( 'radio', 'checkbox', 'data', 'scale' ) ) ) { |
| 198 | - $for = 'for="field_[key]"'; |
|
| 199 | - } |
|
| 198 | + $for = 'for="field_[key]"'; |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - $default_html = <<<DEFAULT_HTML |
|
| 201 | + $default_html = <<<DEFAULT_HTML |
|
| 202 | 202 | <div id="frm_field_[id]_container" class="frm_form_field form-field [required_class][error_class]"> |
| 203 | 203 | <label $for class="frm_primary_label">[field_name] |
| 204 | 204 | <span class="frm_required">[required_label]</span> |
@@ -208,82 +208,82 @@ discard block |
||
| 208 | 208 | [if error]<div class="frm_error">[error]</div>[/if error] |
| 209 | 209 | </div> |
| 210 | 210 | DEFAULT_HTML; |
| 211 | - } else { |
|
| 211 | + } else { |
|
| 212 | 212 | $default_html = apply_filters('frm_other_custom_html', '', $type); |
| 213 | - } |
|
| 213 | + } |
|
| 214 | 214 | |
| 215 | - return apply_filters('frm_custom_html', $default_html, $type); |
|
| 216 | - } |
|
| 215 | + return apply_filters('frm_custom_html', $default_html, $type); |
|
| 216 | + } |
|
| 217 | 217 | |
| 218 | 218 | public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) { |
| 219 | - $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form); |
|
| 219 | + $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form); |
|
| 220 | 220 | |
| 221 | - $defaults = array( |
|
| 221 | + $defaults = array( |
|
| 222 | 222 | 'field_name' => 'item_meta[' . $field['id'] . ']', |
| 223 | 223 | 'field_id' => $field['id'], |
| 224 | - 'field_plus_id' => '', |
|
| 225 | - 'section_id' => '', |
|
| 226 | - ); |
|
| 227 | - $args = wp_parse_args($args, $defaults); |
|
| 228 | - $field_name = $args['field_name']; |
|
| 229 | - $field_id = $args['field_id']; |
|
| 230 | - $html_id = self::get_html_id($field, $args['field_plus_id']); |
|
| 224 | + 'field_plus_id' => '', |
|
| 225 | + 'section_id' => '', |
|
| 226 | + ); |
|
| 227 | + $args = wp_parse_args($args, $defaults); |
|
| 228 | + $field_name = $args['field_name']; |
|
| 229 | + $field_id = $args['field_id']; |
|
| 230 | + $html_id = self::get_html_id($field, $args['field_plus_id']); |
|
| 231 | 231 | |
| 232 | - if ( FrmField::is_multiple_select($field) ) { |
|
| 233 | - $field_name .= '[]'; |
|
| 234 | - } |
|
| 232 | + if ( FrmField::is_multiple_select($field) ) { |
|
| 233 | + $field_name .= '[]'; |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | - //replace [id] |
|
| 237 | - $html = str_replace('[id]', $field_id, $html); |
|
| 236 | + //replace [id] |
|
| 237 | + $html = str_replace('[id]', $field_id, $html); |
|
| 238 | 238 | |
| 239 | - // Remove the for attribute for captcha |
|
| 240 | - if ( $field['type'] == 'captcha' ) { |
|
| 241 | - $html = str_replace(' for="field_[key]"', '', $html); |
|
| 242 | - } |
|
| 239 | + // Remove the for attribute for captcha |
|
| 240 | + if ( $field['type'] == 'captcha' ) { |
|
| 241 | + $html = str_replace(' for="field_[key]"', '', $html); |
|
| 242 | + } |
|
| 243 | 243 | |
| 244 | - // set the label for |
|
| 245 | - $html = str_replace('field_[key]', $html_id, $html); |
|
| 244 | + // set the label for |
|
| 245 | + $html = str_replace('field_[key]', $html_id, $html); |
|
| 246 | 246 | |
| 247 | - //replace [key] |
|
| 248 | - $html = str_replace('[key]', $field['field_key'], $html); |
|
| 247 | + //replace [key] |
|
| 248 | + $html = str_replace('[key]', $field['field_key'], $html); |
|
| 249 | 249 | |
| 250 | - //replace [description] and [required_label] and [error] |
|
| 250 | + //replace [description] and [required_label] and [error] |
|
| 251 | 251 | $required = FrmField::is_required( $field ) ? $field['required_indicator'] : ''; |
| 252 | - if ( ! is_array( $errors ) ) { |
|
| 253 | - $errors = array(); |
|
| 254 | - } |
|
| 252 | + if ( ! is_array( $errors ) ) { |
|
| 253 | + $errors = array(); |
|
| 254 | + } |
|
| 255 | 255 | $error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false; |
| 256 | 256 | |
| 257 | - //If field type is section heading, add class so a bottom margin can be added to either the h3 or description |
|
| 258 | - if ( $field['type'] == 'divider' ) { |
|
| 259 | - if ( FrmField::is_option_true( $field, 'description' ) ) { |
|
| 260 | - $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html ); |
|
| 261 | - } else { |
|
| 262 | - $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html); |
|
| 263 | - } |
|
| 264 | - } |
|
| 257 | + //If field type is section heading, add class so a bottom margin can be added to either the h3 or description |
|
| 258 | + if ( $field['type'] == 'divider' ) { |
|
| 259 | + if ( FrmField::is_option_true( $field, 'description' ) ) { |
|
| 260 | + $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html ); |
|
| 261 | + } else { |
|
| 262 | + $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html); |
|
| 263 | + } |
|
| 264 | + } |
|
| 265 | 265 | |
| 266 | 266 | foreach ( array( 'description' => $field['description'], 'required_label' => $required, 'error' => $error ) as $code => $value ) { |
| 267 | - self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html ); |
|
| 268 | - } |
|
| 267 | + self::remove_inline_conditions( ( $value && $value != '' ), $code, $value, $html ); |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - //replace [required_class] |
|
| 270 | + //replace [required_class] |
|
| 271 | 271 | $required_class = FrmField::is_required( $field ) ? ' frm_required_field' : ''; |
| 272 | - $html = str_replace('[required_class]', $required_class, $html); |
|
| 272 | + $html = str_replace('[required_class]', $required_class, $html); |
|
| 273 | 273 | |
| 274 | - //replace [label_position] |
|
| 275 | - $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form); |
|
| 276 | - $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top'; |
|
| 274 | + //replace [label_position] |
|
| 275 | + $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form); |
|
| 276 | + $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top'; |
|
| 277 | 277 | $html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html ); |
| 278 | 278 | |
| 279 | - //replace [field_name] |
|
| 280 | - $html = str_replace('[field_name]', $field['name'], $html); |
|
| 279 | + //replace [field_name] |
|
| 280 | + $html = str_replace('[field_name]', $field['name'], $html); |
|
| 281 | 281 | |
| 282 | 282 | self::add_field_div_classes( $field_id, $field, $errors, $html ); |
| 283 | 283 | |
| 284 | - //replace [entry_key] |
|
| 285 | - $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); |
|
| 286 | - $html = str_replace('[entry_key]', $entry_key, $html); |
|
| 284 | + //replace [entry_key] |
|
| 285 | + $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); |
|
| 286 | + $html = str_replace('[entry_key]', $entry_key, $html); |
|
| 287 | 287 | |
| 288 | 288 | if ( $form ) { |
| 289 | 289 | $form = (array) $form; |
@@ -297,57 +297,57 @@ discard block |
||
| 297 | 297 | |
| 298 | 298 | self::process_wp_shortcodes( $html ); |
| 299 | 299 | |
| 300 | - //replace [input] |
|
| 301 | - preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
| 302 | - global $frm_vars; |
|
| 303 | - $frm_settings = FrmAppHelper::get_settings(); |
|
| 300 | + //replace [input] |
|
| 301 | + preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
| 302 | + global $frm_vars; |
|
| 303 | + $frm_settings = FrmAppHelper::get_settings(); |
|
| 304 | 304 | |
| 305 | - foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 306 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 305 | + foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 306 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 307 | 307 | $tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) ); |
| 308 | 308 | |
| 309 | - $replace_with = ''; |
|
| 309 | + $replace_with = ''; |
|
| 310 | 310 | |
| 311 | - if ( $tag == 'input' ) { |
|
| 312 | - if ( isset($atts['opt']) ) { |
|
| 313 | - $atts['opt']--; |
|
| 314 | - } |
|
| 311 | + if ( $tag == 'input' ) { |
|
| 312 | + if ( isset($atts['opt']) ) { |
|
| 313 | + $atts['opt']--; |
|
| 314 | + } |
|
| 315 | 315 | |
| 316 | - $field['input_class'] = isset($atts['class']) ? $atts['class'] : ''; |
|
| 317 | - if ( isset($atts['class']) ) { |
|
| 318 | - unset($atts['class']); |
|
| 319 | - } |
|
| 316 | + $field['input_class'] = isset($atts['class']) ? $atts['class'] : ''; |
|
| 317 | + if ( isset($atts['class']) ) { |
|
| 318 | + unset($atts['class']); |
|
| 319 | + } |
|
| 320 | 320 | |
| 321 | - $field['shortcodes'] = $atts; |
|
| 322 | - ob_start(); |
|
| 321 | + $field['shortcodes'] = $atts; |
|
| 322 | + ob_start(); |
|
| 323 | 323 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/input.php' ); |
| 324 | - $replace_with = ob_get_contents(); |
|
| 325 | - ob_end_clean(); |
|
| 326 | - } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) { |
|
| 327 | - $replace_with = FrmProEntriesController::entry_delete_link($atts); |
|
| 328 | - } |
|
| 324 | + $replace_with = ob_get_contents(); |
|
| 325 | + ob_end_clean(); |
|
| 326 | + } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) { |
|
| 327 | + $replace_with = FrmProEntriesController::entry_delete_link($atts); |
|
| 328 | + } |
|
| 329 | 329 | |
| 330 | - $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html ); |
|
| 331 | - } |
|
| 330 | + $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html ); |
|
| 331 | + } |
|
| 332 | 332 | |
| 333 | - $html .= "\n"; |
|
| 333 | + $html .= "\n"; |
|
| 334 | 334 | |
| 335 | - //Return html if conf_field to prevent loop |
|
| 336 | - if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) { |
|
| 337 | - return $html; |
|
| 338 | - } |
|
| 335 | + //Return html if conf_field to prevent loop |
|
| 336 | + if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) { |
|
| 337 | + return $html; |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | - //If field is in repeating section |
|
| 341 | - if ( $args['section_id'] ) { |
|
| 342 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] )); |
|
| 343 | - } else { |
|
| 344 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form )); |
|
| 345 | - } |
|
| 340 | + //If field is in repeating section |
|
| 341 | + if ( $args['section_id'] ) { |
|
| 342 | + $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] )); |
|
| 343 | + } else { |
|
| 344 | + $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form )); |
|
| 345 | + } |
|
| 346 | 346 | |
| 347 | 347 | self::remove_collapse_shortcode( $html ); |
| 348 | 348 | |
| 349 | - return $html; |
|
| 350 | - } |
|
| 349 | + return $html; |
|
| 350 | + } |
|
| 351 | 351 | |
| 352 | 352 | /** |
| 353 | 353 | * This filters shortcodes in the field HTML |
@@ -412,46 +412,46 @@ discard block |
||
| 412 | 412 | return $classes; |
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
|
| 416 | - if ( $no_vars ) { |
|
| 415 | + public static function remove_inline_conditions( $no_vars, $code, $replace_with, &$html ) { |
|
| 416 | + if ( $no_vars ) { |
|
| 417 | 417 | $html = str_replace( '[if ' . $code . ']', '', $html ); |
| 418 | 418 | $html = str_replace( '[/if ' . $code . ']', '', $html ); |
| 419 | - } else { |
|
| 419 | + } else { |
|
| 420 | 420 | $html = preg_replace( '/(\[if\s+' . $code . '\])(.*?)(\[\/if\s+' . $code . '\])/mis', '', $html ); |
| 421 | - } |
|
| 421 | + } |
|
| 422 | 422 | |
| 423 | 423 | $html = str_replace( '[' . $code . ']', $replace_with, $html ); |
| 424 | - } |
|
| 424 | + } |
|
| 425 | 425 | |
| 426 | 426 | public static function get_shortcode_tag( $shortcodes, $short_key, $args ) { |
| 427 | 427 | $args = wp_parse_args( $args, array( 'conditional' => false, 'conditional_check' => false, 'foreach' => false ) ); |
| 428 | - if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) { |
|
| 429 | - $args['conditional_check'] = true; |
|
| 430 | - } |
|
| 431 | - |
|
| 432 | - $prefix = ''; |
|
| 433 | - if ( $args['conditional_check'] ) { |
|
| 434 | - if ( $args['conditional'] ) { |
|
| 435 | - $prefix = 'if '; |
|
| 436 | - } else if ( $args['foreach'] ) { |
|
| 437 | - $prefix = 'foreach '; |
|
| 438 | - } |
|
| 439 | - } |
|
| 440 | - |
|
| 441 | - $with_tags = $args['conditional_check'] ? 3 : 2; |
|
| 442 | - if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
|
| 443 | - $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
|
| 444 | - $tag = str_replace(']', '', $tag); |
|
| 445 | - $tags = explode(' ', $tag); |
|
| 446 | - if ( is_array($tags) ) { |
|
| 447 | - $tag = $tags[0]; |
|
| 448 | - } |
|
| 449 | - } else { |
|
| 450 | - $tag = $shortcodes[ $with_tags - 1 ][ $short_key ]; |
|
| 451 | - } |
|
| 452 | - |
|
| 453 | - return $tag; |
|
| 454 | - } |
|
| 428 | + if ( ( $args['conditional'] || $args['foreach'] ) && ! $args['conditional_check'] ) { |
|
| 429 | + $args['conditional_check'] = true; |
|
| 430 | + } |
|
| 431 | + |
|
| 432 | + $prefix = ''; |
|
| 433 | + if ( $args['conditional_check'] ) { |
|
| 434 | + if ( $args['conditional'] ) { |
|
| 435 | + $prefix = 'if '; |
|
| 436 | + } else if ( $args['foreach'] ) { |
|
| 437 | + $prefix = 'foreach '; |
|
| 438 | + } |
|
| 439 | + } |
|
| 440 | + |
|
| 441 | + $with_tags = $args['conditional_check'] ? 3 : 2; |
|
| 442 | + if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
|
| 443 | + $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
|
| 444 | + $tag = str_replace(']', '', $tag); |
|
| 445 | + $tags = explode(' ', $tag); |
|
| 446 | + if ( is_array($tags) ) { |
|
| 447 | + $tag = $tags[0]; |
|
| 448 | + } |
|
| 449 | + } else { |
|
| 450 | + $tag = $shortcodes[ $with_tags - 1 ][ $short_key ]; |
|
| 451 | + } |
|
| 452 | + |
|
| 453 | + return $tag; |
|
| 454 | + } |
|
| 455 | 455 | |
| 456 | 456 | /** |
| 457 | 457 | * Remove [collapse_this] if it's still included after all processing |
@@ -489,8 +489,8 @@ discard block |
||
| 489 | 489 | } |
| 490 | 490 | $api_js_url = apply_filters( 'frm_recaptcha_js_url', $api_js_url ); |
| 491 | 491 | |
| 492 | - wp_register_script( 'recaptcha-api', $api_js_url, '', true ); |
|
| 493 | - wp_enqueue_script( 'recaptcha-api' ); |
|
| 492 | + wp_register_script( 'recaptcha-api', $api_js_url, '', true ); |
|
| 493 | + wp_enqueue_script( 'recaptcha-api' ); |
|
| 494 | 494 | |
| 495 | 495 | // for reverse compatibility |
| 496 | 496 | $field['captcha_size'] = ( $field['captcha_size'] == 'default' ) ? 'normal' : $field['captcha_size']; |
@@ -503,40 +503,40 @@ discard block |
||
| 503 | 503 | } |
| 504 | 504 | ?>></div> |
| 505 | 505 | <?php |
| 506 | - } |
|
| 506 | + } |
|
| 507 | 507 | |
| 508 | 508 | public static function show_single_option( $field ) { |
| 509 | - $field_name = $field['name']; |
|
| 510 | - $html_id = self::get_html_id($field); |
|
| 511 | - foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 512 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 513 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 509 | + $field_name = $field['name']; |
|
| 510 | + $html_id = self::get_html_id($field); |
|
| 511 | + foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 512 | + $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 513 | + $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 514 | 514 | |
| 515 | - // If this is an "Other" option, get the HTML for it |
|
| 515 | + // If this is an "Other" option, get the HTML for it |
|
| 516 | 516 | if ( self::is_other_opt( $opt_key ) ) { |
| 517 | - // Get string for Other text field, if needed |
|
| 517 | + // Get string for Other text field, if needed |
|
| 518 | 518 | $other_val = self::get_other_val( compact( 'opt_key', 'field' ) ); |
| 519 | 519 | require( FrmAppHelper::plugin_path() . '/pro/classes/views/frmpro-fields/other-option.php' ); |
| 520 | - } else { |
|
| 520 | + } else { |
|
| 521 | 521 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' ); |
| 522 | - } |
|
| 523 | - } |
|
| 524 | - } |
|
| 522 | + } |
|
| 523 | + } |
|
| 524 | + } |
|
| 525 | 525 | |
| 526 | 526 | public static function get_term_link( $tax_id ) { |
| 527 | - $tax = get_taxonomy($tax_id); |
|
| 528 | - if ( ! $tax ) { |
|
| 529 | - return; |
|
| 530 | - } |
|
| 527 | + $tax = get_taxonomy($tax_id); |
|
| 528 | + if ( ! $tax ) { |
|
| 529 | + return; |
|
| 530 | + } |
|
| 531 | 531 | |
| 532 | - $link = sprintf( |
|
| 533 | - __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
|
| 532 | + $link = sprintf( |
|
| 533 | + __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
|
| 534 | 534 | '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>' |
| 535 | - ); |
|
| 536 | - unset($tax); |
|
| 535 | + ); |
|
| 536 | + unset($tax); |
|
| 537 | 537 | |
| 538 | - return $link; |
|
| 539 | - } |
|
| 538 | + return $link; |
|
| 539 | + } |
|
| 540 | 540 | |
| 541 | 541 | public static function value_meets_condition( $observed_value, $cond, $hide_opt ) { |
| 542 | 542 | // Remove white space from hide_opt |
@@ -547,199 +547,199 @@ discard block |
||
| 547 | 547 | $observed_value = wp_kses_post( $observed_value ); |
| 548 | 548 | $hide_opt = wp_kses_post( $hide_opt ); |
| 549 | 549 | |
| 550 | - if ( is_array($observed_value) ) { |
|
| 551 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
| 552 | - } |
|
| 553 | - |
|
| 554 | - $m = false; |
|
| 555 | - if ( $cond == '==' ) { |
|
| 556 | - $m = $observed_value == $hide_opt; |
|
| 557 | - } else if ( $cond == '!=' ) { |
|
| 558 | - $m = $observed_value != $hide_opt; |
|
| 559 | - } else if ( $cond == '>' ) { |
|
| 560 | - $m = $observed_value > $hide_opt; |
|
| 561 | - } else if ( $cond == '<' ) { |
|
| 562 | - $m = $observed_value < $hide_opt; |
|
| 563 | - } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
| 564 | - $m = stripos($observed_value, $hide_opt); |
|
| 565 | - if ( $cond == 'not LIKE' ) { |
|
| 566 | - $m = ( $m === false ) ? true : false; |
|
| 567 | - } else { |
|
| 568 | - $m = ( $m === false ) ? false : true; |
|
| 569 | - } |
|
| 570 | - } |
|
| 571 | - return $m; |
|
| 572 | - } |
|
| 550 | + if ( is_array($observed_value) ) { |
|
| 551 | + return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
| 552 | + } |
|
| 553 | + |
|
| 554 | + $m = false; |
|
| 555 | + if ( $cond == '==' ) { |
|
| 556 | + $m = $observed_value == $hide_opt; |
|
| 557 | + } else if ( $cond == '!=' ) { |
|
| 558 | + $m = $observed_value != $hide_opt; |
|
| 559 | + } else if ( $cond == '>' ) { |
|
| 560 | + $m = $observed_value > $hide_opt; |
|
| 561 | + } else if ( $cond == '<' ) { |
|
| 562 | + $m = $observed_value < $hide_opt; |
|
| 563 | + } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
| 564 | + $m = stripos($observed_value, $hide_opt); |
|
| 565 | + if ( $cond == 'not LIKE' ) { |
|
| 566 | + $m = ( $m === false ) ? true : false; |
|
| 567 | + } else { |
|
| 568 | + $m = ( $m === false ) ? false : true; |
|
| 569 | + } |
|
| 570 | + } |
|
| 571 | + return $m; |
|
| 572 | + } |
|
| 573 | 573 | |
| 574 | 574 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
| 575 | - $m = false; |
|
| 576 | - if ( $cond == '==' ) { |
|
| 577 | - if ( is_array($hide_opt) ) { |
|
| 578 | - $m = array_intersect($hide_opt, $observed_value); |
|
| 579 | - $m = empty($m) ? false : true; |
|
| 580 | - } else { |
|
| 581 | - $m = in_array($hide_opt, $observed_value); |
|
| 582 | - } |
|
| 583 | - } else if ( $cond == '!=' ) { |
|
| 584 | - $m = ! in_array($hide_opt, $observed_value); |
|
| 585 | - } else if ( $cond == '>' ) { |
|
| 586 | - $min = min($observed_value); |
|
| 587 | - $m = $min > $hide_opt; |
|
| 588 | - } else if ( $cond == '<' ) { |
|
| 589 | - $max = max($observed_value); |
|
| 590 | - $m = $max < $hide_opt; |
|
| 591 | - } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
| 592 | - foreach ( $observed_value as $ob ) { |
|
| 593 | - $m = strpos($ob, $hide_opt); |
|
| 594 | - if ( $m !== false ) { |
|
| 595 | - $m = true; |
|
| 596 | - break; |
|
| 597 | - } |
|
| 598 | - } |
|
| 599 | - |
|
| 600 | - if ( $cond == 'not LIKE' ) { |
|
| 601 | - $m = ( $m === false ) ? true : false; |
|
| 602 | - } |
|
| 603 | - } |
|
| 604 | - |
|
| 605 | - return $m; |
|
| 606 | - } |
|
| 607 | - |
|
| 608 | - /** |
|
| 609 | - * Replace a few basic shortcodes and field ids |
|
| 610 | - * @since 2.0 |
|
| 611 | - * @return string |
|
| 612 | - */ |
|
| 575 | + $m = false; |
|
| 576 | + if ( $cond == '==' ) { |
|
| 577 | + if ( is_array($hide_opt) ) { |
|
| 578 | + $m = array_intersect($hide_opt, $observed_value); |
|
| 579 | + $m = empty($m) ? false : true; |
|
| 580 | + } else { |
|
| 581 | + $m = in_array($hide_opt, $observed_value); |
|
| 582 | + } |
|
| 583 | + } else if ( $cond == '!=' ) { |
|
| 584 | + $m = ! in_array($hide_opt, $observed_value); |
|
| 585 | + } else if ( $cond == '>' ) { |
|
| 586 | + $min = min($observed_value); |
|
| 587 | + $m = $min > $hide_opt; |
|
| 588 | + } else if ( $cond == '<' ) { |
|
| 589 | + $max = max($observed_value); |
|
| 590 | + $m = $max < $hide_opt; |
|
| 591 | + } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
|
| 592 | + foreach ( $observed_value as $ob ) { |
|
| 593 | + $m = strpos($ob, $hide_opt); |
|
| 594 | + if ( $m !== false ) { |
|
| 595 | + $m = true; |
|
| 596 | + break; |
|
| 597 | + } |
|
| 598 | + } |
|
| 599 | + |
|
| 600 | + if ( $cond == 'not LIKE' ) { |
|
| 601 | + $m = ( $m === false ) ? true : false; |
|
| 602 | + } |
|
| 603 | + } |
|
| 604 | + |
|
| 605 | + return $m; |
|
| 606 | + } |
|
| 607 | + |
|
| 608 | + /** |
|
| 609 | + * Replace a few basic shortcodes and field ids |
|
| 610 | + * @since 2.0 |
|
| 611 | + * @return string |
|
| 612 | + */ |
|
| 613 | 613 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
| 614 | - if ( strpos($value, '[sitename]') !== false ) { |
|
| 615 | - $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
| 616 | - $value = str_replace('[sitename]', $new_value, $value); |
|
| 617 | - } |
|
| 614 | + if ( strpos($value, '[sitename]') !== false ) { |
|
| 615 | + $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
| 616 | + $value = str_replace('[sitename]', $new_value, $value); |
|
| 617 | + } |
|
| 618 | 618 | |
| 619 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
| 620 | - $value = do_shortcode($value); |
|
| 619 | + $value = apply_filters('frm_content', $value, $form, $entry); |
|
| 620 | + $value = do_shortcode($value); |
|
| 621 | 621 | |
| 622 | - return $value; |
|
| 623 | - } |
|
| 622 | + return $value; |
|
| 623 | + } |
|
| 624 | 624 | |
| 625 | 625 | public static function get_shortcodes( $content, $form_id ) { |
| 626 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 627 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
| 628 | - } |
|
| 626 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 627 | + return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
| 628 | + } |
|
| 629 | 629 | |
| 630 | - $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
|
| 630 | + $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
|
| 631 | 631 | |
| 632 | - $tagregexp = self::allowed_shortcodes($fields); |
|
| 632 | + $tagregexp = self::allowed_shortcodes($fields); |
|
| 633 | 633 | |
| 634 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
| 634 | + preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
| 635 | 635 | |
| 636 | - return $matches; |
|
| 637 | - } |
|
| 636 | + return $matches; |
|
| 637 | + } |
|
| 638 | 638 | |
| 639 | 639 | public static function allowed_shortcodes( $fields = array() ) { |
| 640 | - $tagregexp = array( |
|
| 641 | - 'editlink', 'id', 'key', 'ip', |
|
| 642 | - 'siteurl', 'sitename', 'admin_email', |
|
| 643 | - 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', |
|
| 640 | + $tagregexp = array( |
|
| 641 | + 'editlink', 'id', 'key', 'ip', |
|
| 642 | + 'siteurl', 'sitename', 'admin_email', |
|
| 643 | + 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', |
|
| 644 | 644 | 'parent[-|_]id', |
| 645 | - ); |
|
| 645 | + ); |
|
| 646 | 646 | |
| 647 | - foreach ( $fields as $field ) { |
|
| 648 | - $tagregexp[] = $field->id; |
|
| 649 | - $tagregexp[] = $field->field_key; |
|
| 650 | - } |
|
| 647 | + foreach ( $fields as $field ) { |
|
| 648 | + $tagregexp[] = $field->id; |
|
| 649 | + $tagregexp[] = $field->field_key; |
|
| 650 | + } |
|
| 651 | 651 | |
| 652 | - $tagregexp = implode('|', $tagregexp); |
|
| 653 | - return $tagregexp; |
|
| 654 | - } |
|
| 652 | + $tagregexp = implode('|', $tagregexp); |
|
| 653 | + return $tagregexp; |
|
| 654 | + } |
|
| 655 | 655 | |
| 656 | 656 | public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
| 657 | - $shortcode_values = array( |
|
| 658 | - 'id' => $entry->id, |
|
| 659 | - 'key' => $entry->item_key, |
|
| 660 | - 'ip' => $entry->ip, |
|
| 661 | - ); |
|
| 657 | + $shortcode_values = array( |
|
| 658 | + 'id' => $entry->id, |
|
| 659 | + 'key' => $entry->item_key, |
|
| 660 | + 'ip' => $entry->ip, |
|
| 661 | + ); |
|
| 662 | 662 | |
| 663 | - foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 663 | + foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 664 | 664 | if ( empty( $tag ) ) { |
| 665 | 665 | continue; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 668 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 669 | 669 | |
| 670 | - if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
| 670 | + if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
| 671 | 671 | $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] ); |
| 672 | - $tags = explode(' ', $tag); |
|
| 673 | - if ( is_array($tags) ) { |
|
| 674 | - $tag = $tags[0]; |
|
| 675 | - } |
|
| 676 | - } else { |
|
| 677 | - $tag = $shortcodes[2][ $short_key ]; |
|
| 678 | - } |
|
| 679 | - |
|
| 680 | - switch ( $tag ) { |
|
| 681 | - case 'id': |
|
| 682 | - case 'key': |
|
| 683 | - case 'ip': |
|
| 684 | - $replace_with = $shortcode_values[ $tag ]; |
|
| 685 | - break; |
|
| 686 | - |
|
| 687 | - case 'user_agent': |
|
| 688 | - case 'user-agent': |
|
| 689 | - $entry->description = maybe_unserialize($entry->description); |
|
| 672 | + $tags = explode(' ', $tag); |
|
| 673 | + if ( is_array($tags) ) { |
|
| 674 | + $tag = $tags[0]; |
|
| 675 | + } |
|
| 676 | + } else { |
|
| 677 | + $tag = $shortcodes[2][ $short_key ]; |
|
| 678 | + } |
|
| 679 | + |
|
| 680 | + switch ( $tag ) { |
|
| 681 | + case 'id': |
|
| 682 | + case 'key': |
|
| 683 | + case 'ip': |
|
| 684 | + $replace_with = $shortcode_values[ $tag ]; |
|
| 685 | + break; |
|
| 686 | + |
|
| 687 | + case 'user_agent': |
|
| 688 | + case 'user-agent': |
|
| 689 | + $entry->description = maybe_unserialize($entry->description); |
|
| 690 | 690 | $replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] ); |
| 691 | - break; |
|
| 692 | - |
|
| 693 | - case 'created_at': |
|
| 694 | - case 'created-at': |
|
| 695 | - case 'updated_at': |
|
| 696 | - case 'updated-at': |
|
| 697 | - if ( isset($atts['format']) ) { |
|
| 698 | - $time_format = ' '; |
|
| 699 | - } else { |
|
| 700 | - $atts['format'] = get_option('date_format'); |
|
| 701 | - $time_format = ''; |
|
| 702 | - } |
|
| 703 | - |
|
| 704 | - $this_tag = str_replace('-', '_', $tag); |
|
| 705 | - $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
| 706 | - unset($this_tag); |
|
| 707 | - break; |
|
| 708 | - |
|
| 709 | - case 'created_by': |
|
| 710 | - case 'created-by': |
|
| 711 | - case 'updated_by': |
|
| 712 | - case 'updated-by': |
|
| 713 | - $this_tag = str_replace('-', '_', $tag); |
|
| 691 | + break; |
|
| 692 | + |
|
| 693 | + case 'created_at': |
|
| 694 | + case 'created-at': |
|
| 695 | + case 'updated_at': |
|
| 696 | + case 'updated-at': |
|
| 697 | + if ( isset($atts['format']) ) { |
|
| 698 | + $time_format = ' '; |
|
| 699 | + } else { |
|
| 700 | + $atts['format'] = get_option('date_format'); |
|
| 701 | + $time_format = ''; |
|
| 702 | + } |
|
| 703 | + |
|
| 704 | + $this_tag = str_replace('-', '_', $tag); |
|
| 705 | + $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
| 706 | + unset($this_tag); |
|
| 707 | + break; |
|
| 708 | + |
|
| 709 | + case 'created_by': |
|
| 710 | + case 'created-by': |
|
| 711 | + case 'updated_by': |
|
| 712 | + case 'updated-by': |
|
| 713 | + $this_tag = str_replace('-', '_', $tag); |
|
| 714 | 714 | $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
| 715 | - unset($this_tag); |
|
| 716 | - break; |
|
| 717 | - |
|
| 718 | - case 'admin_email': |
|
| 719 | - case 'siteurl': |
|
| 720 | - case 'frmurl': |
|
| 721 | - case 'sitename': |
|
| 722 | - case 'get': |
|
| 723 | - $replace_with = self::dynamic_default_values( $tag, $atts ); |
|
| 724 | - break; |
|
| 725 | - |
|
| 726 | - default: |
|
| 727 | - $field = FrmField::getOne( $tag ); |
|
| 728 | - if ( ! $field ) { |
|
| 729 | - break; |
|
| 730 | - } |
|
| 731 | - |
|
| 732 | - $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
| 733 | - |
|
| 734 | - $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
|
| 735 | - |
|
| 736 | - $atts['entry_id'] = $entry->id; |
|
| 737 | - $atts['entry_key'] = $entry->item_key; |
|
| 738 | - |
|
| 739 | - if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
| 740 | - $replace_with = $field->name; |
|
| 741 | - } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
| 742 | - $replace_with = $field->description; |
|
| 715 | + unset($this_tag); |
|
| 716 | + break; |
|
| 717 | + |
|
| 718 | + case 'admin_email': |
|
| 719 | + case 'siteurl': |
|
| 720 | + case 'frmurl': |
|
| 721 | + case 'sitename': |
|
| 722 | + case 'get': |
|
| 723 | + $replace_with = self::dynamic_default_values( $tag, $atts ); |
|
| 724 | + break; |
|
| 725 | + |
|
| 726 | + default: |
|
| 727 | + $field = FrmField::getOne( $tag ); |
|
| 728 | + if ( ! $field ) { |
|
| 729 | + break; |
|
| 730 | + } |
|
| 731 | + |
|
| 732 | + $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
| 733 | + |
|
| 734 | + $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
|
| 735 | + |
|
| 736 | + $atts['entry_id'] = $entry->id; |
|
| 737 | + $atts['entry_key'] = $entry->item_key; |
|
| 738 | + |
|
| 739 | + if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
| 740 | + $replace_with = $field->name; |
|
| 741 | + } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
| 742 | + $replace_with = $field->description; |
|
| 743 | 743 | } else { |
| 744 | 744 | $string_value = $replace_with; |
| 745 | 745 | if ( is_array( $replace_with ) ) { |
@@ -753,82 +753,82 @@ discard block |
||
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | - unset($field); |
|
| 757 | - break; |
|
| 758 | - } |
|
| 756 | + unset($field); |
|
| 757 | + break; |
|
| 758 | + } |
|
| 759 | 759 | |
| 760 | - if ( isset($replace_with) ) { |
|
| 761 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 762 | - } |
|
| 760 | + if ( isset($replace_with) ) { |
|
| 761 | + $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 762 | + } |
|
| 763 | 763 | |
| 764 | - unset($atts, $conditional, $replace_with); |
|
| 764 | + unset($atts, $conditional, $replace_with); |
|
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | return $content; |
| 768 | - } |
|
| 769 | - |
|
| 770 | - /** |
|
| 771 | - * Get the value to replace a few standard shortcodes |
|
| 772 | - * |
|
| 773 | - * @since 2.0 |
|
| 774 | - * @return string |
|
| 775 | - */ |
|
| 776 | - public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
| 777 | - $new_value = ''; |
|
| 778 | - switch ( $tag ) { |
|
| 779 | - case 'admin_email': |
|
| 780 | - $new_value = get_option('admin_email'); |
|
| 781 | - break; |
|
| 782 | - case 'siteurl': |
|
| 783 | - $new_value = FrmAppHelper::site_url(); |
|
| 784 | - break; |
|
| 785 | - case 'frmurl': |
|
| 786 | - $new_value = FrmAppHelper::plugin_url(); |
|
| 787 | - break; |
|
| 788 | - case 'sitename': |
|
| 789 | - $new_value = FrmAppHelper::site_name(); |
|
| 790 | - break; |
|
| 791 | - case 'get': |
|
| 792 | - $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
| 793 | - break; |
|
| 794 | - } |
|
| 795 | - |
|
| 796 | - return $new_value; |
|
| 797 | - } |
|
| 798 | - |
|
| 799 | - /** |
|
| 800 | - * Process the [get] shortcode |
|
| 801 | - * |
|
| 802 | - * @since 2.0 |
|
| 803 | - * @return string|array |
|
| 804 | - */ |
|
| 805 | - public static function process_get_shortcode( $atts, $return_array = false ) { |
|
| 806 | - if ( ! isset($atts['param']) ) { |
|
| 807 | - return ''; |
|
| 808 | - } |
|
| 809 | - |
|
| 810 | - if ( strpos($atts['param'], '[') ) { |
|
| 811 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
| 812 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
| 813 | - } |
|
| 814 | - |
|
| 815 | - $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
| 816 | - $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
| 817 | - |
|
| 818 | - if ( $new_value == '' ) { |
|
| 819 | - if ( ! isset($atts['prev_val']) ) { |
|
| 820 | - $atts['prev_val'] = ''; |
|
| 821 | - } |
|
| 822 | - |
|
| 823 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
| 824 | - } |
|
| 825 | - |
|
| 826 | - if ( is_array($new_value) && ! $return_array ) { |
|
| 827 | - $new_value = implode(', ', $new_value); |
|
| 828 | - } |
|
| 829 | - |
|
| 830 | - return $new_value; |
|
| 831 | - } |
|
| 768 | + } |
|
| 769 | + |
|
| 770 | + /** |
|
| 771 | + * Get the value to replace a few standard shortcodes |
|
| 772 | + * |
|
| 773 | + * @since 2.0 |
|
| 774 | + * @return string |
|
| 775 | + */ |
|
| 776 | + public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
| 777 | + $new_value = ''; |
|
| 778 | + switch ( $tag ) { |
|
| 779 | + case 'admin_email': |
|
| 780 | + $new_value = get_option('admin_email'); |
|
| 781 | + break; |
|
| 782 | + case 'siteurl': |
|
| 783 | + $new_value = FrmAppHelper::site_url(); |
|
| 784 | + break; |
|
| 785 | + case 'frmurl': |
|
| 786 | + $new_value = FrmAppHelper::plugin_url(); |
|
| 787 | + break; |
|
| 788 | + case 'sitename': |
|
| 789 | + $new_value = FrmAppHelper::site_name(); |
|
| 790 | + break; |
|
| 791 | + case 'get': |
|
| 792 | + $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
| 793 | + break; |
|
| 794 | + } |
|
| 795 | + |
|
| 796 | + return $new_value; |
|
| 797 | + } |
|
| 798 | + |
|
| 799 | + /** |
|
| 800 | + * Process the [get] shortcode |
|
| 801 | + * |
|
| 802 | + * @since 2.0 |
|
| 803 | + * @return string|array |
|
| 804 | + */ |
|
| 805 | + public static function process_get_shortcode( $atts, $return_array = false ) { |
|
| 806 | + if ( ! isset($atts['param']) ) { |
|
| 807 | + return ''; |
|
| 808 | + } |
|
| 809 | + |
|
| 810 | + if ( strpos($atts['param'], '[') ) { |
|
| 811 | + $atts['param'] = str_replace('[', '[', $atts['param']); |
|
| 812 | + $atts['param'] = str_replace(']', ']', $atts['param']); |
|
| 813 | + } |
|
| 814 | + |
|
| 815 | + $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
| 816 | + $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
| 817 | + |
|
| 818 | + if ( $new_value == '' ) { |
|
| 819 | + if ( ! isset($atts['prev_val']) ) { |
|
| 820 | + $atts['prev_val'] = ''; |
|
| 821 | + } |
|
| 822 | + |
|
| 823 | + $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
| 824 | + } |
|
| 825 | + |
|
| 826 | + if ( is_array($new_value) && ! $return_array ) { |
|
| 827 | + $new_value = implode(', ', $new_value); |
|
| 828 | + } |
|
| 829 | + |
|
| 830 | + return $new_value; |
|
| 831 | + } |
|
| 832 | 832 | |
| 833 | 833 | public static function get_display_value( $replace_with, $field, $atts = array() ) { |
| 834 | 834 | $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
@@ -836,14 +836,14 @@ discard block |
||
| 836 | 836 | $replace_with = apply_filters( 'frm_get_' . $field->type . '_display_value', $replace_with, $field, $atts ); |
| 837 | 837 | $replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts ); |
| 838 | 838 | |
| 839 | - if ( $field->type == 'textarea' || $field->type == 'rte' ) { |
|
| 840 | - $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true; |
|
| 841 | - if ( apply_filters('frm_use_wpautop', $autop) ) { |
|
| 842 | - if ( is_array($replace_with) ) { |
|
| 843 | - $replace_with = implode("\n", $replace_with); |
|
| 844 | - } |
|
| 845 | - $replace_with = wpautop($replace_with); |
|
| 846 | - } |
|
| 839 | + if ( $field->type == 'textarea' || $field->type == 'rte' ) { |
|
| 840 | + $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true; |
|
| 841 | + if ( apply_filters('frm_use_wpautop', $autop) ) { |
|
| 842 | + if ( is_array($replace_with) ) { |
|
| 843 | + $replace_with = implode("\n", $replace_with); |
|
| 844 | + } |
|
| 845 | + $replace_with = wpautop($replace_with); |
|
| 846 | + } |
|
| 847 | 847 | unset( $autop ); |
| 848 | 848 | } else if ( is_array( $replace_with ) ) { |
| 849 | 849 | if ( isset( $atts['show'] ) && $atts['show'] && isset( $replace_with[ $atts['show'] ] ) ) { |
@@ -857,37 +857,37 @@ discard block |
||
| 857 | 857 | } |
| 858 | 858 | |
| 859 | 859 | public static function get_field_types( $type ) { |
| 860 | - $single_input = array( |
|
| 861 | - 'text', 'textarea', 'rte', 'number', 'email', 'url', |
|
| 862 | - 'image', 'file', 'date', 'phone', 'hidden', 'time', |
|
| 863 | - 'user_id', 'tag', 'password', |
|
| 864 | - ); |
|
| 860 | + $single_input = array( |
|
| 861 | + 'text', 'textarea', 'rte', 'number', 'email', 'url', |
|
| 862 | + 'image', 'file', 'date', 'phone', 'hidden', 'time', |
|
| 863 | + 'user_id', 'tag', 'password', |
|
| 864 | + ); |
|
| 865 | 865 | $multiple_input = array( 'radio', 'checkbox', 'select', 'scale', 'lookup' ); |
| 866 | 866 | $other_type = array( 'html', 'break' ); |
| 867 | 867 | |
| 868 | 868 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
| 869 | 869 | |
| 870 | - $field_types = array(); |
|
| 871 | - if ( in_array($type, $single_input) ) { |
|
| 872 | - self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
| 873 | - } else if ( in_array($type, $multiple_input) ) { |
|
| 874 | - self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
| 875 | - } else if ( in_array($type, $other_type) ) { |
|
| 876 | - self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
| 870 | + $field_types = array(); |
|
| 871 | + if ( in_array($type, $single_input) ) { |
|
| 872 | + self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
| 873 | + } else if ( in_array($type, $multiple_input) ) { |
|
| 874 | + self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
| 875 | + } else if ( in_array($type, $other_type) ) { |
|
| 876 | + self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
| 877 | 877 | } else if ( isset( $field_selection[ $type ] ) ) { |
| 878 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 879 | - } |
|
| 878 | + $field_types[ $type ] = $field_selection[ $type ]; |
|
| 879 | + } |
|
| 880 | 880 | |
| 881 | 881 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
| 882 | - return $field_types; |
|
| 883 | - } |
|
| 882 | + return $field_types; |
|
| 883 | + } |
|
| 884 | 884 | |
| 885 | - private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
| 886 | - foreach ( $inputs as $input ) { |
|
| 887 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 888 | - unset($input); |
|
| 889 | - } |
|
| 890 | - } |
|
| 885 | + private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
| 886 | + foreach ( $inputs as $input ) { |
|
| 887 | + $field_types[ $input ] = $fields[ $input ]; |
|
| 888 | + unset($input); |
|
| 889 | + } |
|
| 890 | + } |
|
| 891 | 891 | |
| 892 | 892 | /** |
| 893 | 893 | * Check if current field option is an "other" option |
@@ -901,14 +901,14 @@ discard block |
||
| 901 | 901 | return $opt_key && strpos( $opt_key, 'other_' ) === 0; |
| 902 | 902 | } |
| 903 | 903 | |
| 904 | - /** |
|
| 905 | - * Get value that belongs in "Other" text box |
|
| 906 | - * |
|
| 907 | - * @since 2.0.6 |
|
| 908 | - * |
|
| 909 | - * @param array $args |
|
| 910 | - */ |
|
| 911 | - public static function get_other_val( $args ) { |
|
| 904 | + /** |
|
| 905 | + * Get value that belongs in "Other" text box |
|
| 906 | + * |
|
| 907 | + * @since 2.0.6 |
|
| 908 | + * |
|
| 909 | + * @param array $args |
|
| 910 | + */ |
|
| 911 | + public static function get_other_val( $args ) { |
|
| 912 | 912 | $defaults = array( |
| 913 | 913 | 'opt_key' => 0, 'field' => array(), |
| 914 | 914 | 'parent' => false, 'pointer' => false, |
@@ -984,20 +984,20 @@ discard block |
||
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | return $other_val; |
| 987 | - } |
|
| 988 | - |
|
| 989 | - /** |
|
| 990 | - * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
| 991 | - * Intended for front-end use |
|
| 992 | - * |
|
| 993 | - * @since 2.0.6 |
|
| 994 | - * |
|
| 995 | - * @param array $args should include field, opt_key and field name |
|
| 996 | - * @param boolean $other_opt |
|
| 997 | - * @param string $checked |
|
| 998 | - * @return string $other_val |
|
| 999 | - */ |
|
| 1000 | - public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
| 987 | + } |
|
| 988 | + |
|
| 989 | + /** |
|
| 990 | + * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
| 991 | + * Intended for front-end use |
|
| 992 | + * |
|
| 993 | + * @since 2.0.6 |
|
| 994 | + * |
|
| 995 | + * @param array $args should include field, opt_key and field name |
|
| 996 | + * @param boolean $other_opt |
|
| 997 | + * @param string $checked |
|
| 998 | + * @return string $other_val |
|
| 999 | + */ |
|
| 1000 | + public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
| 1001 | 1001 | //Check if this is an "Other" option |
| 1002 | 1002 | if ( ! self::is_other_opt( $args['opt_key'] ) ) { |
| 1003 | 1003 | return; |
@@ -1013,8 +1013,8 @@ discard block |
||
| 1013 | 1013 | $checked = 'checked="checked" '; |
| 1014 | 1014 | } |
| 1015 | 1015 | |
| 1016 | - return $other_args; |
|
| 1017 | - } |
|
| 1016 | + return $other_args; |
|
| 1017 | + } |
|
| 1018 | 1018 | |
| 1019 | 1019 | /** |
| 1020 | 1020 | * @param array $args |
@@ -1064,8 +1064,8 @@ discard block |
||
| 1064 | 1064 | * @since 2.0.6 |
| 1065 | 1065 | */ |
| 1066 | 1066 | public static function include_other_input( $args ) { |
| 1067 | - if ( ! $args['other_opt'] ) { |
|
| 1068 | - return; |
|
| 1067 | + if ( ! $args['other_opt'] ) { |
|
| 1068 | + return; |
|
| 1069 | 1069 | } |
| 1070 | 1070 | |
| 1071 | 1071 | $classes = array( 'frm_other_input' ); |
@@ -1086,15 +1086,15 @@ discard block |
||
| 1086 | 1086 | } |
| 1087 | 1087 | |
| 1088 | 1088 | /** |
| 1089 | - * Get the HTML id for an "Other" text field |
|
| 1090 | - * Note: This does not affect fields in repeating sections |
|
| 1091 | - * |
|
| 1092 | - * @since 2.0.08 |
|
| 1093 | - * @param string $type - field type |
|
| 1094 | - * @param string $html_id |
|
| 1095 | - * @param string|boolean $opt_key |
|
| 1096 | - * @return string $other_id |
|
| 1097 | - */ |
|
| 1089 | + * Get the HTML id for an "Other" text field |
|
| 1090 | + * Note: This does not affect fields in repeating sections |
|
| 1091 | + * |
|
| 1092 | + * @since 2.0.08 |
|
| 1093 | + * @param string $type - field type |
|
| 1094 | + * @param string $html_id |
|
| 1095 | + * @param string|boolean $opt_key |
|
| 1096 | + * @return string $other_id |
|
| 1097 | + */ |
|
| 1098 | 1098 | public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) { |
| 1099 | 1099 | $other_id = $html_id; |
| 1100 | 1100 | |
@@ -1152,10 +1152,10 @@ discard block |
||
| 1152 | 1152 | } |
| 1153 | 1153 | |
| 1154 | 1154 | public static function switch_field_ids( $val ) { |
| 1155 | - global $frm_duplicate_ids; |
|
| 1156 | - $replace = array(); |
|
| 1157 | - $replace_with = array(); |
|
| 1158 | - foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
| 1155 | + global $frm_duplicate_ids; |
|
| 1156 | + $replace = array(); |
|
| 1157 | + $replace_with = array(); |
|
| 1158 | + foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
| 1159 | 1159 | $replace[] = '[if ' . $old . ']'; |
| 1160 | 1160 | $replace_with[] = '[if ' . $new . ']'; |
| 1161 | 1161 | $replace[] = '[if ' . $old . ' '; |
@@ -1170,153 +1170,153 @@ discard block |
||
| 1170 | 1170 | $replace_with[] = '[' . $new . ']'; |
| 1171 | 1171 | $replace[] = '[' . $old . ' '; |
| 1172 | 1172 | $replace_with[] = '[' . $new . ' '; |
| 1173 | - unset($old, $new); |
|
| 1174 | - } |
|
| 1173 | + unset($old, $new); |
|
| 1174 | + } |
|
| 1175 | 1175 | if ( is_array( $val ) ) { |
| 1176 | 1176 | foreach ( $val as $k => $v ) { |
| 1177 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1178 | - unset($k, $v); |
|
| 1179 | - } |
|
| 1180 | - } else { |
|
| 1181 | - $val = str_replace($replace, $replace_with, $val); |
|
| 1182 | - } |
|
| 1183 | - |
|
| 1184 | - return $val; |
|
| 1185 | - } |
|
| 1186 | - |
|
| 1187 | - public static function get_us_states() { |
|
| 1188 | - return apply_filters( 'frm_us_states', array( |
|
| 1189 | - 'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona', |
|
| 1190 | - 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', |
|
| 1191 | - 'DC' => 'District of Columbia', |
|
| 1192 | - 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
|
| 1193 | - 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
|
| 1194 | - 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
| 1195 | - 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
|
| 1196 | - 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
|
| 1197 | - 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
|
| 1198 | - 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', |
|
| 1199 | - 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', |
|
| 1200 | - 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', |
|
| 1201 | - 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', |
|
| 1202 | - 'WI' => 'Wisconsin', 'WY' => 'Wyoming', |
|
| 1203 | - ) ); |
|
| 1204 | - } |
|
| 1205 | - |
|
| 1206 | - public static function get_countries() { |
|
| 1207 | - return apply_filters( 'frm_countries', array( |
|
| 1208 | - __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ), |
|
| 1209 | - __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ), |
|
| 1210 | - __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ), |
|
| 1211 | - __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ), |
|
| 1212 | - __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ), |
|
| 1213 | - __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ), |
|
| 1214 | - __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ), |
|
| 1215 | - __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ), |
|
| 1216 | - __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ), |
|
| 1217 | - __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ), |
|
| 1218 | - __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ), |
|
| 1219 | - __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ), |
|
| 1220 | - __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ), |
|
| 1221 | - __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ), |
|
| 1222 | - __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ), |
|
| 1223 | - __( 'Costa Rica', 'formidable' ), __( 'Côte d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ), |
|
| 1224 | - __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ), |
|
| 1225 | - __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ), |
|
| 1226 | - __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ), |
|
| 1227 | - __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ), |
|
| 1228 | - __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ), |
|
| 1229 | - __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ), |
|
| 1230 | - __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ), |
|
| 1231 | - __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ), |
|
| 1232 | - __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ), |
|
| 1233 | - __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ), |
|
| 1234 | - __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ), |
|
| 1235 | - __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ), |
|
| 1236 | - __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ), |
|
| 1237 | - __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ), |
|
| 1238 | - __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ), |
|
| 1239 | - __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ), |
|
| 1240 | - __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ), |
|
| 1241 | - __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ), |
|
| 1242 | - __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ), |
|
| 1243 | - __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ), |
|
| 1244 | - __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ), |
|
| 1245 | - __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ), |
|
| 1246 | - __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ), |
|
| 1247 | - __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ), |
|
| 1248 | - __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ), |
|
| 1249 | - __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ), |
|
| 1250 | - __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ), |
|
| 1251 | - __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ), |
|
| 1252 | - __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ), |
|
| 1253 | - __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ), |
|
| 1254 | - __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ), |
|
| 1255 | - __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ), |
|
| 1256 | - __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ), |
|
| 1257 | - __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ), |
|
| 1258 | - __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ), |
|
| 1259 | - __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ), |
|
| 1260 | - __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ), |
|
| 1261 | - __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ), |
|
| 1262 | - __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ), |
|
| 1263 | - __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ), |
|
| 1264 | - __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ), |
|
| 1265 | - __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ), |
|
| 1266 | - __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ), |
|
| 1267 | - __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ), |
|
| 1268 | - __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ), |
|
| 1269 | - __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ), |
|
| 1270 | - __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ), |
|
| 1271 | - __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ), |
|
| 1272 | - __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ), |
|
| 1273 | - __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ), |
|
| 1274 | - __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ), |
|
| 1275 | - __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ), |
|
| 1276 | - __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ), |
|
| 1277 | - __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ), |
|
| 1278 | - __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ), |
|
| 1279 | - __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ), |
|
| 1280 | - __( 'Zimbabwe', 'formidable' ), |
|
| 1281 | - ) ); |
|
| 1282 | - } |
|
| 1177 | + $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1178 | + unset($k, $v); |
|
| 1179 | + } |
|
| 1180 | + } else { |
|
| 1181 | + $val = str_replace($replace, $replace_with, $val); |
|
| 1182 | + } |
|
| 1183 | + |
|
| 1184 | + return $val; |
|
| 1185 | + } |
|
| 1186 | + |
|
| 1187 | + public static function get_us_states() { |
|
| 1188 | + return apply_filters( 'frm_us_states', array( |
|
| 1189 | + 'AL' => 'Alabama', 'AK' => 'Alaska', 'AR' => 'Arkansas', 'AZ' => 'Arizona', |
|
| 1190 | + 'CA' => 'California', 'CO' => 'Colorado', 'CT' => 'Connecticut', 'DE' => 'Delaware', |
|
| 1191 | + 'DC' => 'District of Columbia', |
|
| 1192 | + 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
|
| 1193 | + 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
|
| 1194 | + 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
| 1195 | + 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
|
| 1196 | + 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
|
| 1197 | + 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
|
| 1198 | + 'NC' => 'North Carolina', 'ND' => 'North Dakota', 'OH' => 'Ohio', 'OK' => 'Oklahoma', |
|
| 1199 | + 'OR' => 'Oregon', 'PA' => 'Pennsylvania', 'RI' => 'Rhode Island', 'SC' => 'South Carolina', |
|
| 1200 | + 'SD' => 'South Dakota', 'TN' => 'Tennessee', 'TX' => 'Texas', 'UT' => 'Utah', |
|
| 1201 | + 'VT' => 'Vermont', 'VA' => 'Virginia', 'WA' => 'Washington', 'WV' => 'West Virginia', |
|
| 1202 | + 'WI' => 'Wisconsin', 'WY' => 'Wyoming', |
|
| 1203 | + ) ); |
|
| 1204 | + } |
|
| 1205 | + |
|
| 1206 | + public static function get_countries() { |
|
| 1207 | + return apply_filters( 'frm_countries', array( |
|
| 1208 | + __( 'Afghanistan', 'formidable' ), __( 'Albania', 'formidable' ), __( 'Algeria', 'formidable' ), |
|
| 1209 | + __( 'American Samoa', 'formidable' ), __( 'Andorra', 'formidable' ), __( 'Angola', 'formidable' ), |
|
| 1210 | + __( 'Anguilla', 'formidable' ), __( 'Antarctica', 'formidable' ), __( 'Antigua and Barbuda', 'formidable' ), |
|
| 1211 | + __( 'Argentina', 'formidable' ), __( 'Armenia', 'formidable' ), __( 'Aruba', 'formidable' ), |
|
| 1212 | + __( 'Australia', 'formidable' ), __( 'Austria', 'formidable' ), __( 'Azerbaijan', 'formidable' ), |
|
| 1213 | + __( 'Bahamas', 'formidable' ), __( 'Bahrain', 'formidable' ), __( 'Bangladesh', 'formidable' ), |
|
| 1214 | + __( 'Barbados', 'formidable' ), __( 'Belarus', 'formidable' ), __( 'Belgium', 'formidable' ), |
|
| 1215 | + __( 'Belize', 'formidable' ), __( 'Benin', 'formidable' ), __( 'Bermuda', 'formidable' ), |
|
| 1216 | + __( 'Bhutan', 'formidable' ), __( 'Bolivia', 'formidable' ), __( 'Bosnia and Herzegovina', 'formidable' ), |
|
| 1217 | + __( 'Botswana', 'formidable' ), __( 'Brazil', 'formidable' ), __( 'Brunei', 'formidable' ), |
|
| 1218 | + __( 'Bulgaria', 'formidable' ), __( 'Burkina Faso', 'formidable' ), __( 'Burundi', 'formidable' ), |
|
| 1219 | + __( 'Cambodia', 'formidable' ), __( 'Cameroon', 'formidable' ), __( 'Canada', 'formidable' ), |
|
| 1220 | + __( 'Cape Verde', 'formidable' ), __( 'Cayman Islands', 'formidable' ), __( 'Central African Republic', 'formidable' ), |
|
| 1221 | + __( 'Chad', 'formidable' ), __( 'Chile', 'formidable' ), __( 'China', 'formidable' ), |
|
| 1222 | + __( 'Colombia', 'formidable' ), __( 'Comoros', 'formidable' ), __( 'Congo', 'formidable' ), |
|
| 1223 | + __( 'Costa Rica', 'formidable' ), __( 'Côte d\'Ivoire', 'formidable' ), __( 'Croatia', 'formidable' ), |
|
| 1224 | + __( 'Cuba', 'formidable' ), __( 'Cyprus', 'formidable' ), __( 'Czech Republic', 'formidable' ), |
|
| 1225 | + __( 'Denmark', 'formidable' ), __( 'Djibouti', 'formidable' ), __( 'Dominica', 'formidable' ), |
|
| 1226 | + __( 'Dominican Republic', 'formidable' ), __( 'East Timor', 'formidable' ), __( 'Ecuador', 'formidable' ), |
|
| 1227 | + __( 'Egypt', 'formidable' ), __( 'El Salvador', 'formidable' ), __( 'Equatorial Guinea', 'formidable' ), |
|
| 1228 | + __( 'Eritrea', 'formidable' ), __( 'Estonia', 'formidable' ), __( 'Ethiopia', 'formidable' ), |
|
| 1229 | + __( 'Fiji', 'formidable' ), __( 'Finland', 'formidable' ), __( 'France', 'formidable' ), |
|
| 1230 | + __( 'French Guiana', 'formidable' ), __( 'French Polynesia', 'formidable' ), __( 'Gabon', 'formidable' ), |
|
| 1231 | + __( 'Gambia', 'formidable' ), __( 'Georgia', 'formidable' ), __( 'Germany', 'formidable' ), |
|
| 1232 | + __( 'Ghana', 'formidable' ), __( 'Gibraltar', 'formidable' ), __( 'Greece', 'formidable' ), |
|
| 1233 | + __( 'Greenland', 'formidable' ), __( 'Grenada', 'formidable' ), __( 'Guam', 'formidable' ), |
|
| 1234 | + __( 'Guatemala', 'formidable' ), __( 'Guinea', 'formidable' ), __( 'Guinea-Bissau', 'formidable' ), |
|
| 1235 | + __( 'Guyana', 'formidable' ), __( 'Haiti', 'formidable' ), __( 'Honduras', 'formidable' ), |
|
| 1236 | + __( 'Hong Kong', 'formidable' ), __( 'Hungary', 'formidable' ), __( 'Iceland', 'formidable' ), |
|
| 1237 | + __( 'India', 'formidable' ), __( 'Indonesia', 'formidable' ), __( 'Iran', 'formidable' ), |
|
| 1238 | + __( 'Iraq', 'formidable' ), __( 'Ireland', 'formidable' ), __( 'Israel', 'formidable' ), |
|
| 1239 | + __( 'Italy', 'formidable' ), __( 'Jamaica', 'formidable' ), __( 'Japan', 'formidable' ), |
|
| 1240 | + __( 'Jordan', 'formidable' ), __( 'Kazakhstan', 'formidable' ), __( 'Kenya', 'formidable' ), |
|
| 1241 | + __( 'Kiribati', 'formidable' ), __( 'North Korea', 'formidable' ), __( 'South Korea', 'formidable' ), |
|
| 1242 | + __( 'Kuwait', 'formidable' ), __( 'Kyrgyzstan', 'formidable' ), __( 'Laos', 'formidable' ), |
|
| 1243 | + __( 'Latvia', 'formidable' ), __( 'Lebanon', 'formidable' ), __( 'Lesotho', 'formidable' ), |
|
| 1244 | + __( 'Liberia', 'formidable' ), __( 'Libya', 'formidable' ), __( 'Liechtenstein', 'formidable' ), |
|
| 1245 | + __( 'Lithuania', 'formidable' ), __( 'Luxembourg', 'formidable' ), __( 'Macedonia', 'formidable' ), |
|
| 1246 | + __( 'Madagascar', 'formidable' ), __( 'Malawi', 'formidable' ), __( 'Malaysia', 'formidable' ), |
|
| 1247 | + __( 'Maldives', 'formidable' ), __( 'Mali', 'formidable' ), __( 'Malta', 'formidable' ), |
|
| 1248 | + __( 'Marshall Islands', 'formidable' ), __( 'Mauritania', 'formidable' ), __( 'Mauritius', 'formidable' ), |
|
| 1249 | + __( 'Mexico', 'formidable' ), __( 'Micronesia', 'formidable' ), __( 'Moldova', 'formidable' ), |
|
| 1250 | + __( 'Monaco', 'formidable' ), __( 'Mongolia', 'formidable' ), __( 'Montenegro', 'formidable' ), |
|
| 1251 | + __( 'Montserrat', 'formidable' ), __( 'Morocco', 'formidable' ), __( 'Mozambique', 'formidable' ), |
|
| 1252 | + __( 'Myanmar', 'formidable' ), __( 'Namibia', 'formidable' ), __( 'Nauru', 'formidable' ), |
|
| 1253 | + __( 'Nepal', 'formidable' ), __( 'Netherlands', 'formidable' ), __( 'New Zealand', 'formidable' ), |
|
| 1254 | + __( 'Nicaragua', 'formidable' ), __( 'Niger', 'formidable' ), __( 'Nigeria', 'formidable' ), |
|
| 1255 | + __( 'Norway', 'formidable' ), __( 'Northern Mariana Islands', 'formidable' ), __( 'Oman', 'formidable' ), |
|
| 1256 | + __( 'Pakistan', 'formidable' ), __( 'Palau', 'formidable' ), __( 'Palestine', 'formidable' ), |
|
| 1257 | + __( 'Panama', 'formidable' ), __( 'Papua New Guinea', 'formidable' ), __( 'Paraguay', 'formidable' ), |
|
| 1258 | + __( 'Peru', 'formidable' ), __( 'Philippines', 'formidable' ), __( 'Poland', 'formidable' ), |
|
| 1259 | + __( 'Portugal', 'formidable' ), __( 'Puerto Rico', 'formidable' ), __( 'Qatar', 'formidable' ), |
|
| 1260 | + __( 'Romania', 'formidable' ), __( 'Russia', 'formidable' ), __( 'Rwanda', 'formidable' ), |
|
| 1261 | + __( 'Saint Kitts and Nevis', 'formidable' ), __( 'Saint Lucia', 'formidable' ), |
|
| 1262 | + __( 'Saint Vincent and the Grenadines', 'formidable' ), __( 'Samoa', 'formidable' ), |
|
| 1263 | + __( 'San Marino', 'formidable' ), __( 'Sao Tome and Principe', 'formidable' ), __( 'Saudi Arabia', 'formidable' ), |
|
| 1264 | + __( 'Senegal', 'formidable' ), __( 'Serbia and Montenegro', 'formidable' ), __( 'Seychelles', 'formidable' ), |
|
| 1265 | + __( 'Sierra Leone', 'formidable' ), __( 'Singapore', 'formidable' ), __( 'Slovakia', 'formidable' ), |
|
| 1266 | + __( 'Slovenia', 'formidable' ), __( 'Solomon Islands', 'formidable' ), __( 'Somalia', 'formidable' ), |
|
| 1267 | + __( 'South Africa', 'formidable' ), __( 'South Sudan', 'formidable' ), |
|
| 1268 | + __( 'Spain', 'formidable' ), __( 'Sri Lanka', 'formidable' ), |
|
| 1269 | + __( 'Sudan', 'formidable' ), __( 'Suriname', 'formidable' ), __( 'Swaziland', 'formidable' ), |
|
| 1270 | + __( 'Sweden', 'formidable' ), __( 'Switzerland', 'formidable' ), __( 'Syria', 'formidable' ), |
|
| 1271 | + __( 'Taiwan', 'formidable' ), __( 'Tajikistan', 'formidable' ), __( 'Tanzania', 'formidable' ), |
|
| 1272 | + __( 'Thailand', 'formidable' ), __( 'Togo', 'formidable' ), __( 'Tonga', 'formidable' ), |
|
| 1273 | + __( 'Trinidad and Tobago', 'formidable' ), __( 'Tunisia', 'formidable' ), __( 'Turkey', 'formidable' ), |
|
| 1274 | + __( 'Turkmenistan', 'formidable' ), __( 'Tuvalu', 'formidable' ), __( 'Uganda', 'formidable' ), |
|
| 1275 | + __( 'Ukraine', 'formidable' ), __( 'United Arab Emirates', 'formidable' ), __( 'United Kingdom', 'formidable' ), |
|
| 1276 | + __( 'United States', 'formidable' ), __( 'Uruguay', 'formidable' ), __( 'Uzbekistan', 'formidable' ), |
|
| 1277 | + __( 'Vanuatu', 'formidable' ), __( 'Vatican City', 'formidable' ), __( 'Venezuela', 'formidable' ), |
|
| 1278 | + __( 'Vietnam', 'formidable' ), __( 'Virgin Islands, British', 'formidable' ), |
|
| 1279 | + __( 'Virgin Islands, U.S.', 'formidable' ), __( 'Yemen', 'formidable' ), __( 'Zambia', 'formidable' ), |
|
| 1280 | + __( 'Zimbabwe', 'formidable' ), |
|
| 1281 | + ) ); |
|
| 1282 | + } |
|
| 1283 | 1283 | |
| 1284 | 1284 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1285 | 1285 | $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
| 1286 | 1286 | |
| 1287 | - $states = FrmFieldsHelper::get_us_states(); |
|
| 1288 | - $state_abv = array_keys($states); |
|
| 1289 | - sort($state_abv); |
|
| 1287 | + $states = FrmFieldsHelper::get_us_states(); |
|
| 1288 | + $state_abv = array_keys($states); |
|
| 1289 | + sort($state_abv); |
|
| 1290 | 1290 | $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
| 1291 | 1291 | |
| 1292 | - $states = array_values($states); |
|
| 1293 | - sort($states); |
|
| 1292 | + $states = array_values($states); |
|
| 1293 | + sort($states); |
|
| 1294 | 1294 | $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
| 1295 | - unset($state_abv, $states); |
|
| 1295 | + unset($state_abv, $states); |
|
| 1296 | 1296 | |
| 1297 | 1297 | $prepop[ __( 'Age', 'formidable' ) ] = array( |
| 1298 | - __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
|
| 1299 | - __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
|
| 1300 | - __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
|
| 1301 | - ); |
|
| 1298 | + __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
|
| 1299 | + __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
|
| 1300 | + __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
|
| 1301 | + ); |
|
| 1302 | 1302 | |
| 1303 | 1303 | $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
| 1304 | - __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1305 | - __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1306 | - ); |
|
| 1304 | + __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1305 | + __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1306 | + ); |
|
| 1307 | 1307 | |
| 1308 | 1308 | $prepop[ __( 'Importance', 'formidable' ) ] = array( |
| 1309 | - __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1310 | - __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1311 | - ); |
|
| 1309 | + __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1310 | + __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1311 | + ); |
|
| 1312 | 1312 | |
| 1313 | 1313 | $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
| 1314 | - __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1315 | - __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1316 | - ); |
|
| 1314 | + __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
|
| 1315 | + __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
|
| 1316 | + ); |
|
| 1317 | 1317 | |
| 1318 | 1318 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
| 1319 | - } |
|
| 1319 | + } |
|
| 1320 | 1320 | |
| 1321 | 1321 | /** |
| 1322 | 1322 | * Display a field value selector |
@@ -1326,10 +1326,10 @@ discard block |
||
| 1326 | 1326 | * @param int $selector_field_id |
| 1327 | 1327 | * @param array $selector_args |
| 1328 | 1328 | */ |
| 1329 | - public static function display_field_value_selector( $selector_field_id, $selector_args ) { |
|
| 1330 | - $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args ); |
|
| 1331 | - $field_value_selector->display(); |
|
| 1332 | - } |
|
| 1329 | + public static function display_field_value_selector( $selector_field_id, $selector_args ) { |
|
| 1330 | + $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args ); |
|
| 1331 | + $field_value_selector->display(); |
|
| 1332 | + } |
|
| 1333 | 1333 | |
| 1334 | 1334 | /** |
| 1335 | 1335 | * Convert a field object to a flat array |
@@ -1382,10 +1382,10 @@ discard block |
||
| 1382 | 1382 | return FrmField::is_required( $field ); |
| 1383 | 1383 | } |
| 1384 | 1384 | |
| 1385 | - public static function maybe_get_field( &$field ) { |
|
| 1385 | + public static function maybe_get_field( &$field ) { |
|
| 1386 | 1386 | _deprecated_function( __FUNCTION__, '2.0.9', 'FrmField::maybe_get_field' ); |
| 1387 | 1387 | FrmField::maybe_get_field( $field ); |
| 1388 | - } |
|
| 1388 | + } |
|
| 1389 | 1389 | |
| 1390 | 1390 | public static function dropdown_categories( $args ) { |
| 1391 | 1391 | _deprecated_function( __FUNCTION__, '2.02.07', 'FrmProPost::get_category_dropdown' ); |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( ! defined('ABSPATH') ) { |
|
| 2 | +if ( ! defined( 'ABSPATH' ) ) { |
|
| 3 | 3 | die( 'You are not allowed to call this page directly.' ); |
| 4 | 4 | } |
| 5 | 5 | |
@@ -7,12 +7,12 @@ discard block |
||
| 7 | 7 | |
| 8 | 8 | public static function setup_new_vars( $type = '', $form_id = '' ) { |
| 9 | 9 | |
| 10 | - if ( strpos($type, '|') ) { |
|
| 11 | - list($type, $setting) = explode('|', $type); |
|
| 10 | + if ( strpos( $type, '|' ) ) { |
|
| 11 | + list( $type, $setting ) = explode( '|', $type ); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | - $defaults = self::get_default_field_opts($type, $form_id); |
|
| 15 | - $defaults['field_options']['custom_html'] = self::get_default_html($type); |
|
| 14 | + $defaults = self::get_default_field_opts( $type, $form_id ); |
|
| 15 | + $defaults['field_options']['custom_html'] = self::get_default_html( $type ); |
|
| 16 | 16 | |
| 17 | 17 | $values = array(); |
| 18 | 18 | |
@@ -20,20 +20,20 @@ discard block |
||
| 20 | 20 | if ( $var == 'field_options' ) { |
| 21 | 21 | $values['field_options'] = array(); |
| 22 | 22 | foreach ( $default as $opt_var => $opt_default ) { |
| 23 | - $values['field_options'][ $opt_var ] = $opt_default; |
|
| 24 | - unset($opt_var, $opt_default); |
|
| 23 | + $values['field_options'][$opt_var] = $opt_default; |
|
| 24 | + unset( $opt_var, $opt_default ); |
|
| 25 | 25 | } |
| 26 | 26 | } else { |
| 27 | - $values[ $var ] = $default; |
|
| 27 | + $values[$var] = $default; |
|
| 28 | 28 | } |
| 29 | - unset($var, $default); |
|
| 29 | + unset( $var, $default ); |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | if ( isset( $setting ) && ! empty( $setting ) ) { |
| 33 | 33 | if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
| 34 | 34 | $values['field_options']['data_type'] = $setting; |
| 35 | 35 | } else { |
| 36 | - $values['field_options'][ $setting ] = 1; |
|
| 36 | + $values['field_options'][$setting] = 1; |
|
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
@@ -57,13 +57,13 @@ discard block |
||
| 57 | 57 | } |
| 58 | 58 | |
| 59 | 59 | $fields = FrmField::field_selection(); |
| 60 | - $fields = array_merge($fields, FrmField::pro_field_selection()); |
|
| 60 | + $fields = array_merge( $fields, FrmField::pro_field_selection() ); |
|
| 61 | 61 | |
| 62 | - if ( isset( $fields[ $type ] ) ) { |
|
| 63 | - $values['name'] = is_array( $fields[ $type ] ) ? $fields[ $type ]['name'] : $fields[ $type ]; |
|
| 62 | + if ( isset( $fields[$type] ) ) { |
|
| 63 | + $values['name'] = is_array( $fields[$type] ) ? $fields[$type]['name'] : $fields[$type]; |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | - unset($fields); |
|
| 66 | + unset( $fields ); |
|
| 67 | 67 | |
| 68 | 68 | return $values; |
| 69 | 69 | } |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | $values['form_name'] = ''; |
| 90 | 90 | } else { |
| 91 | 91 | foreach ( $defaults as $var => $default ) { |
| 92 | - $values[ $var ] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 93 | - unset($var, $default); |
|
| 92 | + $values[$var] = FrmAppHelper::get_param( $var, $default, 'get', 'htmlspecialchars' ); |
|
| 93 | + unset( $var, $default ); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | $values['form_name'] = $record->form_id ? FrmForm::getName( $record->form_id ) : ''; |
@@ -101,7 +101,7 @@ discard block |
||
| 101 | 101 | $values['options'] = $record->options; |
| 102 | 102 | $values['field_options'] = $record->field_options; |
| 103 | 103 | |
| 104 | - $defaults = self::get_default_field_opts($values['type'], $record, true); |
|
| 104 | + $defaults = self::get_default_field_opts( $values['type'], $record, true ); |
|
| 105 | 105 | |
| 106 | 106 | if ( $values['type'] == 'captcha' ) { |
| 107 | 107 | $frm_settings = FrmAppHelper::get_settings(); |
@@ -109,11 +109,11 @@ discard block |
||
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | foreach ( $defaults as $opt => $default ) { |
| 112 | - $values[ $opt ] = isset( $record->field_options[ $opt ] ) ? $record->field_options[ $opt ] : $default; |
|
| 113 | - unset($opt, $default); |
|
| 112 | + $values[$opt] = isset( $record->field_options[$opt] ) ? $record->field_options[$opt] : $default; |
|
| 113 | + unset( $opt, $default ); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | - $values['custom_html'] = (isset($record->field_options['custom_html'])) ? $record->field_options['custom_html'] : self::get_default_html($record->type); |
|
| 116 | + $values['custom_html'] = ( isset( $record->field_options['custom_html'] ) ) ? $record->field_options['custom_html'] : self::get_default_html( $record->type ); |
|
| 117 | 117 | |
| 118 | 118 | return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) ); |
| 119 | 119 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | |
| 133 | 133 | global $wpdb; |
| 134 | 134 | |
| 135 | - $form_id = (is_numeric($field)) ? $field : $field->form_id; |
|
| 135 | + $form_id = ( is_numeric( $field ) ) ? $field : $field->form_id; |
|
| 136 | 136 | |
| 137 | 137 | $key = is_numeric( $field ) ? FrmAppHelper::get_unique_key( '', $wpdb->prefix . 'frm_fields', 'field_key' ) : $field->field_key; |
| 138 | 138 | |
@@ -154,11 +154,11 @@ discard block |
||
| 154 | 154 | |
| 155 | 155 | $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 156 | 156 | $values['form_id'] = $form_id; |
| 157 | - $values['options'] = maybe_serialize($field->options); |
|
| 158 | - $values['default_value'] = maybe_serialize($field->default_value); |
|
| 157 | + $values['options'] = maybe_serialize( $field->options ); |
|
| 158 | + $values['default_value'] = maybe_serialize( $field->default_value ); |
|
| 159 | 159 | |
| 160 | 160 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 161 | - $values[ $col ] = $field->{$col}; |
|
| 161 | + $values[$col] = $field->{$col}; |
|
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | |
@@ -172,14 +172,14 @@ discard block |
||
| 172 | 172 | |
| 173 | 173 | $conf_msg = __( 'The entered values do not match', 'formidable' ); |
| 174 | 174 | $defaults = array( |
| 175 | - 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __('%s must be unique', 'formidable' ), $field_name ) ), |
|
| 176 | - 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __('%s is invalid', 'formidable' ), $field_name ) ), |
|
| 175 | + 'unique_msg' => array( 'full' => $default_settings['unique_msg'], 'part' => sprintf( __( '%s must be unique', 'formidable' ), $field_name ) ), |
|
| 176 | + 'invalid' => array( 'full' => __( 'This field is invalid', 'formidable' ), 'part' => sprintf( __( '%s is invalid', 'formidable' ), $field_name ) ), |
|
| 177 | 177 | 'blank' => array( 'full' => $frm_settings->blank_msg, 'part' => $frm_settings->blank_msg ), |
| 178 | 178 | 'conf_msg' => array( 'full' => $conf_msg, 'part' => $conf_msg ), |
| 179 | 179 | ); |
| 180 | 180 | |
| 181 | 181 | $msg = FrmField::get_option( $field, $error ); |
| 182 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 182 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 183 | 183 | $msg = do_shortcode( $msg ); |
| 184 | 184 | return $msg; |
| 185 | 185 | } |
@@ -209,14 +209,14 @@ discard block |
||
| 209 | 209 | </div> |
| 210 | 210 | DEFAULT_HTML; |
| 211 | 211 | } else { |
| 212 | - $default_html = apply_filters('frm_other_custom_html', '', $type); |
|
| 212 | + $default_html = apply_filters( 'frm_other_custom_html', '', $type ); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | - return apply_filters('frm_custom_html', $default_html, $type); |
|
| 215 | + return apply_filters( 'frm_custom_html', $default_html, $type ); |
|
| 216 | 216 | } |
| 217 | 217 | |
| 218 | 218 | public static function replace_shortcodes( $html, $field, $errors = array(), $form = false, $args = array() ) { |
| 219 | - $html = apply_filters('frm_before_replace_shortcodes', $html, $field, $errors, $form); |
|
| 219 | + $html = apply_filters( 'frm_before_replace_shortcodes', $html, $field, $errors, $form ); |
|
| 220 | 220 | |
| 221 | 221 | $defaults = array( |
| 222 | 222 | 'field_name' => 'item_meta[' . $field['id'] . ']', |
@@ -224,42 +224,42 @@ discard block |
||
| 224 | 224 | 'field_plus_id' => '', |
| 225 | 225 | 'section_id' => '', |
| 226 | 226 | ); |
| 227 | - $args = wp_parse_args($args, $defaults); |
|
| 227 | + $args = wp_parse_args( $args, $defaults ); |
|
| 228 | 228 | $field_name = $args['field_name']; |
| 229 | 229 | $field_id = $args['field_id']; |
| 230 | - $html_id = self::get_html_id($field, $args['field_plus_id']); |
|
| 230 | + $html_id = self::get_html_id( $field, $args['field_plus_id'] ); |
|
| 231 | 231 | |
| 232 | - if ( FrmField::is_multiple_select($field) ) { |
|
| 232 | + if ( FrmField::is_multiple_select( $field ) ) { |
|
| 233 | 233 | $field_name .= '[]'; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | //replace [id] |
| 237 | - $html = str_replace('[id]', $field_id, $html); |
|
| 237 | + $html = str_replace( '[id]', $field_id, $html ); |
|
| 238 | 238 | |
| 239 | 239 | // Remove the for attribute for captcha |
| 240 | 240 | if ( $field['type'] == 'captcha' ) { |
| 241 | - $html = str_replace(' for="field_[key]"', '', $html); |
|
| 241 | + $html = str_replace( ' for="field_[key]"', '', $html ); |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | // set the label for |
| 245 | - $html = str_replace('field_[key]', $html_id, $html); |
|
| 245 | + $html = str_replace( 'field_[key]', $html_id, $html ); |
|
| 246 | 246 | |
| 247 | 247 | //replace [key] |
| 248 | - $html = str_replace('[key]', $field['field_key'], $html); |
|
| 248 | + $html = str_replace( '[key]', $field['field_key'], $html ); |
|
| 249 | 249 | |
| 250 | 250 | //replace [description] and [required_label] and [error] |
| 251 | 251 | $required = FrmField::is_required( $field ) ? $field['required_indicator'] : ''; |
| 252 | 252 | if ( ! is_array( $errors ) ) { |
| 253 | 253 | $errors = array(); |
| 254 | 254 | } |
| 255 | - $error = isset( $errors[ 'field' . $field_id ] ) ? $errors[ 'field' . $field_id ] : false; |
|
| 255 | + $error = isset( $errors['field' . $field_id] ) ? $errors['field' . $field_id] : false; |
|
| 256 | 256 | |
| 257 | 257 | //If field type is section heading, add class so a bottom margin can be added to either the h3 or description |
| 258 | 258 | if ( $field['type'] == 'divider' ) { |
| 259 | 259 | if ( FrmField::is_option_true( $field, 'description' ) ) { |
| 260 | 260 | $html = str_replace( 'frm_description', 'frm_description frm_section_spacing', $html ); |
| 261 | 261 | } else { |
| 262 | - $html = str_replace('[label_position]', '[label_position] frm_section_spacing', $html); |
|
| 262 | + $html = str_replace( '[label_position]', '[label_position] frm_section_spacing', $html ); |
|
| 263 | 263 | } |
| 264 | 264 | } |
| 265 | 265 | |
@@ -269,53 +269,53 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | //replace [required_class] |
| 271 | 271 | $required_class = FrmField::is_required( $field ) ? ' frm_required_field' : ''; |
| 272 | - $html = str_replace('[required_class]', $required_class, $html); |
|
| 272 | + $html = str_replace( '[required_class]', $required_class, $html ); |
|
| 273 | 273 | |
| 274 | 274 | //replace [label_position] |
| 275 | - $field['label'] = apply_filters('frm_html_label_position', $field['label'], $field, $form); |
|
| 275 | + $field['label'] = apply_filters( 'frm_html_label_position', $field['label'], $field, $form ); |
|
| 276 | 276 | $field['label'] = ( $field['label'] && $field['label'] != '' ) ? $field['label'] : 'top'; |
| 277 | 277 | $html = str_replace( '[label_position]', ( ( in_array( $field['type'], array( 'divider', 'end_divider', 'break' ) ) ) ? $field['label'] : ' frm_primary_label' ), $html ); |
| 278 | 278 | |
| 279 | 279 | //replace [field_name] |
| 280 | - $html = str_replace('[field_name]', $field['name'], $html); |
|
| 280 | + $html = str_replace( '[field_name]', $field['name'], $html ); |
|
| 281 | 281 | |
| 282 | 282 | self::add_field_div_classes( $field_id, $field, $errors, $html ); |
| 283 | 283 | |
| 284 | 284 | //replace [entry_key] |
| 285 | 285 | $entry_key = FrmAppHelper::simple_get( 'entry', 'sanitize_title' ); |
| 286 | - $html = str_replace('[entry_key]', $entry_key, $html); |
|
| 286 | + $html = str_replace( '[entry_key]', $entry_key, $html ); |
|
| 287 | 287 | |
| 288 | 288 | if ( $form ) { |
| 289 | 289 | $form = (array) $form; |
| 290 | 290 | |
| 291 | 291 | //replace [form_key] |
| 292 | - $html = str_replace('[form_key]', $form['form_key'], $html); |
|
| 292 | + $html = str_replace( '[form_key]', $form['form_key'], $html ); |
|
| 293 | 293 | |
| 294 | 294 | //replace [form_name] |
| 295 | - $html = str_replace('[form_name]', $form['name'], $html); |
|
| 295 | + $html = str_replace( '[form_name]', $form['name'], $html ); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | self::process_wp_shortcodes( $html ); |
| 299 | 299 | |
| 300 | 300 | //replace [input] |
| 301 | - preg_match_all("/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER); |
|
| 301 | + preg_match_all( "/\[(input|deletelink)\b(.*?)(?:(\/))?\]/s", $html, $shortcodes, PREG_PATTERN_ORDER ); |
|
| 302 | 302 | global $frm_vars; |
| 303 | 303 | $frm_settings = FrmAppHelper::get_settings(); |
| 304 | 304 | |
| 305 | 305 | foreach ( $shortcodes[0] as $short_key => $tag ) { |
| 306 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][ $short_key ] ); |
|
| 306 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[2][$short_key] ); |
|
| 307 | 307 | $tag = self::get_shortcode_tag( $shortcodes, $short_key, array( 'conditional' => false, 'conditional_check' => false ) ); |
| 308 | 308 | |
| 309 | 309 | $replace_with = ''; |
| 310 | 310 | |
| 311 | 311 | if ( $tag == 'input' ) { |
| 312 | - if ( isset($atts['opt']) ) { |
|
| 313 | - $atts['opt']--; |
|
| 312 | + if ( isset( $atts['opt'] ) ) { |
|
| 313 | + $atts['opt'] --; |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | - $field['input_class'] = isset($atts['class']) ? $atts['class'] : ''; |
|
| 317 | - if ( isset($atts['class']) ) { |
|
| 318 | - unset($atts['class']); |
|
| 316 | + $field['input_class'] = isset( $atts['class'] ) ? $atts['class'] : ''; |
|
| 317 | + if ( isset( $atts['class'] ) ) { |
|
| 318 | + unset( $atts['class'] ); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | $field['shortcodes'] = $atts; |
@@ -324,24 +324,24 @@ discard block |
||
| 324 | 324 | $replace_with = ob_get_contents(); |
| 325 | 325 | ob_end_clean(); |
| 326 | 326 | } else if ( $tag == 'deletelink' && FrmAppHelper::pro_is_installed() ) { |
| 327 | - $replace_with = FrmProEntriesController::entry_delete_link($atts); |
|
| 327 | + $replace_with = FrmProEntriesController::entry_delete_link( $atts ); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - $html = str_replace( $shortcodes[0][ $short_key ], $replace_with, $html ); |
|
| 330 | + $html = str_replace( $shortcodes[0][$short_key], $replace_with, $html ); |
|
| 331 | 331 | } |
| 332 | 332 | |
| 333 | 333 | $html .= "\n"; |
| 334 | 334 | |
| 335 | 335 | //Return html if conf_field to prevent loop |
| 336 | - if ( isset($field['conf_field']) && $field['conf_field'] == 'stop' ) { |
|
| 336 | + if ( isset( $field['conf_field'] ) && $field['conf_field'] == 'stop' ) { |
|
| 337 | 337 | return $html; |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | //If field is in repeating section |
| 341 | 341 | if ( $args['section_id'] ) { |
| 342 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] )); |
|
| 342 | + $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form, 'field_name' => $field_name, 'field_id' => $field_id, 'field_plus_id' => $args['field_plus_id'], 'section_id' => $args['section_id'] ) ); |
|
| 343 | 343 | } else { |
| 344 | - $html = apply_filters('frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form )); |
|
| 344 | + $html = apply_filters( 'frm_replace_shortcodes', $html, $field, array( 'errors' => $errors, 'form' => $form ) ); |
|
| 345 | 345 | } |
| 346 | 346 | |
| 347 | 347 | self::remove_collapse_shortcode( $html ); |
@@ -393,14 +393,14 @@ discard block |
||
| 393 | 393 | */ |
| 394 | 394 | private static function get_field_div_classes( $field_id, $field, $errors, $html ) { |
| 395 | 395 | // Add error class |
| 396 | - $classes = isset( $errors[ 'field' . $field_id ] ) ? ' frm_blank_field' : ''; |
|
| 396 | + $classes = isset( $errors['field' . $field_id] ) ? ' frm_blank_field' : ''; |
|
| 397 | 397 | |
| 398 | 398 | // Add label position class |
| 399 | 399 | $classes .= ' frm_' . $field['label'] . '_container'; |
| 400 | 400 | |
| 401 | 401 | // Add CSS layout classes |
| 402 | 402 | if ( ! empty( $field['classes'] ) ) { |
| 403 | - if ( ! strpos( $html, 'frm_form_field ') ) { |
|
| 403 | + if ( ! strpos( $html, 'frm_form_field ' ) ) { |
|
| 404 | 404 | $classes .= ' frm_form_field'; |
| 405 | 405 | } |
| 406 | 406 | $classes .= ' ' . $field['classes']; |
@@ -439,15 +439,15 @@ discard block |
||
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | $with_tags = $args['conditional_check'] ? 3 : 2; |
| 442 | - if ( ! empty( $shortcodes[ $with_tags ][ $short_key ] ) ) { |
|
| 443 | - $tag = str_replace( '[' . $prefix, '', $shortcodes[0][ $short_key ] ); |
|
| 444 | - $tag = str_replace(']', '', $tag); |
|
| 445 | - $tags = explode(' ', $tag); |
|
| 446 | - if ( is_array($tags) ) { |
|
| 442 | + if ( ! empty( $shortcodes[$with_tags][$short_key] ) ) { |
|
| 443 | + $tag = str_replace( '[' . $prefix, '', $shortcodes[0][$short_key] ); |
|
| 444 | + $tag = str_replace( ']', '', $tag ); |
|
| 445 | + $tags = explode( ' ', $tag ); |
|
| 446 | + if ( is_array( $tags ) ) { |
|
| 447 | 447 | $tag = $tags[0]; |
| 448 | 448 | } |
| 449 | 449 | } else { |
| 450 | - $tag = $shortcodes[ $with_tags - 1 ][ $short_key ]; |
|
| 450 | + $tag = $shortcodes[$with_tags - 1][$short_key]; |
|
| 451 | 451 | } |
| 452 | 452 | |
| 453 | 453 | return $tag; |
@@ -507,10 +507,10 @@ discard block |
||
| 507 | 507 | |
| 508 | 508 | public static function show_single_option( $field ) { |
| 509 | 509 | $field_name = $field['name']; |
| 510 | - $html_id = self::get_html_id($field); |
|
| 510 | + $html_id = self::get_html_id( $field ); |
|
| 511 | 511 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 512 | - $field_val = apply_filters('frm_field_value_saved', $opt, $opt_key, $field); |
|
| 513 | - $opt = apply_filters('frm_field_label_seen', $opt, $opt_key, $field); |
|
| 512 | + $field_val = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
|
| 513 | + $opt = apply_filters( 'frm_field_label_seen', $opt, $opt_key, $field ); |
|
| 514 | 514 | |
| 515 | 515 | // If this is an "Other" option, get the HTML for it |
| 516 | 516 | if ( self::is_other_opt( $opt_key ) ) { |
@@ -524,7 +524,7 @@ discard block |
||
| 524 | 524 | } |
| 525 | 525 | |
| 526 | 526 | public static function get_term_link( $tax_id ) { |
| 527 | - $tax = get_taxonomy($tax_id); |
|
| 527 | + $tax = get_taxonomy( $tax_id ); |
|
| 528 | 528 | if ( ! $tax ) { |
| 529 | 529 | return; |
| 530 | 530 | } |
@@ -533,7 +533,7 @@ discard block |
||
| 533 | 533 | __( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
| 534 | 534 | '<a href="' . esc_url( admin_url( 'edit-tags.php?taxonomy=' . $tax->name ) ) . '" target="_blank">' . ( empty( $tax->labels->name ) ? __( 'Categories' ) : $tax->labels->name ) . '</a>' |
| 535 | 535 | ); |
| 536 | - unset($tax); |
|
| 536 | + unset( $tax ); |
|
| 537 | 537 | |
| 538 | 538 | return $link; |
| 539 | 539 | } |
@@ -547,8 +547,8 @@ discard block |
||
| 547 | 547 | $observed_value = wp_kses_post( $observed_value ); |
| 548 | 548 | $hide_opt = wp_kses_post( $hide_opt ); |
| 549 | 549 | |
| 550 | - if ( is_array($observed_value) ) { |
|
| 551 | - return self::array_value_condition($observed_value, $cond, $hide_opt); |
|
| 550 | + if ( is_array( $observed_value ) ) { |
|
| 551 | + return self::array_value_condition( $observed_value, $cond, $hide_opt ); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | $m = false; |
@@ -561,7 +561,7 @@ discard block |
||
| 561 | 561 | } else if ( $cond == '<' ) { |
| 562 | 562 | $m = $observed_value < $hide_opt; |
| 563 | 563 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
| 564 | - $m = stripos($observed_value, $hide_opt); |
|
| 564 | + $m = stripos( $observed_value, $hide_opt ); |
|
| 565 | 565 | if ( $cond == 'not LIKE' ) { |
| 566 | 566 | $m = ( $m === false ) ? true : false; |
| 567 | 567 | } else { |
@@ -574,23 +574,23 @@ discard block |
||
| 574 | 574 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
| 575 | 575 | $m = false; |
| 576 | 576 | if ( $cond == '==' ) { |
| 577 | - if ( is_array($hide_opt) ) { |
|
| 578 | - $m = array_intersect($hide_opt, $observed_value); |
|
| 579 | - $m = empty($m) ? false : true; |
|
| 577 | + if ( is_array( $hide_opt ) ) { |
|
| 578 | + $m = array_intersect( $hide_opt, $observed_value ); |
|
| 579 | + $m = empty( $m ) ? false : true; |
|
| 580 | 580 | } else { |
| 581 | - $m = in_array($hide_opt, $observed_value); |
|
| 581 | + $m = in_array( $hide_opt, $observed_value ); |
|
| 582 | 582 | } |
| 583 | 583 | } else if ( $cond == '!=' ) { |
| 584 | - $m = ! in_array($hide_opt, $observed_value); |
|
| 584 | + $m = ! in_array( $hide_opt, $observed_value ); |
|
| 585 | 585 | } else if ( $cond == '>' ) { |
| 586 | - $min = min($observed_value); |
|
| 586 | + $min = min( $observed_value ); |
|
| 587 | 587 | $m = $min > $hide_opt; |
| 588 | 588 | } else if ( $cond == '<' ) { |
| 589 | - $max = max($observed_value); |
|
| 589 | + $max = max( $observed_value ); |
|
| 590 | 590 | $m = $max < $hide_opt; |
| 591 | 591 | } else if ( $cond == 'LIKE' || $cond == 'not LIKE' ) { |
| 592 | 592 | foreach ( $observed_value as $ob ) { |
| 593 | - $m = strpos($ob, $hide_opt); |
|
| 593 | + $m = strpos( $ob, $hide_opt ); |
|
| 594 | 594 | if ( $m !== false ) { |
| 595 | 595 | $m = true; |
| 596 | 596 | break; |
@@ -611,27 +611,27 @@ discard block |
||
| 611 | 611 | * @return string |
| 612 | 612 | */ |
| 613 | 613 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
| 614 | - if ( strpos($value, '[sitename]') !== false ) { |
|
| 614 | + if ( strpos( $value, '[sitename]' ) !== false ) { |
|
| 615 | 615 | $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
| 616 | - $value = str_replace('[sitename]', $new_value, $value); |
|
| 616 | + $value = str_replace( '[sitename]', $new_value, $value ); |
|
| 617 | 617 | } |
| 618 | 618 | |
| 619 | - $value = apply_filters('frm_content', $value, $form, $entry); |
|
| 620 | - $value = do_shortcode($value); |
|
| 619 | + $value = apply_filters( 'frm_content', $value, $form, $entry ); |
|
| 620 | + $value = do_shortcode( $value ); |
|
| 621 | 621 | |
| 622 | 622 | return $value; |
| 623 | 623 | } |
| 624 | 624 | |
| 625 | 625 | public static function get_shortcodes( $content, $form_id ) { |
| 626 | 626 | if ( FrmAppHelper::pro_is_installed() ) { |
| 627 | - return FrmProDisplaysHelper::get_shortcodes($content, $form_id); |
|
| 627 | + return FrmProDisplaysHelper::get_shortcodes( $content, $form_id ); |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | $fields = FrmField::getAll( array( 'fi.form_id' => (int) $form_id, 'fi.type not' => FrmField::no_save_fields() ) ); |
| 631 | 631 | |
| 632 | - $tagregexp = self::allowed_shortcodes($fields); |
|
| 632 | + $tagregexp = self::allowed_shortcodes( $fields ); |
|
| 633 | 633 | |
| 634 | - preg_match_all("/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER); |
|
| 634 | + preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER ); |
|
| 635 | 635 | |
| 636 | 636 | return $matches; |
| 637 | 637 | } |
@@ -649,7 +649,7 @@ discard block |
||
| 649 | 649 | $tagregexp[] = $field->field_key; |
| 650 | 650 | } |
| 651 | 651 | |
| 652 | - $tagregexp = implode('|', $tagregexp); |
|
| 652 | + $tagregexp = implode( '|', $tagregexp ); |
|
| 653 | 653 | return $tagregexp; |
| 654 | 654 | } |
| 655 | 655 | |
@@ -665,28 +665,28 @@ discard block |
||
| 665 | 665 | continue; |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 668 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 669 | 669 | |
| 670 | - if ( ! empty( $shortcodes[3][ $short_key ] ) ) { |
|
| 671 | - $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][ $short_key ] ); |
|
| 672 | - $tags = explode(' ', $tag); |
|
| 673 | - if ( is_array($tags) ) { |
|
| 670 | + if ( ! empty( $shortcodes[3][$short_key] ) ) { |
|
| 671 | + $tag = str_replace( array( '[', ']' ), '', $shortcodes[0][$short_key] ); |
|
| 672 | + $tags = explode( ' ', $tag ); |
|
| 673 | + if ( is_array( $tags ) ) { |
|
| 674 | 674 | $tag = $tags[0]; |
| 675 | 675 | } |
| 676 | 676 | } else { |
| 677 | - $tag = $shortcodes[2][ $short_key ]; |
|
| 677 | + $tag = $shortcodes[2][$short_key]; |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | switch ( $tag ) { |
| 681 | 681 | case 'id': |
| 682 | 682 | case 'key': |
| 683 | 683 | case 'ip': |
| 684 | - $replace_with = $shortcode_values[ $tag ]; |
|
| 684 | + $replace_with = $shortcode_values[$tag]; |
|
| 685 | 685 | break; |
| 686 | 686 | |
| 687 | 687 | case 'user_agent': |
| 688 | 688 | case 'user-agent': |
| 689 | - $entry->description = maybe_unserialize($entry->description); |
|
| 689 | + $entry->description = maybe_unserialize( $entry->description ); |
|
| 690 | 690 | $replace_with = FrmEntriesHelper::get_browser( $entry->description['browser'] ); |
| 691 | 691 | break; |
| 692 | 692 | |
@@ -694,25 +694,25 @@ discard block |
||
| 694 | 694 | case 'created-at': |
| 695 | 695 | case 'updated_at': |
| 696 | 696 | case 'updated-at': |
| 697 | - if ( isset($atts['format']) ) { |
|
| 697 | + if ( isset( $atts['format'] ) ) { |
|
| 698 | 698 | $time_format = ' '; |
| 699 | 699 | } else { |
| 700 | - $atts['format'] = get_option('date_format'); |
|
| 700 | + $atts['format'] = get_option( 'date_format' ); |
|
| 701 | 701 | $time_format = ''; |
| 702 | 702 | } |
| 703 | 703 | |
| 704 | - $this_tag = str_replace('-', '_', $tag); |
|
| 705 | - $replace_with = FrmAppHelper::get_formatted_time($entry->{$this_tag}, $atts['format'], $time_format); |
|
| 706 | - unset($this_tag); |
|
| 704 | + $this_tag = str_replace( '-', '_', $tag ); |
|
| 705 | + $replace_with = FrmAppHelper::get_formatted_time( $entry->{$this_tag}, $atts['format'], $time_format ); |
|
| 706 | + unset( $this_tag ); |
|
| 707 | 707 | break; |
| 708 | 708 | |
| 709 | 709 | case 'created_by': |
| 710 | 710 | case 'created-by': |
| 711 | 711 | case 'updated_by': |
| 712 | 712 | case 'updated-by': |
| 713 | - $this_tag = str_replace('-', '_', $tag); |
|
| 713 | + $this_tag = str_replace( '-', '_', $tag ); |
|
| 714 | 714 | $replace_with = self::get_display_value( $entry->{$this_tag}, (object) array( 'type' => 'user_id' ), $atts ); |
| 715 | - unset($this_tag); |
|
| 715 | + unset( $this_tag ); |
|
| 716 | 716 | break; |
| 717 | 717 | |
| 718 | 718 | case 'admin_email': |
@@ -729,16 +729,16 @@ discard block |
||
| 729 | 729 | break; |
| 730 | 730 | } |
| 731 | 731 | |
| 732 | - $sep = isset($atts['sep']) ? $atts['sep'] : ', '; |
|
| 732 | + $sep = isset( $atts['sep'] ) ? $atts['sep'] : ', '; |
|
| 733 | 733 | |
| 734 | 734 | $replace_with = FrmEntryMeta::get_meta_value( $entry, $field->id ); |
| 735 | 735 | |
| 736 | 736 | $atts['entry_id'] = $entry->id; |
| 737 | 737 | $atts['entry_key'] = $entry->item_key; |
| 738 | 738 | |
| 739 | - if ( isset($atts['show']) && $atts['show'] == 'field_label' ) { |
|
| 739 | + if ( isset( $atts['show'] ) && $atts['show'] == 'field_label' ) { |
|
| 740 | 740 | $replace_with = $field->name; |
| 741 | - } else if ( isset($atts['show']) && $atts['show'] == 'description' ) { |
|
| 741 | + } else if ( isset( $atts['show'] ) && $atts['show'] == 'description' ) { |
|
| 742 | 742 | $replace_with = $field->description; |
| 743 | 743 | } else { |
| 744 | 744 | $string_value = $replace_with; |
@@ -753,15 +753,15 @@ discard block |
||
| 753 | 753 | } |
| 754 | 754 | } |
| 755 | 755 | |
| 756 | - unset($field); |
|
| 756 | + unset( $field ); |
|
| 757 | 757 | break; |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | - if ( isset($replace_with) ) { |
|
| 761 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 760 | + if ( isset( $replace_with ) ) { |
|
| 761 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | - unset($atts, $conditional, $replace_with); |
|
| 764 | + unset( $atts, $conditional, $replace_with ); |
|
| 765 | 765 | } |
| 766 | 766 | |
| 767 | 767 | return $content; |
@@ -777,7 +777,7 @@ discard block |
||
| 777 | 777 | $new_value = ''; |
| 778 | 778 | switch ( $tag ) { |
| 779 | 779 | case 'admin_email': |
| 780 | - $new_value = get_option('admin_email'); |
|
| 780 | + $new_value = get_option( 'admin_email' ); |
|
| 781 | 781 | break; |
| 782 | 782 | case 'siteurl': |
| 783 | 783 | $new_value = FrmAppHelper::site_url(); |
@@ -803,28 +803,28 @@ discard block |
||
| 803 | 803 | * @return string|array |
| 804 | 804 | */ |
| 805 | 805 | public static function process_get_shortcode( $atts, $return_array = false ) { |
| 806 | - if ( ! isset($atts['param']) ) { |
|
| 806 | + if ( ! isset( $atts['param'] ) ) { |
|
| 807 | 807 | return ''; |
| 808 | 808 | } |
| 809 | 809 | |
| 810 | - if ( strpos($atts['param'], '[') ) { |
|
| 811 | - $atts['param'] = str_replace('[', '[', $atts['param']); |
|
| 812 | - $atts['param'] = str_replace(']', ']', $atts['param']); |
|
| 810 | + if ( strpos( $atts['param'], '[' ) ) { |
|
| 811 | + $atts['param'] = str_replace( '[', '[', $atts['param'] ); |
|
| 812 | + $atts['param'] = str_replace( ']', ']', $atts['param'] ); |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | - $new_value = FrmAppHelper::get_param($atts['param'], ''); |
|
| 815 | + $new_value = FrmAppHelper::get_param( $atts['param'], '' ); |
|
| 816 | 816 | $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
| 817 | 817 | |
| 818 | 818 | if ( $new_value == '' ) { |
| 819 | - if ( ! isset($atts['prev_val']) ) { |
|
| 819 | + if ( ! isset( $atts['prev_val'] ) ) { |
|
| 820 | 820 | $atts['prev_val'] = ''; |
| 821 | 821 | } |
| 822 | 822 | |
| 823 | - $new_value = isset($atts['default']) ? $atts['default'] : $atts['prev_val']; |
|
| 823 | + $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val']; |
|
| 824 | 824 | } |
| 825 | 825 | |
| 826 | - if ( is_array($new_value) && ! $return_array ) { |
|
| 827 | - $new_value = implode(', ', $new_value); |
|
| 826 | + if ( is_array( $new_value ) && ! $return_array ) { |
|
| 827 | + $new_value = implode( ', ', $new_value ); |
|
| 828 | 828 | } |
| 829 | 829 | |
| 830 | 830 | return $new_value; |
@@ -837,17 +837,17 @@ discard block |
||
| 837 | 837 | $replace_with = apply_filters( 'frm_get_display_value', $replace_with, $field, $atts ); |
| 838 | 838 | |
| 839 | 839 | if ( $field->type == 'textarea' || $field->type == 'rte' ) { |
| 840 | - $autop = isset($atts['wpautop']) ? $atts['wpautop'] : true; |
|
| 841 | - if ( apply_filters('frm_use_wpautop', $autop) ) { |
|
| 842 | - if ( is_array($replace_with) ) { |
|
| 843 | - $replace_with = implode("\n", $replace_with); |
|
| 840 | + $autop = isset( $atts['wpautop'] ) ? $atts['wpautop'] : true; |
|
| 841 | + if ( apply_filters( 'frm_use_wpautop', $autop ) ) { |
|
| 842 | + if ( is_array( $replace_with ) ) { |
|
| 843 | + $replace_with = implode( "\n", $replace_with ); |
|
| 844 | 844 | } |
| 845 | - $replace_with = wpautop($replace_with); |
|
| 845 | + $replace_with = wpautop( $replace_with ); |
|
| 846 | 846 | } |
| 847 | 847 | unset( $autop ); |
| 848 | 848 | } else if ( is_array( $replace_with ) ) { |
| 849 | - if ( isset( $atts['show'] ) && $atts['show'] && isset( $replace_with[ $atts['show'] ] ) ) { |
|
| 850 | - $replace_with = $replace_with[ $atts['show'] ]; |
|
| 849 | + if ( isset( $atts['show'] ) && $atts['show'] && isset( $replace_with[$atts['show']] ) ) { |
|
| 850 | + $replace_with = $replace_with[$atts['show']]; |
|
| 851 | 851 | } else { |
| 852 | 852 | $replace_with = implode( $sep, $replace_with ); |
| 853 | 853 | } |
@@ -868,14 +868,14 @@ discard block |
||
| 868 | 868 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
| 869 | 869 | |
| 870 | 870 | $field_types = array(); |
| 871 | - if ( in_array($type, $single_input) ) { |
|
| 871 | + if ( in_array( $type, $single_input ) ) { |
|
| 872 | 872 | self::field_types_for_input( $single_input, $field_selection, $field_types ); |
| 873 | - } else if ( in_array($type, $multiple_input) ) { |
|
| 873 | + } else if ( in_array( $type, $multiple_input ) ) { |
|
| 874 | 874 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 875 | - } else if ( in_array($type, $other_type) ) { |
|
| 875 | + } else if ( in_array( $type, $other_type ) ) { |
|
| 876 | 876 | self::field_types_for_input( $other_type, $field_selection, $field_types ); |
| 877 | - } else if ( isset( $field_selection[ $type ] ) ) { |
|
| 878 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 877 | + } else if ( isset( $field_selection[$type] ) ) { |
|
| 878 | + $field_types[$type] = $field_selection[$type]; |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
@@ -884,8 +884,8 @@ discard block |
||
| 884 | 884 | |
| 885 | 885 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
| 886 | 886 | foreach ( $inputs as $input ) { |
| 887 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 888 | - unset($input); |
|
| 887 | + $field_types[$input] = $fields[$input]; |
|
| 888 | + unset( $input ); |
|
| 889 | 889 | } |
| 890 | 890 | } |
| 891 | 891 | |
@@ -930,21 +930,21 @@ discard block |
||
| 930 | 930 | // Check posted vals before checking saved values |
| 931 | 931 | |
| 932 | 932 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 933 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
| 933 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
| 934 | 934 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 935 | - $other_val = isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
| 935 | + $other_val = isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']][$opt_key] ) : ''; |
|
| 936 | 936 | } else { |
| 937 | - $other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ); |
|
| 937 | + $other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ); |
|
| 938 | 938 | } |
| 939 | 939 | return $other_val; |
| 940 | 940 | |
| 941 | - } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
| 941 | + } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
| 942 | 942 | // For normal fields |
| 943 | 943 | |
| 944 | 944 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 945 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
| 945 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : ''; |
|
| 946 | 946 | } else { |
| 947 | - $other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] ); |
|
| 947 | + $other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] ); |
|
| 948 | 948 | } |
| 949 | 949 | return $other_val; |
| 950 | 950 | } |
@@ -953,8 +953,8 @@ discard block |
||
| 953 | 953 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
| 954 | 954 | // Check if there is an "other" val in saved value and make sure the |
| 955 | 955 | // "other" val is not equal to the Other checkbox option |
| 956 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 957 | - $other_val = $field['value'][ $opt_key ]; |
|
| 956 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 957 | + $other_val = $field['value'][$opt_key]; |
|
| 958 | 958 | } |
| 959 | 959 | } else { |
| 960 | 960 | /** |
@@ -966,8 +966,8 @@ discard block |
||
| 966 | 966 | // Multi-select dropdowns - key is not preserved |
| 967 | 967 | if ( is_array( $field['value'] ) ) { |
| 968 | 968 | $o_key = array_search( $temp_val, $field['value'] ); |
| 969 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 970 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 969 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 970 | + unset( $field['value'][$o_key], $o_key ); |
|
| 971 | 971 | } |
| 972 | 972 | } else if ( $temp_val == $field['value'] ) { |
| 973 | 973 | // For radio and regular dropdowns |
@@ -1024,7 +1024,7 @@ discard block |
||
| 1024 | 1024 | private static function set_other_name( $args, &$other_args ) { |
| 1025 | 1025 | //Set up name for other field |
| 1026 | 1026 | $other_args['name'] = str_replace( '[]', '', $args['field_name'] ); |
| 1027 | - $other_args['name'] = preg_replace('/\[' . $args['field']['id'] . '\]$/', '', $other_args['name']); |
|
| 1027 | + $other_args['name'] = preg_replace( '/\[' . $args['field']['id'] . '\]$/', '', $other_args['name'] ); |
|
| 1028 | 1028 | $other_args['name'] = $other_args['name'] . '[other]' . '[' . $args['field']['id'] . ']'; |
| 1029 | 1029 | |
| 1030 | 1030 | //Converts item_meta[field_id] => item_meta[other][field_id] and |
@@ -1051,7 +1051,7 @@ discard block |
||
| 1051 | 1051 | // Count should only be greater than 3 if inside of a repeating section |
| 1052 | 1052 | if ( count( $temp_array ) > 3 ) { |
| 1053 | 1053 | $parent = str_replace( ']', '', $temp_array[1] ); |
| 1054 | - $pointer = str_replace( ']', '', $temp_array[2]); |
|
| 1054 | + $pointer = str_replace( ']', '', $temp_array[2] ); |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | // Get text for "other" text field |
@@ -1170,15 +1170,15 @@ discard block |
||
| 1170 | 1170 | $replace_with[] = '[' . $new . ']'; |
| 1171 | 1171 | $replace[] = '[' . $old . ' '; |
| 1172 | 1172 | $replace_with[] = '[' . $new . ' '; |
| 1173 | - unset($old, $new); |
|
| 1173 | + unset( $old, $new ); |
|
| 1174 | 1174 | } |
| 1175 | 1175 | if ( is_array( $val ) ) { |
| 1176 | 1176 | foreach ( $val as $k => $v ) { |
| 1177 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1178 | - unset($k, $v); |
|
| 1177 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1178 | + unset( $k, $v ); |
|
| 1179 | 1179 | } |
| 1180 | 1180 | } else { |
| 1181 | - $val = str_replace($replace, $replace_with, $val); |
|
| 1181 | + $val = str_replace( $replace, $replace_with, $val ); |
|
| 1182 | 1182 | } |
| 1183 | 1183 | |
| 1184 | 1184 | return $val; |
@@ -1191,7 +1191,7 @@ discard block |
||
| 1191 | 1191 | 'DC' => 'District of Columbia', |
| 1192 | 1192 | 'FL' => 'Florida', 'GA' => 'Georgia', 'HI' => 'Hawaii', 'ID' => 'Idaho', |
| 1193 | 1193 | 'IL' => 'Illinois', 'IN' => 'Indiana', 'IA' => 'Iowa', 'KS' => 'Kansas', |
| 1194 | - 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine','MD' => 'Maryland', |
|
| 1194 | + 'KY' => 'Kentucky', 'LA' => 'Louisiana', 'ME' => 'Maine', 'MD' => 'Maryland', |
|
| 1195 | 1195 | 'MA' => 'Massachusetts', 'MI' => 'Michigan', 'MN' => 'Minnesota', 'MS' => 'Mississippi', |
| 1196 | 1196 | 'MO' => 'Missouri', 'MT' => 'Montana', 'NE' => 'Nebraska', 'NV' => 'Nevada', |
| 1197 | 1197 | 'NH' => 'New Hampshire', 'NJ' => 'New Jersey', 'NM' => 'New Mexico', 'NY' => 'New York', |
@@ -1282,35 +1282,35 @@ discard block |
||
| 1282 | 1282 | } |
| 1283 | 1283 | |
| 1284 | 1284 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1285 | - $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
|
| 1285 | + $prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries(); |
|
| 1286 | 1286 | |
| 1287 | 1287 | $states = FrmFieldsHelper::get_us_states(); |
| 1288 | - $state_abv = array_keys($states); |
|
| 1289 | - sort($state_abv); |
|
| 1290 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1288 | + $state_abv = array_keys( $states ); |
|
| 1289 | + sort( $state_abv ); |
|
| 1290 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1291 | 1291 | |
| 1292 | - $states = array_values($states); |
|
| 1293 | - sort($states); |
|
| 1294 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1295 | - unset($state_abv, $states); |
|
| 1292 | + $states = array_values( $states ); |
|
| 1293 | + sort( $states ); |
|
| 1294 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1295 | + unset( $state_abv, $states ); |
|
| 1296 | 1296 | |
| 1297 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
| 1297 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
| 1298 | 1298 | __( 'Under 18', 'formidable' ), __( '18-24', 'formidable' ), __( '25-34', 'formidable' ), |
| 1299 | 1299 | __( '35-44', 'formidable' ), __( '45-54', 'formidable' ), __( '55-64', 'formidable' ), |
| 1300 | 1300 | __( '65 or Above', 'formidable' ), __( 'Prefer Not to Answer', 'formidable' ), |
| 1301 | 1301 | ); |
| 1302 | 1302 | |
| 1303 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
| 1303 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
| 1304 | 1304 | __( 'Very Satisfied', 'formidable' ), __( 'Satisfied', 'formidable' ), __( 'Neutral', 'formidable' ), |
| 1305 | 1305 | __( 'Unsatisfied', 'formidable' ), __( 'Very Unsatisfied', 'formidable' ), __( 'N/A', 'formidable' ), |
| 1306 | 1306 | ); |
| 1307 | 1307 | |
| 1308 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
| 1308 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
| 1309 | 1309 | __( 'Very Important', 'formidable' ), __( 'Important', 'formidable' ), __( 'Neutral', 'formidable' ), |
| 1310 | 1310 | __( 'Somewhat Important', 'formidable' ), __( 'Not at all Important', 'formidable' ), __( 'N/A', 'formidable' ), |
| 1311 | 1311 | ); |
| 1312 | 1312 | |
| 1313 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
| 1313 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
| 1314 | 1314 | __( 'Strongly Agree', 'formidable' ), __( 'Agree', 'formidable' ), __( 'Neutral', 'formidable' ), |
| 1315 | 1315 | __( 'Disagree', 'formidable' ), __( 'Strongly Disagree', 'formidable' ), __( 'N/A', 'formidable' ), |
| 1316 | 1316 | ); |
@@ -83,12 +83,12 @@ discard block |
||
| 83 | 83 | ) ); |
| 84 | 84 | |
| 85 | 85 | foreach ( $this->style_settings as $key => $setting ) { |
| 86 | - if ( isset( $atts[ $key ] ) && $atts[ $key ] !== '' ) { |
|
| 86 | + if ( isset( $atts[$key] ) && $atts[$key] !== '' ) { |
|
| 87 | 87 | |
| 88 | 88 | if ( $this->is_color_setting( $key ) ) { |
| 89 | - $this->style_settings[ $key ] = $this->get_color_markup( $atts[ $key ] ); |
|
| 89 | + $this->style_settings[$key] = $this->get_color_markup( $atts[$key] ); |
|
| 90 | 90 | } else { |
| 91 | - $this->style_settings[ $key ] = $atts[ $key ]; |
|
| 91 | + $this->style_settings[$key] = $atts[$key]; |
|
| 92 | 92 | } |
| 93 | 93 | } |
| 94 | 94 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | * |
| 160 | 160 | * @return boolean |
| 161 | 161 | */ |
| 162 | - private function is_color_setting ( $setting_key ) { |
|
| 162 | + private function is_color_setting( $setting_key ) { |
|
| 163 | 163 | return strpos( $setting_key, 'color' ) !== false; |
| 164 | 164 | } |
| 165 | 165 | |