Files
comic-easel/ceo-debug.php
T
coraislovely-code 74ee11a91d Refuse to run when loaded outside WordPress
None of the plugin's PHP files checked that they were loaded through
WordPress, so requesting one directly executed it with none of core loaded.
The result is a fatal error on the first undefined function, which depending
on the server's display_errors setting discloses the filesystem path and
details of the PHP configuration.

Add the standard guard to every file. Files opening with PHP get it as their
first statement, after the plugin header comment in the main file, which
WordPress parses and which must stay put. The admin page templates that open
with markup get it as a leading one-line block, with no whitespace before it
that would break header output.

Also required by the WordPress.org plugin guidelines.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 14:31:00 -04:00

63 lines
2.1 KiB
PHP

<?php
if (!defined('ABSPATH')) exit;
// Show Config Variables for right now
// var_dump(ceo_pluginfo());
function ceo_check_directory($dirpath) {
$output = '';
if (is_dir(ceo_pluginfo($dirpath))) {
$output = '<span style="color:green;">'.__('Directory Exists,','comiceasel').'</span>';
if (is_writable(ceo_pluginfo($dirpath))) {
$output .= ' <span style="color:green;">'.__('and is writable.','comiceasel').'</span>';
} else {
$output .= ' <span style="color:red;">'.__('and is not writable.','comiceasel').'</span>';
}
} else {
$output = '<span style="color:red;">'.__('Directory does not exist,','comiceasel').'</span>';
}
return $output;
}
?>
<div class="wrap">
<h2><?php _e('Comic Easel - Debug','comiceasel'); ?></h2>
<table class="widefat">
<thead>
<tr>
<th colspan="3"><?php _e('System Info','comiceasel'); ?></th>
</tr>
</thead>
<tr><td>error</td><td><?php echo esc_html(ceo_pluginfo('error')); ?></td></tr>
<tr><td>base_url</td><td><?php echo esc_html(ceo_pluginfo('base_url')); ?></td></tr>
<tr><td>base_path</td><td><?php echo esc_html(ceo_pluginfo('base_path')); ?><br /><?php echo ceo_check_directory('base_path'); ?></td></tr>
<tr><td>theme_url</td><td><?php echo esc_html(ceo_pluginfo('theme_url')); ?></td></tr>
<tr><td>theme_path</td><td><?php echo esc_html(ceo_pluginfo('theme_path')); ?></td></tr>
<tr><td>style_url</td><td><?php echo esc_html(ceo_pluginfo('style_url')); ?></td></tr>
<tr><td>style_path</td><td><?php echo esc_html(ceo_pluginfo('style_path')); ?></td></tr>
<tr><td>plugin_url</td><td><?php echo esc_html(ceo_pluginfo('plugin_url')); ?></td></tr>
<tr><td>plugin_path</td><td><?php echo esc_html(ceo_pluginfo('plugin_path')); ?></td></tr>
</table>
</div>
<br />
<table class="widefat">
<thead>
<tr>
<th colspan = "3">
<?php _e('Variables', 'comiceasel'); ?>
</th>
</tr>
</thead>
<?php
$ceo_options = ceo_pluginfo();
foreach ($ceo_options as $key => $val) {
if (!isset($ceo_options[$key]) || !$val) { $val = 'Empty or False'; }
if ($val == '1') $val = 'True';
?>
<tr>
<td><?php echo esc_html($key); ?></td>
<td><?php echo esc_html($val); ?></td>
</tr>
<?php }
?>
</table>