2003-05-22 08:12:53 -04:00
|
|
|
<?php
|
|
|
|
// Links
|
2003-08-09 19:10:16 -04:00
|
|
|
// Copyright (C) 2002, 2003 Mike Little -- mike@zed1.com
|
2004-10-18 23:03:06 -04:00
|
|
|
require_once('admin.php');
|
2004-04-25 19:49:45 -04:00
|
|
|
$title = __('Link Categories');
|
2003-12-10 19:22:36 -05:00
|
|
|
$this_file='link-categories.php';
|
|
|
|
$parent_file = 'link-manager.php';
|
2003-05-22 08:12:53 -04:00
|
|
|
|
2004-10-18 23:03:06 -04:00
|
|
|
$wpvarstoreset = array('action', 'cat', 'auto_toggle');
|
2003-12-18 04:36:13 -05:00
|
|
|
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
|
|
|
$wpvar = $wpvarstoreset[$i];
|
|
|
|
if (!isset($$wpvar)) {
|
2004-04-19 04:09:27 -04:00
|
|
|
if (empty($_POST["$wpvar"])) {
|
|
|
|
if (empty($_GET["$wpvar"])) {
|
2003-12-18 04:36:13 -05:00
|
|
|
$$wpvar = '';
|
2003-05-22 08:12:53 -04:00
|
|
|
} else {
|
2004-04-19 04:09:27 -04:00
|
|
|
$$wpvar = $_GET["$wpvar"];
|
2003-05-22 08:12:53 -04:00
|
|
|
}
|
|
|
|
} else {
|
2004-04-19 04:09:27 -04:00
|
|
|
$$wpvar = $_POST["$wpvar"];
|
2003-05-22 08:12:53 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
switch ($action) {
|
2003-12-27 15:55:03 -05:00
|
|
|
case 'addcat':
|
2003-05-22 08:12:53 -04:00
|
|
|
{
|
2004-09-04 20:24:28 -04:00
|
|
|
if ($user_level < 5)
|
2004-04-25 19:49:45 -04:00
|
|
|
die (__("Cheatin' uh ?"));
|
2003-07-30 10:44:57 -04:00
|
|
|
|
2004-12-12 15:41:19 -05:00
|
|
|
$cat_name = wp_specialchars($_POST['cat_name']);
|
2004-04-19 04:09:27 -04:00
|
|
|
$auto_toggle = $_POST['auto_toggle'];
|
2003-05-22 08:12:53 -04:00
|
|
|
if ($auto_toggle != 'Y') {
|
|
|
|
$auto_toggle = 'N';
|
|
|
|
}
|
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$show_images = $_POST['show_images'];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($show_images != 'Y') {
|
|
|
|
$show_images = 'N';
|
|
|
|
}
|
2003-10-08 18:32:01 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$show_description = $_POST['show_description'];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($show_description != 'Y') {
|
|
|
|
$show_description = 'N';
|
|
|
|
}
|
2003-10-08 18:32:01 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$show_rating = $_POST['show_rating'];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($show_rating != 'Y') {
|
|
|
|
$show_rating = 'N';
|
|
|
|
}
|
2003-10-08 18:32:01 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$show_updated = $_POST['show_updated'];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($show_updated != 'Y') {
|
|
|
|
$show_updated = 'N';
|
|
|
|
}
|
2003-10-08 18:32:01 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$sort_order = $_POST['sort_order'];
|
2003-10-08 18:32:01 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$sort_desc = $_POST['sort_desc'];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($sort_desc != 'Y') {
|
|
|
|
$sort_desc = 'N';
|
|
|
|
}
|
2004-04-19 04:09:27 -04:00
|
|
|
$text_before_link = addslashes($_POST['text_before_link']);
|
|
|
|
$text_after_link = addslashes($_POST['text_after_link']);
|
|
|
|
$text_after_all = addslashes($_POST['text_after_all']);
|
2003-07-30 10:44:57 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$list_limit = $_POST['list_limit'];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($list_limit == '')
|
|
|
|
$list_limit = -1;
|
|
|
|
|
2004-05-24 04:22:18 -04:00
|
|
|
$wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name, auto_toggle, show_images, show_description, \n" .
|
2003-07-30 10:44:57 -04:00
|
|
|
" show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, text_after_all, list_limit) \n" .
|
|
|
|
" VALUES ('0', '$cat_name', '$auto_toggle', '$show_images', '$show_description', \n" .
|
|
|
|
" '$show_rating', '$show_updated', '$sort_order', '$sort_desc', '$text_before_link', '$text_after_link', \n" .
|
|
|
|
" '$text_after_all', $list_limit)");
|
|
|
|
|
2003-12-27 15:55:03 -05:00
|
|
|
header('Location: link-categories.php');
|
2003-05-22 08:12:53 -04:00
|
|
|
break;
|
|
|
|
} // end addcat
|
2003-12-27 15:55:03 -05:00
|
|
|
case 'Delete':
|
2003-05-22 08:12:53 -04:00
|
|
|
{
|
2004-12-12 15:41:19 -05:00
|
|
|
$cat_id = (int) $_GET['cat_id'];
|
2003-05-22 08:12:53 -04:00
|
|
|
$cat_name=get_linkcatname($cat_id);
|
|
|
|
|
|
|
|
if ($cat_id=="1")
|
2004-04-25 19:49:45 -04:00
|
|
|
die(sprintf(__("Can't delete the <strong>%s</strong> link category: this is the default one"), $cat_name));
|
2003-05-22 08:12:53 -04:00
|
|
|
|
2004-09-04 20:24:28 -04:00
|
|
|
if ($user_level < 5)
|
2004-04-25 19:49:45 -04:00
|
|
|
die (__("Cheatin' uh ?"));
|
2003-07-30 10:44:57 -04:00
|
|
|
|
2004-05-24 04:22:18 -04:00
|
|
|
$wpdb->query("DELETE FROM $wpdb->linkcategories WHERE cat_id='$cat_id'");
|
|
|
|
$wpdb->query("UPDATE $wpdb->links SET link_category=1 WHERE link_category='$cat_id'");
|
2003-05-22 08:12:53 -04:00
|
|
|
|
2003-12-27 15:55:03 -05:00
|
|
|
header('Location: link-categories.php');
|
2003-05-22 08:12:53 -04:00
|
|
|
break;
|
|
|
|
} // end delete
|
2003-12-27 15:55:03 -05:00
|
|
|
case 'Edit':
|
2003-05-22 08:12:53 -04:00
|
|
|
{
|
2003-12-27 15:55:03 -05:00
|
|
|
include_once ('admin-header.php');
|
2004-12-12 15:41:19 -05:00
|
|
|
$cat_id = (int) $_GET['cat_id'];
|
2003-07-30 10:44:57 -04:00
|
|
|
$row = $wpdb->get_row("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
|
|
|
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
2004-05-24 04:22:18 -04:00
|
|
|
. " text_after_all, list_limit FROM $wpdb->linkcategories WHERE cat_id=$cat_id");
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($row) {
|
|
|
|
if ($row->list_limit == -1) {
|
|
|
|
$row->list_limit = '';
|
|
|
|
}
|
2003-05-22 08:12:53 -04:00
|
|
|
?>
|
2003-12-07 22:46:42 -05:00
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
<div class="wrap">
|
2005-02-24 19:20:48 -05:00
|
|
|
<h2><?php printf('Edit “%s” Category', wp_specialchars($row->cat_name)); ?></h2>
|
2004-04-19 04:09:27 -04:00
|
|
|
|
2003-12-27 15:55:03 -05:00
|
|
|
<form name="editcat" method="post">
|
2003-05-22 08:12:53 -04:00
|
|
|
<input type="hidden" name="action" value="editedcat" />
|
2003-07-30 10:44:57 -04:00
|
|
|
<input type="hidden" name="cat_id" value="<?php echo $row->cat_id ?>" />
|
2004-04-19 04:09:27 -04:00
|
|
|
<fieldset class="options">
|
2004-04-25 19:49:45 -04:00
|
|
|
<legend><?php _e('Category Options') ?></legend>
|
2004-04-19 04:09:27 -04:00
|
|
|
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th width="33%" scope="row"><?php _e('Name:') ?></th>
|
2004-12-12 15:41:19 -05:00
|
|
|
<td width="67%"><input name="cat_name" type="text" value="<?php echo wp_specialchars($row->cat_name)?>" size="30" /></td>
|
2004-04-19 04:09:27 -04:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Show:') ?></th>
|
2003-07-30 10:44:57 -04:00
|
|
|
<td>
|
2004-04-19 04:09:27 -04:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="show_images" value="Y" <?php checked('Y', $row->show_images); ?> />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Image') ?></label> <br />
|
2004-04-19 04:09:27 -04:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="show_description" value="Y" <?php checked('Y', $row->show_description); ?> />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Description') ?></label>
|
|
|
|
<?php _e('(shown in <code>title</code> regardless)') ?><br />
|
2004-04-19 04:09:27 -04:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="show_rating" value="Y" <?php checked('Y', $row->show_rating); ?> />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Rating') ?></label> <br />
|
2004-04-19 04:09:27 -04:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="show_updated" value="Y" <?php checked('Y', $row->show_updated); ?> />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Updated') ?></label>
|
|
|
|
<?php _e('(shown in <code>title</code> regardless)') ?></td>
|
2004-04-19 04:09:27 -04:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Sort order:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td>
|
|
|
|
<select name="sort_order" size="1">
|
2004-06-11 14:23:12 -04:00
|
|
|
<option value="name" <?php echo ($row->sort_order == 'name') ? 'selected="selected"' : ''?>><?php _e('Name') ?></option>
|
2004-04-25 19:49:45 -04:00
|
|
|
<option value="id" <?php echo ($row->sort_order == 'id') ? 'selected' : ''?>><?php _e('Id') ?></option>
|
|
|
|
<option value="url" <?php echo ($row->sort_order == 'url') ? 'selected' : ''?>><?php _e('URL') ?></option>
|
|
|
|
<option value="rating" <?php echo ($row->sort_order == 'rating') ? 'selected' : ''?>><?php _e('Rating') ?></option>
|
|
|
|
<option value="updated" <?php echo ($row->sort_order == 'updated') ? 'selected' : ''?>><?php _e('Updated') ?></option>
|
|
|
|
<option value="rand" <?php echo ($row->sort_order == 'rand') ? 'selected' : ''?>><?php _e('Random') ?></option>
|
|
|
|
<option value="length" <?php echo ($row->sort_order == 'length') ? 'selected' : ''?>><?php _e('Name Length') ?></option>
|
2004-04-19 04:09:27 -04:00
|
|
|
</select>
|
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="sort_desc" value="Y" <?php checked('Y', $row->sort_desc); ?> />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Descending') ?></label>
|
2004-04-19 04:09:27 -04:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Limit:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td>
|
|
|
|
<input type="text" name="list_limit" size="5" value="<?php echo $row->list_limit ?>" />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('(Leave empty for no limit to number of links shown)') ?>
|
2004-04-19 04:09:27 -04:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Toggle:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td><label>
|
|
|
|
<input type="checkbox" name="auto_toggle" value="Y" <?php checked('Y', $row->auto_toggle); ?> />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('When new link is added toggle all others to be invisible') ?></label></td>
|
2004-04-19 04:09:27 -04:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
<fieldset class="options">
|
2004-04-25 19:49:45 -04:00
|
|
|
<legend><?php _e('Formatting') ?></legend>
|
2004-04-19 04:09:27 -04:00
|
|
|
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th width="33%" scope="row"><?php _e('Before Link:') ?></th>
|
2004-12-12 15:41:19 -05:00
|
|
|
<td width="67%"><input type="text" name="text_before_link" size="45" value="<?php echo wp_specialchars($row->text_before_link)?>" /></td>
|
2004-04-19 04:09:27 -04:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Between Link and Description:') ?></th>
|
2004-12-12 15:41:19 -05:00
|
|
|
<td><input type="text" name="text_after_link" size="45" value="<?php echo wp_specialchars($row->text_after_link)?>" /></td>
|
2004-04-19 04:09:27 -04:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('After Link:') ?></th>
|
2004-12-12 15:41:19 -05:00
|
|
|
<td><input type="text" name="text_after_all" size="45" value="<?php echo wp_specialchars($row->text_after_all)?>"/></td>
|
2004-04-19 04:09:27 -04:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
2004-04-25 19:49:45 -04:00
|
|
|
<p class="submit"><input type="submit" name="submit" value="<?php _e('Save Category Settings »') ?>" /></p>
|
2004-04-19 04:09:27 -04:00
|
|
|
</form>
|
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
</div>
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php
|
2003-07-30 10:44:57 -04:00
|
|
|
} // end if row
|
2003-05-22 08:12:53 -04:00
|
|
|
break;
|
|
|
|
} // end Edit
|
|
|
|
case "editedcat":
|
|
|
|
{
|
2004-09-04 20:24:28 -04:00
|
|
|
if ($user_level < 5)
|
2004-04-25 19:49:45 -04:00
|
|
|
die (__("Cheatin' uh ?"));
|
2003-07-30 10:44:57 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$submit=$_POST["submit"];
|
|
|
|
if (isset($submit)) {
|
2003-07-30 10:44:57 -04:00
|
|
|
|
2004-12-12 15:41:19 -05:00
|
|
|
$cat_id = (int)$_POST["cat_id"];
|
2003-10-08 18:32:01 -04:00
|
|
|
|
2004-12-12 15:41:19 -05:00
|
|
|
$cat_name= wp_specialchars($_POST["cat_name"]);
|
2004-04-19 04:09:27 -04:00
|
|
|
$auto_toggle = $_POST["auto_toggle"];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($auto_toggle != 'Y') {
|
|
|
|
$auto_toggle = 'N';
|
2003-10-08 18:32:01 -04:00
|
|
|
}
|
2003-07-30 10:44:57 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$show_images = $_POST["show_images"];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($show_images != 'Y') {
|
|
|
|
$show_images = 'N';
|
|
|
|
}
|
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$show_description = $_POST["show_description"];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($show_description != 'Y') {
|
|
|
|
$show_description = 'N';
|
|
|
|
}
|
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$show_rating = $_POST["show_rating"];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($show_rating != 'Y') {
|
|
|
|
$show_rating = 'N';
|
|
|
|
}
|
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$show_updated = $_POST["show_updated"];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($show_updated != 'Y') {
|
|
|
|
$show_updated = 'N';
|
|
|
|
}
|
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$sort_order = $_POST["sort_order"];
|
2003-07-30 10:44:57 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$sort_desc = $_POST["sort_desc"];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($sort_desc != 'Y') {
|
|
|
|
$sort_desc = 'N';
|
|
|
|
}
|
2004-04-19 04:09:27 -04:00
|
|
|
$text_before_link = addslashes($_POST["text_before_link"]);
|
|
|
|
$text_after_link = addslashes($_POST["text_after_link"]);
|
|
|
|
$text_after_all = addslashes($_POST["text_after_all"]);
|
2003-05-22 08:12:53 -04:00
|
|
|
|
2004-04-19 04:09:27 -04:00
|
|
|
$list_limit = $_POST["list_limit"];
|
2003-07-30 10:44:57 -04:00
|
|
|
if ($list_limit == '')
|
|
|
|
$list_limit = -1;
|
|
|
|
|
2004-05-24 04:22:18 -04:00
|
|
|
$wpdb->query("UPDATE $wpdb->linkcategories set
|
2003-07-30 10:44:57 -04:00
|
|
|
cat_name='$cat_name',
|
|
|
|
auto_toggle='$auto_toggle',
|
|
|
|
show_images='$show_images',
|
|
|
|
show_description='$show_description',
|
|
|
|
show_rating='$show_rating',
|
|
|
|
show_updated='$show_updated',
|
|
|
|
sort_order='$sort_order',
|
|
|
|
sort_desc='$sort_desc',
|
|
|
|
text_before_link='$text_before_link',
|
|
|
|
text_after_link='$text_after_link',
|
|
|
|
text_after_all='$text_after_all',
|
|
|
|
list_limit=$list_limit
|
|
|
|
WHERE cat_id=$cat_id
|
|
|
|
");
|
|
|
|
} // end if save
|
2003-10-08 18:32:01 -04:00
|
|
|
|
2003-07-19 16:45:27 -04:00
|
|
|
|
2003-12-10 19:22:36 -05:00
|
|
|
header("Location: link-categories.php");
|
2003-05-22 08:12:53 -04:00
|
|
|
break;
|
2003-07-30 10:44:57 -04:00
|
|
|
} // end editcat
|
2003-05-22 08:12:53 -04:00
|
|
|
default:
|
|
|
|
{
|
2004-10-18 23:03:06 -04:00
|
|
|
include_once ("admin-header.php");
|
2004-09-04 20:24:28 -04:00
|
|
|
if ($user_level < 5) {
|
2004-04-25 19:49:45 -04:00
|
|
|
die(__("You have do not have sufficient permissions to edit the link categories for this blog. :)"));
|
2003-05-22 08:12:53 -04:00
|
|
|
}
|
|
|
|
?>
|
2004-08-22 19:24:50 -04:00
|
|
|
|
2003-05-23 04:29:51 -04:00
|
|
|
<div class="wrap">
|
2004-08-03 23:35:49 -04:00
|
|
|
<h2><?php _e('Link Categories:') ?></h2>
|
2003-12-27 15:55:03 -05:00
|
|
|
<table width="100%" cellpadding="5" cellspacing="0" border="0">
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th rowspan="2" valign="bottom"><?php _e('Name') ?></th>
|
|
|
|
<th rowspan="2" valign="bottom"><?php _e('ID') ?></th>
|
|
|
|
<th rowspan="2" valign="bottom"><?php _e('Toggle?') ?></th>
|
2005-02-12 03:03:56 -05:00
|
|
|
<th colspan="4" valign="bottom" class="alternate"><?php _e('Show') ?></th>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th rowspan="2" valign="bottom"><?php _e('Sort Order') ?></th>
|
|
|
|
<th rowspan="2" valign="bottom"><?php _e('Desc?') ?></th>
|
2005-02-12 03:03:56 -05:00
|
|
|
<th colspan="3" valign="bottom" class="alternate"><?php _e('Formatting') ?></th>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th rowspan="2" valign="bottom"><?php _e('Limit') ?></th>
|
2003-12-27 15:55:03 -05:00
|
|
|
<th rowspan="2" colspan="2"> </th>
|
2003-07-30 10:44:57 -04:00
|
|
|
</tr>
|
2003-12-27 15:55:03 -05:00
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th valign="top"><?php _e('Images') ?></th>
|
2005-02-12 03:03:56 -05:00
|
|
|
<th valign="top"><?php _e('Description') ?></th>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th valign="top"><?php _e('Rating') ?></th>
|
|
|
|
<th valign="top"><?php _e('Updated') ?></th>
|
|
|
|
<th valign="top"><?php _e('Before') ?></th>
|
|
|
|
<th valign="top"><?php _e('Between') ?></th>
|
|
|
|
<th valign="top"><?php _e('After') ?></th>
|
2003-07-30 10:44:57 -04:00
|
|
|
</tr>
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php
|
2003-07-30 10:44:57 -04:00
|
|
|
$results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle, show_images, show_description, "
|
|
|
|
. " show_rating, show_updated, sort_order, sort_desc, text_before_link, text_after_link, "
|
2004-05-24 04:22:18 -04:00
|
|
|
. " text_after_all, list_limit FROM $wpdb->linkcategories ORDER BY cat_id");
|
2004-04-19 04:09:27 -04:00
|
|
|
$i = 1;
|
2003-11-24 19:46:52 -05:00
|
|
|
foreach ($results as $row) {
|
|
|
|
if ($row->list_limit == -1) {
|
2005-02-24 19:20:48 -05:00
|
|
|
$row->list_limit = __('none');
|
2003-11-24 19:46:52 -05:00
|
|
|
}
|
|
|
|
$style = ($i % 2) ? ' class="alternate"' : '';
|
2005-02-24 19:20:48 -05:00
|
|
|
/*
|
|
|
|
Manually internationalize every sort order option.
|
|
|
|
*/
|
|
|
|
switch ($row->sort_order) {
|
|
|
|
case 'name':
|
|
|
|
$row->sort_order = __('name');
|
|
|
|
break;
|
|
|
|
case 'id':
|
|
|
|
$row->sort_order = __('id');
|
|
|
|
break;
|
|
|
|
case 'url':
|
|
|
|
$row->sort_order = __('url');
|
|
|
|
break;
|
|
|
|
case 'rating':
|
|
|
|
$row->sort_order = __('rating');
|
|
|
|
break;
|
|
|
|
case 'updated':
|
|
|
|
$row->sort_order = __('updated');
|
|
|
|
break;
|
|
|
|
case 'rand':
|
|
|
|
$row->sort_order = __('rand');
|
|
|
|
break;
|
|
|
|
case 'length':
|
|
|
|
$row->sort_order = __('length');
|
|
|
|
break;
|
|
|
|
}
|
2003-07-30 10:44:57 -04:00
|
|
|
?>
|
2003-12-27 15:55:03 -05:00
|
|
|
<tr valign="middle" align="center" <?php echo $style ?> style="border-bottom: 1px dotted #9C9A9C;">
|
2004-12-12 15:41:19 -05:00
|
|
|
<td><?php echo wp_specialchars($row->cat_name)?></td>
|
2003-12-27 15:55:03 -05:00
|
|
|
<td ><?php echo $row->cat_id?></td>
|
2005-02-24 19:20:48 -05:00
|
|
|
<td><?php echo $row->auto_toggle == 'Y' ? __('Y') : __('N') ?></td>
|
|
|
|
<td><?php echo $row->show_images == 'Y' ? __('Y') : __('N') ?></td>
|
|
|
|
<td><?php echo $row->show_description == 'Y' ? __('Y') : __('N') ?></td>
|
|
|
|
<td><?php echo $row->show_rating == 'Y' ? __('Y') : __('N') ?></td>
|
|
|
|
<td><?php echo $row->show_updated == 'Y' ? __('Y') : __('N') ?></td>
|
|
|
|
<td><?php echo $row->sort_order ?></td>
|
|
|
|
<td><?php echo $row->sort_desc == 'Y' ? __('Y') : __('N') ?></td>
|
2003-12-27 15:55:03 -05:00
|
|
|
<td nowrap="nowrap"><?php echo htmlentities($row->text_before_link)?> </td>
|
|
|
|
<td nowrap="nowrap"><?php echo htmlentities($row->text_after_link)?> </td>
|
|
|
|
<td nowrap="nowrap"><?php echo htmlentities($row->text_after_all)?></td>
|
2005-02-24 19:20:48 -05:00
|
|
|
<td><?php echo $row->list_limit ?></td>
|
2004-04-25 19:49:45 -04:00
|
|
|
<td><a href="link-categories.php?cat_id=<?php echo $row->cat_id?>&action=Edit" class="edit"><?php _e('Edit') ?></a></td>
|
|
|
|
<td><a href="link-categories.php?cat_id=<?php echo $row->cat_id?>&action=Delete" onclick="return confirm('<?php _e("You are about to delete this category.\\n \'Cancel\' to stop, \'OK\' to delete.") ?>');" class="delete"><?php _e('Delete') ?></a></td>
|
2003-07-30 10:44:57 -04:00
|
|
|
</tr>
|
|
|
|
<?php
|
|
|
|
++$i;
|
2003-05-22 08:12:53 -04:00
|
|
|
}
|
|
|
|
?>
|
2003-07-30 10:44:57 -04:00
|
|
|
</table>
|
2004-04-25 19:49:45 -04:00
|
|
|
<p><?php _e('These are the defaults for when you call a link category with no additional arguments. All of these settings may be overwritten.') ?></p>
|
2003-12-27 15:55:03 -05:00
|
|
|
|
2003-07-30 10:44:57 -04:00
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="wrap">
|
|
|
|
<form name="addcat" method="post">
|
|
|
|
<input type="hidden" name="action" value="addcat" />
|
2004-08-03 23:35:49 -04:00
|
|
|
<h2><?php _e('Add a Link Category:') ?></h2>
|
2004-04-19 04:09:27 -04:00
|
|
|
<fieldset class="options">
|
2004-04-25 19:49:45 -04:00
|
|
|
<legend><?php _e('Category Options') ?></legend>
|
2004-04-19 04:09:27 -04:00
|
|
|
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th width="33%" scope="row"><?php _e('Name:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td width="67%"><input type="text" name="cat_name" size="30" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Show:') ?></th>
|
2003-10-08 18:32:01 -04:00
|
|
|
<td>
|
2004-04-19 04:09:27 -04:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="show_images" value="Y" />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Image') ?></label> <br />
|
2004-04-19 04:09:27 -04:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="show_description" value="Y" />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Description') ?></label>
|
|
|
|
<?php _e('(shown in <code>title</code> regardless)') ?><br />
|
2004-04-19 04:09:27 -04:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="show_rating" value="Y" />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Rating') ?></label> <br />
|
2004-04-19 04:09:27 -04:00
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="show_updated" value="Y" />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Updated') ?></label>
|
|
|
|
<?php _e('(shown in <code>title</code> regardless)') ?></td>
|
2004-04-19 04:09:27 -04:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Sort order:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td>
|
|
|
|
<select name="sort_order" size="1">
|
2004-04-25 19:49:45 -04:00
|
|
|
<option value="name"><?php _e('Name') ?></option>
|
|
|
|
<option value="id"><?php _e('Id') ?></option>
|
|
|
|
<option value="url"><?php _e('URL') ?></option>
|
|
|
|
<option value="rating"><?php _e('Rating') ?></option>
|
|
|
|
<option value="updated"><?php _e('Updated') ?></option>
|
|
|
|
<option value="rand"><?php _e('Random') ?></option>
|
2004-04-19 04:09:27 -04:00
|
|
|
</select>
|
|
|
|
<label>
|
|
|
|
<input type="checkbox" name="sort_desc" value="Y" />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('Descending') ?></label>
|
2004-04-19 04:09:27 -04:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Limit:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td>
|
2004-04-25 19:49:45 -04:00
|
|
|
<input type="text" name="list_limit" size="5" value="" /> <?php _e('(Leave empty for no limit to number of links shown)') ?>
|
2004-04-19 04:09:27 -04:00
|
|
|
</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Toggle:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td><label>
|
|
|
|
<input type="checkbox" name="auto_toggle" value="Y" />
|
2004-04-25 19:49:45 -04:00
|
|
|
<?php _e('When new link is added toggle all others to be invisible') ?></label></td>
|
2004-04-19 04:09:27 -04:00
|
|
|
</tr>
|
|
|
|
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
|
|
|
<fieldset class="options">
|
2004-04-25 19:49:45 -04:00
|
|
|
<legend><?php _e('Formatting') ?></legend>
|
2004-04-19 04:09:27 -04:00
|
|
|
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th width="33%" scope="row"><?php _e('Before Link:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td width="67%"><input type="text" name="text_before_link" size="45" value="<li>" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('Between Link and Description:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td><input type="text" name="text_after_link" size="45" value="<br />" /></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
2004-04-25 19:49:45 -04:00
|
|
|
<th scope="row"><?php _e('After Link:') ?></th>
|
2004-04-19 04:09:27 -04:00
|
|
|
<td><input type="text" name="text_after_all" size="45" value="</li>"/></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</fieldset>
|
2004-04-25 19:49:45 -04:00
|
|
|
<p class="submit"><input type="submit" name="submit" value="<?php _e('Add Category »') ?>" /></p>
|
2003-10-08 18:32:01 -04:00
|
|
|
</form>
|
2003-05-23 04:29:51 -04:00
|
|
|
</div>
|
|
|
|
<div class="wrap">
|
2004-04-25 19:49:45 -04:00
|
|
|
<h3><?php _e('Note:') ?></h3>
|
|
|
|
<?php printf(__('<p>Deleting a link category does not delete links from that category.<br />
|
|
|
|
It will just set them back to the default category <b>%s</b>.'), get_linkcatname(1)) ?>
|
2003-12-27 15:55:03 -05:00
|
|
|
</p>
|
2003-05-23 04:29:51 -04:00
|
|
|
</div>
|
2003-05-22 08:12:53 -04:00
|
|
|
<?php
|
|
|
|
break;
|
|
|
|
} // end default
|
|
|
|
} // end case
|
|
|
|
?>
|
2004-08-22 19:24:50 -04:00
|
|
|
<?php include('admin-footer.php'); ?>
|