Make WordPress Core


Ignore:
Timestamp:
02/18/2009 09:55:00 PM (16 years ago)
Author:
ryan
Message:

Fix preview for theme installer. see #8652

File:
1 edited

Legend:

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

    r10567 r10590  
    66 * @subpackage Administration
    77 */
     8
     9$themes_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()),
     10                                'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
     11                                'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
     12                                'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),
     13                                'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),
     14                                'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
    815
    916/**
     
    258265 */
    259266function display_themes($themes, $page = 1, $totalpages = 1) {
     267    global $themes_allowedtags;
     268
    260269    $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : '';
    261270    $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : '';
     
    299308            $name = wp_kses($theme->name, $themes_allowedtags);
    300309            $desc = wp_kses($theme->description, $themes_allowedtags);
    301             if ( strlen($desc) > 30 )
    302                 $desc =  substr($desc, 0, 30) . '<span class="dots">...</span><span>' . substr($desc, 30) . '</span>';
    303 
     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';
    304314            $action_links = array();
    305315            $action_links[] = '<a href="' . admin_url('theme-install.php?tab=theme-information&amp;theme=' . $theme->slug .
    306                                 '&amp;TB_iframe=true&amp;width=600&amp;height=800') . '" class="thickbox onclick" title="' .
    307                                 attribute_escape($name) . '">' . __('Install') . '</a>';
    308             $action_links[] = '<a href="' . $theme->preview_url . '&TB_iframe" class="thickbox onclick" title="' .
    309                                 attribute_escape( sprintf(__('Preview %s'), $name) ) . '">' . __('Preview') . '</a>';
     316                                '&amp;TB_iframe=true&amp;width=600&amp;height=800') . '" class="button thickbox onclick">' . __('Install') . '</a>';
     317            $action_links[] = '<a href="' . $preview_link . '" class="button thickbox onclick previewlink">' . __('Preview') . '</a>';
    310318
    311319            $action_links = apply_filters('theme_install_action_links', $action_links, $theme);
    312             $actions = implode ( ' | ', $action_links );
     320            $actions = implode ( ' ', $action_links );
    313321            echo "
    314         <div class='theme-item'>
    315             <h3>{$theme->name}</h3>
    316             <img src='{$theme->screenshot_url}' width='150' /><br />
     322        <div class='theme-item available-theme'>
     323            <a class='thickbox screenshot' href='$preview_link'>
     324            <img src='{$theme->screenshot_url}' width='150' />
     325            </a>
     326            <h3>{$name}</h3>
     327            <span class='action-links'>$actions</span>
    317328            <div class='theme-item-info'>
    318329                {$desc}
    319                 <br class='line' />
    320                 <span class='action-links'>$actions</span>
    321330            </div>
    322331        </div>";
     
    358367function install_theme_information() {
    359368    //TODO: This function needs a LOT of UI work :)
    360     global $tab;
     369    global $tab, $themes_allowedtags;;
    361370
    362371    $api = themes_api('theme_information', array('slug' => stripslashes( $_REQUEST['theme'] ) ));
     
    365374        wp_die($api);
    366375
    367     $themes_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()),
    368                                 'abbr' => array('title' => array()), 'acronym' => array('title' => array()),
    369                                 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(),
    370                                 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(),
    371                                 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(),
    372                                 'img' => array('src' => array(), 'class' => array(), 'alt' => array()));
    373376    //Sanitize HTML
    374377    foreach ( (array)$api->sections as $section_name => $content )
Note: See TracChangeset for help on using the changeset viewer.