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:
matt 2007-08-17 10:33:52 +00:00
parent 410a3c5762
commit 7c2dbb9cb1
7 changed files with 133 additions and 20 deletions

View File

@ -1,8 +1,11 @@
<div id="footer"> <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><?php
<p class="docs"><?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> &#8212; <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?><br />
<?php printf( __('Version %s'), get_bloginfo('version') ); ?></p> $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> </div>
<?php do_action('admin_footer', ''); ?> <?php do_action('admin_footer', ''); ?>
<script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script> <script type="text/javascript">if(typeof wpOnload=='function')wpOnload();</script>

View File

@ -42,7 +42,7 @@ else if ( isset($plugin_page) )
do_action('admin_head'); do_action('admin_head');
?> ?>
</head> </head>
<body> <body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
<div id="wphead"> <div id="wphead">
<h1><?php bloginfo('name'); ?> <span id="viewsite">(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1> <h1><?php bloginfo('name'); ?> <span id="viewsite">(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site &raquo;') ?></a>)</span></h1>
</div> </div>

View File

@ -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/template.php');
require_once(ABSPATH . 'wp-admin/includes/theme.php'); require_once(ABSPATH . 'wp-admin/includes/theme.php');
require_once(ABSPATH . 'wp-admin/includes/user.php'); require_once(ABSPATH . 'wp-admin/includes/user.php');
require_once(ABSPATH . 'wp-admin/includes/update.php');
require_once(ABSPATH . WPINC . '/registration.php'); require_once(ABSPATH . WPINC . '/registration.php');

View File

@ -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' );
?>

View File

@ -175,7 +175,7 @@ h2 {
background: url( images/heading-bg.gif ) repeat-x bottom; background: url( images/heading-bg.gif ) repeat-x bottom;
} }
img, #footer a { img {
border: 0; border: 0;
} }
@ -653,24 +653,15 @@ input.delete:hover {
#footer { #footer {
clear: both; clear: both;
text-align: center; height: 35px;
width: 500px; padding-left: 40px;
margin: auto; margin: 15px 5%;
height: 100px; background: url('images/logo-ghost.png') no-repeat top left;
} }
#footer .docs { #footer p {
padding-top: 19px;
line-height: 160%;
}
#footer .docs a {
text-decoration: underline;
}
#footer .logo {
float: left;
margin: 0; margin: 0;
padding: 0; padding: 5px 0;
} }
#login { #login {
@ -1338,3 +1329,23 @@ a.view-link {
margin-right: 220px; margin-right: 220px;
text-decoration:underline; 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 ;
}

51
wp-includes/update.php Normal file
View File

@ -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();
?>

View File

@ -193,6 +193,7 @@ require (ABSPATH . WPINC . '/version.php');
require (ABSPATH . WPINC . '/deprecated.php'); require (ABSPATH . WPINC . '/deprecated.php');
require (ABSPATH . WPINC . '/script-loader.php'); require (ABSPATH . WPINC . '/script-loader.php');
require (ABSPATH . WPINC . '/taxonomy.php'); require (ABSPATH . WPINC . '/taxonomy.php');
require (ABSPATH . WPINC . '/update.php');
require (ABSPATH . WPINC . '/canonical.php'); require (ABSPATH . WPINC . '/canonical.php');
if (strpos($_SERVER['PHP_SELF'], 'install.php') === false) { if (strpos($_SERVER['PHP_SELF'], 'install.php') === false) {