RTL_Admin_Bar

We are using this class to replace core WP_Admin_Bar in cases when we need to override the default styles with rtl ones.

Defined (1)

The class is defined in the following location(s).

/modules/masterbar/rtl-admin-bar.php  
  1. class RTL_Admin_Bar extends WP_Admin_Bar { 
  2. function render() { 
  3. global $is_IE; 
  4. $root = $this->_bind(); 
  5.  
  6. // Add browser and RTL classes. 
  7. // We have to do this here since admin bar shows on the front end. 
  8. $class = 'nojq nojs rtl'; 
  9. if ( $is_IE ) { 
  10. if ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 7' ) ) { 
  11. $class .= ' ie7'; 
  12. } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 8' ) ) { 
  13. $class .= ' ie8'; 
  14. } elseif ( strpos( $_SERVER['HTTP_USER_AGENT'], 'MSIE 9' ) ) { 
  15. $class .= ' ie9'; 
  16. } elseif ( wp_is_mobile() ) { 
  17. $class .= ' mobile'; 
  18.  
  19. ?> 
  20. <div id="wpadminbar" class="<?php echo $class; ?>"> 
  21. <?php if ( ! is_admin() ) : ?> 
  22. <a class="screen-reader-shortcut" href="#wp-toolbar" tabindex="1"><?php _e( 'Skip to toolbar', 'jetpack' ); ?></a> 
  23. <?php endif; ?> 
  24. <div class="quicklinks" id="wp-toolbar" role="navigation" aria-label="<?php esc_attr_e( 'Toolbar', 'jetpack' ); ?>" tabindex="0"> 
  25. <?php 
  26. foreach ( $root->children as $group ) : 
  27. $this->_render_group( $group ); 
  28. endforeach; 
  29. ?> 
  30. </div> 
  31. <?php if ( is_user_logged_in() ) : ?> 
  32. <a class="screen-reader-shortcut" href="<?php echo esc_url( wp_logout_url() ); ?>"><?php _e( 'Log Out', 'jetpack' ); ?></a> 
  33. <?php endif; ?> 
  34. </div> 
  35.  
  36. <?php