Show
Ignore:
Timestamp:
10/30/07 16:49:38 (1 year ago)
Author:
donncha
Message:

Merge with WordPress? 2.3.1

Files:

Legend:

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

    r1125 r1139  
    4242 
    4343                if ( $category->term_id != $default_cat_id ) 
    44                         $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;cat_ID=$category->term_id", 'delete-category_' . $category->term_id ) . "' class='delete:the-list:cat-$category->term_id delete'>".__( 'Delete' )."</a>"; 
     44                        $edit .= "<td><a href='" . wp_nonce_url( "categories.php?action=delete&amp;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>"; 
    4545                else 
    4646                        $edit .= "<td style='text-align:center'>".__( "Default" ); 
     
    165165} 
    166166 
    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  
    192167function page_rows( $parent = 0, $level = 0, $pages = 0, $hierarchy = true ) { 
    193168        global $wpdb, $class, $post; 
     
    216191    <td><?php the_author() ?></td> 
    217192    <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> 
    218     <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td> 
     193       <td><a href="<?php the_permalink(); ?>" rel="permalink" class="view"><?php _e( 'View' ); ?></a></td> 
    219194    <td><?php if ( current_user_can( 'edit_page', $id ) ) { echo "<a href='page.php?action=edit&amp;post=$id' class='edit'>" . __( 'Edit' ) . "</a>"; } ?></td> 
    220     <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&amp;post=$id", 'delete-page_' . $id ) .  "' class='delete:the-list:page-$id delete'>" . __( 'Delete' ) . "</a>"; } ?></td> 
     195    <td><?php if ( current_user_can( 'delete_page', $id ) ) { echo "<a href='" . wp_nonce_url( "page.php?action=delete&amp;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> 
    221196  </tr> 
    222197 
     
    290265function _wp_comment_list_item( $id, $alt = 0 ) { 
    291266        global $authordata, $comment, $wpdb; 
     267        $id = (int) $id; 
    292268        $comment =& get_comment( $id ); 
    293         $id = (int) $comment->comment_ID; 
    294269        $class = ''; 
    295270        $post = get_post($comment->comment_post_ID); 
    296271        $authordata = get_userdata($post->post_author); 
    297         $comment_status = wp_get_comment_status($id); 
     272        $comment_status = wp_get_comment_status($comment->comment_ID); 
    298273        if ( 'unapproved' == $comment_status ) 
    299274                $class .= ' unapproved'; 
    300275        if ( $alt % 2 ) 
    301276                $class .= ' alternate'; 
    302         echo "<li id='comment-$id' class='$class'>"; 
    303 ?> 
    304 <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> 
     277        echo "<li id='comment-$comment->comment_ID' class='$class'>"; 
     278?> 
     279<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> 
    305280 
    306281<?php comment_text() ?> 
     
    309284<?php 
    310285if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 
    311         echo " <a href='comment.php?action=editcomment&amp;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&amp;c=".$comment->comment_ID."'>" .  __('Edit') . '</a>'; 
     287        echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;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> '; 
    314288        if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { 
    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  ] &#8212; <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&amp;p=' . $comment->comment_post_ID . '&amp;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&amp;p=' . $comment->comment_post_ID . '&amp;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&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;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 ] &#8212; <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p> 
    331299                </li> 
    332300<?php 
     
    359327        // Exit if no meta 
    360328        if (!$meta ) { 
    361                 echo '<tbody id="the-list" class="list:meta"><tr style="display: none;"><td>&nbsp;</td></tr></tbody>'; //TBODY needed for list-manipulation JS 
     329                echo '<tbody id="the-list"><tr style="display: none;"><td>&nbsp;</td></tr></tbody>'; //TBODY needed for list-manipulation JS 
    362330                return; 
    363331        } 
     
    371339        </tr> 
    372340        </thead> 
    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; 
    377377        echo "\n\t</tbody>"; 
    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; 
    414378} 
    415379 
     
    452416        </tr> 
    453417 
    454 <tr class="submit"><td colspan="3"> 
    455         <?php wp_nonce_field( 'change_meta', '_ajax_nonce', false ); ?> 
    456         <input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field &raquo;' ) ?>" /> 
    457 </td></tr> 
    458418</table> 
     419<p class="submit"><input type="submit" id="updatemetasub" name="updatemeta" tabindex="9" value="<?php _e( 'Add Custom Field &raquo;' ) ?>" /></p> 
    459420<?php 
    460421