root/trunk/wp-admin/admin-header.php

Revision 8815, 7.4 kB (checked in by azaozz, 2 days ago)

Add simple Chrome detection and updates for Gears dialog, fixes #7684

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 <?php
2 /**
3  * WordPress Administration Template Header
4  *
5  * @package WordPress
6  * @subpackage Administration
7  */
8
9 @header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
10 if (!isset($_GET["page"])) require_once('admin.php');
11 wp_enqueue_script( 'wp-gears' );
12
13 $min_width_pages = array( 'post.php', 'post-new.php', 'page.php', 'page-new.php', 'widgets.php', 'comment.php', 'link.php' );
14 $the_current_page = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
15 $ie6_no_scrollbar = true;
16
17 /**
18  * Append 'minwidth' to value.
19  *
20  * @param mixed $c
21  * @return string
22  */
23 function add_minwidth($c) {
24     return $c . 'minwidth ';
25 }
26
27 if ( in_array( $the_current_page, $min_width_pages ) ) {
28         $ie6_no_scrollbar = false;
29         add_filter( 'admin_body_class', 'add_minwidth' );
30 }
31
32 get_admin_page_title();
33
34 ?>
35 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
36 <html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>>
37 <head>
38 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
39 <title><?php bloginfo('name') ?> &rsaquo; <?php echo wp_specialchars( strip_tags( $title ) ); ?> &#8212; WordPress</title>
40 <?php
41
42 wp_admin_css( 'css/global' );
43 wp_admin_css();
44 wp_admin_css( 'css/colors' );
45 wp_admin_css( 'css/ie' );
46
47 ?>
48 <script type="text/javascript">
49 //<![CDATA[
50 addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}};
51 //]]>
52 </script>
53 <?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') && $ie6_no_scrollbar ) : ?>
54 <style type="text/css">* html { overflow-x: hidden; }</style>
55 <?php endif;
56
57 $hook_suffixes = array();
58
59 if ( isset($page_hook) )
60     $hook_suffixes[] = "-$page_hook";
61 else if ( isset($plugin_page) )
62     $hook_suffixes[] = "-$plugin_page";
63 else if ( isset($pagenow) )
64     $hook_suffixes[] = "-$pagenow";
65
66 $hook_suffixes[] = '';
67
68 foreach ( $hook_suffixes as $hook_suffix )
69     do_action("admin_print_styles$hook_suffix"); // do_action( 'admin_print_styles-XXX' ); do_action( 'admin_print_styles' );
70 foreach ( $hook_suffixes as $hook_suffix )
71     do_action("admin_print_scripts$hook_suffix"); // do_action( 'admin_print_scripts-XXX' ); do_action( 'admin_print_scripts' );
72 foreach ( $hook_suffixes as $hook_suffix )
73     do_action("admin_head$hook_suffix"); // do_action( 'admin_head-XXX' ); do_action( 'admin_head' );
74 unset($hook_suffixes, $hook_suffix);
75
76 ?>
77 </head>
78 <body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
79 <div id="wpwrap">
80 <div id="sidemenu-bg"><br /></div>
81 <div id="wpcontent">
82 <div id="wphead">
83 <h1><?php if ( '' == get_bloginfo('name', 'display') ) echo '&nbsp;'; else echo get_bloginfo('name', 'display'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
84 </div>
85
86 <?php
87 if ( ! $is_opera ) {
88 ?>
89     <div id="gears-info-box" class="info-box" style="display:none;">
90     <img src="images/gear.png" title="Gear" alt="" class="gears-img" />
91     <div id="gears-msg1">
92     <h3 class="info-box-title"><?php _e('Speed up WordPress'); ?></h3>
93     <p><?php _e('WordPress now has support for Gears, which adds new features to your web browser.'); ?><br />
94     <a href="http://gears.google.com/" target="_blank" style="font-weight:normal;"><?php _e('More information...'); ?></a></p>
95     <p><?php _e('After you install and enable Gears, most of WordPress&#8217; images, scripts, and CSS files will be stored locally on your computer. This speeds up page load time.'); ?></p>
96     <p><strong><?php _e('Don&#8217;t install on a public or shared computer.'); ?></strong></p>    <div class="submit"><button onclick="window.location = 'http://gears.google.com/?action=install&amp;return=<?php echo urlencode( admin_url() ); ?>';" class="button"><?php _e('Install Now'); ?></button>
97     <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Cancel'); ?></button></div>
98     </div>
99
100     <div id="gears-msg2" style="display:none;">
101     <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
102     <p><?php _e('Gears is installed on this computer, but is not enabled for use with WordPress.'); ?></p>
103     <p><?php _e('To enable it click the button below.'); ?></p>
104     <p><strong><?php _e('However, Gears should not be enabled if this is a public or shared computer.'); ?></strong></p>
105     <div class="submit"><button class="button" onclick="wpGears.getPermission();"><?php _e('Enable Gears'); ?></button>
106     <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Cancel'); ?></button></div>
107     </div>
108
109     <div id="gears-msg3" style="display:none;">
110     <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
111     <p><?php
112
113     if ( $is_chrome )
114         _e('Gears is installed and enabled on this computer. You can disable it from your browser&#8217;s Options, Under the Hood menu.');
115     elseif ( $is_safari )
116         _e('Gears is installed and enabled on this computer. You can disable it from the Safari menu.');
117     else
118         _e('Gears is installed and enabled on this computer. You can disable it from your browser&#8217;s Tools menu.');
119
120     ?></p>
121     <p><?php _e('If there are any errors try disabling Gears, reloading the page, and re-enabling Gears.'); ?></p>
122     <p><?php _e('Local storage status:'); ?> <span id="gears-wait"><span style="color:#f00;"><?php _e('Updating files:'); ?></span> <span id="gears-upd-number"></span></span></p>
123     <div class="submit"><button class="button" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Close'); ?></button></div>
124     </div>
125
126     <div id="gears-msg4" style="display:none;">
127     <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
128     <p><?php _e('This web site is denied to use Gears.'); ?></p>
129     <p><?php
130
131     if ( $is_chrome )
132          _e('To allow it, change the Gears settings from your browser&#8217;s Options, Under the Hood menu and reload this page.');
133     elseif ( $is_safari )
134          _e('To allow it, change the Gears settings from the Safari menu and reload this page.');
135     else
136         _e('To allow it, change the Gears settings from your browser&#8217;s Tools menu and reload this page.');
137
138     ?></p>
139     <p><strong><?php _e('However, Gears should not be enabled if this is a public or shared computer.'); ?></strong></p>
140     <div class="submit"><button class="button" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Cancel'); ?></button></div>
141     </div>
142    
143     </div>
144 <?php } ?>
145
146 <div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo site_url('wp-login.php?action=logout', 'login') ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>'); if ( ! $is_opera ) { ?> | <span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Turbo') ?></a></span><?php } ?></p></div>
147
148 <?php
149 require(ABSPATH . 'wp-admin/menu-header.php');
150 ?>
151 <div id="wpbody">
152 <div id="wpbody-content">
153 <?php
154 do_action('admin_notices');
155
156 if ( $parent_file == 'options-general.php' ) {
157     require(ABSPATH . 'wp-admin/options-head.php');
158 }
159 ?>
160
Note: See TracBrowser for help on using the browser.