Ticket #6015: plugin-install.diff

File plugin-install.diff, 55.0 KB (added by DD32, 4 years ago)

GSOC work as of 3rd August

  • wp-admin/css/colors-classic.css

     
    3333 
    3434#user_info a:hover, li.widget-list-control-item h4.widget-title a:hover, .submit a, #dashmenu a:hover, #footer a, #upload-menu li a.upload-tab-link, li.widget-list-control-item h4.widget-title a, 
    3535#dragHelper li.widget-list-control-item h4.widget-title a, 
    36 #draghelper li.widget-list-control-item h4.widget-title a:visited, .login #backtoblog a:hover { 
     36#draghelper li.widget-list-control-item h4.widget-title a:visited, .login #backtoblog a:hover, 
     37#plugin-information .action-button a, #plugin-information .action-button a:hover, #plugin-information .action-button a:visited { 
    3738        color: #fff; 
    3839} 
    3940 
     
    321322        color: #fff; 
    322323} 
    323324 
    324 #rightnow .reallynow { 
     325#rightnow .reallynow, #plugin-information .action-button { 
    325326        background-color: #114973; 
    326327        color: #fff; 
    327328} 
     
    331332        background-color: #07273E; 
    332333} 
    333334 
    334 #adminmenu, div#media-upload-header { 
     335#adminmenu, div#media-upload-header, div#plugin-information-header { 
    335336        background-color: #14568a; 
    336337        border-bottom-color: #07273e; 
    337338} 
  • wp-admin/css/colors-fresh.css

     
    3737 
    3838#user_info a:hover, li.widget-list-control-item h4.widget-title a:hover, .submit a, #dashmenu a:hover, #footer a, #upload-menu li a.upload-tab-link, li.widget-list-control-item h4.widget-title a, 
    3939#dragHelper li.widget-list-control-item h4.widget-title a, 
    40 #draghelper li.widget-list-control-item h4.widget-title a:visited, .login #backtoblog a:hover { 
     40#draghelper li.widget-list-control-item h4.widget-title a:visited, .login #backtoblog a:hover,  
     41#plugin-information .action-button a, #plugin-information .action-button a:hover, #plugin-information .action-button a:visited { 
    4142        color: #fff; 
    4243} 
    4344 
     
    295296        background-image: url(../images/comment-stalk-fresh.gif); 
    296297} 
    297298 
    298 #adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span, #rightnow .reallynow { 
     299#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span, #rightnow .reallynow, #plugin-information .action-button { 
    299300        background-color: #d54e21; 
    300301        color: #fff; 
    301302} 
     
    304305        background-color: #264761; 
    305306} 
    306307 
    307 #adminmenu, div#media-upload-header { 
     308#adminmenu, div#media-upload-header, div#plugin-information-header { 
    308309        background-color: #e4f2fd; 
    309310        border-bottom-color: #c6d9e9; 
    310311} 
  • wp-admin/css/plugin-install.css

     
     1/* NOTE: the following CSS rules(.star*) are taken more or less straight from the bbPress rating plugin. */ 
     2div.star-holder { 
     3        position: relative; 
     4        height: 19px; 
     5        width: 100px; 
     6        font-size: 19px; 
     7} 
     8div.star { 
     9        height: 100%; 
     10        position: absolute; 
     11        top: 0px; 
     12        left: 0px; 
     13        background-color: transparent; 
     14        letter-spacing: 1ex; 
     15        border: none; 
     16} 
     17div.star.select:hover { background-color: #d00; } 
     18.star1 { width: 20%; } 
     19.star2 { width: 40%; } 
     20.star3 { width: 60%; } 
     21.star4 { width: 80%; } 
     22.star5 { width: 100%; } 
     23.star-average, .star.star-rating { background-color: #fc0; }  /* TODO: Colour CSS file */ 
     24.star img, div.star a, div.star a:hover, div.star a:visited { 
     25        display: block; 
     26        position: absolute; 
     27        right: 0px; 
     28        border: none; 
     29        text-decoration: none; 
     30} 
     31div.star img { 
     32        width: 19px; 
     33        height: 19px; 
     34        border-left: 1px solid #fff; 
     35        border-right: 1px solid #fff; 
     36} 
     37 
     38/* Start custom CSS */ 
     39/* TODO: Move remaining colours to Colours CSS */ 
     40/* Header on thickbox */ 
     41#plugin-information-header { 
     42        margin: 0; 
     43        padding: 0 5px; 
     44        font-weight: bold; 
     45        position: relative; 
     46        border-bottom-width: 1px; 
     47        border-bottom-style: solid; 
     48        height: 2.5em; 
     49} 
     50#plugin-information ul#sidemenu { 
     51        font-weight: normal; 
     52        margin: 0 5px; 
     53        position: absolute; 
     54        left: 0px; 
     55        bottom: -1px; 
     56} 
     57 
     58/* Install sidemenu */ 
     59 
     60#plugin-information p.action-button { 
     61        width: 100%; 
     62        padding-bottom:0; 
     63        margin-bottom:0; 
     64        margin-top: 10px; 
     65} 
     66 
     67#plugin-information .action-button a { 
     68        text-align: center; 
     69        font-weight: bold; 
     70        text-decoration: none; 
     71        display: block; 
     72        line-height: 2em; 
     73} 
     74 
     75#plugin-information h2 { 
     76        clear: none !important; 
     77        margin-right: 200px; 
     78} 
     79 
     80#plugin-information .fyi { 
     81        margin-left: 10px; 
     82        margin-bottom: 50px; 
     83        width: 210px; 
     84} 
     85 
     86#plugin-information .fyi h2 { 
     87        font-size: 0.9em; 
     88        margin-bottom: 0px; 
     89        margin-right: 0px; 
     90} 
     91 
     92#plugin-information .fyi h2.mainheader { 
     93        background-color: #cee1ef; /* TODO: Colour CSS file */ 
     94        padding: 5px; 
     95} 
     96 
     97#plugin-information .fyi ul { 
     98        background-color: #eaf3fa; /* TODO: Colour CSS file */ 
     99        padding-top: 10px; 
     100        padding-bottom: 10px; 
     101        padding-left: 7px; 
     102        padding-right: 5px; 
     103        margin: 0px; 
     104        list-style: none; 
     105} 
     106 
     107#plugin-information .fyi li { 
     108                margin-right: 0px; 
     109} 
     110 
     111#plugin-information #section-holder { 
     112        padding: 10px; 
     113} 
     114 
     115#plugin-information #section-screenshots li img { 
     116        vertical-align: text-top; 
     117} 
     118#plugin-information #section-screenshots li p { 
     119        font-style: italic; 
     120        padding-left: 20px; 
     121        padding-bottom: 2em; 
     122} 
     123 No newline at end of file 
  • wp-admin/includes/class-wp-filesystem-ftpext.php

    Cannot display: file marked as a binary type.
    svn:mime-type = application/octet-stream
    
    Property changes on: wp-admin\images\star.gif
    ___________________________________________________________________
    Name: svn:mime-type
       + application/octet-stream
    
     
    119119                return $ret; 
    120120        } 
    121121        function cwd() { 
    122                 $cwd = ftp_pwd($this->link); 
     122                $cwd = @ftp_pwd($this->link); 
    123123                if( $cwd ) 
    124124                        $cwd = trailingslashit($cwd); 
    125125                return $cwd; 
  • wp-admin/includes/dashboard.php

     
    433433                list($link, $frag) = explode( '#', $item['link'] ); 
    434434 
    435435                $link = clean_url($link); 
    436                 $dlink = rtrim($link, '/') . '/download/'; 
     436                if( preg_match('|/([^/]+?)/?$|', $link, $matches) ) 
     437                        $slug = $matches[1]; 
     438                else  
     439                        $slug = ''; 
    437440 
     441                $ilink = wp_nonce_url('plugin-install.php?tab=install-confirmation&plugin=' . $slug, 'install-plugin_' . $slug) . 
     442                                                        '&TB_iframe=true&width=600&height=800'; 
     443 
    438444                echo "<h4>$label</h4>\n"; 
    439                 echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$dlink'>" . __( 'Download' ) . "</a>)</span>\n"; 
     445                echo "<h5><a href='$link'>$title</a></h5>&nbsp;<span>(<a href='$ilink' class='thickbox' title='$title'>" . __( 'Install' ) . "</a>)</span>\n"; 
    440446                echo "<p>$description</p>\n"; 
    441447        } 
    442448} 
  • wp-admin/includes/file.php

     
    458458        return apply_filters('filesystem_method', $method); 
    459459} 
    460460 
    461 ?> 
    462  No newline at end of file 
     461function request_filesystem_credentials($form_post, $type = '', $error = false) { 
     462        $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error); 
     463        if ( '' !== $req_cred ) 
     464                return $req_cred; 
     465 
     466        if ( empty($type) ) 
     467                $type = get_filesystem_method(); 
     468 
     469        if ( 'direct' == $type ) 
     470                return true; 
     471                 
     472        if( ! $credentials = get_option('ftp_credentials') ) 
     473                $credentials = array(); 
     474        // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) 
     475        $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); 
     476        $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); 
     477        $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']); 
     478        $credentials['ssl']      = defined('FTP_SSL')  ? FTP_SSL  : ( isset($_POST['ssl'])      ? $_POST['ssl']      : $credentials['ssl']); 
     479 
     480        if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) { 
     481                $stored_credentials = $credentials; 
     482                unset($stored_credentials['password']); 
     483                update_option('ftp_credentials', $stored_credentials); 
     484                return $credentials; 
     485        } 
     486        $hostname = ''; 
     487        $username = ''; 
     488        $password = ''; 
     489        $ssl = ''; 
     490        if ( !empty($credentials) ) 
     491                extract($credentials, EXTR_OVERWRITE); 
     492        if( $error ) 
     493                echo '<div id="message" class="error"><p>' . __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.') . '</p></div>'; 
     494?> 
     495<form action="<?php echo $form_post ?>" method="post"> 
     496<div class="wrap"> 
     497<h2><?php _e('FTP Connection Information') ?></h2> 
     498<p><?php _e('To perform the requested action, FTP connection information is required.') ?></p> 
     499<table class="form-table"> 
     500<tr valign="top"> 
     501<th scope="row"><label for="hostname"><?php _e('Hostname:') ?></label></th> 
     502<td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td> 
     503</tr> 
     504<tr valign="top"> 
     505<th scope="row"><label for="username"><?php _e('Username:') ?></label></th> 
     506<td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td> 
     507</tr> 
     508<tr valign="top"> 
     509<th scope="row"><label for="password"><?php _e('Password:') ?></label></th> 
     510<td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td> 
     511</tr> 
     512<tr valign="top"> 
     513<th scope="row"><label for="ssl"><?php _e('Use SSL:') ?></label></th> 
     514<td> 
     515<select name="ssl" id="ssl"<?php if( defined('FTP_SSL') ) echo ' disabled="disabled"' ?>> 
     516<?php 
     517foreach ( array(0 => __('No'), 1 => __('Yes')) as $key => $value ) : 
     518        $selected = ($ssl == $value) ? 'selected="selected"' : ''; 
     519        echo "\n\t<option value='$key' $selected>" . $value . '</option>'; 
     520endforeach; 
     521?> 
     522</select> 
     523</td> 
     524</tr> 
     525</table> 
     526<p class="submit"> 
     527<input type="submit" name="submit" value="<?php _e('Proceed'); ?>" /> 
     528</p> 
     529</div> 
     530</form> 
     531<?php 
     532        return false; 
     533} 
     534 
     535?> 
  • wp-admin/includes/misc.php

     
    160160        } 
    161161} 
    162162 
     163function show_message($message) { 
     164        if( is_wp_error($message) ){ 
     165                if( $message->get_error_data() ) 
     166                        $message = $message->get_error_message() . ': ' . $message->get_error_data(); 
     167                else  
     168                        $message = $message->get_error_message(); 
     169        } 
     170        echo "<p>$message</p>\n"; 
     171} 
     172 
    163173?> 
  • wp-admin/includes/plugin-install.php

     
     1<?php 
     2 
     3function plugins_api($action, $args = '') { 
     4        global $wp_version; 
     5 
     6        if( is_array($args) ) 
     7                $args = (object)$args; 
     8 
     9        $args = apply_filters('plugins_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter. 
     10        $res = apply_filters('plugins_api', false); //NOTE: Allows a plugin to completely override the builtin WordPress.org API. 
     11         
     12        if ( ! $res ) { 
     13                $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array(), array(), http_build_query(array('action' => $action, 'request' => serialize($args))) );//Note: http_build_query() can be removed once WP_HTTP accepts unencoded data. 
     14                $res = unserialize($request['body']); 
     15                if ( ! $res ) 
     16                        wp_die($request['body']); 
     17        } 
     18 
     19        return apply_filters('plugins_api_result', $res); 
     20} 
     21 
     22function install_popular_tags( $args = array() ) { 
     23        if ( ! $cache = get_option('wporg_popular_tags') ) 
     24                add_option('wporg_popular_tags', array(), '', 'no');///No autoload. 
     25 
     26        if ( $cache && $cache->timeout + 3 * 60 * 60 > time() ) 
     27                return $cache->cached; 
     28 
     29        $tags = plugins_api('hot_tags'); 
     30 
     31        update_option('wporg_popular_tags', (object) array('timeout' => time(), 'cached' => $tags)); 
     32 
     33        return $tags; 
     34} 
     35 
     36add_action('install_plugins_search', 'install_search', 10, 1); 
     37function install_search($page) { 
     38        $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : ''; 
     39        $term = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; 
     40 
     41        if( ! empty($term) ){ 
     42                $args = array(); 
     43 
     44                switch( $type ){ 
     45                        case 'tag': 
     46                                $args['tag'] = sanitize_title_with_dashes($term); 
     47                                break; 
     48                        case 'term': 
     49                                $args['search'] = $term; 
     50                                break; 
     51                        case 'author': 
     52                                $args['author'] = $term; 
     53                                break; 
     54                } 
     55 
     56                $args['page'] = $page; 
     57 
     58                $api = plugins_api('query_plugins', $args); 
     59 
     60                add_action('install_plugins_table_header', 'install_search_form'); 
     61 
     62                display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); 
     63 
     64                return; 
     65        } 
     66        ?> 
     67         
     68        <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> 
     69         
     70        <h4><?php _e('Search') ?></h4> 
     71        <?php install_search_form() ?> 
     72        <p>     <?php _e('You may search based on 3 criteria:') ?><br /> 
     73                <?php _e('<strong>Term:</strong> Searches plugins names and descriptions for the specified term') ?><br /> 
     74                <?php _e('<strong>Tag:</strong> Searches for plugins tagged as such') ?><br /> 
     75                <?php _e('<strong>Author:</strong> Searches for plugins created by the Author, or which the Author contributed to.') ?></p> 
     76         
     77        <h4><?php _e('Popular tags') ?></h4> 
     78        <p><?php _e('You may also search based on these popular tags, These are tags which are most popular on WordPress.org') ?></p> 
     79        <?php 
     80 
     81                $api_tags = install_popular_tags(); 
     82 
     83                //Set up the tags in a way which can be interprated by wp_generate_tag_cloud() 
     84                $tags = array(); 
     85                foreach ( (array)$api_tags as $tag ) 
     86                        $tags[ $tag['name'] ] = (object) array( 
     87                                                                        'link' => clean_url( admin_url('plugin-install.php?tab=search&type=tag&s=' . urlencode($tag['name'])) ), 
     88                                                                        'name' => $tag['name'], 
     89                                                                        'count' => $tag['count'] ); 
     90                echo wp_generate_tag_cloud($tags, array( 'single_text' => __('%d plugin'), 'multiple_text' => __('%d plugins') ) ); 
     91} 
     92 
     93function install_search_form(){ 
     94        $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : ''; 
     95        $term = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; 
     96 
     97        ?><form id="search-plugins" method="post" action="<?php echo admin_url('plugin-install.php?tab=search') ?>"> 
     98                <select name="type" id="typeselector"> 
     99                        <option value="term"<?php selected('term', $type) ?>><?php _e('Term') ?></option> 
     100                        <option value="tag"<?php selected('tag', $type) ?>><?php _e('Tag') ?></option> 
     101                        <option value="author"<?php selected('author', $type) ?>><?php _e('Author') ?></option> 
     102                </select> 
     103                <input type="text" name="s" id="search-field" value="<?php echo attribute_escape($term) ?>" /> 
     104                <input type="submit" name="search" value="<?php echo attribute_escape(__('Search')) ?>" clas="button" /> 
     105        </form><?php 
     106} 
     107 
     108add_action('install_plugins_featured', 'install_featured', 10, 1); 
     109function install_featured($page){ 
     110        $args = array('browse' => 'featured', 'page' => $page); 
     111        $api = plugins_api('query_plugins', $args); 
     112        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); 
     113} 
     114add_action('install_plugins_popular', 'install_popular', 10, 1); 
     115function install_popular($page){ 
     116        $args = array('browse' => 'popular', 'page' => $page); 
     117        $api = plugins_api('query_plugins', $args); 
     118        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); 
     119} 
     120add_action('install_plugins_new', 'install_new', 10, 1); 
     121function install_new($page){ 
     122        $args = array('browse' => 'new', 'page' => $page); 
     123        $api = plugins_api('query_plugins', $args); 
     124        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); 
     125} 
     126add_action('install_plugins_updated', 'install_updated', 10, 1); 
     127function install_updated($page){ 
     128        $args = array('browse' => 'updated', 'page' => $page); 
     129        $api = plugins_api('query_plugins', $args); 
     130        display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); 
     131} 
     132add_action('install_plugins_upload', 'install_upload_custom', 10, 1); 
     133function install_upload_custom($page){ 
     134        //$args = array('browse' => 'updated', 'page' => $page); 
     135        //$api = plugins_api('query_plugins', $args); 
     136        //display_plugins_table($api->plugins, $api->info['page'], $api->info['pages']); 
     137        echo '<h1>Not Implemented</h1> <p>Will utilise SwfUpload(if available) & unzip .zip plugin packages</p>'; 
     138} 
     139 
     140function display_plugins_table($plugins, $page = 1, $totalpages = 1){ 
     141        global $tab; 
     142         
     143        $type = isset($_REQUEST['type']) ? $_REQUEST['type'] : ''; 
     144        $term = isset($_REQUEST['s']) ? $_REQUEST['s'] : ''; 
     145 
     146        $plugins_allowedtags = array('a' => array('href' => array(),'title' => array(), 'target' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); 
     147 
     148?> 
     149        <div class="tablenav"> 
     150                <div class="alignleft"> 
     151                <?php do_action('install_plugins_table_header'); ?> 
     152                </div> 
     153                <?php 
     154                        $url = $_SERVER['REQUEST_URI']; 
     155                        if ( ! empty($term) ) 
     156                                $url = add_query_arg('s', $term, $url); 
     157                        if ( ! empty($type) ) 
     158                                $url = add_query_arg('type', $type, $url); 
     159 
     160                        $page_links = paginate_links( array( 
     161                                'base' => add_query_arg('paged', '%#%', $url), 
     162                                'format' => '', 
     163                                'total' => $totalpages, 
     164                                'current' => $page 
     165                        )); 
     166                         
     167                        if ( $page_links ) 
     168                                echo "\t\t<div class='tablenav-pages'>$page_links</div>";        
     169?> 
     170        </div> 
     171        <br class="clear" /> 
     172        <table class="widefat" id="install-plugins"> 
     173                <thead> 
     174                        <tr> 
     175                                <th scope="col" class="name"><?php _e('Name'); ?></th> 
     176                                <th scope="col" class="num"><?php _e('Version'); ?></th> 
     177                                <th scope="col" class="num"><?php _e('Rating'); ?></th> 
     178                                <th scope="col" class="desc"><?php _e('Description'); ?></th> 
     179                                <th scope="col" class="action-links"><?php _e('Actions'); ?></th> 
     180                        </tr> 
     181                </thead> 
     182                <tbody class="plugins"> 
     183                <?php 
     184                        if( empty($plugins) ) 
     185                                echo '<tr><td colspan="5">', __('No plugins match your request.'), '</td></tr>'; 
     186                         
     187                        foreach( (array) $plugins as $plugin ){ 
     188                                if ( is_object($plugin) ) 
     189                                        $plugin = (array) $plugin; 
     190 
     191                                $title = wp_kses($plugin['name'], $plugins_allowedtags); 
     192                                $description = wp_kses($plugin['description'], $plugins_allowedtags); 
     193                                $version = wp_kses($plugin['version'], $plugins_allowedtags); 
     194                                 
     195                                $name = strip_tags($title . ' ' . $version); 
     196                                 
     197                                $author = $plugin['author']; 
     198                                if( ! empty($plugin['author']) ) 
     199                                        $author = ' <cite>' . sprintf( __('By %s'), $author ) . '.</cite>'; 
     200 
     201                                $author = wp_kses($author, $plugins_allowedtags); 
     202                                 
     203                                if( isset($plugin['homepage']) ) 
     204                                        $title = '<a target="_blank" href="' . $plugin['homepage'] . '">' . $title . '</a>'; 
     205                                 
     206                                $action_links = array(); 
     207                                $action_links[] = '<a href="' . admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin['slug'] . 
     208                                                                        '&TB_iframe=true&width=600&height=800') . '" class="thickbox onclick" title="' . 
     209                                                                        attribute_escape($name) . '">' . __('Install') . '</a>'; 
     210                                 
     211                                $action_links = apply_filters('plugin_install_action_links', $action_links, $plugin); 
     212                        ?> 
     213                        <tr> 
     214                                <td class="name"><?php echo $title; ?></td> 
     215                                <td class="vers"><?php echo $version; ?></td> 
     216                                <td class="vers"> 
     217                                        <div class="star-holder" title="<?php printf( __('based on %d ratings'), $plugin['num_ratings'] ); ?>"> 
     218                                                <div class="star star-rating" style="width: <?php echo attribute_escape($plugin['rating']) ?>px"></div> 
     219                                                <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div> 
     220                                                <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div> 
     221                                                <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div> 
     222                                                <div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div> 
     223                                                <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div> 
     224                                        </div> 
     225                                </td> 
     226                                <td class="desc"><p><?php echo $description, $author; ?></p></td> 
     227                                <td class="action-links"><?php if ( !empty($action_links) )     echo implode(' | ', $action_links); ?></td> 
     228                        </tr> 
     229                        <?php 
     230                        } 
     231                        ?> 
     232                </tbody> 
     233        </table> 
     234<?php 
     235} 
     236 
     237function install_iframe_header($title = '') { 
     238if( empty($title) ) 
     239        $title = __('Plugin Install') . ' &#8212; ' . __('WordPress'); 
     240 
     241register_shutdown_function('install_iframe_footer'); //Do footer after content, Allows us to simply die or return at any point. 
     242 
     243?> 
     244<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     245<html xmlns="http://www.w3.org/1999/xhtml" <?php do_action('admin_xml_ns'); ?> <?php language_attributes(); ?>> 
     246<head> 
     247<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> 
     248<title><?php bloginfo('name') ?> &rsaquo; <?php echo $title ?></title> 
     249<?php 
     250wp_enqueue_style( 'global' ); 
     251wp_enqueue_style( 'wp-admin' ); 
     252wp_enqueue_style( 'colors' ); 
     253?> 
     254<script type="text/javascript"> 
     255//<![CDATA[ 
     256function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}else{ var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}} 
     257//]]> 
     258</script> 
     259<?php 
     260do_action('admin_print_styles'); 
     261do_action('admin_print_scripts'); 
     262do_action('admin_head'); 
     263?> 
     264</head> 
     265<body<?php if ( isset($GLOBALS['body_id']) ) echo ' id="' . $GLOBALS['body_id'] . '"'; ?>> 
     266<?php 
     267} 
     268 
     269function install_iframe_footer() { 
     270echo ' 
     271</body> 
     272</html>'; 
     273} 
     274 
     275add_action('install_plugins_pre_plugin-information', 'install_plugin_information'); 
     276function install_plugin_information() { 
     277        global $tab; 
     278         
     279        $api = plugins_api('plugin_information', array('slug' => $_REQUEST['plugin'])); 
     280 
     281        $section = isset($_REQUEST['section']) ? $_REQUEST['section'] : 'description'; //Default to the Description tab, Do not translate, API returns English. 
     282        if( empty($section) || ! isset($api->sections[ $section ]) ) 
     283                $section = array_shift( $section_titles = array_keys((array)$api->sections) ); 
     284         
     285        install_iframe_header(); 
     286        echo "<div id='$tab-header'>\n"; 
     287        echo "<ul id='sidemenu'>\n"; 
     288        foreach ( (array)$api->sections as $section_name => $content ) { 
     289         
     290                $title = $section_name; 
     291                $title[0] = strtoupper($title[0]); 
     292                $title = str_replace('_', ' ', $title); 
     293 
     294                $class = ( $section_name == $section ) ? ' class="current"' : ''; 
     295                $href = add_query_arg( array('tab' => $tab, 'section' => $section_name) ); 
     296                $href = clean_url($href); 
     297                $san_title = attribute_escape(sanitize_title_with_dashes($title)); 
     298                echo "\t<li><a name='$san_title' target='' href='$href'$class>$title</a></li>\n"; 
     299        } 
     300        echo "</ul>\n"; 
     301        echo "</div>\n"; 
     302         
     303        ?> 
     304        <div class="alignright fyi"> 
     305                <?php if ( ! empty($api->download_link) ) : ?> 
     306                <p class="action-button"> 
     307                <?php 
     308                        $type = 'install'; 
     309                        if ( file_exists( WP_PLUGIN_DIR  . '/' . $api->slug ) ) { //TODO: Make more.. searchable? 
     310                                $type = 'latest_installed'; 
     311                                $update_plugins = get_option('update_plugins'); 
     312                                foreach ( (array)$update_plugins->response as $file => $plugin ) { 
     313                                        if ( $plugin->slug === $api->slug ) { 
     314                                                $type = 'update_available'; 
     315                                                $update_file = $file; 
     316                                                break; 
     317                                        } 
     318                                } 
     319                        } 
     320 
     321                        switch ( $type ) : 
     322                                default: 
     323                                case 'install': 
     324                                        if ( current_user_can('install_plugins') ) : 
     325                                ?><a href="<?php echo wp_nonce_url(admin_url('plugin-install.php?tab=install&plugin=' . $api->slug), 'install-plugin_' . $api->slug) ?>"><?php _e('Install Now') ?></a><?php 
     326                                        endif; 
     327                                break; 
     328                                case 'update_available': 
     329                                        if ( current_user_can('update_plugins') ) : 
     330                                                ?><a href="<?php echo wp_nonce_url(admin_url('update.php?action=upgrade-plugin&plugin=' . $update_file), 'upgrade-plugin_' . $update_file) ?>"><?php _e('Install Update Now') ?></a><?php 
     331                                        endif; 
     332                                break; 
     333                                case 'latest_installed': 
     334                                        if ( current_user_can('install_plugins') || current_user_can('update_plugins') ) : 
     335                                        ?><a><?php _e('Latest Version Installed') ?></a><?php 
     336                                        endif; 
     337                                break; 
     338                        endswitch; ?> 
     339                </p> 
     340                <?php endif; ?> 
     341                <h2 class="mainheader"><?php _e('FYI') ?></h2> 
     342                <ul> 
     343<?php if ( ! empty($api->version) ) : ?> 
     344                        <li><strong><?php _e('Version:') ?></strong> <?php echo $api->version ?></li> 
     345<?php endif; if ( ! empty($api->author) ) : ?> 
     346                        <li><strong><?php _e('Author:') ?></strong> <?php echo links_add_target($api->author, '_blank') ?></li> 
     347<?php endif; if ( ! empty($api->last_updated) ) : ?> 
     348                        <li><strong><?php _e('Last Updated:') ?></strong> <span title="<?php echo $api->last_updated ?>"><?php  
     349                                                        printf( __('%s ago'), human_time_diff(strtotime($api->last_updated)) ) ?></span></li> 
     350<?php endif; if ( ! empty($api->requires) ) : ?> 
     351                        <li><strong><?php _e('Requires WordPress Version:') ?></strong> <?php printf(__('%s or higher'), $api->requires) ?></li> 
     352<?php endif; if ( ! empty($api->tested) ) : ?> 
     353                        <li><strong><?php _e('Compatible up to:') ?></strong> <?php echo $api->tested ?></li> 
     354<?php endif; if ( ! empty($api->downloaded) ) : ?> 
     355                        <li><strong><?php _e('Downloaded:') ?></strong> <?php printf('%s times', number_format_i18n($api->downloaded)) ?></li> 
     356<?php endif; if ( ! empty($api->slug) ) : ?> 
     357                        <li><a target="_blank" href="http://wordpress.org/extend/plugins/<?php echo $api->slug ?>/"><?php _e('WordPress.org Plugin Page &#187;') ?></a></li> 
     358<?php endif; if ( ! empty($api->homepage) ) : ?> 
     359                        <li><a target="_blank" href="<?php echo $api->homepage ?>"><?php _e('Plugin Homepage  &#187;') ?></a></li> 
     360<?php endif; ?> 
     361                </ul> 
     362                <h2><?php _e('Average Rating') ?></h2> 
     363                <div class="star-holder" title="<?php printf(__('(based on %d ratings)'), $api->num_ratings) ?>"> 
     364                        <div class="star star-rating" style="width: <?php echo attribute_escape($api->rating) ?>px"></div> 
     365                        <div class="star star5"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('5 stars') ?>" /></div> 
     366                        <div class="star star4"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('4 stars') ?>" /></div> 
     367                        <div class="star star3"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('3 stars') ?>" /></div> 
     368                        <div class="star star2"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('2 stars') ?>" /></div> 
     369                        <div class="star star1"><img src="<?php echo admin_url('images/star.gif'); ?>" alt="<?php _e('1 star') ?>" /></div> 
     370                </div> 
     371                <small><?php printf(__('(based on %d ratings)'), $api->num_ratings) ?></small> 
     372        </div> 
     373                <?php 
     374        echo "<div id='section-holder' class='wrap'>\n"; 
     375        foreach ( (array)$api->sections as $section_name => $content ) { 
     376                $title = $section_name; 
     377                $title[0] = strtoupper($title[0]); 
     378                $title = str_replace('_', ' ', $title); 
     379                 
     380                $content = links_add_base_url($content, 'http://wordpress.org/extend/plugins/' . $api->slug . '/'); 
     381                $content = links_add_target($content, '_blank'); 
     382                 
     383                $san_title = attribute_escape(sanitize_title_with_dashes($title)); 
     384                 
     385                $display = ( $section_name == $section ) ? 'block' : 'none'; 
     386                 
     387                echo "\t<div id='section-{$san_title}' style='display: {$display};'>\n"; 
     388                echo "\t\t<h2 class='long-header'>$title</h2>"; 
     389                echo $content; 
     390                echo "\t</div>\n"; 
     391        } 
     392        echo "</div>\n"; 
     393                 
     394        //var_dump($api); 
     395        exit; 
     396} 
     397 
     398add_action('install_plugins_pre_install', 'install_plugin'); 
     399function install_plugin() { 
     400 
     401        check_admin_referer('install-plugin_' . $_REQUEST['plugin']); 
     402 
     403        install_iframe_header(); 
     404         
     405        $api = plugins_api('plugin_information', array('slug' => $_REQUEST['plugin'], 'fields' => array('sections' => false) ) ); //Save on a bit of bandwidth. 
     406         
     407        echo '<div class="wrap">'; 
     408        echo '<h2>', sprintf( __('Installing Plugin: %s'), $api->name . ' ' . $api->version ), '</h2>'; 
     409 
     410        do_plugin_install($api->download_link); 
     411        echo '</div>'; 
     412 
     413        exit; 
     414} 
     415function do_plugin_install($download_url = '') { 
     416        global $wp_filesystem; 
     417         
     418        if ( empty($download_url) ) { 
     419                show_message( __('No plugin Specified') ); 
     420                return; 
     421        } 
     422         
     423        $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : ''; 
     424         
     425        $url = 'plugin-install.php?tab=install'; 
     426        $url = add_query_arg(array('plugin' => $plugin, 'plugin_name' => $_REQUEST['plugin_name'], 'download_url' => $_REQUEST['download_url']), $url); 
     427 
     428        $url = wp_nonce_url($url, "install-plugin_$plugin"); 
     429        if ( false === ($credentials = request_filesystem_credentials($url)) ) 
     430                return; 
     431 
     432        if ( ! WP_Filesystem($credentials) ) { 
     433                request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again 
     434                return; 
     435        } 
     436 
     437        if ( $wp_filesystem->errors->get_error_code() ) { 
     438                foreach ( $wp_filesystem->errors->get_error_messages() as $message ) 
     439                        show_message($message); 
     440                return; 
     441        } 
     442 
     443        $result = wp_install_plugin( $download_url, 'show_message' ); 
     444         
     445        if ( is_wp_error($result) ) { 
     446                show_message($result); 
     447                show_message( __('Installation Failed') ); 
     448        } else { 
     449                show_message( sprintf(__('Successfully installed the plugin <strong>%s %s</strong>.'), $plugin_information->name, $plugin_information->version) );       
     450        } 
     451} 
     452 
     453function wp_install_plugin($package, $feedback = '') { 
     454        global $wp_filesystem; 
     455 
     456        if ( !empty($feedback) ) 
     457                add_filter('install_feedback', $feedback); 
     458 
     459        // Is a filesystem accessor setup? 
     460        if ( ! $wp_filesystem || ! is_object($wp_filesystem) ) 
     461                WP_Filesystem(); 
     462 
     463        if ( ! is_object($wp_filesystem) ) 
     464                return new WP_Error('fs_unavailable', __('Could not access filesystem.')); 
     465 
     466        if ( $wp_filesystem->errors->get_error_code() ) 
     467                return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors); 
     468 
     469        //Get the base plugin folder 
     470        $plugins_dir = $wp_filesystem->wp_plugins_dir(); 
     471        if ( empty($plugins_dir) ) 
     472                return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.')); 
     473 
     474        //And the same for the Content directory. 
     475        $content_dir = $wp_filesystem->wp_content_dir(); 
     476        if( empty($content_dir) ) 
     477                return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).')); 
     478         
     479        $plugins_dir = trailingslashit( $plugins_dir ); 
     480        $content_dir = trailingslashit( $content_dir ); 
     481 
     482        if ( empty($package) ) 
     483                return new WP_Error('no_package', __('Install package not available.')); 
     484 
     485        // Download the package 
     486        apply_filters('install_feedback', sprintf(__('Downloading plugin package from %s'), $package)); 
     487        $download_file = download_url($package); 
     488 
     489        if ( is_wp_error($download_file) ) 
     490                return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message()); 
     491 
     492        $working_dir = $content_dir . 'upgrade/' . basename($package, '.zip'); 
     493 
     494        // Clean up working directory 
     495        if ( $wp_filesystem->is_dir($working_dir) ) 
     496                $wp_filesystem->delete($working_dir, true); 
     497 
     498        apply_filters('install_feedback', __('Unpacking the plugin package')); 
     499        // Unzip package to working directory 
     500        $result = unzip_file($download_file, $working_dir); 
     501         
     502        // Once extracted, delete the package 
     503        unlink($download_file); 
     504         
     505        if ( is_wp_error($result) ) { 
     506                $wp_filesystem->delete($working_dir, true); 
     507                return $result; 
     508        } 
     509         
     510        //Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin 
     511        $filelist = array_keys( $wp_filesystem->dirlist($working_dir) ); 
     512         
     513        if( $wp_filesystem->exists( $plugins_dir . $filelist[0] ) ) { 
     514                $wp_filesystem->delete($working_dir, true); 
     515                return new WP_Error('install_folder_exists', __('Folder allready exists.'), $filelist[0] ); 
     516        } 
     517         
     518        apply_filters('install_feedback', __('Installing the plugin')); 
     519        // Copy new version of plugin into place. 
     520        $result = copy_dir($working_dir, $plugins_dir); 
     521        if ( is_wp_error($result) ) { 
     522                $wp_filesystem->delete($working_dir, true); 
     523                return $result; 
     524        } 
     525 
     526        // Remove working directory 
     527        $wp_filesystem->delete($working_dir, true); 
     528 
     529} 
     530 
     531 
     532?> 
     533 No newline at end of file 
  • wp-admin/includes/schema.php

     
    277277        populate_roles_230(); 
    278278        populate_roles_250(); 
    279279        populate_roles_260(); 
     280        populate_roles_270(); 
    280281} 
    281282 
    282283function populate_roles_160() { 
     
    441442        } 
    442443} 
    443444 
     445function populate_roles_270() { 
     446        $role = get_role( 'administrator' ); 
     447 
     448        if ( !empty( $role ) ) { 
     449                $role->add_cap( 'install_plugins' ); 
     450        } 
     451} 
     452 
    444453?> 
  • wp-admin/includes/update.php

     
    6060 
    6161        $r = $current->response[ $file ]; 
    6262 
     63        $details_url = admin_url('plugin-install.php?tab=plugin-information&plugin=' . $r->slug . '&TB_iframe=true&width=600&height=800'); 
     64 
    6365        echo '<tr><td colspan="5" class="plugin-update">'; 
    6466        if ( ! current_user_can('update_plugins') ) 
    65                 printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.'), $plugin_data['Name'], $r->url, $r->new_version); 
     67                printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a>.'), $plugin_data['Name'], $details_url, $r->new_version); 
    6668        else if ( empty($r->package) ) 
    67                 printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_data['Name'], $r->url, $r->new_version); 
     69                printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_data['Name'], $details_url, $r->new_version); 
    6870        else 
    69                 printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&amp;plugin=' . $file, 'upgrade-plugin_' . $file) ); 
     71                printf( __('There is a new version of %1$s available. <a href="%2$s" class="thickbox" title="%1$s">View version %3$s Details</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $details_url, $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&amp;plugin=' . $file, 'upgrade-plugin_' . $file) ); 
    7072         
    7173        echo '</td></tr>'; 
    7274} 
  • wp-admin/includes/upgrade.php

     
    207207        if ( $wp_current_db_version < 8201 ) 
    208208                upgrade_260(); 
    209209 
     210        if ( $wp_current_db_version < 8530 ) 
     211                upgrade_270(); 
     212 
    210213        maybe_disable_automattic_widgets(); 
    211214 
    212215        $wp_rewrite->flush_rules(); 
     
    755758        } 
    756759} 
    757760 
     761function upgrade_270() { 
     762        if ( $wp_current_db_version < 8530 ) 
     763                populate_roles_270(); 
     764} 
     765 
     766 
    758767// The functions we use to actually do stuff 
    759768 
    760769// General 
  • wp-admin/index.php

     
    2727add_action( 'admin_head', 'index_js' ); 
    2828 
    2929wp_enqueue_script( 'jquery' ); 
     30wp_enqueue_script( 'plugin-installer' ); 
    3031wp_admin_css( 'dashboard' ); 
     32wp_admin_css( 'plugin-installer' ); 
     33add_thickbox(); 
    3134 
    3235$title = __('Dashboard'); 
    3336$parent_file = 'index.php'; 
  • wp-admin/js/plugin-install.js

     
     1/* Plugin Browser Thickbox related JS*/ 
     2jQuery(function($) { 
     3        var thickDims = function() { 
     4                var tbWindow = $('#TB_window'); 
     5                var width = $(window).width(); 
     6                var H = $(window).height(); 
     7                var W = ( 720 < width ) ? 720 : width; 
     8 
     9                if ( tbWindow.size() ) { 
     10                        tbWindow.width( W - 50 ).height( H - 45 ); 
     11                        $('#TB_iframeContent').width( W - 50 ).height( H - 75 ); 
     12                        tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'}); 
     13                        if ( ! ( $.browser.msie && $.browser.version.substr(0,1) < 7 ) ) 
     14                                tbWindow.css({'top':'20px','margin-top':'0'}); 
     15                }; 
     16 
     17                return $('a.thickbox').each( function() { 
     18                        var href = $(this).attr('href'); 
     19                        if ( ! href ) 
     20                                return; 
     21                        href = href.replace(/&width=[0-9]+/g, ''); 
     22                        href = href.replace(/&height=[0-9]+/g, ''); 
     23                        $(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) ); 
     24                }); 
     25        }; 
     26 
     27        thickDims().click( function() { 
     28                $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'}); 
     29                $('#TB_ajaxWindowTitle').html('<strong>' + plugininstallL10n.plugin_information + '</strong>&nbsp;' + $(this).attr('title') ); 
     30                return false; 
     31        }); 
     32 
     33        $(window).resize( function() { tb_position() } ); 
     34}); 
     35 
     36/* Plugin install related JS*/ 
     37jQuery(function($) { 
     38        $('#install-plugins tbody.plugins tr').click( function() { 
     39                $(this).find('.action-links a.onclick').click(); 
     40                return false; 
     41        }); 
     42 
     43        $('#plugin-information #sidemenu a').click( function() { 
     44                var tab = $(this).attr('name'); 
     45                //Flip the tab 
     46                $('#plugin-information-header a.current').removeClass('current'); 
     47                $(this).addClass('current'); 
     48                //Flip the content. 
     49                $('#section-holder div').hide(); //Hide 'em all 
     50                $('#section-' + tab).show(); 
     51                return false; 
     52        }); 
     53}); 
     54 No newline at end of file 
  • wp-admin/menu.php

     
    7070 
    7171$submenu['plugins.php'][5] = array(__('Plugins'), 'activate_plugins', 'plugins.php'); 
    7272$submenu['plugins.php'][10] = array(__('Plugin Editor'), 'edit_plugins', 'plugin-editor.php'); 
     73$submenu['plugins.php'][15] = array(__('Install Plugins'), 'install_plugins', 'plugin-install.php'); 
    7374 
    7475$submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php'); 
    7576$submenu['themes.php'][10] = array(__('Theme Editor'), 'edit_themes', 'theme-editor.php'); 
  • wp-admin/plugin-install.php

     
     1<?php 
     2require_once('admin.php'); 
     3 
     4include(ABSPATH . 'wp-admin/includes/plugin-install.php'); 
     5 
     6$title = __('Install Plugins'); 
     7$parent_file = 'plugins.php'; 
     8 
     9if ( ! current_user_can('install_plugins') ) 
     10        wp_die(__('You do not have sufficient permissions to install plugins on this blog.')); 
     11 
     12wp_reset_vars( array('tab', 'paged') ); 
     13wp_enqueue_style( 'plugin-install' ); 
     14wp_enqueue_script( 'plugin-install' ); 
     15add_thickbox(); 
     16 
     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 
     18$tabs = array( 
     19                        'search'        => __('Search Plugins'), 
     20                        'upload'        => __('Upload a Plugin'), 
     21                        'featured'      => __('Featured Plugins'), 
     22                        'popular'       => __('Popular Plugins'), 
     23                        'new'           => __('Newest Plugins'), 
     24                        'updated'       => __('Recently Updated Plugins') 
     25                ); 
     26 
     27$tabs = apply_filters('install_plugins_tabs', $tabs ); 
     28 
     29if( empty($tab) || ( ! isset($tabs[ $tab ]) && ! in_array($tab, array('install', 'plugin-information')) ) ){ 
     30        $tab_actions = array_keys($tabs); 
     31        $tab = $tab_actions[0]; 
     32} 
     33if( empty($paged) ) 
     34        $paged = 1; 
     35 
     36$body_id = $tab; 
     37 
     38do_action('install_plugins_pre_' . $tab); 
     39 
     40include('admin-header.php'); 
     41?> 
     42<div class="wrap"> 
     43        <h2><?php _e('Install Plugins') ?></h2> 
     44        <ul class="subsubsub"> 
     45<?php 
     46$display_tabs = array(); 
     47foreach ( (array)$tabs as $action => $text ) { 
     48        $sep = ( end($tabs) != $text ) ? ' | ' : ''; 
     49        $class = ( $action == $tab ) ? ' class="current"' : ''; 
     50        $href = admin_url('plugin-install.php?tab='. $action); 
     51        echo "\t\t<li><a href='$href'$class>$text</a>$sep</li>\n"; 
     52} 
     53?> 
     54        </ul> 
     55        <?php do_action('install_plugins_' . $tab, $paged); ?> 
     56</div> 
     57<?php 
     58include('admin-footer.php'); 
     59?> 
     60 No newline at end of file 
  • wp-admin/plugins.php

     
    122122                                        <input type="hidden" name="verify-delete" value="1" /> 
    123123                                        <input type="hidden" name="delete-selected" value="1" /> 
    124124                                        <?php 
    125                                                 foreach( (array)$plugins as $plugin ) { 
    126                                                         $plugin = attribute_escape($plugin); 
    127                                                         echo "<input type='hidden' name='checked[]' value='$plugin' />"; 
    128                                                 } 
     125                                                foreach( (array)$plugins as $plugin ) 
     126                                                        echo '<input type="hidden" name="checked[]" value="' . attribute_escape($plugin) . '" />'; 
    129127                                        ?> 
    130128                                        <?php wp_nonce_field('bulk-manage-plugins') ?> 
    131129                                        <input type="submit" name="submit" value="<?php _e('Yes, Delete these files') ?>" class="button" /> 
     
    138136                                <div id="files-list" style="display:none;"> 
    139137                                        <ul> 
    140138                                        <?php 
    141                                                 foreach( (array)$files_to_delete as $file ) { 
    142                                                         $file = str_replace(ABSPATH, '', $file); 
    143                                                         echo "<li>$file</li>"; 
    144                                                 } 
     139                                                foreach( (array)$files_to_delete as $file ) 
     140                                                        echo '<li>' . str_replace(WP_PLUGIN_DIR, '', $file) . '</li>'; 
    145141                                        ?> 
    146142                                        </ul> 
    147143                                </div>                           
     
    161157} 
    162158 
    163159wp_enqueue_script('admin-forms'); 
     160wp_enqueue_script('plugin-install'); 
     161add_thickbox(); 
    164162 
    165163$title = __('Manage Plugins'); 
    166164require_once('admin-header.php'); 
     
    205203$active_plugins = array(); 
    206204$inactive_plugins = array(); 
    207205$recent_plugins = array(); 
    208 $recently_activated = (array)get_option('recently_activated'); 
     206$recently_activated = (array) get_option('recently_activated'); 
    209207 
    210208//Clean out any plugins which were deactivated over a week ago. 
    211209foreach( $recently_activated as $key => $time ) 
     
    374372<?php endif; ?> 
    375373 
    376374<h2><?php _e('Get More Plugins'); ?></h2> 
    377 <p><?php _e('You can find additional plugins for your site in the <a href="http://wordpress.org/extend/plugins/">WordPress plugin directory</a>.'); ?></p> 
    378 <p><?php printf(__('To install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory. Once a plugin is uploaded, you may activate it here.'), WP_PLUGIN_DIR); ?></p> 
     375<p><?php _e('You can find additional plugins for your site by using the new <a href="plugin-install.php">Plugin Browser/Installer</a> functionality, Or by browsing the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> directly and installing manually.'); ?></p> 
     376<p><?php printf(__('To <em>manually</em> install a plugin you generally just need to upload the plugin file into your <code>%s</code> directory.'), WP_PLUGIN_DIR); ?></p> 
     377<p><?php _e('Once a plugin has been installed, you may activate it here.'); ?></p> 
    379378 
    380379</div> 
    381380 
  • wp-admin/update.php

     
    55if ( ! current_user_can('update_plugins') ) 
    66        wp_die(__('You do not have sufficient permissions to update plugins for this blog.')); 
    77 
    8 function request_filesystem_credentials($form_post, $type = '', $error = false) { 
    9         $req_cred = apply_filters('request_filesystem_credentials', '', $form_post, $type, $error); 
    10         if ( '' !== $req_cred ) 
    11                 return $req_cred; 
    12  
    13         if ( empty($type) ) 
    14                 $type = get_filesystem_method(); 
    15  
    16         if ( 'direct' == $type ) 
    17                 return true; 
    18                  
    19         if( ! $credentials = get_option('ftp_credentials') ) 
    20                 $credentials = array(); 
    21         // If defined, set it to that, Else, If POST'd, set it to that, If not, Set it to whatever it previously was(saved details in option) 
    22         $credentials['hostname'] = defined('FTP_HOST') ? FTP_HOST : (!empty($_POST['hostname']) ? $_POST['hostname'] : $credentials['hostname']); 
    23         $credentials['username'] = defined('FTP_USER') ? FTP_USER : (!empty($_POST['username']) ? $_POST['username'] : $credentials['username']); 
    24         $credentials['password'] = defined('FTP_PASS') ? FTP_PASS : (!empty($_POST['password']) ? $_POST['password'] : $credentials['password']); 
    25         $credentials['ssl']      = defined('FTP_SSL')  ? FTP_SSL  : ( isset($_POST['ssl'])      ? $_POST['ssl']      : $credentials['ssl']); 
    26  
    27         if ( ! $error && !empty($credentials['password']) && !empty($credentials['username']) && !empty($credentials['hostname']) ) { 
    28                 $stored_credentials = $credentials; 
    29                 unset($stored_credentials['password']); 
    30                 update_option('ftp_credentials', $stored_credentials); 
    31                 return $credentials; 
    32         } 
    33         $hostname = ''; 
    34         $username = ''; 
    35         $password = ''; 
    36         $ssl = ''; 
    37         if ( !empty($credentials) ) 
    38                 extract($credentials, EXTR_OVERWRITE); 
    39         if( $error ) 
    40                 echo '<div id="message" class="error"><p>' . __('<strong>Error:</strong> There was an error connecting to the server, Please verify the settings are correct.') . '</p></div>'; 
    41 ?> 
    42 <form action="<?php echo $form_post ?>" method="post"> 
    43 <div class="wrap"> 
    44 <h2><?php _e('FTP Connection Information') ?></h2> 
    45 <p><?php _e('To perform the requested update, FTP connection information is required.') ?></p> 
    46 <table class="form-table"> 
    47 <tr valign="top"> 
    48 <th scope="row"><label for="hostname"><?php _e('Hostname:') ?></label></th> 
    49 <td><input name="hostname" type="text" id="hostname" value="<?php echo attribute_escape($hostname) ?>"<?php if( defined('FTP_HOST') ) echo ' disabled="disabled"' ?> size="40" /></td> 
    50 </tr> 
    51 <tr valign="top"> 
    52 <th scope="row"><label for="username"><?php _e('Username:') ?></label></th> 
    53 <td><input name="username" type="text" id="username" value="<?php echo attribute_escape($username) ?>"<?php if( defined('FTP_USER') ) echo ' disabled="disabled"' ?> size="40" /></td> 
    54 </tr> 
    55 <tr valign="top"> 
    56 <th scope="row"><label for="password"><?php _e('Password:') ?></label></th> 
    57 <td><input name="password" type="password" id="password" value=""<?php if( defined('FTP_PASS') ) echo ' disabled="disabled"' ?> size="40" /><?php if( defined('FTP_PASS') && !empty($password) ) echo '<em>'.__('(Password not shown)').'</em>'; ?></td> 
    58 </tr> 
    59 <tr valign="top"> 
    60 <th scope="row"><label for="ssl"><?php _e('Use SSL:') ?></label></th> 
    61 <td> 
    62 <select name="ssl" id="ssl"<?php if( defined('FTP_SSL') ) echo ' disabled="disabled"' ?>> 
    63 <?php 
    64 foreach ( array(0 => __('No'), 1 => __('Yes')) as $key => $value ) : 
    65         $selected = ($ssl == $value) ? 'selected="selected"' : ''; 
    66         echo "\n\t<option value='$key' $selected>" . $value . '</option>'; 
    67 endforeach; 
    68 ?> 
    69 </select> 
    70 </td> 
    71 </tr> 
    72 </table> 
    73 <p class="submit"> 
    74 <input type="submit" name="submit" value="<?php _e('Proceed'); ?>" /> 
    75 </p> 
    76 </div> 
    77 </form> 
    78 <?php 
    79         return false; 
    80 } 
    81  
    82 function show_message($message) { 
    83         if( is_wp_error($message) ){ 
    84                 if( $message->get_error_data() ) 
    85                         $message = $message->get_error_message() . ': ' . $message->get_error_data(); 
    86                 else  
    87                         $message = $message->get_error_message(); 
    88         } 
    89         echo "<p>$message</p>\n"; 
    90 } 
    91  
    928function do_plugin_upgrade($plugin) { 
    939        global $wp_filesystem; 
    9410 
  • wp-includes/category-template.php

     
    350350        if ( empty($tags) ) 
    351351                return; 
    352352 
     353        foreach ( $tags as $key => $tag ) { 
     354                $link = get_tag_link( $tag->term_id ); 
     355                if ( is_wp_error( $link ) ) 
     356                        return false; 
     357 
     358                $tags[ $key ]->link = $link; 
     359                $tags[ $key ]->id = $tag->term_id; 
     360        } 
     361 
    353362        $return = wp_generate_tag_cloud( $tags, $args ); // Here's where those top tags get sorted according to $args 
    354363 
    355         if ( is_wp_error( $return ) ) 
    356                 return false; 
    357  
    358364        $return = apply_filters( 'wp_tag_cloud', $return, $args ); 
    359365 
    360366        if ( 'array' == $args['format'] ) 
     
    363369        echo $return; 
    364370} 
    365371 
    366 // $tags = prefetched tag array ( get_tags() ) 
    367 // $args['format'] = 'flat' => whitespace separated, 'list' => UL, 'array' => array() 
    368 // $args['orderby'] = 'name', 'count' 
     372/** 
     373 * Generates a tag cloud (heatmap) from provided data 
     374 * 
     375 * TODO: Complete 
     376 *  
     377 * @since 2.6  
     378 * 
     379 * $tags = array of objects with the properties 'name', 'link', 'id', and 'count' 
     380 * $args['format'] = 'flat' => whitespace separated, 'list' => UL, 'array' => array() 
     381 * $args['orderby'] = 'name', 'count' 
     382*/ 
    369383function wp_generate_tag_cloud( $tags, $args = '' ) { 
    370384        global $wp_rewrite; 
    371385        $defaults = array( 
    372                 'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 'number' => 45, 
    373                 'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC' 
     386                'smallest' => 8, 'largest' => 22, 'unit' => 'pt', 
     387                'format' => 'flat', 'orderby' => 'name', 'order' => 'ASC', 
     388                'single_text' => '%d topic', 'multiple_text' => '%d topics' 
    374389        ); 
    375390        $args = wp_parse_args( $args, $defaults ); 
    376391        extract($args); 
    377392 
    378         if ( !$tags ) 
     393        if ( empty($tags) ) 
    379394                return; 
    380         $counts = $tag_links = array(); 
    381         foreach ( (array) $tags as $tag ) { 
    382                 $counts[$tag->name] = $tag->count; 
    383                 $tag_links[$tag->name] = get_tag_link( $tag->term_id ); 
    384                 if ( is_wp_error( $tag_links[$tag->name] ) ) 
    385                         return $tag_links[$tag->name]; 
    386                 $tag_ids[$tag->name] = $tag->term_id; 
    387         } 
    388395 
     396        $counts = array(); 
     397        foreach ( (array) $tags as $tag ) 
     398                $counts[ $tag->name ] = $tag->count; 
     399 
    389400        $min_count = min($counts); 
    390401        $spread = max($counts) - $min_count; 
    391402        if ( $spread <= 0 ) 
     
    416427        $rel = ( is_object($wp_rewrite) && $wp_rewrite->using_permalinks() ) ? ' rel="tag"' : ''; 
    417428 
    418429        foreach ( $counts as $tag => $count ) { 
    419                 $tag_id = $tag_ids[$tag]; 
    420                 $tag_link = clean_url($tag_links[$tag]); 
    421                 $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext('%d topic','%d topics',$count), $count ) ) . "'$rel style='font-size: " . 
     430                $tag_link = clean_url( $tags[ $tag ]->link ); 
     431                $tag_id = $tags[ $tag ]->id; 
     432                 
     433                $a[] = "<a href='$tag_link' class='tag-link-$tag_id' title='" . attribute_escape( sprintf( __ngettext($single_text, $multiple_text, $count), $count ) ) . "'$rel style='font-size: " . 
    422434                        ( $smallest + ( ( $count - $min_count ) * $font_step ) ) 
    423435                        . "$unit;'>$tag</a>"; 
    424436        } 
  • wp-includes/formatting.php

     
    14201420        return $str; 
    14211421} 
    14221422 
     1423/** 
     1424 * Add a Base url to relative links in passed content. 
     1425 * 
     1426 * By default it supports the 'src' and 'href' attributes, 
     1427 * However this may be changed via the 3rd param. 
     1428 * 
     1429 * @package WordPress 
     1430 * @since 2.7 
     1431 * 
     1432 * @param string $content String to search for links in 
     1433 * @param string $base The base URL to prefix to links 
     1434 * @param array $attrs The attributes which should be processed. 
     1435 * @eaturn string The processed content. 
     1436 */ 
     1437function links_add_base_url( $content, $base, $attrs = array('src', 'href') ) { 
     1438        $attrs = implode('|', (array)$attrs); 
     1439        return preg_replace_callback("!($attrs)=(['\"])(.+?)\\2!i",  
     1440                        create_function('$m', 'return _links_add_base($m, "' . $base . '");'), 
     1441                        $content); 
     1442} 
     1443 
     1444/** 
     1445 * Callback to add a base url to relative links in passed content. 
     1446 * 
     1447 * 
     1448 * @package WordPress 
     1449 * @since 2.7 
     1450 * 
     1451 * @internal 
     1452 * @param string $m The matched link 
     1453 * @param string $base The base URL to prefix to links 
     1454 * @eaturn string The processed link 
     1455 */ 
     1456function _links_add_base($m, $base) { 
     1457        //1 = attribute name  2 = quotation mark  3 = URL 
     1458        return $m[1] . '=' . $m[2] .  
     1459                (strpos($m[3], 'http://') === false ? 
     1460                        path_join($base, $m[3]) : 
     1461                        $m[3]) 
     1462                . $m[2]; 
     1463} 
     1464 
     1465/** 
     1466 * Adds a Target attribute to all links in passed content. 
     1467 * 
     1468 * This function by default only applies to <a> tags,  
     1469 * however this can be modified by the 3rd param. 
     1470 * NOTE: Any current target attributed will be striped and replaced. 
     1471 * 
     1472 * @package WordPress 
     1473 * @since 2.7 
     1474 * 
     1475 * @param string $content String to search for links in 
     1476 * @param string $target The Target to add to the links 
     1477 * @param array $tags An array of tags to apply to. 
     1478 * @eaturn string The processed content. 
     1479 */ 
     1480function links_add_target( $content, $target = '_blank', $tags = array('a') ) { 
     1481        $tags = implode('|', (array)$tags); 
     1482        return preg_replace_callback("!<($tags)(.+?)>!i",  
     1483                        create_function('$m', 'return _links_add_target($m, "' . $target . '");'), 
     1484                        $content); 
     1485} 
     1486/** 
     1487 * Callback to add a target attribute to all links in passed content 
     1488 * 
     1489 * 
     1490 * @package WordPress 
     1491 * @since 2.7 
     1492 * 
     1493 * @internal 
     1494 * @param string $m The matched link 
     1495 * @param string $target The Target to add to the links 
     1496 * @eaturn string The processed link. 
     1497 */ 
     1498function _links_add_target( $m, $target ) { 
     1499        $tag = $m[1]; 
     1500        $link = preg_replace('|(target=[\'"](.*?)[\'"])|i', '', $m[2]); 
     1501        return '<' . $tag . $link . ' target="' . $target . '">'; 
     1502} 
     1503 
    14231504?> 
  • wp-includes/script-loader.php

     
    201201                )); 
    202202                 
    203203                $scripts->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'jquery' ), '20080625' ); 
     204 
     205                $scripts->add( 'plugin-install', '/wp-admin/js/plugin-install.js', array( 'thickbox', 'jquery' ), '20080803' ); 
     206                $scripts->localize( 'plugin-install', 'plugininstallL10n', array( 
     207                        'plugin_information' => __('Plugin Information:') 
     208                ) ); 
     209                  
    204210        } 
    205211} 
    206212 
     
    234240        $styles->add_data( 'press-this-ie', 'conditional', 'gte IE 6' ); 
    235241        $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array(), '20080613' ); 
    236242        $styles->add( 'login', '/wp-admin/css/login.css' ); 
     243        $styles->add( 'plugin-install', '/wp-admin/css/plugin-install.css' ); 
    237244 
    238245        foreach ( $rtl_styles as $rtl_style ) 
    239246                $styles->add_data( $rtl_style, 'rtl', true ); 
  • wp-includes/version.php

     
    1515 * 
    1616 * @global int $wp_db_version 
    1717 */ 
    18 $wp_db_version = 8370; 
     18$wp_db_version = 8530; 
    1919 
    2020?>