Make link manager hookable. Props donncha. fixes #3422
git-svn-id: http://svn.automattic.com/wordpress/trunk@4594 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
4e52293cc9
commit
5eb76b01df
|
@ -93,6 +93,17 @@ printf(__('Currently showing %1$s links ordered by %2$s'), $select_cat, $select_
|
||||||
?>
|
?>
|
||||||
<input type="submit" name="action" value="<?php _e('Update »') ?>" /></p>
|
<input type="submit" name="action" value="<?php _e('Update »') ?>" /></p>
|
||||||
</form>
|
</form>
|
||||||
|
<?php
|
||||||
|
$link_columns = array(
|
||||||
|
'name' => '<th width="15%">' . __('Name') . '</th>',
|
||||||
|
'url' => '<th>' . __('URL') . '</th>',
|
||||||
|
'categories' => '<th>' . __('Categories') . '</th>',
|
||||||
|
'rel' => '<th style="text-align: center">' . __('rel') . '</th>',
|
||||||
|
'visible' => '<th style="text-align: center">' . __('Visible') . '</th>',
|
||||||
|
'action' => '<th colspan="2" style="text-align: center">' . __('Action') . '</th>',
|
||||||
|
);
|
||||||
|
$link_columns = apply_filters('manage_link_columns', $link_columns);
|
||||||
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ( 'all' == $cat_id )
|
if ( 'all' == $cat_id )
|
||||||
|
@ -110,13 +121,10 @@ if ( $links ) {
|
||||||
<table class="widefat">
|
<table class="widefat">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th width="15%"><?php _e('Name') ?></th>
|
<?php foreach($link_columns as $column_display_name) {
|
||||||
<th><?php _e('URL') ?></th>
|
echo $column_display_name;
|
||||||
<th><?php _e('Categories') ?></th>
|
} ?>
|
||||||
<th style="text-align: center"><?php _e('rel') ?></th>
|
<th style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th>
|
||||||
<th style="text-align: center"><?php _e('Visible') ?></th>
|
|
||||||
<th colspan="2" style="text-align: center"><?php _e('Action') ?></th>
|
|
||||||
<th style="text-align: center"><input type="checkbox" onclick="checkAll(document.getElementById('links'));" /></th>
|
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody id="the-list">
|
<tbody id="the-list">
|
||||||
|
@ -136,35 +144,47 @@ if ( $links ) {
|
||||||
$visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
|
$visible = ($link->link_visible == 'Y') ? __('Yes') : __('No');
|
||||||
++ $i;
|
++ $i;
|
||||||
$style = ($i % 2) ? '' : ' class="alternate"';
|
$style = ($i % 2) ? '' : ' class="alternate"';
|
||||||
?>
|
?><tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>><?php
|
||||||
<tr id="link-<?php echo $link->link_id; ?>" valign="middle" <?php echo $style; ?>>
|
foreach($link_columns as $column_name=>$column_display_name) {
|
||||||
<td><strong><?php echo $link->link_name; ?></strong><br />
|
switch($column_name) {
|
||||||
<?php
|
case 'name':
|
||||||
|
?><td><strong><?php echo $link->link_name; ?></strong><br /><?php
|
||||||
|
echo $link->link_description . "</td>";
|
||||||
|
break;
|
||||||
|
case 'url':
|
||||||
|
echo "<td><a href='$link->link_url' title='".sprintf(__('Visit %s'), $link->link_name)."'>$short_url</a></td>";
|
||||||
|
break;
|
||||||
|
case 'categories':
|
||||||
|
?><td><?php
|
||||||
|
$cat_names = array();
|
||||||
|
foreach ($link->link_category as $category) {
|
||||||
|
$cat_name = get_the_category_by_ID($category);
|
||||||
|
$cat_name = wp_specialchars($cat_name);
|
||||||
|
if ( $cat_id != $category )
|
||||||
|
$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
|
||||||
|
$cat_names[] = $cat_name;
|
||||||
|
}
|
||||||
|
echo implode(', ', $cat_names);
|
||||||
|
?> </td><?php
|
||||||
|
break;
|
||||||
|
case 'rel':
|
||||||
|
?><td><?php echo $link->link_rel; ?></td><?php
|
||||||
|
break;
|
||||||
|
case 'visible':
|
||||||
|
?><td align='center'><?php echo $visible; ?></td><?php
|
||||||
|
break;
|
||||||
|
case 'action':
|
||||||
|
echo '<td><a href="link.php?link_id='.$link->link_id.'&action=edit" class="edit">'.__('Edit').'</a></td>';
|
||||||
|
echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".js_escape(sprintf(__("You are about to delete the "%s" link to %s.\n"Cancel" to stop, "OK" to delete."), $link->link_name, $link->link_url )).'\' );" class="delete">'.__('Delete').'</a></td>';
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
?>
|
||||||
|
<td><?php do_action('manage_link_custom_column', $column_name, $id); ?></td>
|
||||||
|
<?php
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
echo $link->link_description . "</td>";
|
|
||||||
echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>";
|
|
||||||
?>
|
|
||||||
<td>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
$cat_names = array();
|
|
||||||
foreach ($link->link_category as $category) {
|
|
||||||
$cat_name = get_the_category_by_ID($category);
|
|
||||||
$cat_name = wp_specialchars($cat_name);
|
|
||||||
if ( $cat_id != $category )
|
|
||||||
$cat_name = "<a href='link-manager.php?cat_id=$category'>$cat_name</a>";
|
|
||||||
$cat_names[] = $cat_name;
|
|
||||||
}
|
}
|
||||||
echo implode(', ', $cat_names);
|
|
||||||
?>
|
|
||||||
</td>
|
|
||||||
<td><?php echo $link->link_rel; ?></td>
|
|
||||||
<td align='center'><?php echo $visible; ?></td>
|
|
||||||
<?php
|
|
||||||
|
|
||||||
echo '<td><a href="link.php?link_id='.$link->link_id.'&action=edit" class="edit">'.__('Edit').'</a></td>';
|
|
||||||
echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".js_escape(sprintf(__("You are about to delete the "%s" link to %s.\\n"Cancel" to stop, "OK" to delete."), $link->link_name, $link->link_url )).'\' );" class="delete">'.__('Delete').'</a></td>';
|
|
||||||
echo '<td align="center"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></td>';
|
echo '<td align="center"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></td>';
|
||||||
echo "\n </tr>\n";
|
echo "\n </tr>\n";
|
||||||
}
|
}
|
||||||
|
@ -174,7 +194,7 @@ if ( $links ) {
|
||||||
|
|
||||||
<div id="ajax-response"></div>
|
<div id="ajax-response"></div>
|
||||||
|
|
||||||
<p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links') ?> »" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently \\n \'Cancel\' to stop, \'OK\' to delete.")); ?>')" /></p>
|
<p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links') ?> »" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently \n \'Cancel\' to stop, \'OK\' to delete.")); ?>')" /></p>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
Loading…
Reference in New Issue