191 lines
5.8 KiB
Plaintext
191 lines
5.8 KiB
Plaintext
<?php
|
|
// $Id$
|
|
|
|
/**
|
|
* @file
|
|
* A slim, CSS-driven theme which does not depend on a template engine like phptemplate
|
|
*/
|
|
|
|
/**
|
|
* Implementation of hook_theme. Auto-discover theme functions.
|
|
*/
|
|
function chameleon_theme($existing, $type, $theme, $path) {
|
|
return drupal_find_theme_functions($existing, array($theme));
|
|
}
|
|
|
|
function chameleon_page($content, $show_blocks = TRUE, $show_messages = TRUE) {
|
|
$language = $GLOBALS['language']->language;
|
|
$direction = $GLOBALS['language']->direction ? 'rtl' : 'ltr';
|
|
|
|
if (theme_get_setting('toggle_favicon')) {
|
|
drupal_set_html_head('<link rel="shortcut icon" href="' . check_url(theme_get_setting('favicon')) . '" type="image/x-icon" />');
|
|
}
|
|
|
|
$title = drupal_get_title();
|
|
$rdf_namespaces = drupal_get_rdf_namespaces();
|
|
|
|
// Get blocks before so that they can alter the header (JavaScript, Stylesheets etc.)
|
|
$blocks_left = theme_blocks('left');
|
|
$blocks_right = theme_blocks('right');
|
|
|
|
$output = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML+RDFa 1.0//EN\" \"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd\">\n";
|
|
$output .= "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"$language\" dir=\"$direction\"\n";
|
|
$output .= " $rdf_namespaces>\n";
|
|
$output .= "<head profile=\"http://ns.inria.fr/grddl/rdfa/\">\n";
|
|
$output .= " <title>" . ($title ? strip_tags($title) . " | " . variable_get("site_name", "Drupal") : variable_get("site_name", "Drupal") . " | " . variable_get("site_slogan", "")) . "</title>\n";
|
|
$output .= drupal_get_html_head();
|
|
$output .= drupal_get_css();
|
|
$output .= drupal_get_js();
|
|
$output .= "</head>";
|
|
$output .= "<body>\n";
|
|
$output .= " <div id=\"header\">";
|
|
|
|
if ($logo = theme_get_setting('logo')) {
|
|
$output .= " <a href=\"" . url() . "\" title=\"" . t('Home') . "\"><img src=\"$logo\" alt=\"" . t('Home') . "\" /></a>";
|
|
}
|
|
if (theme_get_setting('toggle_name')) {
|
|
$output .= " <h1 class=\"site-name title\">" . l(variable_get('site_name', 'drupal'), "") . "</h1>";
|
|
}
|
|
if (theme_get_setting('toggle_slogan')) {
|
|
$output .= " <div class=\"site-slogan\">" . variable_get('site_slogan', '') . "</div>";
|
|
}
|
|
|
|
$output .= "</div>\n";
|
|
|
|
$main_menu = theme('links', menu_main_menu(), array('class' => 'links', 'id' => 'navlist'));
|
|
$secondary_menu = theme('links', menu_secondary_menu(), array('class' => 'links', 'id' => 'subnavlist'));
|
|
if (isset($main_menu) || isset($secondary_menu)) {
|
|
$output .= ' <div class="navlinks">';
|
|
if (isset($main_menu)) {
|
|
$output .= $main_menu;
|
|
}
|
|
if (isset($secondary_menu)) {
|
|
$output .= $secondary_menu;
|
|
}
|
|
$output .= " </div>\n";
|
|
}
|
|
|
|
$output .= " <table id=\"content\">\n";
|
|
$output .= " <tr>\n";
|
|
|
|
if ($show_blocks && !empty($blocks_left)) {
|
|
$output .= " <td id=\"sidebar-left\">$blocks_left</td>\n";
|
|
}
|
|
|
|
$output .= " <td id=\"main\">\n";
|
|
|
|
if ($title) {
|
|
$output .= theme("breadcrumb", drupal_get_breadcrumb());
|
|
$output .= "<h2>$title</h2>";
|
|
}
|
|
|
|
if ($tabs = theme('menu_local_tasks')) {
|
|
$output .= $tabs;
|
|
}
|
|
|
|
if ($show_messages) {
|
|
$output .= theme('status_messages');
|
|
}
|
|
|
|
$output .= theme('help');
|
|
|
|
$output .= "\n<!-- begin content -->\n";
|
|
$output .= $content;
|
|
$output .= drupal_get_feeds();
|
|
$output .= "\n<!-- end content -->\n";
|
|
|
|
if ($footer = variable_get('site_footer', '')) {
|
|
$output .= " <div id=\"footer\">$footer</div>\n";
|
|
}
|
|
|
|
$output .= " </td>\n";
|
|
|
|
if ($show_blocks && !empty($blocks_right)) {
|
|
$output .= " <td id=\"sidebar-right\">$blocks_right</td>\n";
|
|
}
|
|
|
|
$output .= " </tr>\n";
|
|
$output .= " </table>\n";
|
|
|
|
$output .= theme_closure();
|
|
$output .= " </body>\n";
|
|
$output .= "</html>\n";
|
|
|
|
return $output;
|
|
}
|
|
|
|
function chameleon_node($node, $teaser = 0) {
|
|
|
|
$output = "<div class=\"node" . ((!$node->status) ? ' node-unpublished' : '') . (($node->sticky) ? ' sticky' : '') . "\">\n";
|
|
|
|
if (!$page) {
|
|
$output .= " <h2 class=\"title\">" . ($teaser ? l($node->title, "node/$node->nid") : check_plain($node->title)) . "</h2>\n";
|
|
}
|
|
|
|
$output .= " <div class=\"content\">\n";
|
|
|
|
if ($teaser && $node->teaser) {
|
|
$output .= $node->teaser;
|
|
}
|
|
elseif (isset($node->body)) {
|
|
$output .= $node->body;
|
|
}
|
|
|
|
$output .= " </div>\n";
|
|
|
|
$submitted = '';
|
|
if (variable_get('node_submitted_' . $node->type, TRUE)) {
|
|
$submitted = t("By !author at @date", array('!author' => theme('username', $node), '@date' => format_date($node->created, 'small')));
|
|
}
|
|
|
|
$terms = '';
|
|
if (!empty($node->content['links']['terms'])) {
|
|
$terms = drupal_render($node->content['links']['terms']);
|
|
}
|
|
|
|
$links = '';
|
|
if ($node->content['links']) {
|
|
$links = drupal_render($node->content['links']);
|
|
}
|
|
|
|
if (!empty($terms) || !empty($links)) {
|
|
$output .= '<div class="links">' . $terms . $links . $submitted . "</div>\n";
|
|
}
|
|
|
|
$output .= "</div>\n";
|
|
|
|
if ($node->content['comments']) {
|
|
$output .= drupal_render($node->content['comments']);
|
|
}
|
|
|
|
return $output;
|
|
}
|
|
|
|
function chameleon_comment($comment, $node, $links = array()) {
|
|
$submitted['comment_submitted'] = array(
|
|
'title' => t('By !author at @date', array('!author' => theme('username', $comment), '@date' => format_date($comment->timestamp, 'small'))),
|
|
'html' => TRUE);
|
|
|
|
$output = "<div class=\"comment\">\n";
|
|
$output .= " <h3 class=\"title\">" . l($comment->subject, $_GET['q'], array('fragment' => "comment-$comment->cid")) . "</h3>\n";
|
|
$output .= " <div class=\"content\">" . $comment->comment;
|
|
if (!empty($comment->signature)) {
|
|
$output .= " <div class=\"clear-block\">";
|
|
$output .= "<div>—</div>\n";
|
|
$output .= $comment->signature . "\n";
|
|
$output .= " </div>\n";
|
|
}
|
|
$output .= " </div>\n";
|
|
$output .= " <div class=\"links\">" . theme('links', array_merge($submitted, $links)) . "</div>\n";
|
|
$output .= "</div>\n";
|
|
|
|
return $output;
|
|
}
|
|
|
|
function chameleon_help() {
|
|
if ($help = menu_get_active_help()) {
|
|
return '<div class="help">' . $help . '</div><hr />';
|
|
}
|
|
}
|
|
|