summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--utils/modules/links.php (renamed from utils/links.php)64
1 files changed, 50 insertions, 14 deletions
diff --git a/utils/links.php b/utils/modules/links.php
index d9ed1d9..cf0cfed 100644
--- a/utils/links.php
+++ b/utils/modules/links.php
@@ -13,16 +13,20 @@ class Link {
public function show()
{
- echo "<div class=\"link\">\n";
+ $str = "";
+
+ $str .= "<div class=\"link\">\n";
if($this->icon != "") {
- echo " <a class=\"link_icon\" rel=\"external\" href=\"" . $this->href . "\">\n";
- echo " <img alt=\"" . $this->title . "\" src=\"" . $this->icon . "\"/>\n";
- echo " </a>\n";
+ $str .= " <a class=\"link_icon\" rel=\"external\" href=\"" . $this->href . "\">\n";
+ $str .= " <img alt=\"" . $this->title . "\" src=\"" . $this->icon . "\"/>\n";
+ $str .= " </a>\n";
}
- echo " <a class=\"link_title\" rel=\"external\" href=\"" . $this->href . "\">\n";
- echo " " . htmlspecialchars_decode($this->title, ENT_QUOTES) . "\n";
- echo " </a>\n";
- echo "</div>\n";
+ $str .= " <a class=\"link_title\" rel=\"external\" href=\"" . $this->href . "\">\n";
+ $str .= " " . htmlspecialchars_decode($this->title, ENT_QUOTES) . "\n";
+ $str .= " </a>\n";
+ $str .= "</div>\n";
+
+ return $str;
}
}
@@ -43,12 +47,15 @@ class LinkGroup {
public function show()
{
- echo "<div class=\"linkgroup\">\n";
- echo " <div class=\"linkgroup_title\">". htmlspecialchars_decode($this->title, ENT_QUOTES) . "</div>\n";
+ $str = "";
+ $str .= "<div class=\"linkgroup\">\n";
+ $str .= " <div class=\"linkgroup_title\">".
+ htmlspecialchars_decode($this->title, ENT_QUOTES) . "</div>\n";
foreach($this->links as $link) {
- $link->show();
+ $str .= $link->show();
}
- echo "</div>\n";
+ $str .= "</div>\n";
+ return $str;
}
}
@@ -60,6 +67,7 @@ class Links {
$key = $group->title;
$this->groups[$key] = $group;
}
+
/*
public function write()
{
@@ -81,11 +89,33 @@ class Links {
fclose($fp);
}
*/
- public function show($groupid)
+ // public function show($groupid)
+ public function run($params)
{
+ $str = "";
+
+ $groupid = "all";
+
+ foreach($params as $param) {
+ if(!$param) continue;
+ switch($param) {
+ case "all":
+ $groupid = "all";
+ break;
+
+ default:
+ $groupid = $param;
+ break;
+ }
+ }
+
+ $str .= "<div class=\"links\">\n";
foreach($this->groups as $group) {
- if($groupid == $group->id || $groupid == "all") $group->show();
+ if($groupid == $group->id || $groupid == "all") $str .= $group->show();
}
+ $str .= "</div>\n";
+
+ return $str;
}
private function read()
@@ -125,4 +155,10 @@ class Links {
}
}
+function links_init()
+{
+ global $DATA_DIR;
+ return new Links($DATA_DIR . "/links.xml");
+}
+
?> \ No newline at end of file