@@ -125,7 +125,8 @@ |
||
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | // Only do this for single site installs. |
| 128 | - if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { // WPCS: CSRF ok. |
|
| 128 | + if ( isset( $_GET['activate-multi'] ) || is_network_admin() ) { |
|
| 129 | +// WPCS: CSRF ok. |
|
| 129 | 130 | return; |
| 130 | 131 | } |
| 131 | 132 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | return; |
| 85 | 85 | } |
| 86 | 86 | |
| 87 | - if ( isset( $this->messages[ $message['key'] ] ) && ! isset( $message['force'] ) ) { |
|
| 87 | + if ( isset( $this->messages[$message['key']] ) && ! isset( $message['force'] ) ) { |
|
| 88 | 88 | // Don't replace messages unless required. |
| 89 | 89 | return; |
| 90 | 90 | } |
@@ -93,13 +93,13 @@ discard block |
||
| 93 | 93 | return; |
| 94 | 94 | } |
| 95 | 95 | |
| 96 | - if ( isset( $this->messages[ $message['key'] ] ) ) { |
|
| 96 | + if ( isset( $this->messages[$message['key']] ) ) { |
|
| 97 | 97 | // Move up and mark as new. |
| 98 | - unset( $this->messages[ $message['key'] ] ); |
|
| 98 | + unset( $this->messages[$message['key']] ); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | $this->fill_message( $message ); |
| 102 | - $this->messages[ $message['key'] ] = $message; |
|
| 102 | + $this->messages[$message['key']] = $message; |
|
| 103 | 103 | |
| 104 | 104 | $this->update_list(); |
| 105 | 105 | |
@@ -127,11 +127,11 @@ discard block |
||
| 127 | 127 | private function clean_messages() { |
| 128 | 128 | $removed = false; |
| 129 | 129 | foreach ( $this->messages as $t => $message ) { |
| 130 | - $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][ get_current_user_id() ] ) && $message['read'][ get_current_user_id() ] < strtotime( '-1 month' ); |
|
| 131 | - $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][ get_current_user_id() ] ) && $message['dismissed'][ get_current_user_id() ] < strtotime( '-1 week' ); |
|
| 130 | + $read = isset( $message['read'] ) && ! empty( $message['read'] ) && isset( $message['read'][get_current_user_id()] ) && $message['read'][get_current_user_id()] < strtotime( '-1 month' ); |
|
| 131 | + $dismissed = isset( $message['dismissed'] ) && ! empty( $message['dismissed'] ) && isset( $message['dismissed'][get_current_user_id()] ) && $message['dismissed'][get_current_user_id()] < strtotime( '-1 week' ); |
|
| 132 | 132 | $expired = $this->is_expired( $message ); |
| 133 | 133 | if ( $read || $expired || $dismissed ) { |
| 134 | - unset( $this->messages[ $t ] ); |
|
| 134 | + unset( $this->messages[$t] ); |
|
| 135 | 135 | $removed = true; |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | private function filter_messages( &$messages ) { |
| 145 | 145 | $user_id = get_current_user_id(); |
| 146 | 146 | foreach ( $messages as $k => $message ) { |
| 147 | - $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][ $user_id ] ); |
|
| 147 | + $dismissed = isset( $message['dismissed'] ) && isset( $message['dismissed'][$user_id] ); |
|
| 148 | 148 | if ( empty( $k ) || $this->is_expired( $message ) || $dismissed ) { |
| 149 | - unset( $messages[ $k ] ); |
|
| 149 | + unset( $messages[$k] ); |
|
| 150 | 150 | } elseif ( ! $this->is_for_user( $message ) ) { |
| 151 | - unset( $messages[ $k ] ); |
|
| 151 | + unset( $messages[$k] ); |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | $messages = apply_filters( 'frm_filter_inbox', $messages ); |
@@ -181,14 +181,14 @@ discard block |
||
| 181 | 181 | * @param string $key |
| 182 | 182 | */ |
| 183 | 183 | public function mark_read( $key ) { |
| 184 | - if ( ! $key || ! isset( $this->messages[ $key ] ) ) { |
|
| 184 | + if ( ! $key || ! isset( $this->messages[$key] ) ) { |
|
| 185 | 185 | return; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - if ( ! isset( $this->messages[ $key ]['read'] ) ) { |
|
| 189 | - $this->messages[ $key ]['read'] = array(); |
|
| 188 | + if ( ! isset( $this->messages[$key]['read'] ) ) { |
|
| 189 | + $this->messages[$key]['read'] = array(); |
|
| 190 | 190 | } |
| 191 | - $this->messages[ $key ]['read'][ get_current_user_id() ] = time(); |
|
| 191 | + $this->messages[$key]['read'][get_current_user_id()] = time(); |
|
| 192 | 192 | |
| 193 | 193 | $this->update_list(); |
| 194 | 194 | } |
@@ -199,9 +199,9 @@ discard block |
||
| 199 | 199 | * @since 4.05.02 |
| 200 | 200 | */ |
| 201 | 201 | public function mark_unread( $key ) { |
| 202 | - $is_read = isset( $this->messages[ $key ] ) && isset( $this->messages[ $key ]['read'] ) && isset( $this->messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 202 | + $is_read = isset( $this->messages[$key] ) && isset( $this->messages[$key]['read'] ) && isset( $this->messages[$key]['read'][get_current_user_id()] ); |
|
| 203 | 203 | if ( $is_read ) { |
| 204 | - unset( $this->messages[ $key ]['read'][ get_current_user_id() ] ); |
|
| 204 | + unset( $this->messages[$key]['read'][get_current_user_id()] ); |
|
| 205 | 205 | $this->update_list(); |
| 206 | 206 | } |
| 207 | 207 | } |
@@ -215,14 +215,14 @@ discard block |
||
| 215 | 215 | return; |
| 216 | 216 | } |
| 217 | 217 | |
| 218 | - if ( ! isset( $this->messages[ $key ] ) ) { |
|
| 218 | + if ( ! isset( $this->messages[$key] ) ) { |
|
| 219 | 219 | return; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - if ( ! isset( $this->messages[ $key ]['dismissed'] ) ) { |
|
| 223 | - $this->messages[ $key ]['dismissed'] = array(); |
|
| 222 | + if ( ! isset( $this->messages[$key]['dismissed'] ) ) { |
|
| 223 | + $this->messages[$key]['dismissed'] = array(); |
|
| 224 | 224 | } |
| 225 | - $this->messages[ $key ]['dismissed'][ get_current_user_id() ] = time(); |
|
| 225 | + $this->messages[$key]['dismissed'][get_current_user_id()] = time(); |
|
| 226 | 226 | |
| 227 | 227 | $this->update_list(); |
| 228 | 228 | } |
@@ -234,11 +234,11 @@ discard block |
||
| 234 | 234 | $user_id = get_current_user_id(); |
| 235 | 235 | foreach ( $this->messages as $key => $message ) { |
| 236 | 236 | if ( ! isset( $message['dismissed'] ) ) { |
| 237 | - $this->messages[ $key ]['dismissed'] = array(); |
|
| 237 | + $this->messages[$key]['dismissed'] = array(); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | - if ( ! isset( $message['dismissed'][ $user_id ] ) ) { |
|
| 241 | - $this->messages[ $key ]['dismissed'][ $user_id ] = time(); |
|
| 240 | + if ( ! isset( $message['dismissed'][$user_id] ) ) { |
|
| 241 | + $this->messages[$key]['dismissed'][$user_id] = time(); |
|
| 242 | 242 | } |
| 243 | 243 | } |
| 244 | 244 | $this->update_list(); |
@@ -248,8 +248,8 @@ discard block |
||
| 248 | 248 | $messages = $this->get_messages( 'filter' ); |
| 249 | 249 | $user_id = get_current_user_id(); |
| 250 | 250 | foreach ( $messages as $t => $message ) { |
| 251 | - if ( isset( $message['read'] ) && isset( $message['read'][ $user_id ] ) ) { |
|
| 252 | - unset( $messages[ $t ] ); |
|
| 251 | + if ( isset( $message['read'] ) && isset( $message['read'][$user_id] ) ) { |
|
| 252 | + unset( $messages[$t] ); |
|
| 253 | 253 | } |
| 254 | 254 | } |
| 255 | 255 | return $messages; |
@@ -273,8 +273,8 @@ discard block |
||
| 273 | 273 | * @since 4.05.02 |
| 274 | 274 | */ |
| 275 | 275 | public function remove( $key ) { |
| 276 | - if ( isset( $this->messages[ $key ] ) ) { |
|
| 277 | - unset( $this->messages[ $key ] ); |
|
| 276 | + if ( isset( $this->messages[$key] ) ) { |
|
| 277 | + unset( $this->messages[$key] ); |
|
| 278 | 278 | $this->update_list(); |
| 279 | 279 | } |
| 280 | 280 | } |
@@ -102,7 +102,7 @@ |
||
| 102 | 102 | 'name' => 'FrmFieldName', |
| 103 | 103 | ); |
| 104 | 104 | |
| 105 | - $class = isset( $type_classes[ $field_type ] ) ? $type_classes[ $field_type ] : ''; |
|
| 105 | + $class = isset( $type_classes[$field_type] ) ? $type_classes[$field_type] : ''; |
|
| 106 | 106 | |
| 107 | 107 | return apply_filters( 'frm_get_field_type_class', $class, $field_type ); |
| 108 | 108 | } |
@@ -39,7 +39,8 @@ |
||
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | foreach ( $sub_field['options'] as $option ) { |
| 42 | - if ( 'default_value' === $option ) { // We parse default value from field column. |
|
| 42 | + if ( 'default_value' === $option ) { |
|
| 43 | +// We parse default value from field column. |
|
| 43 | 44 | continue; |
| 44 | 45 | } |
| 45 | 46 | |
@@ -59,12 +59,12 @@ discard block |
||
| 59 | 59 | if ( is_array( $sub_field ) ) { |
| 60 | 60 | $sub_field = wp_parse_args( $sub_field, $defaults ); |
| 61 | 61 | $sub_field['name'] = $name; |
| 62 | - $this->sub_fields[ $name ] = $sub_field; |
|
| 62 | + $this->sub_fields[$name] = $sub_field; |
|
| 63 | 63 | continue; |
| 64 | 64 | } |
| 65 | 65 | |
| 66 | 66 | if ( is_string( $sub_field ) ) { |
| 67 | - $this->sub_fields[ $name ] = wp_parse_args( |
|
| 67 | + $this->sub_fields[$name] = wp_parse_args( |
|
| 68 | 68 | array( |
| 69 | 69 | 'name' => $name, |
| 70 | 70 | 'label' => $sub_field, |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | if ( is_string( $option ) ) { |
| 119 | - $extra_options[ $key . '_' . $option ] = ''; |
|
| 119 | + $extra_options[$key . '_' . $option] = ''; |
|
| 120 | 120 | } elseif ( ! empty( $option['name'] ) ) { |
| 121 | - $extra_options[ $key . '_' . $option['name'] ] = ''; |
|
| 121 | + $extra_options[$key . '_' . $option['name']] = ''; |
|
| 122 | 122 | } |
| 123 | 123 | } |
| 124 | 124 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | foreach ( $this->sub_fields as $name => $sub_field ) { |
| 142 | 142 | $sub_field['name'] = $name; |
| 143 | 143 | $wrapper_classes = 'frm_grid_container frm_sub_field_options frm_sub_field_options-' . $sub_field['name']; |
| 144 | - if ( ! isset( $processed_sub_fields[ $name ] ) ) { |
|
| 144 | + if ( ! isset( $processed_sub_fields[$name] ) ) { |
|
| 145 | 145 | // Options for this subfield should be hidden. |
| 146 | 146 | $wrapper_classes .= ' frm_hidden'; |
| 147 | 147 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $default_value = array(); |
| 172 | 172 | |
| 173 | 173 | foreach ( $this->sub_fields as $name => $sub_field ) { |
| 174 | - $default_value[ $name ] = ''; |
|
| 174 | + $default_value[$name] = ''; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | return $default_value; |
@@ -342,8 +342,8 @@ discard block |
||
| 342 | 342 | // Placeholder. |
| 343 | 343 | if ( in_array( 'placeholder', $sub_field['options'], true ) ) { |
| 344 | 344 | $placeholders = FrmField::get_option( $field, 'placeholder' ); |
| 345 | - if ( ! empty( $placeholders[ $sub_field['name'] ] ) ) { |
|
| 346 | - $atts[] = 'placeholder="' . esc_attr( $placeholders[ $sub_field['name'] ] ) . '"'; |
|
| 345 | + if ( ! empty( $placeholders[$sub_field['name']] ) ) { |
|
| 346 | + $atts[] = 'placeholder="' . esc_attr( $placeholders[$sub_field['name']] ) . '"'; |
|
| 347 | 347 | } |
| 348 | 348 | } |
| 349 | 349 | |
@@ -390,9 +390,9 @@ discard block |
||
| 390 | 390 | |
| 391 | 391 | // Validate not empty. |
| 392 | 392 | foreach ( $sub_fields as $name => $sub_field ) { |
| 393 | - if ( empty( $sub_field['optional'] ) && empty( $args['value'][ $name ] ) ) { |
|
| 394 | - $errors[ 'field' . $args['id'] . '-' . $name ] = ''; |
|
| 395 | - $errors[ 'field' . $args['id'] ] = $blank_msg; |
|
| 393 | + if ( empty( $sub_field['optional'] ) && empty( $args['value'][$name] ) ) { |
|
| 394 | + $errors['field' . $args['id'] . '-' . $name] = ''; |
|
| 395 | + $errors['field' . $args['id']] = $blank_msg; |
|
| 396 | 396 | } |
| 397 | 397 | } |
| 398 | 398 | |
@@ -411,7 +411,7 @@ discard block |
||
| 411 | 411 | $field_key = isset( $this->field->field_key ) ? $this->field->field_key : $this->field['field_key']; |
| 412 | 412 | $sub_fields = $this->get_processed_sub_fields(); |
| 413 | 413 | foreach ( $sub_fields as $name => $sub_field ) { |
| 414 | - $headings[ $field_id . '_' . $name ] = $field_name . ' (' . $field_key . ') - ' . $sub_field['label']; |
|
| 414 | + $headings[$field_id . '_' . $name] = $field_name . ' (' . $field_key . ') - ' . $sub_field['label']; |
|
| 415 | 415 | } |
| 416 | 416 | |
| 417 | 417 | return $headings; |
@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $sub_field_class = "frm_form_field form-field frm_form_subfield-{$name} {$sub_field['wrapper_classes']}"; |
| 41 | 41 | $sub_field_desc = FrmField::get_option( $field, $name . '_desc' ); |
| 42 | 42 | |
| 43 | - if ( isset( $errors[ 'field' . $field_id . '-' . $name ] ) ) { |
|
| 43 | + if ( isset( $errors['field' . $field_id . '-' . $name] ) ) { |
|
| 44 | 44 | $sub_field_class .= ' frm_blank_field'; |
| 45 | 45 | } |
| 46 | 46 | ?> |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | <input |
| 61 | 61 | type="<?php echo esc_attr( $sub_field['type'] ); ?>" |
| 62 | 62 | id="<?php echo esc_attr( $html_id . '_' . $name ); ?>" |
| 63 | - value="<?php echo esc_attr( isset( $field_value[ $name ] ) ? $field_value[ $name ] : '' ); ?>" |
|
| 63 | + value="<?php echo esc_attr( isset( $field_value[$name] ) ? $field_value[$name] : '' ); ?>" |
|
| 64 | 64 | <?php |
| 65 | 65 | if ( empty( $args['remove_names'] ) ) { |
| 66 | 66 | echo 'name="' . esc_attr( $field_name ) . '[' . esc_attr( $name ) . ']" '; |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | // Don't show individual field errors when there is a combo field error. |
| 80 | - if ( ! empty( $errors ) && isset( $errors[ 'field' . $field_id . '-' . $name ] ) && ! isset( $errors[ 'field' . $field_id ] ) ) { |
|
| 80 | + if ( ! empty( $errors ) && isset( $errors['field' . $field_id . '-' . $name] ) && ! isset( $errors['field' . $field_id] ) ) { |
|
| 81 | 81 | ?> |
| 82 | - <div class="frm_error"><?php echo esc_html( $errors[ 'field' . $field_id . '-' . $name ] ); ?></div> |
|
| 82 | + <div class="frm_error"><?php echo esc_html( $errors['field' . $field_id . '-' . $name] ); ?></div> |
|
| 83 | 83 | <?php } ?> |
| 84 | 84 | </div> |
| 85 | 85 | <?php } ?> |
@@ -51,13 +51,13 @@ discard block |
||
| 51 | 51 | type="text" |
| 52 | 52 | name="<?php echo esc_attr( $input_name ); ?>" |
| 53 | 53 | id="<?php echo esc_attr( $input_id ); ?>" |
| 54 | - value="<?php echo esc_attr( isset( $default_value[ $sub_field['name'] ] ) ? $default_value[ $sub_field['name'] ] : '' ); ?>" |
|
| 54 | + value="<?php echo esc_attr( isset( $default_value[$sub_field['name']] ) ? $default_value[$sub_field['name']] : '' ); ?>" |
|
| 55 | 55 | data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>" |
| 56 | 56 | data-changeatt="value" |
| 57 | 57 | /> |
| 58 | 58 | </span> |
| 59 | 59 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
| 60 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
| 60 | + <?php echo esc_html( $labels[$option] ); ?> |
|
| 61 | 61 | </label> |
| 62 | 62 | </p> |
| 63 | 63 | <?php |
@@ -74,12 +74,12 @@ discard block |
||
| 74 | 74 | type="text" |
| 75 | 75 | name="<?php echo esc_attr( $input_name ); ?>" |
| 76 | 76 | id="<?php echo esc_attr( $input_id ); ?>" |
| 77 | - value="<?php echo esc_attr( isset( $input_value[ $sub_field['name'] ] ) ? $input_value[ $sub_field['name'] ] : '' ); ?>" |
|
| 77 | + value="<?php echo esc_attr( isset( $input_value[$sub_field['name']] ) ? $input_value[$sub_field['name']] : '' ); ?>" |
|
| 78 | 78 | data-changeme="field_<?php echo esc_attr( $field_key . '_' . $sub_field['name'] ); ?>" |
| 79 | 79 | data-changeatt="<?php echo esc_attr( $option ); ?>" |
| 80 | 80 | /> |
| 81 | 81 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
| 82 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
| 82 | + <?php echo esc_html( $labels[$option] ); ?> |
|
| 83 | 83 | </label> |
| 84 | 84 | </p> |
| 85 | 85 | <?php |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | data-changeme="frm_field_<?php echo esc_attr( $field_id . '_' . $sub_field['name'] ); ?>_desc" |
| 101 | 101 | /> |
| 102 | 102 | <label class="frm_description" for="<?php echo esc_attr( $input_id ); ?>"> |
| 103 | - <?php echo esc_html( $labels[ $option ] ); ?> |
|
| 103 | + <?php echo esc_html( $labels[$option] ); ?> |
|
| 104 | 104 | </label> |
| 105 | 105 | </p> |
| 106 | 106 | <?php |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | self::print_file_headers( $filename ); |
| 42 | 42 | unset( $filename ); |
| 43 | 43 | |
| 44 | - $comment_count = FrmDb::get_count( |
|
| 44 | + $comment_count = FrmDb::get_count( |
|
| 45 | 45 | 'frm_item_metas', |
| 46 | 46 | array( |
| 47 | 47 | 'item_id' => $atts['entry_ids'], |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | private static function prepare_csv_headings() { |
| 108 | 108 | $headings = array(); |
| 109 | 109 | self::csv_headings( $headings ); |
| 110 | - $headings = apply_filters( |
|
| 110 | + $headings = apply_filters( |
|
| 111 | 111 | 'frm_csv_columns', |
| 112 | 112 | $headings, |
| 113 | 113 | self::$form_id, |
@@ -129,10 +129,10 @@ discard block |
||
| 129 | 129 | $field_headings = array(); |
| 130 | 130 | $separate_values = array( 'user_id', 'file', 'data', 'date' ); |
| 131 | 131 | if ( isset( $col->field_options['separate_value'] ) && $col->field_options['separate_value'] && ! in_array( $col->type, $separate_values, true ) ) { |
| 132 | - $field_headings[ $col->id . '_label' ] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 132 | + $field_headings[$col->id . '_label'] = strip_tags( $col->name . ' ' . __( '(label)', 'formidable' ) ); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | - $field_headings[ $col->id ] = strip_tags( $col->name ); |
|
| 135 | + $field_headings[$col->id] = strip_tags( $col->name ); |
|
| 136 | 136 | $field_headings = apply_filters( |
| 137 | 137 | 'frm_csv_field_columns', |
| 138 | 138 | $field_headings, |
@@ -151,14 +151,14 @@ discard block |
||
| 151 | 151 | foreach ( self::$fields as $col ) { |
| 152 | 152 | if ( self::is_the_child_of_a_repeater( $col ) ) { |
| 153 | 153 | $repeater_id = $col->field_options['in_section']; |
| 154 | - $headings[ 'repeater' . $repeater_id ] = array(); // set a placeholder to maintain order for repeater fields |
|
| 154 | + $headings['repeater' . $repeater_id] = array(); // set a placeholder to maintain order for repeater fields |
|
| 155 | 155 | |
| 156 | - if ( ! isset( $fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 157 | - $fields_by_repeater_id[ $repeater_id ] = array(); |
|
| 156 | + if ( ! isset( $fields_by_repeater_id[$repeater_id] ) ) { |
|
| 157 | + $fields_by_repeater_id[$repeater_id] = array(); |
|
| 158 | 158 | $repeater_ids[] = $repeater_id; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $fields_by_repeater_id[ $repeater_id ][] = $col; |
|
| 161 | + $fields_by_repeater_id[$repeater_id][] = $col; |
|
| 162 | 162 | |
| 163 | 163 | continue; |
| 164 | 164 | } |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | $end = strpos( $row->meta_value, ':{' ); |
| 178 | 178 | $length = substr( $row->meta_value, $start, $end - $start ); |
| 179 | 179 | |
| 180 | - if ( $length > $max[ $row->field_id ] ) { |
|
| 181 | - $max[ $row->field_id ] = $length; |
|
| 180 | + if ( $length > $max[$row->field_id] ) { |
|
| 181 | + $max[$row->field_id] = $length; |
|
| 182 | 182 | } |
| 183 | 183 | } |
| 184 | 184 | unset( $start, $end, $length, $row, $repeater_meta, $where ); |
@@ -189,17 +189,17 @@ discard block |
||
| 189 | 189 | $repeater_id = str_replace( 'repeater', '', $key ); |
| 190 | 190 | |
| 191 | 191 | $repeater_headings = array(); |
| 192 | - foreach ( $fields_by_repeater_id[ $repeater_id ] as $col ) { |
|
| 192 | + foreach ( $fields_by_repeater_id[$repeater_id] as $col ) { |
|
| 193 | 193 | $repeater_headings += self::field_headings( $col ); |
| 194 | 194 | } |
| 195 | 195 | |
| 196 | - for ( $i = 0; $i < $max[ $repeater_id ]; $i ++ ) { |
|
| 196 | + for ( $i = 0; $i < $max[$repeater_id]; $i ++ ) { |
|
| 197 | 197 | foreach ( $repeater_headings as $repeater_key => $repeater_name ) { |
| 198 | - $flat[ $repeater_key . '[' . $i . ']' ] = $repeater_name; |
|
| 198 | + $flat[$repeater_key . '[' . $i . ']'] = $repeater_name; |
|
| 199 | 199 | } |
| 200 | 200 | } |
| 201 | 201 | } else { |
| 202 | - $flat[ $key ] = $heading; |
|
| 202 | + $flat[$key] = $heading; |
|
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | |
@@ -213,9 +213,9 @@ discard block |
||
| 213 | 213 | |
| 214 | 214 | if ( self::$comment_count ) { |
| 215 | 215 | for ( $i = 0; $i < self::$comment_count; $i ++ ) { |
| 216 | - $headings[ 'comment' . $i ] = __( 'Comment', 'formidable' ); |
|
| 217 | - $headings[ 'comment_user_id' . $i ] = __( 'Comment User', 'formidable' ); |
|
| 218 | - $headings[ 'comment_created_at' . $i ] = __( 'Comment Date', 'formidable' ); |
|
| 216 | + $headings['comment' . $i] = __( 'Comment', 'formidable' ); |
|
| 217 | + $headings['comment_user_id' . $i] = __( 'Comment User', 'formidable' ); |
|
| 218 | + $headings['comment_created_at' . $i] = __( 'Comment Date', 'formidable' ); |
|
| 219 | 219 | } |
| 220 | 220 | unset( $i ); |
| 221 | 221 | } |
@@ -258,7 +258,7 @@ discard block |
||
| 258 | 258 | |
| 259 | 259 | private static function prepare_next_csv_rows( $next_set ) { |
| 260 | 260 | // order by parent_item_id so children will be first |
| 261 | - $where = array( |
|
| 261 | + $where = array( |
|
| 262 | 262 | 'or' => 1, |
| 263 | 263 | 'id' => $next_set, |
| 264 | 264 | 'parent_item_id' => $next_set, |
@@ -303,32 +303,32 @@ discard block |
||
| 303 | 303 | continue; |
| 304 | 304 | } |
| 305 | 305 | |
| 306 | - if ( ! isset( $entries[ self::$entry->parent_item_id ] ) ) { |
|
| 307 | - $entries[ self::$entry->parent_item_id ] = new stdClass(); |
|
| 308 | - $entries[ self::$entry->parent_item_id ]->metas = array(); |
|
| 306 | + if ( ! isset( $entries[self::$entry->parent_item_id] ) ) { |
|
| 307 | + $entries[self::$entry->parent_item_id] = new stdClass(); |
|
| 308 | + $entries[self::$entry->parent_item_id]->metas = array(); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 312 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = array(); |
|
| 313 | - } elseif ( ! is_array( $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] ) ) { |
|
| 311 | + if ( ! isset( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 312 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = array(); |
|
| 313 | + } elseif ( ! is_array( $entries[self::$entry->parent_item_id]->metas[$meta_id] ) ) { |
|
| 314 | 314 | // if the data is here, it should be an array but if this field has collected data |
| 315 | 315 | // both while inside and outside of the repeating section, it's possible this is a string |
| 316 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ] = (array) $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ]; |
|
| 316 | + $entries[self::$entry->parent_item_id]->metas[$meta_id] = (array) $entries[self::$entry->parent_item_id]->metas[$meta_id]; |
|
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | //add the repeated values |
| 320 | - $entries[ self::$entry->parent_item_id ]->metas[ $meta_id ][] = $meta_value; |
|
| 320 | + $entries[self::$entry->parent_item_id]->metas[$meta_id][] = $meta_value; |
|
| 321 | 321 | } |
| 322 | 322 | |
| 323 | 323 | self::$entry->metas = self::fill_missing_repeater_metas( self::$entry->metas, $entries ); |
| 324 | - $entries[ self::$entry->parent_item_id ]->metas += self::$entry->metas; |
|
| 324 | + $entries[self::$entry->parent_item_id]->metas += self::$entry->metas; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | // add the embedded form id |
| 328 | - if ( ! isset( $entries[ self::$entry->parent_item_id ]->embedded_fields ) ) { |
|
| 329 | - $entries[ self::$entry->parent_item_id ]->embedded_fields = array(); |
|
| 328 | + if ( ! isset( $entries[self::$entry->parent_item_id]->embedded_fields ) ) { |
|
| 329 | + $entries[self::$entry->parent_item_id]->embedded_fields = array(); |
|
| 330 | 330 | } |
| 331 | - $entries[ self::$entry->parent_item_id ]->embedded_fields[ self::$entry->id ] = self::$entry->form_id; |
|
| 331 | + $entries[self::$entry->parent_item_id]->embedded_fields[self::$entry->id] = self::$entry->form_id; |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | /** |
@@ -349,14 +349,14 @@ discard block |
||
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | $repeater_id = $field->field_options['in_section']; |
| 352 | - if ( ! isset( self::$fields_by_repeater_id[ $repeater_id ] ) ) { |
|
| 352 | + if ( ! isset( self::$fields_by_repeater_id[$repeater_id] ) ) { |
|
| 353 | 353 | return $metas; |
| 354 | 354 | } |
| 355 | 355 | |
| 356 | - foreach ( self::$fields_by_repeater_id[ $repeater_id ] as $repeater_child ) { |
|
| 357 | - if ( ! isset( $metas[ $repeater_child->id ] ) ) { |
|
| 358 | - $metas[ $repeater_child->id ] = ''; |
|
| 359 | - $entries[ self::$entry->parent_item_id ]->metas[ $repeater_child->id ][] = ''; |
|
| 356 | + foreach ( self::$fields_by_repeater_id[$repeater_id] as $repeater_child ) { |
|
| 357 | + if ( ! isset( $metas[$repeater_child->id] ) ) { |
|
| 358 | + $metas[$repeater_child->id] = ''; |
|
| 359 | + $entries[self::$entry->parent_item_id]->metas[$repeater_child->id][] = ''; |
|
| 360 | 360 | } |
| 361 | 361 | } |
| 362 | 362 | |
@@ -375,7 +375,7 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | private static function add_field_values_to_csv( &$row ) { |
| 377 | 377 | foreach ( self::$fields as $col ) { |
| 378 | - $field_value = isset( self::$entry->metas[ $col->id ] ) ? self::$entry->metas[ $col->id ] : false; |
|
| 378 | + $field_value = isset( self::$entry->metas[$col->id] ) ? self::$entry->metas[$col->id] : false; |
|
| 379 | 379 | |
| 380 | 380 | FrmAppHelper::unserialize_or_decode( $field_value ); |
| 381 | 381 | self::add_array_values_to_columns( $row, compact( 'col', 'field_value' ) ); |
@@ -400,15 +400,15 @@ discard block |
||
| 400 | 400 | 'show_icon' => false, |
| 401 | 401 | 'entry_id' => self::$entry->id, |
| 402 | 402 | 'sep' => self::$separator, |
| 403 | - 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[ self::$entry->id ] ) ) ? 'form' . self::$entry->embedded_fields[ self::$entry->id ] : 0, |
|
| 403 | + 'embedded_field_id' => ( isset( self::$entry->embedded_fields ) && isset( self::$entry->embedded_fields[self::$entry->id] ) ) ? 'form' . self::$entry->embedded_fields[self::$entry->id] : 0, |
|
| 404 | 404 | ) |
| 405 | 405 | ); |
| 406 | 406 | |
| 407 | - $row[ $col->id . '_label' ] = $sep_value; |
|
| 407 | + $row[$col->id . '_label'] = $sep_value; |
|
| 408 | 408 | unset( $sep_value ); |
| 409 | 409 | } |
| 410 | 410 | |
| 411 | - $row[ $col->id ] = $field_value; |
|
| 411 | + $row[$col->id] = $field_value; |
|
| 412 | 412 | |
| 413 | 413 | unset( $col, $field_value ); |
| 414 | 414 | } |
@@ -424,8 +424,8 @@ discard block |
||
| 424 | 424 | // This is combo field inside repeater. The heading key has this format: [86_first[0]]. |
| 425 | 425 | foreach ( $sub_value as $sub_key => $sub_sub_value ) { |
| 426 | 426 | $column_key = $atts['col']->id . '_' . $sub_key . '[' . $key . ']'; |
| 427 | - if ( ! is_numeric( $sub_key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 428 | - $row[ $column_key ] = $sub_sub_value; |
|
| 427 | + if ( ! is_numeric( $sub_key ) && isset( self::$headings[$column_key] ) ) { |
|
| 428 | + $row[$column_key] = $sub_sub_value; |
|
| 429 | 429 | } |
| 430 | 430 | } |
| 431 | 431 | |
@@ -433,8 +433,8 @@ discard block |
||
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | $column_key = $atts['col']->id . '_' . $key; |
| 436 | - if ( ! is_numeric( $key ) && isset( self::$headings[ $column_key ] ) ) { |
|
| 437 | - $row[ $column_key ] = $sub_value; |
|
| 436 | + if ( ! is_numeric( $key ) && isset( self::$headings[$column_key] ) ) { |
|
| 437 | + $row[$column_key] = $sub_value; |
|
| 438 | 438 | } |
| 439 | 439 | } |
| 440 | 440 | } |
@@ -458,18 +458,18 @@ discard block |
||
| 458 | 458 | $sep = ''; |
| 459 | 459 | |
| 460 | 460 | foreach ( self::$headings as $k => $heading ) { |
| 461 | - if ( isset( $rows[ $k ] ) ) { |
|
| 462 | - $row = $rows[ $k ]; |
|
| 461 | + if ( isset( $rows[$k] ) ) { |
|
| 462 | + $row = $rows[$k]; |
|
| 463 | 463 | } else { |
| 464 | 464 | $row = ''; |
| 465 | 465 | // array indexed data is not at $rows[ $k ] |
| 466 | - if ( $k[ strlen( $k ) - 1 ] === ']' ) { |
|
| 466 | + if ( $k[strlen( $k ) - 1] === ']' ) { |
|
| 467 | 467 | $start = strrpos( $k, '[' ); |
| 468 | 468 | $key = substr( $k, 0, $start ++ ); |
| 469 | 469 | $index = substr( $k, $start, strlen( $k ) - 1 - $start ); |
| 470 | 470 | |
| 471 | - if ( isset( $rows[ $key ] ) && isset( $rows[ $key ][ $index ] ) ) { |
|
| 472 | - $row = $rows[ $key ][ $index ]; |
|
| 471 | + if ( isset( $rows[$key] ) && isset( $rows[$key][$index] ) ) { |
|
| 472 | + $row = $rows[$key][$index]; |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | unset( $start, $key, $index ); |
@@ -122,7 +122,8 @@ |
||
| 122 | 122 | |
| 123 | 123 | private static function field_headings( $col ) { |
| 124 | 124 | $field_type_obj = FrmFieldFactory::get_field_factory( $col ); |
| 125 | - if ( ! empty( $field_type_obj->is_combo_field ) ) { // This is combo field. |
|
| 125 | + if ( ! empty( $field_type_obj->is_combo_field ) ) { |
|
| 126 | +// This is combo field. |
|
| 126 | 127 | return $field_type_obj->get_export_headings(); |
| 127 | 128 | } |
| 128 | 129 | |
@@ -213,10 +213,10 @@ |
||
| 213 | 213 | return false; |
| 214 | 214 | } |
| 215 | 215 | $form_params = $frm_vars['form_params']; |
| 216 | - if ( ! isset( $form_params[ $this->form_id ] ) ) { |
|
| 216 | + if ( ! isset( $form_params[$this->form_id] ) ) { |
|
| 217 | 217 | return false; |
| 218 | 218 | } |
| 219 | - $this_form_params = $form_params[ $this->form_id ]; |
|
| 219 | + $this_form_params = $form_params[$this->form_id]; |
|
| 220 | 220 | return ! empty( $this_form_params['action'] ) && 'update' === $this_form_params['action']; |
| 221 | 221 | } |
| 222 | 222 | |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | private function check_honeypot_setting() { |
| 49 | 49 | $form = $this->get_form(); |
| 50 | 50 | $key = $this->get_option_key(); |
| 51 | - return $form->options[ $key ]; |
|
| 51 | + return $form->options[$key]; |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | /** |