WordPress.org

Make WordPress Core

Ticket #12694: 12694.diff

File 12694.diff, 3.8 KB (added by dd32, 5 years ago)
  • wp-admin/includes/theme-install.php

     
    5757                        $res = new WP_Error('themes_api_failed', __('An Unexpected HTTP Error occured during the API request.</p> <p><a href="?" onclick="document.location.reload(); return false;">Try again</a>'), $request->get_error_message() ); 
    5858                } else { 
    5959                        $res = unserialize($request['body']); 
    60                         if ( ! $res ) 
    61                         $res = new WP_Error('themes_api_failed', __('An unknown error occured'), $request['body']); 
     60                        if ( false === $res ) 
     61                                $res = new WP_Error('themes_api_failed', __('An unknown error occured'), $request['body']); 
     62                        elseif ( null === $res ) 
     63                                $res = new WP_Error('themes_theme_404', __('The requested Theme could not be found in the WordPress Themes Directory.')); 
    6264                } 
    6365        } 
    6466        //var_dump(array($args, $res)); 
     
    340342</div> 
    341343</div> 
    342344<?php } 
    343         /* 
    344          object(stdClass)[59] 
    345          public 'name' => string 'Magazine Basic' (length=14) 
    346          public 'slug' => string 'magazine-basic' (length=14) 
    347          public 'version' => string '1.1' (length=3) 
    348          public 'author' => string 'tinkerpriest' (length=12) 
    349          public 'preview_url' => string 'http://wp-themes.com/?magazine-basic' (length=36) 
    350          public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68) 
    351          public 'rating' => float 80 
    352          public 'num_ratings' => int 1 
    353          public 'homepage' => string 'http://wordpress.org/extend/themes/magazine-basic' (length=49) 
    354          public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.' (length=214) 
    355          public 'download_link' => string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66) 
    356          */ 
    357345} 
    358346 
    359347/** 
  • wp-admin/themes.php

     
    257257        <tr> 
    258258                <th><?php _e('Name'); ?></th> 
    259259                <th><?php _e('Description'); ?></th> 
     260                <th><?php _e('Actions'); ?></th> 
    260261        </tr> 
    261262<?php 
    262263        $theme = ''; 
     
    267268        foreach ($theme_names as $theme_name) { 
    268269                $title = $broken_themes[$theme_name]['Title']; 
    269270                $description = $broken_themes[$theme_name]['Description']; 
     271                $stylesheet = $broken_themes[$theme_name]['Name']; 
     272                $missing_parent = (isset($broken_themes[$theme_name]['error']) && 'no_parent' == $broken_themes[$theme_name]['error']) ? $broken_themes[$theme_name]['parent'] : false; 
    270273 
     274                $actions = array(); 
     275                if ( current_user_can('delete_themes') ) 
     276                        $actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url("themes.php?action=delete&amp;template=$stylesheet", 'delete-theme_' . $stylesheet) . '" onclick="' . "return confirm('" . esc_js(sprintf( __("You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete."), $theme_name )) . "');" . '">' . __('Delete') . '</a>'; 
     277 
     278                if ( current_user_can('install_themes') && !empty($missing_parent) ) 
     279                        $actions['install'] = '<a href="' . admin_url('theme-install.php?tab=theme-information&amp;theme=' . urlencode($missing_parent) . '&amp;TB_iframe=true&amp;tbWidth=500&amp;tbHeight=385') . '" class="thickbox thickbox-preview">' . __('Install Parent Theme') . '</a>'; 
     280 
     281                $actions = apply_filters('broken_theme_action_links', $actions, $broken_themes[$theme_name]); 
     282                $actions = implode ( ' | ', $actions ); 
     283 
    271284                $theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"'; 
    272285                echo " 
    273286                <tr $theme> 
    274287                         <td>$title</td> 
    275288                         <td>$description</td> 
     289                         <td style='white-space:nowrap;'>$actions</td> 
    276290                </tr>"; 
    277291        } 
    278292?>