Make WordPress Core

Ticket #19619: 19619.2.diff

File 19619.2.diff, 10.9 KB (added by nacin, 14 years ago)

Includes themes.

  • wp-admin/includes/plugin-install.php

     
    4040        $args = apply_filters('plugins_api_args', $args, $action);
    4141        $res = apply_filters('plugins_api', false, $action, $args);
    4242
     43        $args->wp_version = $GLOBALS['wp_version']; // temporary (?)
     44
    4345        if ( false === $res ) {
    4446                $request = wp_remote_post('http://api.wordpress.org/plugins/info/1.0/', array( 'timeout' => 15, 'body' => array('action' => $action, 'request' => serialize($args))) );
    4547                if ( is_wp_error($request) ) {
     
    8486        <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>
    8587
    8688        <h4><?php _e('Search') ?></h4>
    87         <p class="install-help"><?php _e('Search for plugins by keyword, author, or tag.') ?></p>
    8889        <?php install_search_form(); ?>
    8990
    9091        <h4><?php _e('Popular tags') ?></h4>
     
    101102                $tags = array();
    102103                foreach ( (array)$api_tags as $tag )
    103104                        $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'])) ),
    105106                                                                        'name' => $tag['name'],
    106107                                                                        'id' => sanitize_title_with_dashes($tag['name']),
    107108                                                                        'count' => $tag['count'] );
     
    117118 * @since 2.7.0
    118119 */
    119120function install_search_form(){
    120         $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
    121121        $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
    122122
    123123        ?><form id="search-plugins" method="get" action="">
    124124                <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>
    130125                <input type="text" name="s" value="<?php echo esc_attr($term) ?>" />
    131126                <label class="screen-reader-text" for="plugin-search-input"><?php _e('Search Plugins'); ?></label>
    132127                <?php submit_button( __( 'Search Plugins' ), 'button', 'plugin-search-input', false ); ?>
  • wp-admin/includes/class-wp-plugin-install-list-table.php

     
    3333                $tabs['featured'] = _x( 'Featured','Plugin Installer' );
    3434                $tabs['popular']  = _x( 'Popular','Plugin Installer' );
    3535                $tabs['new']      = _x( 'Newest','Plugin Installer' );
    36                 $tabs['updated']  = _x( 'Recently Updated','Plugin Installer' );
    3736
    3837                $nonmenu_tabs = array( 'plugin-information' ); //Valid actions to perform which do not have a Menu item.
    3938
     
    4847
    4948                switch ( $tab ) {
    5049                        case 'search':
    51                                 $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
    5250                                $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
     51                                $type = isset( $_REQUEST['type'] ) ? $_REQUEST['type'] : '';
    5352
     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
    5474                                switch ( $type ) {
    5575                                        case 'tag':
    5676                                                $args['tag'] = sanitize_title_with_dashes( $term );
     
    6383                                                break;
    6484                                }
    6585
    66                                 add_action( 'install_plugins_table_header', 'install_search_form' );
    6786                                break;
    6887
    6988                        case 'featured':
    7089                        case 'popular':
    7190                        case 'new':
    72                         case 'updated':
    7391                                $args['browse'] = $tab;
    7492                                break;
    7593
     
    87105
    88106                $this->items = $api->plugins;
    89107
     108                if ( 'author' == $type && isset( $api->info['author'] ) )
     109                        $this->plugin_author = $api->info['author'];
     110
    90111                $this->set_pagination_args( array(
    91112                        'total_items' => $api->info['results'],
    92113                        'per_page' => $per_page,
     
    94115        }
    95116
    96117        function no_items() {
    97                 _e( 'No plugins match your request.' );
     118                if ( isset( $this->items ) )
     119                        _e( 'No plugins match your request.' );
    98120        }
    99121
    100122        function get_views() {
     
    120142                                <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
    121143                                <br class="clear" />
    122144                        </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 { ?>
    124155                        <div class="tablenav bottom">
    125156                                <?php $this->pagination( $which ); ?>
    126157                                <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
     
    182213
    183214                        $author = $plugin['author'];
    184215                        if ( ! empty( $plugin['author'] ) )
    185                                 $author = ' <cite>' . sprintf( __( 'By %s' ), $author ) . '.</cite>';
     216                                $author = ' ' . sprintf( __( 'By %s.' ), $author );
    186217
    187218                        $author = wp_kses( $author, $plugins_allowedtags );
    188219
  • wp-admin/includes/class-wp-theme-install-list-table.php

     
    3333                $tabs['featured'] = _x( 'Featured','Theme Installer' );
    3434                //$tabs['popular']  = _x( 'Popular','Theme Installer' );
    3535                $tabs['new']      = _x( 'Newest','Theme Installer' );
    36                 $tabs['updated']  = _x( 'Recently Updated','Theme Installer' );
    3736
    3837                $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item.
    3938
     
    5150                                $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
    5251                                $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
    5352
     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
    5474                                switch ( $type ) {
    5575                                        case 'tag':
    5676                                                $terms = explode( ',', $term );
     
    7595                                        $_REQUEST['type'] = 'tag';
    7696                                }
    7797
    78                                 add_action( 'install_themes_table_header', 'install_theme_search_form' );
    7998                                break;
    8099
    81100                        case 'featured':
    82                         //case 'popular':
    83101                        case 'new':
    84                         case 'updated':
    85102                                $args['browse'] = $tab;
    86103                                break;
    87104
     
    99116
    100117                $this->items = $api->themes;
    101118
     119                if ( 'author' == $type && isset( $api->info['author'] ) )
     120                        $this->theme_author = $api->info['author'];
     121
    102122                $this->set_pagination_args( array(
    103123                        'total_items' => $api->info['results'],
    104124                        'per_page' => $per_page,
     
    106126        }
    107127
    108128        function no_items() {
    109                 _e( 'No themes match your request.' );
     129                if ( isset( $this->items ) )
     130                        _e( 'No themes match your request.' );
    110131        }
    111132
    112133        function get_views() {
     
    135156                                <?php do_action( 'install_themes_table_header' ); ?>
    136157                        </div>
    137158                        <?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                        ?>
    138169                        <img src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" class="ajax-loading list-ajax-loading" alt="" />
    139170                        <br class="clear" />
    140171                </div>
  • wp-admin/includes/theme.php

     
    402402        if ( !isset($args->per_page) )
    403403                $args->per_page = 24;
    404404
     405        $args->wp_version = $GLOBALS['wp_version']; // temporary (?)
     406
    405407        $args = apply_filters('themes_api_args', $args, $action); //NOTE: Ensure that an object is returned via this filter.
    406408        $res = apply_filters('themes_api', false, $action, $args); //NOTE: Allows a theme to completely override the builtin WordPress.org API.
    407409
  • wp-admin/includes/theme-install.php

     
    5050 * @since 2.8.0
    5151 */
    5252function install_theme_search_form() {
    53         $type = isset( $_REQUEST['type'] ) ? stripslashes( $_REQUEST['type'] ) : '';
    5453        $term = isset( $_REQUEST['s'] ) ? stripslashes( $_REQUEST['s'] ) : '';
    5554        ?>
    56 <p class="install-help"><?php _e('Search for themes by keyword, author, or tag.') ?></p>
    57 
    5855<form id="search-themes" method="get" action="">
    5956        <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>
    6557        <input type="text" name="s" size="30" value="<?php echo esc_attr($term) ?>" />
    6658        <?php submit_button( __( 'Search' ), 'button', 'search', false ); ?>
    6759</form>