Changeset 3570

Show
Ignore:
Timestamp:
02/27/06 04:57:30 (3 years ago)
Author:
ryan
Message:

Bookmark/link rework. #2499

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-db.php

    r3528 r3570  
    106106        $category_parent = 0; 
    107107 
     108    if ( isset($posts_private) ) 
     109        $posts_private = (int) $posts_private; 
     110    else 
     111        $posts_private = 0; 
     112 
     113    if ( isset($links_private) ) 
     114        $links_private = (int) $links_private; 
     115    else 
     116        $links_private = 0; 
     117 
    108118    if (!$update) { 
    109         $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent')"); 
     119        $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private')"); 
    110120        $cat_ID = $wpdb->insert_id; 
    111121    } else { 
    112         $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent' WHERE cat_ID = '$cat_ID'"); 
     122        $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private' WHERE cat_ID = '$cat_ID'"); 
    113123    } 
    114124 
     
    154164 
    155165    // Don't delete the default cat. 
    156     if (1 == $cat_ID) 
     166    if ( $cat_ID == get_option('default_category') ) 
     167        return 0; 
     168 
     169    if ( $cat_ID == get_option('default_link_category') ) 
    157170        return 0; 
    158171 
     
    167180    $wpdb->query("UPDATE $wpdb->categories SET category_parent = '$parent' WHERE category_parent = '$cat_ID'"); 
    168181 
    169     // TODO: Only set categories to general if they're not in another category already 
    170     $wpdb->query("UPDATE $wpdb->post2cat SET category_id='1' WHERE category_id='$cat_ID'"); 
    171  
     182    // Only set posts and links to the default category if they're not in another category already. 
     183    $default_cat = get_option('default_category'); 
     184    $posts = $wpdb->get_col("SELECT post_id FROM $wpdb->post2cat WHERE category_id='$cat_ID'"); 
     185    if ( is_array($posts) ) foreach ($posts as $post_id) { 
     186        $cats = wp_get_post_cats('', $post_id); 
     187        if ( 1 == count($cats) ) 
     188            $cats = array($default_cat); 
     189        else 
     190            $cats = array_diff($cats, array($cat_ID)); 
     191        wp_set_post_cats('', $post_id, $cats);  
     192    } 
     193 
     194    $default_link_cat = get_option('default_link_category'); 
     195    $links = $wpdb->get_col("SELECT link_id FROM $wpdb->link2cat WHERE category_id='$cat_ID'"); 
     196    if ( is_array($links) ) foreach ($links as $link_id) { 
     197        $cats = wp_get_link_cats($link_id); 
     198        if ( 1 == count($cats) ) 
     199            $cats = array($default_link_cat); 
     200        else 
     201            $cats = array_diff($cats, array($cat_ID)); 
     202        wp_set_link_cats($link_id, $cats);  
     203    } 
     204     
    172205    wp_cache_delete($cat_ID, 'category'); 
    173206    wp_cache_delete('all_category_ids', 'category'); 
     
    245278 
    246279    $link = $wpdb->get_row("SELECT * FROM $wpdb->links WHERE link_id = '$link_id'"); 
     280    $link->link_category = wp_get_link_cats($link_id); 
    247281 
    248282    if ( $output == OBJECT ) { 
     
    281315        $link_notes = ''; 
    282316 
     317    // Make sure we set a valid category 
     318    if (0 == count($link_category) || !is_array($link_category)) { 
     319        $link_category = array(get_option('default_category')); 
     320    } 
     321 
    283322    if ( $update ) { 
    284323        $wpdb->query("UPDATE $wpdb->links SET link_url='$link_url', 
    285324            link_name='$link_name', link_image='$link_image', 
    286             link_target='$link_target', link_category='$link_category', 
     325            link_target='$link_target', 
    287326            link_visible='$link_visible', link_description='$link_description', 
    288327            link_rating='$link_rating', link_rel='$link_rel', 
     
    290329            WHERE link_id='$link_id'"); 
    291330    } else { 
    292         $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_category, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_category', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')"); 
     331        $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')"); 
    293332        $link_id = $wpdb->insert_id; 
    294333    } 
     334 
     335    wp_set_link_cats($link_id, $link_category); 
    295336 
    296337    if ( $update ) 
     
    312353    $link = add_magic_quotes($link); 
    313354 
     355    // Passed link category list overwrites existing category list if not empty. 
     356    if ( isset($linkdata['link_category']) && is_array($linkdata['link_category']) 
     357             && 0 != count($linkdata['link_category']) ) 
     358        $link_cats = $linkdata['link_category']; 
     359    else  
     360        $link_cats = $link['link_category']; 
     361 
    314362    // Merge old and new fields with new fields overwriting old ones. 
    315363    $linkdata = array_merge($link, $linkdata); 
     364    $linkdata['link_category'] = $link_cats; 
    316365 
    317366    return wp_insert_link($linkdata); 
     
    322371 
    323372    do_action('delete_link', $link_id); 
     373     
     374    $categories = wp_get_link_cats($link_id); 
     375    if( is_array( $categories ) ) { 
     376        foreach ( $categories as $category ) { 
     377            $wpdb->query("UPDATE $wpdb->categories SET link_count = link_count - 1 WHERE cat_ID = '$category'"); 
     378            wp_cache_delete($category, 'category'); 
     379        } 
     380    } 
     381 
     382    $wpdb->query("DELETE FROM $wpdb->link2cat WHERE link_id = '$link_id'"); 
    324383    return $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'"); 
    325384} 
     385 
     386function wp_get_link_cats($link_ID = 0) { 
     387    global $wpdb; 
     388 
     389    $sql = "SELECT category_id  
     390        FROM $wpdb->link2cat  
     391        WHERE link_id = $link_ID  
     392        ORDER BY category_id"; 
     393 
     394    $result = $wpdb->get_col($sql); 
     395 
     396    if ( !$result ) 
     397        $result = array(); 
     398 
     399    return array_unique($result); 
     400} 
     401 
     402function wp_set_link_cats($link_ID = 0, $link_categories = array()) { 
     403    global $wpdb; 
     404    // If $link_categories isn't already an array, make it one: 
     405    if (!is_array($link_categories) || 0 == count($link_categories)) 
     406        $link_categories = array(get_option('default_category')); 
     407 
     408    $link_categories = array_unique($link_categories); 
     409 
     410    // First the old categories 
     411    $old_categories = $wpdb->get_col(" 
     412        SELECT category_id  
     413        FROM $wpdb->link2cat  
     414        WHERE link_id = $link_ID"); 
     415 
     416    if (!$old_categories) { 
     417        $old_categories = array(); 
     418    } else { 
     419        $old_categories = array_unique($old_categories); 
     420    } 
     421 
     422    // Delete any? 
     423    $delete_cats = array_diff($old_categories,$link_categories); 
     424 
     425    if ($delete_cats) { 
     426        foreach ($delete_cats as $del) { 
     427            $wpdb->query(" 
     428                DELETE FROM $wpdb->link2cat  
     429                WHERE category_id = $del  
     430                    AND link_id = $link_ID  
     431                "); 
     432        } 
     433    } 
     434 
     435    // Add any? 
     436    $add_cats = array_diff($link_categories, $old_categories); 
     437 
     438    if ($add_cats) { 
     439        foreach ($add_cats as $new_cat) { 
     440            $wpdb->query(" 
     441                INSERT INTO $wpdb->link2cat (link_id, category_id)  
     442                VALUES ($link_ID, $new_cat)"); 
     443        } 
     444    } 
     445     
     446    // Update category counts. 
     447    $all_affected_cats = array_unique(array_merge($link_categories, $old_categories)); 
     448    foreach ( $all_affected_cats as $cat_id ) { 
     449        $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->link2cat, $wpdb->links WHERE $wpdb->links.link_id = $wpdb->link2cat.link_id AND category_id = '$cat_id'"); 
     450        $wpdb->query("UPDATE $wpdb->categories SET link_count = '$count' WHERE cat_ID = '$cat_id'"); 
     451        wp_cache_delete($cat_id, 'category'); 
     452    } 
     453}   // wp_set_link_cats() 
    326454 
    327455function post_exists($title, $content = '', $post_date = '') { 
  • trunk/wp-admin/admin-functions.php

    r3564 r3570  
    477477    $link->link_notes = wp_specialchars($link->link_notes); 
    478478    $link->link_rss = wp_specialchars($link->link_rss); 
     479    $link->post_category = $link->link_category; 
    479480 
    480481    return $link; 
     
    492493        $link->link_name = ''; 
    493494 
     495    $link->link_visible = 'Y'; 
     496 
    494497    return $link; 
    495498} 
     
    508511    $_POST['link_image'] = wp_specialchars($_POST['link_image']); 
    509512    $_POST['link_rss'] = wp_specialchars($_POST['link_rss']); 
    510     $auto_toggle = get_autotoggle($_POST['link_category']); 
    511  
    512     // if we are in an auto toggle category and this one is visible then we 
    513     // need to make the others invisible before we add this new one. 
    514     // FIXME Add category toggle func. 
    515     //if (($auto_toggle == 'Y') && ($link_visible == 'Y')) { 
    516     //  $wpdb->query("UPDATE $wpdb->links set link_visible = 'N' WHERE link_category = $link_category"); 
    517     //} 
     513    $_POST['link_category'] = $_POST['post_category']; 
    518514 
    519515    if ( !empty($link_id) ) { 
     
    555551 
    556552function get_nested_categories($default = 0, $parent = 0) { 
    557     global $post_ID, $mode, $wpdb; 
     553    global $post_ID, $link_id, $mode, $wpdb; 
    558554 
    559555    if ($post_ID) { 
     
    568564            $checked_categories[] = $default; 
    569565        } 
    570  
     566    } else if ($link_id) { 
     567        $checked_categories = $wpdb->get_col(" 
     568             SELECT category_id 
     569             FROM $wpdb->categories, $wpdb->link2cat 
     570             WHERE $wpdb->link2cat.category_id = cat_ID AND $wpdb->link2cat.link_id = '$link_id' 
     571             "); 
     572 
     573        if (count($checked_categories) == 0) { 
     574            // No selected categories, strange 
     575            $checked_categories[] = $default; 
     576        }    
    571577    } else { 
    572578        $checked_categories[] = $default; 
     
    621627                    $edit = "<a href='categories.php?action=edit&amp;cat_ID=$category->cat_ID' class='edit'>".__('Edit')."</a></td>"; 
    622628                    $default_cat_id = get_option('default_category'); 
    623  
    624                     if ($category->cat_ID != $default_cat_id) 
    625                         $edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;.  All of its posts will go to the default category.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>"; 
     629                    $default_link_cat_id = get_option('default_link_category'); 
     630 
     631                    if ( ($category->cat_ID != $default_cat_id) && ($category->cat_ID != $default_link_cat_id) ) 
     632                        $edit .= "<td><a href='categories.php?action=delete&amp;cat_ID=$category->cat_ID' onclick=\"return deleteSomething( 'cat', $category->cat_ID, '".sprintf(__("You are about to delete the category &quot;%s&quot;.  All of its posts and bookmarks will go to the default categories.\\n&quot;OK&quot; to delete, &quot;Cancel&quot; to stop."), wp_specialchars($category->cat_name, 1))."' );\" class='delete'>".__('Delete')."</a>"; 
    626633                    else 
    627634                        $edit .= "<td style='text-align:center'>".__("Default"); 
     
    634641                                <td>$category->category_description</td> 
    635642                                <td>$category->category_count</td> 
     643                                <td>$category->link_count</td> 
    636644                                <td>$edit</td> 
    637645                                </tr>"; 
     
    688696        foreach ($categories as $category) { 
    689697            if ($currentcat != $category->cat_ID && $parent == $category->category_parent) { 
    690                 $count = $wpdb->get_var("SELECT COUNT(post_id) FROM $wpdb->post2cat WHERE category_id = $category->cat_ID"); 
    691698                $pad = str_repeat('&#8211; ', $level); 
    692699                $category->cat_name = wp_specialchars($category->cat_name); 
     
    703710} 
    704711 
    705 function link_category_dropdown($fieldname, $selected = 0) { 
     712function return_link_categories_list($parent = 0) { 
    706713    global $wpdb; 
    707  
    708     $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); 
    709     echo "\n<select name='$fieldname' size='1'>\n"; 
    710     foreach ($results as $row) { 
    711         echo "\n\t<option value='$row->cat_id'"; 
    712         if ($row->cat_id == $selected) 
    713             echo " selected='selected'"; 
    714         echo ">$row->cat_id : " . wp_specialchars($row->cat_name); 
    715         if ($row->auto_toggle == 'Y') 
    716             echo ' (auto toggle)'; 
    717         echo "</option>"; 
    718     } 
    719     echo "\n</select>\n"; 
     714    return $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories WHERE category_parent = $parent ORDER BY link_count DESC LIMIT 100"); 
    720715} 
    721716 
  • trunk/wp-admin/admin-header.php

    r3563 r3570  
    4141<?php break; case 'page.php' : case 'page-new.php' : ?> 
    4242var manager = new dbxManager('pagemeta'); 
     43<?php break; case 'link.php' : case 'link-add.php' : ?> 
     44var manager = new dbxManager('linkmeta'); 
    4345<?php break; endswitch; ?> 
    4446}); 
  • trunk/wp-admin/categories.php

    r3541 r3570  
    128128        <th scope="col"><?php _e('Description') ?></th> 
    129129        <th scope="col"><?php _e('# Posts') ?></th> 
     130        <th scope="col"><?php _e('# Links') ?></th> 
    130131        <th colspan="2"><?php _e('Action') ?></th> 
    131132    </tr> 
     
    141142<?php if ( current_user_can('manage_categories') ) : ?> 
    142143<div class="wrap"> 
    143 <p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete posts from that category, it will just set them back to the default category <strong>%s</strong>.'), get_catname(get_option('default_category'))) ?></p> 
     144<p><?php printf(__('<strong>Note:</strong><br />Deleting a category does not delete the posts and bookmarks in that category.  Instead, posts in the deleted category are set to the category <strong>%s</strong> and bookmarks are set to <strong>%s</strong>.'), get_catname(get_option('default_category')), get_catname(get_option('default_link_category'))) ?></p> 
    144145</div> 
    145146 
  • trunk/wp-admin/edit-link-form.php

    r3257 r3570  
    11<?php 
    22if ( ! empty($link_id) ) { 
    3     $editing = true; 
    4     $heading = __('Edit a link:'); 
     3    $heading = __('Edit Bookmark'); 
    54    $submit_text = __('Save Changes &raquo;'); 
    6     $form = '<form action="" method="post" name="editlink" id="editlink">';  
     5    $form = '<form name="editlink" id="editlink" method="post" action="link.php">';  
    76} else { 
    8     $editing = false; 
    9     $heading = __('<strong>Add</strong> a link:'); 
    10     $submit_text = __('Add Link &raquo;'); 
    11     $form = '<form name="addlink" method="post" action="link-manager.php">'; 
     7    $heading = __('Create Bookmark'); 
     8    $submit_text = __('Add Bookmark &raquo;'); 
     9    $form = '<form name="addlink" id="addlink" method="post" action="link.php">'; 
    1210} 
    1311 
     
    2927    } 
    3028} 
    31  
    3229?> 
    3330 
    3431<div class="wrap">  
    35   <?php echo $form ?> 
    36   <h2><?php echo $heading ?></h2> 
    37 <fieldset class="options"> 
    38     <legend><?php _e('Basics') ?></legend> 
    39         <table class="editform" width="100%" cellspacing="2" cellpadding="5"> 
    40          <tr> 
    41            <th width="33%" scope="row"><?php _e('URI:') ?></th> 
    42            <td width="67%"><input type="text" name="link_url" value="<?php echo $link->link_url; ?>" style="width: 95%;" /></td> 
    43          </tr> 
    44          <tr> 
    45            <th scope="row"><?php _e('Link Name:') ?></th> 
    46            <td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td> 
    47          </tr> 
    48          <tr> 
    49             <th scope="row"><?php _e('Short description:') ?></th> 
    50             <td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td> 
    51             </tr> 
    52         <tr> 
    53            <th scope="row"><?php _e('Category:') ?></th> 
    54            <td><?php link_category_dropdown('link_category', $link->link_category); ?></td> 
    55          </tr> 
     32<h2><?php echo $heading ?></h2> 
     33<?php echo $form ?> 
     34  
     35<div id="poststuff"> 
     36<div id="moremeta"> 
     37<div id="grabit" class="dbx-group"> 
     38 
     39<fieldset id="categorydiv" class="dbx-box"> 
     40<h3 class="dbx-handle"><?php _e('Categories') ?></h3> 
     41<div class="dbx-content"> 
     42<p id="jaxcat"></p> 
     43<div id="categorychecklist"><?php dropdown_categories(get_settings('default_link_category')); ?></div></div> 
     44</fieldset> 
     45 
     46<fieldset class="dbx-box"> 
     47<h3 class="dbx-handle"><?php _e('Target') ?></h3>  
     48<div class="dbx-content"> 
     49<label for="link_target_blank" class="selectit"> 
     50<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> 
     51<code>_blank</code></label> 
     52<label for="link_target_top" class="selectit"> 
     53<input id="link_target_top" type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> /> 
     54<code>_top</code></label> 
     55<label for="link_target_none" class="selectit"> 
     56<input id="link_target_none" type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> /> 
     57<?php _e('none') ?></label> 
     58</div> 
     59</fieldset> 
     60 
     61<fieldset class="dbx-box"> 
     62<h3 class="dbx-handle"><?php _e('Visible') ?></h3>  
     63<div class="dbx-content"> 
     64<label for="link_visible_yes" class="selectit"> 
     65<input id="link_visible_yes" type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" /> 
     66<?php _e('Yes') ?></label> 
     67<label for="link_visible_no" class="selectit"> 
     68<input id="link_visible_no" type="radio" name="link_visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" /> 
     69<?php _e('No') ?></label> 
     70</div> 
     71</fieldset> 
     72 
     73</div> 
     74</div> 
     75 
     76<fieldset id="uridiv"> 
     77<legend><?php _e('URI:') ?></legend> 
     78<div><input type="text" name="link_url" value="<?php echo $link->link_url; ?>" style="width: 95%" /></div> 
     79</fieldset> 
     80 
     81<fieldset id="namediv"> 
     82<legend><?php _e('Name:') ?></legend> 
     83<div><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></div> 
     84</fieldset> 
     85 
     86<fieldset id="descdiv"> 
     87<legend><?php _e('Description:') ?></legend> 
     88<div><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></div> 
     89</fieldset> 
     90 
     91<p class="submit"> 
     92<input type="submit" name="submit" value="<?php echo $submit_text ?>" /> 
     93</p> 
     94 
     95<div id="advancedstuff" class="dbx-group" > 
     96 
     97<fieldset id="xfn" class="dbx-box"> 
     98<h3 class="dbx-handle"><?php _e('Link Relationship (XFN)') ?></h3> 
     99<div class="dbx-content"> 
     100<table class="editform" width="100%" cellspacing="2" cellpadding="5"> 
     101    <tr> 
     102        <th width="33%" scope="row"><?php _e('rel:') ?></th> 
     103        <td width="67%"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td> 
     104    </tr> 
     105    <tr> 
     106        <th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th> 
     107        <td> 
     108            <table cellpadding="3" cellspacing="5"> 
     109                <tr> 
     110                    <th scope="row"> <?php _e('identity') ?> </th> 
     111                    <td> 
     112                        <label for="me"> 
     113                        <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> /> 
     114                        <?php _e('another web address of mine') ?></label> 
     115                    </td> 
     116                </tr> 
     117                <tr> 
     118                    <th scope="row"> <?php _e('friendship') ?> </th> 
     119                    <td> 
     120                        <label for="contact"> 
     121                        <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label> 
     122                        <label for="acquaintance"> 
     123                        <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php _e('acquaintance') ?></label> 
     124                        <label id="friend"> 
     125                        <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label> 
     126                        <label for="friendship"> 
     127                        <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label> 
     128                    </td> 
     129                </tr> 
     130                <tr> 
     131                    <th scope="row"> <?php _e('physical') ?> </th> 
     132                    <td> 
     133                        <label for="met"> 
     134                        <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> /> 
     135                        <?php _e('met') ?></label> 
     136                    </td> 
     137                </tr> 
     138                <tr> 
     139                    <th scope="row"> <?php _e('professional') ?> </th> 
     140                    <td> 
     141                        <label for="co-worker"> 
     142                        <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> /> 
     143                        <?php _e('co-worker') ?></label> 
     144                        <label for="colleague"> 
     145                        <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> /> 
     146                        <?php _e('colleague') ?></label> 
     147                    </td> 
     148                </tr> 
     149                <tr> 
     150                    <th scope="row"> <?php _e('geographical') ?> </th> 
     151                    <td> 
     152                        <label for="co-resident"> 
     153                        <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> /> 
     154                        <?php _e('co-resident') ?></label> 
     155                        <label for="neighbor"> 
     156                        <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> /> 
     157                        <?php _e('neighbor') ?></label> 
     158                        <label for="geographical"> 
     159                        <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> /> 
     160                        <?php _e('none') ?></label> 
     161                    </td> 
     162                </tr> 
     163                <tr> 
     164                    <th scope="row"> <?php _e('family') ?> </th> 
     165                    <td> 
     166                        <label for="child"> 
     167                        <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  /> 
     168                        <?php _e('child') ?></label> 
     169                        <label for="kin"> 
     170                        <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  /> 
     171                        <?php _e('kin') ?></label> 
     172                        <label for="parent"> 
     173                        <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> /> 
     174                        <?php _e('parent') ?></label> 
     175                        <label for="sibling"> 
     176                        <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> /> 
     177                        <?php _e('sibling') ?></label> 
     178                        <label for="spouse"> 
     179                        <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> /> 
     180                        <?php _e('spouse') ?></label> 
     181                        <label for="family"> 
     182                        <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> /> 
     183                        <?php _e('none') ?></label> 
     184                    </td> 
     185                </tr> 
     186                <tr> 
     187                    <th scope="row"> <?php _e('romantic') ?> </th> 
     188                    <td> 
     189                        <label for="muse"> 
     190                        <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> /> 
     191                        <?php _e('muse') ?></label> 
     192                        <label for="crush"> 
     193                        <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> /> 
     194                        <?php _e('crush') ?></label> 
     195                        <label for="date"> 
     196                        <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> /> 
     197                        <?php _e('date') ?></label> 
     198                        <label for="romantic"> 
     199                        <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> /> 
     200                        <?php _e('sweetheart') ?></label> 
     201                    </td> 
     202                </tr> 
     203            </table> 
     204        </td> 
     205    </tr> 
    56206</table> 
    57 </fieldset> 
    58        <p class="submit"> 
    59        <input type="submit" name="submit" value="<?php echo $submit_text ?>" /> 
    60        </p> 
    61     <fieldset class="options"> 
    62         <legend><?php _e('Link Relationship (XFN)') ?></legend> 
    63         <table class="editform" width="100%" cellspacing="2" cellpadding="5"> 
    64             <tr> 
    65                 <th width="33%" scope="row"><?php _e('rel:') ?></th> 
    66                 <td width="67%"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td> 
    67             </tr> 
    68             <tr> 
    69                 <th scope="row"><?php _e('<a href="http://gmpg.org/xfn/">XFN</a> Creator:') ?></th> 
    70                 <td> 
    71                     <table cellpadding="3" cellspacing="5"> 
    72               <tr> 
    73               <th scope="row"> <?php _e('identity') ?> </th> 
    74               <td> 
    75                 <label for="me"> 
    76                 <input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> /> 
    77           <?php _e('another web address of mine') ?></label> 
    78               </td> 
    79             </tr> 
    80             <tr> 
    81               <th scope="row"> <?php _e('friendship') ?> </th> 
    82               <td> 
    83                 <label for="contact"> 
    84                 <input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label> 
    85                 <label for="acquaintance"> 
    86                 <input class="valinp" type="radio" name="friendship" value="acquaintance" id="acquaintance" <?php xfn_check('friendship', 'acquaintance', 'radio'); ?> />  <?php _e('acquaintance') ?></label> 
    87                 <label id="friend"> 
    88                 <input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label> 
    89                 <label for="friendship"> 
    90                 <input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label> 
    91               </td> 
    92             </tr> 
    93             <tr> 
    94               <th scope="row"> <?php _e('physical') ?> </th> 
    95               <td> 
    96                 <label for="met"> 
    97                 <input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> /> 
    98           <?php _e('met') ?></label> 
    99               </td> 
    100             </tr> 
    101             <tr> 
    102               <th scope="row"> <?php _e('professional') ?> </th> 
    103               <td> 
    104                 <label for="co-worker"> 
    105                 <input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> /> 
    106           <?php _e('co-worker') ?></label> 
    107                 <label for="colleague"> 
    108                 <input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> /> 
    109           <?php _e('colleague') ?></label> 
    110               </td> 
    111             </tr> 
    112             <tr> 
    113               <th scope="row"> <?php _e('geographical') ?> </th> 
    114               <td> 
    115                 <label for="co-resident"> 
    116                 <input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> /> 
    117           <?php _e('co-resident') ?></label> 
    118                 <label for="neighbor"> 
    119                 <input class="valinp" type="radio" name="geographical" value="neighbor" id="neighbor" <?php xfn_check('geographical', 'neighbor', 'radio'); ?> /> 
    120           <?php _e('neighbor') ?></label> 
    121                 <label for="geographical"> 
    122                 <input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> /> 
    123           <?php _e('none') ?></label> 
    124               </td> 
    125             </tr> 
    126             <tr> 
    127               <th scope="row"> <?php _e('family') ?> </th> 
    128               <td> 
    129                 <label for="child"> 
    130                 <input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?>  /> 
    131           <?php _e('child') ?></label> 
    132                 <label for="kin"> 
    133                 <input class="valinp" type="radio" name="family" value="kin" id="kin" <?php xfn_check('family', 'kin', 'radio'); ?>  /> 
    134           <?php _e('kin') ?></label> 
    135                 <label for="parent"> 
    136                 <input class="valinp" type="radio" name="family" value="parent" id="parent" <?php xfn_check('family', 'parent', 'radio'); ?> /> 
    137           <?php _e('parent') ?></label> 
    138                 <label for="sibling"> 
    139                 <input class="valinp" type="radio" name="family" value="sibling" id="sibling" <?php xfn_check('family', 'sibling', 'radio'); ?> /> 
    140           <?php _e('sibling') ?></label> 
    141                 <label for="spouse"> 
    142                 <input class="valinp" type="radio" name="family" value="spouse" id="spouse" <?php xfn_check('family', 'spouse', 'radio'); ?> /> 
    143           <?php _e('spouse') ?></label> 
    144                 <label for="family"> 
    145                 <input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> /> 
    146           <?php _e('none') ?></label> 
    147               </td> 
    148             </tr> 
    149             <tr> 
    150               <th scope="row"> <?php _e('romantic') ?> </th> 
    151               <td> 
    152                 <label for="muse"> 
    153                 <input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> /> 
    154          <?php _e('muse') ?></label> 
    155                 <label for="crush"> 
    156                 <input class="valinp" type="checkbox" name="romantic" value="crush" id="crush" <?php xfn_check('romantic', 'crush'); ?> /> 
    157          <?php _e('crush') ?></label> 
    158                 <label for="date"> 
    159                 <input class="valinp" type="checkbox" name="romantic" value="date" id="date" <?php xfn_check('romantic', 'date'); ?> /> 
    160          <?php _e('date') ?></label> 
    161                 <label for="romantic"> 
    162                 <input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> /> 
    163          <?php _e('sweetheart') ?></label> 
    164               </td> 
    165             </tr> 
    166         </table> 
    167           </td> 
    168             </tr> 
     207</div> 
     208</fieldset> 
     209 
     210<fieldset id="advanced" class="dbx-box"> 
     211<h3 class="dbx-handle"><?php _e('Advanced') ?></h3> 
     212<div class="dbx-content"> 
     213<table class="editform" width="100%" cellspacing="2" cellpadding="5"> 
     214    <tr> 
     215        <th width="33%" scope="row"><?php _e('Image URI:') ?></th> 
     216        <td width="67%"><input type="text" name="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td> 
     217    </tr> 
     218    <tr> 
     219        <th scope="row"><?php _e('RSS URI:') ?> </th> 
     220        <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td> 
     221    </tr> 
     222    <tr> 
     223        <th scope="row"><?php _e('Notes:') ?></th> 
     224        <td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td> 
     225    </tr> 
     226    <tr> 
     227        <th scope="row"><?php _e('Rating:') ?></th> 
     228        <td><select name="link_rating" size="1"> 
     229        <?php 
     230            for ($r = 0; $r < 10; $r++) { 
     231                echo('            <option value="'.$r.'" '); 
     232                if ($link->link_rating == $r) 
     233                    echo 'selected="selected"'; 
     234                echo('>'.$r.'</option>'); 
     235            } 
     236        ?></select>&nbsp;<?php _e('(Leave at 0 for no rating.)') ?> 
     237        </td> 
     238    </tr> 
    169239</table> 
    170240</fieldset> 
    171        <p class="submit"> 
    172        <input type="submit" name="submit" value="<?php echo $submit_text ?>" /> 
    173        </p> 
    174 <fieldset class="options"> 
    175         <legend><?php _e('Advanced') ?></legend> 
    176         <table class="editform" width="100%" cellspacing="2" cellpadding="5"> 
    177          <tr> 
    178            <th width="33%" scope="row"><?php _e('Image URI:') ?></th> 
    179            <td width="67%"><input type="text" name="link_image" size="50" value="<?php echo $link->link_image; ?>" style="width: 95%" /></td> 
    180          </tr> 
    181 <tr> 
    182            <th scope="row"><?php _e('RSS URI:') ?> </th> 
    183            <td><input name="link_rss" type="text" id="rss_uri" value="<?php echo $link->link_rss; ?>" size="50" style="width: 95%" /></td> 
    184          </tr> 
    185          <tr> 
    186            <th scope="row"><?php _e('Notes:') ?></th> 
    187            <td><textarea name="link_notes" cols="50" rows="10" style="width: 95%"><?php echo $link->link_notes; ?></textarea></td> 
    188          </tr> 
    189          <tr> 
    190            <th scope="row"><?php _e('Rating:') ?></th> 
    191            <td><select name="link_rating" size="1"> 
    192 <?php 
    193     for ($r = 0; $r < 10; $r++) { 
    194       echo('            <option value="'.$r.'" '); 
    195       if ($link->link_rating == $r) 
    196         echo 'selected="selected"'; 
    197       echo('>'.$r.'</option>'); 
    198     } 
    199 ?> 
    200            </select> 
    201          &nbsp;<?php _e('(Leave at 0 for no rating.)') ?> </td> 
    202          </tr> 
    203          <tr> 
    204            <th scope="row"><?php _e('Target') ?></th> 
    205            <td><label> 
    206           <input type="radio" name="link_target" value="_blank"   <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> /> 
    207           <code>_blank</code></label><br /> 
    208 <label> 
    209 <input type="radio" name="link_target" value="_top" <?php echo(($link->link_target == '_top') ? 'checked="checked"' : ''); ?> /> 
    210 <code>_top</code></label><br /> 
    211 <label> 
    212 <input type="radio" name="link_target" value=""     <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> /> 
    213 <?php _e('none') ?></label><br /> 
    214 <?php _e('(Note that the <code>target</code> attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?></td> 
    215          </tr> 
    216          <tr> 
    217            <th scope="row"><?php _e('Visible:') ?></th> 
    218            <td><label> 
    219              <input type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" /> 
    220 <?php _e('Yes') ?></label><br /><label> 
    221 <input type="radio" name="link_visible" <?php if ($link->link_visible == 'N') echo "checked='checked'"; ?> value="N" /> 
    222 <?php _e('No') ?></label></td> 
    223          </tr> 
    224 </table> 
    225 </fieldset> 
    226 <p class="submit"><input type="submit" name="submit" value="<?php echo $submit_text ?>" /></p> 
    227 <?php if ( $editing ) : ?> 
    228           <input type="hidden" name="action" value="editlink" /> 
    229           <input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" /> 
    230           <input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" /> 
    231           <input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> 
     241</div> 
     242 
     243<?php if ( $link_id ) : ?> 
     244<input type="hidden" name="action" value="save" /> 
     245<input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" /> 
     246<input type="hidden" name="order_by" value="<?php echo wp_specialchars($order_by, 1); ?>" /> 
     247<input type="hidden" name="cat_id" value="<?php echo (int) $cat_id ?>" /> 
    232248<?php else: ?> 
    233            <input type="hidden" name="action" value="Add" /> 
     249<input type="hidden" name="action" value="add" /> 
    234250<?php endif; ?> 
    235 </form>  
    236 </div> 
     251</div> 
     252</form> 
     253</div> 
  • trunk/wp-admin/index.php

    r3568 r3570  
    121121<li><a href="post-new.php"><?php _e('Write a post'); ?></a></li> 
    122122<li><a href="profile.php"><?php _e('Update your profile or change your password'); ?></a></li> 
    123 <li><a href="link-add.php"><?php _e('Add a link to your blogroll'); ?></a></li> 
     123<li><a href="link-add.php"><?php _e('Add a bookmark to your blogroll'); ?></a></li> 
    124124<li><a href="themes.php"><?php _e('Change your site&#8217;s look or theme'); ?></a></li> 
    125125</ul> 
  • trunk/wp-admin/install.php

    r3548 r3570  
    155155    update_option('default_pingback_flag', 0); 
    156156 
    157 // Now drop in some default links 
    158 $wpdb->query("INSERT INTO $wpdb->linkcategories (cat_id, cat_name) VALUES (1, '".$wpdb->escape(__('Blogroll'))."')"); 
    159 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 1, 'http://blogs.linux.ie/xeer/feed/', '');"); 
    160 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zengun.org/weblog/', 'Michel', 1, 'http://zengun.org/weblog/feed/', '');"); 
    161 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://boren.nu/', 'Ryan', 1, 'http://boren.nu/feed/', '');"); 
    162 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://photomatt.net/', 'Matt', 1, 'http://xml.photomatt.net/feed/', '');"); 
    163 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://zed1.com/journalized/', 'Mike', 1, 'http://zed1.com/journalized/feed/', '');"); 
    164 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://www.alexking.org/', 'Alex', 1, 'http://www.alexking.org/blog/wp-rss2.php', '');"); 
    165 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://dougal.gunters.org/', 'Dougal', 1, 'http://dougal.gunters.org/feed/', '');"); 
    166  
    167157// Default category 
    168158$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_count, category_description) VALUES ('0', '".$wpdb->escape(__('Uncategorized'))."', '".sanitize_title(__('Uncategorized'))."', '1', '')"); 
     159 
     160// Default link category 
     161$wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, link_count, category_description) VALUES ('0', '".$wpdb->escape(__('Blogroll'))."', '".sanitize_title(__('Blogroll'))."', '7', '')"); 
     162 
     163// Now drop in some default links 
     164$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://blogs.linux.ie/xeer/', 'Donncha', 0, 'http://blogs.linux.ie/xeer/feed/', '');"); 
     165$wpdb->query( "INSERT INTO $wpdb->link2cat (`link_id`, `category_id`) VALUES (1, 2)" ); 
     166 
     167$wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rs