From 75e6b7535319b94da1398bcacfc5844c891796e7 Mon Sep 17 00:00:00 2001 From: fumikito Date: Sun, 11 Feb 2024 11:35:22 +0900 Subject: [PATCH] =?UTF-8?q?#8=20Basic=E8=AA=8D=E8=A8=BC=E3=82=92=E5=87=BA?= =?UTF-8?q?=E5=8A=9B=E3=81=99=E3=82=8B=E9=83=A8=E5=88=86=E3=82=92=E4=BD=9C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/WCTokyo/WpCheckin/Router.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/WCTokyo/WpCheckin/Router.php b/lib/WCTokyo/WpCheckin/Router.php index 643a27f..416a5f5 100644 --- a/lib/WCTokyo/WpCheckin/Router.php +++ b/lib/WCTokyo/WpCheckin/Router.php @@ -46,6 +46,7 @@ public function pre_get_posts( $wp_query ) { return; } if ( in_array( $is_checkin, [ 'archive', 'single' ], true ) ) { + $do_auth_header = true; wp_enqueue_style( 'wp-checkin' ); // Load template and exit. $args = []; @@ -78,13 +79,16 @@ public function pre_get_posts( $wp_query ) { ] ); remove_action( 'wp_head', 'feed_links_extra', 3 ); // Do authorization header. + if ( $do_auth_header ) { + $this->do_authorization_header(); + } + // Render hijacked template. do_action( 'template_redirect' ); wp_checkin_template( 'template-parts/header', $args ); wp_checkin_template( 'template-parts/' . $is_checkin, $args ); wp_checkin_template( 'template-parts/footer', $args ); exit; } - } /** @@ -98,4 +102,13 @@ public function add_rewrite_rules() { add_rewrite_rule( '^checkin/page/(\d+)/?$', 'index.php?checkin=archive&paged=$matches[1]', 'top' ); add_rewrite_rule( '^checkin/ticket/(\d+)/?$', 'index.php?checkin=single&p=$matches[1]', 'top' ); } + + /** + * Do authorization header. + * + * @return void + */ + public function do_authorization_header() { + // W.I.P + } }