| 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 | | |
|---|
| 311 | | echo " <a href='comment.php?action=editcomment&c=$id'>" . __('Edit') . '</a>'; |
|---|
| 312 | | $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); |
|---|
| 313 | | echo " | <a href='$url' class='delete:the-comment-list:comment-$id'>" . __('Delete') . '</a> '; |
|---|
| | 286 | echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>'; |
|---|
| | 287 | 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> '; |
|---|
| 315 | | $url = clean_url( wp_nonce_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$id", "unapprove-comment_$id" ) ); |
|---|
| 316 | | echo "<span class='unapprove'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:FF3333'>" . __('Unapprove') . '</a> </span>'; |
|---|
| 317 | | $url = clean_url( wp_nonce_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$id", "approve-comment_$id" ) ); |
|---|
| 318 | | echo "<span class='approve'> | <a href='$url' class='dim:the-comment-list:comment-$id:unapproved:FFFF33:FFFF33'>" . __('Approve') . '</a> </span>'; |
|---|
| 319 | | } |
|---|
| 320 | | $url = clean_url( wp_nonce_url( "comment.php?action=deletecomment&dt=spam&p=$comment->comment_post_ID&c=$id", "delete-comment_$id" ) ); |
|---|
| 321 | | echo " | <a href='$url' class='delete:the-comment-list:comment-$id::spam=1'>" . __('Spam') . '</a> '; |
|---|
| 322 | | } |
|---|
| 323 | | if ( !is_single() ) { |
|---|
| 324 | | $post = get_post($comment->comment_post_ID, OBJECT, 'display'); |
|---|
| 325 | | $post_title = wp_specialchars( $post->post_title, 'double' ); |
|---|
| 326 | | $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; |
|---|
| 327 | | ?> |
|---|
| 328 | | ] — <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a> |
|---|
| 329 | | <?php } ?> |
|---|
| 330 | | </p> |
|---|
| | 289 | 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>'; |
|---|
| | 290 | 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>'; |
|---|
| | 291 | } |
|---|
| | 292 | 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> "; |
|---|
| | 293 | } |
|---|
| | 294 | $post = get_post($comment->comment_post_ID, OBJECT, 'display'); |
|---|
| | 295 | $post_title = wp_specialchars( $post->post_title, 'double' ); |
|---|
| | 296 | $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; |
|---|
| | 297 | ?> |
|---|
| | 298 | ] — <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p> |
|---|
| 373 | | <tbody id='the-list' class='list:meta'> |
|---|
| 374 | | <?php |
|---|
| 375 | | foreach ( $meta as $entry ) |
|---|
| 376 | | echo _list_meta_row( $entry, $count ); |
|---|
| | 341 | <?php |
|---|
| | 342 | $r ="\n\t<tbody id='the-list'>"; |
|---|
| | 343 | foreach ( $meta as $entry ) { |
|---|
| | 344 | ++ $count; |
|---|
| | 345 | if ( $count % 2 ) |
|---|
| | 346 | $style = 'alternate'; |
|---|
| | 347 | else |
|---|
| | 348 | $style = ''; |
|---|
| | 349 | if ('_' == $entry['meta_key'] { 0 } ) |
|---|
| | 350 | $style .= ' hidden'; |
|---|
| | 351 | |
|---|
| | 352 | if ( is_serialized( $entry['meta_value'] ) ) { |
|---|
| | 353 | if ( is_serialized_string( $entry['meta_value'] ) ) { |
|---|
| | 354 | // this is a serialized string, so we should display it |
|---|
| | 355 | $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); |
|---|
| | 356 | } else { |
|---|
| | 357 | // this is a serialized array/object so we should NOT display it |
|---|
| | 358 | --$count; |
|---|
| | 359 | continue; |
|---|
| | 360 | } |
|---|
| | 361 | } |
|---|
| | 362 | |
|---|
| | 363 | $key_js = js_escape( $entry['meta_key'] ); |
|---|
| | 364 | $entry['meta_key'] = attribute_escape($entry['meta_key']); |
|---|
| | 365 | $entry['meta_value'] = attribute_escape($entry['meta_value']); |
|---|
| | 366 | $entry['meta_id'] = (int) $entry['meta_id']; |
|---|
| | 367 | $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>"; |
|---|
| | 368 | $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>"; |
|---|
| | 369 | $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>"; |
|---|
| | 370 | $r .= "\n\t\t<td align='center'><input name='updatemeta' type='submit' class='updatemeta' tabindex='6' value='".attribute_escape(__( 'Update' ))."' /><br />"; |
|---|
| | 371 | $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' onclick=\"return deleteSomething( 'meta', {$entry['meta_id']}, '"; |
|---|
| | 372 | $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 ) ); |
|---|
| | 373 | $r .= "' );\" class='deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' /></td>"; |
|---|
| | 374 | $r .= "\n\t</tr>"; |
|---|
| | 375 | } |
|---|
| | 376 | echo $r; |
|---|
| 378 | | } |
|---|
| 379 | | |
|---|
| 380 | | function _list_meta_row( $entry, &$count ) { |
|---|
| 381 | | $r = ''; |
|---|
| 382 | | ++ $count; |
|---|
| 383 | | if ( $count % 2 ) |
|---|
| 384 | | $style = 'alternate'; |
|---|
| 385 | | else |
|---|
| 386 | | $style = ''; |
|---|
| 387 | | if ('_' == $entry['meta_key'] { 0 } ) |
|---|
| 388 | | $style .= ' hidden'; |
|---|
| 389 | | |
|---|
| 390 | | if ( is_serialized( $entry['meta_value'] ) ) { |
|---|
| 391 | | if ( is_serialized_string( $entry['meta_value'] ) ) { |
|---|
| 392 | | // this is a serialized string, so we should display it |
|---|
| 393 | | $entry['meta_value'] = maybe_unserialize( $entry['meta_value'] ); |
|---|
| 394 | | } else { |
|---|
| 395 | | // this is a serialized array/object so we should NOT display it |
|---|
| 396 | | --$count; |
|---|
| 397 | | return; |
|---|
| 398 | | } |
|---|
| 399 | | } |
|---|
| 400 | | |
|---|
| 401 | | $key_js = js_escape( $entry['meta_key'] ); |
|---|
| 402 | | $entry['meta_key'] = attribute_escape($entry['meta_key']); |
|---|
| 403 | | $entry['meta_value'] = attribute_escape($entry['meta_value']); |
|---|
| 404 | | $entry['meta_id'] = (int) $entry['meta_id']; |
|---|
| 405 | | $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>"; |
|---|
| 406 | | $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>"; |
|---|
| 407 | | $r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>"; |
|---|
| 408 | | $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 />"; |
|---|
| 409 | | $r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' "; |
|---|
| 410 | | $r .= "class='delete:the-list:meta-{$entry['meta_id']} deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' />"; |
|---|
| 411 | | $r .= "<input type='hidden' name='_ajax_nonce' value='$nonce' />"; |
|---|
| 412 | | $r .= "</td>\n\t</tr>"; |
|---|
| 413 | | return $r; |
|---|