From 277fedffc624f55c6ecc8bd80ed8db370134e47e Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Fri, 20 Jan 2023 20:22:06 +0100 Subject: Rename and reorganize more source files. --- .../view-helpers/class-giglogadmin-venueform.php | 52 ++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 includes/view-helpers/class-giglogadmin-venueform.php (limited to 'includes/view-helpers/class-giglogadmin-venueform.php') diff --git a/includes/view-helpers/class-giglogadmin-venueform.php b/includes/view-helpers/class-giglogadmin-venueform.php new file mode 100644 index 0000000..f837d73 --- /dev/null +++ b/includes/view-helpers/class-giglogadmin-venueform.php @@ -0,0 +1,52 @@ + + * SPDX-FileCopyrightText: 2021 Harald Eilertsen + * + * SPDX-License-Identifier: AGPL-3.0-or-later + */ + +if ( ! class_exists( 'GiglogAdmin_VenueForm' ) ) { + class GiglogAdmin_VenueForm { + + public function render() : string { + return '
' + . '

VENUE DETAILS

' + . '
' + . '
' + . wp_nonce_field( 'edit-venue', 'nonce' ) + . '
' + . ' ' + . ' ' + . '
' + . '
' + . ' ' + . ' ' + . '
' + . '
' + . ' ' + . '
' + . '
' + . '' + . '
'; + } + + static function update() : void { + if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 'edit-venue' ) ) { + header( "{$_SERVER['SERVER_PROTOCOL']} 403 Forbidden" ); + wp_die( 'CSRF validation failed.', 403 ); + } + + if ( empty( $_POST['venuename'] ) || empty( $_POST['venuecity'] ) ) { + echo ''; + } else { + GiglogAdmin_Venue::create( $_POST['venuename'], $_POST['venuecity'] ); + echo ''; + } + } + } +} -- cgit v1.2.3