trailing tabs and whitespace cleanup.

git-svn-id: http://svn.automattic.com/wordpress/trunk@4953 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
markjaquith 2007-02-27 15:24:54 +00:00
parent c7ce6107ad
commit d0f79bb3f2
36 changed files with 200 additions and 202 deletions

View File

@ -12,16 +12,16 @@ if (!$step) $step = 0;
?> ?>
<?php <?php
switch ($step) { switch ($step) {
case 0: case 0: {
{ include_once('admin-header.php');
include_once('admin-header.php'); if ( !current_user_can('manage_links') )
if ( !current_user_can('manage_links') ) wp_die(__('Cheatin&#8217; uh?'));
wp_die(__('Cheatin&#8217; uh?'));
$opmltype = 'blogrolling'; // default. $opmltype = 'blogrolling'; // default.
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Import your blogroll from another system') ?> </h2> <h2><?php _e('Import your blogroll from another system') ?> </h2>
<form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll"> <form enctype="multipart/form-data" action="link-import.php" method="post" name="blogroll">
<?php wp_nonce_field('import-bookmarks') ?> <?php wp_nonce_field('import-bookmarks') ?>
@ -40,7 +40,6 @@ switch ($step) {
<input id="userfile" name="userfile" type="file" size="30" /> <input id="userfile" name="userfile" type="file" size="30" />
</div> </div>
</div> </div>
<p style="clear: both; margin-top: 1em;"><?php _e('Now select a category you want to put these links in.') ?><br /> <p style="clear: both; margin-top: 1em;"><?php _e('Now select a category you want to put these links in.') ?><br />
@ -60,72 +59,71 @@ foreach ($categories as $category) {
</div> </div>
<?php <?php
break; break;
} // end case 0 } // end case 0
case 1: { case 1: {
check_admin_referer('import-bookmarks'); check_admin_referer('import-bookmarks');
include_once('admin-header.php'); include_once('admin-header.php');
if ( !current_user_can('manage_links') ) if ( !current_user_can('manage_links') )
wp_die(__('Cheatin&#8217; uh?')); wp_die(__('Cheatin&#8217; uh?'));
?> ?>
<div class="wrap"> <div class="wrap">
<h2><?php _e('Importing...') ?></h2> <h2><?php _e('Importing...') ?></h2>
<?php <?php
$cat_id = $_POST['cat_id']; $cat_id = $_POST['cat_id'];
if (($cat_id == '') || ($cat_id == 0)) { if ( $cat_id == '' || $cat_id == 0 )
$cat_id = 1; $cat_id = 1;
}
$opml_url = $_POST['opml_url']; $opml_url = $_POST['opml_url'];
if (isset($opml_url) && $opml_url != '' && $opml_url != 'http://') { if ( isset($opml_url) && $opml_url != '' && $opml_url != 'http://' ) {
$blogrolling = true; $blogrolling = true;
} } else { // try to get the upload file.
else // try to get the upload file. $overrides = array('test_form' => false, 'test_type' => false);
{ $file = wp_handle_upload($_FILES['userfile'], $overrides);
$overrides = array('test_form' => false, 'test_type' => false);
$file = wp_handle_upload($_FILES['userfile'], $overrides);
if ( isset($file['error']) ) if ( isset($file['error']) )
wp_die($file['error']); wp_die($file['error']);
$url = $file['url']; $url = $file['url'];
$opml_url = $file['file']; $opml_url = $file['file'];
$blogrolling = false; $blogrolling = false;
} }
if (isset($opml_url) && $opml_url != '') { if ( isset($opml_url) && $opml_url != '' ) {
$opml = wp_remote_fopen($opml_url); $opml = wp_remote_fopen($opml_url);
include_once('link-parse-opml.php'); include_once('link-parse-opml.php');
$link_count = count($names); $link_count = count($names);
for ($i = 0; $i < $link_count; $i++) { for ( $i = 0; $i < $link_count; $i++ ) {
if ('Last' == substr($titles[$i], 0, 4)) if ('Last' == substr($titles[$i], 0, 4))
$titles[$i] = ''; $titles[$i] = '';
if ('http' == substr($titles[$i], 0, 4)) if ( 'http' == substr($titles[$i], 0, 4) )
$titles[$i] = ''; $titles[$i] = '';
$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]); $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]);
wp_insert_link($link); wp_insert_link($link);
echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]); echo sprintf('<p>'.__('Inserted <strong>%s</strong>').'</p>', $names[$i]);
} }
?> ?>
<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>
<?php
} // end if got url
else
{
echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
} // end else
if ( ! $blogrolling ) <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>
@unlink($opml_url);
<?php
} // end if got url
else
{
echo "<p>" . __("You need to supply your OPML url. Press back on your browser and try again") . "</p>\n";
} // end else
if ( ! $blogrolling )
@unlink($opml_url);
?> ?>
</div> </div>
<?php <?php
break; break;
} // end case 1 } // end case 1
} // end switch } // end switch
include('admin-footer.php'); include('admin-footer.php');

View File

@ -351,14 +351,14 @@ function wp_get_archives($args = '') {
} elseif ('yearly' == $type) { } elseif ('yearly' == $type) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type ='post' AND post_status = 'publish' GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit); $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, count(ID) as posts FROM $wpdb->posts WHERE post_type ='post' AND post_status = 'publish' GROUP BY YEAR(post_date) ORDER BY post_date DESC" . $limit);
if ($arcresults) { if ($arcresults) {
$afterafter = $after; $afterafter = $after;
foreach ($arcresults as $arcresult) { foreach ($arcresults as $arcresult) {
$url = get_year_link($arcresult->year); $url = get_year_link($arcresult->year);
$text = sprintf('%d', $arcresult->year); $text = sprintf('%d', $arcresult->year);
if ($show_post_count) if ($show_post_count)
$after = '&nbsp;('.$arcresult->posts.')' . $afterafter; $after = '&nbsp;('.$arcresult->posts.')' . $afterafter;
echo get_archives_link($url, $text, $format, $before, $after); echo get_archives_link($url, $text, $format, $before, $after);
} }
} }
} elseif ( 'daily' == $type ) { } elseif ( 'daily' == $type ) {
$arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit); $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth`, count(ID) as posts FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date), DAYOFMONTH(post_date) ORDER BY post_date DESC" . $limit);