Skip to content

Commit 6138743

Browse files
author
Antti Kuosmanen
committed
Add shortcode meta box, don't escape html in title format
1 parent 4f1bbb7 commit 6138743

1 file changed

Lines changed: 21 additions & 2 deletions

File tree

classes/class-cpt-wplf-form.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,16 @@ function custom_columns_display_cpt( $column, $post_id ) {
193193
* Add meta box to show fields in form
194194
*/
195195
function add_meta_boxes_cpt() {
196+
// Shortcode meta box
197+
add_meta_box(
198+
'wplf-shortcode',
199+
__( 'Shortcode', 'wp-libre-form' ),
200+
array( $this, 'metabox_shortcode' ),
201+
'wplf-form',
202+
'normal',
203+
'high'
204+
);
205+
196206
// Messages meta box
197207
add_meta_box(
198208
'wplf-messages',
@@ -232,6 +242,15 @@ function add_meta_boxes_cpt() {
232242
}
233243

234244

245+
/**
246+
* Meta box callback for shortcode meta box
247+
*/
248+
function metabox_shortcode( $post ) {
249+
?>
250+
<p><code>[libre-form id="<?php echo $post->ID; ?>"]</code></p>
251+
<?php
252+
}
253+
235254
/**
236255
* Meta box callback for fields meta box
237256
*/
@@ -350,12 +369,12 @@ function save_cpt( $post_id ) {
350369

351370
// save email copy
352371
if ( isset( $_POST['wplf_email_copy_to'] ) ) {
353-
update_post_meta( $post_id, '_wplf_email_copy_to', sanitize_text_field( $_POST['wplf_email_copy_to'] ) );
372+
update_post_meta( $post_id, '_wplf_email_copy_to', sanitize_email( $_POST['wplf_email_copy_to'] ) );
354373
}
355374

356375
// save title format
357376
if ( isset( $_POST['wplf_title_format'] ) ) {
358-
update_post_meta( $post_id, '_wplf_title_format', esc_html( $_POST['wplf_title_format'] ) );
377+
update_post_meta( $post_id, '_wplf_title_format', $_POST['wplf_title_format'] );
359378
}
360379
}
361380

0 commit comments

Comments
 (0)