Example #1
0
/**
 * 
 * @param type $path
 * 
 * Allow a file to download
 */
function debug_file_download($path)
{
    $content = debug_file_read($path);
    header('Content-type: application/octet-stream', true);
    header('Content-Disposition: attachment; filename="' . basename($path) . '"', true);
    header("Pragma: no-cache");
    header("Expires: 0");
    echo $content;
    exit;
}
Example #2
0
    <?php 
if (isset($_POST['clearlog'])) {
    $responce = debug_clearlog();
    ?>
        <div class="<?php 
    echo $responce['class'];
    ?>
 settings-error"> 
            <p><strong><?php 
    echo $responce['message'];
    ?>
</strong></p>
        </div>
        <?php 
}
$content = debug_file_read('wp-content/debug.log');
if ($content !== false) {
    echo '<form method="post" action="">';
    echo '<p style="  float: right;margin-top: -32px;"><input type="submit" name="clearlog" id="clearlog" class="button button-primary" value="' . __('Clear Log', 'debug') . '">';
    echo '&nbsp;&nbsp;<input type="submit" name="downloadlog" id="downloadlog" class="button button-primary" value="' . __('Download Log', 'debug') . '">';
    echo '</p></form>';
    echo '<pre id="debug-log">' . htmlentities($content) . '</pre>';
} else {
    echo '<div class="notice settings-error">';
    echo '<p><strong>' . __('No Log File Found', 'debug') . '</strong></p>';
    echo '</div>';
}
echo debug_footer_link();
?>
</div>