Changeset 16459 for trunk/wp-admin/includes/internal-linking.php
- Timestamp:
- 11/18/2010 07:59:05 AM (14 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/internal-linking.php
r16457 r16459 1 1 <?php 2 // args expects optionally 'pagenum' and 's' 2 /** 3 * Internal linking functions. 4 * 5 * @package WordPres 6 * @subpackage Administration 7 * @since 3.1.0 8 */ 9 10 /** 11 * Performs post queries for internal linking. 12 * 13 * @since 3.1.0 14 * 15 * @param array $args Optional. Accepts 'pagenum' and 's' (search) arguments. 16 * @return array Results. 17 */ 3 18 function wp_link_query( $args = array() ) { 4 19 $pts = get_post_types( array( 'publicly_queryable' => true ), 'objects' ); … … 49 64 } 50 65 51 function wp_link_ajax( $request ) { 52 // Searches have a title term. 53 if ( isset( $request['title'] ) ) 54 $args['s'] = stripslashes( $request['title'] ); 55 $args['pagenum'] = ! empty( $request['page'] ) ? absint( $request['page'] ) : 1; 56 57 $results = wp_link_query( $args ); 58 59 if ( ! isset( $results ) ) 60 die( '0' ); 61 62 echo json_encode( $results ); 63 echo "\n"; 64 } 65 66 /** 67 * Dialog for internal linking. 68 * 69 * @since 3.1.0 70 */ 66 71 function wp_link_dialog() { 67 72 ?> … … 70 75 <div id="link-options"> 71 76 <p class="howto"><?php _e( 'Enter the destination URL:' ); ?></p> 72 < label for="url-field">73 < span><?php _e( 'URL' ); ?></span><input id="url-field" type="text" />74 </ label>75 < label for="link-title-field">76 < span><?php _e( 'Title' ); ?></span><input id="link-title-field" type="text" />77 </ label>78 < label for="link-target-checkbox" id="open-in-new-tab">79 < input type="checkbox" id="link-target-checkbox" /><span><?php _e( 'Open link in a new window/tab' ); ?></span>80 </ label>77 <div> 78 <label><span><?php _e( 'URL' ); ?></span><input id="url-field" type="text" /></label> 79 </div> 80 <div> 81 <label><span><?php _e( 'Title' ); ?></span><input id="link-title-field" type="text" /></label> 82 </div> 83 <div class="link-target"> 84 <label><input type="checkbox" id="link-target-checkbox" /> <?php _e( 'Open link in a new window/tab' ); ?></label> 85 </div> 81 86 </div> 82 87 <div id="search-panel"> … … 91 96 <div id="search-results" class="query-results"> 92 97 <ul> 93 <li class=" wp-results-loadingunselectable"><em><?php _e( 'Loading...' ); ?></em></li>98 <li class="loading-results unselectable"><em><?php _e( 'Loading...' ); ?></em></li> 94 99 </ul> 95 100 <div class="river-waiting"> … … 101 106 <ul> 102 107 <li class="unselectable"><em><?php _e( 'No search term specified. Showing recent items.' ); ?></em></li> 103 <?php foreach ( $most_recent as $item ) : ?> 104 <li> 108 <?php 109 $alt = true; 110 foreach ( $most_recent as $item ) : ?> 111 <li<?php if ( $alt ) echo ' class="alternate"'; ?>> 105 112 <input type="hidden" class="item-permalink" value="<?php echo esc_url( $item['permalink'] ); ?>" /> 106 113 <span class="item-title"><?php echo $item['title']; ?></span> 107 114 <span class="item-info"><?php echo esc_html( $item['info'] ); ?></span> 108 115 </li> 109 <?php endforeach; ?> 116 <?php 117 $alt = ! $alt; 118 endforeach; ?> 110 119 </ul> 111 120 <div class="river-waiting"> … … 117 126 <div class="submitbox"> 118 127 <div id="wp-link-cancel"> 119 <a class="submitdelete deletion" ><?php _e( 'Cancel' ); ?></a>128 <a class="submitdelete deletion" href="#"><?php _e( 'Cancel' ); ?></a> 120 129 </div> 121 130 <div id="wp-link-update"> 122 <a class="button-primary" ><?php _e( 'Update' ); ?></a>131 <a class="button-primary" href="#"><?php _e( 'Update' ); ?></a> 123 132 </div> 124 133 </div> 125 134 </div> 126 <?php } ?> 135 <?php 136 } 137 ?>
Note: See TracChangeset
for help on using the changeset viewer.