From ad3e2f6dba318e8db67eba7e750a88b8363e5c01 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 19 Sep 2005 00:47:58 +0000 Subject: [PATCH] Consolidate link forms into edit-link-form git-svn-id: http://svn.automattic.com/wordpress/trunk@2890 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/admin-functions.php | 31 +++++ wp-admin/edit-link-form.php | 234 ++++++++++++++++++++++++++++++++++ wp-admin/link-add.php | 234 +--------------------------------- wp-admin/link-manager.php | 239 +---------------------------------- 4 files changed, 272 insertions(+), 466 deletions(-) create mode 100644 wp-admin/edit-link-form.php diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 0d743354a..0cf21a0e4 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -520,6 +520,20 @@ function get_link_to_edit($link_id) { return $link; } +function get_default_link_to_edit() { + if ( isset($_GET['linkurl']) ) + $link->link_url = wp_specialchars($_GET['linkurl'], 1); + else + $link->link_url = ''; + + if ( isset($_GET['name']) ) + $link->link_name = wp_specialchars($_GET['name'], 1); + else + $link->link_name = ''; + + return $link; +} + function add_link() { return edit_link(); } @@ -799,6 +813,23 @@ function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $lev } } +function link_category_dropdown($fieldname, $selected = 0) { + global $wpdb; + + $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); + echo "\n\n"; +} + function wp_create_thumbnail($file, $max_side, $effect = '') { // 1 = GIF, 2 = JPEG, 3 = PNG diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php new file mode 100644 index 000000000..09cb3ad0a --- /dev/null +++ b/wp-admin/edit-link-form.php @@ -0,0 +1,234 @@ +'; +} else { + $editing = false; + $heading = __('Add a link:'); + $submit_text = __('Add Link »'); + $form = '
'; +} + +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"'; + } +} + +?> + +
+ +

+
+ + + + + + + + + + + + + + + + + + +
link_category); ?>
+
+

+ +

+
+ + + + + + + + + + +
XFN Creator:') ?> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ + + + +
+ +
+ + +
+ + + +
+ + + + + + +
+ + + + +
+
+
+

+ +

+
+ + + + + + + + + + + + + + + + + + + + + + + + + + +
+  

+
+
+target attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?>

+
+

+ + + + + + + + + +
\ No newline at end of file diff --git a/wp-admin/link-add.php b/wp-admin/link-add.php index 49f125ea9..a69be2ea2 100644 --- a/wp-admin/link-add.php +++ b/wp-admin/link-add.php @@ -5,38 +5,6 @@ $title = __('Add Link'); $this_file = 'link-manager.php'; $parent_file = 'link-manager.php'; -function category_dropdown($fieldname, $selected = 0) { - global $wpdb; - - $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); - echo "\n\n"; -} - -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"'; - } -} $wpvarstoreset = array('action', 'cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', @@ -56,212 +24,18 @@ for ($i=0; $i

-
-

Add a link:') ?>

-
-
- - - - - - - - - - - - - - - - - - -
-
-

- -

-
- - - - - - - - - - -
XFN Creator:') ?> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- -
- - - - -
- -
- - -
- - - -
- - - - - - -
- - - - -
-
-
-

- -

-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
-  
-
- -
- -target attribute is illegal in XHTML 1.1 and 1.0 Strict.)') ?>

-
-
-

- -

-
-
+
You can drag Link This 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.

'), "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();") ?> diff --git a/wp-admin/link-manager.php b/wp-admin/link-manager.php index d32d93479..ab2014d51 100644 --- a/wp-admin/link-manager.php +++ b/wp-admin/link-manager.php @@ -7,39 +7,6 @@ require_once('admin.php'); $title = __('Manage Links'); $this_file = $parent_file = 'link-manager.php'; -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"'; - } -} - -function category_dropdown($fieldname, $selected = 0) { - global $wpdb; - - $results = $wpdb->get_results("SELECT cat_id, cat_name, auto_toggle FROM $wpdb->linkcategories ORDER BY cat_id"); - echo "\n\n"; -} - $wpvarstoreset = array('action','cat_id', 'linkurl', 'name', 'image', 'description', 'visible', 'target', 'category', 'link_id', 'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel', @@ -221,208 +188,8 @@ switch ($action) { if ( !$link = get_link_to_edit($link_id) ) die( __('Link not found.') ); -?> - -
- -
-" /> - +