Changeset 6213 for trunk/wp-admin/includes/template.php
- Timestamp:
- 10/09/2007 10:49:42 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/template.php
r6193 r6213 42 42 43 43 if ( $category->term_id != $default_cat_id ) 44 $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' onclick=\"return deleteSomething( 'cat', $category->term_id, '" . js_escape(sprintf( __("You are about to delete the category '%s'.\nAll posts that were only assigned to this category will be assigned to the '%s' category.\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_catname( $default_cat_id ), get_catname( $default_link_cat_id ) )) . "' );\" class='delete'>".__( 'Delete' )."</a>";44 $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' class='delete:the-list:cat-$category->term_id delete'>".__( 'Delete' )."</a>"; 45 45 else 46 46 $edit .= "<td style='text-align:center'>".__( "Default" ); … … 165 165 } 166 166 167 // define the columns to display, the syntax is 'internal name' => 'display name' 168 function wp_manage_posts_columns() { 169 $posts_columns = array(); 170 $posts_columns['id'] = '<div style="text-align: center">' . __('ID') . '</div>'; 171 if ( 'draft' === $_GET['post_status'] ) 172 $posts_columns['modified'] = __('Modified'); 173 elseif ( 'pending' === $_GET['post_status'] ) 174 $posts_columns['modified'] = __('Submitted'); 175 else 176 $posts_columns['date'] = __('When'); 177 $posts_columns['title'] = __('Title'); 178 $posts_columns['categories'] = __('Categories'); 179 if ( !in_array($_GET['post_status'], array('pending', 'draft', 'future')) ) 180 $posts_columns['comments'] = '<div style="text-align: center">' . __('Comments') . '</div>'; 181 $posts_columns['author'] = __('Author'); 182 $posts_columns = apply_filters('manage_posts_columns', $posts_columns); 183 184 // you can not edit these at the moment 185 $posts_columns['control_view'] = ''; 186 $posts_columns['control_edit'] = ''; 187 $posts_columns['control_delete'] = ''; 188 189 return $posts_columns; 190 } 191 167 192 function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) { 168 193 global $wpdb, $class, $post; … … 191 216 <td><?php the_author() ?></td> 192 217 <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else echo mysql2date( __('Y-m-d g:i a'), $post->post_modified ); ?></td> 193 218 <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td> 194 219 <td><?php if ( current_user_can( 'edit_page', $id ) ) { echo "<a href='page.php?action=edit&post=$id' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td> 195 <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&post=$id", 'delete-page_' . $id ) . "' class='delete ' onclick=\"return deleteSomething( 'page', " . $id . ", '" . js_escape(sprintf( __("You are about to delete the '%s' page.\n'OK' to delete, 'Cancel' to stop." ), get_the_title() ) ) . "' );\">" . __( 'Delete' ) . "</a>"; } ?></td>220 <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&post=$id", 'delete-page_' . $id ) . "' class='delete:the-list:page-$id delete'>" . __( 'Delete' ) . "</a>"; } ?></td> 196 221 </tr> 197 222 … … 263 288 function _wp_comment_list_item( $id, $alt = 0 ) { 264 289 global $authordata, $comment, $wpdb; 265 $id = (int) $id;266 290 $comment =& get_comment( $id ); 291 $id = (int) $comment->comment_ID; 267 292 $class = ''; 268 293 $post = get_post($comment->comment_post_ID); 269 294 $authordata = get_userdata($post->post_author); 270 $comment_status = wp_get_comment_status($ comment->comment_ID);295 $comment_status = wp_get_comment_status($id); 271 296 if ( 'unapproved' == $comment_status ) 272 297 $class .= ' unapproved'; 273 298 if ( $alt % 2 ) 274 299 $class .= ' alternate'; 275 echo "<li id='comment-$ comment->comment_ID' class='$class'>";276 ?> 277 <p><strong ><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p>300 echo "<li id='comment-$id' class='$class'>"; 301 ?> 302 <p><strong class="comment-author"><?php comment_author(); ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p> 278 303 279 304 <?php comment_text() ?> … … 282 307 <?php 283 308 if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 284 echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>'; 285 echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> '; 309 echo " <a href='comment.php?action=editcomment&c=$id'>" . __('Edit') . '</a>'; 310 $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); 311 echo " | <a href='$url' class='delete:the-comment-list:comment-$id'>" . __('Delete') . '</a> '; 286 312 if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { 287 echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>'; 288 echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&p=' . $comment->comment_post_ID . '&c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>'; 289 } 290 echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&dt=spam&p=" . $comment->comment_post_ID . "&c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by '%s'.\n'Cancel' to stop, 'OK' to mark as spam."), $comment->comment_author)) . "', theCommentList );\">" . __('Spam') . "</a> "; 313 $url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$id", "unapprove-comment_$id" ) ); 314 echo "<span class='unapprove'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:FF3333'>" . __('Unapprove') . '</a> </span>'; 315 $url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$id", "approve-comment_$id" ) ); 316 echo "<span class='approve'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:FFFF33:FFFF33'>" . __('Approve') . '</a> </span>'; 317 } 318 $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); 319 echo " | <a href='$url' class='delete:the-comment-list:comment-$id::spam=1'>" . __('Spam') . '</a> '; 291 320 } 292 321 $post = get_post($comment->comment_post_ID, OBJECT, 'display'); … … 325 354 // Exit if no meta 326 355 if (!$meta ) { 327 echo '<tbody id="the-list" ><tr style="display: none;"><td> </td></tr></tbody>'; //TBODY needed for list-manipulation JS356 echo '<tbody id="the-list" class="list:meta"><tr style="display: none;"><td> </td></tr></tbody>'; //TBODY needed for list-manipulation JS 328 357 return; 329 358 } … … 337 366 </tr> 338 367 </thead> 339 <?php 340 $r ="\n\t<tbody id='the-list'>"; 341 foreach ( $meta as $entry ) { 342 ++ $count; 343 if ( $count % 2 ) 344 $style = 'alternate'; 345 else 346 $style = ''; 347 if ('_' == $entry['meta_key'] { 0 } ) 348 $style .= ' hidden'; 349 350 if ( is_serialized( $entry['meta_value'] ) ) { 351 if ( is_serialized_string( $entry['meta_value'] ) ) { 352 // this is a serialized string, so we should display it 353 $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); 354 } else { 355 // this is a serialized array/object so we should NOT display it 356 --$count; 357 continue; 358 } 359 } 360 361 $key_js = js_escape( $entry['meta_key'] ); 362 $entry['meta_key'] = attribute_escape($entry['meta_key']); 363 $entry['meta_value'] = attribute_escape($entry['meta_value']); 364 $entry['meta_id'] = (int) $entry['meta_id']; 365 $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>"; 366 $r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>"; 367 $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>"; 368 $r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".attribute_escape(__( 'Update' ))."' /><br />"; 369 $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' onclick=\"return deleteSomething( 'meta', {$entry['meta_id']}, '"; 370 $r .= js_escape(sprintf( __("You are about to delete the '%s' custom field on this post.\n'OK' to delete, 'Cancel' to stop." ), $key_js ) ); 371 $r .= "' );\" class='deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' /></td>"; 372 $r .= "\n\t</tr>"; 373 } 374 echo $r; 368 <tbody id='the-list' class='list:meta'> 369 <?php 370 foreach ( $meta as $entry ) 371 echo _list_meta_row( $entry, $count ); 375 372 echo "\n\t</tbody>"; 373 } 374 375 function _list_meta_row( $entry, &$count ) { 376 $r = ''; 377 ++ $count; 378 if ( $count % 2 ) 379 $style = 'alternate'; 380 else 381 $style = ''; 382 if ('_' == $entry['meta_key'] { 0 } ) 383 $style .= ' hidden'; 384 385 if ( is_serialized( $entry['meta_value'] ) ) { 386 if ( is_serialized_string( $entry['meta_value'] ) ) { 387 // this is a serialized string, so we should display it 388 $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); 389 } else { 390 // this is a serialized array/object so we should NOT display it 391 --$count; 392 return; 393 } 394 } 395 396 $key_js = js_escape( $entry['meta_key'] ); 397 $entry['meta_key'] = attribute_escape($entry['meta_key']); 398 $entry['meta_value'] = attribute_escape($entry['meta_value']); 399 $entry['meta_id'] = (int) $entry['meta_id']; 400 $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>"; 401 $r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>"; 402 $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>"; 403 $r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' tabindex='6' value='".attribute_escape(__( 'Update' ))."' class='add:the-list:meta-{$entry['meta_id']} updatemeta' /><br />"; 404 $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' "; 405 $r .= "class='delete:the-list:meta-{$entry['meta_id']} deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' />"; 406 $r .= "<input type='hidden' name='_ajax_nonce' value='$nonce' />"; 407 $r .= "</td>\n\t</tr>"; 408 return $r; 376 409 } 377 410 … … 414 447 </tr> 415 448 449 <tr class="submit"><td colspan="3"> 450 <?php wp_nonce_field( 'change_meta', '_ajax_nonce', false ); ?> 451 <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field »' ) ?>" /> 452 </td></tr> 416 453 </table> 417 <p class="submit"><input type="submit" id="updatemetasub" name="updatemeta" tabindex="9" value="<?php _e( 'Add Custom Field »' ) ?>" /></p>418 454 <?php 419 455
Note: See TracChangeset
for help on using the changeset viewer.