Reduce PHP/HTML mode-switch overhead

Probably impossible to notice, but still.
This commit is contained in:
Tetrakern 2024-05-17 12:29:52 +02:00
parent d136d97c13
commit c384de6e01
34 changed files with 73 additions and 92 deletions

View File

@ -6,16 +6,15 @@
* @subpackage Fictioneer
* @since 4.7.0
*/
?>
<?php
// Setup
$custom_404 = intval( get_option( 'fictioneer_404_page', -1 ) ?: -1 );
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main singular the-404">

View File

@ -7,9 +7,7 @@
* @since 4.6.0
* @see fictioneer_clause_sticky_stories()
*/
?>
<?php
// Get queried author
$author_id = get_queried_object_id();
@ -88,9 +86,10 @@ if ( ! array_key_exists( $current_tab, $tabs ) ) {
// Select tab
$tabs[ $current_tab ]['classes'][] = '_current';
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main author-page singular">

View File

@ -7,9 +7,12 @@
* @since 3.0
* @see partials/_archive-loop.php
*/
?>
<?php get_header(); ?>
// Header
get_header();
?>
<main id="main" class="main archive category-archive">

View File

@ -10,9 +10,7 @@
* @subpackage Fictioneer
* @since 3.0
*/
?>
<?php
// Setup
$post_id = get_the_ID();
@ -88,9 +86,10 @@ if ( function_exists( 'update_post_author_caches' ) ) {
update_post_author_caches( $list_of_chapters->posts );
}
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main singular chapters">

View File

@ -10,9 +10,7 @@
* @subpackage Fictioneer
* @since 5.0.0
*/
?>
<?php
// Setup
$post_id = get_the_ID();
@ -48,9 +46,10 @@ if ( function_exists( 'update_post_author_caches' ) ) {
update_post_author_caches( $list_of_collections->posts );
}
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main singular collections">

View File

@ -8,9 +8,7 @@
* @subpackage Fictioneer
* @since 4.7.0
*/
?>
<?php
// Don't show the comments if the password has not been entered
if ( post_password_required() ) {

View File

@ -18,9 +18,7 @@
* @internal $args['post_type'] Optional. Current post type.
* @internal $args['breadcrumbs'] Array of breadcrumb tuples with label (0) and link (1).
*/
?>
<?php
// Setup
$page_id = get_queried_object_id();

View File

@ -17,9 +17,7 @@
*
* @internal $args Array of arguments passed to the template.
*/
?>
<?php
if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
global $fictioneer_render_start_time;

View File

@ -10,9 +10,12 @@
* @since 4.6.0
* @see partials/_loop.php
*/
?>
<?php get_header(); ?>
// Header
get_header();
?>
<main id="main" class="main index">

View File

@ -10,9 +10,7 @@
* @subpackage Fictioneer
* @since 3.0
*/
?>
<?php
// Setup
$post_id = get_the_ID();
@ -48,9 +46,10 @@ if ( function_exists( 'update_post_author_caches' ) ) {
update_post_author_caches( $list_of_recommendations->posts );
}
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main singular recommendations">

View File

@ -7,9 +7,7 @@
* @since 5.0.0
* @since 5.11.0 - Consider querying for story status.
*/
?>
<?php
global $wp_query;
@ -64,9 +62,10 @@ $is_advanced_search = $post_type != 'any' || $sentence != '0' || $order != 'desc
$hook_args['is_advanced_search'] = $is_advanced_search;
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main search-results">
<div class="observer main-observer"></div>

View File

@ -12,9 +12,7 @@
* @internal $args['preselect_type'] Optional. Default post type to query.
* @internal $args['cache'] Whether to account for active caching.
*/
?>
<?php
// Setup
$no_params = empty( array_filter( $_GET ) );

View File

@ -9,9 +9,7 @@
* @since 1.0
* @see comments.php
*/
?>
<?php
// Setup
$password_required = post_password_required();

View File

@ -13,9 +13,7 @@
* @see partials/_collection-header.php
* @see partials/_collection-statistics.php
*/
?>
<?php
// Header
get_header( null, array( 'type' => 'fcn_collection' ) );

View File

@ -9,9 +9,7 @@
* @since 4.0.0
* @see partials/_recommendation-header.php
*/
?>
<?php
// Setup
$password_required = post_password_required();

View File

@ -10,9 +10,7 @@
* @see partials/_story-header.php
* @see partials/_story-footer.php
*/
?>
<?php
// Setup
$post_id = $args['post_id'] ?? get_the_ID();

View File

@ -6,9 +6,7 @@
* @subpackage Fictioneer
* @since 1.0
*/
?>
<?php
// Setup
$password_required = post_password_required();

View File

@ -11,9 +11,7 @@
* @subpackage Fictioneer
* @since 4.6.0
*/
?>
<?php
// Return home if bookmarks are disabled
if ( ! get_option( 'fictioneer_enable_bookmarks' ) ) {
@ -21,9 +19,10 @@ if ( ! get_option( 'fictioneer_enable_bookmarks' ) ) {
exit();
}
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main singular bookmarks-page">

View File

@ -10,9 +10,7 @@
* @subpackage Fictioneer
* @since 5.0.0
*/
?>
<?php
// Setup
$current_tab = sanitize_key( $_GET['tab'] ?? '' );
@ -65,9 +63,10 @@ if ( ! array_key_exists( $current_tab, $tabs ) ) {
// Select tab
$tabs[ $current_tab ]['classes'][] = '_current';
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main singular bookshelf">

View File

@ -10,9 +10,7 @@
* @subpackage Fictioneer
* @since 5.0.0
*/
?>
<?php
// Only for logged-in users...
if ( ! is_user_logged_in() || get_option( 'fictioneer_enable_public_cache_compatibility' ) ) {
@ -81,9 +79,10 @@ if ( ! array_key_exists( $current_tab, $tabs ) ) {
// Select tab
$tabs[ $current_tab ]['classes'][] = '_current';
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main singular bookshelf">

View File

@ -6,9 +6,7 @@
* @subpackage Fictioneer
* @since 5.14.0
*/
?>
<?php
// Setup
$post_id = get_the_ID();

View File

@ -6,9 +6,7 @@
* @subpackage Fictioneer
* @since 5.14.0
*/
?>
<?php
// Setup
$post_id = get_the_ID();

View File

@ -8,9 +8,7 @@
* @see partials/_story-header.php
* @see partials/_story-footer.php
*/
?>
<?php
// Setup
$post_id = get_post_meta( get_the_ID(), 'fictioneer_template_story_id', true );
@ -23,3 +21,5 @@ if ( ! $post_id ) {
$post = get_post( $post_id );
get_template_part( 'single-fcn_story', null, array( 'post_id' => $post_id ) );
?>

View File

@ -7,9 +7,7 @@
* @since 5.14.0
* @see comments.php
*/
?>
<?php
// Setup
$post_id = get_the_ID();

View File

@ -6,9 +6,7 @@
* @subpackage Fictioneer
* @since 5.0.0
*/
?>
<?php
// Queries
$tags = get_terms(
@ -54,9 +52,10 @@ $terms = array(
'characters' => [__( 'Characters', 'fictioneer' ), $characters]
);
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main singular">

View File

@ -7,9 +7,7 @@
* @since 1.0
* @see comments.php
*/
?>
<?php
// Setup
$post_id = get_the_ID();

View File

@ -7,9 +7,7 @@
* @since 1.0
* @see comments.php
*/
?>
<?php
// Setup
$post_id = get_the_ID();

View File

@ -11,9 +11,7 @@
* @since 3.0
* @see fictioneer_clause_sticky_stories()
*/
?>
<?php
// Setup
$post_id = get_the_ID();
@ -95,9 +93,10 @@ if ( function_exists( 'update_post_author_caches' ) ) {
update_post_author_caches( $list_of_stories->posts );
}
?>
// Header
get_header();
<?php get_header(); ?>
?>
<main id="main" class="main singular stories">

View File

@ -8,9 +8,12 @@
* @see wp_tag_cloud()
* @see partials/_archive-loop.php
*/
?>
<?php get_header(); ?>
// Header
get_header();
?>
<main id="main" class="main archive tag-archive">

View File

@ -7,9 +7,12 @@
* @since 4.0.0
* @see partials/_archive-loop.php
*/
?>
<?php get_header(); ?>
// Header
get_header();
?>
<main id="main" class="main archive character-archive">

View File

@ -7,9 +7,12 @@
* @since 4.6.0
* @see partials/_archive-loop.php
*/
?>
<?php get_header(); ?>
// Header
get_header();
?>
<main id="main" class="main archive content-warning-archive">

View File

@ -7,9 +7,12 @@
* @since 4.0.0
* @see partials/_archive-loop.php
*/
?>
<?php get_header(); ?>
// Header
get_header();
?>
<main id="main" class="main archive fandom-archive">

View File

@ -7,9 +7,12 @@
* @since 4.6.0
* @see partials/_archive-loop.php
*/
?>
<?php get_header(); ?>
// Header
get_header();
?>
<main id="main" class="main archive genre-archive">

View File

@ -10,9 +10,7 @@
* @subpackage Fictioneer
* @since 4.5.0
*/
?>
<?php
// Only for logged-in users...
if ( ! is_user_logged_in() && ! get_option( 'fictioneer_enable_public_cache_compatibility' ) ) {
@ -57,9 +55,10 @@ $hook_args = array(
'is_moderator' => $is_moderator
);
?>
// Header
get_header( null, array( 'type' => 'user-profile' ) );
<?php get_header( null, array( 'type' => 'user-profile' ) ); ?>
?>
<main id="main" class="main singular profile">