Commit 951b553a authored by Dries's avatar Dries

- Committed stage 2 of the theme system improvements!  Patch by CodeMonkeyX.
parent 00ee7f74
...@@ -1186,6 +1186,5 @@ function drupal_page_footer() { ...@@ -1186,6 +1186,5 @@ function drupal_page_footer() {
$locale = locale_init(); $locale = locale_init();
// initialize theme: // initialize theme:
$theme = theme_init(); $theme = init_theme();
?> ?>
...@@ -28,7 +28,7 @@ function pager_display($tags = "", $limit = 10, $element = 0, $type = "default", ...@@ -28,7 +28,7 @@ function pager_display($tags = "", $limit = 10, $element = 0, $type = "default",
* *
* @see pager_display * @see pager_display
*/ */
function pager_display_default($tags = "", $limit = 10, $element = 0, $attributes = array()) { function theme_pager_display_default($tags = "", $limit = 10, $element = 0, $attributes = array()) {
global $pager_total; global $pager_total;
if ($pager_total[$element] > $limit) { if ($pager_total[$element] > $limit) {
$output .= "<div id=\"pager\" class=\"container-inline\">"; $output .= "<div id=\"pager\" class=\"container-inline\">";
...@@ -51,13 +51,13 @@ function pager_display_default($tags = "", $limit = 10, $element = 0, $attribute ...@@ -51,13 +51,13 @@ function pager_display_default($tags = "", $limit = 10, $element = 0, $attribute
* *
* @see pager_display * @see pager_display
*/ */
function pager_display_simple($tags = "", $limit = 10, $element = 0, $attributes = array()) { function theme_pager_display_simple($tags = "", $limit = 10, $element = 0, $attributes = array()) {
/* /*
** It's left as an exercise to theme writers to create an alternative ** It's left as an exercise to theme writers to create an alternative
** pager for pager_display_simple(). if your theme does not offer a ** pager for pager_display_simple(). if your theme does not offer a
** replacement, the theme.inc pager_display_default() is used. ** replacement, the theme.inc pager_display_default() is used.
*/ */
return pager_display_default($tags, $limit, $element, $attributes); return theme_pager_display_default($tags, $limit, $element, $attributes);
} }
/** /**
...@@ -68,13 +68,13 @@ function pager_display_simple($tags = "", $limit = 10, $element = 0, $attributes ...@@ -68,13 +68,13 @@ function pager_display_simple($tags = "", $limit = 10, $element = 0, $attributes
* *
* @see pager_display * @see pager_display
*/ */
function pager_display_admin($tags = "", $limit = 10, $element = 0, $attributes = array()) { function theme_pager_display_admin($tags = "", $limit = 10, $element = 0, $attributes = array()) {
/* /*
** It's left as an exercise to theme writers to create an alternative ** It's left as an exercise to theme writers to create an alternative
** pager for pager_display_admin(). if your theme does not offer a ** pager for pager_display_admin(). if your theme does not offer a
** replacement, the pager.inc pager_display_default() is used. ** replacement, the pager.inc pager_display_default() is used.
*/ */
return pager_display_default($tags, $limit, $element, $attributes); return theme_pager_display_default($tags, $limit, $element, $attributes);
} }
/* ******************************************************************* /* *******************************************************************
......
This diff is collapsed.
...@@ -124,7 +124,7 @@ function import_update() { ...@@ -124,7 +124,7 @@ function import_update() {
} }
} }
function import_theme_format_item($item, $feed = 0) { function theme_import_format_item($item, $feed = 0) {
global $user; global $user;
if ($user->uid && module_exist("blog") && user_access("maintain personal blog")) { if ($user->uid && module_exist("blog") && user_access("maintain personal blog")) {
...@@ -148,7 +148,7 @@ function import_bundle_block($attributes) { ...@@ -148,7 +148,7 @@ function import_bundle_block($attributes) {
$items = array(); $items = array();
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
$items[] = theme("import_theme_format_item", $item); $items[] = theme("import_format_item", $item);
} }
$output = "<div class=\"import-block\"><div class=\"bundle\">"; $output = "<div class=\"import-block\"><div class=\"bundle\">";
...@@ -163,11 +163,11 @@ function import_feed_block($feed) { ...@@ -163,11 +163,11 @@ function import_feed_block($feed) {
$items = array(); $items = array();
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
$items[] = theme("import_theme_format_item", $item); $items[] = theme("import_format_item", $item);
} }
$output = "<div class=\"import-block\"><div class=\"feed\">"; $output = "<div class=\"import-block\"><div class=\"feed\">";
$output .= theme("theme_item_list", $items); $output .= theme("item_list", $items);
$output .= "</div></div>"; $output .= "</div></div>";
return $output; return $output;
...@@ -656,10 +656,10 @@ function import_page_last() { ...@@ -656,10 +656,10 @@ function import_page_last() {
} }
$output .= "</table>\n"; $output .= "</table>\n";
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
theme("box", t("Latest news"), $output); print theme("box", t("Latest news"), $output);
theme("footer"); print theme("footer");
} }
function import_page_feed($fid) { function import_page_feed($fid) {
...@@ -691,11 +691,11 @@ function import_page_feed($fid) { ...@@ -691,11 +691,11 @@ function import_page_feed($fid) {
} }
$output .= "</table>\n"; $output .= "</table>\n";
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
theme("box", $feed->title, $header); print theme("box", $feed->title, $header);
theme("box", t("Latest news"), $output); print theme("box", t("Latest news"), $output);
theme("footer"); print theme("footer");
} }
function import_page_bundle($bid) { function import_page_bundle($bid) {
...@@ -730,11 +730,11 @@ function import_page_bundle($bid) { ...@@ -730,11 +730,11 @@ function import_page_bundle($bid) {
} }
$output .= "</table>\n"; $output .= "</table>\n";
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
theme("box", $bundle->title, $header); print theme("box", $bundle->title, $header);
theme("box", t("Latest news"), $output); print theme("box", t("Latest news"), $output);
theme("footer"); print theme("footer");
} }
...@@ -750,10 +750,10 @@ function import_page_sources() { ...@@ -750,10 +750,10 @@ function import_page_sources() {
$output .= "<div style=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />"; $output .= "<div style=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />";
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
theme("box", t("News sources"), $output); print theme("box", t("News sources"), $output);
theme("footer"); print theme("footer");
} }
function import_page_fd() { function import_page_fd() {
...@@ -788,8 +788,8 @@ function import_page_feeds() { ...@@ -788,8 +788,8 @@ function import_page_feeds() {
function import_page_blocks($blocks) { function import_page_blocks($blocks) {
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
print "<table cellpadding=\"0\" cellspacing=\"5\" border=\"0\" style=\"width: 100%;\">\n"; print "<table cellpadding=\"0\" cellspacing=\"5\" border=\"0\" style=\"width: 100%;\">\n";
print " <tr>\n"; print " <tr>\n";
...@@ -797,7 +797,7 @@ function import_page_blocks($blocks) { ...@@ -797,7 +797,7 @@ function import_page_blocks($blocks) {
$i = 1; $i = 1;
print " <td style=\"vertical-align: top; width: 33%;\">\n"; print " <td style=\"vertical-align: top; width: 33%;\">\n";
while ($block = each($blocks)) { while ($block = each($blocks)) {
theme("box", $block["value"]["subject"], $block["value"]["content"]); print theme("box", $block["value"]["subject"], $block["value"]["content"]);
if ($i == ceil(count($blocks) / 3)) { if ($i == ceil(count($blocks) / 3)) {
break; break;
} }
...@@ -808,7 +808,7 @@ function import_page_blocks($blocks) { ...@@ -808,7 +808,7 @@ function import_page_blocks($blocks) {
print " </tr>\n"; print " </tr>\n";
print "</table>\n"; print "</table>\n";
theme("footer"); print theme("footer");
} }
function import_page() { function import_page() {
......
...@@ -124,7 +124,7 @@ function import_update() { ...@@ -124,7 +124,7 @@ function import_update() {
} }
} }
function import_theme_format_item($item, $feed = 0) { function theme_import_format_item($item, $feed = 0) {
global $user; global $user;
if ($user->uid && module_exist("blog") && user_access("maintain personal blog")) { if ($user->uid && module_exist("blog") && user_access("maintain personal blog")) {
...@@ -148,7 +148,7 @@ function import_bundle_block($attributes) { ...@@ -148,7 +148,7 @@ function import_bundle_block($attributes) {
$items = array(); $items = array();
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
$items[] = theme("import_theme_format_item", $item); $items[] = theme("import_format_item", $item);
} }
$output = "<div class=\"import-block\"><div class=\"bundle\">"; $output = "<div class=\"import-block\"><div class=\"bundle\">";
...@@ -163,11 +163,11 @@ function import_feed_block($feed) { ...@@ -163,11 +163,11 @@ function import_feed_block($feed) {
$items = array(); $items = array();
while ($item = db_fetch_object($result)) { while ($item = db_fetch_object($result)) {
$items[] = theme("import_theme_format_item", $item); $items[] = theme("import_format_item", $item);
} }
$output = "<div class=\"import-block\"><div class=\"feed\">"; $output = "<div class=\"import-block\"><div class=\"feed\">";
$output .= theme("theme_item_list", $items); $output .= theme("item_list", $items);
$output .= "</div></div>"; $output .= "</div></div>";
return $output; return $output;
...@@ -656,10 +656,10 @@ function import_page_last() { ...@@ -656,10 +656,10 @@ function import_page_last() {
} }
$output .= "</table>\n"; $output .= "</table>\n";
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
theme("box", t("Latest news"), $output); print theme("box", t("Latest news"), $output);
theme("footer"); print theme("footer");
} }
function import_page_feed($fid) { function import_page_feed($fid) {
...@@ -691,11 +691,11 @@ function import_page_feed($fid) { ...@@ -691,11 +691,11 @@ function import_page_feed($fid) {
} }
$output .= "</table>\n"; $output .= "</table>\n";
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
theme("box", $feed->title, $header); print theme("box", $feed->title, $header);
theme("box", t("Latest news"), $output); print theme("box", t("Latest news"), $output);
theme("footer"); print theme("footer");
} }
function import_page_bundle($bid) { function import_page_bundle($bid) {
...@@ -730,11 +730,11 @@ function import_page_bundle($bid) { ...@@ -730,11 +730,11 @@ function import_page_bundle($bid) {
} }
$output .= "</table>\n"; $output .= "</table>\n";
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
theme("box", $bundle->title, $header); print theme("box", $bundle->title, $header);
theme("box", t("Latest news"), $output); print theme("box", t("Latest news"), $output);
theme("footer"); print theme("footer");
} }
...@@ -750,10 +750,10 @@ function import_page_sources() { ...@@ -750,10 +750,10 @@ function import_page_sources() {
$output .= "<div style=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />"; $output .= "<div style=\"xml-icon\">". l("<img src=\"". theme("image", "xml.gif") ."\" width=\"36\" height=\"14\" style=\"border: 0px;\" />", "import/fd", array("title" => t("View the list of syndicated web sites in XML format."))) ."</div><br />";
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
theme("box", t("News sources"), $output); print theme("box", t("News sources"), $output);
theme("footer"); print theme("footer");
} }
function import_page_fd() { function import_page_fd() {
...@@ -788,8 +788,8 @@ function import_page_feeds() { ...@@ -788,8 +788,8 @@ function import_page_feeds() {
function import_page_blocks($blocks) { function import_page_blocks($blocks) {
theme("header"); print theme("header");
theme("box", t("News feeds"), import_page_info()); print theme("box", t("News feeds"), import_page_info());
print "<table cellpadding=\"0\" cellspacing=\"5\" border=\"0\" style=\"width: 100%;\">\n"; print "<table cellpadding=\"0\" cellspacing=\"5\" border=\"0\" style=\"width: 100%;\">\n";
print " <tr>\n"; print " <tr>\n";
...@@ -797,7 +797,7 @@ function import_page_blocks($blocks) { ...@@ -797,7 +797,7 @@ function import_page_blocks($blocks) {
$i = 1; $i = 1;
print " <td style=\"vertical-align: top; width: 33%;\">\n"; print " <td style=\"vertical-align: top; width: 33%;\">\n";
while ($block = each($blocks)) { while ($block = each($blocks)) {
theme("box", $block["value"]["subject"], $block["value"]["content"]); print theme("box", $block["value"]["subject"], $block["value"]["content"]);
if ($i == ceil(count($blocks) / 3)) { if ($i == ceil(count($blocks) / 3)) {
break; break;
} }
...@@ -808,7 +808,7 @@ function import_page_blocks($blocks) { ...@@ -808,7 +808,7 @@ function import_page_blocks($blocks) {
print " </tr>\n"; print " </tr>\n";
print "</table>\n"; print "</table>\n";
theme("footer"); print theme("footer");
} }
function import_page() { function import_page() {
......
...@@ -197,7 +197,7 @@ function archive_page() { ...@@ -197,7 +197,7 @@ function archive_page() {
$op = $_POST["op"]; $op = $_POST["op"];
$edit = $_POST["edit"]; $edit = $_POST["edit"];
theme("header"); print theme("header");
if (user_access("access content")) { if (user_access("access content")) {
if ($op == t("Show")) { if ($op == t("Show")) {
...@@ -224,7 +224,7 @@ function archive_page() { ...@@ -224,7 +224,7 @@ function archive_page() {
$start = "<div class=\"container-inline\">"; $start = "<div class=\"container-inline\">";
$start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show")); $start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show"));
$start .= "</div>"; $start .= "</div>";
theme("box", t("Archives"), form($start)); print theme("box", t("Archives"), form($start));
/* /*
** Fetch nodes for the selected date, or current date if none ** Fetch nodes for the selected date, or current date if none
...@@ -243,7 +243,7 @@ function archive_page() { ...@@ -243,7 +243,7 @@ function archive_page() {
message_access(); message_access();
} }
theme("footer"); print theme("footer");
} }
function archive_settings() { function archive_settings() {
......
...@@ -197,7 +197,7 @@ function archive_page() { ...@@ -197,7 +197,7 @@ function archive_page() {
$op = $_POST["op"]; $op = $_POST["op"];
$edit = $_POST["edit"]; $edit = $_POST["edit"];
theme("header"); print theme("header");
if (user_access("access content")) { if (user_access("access content")) {
if ($op == t("Show")) { if ($op == t("Show")) {
...@@ -224,7 +224,7 @@ function archive_page() { ...@@ -224,7 +224,7 @@ function archive_page() {
$start = "<div class=\"container-inline\">"; $start = "<div class=\"container-inline\">";
$start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show")); $start .= form_select("", "year", ($year ? $year : date("Y")), $years). form_select("", "month", ($month ? $month : date("m")), $months) . form_select("", "day", ($day ? $day : date("d")), $days) . form_submit(t("Show"));
$start .= "</div>"; $start .= "</div>";
theme("box", t("Archives"), form($start)); print theme("box", t("Archives"), form($start));
/* /*
** Fetch nodes for the selected date, or current date if none ** Fetch nodes for the selected date, or current date if none
...@@ -243,7 +243,7 @@ function archive_page() { ...@@ -243,7 +243,7 @@ function archive_page() {
message_access(); message_access();
} }
theme("footer"); print theme("footer");
} }
function archive_settings() { function archive_settings() {
......
...@@ -119,7 +119,7 @@ function blog_page_user($uid) { ...@@ -119,7 +119,7 @@ function blog_page_user($uid) {
$breadcrumb[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$breadcrumb[] = l(t("Blogs"), "blog"); $breadcrumb[] = l(t("Blogs"), "blog");
$breadcrumb[] = t("%name's blog", array("%name" => $account->name)); $breadcrumb[] = t("%name's blog", array("%name" => $account->name));
theme("breadcrumb", $breadcrumb); print theme("breadcrumb", $breadcrumb);
$result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND uid = '$account->uid' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10)); $result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND uid = '$account->uid' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10));
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
...@@ -135,7 +135,7 @@ function blog_page_last() { ...@@ -135,7 +135,7 @@ function blog_page_last() {
// Breadcrumb navigation: // Breadcrumb navigation:
$breadcrumb[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$breadcrumb[] = t("Blogs"); $breadcrumb[] = t("Blogs");
theme("breadcrumb", $breadcrumb); print theme("breadcrumb", $breadcrumb);
$result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10)); $result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10));
...@@ -153,7 +153,7 @@ function blog_validate(&$node) { ...@@ -153,7 +153,7 @@ function blog_validate(&$node) {
*/ */
if (isset($node->body) && count(explode(" ", $node->body)) < variable_get("minimum_blog_size", 0)) { if (isset($node->body) && count(explode(" ", $node->body)) < variable_get("minimum_blog_size", 0)) {
$error["body"] = theme("theme_error", t("The body of your blog is too short.")); $error["body"] = theme("error", t("The body of your blog is too short."));
} }
return $error; return $error;
...@@ -207,20 +207,20 @@ function blog_page() { ...@@ -207,20 +207,20 @@ function blog_page() {
} }
break; break;
default: default:
theme("header"); print theme("header");
if (arg(1)) { if (arg(1)) {
blog_page_user(arg(1)); blog_page_user(arg(1));
} }
else { else {
blog_page_last(); blog_page_last();
} }
theme("footer"); print theme("footer");
} }
} }
else { else {
theme("header"); print theme("header");
theme("box", t("Access denied"), message_access()); print theme("box", t("Access denied"), message_access());
theme("footer"); print theme("footer");
} }
} }
...@@ -237,12 +237,12 @@ function blog_view($node, $main = 0) { ...@@ -237,12 +237,12 @@ function blog_view($node, $main = 0) {
$breadcrumb[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$breadcrumb[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid"); $breadcrumb[] = l(t("%name's blog", array("%name" => $node->name)), "blog/$node->uid");
// print the breadcrumb // print the breadcrumb
theme("breadcrumb", $breadcrumb); print theme("breadcrumb", $breadcrumb);
} }
// prepair the node content // prepair the node content
$node = blog_content($node); $node = blog_content($node);
// print the node // print the node
theme("node", $node, $main); print theme("node", $node, $main);
} }
function blog_link($type, $node = 0, $main) { function blog_link($type, $node = 0, $main) {
......
...@@ -119,7 +119,7 @@ function blog_page_user($uid) { ...@@ -119,7 +119,7 @@ function blog_page_user($uid) {
$breadcrumb[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$breadcrumb[] = l(t("Blogs"), "blog"); $breadcrumb[] = l(t("Blogs"), "blog");
$breadcrumb[] = t("%name's blog", array("%name" => $account->name)); $breadcrumb[] = t("%name's blog", array("%name" => $account->name));
theme("breadcrumb", $breadcrumb); print theme("breadcrumb", $breadcrumb);
$result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND uid = '$account->uid' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10)); $result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND uid = '$account->uid' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10));
while ($node = db_fetch_object($result)) { while ($node = db_fetch_object($result)) {
...@@ -135,7 +135,7 @@ function blog_page_last() { ...@@ -135,7 +135,7 @@ function blog_page_last() {
// Breadcrumb navigation: // Breadcrumb navigation:
$breadcrumb[] = l(t("Home"), NULL); $breadcrumb[] = l(t("Home"), NULL);
$breadcrumb[] = t("Blogs"); $breadcrumb[] = t("Blogs");
theme("breadcrumb", $breadcrumb); print theme("breadcrumb", $breadcrumb);
$result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10)); $result = pager_query("SELECT nid FROM {node} WHERE type = 'blog' AND status = 1 ORDER BY nid DESC", variable_get("default_nodes_main", 10));