From 73c4f8cfad7d38344c2757e9a611b4ce52f5788e Mon Sep 17 00:00:00 2001 From: mikelittle Date: Tue, 3 Jun 2003 22:42:13 +0000 Subject: [PATCH] Check for no links returned stops error git-svn-id: http://svn.automattic.com/wordpress/trunk@151 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/linkmanager.php | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/wp-admin/linkmanager.php b/wp-admin/linkmanager.php index 1a8c7ce8c2..3851549d1e 100644 --- a/wp-admin/linkmanager.php +++ b/wp-admin/linkmanager.php @@ -453,20 +453,21 @@ switch ($action) { // echo "$sql"; $links = $wpdb->get_results($sql); - foreach ($links as $link) { - $short_url = str_replace('http://', '', $link->link_url); - $short_url = str_replace('www.', '', $short_url); - if ('/' == substr($short_url, -1)) $short_url = substr($short_url, 0, -1); - if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; + if ($links) { + foreach ($links as $link) { + $short_url = str_replace('http://', '', $link->link_url); + $short_url = str_replace('www.', '', $short_url); + if ('/' == substr($short_url, -1)) $short_url = substr($short_url, 0, -1); + if (strlen($short_url) > 35) $short_url = substr($short_url, 0, 32).'...'; - $link->link_name = stripslashes($link->link_name); - $link->category = stripslashes($link->category); - $link->link_rel = stripslashes($link->link_rel); - $image = ($link->link_image != null) ? 'Yes' : 'No'; - $visible = ($link->link_visible == 'Y') ? 'Yes' : 'No'; - ++$i; - $style = ($i % 2) ? ' class="alternate"' : ''; -echo <<link_name = stripslashes($link->link_name); + $link->category = stripslashes($link->category); + $link->link_rel = stripslashes($link->link_rel); + $image = ($link->link_image != null) ? 'Yes' : 'No'; + $visible = ($link->link_visible == 'Y') ? 'Yes' : 'No'; + ++$i; + $style = ($i % 2) ? ' class="alternate"' : ''; + echo << $link->link_name
Description: $link->link_description @@ -479,7 +480,8 @@ echo << LINKS; - } + } + } ?>