@@ -105,7 +105,7 @@ public static function register_cpt() {
105105 /**
106106 * Modify post.php permalink html to show notice if form isn't publicly visible.
107107 */
108- function modify_permalink_html ( $ html , $ post_id ) {
108+ public function modify_permalink_html ( $ html , $ post_id ) {
109109 $ publicly_visible = $ this ->get_publicly_visible_state ( $ post_id );
110110
111111 if ( get_post_type ( $ post_id ) === 'wplf-form ' && ! $ publicly_visible ) {
@@ -120,7 +120,7 @@ function modify_permalink_html( $html, $post_id ) {
120120 /**
121121 * Disable TinyMCE editor for forms, which are simple HTML things
122122 */
123- function disable_tinymce ( $ default ) {
123+ public function disable_tinymce ( $ default ) {
124124 global $ post ;
125125
126126 // only for this cpt
@@ -134,7 +134,7 @@ function disable_tinymce( $default ) {
134134 /**
135135 * Include custom JS and CSS on the edit screen
136136 */
137- function admin_post_scripts_cpt ( $ hook ) {
137+ public function admin_post_scripts_cpt ( $ hook ) {
138138 global $ post ;
139139
140140 // make sure we're on the correct view
@@ -160,7 +160,7 @@ function admin_post_scripts_cpt( $hook ) {
160160 /**
161161 * Pre-populate form editor with default content
162162 */
163- function default_content_cpt ( $ content ) {
163+ public function default_content_cpt ( $ content ) {
164164 global $ pagenow ;
165165
166166 // only on post.php screen
@@ -211,7 +211,7 @@ function remove_row_actions( $actions, $post ) {
211211 /**
212212 * Custom columns in edit.php for Forms
213213 */
214- function custom_columns_cpt ( $ columns ) {
214+ public function custom_columns_cpt ( $ columns ) {
215215 $ new_columns = array (
216216 'cb ' => $ columns ['cb ' ],
217217 'title ' => $ columns ['title ' ],
@@ -226,7 +226,7 @@ function custom_columns_cpt( $columns ) {
226226 /**
227227 * Custom column display for Form CPT in edit.php
228228 */
229- function custom_columns_display_cpt ( $ column , $ post_id ) {
229+ public function custom_columns_display_cpt ( $ column , $ post_id ) {
230230 if ( 'shortcode ' === $ column ) {
231231?>
232232<input type="text" class="code" value='[libre-form id="<?php echo intval ( $ post_id ); ?> "]' readonly>
@@ -253,7 +253,7 @@ function custom_columns_display_cpt( $column, $post_id ) {
253253 /**
254254 * Add meta box to show fields in form
255255 */
256- function add_meta_boxes_cpt () {
256+ public function add_meta_boxes_cpt () {
257257 // Shortcode meta box
258258 add_meta_box (
259259 'wplf-shortcode ' ,
@@ -307,7 +307,7 @@ function add_meta_boxes_cpt() {
307307 /**
308308 * Meta box callback for shortcode meta box
309309 */
310- function metabox_shortcode ( $ post ) {
310+ public function metabox_shortcode ( $ post ) {
311311?>
312312<p><input type="text" class="code" value='[libre-form id="<?php echo esc_attr ( $ post ->ID ); ?> "]' readonly></p>
313313<?php
@@ -339,7 +339,7 @@ function metabox_thank_you( $post ) {
339339 /**
340340 * Meta box callback for form fields meta box
341341 */
342- function metabox_form_fields () {
342+ public function metabox_form_fields () {
343343?>
344344<p><?php esc_html_e ( 'Fields marked with * are required ' , 'wp-libre-form ' ); ?> </p>
345345<div class="wplf-form-field-container">
@@ -353,7 +353,7 @@ function metabox_form_fields() {
353353 /**
354354 * Meta box callback for submit email meta box
355355 */
356- function metabox_submit_email ( $ post ) {
356+ public function metabox_submit_email ( $ post ) {
357357 // get post meta
358358 $ meta = get_post_meta ( $ post ->ID );
359359 $ email_enabled = isset ( $ meta ['_wplf_email_copy_enabled ' ] ) ? $ meta ['_wplf_email_copy_enabled ' ][0 ] : true ;
@@ -444,7 +444,7 @@ function metabox_submit_email( $post ) {
444444 /**
445445 * Meta box callback for submission title format
446446 */
447- function meta_box_title_format ( $ post ) {
447+ public function meta_box_title_format ( $ post ) {
448448 // get post meta
449449 $ meta = get_post_meta ( $ post ->ID );
450450 $ default = '%name% <%email%> ' ; // default submission title format
@@ -602,7 +602,7 @@ protected function maybe_persist_override_template( $template, $form_id, $force
602602 /**
603603 * Handles saving our post meta
604604 */
605- function save_cpt ( $ post_id ) {
605+ public function save_cpt ( $ post_id ) {
606606 // verify nonce
607607 if ( ! isset ( $ _POST ['wplf_form_meta_nonce ' ] ) ) {
608608 return ;
@@ -716,15 +716,15 @@ function save_cpt( $post_id ) {
716716 *
717717 * We apply <form> via the shortcode, you can't have nested forms anyway
718718 */
719- function strip_form_tags ( $ content ) {
719+ public function strip_form_tags ( $ content ) {
720720 return preg_replace ( '/<\/?form.*>/i ' , '' , $ content );
721721 }
722722
723723
724724 /**
725725 * The function we display the form with
726726 */
727- function wplf_form ( $ id , $ content = '' , $ xclass = '' , $ attributes = [] ) {
727+ public function wplf_form ( $ id , $ content = '' , $ xclass = '' , $ attributes = [] ) {
728728 global $ post ;
729729 $ preview = ! empty ( $ _GET ['preview ' ] ) ? $ _GET ['preview ' ] : false ;
730730
@@ -803,7 +803,7 @@ class="libre-form libre-form-<?php echo esc_attr( $id . ' ' . $xclass ); ?>"
803803 /**
804804 * Enqueue the front end JS
805805 */
806- function maybe_enqueue_frontend_script () {
806+ public function maybe_enqueue_frontend_script () {
807807 global $ post ;
808808
809809 // register the script, but only enqueue it if the current post contains a form in it
@@ -827,7 +827,7 @@ function maybe_enqueue_frontend_script() {
827827 /**
828828 * Shortcode for displaying a Form
829829 */
830- function shortcode ( $ shortcode_atts , $ content = null ) {
830+ public function shortcode ( $ shortcode_atts , $ content = null ) {
831831 $ attributes = shortcode_atts ( array (
832832 'id ' => null ,
833833 'xclass ' => '' ,
@@ -849,7 +849,7 @@ function shortcode( $shortcode_atts, $content = null ) {
849849 /**
850850 * Use the shortcode for previewing forms
851851 */
852- function use_shortcode_for_preview ( $ content ) {
852+ public function use_shortcode_for_preview ( $ content ) {
853853 global $ post ;
854854 if ( ! isset ( $ post ->post_type ) || $ post ->post_type !== 'wplf-form ' ) {
855855 return $ content ;
@@ -861,7 +861,7 @@ function use_shortcode_for_preview( $content ) {
861861 * Set and show 404 page for visitors trying to see single form.
862862 * And yes, it is a global $post. That's right.
863863 */
864- function maybe_set_404_for_single_form () {
864+ public function maybe_set_404_for_single_form () {
865865 global $ post ;
866866
867867 if ( ! is_singular ( 'wplf-form ' ) ) {
@@ -882,14 +882,14 @@ function maybe_set_404_for_single_form() {
882882 /**
883883 * Wrapper function to check if form is publicly visible.
884884 */
885- function get_publicly_visible_state ( $ id ) {
885+ public function get_publicly_visible_state ( $ id ) {
886886 return apply_filters ( 'wplf-form-publicly-visible ' , false , $ id );
887887 }
888888
889889 /**
890890 * A very simple uglify. Just removes line breaks from html
891891 */
892- function minify_html ( $ html ) {
892+ public function minify_html ( $ html ) {
893893 return str_replace ( array ( "\n" , "\r" ), ' ' , $ html );
894894 }
895895}
0 commit comments