@@ -14,7 +14,7 @@ |
||
| 14 | 14 | protected function field_settings_for_type() { |
| 15 | 15 | return array( |
| 16 | 16 | 'size' => true, |
| 17 | - 'clear_on_focus' => true, |
|
| 17 | + 'clear_on_focus' => true, |
|
| 18 | 18 | 'invalid' => true, |
| 19 | 19 | ); |
| 20 | 20 | } |
@@ -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 | } |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | </div> |
| 6 | 6 | </div> |
| 7 | 7 | <?php |
| 8 | - return; |
|
| 8 | + return; |
|
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | global $frm_vars; |
@@ -54,8 +54,8 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | // close open collapsible toggle div |
| 56 | 56 | if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) { |
| 57 | - echo "</div>\n"; |
|
| 58 | - unset($frm_vars['collapse_div']); |
|
| 57 | + echo "</div>\n"; |
|
| 58 | + unset($frm_vars['collapse_div']); |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); |
@@ -1,6 +1,6 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -if ( empty($values) || ! isset($values['fields']) || empty($values['fields']) ) { ?> |
|
| 3 | -<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class($form); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container"> |
|
| 2 | +if ( empty( $values ) || ! isset( $values['fields'] ) || empty( $values['fields'] ) ) { ?> |
|
| 3 | +<div class="frm_forms <?php echo FrmFormsHelper::get_form_style_class( $form ); ?>" id="frm_form_<?php echo esc_attr( $form->id ) ?>_container"> |
|
| 4 | 4 | <div class="frm_error_style"><strong><?php esc_html_e( 'Oops!', 'formidable' ) ?></strong> <?php printf( esc_html__( 'You did not add any fields to your form. %1$sGo back%2$s and add some.', 'formidable' ), '<a href="' . esc_url( admin_url( '?page=formidable&frm_action=edit&id=' . $form->id ) ) . '">', '</a>' ) ?> |
| 5 | 5 | </div> |
| 6 | 6 | </div> |
@@ -19,15 +19,15 @@ discard block |
||
| 19 | 19 | <fieldset> |
| 20 | 20 | <?php echo FrmFormsHelper::replace_shortcodes( $values['before_html'], $form, $title, $description ); ?> |
| 21 | 21 | <div <?php echo wp_strip_all_tags( apply_filters( 'frm_fields_container_class', 'class="frm_fields_container"' ) ); ?>> |
| 22 | -<?php do_action( 'frm_after_title', compact('form') ) ?> |
|
| 23 | -<input type="hidden" name="frm_action" value="<?php echo esc_attr($form_action) ?>" /> |
|
| 24 | -<input type="hidden" name="form_id" value="<?php echo esc_attr($form->id) ?>" /> |
|
| 25 | -<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr($frm_hide_fields) ?>" /> |
|
| 26 | -<input type="hidden" name="form_key" value="<?php echo esc_attr($form->form_key) ?>" /> |
|
| 22 | +<?php do_action( 'frm_after_title', compact( 'form' ) ) ?> |
|
| 23 | +<input type="hidden" name="frm_action" value="<?php echo esc_attr( $form_action ) ?>" /> |
|
| 24 | +<input type="hidden" name="form_id" value="<?php echo esc_attr( $form->id ) ?>" /> |
|
| 25 | +<input type="hidden" name="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" id="frm_hide_fields_<?php echo esc_attr( $form->id ) ?>" value="<?php echo esc_attr( $frm_hide_fields ) ?>" /> |
|
| 26 | +<input type="hidden" name="form_key" value="<?php echo esc_attr( $form->form_key ) ?>" /> |
|
| 27 | 27 | <input type="hidden" name="item_meta[0]" value="" /> |
| 28 | 28 | <?php wp_nonce_field( 'frm_submit_entry_nonce', 'frm_submit_entry_' . $form->id ); ?> |
| 29 | 29 | <label for="frm_verify_<?php echo esc_attr( $form->id ) ?>" class="frm_screen_reader frm_hidden"><?php esc_html_e( 'If you are human, leave this field blank.', 'formidable' ) ?></label> |
| 30 | -<input type="text" class="frm_hidden frm_verify" id="frm_verify_<?php echo esc_attr( $form->id ) ?>" name="frm_verify" value="<?php echo esc_attr( FrmAppHelper::get_param('frm_verify', '', 'get', 'wp_kses_post' ) ) ?>" <?php FrmFormsHelper::maybe_hide_inline() ?> /> |
|
| 30 | +<input type="text" class="frm_hidden frm_verify" id="frm_verify_<?php echo esc_attr( $form->id ) ?>" name="frm_verify" value="<?php echo esc_attr( FrmAppHelper::get_param( 'frm_verify', '', 'get', 'wp_kses_post' ) ) ?>" <?php FrmFormsHelper::maybe_hide_inline() ?> /> |
|
| 31 | 31 | <?php if ( isset( $id ) ) { ?> |
| 32 | 32 | <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
| 33 | 33 | <?php } ?> |
@@ -41,14 +41,14 @@ discard block |
||
| 41 | 41 | ?> |
| 42 | 42 | <div class="frm_form_field form-field"> |
| 43 | 43 | <label class="frm_primary_label"><?php esc_html_e( 'Entry Key', 'formidable' ) ?></label> |
| 44 | -<input type="text" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" /> |
|
| 44 | +<input type="text" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" /> |
|
| 45 | 45 | </div> |
| 46 | 46 | <?php } else { ?> |
| 47 | -<input type="hidden" name="item_key" value="<?php echo esc_attr($values['item_key']) ?>" /> |
|
| 47 | +<input type="hidden" name="item_key" value="<?php echo esc_attr( $values['item_key'] ) ?>" /> |
|
| 48 | 48 | <?php |
| 49 | 49 | } |
| 50 | 50 | |
| 51 | -do_action('frm_entry_form', $form, $form_action, $errors); |
|
| 51 | +do_action( 'frm_entry_form', $form, $form_action, $errors ); |
|
| 52 | 52 | |
| 53 | 53 | global $frm_vars; |
| 54 | 54 | // close open section div |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // close open collapsible toggle div |
| 61 | -if ( isset($frm_vars['collapse_div']) && $frm_vars['collapse_div'] ) { |
|
| 61 | +if ( isset( $frm_vars['collapse_div'] ) && $frm_vars['collapse_div'] ) { |
|
| 62 | 62 | echo "</div>\n"; |
| 63 | - unset($frm_vars['collapse_div']); |
|
| 63 | + unset( $frm_vars['collapse_div'] ); |
|
| 64 | 64 | } |
| 65 | 65 | |
| 66 | -echo FrmFormsHelper::replace_shortcodes($values['after_html'], $form); |
|
| 66 | +echo FrmFormsHelper::replace_shortcodes( $values['after_html'], $form ); |
|
| 67 | 67 | |
| 68 | 68 | if ( FrmForm::show_submit( $form ) ) { |
| 69 | 69 | |
@@ -76,6 +76,6 @@ discard block |
||
| 76 | 76 | </div> |
| 77 | 77 | </fieldset> |
| 78 | 78 | </div> |
| 79 | -<?php if ( has_action('frm_entries_footer_scripts') ) { ?> |
|
| 79 | +<?php if ( has_action( 'frm_entries_footer_scripts' ) ) { ?> |
|
| 80 | 80 | <script type="text/javascript"><?php do_action( 'frm_entries_footer_scripts', $values['fields'], $form ); ?></script> |
| 81 | 81 | <?php } ?> |
@@ -75,7 +75,6 @@ discard block |
||
| 75 | 75 | * @since 3.0 |
| 76 | 76 | * |
| 77 | 77 | * @param array $file_names And array of file paths |
| 78 | - * @param string $new_location The path for the file to be saved |
|
| 79 | 78 | */ |
| 80 | 79 | public function combine_files( $file_names ) { |
| 81 | 80 | if ( $this->has_permission ) { |
@@ -125,6 +124,9 @@ discard block |
||
| 125 | 124 | } |
| 126 | 125 | } |
| 127 | 126 | |
| 127 | + /** |
|
| 128 | + * @param boolean $dirs_exist |
|
| 129 | + */ |
|
| 128 | 130 | private function create_directories( &$dirs_exist ) { |
| 129 | 131 | global $wp_filesystem; |
| 130 | 132 | |
@@ -21,8 +21,8 @@ discard block |
||
| 21 | 21 | $this->error_message = isset( $atts['error_message'] ) ? $atts['error_message'] : ''; |
| 22 | 22 | $this->uploads = wp_upload_dir(); |
| 23 | 23 | $this->set_new_file_path( $atts ); |
| 24 | - $this->chmod_dir = defined('FS_CHMOD_DIR') ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 ); |
|
| 25 | - $this->chmod_file = defined('FS_CHMOD_FILE') ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ); |
|
| 24 | + $this->chmod_dir = defined( 'FS_CHMOD_DIR' ) ? FS_CHMOD_DIR : ( fileperms( ABSPATH ) & 0777 | 0755 ); |
|
| 25 | + $this->chmod_file = defined( 'FS_CHMOD_FILE' ) ? FS_CHMOD_FILE : ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ); |
|
| 26 | 26 | |
| 27 | 27 | $this->check_permission(); |
| 28 | 28 | } |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | private function get_creds() { |
| 157 | - if ( ! function_exists('get_filesystem_method') ) { |
|
| 157 | + if ( ! function_exists( 'get_filesystem_method' ) ) { |
|
| 158 | 158 | include_once( ABSPATH . 'wp-admin/includes/file.php' ); |
| 159 | 159 | } |
| 160 | 160 | |
@@ -173,13 +173,13 @@ discard block |
||
| 173 | 173 | 'username' => '', |
| 174 | 174 | ) ); |
| 175 | 175 | |
| 176 | - $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : $credentials['hostname']; |
|
| 177 | - $credentials['username'] = defined('FTP_USER') ? FTP_USER : $credentials['username']; |
|
| 178 | - $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : ''; |
|
| 176 | + $credentials['hostname'] = defined( 'FTP_HOST' ) ? FTP_HOST : $credentials['hostname']; |
|
| 177 | + $credentials['username'] = defined( 'FTP_USER' ) ? FTP_USER : $credentials['username']; |
|
| 178 | + $credentials['password'] = defined( 'FTP_PASS' ) ? FTP_PASS : ''; |
|
| 179 | 179 | |
| 180 | 180 | // Check to see if we are setting the public/private keys for ssh |
| 181 | - $credentials['public_key'] = defined('FTP_PUBKEY') ? FTP_PUBKEY : ''; |
|
| 182 | - $credentials['private_key'] = defined('FTP_PRIKEY') ? FTP_PRIKEY : ''; |
|
| 181 | + $credentials['public_key'] = defined( 'FTP_PUBKEY' ) ? FTP_PUBKEY : ''; |
|
| 182 | + $credentials['private_key'] = defined( 'FTP_PRIKEY' ) ? FTP_PRIKEY : ''; |
|
| 183 | 183 | |
| 184 | 184 | // Sanitize the hostname, Some people might pass in odd-data: |
| 185 | 185 | $credentials['hostname'] = preg_replace( '|\w+://|', '', $credentials['hostname'] ); //Strip any schemes off |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action('frm_field_input_html', $field) ?> /><?php |
|
| 40 | + ?><input type="checkbox" name="<?php echo esc_attr( $field_name ) ?>[<?php echo ( $other_opt ? esc_attr( $opt_key ) : '' ) ?>]" id="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php echo $checked ?> <?php do_action( 'frm_field_input_html', $field ) ?> /><?php |
|
| 41 | 41 | |
| 42 | 42 | if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) { |
| 43 | 43 | echo ' ' . $opt . '</label>'; |
@@ -18,14 +18,14 @@ |
||
| 18 | 18 | if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) { |
| 19 | 19 | ?><label for="<?php echo esc_attr( $html_id ) ?>-<?php echo esc_attr( $opt_key ) ?>"><?php |
| 20 | 20 | } |
| 21 | - $checked = FrmAppHelper::check_selected($field['value'], $field_val) ? 'checked="checked" ' : ' '; |
|
| 21 | + $checked = FrmAppHelper::check_selected( $field['value'], $field_val ) ? 'checked="checked" ' : ' '; |
|
| 22 | 22 | |
| 23 | 23 | $other_opt = false; |
| 24 | 24 | $other_args = FrmFieldsHelper::prepare_other_input( compact( 'field_name', 'opt_key', 'field' ), $other_opt, $checked ); |
| 25 | 25 | ?> |
| 26 | 26 | <input type="radio" name="<?php echo esc_attr( $field_name ) ?>" id="<?php echo esc_attr( $html_id . '-' . $opt_key ) ?>" value="<?php echo esc_attr( $field_val ) ?>" <?php |
| 27 | 27 | echo $checked; |
| 28 | - do_action('frm_field_input_html', $field); |
|
| 28 | + do_action( 'frm_field_input_html', $field ); |
|
| 29 | 29 | ?>/><?php |
| 30 | 30 | |
| 31 | 31 | if ( ! isset( $shortcode_atts ) || ! isset( $shortcode_atts['label'] ) || $shortcode_atts['label'] ) { |
@@ -86,7 +86,7 @@ |
||
| 86 | 86 | 'captcha' => 'FrmFieldCaptcha', |
| 87 | 87 | ); |
| 88 | 88 | |
| 89 | - $class = isset( $type_classes[ $field_type ] ) ? $type_classes[ $field_type ] : ''; |
|
| 89 | + $class = isset( $type_classes[$field_type] ) ? $type_classes[$field_type] : ''; |
|
| 90 | 90 | return apply_filters( 'frm_get_field_type_class', $class, $field_type ); |
| 91 | 91 | } |
| 92 | 92 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | * @since 3.0 |
| 56 | 56 | * |
| 57 | 57 | * @param string $field_type |
| 58 | - * @param int|array|object $field |
|
| 58 | + * @param integer $field |
|
| 59 | 59 | * |
| 60 | 60 | * @return stdClass |
| 61 | 61 | */ |
@@ -111,6 +111,7 @@ discard block |
||
| 111 | 111 | |
| 112 | 112 | /** |
| 113 | 113 | * @since 3.0 |
| 114 | + * @param string $property |
|
| 114 | 115 | */ |
| 115 | 116 | public static function field_has_property( $type, $property ) { |
| 116 | 117 | $field = self::get_field_type( $type ); |
@@ -38,7 +38,7 @@ |
||
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | protected function extra_field_opts() { |
| 41 | - $form_id = $this->get_field_column('form_id'); |
|
| 41 | + $form_id = $this->get_field_column( 'form_id' ); |
|
| 42 | 42 | return array( |
| 43 | 43 | 'align' => FrmStylesController::get_style_val( 'radio_align', ( empty( $form_id ) ? 'default' : $form_id ) ), |
| 44 | 44 | ); |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | protected function extra_field_opts() { |
| 50 | - $form_id = $this->get_field_column('form_id'); |
|
| 50 | + $form_id = $this->get_field_column( 'form_id' ); |
|
| 51 | 51 | return array( |
| 52 | 52 | 'align' => FrmStylesController::get_style_val( 'check_align', ( empty( $form_id ) ? 'default' : $form_id ) ), |
| 53 | 53 | ); |
@@ -246,6 +246,7 @@ |
||
| 246 | 246 | |
| 247 | 247 | /** |
| 248 | 248 | * @since 3.0 |
| 249 | + * @param stdClass $field_info |
|
| 249 | 250 | */ |
| 250 | 251 | private static function get_classes_for_builder_field( $field, $display, $field_info ) { |
| 251 | 252 | $li_classes = $field_info->form_builder_classes( $display['type'] ); |
@@ -2,25 +2,25 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | class FrmFieldsController { |
| 4 | 4 | |
| 5 | - public static function load_field() { |
|
| 5 | + public static function load_field() { |
|
| 6 | 6 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 7 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 7 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 8 | 8 | |
| 9 | - $fields = $_POST['field']; |
|
| 10 | - if ( empty( $fields ) ) { |
|
| 11 | - wp_die(); |
|
| 12 | - } |
|
| 9 | + $fields = $_POST['field']; |
|
| 10 | + if ( empty( $fields ) ) { |
|
| 11 | + wp_die(); |
|
| 12 | + } |
|
| 13 | 13 | |
| 14 | - $_GET['page'] = 'formidable'; |
|
| 15 | - $fields = stripslashes_deep( $fields ); |
|
| 14 | + $_GET['page'] = 'formidable'; |
|
| 15 | + $fields = stripslashes_deep( $fields ); |
|
| 16 | 16 | |
| 17 | 17 | $values = array( |
| 18 | 18 | 'id' => FrmAppHelper::get_post_param( 'form_id', '', 'absint' ), |
| 19 | 19 | 'doing_ajax' => true, |
| 20 | 20 | ); |
| 21 | - $field_html = array(); |
|
| 21 | + $field_html = array(); |
|
| 22 | 22 | |
| 23 | - foreach ( $fields as $field ) { |
|
| 23 | + foreach ( $fields as $field ) { |
|
| 24 | 24 | $field = htmlspecialchars_decode( nl2br( $field ) ); |
| 25 | 25 | $field = json_decode( $field ); |
| 26 | 26 | if ( ! isset( $field->id ) || ! is_numeric( $field->id ) ) { |
@@ -38,19 +38,19 @@ discard block |
||
| 38 | 38 | self::load_single_field( $field, $values ); |
| 39 | 39 | $field_html[ absint( $field->id ) ] = ob_get_contents(); |
| 40 | 40 | ob_end_clean(); |
| 41 | - } |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | echo json_encode( $field_html ); |
| 44 | 44 | |
| 45 | - wp_die(); |
|
| 46 | - } |
|
| 45 | + wp_die(); |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | 48 | /** |
| 49 | 49 | * Create a new field with ajax |
| 50 | 50 | */ |
| 51 | - public static function create() { |
|
| 51 | + public static function create() { |
|
| 52 | 52 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 53 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 53 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 54 | 54 | |
| 55 | 55 | $field_type = FrmAppHelper::get_post_param( 'field_type', '', 'sanitize_text_field' ); |
| 56 | 56 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
@@ -60,16 +60,16 @@ discard block |
||
| 60 | 60 | // this hook will allow for multiple fields to be added at once |
| 61 | 61 | do_action( 'frm_after_field_created', $field, $form_id ); |
| 62 | 62 | |
| 63 | - wp_die(); |
|
| 64 | - } |
|
| 63 | + wp_die(); |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - /** |
|
| 67 | - * Set up and create a new field |
|
| 68 | - * |
|
| 69 | - * @param string $field_type |
|
| 70 | - * @param integer $form_id |
|
| 71 | - * @return array|bool |
|
| 72 | - */ |
|
| 66 | + /** |
|
| 67 | + * Set up and create a new field |
|
| 68 | + * |
|
| 69 | + * @param string $field_type |
|
| 70 | + * @param integer $form_id |
|
| 71 | + * @return array|bool |
|
| 72 | + */ |
|
| 73 | 73 | public static function include_new_field( $field_type, $form_id ) { |
| 74 | 74 | $values = array(); |
| 75 | 75 | if ( FrmAppHelper::pro_is_installed() ) { |
@@ -77,19 +77,19 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | $field_values = FrmFieldsHelper::setup_new_vars( $field_type, $form_id ); |
| 80 | - $field_values = apply_filters( 'frm_before_field_created', $field_values ); |
|
| 80 | + $field_values = apply_filters( 'frm_before_field_created', $field_values ); |
|
| 81 | 81 | |
| 82 | - $field_id = FrmField::create( $field_values ); |
|
| 82 | + $field_id = FrmField::create( $field_values ); |
|
| 83 | 83 | |
| 84 | - if ( ! $field_id ) { |
|
| 85 | - return false; |
|
| 86 | - } |
|
| 84 | + if ( ! $field_id ) { |
|
| 85 | + return false; |
|
| 86 | + } |
|
| 87 | 87 | |
| 88 | 88 | $field = self::get_field_array_from_id( $field_id ); |
| 89 | 89 | self::load_single_field( $field, $values, $form_id ); |
| 90 | 90 | |
| 91 | - return $field; |
|
| 92 | - } |
|
| 91 | + return $field; |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | 94 | public static function edit_name( $field = 'name', $id = '' ) { |
| 95 | 95 | _deprecated_function( __FUNCTION__, '3.0' ); |
@@ -101,29 +101,29 @@ discard block |
||
| 101 | 101 | $field = 'name'; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | - if ( empty( $id ) ) { |
|
| 104 | + if ( empty( $id ) ) { |
|
| 105 | 105 | $id = FrmAppHelper::get_post_param( 'element_id', '', 'sanitize_title' ); |
| 106 | 106 | $id = str_replace( 'field_label_', '', $id ); |
| 107 | - } |
|
| 107 | + } |
|
| 108 | 108 | |
| 109 | 109 | $value = FrmAppHelper::get_post_param( 'update_value', '', 'wp_kses_post' ); |
| 110 | 110 | $value = trim( $value ); |
| 111 | - if ( trim( strip_tags( $value ) ) === '' ) { |
|
| 112 | - // set blank value if there is no content |
|
| 113 | - $value = ''; |
|
| 114 | - } |
|
| 111 | + if ( trim( strip_tags( $value ) ) === '' ) { |
|
| 112 | + // set blank value if there is no content |
|
| 113 | + $value = ''; |
|
| 114 | + } |
|
| 115 | 115 | |
| 116 | 116 | FrmField::update( $id, array( $field => $value ) ); |
| 117 | 117 | |
| 118 | 118 | do_action( 'frm_after_update_field_' . $field, compact( 'id', 'value' ) ); |
| 119 | 119 | |
| 120 | 120 | echo stripslashes( wp_kses_post( $value ) ); |
| 121 | - wp_die(); |
|
| 122 | - } |
|
| 121 | + wp_die(); |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - public static function update_ajax_option() { |
|
| 124 | + public static function update_ajax_option() { |
|
| 125 | 125 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 126 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 126 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 127 | 127 | |
| 128 | 128 | $field_id = FrmAppHelper::get_post_param( 'field', 0, 'absint' ); |
| 129 | 129 | if ( ! $field_id ) { |
@@ -138,24 +138,24 @@ discard block |
||
| 138 | 138 | unset( $new_val ); |
| 139 | 139 | } |
| 140 | 140 | |
| 141 | - FrmField::update( $field_id, array( |
|
| 142 | - 'field_options' => $field->field_options, |
|
| 141 | + FrmField::update( $field_id, array( |
|
| 142 | + 'field_options' => $field->field_options, |
|
| 143 | 143 | 'form_id' => $field->form_id, |
| 144 | - ) ); |
|
| 145 | - wp_die(); |
|
| 146 | - } |
|
| 144 | + ) ); |
|
| 145 | + wp_die(); |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - public static function duplicate() { |
|
| 148 | + public static function duplicate() { |
|
| 149 | 149 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 150 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 150 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 151 | 151 | |
| 152 | 152 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 153 | 153 | $form_id = FrmAppHelper::get_post_param( 'form_id', 0, 'absint' ); |
| 154 | 154 | |
| 155 | 155 | $copy_field = FrmField::getOne( $field_id ); |
| 156 | - if ( ! $copy_field ) { |
|
| 157 | - wp_die(); |
|
| 158 | - } |
|
| 156 | + if ( ! $copy_field ) { |
|
| 157 | + wp_die(); |
|
| 158 | + } |
|
| 159 | 159 | |
| 160 | 160 | do_action( 'frm_duplicate_field', $copy_field, $form_id ); |
| 161 | 161 | do_action( 'frm_duplicate_field_' . $copy_field->type, $copy_field, $form_id ); |
@@ -169,8 +169,8 @@ discard block |
||
| 169 | 169 | self::load_single_field( $field_id, $values ); |
| 170 | 170 | } |
| 171 | 171 | |
| 172 | - wp_die(); |
|
| 173 | - } |
|
| 172 | + wp_die(); |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | 175 | /** |
| 176 | 176 | * Load a single field in the form builder along with all needed variables |
@@ -255,21 +255,21 @@ discard block |
||
| 255 | 255 | return $li_classes; |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - public static function destroy() { |
|
| 258 | + public static function destroy() { |
|
| 259 | 259 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 260 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 260 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 261 | 261 | |
| 262 | 262 | $field_id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 263 | 263 | FrmField::destroy( $field_id ); |
| 264 | - wp_die(); |
|
| 265 | - } |
|
| 264 | + wp_die(); |
|
| 265 | + } |
|
| 266 | 266 | |
| 267 | - /* Field Options */ |
|
| 267 | + /* Field Options */ |
|
| 268 | 268 | |
| 269 | - //Add Single Option or Other Option |
|
| 270 | - public static function add_option() { |
|
| 269 | + //Add Single Option or Other Option |
|
| 270 | + public static function add_option() { |
|
| 271 | 271 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 272 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 272 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 273 | 273 | |
| 274 | 274 | $id = FrmAppHelper::get_post_param( 'field_id', 0, 'absint' ); |
| 275 | 275 | $opt_type = FrmAppHelper::get_post_param( 'opt_type', '', 'sanitize_text_field' ); |
@@ -294,61 +294,61 @@ discard block |
||
| 294 | 294 | FrmFieldsHelper::show_single_option( $field ); |
| 295 | 295 | |
| 296 | 296 | wp_die(); |
| 297 | - } |
|
| 297 | + } |
|
| 298 | 298 | |
| 299 | - public static function edit_option() { |
|
| 299 | + public static function edit_option() { |
|
| 300 | 300 | _deprecated_function( __FUNCTION__, '2.3' ); |
| 301 | - } |
|
| 301 | + } |
|
| 302 | 302 | |
| 303 | - public static function delete_option() { |
|
| 303 | + public static function delete_option() { |
|
| 304 | 304 | _deprecated_function( __FUNCTION__, '2.3' ); |
| 305 | - } |
|
| 305 | + } |
|
| 306 | 306 | |
| 307 | - public static function import_choices() { |
|
| 308 | - FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
| 307 | + public static function import_choices() { |
|
| 308 | + FrmAppHelper::permission_check( 'frm_edit_forms', 'hide' ); |
|
| 309 | 309 | |
| 310 | 310 | $field_id = absint( $_REQUEST['field_id'] ); |
| 311 | 311 | |
| 312 | - global $current_screen, $hook_suffix; |
|
| 312 | + global $current_screen, $hook_suffix; |
|
| 313 | 313 | |
| 314 | - // Catch plugins that include admin-header.php before admin.php completes. |
|
| 315 | - if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) { |
|
| 316 | - $hook_suffix = ''; |
|
| 317 | - set_current_screen(); |
|
| 318 | - } |
|
| 314 | + // Catch plugins that include admin-header.php before admin.php completes. |
|
| 315 | + if ( empty( $current_screen ) && function_exists( 'set_current_screen' ) ) { |
|
| 316 | + $hook_suffix = ''; |
|
| 317 | + set_current_screen(); |
|
| 318 | + } |
|
| 319 | 319 | |
| 320 | - if ( function_exists( 'register_admin_color_schemes' ) ) { |
|
| 321 | - register_admin_color_schemes(); |
|
| 322 | - } |
|
| 320 | + if ( function_exists( 'register_admin_color_schemes' ) ) { |
|
| 321 | + register_admin_color_schemes(); |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | 324 | $hook_suffix = ''; |
| 325 | 325 | $admin_body_class = ''; |
| 326 | 326 | |
| 327 | - if ( get_user_setting( 'mfold' ) == 'f' ) { |
|
| 328 | - $admin_body_class .= ' folded'; |
|
| 329 | - } |
|
| 327 | + if ( get_user_setting( 'mfold' ) == 'f' ) { |
|
| 328 | + $admin_body_class .= ' folded'; |
|
| 329 | + } |
|
| 330 | 330 | |
| 331 | - if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) { |
|
| 332 | - $admin_body_class .= ' admin-bar'; |
|
| 333 | - } |
|
| 331 | + if ( function_exists( 'is_admin_bar_showing' ) && is_admin_bar_showing() ) { |
|
| 332 | + $admin_body_class .= ' admin-bar'; |
|
| 333 | + } |
|
| 334 | 334 | |
| 335 | - if ( is_rtl() ) { |
|
| 336 | - $admin_body_class .= ' rtl'; |
|
| 337 | - } |
|
| 335 | + if ( is_rtl() ) { |
|
| 336 | + $admin_body_class .= ' rtl'; |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | - $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
|
| 340 | - $prepop = array(); |
|
| 339 | + $admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' ); |
|
| 340 | + $prepop = array(); |
|
| 341 | 341 | FrmFieldsHelper::get_bulk_prefilled_opts( $prepop ); |
| 342 | 342 | |
| 343 | 343 | $field = FrmField::getOne( $field_id ); |
| 344 | 344 | |
| 345 | - wp_enqueue_script( 'utils' ); |
|
| 345 | + wp_enqueue_script( 'utils' ); |
|
| 346 | 346 | wp_enqueue_style( 'formidable-admin', FrmAppHelper::plugin_url() . '/css/frm_admin.css' ); |
| 347 | - FrmAppHelper::load_admin_wide_js(); |
|
| 347 | + FrmAppHelper::load_admin_wide_js(); |
|
| 348 | 348 | |
| 349 | 349 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/import_choices.php' ); |
| 350 | - wp_die(); |
|
| 351 | - } |
|
| 350 | + wp_die(); |
|
| 351 | + } |
|
| 352 | 352 | |
| 353 | 353 | public static function import_options() { |
| 354 | 354 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
@@ -362,8 +362,8 @@ discard block |
||
| 362 | 362 | $field = FrmField::getOne( $field_id ); |
| 363 | 363 | |
| 364 | 364 | if ( ! in_array( $field->type, array( 'radio', 'checkbox', 'select' ) ) ) { |
| 365 | - return; |
|
| 366 | - } |
|
| 365 | + return; |
|
| 366 | + } |
|
| 367 | 367 | |
| 368 | 368 | $field = FrmFieldsHelper::setup_edit_vars( $field ); |
| 369 | 369 | $opts = FrmAppHelper::get_param( 'opts', '', 'post', 'wp_kses_post' ); |
@@ -386,10 +386,10 @@ discard block |
||
| 386 | 386 | } |
| 387 | 387 | } |
| 388 | 388 | |
| 389 | - //Keep other options after bulk update |
|
| 390 | - if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) { |
|
| 391 | - $other_array = array(); |
|
| 392 | - foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 389 | + //Keep other options after bulk update |
|
| 390 | + if ( isset( $field['field_options']['other'] ) && $field['field_options']['other'] == true ) { |
|
| 391 | + $other_array = array(); |
|
| 392 | + foreach ( $field['options'] as $opt_key => $opt ) { |
|
| 393 | 393 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 394 | 394 | $other_array[ $opt_key ] = $opt; |
| 395 | 395 | } |
@@ -400,36 +400,36 @@ discard block |
||
| 400 | 400 | } |
| 401 | 401 | } |
| 402 | 402 | |
| 403 | - $field['options'] = $opts; |
|
| 403 | + $field['options'] = $opts; |
|
| 404 | 404 | |
| 405 | 405 | FrmFieldsHelper::show_single_option( $field ); |
| 406 | 406 | |
| 407 | - wp_die(); |
|
| 408 | - } |
|
| 407 | + wp_die(); |
|
| 408 | + } |
|
| 409 | 409 | |
| 410 | - public static function update_order() { |
|
| 410 | + public static function update_order() { |
|
| 411 | 411 | FrmAppHelper::permission_check( 'frm_edit_forms' ); |
| 412 | - check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 412 | + check_ajax_referer( 'frm_ajax', 'nonce' ); |
|
| 413 | 413 | |
| 414 | 414 | $fields = FrmAppHelper::get_post_param( 'frm_field_id' ); |
| 415 | 415 | foreach ( (array) $fields as $position => $item ) { |
| 416 | 416 | FrmField::update( absint( $item ), array( 'field_order' => absint( $position ) ) ); |
| 417 | 417 | } |
| 418 | - wp_die(); |
|
| 419 | - } |
|
| 418 | + wp_die(); |
|
| 419 | + } |
|
| 420 | 420 | |
| 421 | 421 | public static function change_type( $type ) { |
| 422 | - $type_switch = array( |
|
| 423 | - 'scale' => 'radio', |
|
| 422 | + $type_switch = array( |
|
| 423 | + 'scale' => 'radio', |
|
| 424 | 424 | 'star' => 'radio', |
| 425 | - '10radio' => 'radio', |
|
| 426 | - 'rte' => 'textarea', |
|
| 427 | - 'website' => 'url', |
|
| 425 | + '10radio' => 'radio', |
|
| 426 | + 'rte' => 'textarea', |
|
| 427 | + 'website' => 'url', |
|
| 428 | 428 | 'image' => 'url', |
| 429 | - ); |
|
| 430 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 431 | - $type = $type_switch[ $type ]; |
|
| 432 | - } |
|
| 429 | + ); |
|
| 430 | + if ( isset( $type_switch[ $type ] ) ) { |
|
| 431 | + $type = $type_switch[ $type ]; |
|
| 432 | + } |
|
| 433 | 433 | |
| 434 | 434 | $pro_fields = FrmField::pro_field_selection(); |
| 435 | 435 | $types = array_keys( $pro_fields ); |
@@ -437,8 +437,8 @@ discard block |
||
| 437 | 437 | $type = 'text'; |
| 438 | 438 | } |
| 439 | 439 | |
| 440 | - return $type; |
|
| 441 | - } |
|
| 440 | + return $type; |
|
| 441 | + } |
|
| 442 | 442 | |
| 443 | 443 | /** |
| 444 | 444 | * @param array $settings |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | return apply_filters( 'frm_display_field_options', $settings ); |
| 456 | - } |
|
| 456 | + } |
|
| 457 | 457 | |
| 458 | 458 | /** |
| 459 | 459 | * Display the format option |
@@ -465,8 +465,8 @@ discard block |
||
| 465 | 465 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/value-format.php' ); |
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - public static function input_html( $field, $echo = true ) { |
|
| 469 | - $class = array(); //$field['type']; |
|
| 468 | + public static function input_html( $field, $echo = true ) { |
|
| 469 | + $class = array(); //$field['type']; |
|
| 470 | 470 | self::add_input_classes( $field, $class ); |
| 471 | 471 | |
| 472 | 472 | $add_html = array(); |
@@ -485,85 +485,85 @@ discard block |
||
| 485 | 485 | $add_html = apply_filters( 'frm_field_extra_html', $add_html, $field ); |
| 486 | 486 | $add_html = ' ' . implode( ' ', $add_html ) . ' '; |
| 487 | 487 | |
| 488 | - if ( $echo ) { |
|
| 489 | - echo $add_html; |
|
| 490 | - } |
|
| 488 | + if ( $echo ) { |
|
| 489 | + echo $add_html; |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | - return $add_html; |
|
| 493 | - } |
|
| 492 | + return $add_html; |
|
| 493 | + } |
|
| 494 | 494 | |
| 495 | 495 | private static function add_input_classes( $field, array &$class ) { |
| 496 | 496 | if ( isset( $field['input_class'] ) && ! empty( $field['input_class'] ) ) { |
| 497 | 497 | $class[] = $field['input_class']; |
| 498 | 498 | } |
| 499 | 499 | |
| 500 | - if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) { |
|
| 501 | - return; |
|
| 502 | - } |
|
| 500 | + if ( $field['type'] == 'hidden' || $field['type'] == 'user_id' ) { |
|
| 501 | + return; |
|
| 502 | + } |
|
| 503 | 503 | |
| 504 | 504 | if ( isset( $field['size'] ) && $field['size'] > 0 ) { |
| 505 | 505 | $class[] = 'auto_width'; |
| 506 | 506 | } |
| 507 | - } |
|
| 507 | + } |
|
| 508 | 508 | |
| 509 | 509 | private static function add_html_size( $field, array &$add_html ) { |
| 510 | 510 | if ( ! isset( $field['size'] ) || $field['size'] <= 0 || in_array( $field['type'], array( 'select', 'data', 'time', 'hidden', 'file', 'lookup' ) ) ) { |
| 511 | - return; |
|
| 512 | - } |
|
| 511 | + return; |
|
| 512 | + } |
|
| 513 | 513 | |
| 514 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 515 | - return; |
|
| 516 | - } |
|
| 514 | + if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 515 | + return; |
|
| 516 | + } |
|
| 517 | 517 | |
| 518 | 518 | if ( is_numeric( $field['size'] ) ) { |
| 519 | 519 | $field['size'] .= 'px'; |
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | $important = apply_filters( 'frm_use_important_width', 1, $field ); |
| 523 | - // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
|
| 523 | + // Note: This inline styling must stay since we cannot realistically set a class for every possible field size |
|
| 524 | 524 | $add_html['style'] = 'style="width:' . esc_attr( $field['size'] ) . ( $important ? ' !important' : '' ) . '"'; |
| 525 | 525 | |
| 526 | 526 | self::add_html_cols( $field, $add_html ); |
| 527 | - } |
|
| 527 | + } |
|
| 528 | 528 | |
| 529 | 529 | private static function add_html_cols( $field, array &$add_html ) { |
| 530 | 530 | if ( ! in_array( $field['type'], array( 'textarea', 'rte' ) ) ) { |
| 531 | - return; |
|
| 532 | - } |
|
| 531 | + return; |
|
| 532 | + } |
|
| 533 | 533 | |
| 534 | - // convert to cols for textareas |
|
| 535 | - $calc = array( |
|
| 536 | - '' => 9, |
|
| 537 | - 'px' => 9, |
|
| 538 | - 'rem' => 0.444, |
|
| 539 | - 'em' => 0.544, |
|
| 540 | - ); |
|
| 534 | + // convert to cols for textareas |
|
| 535 | + $calc = array( |
|
| 536 | + '' => 9, |
|
| 537 | + 'px' => 9, |
|
| 538 | + 'rem' => 0.444, |
|
| 539 | + 'em' => 0.544, |
|
| 540 | + ); |
|
| 541 | 541 | |
| 542 | 542 | // include "col" for valid html |
| 543 | 543 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
| 544 | 544 | |
| 545 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 546 | - return; |
|
| 547 | - } |
|
| 545 | + if ( ! isset( $calc[ $unit ] ) ) { |
|
| 546 | + return; |
|
| 547 | + } |
|
| 548 | 548 | |
| 549 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 549 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 550 | 550 | |
| 551 | 551 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 552 | - } |
|
| 552 | + } |
|
| 553 | 553 | |
| 554 | 554 | private static function add_html_length( $field, array &$add_html ) { |
| 555 | - // check for max setting and if this field accepts maxlength |
|
| 555 | + // check for max setting and if this field accepts maxlength |
|
| 556 | 556 | if ( FrmField::is_option_empty( $field, 'max' ) || in_array( $field['type'], array( 'textarea', 'rte', 'hidden', 'file' ) ) ) { |
| 557 | - return; |
|
| 558 | - } |
|
| 557 | + return; |
|
| 558 | + } |
|
| 559 | 559 | |
| 560 | 560 | if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
| 561 | - // don't load on form builder page |
|
| 562 | - return; |
|
| 563 | - } |
|
| 561 | + // don't load on form builder page |
|
| 562 | + return; |
|
| 563 | + } |
|
| 564 | 564 | |
| 565 | 565 | $add_html['maxlength'] = 'maxlength="' . esc_attr( $field['max'] ) . '"'; |
| 566 | - } |
|
| 566 | + } |
|
| 567 | 567 | |
| 568 | 568 | private static function add_html_placeholder( $field, array &$add_html, array &$class ) { |
| 569 | 569 | if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
@@ -665,27 +665,27 @@ discard block |
||
| 665 | 665 | } |
| 666 | 666 | } |
| 667 | 667 | |
| 668 | - private static function add_shortcodes_to_html( $field, array &$add_html ) { |
|
| 669 | - if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) { |
|
| 670 | - return; |
|
| 671 | - } |
|
| 668 | + private static function add_shortcodes_to_html( $field, array &$add_html ) { |
|
| 669 | + if ( FrmField::is_option_empty( $field, 'shortcodes' ) ) { |
|
| 670 | + return; |
|
| 671 | + } |
|
| 672 | 672 | |
| 673 | - foreach ( $field['shortcodes'] as $k => $v ) { |
|
| 674 | - if ( 'opt' === $k ) { |
|
| 675 | - continue; |
|
| 676 | - } |
|
| 673 | + foreach ( $field['shortcodes'] as $k => $v ) { |
|
| 674 | + if ( 'opt' === $k ) { |
|
| 675 | + continue; |
|
| 676 | + } |
|
| 677 | 677 | |
| 678 | 678 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
| 679 | - $add_html[] = $v; |
|
| 680 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 679 | + $add_html[] = $v; |
|
| 680 | + } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 681 | 681 | $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
| 682 | - } else { |
|
| 682 | + } else { |
|
| 683 | 683 | $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
| 684 | - } |
|
| 684 | + } |
|
| 685 | 685 | |
| 686 | 686 | unset( $k, $v ); |
| 687 | - } |
|
| 688 | - } |
|
| 687 | + } |
|
| 688 | + } |
|
| 689 | 689 | |
| 690 | 690 | /** |
| 691 | 691 | * Add pattern attribute |
@@ -709,16 +709,16 @@ discard block |
||
| 709 | 709 | } |
| 710 | 710 | } |
| 711 | 711 | |
| 712 | - public static function check_value( $opt, $opt_key, $field ) { |
|
| 713 | - if ( is_array( $opt ) ) { |
|
| 714 | - if ( FrmField::is_option_true( $field, 'separate_value' ) ) { |
|
| 715 | - $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
| 716 | - } else { |
|
| 717 | - $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
| 718 | - } |
|
| 719 | - } |
|
| 720 | - return $opt; |
|
| 721 | - } |
|
| 712 | + public static function check_value( $opt, $opt_key, $field ) { |
|
| 713 | + if ( is_array( $opt ) ) { |
|
| 714 | + if ( FrmField::is_option_true( $field, 'separate_value' ) ) { |
|
| 715 | + $opt = isset( $opt['value'] ) ? $opt['value'] : ( isset( $opt['label'] ) ? $opt['label'] : reset( $opt ) ); |
|
| 716 | + } else { |
|
| 717 | + $opt = isset( $opt['label'] ) ? $opt['label'] : reset( $opt ); |
|
| 718 | + } |
|
| 719 | + } |
|
| 720 | + return $opt; |
|
| 721 | + } |
|
| 722 | 722 | |
| 723 | 723 | public static function check_label( $opt ) { |
| 724 | 724 | if ( is_array( $opt ) ) { |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | |
| 37 | 37 | ob_start(); |
| 38 | 38 | self::load_single_field( $field, $values ); |
| 39 | - $field_html[ absint( $field->id ) ] = ob_get_contents(); |
|
| 39 | + $field_html[absint( $field->id )] = ob_get_contents(); |
|
| 40 | 40 | ob_end_clean(); |
| 41 | 41 | } |
| 42 | 42 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | if ( strpos( $opt, '|' ) !== false ) { |
| 376 | 376 | $vals = explode( '|', $opt ); |
| 377 | 377 | if ( $vals[0] != $vals[1] ) { |
| 378 | - $opts[ $opt_key ] = array( |
|
| 378 | + $opts[$opt_key] = array( |
|
| 379 | 379 | 'label' => trim( $vals[0] ), |
| 380 | 380 | 'value' => trim( $vals[1] ), |
| 381 | 381 | ); |
@@ -391,7 +391,7 @@ discard block |
||
| 391 | 391 | $other_array = array(); |
| 392 | 392 | foreach ( $field['options'] as $opt_key => $opt ) { |
| 393 | 393 | if ( FrmFieldsHelper::is_other_opt( $opt_key ) ) { |
| 394 | - $other_array[ $opt_key ] = $opt; |
|
| 394 | + $other_array[$opt_key] = $opt; |
|
| 395 | 395 | } |
| 396 | 396 | unset( $opt_key, $opt ); |
| 397 | 397 | } |
@@ -427,8 +427,8 @@ discard block |
||
| 427 | 427 | 'website' => 'url', |
| 428 | 428 | 'image' => 'url', |
| 429 | 429 | ); |
| 430 | - if ( isset( $type_switch[ $type ] ) ) { |
|
| 431 | - $type = $type_switch[ $type ]; |
|
| 430 | + if ( isset( $type_switch[$type] ) ) { |
|
| 431 | + $type = $type_switch[$type]; |
|
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | $pro_fields = FrmField::pro_field_selection(); |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | return; |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | - if ( FrmAppHelper::is_admin_page('formidable' ) ) { |
|
| 514 | + if ( FrmAppHelper::is_admin_page( 'formidable' ) ) { |
|
| 515 | 515 | return; |
| 516 | 516 | } |
| 517 | 517 | |
@@ -542,11 +542,11 @@ discard block |
||
| 542 | 542 | // include "col" for valid html |
| 543 | 543 | $unit = trim( preg_replace( '/[0-9]+/', '', $field['size'] ) ); |
| 544 | 544 | |
| 545 | - if ( ! isset( $calc[ $unit ] ) ) { |
|
| 545 | + if ( ! isset( $calc[$unit] ) ) { |
|
| 546 | 546 | return; |
| 547 | 547 | } |
| 548 | 548 | |
| 549 | - $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[ $unit ]; |
|
| 549 | + $size = (float) str_replace( $unit, '', $field['size'] ) / $calc[$unit]; |
|
| 550 | 550 | |
| 551 | 551 | $add_html['cols'] = 'cols="' . absint( $size ) . '"'; |
| 552 | 552 | } |
@@ -677,10 +677,10 @@ discard block |
||
| 677 | 677 | |
| 678 | 678 | if ( is_numeric( $k ) && strpos( $v, '=' ) ) { |
| 679 | 679 | $add_html[] = $v; |
| 680 | - } else if ( ! empty( $k ) && isset( $add_html[ $k ] ) ) { |
|
| 681 | - $add_html[ $k ] = str_replace( $k . '="', $k . '="' . $v, $add_html[ $k ] ); |
|
| 680 | + } else if ( ! empty( $k ) && isset( $add_html[$k] ) ) { |
|
| 681 | + $add_html[$k] = str_replace( $k . '="', $k . '="' . $v, $add_html[$k] ); |
|
| 682 | 682 | } else { |
| 683 | - $add_html[ $k ] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 683 | + $add_html[$k] = $k . '="' . esc_attr( $v ) . '"'; |
|
| 684 | 684 | } |
| 685 | 685 | |
| 686 | 686 | unset( $k, $v ); |