Changeset 6299
- Timestamp:
- 10/31/2007 03:53:32 AM (18 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
-
wp-admin/admin-ajax.php (modified) (2 diffs)
-
wp-admin/edit-link-categories.php (modified) (3 diffs)
-
wp-admin/edit-link-category-form.php (modified) (1 diff)
-
wp-admin/includes/template.php (modified) (3 diffs)
-
wp-admin/js/categories.js (modified) (2 diffs)
-
wp-includes/script-loader.php (modified) (1 diff)
-
wp-settings.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-ajax.php
r6287 r6299 52 52 die('1'); 53 53 else die('0'); 54 break; 55 case 'delete-link-cat' : 56 check_ajax_referer( "delete-link-category_$id" ); 57 if ( !current_user_can( 'manage_categories' ) ) 58 die('-1'); 59 60 $cat_name = get_term_field('name', $id, 'link_category'); 61 62 // Don't delete the default cats. 63 if ( $id == get_option('default_link_category') ) { 64 $x = new WP_AJAX_Response( array( 65 'what' => 'link-cat', 66 'id' => $id, 67 'data' => new WP_Error( 'default-link-cat', sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name) ) 68 ) ); 69 $x->send(); 70 } 71 72 $r = wp_delete_term($id, 'link_category'); 73 if ( !$r ) 74 die('0'); 75 if ( is_wp_error($r) ) { 76 $x = new WP_AJAX_Response( array( 77 'what' => 'link-cat', 78 'id' => $id, 79 'data' => $r 80 ) ); 81 $x->send(); 82 } 83 die('1'); 54 84 break; 55 85 case 'delete-link' : … … 179 209 'data' => _cat_row( $cat, $level, $cat_full_name ), 180 210 'supplemental' => array('name' => $cat_full_name, 'show-link' => sprintf(__( 'Category <a href="#%s">%s</a> added' ), "cat-$cat->term_id", $cat_full_name)) 211 ) ); 212 $x->send(); 213 break; 214 case 'add-link-cat' : // From Blogroll -> Categories 215 check_ajax_referer( 'add-link-category' ); 216 if ( !current_user_can( 'manage_categories' ) ) 217 die('-1'); 218 219 $r = wp_insert_term($_POST['name'], 'link_category', $_POST ); 220 if ( is_wp_error( $r ) ) { 221 $x = new WP_AJAX_Response( array( 222 'what' => 'link-cat', 223 'id' => $r 224 ) ); 225 $x->send(); 226 } 227 228 extract($r, EXTR_SKIP); 229 230 if ( !$link_cat = link_cat_row( $term_id ) ) 231 die('0'); 232 233 $x = new WP_Ajax_Response( array( 234 'what' => 'link-cat', 235 'id' => $term_id, 236 'data' => $link_cat 181 237 ) ); 182 238 $x->send(); -
trunk/wp-admin/edit-link-categories.php
r6118 r6299 5 5 $parent_file = 'link-manager.php'; 6 6 7 //wp_enqueue_script( 'admin-categories' ); TODO: Fix AJAX 7 wp_enqueue_script( 'admin-categories' ); 8 8 require_once ('admin-header.php'); 9 9 … … 14 14 $messages[5] = __('Category not updated.'); 15 15 16 function link_cat_row($category) { 17 global $class; 16 if (isset($_GET['message'])) : ?> 18 17 19 if ( current_user_can( 'manage_categories' ) ) {20 $edit = "<a href='link-category.php?action=edit&cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>";21 $default_cat_id = (int) get_option( 'default_link_category' );22 23 if ( $category->term_id != $default_cat_id )24 $edit .= "<td><a href='" . wp_nonce_url( "link-category.php?action=delete&cat_ID=$category->term_id", 'delete-link-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll links that were only assigned to this category will be assigned to the '%s' category.\n'OK' to delete, 'Cancel' to stop." ), $category->name, get_term_field( 'name', $default_cat_id, 'link_category' ))) . "' );\" class='delete'>".__( 'Delete' )."</a>";25 else26 $edit .= "<td style='text-align:center'>".__( "Default" );27 } else {28 $edit = '';29 }30 31 $class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'";32 33 $category->count = number_format_i18n( $category->count );34 $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count;35 return "<tr id='cat-$category->term_id'$class>36 <th scope='row' style='text-align: center'>$category->term_id</th>37 <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "</td>38 <td>$category->description</td>39 <td align='center'>$count</td>40 <td>$edit</td>\n\t</tr>\n";41 }42 ?>43 44 <?php if (isset($_GET['message'])) : ?>45 18 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div> 46 19 <?php endif; ?> … … 62 35 </tr> 63 36 </thead> 64 <tbody id="the-list" >37 <tbody id="the-list" class="list:link-cat"> 65 38 <?php 66 39 $categories = get_terms( 'link_category', 'hide_empty=0' ); -
trunk/wp-admin/edit-link-category-form.php
r6118 r6299 10 10 $heading = __('Add Category'); 11 11 $submit_text = __('Add Category »'); 12 $form = '<form name="addcat" id="addcat" method="post" action="link-category.php">';12 $form = '<form name="addcat" id="addcat" class="add:the-list:" method="post" action="link-category.php">'; 13 13 $action = 'addcat'; 14 14 $nonce_action = 'add-link-category'; -
trunk/wp-admin/includes/template.php
r6277 r6299 35 35 global $class; 36 36 37 $category = get_category( $category ); 38 37 39 $pad = str_repeat( '— ', $level ); 38 40 if ( current_user_can( 'manage_categories' ) ) { … … 48 50 $edit = ''; 49 51 50 $class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class )? '' : " class='alternate'";52 $class = " class='alternate'" == $class ? '' : " class='alternate'"; 51 53 52 54 $category->count = number_format_i18n( $category->count ); … … 60 62 61 63 return apply_filters('cat_row', $output); 64 } 65 66 function link_cat_row( $category ) { 67 global $class; 68 69 if ( !$category = get_term( $category, 'link_category' ) ) 70 return false; 71 if ( is_wp_error( $category ) ) 72 return $category; 73 74 if ( current_user_can( 'manage_categories' ) ) { 75 $edit = "<a href='link-category.php?action=edit&cat_ID=$category->term_id' class='edit'>".__( 'Edit' )."</a></td>"; 76 $default_cat_id = (int) get_option( 'default_link_category' ); 77 78 $delete_url = wp_nonce_url( "link-category.php?action=delete&cat_ID=$category->term_id", "delete-link-category_$category->term_id" ); 79 if ( $category->term_id != $default_cat_id ) 80 $edit .= "<td><a href='$delete_url' class='delete:the-list:link-cat-$category->term_id delete'>" . __( 'Delete' ) . "</a>"; 81 else 82 $edit .= "<td style='text-align:center'>" . __( "Default" ); 83 } else { 84 $edit = ''; 85 } 86 87 $class = " class='alternate'" == $class ? '' : " class='alternate'"; 88 89 $category->count = number_format_i18n( $category->count ); 90 $count = ( $category->count > 0 ) ? "<a href='link-manager.php?cat_id=$category->term_id'>$category->count</a>" : $category->count; 91 $output = "<tr id='link-cat-$category->term_id'$class> 92 <th scope='row' style='text-align: center'>$category->term_id</th> 93 <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->name ) . "</td> 94 <td>$category->description</td> 95 <td align='center'>$count</td> 96 <td>$edit</td>\n\t</tr>\n"; 97 98 return apply_filters( 'link_cat_row', $output ); 62 99 } 63 100 -
trunk/wp-admin/js/categories.js
r6213 r6299 1 1 jQuery(function($) { 2 var options = document.forms['addcat'].category_parent.options; 2 var options = false 3 if ( document.forms['addcat'].category_parent ) 4 options = document.forms['addcat'].category_parent.options; 3 5 4 6 var addAfter = function( r, settings ) { … … 15 17 } 16 18 17 var a = $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } ); 19 if ( options ) 20 $('#the-list').wpList( { addAfter: addAfter, delAfter: delAfter } ); 21 else 22 $('#the-list').wpList(); 18 23 }); -
trunk/wp-includes/script-loader.php
r6287 r6299 116 116 'how' => __('Separate multiple categories with commas.') 117 117 ) ); 118 $this->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '2007 0823' );118 $this->add( 'admin-categories', '/wp-admin/js/categories.js', array('wp-lists'), '20071031' ); 119 119 $this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('wp-lists'), '20070823' ); 120 120 $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('wp-lists'), '20070822' ); -
trunk/wp-settings.php
r6260 r6299 119 119 require (ABSPATH . WPINC . '/compat.php'); 120 120 require (ABSPATH . WPINC . '/functions.php'); 121 require (ABSPATH . WPINC . '/classes.php'); 121 122 122 123 require_wp_db(); 123 // $table_prefix is deprecated as of 2.1 124 $wpdb->prefix = $table_prefix; 125 126 if ( preg_match('|[^a-z0-9_]|i', $wpdb->prefix) && !file_exists(ABSPATH . 'wp-content/db.php') ) 124 $prefix = $wpdb->set_prefix($table_prefix); 125 126 if ( is_wp_error($prefix) ) 127 127 wp_die("<strong>ERROR</strong>: <code>$table_prefix</code> in <code>wp-config.php</code> can only contain numbers, letters, and underscores."); 128 129 // Table names130 $wpdb->posts = $wpdb->prefix . 'posts';131 $wpdb->users = $wpdb->prefix . 'users';132 $wpdb->categories = $wpdb->prefix . 'categories';133 $wpdb->post2cat = $wpdb->prefix . 'post2cat';134 $wpdb->comments = $wpdb->prefix . 'comments';135 $wpdb->link2cat = $wpdb->prefix . 'link2cat';136 $wpdb->links = $wpdb->prefix . 'links';137 $wpdb->options = $wpdb->prefix . 'options';138 $wpdb->postmeta = $wpdb->prefix . 'postmeta';139 $wpdb->usermeta = $wpdb->prefix . 'usermeta';140 $wpdb->terms = $wpdb->prefix . 'terms';141 $wpdb->term_taxonomy = $wpdb->prefix . 'term_taxonomy';142 $wpdb->term_relationships = $wpdb->prefix . 'term_relationships';143 144 if ( defined('CUSTOM_USER_TABLE') )145 $wpdb->users = CUSTOM_USER_TABLE;146 if ( defined('CUSTOM_USER_META_TABLE') )147 $wpdb->usermeta = CUSTOM_USER_META_TABLE;148 128 149 129 if ( file_exists(ABSPATH . 'wp-content/object-cache.php') ) … … 154 134 wp_cache_init(); 155 135 156 require (ABSPATH . WPINC . '/classes.php');157 136 require (ABSPATH . WPINC . '/plugin.php'); 158 137 require (ABSPATH . WPINC . '/default-filters.php');
Note: See TracChangeset
for help on using the changeset viewer.