Make WordPress Core


Ignore:
Timestamp:
12/21/2010 04:50:16 PM (14 years ago)
Author:
ryan
Message:

Add delete support to network themes. Props PeteMall. fixes #15707

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/class-wp-ms-themes-list-table.php

    r17050 r17101  
    232232        if ( 'disabled' != $status )
    233233            $actions['disable-selected'] = $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' );
    234         if ( current_user_can( 'update_themes' ) && !$this->is_site_themes )
    235             $actions['update-selected'] = __( 'Update' );
    236 
     234        if ( ! $this->is_site_themes ) {
     235            if ( current_user_can( 'delete_themes' ) )
     236                $actions['delete-selected'] = __( 'Delete' );
     237            if ( current_user_can( 'update_themes' ) )
     238                $actions['update-selected'] = __( 'Update' );
     239        }
    237240        return $actions;
    238241    }
     
    266269            'enable' => '',
    267270            'disable' => '',
    268             'edit' => ''
     271            'edit' => '',
     272            'delete' => ''
    269273        );
    270274
     
    272276
    273277        if ( empty( $theme['enabled'] ) )
    274             $actions['enable'] = '<a href="' . wp_nonce_url($url . 'action=enable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'enable-theme_' . $theme_key) . '" title="' . __('Enable this theme') . '" class="edit">' . ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) . '</a>';
     278            $actions['enable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=enable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'enable-theme_' . $theme_key) ) . '" title="' . esc_attr__('Enable this theme') . '" class="edit">' . ( $this->is_site_themes ? __( 'Enable' ) : __( 'Network Enable' ) ) . '</a>';
    275279        else
    276             $actions['disable'] = '<a href="' . wp_nonce_url($url . 'action=disable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'disable-theme_' . $theme_key) . '" title="' . __('Disable this theme') . '">' . ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) . '</a>';
     280            $actions['disable'] = '<a href="' . esc_url( wp_nonce_url($url . 'action=disable&amp;theme=' . $theme_key . '&amp;paged=' . $page . '&amp;s=' . $s, 'disable-theme_' . $theme_key) ) . '" title="' . esc_attr__('Disable this theme') . '">' . ( $this->is_site_themes ? __( 'Disable' ) : __( 'Network Disable' ) ) . '</a>';
    277281
    278282        if ( current_user_can('edit_themes') )
    279             $actions['edit'] = '<a href="theme-editor.php?theme=' . $theme['Name'] . '" title="' . __('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>';
     283            $actions['edit'] = '<a href="' . esc_url('theme-editor.php?theme=' . $theme['Name'] ) . '" title="' . esc_attr__('Open this theme in the Theme Editor') . '" class="edit">' . __('Edit') . '</a>';
     284           
     285        if ( empty( $theme['enabled'] ) && current_user_can( 'delete_themes' ) && ! $this->is_site_themes )
     286            $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=delete-selected&amp;checked[]=' . $theme_key . '&amp;theme_status=' . $context . '&amp;paged=' . $page . '&amp;s=' . $s, 'bulk-themes' ) ) . '" title="' . esc_attr__( 'Delete this theme' ) . '" class="delete">' . __( 'Delete' ) . '</a>';
    280287
    281288        $actions = apply_filters( 'theme_action_links', array_filter( $actions ), $theme_key, $theme, $context );
    282289        $actions = apply_filters( "theme_action_links_$theme_key", $actions, $theme_key, $theme, $context );
    283 
     290 
    284291        $class = empty( $theme['enabled'] ) ? 'inactive' : 'active';
    285292        $checkbox_id = md5($theme['Name']) . "_checkbox";
     
    320327                        $author = $theme['Author'];
    321328                        if ( !empty( $theme['Author URI'] ) )
    322                             $author = '<a href="' . $theme['Author URI'] . '" title="' . __( 'Visit author homepage' ) . '">' . $theme['Author'] . '</a>';
     329                            $author = '<a href="' . $theme['Author URI'] . '" title="' . esc_attr__( 'Visit author homepage' ) . '">' . $theme['Author'] . '</a>';
    323330                        $theme_meta[] = sprintf( __( 'By %s' ), $author );
    324331                    }
    325332                    if ( !empty( $theme['Theme URI'] ) )
    326                         $theme_meta[] = '<a href="' . $theme['Theme URI'] . '" title="' . __( 'Visit theme homepage' ) . '">' . __( 'Visit Theme Site' ) . '</a>';
     333                        $theme_meta[] = '<a href="' . $theme['Theme URI'] . '" title="' . esc_attr__( 'Visit theme homepage' ) . '">' . __( 'Visit Theme Site' ) . '</a>';
    327334
    328335                    $theme_meta = apply_filters( 'theme_row_meta', $theme_meta, $theme_key, $theme, $status );
Note: See TracChangeset for help on using the changeset viewer.