mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-18 14:21:25 +01:00
Theme preview and thickbox CSS cleanup. Props azaozz. see #5486
git-svn-id: http://svn.automattic.com/wordpress/trunk@7961 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e9ea1ab0ef
commit
bc07ef1efe
@ -49,12 +49,16 @@ if ( isset($page_hook) )
|
|||||||
do_action('admin_print_scripts-' . $page_hook);
|
do_action('admin_print_scripts-' . $page_hook);
|
||||||
else if ( isset($plugin_page) )
|
else if ( isset($plugin_page) )
|
||||||
do_action('admin_print_scripts-' . $plugin_page);
|
do_action('admin_print_scripts-' . $plugin_page);
|
||||||
|
else if ( isset($pagenow) )
|
||||||
|
do_action('admin_print_scripts-' . $pagenow);
|
||||||
do_action('admin_print_scripts');
|
do_action('admin_print_scripts');
|
||||||
|
|
||||||
if ( isset($page_hook) )
|
if ( isset($page_hook) )
|
||||||
do_action('admin_head-' . $page_hook);
|
do_action('admin_head-' . $page_hook);
|
||||||
else if ( isset($plugin_page) )
|
else if ( isset($plugin_page) )
|
||||||
do_action('admin_head-' . $plugin_page);
|
do_action('admin_head-' . $plugin_page);
|
||||||
|
else if ( isset($pagenow) )
|
||||||
|
do_action('admin_head-' . $pagenow);
|
||||||
do_action('admin_head');
|
do_action('admin_head');
|
||||||
?>
|
?>
|
||||||
</head>
|
</head>
|
||||||
|
@ -21,7 +21,7 @@ case 'editcomment' :
|
|||||||
$title = __('Edit Comment');
|
$title = __('Edit Comment');
|
||||||
|
|
||||||
wp_enqueue_script('comment');
|
wp_enqueue_script('comment');
|
||||||
//wp_enqueue_script('thickbox');
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
|
|
||||||
$comment_id = absint( $_GET['c'] );
|
$comment_id = absint( $_GET['c'] );
|
||||||
|
@ -1,155 +1,5 @@
|
|||||||
|
|
||||||
/* ---------->>> global settings needed for thickbox <<<-----------------------------------------------------------*/
|
|
||||||
*{padding: 0; margin: 0;}
|
|
||||||
|
|
||||||
/* ---------->>> thickbox specific link and font settings <<<------------------------------------------------------*/
|
|
||||||
#TB_window {
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_secondLine {
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_overlay {
|
|
||||||
position: fixed;
|
|
||||||
z-index:100;
|
|
||||||
top: 0px;
|
|
||||||
left: 0px;
|
|
||||||
background-color:#000;
|
|
||||||
filter:alpha(opacity=75);
|
|
||||||
-moz-opacity: 0.75;
|
|
||||||
opacity: 0.75;
|
|
||||||
height:100%;
|
|
||||||
width:100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
* html #TB_overlay { /* ie6 hack */
|
|
||||||
position: absolute;
|
|
||||||
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_window {
|
|
||||||
position: fixed;
|
|
||||||
background: #ffffff;
|
|
||||||
z-index: 102;
|
|
||||||
color:#000000;
|
|
||||||
display:none;
|
|
||||||
border: 4px solid #525252;
|
|
||||||
text-align:left;
|
|
||||||
top:50%;
|
|
||||||
left:50%;
|
|
||||||
}
|
|
||||||
|
|
||||||
* html #TB_window { /* ie6 hack */
|
|
||||||
position: absolute;
|
|
||||||
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_window img#TB_Image {
|
|
||||||
display:block;
|
|
||||||
margin: 15px 0 0 15px;
|
|
||||||
border-right: 1px solid #ccc;
|
|
||||||
border-bottom: 1px solid #ccc;
|
|
||||||
border-top: 1px solid #666;
|
|
||||||
border-left: 1px solid #666;
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_caption{
|
|
||||||
height:25px;
|
|
||||||
padding:7px 30px 10px 25px;
|
|
||||||
float:left;
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_closeWindow{
|
|
||||||
height:25px;
|
|
||||||
padding:11px 25px 10px 0;
|
|
||||||
float:right;
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_closeAjaxWindow{
|
|
||||||
padding:7px 10px 5px 0;
|
|
||||||
margin-bottom:1px;
|
|
||||||
text-align:right;
|
|
||||||
float:right;
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_ajaxWindowTitle{
|
|
||||||
float:left;
|
|
||||||
padding:7px 0 5px 10px;
|
|
||||||
margin-bottom:1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_title{
|
|
||||||
background-color:#e8e8e8;
|
|
||||||
height:27px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_ajaxContent{
|
|
||||||
clear:both;
|
|
||||||
padding:2px 15px 15px 15px;
|
|
||||||
overflow:auto;
|
|
||||||
text-align:left;
|
|
||||||
line-height:1.4em;
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_ajaxContent.TB_modal{
|
|
||||||
padding:15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_ajaxContent p{
|
|
||||||
padding:5px 0px 5px 0px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_load{
|
|
||||||
position: fixed;
|
|
||||||
display:none;
|
|
||||||
height:13px;
|
|
||||||
width:208px;
|
|
||||||
z-index:103;
|
|
||||||
top: 50%;
|
|
||||||
left: 50%;
|
|
||||||
margin: -6px 0 0 -104px; /* -height/2 0 0 -width/2 */
|
|
||||||
}
|
|
||||||
|
|
||||||
* html #TB_load { /* ie6 hack */
|
|
||||||
position: absolute;
|
|
||||||
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_HideSelect{
|
|
||||||
z-index:99;
|
|
||||||
position:fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
background-color:#fff;
|
|
||||||
border:none;
|
|
||||||
filter:alpha(opacity=0);
|
|
||||||
-moz-opacity: 0;
|
|
||||||
opacity: 0;
|
|
||||||
height:100%;
|
|
||||||
width:100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
* html #TB_HideSelect { /* ie6 hack */
|
|
||||||
position: absolute;
|
|
||||||
height: expression(document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px');
|
|
||||||
}
|
|
||||||
|
|
||||||
#TB_iframeContent{
|
|
||||||
clear:both;
|
|
||||||
border:none;
|
|
||||||
margin-bottom:-1px;
|
|
||||||
margin-top:1px;
|
|
||||||
_margin-bottom:1px;
|
|
||||||
}
|
|
||||||
/* end jquery thickbox css */
|
|
||||||
|
|
||||||
/* quickpost css */
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
body {
|
body {
|
||||||
font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
|
font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
|
||||||
}
|
}
|
||||||
/* jquery tabs css */
|
/* jquery tabs css */
|
||||||
|
|
||||||
@ -169,12 +19,12 @@ font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
|
|||||||
|
|
||||||
/* Skin */
|
/* Skin */
|
||||||
div.ui-tabs-panel {
|
div.ui-tabs-panel {
|
||||||
border: none;
|
border: none;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: auto;
|
height: auto;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.ui-tabs-nav {
|
.ui-tabs-nav {
|
||||||
list-style: none;
|
list-style: none;
|
||||||
@ -256,7 +106,7 @@ margin-top: -2px;
|
|||||||
}
|
}
|
||||||
|
|
||||||
#wphead {
|
#wphead {
|
||||||
border-top: none;
|
border-top: none;
|
||||||
}
|
}
|
||||||
.submit input {
|
.submit input {
|
||||||
}
|
}
|
||||||
|
@ -33,13 +33,13 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); // applicatio
|
|||||||
?>
|
?>
|
||||||
{
|
{
|
||||||
"betaManifestVersion" : 1,
|
"betaManifestVersion" : 1,
|
||||||
"version" : "<?php echo $version; ?>_20080511",
|
"version" : "<?php echo $version; ?>_20080520",
|
||||||
"entries" : [
|
"entries" : [
|
||||||
<?php echo $default_js; ?>
|
<?php echo $default_js; ?>
|
||||||
|
|
||||||
{ "url" : "wp-admin.css?version=2.6-bleeding" },
|
{ "url" : "wp-admin.css?version=2.6-bleeding" },
|
||||||
{ "url" : "rtl.css?version=2.6-bleeding" },
|
{ "url" : "rtl.css?version=2.6-bleeding" },
|
||||||
{ "url" : "../wp-includes/js/thickbox/thickbox.css?ver=20080430" },
|
{ "url" : "../wp-includes/js/thickbox/thickbox.css?version=2.6-bleeding" },
|
||||||
{ "url" : "css/colors-classic-rtl.css?version=2.6-bleeding" },
|
{ "url" : "css/colors-classic-rtl.css?version=2.6-bleeding" },
|
||||||
{ "url" : "css/colors-classic.css?version=2.6-bleeding" },
|
{ "url" : "css/colors-classic.css?version=2.6-bleeding" },
|
||||||
{ "url" : "css/colors-fresh-rtl.css?version=2.6-bleeding" },
|
{ "url" : "css/colors-fresh-rtl.css?version=2.6-bleeding" },
|
||||||
@ -56,6 +56,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); // applicatio
|
|||||||
{ "url" : "css/login.css?version=2.6-bleeding" },
|
{ "url" : "css/login.css?version=2.6-bleeding" },
|
||||||
{ "url" : "css/media-rtl.css?version=2.6-bleeding" },
|
{ "url" : "css/media-rtl.css?version=2.6-bleeding" },
|
||||||
{ "url" : "css/media.css?version=2.6-bleeding" },
|
{ "url" : "css/media.css?version=2.6-bleeding" },
|
||||||
|
{ "url" : "css/press-this.css?version=2.6-bleeding" },
|
||||||
{ "url" : "css/theme-editor-rtl.css?version=2.6-bleeding" },
|
{ "url" : "css/theme-editor-rtl.css?version=2.6-bleeding" },
|
||||||
{ "url" : "css/theme-editor.css?version=2.6-bleeding" },
|
{ "url" : "css/theme-editor.css?version=2.6-bleeding" },
|
||||||
{ "url" : "css/upload-rtl.css?version=2.6-bleeding" },
|
{ "url" : "css/upload-rtl.css?version=2.6-bleeding" },
|
||||||
|
@ -167,34 +167,20 @@ function media_buttons() {
|
|||||||
$audio_title = __('Add Audio');
|
$audio_title = __('Add Audio');
|
||||||
$out = <<<EOF
|
$out = <<<EOF
|
||||||
|
|
||||||
<a href="{$image_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
|
<a href="{$image_upload_iframe_src}&TB_iframe=true" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
|
||||||
<a href="{$video_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
|
<a href="{$video_upload_iframe_src}&TB_iframe=true" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
|
||||||
<a href="{$audio_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
|
<a href="{$audio_upload_iframe_src}&TB_iframe=true" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
|
||||||
<a href="{$media_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
|
<a href="{$media_upload_iframe_src}&TB_iframe=true" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
|
||||||
|
|
||||||
EOF;
|
EOF;
|
||||||
printf($context, $out);
|
printf($context, $out);
|
||||||
}
|
}
|
||||||
add_action( 'media_buttons', 'media_buttons' );
|
add_action( 'media_buttons', 'media_buttons' );
|
||||||
|
|
||||||
function media_buttons_head() {
|
add_action( 'admin_print_scripts-post-new.php', 'add_thickbox' );
|
||||||
$siteurl = get_option('siteurl');
|
add_action( 'admin_print_scripts-post.php', 'add_thickbox' );
|
||||||
echo "<style type='text/css' media='all'>
|
add_action( 'admin_print_scripts-page-new.php', 'add_thickbox' );
|
||||||
@import '{$siteurl}/wp-includes/js/thickbox/thickbox.css?ver=20080430';
|
add_action( 'admin_print_scripts-page.php', 'add_thickbox' );
|
||||||
div#TB_title {
|
|
||||||
background-color: #222222;
|
|
||||||
color: #cfcfcf;
|
|
||||||
}
|
|
||||||
div#TB_title a, div#TB_title a:visited {
|
|
||||||
color: #cfcfcf;
|
|
||||||
}
|
|
||||||
#TB_window {
|
|
||||||
top: 20px;
|
|
||||||
}
|
|
||||||
</style>\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
add_action( 'admin_print_scripts', 'media_buttons_head' );
|
|
||||||
|
|
||||||
function media_admin_css() {
|
function media_admin_css() {
|
||||||
wp_admin_css('css/media');
|
wp_admin_css('css/media');
|
||||||
|
@ -21,7 +21,10 @@ jQuery(function($) {
|
|||||||
if ( tbWindow.size() ) {
|
if ( tbWindow.size() ) {
|
||||||
tbWindow.width( W - 50 ).height( H - 45 );
|
tbWindow.width( W - 50 ).height( H - 45 );
|
||||||
$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
|
$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
|
||||||
tbWindow.css({marginLeft: '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
|
tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px','top':'20px','margin-top':'0'});
|
||||||
|
$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
|
||||||
|
if ( $.browser.msie && $.browser.version.substr(0,1) < 7 )
|
||||||
|
tbWindow.css({'margin-top':document.documentElement.scrollTop+'px'});
|
||||||
};
|
};
|
||||||
|
|
||||||
return $('a.thickbox').each( function() {
|
return $('a.thickbox').each( function() {
|
||||||
|
44
wp-admin/js/theme-preview.js
Normal file
44
wp-admin/js/theme-preview.js
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
jQuery(function($) {
|
||||||
|
if ( 'undefined' == typeof $.fn.pngFix )
|
||||||
|
$.fn.pngFix = function() { return this; }
|
||||||
|
|
||||||
|
var thickDims = function() {
|
||||||
|
var tbWindow = $('#TB_window');
|
||||||
|
var H = $(window).height();
|
||||||
|
var W = $(window).width();
|
||||||
|
|
||||||
|
if ( tbWindow.size() ) {
|
||||||
|
tbWindow.width( W - 100 ).height( H - 60 );
|
||||||
|
$('#TB_iframeContent').width( W - 100 ).height( H - 90 );
|
||||||
|
tbWindow.css({'margin-left': '-' + parseInt((( W - 100 ) / 2),10) + 'px','top':'30px','margin-top':'0'});
|
||||||
|
if ( $.browser.msie && $.browser.version.substr(0,1) < 7 )
|
||||||
|
tbWindow.css({'margin-top':document.documentElement.scrollTop+'px'});
|
||||||
|
};
|
||||||
|
|
||||||
|
return $('a.thickbox').each( function() {
|
||||||
|
var href = $(this).parents('.available-theme').find('.previewlink').attr('href');
|
||||||
|
if ( ! href ) return;
|
||||||
|
href = href.replace(/&width=[0-9]+/g, '');
|
||||||
|
href = href.replace(/&height=[0-9]+/g, '');
|
||||||
|
$(this).attr( 'href', href + '&width=' + ( W - 100 ) + '&height=' + ( H - 100 ) );
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
thickDims()
|
||||||
|
.click( function() {
|
||||||
|
var alink = $(this).parents('.available-theme').find('.activatelink');
|
||||||
|
var url = alink.attr('href');
|
||||||
|
var text = alink.html();
|
||||||
|
|
||||||
|
$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
|
||||||
|
$('#TB_closeAjaxWindow').css({'float':'left'});
|
||||||
|
$('#TB_ajaxWindowTitle').css({'float':'right'})
|
||||||
|
.append(' <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>');
|
||||||
|
|
||||||
|
$('#TB_iframeContent').width('100%');
|
||||||
|
return false;
|
||||||
|
} );
|
||||||
|
|
||||||
|
$(window).resize( function() { thickDims() } );
|
||||||
|
});
|
@ -13,7 +13,6 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
|
|||||||
|
|
||||||
wp_enqueue_script('link');
|
wp_enqueue_script('link');
|
||||||
wp_enqueue_script('xfn');
|
wp_enqueue_script('xfn');
|
||||||
wp_enqueue_script('thickbox');
|
|
||||||
|
|
||||||
require('admin-header.php');
|
require('admin-header.php');
|
||||||
?>
|
?>
|
||||||
|
@ -85,7 +85,6 @@ switch ($action) {
|
|||||||
case 'edit' :
|
case 'edit' :
|
||||||
wp_enqueue_script('link');
|
wp_enqueue_script('link');
|
||||||
wp_enqueue_script('xfn');
|
wp_enqueue_script('xfn');
|
||||||
wp_enqueue_script('thickbox');
|
|
||||||
|
|
||||||
$parent_file = 'edit.php';
|
$parent_file = 'edit.php';
|
||||||
$submenu_file = 'link-manager.php';
|
$submenu_file = 'link-manager.php';
|
||||||
|
@ -7,7 +7,6 @@ wp_enqueue_script('autosave');
|
|||||||
wp_enqueue_script('page');
|
wp_enqueue_script('page');
|
||||||
if ( user_can_richedit() )
|
if ( user_can_richedit() )
|
||||||
wp_enqueue_script('editor');
|
wp_enqueue_script('editor');
|
||||||
wp_enqueue_script('thickbox');
|
|
||||||
wp_enqueue_script('media-upload');
|
wp_enqueue_script('media-upload');
|
||||||
wp_enqueue_script('word-count');
|
wp_enqueue_script('word-count');
|
||||||
|
|
||||||
|
@ -81,7 +81,6 @@ case 'edit':
|
|||||||
wp_enqueue_script('page');
|
wp_enqueue_script('page');
|
||||||
if ( user_can_richedit() )
|
if ( user_can_richedit() )
|
||||||
wp_enqueue_script('editor');
|
wp_enqueue_script('editor');
|
||||||
wp_enqueue_script('thickbox');
|
|
||||||
wp_enqueue_script('media-upload');
|
wp_enqueue_script('media-upload');
|
||||||
wp_enqueue_script('word-count');
|
wp_enqueue_script('word-count');
|
||||||
|
|
||||||
|
@ -7,7 +7,6 @@ wp_enqueue_script('autosave');
|
|||||||
wp_enqueue_script('post');
|
wp_enqueue_script('post');
|
||||||
if ( user_can_richedit() )
|
if ( user_can_richedit() )
|
||||||
wp_enqueue_script('editor');
|
wp_enqueue_script('editor');
|
||||||
wp_enqueue_script('thickbox');
|
|
||||||
wp_enqueue_script('media-upload');
|
wp_enqueue_script('media-upload');
|
||||||
wp_enqueue_script('word-count');
|
wp_enqueue_script('word-count');
|
||||||
|
|
||||||
|
@ -88,7 +88,6 @@ case 'edit':
|
|||||||
wp_enqueue_script('post');
|
wp_enqueue_script('post');
|
||||||
if ( user_can_richedit() )
|
if ( user_can_richedit() )
|
||||||
wp_enqueue_script('editor');
|
wp_enqueue_script('editor');
|
||||||
wp_enqueue_script('thickbox');
|
|
||||||
wp_enqueue_script('media-upload');
|
wp_enqueue_script('media-upload');
|
||||||
wp_enqueue_script('word-count');
|
wp_enqueue_script('word-count');
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ if ( empty($_GET['tab']) ) {
|
|||||||
<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script>
|
<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script>
|
||||||
<?php
|
<?php
|
||||||
wp_enqueue_script('jquery-ui-tabs');
|
wp_enqueue_script('jquery-ui-tabs');
|
||||||
wp_enqueue_script('thickbox');
|
add_thickbox();
|
||||||
wp_enqueue_script('post');
|
wp_enqueue_script('post');
|
||||||
do_action('admin_print_scripts');
|
do_action('admin_print_scripts');
|
||||||
do_action('admin_head');
|
do_action('admin_head');
|
||||||
|
@ -13,6 +13,10 @@ if ( isset($_GET['action']) ) {
|
|||||||
|
|
||||||
$title = __('Manage Themes');
|
$title = __('Manage Themes');
|
||||||
$parent_file = 'themes.php';
|
$parent_file = 'themes.php';
|
||||||
|
|
||||||
|
add_thickbox();
|
||||||
|
wp_enqueue_script( 'theme-preview' );
|
||||||
|
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@ -29,12 +33,12 @@ $ct = current_theme_info();
|
|||||||
|
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h2><?php _e('Current Theme'); ?></h2>
|
<h2><?php _e('Current Theme'); ?></h2>
|
||||||
<div id="currenttheme">
|
<div id="current-theme">
|
||||||
<?php if ( $ct->screenshot ) : ?>
|
<?php if ( $ct->screenshot ) : ?>
|
||||||
<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
|
<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<h3><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h3>
|
<h3><?php printf(_c('%1$s %2$s by %3$s|1: theme title, 2: theme version, 3: theme author'), $ct->title, $ct->version, $ct->author) ; ?></h3>
|
||||||
<p><?php echo $ct->description; ?></p>
|
<p class="description"><?php echo $ct->description; ?></p>
|
||||||
<?php if ($ct->parent_theme) { ?>
|
<?php if ($ct->parent_theme) { ?>
|
||||||
<p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
|
<p><?php printf(__('The template files are located in <code>%2$s</code>. The stylesheet files are located in <code>%3$s</code>. <strong>%4$s</strong> uses templates from <strong>%5$s</strong>. Changes made to the templates will affect both themes.'), $ct->title, $ct->template_dir, $ct->stylesheet_dir, $ct->title, $ct->parent_theme); ?></p>
|
||||||
<?php } else { ?>
|
<?php } else { ?>
|
||||||
@ -47,16 +51,31 @@ $ct = current_theme_info();
|
|||||||
|
|
||||||
<h2><?php _e('Available Themes'); ?></h2>
|
<h2><?php _e('Available Themes'); ?></h2>
|
||||||
<?php if ( 1 < count($themes) ) { ?>
|
<?php if ( 1 < count($themes) ) { ?>
|
||||||
|
<table id="availablethemes" cellspacing="0" cellpadding="0">
|
||||||
<?php
|
<?php
|
||||||
$style = '';
|
$style = '';
|
||||||
|
|
||||||
$theme_names = array_keys($themes);
|
$theme_names = array_keys($themes);
|
||||||
natcasesort($theme_names);
|
natcasesort($theme_names);
|
||||||
|
|
||||||
foreach ($theme_names as $theme_name) {
|
$rows = ceil(count($theme_names) / 3);
|
||||||
if ( $theme_name == $ct->name )
|
for ( $row = 1; $row <= $rows; $row++ )
|
||||||
continue;
|
for ( $col = 1; $col <= 3; $col++ )
|
||||||
|
$table[$row][$col] = array_shift($theme_names);
|
||||||
|
|
||||||
|
foreach ( $table as $row => $cols ) {
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<?php
|
||||||
|
foreach ( $cols as $col => $theme_name ) {
|
||||||
|
$class = array('available-theme');
|
||||||
|
if ( $row == 1 ) $class[] = 'top';
|
||||||
|
if ( $col == 1 ) $class[] = 'left';
|
||||||
|
if ( $row == $rows ) $class[] = 'bottom';
|
||||||
|
if ( $col == 3 ) $class[] = 'right';
|
||||||
|
?>
|
||||||
|
<td class="<?php echo join(' ', $class); ?>">
|
||||||
|
<?php if ( !empty($theme_name) ) :
|
||||||
$template = $themes[$theme_name]['Template'];
|
$template = $themes[$theme_name]['Template'];
|
||||||
$stylesheet = $themes[$theme_name]['Stylesheet'];
|
$stylesheet = $themes[$theme_name]['Stylesheet'];
|
||||||
$title = $themes[$theme_name]['Title'];
|
$title = $themes[$theme_name]['Title'];
|
||||||
@ -65,25 +84,32 @@ foreach ($theme_names as $theme_name) {
|
|||||||
$author = $themes[$theme_name]['Author'];
|
$author = $themes[$theme_name]['Author'];
|
||||||
$screenshot = $themes[$theme_name]['Screenshot'];
|
$screenshot = $themes[$theme_name]['Screenshot'];
|
||||||
$stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
|
$stylesheet_dir = $themes[$theme_name]['Stylesheet Dir'];
|
||||||
|
$preview_link = clean_url( get_option('home') . '/');
|
||||||
|
$preview_link = add_query_arg( array('preview' => 1, 'template' => $template, 'stylesheet' => $stylesheet, 'TB_iframe' => 'true', 'width' => 600, 'height' => 400 ), $preview_link );
|
||||||
|
$preview_text = attribute_escape( sprintf( __('Preview of "%s"'), $title ) );
|
||||||
$tags = $themes[$theme_name]['Tags'];
|
$tags = $themes[$theme_name]['Tags'];
|
||||||
|
$thickbox_class = 'thickbox';
|
||||||
$activate_link = wp_nonce_url("themes.php?action=activate&template=".urlencode($template)."&stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
|
$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 ) );
|
||||||
?>
|
?>
|
||||||
<div class="available-theme">
|
<a href="<?php echo $activate_link; ?>" class="<?php echo $thickbox_class; ?> screenshot">
|
||||||
<h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
|
|
||||||
|
|
||||||
<a href="<?php echo $activate_link; ?>" class="screenshot">
|
|
||||||
<?php if ( $screenshot ) : ?>
|
<?php if ( $screenshot ) : ?>
|
||||||
<img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
|
<img src="<?php echo ( $tpage == 'stage' ) ? $screenshot : get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</a>
|
</a>
|
||||||
|
<h3><a class="<?php echo $thickbox_class; ?>" href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
|
||||||
<p><?php echo $description; ?></p>
|
<p><?php echo $description; ?></p>
|
||||||
<?php if ( $tags ) : ?>
|
<?php if ( $tags ) : ?>
|
||||||
<p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
|
<p><?php _e('Tags:'); ?> <?php echo join(', ', $tags); ?></p>
|
||||||
|
<noscript><p class="themeactions"><a href="<?php echo $preview_link; ?>" title="<?php echo $preview_text; ?>"><?php _e('Preview'); ?></a> <a href="<?php echo $activate_link; ?>" title="<?php echo $activate_text; ?>"><?php _e('Activate'); ?></a></p></noscript>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
<div style="display:none;"><a class="previewlink" href="<?php echo $preview_link; ?>"><?php echo $preview_text; ?></a> <a class="activatelink" href="<?php echo $activate_link; ?>"><?php echo $activate_text; ?></a></div>
|
||||||
<?php } // end foreach theme_names ?>
|
<?php endif; // end if not empty theme_name ?>
|
||||||
|
</td>
|
||||||
|
<?php } // end foreach $cols ?>
|
||||||
|
</tr>
|
||||||
|
<?php } // end foreach $table ?>
|
||||||
|
</table>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
@ -52,28 +52,90 @@ form#upload #post_content {
|
|||||||
margin: 10px 20px 10px 20px;
|
margin: 10px 20px 10px 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.available-theme {
|
table#availablethemes {
|
||||||
width: 30%;
|
border-spacing: 0px;
|
||||||
margin: 0 1em;
|
border: none;
|
||||||
float: left;
|
border-top: 1px solid #ccc;
|
||||||
text-align: center;
|
border-bottom: 1px solid #ccc;
|
||||||
height: 28em;
|
margin: 10px auto;
|
||||||
overflow: hidden;
|
}
|
||||||
|
td.available-theme {
|
||||||
|
vertical-align: top;
|
||||||
|
width: 240px;
|
||||||
|
margin: 0;
|
||||||
|
padding: 20px;
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
table#availablethemes td {
|
||||||
|
border: 1px solid #eee;
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
table#availablethemes td.top {
|
||||||
|
border-top: none;
|
||||||
|
}
|
||||||
|
table#availablethemes td.right {
|
||||||
|
border-right: none;
|
||||||
|
border-left: none;
|
||||||
|
}
|
||||||
|
table#availablethemes td.bottom {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
table#availablethemes td.left {
|
||||||
|
border-right: none;
|
||||||
|
border-left: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.available-theme a.screenshot {
|
.available-theme a.screenshot {
|
||||||
width: 250px;
|
width: 240px;
|
||||||
height: 200px;
|
height: 180px;
|
||||||
display: block;
|
display: block;
|
||||||
margin: auto;
|
border: 1px solid #efefef;
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
border-width: 1px;
|
}
|
||||||
border-style: solid;
|
.available-theme img {
|
||||||
|
width: 240px;
|
||||||
|
}
|
||||||
|
.available-theme h3 {
|
||||||
|
margin: 15px 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.available-theme img {
|
#current-theme {
|
||||||
width: 100%;
|
margin-top: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#current-theme a {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#current-theme h3 {
|
||||||
|
font-size: 17px;
|
||||||
|
font-weight: normal;
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#current-theme .description {
|
||||||
|
margin-top: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#current-theme img {
|
||||||
|
float: left;
|
||||||
|
border: 1px solid #666;
|
||||||
|
margin-right: 1em;
|
||||||
|
margin-bottom: 1.5em;
|
||||||
|
width: 150px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#TB_window #TB_title a.tb-theme-preview-link,
|
||||||
|
#TB_window #TB_title a.tb-theme-preview-link:visited {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #999;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
#TB_window #TB_title a.tb-theme-preview-link:hover,
|
||||||
|
#TB_window #TB_title a.tb-theme-preview-link:focus {
|
||||||
|
color: #ccc;
|
||||||
}
|
}
|
||||||
|
|
||||||
.checkbox {
|
.checkbox {
|
||||||
@ -249,15 +311,6 @@ textarea.all-options, input.all-options {
|
|||||||
border-collapse: separate;
|
border-collapse: separate;
|
||||||
}
|
}
|
||||||
|
|
||||||
#currenttheme img {
|
|
||||||
float: left;
|
|
||||||
margin-right: 1em;
|
|
||||||
margin-bottom: 1.5em;
|
|
||||||
width: 300px;
|
|
||||||
border-width: 1px;
|
|
||||||
border-style: solid;
|
|
||||||
}
|
|
||||||
|
|
||||||
#quicktags {
|
#quicktags {
|
||||||
padding: 0;
|
padding: 0;
|
||||||
border: 0 none;
|
border: 0 none;
|
||||||
|
@ -1139,6 +1139,8 @@ function wp_admin_css_uri( $file = 'wp-admin' ) {
|
|||||||
$color = $_wp_admin_css_colors[$color];
|
$color = $_wp_admin_css_colors[$color];
|
||||||
$_file = $color->url;
|
$_file = $color->url;
|
||||||
$_file = ('css/colors-rtl' == $file) ? str_replace('.css','-rtl.css',$_file) : $_file;
|
$_file = ('css/colors-rtl' == $file) ? str_replace('.css','-rtl.css',$_file) : $_file;
|
||||||
|
} elseif ( 'css/thickbox' == $file ) {
|
||||||
|
$_file = get_option( 'siteurl' ) . "/wp-includes/js/thickbox/thickbox.css";
|
||||||
} else {
|
} else {
|
||||||
$_file = get_option( 'siteurl' ) . "/wp-admin/$file.css";
|
$_file = get_option( 'siteurl' ) . "/wp-admin/$file.css";
|
||||||
}
|
}
|
||||||
@ -1157,6 +1159,15 @@ function wp_admin_css( $file = 'wp-admin' ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function add_thickbox() {
|
||||||
|
wp_enqueue_script( 'thickbox' );
|
||||||
|
add_action( 'admin_print_scripts', 'add_thickbox_css' );
|
||||||
|
}
|
||||||
|
|
||||||
|
function add_thickbox_css() {
|
||||||
|
wp_admin_css( 'css/thickbox' );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the XHTML generator that is generated on the wp_head hook.
|
* Outputs the XHTML generator that is generated on the wp_head hook.
|
||||||
*/
|
*/
|
||||||
|
@ -45,17 +45,19 @@
|
|||||||
|
|
||||||
#TB_window {
|
#TB_window {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
|
background: #ffffff;
|
||||||
z-index: 102;
|
z-index: 102;
|
||||||
color:#000000;
|
color:#000000;
|
||||||
display:none;
|
display:none;
|
||||||
|
border: 4px solid #525252;
|
||||||
text-align:left;
|
text-align:left;
|
||||||
top:20px;
|
top:50%;
|
||||||
left:50%;
|
left:50%;
|
||||||
}
|
}
|
||||||
|
|
||||||
* html #TB_window { /* ie6 hack */
|
* html #TB_window { /* ie6 hack */
|
||||||
position: absolute;
|
position: absolute;
|
||||||
margin-top: expression(20) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
|
margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px');
|
||||||
}
|
}
|
||||||
|
|
||||||
#TB_window img#TB_Image {
|
#TB_window img#TB_Image {
|
||||||
@ -80,24 +82,19 @@ margin-top: expression(20) + (TBWindowMargin = document.documentElement && docum
|
|||||||
}
|
}
|
||||||
|
|
||||||
#TB_closeAjaxWindow{
|
#TB_closeAjaxWindow{
|
||||||
padding:7px 10px 5px 0;
|
padding:6px 10px 0;
|
||||||
margin-bottom:1px;
|
|
||||||
text-align:right;
|
text-align:right;
|
||||||
float:right;
|
float:right;
|
||||||
}
|
}
|
||||||
|
|
||||||
#TB_ajaxWindowTitle{
|
#TB_ajaxWindowTitle{
|
||||||
float:left;
|
float:left;
|
||||||
padding:7px 0 5px 10px;
|
padding:6px 10px 0;
|
||||||
margin-bottom:1px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#TB_title{
|
#TB_title{
|
||||||
background-color:#e8e8e8;
|
background-color:#e8e8e8;
|
||||||
height:27px;
|
height:27px;
|
||||||
border-width: 4px;
|
|
||||||
border-color: #525252;
|
|
||||||
border-style: solid solid none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#TB_ajaxContent{
|
#TB_ajaxContent{
|
||||||
@ -155,6 +152,5 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
|
|||||||
clear:both;
|
clear:both;
|
||||||
border:none;
|
border:none;
|
||||||
margin-bottom:-1px;
|
margin-bottom:-1px;
|
||||||
margin-top:1px;
|
|
||||||
_margin-bottom:1px;
|
_margin-bottom:1px;
|
||||||
}
|
}
|
||||||
|
@ -205,6 +205,8 @@ class WP_Scripts {
|
|||||||
'updateCompleted' => __('Update completed.'),
|
'updateCompleted' => __('Update completed.'),
|
||||||
'error' => __('Error:')
|
'error' => __('Error:')
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'dimensions' ), '20080515' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -479,6 +479,48 @@ function locale_stylesheet() {
|
|||||||
echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
|
echo '<link rel="stylesheet" href="' . $stylesheet . '" type="text/css" media="screen" />';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function preview_theme() {
|
||||||
|
if ( ! (isset($_GET['template']) && isset($_GET['preview'])) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ( !current_user_can( 'switch_themes' ) )
|
||||||
|
return;
|
||||||
|
|
||||||
|
$_GET[template] = preg_replace('|[^a-z0-9]|i', '', $_GET[template]);
|
||||||
|
|
||||||
|
add_filter('template', create_function('', "return '$_GET[template]';") );
|
||||||
|
|
||||||
|
if ( isset($_GET['stylesheet']) ) {
|
||||||
|
$_GET[stylesheet] = preg_replace('|[^a-z0-9]|i', '', $_GET[stylesheet]);
|
||||||
|
add_filter('stylesheet', create_function('', "return '$_GET[stylesheet]';") );
|
||||||
|
}
|
||||||
|
|
||||||
|
ob_start( 'preview_theme_ob_filter' );
|
||||||
|
}
|
||||||
|
add_action('setup_theme', 'preview_theme');
|
||||||
|
|
||||||
|
function preview_theme_ob_filter( $content ) {
|
||||||
|
return preg_replace_callback( "|(<a.*?href=([\"']))(.*?)([\"'].*?>)|", 'preview_theme_ob_filter_callback', $content );
|
||||||
|
}
|
||||||
|
|
||||||
|
function preview_theme_ob_filter_callback( $matches ) {
|
||||||
|
if (
|
||||||
|
( false !== strpos($matches[3], '/wp-admin/') )
|
||||||
|
||
|
||||||
|
( false !== strpos($matches[3], '://') && 0 !== strpos($matches[3], get_option('home')) )
|
||||||
|
||
|
||||||
|
( false !== strpos($matches[3], '/feed/') )
|
||||||
|
||
|
||||||
|
( false !== strpos($matches[3], '/trackback/') )
|
||||||
|
)
|
||||||
|
return $matches[1] . "#$matches[2] onclick=$matches[2]return false;" . $matches[4];
|
||||||
|
|
||||||
|
$link = add_query_arg( array('preview' => 1, 'template' => $_GET['template'], 'stylesheet' => @$_GET['stylesheet'] ), $matches[3] );
|
||||||
|
if ( 0 === strpos($link, 'preview=1') )
|
||||||
|
$link = "?$link";
|
||||||
|
return $matches[1] . attribute_escape( $link ) . $matches[4];
|
||||||
|
}
|
||||||
|
|
||||||
function switch_theme($template, $stylesheet) {
|
function switch_theme($template, $stylesheet) {
|
||||||
update_option('template', $template);
|
update_option('template', $template);
|
||||||
update_option('stylesheet', $stylesheet);
|
update_option('stylesheet', $stylesheet);
|
||||||
|
@ -425,6 +425,7 @@ $wp_rewrite =& new WP_Rewrite();
|
|||||||
*/
|
*/
|
||||||
$wp =& new WP();
|
$wp =& new WP();
|
||||||
|
|
||||||
|
do_action('setup_theme');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Web Path to the current active template directory
|
* Web Path to the current active template directory
|
||||||
|
Loading…
Reference in New Issue
Block a user