Make WordPress Core


Ignore:
Timestamp:
02/27/2007 03:24:54 PM (17 years ago)
Author:
markjaquith
Message:

trailing tabs and whitespace cleanup.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/link-import.php

    r4734 r4953  
    1313<?php
    1414switch ($step) {
    15     case 0:
    16     {
    17         include_once('admin-header.php');
    18         if ( !current_user_can('manage_links') )
    19             wp_die(__('Cheatin&#8217; uh?'));
     15    case 0: {
     16        include_once('admin-header.php');
     17        if ( !current_user_can('manage_links') )
     18            wp_die(__('Cheatin&#8217; uh?'));
    2019
    21         $opmltype = 'blogrolling'; // default.
     20        $opmltype = 'blogrolling'; // default.
    2221?>
    2322
    2423<div class="wrap">
     24
    2525<h2><?php _e('Import your blogroll from another system') ?> </h2>
    2626<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
     
    4040<input id="userfile" name="userfile" type="file" size="30" />
    4141</div>
    42 
    4342
    4443</div>
     
    6160</div>
    6261<?php
    63                 break;
    64             } // end case 0
     62        break;
     63    } // end case 0
    6564
    66     case 1: {
     65    case 1: {
    6766        check_admin_referer('import-bookmarks');
    6867
    69                 include_once('admin-header.php');
    70                 if ( !current_user_can('manage_links') )
    71                     wp_die(__('Cheatin&#8217; uh?'));
     68        include_once('admin-header.php');
     69        if ( !current_user_can('manage_links') )
     70            wp_die(__('Cheatin&#8217; uh?'));
    7271?>
    7372<div class="wrap">
    7473
    75      <h2><?php _e('Importing...') ?></h2>
     74<h2><?php _e('Importing...') ?></h2>
    7675<?php
    77                 $cat_id = $_POST['cat_id'];
    78                 if (($cat_id == '') || ($cat_id == 0)) {
    79                     $cat_id  = 1;
    80                 }
     76        $cat_id = $_POST['cat_id'];
     77        if ( $cat_id == '' || $cat_id == 0 )
     78            $cat_id  = 1;
    8179
    82                 $opml_url = $_POST['opml_url'];
    83                 if (isset($opml_url) && $opml_url != '' && $opml_url != 'http://') {
    84                     $blogrolling = true;
    85                 }
    86                 else // try to get the upload file.
    87                 {
    88                     $overrides = array('test_form' => false, 'test_type' => false);
    89                     $file = wp_handle_upload($_FILES['userfile'], $overrides);
     80        $opml_url = $_POST['opml_url'];
     81        if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
     82            $blogrolling = true;
     83        } else { // try to get the upload file.
     84            $overrides = array('test_form' => false, 'test_type' => false);
     85            $file = wp_handle_upload($_FILES['userfile'], $overrides);
    9086
    91                     if ( isset($file['error']) )
    92                         wp_die($file['error']);
     87            if ( isset($file['error']) )
     88                wp_die($file['error']);
    9389
    94                     $url = $file['url'];
    95                     $opml_url = $file['file'];
    96                     $blogrolling = false;
    97                 }
     90            $url = $file['url'];
     91            $opml_url = $file['file'];
     92            $blogrolling = false;
     93        }
    9894
    99                 if (isset($opml_url) && $opml_url != '') {
    100                     $opml = wp_remote_fopen($opml_url);
    101                     include_once('link-parse-opml.php');
     95        if ( isset($opml_url) && $opml_url != '' ) {
     96            $opml = wp_remote_fopen($opml_url);
     97            include_once('link-parse-opml.php');
    10298
    103                     $link_count = count($names);
    104                     for ($i = 0; $i < $link_count; $i++) {
    105                         if ('Last' == substr($titles[$i], 0, 4))
    106                             $titles[$i] = '';
    107                         if ('http' == substr($titles[$i], 0, 4))
    108                             $titles[$i] = '';
    109                         $link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);                       
    110                         wp_insert_link($link);
    111                         echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
    112                     }
     99            $link_count = count($names);
     100            for ( $i = 0; $i < $link_count; $i++ ) {
     101                if ('Last' == substr($titles[$i], 0, 4))
     102                    $titles[$i] = '';
     103                if ( 'http' == substr($titles[$i], 0, 4) )
     104                    $titles[$i] = '';
     105                $link = array( 'link_url' => $urls[$i], 'link_name' => $wpdb->escape($names[$i]), 'link_category' => array($cat_id), 'link_description' => $wpdb->escape($descriptions[$i]), 'link_owner' => $user_ID, 'link_rss' => $feeds[$i]);
     106                wp_insert_link($link);
     107                echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
     108            }
    113109?>
    114      <p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
     110
     111<p><?php printf(__('Inserted %1$d links into category %2$s. All done! Go <a href="%3$s">manage those links</a>.'), $link_count, $cat_id, 'link-manager.php') ?></p>
     112
    115113<?php
    116                 } // end if got url
    117                 else
    118                 {
    119                     echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
    120                 } // end else
     114} // end if got url
     115else
     116{
     117    echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
     118} // end else
    121119
    122                 if ( ! $blogrolling )
    123                     @unlink($opml_url);
     120if ( ! $blogrolling )
     121    @unlink($opml_url);
    124122?>
    125123</div>
    126124<?php
    127                 break;
    128             } // end case 1
     125        break;
     126    } // end case 1
    129127} // end switch
    130128
Note: See TracChangeset for help on using the changeset viewer.