summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/theme.inc35
-rw-r--r--themes/example/example.theme9
-rw-r--r--themes/marvin/marvin.theme12
-rw-r--r--themes/unconed/unconed.theme12
4 files changed, 40 insertions, 28 deletions
diff --git a/includes/theme.inc b/includes/theme.inc
index dc2108eab..7cb07bfc9 100644
--- a/includes/theme.inc
+++ b/includes/theme.inc
@@ -1,5 +1,17 @@
<?php
+class BaseTheme {
+ function links($links = array(), $status = 0, $node = 0) {
+ if ($status == 1)
+ $links = array_merge(theme_morelink($node), $links);
+ foreach ($links as $link) {
+ $_links[] = count($link) == 2 ? "<A HREF=\"$link[0]\"><FONT COLOR=\"$theme->link\">". t($link[1]) ."</FONT></A>" : t($link[0]);
+ }
+ if ($status == 2) return ($_links ? implode(" | ", $_links) : "");
+ else return ($_links ? "[ ". implode(" | ", $_links) ." ]" : "");
+ }
+}
+
function theme_init() {
global $user, $themes;
@@ -12,21 +24,22 @@ function theme_init() {
return new Theme();
}
-function theme_link($separator = " | ") {
- $links[] = "<A HREF=\"index.php\">". t("home") ."</A>";
- $links[] = "<A HREF=\"search.php\">". t("search") ."</A>";
- $links[] = "<A HREF=\"submit.php\">". t("submit") ."</A>";
- $links[] = "<A HREF=\"account.php\">". t("account") ."</A>";
+function theme_link() {
+ global $theme;
+ $links[] = array("index.php", t("home"));
+ $links[] = array("search.php", t("search"));
+ $links[] = array("submit.php", t("submit"));
+ $links[] = array("account.php", t("account"));
foreach (module_list() as $name) {
- if (module_hook($name, "page")) $links[] = "<A HREF=\"module.php?mod=$name\">".t($name) ."</A>";
+ if (module_hook($name, "page")) $links[] = array("module.php?mod=$name", t($name));
}
// if (module_exist("forum")) $links[] = "<A HREF=\"module.php?mod=forum\">".t("forum") ."</A>";
// if (module_exist("diary")) $links[] = "<A HREF=\"module.php?mod=diary\">". t("diary") ."</A>";
// if (module_exist("book")) $links[] = "<A HREF=\"module.php?mod=book\">". t("handbook") ."</A>";
- return implode($separator, $links);
+ return $theme->links($links, 2);
}
@@ -97,15 +110,15 @@ function theme_blocks($region, $theme) {
}
}
-function theme_morelink($theme, $node) {
+function theme_morelink(&$node) {
if ($node->body) {
- $link[] = "<A HREF=\"node.php?id=$node->nid\"><FONT COLOR=\"$theme->link\">". t("read more") ."</FONT></A>";
+ $links[] = array("node.php?id=$node->nid", t("read more"));
}
if ($node->comment) {
- $link[] = "<A HREF=\"node.php?id=$node->nid\"><FONT COLOR=\"$theme->link\">". format_plural(node_get_comments($node->nid), "comment", "comments") ."</FONT></A>";
+ $links[] = array("node.php?id=$node->nid", format_plural(node_get_comments($node->nid), "comment", "comments"));
}
- return ($link ? "[ ". implode(" | ", $link) ." ]" : "");
+ return $links;
}
function theme_moderation_results($theme, $node) {
diff --git a/themes/example/example.theme b/themes/example/example.theme
index 20e567173..ad8a92cff 100644
--- a/themes/example/example.theme
+++ b/themes/example/example.theme
@@ -9,7 +9,7 @@
*********************************************************************/
- class Theme {
+ class Theme extends BaseTheme {
// General colorset that can be used for this theme
var $foreground = "#000000";
var $background = "#FFFFFF";
@@ -30,7 +30,7 @@
<TD ALIGN="right" COLSPAN="2">
<?php
- print theme_link(" | ");
+ print theme_link();
?>
</TD>
@@ -50,7 +50,7 @@
} // close header function
- function node($node, $main = 0) {
+ function node($node, $main = 0, $links = 0) {
?>
<TABLE BORDER="1" CELLSPACING="0" CELLPADDING="3" WIDTH="100%">
@@ -83,8 +83,7 @@
<TR>
<TD COLSPAN="2">
<?php
- if ($main)
- echo theme_morelink($this, $node);
+ if ($main || $links) echo $this->links($links, $main, $node);
?>
</TD>
diff --git a/themes/marvin/marvin.theme b/themes/marvin/marvin.theme
index 67746ab24..ab76f8fe1 100644
--- a/themes/marvin/marvin.theme
+++ b/themes/marvin/marvin.theme
@@ -10,7 +10,7 @@
*********************************************************************/
- class Theme {
+ class Theme extends BaseTheme {
var $link = "#666699";
// General colorset that can be used for this theme
@@ -39,7 +39,7 @@
<TR>
<TD ALIGN="right" COLSPAN="2">
<?php
- print "<SMALL>". theme_link(" | ") ."</SMALL>\n";
+ print "<SMALL>". theme_link() ."</SMALL>\n";
?>
</TD>
</TR>
@@ -66,12 +66,12 @@
print " </TD>\n";
print " </TR>\n";
print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
- if ($main) print " <TR><TD COLSPAN=\"2\">". theme_morelink($this, $story) ."</TD></TR>\n";
+ if ($main || $links) print " <TR><TD COLSPAN=\"2\">". $this->links($links, $main, $node) ."</TD></TR>\n";
print "</TABLE>\n";
print "<BR><BR>\n\n";
}
- function node($node, $main = 0) {
+ function node($node, $main = 0, $links = 0) {
print "\n<!-- node: \"$node->title\" -->\n";
print "<TABLE BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">\n";
print " <TR><TD COLSPAN=\"2\"><IMG SRC=\"themes/marvin/images/drop.gif\" ALT=\"\"> &nbsp; <B>". check_output($node->title) ."</B></TD></TR>\n";
@@ -86,7 +86,7 @@
print " <TD COLSPAN=\"2\"><P>". check_output($node->body, 1) ."</P></TD>\n";
print " </TR>\n";
print " <TR><TD COLSPAN=\"2\">&nbsp;</TD></TR>\n";
- if ($main) print " <TR><TD COLSPAN=\"2\">". theme_morelink($this, $node) ."</TD></TR>\n";
+ if ($main || $links) print " <TR><TD COLSPAN=\"2\">". $this->links($links, $main, $node) ."</TD></TR>\n";
print "</TABLE>\n";
print "<BR><BR>\n\n";
}
@@ -168,7 +168,7 @@
<TR>
<TD ALIGN="center" COLSPAN="3">
<?php
- print "<P><SMALL>[ ". theme_link(" | ") ." ]</SMALL></P><P>". variable_get(site_footer, "") ."</P>\n";
+ print "<P><SMALL>[ ". theme_link() ." ]</SMALL></P><P>". variable_get(site_footer, "") ."</P>\n";
?>
</TD>
</TR>
diff --git a/themes/unconed/unconed.theme b/themes/unconed/unconed.theme
index 08ea6fe3c..54c938dd5 100644
--- a/themes/unconed/unconed.theme
+++ b/themes/unconed/unconed.theme
@@ -10,7 +10,7 @@
*********************************************************************/
- class Theme {
+ class Theme extends BaseTheme {
var $foreground = "#000000";
var $background = "#FFFFFF";
@@ -65,7 +65,7 @@
</TR>
<TR>
<TD COLSPAN="2" ALIGN="CENTER">
- <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BGCOLOR="<?php echo $this->brcolor1; ?>"><TR><TD ALIGN="CENTER"><TABLE BORDER="0" WIDTH="100%" CELLSPACING="1" CELLPADDING="4"><TR><TD ALIGN="CENTER" BGCOLOR="<?php echo $this->bgcolor2; ?>"><BIG><?php print theme_link(" | "); ?></BIG></TD></TR></TABLE></TD></TR></TABLE>
+ <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BGCOLOR="<?php echo $this->brcolor1; ?>"><TR><TD ALIGN="CENTER"><TABLE BORDER="0" WIDTH="100%" CELLSPACING="1" CELLPADDING="4"><TR><TD ALIGN="CENTER" BGCOLOR="<?php echo $this->bgcolor2; ?>"><BIG><?php print theme_link(); ?></BIG></TD></TR></TABLE></TD></TR></TABLE>
</TD>
</TR>
<TR><TD COLSPAN="2"><?php
@@ -81,7 +81,7 @@
<?php
}
- function node($node, $main = 0) {
+ function node($node, $main = 0, $links = 0) {
print "\n<!-- node: \"$node->title\" -->\n";
?>
@@ -103,8 +103,8 @@
</TD>
</TR>
<?php
- if ($main)
- echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">". theme_morelink($this, $node) ."</TD></TR>";
+ if ($main || $links)
+ echo "<TR BGCOLOR=\"". $this->bgcolor3 ."\"><TD BGCOLOR=\"". $this->bgcolor3 ."\" ALIGN=\"right\" COLSPAN=\"2\">". $this->links($links, $main, $node) ."</TD></TR>";
?>
</TABLE></TD></TR></TABLE><BR>
<?php
@@ -204,7 +204,7 @@
?></TD></TR>
<TR>
<TD COLSPAN="2">
- <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BGCOLOR="<?php echo $this->brcolor1; ?>"><TR><TD ALIGN="CENTER"><TABLE BORDER="0" WIDTH="100%" CELLSPACING="1" CELLPADDING="4"><TR><TD ALIGN="CENTER" BGCOLOR="<?php echo $this->bgcolor2; ?>"><BIG><?php print theme_link(" | "); ?></BIG></TD></TR></TABLE></TD></TR></TABLE>
+ <TABLE BORDER="0" WIDTH="100%" CELLSPACING="0" CELLPADDING="0" BGCOLOR="<?php echo $this->brcolor1; ?>"><TR><TD ALIGN="CENTER"><TABLE BORDER="0" WIDTH="100%" CELLSPACING="1" CELLPADDING="4"><TR><TD ALIGN="CENTER" BGCOLOR="<?php echo $this->bgcolor2; ?>"><BIG><?php print theme_link(); ?></BIG></TD></TR></TABLE></TD></TR></TABLE>
</TD>
</TR>
</TABLE>