feat: add standalone form page, close all audit gaps, pass v1.0 milestone
Add standalone form page template that bypasses the theme, with admin setting and auto-creation on plugin activation. Fix reCAPTCHA v3 double submission, remove jQuery dependency, extend localized JS strings, and overhaul form CSS/JS. Update milestone audit to PASSED (9/9, 10/10, 5/5). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -92,6 +92,30 @@ class Umzugsliste {
|
||||
*/
|
||||
private function init_hooks() {
|
||||
add_action( 'init', array( $this, 'init' ) );
|
||||
add_filter( 'template_include', array( $this, 'maybe_load_form_template' ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Load standalone form template if current page is the configured form page
|
||||
*
|
||||
* @param string $template Current template path
|
||||
* @return string Template path
|
||||
*/
|
||||
public function maybe_load_form_template( $template ) {
|
||||
if ( is_admin() || ! is_page() ) {
|
||||
return $template;
|
||||
}
|
||||
|
||||
$form_page_id = (int) get_option( 'umzugsliste_form_page_id', 0 );
|
||||
|
||||
if ( $form_page_id > 0 && is_page( $form_page_id ) ) {
|
||||
$custom_template = UMZUGSLISTE_PLUGIN_DIR . 'templates/form-page.php';
|
||||
if ( file_exists( $custom_template ) ) {
|
||||
return $custom_template;
|
||||
}
|
||||
}
|
||||
|
||||
return $template;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -126,6 +150,20 @@ function umzugsliste_activate() {
|
||||
require_once UMZUGSLISTE_PLUGIN_DIR . 'includes/class-cpt.php';
|
||||
Umzugsliste_CPT::get_instance();
|
||||
|
||||
// Auto-create form page if none exists
|
||||
$form_page_id = (int) get_option( 'umzugsliste_form_page_id', 0 );
|
||||
if ( $form_page_id <= 0 || ! get_post( $form_page_id ) ) {
|
||||
$page_id = wp_insert_post( array(
|
||||
'post_title' => 'Umzugsliste',
|
||||
'post_content' => '',
|
||||
'post_status' => 'publish',
|
||||
'post_type' => 'page',
|
||||
) );
|
||||
if ( $page_id && ! is_wp_error( $page_id ) ) {
|
||||
update_option( 'umzugsliste_form_page_id', $page_id );
|
||||
}
|
||||
}
|
||||
|
||||
// Flush rewrite rules
|
||||
flush_rewrite_rules();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user