reworking of comicpress-debug for data-driven messages, probably broken and needing cleaning

This commit is contained in:
John Bintz 2009-12-11 10:54:09 -05:00
parent 96110d138a
commit d86588fc3a
1 changed files with 31 additions and 10 deletions

View File

@ -2,20 +2,42 @@
function comicpress_notice_debug() { function comicpress_notice_debug() {
global $current_user, $comiccat, $blogcat; global $current_user, $comiccat, $blogcat;
if( substr( $_SERVER[ 'PHP_SELF' ], -19 ) != '/wp-admin/index.php' ) if( strpos( $_SERVER[ 'PHP_SELF' ], -'/wp-admin/index.php' ) === false )
return; return;
$error = '';
$error = array();
$comicpress_options = comicpress_load_options(); $comicpress_options = comicpress_load_options();
if ($comiccat == $blogcat) $error .= '<h3>The $comiccat is the same as $blogcat.</h3>Installation instructions on how to set the comicpress-options.php settings and comicpress manager settings here, not to mention the __( for language pack.'; if ($comiccat == $blogcat) {
$error[] = array('header', 'The $comiccat is the same as $blogcat.');
$error[] = 'Installation instructions on how to set the comicpress-options.php settings and comicpress manager settings here, not to mention the __( for language pack.';
}
if (!empty($error)) { if (!empty($error)) {
?> ?>
<div class="error"> <div class="error">
<h2>ComicPress Debug</h2> <h2>ComicPress Installation Problems Detected</h2>
ComicPress doesn't seem to be fully installed at this time, check out these messages.<br /> <p>ComicPress doesn't seem to be fully installed at this time, check out these messages:</p>
<br /> <?php
<?php echo $error; ?> foreach ($error as $info) {
<br /> unset($text);
<br /> if (is_array($info)) {
list($type, $text) = $info;
} else {
if (is_string($info)) {
$text = $info;
$type = 'paragraph';
}
}
if (!empty($text) && !empty($type)) {
switch ($type) {
case 'header': echo "<h3>${text}</h3>"; break;
case 'raw': echo $text; break;
default: echo "<p>${text}</p>"; break;
}
}
}
?>
</div> </div>
<?php <?php
} }
@ -23,4 +45,3 @@ function comicpress_notice_debug() {
add_action( 'admin_notices', 'comicpress_notice_debug' ); add_action( 'admin_notices', 'comicpress_notice_debug' );
?>