WordPress.org

Make WordPress Core

Changeset 2979


Ignore:
Timestamp:
11/01/2005 09:28:03 PM (16 years ago)
Author:
ryan
Message:

wp_handle_upload() and image upload improvements from Andy. fixes #1806

Location:
trunk/wp-admin
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/admin-functions.php

    r2967 r2979  
    11<?php
    2 
    32
    43// Creates a new post from the "Write Post" form using $_POST information.
     
    286285    if (isset ($_POST['first_name']))
    287286        $user->first_name = wp_specialchars(trim($_POST['first_name']));
     287    if (isset ($_POST['middle_name']))
     288        $user->middle_name = wp_specialchars(trim($_POST['middle_name']));
    288289    if (isset ($_POST['last_name']))
    289290        $user->last_name = wp_specialchars(trim($_POST['last_name']));
     
    300301    if (isset ($_POST['yim']))
    301302        $user->yim = wp_specialchars(trim($_POST['yim']));
     303    if (isset ($_POST['flickr_username']))
     304        $user->flickr_username = wp_specialchars(trim($_POST['flickr_username']));
    302305
    303306    $errors = array ();
     
    15431546}
    15441547
     1548// array wp_handle_upload ( array &file [, array overrides] )
     1549// file: reference to a single element of $_FILES. Call the function once for each uploaded file.
     1550// overrides: an associative array of names=>values to override default variables with extract($overrides, EXTR_OVERWRITE).
     1551// On success, returns an associative array of file attributes.
     1552// On failure, returns $overrides['upload_error_handler'](&$file, $message) or array('error'=>$message).
     1553function wp_handle_upload(&$file, $overrides = false) {
     1554    // The default error handler.
     1555    function wp_handle_upload_error(&$file, $message) {
     1556        return array('error'=>$message);
     1557    }
     1558
     1559    // You may define your own function and pass the name in $overrides['upload_error_handler']
     1560    $upload_error_handler = 'wp_handle_upload_error';
     1561
     1562    // $_POST['action'] must be set and its value must equal $overrides['action'] or this:
     1563    $action = 'wp_handle_upload';
     1564
     1565    // Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
     1566    $upload_error_strings = array(false,
     1567        __("The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>."),
     1568        __("The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form."),
     1569        __("The uploaded file was only partially uploaded."),
     1570        __("No file was uploaded."),
     1571        __("Missing a temporary folder."),
     1572        __("Failed to write file to disk."));
     1573
     1574    // Accepted MIME types are set here as PCRE. Override with $override['mimes'].
     1575    $mimes = apply_filters('upload_mimes', array(
     1576            'image/jpeg'    =>  'jpg|jpeg|jpe',
     1577            'image/gif' =>  'gif',
     1578            'image/(png|x-png)' =>  'png',
     1579            'image/(bmp|x-bmp|x-ms-bmp)'    =>  'bmp',
     1580            'image/(tiff|x-tiff)'   =>  'tif|tiff',
     1581            'image/(ico|x-ico)' =>  'ico',
     1582            'video/(asf|x-asf|x-ms-asf)'    =>  'asf|asx|wma|wax|wmv|wmx',
     1583            'video/(wmv|x-wmv|x-ms-wmv)'    =>  'wmv',
     1584            'video/(msvideo|x-msvideo)' =>  'avi',
     1585            'video/(quicktime|x-quicktime)' =>  'mov|qt',
     1586            'video/(mpeg|x-mpeg)'   =>  'mpeg|mpg|mpe',
     1587            'text/plain'    =>  'txt|c|cc|h|php',
     1588            'text/richtext' =>  'rtx',
     1589            'text/css'  =>  'css',
     1590            'text/html' =>  'htm|html',
     1591            'text/javascript'   =>  'js',
     1592            'audio/(mpeg|x-mpeg|mpeg3|x-mpeg3)' =>  'mp3',
     1593            'audio/x-realaudio' =>  'ra|ram',
     1594            'audio/(wav|x-wav)' =>  'wav',
     1595            'audio/(ogg|x-ogg)' =>  'ogg',
     1596            'audio/(midi|x-midi)'   =>  'mid|midi',
     1597            'application/pdf'   =>  'pdf',
     1598            'application/msword'    =>  'doc',
     1599            'application/mspowerpoint'  =>  'pot|pps|ppt',
     1600            'application/mswrite'   =>  'wri',
     1601            'application/(msexcel|vnd.ms-excel)'    =>  'xla|xls|xlt|xlw',
     1602            'application/msaccess'  =>  'mdb',
     1603            'application/msproject' =>  'mpp',
     1604            'application/x-shockwave-flash' =>  'swf',
     1605            'application/java'  =>  'class',
     1606            'application/x-tar' =>  'tar',
     1607            'application/(zip|x-zip-compressed)'    =>  'zip',
     1608            'application/(x-gzip|x-gzip-compressed)'    =>  'gz|gzip'));
     1609
     1610    // For security, we never trust HTTP Content-Type headers unless the user overrides this.
     1611    $trust_content_type = false;
     1612
     1613    // All tests are on by default. Most can be turned off by $override[{test_name}] = false;
     1614    $test_form = true;
     1615    $test_size = true;
     1616    $test_type = true;
     1617
     1618    // Install user overrides. Did we mention that this voids your warranty?
     1619    if ( is_array($overrides) )
     1620        extract($overrides, EXTR_OVERWRITE);
     1621
     1622    // A correct form post will pass this test.
     1623    if ( $test_form && (!isset($_POST['action']) || ($_POST['action'] != $action)) )
     1624        return $upload_error_handler($file, __('Invalid form submission.'));
     1625
     1626    // A successful upload will pass this test. It makes no sense to override this one.
     1627    if ( $file['error'] > 0 )
     1628        return $upload_error_handler($file, $upload_error_strings[$file['error']]);
     1629
     1630    // A non-empty file will pass this test.
     1631    if ( $test_size && !($file['size'] > 0) )
     1632        return $upload_error_handler($file, __('File is empty. Please upload something more substantial.'));
     1633
     1634    // A properly uploaded file will pass this test. There should be no reason to override this one.
     1635    if (! is_uploaded_file($file['tmp_name']) )
     1636        return $upload_error_handler($file, __('Specified file failed upload test.'));
     1637
     1638    // A correct MIME type will pass this test. We can't always determine it programatically, so we'll trust the HTTP headers.
     1639    if ( $test_type ) {
     1640        $type = false;
     1641        $ext = false;
     1642        foreach ($mimes as $mime_preg => $ext_preg) {
     1643            $mime_preg = '!^' . $mime_preg . '$!i';
     1644            $ext_preg = '![^.]\.(' . $ext_preg . ')$!i';
     1645            if ( preg_match($mime_preg, $file['type'], $type) ) {
     1646                if ( preg_match($ext_preg, $file['name'], $ext) ) {
     1647                    break;
     1648                } else {
     1649                    return $upload_error_handler($file, __('File extension does not match file type. Try another.'));
     1650                }
     1651            }
     1652        }
     1653        if (! $type && $ext )
     1654            return $upload_error_handler($file, __('File type does not meet security guidelines. Try another.'));
     1655        $type = $type[0];
     1656        $ext = $ext[1];
     1657    }
     1658
     1659    // A writable uploads dir will pass this test. Again, there's no point overriding this one.
     1660    if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
     1661        return $upload_error_handler($file, $uploads['error']);
     1662
     1663    // Increment the file number until we have a unique file to save in $dir. Use $override['unique_filename_callback'] if supplied.
     1664    if ( isset($unique_filename_callback) && function_exists($unique_filename_callback) ) {
     1665        $filename = $unique_filename_callback($uploads['path'], $file['name']);
     1666    } else {
     1667        $number = '';
     1668        $filename = $file['name'];
     1669        while ( file_exists($uploads['path'] . "/$filename") )
     1670            $filename = str_replace("$number.$ext", ++$number . ".$ext", $filename);
     1671    }
     1672
     1673    // Move the file to the uploads dir
     1674    $new_file = $uploads['path'] . "/$filename";
     1675    if ( false === move_uploaded_file($file['tmp_name'], $new_file) )
     1676        die('The uploaded file could not be moved to $file.');
     1677
     1678    // Set correct file permissions
     1679    $stat = stat(dirname($new_file));
     1680    $perms = $stat['mode'] & 0000777;
     1681    @ chmod($new_file, $perms);
     1682
     1683    // Compute the URL
     1684    $url = $uploads['url'] . "/$filename";
     1685
     1686    return array('file' => $new_file, 'url' => $url);
     1687}
     1688
    15451689?>
  • trunk/wp-admin/image-uploading.php

    r2967 r2979  
    66    die(__('You do not have permission to edit posts.'));
    77
    8 $wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'object');
     8$wpvarstoreset = array('action', 'post', 'all', 'last', 'link', 'sort', 'start', 'imgtitle', 'descr', 'object', 'flickrtag');
    99
    1010for ($i=0; $i<count($wpvarstoreset); $i += 1) {
     
    2727
    2828function get_udims($width, $height) {
    29     if ( $height < 96 && $width < 128 )
     29    if ( $height <= 96 && $width <= 128 )
    3030        return array($width, $height);
    3131    elseif ( $width / $height > 4 / 3 )
     
    4545case 'save':
    4646
    47 // Define acceptable image extentions/types here. Tests will apply strtolower().
    48 $exts = array('gif' => IMAGETYPE_GIF, 'jpg' => IMAGETYPE_JPEG, 'png' => IMAGETYPE_PNG);
    49 
    50 // Define the error messages for bad uploads.
    51 $upload_err = array(false,
    52     __("The uploaded file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>."),
    53     __("The uploaded file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form."),
    54     __("The uploaded file was only partially uploaded."),
    55     __("No file was uploaded."),
    56     __("Missing a temporary folder."),
    57     __("Failed to write file to disk."));
    58 
    59 $iuerror = false;
    60 
    61 // Failing any single one of the following tests is fatal.
    62 
    63 // A correct form post will pass this test.
    64 if ( !isset($_POST['action']) || $_POST['action'] != 'save' || count($_FILES) != 1 || ! isset($_FILES['image']) || is_array($_FILES['image']['name']) )
    65     $error = __('Invalid form submission. Only submit approved forms.');
    66 
    67 // A successful upload will pass this test.
    68 elseif ( $_FILES['image']['error'] > 0 )
    69     $error = $upload_err[$_FILES['image']['error']];
    70 
    71 // A non-empty file will pass this test.
    72 elseif ( 0 == $_FILES['image']['size'] )
    73     $error = __('File is empty. Please upload something more substantial.');
    74 
    75 // A correct MIME category will pass this test. Full types are not consistent across browsers.
    76 elseif ( ! 'image/' == substr($_FILES['image']['type'], 0, 6) )
    77     $error = __('Bad MIME type submitted by your browser.');
    78 
    79 // An acceptable file extension will pass this test.
    80 elseif ( ! ( ( 0 !== preg_match('#\.?([^\.]*)$#', $_FILES['image']['name'], $matches) ) && ( $ext = strtolower($matches[1]) ) && array_key_exists($ext, $exts) ) )
    81     $error = __('Bad file extension.');
    82 
    83 // A valid uploaded file will pass this test.
    84 elseif ( ! is_uploaded_file($_FILES['image']['tmp_name']) )
    85     $error = __('Bad temp file. Try renaming the file and uploading again.');
    86 
    87 // A valid image file will pass this test.
    88 elseif ( function_exists('exif_imagetype') && $exts[$ext] != $imagetype = exif_imagetype($_FILES['image']['tmp_name']) )
    89     $error = __('Bad image file. Try again, or try recreating it.');
    90 
    91 // An image with at least one pixel will pass this test.
    92 elseif ( ! ( ( $imagesize = getimagesize($_FILES['image']['tmp_name']) ) && $imagesize[0] > 1 && $imagesize[1] > 1 ) )
    93     $error = __('The image has no pixels. Isn\'t that odd?');
    94 
    95 // A writable uploads dir will pass this test.
    96 elseif ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
    97     $error = $uploads['error'];
    98 
    99 if ( $error )
    100     // Something wasn't right. Abort and never touch the temp file again.
    101     die("$error <a href='".basename(__FILE__)."?action=upload&post=$post'>Back to Image Uploading</a>");
    102 
    103 // Increment the file number until we have a unique file to save in $dir
    104 $number = '';
    105 $filename = $_FILES['image']['name'];
    106 while ( file_exists($uploads['path'] . "/$filename") )
    107     $filename = str_replace("$number.$ext", ++$number . ".$ext", $filename);
    108 
    109 // Move the file to the uploads dir
    110 $file = $uploads['path'] . "/$filename";
    111 if ( false === move_uploaded_file($_FILES['image']['tmp_name'], $file) )
    112     die('The uploaded file could not be moved to $file.');
    113 chmod($file, 0666);  // FIXME: Need to set this according to rw bits on parent dir.
    114 
    115 // Compute the URL
    116 $url = $uploads['url'] . "/$filename";
     47$overrides = array('action'=>'save');
     48
     49$file = wp_handle_upload($_FILES['image'], $overrides);
     50
     51if ( isset($file['error']) )
     52    die($file['error'] . '<a href="' . basename(__FILE__) . '?action=upload&post="' . $post . '">Back to Image Uploading</a>');
     53
     54$url = $file['url'];
     55$file = $file['file'];
     56$filename = basename($file);
    11757
    11858// Construct the object array
     
    14282if ( $imagedata['width'] * $imagedata['height'] < 3 * 1024 * 1024 ) {
    14383    if ( $imagedata['width'] > 128 && $imagedata['width'] >= $imagedata['height'] * 4 / 3 )
    144         $error = wp_create_thumbnail($file, 128);
     84        $error = wp_create_thumbnail($file['file'], 128);
    14585    elseif ( $imagedata['height'] > 96 )
    14686        $error = wp_create_thumbnail($file, 96);
     
    261201break;
    262202
     203case 'flickr':
     204
     205require_once ABSPATH . WPINC . '/class-snoopy.php';
     206
     207function flickr_api_call($method, $params = '') {
     208    $api_key = '7cd7b7dea9c9d3069caf99d12471008e';  // An API key reserved for WordPress
     209    $searchurl = 'http://www.flickr.com/services/rest/?method=' . $method . '&api_key=' . $api_key . '&' . $params;
     210    $client = new Snoopy();
     211    $client->agent = 'WordPress/Flickr Browser';
     212    $client->read_timeout = 2;
     213    $client->use_gzip = true;
     214    @$client->fetch($searchurl);
     215    return $client->results;
     216}
     217
     218// How many images do we show? How many do we query?
     219$num = 5;
     220$double = $num * 2;
     221
     222$flickr_user_id = get_user_option('flickr_userid');
     223if($flickr_user_id == '') {
     224    $flickr_username = get_user_option('flickr_username');
     225    $user_xml = flickr_api_call('flickr.people.findByUsername', "username={$flickr_username}");
     226    if(preg_match('/nsid="(.*?)">/', $user_xml, $matches)) {
     227        $flickr_user_id = $matches[1];
     228    }
     229    else die("Failed to find Flickr ID for '$flickr_username'"); // Oh, dear - no Flickr user_id!
     230
     231    // Store the found Flickr user_id in usermeta...
     232    // Don't forget on the options page to update the user_id along with the username!
     233    update_user_option($current_user->id, 'flickr_userid', $flickr_user_id, true);
     234}
     235
     236// Fetch photo list from Flickr
     237$ustart = $start + 1;
     238//$photos_xml = flickr_api_call('flickr.photos.search', array('per_page' => $num,  'user_id' => $flickr_user_id));
     239if($flickrtag == '') {
     240    $all = '0';
     241    $photos_xml = flickr_api_call('flickr.people.getPublicPhotos', "per_page={$num}&user_id={$flickr_user_id}&page={$ustart}");
     242}
     243else {
     244    $photos_xml = flickr_api_call('flickr.photos.search', "per_page={$num}&user_id={$flickr_user_id}&page={$ustart}&tags={$flickrtag}");
     245    $all = '0&flickrtag=' . $flickrtag;
     246}
     247//echo "<pre>" . htmlentities($photos_xml) . "</pre>";  // Displays the XML returned by Flickr for the photo list
     248
     249//Get Page Count
     250preg_match('/<photos.*pages="([0-9]+)"/', $photos_xml, $page_counta);
     251$page_count = $page_counta[1];
     252if($page_count == 0) {
     253    $back = false;
     254    $next = false;
     255    break;
     256}
     257if($start < $page_count) $next = $start + 1; else $next = false;
     258if($start > 0) $back = $start - 1; else $back = false;
     259if($last != '') {
     260    $photos_xml = flickr_api_call('flickr.people.getPublicPhotos', "per_page={$num}&user_id={$flickr_user_id}&page={$page_count}");
     261    $back = $page_count -1;
     262    $next = false;
     263}
     264
     265//Get Photos
     266preg_match_all('/<photo.*?id="([0-9]+)".*?secret="([0-9a-f]+)".*?server="([0-9]+)".*?title="([^"]*)".*?\/>/', $photos_xml, $matches, PREG_SET_ORDER);
     267foreach($matches as $match) {
     268    $img['post_title'] = $match[4];
     269
     270    $sizes_xml = flickr_api_call('flickr.photos.getSizes', "photo_id={$match[1]}");
     271    preg_match_all('/<size.*?label="([^"]+)".*?width="([0-9]+)".*?height="([0-9]+)".*?source="([^"]+)".*?\/>/', $sizes_xml, $sizes, PREG_SET_ORDER);
     272
     273    $max_size = '';
     274    foreach($sizes as $size) {
     275        $img_size[$size[1]]['width'] = $size[2];
     276        $img_size[$size[1]]['height'] = $size[3];
     277        $img_size[$size[1]]['url'] = $size[4];
     278        if($max_size == '' || $img_size[$size[1]]['width'] > $img_size[$max_size]['width']) {
     279            $max_size = $size[1];
     280        }
     281    }
     282
     283    $images[] = array(
     284        'post_title' => $match[4],
     285        'thumbnail' => $img_size['Thumbnail']['url'],
     286        'full' => $img_size[$max_size]['url'],
     287        'href' => "http://flickr.com/photos/{$flickr_user_id}/{$match[1]}/",
     288        'width' => $img_size['Thumbnail']['width'],
     289        'height' => $img_size['Thumbnail']['height'],
     290        'size_info' => $img_size,
     291    );
     292}
     293
     294$current_flickr = ' class="current"';
     295
     296$__use_size = __('Use %s');
     297$__close = __('CLOSE');
     298
     299$images_script .= "var flickr_src = new Array();\n";
     300
     301$i=0;
     302foreach($images as $image) {
     303        list($uwidth, $uheight) = get_udims($image['width'], $image['height']);
     304        $xpadding = (128 - $uwidth) / 2;
     305        $ypadding = (96 - $uheight) / 2;
     306        $height_width = 'height="'.$uheight.'" width="'.$uwidth.'"';
     307        $images_style .= "#target$i img { padding: {$ypadding}px {$xpadding}px; }\n";
     308        $images_html .= "
     309            <div id='target$i' class='imagewrap left'>
     310                <div id='popup$i' class='popup'>
     311        ";
     312
     313        $images_script .= "flickr_src[$i] = new Array();\n";
     314        foreach($image['size_info'] as $szkey => $size) {
     315            $images_script .= "flickr_src[$i]['{$szkey}']= '{$size['url']}';\n";
     316            $use = sprintf($__use_size, $szkey);
     317            $prefix = ($szkey == 'Thumbnail') ? '<strong>':'';
     318            $postfix = ($szkey == 'Thumbnail') ? '</strong>':'';
     319            $images_html .= "<a id=\"I{$i}_{$szkey}\" onclick=\"toggleSize($i,'$szkey');return false;\" href=\"javascript:void();\">{$prefix}{$use}{$postfix}</a>\n";
     320        }
     321        $images_html .= "
     322                    <a onclick=\"popup.style.display='none';return false;\" href=\"javascript:void()\">$__close</a>
     323                </div>
     324                <a id=\"link$i\" class=\"imagelink\" href=\"{$image['href']}\" onclick=\"imagePopup($i);return false;\" title=\"{$image['post_title']}\">
     325                    <img id=\"image$i\" src=\"{$image['thumbnail']}\" alt=\"{$image['post_title']}\" $height_width />
     326                </a>
     327            </div>
     328        ";
     329        $i++;
     330}
     331
     332$images_width = ( count($images) * 133 ) + 5;
     333
     334break;
     335
    263336default:
    264337die('This script was not meant to be called directly.');
     
    323396    }
    324397}
     398function toggleSize(n,sz) {
     399    o = document.getElementById('image'+n);
     400    oi = document.getElementById('popup'+n);
     401    o.src = flickr_src[n][sz];
     402    if (!document.getElementsByTagName) return;
     403    var anchors = document.getElementsByTagName("a");
     404    var re_id = 'I'+n+'_'; // /i[0-9]+_.+/i;
     405    var re_strip = /<.*?>/i;
     406    for (var i=0; i< anchors.length; i++) {
     407        var anchor = anchors[i];
     408        if (anchor.getAttribute("href") && anchor.id.match(re_id))
     409            anchor.innerHTML = anchor.innerHTML.replace(re_strip, '');
     410    }
     411    var anchor = document.getElementById('I'+n+'_'+sz);
     412    anchor.innerHTML = '<strong>' + anchor.innerHTML + '</strong>';
     413}
    325414</script>
    326415<style type="text/css">
     
    348437padding: 5px 15px;
    349438height: 96px;
     439white-space: nowrap;
    350440width: <?php echo $images_width; ?>px;
    351441}
     
    356446.imagewrap {
    357447margin-right: 5px;
     448height: 96px;
     449overflow: hidden;
    358450}
    359451.imagewrap * {
     
    365457text-decoration: none;
    366458float: left;
    367 display: block;
     459/*display: block;*/
    368460text-align: center;
    369461}
     
    456548color: #000;
    457549}
     550#flickrtags {
     551    display: inline;
     552}
     553#flickrtags input {
     554    border:0px;
     555}
     556input#flickrtag {
     557    background-color: white;
     558    color: black;
     559    width:65px;
     560}
     561input#flickrsubmit {
     562    background-color: #dfe8f1;
     563    color: black;
     564}
    458565</style>
    459566</head>
     
    461568<ul id="menu">
    462569<li<?php echo $current_1; ?>><a href="image-uploading.php?action=upload&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>">Upload Photo</a></li>
     570<li<?php echo $current_flickr; ?>><a href="image-uploading.php?action=flickr&amp;post=<?php echo $post; ?>">Browse Flickr</a></li>
    463571<li<?php echo $current_2; ?>><a href="image-uploading.php?action=view&amp;post=<?php echo $post; ?>">Browse Attached</a></li>
    464572<li<?php echo $current_3; ?>><a href="image-uploading.php?action=view&amp;post=<?php echo $post; ?>&amp;all=true">Browse All</a></li>
    465573<li> </li>
    466574<?php if ( false !== $back ) : ?>
    467 <li class="spacer"><a href="image-uploading.php?action=view&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=0" title="First">|&lt;</a></li>
    468 <li><a href="image-uploading.php?action=view&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=<?php echo $back; ?>" title="Back">&lt;&lt;</a></li>
     575<li class="spacer"><a href="image-uploading.php?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=0" title="First">|&lt;</a></li>
     576<li><a href="image-uploading.php?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=<?php echo $back; ?>" title="Back">&lt;&lt;</a></li>
    469577<?php else : ?>
    470578<li class="inactive spacer">|&lt;</li>
    471579<li class="inactive">&lt;&lt;</li>
    472580<?php endif; ?>
     581
     582<?php if($action == 'flickr') : ?>
     583<form id="flickrtags" method="get"><?php echo sprintf(__('Tag: %s'), '<input type="text" id="flickrtag" name="flickrtag" value="' . $flickrtag . '" />'); ?><input id="flickrsubmit" type="submit" value="Filter" /><?php
     584parse_str($_SERVER['QUERY_STRING'], $formquery);
     585foreach($formquery as $k=>$v) if($k!='flickrtag') echo "<input type=\"hidden\" name=\"$k\" value=\"$v\" />";
     586?></form>
     587<?php endif; ?>
     588
    473589<?php if ( false !== $next ) : ?>
    474 <li><a href="image-uploading.php?action=view&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=<?php echo $next; ?>" title="Next">&gt;&gt;</a></li>
    475 <li><a href="image-uploading.php?action=view&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;last=true" title="Last">&gt;|</a></li>
     590<li><a href="image-uploading.php?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;start=<?php echo $next; ?>" title="Next">&gt;&gt;</a></li>
     591<li><a href="image-uploading.php?action=<?php echo $action; ?>&amp;post=<?php echo $post; ?>&amp;all=<?php echo $all; ?>&amp;last=true" title="Last">&gt;|</a></li>
    476592<?php else : ?>
    477593<li class="inactive">&gt;&gt;</li>
     
    479595<?php endif; ?>
    480596</ul>
    481 <?php if ( $action == 'view' ) : ?>
    482 <span class="left tip">Drag and drop photos to post</span>
    483 <span class="right tip">Click photos for more options</span>
     597<?php if ( $action == 'view' || $action == 'flickr' ) : ?>
     598<span class="left tip"><?php _e('Drag and drop photos to post'); ?></span>
     599<span class="right tip"><?php _e('Click photos for more options'); ?></span>
    484600<div id="wrap">
    485601<div id="images">
     
    487603</div>
    488604</div>
    489 <?php elseif ( $action = 'upload' ) : ?>
     605<?php elseif ( $action == 'upload' ) : ?>
    490606<div class="center tip">Duplicated filenames will be numbered (photo.jpg, photo1.jpg, etc.)</div>
    491607<form enctype="multipart/form-data" id="uploadForm" method="POST" action="image-uploading.php" onsubmit="return validateImageName()">
     
    504620</body>
    505621</html>
     622
     623
     624
  • trunk/wp-admin/profile.php

    r2872 r2979  
    3434<input type="text" name="first_name" value="<?php echo $profiledata->first_name ?>" /></label></p>
    3535
     36<p><label><?php _e('Middle name:') ?><br />
     37<input type="text" name="middle_name" value="<?php echo $profiledata->middle_name ?>" /></label></p>
     38
    3639<p><label><?php _e('Last name:') ?><br />
    3740<input type="text" name="last_name"  value="<?php echo $profiledata->last_name ?>" /></label></p>
     
    5457<option value="<?php echo $profiledata->first_name." ".$profiledata->last_name ?>"><?php echo $profiledata->first_name." ".$profiledata->last_name ?></option>
    5558<option value="<?php echo $profiledata->last_name." ".$profiledata->first_name ?>"><?php echo $profiledata->last_name." ".$profiledata->first_name ?></option>
     59<?php if ( !empty( $profiledata->middle_name ) ) : ?>
     60<option value="<?php echo $n = $profiledata->first_name." ".$profiledata->middle_name." ".$profiledata->last_name ?>"><?php echo $n ?></option>
     61<?php endif; ?>
    5662<?php endif; ?>
    5763</select></label></p>
     
    6672<p><label><?php _e('Website:') ?><br />
    6773<input type="text" name="url" value="<?php echo $profiledata->user_url ?>" />
     74</label></p>
     75
     76<p><label><?php _e('Flickr Username:') ?><br />
     77<input type="text" name="flickr_username" value="<?php echo $profiledata->flickr_username ?>" />
    6878</label></p>
    6979
Note: See TracChangeset for help on using the changeset viewer.