1
0
Fork 0

edit: phpdoc stuff

add: pChart lib - no more usage of google api. There has to be the wp-content/cache writable for images
add: test-folder for later use
new: class agents, new isBot-functionality within this class, old function is deprecated, uses an ini-file with botnames
Dieser Commit ist enthalten in:
Oldperl 2011-11-14 14:21:22 +00:00
Ursprung 187cc396c4
Commit 86383bb510
53 geänderte Dateien mit 26319 neuen und 380 gelöschten Zeilen

Datei anzeigen

@ -2,23 +2,56 @@
/**
* file semmelstatzR_statz.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://www.php-backoffice.de/projects/semmelstatzR
* @link http://sourceforge.net/projects/semmelstatz/
* @license http://www.gnu.org/licenses/gpl-2.0.html
* @package SemmelstatzR
* @version $Rev$
* @since 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$
*
*/
/**
* based upon semmelstatz
* Copyright (c) 2005-2009 Andreas 'Redunzl' Mueller (redunzl@gmx.de)
*
* @license http://www.gnu.org/licenses/gpl-2.0.html
* 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
* published by the Free Software Foundation.
*
* 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, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
if(!current_user_can('manage_statz')) {
die('Zugriff verweigert');
}
include_once plugin_dir_path(__FILE__).'includes/pChart/class/pData.class.php';
include_once plugin_dir_path(__FILE__).'includes/pChart/class/pDraw.class.php';
include_once plugin_dir_path(__FILE__).'includes/pChart/class/pImage.class.php';
### AKTUELL - Funktionen
function sem_showWhoIsOnline() {
@ -96,37 +129,40 @@ if(!current_user_can('manage_statz')) {
return;
}
foreach ($results as $result) {
$visitors[] = $result->visitors;
$hours[] = mysql2date('H', $result->hours);
}
$maxvalue = max($visitors);
$visitors = implode(',', $visitors);
$hours = "|".implode('|', $hours)."|";
$charturl = "http://chart.apis.google.com/chart?";
$chartsize = "chs=600x150&";
$charttype = "cht=bvs&";
$chartgrid = "chg=25,25&";
$chartdata = "chd=t:".$visitors."&";
$chartminmax = "chds=0,".$maxvalue."&";
$barsize = "chbh=a&";
$axis = "chxt=x,y&";
$axisdataX = "chxl=0:".$hours;
$axisdataY = "1:|0|".$maxvalue."&";
$datalabels = "chm=N,000000,0,-1,10";
$chart = $charturl.$chartsize.$charttype.$chartgrid.$chartdata.$chartminmax.$barsize.$axis.$axisdataX.$axisdataY.$datalabels;
print "<div class='chart'>";
print "<img src=".$chart." alt='Chart nicht verf&uuml;gbar'/>";
print "</div>";
print "</div>";
print "<hr />";
}
foreach ($results as $result) {
$visitors[] = $result->visitors;
$hours[] = mysql2date('H', $result->hours);
}
$MyData = new pData();
$MyData->addPoints($visitors,"Visitors");
$MyData->setAxisName(0,"Visitors");
$MyData->addPoints($hours,"Hours");
$MyData->setAbscissa("Hours");
$myPicture = new pImage(780,150,$MyData);
$myPicture->Antialias = FALSE;
$myPicture->drawRectangle(0,0,779,149,array("R"=>0,"G"=>0,"B"=>0));
$myPicture->setFontProperties(array("FontName"=>plugin_dir_path(__FILE__)."includes/pChart/fonts/Bedizen.ttf","FontSize"=>8));
$myPicture->setGraphArea(30,20,760,130);
$scaleSettings = array("GridR"=>200,"GridG"=>200,"GridB"=>200);
$myPicture->drawScale($scaleSettings);
$myPicture->drawBarChart();
@$myPicture->Render(WP_CONTENT_DIR."/cache/24HourGoo.png");
print "<div class='chart'>";
if(is_readable(WP_CONTENT_DIR."/cache/24HourGoo.png")) {
print '<img src="'.WP_CONTENT_URL.'/cache/24HourGoo.png" />';
} else if(!is_dir(WP_CONTENT_DIR."/cache")) {
print semr_i18n('No Chart: Cannot find cache-folder!');
} else if(!is_writable(WP_CONTENT_DIR."/cache")) {
print semr_i18n('No Chart: Missing rights for cache-folder!');
}
print "</div>";
print "</div>";
print "<hr />";
}
function sem_showDailyStatz() {
global $wpdb;