added yoast debuging theme

This commit is contained in:
Kenneth Reitz
2010-04-07 02:11:05 -04:00
parent 5862f106fb
commit 8f75fe67c4
8 changed files with 252 additions and 0 deletions
Vendored
BIN
View File
Binary file not shown.
@@ -0,0 +1,7 @@
<?php wp_footer(); ?>
<div id="footer">
Debug theme by <a href="http://yoast.com/">Yoast</a>.
</div>
</div>
</body>
</html>
@@ -0,0 +1,28 @@
<?php
function show_constant($constant) {
if (!defined($constant)) {
?> <tr>
<th><?php echo $constant; ?></th>
<td>Not defined</td>
</tr>
<?php
} else {
?> <tr>
<th><?php echo $constant; ?></th>
<td><?php echo constant($constant); ?></td>
</tr>
<?php
}
}
function show_var($desc, $var, $onlytrue = false) {
if ($onlytrue && !$var)
return;
?> <tr>
<th><?php echo $desc; ?></th>
<td><?php var_dump($var); ?></td>
</tr>
<?php
}
?>
@@ -0,0 +1,18 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php wp_head(); ?>
<link rel="stylesheet" href="<?php bloginfo('stylesheet_url'); ?>" type="text/css" media="screen" charset="utf-8"/>
</head>
<body>
<div id="wrapper">
<div id="header">
<h1>Debug theme by Yoast</h1>
</div>
<?php if (!is_home()) { ?>
<div class="box double">
<a href="<?php bloginfo('wpurl'); ?>">Home</a>
</div>
<?php } ?>
@@ -0,0 +1,78 @@
<?php
get_header();
?>
<div class="box">
<h2>Database Constants &amp; Variables</h2>
<table>
<tbody>
<?php
foreach (array('DB_HOST', 'DB_NAME', 'DB_USER', 'DB_PASSWORD','DB_CHARSET','DB_COLLATE') as $const) {
show_constant($const);
}
?>
<tr>
<th>$table_prefix</th>
<td><?php echo $table_prefix; ?></td>
</tr>
</tbody>
</table>
</div>
<div class="box">
<h2>Security Constants</h2>
<table>
<tbody>
<?php
foreach (array('AUTH_KEY', 'SECURE_AUTH_KEY', 'LOGGED_IN_KEY', 'NONCE_KEY') as $const) {
show_constant($const);
}
?>
</tbody>
</table>
<p>Yes <a href="http://codex.wordpress.org/Editing_wp-config.php#Security_Keys">these are needed</a> and they should be unique, generate new ones <a href="https://api.wordpress.org/secret-key/1.1/">here</a>.</p>
</div>
<div class="box">
<h2>Editor settings</h2>
<table>
<tbody>
<?php
foreach (array('AUTOSAVE_INTERVAL', 'WP_POST_REVISIONS') as $const) {
show_constant($const);
}
?>
</tbody>
</table>
</div>
<div class="box">
<h2>Cache and memory</h2>
<table>
<tbody>
<?php
foreach (array('WP_MEMORY_LIMIT', 'WP_CACHE') as $const) {
show_constant($const);
}
?>
</tbody>
</table>
</div>
<br class="clear"/>
<div class="box double">
<h2>URL's and directories</h2>
<table>
<tbody>
<?php
foreach (array('WP_SITEURL', 'WP_HOME', 'WP_CONTENT_DIR', 'WP_CONTENT_URL', 'WP_PLUGIN_DIR', 'WP_PLUGIN_URL', 'PLUGINDIR', 'COOKIE_DOMAIN', 'TEMPLATEPATH', 'STYLESHEETPATH') as $const) {
show_constant($const);
}
?>
</tbody>
</table>
</div>
<?php
get_footer();
?>
@@ -0,0 +1,51 @@
<?php
get_header();
?>
<div class="box double">
<h2>Page type</h2>
<table>
<tbody>
<?php
foreach (array('is_single','is_preview','is_page','is_archive','is_date','is_year','is_month','is_day','is_time','is_author','is_category','is_tag','is_tax','is_search','is_feed','is_comment_feed','is_trackback','is_home','is_404','is_comments_popup','is_admin','is_attachment','is_singular','is_robots','is_posts_page','is_paged') as $is) {
show_var($is, $wp_query->$is, true);
} ?>
</tbody>
</table>
</div>
<div class="box double">
<h2>Query</h2>
<table>
<tbody>
<?php
foreach ($wp_query->query as $var => $val) {
show_var($var, $val, true);
}
if (isset($post_count))
show_var('post_count', $post_count);
if (isset($found_posts))
show_var('found_posts', $found_posts);
?>
</tbody>
</table>
</div>
<div class="box double">
<h2>Query Vars set</h2>
<table>
<tbody>
<?php
foreach ($wp_query->query_vars as $var => $val) {
show_var($var, $val, true);
} ?>
</tbody>
</table>
</div>
<div class="box double">
<h2>SQL Query</h2>
<p><?php echo $wp_query->request ?></p>
</div>
<?php
get_footer();
?>
Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

@@ -0,0 +1,70 @@
/*
Theme Name: Yoast Debug Theme
Theme URI: http://yoast.com/wordpress-debug-theme/
Description: A theme to debug issues with your WordPress install.
Author: Joost de Valk
Author URI: http://yoast.com/
Version: 1.0
*/
body {
font-family: Helvetica;
font-size: 12px;
}
#wrapper {
width: 620px;
margin: 0 auto;
}
#header, #footer {
clear: both;
}
#footer {
border-top: 1px solid #aaa;
color: #aaa;
padding-top: 10px;
background: url(http://netdna.yoast.com/images/yoast-ipod-touch.png) top right no-repeat;
margin-top: 20px;
height: 60px;
}
#footer a {
text-decoration: none;
color: #000;
}
a {
color: orange;
font-weight: bold;
text-decoration: underline;
}
.box {
float: left;
width: 300px;
margin-right: 10px;
margin-bottom: 20px;
}
.box.double {
width: 610px;
clear: both;
}
table {
width: 290px;
margin: 0 auto;
border-top: 1px solid #aaa;
border-bottom: 1px solid #aaa;
}
.box.double table {
width: 600px;
}
th, td {
text-align: left;
font-size: 12px;
}
th {
width: 150px;
}
h2 {
margin-top: 20px;
font-size: 130%;
}
.clear {
clear: both;
}