Пример #1
0
function jh_404_widget()
{
    $log = jh_404_get_log();
    ?>
	
	<table>
		<thead>
			<th class="td-url">URL</th>
			<th class="td-count">Count</th>
			<th class="td-date">Date</th>
			<th class="td-delete"></th>
		</thead>
		<tbody>
			<?php 
    if (!empty($log) && is_array($log)) {
        jh_404_table_body_content($log);
    } else {
        ?>
				<tr><td colspan="4">No 404s, excellent!</td></tr>
			<?php 
    }
    ?>
		</tbody>
	</table>
	
	<p class="actions">
		<a href="#" class="refresh">Refresh</a> | <a href="#" class="delete-all">Delete All</a>
		<span id="jh-404-loading">Loading...</span>
	</p>
	
	<?php 
}
Пример #2
0
<?php

include_once '../../../wp-load.php';
switch ($_POST['action']) {
    case 'delete_url':
        if (!wp_verify_nonce($_POST['nonce'], 'delete_url')) {
            echo 'Nonce Error';
            exit;
        }
        $log = (array) get_option('jh_404_log');
        unset($log[$_POST['url']]);
        update_option('jh_404_log', $log);
        echo 'URL Deleted';
        break;
    case 'delete_all':
        if (!wp_verify_nonce($_POST['nonce'], 'delete_all')) {
            echo 'Nonce Error';
            exit;
        }
        update_option('jh_404_log', array());
        echo 'All URLs Deleted';
        break;
    case 'refresh':
        if (!wp_verify_nonce($_POST['nonce'], 'refresh')) {
            echo 'Nonce Error';
            exit;
        }
        $log = jh_404_get_log();
        jh_404_table_body_content($log);
        break;
}