Dieser Commit ist enthalten in:
Ursprung
808ff10984
Commit
0a403d6417
4 geänderte Dateien mit 220 neuen und 110 gelöschten Zeilen
72
trunk/includes/class.semmelstatzR.php
Normale Datei
72
trunk/includes/class.semmelstatzR.php
Normale Datei
|
@ -0,0 +1,72 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* File: class.semmelstatzR.php
|
||||||
|
*
|
||||||
|
* @package SemmelstatzR
|
||||||
|
* @version $Rev$
|
||||||
|
* @since 2011/11/07 v 1.0.0 Beta
|
||||||
|
* @author SEM-Team
|
||||||
|
* @copyright (c)2011 SEM-Team
|
||||||
|
* @link http://sourceforge.net/projects/semmelstatz/
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
class semmelstatzR {
|
||||||
|
|
||||||
|
protected $_oDb;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @global type $wpdb
|
||||||
|
*/
|
||||||
|
public function __construct() {
|
||||||
|
$this->_initDb();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* public */
|
||||||
|
|
||||||
|
|
||||||
|
/* protected */
|
||||||
|
|
||||||
|
|
||||||
|
/* private */
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @global wpdb $wpdb
|
||||||
|
* @return boolean
|
||||||
|
*/
|
||||||
|
private function _initDb() {
|
||||||
|
global $wpdb;
|
||||||
|
|
||||||
|
if($this->_oDb instanceof $wpdb) {
|
||||||
|
return true;
|
||||||
|
} else if($wpdb instanceof wpdb) {
|
||||||
|
$this->_oDb = $wpdb;
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
|
@ -8,83 +8,88 @@
|
||||||
* @author Andreas 'Redunzl' Mueller
|
* @author Andreas 'Redunzl' Mueller
|
||||||
* @copyright (c)2011 PHP-Backoffice
|
* @copyright (c)2011 PHP-Backoffice
|
||||||
* @copyright (c)2005-2009 kopfhoch-studio
|
* @copyright (c)2005-2009 kopfhoch-studio
|
||||||
* @link http://www.php-backoffice.de/projects/semmelstatzR
|
|
||||||
* @link http://sourceforge.net/projects/semmelstatz/
|
* @link http://sourceforge.net/projects/semmelstatz/
|
||||||
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if(!current_user_can('manage_statz')) {
|
define('SEMMELSTATZR_VERSION', '1.0.0 Beta');
|
||||||
die('Zugriff verweigert');
|
define('SEMMELSTATZR_SRVPATH', dirname(__FILE__));
|
||||||
|
define('SEMMELSTATZR_HTML_RELPATH', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)));
|
||||||
|
|
||||||
|
if(current_user_can('manage_statz')) {
|
||||||
|
|
||||||
|
global $wpdb;
|
||||||
|
$pre = $wpdb->prefix; $lenpre = strlen($pre);
|
||||||
|
$tablesstatus = $wpdb->get_results("SHOW TABLE STATUS");
|
||||||
|
|
||||||
|
print "<div class='wrap'>";
|
||||||
|
print "<div><a name='top'></a></div>";
|
||||||
|
print "<div id='icon-semmelstatzR' class='icon32'><br /></div>";
|
||||||
|
print "<h2>SemmelstatzR › Datenbank</h2>";
|
||||||
|
|
||||||
|
print "<div class='statz'>Datenbank</div>";
|
||||||
|
print "<table class='statzelement'>";
|
||||||
|
print "<tr>";
|
||||||
|
print "<th style='text-align:center;width:6%'>Nr.</th>";
|
||||||
|
print "<th style='text-align:left;width:20%'>Tabellen</th>";
|
||||||
|
print "<th style='text-align:right;width:10%'>Datensätze</th>";
|
||||||
|
print "<th style='text-align:right;width:10%'>Daten</th>";
|
||||||
|
print "<th style='text-align:right;width:10%'>Index</th>";
|
||||||
|
print "<th style='text-align:right;width:10%'>Daten & Index</th>";
|
||||||
|
print "<th style='text-align:right;width:7%'>Überhang</th>";
|
||||||
|
|
||||||
|
foreach($tablesstatus as $key=>$tablestatus) {
|
||||||
|
|
||||||
|
if(substr($tablestatus->Name,0,$lenpre) != $pre) continue;
|
||||||
|
|
||||||
|
print "<tr"; if(1&$key) print " class='alternate'"; print ">";
|
||||||
|
print "<td style='text-align:center;'>".($key+1)."</td>";
|
||||||
|
print "<td style='text-align:left;'>".$tablestatus->Name."</td>";
|
||||||
|
print "<td style='text-align:right;'>".number_format($tablestatus->Rows,0,',','.')."</td>";
|
||||||
|
print "<td style='text-align:right;'>".number_format($tablestatus->Data_length/1024,0,',','.')." kb</td>";
|
||||||
|
print "<td style='text-align:right;'>".number_format($tablestatus->Index_length/1024,0,',','.')." kb</td>";
|
||||||
|
print "<td style='text-align:right;'>".number_format(($tablestatus->Data_length + $tablestatus->Index_length)/1024,0,',','.')." kb</td>";
|
||||||
|
|
||||||
|
if($tablestatus->Data_free > 0) {
|
||||||
|
print "<td style='color:#ff0000;text-align:right;'>";
|
||||||
|
print " ".number_format($tablestatus->Data_free/1024,2,',','.')." kb";
|
||||||
|
print "</td>";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print "<td style='text-align:right;'>--</td>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$row_usage += $tablestatus->Rows;
|
||||||
|
$data_usage += $tablestatus->Data_length;
|
||||||
|
$index_usage += $tablestatus->Index_length;
|
||||||
|
$total_usage += $tablestatus->Data_length + $tablestatus->Index_length;
|
||||||
|
$overhead_usage += $tablestatus->Data_free;
|
||||||
|
echo '</tr>';
|
||||||
|
}
|
||||||
|
|
||||||
|
print "<tr>";
|
||||||
|
print "<th style='text-align:center;'>Gesamt</th>";
|
||||||
|
print "<th style='text-align:left;'> </th>";
|
||||||
|
print "<th style='text-align:right;'>".number_format($row_usage,0,',','.')."</th>";
|
||||||
|
print "<th style='text-align:right;'>".number_format($data_usage/1024,0,',','.')." kb</th>";
|
||||||
|
print "<th style='text-align:right;'>".number_format($index_usage/1024,0,',','.')." kb</th>";
|
||||||
|
print "<th style='text-align:right;'>".number_format($total_usage/1024,0,',','.')." kb</th>";
|
||||||
|
print "<th style='color:#ff0000;text-align:right;'>".number_format($overhead_usage/1024,2,',','.')." kb</th>";
|
||||||
|
print "</tr>";
|
||||||
|
|
||||||
|
print "<tr><td colspan='7'><p align='right'>Es werden ausschließlich die WORDPRESS-Tabellen angezeigt, die zum Blog <b>'".get_option('blogname')."'</b> gehören.</p></td></tr>";
|
||||||
|
|
||||||
|
print "</table>";
|
||||||
|
print "<hr />";
|
||||||
|
|
||||||
|
sem_showCopyright();
|
||||||
|
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
echo '<p>No permission to access this area</p>';
|
||||||
}
|
}
|
||||||
|
|
||||||
global $wpdb;
|
|
||||||
$pre = $wpdb->prefix; $lenpre = strlen($pre);
|
|
||||||
$tablesstatus = $wpdb->get_results("SHOW TABLE STATUS");
|
|
||||||
|
|
||||||
print "<div class='wrap'>";
|
|
||||||
print "<div><a name='top'></a></div>";
|
|
||||||
print "<div id='icon-semmelstatzR' class='icon32'><br /></div>";
|
|
||||||
print "<h2>SemmelstatzR › Datenbank</h2>";
|
|
||||||
|
|
||||||
print "<div class='statz'>Datenbank</div>";
|
|
||||||
print "<table class='statzelement'>";
|
|
||||||
print "<tr>";
|
|
||||||
print "<th style='text-align:center;width:6%'>Nr.</th>";
|
|
||||||
print "<th style='text-align:left;width:20%'>Tabellen</th>";
|
|
||||||
print "<th style='text-align:right;width:10%'>Datensätze</th>";
|
|
||||||
print "<th style='text-align:right;width:10%'>Daten</th>";
|
|
||||||
print "<th style='text-align:right;width:10%'>Index</th>";
|
|
||||||
print "<th style='text-align:right;width:10%'>Daten & Index</th>";
|
|
||||||
print "<th style='text-align:right;width:7%'>Überhang</th>";
|
|
||||||
|
|
||||||
foreach($tablesstatus as $key=>$tablestatus) {
|
|
||||||
|
|
||||||
if(substr($tablestatus->Name,0,$lenpre) != $pre) continue;
|
|
||||||
|
|
||||||
print "<tr"; if(1&$key) print " class='alternate'"; print ">";
|
|
||||||
print "<td style='text-align:center;'>".($key+1)."</td>";
|
|
||||||
print "<td style='text-align:left;'>".$tablestatus->Name."</td>";
|
|
||||||
print "<td style='text-align:right;'>".number_format($tablestatus->Rows,0,',','.')."</td>";
|
|
||||||
print "<td style='text-align:right;'>".number_format($tablestatus->Data_length/1024,0,',','.')." kb</td>";
|
|
||||||
print "<td style='text-align:right;'>".number_format($tablestatus->Index_length/1024,0,',','.')." kb</td>";
|
|
||||||
print "<td style='text-align:right;'>".number_format(($tablestatus->Data_length + $tablestatus->Index_length)/1024,0,',','.')." kb</td>";
|
|
||||||
|
|
||||||
if($tablestatus->Data_free > 0) {
|
|
||||||
print "<td style='color:#ff0000;text-align:right;'>";
|
|
||||||
print " ".number_format($tablestatus->Data_free/1024,2,',','.')." kb";
|
|
||||||
print "</td>";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print "<td style='text-align:right;'>--</td>";
|
|
||||||
}
|
|
||||||
|
|
||||||
$row_usage += $tablestatus->Rows;
|
|
||||||
$data_usage += $tablestatus->Data_length;
|
|
||||||
$index_usage += $tablestatus->Index_length;
|
|
||||||
$total_usage += $tablestatus->Data_length + $tablestatus->Index_length;
|
|
||||||
$overhead_usage += $tablestatus->Data_free;
|
|
||||||
echo '</tr>';
|
|
||||||
}
|
|
||||||
|
|
||||||
print "<tr>";
|
|
||||||
print "<th style='text-align:center;'>Gesamt</th>";
|
|
||||||
print "<th style='text-align:left;'> </th>";
|
|
||||||
print "<th style='text-align:right;'>".number_format($row_usage,0,',','.')."</th>";
|
|
||||||
print "<th style='text-align:right;'>".number_format($data_usage/1024,0,',','.')." kb</th>";
|
|
||||||
print "<th style='text-align:right;'>".number_format($index_usage/1024,0,',','.')." kb</th>";
|
|
||||||
print "<th style='text-align:right;'>".number_format($total_usage/1024,0,',','.')." kb</th>";
|
|
||||||
print "<th style='color:#ff0000;text-align:right;'>".number_format($overhead_usage/1024,2,',','.')." kb</th>";
|
|
||||||
print "</tr>";
|
|
||||||
|
|
||||||
print "<tr><td colspan='7'><p align='right'>Es werden ausschließlich die WORDPRESS-Tabellen angezeigt, die zum Blog <b>'".get_option('blogname')."'</b> gehören.</p></td></tr>";
|
|
||||||
|
|
||||||
print "</table>";
|
|
||||||
print "<hr />";
|
|
||||||
|
|
||||||
sem_showCopyright();
|
|
||||||
|
|
||||||
print "</div>";
|
|
||||||
|
|
||||||
?>
|
?>
|
|
@ -1,31 +1,47 @@
|
||||||
<?php
|
<?php
|
||||||
/*
|
/*
|
||||||
Plugin Name: SemmelstatzR
|
Plugin Name: semmelstatzR
|
||||||
Plugin URI: http://sourceforge.net/projects/semmelstatz/
|
Plugin URI: http://sourceforge.net/projects/semmelstatz/
|
||||||
Description: Visitorstatistic for Wordpress, based upon the original wp-plugin semmelstatz by Andreas 'Redunzl' Mueller (http://www.kopfhoch-studio.de)
|
Description: Visitorstatistic for Wordpress, based upon the original wp-plugin semmelstatz by Andreas 'Redunzl' Mueller (http://www.kopfhoch-studio.de)
|
||||||
Version: 1.0.0 beta
|
Version: 1.0.0 Beta
|
||||||
Author: Ortwin Pinke
|
Author: SEM-Team
|
||||||
Author URI: http://www.ortwinpinke.de
|
Author URI: http://semmelstatz.sf.net
|
||||||
|
License: GPLv3
|
||||||
|
License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* file semmelstatzR.php
|
* file semmelstatzR.php
|
||||||
*
|
*
|
||||||
* @package SemmelstatzR
|
* @package SemmelstatzR
|
||||||
* @version $Rev$
|
* @version $Rev$
|
||||||
* @author Ortwin Pinke <info@php-backoffice.de>
|
* @author Ortwin Pinke <me@ortwinpinke.de>
|
||||||
* @author Andreas 'Redunzl' Mueller
|
* @author Andreas 'Redunzl' Mueller
|
||||||
* @copyright (c)2011 PHP-Backoffice
|
* @copyright (c)2011 SEM-Team
|
||||||
* @copyright (c)2005-2009 kopfhoch-studio
|
* @copyright (c)2005-2009 kopfhoch-studio
|
||||||
* @link http://www.php-backoffice.de/projects/semmelstatzR
|
|
||||||
* @link http://sourceforge.net/projects/semmelstatz/
|
* @link http://sourceforge.net/projects/semmelstatz/
|
||||||
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
* @license http://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
|
*/
|
||||||
|
/**
|
||||||
|
* based upon semmelstatz
|
||||||
* Copyright (c) 2005-2009 Andreas 'Redunzl' Mueller (redunzl@gmx.de)
|
* Copyright (c) 2005-2009 Andreas 'Redunzl' Mueller (redunzl@gmx.de)
|
||||||
* Copyright (c) 2011- Ortwin Pinke (info@php-backoffice.de)
|
|
||||||
*
|
*
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License (version 2) as
|
* it under the terms of the GNU General Public License (version 2) as
|
||||||
* published by the Free Software Foundation.
|
* published by the Free Software Foundation.
|
||||||
|
@ -40,32 +56,7 @@ Author URI: http://www.ortwinpinke.de
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
### constants
|
require_once dirname(__FILE__).DIRECTORY_SEPARATOR.'semmelstatzR_startup.php';
|
||||||
define('SEMMELSTATZR_VERSION', '1.0.0 Beta');
|
|
||||||
define('SEMMELSTATZR_SRVPATH', dirname(__FILE__));
|
|
||||||
define('SEMMELSTATZR_HTML_RELPATH', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)));
|
|
||||||
|
|
||||||
### Deklaration der Tabellennamen
|
|
||||||
global $wpdb;
|
|
||||||
$wpdb->statz = $wpdb->prefix . 'statz';
|
|
||||||
$wpdb->statzhist = $wpdb->prefix . 'statzhist';
|
|
||||||
|
|
||||||
### Auslesen des Domainnamens
|
|
||||||
global $homehost;
|
|
||||||
if(substr($_SERVER['SERVER_NAME'],0,4) == 'www.') {
|
|
||||||
$homehost = '%' . substr($_SERVER['SERVER_NAME'],4) . '%';
|
|
||||||
} else {
|
|
||||||
$homehost = '%' . $_SERVER['SERVER_NAME'] . '%';
|
|
||||||
}
|
|
||||||
|
|
||||||
### localization
|
|
||||||
//if(!load_plugin_textdomain('semmelstatzR','/wp-content/languages/')) {
|
|
||||||
$plugin_dir = basename(dirname(__FILE__));
|
|
||||||
load_plugin_textdomain('semmelstatzR',null,$plugin_dir.'/locale/');
|
|
||||||
//}
|
|
||||||
|
|
||||||
include_once SEMMELSTATZR_SRVPATH.'/includes/functions.semr.php';
|
|
||||||
include_once SEMMELSTATZR_SRVPATH.'/includes/functions.semr_template.php';
|
|
||||||
|
|
||||||
|
|
||||||
if(is_admin() == true) {
|
if(is_admin() == true) {
|
||||||
|
|
42
trunk/semmelstatzR_startup.php
Normale Datei
42
trunk/semmelstatzR_startup.php
Normale Datei
|
@ -0,0 +1,42 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* file semmelstatzR_startup.php
|
||||||
|
*
|
||||||
|
* @package SemmelstatzR
|
||||||
|
* @version $Rev$
|
||||||
|
* @author Ortwin Pinke <info@dceonline.de>
|
||||||
|
* @author Andreas 'Redunzl' Mueller
|
||||||
|
* @copyright (c)2011 PHP-Backoffice
|
||||||
|
* @copyright (c)2005-2009 kopfhoch-studio
|
||||||
|
* @link http://sourceforge.net/projects/semmelstatz/
|
||||||
|
* @license http://www.gnu.org/licenses/gpl-2.0.html
|
||||||
|
*
|
||||||
|
* $Id$
|
||||||
|
*/
|
||||||
|
### constants
|
||||||
|
define('SEMMELSTATZR_VERSION', '1.0.0 Beta');
|
||||||
|
define('SEMMELSTATZR_SRVPATH', dirname(__FILE__));
|
||||||
|
define('SEMMELSTATZR_HTML_RELPATH', WP_PLUGIN_URL.'/'.str_replace(basename( __FILE__),"",plugin_basename(__FILE__)));
|
||||||
|
|
||||||
|
### Deklaration der Tabellennamen
|
||||||
|
global $wpdb;
|
||||||
|
$wpdb->statz = $wpdb->prefix . 'statz';
|
||||||
|
$wpdb->statzhist = $wpdb->prefix . 'statzhist';
|
||||||
|
|
||||||
|
### Auslesen des Domainnamens
|
||||||
|
global $homehost;
|
||||||
|
if(substr($_SERVER['SERVER_NAME'],0,4) == 'www.') {
|
||||||
|
$homehost = '%' . substr($_SERVER['SERVER_NAME'],4) . '%';
|
||||||
|
} else {
|
||||||
|
$homehost = '%' . $_SERVER['SERVER_NAME'] . '%';
|
||||||
|
}
|
||||||
|
|
||||||
|
### localization
|
||||||
|
if(!load_plugin_textdomain('semmelstatzR')) {
|
||||||
|
$plugin_dir = basename(dirname(__FILE__));
|
||||||
|
load_plugin_textdomain('semmelstatzR',null,$plugin_dir.'/locale/');
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once SEMMELSTATZR_SRVPATH.'/includes/functions.semr.php';
|
||||||
|
include_once SEMMELSTATZR_SRVPATH.'/includes/functions.semr_template.php';
|
||||||
|
?>
|
Laden …
In neuem Issue referenzieren