Revision [16809]
This is an old revision of SmiliesAction made by JsnKs3 on 2007-05-31 10:49:59.
New image action
This is a general purpose image action but since it was created out of the need to add emoticons or smilies in Wikka I named the page Smilies Action.
This new image action improves:
- simpler syntax (debatable you might say) - don't need to specify parameter names
- smaller code in database
- more readable (older version looks a lot like html code)
- don't need to remember image's extension or folder
- can be configured to add more image directories or image extensions
disadvantages:
- not standard way to pass and handle parameters (does this have any other implications)
- add more if like
Compare the two actions that result to the same thing.
the integrated image action:
the new image action:
Unknown action ""i""
here is the action save it as actions/i.php
%%(php)
<?php
? is there a better way to do this
foreach ($vars as $param => $value) {
list($src,$title,$link,$class,$alt)=explode(";",$value);
}icon dirs and extension to check
$iconDirs = array("smilies", "images","flags");
$exts = array("gif","jpg","png");
if ($src
"") exit();
foreach($iconDirs as $idir){
foreach($exts as $ext){
$src2 =$idir."/".$src.".".$ext;
if(file_exists($src2)) break 2;
}
}
$output = "<img";
$output .= " src='".$src2."'";
$title = $this->htmlspecialchars_ent($title);
if (empty($link)
$src2 =$idir."/".$src.".".$ext;
if(file_exists($src2)) break 2;