2003-12-23 16:47:03 -05:00
< ? php
2004-10-18 23:03:06 -04:00
require_once ( 'admin.php' );
2003-12-23 16:47:03 -05:00
$title = 'Add Link' ;
$this_file = 'link-manager.php' ;
2004-04-19 04:09:27 -04:00
$parent_file = 'link-manager.php' ;
2003-12-23 16:47:03 -05:00
function category_dropdown ( $fieldname , $selected = 0 ) {
2004-05-24 04:22:18 -04:00
global $wpdb ;
2003-12-23 16:47:03 -05:00
2004-05-24 04:22:18 -04:00
$results = $wpdb -> get_results ( " SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id " );
2003-12-23 16:47:03 -05:00
echo ' <select name="' . $fieldname . '" size="1">' . " \n " ;
foreach ( $results as $row ) {
echo " <option value= \" " . $row -> cat_id . " \" " ;
if ( $row -> cat_id == $selected )
echo " selected " ;
2004-06-19 00:41:34 -04:00
echo " > " . $row -> cat_id . " : " . htmlspecialchars ( $row -> cat_name );
2003-12-23 16:47:03 -05:00
if ( $row -> auto_toggle == 'Y' )
echo ' (auto toggle)' ;
echo " </option> \n " ;
}
echo " </select> \n " ;
}
2004-10-18 23:03:06 -04:00
$wpvarstoreset = array ( 'action' , 'cat_id' , 'linkurl' , 'name' , 'image' ,
2003-12-23 16:47:03 -05:00
'description' , 'visible' , 'target' , 'category' , 'link_id' ,
'submit' , 'order_by' , 'links_show_cat_id' , 'rating' , 'rel' ,
'notes' , 'linkcheck[]' );
for ( $i = 0 ; $i < count ( $wpvarstoreset ); $i += 1 ) {
$wpvar = $wpvarstoreset [ $i ];
if ( ! isset ( $$wpvar )) {
2004-04-20 18:56:47 -04:00
if ( empty ( $_POST [ " $wpvar " ])) {
if ( empty ( $_GET [ " $wpvar " ])) {
2003-12-23 16:47:03 -05:00
$$wpvar = '' ;
} else {
2004-04-20 18:56:47 -04:00
$$wpvar = $_GET [ " $wpvar " ];
2003-12-23 16:47:03 -05:00
}
} else {
2004-04-20 18:56:47 -04:00
$$wpvar = $_POST [ " $wpvar " ];
2003-12-23 16:47:03 -05:00
}
}
}
2004-04-20 18:56:47 -04:00
$link_url = stripslashes ( $_GET [ 'linkurl' ]);
$link_name = htmlentities ( stripslashes ( urldecode ( $_GET [ 'name' ])));
2004-01-09 04:48:48 -05:00
2004-04-28 01:34:50 -04:00
$xfn = true ;
2003-12-23 16:47:03 -05:00
require ( 'admin-header.php' );
?>
2004-08-22 19:24:50 -04:00
2004-04-28 01:34:50 -04:00
< ? php if ( $_GET [ 'added' ]) : ?>
< div class = " updated " >< p > Link added .</ p ></ div >
< ? php endif ; ?>
2003-12-23 16:47:03 -05:00
< div class = " wrap " >
2004-08-03 23:35:49 -04:00
< h2 >< ? php _e ( '<strong>Add</strong> a link:' ) ?> </h2>
2003-12-27 15:55:03 -05:00
< form name = " addlink " method = " post " action = " link-manager.php " >
2004-04-15 05:15:56 -04:00
< fieldset class = " options " >
2004-04-25 16:20:23 -04:00
< legend >< ? php _e ( 'Basics' ) ?> </legend>
2004-04-15 05:15:56 -04:00
< table class = " editform " width = " 100% " cellspacing = " 2 " cellpadding = " 5 " >
2003-12-27 15:55:03 -05:00
< tr >
2004-04-25 16:20:23 -04:00
< th width = " 33% " scope = " row " >< ? php _e ( 'URI:' ) ?> </th>
2004-06-11 14:23:12 -04:00
< td width = " 67% " >< input type = " text " name = " linkurl " value = " <?php echo $_GET['linkurl'] ; ?> " style = " width: 95%; " /></ td >
2003-12-27 15:55:03 -05:00
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " >< ? php _e ( 'Link Name:' ) ?> </th>
2004-04-15 05:15:56 -04:00
< td >< input type = " text " name = " name " value = " <?php echo urldecode( $_GET['name'] ); ?> " style = " width: 95% " /></ td >
2003-12-27 15:55:03 -05:00
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " >< ? php _e ( 'Short description:' ) ?> </th>
2004-04-15 05:15:56 -04:00
< td >< input type = " text " name = " description " value = " " style = " width: 95% " /></ td >
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " >< ? php _e ( 'Category:' ) ?> </th>
2004-04-15 05:15:56 -04:00
< td >< ? php category_dropdown ( 'category' ); ?> </td>
2003-12-27 15:55:03 -05:00
</ tr >
2004-04-15 05:15:56 -04:00
</ table >
</ fieldset >
< p class = " submit " >
2004-04-25 16:20:23 -04:00
< input type = " submit " name = " submit " value = " <?php _e('Add Link »') ?> " />
2004-04-15 05:15:56 -04:00
</ p >
< fieldset class = " options " >
2004-04-25 16:20:23 -04:00
< legend >< ? php _e ( 'Link Relationship (XFN)' ) ?> </legend>
2004-04-15 05:15:56 -04:00
< table class = " editform " width = " 100% " cellspacing = " 2 " cellpadding = " 5 " >
< tr >
2004-04-25 16:20:23 -04:00
< th width = " 33% " scope = " row " >< ? php _e ( 'rel:' ) ?> </th>
2004-06-11 14:23:12 -04:00
< td width = " 67% " >< input type = " text " name = " rel " id = " rel " size = " 50 " value = " " /></ td >
2004-04-15 05:15:56 -04:00
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " >< ? php _e ( '<a href="http://gmpg.org/xfn/">XFN</a> Creator:' ) ?> </th>
2004-04-15 05:15:56 -04:00
< td >< table cellpadding = " 3 " cellspacing = " 5 " >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " > < ? php _e ( 'friendship' ) ?> </th>
2004-08-17 09:53:06 -04:00
< td >
< label for = " label1 " >
< input class = " valinp " type = " radio " name = " friendship " value = " acquaintance " id = " label1 " />
< ? php _e ( 'acquaintance' ) ?> </label>
< label for = " label2 " >
< input class = " valinp " type = " radio " name = " friendship " value = " contact " id = " label2 " />
< ? php _e ( 'contact' ) ?> </label>
< label for = " label3 " >
< input class = " valinp " type = " radio " name = " friendship " value = " friend " id = " label3 " />
< ? php _e ( 'friend' ) ?> </label>
< label for = " label4 " >
< input class = " valinp " type = " radio " name = " friendship " value = " " id = " label4 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'none' ) ?> </label>
2004-04-15 05:15:56 -04:00
</ td >
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " > < ? php _e ( 'physical' ) ?> </th>
2004-08-17 09:53:06 -04:00
< td >< label for = " label10 " >
< input class = " valinp " type = " checkbox " name = " physical " value = " met " id = " label10 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'met' ) ?> </label>
2004-04-15 05:15:56 -04:00
</ td >
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " > < ? php _e ( 'professional' ) ?> </th>
2004-08-17 09:53:06 -04:00
< td >< label for = " label20 " >
< input class = " valinp " type = " checkbox " name = " professional " value = " co-worker " id = " label20 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'co-worker' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label21 " >
< input class = " valinp " type = " checkbox " name = " professional " value = " colleague " id = " label21 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'colleague' ) ?> </label>
2004-04-15 05:15:56 -04:00
</ td >
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " > < ? php _e ( 'geographical' ) ?> </th>
2004-08-17 09:53:06 -04:00
< td >< label for = " label30 " >
< input class = " valinp " type = " radio " name = " geographical " value = " co-resident " id = " label30 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'co-resident' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label31 " >
< input class = " valinp " type = " radio " name = " geographical " value = " neighbor " id = " label31 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'neighbor' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label32 " >
< input class = " valinp " type = " radio " name = " geographical " value = " " id = " label32 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'none' ) ?> </label>
2004-04-15 05:15:56 -04:00
</ td >
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " > < ? php _e ( 'family' ) ?> </th>
2004-08-17 09:53:06 -04:00
< td >
< label for = " label40 " >
< input class = " valinp " type = " radio " name = " family " value = " child " id = " label40 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'child' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label41 " >
< input class = " valinp " type = " radio " name = " family " value = " kin " id = " label41 " />
< ? php _e ( 'kin' ) ?> </label>
< label for = " label42 " >
< input class = " valinp " type = " radio " name = " family " value = " parent " id = " label42 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'parent' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label43 " >
< input class = " valinp " type = " radio " name = " family " value = " sibling " id = " label43 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'sibling' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label44 " >
< input class = " valinp " type = " radio " name = " family " value = " spouse " id = " label44 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'spouse' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label45 " >
< input class = " valinp " type = " radio " name = " family " value = " " id = " label45 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'none' ) ?> </label>
2004-04-15 05:15:56 -04:00
</ td >
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " > < ? php _e ( 'romantic' ) ?> </th>
2004-08-17 09:53:06 -04:00
< td >< label for = " label50 " >
< input class = " valinp " type = " checkbox " name = " romantic " value = " muse " id = " label50 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'muse' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label51 " >
< input class = " valinp " type = " checkbox " name = " romantic " value = " crush " id = " label51 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'crush' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label52 " >
< input class = " valinp " type = " checkbox " name = " romantic " value = " date " id = " label42 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'date' ) ?> </label>
2004-08-17 09:53:06 -04:00
< label for = " label53 " >
< input class = " valinp " type = " checkbox " name = " romantic " value = " sweetheart " id = " label53 " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'sweetheart' ) ?> </label>
2004-04-15 05:15:56 -04:00
</ td >
</ tr >
2004-08-17 09:53:06 -04:00
< tr >
< th scope = " row " > < ? php _e ( 'identity' ) ?> </th>
< td >< label for = " label60 " >
< input class = " valinp " type = " checkbox " name = " identity " value = " me " id = " label60 " />
< ? php _e ( 'me' ) ?> </label>
</ td >
</ tr >
2004-04-15 05:15:56 -04:00
</ table ></ td >
</ tr >
</ table >
</ fieldset >
< p class = " submit " >
2004-04-25 16:20:23 -04:00
< input type = " submit " name = " submit " value = " <?php _e('Add Link »') ?> " />
2004-04-15 05:15:56 -04:00
</ p >
< fieldset class = " options " >
2004-04-25 16:20:23 -04:00
< legend >< ? php _e ( 'Advanced' ) ?> </legend>
2004-04-15 05:15:56 -04:00
< table class = " editform " width = " 100% " cellspacing = " 2 " cellpadding = " 5 " >
2003-12-31 20:05:28 -05:00
< tr >
2004-04-25 16:20:23 -04:00
< th width = " 33% " scope = " row " >< ? php _e ( 'Image URI:' ) ?> </th>
2004-04-19 04:09:27 -04:00
< td width = " 67% " >< input type = " text " name = " image " size = " 50 " value = " " style = " width: 95% " /></ td >
2004-04-15 05:15:56 -04:00
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " >< ? php _e ( 'RSS URI:' ) ?> </th>
2004-04-19 04:09:27 -04:00
< td >< input name = " rss_uri " type = " text " id = " rss_uri " value = " " size = " 50 " style = " width: 95% " /></ td >
2003-12-27 15:55:03 -05:00
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " >< ? php _e ( 'Notes:' ) ?> </th>
2004-04-19 04:09:27 -04:00
< td >< textarea name = " notes " cols = " 50 " rows = " 10 " style = " width: 95% " ></ textarea ></ td >
2003-12-27 15:55:03 -05:00
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " >< ? php _e ( 'Rating:' ) ?> </th>
2003-12-27 15:55:03 -05:00
< td >< select name = " rating " size = " 1 " >
< ? php
2003-12-23 16:47:03 -05:00
for ( $r = 0 ; $r < 10 ; $r ++ ) {
echo ( ' <option value="' . $r . '">' . $r . '</option>' );
}
?>
2003-12-27 15:55:03 -05:00
</ select >
2004-04-25 16:20:23 -04:00
& nbsp ; < ? php _e ( '(Leave at 0 for no rating.)' ) ?> </td>
2003-12-27 15:55:03 -05:00
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " >< ? php _e ( 'Target' ) ?> </th>
2003-12-27 15:55:03 -05:00
< td >< label >
2004-04-19 04:09:27 -04:00
< input type = " radio " name = " target " value = " _blank " />
2003-12-27 15:55:03 -05:00
< code > _blank </ code ></ label >
2004-04-19 04:09:27 -04:00
< br />
< label >< input type = " radio " name = " target " value = " _top " />
2003-12-27 15:55:03 -05:00
< code > _top </ code ></ label >
2004-04-19 04:09:27 -04:00
< br />
< label >< input type = " radio " name = " target " value = " " checked = " checked " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'none' ) ?> </label>
< ? php _e ( '(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)' ) ?> </td>
2003-12-27 15:55:03 -05:00
</ tr >
< tr >
2004-04-25 16:20:23 -04:00
< th scope = " row " >< ? php _e ( 'Visible:' ) ?> </th>
2003-12-27 15:55:03 -05:00
< td >< label >
2004-04-19 04:09:27 -04:00
< input type = " radio " name = " visible " checked = " checked " value = " Y " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'Yes' ) ?> </label><br />
2004-06-11 14:23:12 -04:00
< label >< input type = " radio " name = " visible " value = " N " /> < input type = " hidden " name = " action " value = " Add " />
2004-04-25 16:20:23 -04:00
< ? php _e ( 'No' ) ?> </label></td>
2003-12-27 15:55:03 -05:00
</ tr >
2004-04-15 05:15:56 -04:00
</ table >
</ fieldset >
< p class = " submit " >
2004-04-25 16:20:23 -04:00
< input type = " submit " name = " submit " value = " <?php _e('Add Link »') ?> " />
2003-12-31 20:05:28 -05:00
</ p >
</ form >
2003-12-23 16:47:03 -05:00
</ div >
< div class = " wrap " >
2004-06-11 14:23:12 -04:00
< ? php printf ( __ ( '<p>You can drag <a href="%s" title="Link add bookmarklet">Link This</a> to your toolbar and when you click it a window will pop up that will allow you to add whatever site you’re on to your links! Right now this only works on Mozilla or Netscape, but we’re working on it.</p>' ), " javascript:void(linkmanpopup=window.open(' " . get_settings ( 'siteurl' ) . " /wp-admin/link-add.php?action=popup&linkurl='+escape(location.href)+'&name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus(); " ) ?>
2003-12-23 16:47:03 -05:00
</ div >
< ? php
require ( 'admin-footer.php' );
2004-04-25 16:20:23 -04:00
?>