示例#1
0
function sm_render_settings()
{
    $left_width = 420;
    $input_width = 420;
    $sm_settings = get_option('sm_settings');
    $detail_start = '<div style="margin-bottom: 5px;">';
    $detail_end = '</div>';
    $track_admin_detail = $detail_start . __('Should the plugin track hits on admin pages?', 'sm') . $detail_end;
    $track_expiry_detail = $detail_start . __('How many days should the data be kept for?', 'sm') . $detail_end;
    $robot_hits_detail = $detail_start . __('If you mark a user/ip address as a robot then should stats from them ever be shown?', 'sm') . $detail_end;
    echo sm_start_box('General Settings');
    echo '	<form method="POST">';
    echo '	<table style="width: 100%;">';
    echo '	<tr>
				<td style="vertical-align: top; width: ' . $left_width . 'px;">
					<div style="margin-bottom: 10px; font-weight: bold;">' . __('Track Admin?', 'sm') . '</div>
					<div style="font-size: 10px;">' . $track_admin_detail . '</div>
				</td>
				<td style="vertical-align: top;">
					<label><input type="radio" name="settings[track_admin]" value="1" ' . ($sm_settings->track_admin ? 'checked="checked"' : '') . ' /> Yes</label><br />
					<label><input type="radio" name="settings[track_admin]" value="0" ' . (!$sm_settings->track_admin ? 'checked="checked"' : '') . ' /> No</label>
				</td>
			</tr>';
    echo '	<tr>
				<td style="vertical-align: top; width: ' . $left_width . 'px;">
					<div style="margin-bottom: 10px; font-weight: bold;">' . __('Data Expiry', 'sm') . '</div>
					<div style="font-size: 10px;">' . $track_expiry_detail . '</div>
				</td>
				<td style="vertical-align: top;">
					<input name="settings[track_expiry]" value="' . $sm_settings->track_expiry / 86400 . '" />
				</td>
			</tr>';
    echo '	<tr>
				<td style="vertical-align: top; width: ' . $left_width . 'px;">
					<div style="margin-bottom: 10px; font-weight: bold;">' . __('Show Robot Hits', 'sm') . '</div>
					<div style="font-size: 10px;">' . $robot_hits_detail . '</div>
				</td>
				<td style="vertical-align: top;">
					<label><input type="radio" name="settings[view_robot_hits]" value="1" ' . ($sm_settings->view_robot_hits ? 'checked="checked"' : '') . ' /> Yes</label><br />
					<label><input type="radio" name="settings[view_robot_hits]" value="0" ' . (!$sm_settings->view_robot_hits ? 'checked="checked"' : '') . ' /> No</label>
				</td>
			</tr>';
    echo '</table>';
    echo '<p class="submit" style="margin-top: 0px; text-align: right;">
			<input type="submit" class="button" name="sm_update_settings" value="' . __('Save settings', 'sm') . '" />
		</p>';
    echo '</form>';
    echo sm_end_box();
    echo sm_start_box('Excluded Pages');
    sm_render_excluded_pages();
    echo sm_end_box();
    echo sm_start_box('Excluded Users');
    sm_render_excluded_users();
    echo sm_end_box();
}
示例#2
0
<?php

echo '<div class="wrap" id="poststuff">';
if (sm_post('exclude_users_button')) {
    sm_save_excluded_users();
} else {
    if (sm_post('delete_userdata')) {
        sm_delete_userdata();
    }
}
echo '<form method="POST">';
echo sm_start_box('Session Manager - All Sessions by User');
sm_show_all_sessions();
echo sm_end_box();
echo sm_start_box('Actions');
sm_render_actions('by_user');
echo sm_end_box();
echo '</form>';
echo '</div>';
示例#3
0
<?php

echo '<div class="wrap" id="poststuff">';
echo sm_start_box('Session Manager');
$home_url = get_option('siteurl');
$hits = sm_get_num_hits();
$dates = sm_get_hit_dates();
$start_date = $dates->start_date;
$end_date = $dates->end_date;
$date_format = get_option('date_format');
$intro = '
<p><strong>Welcome to the Wordpress Session Manager by <a href="http://www.newmedias.co.uk" target="_blank">CNMS</a></strong>.</p>
<p>This lightweight yet informative plugin simply logs pages viewed by all site visitors in the last day (by default although this is configurable) and then allows you, the admin, to view the actions per user or per page. This will give you a good idea of the more popular pages on your site allowing you to optimise the site a little more.</p>
<p>Use the tabs down the left menu (WP2.7+) or along the top (<= WP 2.6) to get to the data pages. The navigation is also available below:</p>
<p>
	<ul style="list-style-type: square !important; margin-left: 20px; font-size: 11px;">
		<li><a href="' . $home_url . '/wp-admin/admin.php?page=sm_all_sessions">Hits By Page</a></li>
		<li><a href="' . $home_url . '/wp-admin/admin.php?page=sm_all_by_user">Hits By User</a></li>
		<li><a href="' . $home_url . '/wp-admin/admin.php?page=sm_all_data">Recent Hits</a></li>
		<li><a href="' . $home_url . '/wp-admin/admin.php?page=sm_settings">Settings</a></li>
	</ul>
</p>';
echo '<p>' . __($intro, 'sm') . '</p>';
echo '<p style="font-weight: bold;">' . __('There have been ', 'sm') . $hits . __(' hits between ', 'sm') . date($date_format, $start_date) . __(' and ', 'sm') . date($date_format, $end_date) . '</p>';
if ($hits) {
    if ($top_three = sm_get_top_pages()) {
        echo '<div style="float: left; width: 60%;">';
        echo '<p style="font-style: italic;">' . __('The five post popular pages on your site are:', 'sm') . '</p>';
        echo '<ul style="list-style-type: square !important; margin-left: 20px; font-size: 11px;">';
        foreach ($top_three as $page) {
            $hits = ' ' . ($page->hits == 1 ? 'Hit' : 'Hits') . ' - ';