That's a possibility. What I have done, the results of which you've seen hans, is display an image corresponding to the commenter's OS and browser. It's a routine I'm constantly updating (well, pretty often anyway, more often than stable releases of PivotX have come out, that is) as well as the images. I'm really wishing the server issues my host is experiencing were over so I could show again what I have done. Though, I did keep a rudimentary version of this as a hack for the old PivotLog, and you can see some of the work (crude by comparison to what I have written now) on those forums.
Given what has been said so far, I'm coming around; I would create a new tag, not replace [[ comments ]].
As a short preview, and I plan to refine this more once/if I turn it into an extension, within the smarty_comments I've put this:
- Code: Select all
// get translate ua function
include_once($Paths['pivot_path']."includes/useragent.inc.php");
// make images for useragents
if ($temp_row['useragent']) {
$uainfo = translateua($temp_row['useragent']);
} else {
$uainfo = array();
$uainfo['os']['link'] = "";
$uainfo['os']['image'] = "<img src=\"pivotx/pics/useragent/unknown.png\" border=\"0\" alt=\"Unknown/Unspecified OS\" title=\"Unknown/Unspecified OS\" />";
$uainfo['os']['text'] = "UNKNOWN";
$uainfo['browser']['link'] = "";
$uainfo['browser']['image'] = "<img src=\"pivotx/pics/useragent/unknown.png\" border=\"0\" alt=\"Unknown/Unspecified Browser\" title=\"Unknown/Unspecified Browser\" />";
$uainfo['browser']['text'] = "UNKNOWN";
$uainfo['browser']['typeimg'] = "";
$uainfo['browser']['typetext'] = "";
}
The configuration I had in mind was to give the user a choice to use a local copy of useragents.inc.php and the useragent images or resources I would keep on one of my sites (I've got the bandwidth for it). There are pros and cons to either choice.
Parameters are handled thus:
- Code: Select all
$this_tag= str_replace("%gravatar%", $gravatar, $this_tag);
$this_tag= str_replace("%editlink%", $editlink, $this_tag);
// My additions
$this_tag= str_replace("%oslink%", $uainfo['os']['link'], $this_tag);
$this_tag= str_replace("%os%", $uainfo['os']['image'], $this_tag);
$this_tag= str_replace("%ostext%", $uainfo['os']['text'], $this_tag);
$this_tag= str_replace("%browserlink%", $uainfo['browser']['link'], $this_tag);
$this_tag= str_replace("%browser%", $uainfo['browser']['image'], $this_tag);
$this_tag= str_replace("%browsertext%", $uainfo['browser']['text'], $this_tag);
$this_tag= str_replace("%gecko-webkit%", $uainfo['browser']['typeimg'], $this_tag);
$this_tag= str_replace("%gecko-webkit-text%", $uainfo['browser']['typetext'], $this_tag);
Now, if you want to include this as part of the next build of PivotX, by all means, please do. I can send you the useragents.inc.php file (which, again, I was planning on refining for the intended extension), and I would be more than pleased to keep that updated, as well as the images. If we do go this route, we should probably figure out a way to make it easy for people to update these files apart from the rest of PivotX, perhaps even giving the option to use local or remote copies.