| 1 |
<?php |
|---|
| 2 |
if ( ! empty($link_id) ) { |
|---|
| 3 |
$editing = true; |
|---|
| 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; |
|---|
| 8 |
} else { |
|---|
| 9 |
$editing = false; |
|---|
| 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'; |
|---|
| 14 |
} |
|---|
| 15 |
|
|---|
| 16 |
function xfn_check($class, $value = '', $type = 'check') { |
|---|
| 17 |
global $link; |
|---|
| 18 |
|
|---|
| 19 |
$link_rel = $link->link_rel; |
|---|
| 20 |
$rels = preg_split('/\s+/', $link_rel); |
|---|
| 21 |
|
|---|
| 22 |
if ('' != $value && in_array($value, $rels) ) { |
|---|
| 23 |
echo ' checked="checked"'; |
|---|
| 24 |
} |
|---|
| 25 |
|
|---|
| 26 |
if ('' == $value) { |
|---|
| 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"'; |
|---|
| 31 |
} |
|---|
| 32 |
} |
|---|
| 33 |
|
|---|
| 34 |
?> |
|---|
| 35 |
|
|---|
| 36 |
<div class="wrap"> |
|---|
| 37 |
<?php echo $form ?> |
|---|
| 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"> |
|---|
| 43 |
<tr> |
|---|
| 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> |
|---|
| 46 |
</tr> |
|---|
| 47 |
<tr> |
|---|
| 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> |
|---|
| 50 |
</tr> |
|---|
| 51 |
<tr> |
|---|
| 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> |
|---|
| 54 |
</tr> |
|---|
| 55 |
<tr> |
|---|
| 56 |
<th scope="row"><?php _e('Category:') ?></th> |
|---|
| 57 |
<td><?php link_category_dropdown('link_category', $link->link_category); ?></td> |
|---|
| 58 |
</tr> |
|---|
| 59 |
</table> |
|---|
| 60 |
</fieldset> |
|---|
| 61 |
<p class="submit"> |
|---|
| 62 |
<input type="submit" name="submit" value="<?php echo $submit_text ?>" /> |
|---|
| 63 |
</p> |
|---|
| 64 |
<fieldset class="options"> |
|---|
| 65 |
<legend><?php _e('Link Relationship (XFN)') ?></legend> |
|---|
| 66 |
<table class="editform" width="100%" cellspacing="2" cellpadding="5"> |
|---|
| 67 |
<tr> |
|---|
| 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> |
|---|
| 70 |
</tr> |
|---|
| 71 |
<tr> |
|---|
| 72 |
<th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th> |
|---|
| 73 |
<td> |
|---|
| 74 |
<table cellpadding="3" cellspacing="5"> |
|---|
| 75 |
<tr> |
|---|
| 76 |
<th scope="row"> <?php _e('identity') ?> </th> |
|---|
| 77 |
<td> |
|---|
| 78 |
<label for="me"> |
|---|
| 79 |
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> /> |
|---|
| 80 |
<?php _e('another web address of mine') ?></label> |
|---|
| 81 |
</td> |
|---|
| 82 |
</tr> |
|---|
| 83 |
<tr> |
|---|
| 84 |
<th scope="row"> <?php _e('friendship') ?> </th> |
|---|
| 85 |
<td> |
|---|
| 86 |
<label for="contact"> |
|---|
| 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> |
|---|
| 90 |
<label for="friend"> |
|---|
| 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> |
|---|
| 94 |
</td> |
|---|
| 95 |
</tr> |
|---|
| 96 |
<tr> |
|---|
| 97 |
<th scope="row"> <?php _e('physical') ?> </th> |
|---|
| 98 |
<td> |
|---|
| 99 |
<label for="met"> |
|---|
| 100 |
<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> /> |
|---|
| 101 |
<?php _e('met') ?></label> |
|---|
| 102 |
</td> |
|---|
| 103 |
</tr> |
|---|
| 104 |
<tr> |
|---|
| 105 |
<th scope="row"> <?php _e('professional') ?> </th> |
|---|
| 106 |
<td> |
|---|
| 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> |
|---|
| 113 |
</td> |
|---|
| 114 |
</tr> |
|---|
| 115 |
<tr> |
|---|
| 116 |
<th scope="row"> <?php _e('geographical') ?> </th> |
|---|
| 117 |
<td> |
|---|
| 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> |
|---|
| 127 |
</td> |
|---|
| 128 |
</tr> |
|---|
| 129 |
<tr> |
|---|
| 130 |
<th scope="row"> <?php _e('family') ?> </th> |
|---|
| 131 |
<td> |
|---|
| 132 |
<label for="child"> |
|---|
| 133 |
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> /> |
|---|
| 134 |
<?php _e('child') ?></label> |
|---|
| 135 |
<label for="kin"> |
|---|
| 136 |
<input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?> /> |
|---|
| 137 |
<?php _e('kin') ?></label> |
|---|
| 138 |
<label for="parent"> |
|---|
| 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> |
|---|
| 144 |
<label for="spouse"> |
|---|
| 145 |
<input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> /> |
|---|
| 146 |
<?php _e('spouse') ?></label> |
|---|
| 147 |
<label for="family"> |
|---|
| 148 |
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> /> |
|---|
| 149 |
<?php _e('none') ?></label> |
|---|
| 150 |
</td> |
|---|
| 151 |
</tr> |
|---|
| 152 |
<tr> |
|---|
| 153 |
<th scope="row"> <?php _e('romantic') ?> </th> |
|---|
| 154 |
<td> |
|---|
| 155 |
<label for="muse"> |
|---|
| 156 |
<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> /> |
|---|
| 157 |
<?php _e('muse') ?></label> |
|---|
| 158 |
<label for="crush"> |
|---|
| 159 |
<input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> /> |
|---|
| 160 |
<?php _e('crush') ?></label> |
|---|
| 161 |
<label for="date"> |
|---|
| 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> |
|---|
| 167 |
</td> |
|---|
| 168 |
</tr> |
|---|
| 169 |
</table> |
|---|
| 170 |
</td> |
|---|
| 171 |
</tr> |
|---|
| 172 |
</table> |
|---|
| 173 |
</fieldset> |
|---|
| 174 |
<p class="submit"> |
|---|
| 175 |
<input type="submit" name="submit" value="<?php echo $submit_text ?>" /> |
|---|
| 176 |
</p> |
|---|
| 177 |
<fieldset class="options"> |
|---|
| 178 |
<legend><?php _e('Advanced') ?></legend> |
|---|
| 179 |
<table class="editform" width="100%" cellspacing="2" cellpadding="5"> |
|---|
| 180 |
<tr> |
|---|
| 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> |
|---|
| 183 |
</tr> |
|---|
| 184 |
<tr> |
|---|
| 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> |
|---|
| 187 |
</tr> |
|---|
| 188 |
<tr> |
|---|
| 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> |
|---|
| 191 |
</tr> |
|---|
| 192 |
<tr> |
|---|
| 193 |
<th scope="row"><?php _e('Rating:') ?></th> |
|---|
| 194 |
<td><select name="link_rating" size="1"> |
|---|
| 195 |
<?php |
|---|
| 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>'); |
|---|
| 201 |
} |
|---|
| 202 |
?> |
|---|
| 203 |
</select> |
|---|
| 204 |
<?php _e('(Leave at 0 for no rating.)') ?> </td> |
|---|
| 205 |
</tr> |
|---|
| 206 |
<tr> |
|---|
| 207 |
<th scope="row"><?php _e('Target') ?></th> |
|---|
| 208 |
<td><label> |
|---|
| 209 |
<input type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> |
|---|
| 210 |
<code>_blank</code></label><br /> |
|---|
| 211 |
<label> |
|---|
| 212 |
<input type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> /> |
|---|
| 213 |
<code>_top</code></label><br /> |
|---|
| 214 |
<label> |
|---|
| 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> |
|---|
| 218 |
</tr> |
|---|
| 219 |
<tr> |
|---|
| 220 |
<th scope="row"><?php _e('Visible:') ?></th> |
|---|
| 221 |
<td><label> |
|---|
| 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> |
|---|
| 226 |
</tr> |
|---|
| 227 |
</table> |
|---|
| 228 |
</fieldset> |
|---|
| 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 attribute_escape($order_by); ?>" /> |
|---|
| 234 |
<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> |
|---|
| 235 |
<?php else: ?> |
|---|
| 236 |
<input type="hidden" name="action" value="Add" /> |
|---|
| 237 |
<?php endif; ?> |
|---|
| 238 |
</form> |
|---|
| 239 |
</div> |
|---|