Changeset 20751
- Timestamp:
- 05/09/2012 03:01:49 PM (12 years ago)
- Location:
- trunk/wp-admin/includes
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/class-wp-plugin-install-list-table.php
r20675 r20751 204 204 case 'latest_installed': 205 205 case 'newer_installed': 206 $action_links[] = '<span title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _ _( 'Installed' ) . '</span>';206 $action_links[] = '<span title="' . esc_attr__( 'This plugin is already installed and is up to date' ) . ' ">' . _x( 'Installed', 'plugin' ) . '</span>'; 207 207 break; 208 208 } -
trunk/wp-admin/includes/class-wp-theme-install-list-table.php
r20730 r20751 199 199 'theme' => $theme->slug, 200 200 ), self_admin_url( 'update.php' ) ); 201 $actions[] = '<a class="install-now" href="' . wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>'; 201 202 $update_url = add_query_arg( array( 203 'action' => 'upgrade-theme', 204 'theme' => $theme->slug, 205 ), self_admin_url( 'update.php' ) ); 206 207 $status = $this->_get_theme_status( $theme ); 208 209 switch ( $status ) { 210 default: 211 case 'install': 212 $actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>'; 213 break; 214 case 'update_available': 215 $actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>'; 216 break; 217 case 'newer_installed': 218 case 'latest_installed': 219 $actions[] = '<span class="install-now" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>'; 220 break; 221 } 202 222 203 223 $actions[] = '<a class="install-theme-preview" href="#" title="' . esc_attr( sprintf( __( 'Preview %s' ), $name ) ) . '">' . __( 'Preview' ) . '</a>'; … … 291 311 ), self_admin_url( 'update.php' ) ); 292 312 313 $update_url = add_query_arg( array( 314 'action' => 'upgrade-theme', 315 'theme' => $theme->slug, 316 ), self_admin_url( 'update.php' ) ); 317 318 $status = $this->_get_theme_status( $theme ); 319 293 320 ?> 294 <div class="install-theme-info"> 295 <a class="theme-install button-primary" href="<?php echo wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ); ?>"><?php _e( 'Install' ); ?></a> 321 <div class="install-theme-info"><?php 322 switch ( $status ) { 323 default: 324 case 'install': 325 echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '">' . __( 'Install' ) . '</a>'; 326 break; 327 case 'update_available': 328 echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>'; 329 break; 330 case 'newer_installed': 331 case 'latest_installed': 332 echo '<span class="theme-install" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>'; 333 break; 334 } ?> 296 335 <h3 class="theme-name"><?php echo $name; ?></h3> 297 336 <span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span> … … 329 368 parent::_js_vars( compact( 'tab', 'type' ) ); 330 369 } 370 371 /** 372 * Check to see if the theme is already installed. 373 * 374 * @since 3.4 375 * @access private 376 * 377 * @param object $theme - A WordPress.org Theme API object. 378 * @return string Theme status. 379 */ 380 private function _get_theme_status( $theme ) { 381 $status = 'install'; 382 383 $installed_theme = wp_get_theme( $theme->slug ); 384 if ( $installed_theme->exists() ) { 385 if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) ) 386 $status = 'latest_installed'; 387 elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) ) 388 $status = 'newer_installed'; 389 else 390 $status = 'update_available'; 391 } 392 393 return $status; 394 } 331 395 }
Note: See TracChangeset
for help on using the changeset viewer.