Ticket #19619: 19619.diff
| File 19619.diff, 5.6 KB (added by , 14 years ago) |
|---|
-
wp-admin/includes/plugin-install.php
40 40 $args = apply_filters('plugins_api_args', $args, $action); 41 41 $res = apply_filters('plugins_api', false, $action, $args); 42 42 43 $args->wp_version = $GLOBALS['wp_version']; // temporary (?) 44 43 45 if ( false === $res ) { 44 46 $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) ); 45 47 if ( is_wp_error($request) ) { … … 101 103 $tags = array(); 102 104 foreach ( (array)$api_tags as $tag ) 103 105 $tags[ $tag['name'] ] = (object) array( 104 'link' => esc_url( self_admin_url('plugin-install.php?tab=search& type=tag&s=' . urlencode($tag['name'])) ),106 'link' => esc_url( self_admin_url('plugin-install.php?tab=search&s=tag:' . urlencode($tag['name'])) ), 105 107 'name' => $tag['name'], 106 108 'id' => sanitize_title_with_dashes($tag['name']), 107 109 'count' => $tag['count'] ); … … 117 119 * @since 2.7.0 118 120 */ 119 121 function install_search_form(){ 120 $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';121 122 $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; 122 123 123 124 ?><form id="search-plugins" method="get" action=""> 124 125 <input type="hidden" name="tab" value="search" /> 125 <select name="type" id="typeselector">126 <option value="term"<?php selected('term', $type) ?>><?php _e('Term'); ?></option>127 <option value="author"<?php selected('author', $type) ?>><?php _e('Author'); ?></option>128 <option value="tag"<?php selected('tag', $type) ?>><?php _ex('Tag', 'Plugin Installer'); ?></option>129 </select>130 126 <input type="text" name="s" value="<?php echo esc_attr($term) ?>" /> 131 127 <label class="screen-reader-text" for="plugin-search-input"><?php _e('Search Plugins'); ?></label> 132 128 <?php submit_button( __( 'Search Plugins' ), 'button', 'plugin-search-input', false ); ?> -
wp-admin/includes/class-wp-plugin-install-list-table.php
33 33 $tabs['featured'] = _x( 'Featured','Plugin Installer' ); 34 34 $tabs['popular'] = _x( 'Popular','Plugin Installer' ); 35 35 $tabs['new'] = _x( 'Newest','Plugin Installer' ); 36 $tabs['updated'] = _x( 'Recently Updated','Plugin Installer' );37 36 38 37 $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item. 39 38 … … 48 47 49 48 switch ( $tab ) { 50 49 case 'search': 51 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';52 50 $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; 51 $type = isset( $_REQUEST['type'] ) ? $_REQUEST['type'] : ''; 53 52 53 if ( 'tag:' == substr( $term, 0, 4 ) ) { 54 $type = 'tag'; 55 $term = substr( $term, 4 ); 56 } elseif ( 'author:' == substr( $term, 0, 7 ) ) { 57 $type = 'author'; 58 $term = substr( $term, 7 ); 59 } elseif ( 'author' == $type ) { 60 $_REQUEST['s'] = 'author:' . $_REQUEST['s']; 61 } elseif ( 'tag' == $type ) { 62 $_REQUEST['s'] = 'tag:' . $_REQUEST['s']; 63 } else { 64 $type = 'term'; 65 } 66 67 add_action( 'install_plugins_table_header', 'install_search_form' ); 68 69 if ( ! $term ) { 70 $args = false; 71 break; 72 } 73 54 74 switch ( $type ) { 55 75 case 'tag': 56 76 $args['tag'] = sanitize_title_with_dashes( $term ); … … 63 83 break; 64 84 } 65 85 66 add_action( 'install_plugins_table_header', 'install_search_form' );67 86 break; 68 87 69 88 case 'featured': 70 89 case 'popular': 71 90 case 'new': 72 case 'updated':73 91 $args['browse'] = $tab; 74 92 break; 75 93 … … 87 105 88 106 $this->items = $api->plugins; 89 107 108 if ( 'author' == $type && isset( $api->info['author'] ) ) 109 $this->plugin_author = $api->info['author']; 110 90 111 $this->set_pagination_args( array( 91 112 'total_items' => $api->info['results'], 92 113 'per_page' => $per_page, … … 94 115 } 95 116 96 117 function no_items() { 97 _e( 'No plugins match your request.' ); 118 if ( isset( $this->items ) ) 119 _e( 'No plugins match your request.' ); 98 120 } 99 121 100 122 function get_views() { … … 120 142 <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" /> 121 143 <br class="clear" /> 122 144 </div> 123 <?php } else { ?> 145 <?php 146 if ( isset( $this->plugin_author ) ) { 147 echo '<div style="margin:10px 10px">'; 148 $gravatar = ( is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/' ) . $this->plugin_author['gravatar'] . '?s=64'; 149 echo '<img src="' . esc_url( $gravatar ) . '" class="gravatar" style="float:left; margin: 0 10px 10px 0" />'; 150 echo '<h3>' . esc_html( $this->plugin_author['name'] ) . '</h3>'; 151 echo '<p><a href="' . esc_url( $this->plugin_author['url'] ) . '">' . esc_html( $this->plugin_author['url'] ) . '</a></p>'; 152 echo '</div>'; 153 } 154 } else { ?> 124 155 <div class="tablenav bottom"> 125 156 <?php $this->pagination( $which ); ?> 126 157 <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" /> … … 182 213 183 214 $author = $plugin['author']; 184 215 if ( ! empty( $plugin['author'] ) ) 185 $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '.</cite>';216 $author = ' ' . sprintf( __( 'By %s.' ), $author ); 186 217 187 218 $author = wp_kses( $author, $plugins_allowedtags ); 188 219