@@ -66,7 +66,7 @@ |
||
| 66 | 66 | </a> |
| 67 | 67 | <?php } ?> |
| 68 | 68 | <?php |
| 69 | - if ( $style->ID ) { |
|
| 69 | + if ( $style->ID ) { |
|
| 70 | 70 | echo '<span class="howto"><span>.frm_style_' . esc_attr( $style->post_name ) . '</span></span>'; |
| 71 | 71 | } |
| 72 | 72 | ?> |
@@ -36,7 +36,7 @@ |
||
| 36 | 36 | public function validate( $args ) { |
| 37 | 37 | $errors = array(); |
| 38 | 38 | if ( $args['value'] != '' && ! is_email( $args['value'] ) ) { |
| 39 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 39 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 40 | 40 | } |
| 41 | 41 | return $errors; |
| 42 | 42 | } |
@@ -136,12 +136,12 @@ discard block |
||
| 136 | 136 | * @return array |
| 137 | 137 | */ |
| 138 | 138 | private function prepare_array_property( $index, $atts ) { |
| 139 | - if ( isset( $atts[ $index ] ) && ! empty( $atts[ $index ] ) ) { |
|
| 139 | + if ( isset( $atts[$index] ) && ! empty( $atts[$index] ) ) { |
|
| 140 | 140 | |
| 141 | - if ( is_array( $atts[ $index ] ) ) { |
|
| 142 | - $property = $atts[ $index ]; |
|
| 141 | + if ( is_array( $atts[$index] ) ) { |
|
| 142 | + $property = $atts[$index]; |
|
| 143 | 143 | } else { |
| 144 | - $property = explode( ',', $atts[ $index ] ); |
|
| 144 | + $property = explode( ',', $atts[$index] ); |
|
| 145 | 145 | } |
| 146 | 146 | } else { |
| 147 | 147 | $property = array(); |
@@ -274,6 +274,6 @@ discard block |
||
| 274 | 274 | * @param stdClass $field |
| 275 | 275 | */ |
| 276 | 276 | protected function add_field_values( $field ) { |
| 277 | - $this->field_values[ $field->id ] = new FrmFieldValue( $field, $this->entry ); |
|
| 277 | + $this->field_values[$field->id] = new FrmFieldValue( $field, $this->entry ); |
|
| 278 | 278 | } |
| 279 | 279 | } |
@@ -59,8 +59,8 @@ discard block |
||
| 59 | 59 | protected function init_saved_value( $entry ) { |
| 60 | 60 | if ( $this->field->type === 'html' ) { |
| 61 | 61 | $this->saved_value = $this->field->description; |
| 62 | - } else if ( isset( $entry->metas[ $this->field->id ] ) ) { |
|
| 63 | - $this->saved_value = $entry->metas[ $this->field->id ]; |
|
| 62 | + } else if ( isset( $entry->metas[$this->field->id] ) ) { |
|
| 63 | + $this->saved_value = $entry->metas[$this->field->id]; |
|
| 64 | 64 | } else { |
| 65 | 65 | $this->saved_value = ''; |
| 66 | 66 | } |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | // TODO: maybe change from 'source' to 'run_filters' = 'email' |
| 177 | 177 | if ( isset( $atts['source'] ) && $atts['source'] === 'entry_formatter' ) { |
| 178 | 178 | // Deprecated frm_email_value hook |
| 179 | - $meta = array( |
|
| 179 | + $meta = array( |
|
| 180 | 180 | 'item_id' => $entry->id, |
| 181 | 181 | 'field_id' => $this->field->id, |
| 182 | 182 | 'meta_value' => $this->saved_value, |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | * |
| 206 | 206 | * @param object $field |
| 207 | 207 | * |
| 208 | - * @return array |
|
| 208 | + * @return stdClass |
|
| 209 | 209 | */ |
| 210 | 210 | private static function get_original_field( $field ) { |
| 211 | 211 | $original_type = FrmField::get_option( $field, 'original_type' ); |
@@ -232,7 +232,7 @@ discard block |
||
| 232 | 232 | * |
| 233 | 233 | * @param string $type |
| 234 | 234 | * |
| 235 | - * @return array |
|
| 235 | + * @return string |
|
| 236 | 236 | */ |
| 237 | 237 | public static function get_default_field( $type ) { |
| 238 | 238 | $field_type = FrmFieldFactory::get_field_type( $type ); |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | * @since 2.0 |
| 257 | 257 | * |
| 258 | 258 | * @param $field |
| 259 | - * @param $error |
|
| 259 | + * @param string $error |
|
| 260 | 260 | * |
| 261 | 261 | * @return string |
| 262 | 262 | */ |
@@ -847,6 +847,9 @@ discard block |
||
| 847 | 847 | return $field_types; |
| 848 | 848 | } |
| 849 | 849 | |
| 850 | + /** |
|
| 851 | + * @param string[] $inputs |
|
| 852 | + */ |
|
| 850 | 853 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
| 851 | 854 | foreach ( $inputs as $input ) { |
| 852 | 855 | $field_types[ $input ] = $fields[ $input ]; |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | if ( in_array( $type, array( 'data', 'lookup' ) ) ) { |
| 26 | 26 | $values['field_options']['data_type'] = $setting; |
| 27 | 27 | } else { |
| 28 | - $values['field_options'][ $setting ] = 1; |
|
| 28 | + $values['field_options'][$setting] = 1; |
|
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
@@ -127,10 +127,10 @@ discard block |
||
| 127 | 127 | } |
| 128 | 128 | |
| 129 | 129 | foreach ( $defaults as $opt => $default ) { |
| 130 | - $values[ $opt ] = isset( $field->field_options[ $opt ] ) ? $field->field_options[ $opt ] : $default; |
|
| 130 | + $values[$opt] = isset( $field->field_options[$opt] ) ? $field->field_options[$opt] : $default; |
|
| 131 | 131 | |
| 132 | 132 | if ( $check_post ) { |
| 133 | - self::get_posted_field_setting( $opt . '_' . $field->id, $values[ $opt ] ); |
|
| 133 | + self::get_posted_field_setting( $opt . '_' . $field->id, $values[$opt] ); |
|
| 134 | 134 | } |
| 135 | 135 | |
| 136 | 136 | unset( $opt, $default ); |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | * @param mixed $value |
| 174 | 174 | */ |
| 175 | 175 | private static function get_posted_field_setting( $setting, &$value ) { |
| 176 | - if ( isset( $_POST['field_options'][ $setting ] ) ) { |
|
| 177 | - $value = maybe_unserialize( $_POST['field_options'][ $setting ] ); |
|
| 176 | + if ( isset( $_POST['field_options'][$setting] ) ) { |
|
| 177 | + $value = maybe_unserialize( $_POST['field_options'][$setting] ); |
|
| 178 | 178 | if ( strpos( $setting, 'html' ) !== false ) { |
| 179 | 179 | // strip slashes from HTML but not regex |
| 180 | 180 | $value = stripslashes_deep( $value ); |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | $values['default_value'] = maybe_serialize( $field->default_value ); |
| 249 | 249 | |
| 250 | 250 | foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
| 251 | - $values[ $col ] = $field->{$col}; |
|
| 251 | + $values[$col] = $field->{$col}; |
|
| 252 | 252 | } |
| 253 | 253 | } |
| 254 | 254 | |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | ); |
| 287 | 287 | |
| 288 | 288 | $msg = FrmField::get_option( $field, $error ); |
| 289 | - $msg = empty( $msg ) ? $defaults[ $error ]['part'] : $msg; |
|
| 289 | + $msg = empty( $msg ) ? $defaults[$error]['part'] : $msg; |
|
| 290 | 290 | $msg = do_shortcode( $msg ); |
| 291 | 291 | return $msg; |
| 292 | 292 | } |
@@ -615,7 +615,7 @@ discard block |
||
| 615 | 615 | continue; |
| 616 | 616 | } |
| 617 | 617 | |
| 618 | - $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][ $short_key ] ); |
|
| 618 | + $atts = FrmShortcodeHelper::get_shortcode_attribute_array( $shortcodes[3][$short_key] ); |
|
| 619 | 619 | $tag = FrmShortcodeHelper::get_shortcode_tag( $shortcodes, $short_key ); |
| 620 | 620 | |
| 621 | 621 | $atts['entry'] = $entry; |
@@ -624,7 +624,7 @@ discard block |
||
| 624 | 624 | |
| 625 | 625 | if ( $replace_with !== null ) { |
| 626 | 626 | self::sanitize_embedded_shortcodes( compact( 'entry' ), $replace_with ); |
| 627 | - $content = str_replace( $shortcodes[0][ $short_key ], $replace_with, $content ); |
|
| 627 | + $content = str_replace( $shortcodes[0][$short_key], $replace_with, $content ); |
|
| 628 | 628 | } |
| 629 | 629 | |
| 630 | 630 | unset( $atts, $replace_with ); |
@@ -666,8 +666,8 @@ discard block |
||
| 666 | 666 | |
| 667 | 667 | $dynamic_default = array( 'admin_email', 'siteurl', 'frmurl', 'sitename', 'get' ); |
| 668 | 668 | |
| 669 | - if ( isset( $shortcode_values[ $atts['tag'] ] ) ) { |
|
| 670 | - $replace_with = $shortcode_values[ $atts['tag'] ]; |
|
| 669 | + if ( isset( $shortcode_values[$atts['tag']] ) ) { |
|
| 670 | + $replace_with = $shortcode_values[$atts['tag']]; |
|
| 671 | 671 | } elseif ( in_array( $atts['tag'], $dynamic_default ) ) { |
| 672 | 672 | $replace_with = self::dynamic_default_values( $atts['tag'], $atts ); |
| 673 | 673 | } elseif ( $clean_tag == 'user_agent' ) { |
@@ -877,8 +877,8 @@ discard block |
||
| 877 | 877 | self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
| 878 | 878 | } elseif ( in_array( $type, $other_type ) ) { |
| 879 | 879 | self::field_types_for_input( $other_type, $field_selection, $field_types ); |
| 880 | - } elseif ( isset( $field_selection[ $type ] ) ) { |
|
| 881 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 880 | + } elseif ( isset( $field_selection[$type] ) ) { |
|
| 881 | + $field_types[$type] = $field_selection[$type]; |
|
| 882 | 882 | } |
| 883 | 883 | |
| 884 | 884 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
@@ -887,7 +887,7 @@ discard block |
||
| 887 | 887 | |
| 888 | 888 | private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
| 889 | 889 | foreach ( $inputs as $input ) { |
| 890 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 890 | + $field_types[$input] = $fields[$input]; |
|
| 891 | 891 | unset( $input ); |
| 892 | 892 | } |
| 893 | 893 | } |
@@ -935,21 +935,21 @@ discard block |
||
| 935 | 935 | // Check posted vals before checking saved values |
| 936 | 936 | |
| 937 | 937 | // For fields inside repeating sections - note, don't check if $pointer is true because it will often be zero |
| 938 | - if ( $parent && isset( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ) ) { |
|
| 938 | + if ( $parent && isset( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ) ) { |
|
| 939 | 939 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 940 | - $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 ] ) : ''; |
|
| 940 | + $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] ) : ''; |
|
| 941 | 941 | } else { |
| 942 | - $other_val = sanitize_text_field( $_POST['item_meta'][ $parent ][ $pointer ]['other'][ $field['id'] ] ); |
|
| 942 | + $other_val = sanitize_text_field( $_POST['item_meta'][$parent][$pointer]['other'][$field['id']] ); |
|
| 943 | 943 | } |
| 944 | 944 | return $other_val; |
| 945 | 945 | |
| 946 | - } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][ $field['id'] ] ) ) { |
|
| 946 | + } else if ( isset( $field['id'] ) && isset( $_POST['item_meta']['other'][$field['id']] ) ) { |
|
| 947 | 947 | // For normal fields |
| 948 | 948 | |
| 949 | 949 | if ( FrmField::is_field_with_multiple_values( $field ) ) { |
| 950 | - $other_val = isset( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) ? sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ][ $opt_key ] ) : ''; |
|
| 950 | + $other_val = isset( $_POST['item_meta']['other'][$field['id']][$opt_key] ) ? sanitize_text_field( $_POST['item_meta']['other'][$field['id']][$opt_key] ) : ''; |
|
| 951 | 951 | } else { |
| 952 | - $other_val = sanitize_text_field( $_POST['item_meta']['other'][ $field['id'] ] ); |
|
| 952 | + $other_val = sanitize_text_field( $_POST['item_meta']['other'][$field['id']] ); |
|
| 953 | 953 | } |
| 954 | 954 | return $other_val; |
| 955 | 955 | } |
@@ -958,8 +958,8 @@ discard block |
||
| 958 | 958 | if ( $field['type'] == 'checkbox' && is_array( $field['value'] ) ) { |
| 959 | 959 | // Check if there is an "other" val in saved value and make sure the |
| 960 | 960 | // "other" val is not equal to the Other checkbox option |
| 961 | - if ( isset( $field['value'][ $opt_key ] ) && $field['options'][ $opt_key ] != $field['value'][ $opt_key ] ) { |
|
| 962 | - $other_val = $field['value'][ $opt_key ]; |
|
| 961 | + if ( isset( $field['value'][$opt_key] ) && $field['options'][$opt_key] != $field['value'][$opt_key] ) { |
|
| 962 | + $other_val = $field['value'][$opt_key]; |
|
| 963 | 963 | } |
| 964 | 964 | } else { |
| 965 | 965 | /** |
@@ -971,8 +971,8 @@ discard block |
||
| 971 | 971 | // Multi-select dropdowns - key is not preserved |
| 972 | 972 | if ( is_array( $field['value'] ) ) { |
| 973 | 973 | $o_key = array_search( $temp_val, $field['value'] ); |
| 974 | - if ( isset( $field['value'][ $o_key ] ) ) { |
|
| 975 | - unset( $field['value'][ $o_key ], $o_key ); |
|
| 974 | + if ( isset( $field['value'][$o_key] ) ) { |
|
| 975 | + unset( $field['value'][$o_key], $o_key ); |
|
| 976 | 976 | } |
| 977 | 977 | } else if ( $temp_val == $field['value'] ) { |
| 978 | 978 | // For radio and regular dropdowns |
@@ -1194,7 +1194,7 @@ discard block |
||
| 1194 | 1194 | } |
| 1195 | 1195 | if ( is_array( $val ) ) { |
| 1196 | 1196 | foreach ( $val as $k => $v ) { |
| 1197 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1197 | + $val[$k] = str_replace( $replace, $replace_with, $v ); |
|
| 1198 | 1198 | unset( $k, $v ); |
| 1199 | 1199 | } |
| 1200 | 1200 | } else { |
@@ -1265,19 +1265,19 @@ discard block |
||
| 1265 | 1265 | } |
| 1266 | 1266 | |
| 1267 | 1267 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1268 | - $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
|
| 1268 | + $prepop[__( 'Countries', 'formidable' )] = FrmFieldsHelper::get_countries(); |
|
| 1269 | 1269 | |
| 1270 | 1270 | $states = FrmFieldsHelper::get_us_states(); |
| 1271 | 1271 | $state_abv = array_keys( $states ); |
| 1272 | 1272 | sort( $state_abv ); |
| 1273 | - $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
|
| 1273 | + $prepop[__( 'U.S. State Abbreviations', 'formidable' )] = $state_abv; |
|
| 1274 | 1274 | |
| 1275 | 1275 | $states = array_values( $states ); |
| 1276 | 1276 | sort( $states ); |
| 1277 | - $prepop[ __( 'U.S. States', 'formidable' ) ] = $states; |
|
| 1277 | + $prepop[__( 'U.S. States', 'formidable' )] = $states; |
|
| 1278 | 1278 | unset( $state_abv, $states ); |
| 1279 | 1279 | |
| 1280 | - $prepop[ __( 'Age', 'formidable' ) ] = array( |
|
| 1280 | + $prepop[__( 'Age', 'formidable' )] = array( |
|
| 1281 | 1281 | __( 'Under 18', 'formidable' ), |
| 1282 | 1282 | __( '18-24', 'formidable' ), |
| 1283 | 1283 | __( '25-34', 'formidable' ), |
@@ -1288,7 +1288,7 @@ discard block |
||
| 1288 | 1288 | __( 'Prefer Not to Answer', 'formidable' ), |
| 1289 | 1289 | ); |
| 1290 | 1290 | |
| 1291 | - $prepop[ __( 'Satisfaction', 'formidable' ) ] = array( |
|
| 1291 | + $prepop[__( 'Satisfaction', 'formidable' )] = array( |
|
| 1292 | 1292 | __( 'Very Satisfied', 'formidable' ), |
| 1293 | 1293 | __( 'Satisfied', 'formidable' ), |
| 1294 | 1294 | __( 'Neutral', 'formidable' ), |
@@ -1297,7 +1297,7 @@ discard block |
||
| 1297 | 1297 | __( 'N/A', 'formidable' ), |
| 1298 | 1298 | ); |
| 1299 | 1299 | |
| 1300 | - $prepop[ __( 'Importance', 'formidable' ) ] = array( |
|
| 1300 | + $prepop[__( 'Importance', 'formidable' )] = array( |
|
| 1301 | 1301 | __( 'Very Important', 'formidable' ), |
| 1302 | 1302 | __( 'Important', 'formidable' ), |
| 1303 | 1303 | __( 'Neutral', 'formidable' ), |
@@ -1306,7 +1306,7 @@ discard block |
||
| 1306 | 1306 | __( 'N/A', 'formidable' ), |
| 1307 | 1307 | ); |
| 1308 | 1308 | |
| 1309 | - $prepop[ __( 'Agreement', 'formidable' ) ] = array( |
|
| 1309 | + $prepop[__( 'Agreement', 'formidable' )] = array( |
|
| 1310 | 1310 | __( 'Strongly Agree', 'formidable' ), |
| 1311 | 1311 | __( 'Agree', 'formidable' ), |
| 1312 | 1312 | __( 'Neutral', 'formidable' ), |
@@ -29,17 +29,17 @@ discard block |
||
| 29 | 29 | } |
| 30 | 30 | } |
| 31 | 31 | |
| 32 | - return $values; |
|
| 33 | - } |
|
| 32 | + return $values; |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | 35 | public static function get_html_id( $field, $plus = '' ) { |
| 36 | 36 | return apply_filters( 'frm_field_html_id', 'field_' . $field['field_key'] . $plus, $field ); |
| 37 | - } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - public static function setup_edit_vars( $field, $doing_ajax = false ) { |
|
| 39 | + public static function setup_edit_vars( $field, $doing_ajax = false ) { |
|
| 40 | 40 | $values = self::field_object_to_array( $field ); |
| 41 | 41 | return apply_filters( 'frm_setup_edit_field_vars', $values, array( 'doing_ajax' => $doing_ajax ) ); |
| 42 | - } |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | 44 | public static function field_object_to_array( $field ) { |
| 45 | 45 | $values = (array) $field; |
@@ -239,18 +239,18 @@ discard block |
||
| 239 | 239 | return $field_type->get_new_field_defaults(); |
| 240 | 240 | } |
| 241 | 241 | |
| 242 | - public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { |
|
| 243 | - global $wpdb; |
|
| 242 | + public static function fill_field( &$values, $field, $form_id, $new_key = '' ) { |
|
| 243 | + global $wpdb; |
|
| 244 | 244 | |
| 245 | 245 | $values['field_key'] = FrmAppHelper::get_unique_key( $new_key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 246 | - $values['form_id'] = $form_id; |
|
| 246 | + $values['form_id'] = $form_id; |
|
| 247 | 247 | $values['options'] = maybe_serialize( $field->options ); |
| 248 | 248 | $values['default_value'] = maybe_serialize( $field->default_value ); |
| 249 | 249 | |
| 250 | - foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
|
| 251 | - $values[ $col ] = $field->{$col}; |
|
| 252 | - } |
|
| 253 | - } |
|
| 250 | + foreach ( array( 'name', 'description', 'type', 'field_order', 'field_options', 'required' ) as $col ) { |
|
| 251 | + $values[ $col ] = $field->{$col}; |
|
| 252 | + } |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | 255 | /** |
| 256 | 256 | * @since 2.0 |
@@ -389,26 +389,26 @@ discard block |
||
| 389 | 389 | $html_id = isset( $field['html_id'] ) ? $field['html_id'] : self::get_html_id( $field ); |
| 390 | 390 | |
| 391 | 391 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 392 | - $field_val = self::get_value_from_array( $opt, $opt_key, $field ); |
|
| 393 | - $opt = self::get_label_from_array( $opt, $opt_key, $field ); |
|
| 392 | + $field_val = self::get_value_from_array( $opt, $opt_key, $field ); |
|
| 393 | + $opt = self::get_label_from_array( $opt, $opt_key, $field ); |
|
| 394 | 394 | |
| 395 | 395 | // Get string for Other text field, if needed |
| 396 | 396 | $other_val = self::get_other_val( compact( 'opt_key', 'field' ) ); |
| 397 | 397 | |
| 398 | 398 | $checked = ( $other_val || isset( $field['value'] ) && ( ( ! is_array( $field['value'] ) && $field['value'] == $field_val ) || ( is_array( $field['value'] ) && in_array( $field_val, $field['value'] ) ) ) ) ? ' checked="checked"' : ''; |
| 399 | 399 | |
| 400 | - // If this is an "Other" option, get the HTML for it |
|
| 400 | + // If this is an "Other" option, get the HTML for it |
|
| 401 | 401 | if ( self::is_other_opt( $opt_key ) ) { |
| 402 | 402 | if ( FrmAppHelper::pro_is_installed() ) { |
| 403 | 403 | require( FrmProAppHelper::plugin_path() . '/classes/views/frmpro-fields/other-option.php' ); |
| 404 | 404 | } |
| 405 | - } else { |
|
| 405 | + } else { |
|
| 406 | 406 | require( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/single-option.php' ); |
| 407 | - } |
|
| 407 | + } |
|
| 408 | 408 | |
| 409 | 409 | unset( $checked, $other_val ); |
| 410 | 410 | } |
| 411 | - } |
|
| 411 | + } |
|
| 412 | 412 | |
| 413 | 413 | public static function get_value_from_array( $opt, $opt_key, $field ) { |
| 414 | 414 | $opt = apply_filters( 'frm_field_value_saved', $opt, $opt_key, $field ); |
@@ -427,9 +427,9 @@ discard block |
||
| 427 | 427 | */ |
| 428 | 428 | public static function get_term_link( $tax_id ) { |
| 429 | 429 | $tax = get_taxonomy( $tax_id ); |
| 430 | - if ( ! $tax ) { |
|
| 431 | - return ''; |
|
| 432 | - } |
|
| 430 | + if ( ! $tax ) { |
|
| 431 | + return ''; |
|
| 432 | + } |
|
| 433 | 433 | |
| 434 | 434 | $link = sprintf( |
| 435 | 435 | esc_html__( 'Please add options from the WordPress "%1$s" page', 'formidable' ), |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | ); |
| 438 | 438 | unset( $tax ); |
| 439 | 439 | |
| 440 | - return $link; |
|
| 441 | - } |
|
| 440 | + return $link; |
|
| 441 | + } |
|
| 442 | 442 | |
| 443 | 443 | public static function value_meets_condition( $observed_value, $cond, $hide_opt ) { |
| 444 | 444 | $hide_opt = self::get_value_for_comparision( $hide_opt ); |
@@ -446,9 +446,9 @@ discard block |
||
| 446 | 446 | |
| 447 | 447 | if ( is_array( $observed_value ) ) { |
| 448 | 448 | return self::array_value_condition( $observed_value, $cond, $hide_opt ); |
| 449 | - } |
|
| 449 | + } |
|
| 450 | 450 | |
| 451 | - $m = false; |
|
| 451 | + $m = false; |
|
| 452 | 452 | if ( $cond == '==' ) { |
| 453 | 453 | $m = $observed_value == $hide_opt; |
| 454 | 454 | } elseif ( $cond == '!=' ) { |
@@ -469,8 +469,8 @@ discard block |
||
| 469 | 469 | $m = ( $m === false ) ? false : true; |
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | - return $m; |
|
| 473 | - } |
|
| 472 | + return $m; |
|
| 473 | + } |
|
| 474 | 474 | |
| 475 | 475 | /** |
| 476 | 476 | * Trim and sanitize the values |
@@ -486,8 +486,8 @@ discard block |
||
| 486 | 486 | } |
| 487 | 487 | |
| 488 | 488 | public static function array_value_condition( $observed_value, $cond, $hide_opt ) { |
| 489 | - $m = false; |
|
| 490 | - if ( $cond == '==' ) { |
|
| 489 | + $m = false; |
|
| 490 | + if ( $cond == '==' ) { |
|
| 491 | 491 | if ( is_array( $hide_opt ) ) { |
| 492 | 492 | $m = array_intersect( $hide_opt, $observed_value ); |
| 493 | 493 | $m = empty( $m ) ? false : true; |
@@ -511,35 +511,35 @@ discard block |
||
| 511 | 511 | } |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - if ( $cond == 'not LIKE' ) { |
|
| 515 | - $m = ( $m === false ) ? true : false; |
|
| 516 | - } |
|
| 517 | - } |
|
| 514 | + if ( $cond == 'not LIKE' ) { |
|
| 515 | + $m = ( $m === false ) ? true : false; |
|
| 516 | + } |
|
| 517 | + } |
|
| 518 | 518 | |
| 519 | - return $m; |
|
| 520 | - } |
|
| 519 | + return $m; |
|
| 520 | + } |
|
| 521 | 521 | |
| 522 | - /** |
|
| 523 | - * Replace a few basic shortcodes and field ids |
|
| 524 | - * @since 2.0 |
|
| 525 | - * @return string |
|
| 526 | - */ |
|
| 522 | + /** |
|
| 523 | + * Replace a few basic shortcodes and field ids |
|
| 524 | + * @since 2.0 |
|
| 525 | + * @return string |
|
| 526 | + */ |
|
| 527 | 527 | public static function basic_replace_shortcodes( $value, $form, $entry ) { |
| 528 | 528 | if ( strpos( $value, '[sitename]' ) !== false ) { |
| 529 | - $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
| 529 | + $new_value = wp_specialchars_decode( FrmAppHelper::site_name(), ENT_QUOTES ); |
|
| 530 | 530 | $value = str_replace( '[sitename]', $new_value, $value ); |
| 531 | - } |
|
| 531 | + } |
|
| 532 | 532 | |
| 533 | 533 | $value = apply_filters( 'frm_content', $value, $form, $entry ); |
| 534 | 534 | $value = do_shortcode( $value ); |
| 535 | 535 | |
| 536 | - return $value; |
|
| 537 | - } |
|
| 536 | + return $value; |
|
| 537 | + } |
|
| 538 | 538 | |
| 539 | 539 | public static function get_shortcodes( $content, $form_id ) { |
| 540 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 540 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 541 | 541 | return FrmProDisplaysHelper::get_shortcodes( $content, $form_id ); |
| 542 | - } |
|
| 542 | + } |
|
| 543 | 543 | |
| 544 | 544 | $fields = FrmField::getAll( |
| 545 | 545 | array( |
@@ -552,23 +552,23 @@ discard block |
||
| 552 | 552 | |
| 553 | 553 | preg_match_all( "/\[(if )?($tagregexp)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?/s", $content, $matches, PREG_PATTERN_ORDER ); |
| 554 | 554 | |
| 555 | - return $matches; |
|
| 556 | - } |
|
| 555 | + return $matches; |
|
| 556 | + } |
|
| 557 | 557 | |
| 558 | 558 | public static function allowed_shortcodes( $fields = array() ) { |
| 559 | 559 | $tagregexp = array( 'editlink', 'id', 'key', 'ip', 'siteurl', 'sitename', 'admin_email', 'post[-|_]id', 'created[-|_]at', 'updated[-|_]at', 'updated[-|_]by', 'parent[-|_]id' ); |
| 560 | 560 | |
| 561 | - foreach ( $fields as $field ) { |
|
| 562 | - $tagregexp[] = $field->id; |
|
| 563 | - $tagregexp[] = $field->field_key; |
|
| 564 | - } |
|
| 561 | + foreach ( $fields as $field ) { |
|
| 562 | + $tagregexp[] = $field->id; |
|
| 563 | + $tagregexp[] = $field->field_key; |
|
| 564 | + } |
|
| 565 | 565 | |
| 566 | 566 | $tagregexp = implode( '|', $tagregexp ); |
| 567 | - return $tagregexp; |
|
| 568 | - } |
|
| 567 | + return $tagregexp; |
|
| 568 | + } |
|
| 569 | 569 | |
| 570 | 570 | public static function replace_content_shortcodes( $content, $entry, $shortcodes ) { |
| 571 | - foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 571 | + foreach ( $shortcodes[0] as $short_key => $tag ) { |
|
| 572 | 572 | if ( empty( $tag ) ) { |
| 573 | 573 | continue; |
| 574 | 574 | } |
@@ -589,7 +589,7 @@ discard block |
||
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | return $content; |
| 592 | - } |
|
| 592 | + } |
|
| 593 | 593 | |
| 594 | 594 | /** |
| 595 | 595 | * Prevent shortcodes in fields from being processed |
@@ -698,44 +698,44 @@ discard block |
||
| 698 | 698 | return $replace_with; |
| 699 | 699 | } |
| 700 | 700 | |
| 701 | - /** |
|
| 702 | - * Get the value to replace a few standard shortcodes |
|
| 703 | - * |
|
| 704 | - * @since 2.0 |
|
| 705 | - * @return string |
|
| 706 | - */ |
|
| 707 | - public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
| 708 | - $new_value = ''; |
|
| 709 | - switch ( $tag ) { |
|
| 710 | - case 'admin_email': |
|
| 701 | + /** |
|
| 702 | + * Get the value to replace a few standard shortcodes |
|
| 703 | + * |
|
| 704 | + * @since 2.0 |
|
| 705 | + * @return string |
|
| 706 | + */ |
|
| 707 | + public static function dynamic_default_values( $tag, $atts = array(), $return_array = false ) { |
|
| 708 | + $new_value = ''; |
|
| 709 | + switch ( $tag ) { |
|
| 710 | + case 'admin_email': |
|
| 711 | 711 | $new_value = get_option( 'admin_email' ); |
| 712 | - break; |
|
| 713 | - case 'siteurl': |
|
| 714 | - $new_value = FrmAppHelper::site_url(); |
|
| 715 | - break; |
|
| 716 | - case 'frmurl': |
|
| 717 | - $new_value = FrmAppHelper::plugin_url(); |
|
| 718 | - break; |
|
| 719 | - case 'sitename': |
|
| 720 | - $new_value = FrmAppHelper::site_name(); |
|
| 721 | - break; |
|
| 722 | - case 'get': |
|
| 723 | - $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
| 724 | - } |
|
| 725 | - |
|
| 726 | - return $new_value; |
|
| 727 | - } |
|
| 728 | - |
|
| 729 | - /** |
|
| 730 | - * Process the [get] shortcode |
|
| 731 | - * |
|
| 732 | - * @since 2.0 |
|
| 733 | - * @return string|array |
|
| 734 | - */ |
|
| 735 | - public static function process_get_shortcode( $atts, $return_array = false ) { |
|
| 712 | + break; |
|
| 713 | + case 'siteurl': |
|
| 714 | + $new_value = FrmAppHelper::site_url(); |
|
| 715 | + break; |
|
| 716 | + case 'frmurl': |
|
| 717 | + $new_value = FrmAppHelper::plugin_url(); |
|
| 718 | + break; |
|
| 719 | + case 'sitename': |
|
| 720 | + $new_value = FrmAppHelper::site_name(); |
|
| 721 | + break; |
|
| 722 | + case 'get': |
|
| 723 | + $new_value = self::process_get_shortcode( $atts, $return_array ); |
|
| 724 | + } |
|
| 725 | + |
|
| 726 | + return $new_value; |
|
| 727 | + } |
|
| 728 | + |
|
| 729 | + /** |
|
| 730 | + * Process the [get] shortcode |
|
| 731 | + * |
|
| 732 | + * @since 2.0 |
|
| 733 | + * @return string|array |
|
| 734 | + */ |
|
| 735 | + public static function process_get_shortcode( $atts, $return_array = false ) { |
|
| 736 | 736 | if ( ! isset( $atts['param'] ) ) { |
| 737 | - return ''; |
|
| 738 | - } |
|
| 737 | + return ''; |
|
| 738 | + } |
|
| 739 | 739 | |
| 740 | 740 | if ( strpos( $atts['param'], '[' ) ) { |
| 741 | 741 | $atts['param'] = str_replace( '[', '[', $atts['param'] ); |
@@ -743,22 +743,22 @@ discard block |
||
| 743 | 743 | } |
| 744 | 744 | |
| 745 | 745 | $new_value = FrmAppHelper::get_param( $atts['param'], '', 'get', 'sanitize_text_field' ); |
| 746 | - $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
| 746 | + $new_value = FrmAppHelper::get_query_var( $new_value, $atts['param'] ); |
|
| 747 | 747 | |
| 748 | - if ( $new_value == '' ) { |
|
| 748 | + if ( $new_value == '' ) { |
|
| 749 | 749 | if ( ! isset( $atts['prev_val'] ) ) { |
| 750 | - $atts['prev_val'] = ''; |
|
| 751 | - } |
|
| 750 | + $atts['prev_val'] = ''; |
|
| 751 | + } |
|
| 752 | 752 | |
| 753 | 753 | $new_value = isset( $atts['default'] ) ? $atts['default'] : $atts['prev_val']; |
| 754 | - } |
|
| 754 | + } |
|
| 755 | 755 | |
| 756 | 756 | if ( is_array( $new_value ) && ! $return_array ) { |
| 757 | 757 | $new_value = implode( ', ', $new_value ); |
| 758 | 758 | } |
| 759 | 759 | |
| 760 | - return $new_value; |
|
| 761 | - } |
|
| 760 | + return $new_value; |
|
| 761 | + } |
|
| 762 | 762 | |
| 763 | 763 | public static function get_display_value( $value, $field, $atts = array() ) { |
| 764 | 764 | |
@@ -828,27 +828,27 @@ discard block |
||
| 828 | 828 | |
| 829 | 829 | $field_selection = array_merge( FrmField::pro_field_selection(), FrmField::field_selection() ); |
| 830 | 830 | |
| 831 | - $field_types = array(); |
|
| 831 | + $field_types = array(); |
|
| 832 | 832 | if ( in_array( $type, $single_input ) ) { |
| 833 | - self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
| 833 | + self::field_types_for_input( $single_input, $field_selection, $field_types ); |
|
| 834 | 834 | } elseif ( in_array( $type, $multiple_input ) ) { |
| 835 | - self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
| 835 | + self::field_types_for_input( $multiple_input, $field_selection, $field_types ); |
|
| 836 | 836 | } elseif ( in_array( $type, $other_type ) ) { |
| 837 | - self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
| 837 | + self::field_types_for_input( $other_type, $field_selection, $field_types ); |
|
| 838 | 838 | } elseif ( isset( $field_selection[ $type ] ) ) { |
| 839 | - $field_types[ $type ] = $field_selection[ $type ]; |
|
| 840 | - } |
|
| 839 | + $field_types[ $type ] = $field_selection[ $type ]; |
|
| 840 | + } |
|
| 841 | 841 | |
| 842 | 842 | $field_types = apply_filters( 'frm_switch_field_types', $field_types, compact( 'type' ) ); |
| 843 | - return $field_types; |
|
| 844 | - } |
|
| 843 | + return $field_types; |
|
| 844 | + } |
|
| 845 | 845 | |
| 846 | - private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
| 847 | - foreach ( $inputs as $input ) { |
|
| 848 | - $field_types[ $input ] = $fields[ $input ]; |
|
| 846 | + private static function field_types_for_input( $inputs, $fields, &$field_types ) { |
|
| 847 | + foreach ( $inputs as $input ) { |
|
| 848 | + $field_types[ $input ] = $fields[ $input ]; |
|
| 849 | 849 | unset( $input ); |
| 850 | - } |
|
| 851 | - } |
|
| 850 | + } |
|
| 851 | + } |
|
| 852 | 852 | |
| 853 | 853 | /** |
| 854 | 854 | * Check if current field option is an "other" option |
@@ -862,14 +862,14 @@ discard block |
||
| 862 | 862 | return $opt_key && strpos( $opt_key, 'other_' ) === 0; |
| 863 | 863 | } |
| 864 | 864 | |
| 865 | - /** |
|
| 866 | - * Get value that belongs in "Other" text box |
|
| 867 | - * |
|
| 868 | - * @since 2.0.6 |
|
| 869 | - * |
|
| 870 | - * @param array $args |
|
| 871 | - */ |
|
| 872 | - public static function get_other_val( $args ) { |
|
| 865 | + /** |
|
| 866 | + * Get value that belongs in "Other" text box |
|
| 867 | + * |
|
| 868 | + * @since 2.0.6 |
|
| 869 | + * |
|
| 870 | + * @param array $args |
|
| 871 | + */ |
|
| 872 | + public static function get_other_val( $args ) { |
|
| 873 | 873 | $defaults = array( |
| 874 | 874 | 'opt_key' => 0, |
| 875 | 875 | 'field' => array(), |
@@ -947,20 +947,20 @@ discard block |
||
| 947 | 947 | } |
| 948 | 948 | |
| 949 | 949 | return $other_val; |
| 950 | - } |
|
| 951 | - |
|
| 952 | - /** |
|
| 953 | - * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
| 954 | - * Intended for front-end use |
|
| 955 | - * |
|
| 956 | - * @since 2.0.6 |
|
| 957 | - * |
|
| 958 | - * @param array $args should include field, opt_key and field name |
|
| 959 | - * @param boolean $other_opt |
|
| 960 | - * @param string $checked |
|
| 961 | - * @return array $other_args |
|
| 962 | - */ |
|
| 963 | - public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
| 950 | + } |
|
| 951 | + |
|
| 952 | + /** |
|
| 953 | + * Check if there is a saved value for the "Other" text field. If so, set it as the $other_val. |
|
| 954 | + * Intended for front-end use |
|
| 955 | + * |
|
| 956 | + * @since 2.0.6 |
|
| 957 | + * |
|
| 958 | + * @param array $args should include field, opt_key and field name |
|
| 959 | + * @param boolean $other_opt |
|
| 960 | + * @param string $checked |
|
| 961 | + * @return array $other_args |
|
| 962 | + */ |
|
| 963 | + public static function prepare_other_input( $args, &$other_opt, &$checked ) { |
|
| 964 | 964 | //Check if this is an "Other" option |
| 965 | 965 | if ( ! self::is_other_opt( $args['opt_key'] ) ) { |
| 966 | 966 | return; |
@@ -976,8 +976,8 @@ discard block |
||
| 976 | 976 | $checked = 'checked="checked" '; |
| 977 | 977 | } |
| 978 | 978 | |
| 979 | - return $other_args; |
|
| 980 | - } |
|
| 979 | + return $other_args; |
|
| 980 | + } |
|
| 981 | 981 | |
| 982 | 982 | /** |
| 983 | 983 | * @param array $args |
@@ -1034,8 +1034,8 @@ discard block |
||
| 1034 | 1034 | * @since 2.0.6 |
| 1035 | 1035 | */ |
| 1036 | 1036 | public static function include_other_input( $args ) { |
| 1037 | - if ( ! $args['other_opt'] ) { |
|
| 1038 | - return; |
|
| 1037 | + if ( ! $args['other_opt'] ) { |
|
| 1038 | + return; |
|
| 1039 | 1039 | } |
| 1040 | 1040 | |
| 1041 | 1041 | $classes = array( 'frm_other_input' ); |
@@ -1060,15 +1060,15 @@ discard block |
||
| 1060 | 1060 | } |
| 1061 | 1061 | |
| 1062 | 1062 | /** |
| 1063 | - * Get the HTML id for an "Other" text field |
|
| 1064 | - * Note: This does not affect fields in repeating sections |
|
| 1065 | - * |
|
| 1066 | - * @since 2.0.08 |
|
| 1067 | - * @param string $type - field type |
|
| 1068 | - * @param string $html_id |
|
| 1069 | - * @param string|boolean $opt_key |
|
| 1070 | - * @return string $other_id |
|
| 1071 | - */ |
|
| 1063 | + * Get the HTML id for an "Other" text field |
|
| 1064 | + * Note: This does not affect fields in repeating sections |
|
| 1065 | + * |
|
| 1066 | + * @since 2.0.08 |
|
| 1067 | + * @param string $type - field type |
|
| 1068 | + * @param string $html_id |
|
| 1069 | + * @param string|boolean $opt_key |
|
| 1070 | + * @return string $other_id |
|
| 1071 | + */ |
|
| 1072 | 1072 | public static function get_other_field_html_id( $type, $html_id, $opt_key = false ) { |
| 1073 | 1073 | $other_id = $html_id; |
| 1074 | 1074 | |
@@ -1132,10 +1132,10 @@ discard block |
||
| 1132 | 1132 | } |
| 1133 | 1133 | |
| 1134 | 1134 | public static function switch_field_ids( $val ) { |
| 1135 | - global $frm_duplicate_ids; |
|
| 1136 | - $replace = array(); |
|
| 1137 | - $replace_with = array(); |
|
| 1138 | - foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
| 1135 | + global $frm_duplicate_ids; |
|
| 1136 | + $replace = array(); |
|
| 1137 | + $replace_with = array(); |
|
| 1138 | + foreach ( (array) $frm_duplicate_ids as $old => $new ) { |
|
| 1139 | 1139 | $replace[] = '[if ' . $old . ']'; |
| 1140 | 1140 | $replace_with[] = '[if ' . $new . ']'; |
| 1141 | 1141 | $replace[] = '[if ' . $old . ' '; |
@@ -1151,18 +1151,18 @@ discard block |
||
| 1151 | 1151 | $replace[] = '[' . $old . ' '; |
| 1152 | 1152 | $replace_with[] = '[' . $new . ' '; |
| 1153 | 1153 | unset( $old, $new ); |
| 1154 | - } |
|
| 1154 | + } |
|
| 1155 | 1155 | if ( is_array( $val ) ) { |
| 1156 | 1156 | foreach ( $val as $k => $v ) { |
| 1157 | - $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1157 | + $val[ $k ] = str_replace( $replace, $replace_with, $v ); |
|
| 1158 | 1158 | unset( $k, $v ); |
| 1159 | - } |
|
| 1160 | - } else { |
|
| 1159 | + } |
|
| 1160 | + } else { |
|
| 1161 | 1161 | $val = str_replace( $replace, $replace_with, $val ); |
| 1162 | - } |
|
| 1162 | + } |
|
| 1163 | 1163 | |
| 1164 | - return $val; |
|
| 1165 | - } |
|
| 1164 | + return $val; |
|
| 1165 | + } |
|
| 1166 | 1166 | |
| 1167 | 1167 | public static function get_us_states() { |
| 1168 | 1168 | $states = array( |
@@ -1228,7 +1228,7 @@ discard block |
||
| 1228 | 1228 | public static function get_bulk_prefilled_opts( array &$prepop ) { |
| 1229 | 1229 | $prepop[ __( 'Countries', 'formidable' ) ] = FrmFieldsHelper::get_countries(); |
| 1230 | 1230 | |
| 1231 | - $states = FrmFieldsHelper::get_us_states(); |
|
| 1231 | + $states = FrmFieldsHelper::get_us_states(); |
|
| 1232 | 1232 | $state_abv = array_keys( $states ); |
| 1233 | 1233 | sort( $state_abv ); |
| 1234 | 1234 | $prepop[ __( 'U.S. State Abbreviations', 'formidable' ) ] = $state_abv; |
@@ -1277,7 +1277,7 @@ discard block |
||
| 1277 | 1277 | ); |
| 1278 | 1278 | |
| 1279 | 1279 | $prepop = apply_filters( 'frm_bulk_field_choices', $prepop ); |
| 1280 | - } |
|
| 1280 | + } |
|
| 1281 | 1281 | |
| 1282 | 1282 | /** |
| 1283 | 1283 | * Display a field value selector |
@@ -1287,10 +1287,10 @@ discard block |
||
| 1287 | 1287 | * @param int $selector_field_id |
| 1288 | 1288 | * @param array $selector_args |
| 1289 | 1289 | */ |
| 1290 | - public static function display_field_value_selector( $selector_field_id, $selector_args ) { |
|
| 1291 | - $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args ); |
|
| 1292 | - $field_value_selector->display(); |
|
| 1293 | - } |
|
| 1290 | + public static function display_field_value_selector( $selector_field_id, $selector_args ) { |
|
| 1291 | + $field_value_selector = FrmFieldFactory::create_field_value_selector( $selector_field_id, $selector_args ); |
|
| 1292 | + $field_value_selector->display(); |
|
| 1293 | + } |
|
| 1294 | 1294 | |
| 1295 | 1295 | /** |
| 1296 | 1296 | * Convert a field object to a flat array |
@@ -1330,7 +1330,7 @@ discard block |
||
| 1330 | 1330 | */ |
| 1331 | 1331 | public static function get_shortcode_tag( $shortcodes, $short_key, $args ) { |
| 1332 | 1332 | return FrmDeprecated::get_shortcode_tag( $shortcodes, $short_key, $args ); |
| 1333 | - } |
|
| 1333 | + } |
|
| 1334 | 1334 | |
| 1335 | 1335 | /** |
| 1336 | 1336 | * @deprecated 3.0 |
@@ -61,9 +61,9 @@ |
||
| 61 | 61 | |
| 62 | 62 | // validate the url format |
| 63 | 63 | if ( ! empty( $value ) && ! preg_match( '/^http(s)?:\/\/(?:localhost|(?:[\da-z\.-]+\.[\da-z\.-]+))/i', $value ) ) { |
| 64 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 64 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 65 | 65 | } elseif ( $this->field->required == '1' && empty( $value ) ) { |
| 66 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' ); |
|
| 66 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'blank' ); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | return $errors; |
@@ -43,6 +43,9 @@ |
||
| 43 | 43 | } |
| 44 | 44 | } |
| 45 | 45 | |
| 46 | + /** |
|
| 47 | + * @param boolean $exclude |
|
| 48 | + */ |
|
| 46 | 49 | private static function get_fields_to_validate( $values, $exclude ) { |
| 47 | 50 | $where = apply_filters( 'frm_posted_field_ids', array( 'fi.form_id' => $values['form_id'] ) ); |
| 48 | 51 | |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | return $errors; |
| 11 | 11 | } |
| 12 | 12 | |
| 13 | - if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
|
| 13 | + if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values['frm_submit_entry_' . $values['form_id']] ) || ! wp_verify_nonce( $values['frm_submit_entry_' . $values['form_id']], 'frm_submit_entry_nonce' ) ) ) { |
|
| 14 | 14 | $errors['form'] = __( 'You do not have permission to do that', 'formidable' ); |
| 15 | 15 | } |
| 16 | 16 | |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $args = wp_parse_args( $args, $defaults ); |
| 68 | 68 | |
| 69 | 69 | if ( empty( $args['parent_field_id'] ) ) { |
| 70 | - $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
|
| 70 | + $value = isset( $values['item_meta'][$args['id']] ) ? $values['item_meta'][$args['id']] : ''; |
|
| 71 | 71 | } else { |
| 72 | 72 | // value is from a nested form |
| 73 | 73 | $value = $values; |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 91 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 91 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
|
| 92 | 92 | } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok. |
| 93 | 93 | $_POST['item_name'] = $value; |
| 94 | 94 | } |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | $pattern = self::phone_format( $field ); |
| 184 | 184 | |
| 185 | 185 | if ( ! preg_match( $pattern, $value ) ) { |
| 186 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 186 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $field, 'invalid' ); |
|
| 187 | 187 | } |
| 188 | 188 | } |
| 189 | 189 | } |
@@ -424,7 +424,7 @@ discard block |
||
| 424 | 424 | |
| 425 | 425 | // Send any potentially useful $_SERVER vars, but avoid sending junk we don't need. |
| 426 | 426 | if ( $include_value ) { |
| 427 | - $datas[ $key ] = $value; |
|
| 427 | + $datas[$key] = $value; |
|
| 428 | 428 | } |
| 429 | 429 | unset( $key, $value ); |
| 430 | 430 | } |
@@ -89,7 +89,8 @@ |
||
| 89 | 89 | |
| 90 | 90 | if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
| 91 | 91 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
| 92 | - } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok. |
|
| 92 | + } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { |
|
| 93 | +// WPCS: CSRF ok. |
|
| 93 | 94 | $_POST['item_name'] = $value; |
| 94 | 95 | } |
| 95 | 96 | |
@@ -1,18 +1,18 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | class FrmEntryValidate { |
| 4 | - public static function validate( $values, $exclude = false ) { |
|
| 5 | - FrmEntry::sanitize_entry_post( $values ); |
|
| 6 | - $errors = array(); |
|
| 4 | + public static function validate( $values, $exclude = false ) { |
|
| 5 | + FrmEntry::sanitize_entry_post( $values ); |
|
| 6 | + $errors = array(); |
|
| 7 | 7 | |
| 8 | 8 | if ( ! isset( $values['form_id'] ) || ! isset( $values['item_meta'] ) ) { |
| 9 | - $errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' ); |
|
| 10 | - return $errors; |
|
| 11 | - } |
|
| 9 | + $errors['form'] = __( 'There was a problem with your submission. Please try again.', 'formidable' ); |
|
| 10 | + return $errors; |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | 13 | if ( FrmAppHelper::is_admin() && is_user_logged_in() && ( ! isset( $values[ 'frm_submit_entry_' . $values['form_id'] ] ) || ! wp_verify_nonce( $values[ 'frm_submit_entry_' . $values['form_id'] ], 'frm_submit_entry_nonce' ) ) ) { |
| 14 | - $errors['form'] = __( 'You do not have permission to do that', 'formidable' ); |
|
| 15 | - } |
|
| 14 | + $errors['form'] = __( 'You do not have permission to do that', 'formidable' ); |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | 17 | self::set_item_key( $values ); |
| 18 | 18 | |
@@ -57,24 +57,24 @@ discard block |
||
| 57 | 57 | return FrmField::getAll( $where, 'field_order' ); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - public static function validate_field( $posted_field, &$errors, $values, $args = array() ) { |
|
| 61 | - $defaults = array( |
|
| 62 | - 'id' => $posted_field->id, |
|
| 63 | - 'parent_field_id' => '', // the id of the repeat or embed form |
|
| 64 | - 'key_pointer' => '', // the pointer in the posted array |
|
| 65 | - 'exclude' => array(), // exclude these field types from validation |
|
| 66 | - ); |
|
| 67 | - $args = wp_parse_args( $args, $defaults ); |
|
| 60 | + public static function validate_field( $posted_field, &$errors, $values, $args = array() ) { |
|
| 61 | + $defaults = array( |
|
| 62 | + 'id' => $posted_field->id, |
|
| 63 | + 'parent_field_id' => '', // the id of the repeat or embed form |
|
| 64 | + 'key_pointer' => '', // the pointer in the posted array |
|
| 65 | + 'exclude' => array(), // exclude these field types from validation |
|
| 66 | + ); |
|
| 67 | + $args = wp_parse_args( $args, $defaults ); |
|
| 68 | 68 | |
| 69 | 69 | if ( empty( $args['parent_field_id'] ) ) { |
| 70 | 70 | $value = isset( $values['item_meta'][ $args['id'] ] ) ? $values['item_meta'][ $args['id'] ] : ''; |
| 71 | - } else { |
|
| 72 | - // value is from a nested form |
|
| 73 | - $value = $values; |
|
| 74 | - } |
|
| 71 | + } else { |
|
| 72 | + // value is from a nested form |
|
| 73 | + $value = $values; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - // Check for values in "Other" fields |
|
| 77 | - FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args ); |
|
| 76 | + // Check for values in "Other" fields |
|
| 77 | + FrmEntriesHelper::maybe_set_other_validation( $posted_field, $value, $args ); |
|
| 78 | 78 | |
| 79 | 79 | self::maybe_clear_value_for_default_blank_setting( $posted_field, $value ); |
| 80 | 80 | |
@@ -87,11 +87,11 @@ discard block |
||
| 87 | 87 | $value = trim( $value ); |
| 88 | 88 | } |
| 89 | 89 | |
| 90 | - if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
|
| 90 | + if ( $posted_field->required == '1' && FrmAppHelper::is_empty_value( $value ) ) { |
|
| 91 | 91 | $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $posted_field, 'blank' ); |
| 92 | - } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok. |
|
| 93 | - $_POST['item_name'] = $value; |
|
| 94 | - } |
|
| 92 | + } else if ( $posted_field->type == 'text' && ! isset( $_POST['item_name'] ) ) { // WPCS: CSRF ok. |
|
| 93 | + $_POST['item_name'] = $value; |
|
| 94 | + } |
|
| 95 | 95 | |
| 96 | 96 | FrmEntriesHelper::set_posted_value( $posted_field, $value, $args ); |
| 97 | 97 | |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | |
| 104 | 104 | $errors = apply_filters( 'frm_validate_' . $posted_field->type . '_field_entry', $errors, $posted_field, $value, $args ); |
| 105 | 105 | $errors = apply_filters( 'frm_validate_field_entry', $errors, $posted_field, $value, $args ); |
| 106 | - } |
|
| 106 | + } |
|
| 107 | 107 | |
| 108 | 108 | private static function maybe_clear_value_for_default_blank_setting( $field, &$value ) { |
| 109 | 109 | $is_default = ( FrmField::is_option_true_in_object( $field, 'default_blank' ) && $value == $field->default_value ); |
@@ -206,32 +206,32 @@ discard block |
||
| 206 | 206 | return $pattern; |
| 207 | 207 | } |
| 208 | 208 | |
| 209 | - /** |
|
| 210 | - * check for spam |
|
| 211 | - * @param boolean $exclude |
|
| 212 | - * @param array $values |
|
| 213 | - * @param array $errors by reference |
|
| 214 | - */ |
|
| 215 | - public static function spam_check( $exclude, $values, &$errors ) { |
|
| 216 | - if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) { |
|
| 217 | - // only check spam if there are no other errors |
|
| 218 | - return; |
|
| 219 | - } |
|
| 209 | + /** |
|
| 210 | + * check for spam |
|
| 211 | + * @param boolean $exclude |
|
| 212 | + * @param array $values |
|
| 213 | + * @param array $errors by reference |
|
| 214 | + */ |
|
| 215 | + public static function spam_check( $exclude, $values, &$errors ) { |
|
| 216 | + if ( ! empty( $exclude ) || ! isset( $values['item_meta'] ) || empty( $values['item_meta'] ) || ! empty( $errors ) ) { |
|
| 217 | + // only check spam if there are no other errors |
|
| 218 | + return; |
|
| 219 | + } |
|
| 220 | 220 | |
| 221 | 221 | if ( self::is_honeypot_spam() || self::is_spam_bot() ) { |
| 222 | 222 | $errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' ); |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | - if ( self::blacklist_check( $values ) ) { |
|
| 226 | - $errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' ); |
|
| 227 | - } |
|
| 225 | + if ( self::blacklist_check( $values ) ) { |
|
| 226 | + $errors['spam'] = __( 'Your entry appears to be blacklist spam!', 'formidable' ); |
|
| 227 | + } |
|
| 228 | 228 | |
| 229 | - if ( self::is_akismet_spam( $values ) ) { |
|
| 229 | + if ( self::is_akismet_spam( $values ) ) { |
|
| 230 | 230 | if ( self::is_akismet_enabled_for_user( $values['form_id'] ) ) { |
| 231 | 231 | $errors['spam'] = __( 'Your entry appears to be spam!', 'formidable' ); |
| 232 | 232 | } |
| 233 | - } |
|
| 234 | - } |
|
| 233 | + } |
|
| 234 | + } |
|
| 235 | 235 | |
| 236 | 236 | private static function is_honeypot_spam() { |
| 237 | 237 | $honeypot_value = FrmAppHelper::get_param( 'frm_verify', '', 'get', 'sanitize_text_field' ); |
@@ -253,15 +253,15 @@ discard block |
||
| 253 | 253 | return ( isset( $form->options['akismet'] ) && ! empty( $form->options['akismet'] ) && ( $form->options['akismet'] != 'logged' || ! is_user_logged_in() ) ); |
| 254 | 254 | } |
| 255 | 255 | |
| 256 | - public static function blacklist_check( $values ) { |
|
| 256 | + public static function blacklist_check( $values ) { |
|
| 257 | 257 | if ( ! apply_filters( 'frm_check_blacklist', true, $values ) ) { |
| 258 | - return false; |
|
| 259 | - } |
|
| 258 | + return false; |
|
| 259 | + } |
|
| 260 | 260 | |
| 261 | - $mod_keys = trim( get_option( 'blacklist_keys' ) ); |
|
| 262 | - if ( empty( $mod_keys ) ) { |
|
| 263 | - return false; |
|
| 264 | - } |
|
| 261 | + $mod_keys = trim( get_option( 'blacklist_keys' ) ); |
|
| 262 | + if ( empty( $mod_keys ) ) { |
|
| 263 | + return false; |
|
| 264 | + } |
|
| 265 | 265 | |
| 266 | 266 | $content = FrmEntriesHelper::entry_array_to_string( $values ); |
| 267 | 267 | if ( empty( $content ) ) { |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | $user_info = self::get_spam_check_user_info( $values ); |
| 274 | 274 | |
| 275 | 275 | return wp_blacklist_check( $user_info['comment_author'], $user_info['comment_author_email'], $user_info['comment_author_url'], $content, $ip, $user_agent ); |
| 276 | - } |
|
| 276 | + } |
|
| 277 | 277 | |
| 278 | 278 | /** |
| 279 | 279 | * Check entries for Akismet spam |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | |
| 44 | 44 | //validate the number format |
| 45 | 45 | if ( ! is_numeric( $args['value'] ) && '' !== $args['value'] ) { |
| 46 | - $errors[ 'field' . $args['id'] ] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 46 | + $errors['field' . $args['id']] = FrmFieldsHelper::get_error_msg( $this->field, 'invalid' ); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | // validate number settings |
@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | if ( $frm_settings->use_html && $maxnum !== '' && $minnum !== '' ) { |
| 56 | 56 | $value = (float) $args['value']; |
| 57 | 57 | if ( $value < $minnum ) { |
| 58 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a higher number', 'formidable' ); |
|
| 58 | + $errors['field' . $args['id']] = __( 'Please select a higher number', 'formidable' ); |
|
| 59 | 59 | } elseif ( $value > $maxnum ) { |
| 60 | - $errors[ 'field' . $args['id'] ] = __( 'Please select a lower number', 'formidable' ); |
|
| 60 | + $errors['field' . $args['id']] = __( 'Please select a lower number', 'formidable' ); |
|
| 61 | 61 | } |
| 62 | 62 | } |
| 63 | 63 | } |
@@ -4,7 +4,7 @@ discard block |
||
| 4 | 4 | public $id = 0; // the id of the post |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | - * @param int|string $id The id of the stylsheet or 'default' |
|
| 7 | + * @param integer $id The id of the stylsheet or 'default' |
|
| 8 | 8 | */ |
| 9 | 9 | public function __construct( $id = 0 ) { |
| 10 | 10 | $this->id = $id; |
@@ -127,6 +127,9 @@ discard block |
||
| 127 | 127 | set_transient( 'frmpro_css', $css ); |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | + /** |
|
| 131 | + * @param string $filename |
|
| 132 | + */ |
|
| 130 | 133 | private function get_css_content( $filename ) { |
| 131 | 134 | $css = '/* ' . __( 'WARNING: Any changes made to this file will be lost when your Formidable settings are updated', 'formidable' ) . ' */' . "\n"; |
| 132 | 135 | |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | $new_instance = stripslashes_deep( (array) $new_instance ); |
| 53 | 53 | $this->id = $new_instance['ID']; |
| 54 | 54 | if ( $id != $this->id || ! $_POST || ! isset( $_POST['frm_style_setting'] ) ) { |
| 55 | - $all_instances[ $number ] = $new_instance; |
|
| 55 | + $all_instances[$number] = $new_instance; |
|
| 56 | 56 | |
| 57 | 57 | if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
| 58 | 58 | // this style was set to default, so remove default setting on previous default style |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | $new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] ); |
| 68 | 68 | $new_instance['post_content'] = $_POST['frm_style_setting']['post_content']; |
| 69 | 69 | $new_instance['post_type'] = FrmStylesController::$post_type; |
| 70 | - $new_instance['post_status'] = 'publish'; |
|
| 70 | + $new_instance['post_status'] = 'publish'; |
|
| 71 | 71 | $new_instance['menu_order'] = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0; |
| 72 | 72 | |
| 73 | 73 | if ( empty( $id ) ) { |
@@ -77,20 +77,20 @@ discard block |
||
| 77 | 77 | $default_settings = $this->get_defaults(); |
| 78 | 78 | |
| 79 | 79 | foreach ( $default_settings as $setting => $default ) { |
| 80 | - if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 81 | - $new_instance['post_content'][ $setting ] = $default; |
|
| 80 | + if ( ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 81 | + $new_instance['post_content'][$setting] = $default; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if ( $this->is_color( $setting ) ) { |
| 85 | - $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
|
| 86 | - } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
|
| 87 | - $new_instance['post_content'][ $setting ] = 0; |
|
| 85 | + $new_instance['post_content'][$setting] = str_replace( '#', '', $new_instance['post_content'][$setting] ); |
|
| 86 | + } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][$setting] ) ) { |
|
| 87 | + $new_instance['post_content'][$setting] = 0; |
|
| 88 | 88 | } else if ( $setting == 'font' ) { |
| 89 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 89 | + $new_instance['post_content'][$setting] = $this->force_balanced_quotation( $new_instance['post_content'][$setting] ); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $all_instances[ $number ] = $new_instance; |
|
| 93 | + $all_instances[$number] = $new_instance; |
|
| 94 | 94 | |
| 95 | 95 | $action_ids[] = $this->save( $new_instance ); |
| 96 | 96 | |
@@ -257,12 +257,12 @@ discard block |
||
| 257 | 257 | $style->post_content = $this->override_defaults( $style->post_content ); |
| 258 | 258 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 259 | 259 | |
| 260 | - $styles[ $style->ID ] = $style; |
|
| 260 | + $styles[$style->ID] = $style; |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | if ( ! $default_style ) { |
| 264 | 264 | $default_style = reset( $styles ); |
| 265 | - $styles[ $default_style->ID ]->menu_order = 1; |
|
| 265 | + $styles[$default_style->ID]->menu_order = 1; |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | return $styles; |
@@ -7,46 +7,46 @@ discard block |
||
| 7 | 7 | * @param int|string $id The id of the stylsheet or 'default' |
| 8 | 8 | */ |
| 9 | 9 | public function __construct( $id = 0 ) { |
| 10 | - $this->id = $id; |
|
| 11 | - } |
|
| 10 | + $this->id = $id; |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function get_new() { |
|
| 13 | + public function get_new() { |
|
| 14 | 14 | $this->id = 0; |
| 15 | 15 | |
| 16 | - $max_slug_value = 2147483647; |
|
| 17 | - $min_slug_value = 37; // we want to have at least 2 characters in the slug |
|
| 16 | + $max_slug_value = 2147483647; |
|
| 17 | + $min_slug_value = 37; // we want to have at least 2 characters in the slug |
|
| 18 | 18 | $key = base_convert( rand( $min_slug_value, $max_slug_value ), 10, 36 ); |
| 19 | 19 | |
| 20 | - $style = array( |
|
| 21 | - 'post_type' => FrmStylesController::$post_type, |
|
| 22 | - 'ID' => '', |
|
| 23 | - 'post_title' => __( 'New Style', 'formidable' ), |
|
| 24 | - 'post_name' => $key, |
|
| 25 | - 'post_content' => $this->get_defaults(), |
|
| 26 | - 'menu_order' => '', |
|
| 27 | - 'post_status' => 'publish', |
|
| 28 | - ); |
|
| 20 | + $style = array( |
|
| 21 | + 'post_type' => FrmStylesController::$post_type, |
|
| 22 | + 'ID' => '', |
|
| 23 | + 'post_title' => __( 'New Style', 'formidable' ), |
|
| 24 | + 'post_name' => $key, |
|
| 25 | + 'post_content' => $this->get_defaults(), |
|
| 26 | + 'menu_order' => '', |
|
| 27 | + 'post_status' => 'publish', |
|
| 28 | + ); |
|
| 29 | 29 | |
| 30 | - return (object) $style; |
|
| 31 | - } |
|
| 30 | + return (object) $style; |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | 33 | public function save( $settings ) { |
| 34 | 34 | return FrmDb::save_settings( $settings, 'frm_styles' ); |
| 35 | - } |
|
| 35 | + } |
|
| 36 | 36 | |
| 37 | 37 | public function duplicate( $id ) { |
| 38 | - // duplicating is a pro feature |
|
| 39 | - } |
|
| 38 | + // duplicating is a pro feature |
|
| 39 | + } |
|
| 40 | 40 | |
| 41 | - public function update( $id = 'default' ) { |
|
| 41 | + public function update( $id = 'default' ) { |
|
| 42 | 42 | $all_instances = $this->get_all(); |
| 43 | 43 | |
| 44 | 44 | if ( empty( $id ) ) { |
| 45 | - $new_style = (array) $this->get_new(); |
|
| 46 | - $all_instances[] = $new_style; |
|
| 45 | + $new_style = (array) $this->get_new(); |
|
| 46 | + $all_instances[] = $new_style; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $action_ids = array(); |
|
| 49 | + $action_ids = array(); |
|
| 50 | 50 | |
| 51 | 51 | foreach ( $all_instances as $number => $new_instance ) { |
| 52 | 52 | $new_instance = stripslashes_deep( (array) $new_instance ); |
@@ -55,28 +55,28 @@ discard block |
||
| 55 | 55 | $all_instances[ $number ] = $new_instance; |
| 56 | 56 | |
| 57 | 57 | if ( $new_instance['menu_order'] && $_POST && empty( $_POST['prev_menu_order'] ) && isset( $_POST['frm_style_setting']['menu_order'] ) ) { |
| 58 | - // this style was set to default, so remove default setting on previous default style |
|
| 59 | - $new_instance['menu_order'] = 0; |
|
| 58 | + // this style was set to default, so remove default setting on previous default style |
|
| 59 | + $new_instance['menu_order'] = 0; |
|
| 60 | 60 | $action_ids[] = $this->save( $new_instance ); |
| 61 | - } |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - // don't continue if not saving this style |
|
| 64 | - continue; |
|
| 63 | + // don't continue if not saving this style |
|
| 64 | + continue; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | $new_instance['post_title'] = sanitize_text_field( $_POST['frm_style_setting']['post_title'] ); |
| 68 | 68 | $new_instance['post_content'] = $_POST['frm_style_setting']['post_content']; |
| 69 | 69 | $new_instance['post_type'] = FrmStylesController::$post_type; |
| 70 | - $new_instance['post_status'] = 'publish'; |
|
| 70 | + $new_instance['post_status'] = 'publish'; |
|
| 71 | 71 | $new_instance['menu_order'] = isset( $_POST['frm_style_setting']['menu_order'] ) ? absint( $_POST['frm_style_setting']['menu_order'] ) : 0; |
| 72 | 72 | |
| 73 | 73 | if ( empty( $id ) ) { |
| 74 | - $new_instance['post_name'] = $new_instance['post_title']; |
|
| 75 | - } |
|
| 74 | + $new_instance['post_name'] = $new_instance['post_title']; |
|
| 75 | + } |
|
| 76 | 76 | |
| 77 | - $default_settings = $this->get_defaults(); |
|
| 77 | + $default_settings = $this->get_defaults(); |
|
| 78 | 78 | |
| 79 | - foreach ( $default_settings as $setting => $default ) { |
|
| 79 | + foreach ( $default_settings as $setting => $default ) { |
|
| 80 | 80 | if ( ! isset( $new_instance['post_content'][ $setting ] ) ) { |
| 81 | 81 | $new_instance['post_content'][ $setting ] = $default; |
| 82 | 82 | } |
@@ -85,10 +85,10 @@ discard block |
||
| 85 | 85 | $new_instance['post_content'][ $setting ] = str_replace( '#', '', $new_instance['post_content'][ $setting ] ); |
| 86 | 86 | } else if ( in_array( $setting, array( 'submit_style', 'important_style', 'auto_width' ) ) && ! isset( $new_instance['post_content'][ $setting ] ) ) { |
| 87 | 87 | $new_instance['post_content'][ $setting ] = 0; |
| 88 | - } else if ( $setting == 'font' ) { |
|
| 89 | - $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 90 | - } |
|
| 91 | - } |
|
| 88 | + } else if ( $setting == 'font' ) { |
|
| 89 | + $new_instance['post_content'][ $setting ] = $this->force_balanced_quotation( $new_instance['post_content'][ $setting ] ); |
|
| 90 | + } |
|
| 91 | + } |
|
| 92 | 92 | |
| 93 | 93 | $all_instances[ $number ] = $new_instance; |
| 94 | 94 | |
@@ -118,16 +118,16 @@ discard block |
||
| 118 | 118 | return array_filter( $settings, array( $this, 'is_color' ) ); |
| 119 | 119 | } |
| 120 | 120 | |
| 121 | - /** |
|
| 122 | - * Create static css file |
|
| 123 | - */ |
|
| 121 | + /** |
|
| 122 | + * Create static css file |
|
| 123 | + */ |
|
| 124 | 124 | public function save_settings() { |
| 125 | 125 | $filename = FrmAppHelper::plugin_path() . '/css/custom_theme.css.php'; |
| 126 | 126 | update_option( 'frm_last_style_update', date( 'njGi' ) ); |
| 127 | 127 | |
| 128 | 128 | if ( ! is_file( $filename ) ) { |
| 129 | - return; |
|
| 130 | - } |
|
| 129 | + return; |
|
| 130 | + } |
|
| 131 | 131 | |
| 132 | 132 | $this->clear_cache(); |
| 133 | 133 | |
@@ -151,10 +151,10 @@ discard block |
||
| 151 | 151 | $saving = true; |
| 152 | 152 | $frm_style = $this; |
| 153 | 153 | |
| 154 | - ob_start(); |
|
| 155 | - include( $filename ); |
|
| 154 | + ob_start(); |
|
| 155 | + include( $filename ); |
|
| 156 | 156 | $css .= preg_replace( '/\/\*(.|\s)*?\*\//', '', str_replace( array( "\r\n", "\r", "\n", "\t", ' ' ), '', ob_get_contents() ) ); |
| 157 | - ob_end_clean(); |
|
| 157 | + ob_end_clean(); |
|
| 158 | 158 | |
| 159 | 159 | return $css; |
| 160 | 160 | } |
@@ -175,83 +175,83 @@ discard block |
||
| 175 | 175 | |
| 176 | 176 | public function destroy( $id ) { |
| 177 | 177 | return wp_delete_post( $id ); |
| 178 | - } |
|
| 179 | - |
|
| 180 | - public function get_one() { |
|
| 181 | - if ( 'default' == $this->id ) { |
|
| 182 | - $style = $this->get_default_style(); |
|
| 183 | - if ( $style ) { |
|
| 184 | - $this->id = $style->ID; |
|
| 185 | - } else { |
|
| 186 | - $this->id = 0; |
|
| 187 | - } |
|
| 188 | - return $style; |
|
| 189 | - } |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + public function get_one() { |
|
| 181 | + if ( 'default' == $this->id ) { |
|
| 182 | + $style = $this->get_default_style(); |
|
| 183 | + if ( $style ) { |
|
| 184 | + $this->id = $style->ID; |
|
| 185 | + } else { |
|
| 186 | + $this->id = 0; |
|
| 187 | + } |
|
| 188 | + return $style; |
|
| 189 | + } |
|
| 190 | 190 | |
| 191 | 191 | $style = get_post( $this->id ); |
| 192 | 192 | |
| 193 | - if ( ! $style ) { |
|
| 194 | - return $style; |
|
| 195 | - } |
|
| 193 | + if ( ! $style ) { |
|
| 194 | + return $style; |
|
| 195 | + } |
|
| 196 | 196 | |
| 197 | 197 | $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
| 198 | 198 | |
| 199 | - $default_values = $this->get_defaults(); |
|
| 199 | + $default_values = $this->get_defaults(); |
|
| 200 | 200 | |
| 201 | 201 | // fill default values |
| 202 | 202 | $style->post_content = $this->override_defaults( $style->post_content ); |
| 203 | 203 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 204 | 204 | |
| 205 | - return $style; |
|
| 206 | - } |
|
| 205 | + return $style; |
|
| 206 | + } |
|
| 207 | 207 | |
| 208 | - public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
| 209 | - $post_atts = array( |
|
| 208 | + public function get_all( $orderby = 'title', $order = 'ASC', $limit = 99 ) { |
|
| 209 | + $post_atts = array( |
|
| 210 | 210 | 'post_type' => FrmStylesController::$post_type, |
| 211 | 211 | 'post_status' => 'publish', |
| 212 | 212 | 'numberposts' => $limit, |
| 213 | 213 | 'orderby' => $orderby, |
| 214 | 214 | 'order' => $order, |
| 215 | - ); |
|
| 215 | + ); |
|
| 216 | 216 | |
| 217 | 217 | $temp_styles = FrmDb::check_cache( serialize( $post_atts ), 'frm_styles', $post_atts, 'get_posts' ); |
| 218 | 218 | |
| 219 | 219 | if ( empty( $temp_styles ) ) { |
| 220 | - global $wpdb; |
|
| 221 | - // make sure there wasn't a conflict with the query |
|
| 220 | + global $wpdb; |
|
| 221 | + // make sure there wasn't a conflict with the query |
|
| 222 | 222 | $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->posts . ' WHERE post_type=%s AND post_status=%s ORDER BY post_title ASC LIMIT 99', FrmStylesController::$post_type, 'publish' ); |
| 223 | 223 | $temp_styles = FrmDb::check_cache( 'frm_backup_style_check', 'frm_styles', $query, 'get_results' ); |
| 224 | 224 | |
| 225 | 225 | if ( empty( $temp_styles ) ) { |
| 226 | - // create a new style if there are none |
|
| 227 | - $new = $this->get_new(); |
|
| 226 | + // create a new style if there are none |
|
| 227 | + $new = $this->get_new(); |
|
| 228 | 228 | $new->post_title = __( 'Formidable Style', 'formidable' ); |
| 229 | 229 | $new->post_name = $new->post_title; |
| 230 | - $new->menu_order = 1; |
|
| 230 | + $new->menu_order = 1; |
|
| 231 | 231 | $new = $this->save( (array) $new ); |
| 232 | 232 | $this->update( 'default' ); |
| 233 | 233 | |
| 234 | - $post_atts['include'] = $new; |
|
| 234 | + $post_atts['include'] = $new; |
|
| 235 | 235 | |
| 236 | - $temp_styles = get_posts( $post_atts ); |
|
| 237 | - } |
|
| 238 | - } |
|
| 239 | - |
|
| 240 | - $default_values = $this->get_defaults(); |
|
| 241 | - $default_style = false; |
|
| 236 | + $temp_styles = get_posts( $post_atts ); |
|
| 237 | + } |
|
| 238 | + } |
|
| 242 | 239 | |
| 243 | - $styles = array(); |
|
| 244 | - foreach ( $temp_styles as $style ) { |
|
| 245 | - $this->id = $style->ID; |
|
| 246 | - if ( $style->menu_order ) { |
|
| 247 | - if ( $default_style ) { |
|
| 248 | - // only return one default |
|
| 249 | - $style->menu_order = 0; |
|
| 250 | - } else { |
|
| 251 | - // check for a default style |
|
| 252 | - $default_style = $style->ID; |
|
| 253 | - } |
|
| 254 | - } |
|
| 240 | + $default_values = $this->get_defaults(); |
|
| 241 | + $default_style = false; |
|
| 242 | + |
|
| 243 | + $styles = array(); |
|
| 244 | + foreach ( $temp_styles as $style ) { |
|
| 245 | + $this->id = $style->ID; |
|
| 246 | + if ( $style->menu_order ) { |
|
| 247 | + if ( $default_style ) { |
|
| 248 | + // only return one default |
|
| 249 | + $style->menu_order = 0; |
|
| 250 | + } else { |
|
| 251 | + // check for a default style |
|
| 252 | + $default_style = $style->ID; |
|
| 253 | + } |
|
| 254 | + } |
|
| 255 | 255 | |
| 256 | 256 | $style->post_content = FrmAppHelper::maybe_json_decode( $style->post_content ); |
| 257 | 257 | |
@@ -260,183 +260,183 @@ discard block |
||
| 260 | 260 | $style->post_content = wp_parse_args( $style->post_content, $default_values ); |
| 261 | 261 | |
| 262 | 262 | $styles[ $style->ID ] = $style; |
| 263 | - } |
|
| 263 | + } |
|
| 264 | 264 | |
| 265 | - if ( ! $default_style ) { |
|
| 265 | + if ( ! $default_style ) { |
|
| 266 | 266 | $default_style = reset( $styles ); |
| 267 | 267 | $styles[ $default_style->ID ]->menu_order = 1; |
| 268 | - } |
|
| 268 | + } |
|
| 269 | 269 | |
| 270 | - return $styles; |
|
| 271 | - } |
|
| 270 | + return $styles; |
|
| 271 | + } |
|
| 272 | 272 | |
| 273 | 273 | public function get_default_style( $styles = null ) { |
| 274 | 274 | if ( ! isset( $styles ) ) { |
| 275 | 275 | $styles = $this->get_all( 'menu_order', 'DESC', 1 ); |
| 276 | - } |
|
| 276 | + } |
|
| 277 | 277 | |
| 278 | - foreach ( $styles as $style ) { |
|
| 279 | - if ( $style->menu_order ) { |
|
| 280 | - return $style; |
|
| 281 | - } |
|
| 282 | - } |
|
| 283 | - } |
|
| 278 | + foreach ( $styles as $style ) { |
|
| 279 | + if ( $style->menu_order ) { |
|
| 280 | + return $style; |
|
| 281 | + } |
|
| 282 | + } |
|
| 283 | + } |
|
| 284 | 284 | |
| 285 | 285 | public function override_defaults( $settings ) { |
| 286 | 286 | if ( ! is_array( $settings ) ) { |
| 287 | - return $settings; |
|
| 288 | - } |
|
| 287 | + return $settings; |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | 290 | $settings['line_height'] = ( ! isset( $settings['field_height'] ) || $settings['field_height'] == '' || $settings['field_height'] == 'auto' ) ? 'normal' : $settings['field_height']; |
| 291 | 291 | |
| 292 | 292 | if ( ! isset( $settings['form_desc_size'] ) && isset( $settings['description_font_size'] ) ) { |
| 293 | - $settings['form_desc_size'] = $settings['description_font_size']; |
|
| 294 | - $settings['form_desc_color'] = $settings['description_color']; |
|
| 295 | - $settings['title_color'] = $settings['label_color']; |
|
| 296 | - } |
|
| 293 | + $settings['form_desc_size'] = $settings['description_font_size']; |
|
| 294 | + $settings['form_desc_color'] = $settings['description_color']; |
|
| 295 | + $settings['title_color'] = $settings['label_color']; |
|
| 296 | + } |
|
| 297 | 297 | |
| 298 | 298 | if ( ! isset( $settings['section_color'] ) && isset( $settings['label_color'] ) ) { |
| 299 | - $settings['section_color'] = $settings['label_color']; |
|
| 300 | - $settings['section_border_color'] = $settings['border_color']; |
|
| 301 | - } |
|
| 299 | + $settings['section_color'] = $settings['label_color']; |
|
| 300 | + $settings['section_border_color'] = $settings['border_color']; |
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | 303 | if ( ! isset( $settings['submit_hover_bg_color'] ) && isset( $settings['submit_bg_color'] ) ) { |
| 304 | - $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
| 305 | - $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
| 306 | - $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
| 304 | + $settings['submit_hover_bg_color'] = $settings['submit_bg_color']; |
|
| 305 | + $settings['submit_hover_color'] = $settings['submit_text_color']; |
|
| 306 | + $settings['submit_hover_border_color'] = $settings['submit_border_color']; |
|
| 307 | 307 | |
| 308 | - $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
| 309 | - $settings['submit_active_color'] = $settings['submit_text_color']; |
|
| 310 | - $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
| 311 | - } |
|
| 308 | + $settings['submit_active_bg_color'] = $settings['submit_bg_color']; |
|
| 309 | + $settings['submit_active_color'] = $settings['submit_text_color']; |
|
| 310 | + $settings['submit_active_border_color'] = $settings['submit_border_color']; |
|
| 311 | + } |
|
| 312 | 312 | |
| 313 | - return apply_filters( 'frm_override_default_styles', $settings ); |
|
| 313 | + return apply_filters( 'frm_override_default_styles', $settings ); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | public function get_defaults() { |
| 317 | 317 | $defaults = array( |
| 318 | - 'theme_css' => 'ui-lightness', |
|
| 319 | - 'theme_name' => 'UI Lightness', |
|
| 318 | + 'theme_css' => 'ui-lightness', |
|
| 319 | + 'theme_name' => 'UI Lightness', |
|
| 320 | 320 | |
| 321 | 321 | 'center_form' => '', |
| 322 | - 'form_width' => '100%', |
|
| 323 | - 'form_align' => 'left', |
|
| 324 | - 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
| 325 | - 'fieldset' => '0px', |
|
| 326 | - 'fieldset_color' => '000000', |
|
| 327 | - 'fieldset_padding' => '0 0 15px 0', |
|
| 328 | - 'fieldset_bg_color' => '', |
|
| 329 | - |
|
| 330 | - 'title_size' => '20px', |
|
| 331 | - 'title_color' => '444444', |
|
| 322 | + 'form_width' => '100%', |
|
| 323 | + 'form_align' => 'left', |
|
| 324 | + 'direction' => is_rtl() ? 'rtl' : 'ltr', |
|
| 325 | + 'fieldset' => '0px', |
|
| 326 | + 'fieldset_color' => '000000', |
|
| 327 | + 'fieldset_padding' => '0 0 15px 0', |
|
| 328 | + 'fieldset_bg_color' => '', |
|
| 329 | + |
|
| 330 | + 'title_size' => '20px', |
|
| 331 | + 'title_color' => '444444', |
|
| 332 | 332 | 'title_margin_top' => '10px', |
| 333 | 333 | 'title_margin_bottom' => '10px', |
| 334 | - 'form_desc_size' => '14px', |
|
| 335 | - 'form_desc_color' => '666666', |
|
| 334 | + 'form_desc_size' => '14px', |
|
| 335 | + 'form_desc_color' => '666666', |
|
| 336 | 336 | 'form_desc_margin_top' => '10px', |
| 337 | 337 | 'form_desc_margin_bottom' => '25px', |
| 338 | 338 | |
| 339 | - 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
| 340 | - 'font_size' => '14px', |
|
| 341 | - 'label_color' => '444444', |
|
| 342 | - 'weight' => 'bold', |
|
| 343 | - 'position' => 'none', |
|
| 344 | - 'align' => 'left', |
|
| 345 | - 'width' => '150px', |
|
| 346 | - 'required_color' => 'B94A48', |
|
| 347 | - 'required_weight' => 'bold', |
|
| 348 | - 'label_padding' => '0 0 3px 0', |
|
| 349 | - |
|
| 350 | - 'description_font_size' => '12px', |
|
| 351 | - 'description_color' => '666666', |
|
| 352 | - 'description_weight' => 'normal', |
|
| 353 | - 'description_style' => 'normal', |
|
| 354 | - 'description_align' => 'left', |
|
| 339 | + 'font' => '"Lucida Grande","Lucida Sans Unicode",Tahoma,sans-serif', |
|
| 340 | + 'font_size' => '14px', |
|
| 341 | + 'label_color' => '444444', |
|
| 342 | + 'weight' => 'bold', |
|
| 343 | + 'position' => 'none', |
|
| 344 | + 'align' => 'left', |
|
| 345 | + 'width' => '150px', |
|
| 346 | + 'required_color' => 'B94A48', |
|
| 347 | + 'required_weight' => 'bold', |
|
| 348 | + 'label_padding' => '0 0 3px 0', |
|
| 349 | + |
|
| 350 | + 'description_font_size' => '12px', |
|
| 351 | + 'description_color' => '666666', |
|
| 352 | + 'description_weight' => 'normal', |
|
| 353 | + 'description_style' => 'normal', |
|
| 354 | + 'description_align' => 'left', |
|
| 355 | 355 | 'description_margin' => '0', |
| 356 | 356 | |
| 357 | - 'field_font_size' => '14px', |
|
| 358 | - 'field_height' => '32px', |
|
| 359 | - 'line_height' => 'normal', |
|
| 360 | - 'field_width' => '100%', |
|
| 361 | - 'auto_width' => false, |
|
| 362 | - 'field_pad' => '6px 10px', |
|
| 363 | - 'field_margin' => '20px', |
|
| 357 | + 'field_font_size' => '14px', |
|
| 358 | + 'field_height' => '32px', |
|
| 359 | + 'line_height' => 'normal', |
|
| 360 | + 'field_width' => '100%', |
|
| 361 | + 'auto_width' => false, |
|
| 362 | + 'field_pad' => '6px 10px', |
|
| 363 | + 'field_margin' => '20px', |
|
| 364 | 364 | 'field_weight' => 'normal', |
| 365 | - 'text_color' => '555555', |
|
| 366 | - //'border_color_hv' => 'cccccc', |
|
| 367 | - 'border_color' => 'cccccc', |
|
| 368 | - 'field_border_width' => '1px', |
|
| 369 | - 'field_border_style' => 'solid', |
|
| 370 | - |
|
| 371 | - 'bg_color' => 'ffffff', |
|
| 372 | - //'bg_color_hv' => 'ffffff', |
|
| 365 | + 'text_color' => '555555', |
|
| 366 | + //'border_color_hv' => 'cccccc', |
|
| 367 | + 'border_color' => 'cccccc', |
|
| 368 | + 'field_border_width' => '1px', |
|
| 369 | + 'field_border_style' => 'solid', |
|
| 370 | + |
|
| 371 | + 'bg_color' => 'ffffff', |
|
| 372 | + //'bg_color_hv' => 'ffffff', |
|
| 373 | 373 | 'remove_box_shadow' => '', |
| 374 | - 'bg_color_active' => 'ffffff', |
|
| 374 | + 'bg_color_active' => 'ffffff', |
|
| 375 | 375 | 'border_color_active' => '66afe9', |
| 376 | 376 | 'remove_box_shadow_active' => '', |
| 377 | - 'text_color_error' => '444444', |
|
| 378 | - 'bg_color_error' => 'ffffff', |
|
| 377 | + 'text_color_error' => '444444', |
|
| 378 | + 'bg_color_error' => 'ffffff', |
|
| 379 | 379 | 'border_color_error' => 'B94A48', |
| 380 | 380 | 'border_width_error' => '1px', |
| 381 | 381 | 'border_style_error' => 'solid', |
| 382 | - 'bg_color_disabled' => 'ffffff', |
|
| 383 | - 'border_color_disabled' => 'E5E5E5', |
|
| 384 | - 'text_color_disabled' => 'A1A1A1', |
|
| 385 | - |
|
| 386 | - 'radio_align' => 'block', |
|
| 387 | - 'check_align' => 'block', |
|
| 388 | - 'check_font_size' => '13px', |
|
| 389 | - 'check_label_color' => '444444', |
|
| 390 | - 'check_weight' => 'normal', |
|
| 391 | - |
|
| 392 | - 'section_font_size' => '18px', |
|
| 393 | - 'section_color' => '444444', |
|
| 394 | - 'section_weight' => 'bold', |
|
| 395 | - 'section_pad' => '15px 0 3px 0', |
|
| 396 | - 'section_mar_top' => '15px', |
|
| 382 | + 'bg_color_disabled' => 'ffffff', |
|
| 383 | + 'border_color_disabled' => 'E5E5E5', |
|
| 384 | + 'text_color_disabled' => 'A1A1A1', |
|
| 385 | + |
|
| 386 | + 'radio_align' => 'block', |
|
| 387 | + 'check_align' => 'block', |
|
| 388 | + 'check_font_size' => '13px', |
|
| 389 | + 'check_label_color' => '444444', |
|
| 390 | + 'check_weight' => 'normal', |
|
| 391 | + |
|
| 392 | + 'section_font_size' => '18px', |
|
| 393 | + 'section_color' => '444444', |
|
| 394 | + 'section_weight' => 'bold', |
|
| 395 | + 'section_pad' => '15px 0 3px 0', |
|
| 396 | + 'section_mar_top' => '15px', |
|
| 397 | 397 | 'section_mar_bottom' => '12px', |
| 398 | - 'section_bg_color' => '', |
|
| 399 | - 'section_border_color' => 'e8e8e8', |
|
| 400 | - 'section_border_width' => '2px', |
|
| 401 | - 'section_border_style' => 'solid', |
|
| 402 | - 'section_border_loc' => '-top', |
|
| 403 | - 'collapse_icon' => '6', |
|
| 404 | - 'collapse_pos' => 'after', |
|
| 405 | - 'repeat_icon' => '1', |
|
| 406 | - |
|
| 407 | - 'submit_style' => false, |
|
| 408 | - 'submit_font_size' => '14px', |
|
| 409 | - 'submit_width' => 'auto', |
|
| 410 | - 'submit_height' => 'auto', |
|
| 411 | - 'submit_bg_color' => 'ffffff', |
|
| 412 | - 'submit_border_color' => 'cccccc', |
|
| 413 | - 'submit_border_width' => '1px', |
|
| 414 | - 'submit_text_color' => '444444', |
|
| 415 | - 'submit_weight' => 'normal', |
|
| 416 | - 'submit_border_radius' => '4px', |
|
| 417 | - 'submit_bg_img' => '', |
|
| 418 | - 'submit_margin' => '10px', |
|
| 419 | - 'submit_padding' => '6px 11px', |
|
| 420 | - 'submit_shadow_color' => 'eeeeee', |
|
| 421 | - 'submit_hover_bg_color' => 'efefef', |
|
| 422 | - 'submit_hover_color' => '444444', |
|
| 423 | - 'submit_hover_border_color' => 'cccccc', |
|
| 424 | - 'submit_active_bg_color' => 'efefef', |
|
| 425 | - 'submit_active_color' => '444444', |
|
| 426 | - 'submit_active_border_color' => 'cccccc', |
|
| 427 | - |
|
| 428 | - 'border_radius' => '4px', |
|
| 429 | - 'error_bg' => 'F2DEDE', |
|
| 430 | - 'error_border' => 'EBCCD1', |
|
| 431 | - 'error_text' => 'B94A48', |
|
| 432 | - 'error_font_size' => '14px', |
|
| 433 | - |
|
| 434 | - 'success_bg_color' => 'DFF0D8', |
|
| 435 | - 'success_border_color' => 'D6E9C6', |
|
| 436 | - 'success_text_color' => '468847', |
|
| 437 | - 'success_font_size' => '14px', |
|
| 438 | - |
|
| 439 | - 'important_style' => false, |
|
| 398 | + 'section_bg_color' => '', |
|
| 399 | + 'section_border_color' => 'e8e8e8', |
|
| 400 | + 'section_border_width' => '2px', |
|
| 401 | + 'section_border_style' => 'solid', |
|
| 402 | + 'section_border_loc' => '-top', |
|
| 403 | + 'collapse_icon' => '6', |
|
| 404 | + 'collapse_pos' => 'after', |
|
| 405 | + 'repeat_icon' => '1', |
|
| 406 | + |
|
| 407 | + 'submit_style' => false, |
|
| 408 | + 'submit_font_size' => '14px', |
|
| 409 | + 'submit_width' => 'auto', |
|
| 410 | + 'submit_height' => 'auto', |
|
| 411 | + 'submit_bg_color' => 'ffffff', |
|
| 412 | + 'submit_border_color' => 'cccccc', |
|
| 413 | + 'submit_border_width' => '1px', |
|
| 414 | + 'submit_text_color' => '444444', |
|
| 415 | + 'submit_weight' => 'normal', |
|
| 416 | + 'submit_border_radius' => '4px', |
|
| 417 | + 'submit_bg_img' => '', |
|
| 418 | + 'submit_margin' => '10px', |
|
| 419 | + 'submit_padding' => '6px 11px', |
|
| 420 | + 'submit_shadow_color' => 'eeeeee', |
|
| 421 | + 'submit_hover_bg_color' => 'efefef', |
|
| 422 | + 'submit_hover_color' => '444444', |
|
| 423 | + 'submit_hover_border_color' => 'cccccc', |
|
| 424 | + 'submit_active_bg_color' => 'efefef', |
|
| 425 | + 'submit_active_color' => '444444', |
|
| 426 | + 'submit_active_border_color' => 'cccccc', |
|
| 427 | + |
|
| 428 | + 'border_radius' => '4px', |
|
| 429 | + 'error_bg' => 'F2DEDE', |
|
| 430 | + 'error_border' => 'EBCCD1', |
|
| 431 | + 'error_text' => 'B94A48', |
|
| 432 | + 'error_font_size' => '14px', |
|
| 433 | + |
|
| 434 | + 'success_bg_color' => 'DFF0D8', |
|
| 435 | + 'success_border_color' => 'D6E9C6', |
|
| 436 | + 'success_text_color' => '468847', |
|
| 437 | + 'success_font_size' => '14px', |
|
| 438 | + |
|
| 439 | + 'important_style' => false, |
|
| 440 | 440 | |
| 441 | 441 | 'progress_bg_color' => 'dddddd', |
| 442 | 442 | 'progress_active_color' => 'ffffff', |
@@ -446,10 +446,10 @@ discard block |
||
| 446 | 446 | 'progress_border_size' => '2px', |
| 447 | 447 | 'progress_size' => '30px', |
| 448 | 448 | |
| 449 | - 'custom_css' => '', |
|
| 449 | + 'custom_css' => '', |
|
| 450 | 450 | ); |
| 451 | 451 | return apply_filters( 'frm_default_style_settings', $defaults ); |
| 452 | - } |
|
| 452 | + } |
|
| 453 | 453 | |
| 454 | 454 | public function get_field_name( $field_name, $post_field = 'post_content' ) { |
| 455 | 455 | return 'frm_style_setting' . ( empty( $post_field ) ? '' : '[' . $post_field . ']' ) . '[' . $field_name . ']'; |