PluginProbe
weForms – Easy Drag & Drop Contact Form Builder For WordPress / 1.6.23
weForms – Easy Drag & Drop Contact Form Builder For WordPress v1.6.23
1.6.7 1.6.8 1.6.9 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.18 1.6.19 1.6.2 1.6.20 1.6.21 1.6.22 1.6.23 1.6.24 1.6.25 1.6.26 1.6.27 1.6.28 1.6.3 1.6.4 1.6.5 1.6.6 All 74 releases
← All changes | includes/class-form-entry.php +43 -5 1.6.51.6.23 View file →
@@ -109,11 +109,16 @@
109 109 $grid_css = '<style>.wpufTable {display: table; width: 100%; } .wpufTableRow {display: table-row; } .wpufTableRow:nth-child(even) {background-color: #f5f5f5; } .wpufTableHeading {background-color: #eee; display: table-header-group; font-weight: bold; } .wpufTableCell, .wpufTableHead {border: none; display: table-cell; padding: 3px 10px; } .wpufTableFoot {background-color: #eee; display: table-footer-group; font-weight: bold; } .wpufTableBody {display: table-row-group; }</style>';
110 110
111 111 $values = [];
112 112
113 - $query = "SELECT * FROM {$wpdb->weforms_entries} as entry
114 - LEFT JOIN {$wpdb->weforms_entrymeta} AS meta ON entry.id = meta.weforms_entry_id
115 - WHERE entry.id = {$this->id}";
113 + $query = $wpdb->prepare(
114 + "
115 + SELECT * FROM {$wpdb->weforms_entries} as entry
116 + LEFT JOIN {$wpdb->weforms_entrymeta} AS meta ON entry.id = meta.weforms_entry_id
117 + WHERE entry.id = %d
118 + ",
119 + $this->id
120 + );
116 121
117 122 $results = $wpdb->get_results( $query );
118 123
119 124 if ( $results ) {
@@ -352,15 +357,18 @@
352 357
353 358 $value = implode( '<br> ', $serialized_value );
354 359 }
355 360 } elseif ( $field['type'] == 'signature_field' ) {
356 - $url = content_url() . $value;
357 - $value = $url;
361 + $url = $value;
358 362
359 363 if ( isset( $_REQUEST['action'] ) != 'weforms_pdf_download' ) {
364 + $url = content_url() . '/' . $value;
360 365 $value = sprintf( '<img src="%s">', $url );
361 366 $value .= sprintf( '<a style="margin-left: -200px" href="%s">Download</a>', $url );
362 367 }
368 + else{
369 + $value = sprintf( '<img src="%s">', $url );
370 + }
363 371 }
364 372
365 373 $this->fields[ $result->meta_key ]['value'] = apply_filters( 'weforms_entry_meta_field', $value, $field );
366 374 }
@@ -416,6 +424,36 @@
416 424 return;
417 425 }
418 426
419 427 return $wpdb->get_row( "SELECT * FROM {$wpdb->prefix}weforms_payments WHERE entry_id = {$this->id} " );
428 + }
429 +
430 + /**
431 + * Get Form from entry id.
432 + *
433 + * @param int $entry_id The entry id.
434 + * @global object $wpdb The Wordpress database object.
435 + *
436 + * @return object The form object.
437 + */
438 + public static function get_form( $entry_id ) {
439 + $form_id = self::get_form_id( $entry_id );
440 +
441 + return ! empty( $form_id ) ? weforms()->form->get( $form_id ) : null;
442 + }
443 +
444 + /**
445 + * Get form id from entry id.
446 + *
447 + * @param int $entry_id The entry id.
448 + * @global object $wpdb The Wordpress database object.
449 + *
450 + * @return int The form id.
451 + */
452 + public static function get_form_id( $entry_id ) {
453 + global $wpdb;
454 +
455 + $results = $wpdb->get_results( $wpdb->prepare( "SELECT form_id FROM {$wpdb->prefix}weforms_entries WHERE id = %d ", $entry_id ) );
456 +
457 + return ! empty( $results[0]->form_id ) ? $results[0]->form_id : null;
420 458 }
421 459 }