| @@ -1,6 +1,13 @@ | ||
| 1 | 1 | <?php |
| 2 | -// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable | |
| 2 | +/** | |
| 3 | + * Admin header template. | |
| 4 | + * | |
| 5 | + * @package Activitypub | |
| 6 | + */ | |
| 7 | + | |
| 8 | +/* @var array $args Template arguments. */ | |
| 9 | +$args = wp_parse_args( $args ); | |
| 3 | 10 | ?> |
| 4 | 11 | <div class="activitypub-settings-header"> |
| 5 | 12 | <div class="activitypub-settings-title-section"> |
| 6 | 13 | <h1><?php \esc_html_e( 'ActivityPub', 'activitypub' ); ?></h1> |
| @@ -6,22 +13,22 @@ | ||
| 6 | 13 | <h1><?php \esc_html_e( 'ActivityPub', 'activitypub' ); ?></h1> |
| 7 | 14 | </div> |
| 8 | 15 | |
| 9 | 16 | <nav class="activitypub-settings-tabs-wrapper" aria-label="<?php \esc_attr_e( 'Secondary menu', 'activitypub' ); ?>"> |
| 10 | - <a href="<?php echo \esc_url_raw( admin_url( 'options-general.php?page=activitypub' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['welcome'] ); ?>"> | |
| 11 | - <?php \esc_html_e( 'Welcome', 'activitypub' ); ?> | |
| 12 | - </a> | |
| 17 | + <?php | |
| 18 | + foreach ( $args['tabs'] as $slug => $label ) : | |
| 19 | + $url = add_query_arg( | |
| 20 | + array( 'tab' => 'welcome' !== $slug ? $slug : false ), | |
| 21 | + \admin_url( 'options-general.php?page=activitypub' ) | |
| 22 | + ); | |
| 23 | + ?> | |
| 13 | 24 | |
| 14 | - <a href="<?php echo \esc_url_raw( admin_url( 'options-general.php?page=activitypub&tab=settings' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['settings'] ); ?>"> | |
| 15 | - <?php \esc_html_e( 'Settings', 'activitypub' ); ?> | |
| 16 | - </a> | |
| 25 | + <a href="<?php echo \esc_url( $url ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args[ $slug ] ); ?>"> | |
| 26 | + <?php echo \esc_html( $label ); ?> | |
| 27 | + </a> | |
| 17 | 28 | |
| 18 | - <?php if ( ! \Activitypub\is_user_disabled( \Activitypub\Collection\Users::BLOG_USER_ID ) ) : ?> | |
| 19 | - | |
| 20 | - <a href="<?php echo \esc_url_raw( admin_url( 'options-general.php?page=activitypub&tab=followers' ) ); ?>" class="activitypub-settings-tab <?php echo \esc_attr( $args['followers'] ); ?>"> | |
| 21 | - <?php \esc_html_e( 'Followers', 'activitypub' ); ?> | |
| 22 | - </a> | |
| 23 | - | |
| 24 | - <?php endif; ?> | |
| 29 | + <?php | |
| 30 | + endforeach; | |
| 31 | + ?> | |
| 25 | 32 | </nav> |
| 26 | 33 | </div> |
| 27 | 34 | <hr class="wp-header-end"> |