@@ -149,41 +149,41 @@ discard block |
||
| 149 | 149 | return apply_filters( 'frm_pro_available_fields', $fields ); |
| 150 | 150 | } |
| 151 | 151 | |
| 152 | - public static function create( $values, $return = true ) { |
|
| 153 | - global $wpdb, $frm_duplicate_ids; |
|
| 152 | + public static function create( $values, $return = true ) { |
|
| 153 | + global $wpdb, $frm_duplicate_ids; |
|
| 154 | 154 | |
| 155 | - $new_values = array(); |
|
| 155 | + $new_values = array(); |
|
| 156 | 156 | $key = isset( $values['field_key'] ) ? $values['field_key'] : $values['name']; |
| 157 | 157 | $new_values['field_key'] = FrmAppHelper::get_unique_key( $key, $wpdb->prefix . 'frm_fields', 'field_key' ); |
| 158 | 158 | |
| 159 | 159 | foreach ( array( 'name', 'description', 'type', 'default_value' ) as $col ) { |
| 160 | 160 | $new_values[ $col ] = $values[ $col ]; |
| 161 | - } |
|
| 161 | + } |
|
| 162 | 162 | |
| 163 | - $new_values['options'] = $values['options']; |
|
| 163 | + $new_values['options'] = $values['options']; |
|
| 164 | 164 | |
| 165 | 165 | $new_values['field_order'] = isset( $values['field_order'] ) ? (int) $values['field_order'] : null; |
| 166 | 166 | $new_values['required'] = isset( $values['required'] ) ? (int) $values['required'] : 0; |
| 167 | 167 | $new_values['form_id'] = isset( $values['form_id'] ) ? (int) $values['form_id'] : null; |
| 168 | - $new_values['field_options'] = $values['field_options']; |
|
| 168 | + $new_values['field_options'] = $values['field_options']; |
|
| 169 | 169 | $new_values['created_at'] = current_time( 'mysql', 1 ); |
| 170 | 170 | |
| 171 | 171 | if ( isset( $values['id'] ) ) { |
| 172 | 172 | $frm_duplicate_ids[ $values['field_key'] ] = $new_values['field_key']; |
| 173 | 173 | $new_values = apply_filters( 'frm_duplicated_field', $new_values ); |
| 174 | - } |
|
| 174 | + } |
|
| 175 | 175 | |
| 176 | 176 | self::preserve_format_option_backslashes( $new_values ); |
| 177 | 177 | |
| 178 | 178 | foreach ( $new_values as $k => $v ) { |
| 179 | - if ( is_array( $v ) ) { |
|
| 179 | + if ( is_array( $v ) ) { |
|
| 180 | 180 | $new_values[ $k ] = serialize( $v ); |
| 181 | 181 | } |
| 182 | - unset( $k, $v ); |
|
| 183 | - } |
|
| 182 | + unset( $k, $v ); |
|
| 183 | + } |
|
| 184 | 184 | |
| 185 | - //if(isset($values['id']) and is_numeric($values['id'])) |
|
| 186 | - // $new_values['id'] = $values['id']; |
|
| 185 | + //if(isset($values['id']) and is_numeric($values['id'])) |
|
| 186 | + // $new_values['id'] = $values['id']; |
|
| 187 | 187 | |
| 188 | 188 | $query_results = $wpdb->insert( $wpdb->prefix . 'frm_fields', $new_values ); |
| 189 | 189 | $new_id = 0; |
@@ -204,10 +204,10 @@ discard block |
||
| 204 | 204 | } else { |
| 205 | 205 | return false; |
| 206 | 206 | } |
| 207 | - } |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | - public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
|
| 210 | - global $frm_duplicate_ids; |
|
| 209 | + public static function duplicate( $old_form_id, $form_id, $copy_keys = false, $blog_id = false ) { |
|
| 210 | + global $frm_duplicate_ids; |
|
| 211 | 211 | |
| 212 | 212 | $where = array( |
| 213 | 213 | array( |
@@ -218,14 +218,14 @@ discard block |
||
| 218 | 218 | ); |
| 219 | 219 | $fields = self::getAll( $where, 'field_order', '', $blog_id ); |
| 220 | 220 | |
| 221 | - foreach ( (array) $fields as $field ) { |
|
| 221 | + foreach ( (array) $fields as $field ) { |
|
| 222 | 222 | $new_key = $copy_keys ? $field->field_key : ''; |
| 223 | 223 | if ( $copy_keys && substr( $field->field_key, -1 ) == 2 ) { |
| 224 | 224 | $new_key = rtrim( $new_key, 2 ); |
| 225 | 225 | } |
| 226 | 226 | |
| 227 | - $values = array(); |
|
| 228 | - FrmFieldsHelper::fill_field( $values, $field, $form_id, $new_key ); |
|
| 227 | + $values = array(); |
|
| 228 | + FrmFieldsHelper::fill_field( $values, $field, $form_id, $new_key ); |
|
| 229 | 229 | |
| 230 | 230 | // If this is a repeating section, create new form |
| 231 | 231 | if ( self::is_repeating_field( $field ) ) { |
@@ -256,11 +256,11 @@ discard block |
||
| 256 | 256 | $frm_duplicate_ids[ $field->id ] = $new_id; |
| 257 | 257 | $frm_duplicate_ids[ $field->field_key ] = $new_id; |
| 258 | 258 | unset( $field ); |
| 259 | - } |
|
| 260 | - } |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | 261 | |
| 262 | 262 | public static function update( $id, $values ) { |
| 263 | - global $wpdb; |
|
| 263 | + global $wpdb; |
|
| 264 | 264 | |
| 265 | 265 | $id = absint( $id ); |
| 266 | 266 | |
@@ -269,8 +269,8 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | |
| 271 | 271 | if ( isset( $values['required'] ) ) { |
| 272 | - $values['required'] = (int) $values['required']; |
|
| 273 | - } |
|
| 272 | + $values['required'] = (int) $values['required']; |
|
| 273 | + } |
|
| 274 | 274 | |
| 275 | 275 | self::preserve_format_option_backslashes( $values ); |
| 276 | 276 | |
@@ -292,41 +292,41 @@ discard block |
||
| 292 | 292 | |
| 293 | 293 | $query_results = $wpdb->update( $wpdb->prefix . 'frm_fields', $values, array( 'id' => $id ) ); |
| 294 | 294 | |
| 295 | - $form_id = 0; |
|
| 295 | + $form_id = 0; |
|
| 296 | 296 | if ( isset( $values['form_id'] ) ) { |
| 297 | - $form_id = absint( $values['form_id'] ); |
|
| 297 | + $form_id = absint( $values['form_id'] ); |
|
| 298 | 298 | } else { |
| 299 | 299 | $field = self::getOne( $id ); |
| 300 | - if ( $field ) { |
|
| 301 | - $form_id = $field->form_id; |
|
| 302 | - } |
|
| 300 | + if ( $field ) { |
|
| 301 | + $form_id = $field->form_id; |
|
| 302 | + } |
|
| 303 | 303 | unset( $field ); |
| 304 | - } |
|
| 304 | + } |
|
| 305 | 305 | unset( $values ); |
| 306 | 306 | |
| 307 | 307 | if ( $query_results ) { |
| 308 | - wp_cache_delete( $id, 'frm_field' ); |
|
| 309 | - if ( $form_id ) { |
|
| 310 | - self::delete_form_transient( $form_id ); |
|
| 311 | - } |
|
| 312 | - } |
|
| 308 | + wp_cache_delete( $id, 'frm_field' ); |
|
| 309 | + if ( $form_id ) { |
|
| 310 | + self::delete_form_transient( $form_id ); |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | 313 | |
| 314 | - return $query_results; |
|
| 315 | - } |
|
| 314 | + return $query_results; |
|
| 315 | + } |
|
| 316 | 316 | |
| 317 | 317 | /** |
| 318 | - * Keep backslashes in the phone format option |
|
| 319 | - * |
|
| 320 | - * @since 2.0.8 |
|
| 321 | - * @param $values array - pass by reference |
|
| 322 | - */ |
|
| 318 | + * Keep backslashes in the phone format option |
|
| 319 | + * |
|
| 320 | + * @since 2.0.8 |
|
| 321 | + * @param $values array - pass by reference |
|
| 322 | + */ |
|
| 323 | 323 | private static function preserve_format_option_backslashes( &$values ) { |
| 324 | 324 | if ( isset( $values['field_options']['format'] ) ) { |
| 325 | 325 | $values['field_options']['format'] = FrmAppHelper::preserve_backslashes( $values['field_options']['format'] ); |
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | |
| 329 | - public static function destroy( $id ) { |
|
| 329 | + public static function destroy( $id ) { |
|
| 330 | 330 | global $wpdb; |
| 331 | 331 | |
| 332 | 332 | do_action( 'frm_before_destroy_field', $id ); |
@@ -341,7 +341,7 @@ discard block |
||
| 341 | 341 | |
| 342 | 342 | $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_item_metas WHERE field_id=%d', $id ) ); |
| 343 | 343 | return $wpdb->query( $wpdb->prepare( 'DELETE FROM ' . $wpdb->prefix . 'frm_fields WHERE id=%d', $id ) ); |
| 344 | - } |
|
| 344 | + } |
|
| 345 | 345 | |
| 346 | 346 | public static function delete_form_transient( $form_id ) { |
| 347 | 347 | $form_id = absint( $form_id ); |
@@ -356,10 +356,10 @@ discard block |
||
| 356 | 356 | FrmDb::cache_delete_group( 'frm_field' ); |
| 357 | 357 | |
| 358 | 358 | $form = FrmForm::getOne( $form_id ); |
| 359 | - if ( $form && $form->parent_form_id && $form->parent_form_id != $form_id ) { |
|
| 360 | - self::delete_form_transient( $form->parent_form_id ); |
|
| 361 | - } |
|
| 362 | - } |
|
| 359 | + if ( $form && $form->parent_form_id && $form->parent_form_id != $form_id ) { |
|
| 360 | + self::delete_form_transient( $form->parent_form_id ); |
|
| 361 | + } |
|
| 362 | + } |
|
| 363 | 363 | |
| 364 | 364 | /** |
| 365 | 365 | * If $field is numeric, get the field object |
@@ -379,29 +379,29 @@ discard block |
||
| 379 | 379 | return null; |
| 380 | 380 | } |
| 381 | 381 | |
| 382 | - global $wpdb; |
|
| 382 | + global $wpdb; |
|
| 383 | 383 | |
| 384 | 384 | $where = is_numeric( $id ) ? 'id=%d' : 'field_key=%s'; |
| 385 | 385 | $query = $wpdb->prepare( 'SELECT * FROM ' . $wpdb->prefix . 'frm_fields WHERE ' . $where, $id ); // WPCS: unprepared SQL ok. |
| 386 | 386 | |
| 387 | - $results = FrmDb::check_cache( $id, 'frm_field', $query, 'get_row', 0 ); |
|
| 387 | + $results = FrmDb::check_cache( $id, 'frm_field', $query, 'get_row', 0 ); |
|
| 388 | 388 | |
| 389 | 389 | if ( empty( $results ) ) { |
| 390 | 390 | self::filter_field( $filter, $results ); |
| 391 | - return $results; |
|
| 392 | - } |
|
| 391 | + return $results; |
|
| 392 | + } |
|
| 393 | 393 | |
| 394 | 394 | if ( is_numeric( $id ) ) { |
| 395 | 395 | FrmDb::set_cache( $results->field_key, $results, 'frm_field' ); |
| 396 | - } else if ( $results ) { |
|
| 396 | + } else if ( $results ) { |
|
| 397 | 397 | FrmDb::set_cache( $results->id, $results, 'frm_field' ); |
| 398 | - } |
|
| 398 | + } |
|
| 399 | 399 | |
| 400 | 400 | self::prepare_options( $results ); |
| 401 | 401 | self::filter_field( $filter, $results ); |
| 402 | 402 | |
| 403 | 403 | return stripslashes_deep( $results ); |
| 404 | - } |
|
| 404 | + } |
|
| 405 | 405 | |
| 406 | 406 | /** |
| 407 | 407 | * @since 3.06.01 |
@@ -423,26 +423,26 @@ discard block |
||
| 423 | 423 | * @param int|string The field id or key |
| 424 | 424 | * @param mixed $col The name of the column in the fields database table |
| 425 | 425 | */ |
| 426 | - public static function get_type( $id, $col = 'type' ) { |
|
| 427 | - $field = FrmDb::check_cache( $id, 'frm_field' ); |
|
| 428 | - if ( $field ) { |
|
| 429 | - $type = $field->{$col}; |
|
| 430 | - } else { |
|
| 426 | + public static function get_type( $id, $col = 'type' ) { |
|
| 427 | + $field = FrmDb::check_cache( $id, 'frm_field' ); |
|
| 428 | + if ( $field ) { |
|
| 429 | + $type = $field->{$col}; |
|
| 430 | + } else { |
|
| 431 | 431 | $where = array( |
| 432 | 432 | 'or' => 1, |
| 433 | 433 | 'id' => $id, |
| 434 | 434 | 'field_key' => $id, |
| 435 | 435 | ); |
| 436 | 436 | $type = FrmDb::get_var( 'frm_fields', $where, $col ); |
| 437 | - } |
|
| 437 | + } |
|
| 438 | 438 | |
| 439 | - return $type; |
|
| 440 | - } |
|
| 439 | + return $type; |
|
| 440 | + } |
|
| 441 | 441 | |
| 442 | 442 | public static function get_all_types_in_form( $form_id, $type, $limit = '', $inc_sub = 'exclude' ) { |
| 443 | - if ( ! $form_id ) { |
|
| 444 | - return array(); |
|
| 445 | - } |
|
| 443 | + if ( ! $form_id ) { |
|
| 444 | + return array(); |
|
| 445 | + } |
|
| 446 | 446 | |
| 447 | 447 | $results = self::get_fields_from_transients( |
| 448 | 448 | $form_id, |
@@ -452,30 +452,30 @@ discard block |
||
| 452 | 452 | ) |
| 453 | 453 | ); |
| 454 | 454 | if ( ! empty( $results ) ) { |
| 455 | - $fields = array(); |
|
| 456 | - $count = 0; |
|
| 457 | - foreach ( $results as $result ) { |
|
| 458 | - if ( $type != $result->type ) { |
|
| 459 | - continue; |
|
| 460 | - } |
|
| 455 | + $fields = array(); |
|
| 456 | + $count = 0; |
|
| 457 | + foreach ( $results as $result ) { |
|
| 458 | + if ( $type != $result->type ) { |
|
| 459 | + continue; |
|
| 460 | + } |
|
| 461 | 461 | |
| 462 | 462 | $fields[ $result->id ] = $result; |
| 463 | - $count++; |
|
| 464 | - if ( $limit == 1 ) { |
|
| 465 | - $fields = $result; |
|
| 466 | - break; |
|
| 467 | - } |
|
| 463 | + $count++; |
|
| 464 | + if ( $limit == 1 ) { |
|
| 465 | + $fields = $result; |
|
| 466 | + break; |
|
| 467 | + } |
|
| 468 | 468 | |
| 469 | 469 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 470 | - break; |
|
| 471 | - } |
|
| 470 | + break; |
|
| 471 | + } |
|
| 472 | 472 | |
| 473 | 473 | unset( $result ); |
| 474 | 474 | } |
| 475 | 475 | return stripslashes_deep( $fields ); |
| 476 | - } |
|
| 476 | + } |
|
| 477 | 477 | |
| 478 | - self::$use_cache = false; |
|
| 478 | + self::$use_cache = false; |
|
| 479 | 479 | |
| 480 | 480 | $where = array( |
| 481 | 481 | 'fi.form_id' => (int) $form_id, |
@@ -483,59 +483,59 @@ discard block |
||
| 483 | 483 | ); |
| 484 | 484 | self::maybe_include_repeating_fields( $inc_sub, $where ); |
| 485 | 485 | $results = self::getAll( $where, 'field_order', $limit ); |
| 486 | - self::$use_cache = true; |
|
| 486 | + self::$use_cache = true; |
|
| 487 | 487 | self::include_sub_fields( $results, $inc_sub, $type ); |
| 488 | 488 | |
| 489 | - return $results; |
|
| 490 | - } |
|
| 489 | + return $results; |
|
| 490 | + } |
|
| 491 | 491 | |
| 492 | 492 | public static function get_all_for_form( $form_id, $limit = '', $inc_embed = 'exclude', $inc_repeat = 'include' ) { |
| 493 | - if ( ! (int) $form_id ) { |
|
| 494 | - return array(); |
|
| 495 | - } |
|
| 493 | + if ( ! (int) $form_id ) { |
|
| 494 | + return array(); |
|
| 495 | + } |
|
| 496 | 496 | |
| 497 | 497 | $results = self::get_fields_from_transients( $form_id, compact( 'inc_embed', 'inc_repeat' ) ); |
| 498 | 498 | if ( ! empty( $results ) ) { |
| 499 | 499 | if ( empty( $limit ) ) { |
| 500 | 500 | return $results; |
| 501 | - } |
|
| 501 | + } |
|
| 502 | 502 | |
| 503 | - $fields = array(); |
|
| 504 | - $count = 0; |
|
| 505 | - foreach ( $results as $result ) { |
|
| 503 | + $fields = array(); |
|
| 504 | + $count = 0; |
|
| 505 | + foreach ( $results as $result ) { |
|
| 506 | 506 | $count++; |
| 507 | 507 | $fields[ $result->id ] = $result; |
| 508 | 508 | if ( ! empty( $limit ) && $count >= $limit ) { |
| 509 | - break; |
|
| 510 | - } |
|
| 511 | - } |
|
| 509 | + break; |
|
| 510 | + } |
|
| 511 | + } |
|
| 512 | 512 | |
| 513 | 513 | return $fields; |
| 514 | - } |
|
| 514 | + } |
|
| 515 | 515 | |
| 516 | - self::$use_cache = false; |
|
| 516 | + self::$use_cache = false; |
|
| 517 | 517 | |
| 518 | 518 | $where = array( 'fi.form_id' => absint( $form_id ) ); |
| 519 | 519 | self::maybe_include_repeating_fields( $inc_repeat, $where ); |
| 520 | 520 | $results = self::getAll( $where, 'field_order', $limit ); |
| 521 | 521 | |
| 522 | - self::$use_cache = true; |
|
| 522 | + self::$use_cache = true; |
|
| 523 | 523 | |
| 524 | 524 | self::include_sub_fields( $results, $inc_embed, 'all' ); |
| 525 | 525 | |
| 526 | 526 | if ( empty( $limit ) ) { |
| 527 | 527 | self::set_field_transient( $results, $form_id, 0, compact( 'inc_embed', 'inc_repeat' ) ); |
| 528 | - } |
|
| 528 | + } |
|
| 529 | 529 | |
| 530 | 530 | return $results; |
| 531 | - } |
|
| 531 | + } |
|
| 532 | 532 | |
| 533 | 533 | /** |
| 534 | - * If repeating fields should be included, adjust $where accordingly |
|
| 535 | - * |
|
| 536 | - * @param string $inc_repeat |
|
| 537 | - * @param array $where - pass by reference |
|
| 538 | - */ |
|
| 534 | + * If repeating fields should be included, adjust $where accordingly |
|
| 535 | + * |
|
| 536 | + * @param string $inc_repeat |
|
| 537 | + * @param array $where - pass by reference |
|
| 538 | + */ |
|
| 539 | 539 | private static function maybe_include_repeating_fields( $inc_repeat, &$where ) { |
| 540 | 540 | if ( $inc_repeat == 'include' ) { |
| 541 | 541 | $form_id = $where['fi.form_id']; |
@@ -550,21 +550,21 @@ discard block |
||
| 550 | 550 | |
| 551 | 551 | public static function include_sub_fields( &$results, $inc_embed, $type = 'all' ) { |
| 552 | 552 | if ( 'include' != $inc_embed || empty( $results ) ) { |
| 553 | - return; |
|
| 554 | - } |
|
| 553 | + return; |
|
| 554 | + } |
|
| 555 | 555 | |
| 556 | - $form_fields = $results; |
|
| 556 | + $form_fields = $results; |
|
| 557 | 557 | $index_offset = 1; |
| 558 | - foreach ( $form_fields as $k => $field ) { |
|
| 558 | + foreach ( $form_fields as $k => $field ) { |
|
| 559 | 559 | if ( 'form' != $field->type || ! isset( $field->field_options['form_select'] ) ) { |
| 560 | - continue; |
|
| 561 | - } |
|
| 560 | + continue; |
|
| 561 | + } |
|
| 562 | 562 | |
| 563 | - if ( $type == 'all' ) { |
|
| 564 | - $sub_fields = self::get_all_for_form( $field->field_options['form_select'] ); |
|
| 565 | - } else { |
|
| 563 | + if ( $type == 'all' ) { |
|
| 564 | + $sub_fields = self::get_all_for_form( $field->field_options['form_select'] ); |
|
| 565 | + } else { |
|
| 566 | 566 | $sub_fields = self::get_all_types_in_form( $field->form_id, $type ); |
| 567 | - } |
|
| 567 | + } |
|
| 568 | 568 | |
| 569 | 569 | if ( ! empty( $sub_fields ) ) { |
| 570 | 570 | $index = $k + $index_offset; |
@@ -572,35 +572,35 @@ discard block |
||
| 572 | 572 | array_splice( $results, $index, 0, $sub_fields ); |
| 573 | 573 | } |
| 574 | 574 | unset( $field, $sub_fields ); |
| 575 | - } |
|
| 576 | - } |
|
| 575 | + } |
|
| 576 | + } |
|
| 577 | 577 | |
| 578 | 578 | public static function getAll( $where = array(), $order_by = '', $limit = '', $blog_id = false ) { |
| 579 | 579 | $cache_key = maybe_serialize( $where ) . $order_by . 'l' . $limit . 'b' . $blog_id; |
| 580 | - if ( self::$use_cache ) { |
|
| 581 | - // make sure old cache doesn't get saved as a transient |
|
| 580 | + if ( self::$use_cache ) { |
|
| 581 | + // make sure old cache doesn't get saved as a transient |
|
| 582 | 582 | $results = wp_cache_get( $cache_key, 'frm_field' ); |
| 583 | - if ( false !== $results ) { |
|
| 583 | + if ( false !== $results ) { |
|
| 584 | 584 | return stripslashes_deep( $results ); |
| 585 | - } |
|
| 586 | - } |
|
| 585 | + } |
|
| 586 | + } |
|
| 587 | 587 | |
| 588 | - global $wpdb; |
|
| 588 | + global $wpdb; |
|
| 589 | 589 | |
| 590 | - if ( $blog_id && is_multisite() ) { |
|
| 591 | - global $wpmuBaseTablePrefix; |
|
| 592 | - if ( $wpmuBaseTablePrefix ) { |
|
| 590 | + if ( $blog_id && is_multisite() ) { |
|
| 591 | + global $wpmuBaseTablePrefix; |
|
| 592 | + if ( $wpmuBaseTablePrefix ) { |
|
| 593 | 593 | $prefix = $wpmuBaseTablePrefix . $blog_id . '_'; |
| 594 | - } else { |
|
| 595 | - $prefix = $wpdb->get_blog_prefix( $blog_id ); |
|
| 596 | - } |
|
| 594 | + } else { |
|
| 595 | + $prefix = $wpdb->get_blog_prefix( $blog_id ); |
|
| 596 | + } |
|
| 597 | 597 | |
| 598 | 598 | $table_name = $prefix . 'frm_fields'; |
| 599 | 599 | $form_table_name = $prefix . 'frm_forms'; |
| 600 | 600 | } else { |
| 601 | 601 | $table_name = $wpdb->prefix . 'frm_fields'; |
| 602 | 602 | $form_table_name = $wpdb->prefix . 'frm_forms'; |
| 603 | - } |
|
| 603 | + } |
|
| 604 | 604 | |
| 605 | 605 | if ( ! empty( $order_by ) && strpos( $order_by, 'ORDER BY' ) === false ) { |
| 606 | 606 | $order_by = ' ORDER BY ' . $order_by; |
@@ -608,8 +608,8 @@ discard block |
||
| 608 | 608 | |
| 609 | 609 | $limit = FrmDb::esc_limit( $limit ); |
| 610 | 610 | |
| 611 | - $query = "SELECT fi.*, fr.name as form_name FROM {$table_name} fi LEFT OUTER JOIN {$form_table_name} fr ON fi.form_id=fr.id"; |
|
| 612 | - $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
|
| 611 | + $query = "SELECT fi.*, fr.name as form_name FROM {$table_name} fi LEFT OUTER JOIN {$form_table_name} fr ON fi.form_id=fr.id"; |
|
| 612 | + $query_type = ( $limit == ' LIMIT 1' || $limit == 1 ) ? 'row' : 'results'; |
|
| 613 | 613 | |
| 614 | 614 | if ( is_array( $where ) ) { |
| 615 | 615 | $args = array( |
@@ -623,8 +623,8 @@ discard block |
||
| 623 | 623 | |
| 624 | 624 | $function_name = ( $query_type == 'row' ) ? 'get_row' : 'get_results'; |
| 625 | 625 | $results = $wpdb->$function_name( $query ); |
| 626 | - } |
|
| 627 | - unset( $where ); |
|
| 626 | + } |
|
| 627 | + unset( $where ); |
|
| 628 | 628 | |
| 629 | 629 | self::format_field_results( $results ); |
| 630 | 630 | |
@@ -877,8 +877,8 @@ discard block |
||
| 877 | 877 | } |
| 878 | 878 | |
| 879 | 879 | /** |
| 880 | - * @since 2.0.09 |
|
| 881 | - */ |
|
| 880 | + * @since 2.0.09 |
|
| 881 | + */ |
|
| 882 | 882 | public static function is_repeating_field( $field ) { |
| 883 | 883 | if ( is_array( $field ) ) { |
| 884 | 884 | $is_repeating_field = ( 'divider' == $field['type'] ); |