2 if ( ! empty($link_id) ) {
4 $heading = __('Edit a link:');
5 $submit_text = __('Save Changes »');
6 $form = '<form action="" method="post" name="editlink" id="editlink">';
7 $nonce_action = 'update-bookmark_' . $link_id;
10 $heading = __('<strong>Add</strong> a link:');
11 $submit_text = __('Add Link »');
12 $form = '<form name="addlink" method="post" action="link-manager.php">';
13 $nonce_action = 'add-bookmark';
16 function xfn_check($class, $value = '', $type = 'check') {
19 $link_rel = $link->link_rel;
20 $rels = preg_split('/\s+/', $link_rel);
22 if ('' != $value && in_array($value, $rels) ) {
23 echo ' checked="checked"';
27 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"';
28 if ('friendship' == $class && !strstr($link_rel, 'friend') && !strstr($link_rel, 'acquaintance') && !strstr($link_rel, 'contact') ) echo ' checked="checked"';
29 if ('geographical' == $class && !strstr($link_rel, 'co-resident') && !strstr($link_rel, 'neighbor') ) echo ' checked="checked"';
30 if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
38 <?php wp_nonce_field($nonce_action); ?>
39 <h2><?php echo $heading ?></h2>
40 <fieldset class="options">
41 <legend><?php _e('Basics') ?></legend>
42 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
44 <th width="33%" scope="row"><?php _e('URI:') ?></th>
45 <td width="67%"><input type="text" name="link_url" value="<?php echo $link->link_url; ?>" style="width: 95%;" /></td>
48 <th scope="row"><?php _e('Link Name:') ?></th>
49 <td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td>
52 <th scope="row"><?php _e('Short description:') ?></th>
53 <td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td>
56 <th scope="row"><?php _e('Category:') ?></th>
57 <td><?php link_category_dropdown('link_category', $link->link_category); ?></td>
62 <input type="submit" name="submit" value="<?php echo $submit_text ?>" />
64 <fieldset class="options">
65 <legend><?php _e('Link Relationship (XFN)') ?></legend>
66 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
68 <th width="33%" scope="row"><?php _e('rel:') ?></th>
69 <td width="67%"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
72 <th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th>
74 <table cellpadding="3" cellspacing="5">
76 <th scope="row"> <?php _e('identity') ?> </th>
79 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
80 <?php _e('another web address of mine') ?></label>
84 <th scope="row"> <?php _e('friendship') ?> </th>
87 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
88 <label for="acquaintance">
89 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> /> <?php _e('acquaintance') ?></label>
91 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
92 <label for="friendship">
93 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
97 <th scope="row"> <?php _e('physical') ?> </th>
100 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
101 <?php _e('met') ?></label>
105 <th scope="row"> <?php _e('professional') ?> </th>
107 <label for="co-worker">
108 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
109 <?php _e('co-worker') ?></label>
110 <label for="colleague">
111 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
112 <?php _e('colleague') ?></label>
116 <th scope="row"> <?php _e('geographical') ?> </th>
118 <label for="co-resident">
119 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
120 <?php _e('co-resident') ?></label>
121 <label for="neighbor">
122 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> />
123 <?php _e('neighbor') ?></label>
124 <label for="geographical">
125 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
126 <?php _e('none') ?></label>
130 <th scope="row"> <?php _e('family') ?> </th>
133 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
134 <?php _e('child') ?></label>
136 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> />
137 <?php _e('kin') ?></label>
139 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> />
140 <?php _e('parent') ?></label>
141 <label for="sibling">
142 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> />
143 <?php _e('sibling') ?></label>
145 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> />
146 <?php _e('spouse') ?></label>
148 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
149 <?php _e('none') ?></label>
153 <th scope="row"> <?php _e('romantic') ?> </th>
156 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
157 <?php _e('muse') ?></label>
159 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> />
160 <?php _e('crush') ?></label>
162 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> />
163 <?php _e('date') ?></label>
164 <label for="romantic">
165 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
166 <?php _e('sweetheart') ?></label>
175 <input type="submit" name="submit" value="<?php echo $submit_text ?>" />
177 <fieldset class="options">
178 <legend><?php _e('Advanced') ?></legend>
179 <table class="editform" width="100%" cellspacing="2" cellpadding="5">
181 <th width="33%" scope="row"><?php _e('Image URI:') ?></th>
182 <td width="67%"><input type="text" name="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td>
185 <th scope="row"><?php _e('RSS URI:') ?> </th>
186 <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td>
189 <th scope="row"><?php _e('Notes:') ?></th>
190 <td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td>
193 <th scope="row"><?php _e('Rating:') ?></th>
194 <td><select name="link_rating" size="1">
196 for ($r = 0; $r < 10; $r++) {
197 echo(' <option value="'.$r.'" ');
198 if ($link->link_rating == $r)
199 echo 'selected="selected"';
200 echo('>'.$r.'</option>');
204 <?php _e('(Leave at 0 for no rating.)') ?> </td>
207 <th scope="row"><?php _e('Target') ?></th>
209 <input type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
210 <code>_blank</code></label><br />
212 <input type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> />
213 <code>_top</code></label><br />
215 <input type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
216 <?php _e('none') ?></label><br />
217 <?php _e('(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?></td>
220 <th scope="row"><?php _e('Visible:') ?></th>
222 <input type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
223 <?php _e('Yes') ?></label><br /><label>
224 <input type="radio" name="link_visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" />
225 <?php _e('No') ?></label></td>
229 <p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p>
230 <?php if ( $editing ) : ?>
231 <input type="hidden" name="action" value="editlink" />
232 <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
233 <input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" />
234 <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" />
236 <input type="hidden" name="action" value="Add" />