187 | 187 | |
188 | 188 | $cur = get_preferred_from_update_core(); |
189 | 189 | if ( ! is_object( $cur ) ) |
190 | 190 | $cur = new stdClass; |
191 | 191 | |
192 | 192 | if ( ! isset( $cur->current ) ) |
193 | 193 | $cur->current = ''; |
194 | 194 | |
195 | 195 | if ( ! isset( $cur->url ) ) |
196 | 196 | $cur->url = ''; |
197 | 197 | |
198 | 198 | if ( ! isset( $cur->response ) ) |
199 | 199 | $cur->response = ''; |
200 | 200 | |
201 | 201 | switch ( $cur->response ) { |
202 | 202 | case 'development' : |
203 | 203 | return sprintf( __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), get_bloginfo( 'version', 'display' ), network_admin_url( 'update-core.php' ) ); |
204 | 204 | |
205 | 205 | case 'upgrade' : |
206 | 206 | return '<strong><a href="' . network_admin_url( 'update-core.php' ) . '">' . sprintf( __( 'Get Version %s' ), $cur->current ) . '</a></strong>'; |
207 | 207 | |
208 | 208 | case 'latest' : |
209 | 209 | default : |
228 | 228 | $cur = get_preferred_from_update_core(); |
229 | 229 | |
230 | 230 | if ( ! isset( $cur->response ) || $cur->response != 'upgrade' ) |
231 | 231 | return false; |
232 | 232 | |
233 | 233 | if ( current_user_can('update_core') ) { |
234 | 234 | $msg = sprintf( __('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! <a href="%2$s">Please update now</a>.'), $cur->current, network_admin_url( 'update-core.php' ) ); |
235 | 235 | } else { |
236 | 236 | $msg = sprintf( __('<a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> is available! Please notify the site administrator.'), $cur->current ); |
237 | 237 | } |
238 | 238 | echo "<div class='update-nag'>$msg</div>"; |
239 | 239 | } |
240 | 240 | |
241 | 241 | // Called directly from dashboard |
242 | 242 | function update_right_now_message() { |
243 | | $theme_name = wp_get_theme(); |
244 | | if ( current_user_can( 'switch_themes' ) ) { |
245 | | $theme_name = sprintf( '<a href="themes.php">%1$s</a>', $theme_name ); |
246 | | } |
247 | | |
248 | | $msg = ''; |
249 | | |
250 | | if ( current_user_can('update_core') ) { |
251 | | $cur = get_preferred_from_update_core(); |
252 | | |
253 | | if ( isset( $cur->response ) && $cur->response == 'upgrade' ) |
254 | | $msg .= '<a href="' . network_admin_url( 'update-core.php' ) . '" class="button" aria-describedby="wp-version">' . sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) ) . '</a> '; |
255 | | } |
256 | | |
257 | | /* translators: 1: version number, 2: theme name */ |
258 | | $content = __( 'WordPress %1$s running %2$s theme.' ); |
259 | | |
260 | | /** |
261 | | * Filter the text displayed in the 'At a Glance' dashboard widget. |
262 | | * |
263 | | * Prior to 3.8.0, the widget was named 'Right Now'. |
264 | | * |
265 | | * @since 4.4.0 |
266 | | * |
267 | | * @param string $content Default text. |
268 | | */ |
269 | | $content = apply_filters( 'update_right_now_text', $content ); |
270 | | |
271 | | $msg .= sprintf( '<span id="wp-version">' . $content . '</span>', get_bloginfo( 'version', 'display' ), $theme_name ); |
272 | | |
273 | | echo "<p id='wp-version-message'>$msg</p>"; |