| @@ -5,18 +5,29 @@ | ||
| 5 | 5 | * @version 1.0 |
| 6 | 6 | * @package Friends |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -$search = ''; | |
| 10 | -if ( isset( $_GET['s'] ) ) { | |
| 11 | - $search = wp_unslash( $_GET['s'] ); | |
| 9 | +$_search = ''; | |
| 10 | +if ( isset( $_GET['s'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 11 | + $_search = sanitize_text_field( wp_unslash( $_GET['s'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 12 | 12 | } |
| 13 | 13 | |
| 14 | +add_filter( | |
| 15 | + 'document_title_parts', | |
| 16 | + function ( $title ) use ( $args ) { | |
| 17 | + if ( isset( $args['title'] ) ) { | |
| 18 | + $title['title'] = $args['title']; | |
| 19 | + } | |
| 20 | + return $title; | |
| 21 | + } | |
| 22 | +); | |
| 23 | + | |
| 14 | 24 | ?><!DOCTYPE html> |
| 15 | 25 | <html <?php language_attributes(); ?> class="no-js no-svg"> |
| 16 | 26 | <head> |
| 17 | 27 | <meta charset="<?php bloginfo( 'charset' ); ?>"> |
| 18 | 28 | <meta name="viewport" content="width=device-width, initial-scale=1"> |
| 29 | + <meta name="color-scheme" content="light dark"> | |
| 19 | 30 | <?php wp_head(); ?> |
| 20 | 31 | </head> |
| 21 | 32 | |
| 22 | 33 | <body <?php body_class( 'off-canvas off-canvas-sidebar-show' ); ?>> |
| @@ -22,8 +33,10 @@ | ||
| 22 | 33 | <body <?php body_class( 'off-canvas off-canvas-sidebar-show' ); ?>> |
| 23 | 34 | <div id="friends-sidebar" class="off-canvas-sidebar"> |
| 24 | 35 | <div class="friends-brand"> |
| 25 | 36 | <a class="friends-logo" href="<?php echo esc_url( home_url( '/friends/' ) ); ?>"><h2><?php esc_html_e( 'Friends', 'friends' ); ?></h2></a> |
| 37 | + | |
| 38 | + <a class="friends-sidebar-customize" href="<?php echo esc_url( add_query_arg( 'url', home_url( '/friends/' ), admin_url( 'customize.php?autofocus[section]=sidebar-widgets-friends-sidebar' ) ) ); ?>"><?php esc_html_e( 'customize sidebar', 'friends' ); ?></a> | |
| 26 | 39 | </div> |
| 27 | 40 | <div class="friends-nav accordion-container"> |
| 28 | 41 | <?php dynamic_sidebar( 'friends-sidebar' ); ?> |
| 29 | 42 | </div> |
| @@ -31,9 +44,9 @@ | ||
| 31 | 44 | |
| 32 | 45 | <a class="off-canvas-overlay" href="#close"></a> |
| 33 | 46 | |
| 34 | 47 | <div class="off-canvas-content"> |
| 35 | - <header class="<?php echo is_single() ? '' : 'navbar'; ?>"> | |
| 48 | + <header class="<?php echo is_single() ? '' : 'navbar'; ?><?php echo ( isset( $args['no-bottom-margin'] ) && $args['no-bottom-margin'] ) ? ' no-bottom-margin' : ''; ?>"> | |
| 36 | 49 | <section class="navbar-section author"> |
| 37 | 50 | <a class="off-canvas-toggle btn btn-primary bt-action" href="#friends-sidebar"> |
| 38 | 51 | <span class="ab-icon dashicons dashicons-menu-alt2"></span> |
| 39 | 52 | </a> |
| @@ -40,21 +53,29 @@ | ||
| 40 | 53 | <?php |
| 41 | 54 | if ( $args['friend_user'] && $args['friend_user'] instanceof Friends\User && is_singular() ) { |
| 42 | 55 | Friends\Friends::template_loader()->get_template_part( |
| 43 | 56 | 'frontend/single-header', |
| 44 | - null, | |
| 57 | + $args['post_format'], | |
| 45 | 58 | $args |
| 46 | 59 | ); |
| 47 | 60 | } elseif ( $args['friend_user'] && $args['friend_user'] instanceof Friends\User ) { |
| 48 | 61 | Friends\Friends::template_loader()->get_template_part( |
| 49 | 62 | 'frontend/author-header', |
| 50 | - null, | |
| 63 | + $args['post_format'], | |
| 51 | 64 | $args |
| 52 | 65 | ); |
| 66 | + } elseif ( isset( $args['title'] ) ) { | |
| 67 | + ?> | |
| 68 | + <div id="main-header" class="mb-2"> | |
| 69 | + <h2 id="page-title"><a href="<?php echo esc_url( home_url( '/friends/' ) ); ?>"> | |
| 70 | + <?php echo esc_html( $args['title'] ); ?> | |
| 71 | + </a></h2> | |
| 72 | + </div> | |
| 73 | + <?php | |
| 53 | 74 | } else { |
| 54 | 75 | Friends\Friends::template_loader()->get_template_part( |
| 55 | 76 | 'frontend/main-feed-header', |
| 56 | - null, | |
| 77 | + $args['post_format'], | |
| 57 | 78 | $args |
| 58 | 79 | ); |
| 59 | 80 | } |
| 60 | 81 | ?> |
| @@ -59,14 +80,18 @@ | ||
| 59 | 80 | } |
| 60 | 81 | ?> |
| 61 | 82 | |
| 62 | 83 | </section> |
| 63 | - <?php if ( ! is_singular() ) : ?> | |
| 64 | - <section class="navbar-section"> | |
| 84 | + | |
| 85 | + <dialog class="search-dialog"> | |
| 86 | + </dialog> | |
| 87 | + | |
| 88 | + | |
| 89 | + <section class="navbar-section search<?php echo esc_attr( is_singular() ? ' d-hide' : '' ); ?><?php echo esc_attr( ! empty( $args['hide-mobile-search'] ) ? ' hide-mobile-search' : '' ); ?>"> | |
| 65 | 90 | <form class="input-group input-inline form-autocomplete" action="<?php echo esc_url( home_url( '/friends/' ) ); ?>"> |
| 66 | 91 | <div class="form-autocomplete-input form-input"> |
| 67 | 92 | <div class="has-icon-right"> |
| 68 | - <input class="form-input" type="text" tabindex="2" name="s" placeholder="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'Search' ); ?>" value="<?php echo esc_attr( $search ); ?>" id="master-search" autocomplete="off"/> | |
| 93 | + <input class="form-input" type="text" tabindex="2" name="s" placeholder="<?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_attr_e( 'Search or paste URL' ); ?>" value="<?php echo esc_attr( $_search ); ?>" id="master-search" autocomplete="off" data-nonce="<?php echo esc_attr( wp_create_nonce( 'friends-autocomplete' ) ); ?>" /> | |
| 69 | 94 | <i class="form-icon"></i> |
| 70 | 95 | </div> |
| 71 | 96 | </div> |
| 72 | 97 | <ul class="menu" style="display: none"> |
| @@ -73,54 +98,7 @@ | ||
| 73 | 98 | </ul> |
| 74 | 99 | <button class="btn btn-primary input-group-btn"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Search' ); ?></button> |
| 75 | 100 | </form> |
| 76 | 101 | </section> |
| 77 | - <?php endif; ?> | |
| 78 | 102 | </header> |
| 79 | - <form method="post" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" id="quick-post-panel" class="<?php echo isset( $_REQUEST['in_reply_to'] ) ? 'open' : ''; ?>"> | |
| 80 | - <?php wp_nonce_field( 'friends_publish' ); ?> | |
| 81 | - <input type="hidden" name="action" value="friends_publish" /> | |
| 82 | - <input type="hidden" name="format" value="status" /> | |
| 83 | - <input type="hidden" name="status" value="publish" /> | |
| 84 | - <div class="form-group"> | |
| 85 | - <div class="has-icon-right"> | |
| 86 | - Reply to: <input class="form-input" type="url" name="in_reply_to" placeholder="<?php esc_attr_e( 'In reply to https://...', 'friends' ); ?>" value="<?php echo esc_attr( ! empty( $args['in_reply_to'] ) ? $args['in_reply_to']['url'] : '' ); ?>" id="friends_in_reply_to" autocomplete="off"/> | |
| 87 | - <i class="form-icon"></i> | |
| 88 | - </div> | |
| 89 | - </div> | |
| 90 | - <div id="in_reply_to_preview"><?php echo wp_kses_post( ! empty( $args['in_reply_to'] ) ? $args['in_reply_to']['html'] : '' ); ?></div> | |
| 91 | - <p class="description">Click the mentions to copy them into your reply.</p> | |
| 92 | - <div class="form-group<?php echo esc_attr( $args['blocks-everywhere'] ? ' blocks-everywhere iso-editor__loading' : '' ); ?>"> | |
| 93 | - <textarea class="form-input friends-status-content<?php echo esc_attr( $args['blocks-everywhere'] ? ' blocks-everywhere-enabled' : '' ); ?>" name="content" rows="5" cols="70" placeholder="<?php echo /* translators: %s is a user display name. */ esc_attr( sprintf( __( "What's on your mind, %s?", 'friends' ), wp_get_current_user()->display_name ) ); ?>"><?php echo wp_kses_post( ! empty( $args['in_reply_to'] ) ? ( $args['blocks-everywhere'] ? '<!-- wp:paragraph -->' . PHP_EOL . '<p>' . $args['in_reply_to']['mention'] . PHP_EOL . '</p>' . PHP_EOL . '<!-- /wp:paragraph -->' . PHP_EOL : $args['in_reply_to']['mention'] . ' ' ) : '' ); ?></textarea><br /> | |
| 94 | - <?php | |
| 95 | - do_action( 'friends_post_status_form' ); | |
| 96 | - ?> | |
| 97 | - </div> | |
| 98 | - | |
| 99 | - <div class="form-group col-4"> | |
| 100 | - <select name="status" class="form-select"> | |
| 101 | - <option value="publish"><?php esc_html_e( 'Visible to everyone', 'friends' ); ?></option> | |
| 102 | - <option value="private"><?php esc_html_e( 'Only visible to my friends', 'friends' ); ?></option> | |
| 103 | - </select> | |
| 104 | - </div> | |
| 105 | - | |
| 106 | - <div class="form-group col-4"> | |
| 107 | - <p> | |
| 108 | - <?php | |
| 109 | - echo esc_html( | |
| 110 | - sprintf( | |
| 111 | - // translators: %s is the name of a post format. | |
| 112 | - __( 'Post Format: %s', 'friends' ), | |
| 113 | - __( 'Status' ) // phpcs:ignore WordPress.WP.I18n.MissingArgDomain | |
| 114 | - ) | |
| 115 | - ); | |
| 116 | - ?> | |
| 117 | - </p> | |
| 118 | - </div> | |
| 119 | - | |
| 120 | - <div class="form-group"> | |
| 121 | - <button class="btn"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Publish' ); ?></button> | |
| 122 | - <a href="#" class="quick-post-panel-toggle"><?php /* phpcs:ignore WordPress.WP.I18n.MissingArgDomain */ esc_html_e( 'Cancel' ); ?></a> | |
| 123 | - </div> | |
| 124 | - </form> | |
| 125 | -<?php | |
| 126 | -do_action( 'friends_after_header', $args ); | |
| 103 | + <?php | |
| 104 | + do_action( 'friends_after_header', $args ); | |