<?php

// No app header on the drafts or pages page
if ( isset( $_GET['drafts'] ) || isset( $_GET['pages'] ) ) {
	return;
}

global $o2;

$o2_title   = $o2->options['options']['pageTitle'];
$show_title = ! is_search();

?><header class="o2-app-header">
	<?php if ( $show_title && $o2_title !== '' ) : ?>
		<h2 class="o2-app-page-title">
			<?php echo esc_html( $o2_title ); ?>
		</h2>
	<?php endif; ?>

	<span class="o2-app-controls">
		<?php \Automattic\P2\Themes\P2020\Filter\print_filter_controls(); ?>

		<?php if ( is_home() && current_user_can( 'publish_posts' ) && isset( $o2->options['options']['feedId'] ) ) : ?>
			<a href="#" class="p2-mark-all-as-seen" data-feed-id="<?php echo esc_attr( $o2->options['options']['feedId'] ); ?>">
				<?php echo esc_html( __( 'Mark all as seen', 'p2020' ) ); ?>
			</a>
		<?php endif; ?>

		<?php
		global $wp_query;
		if ( is_home() && Automattic\P2\Plugins\Core\Feed_Modifiers\Utils::should_apply_feed_modifiers( $wp_query ) ) {
			\Automattic\P2\Plugins\Core\Feed_Modifiers\Control_Menu::print_feed_modifier_controls();
		}
		?>

		<?php \Automattic\P2\Themes\P2020\View_Selector::print_view_selector(); ?>
	</span>
</header>