Changeset 8540

Show
Ignore:
Timestamp:
08/04/08 21:01:09 (4 months ago)
Author:
westi
Message:

Plugin Install GSOC project first code drop. Props DD32 see #6015.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/css/colors-classic.css

    r8305 r8540  
    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} 
     
    322323} 
    323324 
    324 #rightnow .reallynow
     325#rightnow .reallynow, #plugin-information .action-button
    325326    background-color: #114973; 
    326327    color: #fff; 
     
    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; 
  • trunk/wp-admin/css/colors-fresh.css

    r8305 r8540  
    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} 
     
    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; 
     
    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; 
  • trunk/wp-admin/includes/class-wp-filesystem-ftpext.php

    r8009 r8540  
    120120    } 
    121121    function cwd() { 
    122         $cwd = ftp_pwd($this->link); 
     122        $cwd = @ftp_pwd($this->link); 
    123123        if( $cwd ) 
    124124            $cwd = trailingslashit($cwd); 
  • trunk/wp-admin/includes/dashboard.php

    r8137 r8540  
    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 = ''; 
     440 
     441        $ilink = wp_nonce_url('plugin-install.php?tab=install-confirmation&plugin=' . $slug, 'install-plugin_' . $slug) . 
     442                            '&TB_iframe=true&width=600&height=800'; 
    437443 
    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    } 
  • trunk/wp-admin/includes/file.php

    r8192 r8540  
    459459} 
    460460 
     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>'; 
    461494?> 
     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?> 
  • trunk/wp-admin/includes/misc.php

    r8236 r8540  
    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?> 
  • trunk/wp-admin/includes/schema.php

    r8433 r8540  
    278278    populate_roles_250(); 
    279279    populate_roles_260(); 
     280    populate_roles_270(); 
    280281} 
    281282 
     
    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?> 
  • trunk/wp-admin/includes/update.php

    r8317 r8540  
    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>'; 
  • trunk/wp-admin/includes/upgrade.php

    r8350 r8540  
    207207    if ( $wp_current_db_version < 8201 ) 
    208208        upgrade_260(); 
     209 
     210    if ( $wp_current_db_version < 8539 ) 
     211        upgrade_270(); 
    209212 
    210213    maybe_disable_automattic_widgets(); 
     
    755758    } 
    756759} 
     760 
     761function upgrade_270() { 
     762    if ( $wp_current_db_version < 8530 ) 
     763        populate_roles_270(); 
     764} 
     765 
    757766 
    758767// The functions we use to actually do stuff 
  • trunk/wp-admin/index.php

    r8211 r8540  
    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'); 
  • trunk/wp-admin/menu.php

    r8305 r8540  
    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'); 
  • trunk/wp-admin/plugins.php

    r8499 r8540  
    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') ?> 
     
    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> 
     
    162158 
    163159wp_enqueue_script('admin-forms'); 
     160wp_enqueue_script('plugin-install'); 
     161add_thickbox(); 
    164162 
    165163$title = __('Manage Plugins'); 
     
    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. 
     
    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> 
  • trunk/wp-admin/update.php

    r8060 r8540  
    55if ( ! current_user_can('update_plugins') ) 
    66    wp_die(__('You do not have sufficient permissions to update plugins for this blog.')); 
    7  
    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 } 
    917 
    928function do_plugin_upgrade($plugin) { 
  • trunk/wp-includes/category-template.php

    r8299 r8540  
    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 
    354  
    355     if ( is_wp_error( $return ) ) 
    356         return false; 
    357363 
    358364    $return = apply_filters( 'wp_tag_cloud', $return, $args ); 
     
    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     } 
     395 
     396    $counts = array(); 
     397    foreach ( (array) $tags as $tag ) 
     398        $counts[ $tag->name ] = $tag->count; 
    388399 
    389400    $min_count = min($counts); 
     
    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>"; 
  • trunk/wp-includes/formatting.php

    r8525 r8540  
    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?> 
  • trunk/wp-includes/script-loader.php

    r8512 r8540  
    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} 
     
    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 ) 
  • trunk/wp-includes/version.php

    r8433 r8540  
    1616 * @global int $wp_db_version 
    1717 */ 
    18 $wp_db_version = 8370
     18$wp_db_version = 8539
    1919 
    2020?>