Skip to content

Commit

Permalink
#8 Basic認証を出力する部分を作成
Browse files Browse the repository at this point in the history
  • Loading branch information
fumikito committed Feb 11, 2024
1 parent bccc0df commit 75e6b75
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion lib/WCTokyo/WpCheckin/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [];
Expand Down Expand Up @@ -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;
}

}

/**
Expand All @@ -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
}
}

0 comments on commit 75e6b75

Please sign in to comment.