Ticket #19619: 19619.2.diff
| File 19619.2.diff, 10.9 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) ) { … … 84 86 <p><?php printf( __( 'Plugins extend and expand the functionality of WordPress. You may automatically install plugins from the <a href="http://wordpress.org/extend/plugins/">WordPress Plugin Directory</a> or upload a plugin in .zip format via <a href="%s">this page</a>.' ), self_admin_url( 'plugin-install.php?tab=upload' ) ); ?></p> 85 87 86 88 <h4><?php _e('Search') ?></h4> 87 <p class="install-help"><?php _e('Search for plugins by keyword, author, or tag.') ?></p>88 89 <?php install_search_form(); ?> 89 90 90 91 <h4><?php _e('Popular tags') ?></h4> … … 101 102 $tags = array(); 102 103 foreach ( (array)$api_tags as $tag ) 103 104 $tags[ $tag['name'] ] = (object) array( 104 'link' => esc_url( self_admin_url('plugin-install.php?tab=search& type=tag&s=' . urlencode($tag['name'])) ),105 'link' => esc_url( self_admin_url('plugin-install.php?tab=search&s=tag:' . urlencode($tag['name'])) ), 105 106 'name' => $tag['name'], 106 107 'id' => sanitize_title_with_dashes($tag['name']), 107 108 'count' => $tag['count'] ); … … 117 118 * @since 2.7.0 118 119 */ 119 120 function install_search_form(){ 120 $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';121 121 $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; 122 122 123 123 ?><form id="search-plugins" method="get" action=""> 124 124 <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 125 <input type="text" name="s" value="<?php echo esc_attr($term) ?>" /> 131 126 <label class="screen-reader-text" for="plugin-search-input"><?php _e('Search Plugins'); ?></label> 132 127 <?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 -
wp-admin/includes/class-wp-theme-install-list-table.php
33 33 $tabs['featured'] = _x( 'Featured','Theme Installer' ); 34 34 //$tabs['popular'] = _x( 'Popular','Theme Installer' ); 35 35 $tabs['new'] = _x( 'Newest','Theme Installer' ); 36 $tabs['updated'] = _x( 'Recently Updated','Theme Installer' );37 36 38 37 $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item. 39 38 … … 51 50 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : ''; 52 51 $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; 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 ( 'tag' == $type ) { 60 $_REQUEST['s'] = 'tag:' . $_REQUEST['s']; 61 } elseif ( 'author' == $type ) { 62 $_REQUEST['s'] = 'author:' . $_REQUEST['s']; 63 } else { 64 $type = 'term'; 65 } 66 67 add_action( 'install_themes_table_header', 'install_theme_search_form' ); 68 69 if ( ! $term ) { 70 $args = false; 71 break; 72 } 73 54 74 switch ( $type ) { 55 75 case 'tag': 56 76 $terms = explode( ',', $term ); … … 75 95 $_REQUEST['type'] = 'tag'; 76 96 } 77 97 78 add_action( 'install_themes_table_header', 'install_theme_search_form' );79 98 break; 80 99 81 100 case 'featured': 82 //case 'popular':83 101 case 'new': 84 case 'updated':85 102 $args['browse'] = $tab; 86 103 break; 87 104 … … 99 116 100 117 $this->items = $api->themes; 101 118 119 if ( 'author' == $type && isset( $api->info['author'] ) ) 120 $this->theme_author = $api->info['author']; 121 102 122 $this->set_pagination_args( array( 103 123 'total_items' => $api->info['results'], 104 124 'per_page' => $per_page, … … 106 126 } 107 127 108 128 function no_items() { 109 _e( 'No themes match your request.' ); 129 if ( isset( $this->items ) ) 130 _e( 'No themes match your request.' ); 110 131 } 111 132 112 133 function get_views() { … … 135 156 <?php do_action( 'install_themes_table_header' ); ?> 136 157 </div> 137 158 <?php $this->pagination( 'top' ); ?> 159 <?php 160 if ( isset( $this->theme_author ) ) { 161 echo '<div style="padding:15px 15px 0px; clear:both">'; 162 $gravatar = ( is_ssl() ? 'https://secure.gravatar.com/avatar/' : 'http://0.gravatar.com/avatar/' ) . $this->theme_author['gravatar'] . '?s=64'; 163 echo '<img src="' . esc_url( $gravatar ) . '" class="gravatar" style="float:left; margin: 0 10px 10px 0" />'; 164 echo '<h3>' . esc_html( $this->theme_author['name'] ) . '</h3>'; 165 echo '<p><a href="' . esc_url( $this->theme_author['url'] ) . '">' . esc_html( $this->theme_author['url'] ) . '</a></p>'; 166 echo '</div>'; 167 } 168 ?> 138 169 <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" /> 139 170 <br class="clear" /> 140 171 </div> -
wp-admin/includes/theme.php
402 402 if ( !isset($args->per_page) ) 403 403 $args->per_page = 24; 404 404 405 $args->wp_version = $GLOBALS['wp_version']; // temporary (?) 406 405 407 $args = apply_filters('themes_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter. 406 408 $res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API. 407 409 -
wp-admin/includes/theme-install.php
50 50 * @since 2.8.0 51 51 */ 52 52 function install_theme_search_form() { 53 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';54 53 $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : ''; 55 54 ?> 56 <p class="install-help"><?php _e('Search for themes by keyword, author, or tag.') ?></p>57 58 55 <form id="search-themes" method="get" action=""> 59 56 <input type="hidden" name="tab" value="search" /> 60 <select name="type" id="typeselector">61 <option value="term" <?php selected('term', $type) ?>><?php _e('Term'); ?></option>62 <option value="author" <?php selected('author', $type) ?>><?php _e('Author'); ?></option>63 <option value="tag" <?php selected('tag', $type) ?>><?php _ex('Tag', 'Theme Installer'); ?></option>64 </select>65 57 <input type="text" name="s" size="30" value="<?php echo esc_attr($term) ?>" /> 66 58 <?php submit_button( __( 'Search' ), 'button', 'search', false ); ?> 67 59 </form>