Make WordPress Core

Changeset 10653


Ignore:
Timestamp:
02/26/2009 12:44:32 AM (18 years ago)
Author:
ryan
Message:

Try grid layout for theme browser. see #8652

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/includes/theme-install.php

    r10650 r10653  
    300300                <br class="clear" />
    301301        </div>
    302         <div class="theme-listing">
     302        <table id="availablethemes" cellspacing="0" cellpadding="0">
    303303                <?php
    304304                $in_column = 0;
    305                 foreach ( $themes as $theme ) {
    306                         //var_dump($theme);
     305                $rows = ceil(count($themes) / 3);
     306                $i = 0;
     307                for ( $row = 1; $row <= $rows; $row++ ) {
     308                        for ( $col = 1; $col <= 3; $col++ ) {
     309                                $table[$row][$col] = $i;
     310                                $i++;
     311                        }
     312                }
     313
     314                foreach ( $table as $row => $cols ) {
     315?>
     316<tr>
     317<?php
     318                        foreach ( $cols as $col => $theme_index ) {
     319                                $class = array('available-theme');
     320                                if ( $row == 1 ) $class[] = 'top';
     321                                if ( $col == 1 ) $class[] = 'left';
     322                                if ( $row == $rows ) $class[] = 'bottom';
     323                                if ( $col == 3 ) $class[] = 'right';
     324                                $theme = $themes[$theme_index];
     325?>
     326        <td class="<?php echo join(' ', $class); ?>">
     327<?php
     328                                        //var_dump($theme);
    307329                       
    308                         $name = wp_kses($theme->name, $themes_allowedtags);
    309                         $desc = wp_kses($theme->description, $themes_allowedtags);
    310                         //if ( strlen($desc) > 30 )
    311                         //      $desc =  substr($desc, 0, 30) . '<span class="dots">...</span><span>' . substr($desc, 30) . '</span>';
    312 
    313                         $preview_link = $theme->preview_url . '?TB_iframe=true&amp;width=600&amp;height=400';
    314                         $action_links = array();
    315                         $action_links[] = '<a href="' . admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .
    316                                                                 '&amp;TB_iframe=true&amp;width=600&amp;height=800') . '" class="button thickbox onclick" title="' . attribute_escape(sprintf(__('Install "%s"'), $name)) . '">' . __('Install') . '</a>';
    317                         $action_links[] = '<a href="' . $preview_link . '" class="button thickbox thickbox-preview onclick previewlink" title="' . attribute_escape(sprintf(__('Preview "%s"'), $name)) . '">' . __('Preview') . '</a>';
    318 
    319                         $action_links = apply_filters('theme_install_action_links', $action_links, $theme);
    320                         $actions = implode ( ' ', $action_links );
    321                         echo "
    322                 <div class='theme-item available-theme'>
    323                         <a class='thickbox thickbox-preview screenshot' href='$preview_link' title='" . attribute_escape(sprintf(__('Preview "%s"'), $name)) . "'>
    324                         <img src='{$theme->screenshot_url}' width='150' />
    325                         </a>
    326                         <h3>{$name}</h3>
    327                         <span class='action-links'>$actions</span>
    328                         <div class='theme-item-info'>
    329                                 {$desc}
    330                         </div>
    331                 </div>";
    332                 /*
    333                 object(stdClass)[59]
    334                   public 'name' => string 'Magazine Basic' (length=14)
    335                   public 'slug' => string 'magazine-basic' (length=14)
    336                   public 'version' => string '1.1' (length=3)
    337                   public 'author' => string 'tinkerpriest' (length=12)
    338                   public 'preview_url' => string 'http://wp-themes.com/?magazine-basic' (length=36)
    339                   public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68)
    340                   public 'rating' => float 80
    341                   public 'num_ratings' => int 1
    342                   public 'homepage' => string 'http://wordpress.org/extend/themes/magazine-basic' (length=49)
    343                   public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.' (length=214)
    344                   public 'download_link' => string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66)
    345                   */
    346                 }
    347                
    348                 ?>
    349         </div>
     330                                $name = wp_kses($theme->name, $themes_allowedtags);
     331                                $desc = wp_kses($theme->description, $themes_allowedtags);
     332                                //if ( strlen($desc) > 30 )
     333                                //      $desc =  substr($desc, 0, 30) . '<span class="dots">...</span><span>' . substr($desc, 30) . '</span>';
     334
     335                                $preview_link = $theme->preview_url . '?TB_iframe=true&amp;width=600&amp;height=400';
     336                                $action_links = array();
     337                                $action_links[] = '<a href="' . admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .
     338                                                                        '&amp;TB_iframe=true&amp;width=600&amp;height=800') . '" class="button thickbox onclick" title="' . attribute_escape(sprintf(__('Install "%s"'), $name)) . '">' . __('Install') . '</a>';
     339                                $action_links[] = '<a href="' . $preview_link . '" class="button thickbox thickbox-preview onclick previewlink" title="' . attribute_escape(sprintf(__('Preview "%s"'), $name)) . '">' . __('Preview') . '</a>';
     340       
     341                                $action_links = apply_filters('theme_install_action_links', $action_links, $theme);
     342                                $actions = implode ( ' ', $action_links );
     343                                echo "
     344                                <a class='thickbox thickbox-preview screenshot' href='$preview_link' title='" . attribute_escape(sprintf(__('Preview "%s"'), $name)) . "'>
     345                                <img src='{$theme->screenshot_url}' width='150' />
     346                                </a>
     347                                <h3>{$name}</h3>
     348                                <span class='action-links'>$actions</span>
     349                                        <p>{$desc}</p>";
     350                        /*
     351                        object(stdClass)[59]
     352                          public 'name' => string 'Magazine Basic' (length=14)
     353                          public 'slug' => string 'magazine-basic' (length=14)
     354                          public 'version' => string '1.1' (length=3)
     355                          public 'author' => string 'tinkerpriest' (length=12)
     356                          public 'preview_url' => string 'http://wp-themes.com/?magazine-basic' (length=36)
     357                          public 'screenshot_url' => string 'http://wp-themes.com/wp-content/themes/magazine-basic/screenshot.png' (length=68)
     358                          public 'rating' => float 80
     359                          public 'num_ratings' => int 1
     360                          public 'homepage' => string 'http://wordpress.org/extend/themes/magazine-basic' (length=49)
     361                          public 'description' => string 'A basic magazine style layout with a fully customizable layout through a backend interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.' (length=214)
     362                          public 'download_link' => string 'http://wordpress.org/extend/themes/download/magazine-basic.1.1.zip' (length=66)
     363                          */
     364?>
     365        </td>
     366<?php } // end foreach $cols ?>
     367</tr>
     368<?php } // end foreach $table ?>
     369</table>
    350370
    351371        <div class="tablenav">
Note: See TracChangeset for help on using the changeset viewer.