Javascript ist Toll!

Wordpress

2. Januar 2007 - 14:54

Wordpress stattraq und der IE7

Mal wieder ein Nicht-JS Thema.

Ich nutze das wordpress Plugin Stattraq, da ich keine Logfiles hier auf dem Server habe und Webalizer Statistiken, die hier mir zu Verfügung stehen, sind nur für bestimmte Auswertungen aussagekräftig.

Leider enthält das Plugin ein paar Fehler, einmal ist in meiner Version ein CSS Wert in der Datei wp-stattraq/styles/normal.css fehlerhaft auskommentiert, die Zeile: _width:100% kann gelöscht werden.

Was aber schlimmer ist, das Plugin erzeugt eine Fehlermeldung im IE7. Das hat zwei Gründe. Einmal zählt das Plugin nur bis Version 7 und dann ist ein Fehler im Code. Die Fehler sind in dem folgenden Block, in der Datei stattraq.php im Plugin Verzeichniss:

	}else if(strpos($ua, 'MSIE') !== false){
	    if(strpos($ua, 'MSIE 6')!==false || strpos($ua, 'MSIE6')!==false) $ver = 6;		
		else if(strpos($ua, 'MSIE 5.5') !== false)
				$ver = 5.5;
		else if(strpos($ua, 'MSIE 5') !== false)
				$ver = 5;
		else if(strpos($ua, "MSIE 4") !== false)
			$ver = 4;
		else if(strpos($ua, 'MSIE 3') !== false)
			$ver = 3;
		else if($strpos($ua, 'MSIE 2') !== false)
			$ver = 2;
		else
			$ver = '';
		return 'Internet Explorer ' . $ver;

Um die Statstik auf den IE 7 zu erweitern, muss hier die zweite Zeile geändert und ergänzt werden.

	}else if(strpos($ua, 'MSIE') !== false){
	    if(strpos($ua, 'MSIE 7')!==false || strpos($ua, 'MSIE7')!==false)   $ver = 7;
	    elseif(strpos($ua, 'MSIE 6')!==false || strpos($ua, 'MSIE6')!==false) $ver = 6;	

Darüber hinaus ist in der Anweisung $strpos($ua, 'MSIE 2') das Dollarzeichen falsch (was letztlich für die Fehlermeldung verantwortlich ist).

Wenn diese Änderungen in der Datei gemacht wurden, läuft wieder alles perfekt und der IE 7 wird in die Statistik aufgenommen.

und wenn wir schon dabei sind, kann man auch noch den Block in dem die Firefox Erkennung läuft ergänzen:

	}else if(strpos($ua, 'Firefox') !== false){
		if(strpos($ua, '2.') !== false)
			$ver = '2.x';
		else if(strpos($ua, '1.') !== false)
			$ver = '1.x';
		else if(strpos($ua, '0.9') !== false)
			$ver = 0.9;
		else if(strpos($ua, '0.8') !== false)
			$ver = 0.8;
		else if(strpos($ua, '0.10') !== false)
			$ver = 1;
		else
			$ver = '';
		return 'Mozilla Firefox ' . $ver;

Dann werden Firefox 1.x und 2.0 mit in die Statistik aufgenommen.

Ähnliche Artikel

Comments (2)
3869 mal gelesen.

2 Comments

Einen Kommentar hinterlassen »

Kommentare

1. von Murph
Dienstag 20.Februar 2007: 03:50

Everything you listed is already fixed in the current version of Stat Traq. This tells me that you are running an old version of Stat Traq, probably a version before I did any modifications to it. The problem with the code "_width:" is that your host is not running the most current version of PHP. This function is standard in PHP 4 and PHP 5. It sounds like the server you are on is very outdated.

2. von Struppi
Dienstag 20.Februar 2007: 10:19

I don't know if you understand what you did read, it doesn't sound so.

_width is a part of the CSS file, it's a workaround for some IE versions, but I would never use it and you it have still in your CSS. and this wasn't the problem, the problem was, that if you visited the site with an IE 7 only an empty white site appeared, because there was a bug in the stattraq.php. If you have fixed it, good, but when I noticed that I didn't found a fix. My Version - 1.0a - have the errors I describes above. And the errors were definitly in the code.

And what you want tell about the server I don't know. The server has nothing to do with the wrong PHP Code nor with the wrong CSS.

Einen Kommentar hinterlassen

Name (erforderlich)
Mail (wird nicht angezeigt) (erforderlich)
Website

Folgende HTML Tags sind erlaubt: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>



Powered by WordPress Stop Spam Harvesters, Join Project Honey Pot kostenloser Counter Browser-Statistiken
rats-wonderful
rats-wonderful
rats-wonderful
rats-wonderful