1
0
Fork 0

some doc and cleanup stuff

Dieser Commit ist enthalten in:
oldperl 2011-12-17 15:26:24 +00:00
Ursprung e400b059d8
Commit b90587fef1
3 geänderte Dateien mit 271 neuen und 225 gelöschten Zeilen

Datei anzeigen

@ -10,8 +10,7 @@ Plugin URI: https://github.com/meglio/wp-upgrademe
if (!class_exists('Upgrademe')) { if (!class_exists('Upgrademe')) {
class Upgrademe class Upgrademe {
{
/** /**
* Stores parsed and validated data returned by unofficial APIs. * Stores parsed and validated data returned by unofficial APIs.
* @var array * @var array

Datei anzeigen

@ -4,7 +4,7 @@
* *
* @package SemmelstatzR * @package SemmelstatzR
* @version $Rev$ * @version $Rev$
* @since 1.0.0 Beta * @since 1.0.0
* @author SEM-Team * @author SEM-Team
* @copyright (c)2011 SEM-Team * @copyright (c)2011 SEM-Team
* @link http://sourceforge.net/projects/semmelstatz/ * @link http://sourceforge.net/projects/semmelstatz/
@ -69,7 +69,7 @@
} }
} }
### Auslesen der höchsten Post-ID ### Auslesen der h<EFBFBD>chsten Post-ID
function sem_getMaxPostID() { function sem_getMaxPostID() {
global $wpdb; global $wpdb;
$maxpostid = $wpdb->get_var("SELECT MAX(ID) FROM ".$wpdb->posts." LIMIT 0,1"); $maxpostid = $wpdb->get_var("SELECT MAX(ID) FROM ".$wpdb->posts." LIMIT 0,1");
@ -117,7 +117,12 @@ function sem_AreYouBot($user_agent) {
return $oCheckAgent->isBot(); return $oCheckAgent->isBot();
} }
### Referer nach Suchmaschinen-Queries und interner Suche prüfen und Suchstring extrahieren /**
* Referer nach Suchmaschinen-Queries und interner Suche prüfen und Suchstring extrahieren
*
* @param string $referer
* @return string name of searchengine and keywords
*/
function sem_getKeyword($referer) { function sem_getKeyword($referer) {
if(empty($referer)) return false; if(empty($referer)) return false;
$homehost = '%'.(substr($_SERVER['SERVER_NAME'],0,4) == 'www.')? $homehost = '%'.(substr($_SERVER['SERVER_NAME'],0,4) == 'www.')?
@ -221,14 +226,14 @@ function sem_getKeyword($referer) {
elseif (preg_match("/".$homehost."/i", $keyword["host"])) { elseif (preg_match("/".$homehost."/i", $keyword["host"])) {
parse_str($keyword["query"],$q); parse_str($keyword["query"],$q);
$keyword = $q["s"]; $keyword = $q["s"];
if($keyword == "") return; return "Interne Suche: ".$keyword; if($keyword == "") return; return semr_i18n("Internal search: ").$keyword;
} }
else { else {
return; return;
} }
} }
### Anzahl der Datensätze in der statz-Tabelle ### Anzahl der Datens<EFBFBD>tze in der statz-Tabelle
function sem_showNumStatzEntries() { function sem_showNumStatzEntries() {
global $wpdb; global $wpdb;
$numstatzentries = $wpdb->get_var("SELECT COUNT(id) FROM ".$wpdb->statz); $numstatzentries = $wpdb->get_var("SELECT COUNT(id) FROM ".$wpdb->statz);
@ -259,27 +264,41 @@ function sem_getKeyword($referer) {
} }
} }
### Zeigt Copyright-Notiz an /**
* prints a copyright notiz
*/
function sem_showCopyright() { function sem_showCopyright() {
print "<p class='copyright'>semmelstatzR ". SEMMELSTATZR_VERSION . " happily coded by <a target='_blank' href='http://semmelstatz.sourceforge.net/'>SEM-Team<br /> print "<p class='copyright'>semmelstatzR ". SEMMELSTATZR_VERSION .
" happily coded by <a target='_blank' href='http://semmelstatz.sourceforge.net/'>SEM-Team<br />
<a target='_blank' style='border:none;' href='http://sourceforge.net/projects/semmelstatz/'> <a target='_blank' style='border:none;' href='http://sourceforge.net/projects/semmelstatz/'>
<img src='".get_option('siteurl')."/wp-content/plugins/semmelstatzR/img/statzR.png' /></a></p>"; <img src='".get_option('siteurl')."/wp-content/plugins/semmelstatzR/img/statzR.png' /></a></p>";
} }
### statz-Tabelle leeren (NICHT LÖSCHEN!!!) /**
* empty statz table
*
* @global type $wpdb
* @return bool
*/
function sem_truncateStatzTable() { function sem_truncateStatzTable() {
global $wpdb, $userip; global $wpdb;
$wpdb->query('TRUNCATE TABLE '.$wpdb->statz); $wpdb->query('TRUNCATE TABLE '.$wpdb->statz);
sem_optStatzTable(); sem_optStatzTable();
return $wpdb->query("INSERT INTO `$wpdb->statz`(ip, time, referer, page, username) VALUES('127.0.0.1', NOW(),NULL,0,'statz-Tabelle geleert')"); return ($wpdb->query("INSERT INTO `$wpdb->statz`(ip, time, referer, page, username) VALUES('127.0.0.1', NOW(),NULL,0,'statz-Tabelle geleert')"))?true:false;
} }
### Obsolet, bleibt aber aus Kompatibilitätsgründen zu SEMMELSTATZ_DELETE /**
*
* @deprecated no need to hold unused functions in semR
* @todo remove in next major release
* @param int $days
* @return boolean
*/
function sem_delOldRecords($days) { function sem_delOldRecords($days) {
return true; return true;
} }
### simpleEncoding für die GoogleChartAPI ### simpleEncoding f<EFBFBD>r die GoogleChartAPI
function sem_encodeChartData($values) { function sem_encodeChartData($values) {
$maxValue = max($values); $maxValue = max($values);
@ -298,7 +317,7 @@ function sem_truncateStatzTable() {
return $chartData; return $chartData;
} }
### Datensätze älter als statz_recdays_limit-Tage löschen ### Datens<EFBFBD>tze <20>lter als statz_recdays_limit-Tage l<>schen
function sem_delOutOfLimit() { function sem_delOutOfLimit() {
global $wpdb; global $wpdb;
$sem_options = get_option('semmelstatzR_options'); ### optionsarray auslesen $sem_options = get_option('semmelstatzR_options'); ### optionsarray auslesen
@ -309,7 +328,7 @@ function sem_truncateStatzTable() {
sem_optStatzTable(); sem_optStatzTable();
} }
### Wenn AUTOMATISCHES LIMIT aktiviert, dann LIMITIERE und erhöhe NEXT_CRON ### Wenn AUTOMATISCHES LIMIT aktiviert, dann LIMITIERE und erh<EFBFBD>he NEXT_CRON
function sem_doCronStatzLimit() { function sem_doCronStatzLimit() {
sem_delOutOfLimit(); sem_delOutOfLimit();
$sem_options = get_option('semmelstatzR_options'); ### optionsarray auslesen $sem_options = get_option('semmelstatzR_options'); ### optionsarray auslesen
@ -330,6 +349,10 @@ function sem_truncateStatzTable() {
} }
### Unter bestimmten Voraussetzungen den Vortag in die statzhist-Tabelle schreiben ### Unter bestimmten Voraussetzungen den Vortag in die statzhist-Tabelle schreiben
/**
* @todo add action cache so we don't need to do it with every call
* @global type $wpdb
*/
function sem_writeYesterdayToHist() { function sem_writeYesterdayToHist() {
global $wpdb; global $wpdb;
if(!$wpdb->get_var("SELECT date FROM ".$wpdb->statzhist." WHERE substring(date,1,10) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)")) { if(!$wpdb->get_var("SELECT date FROM ".$wpdb->statzhist." WHERE substring(date,1,10) = DATE_SUB(CURDATE(), INTERVAL 1 DAY)")) {
@ -379,7 +402,10 @@ function sem_truncateStatzTable() {
/** /**
* translate and return a string * translate and return a string
*
* @uses wp-function __() and prefilled plugin gettextdomain * @uses wp-function __() and prefilled plugin gettextdomain
* @author Ortwin Pinke
* @since 1.0.0
* *
* @param string $sValue string to translate * @param string $sValue string to translate
* @param string $sDomain gettextdomain * @param string $sDomain gettextdomain
@ -391,7 +417,10 @@ function semr_i18n($sValue, $sDomain = "semmelstatzR") {
/** /**
* translate and echo a string * translate and echo a string
*
* @uses wp-function _e() and prefilled plugin gettextdomain * @uses wp-function _e() and prefilled plugin gettextdomain
* @author Ortwin Pinke
* @since 1.0.0
* *
* @param string $sValue * @param string $sValue
* @param string $sDomain * @param string $sDomain
@ -403,7 +432,10 @@ function semr_i18ne($sValue, $sDomain = "semmelstatzR") {
/** /**
* translate and return a plural or singular string based on an amount * translate and return a plural or singular string based on an amount
*
* @uses wp-function _n() and prefilled plugin gettextdomain * @uses wp-function _n() and prefilled plugin gettextdomain
* @author Ortwin Pinke
* @since 1.0.0
* *
* @param string $sSingular * @param string $sSingular
* @param string $sPlural * @param string $sPlural
@ -418,8 +450,9 @@ function semr_i18np($sSingular, $sPlural, $iNumber, $sDomain = "semmelstatzR") {
/** /**
* *
* @author anyexample.com * @author anyexample.com
* @license http://www.anyexample.com/license/ * @license modified MIT see http://www.anyexample.com/license/
* @link http://www.anyexample.com/programming/php/php_convert_rgb_from_to_html_hex_color.xml * @link http://www.anyexample.com/programming/php/php_convert_rgb_from_to_html_hex_color.xml
* @since 1.0.0
* *
* @param string $color * @param string $color
* @return array * @return array
@ -445,8 +478,9 @@ function semr_hex2rgb($color) {
/** /**
* *
* @author anyexample.com * @author anyexample.com
* @license http://www.anyexample.com/license/ * @license modified MIT see http://www.anyexample.com/license/
* @link http://www.anyexample.com/programming/php/php_convert_rgb_from_to_html_hex_color.xml * @link http://www.anyexample.com/programming/php/php_convert_rgb_from_to_html_hex_color.xml
* @since 1.0.0
* *
* @param int $r * @param int $r
* @param int $g * @param int $g

Datei anzeigen

@ -3,7 +3,7 @@
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 RC
Author: SEM-Team Author: SEM-Team
Author URI: http://semmelstatz.sf.net Author URI: http://semmelstatz.sf.net
License: GPLv3 License: GPLv3
@ -16,7 +16,7 @@ License URI: http://www.gnu.org/licenses/gpl-3.0.html
* @version $Rev$ * @version $Rev$
* @since 1.0.0 Beta * @since 1.0.0 Beta
* @author SEM-Team * @author SEM-Team
* @copyright (c)2011 SEM-Team * @copyright (c)2011-2012 SEM-Team
* @link http://sourceforge.net/projects/semmelstatz/ * @link http://sourceforge.net/projects/semmelstatz/
* @license http://www.gnu.org/licenses/gpl-3.0.html * @license http://www.gnu.org/licenses/gpl-3.0.html
* *
@ -128,7 +128,7 @@ if(is_admin() == true) {
global $wpdb; global $wpdb;
if(get_option('statz_options')) { if(get_option('statz_options')) {
$wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'statz%';"); // Löschen der alten Optionen $wpdb->query("DELETE FROM $wpdb->options WHERE option_name LIKE 'statz%';"); // L<EFBFBD>schen der alten Optionen
} }
if(!get_option('semmelstatzR_options')) { if(!get_option('semmelstatzR_options')) {
@ -156,7 +156,7 @@ if(is_admin() == true) {
"statz_topreads_limit" => 10, "statz_topreads_limit" => 10,
"statz_write_admins" => false, "statz_write_admins" => false,
"statz_write_users" => false, "statz_write_users" => false,
"statz_use_img" => true "statz_use_img" => false
); );
add_option( 'semmelstatzR_options', $sem_options ); add_option( 'semmelstatzR_options', $sem_options );
} }
@ -175,7 +175,7 @@ function sem_statzsetup() {
} elseif(@is_file(ABSPATH.'/wp-admin/includes/upgrade.php')) { } elseif(@is_file(ABSPATH.'/wp-admin/includes/upgrade.php')) {
include_once(ABSPATH.'/wp-admin/includes/upgrade.php'); include_once(ABSPATH.'/wp-admin/includes/upgrade.php');
} else { } else {
die('Kann <i>wp-admin/upgrade-functions.php</i> und <i>wp-admin/includes/upgrade.php</i> nicht finden!'); die(semr_i18n('Cannot find <i>wp-admin/upgrade-functions.php</i> and <i>wp-admin/includes/upgrade.php</i>!'));
} }
$create_table = array(); $create_table = array();
@ -228,7 +228,7 @@ function sem_writeStatz() {
// true === $sem_options['statz_use_img'] && // true === $sem_options['statz_use_img'] &&
if(true == $sem_options['statz_use_img'] && !defined('SEMMELSTATZR_STATZIMG')) { if(true == $sem_options['statz_use_img'] && !defined('SEMMELSTATZR_STATZIMG')) {
print '<img src="'.SEMMELSTATZR_HTML_RELPATH.'semr_image.php" alt="" />'; print '<img src="'.SEMMELSTATZR_HTML_RELPATH.'semr_image.php" alt="" />';
return; ### nothing todo if stat image is used return; ### nothing else todo if stat image is used
} }
sem_writeYesterdayToHist(); sem_writeYesterdayToHist();
@ -251,8 +251,7 @@ $referer = $wpdb->escape(urldecode($_SERVER['HTTP_REFERER']));
if (!empty($referer)) { if (!empty($referer)) {
if(get_option('blog_charset') == 'iso-8859-1') $referer = utf8_decode($referer); if(get_option('blog_charset') == 'iso-8859-1') $referer = utf8_decode($referer);
$referer = "'".$referer."'"; $referer = "'".$referer."'";
} } else {
else {
$referer = 'NULL'; $referer = 'NULL';
} }
@ -272,13 +271,19 @@ $wpdb->query("INSERT INTO $wpdb->statz (ip, time, referer, page, username)
} }
### Zeitgesteuertes Limitieren der statz-Tabelle ### Zeitgesteuertes Limitieren der statz-Tabelle
// Wenn semmelKron JA UND statz_next_cron älter JETZT, dann... // @todo add action cache
// Wenn semmelKron JA UND statz_next_cron älter JETZT, dann...
$sem_options = get_option('semmelstatzR_options'); ### optionsarray auslesen $sem_options = get_option('semmelstatzR_options'); ### optionsarray auslesen
if($sem_options['statz_do_cron'] == true && $sem_options['statz_next_cron'] < time()) { if($sem_options['statz_do_cron'] == true && $sem_options['statz_next_cron'] < time()) {
add_action('shutdown', 'sem_doCronStatzLimit'); // ...limitiere statz-Tabelle auf vorgegebenen Wert add_action('shutdown', 'sem_doCronStatzLimit'); // ...limitiere statz-Tabelle auf vorgegebenen Wert
} }
### Rendert eine Mini-STATZ. Idee: René Tauchnitz /**
* renders a ministatz for dashboard
* Idee: René Tauchnitz
*
* @return void
*/
function sem_dashboardStatz_show() { function sem_dashboardStatz_show() {
$widget_options = get_option( 'dashboard_widget_options' ); $widget_options = get_option( 'dashboard_widget_options' );
@ -299,6 +304,14 @@ function sem_dashboardStatz_show() {
echo '</p>'; echo '</p>';
} }
/**
* dashboard-control for ministatz
*
* @author Ortwin Pinke
* @since semR 1.0
*
* @return void
*/
function sem_dashboardStatz_control() { function sem_dashboardStatz_control() {
if (!$widget_options = get_option('dashboard_widget_options')) if (!$widget_options = get_option('dashboard_widget_options'))
$widget_options = array(); $widget_options = array();