diff --git a/wp-admin/includes/theme-install.php b/wp-admin/includes/theme-install.php index 161f67c58b..6833efbbc9 100644 --- a/wp-admin/includes/theme-install.php +++ b/wp-admin/includes/theme-install.php @@ -6,6 +6,13 @@ * @subpackage Administration */ +$themes_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), + 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), + 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), + 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), + 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), + 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); + /** * Retrieve theme installer pages from WordPress Themes API. * @@ -257,6 +264,8 @@ function install_themes_upload() { * @param int $totalpages Number of pages. */ function display_themes($themes, $page = 1, $totalpages = 1) { + global $themes_allowedtags; + $type = isset($_REQUEST['type']) ? stripslashes( $_REQUEST['type'] ) : ''; $term = isset($_REQUEST['s']) ? stripslashes( $_REQUEST['s'] ) : ''; @@ -298,26 +307,26 @@ function display_themes($themes, $page = 1, $totalpages = 1) { $name = wp_kses($theme->name, $themes_allowedtags); $desc = wp_kses($theme->description, $themes_allowedtags); - if ( strlen($desc) > 30 ) - $desc = substr($desc, 0, 30) . '...' . substr($desc, 30) . ''; + //if ( strlen($desc) > 30 ) + // $desc = substr($desc, 0, 30) . '...' . substr($desc, 30) . ''; + $preview_link = $theme->preview_url . '?TB_iframe=true&width=600&height=400'; $action_links = array(); $action_links[] = '' . __('Install') . ''; - $action_links[] = '' . __('Preview') . ''; + '&TB_iframe=true&width=600&height=800') . '" class="button thickbox onclick">' . __('Install') . ''; + $action_links[] = '' . __('Preview') . ''; $action_links = apply_filters('theme_install_action_links', $action_links, $theme); - $actions = implode ( ' | ', $action_links ); + $actions = implode ( ' ', $action_links ); echo " -
-

{$theme->name}

-
+
+ + + +

{$name}

+ $actions
{$desc} -
- $actions
"; /* @@ -357,19 +366,13 @@ add_action('install_themes_pre_theme-information', 'install_theme_information'); */ function install_theme_information() { //TODO: This function needs a LOT of UI work :) - global $tab; + global $tab, $themes_allowedtags;; $api = themes_api('theme_information', array('slug' => stripslashes( $_REQUEST['theme'] ) )); if ( is_wp_error($api) ) wp_die($api); - $themes_allowedtags = array('a' => array('href' => array(), 'title' => array(), 'target' => array()), - 'abbr' => array('title' => array()), 'acronym' => array('title' => array()), - 'code' => array(), 'pre' => array(), 'em' => array(), 'strong' => array(), - 'div' => array(), 'p' => array(), 'ul' => array(), 'ol' => array(), 'li' => array(), - 'h1' => array(), 'h2' => array(), 'h3' => array(), 'h4' => array(), 'h5' => array(), 'h6' => array(), - 'img' => array('src' => array(), 'class' => array(), 'alt' => array())); //Sanitize HTML foreach ( (array)$api->sections as $section_name => $content ) $api->sections[$section_name] = wp_kses($content, $themes_allowedtags); diff --git a/wp-admin/js/theme-preview.dev.js b/wp-admin/js/theme-preview.dev.js index f3caf4d50c..033015694b 100644 --- a/wp-admin/js/theme-preview.dev.js +++ b/wp-admin/js/theme-preview.dev.js @@ -14,7 +14,7 @@ jQuery(document).ready(function($) { }; return $('a.thickbox').each( function() { - var href = $(this).parents('.available-theme').find('.previewlink').attr('href'); + var href = $(this).attr('href'); if ( ! href ) return; href = href.replace(/&width=[0-9]+/g, ''); href = href.replace(/&height=[0-9]+/g, ''); @@ -26,6 +26,7 @@ jQuery(document).ready(function($) { .click( function() { var alink = $(this).parents('.available-theme').find('.activatelink'), url = alink.attr('href'), text = alink.html(); + if ( null == text ) text = ''; $('#TB_title').css({'background-color':'#222','color':'#cfcfcf'}); $('#TB_closeAjaxWindow').css({'float':'left'}); $('#TB_ajaxWindowTitle').css({'float':'right'}) diff --git a/wp-admin/js/theme-preview.js b/wp-admin/js/theme-preview.js index 406707f232..736a8a14c5 100644 --- a/wp-admin/js/theme-preview.js +++ b/wp-admin/js/theme-preview.js @@ -1 +1 @@ -var thickDims;jQuery(document).ready(function(a){thickDims=function(){var d=a("#TB_window"),c=a(window).height(),b=a(window).width();if(d.size()){d.width(b-90).height(c-60);a("#TB_iframeContent").width(b-90).height(c-90);d.css({"margin-left":"-"+parseInt(((b-90)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){d.css({top:"30px","margin-top":"0"})}}return a("a.thickbox").each(function(){var e=a(this).parents(".available-theme").find(".previewlink").attr("href");if(!e){return}e=e.replace(/&width=[0-9]+/g,"");e=e.replace(/&height=[0-9]+/g,"");a(this).attr("href",e+"&width="+(b-110)+"&height="+(c-100))})};thickDims().click(function(){var c=a(this).parents(".available-theme").find(".activatelink"),b=c.attr("href"),d=c.html();a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).append(' '+d+"");a("#TB_iframeContent").width("100%");return false});a(window).resize(function(){thickDims()})});function tb_position(){thickDims()}; \ No newline at end of file +var thickDims;jQuery(document).ready(function(a){thickDims=function(){var d=a("#TB_window"),c=a(window).height(),b=a(window).width();if(d.size()){d.width(b-90).height(c-60);a("#TB_iframeContent").width(b-90).height(c-90);d.css({"margin-left":"-"+parseInt(((b-90)/2),10)+"px"});if(typeof document.body.style.maxWidth!="undefined"){d.css({top:"30px","margin-top":"0"})}}return a("a.thickbox").each(function(){var e=a(this).attr("href");if(!e){return}e=e.replace(/&width=[0-9]+/g,"");e=e.replace(/&height=[0-9]+/g,"");a(this).attr("href",e+"&width="+(b-110)+"&height="+(c-100))})};thickDims().click(function(){var c=a(this).parents(".available-theme").find(".activatelink"),b=c.attr("href"),d=c.html();if(null==d){d=""}a("#TB_title").css({"background-color":"#222",color:"#cfcfcf"});a("#TB_closeAjaxWindow").css({"float":"left"});a("#TB_ajaxWindowTitle").css({"float":"right"}).append(' '+d+"");a("#TB_iframeContent").width("100%");return false});a(window).resize(function(){thickDims()})});function tb_position(){thickDims()}; \ No newline at end of file diff --git a/wp-admin/theme-install.php b/wp-admin/theme-install.php index b79d53dbc3..518e45e6af 100644 --- a/wp-admin/theme-install.php +++ b/wp-admin/theme-install.php @@ -22,6 +22,7 @@ wp_enqueue_style( 'theme-install' ); wp_enqueue_script( 'theme-install' ); add_thickbox(); +wp_enqueue_script( 'theme-preview' ); //These are the tabs which are shown on the page, $tabs = array(); diff --git a/wp-admin/themes.php b/wp-admin/themes.php index 15b3e5bfc3..1603b0b791 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -178,7 +178,7 @@ foreach ( $cols as $col => $theme_name ) { $activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template); $activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) ); ?> - + diff --git a/wp-includes/script-loader.php b/wp-includes/script-loader.php index a75cf1187f..5f68a8015a 100644 --- a/wp-includes/script-loader.php +++ b/wp-includes/script-loader.php @@ -341,7 +341,7 @@ function wp_default_scripts( &$scripts ) { 'l10n_print_after' => 'try{convertEntities(wpGearsL10n);}catch(e){};' )); - $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090114' ); + $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), '20090218' ); $scripts->add_data( 'theme-preview', 'group', 1 ); $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery-form', 'suggest' ), '20090125' );