@@ -104,7 +104,7 @@ public static function register_cpt() {
104104 /**
105105 * Modify post.php permalink html to show notice if form isn't publicly visible.
106106 */
107- function modify_permalink_html ( $ html , $ post_id ) {
107+ public function modify_permalink_html ( $ html , $ post_id ) {
108108 $ publicly_visible = $ this ->get_publicly_visible_state ( $ post_id );
109109
110110 if ( get_post_type ( $ post_id ) === 'wplf-form ' && ! $ publicly_visible ) {
@@ -119,7 +119,7 @@ function modify_permalink_html( $html, $post_id ) {
119119 /**
120120 * Disable TinyMCE editor for forms, which are simple HTML things
121121 */
122- function disable_tinymce ( $ default ) {
122+ public function disable_tinymce ( $ default ) {
123123 global $ post ;
124124
125125 // only for this cpt
@@ -133,7 +133,7 @@ function disable_tinymce( $default ) {
133133 /**
134134 * Include custom JS on the edit screen
135135 */
136- function admin_post_scripts_cpt ( $ hook ) {
136+ public function admin_post_scripts_cpt ( $ hook ) {
137137 global $ post ;
138138
139139 // make sure we're on the correct view
@@ -154,7 +154,7 @@ function admin_post_scripts_cpt( $hook ) {
154154 /**
155155 * Pre-populate form editor with default content
156156 */
157- function default_content_cpt ( $ content ) {
157+ public function default_content_cpt ( $ content ) {
158158 global $ pagenow ;
159159
160160 // only on post.php screen
@@ -205,7 +205,7 @@ function remove_row_actions( $actions, $post ) {
205205 /**
206206 * Custom columns in edit.php for Forms
207207 */
208- function custom_columns_cpt ( $ columns ) {
208+ public function custom_columns_cpt ( $ columns ) {
209209 $ new_columns = array (
210210 'cb ' => $ columns ['cb ' ],
211211 'title ' => $ columns ['title ' ],
@@ -220,7 +220,7 @@ function custom_columns_cpt( $columns ) {
220220 /**
221221 * Custom column display for Form CPT in edit.php
222222 */
223- function custom_columns_display_cpt ( $ column , $ post_id ) {
223+ public function custom_columns_display_cpt ( $ column , $ post_id ) {
224224 if ( 'shortcode ' === $ column ) {
225225?>
226226<input type="text" class="code" value='[libre-form id="<?php echo intval ( $ post_id ); ?> "]' readonly>
@@ -247,7 +247,7 @@ function custom_columns_display_cpt( $column, $post_id ) {
247247 /**
248248 * Add meta box to show fields in form
249249 */
250- function add_meta_boxes_cpt () {
250+ public function add_meta_boxes_cpt () {
251251 // Shortcode meta box
252252 add_meta_box (
253253 'wplf-shortcode ' ,
@@ -301,7 +301,7 @@ function add_meta_boxes_cpt() {
301301 /**
302302 * Meta box callback for shortcode meta box
303303 */
304- function metabox_shortcode ( $ post ) {
304+ public function metabox_shortcode ( $ post ) {
305305?>
306306<p><input type="text" class="code" value='[libre-form id="<?php echo esc_attr ( $ post ->ID ); ?> "]' readonly></p>
307307<?php
@@ -333,7 +333,7 @@ function metabox_thank_you( $post ) {
333333 /**
334334 * Meta box callback for form fields meta box
335335 */
336- function metabox_form_fields () {
336+ public function metabox_form_fields () {
337337?>
338338<p><?php esc_html_e ( 'Fields marked with * are required ' , 'wp-libre-form ' ); ?> </p>
339339<div class="wplf-form-field-container">
@@ -347,7 +347,7 @@ function metabox_form_fields() {
347347 /**
348348 * Meta box callback for submit email meta box
349349 */
350- function metabox_submit_email ( $ post ) {
350+ public function metabox_submit_email ( $ post ) {
351351 // get post meta
352352 $ meta = get_post_meta ( $ post ->ID );
353353 $ email_enabled = isset ( $ meta ['_wplf_email_copy_enabled ' ] ) ? $ meta ['_wplf_email_copy_enabled ' ][0 ] : true ;
@@ -438,7 +438,7 @@ function metabox_submit_email( $post ) {
438438 /**
439439 * Meta box callback for submission title format
440440 */
441- function meta_box_title_format ( $ post ) {
441+ public function meta_box_title_format ( $ post ) {
442442 // get post meta
443443 $ meta = get_post_meta ( $ post ->ID );
444444 $ default = '%name% <%email%> ' ; // default submission title format
@@ -463,7 +463,7 @@ class="code"
463463 /**
464464 * Handles saving our post meta
465465 */
466- function save_cpt ( $ post_id ) {
466+ public function save_cpt ( $ post_id ) {
467467 // verify nonce
468468 if ( ! isset ( $ _POST ['wplf_form_meta_nonce ' ] ) ) {
469469 return ;
@@ -577,15 +577,15 @@ function save_cpt( $post_id ) {
577577 *
578578 * We apply <form> via the shortcode, you can't have nested forms anyway
579579 */
580- function strip_form_tags ( $ content ) {
580+ public function strip_form_tags ( $ content ) {
581581 return preg_replace ( '/<\/?form.*>/i ' , '' , $ content );
582582 }
583583
584584
585585 /**
586586 * The function we display the form with
587587 */
588- function wplf_form ( $ id , $ content = '' , $ xclass = '' , $ attributes = [] ) {
588+ public function wplf_form ( $ id , $ content = '' , $ xclass = '' , $ attributes = [] ) {
589589 global $ post ;
590590
591591 if ( 'publish ' === get_post_status ( $ id ) || 'true ' === $ _GET ['preview ' ] ) {
@@ -663,7 +663,7 @@ class="libre-form libre-form-<?php echo esc_attr( $id . ' ' . $xclass ); ?>"
663663 /**
664664 * Enqueue the front end JS
665665 */
666- function maybe_enqueue_frontend_script () {
666+ public function maybe_enqueue_frontend_script () {
667667 global $ post ;
668668
669669 // register the script, but only enqueue it if the current post contains a form in it
@@ -687,7 +687,7 @@ function maybe_enqueue_frontend_script() {
687687 /**
688688 * Shortcode for displaying a Form
689689 */
690- function shortcode ( $ shortcode_atts , $ content = null ) {
690+ public function shortcode ( $ shortcode_atts , $ content = null ) {
691691 $ attributes = shortcode_atts ( array (
692692 'id ' => null ,
693693 'xclass ' => '' ,
@@ -709,7 +709,7 @@ function shortcode( $shortcode_atts, $content = null ) {
709709 /**
710710 * Use the shortcode for previewing forms
711711 */
712- function use_shortcode_for_preview ( $ content ) {
712+ public function use_shortcode_for_preview ( $ content ) {
713713 global $ post ;
714714 if ( ! isset ( $ post ->post_type ) || $ post ->post_type !== 'wplf-form ' ) {
715715 return $ content ;
@@ -721,7 +721,7 @@ function use_shortcode_for_preview( $content ) {
721721 * Set and show 404 page for visitors trying to see single form.
722722 * And yes, it is a global $post. That's right.
723723 */
724- function maybe_set_404_for_single_form () {
724+ public function maybe_set_404_for_single_form () {
725725 global $ post ;
726726
727727 if ( ! is_singular ( 'wplf-form ' ) ) {
@@ -742,14 +742,14 @@ function maybe_set_404_for_single_form() {
742742 /**
743743 * Wrapper function to check if form is publicly visible.
744744 */
745- function get_publicly_visible_state ( $ id ) {
745+ public function get_publicly_visible_state ( $ id ) {
746746 return apply_filters ( 'wplf-form-publicly-visible ' , false , $ id );
747747 }
748748
749749 /**
750750 * A very simple uglify. Just removes line breaks from html
751751 */
752- function minify_html ( $ html ) {
752+ public function minify_html ( $ html ) {
753753 return str_replace ( array ( "\n" , "\r" ), ' ' , $ html );
754754 }
755755}
0 commit comments