kompass/modules/event-participants/Controllers/class-signuppage.php

24 lines
718 B
PHP
Raw Permalink Normal View History

2024-05-27 16:59:30 +02:00
<?php
namespace Bdp\Modules\EventParticipants\Controllers;
use function Bdp\Modules\EventParticipants\Views\registrationForm;
class EventSignupPageController
{
public static function print_signup_page($content) : string {
// Der zu ersetzende String
$pattern = '/{{event-(\d+)}}/';
if (preg_match($pattern, $content, $matches)) {
if (isset($_POST['eventId'])) {
$content = preg_replace($pattern, ParticipationSignupController::saveRegistration($_POST), $content);
} else {
$eventId = $matches[1];
$url = str_replace(get_site_url(), '', get_permalink());
$content = preg_replace( $pattern, registrationForm( $eventId, $url ), $content );
}
}
return $content;
}
}