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:
ryan 2008-05-20 17:19:33 +00:00
parent e9ea1ab0ef
commit bc07ef1efe
21 changed files with 255 additions and 242 deletions

View File

@ -49,12 +49,16 @@ if ( isset($page_hook) )
do_action('admin_print_scripts-' . $page_hook);
else if ( isset($plugin_page) )
do_action('admin_print_scripts-' . $plugin_page);
else if ( isset($pagenow) )
do_action('admin_print_scripts-' . $pagenow);
do_action('admin_print_scripts');
if ( isset($page_hook) )
do_action('admin_head-' . $page_hook);
else if ( isset($plugin_page) )
do_action('admin_head-' . $plugin_page);
else if ( isset($pagenow) )
do_action('admin_head-' . $pagenow);
do_action('admin_head');
?>
</head>

View File

@ -21,7 +21,7 @@ case 'editcomment' :
$title = __('Edit Comment');
wp_enqueue_script('comment');
//wp_enqueue_script('thickbox');
require_once('admin-header.php');
$comment_id = absint( $_GET['c'] );

View File

@ -1,153 +1,3 @@
/* ---------->>> 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 {
font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
}

View File

@ -33,13 +33,13 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' ); // applicatio
?>
{
"betaManifestVersion" : 1,
"version" : "<?php echo $version; ?>_20080511",
"version" : "<?php echo $version; ?>_20080520",
"entries" : [
<?php echo $default_js; ?>
{ "url" : "wp-admin.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.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/media-rtl.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.css?version=2.6-bleeding" },
{ "url" : "css/upload-rtl.css?version=2.6-bleeding" },

View File

@ -167,34 +167,20 @@ function media_buttons() {
$audio_title = __('Add Audio');
$out = <<<EOF
<a href="{$image_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
<a href="{$video_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
<a href="{$audio_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
<a href="{$media_upload_iframe_src}&amp;TB_iframe=true&amp;height=500&amp;width=640" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
<a href="{$image_upload_iframe_src}&amp;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}&amp;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}&amp;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}&amp;TB_iframe=true" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
EOF;
printf($context, $out);
}
add_action( 'media_buttons', 'media_buttons' );
function media_buttons_head() {
$siteurl = get_option('siteurl');
echo "<style type='text/css' media='all'>
@import '{$siteurl}/wp-includes/js/thickbox/thickbox.css?ver=20080430';
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' );
add_action( 'admin_print_scripts-post-new.php', 'add_thickbox' );
add_action( 'admin_print_scripts-post.php', 'add_thickbox' );
add_action( 'admin_print_scripts-page-new.php', 'add_thickbox' );
add_action( 'admin_print_scripts-page.php', 'add_thickbox' );
function media_admin_css() {
wp_admin_css('css/media');

View File

@ -21,7 +21,10 @@ jQuery(function($) {
if ( tbWindow.size() ) {
tbWindow.width( W - 50 ).height( H - 45 );
$('#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() {

View 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('&nbsp;<a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>');
$('#TB_iframeContent').width('100%');
return false;
} );
$(window).resize( function() { thickDims() } );
});

View File

@ -13,7 +13,6 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
wp_enqueue_script('link');
wp_enqueue_script('xfn');
wp_enqueue_script('thickbox');
require('admin-header.php');
?>

View File

@ -85,7 +85,6 @@ switch ($action) {
case 'edit' :
wp_enqueue_script('link');
wp_enqueue_script('xfn');
wp_enqueue_script('thickbox');
$parent_file = 'edit.php';
$submenu_file = 'link-manager.php';

View File

@ -7,7 +7,6 @@ wp_enqueue_script('autosave');
wp_enqueue_script('page');
if ( user_can_richedit() )
wp_enqueue_script('editor');
wp_enqueue_script('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');

View File

@ -81,7 +81,6 @@ case 'edit':
wp_enqueue_script('page');
if ( user_can_richedit() )
wp_enqueue_script('editor');
wp_enqueue_script('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');

View File

@ -7,7 +7,6 @@ wp_enqueue_script('autosave');
wp_enqueue_script('post');
if ( user_can_richedit() )
wp_enqueue_script('editor');
wp_enqueue_script('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');

View File

@ -88,7 +88,6 @@ case 'edit':
wp_enqueue_script('post');
if ( user_can_richedit() )
wp_enqueue_script('editor');
wp_enqueue_script('thickbox');
wp_enqueue_script('media-upload');
wp_enqueue_script('word-count');

View File

@ -194,7 +194,7 @@ if ( empty($_GET['tab']) ) {
<script type="text/javascript" src="../wp-includes/js/tinymce/tiny_mce.js"></script>
<?php
wp_enqueue_script('jquery-ui-tabs');
wp_enqueue_script('thickbox');
add_thickbox();
wp_enqueue_script('post');
do_action('admin_print_scripts');
do_action('admin_head');

View File

@ -13,6 +13,10 @@ if ( isset($_GET['action']) ) {
$title = __('Manage Themes');
$parent_file = 'themes.php';
add_thickbox();
wp_enqueue_script( 'theme-preview' );
require_once('admin-header.php');
?>
@ -29,12 +33,12 @@ $ct = current_theme_info();
<div class="wrap">
<h2><?php _e('Current Theme'); ?></h2>
<div id="currenttheme">
<div id="current-theme">
<?php if ( $ct->screenshot ) : ?>
<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" />
<?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>
<p><?php echo $ct->description; ?></p>
<p class="description"><?php echo $ct->description; ?></p>
<?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>
<?php } else { ?>
@ -47,16 +51,31 @@ $ct = current_theme_info();
<h2><?php _e('Available Themes'); ?></h2>
<?php if ( 1 < count($themes) ) { ?>
<table id="availablethemes" cellspacing="0" cellpadding="0">
<?php
$style = '';
$theme_names = array_keys($themes);
natcasesort($theme_names);
foreach ($theme_names as $theme_name) {
if ( $theme_name == $ct->name )
continue;
$rows = ceil(count($theme_names) / 3);
for ( $row = 1; $row <= $rows; $row++ )
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'];
$stylesheet = $themes[$theme_name]['Stylesheet'];
$title = $themes[$theme_name]['Title'];
@ -65,25 +84,32 @@ foreach ($theme_names as $theme_name) {
$author = $themes[$theme_name]['Author'];
$screenshot = $themes[$theme_name]['Screenshot'];
$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'];
$thickbox_class = 'thickbox';
$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=".urlencode($template)."&amp;stylesheet=".urlencode($stylesheet), 'switch-theme_' . $template);
$activate_text = attribute_escape( sprintf( __('Activate "%s"'), $title ) );
?>
<div class="available-theme">
<h3><a href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
<a href="<?php echo $activate_link; ?>" class="screenshot">
<a href="<?php echo $activate_link; ?>" class="<?php echo $thickbox_class; ?> 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; ?>
</a>
<h3><a class="<?php echo $thickbox_class; ?>" href="<?php echo $activate_link; ?>"><?php echo $title; ?></a></h3>
<p><?php echo $description; ?></p>
<?php if ( $tags ) : ?>
<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; ?>
</div>
<?php } // end foreach theme_names ?>
<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 endif; // end if not empty theme_name ?>
</td>
<?php } // end foreach $cols ?>
</tr>
<?php } // end foreach $table ?>
</table>
<?php } ?>
<?php

View File

@ -52,28 +52,90 @@ form#upload #post_content {
margin: 10px 20px 10px 20px;
}
.available-theme {
width: 30%;
margin: 0 1em;
float: left;
text-align: center;
height: 28em;
overflow: hidden;
table#availablethemes {
border-spacing: 0px;
border: none;
border-top: 1px solid #ccc;
border-bottom: 1px solid #ccc;
margin: 10px auto;
}
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 {
width: 250px;
height: 200px;
width: 240px;
height: 180px;
display: block;
margin: auto;
border: 1px solid #efefef;
margin-bottom: 10px;
overflow: hidden;
border-width: 1px;
border-style: solid;
}
.available-theme img {
width: 240px;
}
.available-theme h3 {
margin: 15px 0 5px;
}
.available-theme img {
width: 100%;
#current-theme {
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 {
@ -249,15 +311,6 @@ textarea.all-options, input.all-options {
border-collapse: separate;
}
#currenttheme img {
float: left;
margin-right: 1em;
margin-bottom: 1.5em;
width: 300px;
border-width: 1px;
border-style: solid;
}
#quicktags {
padding: 0;
border: 0 none;

View File

@ -1139,6 +1139,8 @@ function wp_admin_css_uri( $file = 'wp-admin' ) {
$color = $_wp_admin_css_colors[$color];
$_file = $color->url;
$_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 {
$_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.
*/

View File

@ -45,17 +45,19 @@
#TB_window {
position: fixed;
background: #ffffff;
z-index: 102;
color:#000000;
display:none;
border: 4px solid #525252;
text-align:left;
top:20px;
top:50%;
left:50%;
}
* html #TB_window { /* ie6 hack */
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 {
@ -80,24 +82,19 @@ margin-top: expression(20) + (TBWindowMargin = document.documentElement && docum
}
#TB_closeAjaxWindow{
padding:7px 10px 5px 0;
margin-bottom:1px;
padding:6px 10px 0;
text-align:right;
float:right;
}
#TB_ajaxWindowTitle{
float:left;
padding:7px 0 5px 10px;
margin-bottom:1px;
padding:6px 10px 0;
}
#TB_title{
background-color:#e8e8e8;
height:27px;
border-width: 4px;
border-color: #525252;
border-style: solid solid none;
}
#TB_ajaxContent{
@ -155,6 +152,5 @@ margin-top: expression(0 - parseInt(this.offsetHeight / 2) + (TBWindowMargin = d
clear:both;
border:none;
margin-bottom:-1px;
margin-top:1px;
_margin-bottom:1px;
}

View File

@ -205,6 +205,8 @@ class WP_Scripts {
'updateCompleted' => __('Update completed.'),
'error' => __('Error:')
));
$this->add( 'theme-preview', '/wp-admin/js/theme-preview.js', array( 'thickbox', 'dimensions' ), '20080515' );
}
}

View File

@ -479,6 +479,48 @@ function locale_stylesheet() {
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) {
update_option('template', $template);
update_option('stylesheet', $stylesheet);

View File

@ -425,6 +425,7 @@ $wp_rewrite =& new WP_Rewrite();
*/
$wp =& new WP();
do_action('setup_theme');
/**
* Web Path to the current active template directory