2003-12-23 22:47:03 +01:00
< ? php
2004-10-19 05:03:06 +02:00
require_once ( 'admin.php' );
2003-12-23 22:47:03 +01:00
2004-12-12 21:41:19 +01:00
$title = __ ( 'Add Link' );
2003-12-23 22:47:03 +01:00
$this_file = 'link-manager.php' ;
2004-04-19 10:09:27 +02:00
$parent_file = 'link-manager.php' ;
2003-12-23 22:47:03 +01:00
function category_dropdown ( $fieldname , $selected = 0 ) {
2004-12-12 21:41:19 +01:00
global $wpdb ;
$results = $wpdb -> get_results ( " SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id " );
echo " \n <select name=' $fieldname ' size='1'> \n " ;
foreach ( $results as $row ) {
echo " \n \t <option value=' $row->cat_id ' " ;
if ( $row -> cat_id == $selected )
echo " selected='selected' " ;
echo " > $row->cat_id : " . wp_specialchars ( $row -> cat_name );
if ( $row -> auto_toggle == 'Y' )
echo ' (auto toggle)' ;
echo " </option> " ;
}
echo " \n </select> \n " ;
2003-12-23 22:47:03 +01:00
}
2005-01-06 10:46:52 +01:00
function xfn_check ( $class , $value = '' , $type = 'check' ) {
global $link_rel ;
$rels = preg_split ( '/\s+/' , $link_rel );
if ( '' != $value && in_array ( $value , $rels ) ) {
echo ' checked="checked"' ;
}
if ( '' == $value ) {
if ( 'family' == $class && ! strstr ( $link_rel , 'child' ) && ! strstr ( $link_rel , 'parent' ) && ! strstr ( $link_rel , 'sibling' ) && ! strstr ( $link_rel , 'spouse' ) && ! strstr ( $link_rel , 'kin' )) echo ' checked="checked"' ;
if ( 'friendship' == $class && ! strstr ( $link_rel , 'friend' ) && ! strstr ( $link_rel , 'acquaintance' ) && ! strstr ( $link_rel , 'contact' ) ) echo ' checked="checked"' ;
if ( 'geographical' == $class && ! strstr ( $link_rel , 'co-resident' ) && ! strstr ( $link_rel , 'neighbor' ) ) echo ' checked="checked"' ;
if ( 'identity' == $class && in_array ( 'me' , $rels ) ) echo ' checked="checked"' ;
}
}
2004-10-19 05:03:06 +02:00
$wpvarstoreset = array ( 'action' , 'cat_id' , 'linkurl' , 'name' , 'image' ,
2003-12-23 22:47:03 +01: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-21 00:56:47 +02:00
if ( empty ( $_POST [ " $wpvar " ])) {
if ( empty ( $_GET [ " $wpvar " ])) {
2003-12-23 22:47:03 +01:00
$$wpvar = '' ;
} else {
2004-04-21 00:56:47 +02:00
$$wpvar = $_GET [ " $wpvar " ];
2003-12-23 22:47:03 +01:00
}
} else {
2004-04-21 00:56:47 +02:00
$$wpvar = $_POST [ " $wpvar " ];
2003-12-23 22:47:03 +01:00
}
}
}
2004-04-21 00:56:47 +02:00
$link_url = stripslashes ( $_GET [ 'linkurl' ]);
$link_name = htmlentities ( stripslashes ( urldecode ( $_GET [ 'name' ])));
2004-01-09 10:48:48 +01:00
2004-04-28 07:34:50 +02:00
$xfn = true ;
2003-12-23 22:47:03 +01:00
require ( 'admin-header.php' );
?>
2004-08-23 01:24:50 +02:00
2004-04-28 07:34:50 +02:00
< ? php if ( $_GET [ 'added' ]) : ?>
2004-12-12 21:41:19 +01:00
< div class = " updated " >< p >< ? php _e ( 'Link added.' ); ?> </p></div>
2004-04-28 07:34:50 +02:00
< ? php endif ; ?>
2003-12-23 22:47:03 +01:00
< div class = " wrap " >
2004-08-04 05:35:49 +02:00
< h2 >< ? php _e ( '<strong>Add</strong> a link:' ) ?> </h2>
2003-12-27 21:55:03 +01:00
< form name = " addlink " method = " post " action = " link-manager.php " >
2004-04-15 11:15:56 +02:00
< fieldset class = " options " >
2004-04-25 22:20:23 +02:00
< legend >< ? php _e ( 'Basics' ) ?> </legend>
2004-04-15 11:15:56 +02:00
< table class = " editform " width = " 100% " cellspacing = " 2 " cellpadding = " 5 " >
2003-12-27 21:55:03 +01:00
< tr >
2004-04-25 22:20:23 +02:00
< th width = " 33% " scope = " row " >< ? php _e ( 'URI:' ) ?> </th>
2004-12-12 21:41:19 +01:00
< td width = " 67% " >< input type = " text " name = " linkurl " value = " <?php echo wp_specialchars( $_GET['linkurl'] , 1); ?> " style = " width: 95%; " /></ td >
2003-12-27 21:55:03 +01:00
</ tr >
< tr >
2004-04-25 22:20:23 +02:00
< th scope = " row " >< ? php _e ( 'Link Name:' ) ?> </th>
2004-12-12 21:41:19 +01:00
< td >< input type = " text " name = " name " value = " <?php echo wp_specialchars( urldecode( $_GET['name'] ), 1 ); ?> " style = " width: 95% " /></ td >
2003-12-27 21:55:03 +01:00
</ tr >
< tr >
2004-04-25 22:20:23 +02:00
< th scope = " row " >< ? php _e ( 'Short description:' ) ?> </th>
2004-04-15 11:15:56 +02:00
< td >< input type = " text " name = " description " value = " " style = " width: 95% " /></ td >
</ tr >
< tr >
2004-04-25 22:20:23 +02:00
< th scope = " row " >< ? php _e ( 'Category:' ) ?> </th>
2004-04-15 11:15:56 +02:00
< td >< ? php category_dropdown ( 'category' ); ?> </td>
2003-12-27 21:55:03 +01:00
</ tr >
2004-04-15 11:15:56 +02:00
</ table >
</ fieldset >
< p class = " submit " >
2004-04-25 22:20:23 +02:00
< input type = " submit " name = " submit " value = " <?php _e('Add Link »') ?> " />
2004-04-15 11:15:56 +02:00
</ p >
< fieldset class = " options " >
2004-04-25 22:20:23 +02:00
< legend >< ? php _e ( 'Link Relationship (XFN)' ) ?> </legend>
2004-04-15 11:15:56 +02:00
< table class = " editform " width = " 100% " cellspacing = " 2 " cellpadding = " 5 " >
< tr >
2005-01-06 10:46:52 +01:00
< th width = " 33% " scope = " row " >< ? php _e ( 'rel:' ) ?> </th>
< td width = " 67% " >< input type = " text " name = " rel " id = " rel " size = " 50 " value = " <?php echo $link_rel ; ?> " /></ td >
2004-04-15 11:15:56 +02:00
</ tr >
< tr >
2005-01-06 10:46:52 +01:00
< th scope = " row " >< ? php _e ( '<a href="http://gmpg.org/xfn/">XFN</a> Creator:' ) ?> </th>
< td >
< table cellpadding = " 3 " cellspacing = " 5 " >
< tr >
< th scope = " row " > < ? php _e ( 'identity' ) ?> </th>
< td >
< label for = " me " >
< input type = " checkbox " name = " identity " value = " me " id = " me " < ? php xfn_check ( 'identity' , 'me' ); ?> />
< ? php _e ( 'another web address of mine' ) ?> </label>
</ td >
</ tr >
< tr >
< th scope = " row " > < ? php _e ( 'friendship' ) ?> </th>
< td >
< label for = " acquaintance " >
< input class = " valinp " type = " radio " name = " friendship " value = " acquaintance " id = " acquaintance " < ? php xfn_check ( 'friendship' , 'acquaintance' , 'radio' ); ?> /> <?php _e('acquaintance') ?></label>
< label for = " contact " >
< input class = " valinp " type = " radio " name = " friendship " value = " contact " id = " contact " < ? php xfn_check ( 'friendship' , 'contact' , 'radio' ); ?> /> <?php _e('contact') ?></label>
< label id = " friend " >
< input class = " valinp " type = " radio " name = " friendship " value = " friend " id = " friend " < ? php xfn_check ( 'friendship' , 'friend' , 'radio' ); ?> /> <?php _e('friend') ?></label>
< label for = " friendship " >
< input name = " friendship " type = " radio " class = " valinp " value = " " id = " friendship " < ? php xfn_check ( 'friendship' , '' , 'radio' ); ?> /> <?php _e('none') ?></label>
</ td >
</ tr >
< tr >
< th scope = " row " > < ? php _e ( 'physical' ) ?> </th>
< td >
< label for = " met " >
< input class = " valinp " type = " checkbox " name = " physical " value = " met " id = " met " < ? php xfn_check ( 'physical' , 'met' ); ?> />
< ? php _e ( 'met' ) ?> </label>
</ td >
</ tr >
< tr >
< th scope = " row " > < ? php _e ( 'professional' ) ?> </th>
< td >
< label for = " co-worker " >
< input class = " valinp " type = " checkbox " name = " professional " value = " co-worker " id = " co-worker " < ? php xfn_check ( 'professional' , 'co-worker' ); ?> />
< ? php _e ( 'co-worker' ) ?> </label>
< label for = " colleague " >
< input class = " valinp " type = " checkbox " name = " professional " value = " colleague " id = " colleague " < ? php xfn_check ( 'professional' , 'colleague' ); ?> />
< ? php _e ( 'colleague' ) ?> </label>
</ td >
</ tr >
< tr >
< th scope = " row " > < ? php _e ( 'geographical' ) ?> </th>
< td >
< label for = " co-resident " >
< input class = " valinp " type = " radio " name = " geographical " value = " co-resident " id = " co-resident " < ? php xfn_check ( 'geographical' , 'co-resident' , 'radio' ); ?> />
< ? php _e ( 'co-resident' ) ?> </label>
< label for = " neighbor " >
< input class = " valinp " type = " radio " name = " geographical " value = " neighbor " id = " neighbor " < ? php xfn_check ( 'geographical' , 'neighbor' , 'radio' ); ?> />
< ? php _e ( 'neighbor' ) ?> </label>
< label for = " geographical " >
< input class = " valinp " type = " radio " name = " geographical " value = " " id = " geographical " < ? php xfn_check ( 'geographical' , '' , 'radio' ); ?> />
< ? php _e ( 'none' ) ?> </label>
</ td >
</ tr >
< tr >
< th scope = " row " > family </ th >
< td >
< label for = " child " >
< input class = " valinp " type = " radio " name = " family " value = " child " id = " child " < ? php xfn_check ( 'family' , 'child' , 'radio' ); ?> />
< ? php _e ( 'child' ) ?> </label>
< label for = " kin " >
< input class = " valinp " type = " radio " name = " family " value = " kin " id = " kin " < ? php xfn_check ( 'family' , 'kin' , 'radio' ); ?> />
< ? php _e ( 'kin' ) ?> </label>
< label for = " parent " >
< input class = " valinp " type = " radio " name = " family " value = " parent " id = " parent " < ? php xfn_check ( 'family' , 'parent' , 'radio' ); ?> />
< ? php _e ( 'parent' ) ?> </label>
< label for = " sibling " >
< input class = " valinp " type = " radio " name = " family " value = " sibling " id = " sibling " < ? php xfn_check ( 'family' , 'sibling' , 'radio' ); ?> />
< ? php _e ( 'sibling' ) ?> </label>
< label for = " spouse " >
< input class = " valinp " type = " radio " name = " family " value = " spouse " id = " spouse " < ? php xfn_check ( 'family' , 'spouse' , 'radio' ); ?> />
< ? php _e ( 'spouse' ) ?> </label>
< label for = " family " >
< input class = " valinp " type = " radio " name = " family " value = " " id = " family " < ? php xfn_check ( 'family' , '' , 'radio' ); ?> />
< ? php _ e ( 'none' ) ?> </label>
</ td >
</ tr >
< tr >
< th scope = " row " > < ? php _e ( 'romantic' ) ?> </th>
< td >
< label for = " muse " >
< input class = " valinp " type = " checkbox " name = " romantic " value = " muse " id = " muse " < ? php xfn_check ( 'romantic' , 'muse' ); ?> />
< ? php _e ( 'muse' ) ?> </label>
< label for = " crush " >
< input class = " valinp " type = " checkbox " name = " romantic " value = " crush " id = " crush " < ? php xfn_check ( 'romantic' , 'crush' ); ?> />
< ? php _e ( 'crush' ) ?> </label>
< label for = " date " >
< input class = " valinp " type = " checkbox " name = " romantic " value = " date " id = " date " < ? php xfn_check ( 'romantic' , 'date' ); ?> />
< ? php _e ( 'date' ) ?> </label>
< label for = " romantic " >
< input class = " valinp " type = " checkbox " name = " romantic " value = " sweetheart " id = " romantic " < ? php xfn_check ( 'romantic' , 'sweetheart' ); ?> />
< ? php _e ( 'sweetheart' ) ?> </label>
</ td >
</ tr >
</ table >
</ td >
2004-04-15 11:15:56 +02:00
</ tr >
</ table >
</ fieldset >
< p class = " submit " >
2004-04-25 22:20:23 +02:00
< input type = " submit " name = " submit " value = " <?php _e('Add Link »') ?> " />
2004-04-15 11:15:56 +02:00
</ p >
< fieldset class = " options " >
2004-04-25 22:20:23 +02:00
< legend >< ? php _e ( 'Advanced' ) ?> </legend>
2004-04-15 11:15:56 +02:00
< table class = " editform " width = " 100% " cellspacing = " 2 " cellpadding = " 5 " >
2004-01-01 02:05:28 +01:00
< tr >
2004-04-25 22:20:23 +02:00
< th width = " 33% " scope = " row " >< ? php _e ( 'Image URI:' ) ?> </th>
2004-04-19 10:09:27 +02:00
< td width = " 67% " >< input type = " text " name = " image " size = " 50 " value = " " style = " width: 95% " /></ td >
2004-04-15 11:15:56 +02:00
</ tr >
< tr >
2004-04-25 22:20:23 +02:00
< th scope = " row " >< ? php _e ( 'RSS URI:' ) ?> </th>
2004-04-19 10:09:27 +02:00
< td >< input name = " rss_uri " type = " text " id = " rss_uri " value = " " size = " 50 " style = " width: 95% " /></ td >
2003-12-27 21:55:03 +01:00
</ tr >
< tr >
2004-04-25 22:20:23 +02:00
< th scope = " row " >< ? php _e ( 'Notes:' ) ?> </th>
2004-04-19 10:09:27 +02:00
< td >< textarea name = " notes " cols = " 50 " rows = " 10 " style = " width: 95% " ></ textarea ></ td >
2003-12-27 21:55:03 +01:00
</ tr >
< tr >
2004-04-25 22:20:23 +02:00
< th scope = " row " >< ? php _e ( 'Rating:' ) ?> </th>
2003-12-27 21:55:03 +01:00
< td >< select name = " rating " size = " 1 " >
< ? php
2003-12-23 22:47:03 +01:00
for ( $r = 0 ; $r < 10 ; $r ++ ) {
echo ( ' <option value="' . $r . '">' . $r . '</option>' );
}
?>
2003-12-27 21:55:03 +01:00
</ select >
2004-04-25 22:20:23 +02:00
& nbsp ; < ? php _e ( '(Leave at 0 for no rating.)' ) ?> </td>
2003-12-27 21:55:03 +01:00
</ tr >
< tr >
2004-04-25 22:20:23 +02:00
< th scope = " row " >< ? php _e ( 'Target' ) ?> </th>
2003-12-27 21:55:03 +01:00
< td >< label >
2004-04-19 10:09:27 +02:00
< input type = " radio " name = " target " value = " _blank " />
2003-12-27 21:55:03 +01:00
< code > _blank </ code ></ label >
2004-04-19 10:09:27 +02:00
< br />
< label >< input type = " radio " name = " target " value = " _top " />
2003-12-27 21:55:03 +01:00
< code > _top </ code ></ label >
2004-04-19 10:09:27 +02:00
< br />
< label >< input type = " radio " name = " target " value = " " checked = " checked " />
2004-04-25 22:20:23 +02: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 21:55:03 +01:00
</ tr >
< tr >
2004-04-25 22:20:23 +02:00
< th scope = " row " >< ? php _e ( 'Visible:' ) ?> </th>
2003-12-27 21:55:03 +01:00
< td >< label >
2004-04-19 10:09:27 +02:00
< input type = " radio " name = " visible " checked = " checked " value = " Y " />
2004-04-25 22:20:23 +02:00
< ? php _e ( 'Yes' ) ?> </label><br />
2004-06-11 20:23:12 +02:00
< label >< input type = " radio " name = " visible " value = " N " /> < input type = " hidden " name = " action " value = " Add " />
2004-04-25 22:20:23 +02:00
< ? php _e ( 'No' ) ?> </label></td>
2003-12-27 21:55:03 +01:00
</ tr >
2004-04-15 11:15:56 +02:00
</ table >
</ fieldset >
< p class = " submit " >
2004-04-25 22:20:23 +02:00
< input type = " submit " name = " submit " value = " <?php _e('Add Link »') ?> " />
2004-01-01 02:05:28 +01:00
</ p >
</ form >
2003-12-23 22:47:03 +01:00
</ div >
< div class = " wrap " >
2004-06-11 20:23:12 +02: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 22:47:03 +01:00
</ div >
< ? php
require ( 'admin-footer.php' );
2004-04-25 22:20:23 +02:00
?>