First pass at upgrade notification for core, see #1476. Also includes some minor footer styling changes.
git-svn-id: http://svn.automattic.com/wordpress/trunk@5892 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
410a3c5762
commit
7c2dbb9cb1
|
@ -1,8 +1,11 @@
|
|||
|
||||
<div id="footer">
|
||||
<p class="logo"><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p>
|
||||
<p class="docs"><?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> — <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?><br />
|
||||
<?php printf( __('Version %s'), get_bloginfo('version') ); ?></p>
|
||||
<p><?php
|
||||
|
||||
$upgrade = apply_filters( 'update_footer', '' );
|
||||
printf( __( 'Thank you for creating with <a href="%s">WordPress</a> | <a href="%s">Documentation</a> | <a href="%s">Feedback</a> %s' ), 'http://wordpress.org/', 'http://codex.wordpress.org/', 'http://wordpress.org/support/forum/4', $upgrade )
|
||||
|
||||
?></p>
|
||||
</div>
|
||||
<?php do_action('admin_footer', ''); ?>
|
||||
<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>
|
||||
|
|
|
@ -42,7 +42,7 @@ else if ( isset($plugin_page) )
|
|||
do_action('admin_head');
|
||||
?>
|
||||
</head>
|
||||
<body>
|
||||
<body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
|
||||
<div id="wphead">
|
||||
<h1><?php bloginfo('name'); ?> <span id="viewsite">(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site »') ?></a>)</span></h1>
|
||||
</div>
|
||||
|
|
|
@ -12,6 +12,7 @@ require_once(ABSPATH . 'wp-admin/includes/taxonomy.php');
|
|||
require_once(ABSPATH . 'wp-admin/includes/template.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/theme.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/user.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/update.php');
|
||||
|
||||
require_once(ABSPATH . WPINC . '/registration.php');
|
||||
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<?php
|
||||
|
||||
// The admin side of our 1.0 update system
|
||||
|
||||
function core_update_footer( $msg ) {
|
||||
$cur = get_option( 'update_core' );
|
||||
|
||||
if ( ! isset( $cur->response ) )
|
||||
return $msg;
|
||||
|
||||
switch ( $cur->response ) {
|
||||
case 'development' :
|
||||
return sprintf( __( '| You are using a development version (%s). Cool! Please <a href="%s">stay updated</a>.' ), $GLOBALS['wp_version'], 'http://wordpress.org/download/svn/' );
|
||||
break;
|
||||
|
||||
case 'upgrade' :
|
||||
add_action( 'admin_footer', 'update_nag' );
|
||||
return sprintf( __( '| <strong>Your WordPress %s is out of date. <a href="%s">Please update</a>.</strong>' ), $GLOBALS['wp_version'], $cur->url );
|
||||
break;
|
||||
|
||||
|
||||
case 'latest' :
|
||||
return sprintf( __( '| Version %s' ), $GLOBALS['wp_version'] );
|
||||
break;
|
||||
}
|
||||
}
|
||||
add_filter( 'update_footer', 'core_update_footer' );
|
||||
|
||||
function update_nag() {
|
||||
$cur = get_option( 'update_core' );
|
||||
?>
|
||||
<div id="update-nag"><?php printf( __('Update Available! <a href="%s">Please upgrade now</a>.'), $cur->url ); ?></div>
|
||||
<?php
|
||||
}
|
||||
|
||||
function update_nag_body( $class ) {
|
||||
$cur = get_option( 'update_core' );
|
||||
|
||||
if ( ! isset( $cur->response ) || $cur->response != 'upgrade' )
|
||||
return $class;
|
||||
|
||||
return "nagtime $class";
|
||||
}
|
||||
add_filter( 'admin_body_class', 'update_nag_body' );
|
||||
|
||||
?>
|
|
@ -175,7 +175,7 @@ h2 {
|
|||
background: url( images/heading-bg.gif ) repeat-x bottom;
|
||||
}
|
||||
|
||||
img, #footer a {
|
||||
img {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
|
@ -653,24 +653,15 @@ input.delete:hover {
|
|||
|
||||
#footer {
|
||||
clear: both;
|
||||
text-align: center;
|
||||
width: 500px;
|
||||
margin: auto;
|
||||
height: 100px;
|
||||
height: 35px;
|
||||
padding-left: 40px;
|
||||
margin: 15px 5%;
|
||||
background: url('images/logo-ghost.png') no-repeat top left;
|
||||
}
|
||||
|
||||
#footer .docs {
|
||||
padding-top: 19px;
|
||||
line-height: 160%;
|
||||
}
|
||||
|
||||
#footer .docs a {
|
||||
text-decoration: underline;
|
||||
}
|
||||
#footer .logo {
|
||||
float: left;
|
||||
#footer p {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
padding: 5px 0;
|
||||
}
|
||||
|
||||
#login {
|
||||
|
@ -1338,3 +1329,23 @@ a.view-link {
|
|||
margin-right: 220px;
|
||||
text-decoration:underline;
|
||||
}
|
||||
|
||||
#update-nag {
|
||||
width: 100%;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
background: #fff;
|
||||
border-bottom: 2px solid #911;
|
||||
text-align: center;
|
||||
font-size: 11px;
|
||||
height: 18px;
|
||||
}
|
||||
|
||||
.nagtime {
|
||||
padding-top: 15px;
|
||||
}
|
||||
|
||||
.nagtime #user_info {
|
||||
top: 17px ;
|
||||
}
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
// A simple set of functions to check our version 1.0 update service
|
||||
|
||||
function wp_version_check() {
|
||||
global $wp_version;
|
||||
$php_version = phpversion();
|
||||
|
||||
$current = get_option( 'update_core' );
|
||||
$locale = get_locale();
|
||||
|
||||
if (
|
||||
isset( $current->last_checked ) &&
|
||||
43200 > ( time() - $current->last_checked ) &&
|
||||
$current->version_checked == $wp_version
|
||||
)
|
||||
return false;
|
||||
|
||||
$new_option = '';
|
||||
$new_option->last_checked = time(); // this gets set whether we get a response or not, so if something is down or misconfigured it won't delay the page load for more than 3 seconds, twice a day
|
||||
$new_option->version_checked = $wp_version;
|
||||
|
||||
$http_request = "GET /core/version-check/1.0/?version=$wp_version&php=$php_version&locale=$locale HTTP/1.0\r\n";
|
||||
$http_request .= "Host: api.wordpress.org\r\n";
|
||||
$http_request .= 'Content-Type: application/x-www-form-urlencoded; charset=' . get_option('blog_charset') . "\r\n";
|
||||
$http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
|
||||
$http_request .= "\r\n";
|
||||
|
||||
$response = '';
|
||||
if ( false !== ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3 ) ) ) {
|
||||
fwrite( $fs, $http_request );
|
||||
while ( !feof( $fs ) )
|
||||
$response .= fgets( $fs, 1160 ); // One TCP-IP packet
|
||||
fclose( $fs );
|
||||
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
$body = trim( $response[1] );
|
||||
$body = str_replace(array("\r\n", "\r"), "\n", $body);
|
||||
|
||||
$returns = explode("\n", $body);
|
||||
|
||||
$new_option->response = $returns[0];
|
||||
if ( isset( $returns[1] ) )
|
||||
$new_option->url = $returns[1];
|
||||
}
|
||||
update_option( 'update_core', $new_option );
|
||||
}
|
||||
|
||||
wp_version_check();
|
||||
|
||||
?>
|
|
@ -193,6 +193,7 @@ require (ABSPATH . WPINC . '/version.php');
|
|||
require (ABSPATH . WPINC . '/deprecated.php');
|
||||
require (ABSPATH . WPINC . '/script-loader.php');
|
||||
require (ABSPATH . WPINC . '/taxonomy.php');
|
||||
require (ABSPATH . WPINC . '/update.php');
|
||||
require (ABSPATH . WPINC . '/canonical.php');
|
||||
|
||||
if (strpos($_SERVER['PHP_SELF'], 'install.php') === false) {
|
||||
|
|
Loading…
Reference in New Issue