Ticket #2284: edit page hooks.diff
| File edit page hooks.diff, 7.3 KB (added by , 20 years ago) |
|---|
-
wp-admin/admin-functions.php
607 607 } 608 608 } 609 609 610 function page_rows($parent = 0, $level = 0, $pages = 0) { 611 global $wpdb, $class, $post; 612 if (!$pages) 613 $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order"); 614 615 if ($pages) { 616 foreach ($pages as $post) { 617 start_wp(); 618 if ($post->post_parent == $parent) { 619 $post->post_title = wp_specialchars($post->post_title); 620 $pad = str_repeat('— ', $level); 621 $id = $post->ID; 622 $class = ('alternate' == $class) ? '' : 'alternate'; 610 function page_rows($searching = false, $pages, $pages_columns, $parent = 0, $level = 0) { 611 global $class, $post; 612 if (!$pages) return false; 613 foreach ($pages as $post) { 614 start_wp(); 615 if (($post->post_parent == $parent) || $searching) { 616 $post->post_title = wp_specialchars($post->post_title); 617 $pad = (!$searching) ? str_repeat('— ', $level) : ""; 618 $id = $post->ID; 619 $class = ('alternate' == $class) ? '' : 'alternate'; 623 620 ?> 624 <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'> 625 <th scope="row"><?php echo $post->ID; ?></th> 626 <td> 627 <?php echo $pad; ?><?php the_title() ?> 628 </td> 629 <td><?php the_author() ?></td> 630 <td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td> 631 <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td> 632 <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 633 <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the "%s" page.\\n"OK" to delete, "Cancel" to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td> 634 </tr> 635 636 <?php 637 638 page_rows($id, $level +1, $pages); 621 <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'> 622 <? 623 foreach($pages_columns as $column_name => $column_display_name) { 624 switch($column_name) { 625 626 case 'id': 627 ?><th scope="row"><?php echo $id ?></th><?php 628 break; 629 630 case 'title': 631 ?> 632 <td><?php echo $pad; the_title(); ?></td><?php 633 break; 634 635 case 'owner': 636 ?><td><?php the_author() ?></td><?php 637 break; 638 639 case 'updated': 640 ?><td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td><?php 641 break; 642 643 case 'control_view': 644 ?> 645 <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td> 646 <?php 647 break; 648 649 case 'control_edit': 650 ?> 651 <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 652 <?php 653 break; 654 655 case 'control_delete': 656 ?> 657 <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the "%s" page.\\n"OK" to delete, "Cancel" to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td> 658 <?php 659 break; 660 661 default: 662 ?><td><?php do_action('manage_pages_custom_column', $column_name, $id); ?></td><?php 663 break; 664 } 639 665 } 640 } 641 } else { 642 return false; 666 if (!$searching) page_rows($searching, $pages, $pages_columns, $id, $level +1); 667 } 643 668 } 644 669 } 645 670 671 646 672 function wp_dropdown_cats($currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0) { 647 673 global $wpdb, $bgcolor; 648 674 if (!$categories) { -
wp-admin/edit-pages.php
12 12 13 13 <form name="searchform" action="" method="get"> 14 14 <fieldset> 15 <legend><?php _e('Search Pages …') ?></legend>15 <legend><?php _e('Search Pages') ?></legend> 16 16 <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" /> 17 17 <input type="submit" name="submit" value="<?php _e('Search') ?>" /> 18 18 </fieldset> … … 20 20 21 21 <?php 22 22 23 $show_post_type = 'page'; 24 25 if ( isset($_GET['s']) ) 26 wp(); 23 if (isset($_GET['s']) && ("" != $_GET['s'])) { 24 $s = $_GET['s']; 25 $searching = true; 26 $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' AND (post_title LIKE '%$s%' OR post_content LIKE '%$s%')"); 27 } 27 28 else 28 $p osts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static'");29 $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_status = 'static' ORDER BY menu_order"); 29 30 30 if ($posts) { 31 if ($pages) { 32 33 $pages_columns = array( 34 'id' => __('ID'), 35 'title' => __('Title'), 36 'owner' => __('Owner'), 37 'updated' => __('Updated') 38 ); 39 $pages_columns = apply_filters('manage_pages_columns', $pages_columns); 40 41 // you can not edit these at the moment 42 $pages_columns['control_view'] = ''; 43 $pages_columns['control_edit'] = ''; 44 $pages_columns['control_delete'] = ''; 45 31 46 ?> 32 47 <table id="the-list-x" width="100%" cellpadding="3" cellspacing="3"> 33 48 <tr> 34 <th scope="col"><?php _e('ID') ?></th> 35 <th scope="col"><?php _e('Title') ?></th> 36 <th scope="col"><?php _e('Owner') ?></th> 37 <th scope="col"><?php _e('Updated') ?></th> 38 <th scope="col"></th> 39 <th scope="col"></th> 40 <th scope="col"></th> 49 <?php foreach($pages_columns as $column_display_name) { ?> 50 <th scope="col"><?php echo $column_display_name; ?></th> 51 <?php } ?> 41 52 </tr> 42 53 <?php 43 if ( isset($_GET['s']) ) { 44 foreach ( $posts as $post ) : 45 $class = ('alternate' != $class) ? 'alternate' : ''; ?> 46 <tr id='page-<?php echo $id; ?>' class='<?php echo $class; ?>'> 47 <th scope="row"><?php echo $post->ID; ?></th> 48 <td> 49 <?php echo $pad; ?><?php the_title() ?> 50 </td> 51 <td><?php the_author() ?></td> 52 <td><?php echo mysql2date('Y-m-d g:i a', $post->post_modified); ?></td> 53 <td><a href="<?php the_permalink(); ?>" rel="permalink" class="edit"><?php _e('View'); ?></a></td> 54 <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=edit&post=$id' class='edit'>" . __('Edit') . "</a>"; } ?></td> 55 <td><?php if ( current_user_can('edit_pages') ) { echo "<a href='post.php?action=delete&post=$id' class='delete' onclick=\"return deleteSomething( 'page', " . $id . ", '" . sprintf(__("You are about to delete the "%s" page.\\n"OK" to delete, "Cancel" to stop."), wp_specialchars(get_the_title('','',0), 1)) . "' );\">" . __('Delete') . "</a>"; } ?></td> 56 </tr> 57 <?php 58 endforeach; 59 } else { 60 page_rows(); 61 } 54 page_rows($searching, $pages, $pages_columns); 62 55 ?> 63 56 </table> 64 65 57 <div id="ajax-response"></div> 66 58 67 59 <?php 68 60 } else { 69 61 ?> 70 <p><?php _e('No pages yet.') ?></p>62 <p><?php _e('No pages found.') ?></p> 71 63 <?php 72 64 } // end if ($posts) 73 65 ?>