1 | <?php // phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
||
13 | * we need to override the default styles with rtl ones. This is |
||
14 | * achieved by adding 'rtl' class to #wpadminbar div. Apart from that |
||
15 | * the output of render method should be the same as the one of base class. |
||
16 | */ |
||
17 | class RTL_Admin_Bar extends WP_Admin_Bar { |
||
18 | /** |
||
19 | * Display the admin bar. |
||
20 | */ |
||
21 | public function render() { |
||
22 | global $is_IE; |
||
23 | $root = $this->_bind(); |
||
24 | |||
25 | // Add browser and RTL classes. |
||
26 | // We have to do this here since admin bar shows on the front end. |
||
27 | $class = 'nojq nojs rtl'; |
||
28 | if ( $is_IE ) { |
||
29 | if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) ) { |
||
30 | $class .= ' ie7'; |
||
31 | } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) ) { |
||
32 | $class .= ' ie8'; |
||
33 | } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) ) { |
||
34 | $class .= ' ie9'; |
||
35 | } |
||
36 | } elseif ( wp_is_mobile() ) { |
||
37 | $class .= ' mobile'; |
||
38 | } |
||
39 | |||
40 | ?> |
||
41 | <div id="wpadminbar" class="<?php echo esc_attr( $class ); ?>"> |
||
42 | <?php if ( ! is_admin() ) : ?> |
||
43 | <a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php esc_html_e( 'Skip to toolbar', 'jetpack' ); ?></a> |
||
44 | <?php endif; ?> |
||
45 | <div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="<?php esc_attr_e( 'Toolbar', 'jetpack' ); ?>" tabindex="0"> |
||
46 | <?php |
||
47 | foreach ( $root->children as $group ) : |
||
48 | $this->_render_group( $group ); |
||
49 | endforeach; |
||
50 | ?> |
||
51 | </div> |
||
52 | <?php if ( is_user_logged_in() ) : ?> |
||
53 | <a class="screen-reader-shortcut" href="<?php echo esc_url( wp_logout_url() ); ?>"><?php esc_html_e( 'Log Out', 'jetpack' ); ?></a> |
||
54 | <?php endif; ?> |
||
55 | </div> |
||
56 | |||
60 |