enhancing dashboard widget part I
Dieser Commit ist enthalten in:
Ursprung
c56e4b3ab7
Commit
94c2a44af7
2 geänderte Dateien mit 50 neuen und 17 gelöschten Zeilen
|
@ -129,4 +129,16 @@ table.chartelement {
|
|||
input.regular-text {
|
||||
font-size: 11px;
|
||||
width: 28em;
|
||||
}
|
||||
|
||||
span.rahmen {
|
||||
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||
font-size:12px;
|
||||
font-weight: bold;
|
||||
color: #1172B9;
|
||||
background-color: #E5E5E5;
|
||||
padding: 0 4px 0 4px;
|
||||
border-radius: 1em;
|
||||
-moz-border-radius:4px;
|
||||
-khtml-border-radius:4px;
|
||||
}
|
|
@ -62,11 +62,15 @@ if(is_admin() == true) {
|
|||
|
||||
/**
|
||||
* add CSS
|
||||
*
|
||||
* @uses wp add_action()
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function semmelstatzR_css() {
|
||||
print "<link rel='stylesheet' href='".get_option('siteurl')."/wp-content/plugins/semmelstatzR/semmelstatzR.css' type='text/css' media='screen' />\n";
|
||||
print "<link rel='stylesheet' href='".
|
||||
get_option('siteurl').
|
||||
"/wp-content/plugins/semmelstatzR/semmelstatzR.css' type='text/css' media='screen' />\n";
|
||||
}
|
||||
add_action('admin_head', 'semmelstatzR_css');
|
||||
### End add CSS
|
||||
|
@ -74,13 +78,15 @@ if(is_admin() == true) {
|
|||
/**
|
||||
* add toplevel menu into admin
|
||||
*
|
||||
* @todo localization
|
||||
* @uses wp add_action() admin_menu
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function semmelstatzR_menu() {
|
||||
if (function_exists('add_menu_page')) {
|
||||
add_menu_page('SemmelstatzR','SemmelstatzR', 'manage_statz', 'semmelstatzR/semmelstatzR-statz.php', '', plugins_url('semmelstatzR/img/statz_small.png'));
|
||||
add_menu_page('SemmelstatzR','SemmelstatzR',
|
||||
'manage_statz', 'semmelstatzR/semmelstatzR-statz.php', '',
|
||||
plugins_url('semmelstatzR/img/statz_small.png'));
|
||||
}
|
||||
if (function_exists('add_submenu_page')) {
|
||||
|
||||
|
@ -107,10 +113,10 @@ if(is_admin() == true) {
|
|||
}
|
||||
}
|
||||
add_action('admin_menu', 'semmelstatzR_menu');
|
||||
### end add toplevel adminmenu
|
||||
|
||||
// include context help system
|
||||
include SEMMELSTATZR_SRVPATH."includes/help/start.php";
|
||||
### end add toplevel adminmenu
|
||||
|
||||
|
||||
|
||||
/**
|
||||
|
@ -162,7 +168,6 @@ if(is_admin() == true) {
|
|||
|
||||
|
||||
### Anlegen der Tabellen, Optionen schreiben
|
||||
add_action('activate_semmelstatzR/semmelstatzR.php', 'sem_statzsetup');
|
||||
function sem_statzsetup() {
|
||||
global $wpdb;
|
||||
if(@is_file(ABSPATH.'/wp-admin/upgrade-functions.php')) {
|
||||
|
@ -211,6 +216,7 @@ function sem_statzsetup() {
|
|||
$role->add_cap('manage_statz');
|
||||
}
|
||||
}
|
||||
add_action('activate_semmelstatzR/semmelstatzR.php', 'sem_statzsetup');
|
||||
|
||||
### Zugriff analysieren und in statz-Tabelle schreiben
|
||||
add_action('wp_footer', 'sem_writeStatz');
|
||||
|
@ -275,33 +281,48 @@ $wpdb->query("INSERT INTO $wpdb->statz (ip, time, referer, page, username)
|
|||
### Rendert eine Mini-STATZ. Idee: René Tauchnitz
|
||||
function sem_dashboardStatz_show() {
|
||||
|
||||
$widgets = get_option( 'dashboard_widget_options' );
|
||||
$widget_options = get_option( 'dashboard_widget_options' );
|
||||
|
||||
echo '<p>';
|
||||
printf(_n("%d Visitor online", "%d Visitors online", sem_showNumUsersOnline(), "semmelstatzR"), sem_showNumUsersOnline());
|
||||
printf(semr_i18np("%d Visitor online", "%d Visitors online", sem_showNumUsersOnline()), sem_showNumUsersOnline());
|
||||
echo ' - ';
|
||||
printf(__("Today: %s", "semmelstatzR"),sem_showTodayStatz());
|
||||
echo ' <a title="'.__("more...", "semmelstatzR").'" href="'.get_option('siteurl').'/wp-admin/admin.php?page=semmelstatzR/semmelstatzR-statz.php">»»</a>';
|
||||
printf(semr_i18n("Today: %s"),sem_showTodayStatz());
|
||||
echo ' <a title="'.semr_i18n("more...").'" href="'.get_option('siteurl')
|
||||
.'/wp-admin/admin.php?page=semmelstatzR/semmelstatzR-statz.php">»»</a>';
|
||||
echo '</p>';
|
||||
echo '<p style="line-height: 2.0em;">';
|
||||
printf(semr_i18n("This blog is online since %s that are %s days.<br>"),
|
||||
'<span class="rahmen">'.sem_showFirstPostDate()."</span>",
|
||||
'<span class="rahmen">'.sem_showPostDays()."</span>");
|
||||
printf(semr_i18n("SemmelstatzR collects the statistics since %s."),
|
||||
'<span class="rahmen">'.sem_showStatzStartDate()."</span>");
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
function sem_dashboardStatz_control() {
|
||||
if ( !$widget_options = get_option( 'dashboard_widget_options' ) )
|
||||
if (!$widget_options = get_option('dashboard_widget_options'))
|
||||
$widget_options = array();
|
||||
|
||||
if ( !isset($widget_options['dashboard_sem_dashboardStatz']) )
|
||||
if (!isset($widget_options['dashboard_sem_dashboardStatz']))
|
||||
$widget_options['dashboard_sem_dashboardStatz'] = array();
|
||||
|
||||
if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['dashboard-sem-dashboardStatz']) ) {
|
||||
if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['dashboard-sem-dashboardStatz'])) {
|
||||
$number = absint( $_POST['dashboard-sem-dashboardStatz']['items'] );
|
||||
$number = ($number > 20)?20:$number;
|
||||
$widget_options['dashboard_sem_dashboardStatz']['items'] = $number;
|
||||
$widget_options['dashboard_sem_dashboardStatz']['showinfo'] =
|
||||
($_POST['dashboard-sem-dashboardStatz']['showinfo'] == true)?true:false;
|
||||
update_option( 'dashboard_widget_options', $widget_options );
|
||||
}
|
||||
|
||||
$number = isset( $widget_options['dashboard_sem_dashboardStatz']['items'] ) ? (int) $widget_options['dashboard_sem_dashboardStatz']['items'] : '';
|
||||
|
||||
echo '<p><label for="sem-number">' . semr_i18n('Number of Items (max. 10):') . '</label>';
|
||||
echo '<input id="sem-number" name="dashboard-sem-dashboardStatz[items]" type="text" value="' . $number . '" size="3" /></p>';
|
||||
$number = isset( $widget_options['dashboard_sem_dashboardStatz']['items'] )?
|
||||
(int) $widget_options['dashboard_sem_dashboardStatz']['items'] : '';
|
||||
$checked = isset($widget_options['dashboard_sem_dashboardStatz']['showinfo'])?'checked="checked"':'';
|
||||
|
||||
echo '<p><label for="sem-info">' . semr_i18n('Show semR Info:').'</label>';
|
||||
echo '<input id="sem-ninfo" name="dashboard-sem-dashboardStatz[showinfo]" type="checkbox" value="true"'.$checked.' /></p>';
|
||||
echo '<p><label for="sem-number">' . semr_i18n('Number of Items (max. 10):') . '</label>';
|
||||
echo '<input id="sem-number" name="dashboard-sem-dashboardStatz[items]" type="text" value="'.$number.'" size="3" /></p>';
|
||||
|
||||
//print_r($widget_options['dashboard_sem_dashboardStatz']);
|
||||
}
|
||||
|
|
Laden …
In neuem Issue referenzieren