WordPress.org

Make WordPress Core

Ticket #6015: 6015.4.diff

File 6015.4.diff, 4.6 KB (added by DD32, 6 years ago)

Alternate upload plugin location/hide help screen

  • wp-admin/includes/plugin-install.php

     
    6868        } 
    6969        ?> 
    7070         
    71         <p><?php _e('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> via this page.') ?></p> 
     71        <p><?php _e('Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> or upload a plugin in .zip format via this page.') ?></p> 
    7272         
    7373        <h4><?php _e('Search') ?></h4> 
    74         <?php install_search_form() ?> 
     74        <?php install_search_form( 
     75                '<a href="' . add_query_arg('show-help', !isset($_REQUEST['show-help'])) .'" onclick="jQuery(\'#search-help\').toggle(); return false;">' . 
     76                        __('[need help?]') . '</a>') ?> 
     77        <div id="search-help" style="display: <?php echo isset($_REQUEST['show-help']) ? 'block' : 'none'; ?>;"> 
    7578        <p>     <?php _e('You may search based on 3 criteria:') ?><br /> 
    7679                <?php _e('<strong>Term:</strong> Searches plugins names and descriptions for the specified term') ?><br /> 
    7780                <?php _e('<strong>Tag:</strong> Searches for plugins tagged as such') ?><br /> 
    7881                <?php _e('<strong>Author:</strong> Searches for plugins created by the Author, or which the Author contributed to.') ?></p> 
     82        </div> 
    7983         
     84        <h4><?php _e('Install a plugin in .zip format') ?></h4> 
     85        <p><?php _e('If you have a plugin in a .zip format, You may install it by uploading it here.') ?></p> 
     86        <form> 
     87                <input type="file" name="pluginzip" /> 
     88                <input type="submit" value="<?php _e('Install Now') ?>" />(Not working yet) 
     89        </form> 
     90         
    8091        <h4><?php _e('Popular tags') ?></h4> 
    81         <p><?php _e('You may also search based on these popular tags, These are tags which are most popular on WordPress.org') ?></p> 
     92        <p><?php _e('You may also browse based on the most popular tags on wordpress.org') ?></p> 
    8293        <?php 
    8394 
    8495                $api_tags = install_popular_tags(); 
     
    93104                echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) ); 
    94105} 
    95106 
    96 function install_search_form(){ 
     107function install_search_form($after_submit = '') { 
    97108        $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : ''; 
    98109        $term = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; 
    99110 
     
    105116                </select> 
    106117                <input type="text" name="s" id="search-field" value="<?php echo attribute_escape($term) ?>" /> 
    107118                <input type="submit" name="search" value="<?php echo attribute_escape(__('Search')) ?>" clas="button" /> 
     119                <?php if ( ! empty($after_submit) ) echo $after_submit ?> 
    108120        </form><?php 
    109121} 
    110122 
     
    132144        $api = plugins_api('query_plugins', $args); 
    133145        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); 
    134146} 
    135 add_action('install_plugins_upload', 'install_upload_custom', 10, 1); 
    136 function install_upload_custom($page){ 
    137         //$args = array('browse' => 'updated', 'page' => $page); 
    138         //$api = plugins_api('query_plugins', $args); 
    139         //display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); 
    140         echo '<h1>Not Implemented</h1> <p>Will utilise SwfUpload(if available) & unzip .zip plugin packages</p>'; 
    141 } 
    142147 
    143148function display_plugins_table($plugins, $page = 1, $totalpages = 1){ 
    144149        global $tab; 
  • wp-admin/plugin-install.php

     
    1414wp_enqueue_script( 'plugin-install' ); 
    1515add_thickbox(); 
    1616 
    17 //These are the tabs which are shown on the page, Note that 'install' and 'plugin-information' are valid hooks, but not shown here due to not requiring the header 
     17//These are the tabs which are shown on the page, 
    1818$tabs = array( 
    1919                        'search'        => __('Search Plugins'), 
    20                         'upload'        => __('Upload a Plugin'), 
    2120                        'featured'      => __('Featured Plugins'), 
    2221                        'popular'       => __('Popular Plugins'), 
    2322                        'new'           => __('Newest Plugins'), 
    2423                        'updated'       => __('Recently Updated Plugins') 
    2524                ); 
     25$nonmenu_tags = array('install', 'plugin-information', 'upload'); //Valid actions to perform which do not have a Menu item. 
    2626 
    2727$tabs = apply_filters('install_plugins_tabs', $tabs ); 
    2828 
    29 if( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, array('install', 'plugin-information')) ) ){ 
     29if( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, (array)$nonmenu_tabs) ) ){ 
    3030        $tab_actions = array_keys($tabs); 
    3131        $tab = $tab_actions[0]; 
    3232}