Commit c05f2181 authored by Dries's avatar Dries

- Patch #572618 by effulgentsia, pwolanin, sun: all theme functions should...

- Patch #572618 by effulgentsia, pwolanin, sun: all theme functions should take a single argument. Code clean-up and performance improvement. Woot.
parent 48dd14a8
......@@ -170,7 +170,7 @@ function _batch_progress_page_nojs() {
// the error message.
ob_start();
$fallback = $current_set['error_message'] . '<br />' . $batch['error_message'];
$fallback = theme('maintenance_page', $fallback, FALSE);
$fallback = theme('maintenance_page', array('content' => $fallback, 'show_messages' => FALSE));
// We strip the end of the page using a marker in the template, so any
// additional HTML output by PHP shows up inside the page rather than below
......@@ -192,7 +192,7 @@ function _batch_progress_page_nojs() {
$url = url($batch['url'], array('query' => array('id' => $batch['id'], 'op' => $new_op)));
drupal_add_html_head('<meta http-equiv="Refresh" content="0; URL=' . $url . '">');
return theme('progress_bar', $percentage, $message);
return theme('progress_bar', array('percent' => $percentage, 'message' => $message));
}
/**
......
......@@ -320,7 +320,7 @@ function drupal_add_feed($url = NULL, $title = '') {
$stored_feed_links = &drupal_static(__FUNCTION__, array());
if (!is_null($url) && !isset($stored_feed_links[$url])) {
$stored_feed_links[$url] = theme('feed_icon', $url, $title);
$stored_feed_links[$url] = theme('feed_icon', array('url' => $url, 'title' => $title));
drupal_add_link(array('rel' => 'alternate',
'type' => 'application/rss+xml',
......@@ -650,8 +650,8 @@ function drupal_site_offline() {
drupal_maintenance_theme();
drupal_add_http_header('503 Service unavailable');
drupal_set_title(t('Site under maintenance'));
print theme('maintenance_page', filter_xss_admin(variable_get('maintenance_mode_message',
t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal'))))));
print theme('maintenance_page', array('content' => filter_xss_admin(variable_get('maintenance_mode_message',
t('@site is currently under maintenance. We should be back shortly. Thank you for your patience.', array('@site' => variable_get('site_name', 'Drupal')))))));
}
/**
......@@ -1174,7 +1174,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
drupal_set_title(t('Error'));
// We fallback to a maintenance page at this point, because the page generation
// itself can generate errors.
print theme('maintenance_page', t('The website encountered an unexpected error. Please try again later.'));
print theme('maintenance_page', array('content' => t('The website encountered an unexpected error. Please try again later.')));
exit;
}
}
......@@ -1499,7 +1499,7 @@ function t($string, array $args = array(), array $options = array()) {
case '%':
default:
// Escaped and placeholder.
$args[$key] = theme('placeholder', $value);
$args[$key] = theme('placeholder', array('text' => $value));
break;
case '!':
......@@ -3683,7 +3683,7 @@ function drupal_get_library($module, $name) {
* themed into a table. The table must have an id attribute set. If using
* theme_table(), the id may be set as such:
* @code
* $output = theme('table', $header, $rows, array('id' => 'my-module-table'));
* $output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'my-module-table')));
* return $output;
* @endcode
*
......@@ -4860,7 +4860,7 @@ function drupal_common_theme() {
'arguments' => array('region' => NULL),
),
'username' => array(
'arguments' => array('object' => NULL),
'arguments' => array('account' => NULL),
),
'progress_bar' => array(
'arguments' => array('percent' => NULL, 'message' => NULL),
......
......@@ -1162,7 +1162,7 @@ function file_save_upload($source, $validators = array(), $destination = FALSE,
if (!empty($errors)) {
$message = t('The specified file %name could not be uploaded.', array('%name' => $file->filename));
if (count($errors) > 1) {
$message .= theme('item_list', $errors);
$message .= theme('item_list', array('items' => $errors));
}
else {
$message .= ' ' . array_pop($errors);
......
This diff is collapsed.
......@@ -69,9 +69,17 @@ function locale_languages_overview_form() {
/**
* Theme the language overview form.
*
* @param $variables
* An associative array containing:
* - form: @todo: document
*
* @return
* A themed HTML string representing the form.
*
* @ingroup themeable
*/
function theme_locale_languages_overview_form($form) {
function theme_locale_languages_overview_form($variables) {
$form = $variables['form'];
$default = language_default();
foreach ($form['name'] as $key => $element) {
// Do not take form control structures.
......@@ -96,7 +104,7 @@ function theme_locale_languages_overview_form($form) {
}
}
$header = array(array('data' => t('English name')), array('data' => t('Native name')), array('data' => t('Code')), array('data' => t('Direction')), array('data' => t('Enabled')), array('data' => t('Default')), array('data' => t('Weight')), array('data' => t('Operations')));
$output = theme('table', $header, $rows, array('id' => 'language-order'));
$output = theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => array('id' => 'language-order')));
$output .= drupal_render_children($form);
drupal_add_tabledrag('language-order', 'order', 'sibling', 'language-order-weight');
......@@ -543,7 +551,7 @@ function locale_translate_overview_screen() {
$rows[$data->language][$data->textgroup] = $data->translation . '/' . $groupsums[$data->textgroup] . " ($ratio%)";
}
return theme('table', $headers, $rows);
return theme('table', array('header' => $headers, 'rows' => $rows));
}
/**
* @} End of "locale-translate-overview"
......@@ -2305,8 +2313,8 @@ function _locale_translate_seek() {
}
if (count($rows)) {
$output .= theme('table', $header, $rows);
if ($pager = theme('pager', NULL)) {
$output .= theme('table', array('header' => $header, 'rows' => $rows));
if ($pager = theme('pager', array('tags' => NULL))) {
$output .= $pager;
}
}
......
......@@ -1308,21 +1308,33 @@ function template_preprocess_menu_tree(&$variables) {
/**
* Theme wrapper for the HTML output for a menu sub-tree.
*
* @param $variables
* An associative array containing:
* - tree: @todo: document
*
* @return
* A themed HTML string.
*
* @ingroup themeable
*/
function theme_menu_tree($tree) {
return '<ul class="menu">' . $tree . '</ul>';
function theme_menu_tree($variables) {
return '<ul class="menu">' . $variables['tree'] . '</ul>';
}
/**
* Generate the HTML output for a menu link and submenu.
*
* @param $element
* Structured array data for a menu link.
* @param $variables
* An associative array containing:
* - element: Structured array data for a menu link.
*
* @return
* A themed HTML string.
*
* @ingroup themeable
*/
function theme_menu_link(array $element) {
function theme_menu_link(array $variables) {
$element = $variables['element'];
$sub_menu = '';
if ($element['#below']) {
......@@ -1335,26 +1347,31 @@ function theme_menu_link(array $element) {
/**
* Generate the HTML output for a single local task link.
*
* @param $link
* A menu link array with 'title', 'href', and 'localized_options' keys.
* @param $active
* A boolean indicating whether the local task is active.
* @param $variables
* An associative array containing:
* - link: A menu link array with 'title', 'href', and 'localized_options'
* keys.
* - active: A boolean indicating whether the local task is active.
*
* @ingroup themeable
*/
function theme_menu_local_task($link, $active = FALSE) {
return '<li ' . ($active ? 'class="active" ' : '') . '>' . l($link['title'], $link['href'], $link['localized_options']) . "</li>\n";
function theme_menu_local_task($variables) {
$link = $variables['link'];
return '<li ' . ($variables['active'] ? 'class="active" ' : '') . '>' . l($link['title'], $link['href'], $link['localized_options']) . "</li>\n";
}
/**
* Generate the HTML output for a single local action link.
*
* @param $link
* A menu link array with 'title', 'href', and 'localized_options' keys.
* @param $variables
* An associative array containing:
* - link: A menu link array with 'title', 'href', and 'localized_options'
* keys.
*
* @ingroup themeable
*/
function theme_menu_local_action($link) {
function theme_menu_local_action($variables) {
$link = $variables['link'];
return '<li>' . l($link['title'], $link['href'], $link['localized_options']) . "</li>\n";
}
......@@ -1389,7 +1406,7 @@ function menu_get_active_help() {
// Add "more help" link on admin pages if the module provides a
// standalone help page.
if ($arg[0] == "admin" && user_access('access administration pages') && module_exists('help') && $function('admin/help#' . $arg[2], $empty_arg) && $help) {
$output .= theme("more_help_link", url('admin/help/' . $arg[2]));
$output .= theme("more_help_link", array('url' => url('admin/help/' . $arg[2])));
}
}
return $output;
......@@ -1597,17 +1614,17 @@ function menu_local_tasks($level = 0) {
for ($p = $item['tab_parent']; $tasks[$p]['type'] == MENU_DEFAULT_LOCAL_TASK; $p = $tasks[$p]['tab_parent']);
// Use the path of the parent instead.
$link['href'] = $tasks[$p]['href'];
$tabs_current .= theme('menu_local_task', $link, TRUE);
$tabs_current .= theme('menu_local_task', array('link' => $link, 'active' => TRUE));
$next_path = $item['path'];
$tab_count++;
}
else {
if ($item['type'] == MENU_LOCAL_TASK) {
$tabs_current .= theme('menu_local_task', $link);
$tabs_current .= theme('menu_local_task', array('link' => $link));
$tab_count++;
}
else {
$actions_current .= theme('menu_local_action', $link);
$actions_current .= theme('menu_local_action', array('link' => $link));
$action_count++;
}
}
......@@ -1649,14 +1666,14 @@ function menu_local_tasks($level = 0) {
}
// We check for the active tab.
if ($item['path'] == $path) {
$tabs_current .= theme('menu_local_task', $link, TRUE);
$tabs_current .= theme('menu_local_task', array('link' => $link, 'active' => TRUE));
$next_path = $item['tab_parent'];
if (isset($tasks[$next_path])) {
$next_parent = $tasks[$next_path]['tab_parent'];
}
}
else {
$tabs_current .= theme('menu_local_task', $link);
$tabs_current .= theme('menu_local_task', array('link' => $link));
}
}
}
......
This diff is collapsed.
......@@ -169,7 +169,7 @@ function tablesort_header($cell, $header, $ts) {
if ($cell['data'] == $ts['name']) {
$ts['sort'] = (($ts['sort'] == 'asc') ? 'desc' : 'asc');
$cell['class'][] = 'active';
$image = theme('tablesort_indicator', $ts['sort']);
$image = theme('tablesort_indicator', array('style' => $ts['sort']));
}
else {
// If the user clicks a different header, we want to sort ascending initially.
......
This diff is collapsed.
......@@ -85,7 +85,10 @@ function _theme_load_offline_registry($theme, $base_theme = NULL, $theme_engine
*
* @ingroup themeable
*/
function theme_task_list($items, $active = NULL) {
function theme_task_list($variables) {
$items = $variables['items'];
$active = $variables['active'];
$done = isset($items[$active]) || $active == NULL;
$output = '<h2 class="element-invisible">Installation tasks</h2>';
$output .= '<ol class="task-list">';
......@@ -115,14 +118,13 @@ function theme_task_list($items, $active = NULL) {
*
* Note: this function is not themeable.
*
* @param $content
* The page content to show.
* @param $variables
* An associative array containing:
* - content: The page content to show.
*/
function theme_install_page($content) {
function theme_install_page($variables) {
drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
// Assign content.
$variables['content'] = $content;
// Delay setting the message variable so it can be processed below.
$variables['show_messages'] = FALSE;
// Variable processors invoked manually since this function and theme_update_page()
......@@ -136,7 +138,7 @@ function theme_install_page($content) {
if (isset($messages['error'])) {
$title = count($messages['error']) > 1 ? st('The following errors must be resolved before you can continue the installation process') : st('The following error must be resolved before you can continue the installation process');
$variables['messages'] .= '<h3>' . $title . ':</h3>';
$variables['messages'] .= theme('status_messages', 'error');
$variables['messages'] .= theme('status_messages', array('display' => 'error'));
$variables['content'] .= '<p>' . st('Please check the error messages and <a href="!url">try again</a>.', array('!url' => request_uri())) . '</p>';
}
......@@ -144,14 +146,14 @@ function theme_install_page($content) {
if (isset($messages['warning'])) {
$title = count($messages['warning']) > 1 ? st('The following installation warnings should be carefully reviewed') : st('The following installation warning should be carefully reviewed');
$variables['messages'] .= '<h4>' . $title . ':</h4>';
$variables['messages'] .= theme('status_messages', 'warning');
$variables['messages'] .= theme('status_messages', array('display' => 'warning'));
}
// Special handling of status messages
if (isset($messages['status'])) {
$title = count($messages['status']) > 1 ? st('The following installation warnings should be carefully reviewed, but in most cases may be safely ignored') : st('The following installation warning should be carefully reviewed, but in most cases may be safely ignored');
$variables['messages'] .= '<h4>' . $title . ':</h4>';
$variables['messages'] .= theme('status_messages', 'status');
$variables['messages'] .= theme('status_messages', array('display' => 'status'));
}
// This was called as a theme hook (not template), so we need to
......@@ -168,19 +170,16 @@ function theme_install_page($content) {
*
* Note: this function is not themeable.
*
* @param $content
* The page content to show.
* @param $show_messages
* Whether to output status and error messages.
* FALSE can be useful to postpone the messages to a subsequent page.
* @param $variables
* An associative array containing:
* - content: The page content to show.
* - show_messages: Whether to output status and error messages.
* FALSE can be useful to postpone the messages to a subsequent page.
*/
function theme_update_page($content, $show_messages = TRUE) {
function theme_update_page($variables) {
// Set required headers.
drupal_add_http_header('Content-Type', 'text/html; charset=utf-8');
// Assign content and show message flag.
$variables['content'] = $content;
$variables['show_messages'] = $show_messages;
// Variable processors invoked manually since this function and theme_install_page()
// are exceptions in how it works within the theme system.
template_preprocess($variables, 'update_page');
......@@ -192,7 +191,7 @@ function theme_update_page($content, $show_messages = TRUE) {
if (isset($messages['warning'])) {
$title = count($messages['warning']) > 1 ? 'The following update warnings should be carefully reviewed before continuing' : 'The following update warning should be carefully reviewed before continuing';
$variables['messages'] .= '<h4>' . $title . ':</h4>';
$variables['messages'] .= theme('status_messages', 'warning');
$variables['messages'] .= theme('status_messages', array('display' => 'warning'));
}
// This was called as a theme hook (not template), so we need to
......
......@@ -679,9 +679,9 @@ function install_display_output($output, $install_state) {
// Let the theming function know when every step of the installation has
// been completed.
$active_task = $install_state['installation_finished'] ? NULL : $install_state['active_task'];
drupal_add_region_content('sidebar_first', theme_task_list(install_tasks_to_display($install_state), $active_task));
drupal_add_region_content('sidebar_first', theme('task_list', array('items' => install_tasks_to_display($install_state), 'active' => $active_task)));
}
print theme($install_state['database_tables_exist'] ? 'maintenance_page' : 'install_page', $output);
print theme($install_state['database_tables_exist'] ? 'maintenance_page' : 'install_page', array('content' => $output));
exit;
}
......@@ -708,7 +708,7 @@ function install_verify_requirements(&$install_state) {
if ($severity == REQUIREMENT_ERROR) {
if ($install_state['interactive']) {
drupal_set_title(st('Requirements problem'));
$status_report = theme('status_report', $requirements);
$status_report = theme('status_report', array('requirements' => $requirements));
$status_report .= st('Check the error messages and <a href="!url">proceed with the installation</a>.', array('!url' => request_uri()));
return $status_report;
}
......@@ -1025,7 +1025,8 @@ function install_select_profile(&$install_state) {
if ($install_state['interactive']) {
include_once DRUPAL_ROOT . '/includes/form.inc';
drupal_set_title(st('Select an installation profile'));
return drupal_render(drupal_get_form('install_select_profile_form', $install_state['profiles']));
$form = drupal_get_form('install_select_profile_form', $install_state['profiles']);
return drupal_render($form);
}
else {
throw new Exception(install_no_profile_error());
......
......@@ -32,7 +32,7 @@ function aggregator_view() {
if (empty($rows)) {
$rows[] = array(array('data' => t('No feeds available. <a href="@link">Add feed</a>.', array('@link' => url('admin/content/aggregator/add/feed'))), 'colspan' => '5', 'class' => array('message')));
}
$output .= theme('table', $header, $rows);
$output .= theme('table', array('header' => $header, 'rows' => $rows));
$result = db_query('SELECT c.cid, c.title, COUNT(ci.iid) as items FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid GROUP BY c.cid, c.title ORDER BY title');
......@@ -46,7 +46,7 @@ function aggregator_view() {
if (empty($rows)) {
$rows[] = array(array('data' => t('No categories available. <a href="@link">Add category</a>.', array('@link' => url('admin/config/services/aggregator/add/category'))), 'colspan' => '5', 'class' => array('message')));
}
$output .= theme('table', $header, $rows);
$output .= theme('table', array('header' => $header, 'rows' => $rows));
return $output;
}
......
......@@ -390,7 +390,7 @@ function aggregator_block_view($delta = '') {
if ($feed = db_query('SELECT fid, title, block FROM {aggregator_feed} WHERE block <> 0 AND fid = :fid', array(':fid' => $id))->fetchObject()) {
$block['subject'] = check_plain($feed->title);
$result = db_query_range("SELECT * FROM {aggregator_item} WHERE fid = :fid ORDER BY timestamp DESC, iid DESC", 0, $feed->block, array(':fid' => $id));
$read_more = theme('more_link', url('aggregator/sources/' . $feed->fid), t("View this feed's recent news."));
$read_more = theme('more_link', array('url' => url('aggregator/sources/' . $feed->fid), 'title' => t("View this feed's recent news.")));
}
break;
......@@ -398,18 +398,18 @@ function aggregator_block_view($delta = '') {
if ($category = db_query('SELECT cid, title, block FROM {aggregator_category} WHERE cid = :cid', array(':cid' => $id))->fetchObject()) {
$block['subject'] = check_plain($category->title);
$result = db_query_range('SELECT i.* FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON ci.iid = i.iid WHERE ci.cid = :cid ORDER BY i.timestamp DESC, i.iid DESC', 0, $category->block, array(':cid' => $category->cid));
$read_more = theme('more_link', url('aggregator/categories/' . $category->cid), t("View this category's recent news."));
$read_more = theme('more_link', array('url' => url('aggregator/categories/' . $category->cid), 'title' => t("View this category's recent news.")));
}
break;
}
$items = array();
foreach ($result as $item) {
$items[] = theme('aggregator_block_item', $item);
$items[] = theme('aggregator_block_item', array('item' => $item));
}
// Only display the block if there are items to show.
if (count($items) > 0) {
$block['content'] = theme('item_list', $items) . $read_more;
$block['content'] = theme('item_list', array('items' => $items)) . $read_more;
}
return $block;
}
......@@ -642,19 +642,18 @@ function aggregator_category_load($cid) {
/**
* Format an individual feed item for display in the block.
*
* @param $item
* The item to be displayed.
* @param $feed
* Not used.
* @param $variables
* An associative array containing:
* - item: The item to be displayed.
* - feed: Not used.
*
* @return
* The item HTML.
* @ingroup themeable
*/
function theme_aggregator_block_item($item, $feed = 0) {
function theme_aggregator_block_item($variables) {
// Display the external link to the item.
return '<a href="' . check_url($item->link) . '">' . check_plain($item->title) . "</a>\n";
return '<a href="' . check_url($variables['item']->link) . '">' . check_plain($variables['item']->title) . "</a>\n";
}
/**
......
......@@ -37,7 +37,7 @@ function aggregator_page_source($arg1, $arg2 = NULL) {
// $arg1 is $form_state and $arg2 is $feed. Otherwise, $arg1 is $feed.
$feed = is_object($arg2) ? $arg2 : $arg1;
drupal_set_title($feed->title);
$feed_source = theme('aggregator_feed_source', $feed);
$feed_source = theme('aggregator_feed_source', array('feed' => $feed));
// It is safe to include the fid in the query because it's loaded from the
// database by aggregator_feed_load.
......@@ -128,9 +128,9 @@ function _aggregator_page_list($items, $op, $feed_source = '') {
// Assemble themed output.
$output = $feed_source;
foreach ($items as $item) {
$output .= theme('aggregator_item', $item);
$output .= theme('aggregator_item', array('item' => $item));
}
$output = theme('aggregator_wrapper', $output);
$output = theme('aggregator_wrapper', array('content' => $output));
}
return $output;
......@@ -163,7 +163,7 @@ function aggregator_categorize_items($items, $feed_source = '') {
'#tree' => TRUE,
);
foreach ($items as $item) {
$form['items'][$item->iid] = array('#markup' => theme('aggregator_item', $item));
$form['items'][$item->iid] = array('#markup' => theme('aggregator_item', array('item' => $item)));
$form['categories'][$item->iid] = array();
$categories_result = db_query('SELECT c.cid, c.title, ci.iid FROM {aggregator_category} c LEFT JOIN {aggregator_category_item} ci ON c.cid = ci.cid AND ci.iid = :iid', array(':iid' => $item->iid));
$selected = array();
......@@ -229,13 +229,17 @@ function aggregator_categorize_items_submit($form, &$form_state) {
/**
* Theme the page list form for assigning categories.
*
* @param $form
* An associative array containing the structure of the form.
* @param $variables
* An associative array containing:
* - form: An associative array containing the structure of the form.
*
* @return
* The output HTML.
* @ingroup themeable
*/
function theme_aggregator_categorize_items($form) {
function theme_aggregator_categorize_items($variables) {
$form = $variables['form'];
$output = drupal_render($form['feed_source']);
$rows = array();
if (!empty($form['items'])) {
......@@ -246,11 +250,11 @@ function theme_aggregator_categorize_items($form) {
);
}
}
$output .= theme('table', array('', t('Categorize')), $rows);
$output .= theme('table', array('header' => array('', t('Categorize')), 'rows' => $rows));
$output .= drupal_render($form['submit']);
$output .= drupal_render_children($form);
return theme('aggregator_wrapper', $output);
return theme('aggregator_wrapper', array('content' => $output));
}
/**
......@@ -259,7 +263,7 @@ function theme_aggregator_categorize_items($form) {
* @see aggregator-wrapper.tpl.php
*/
function template_preprocess_aggregator_wrapper(&$variables) {
$variables['pager'] = theme('pager', NULL);
$variables['pager'] = theme('pager', array('tags' => NULL));
}
/**
......@@ -306,15 +310,15 @@ function aggregator_page_sources() {
if (variable_get('aggregator_summary_items', 3)) {
$items = db_query_range('SELECT i.title, i.timestamp, i.link FROM {aggregator_item} i WHERE i.fid = :fid ORDER BY i.timestamp DESC', 0, variable_get('aggregator_summary_items', 3), array(':fid' => $feed->fid));
foreach ($items as $item) {
$summary_items[] = theme('aggregator_summary_item', $item);
$summary_items[] = theme('aggregator_summary_item', array('item' => $item));
}
}
$feed->url = url('aggregator/sources/' . $feed->fid);
$output .= theme('aggregator_summary_items', $summary_items, $feed);
$output .= theme('aggregator_summary_items', array('summary_items' => $summary_items, 'source' => $feed));
}
$output .= theme('feed_icon', url('aggregator/opml'), t('OPML feed'));
$output .= theme('feed_icon', array('url' => url('aggregator/opml'), 'title' => t('OPML feed')));
return theme('aggregator_wrapper', $output);
return theme('aggregator_wrapper', array('content' => $output));
}
/**
......@@ -329,14 +333,14 @@ function aggregator_page_categories() {
$summary_items = array();
$items = db_query_range('SELECT i.title, i.timestamp, i.link, f.title as feed_title, f.link as feed_link FROM {aggregator_category_item} ci LEFT JOIN {aggregator_item} i ON i.iid = ci.iid LEFT JOIN {aggregator_feed} f ON i.fid = f.fid WHERE ci.cid = :cid ORDER BY i.timestamp DESC', 0, variable_get('aggregator_summary_items', 3), array(':cid' => $category->cid));
foreach ($items as $item) {
$summary_items[] = theme('aggregator_summary_item', $item);
$summary_items[] = theme('aggregator_summary_item', array('item' => $item));
}
}
$category->url = url('aggregator/categories/' . $category->cid);
$output .= theme('aggregator_summary_items', $summary_items, $category);
$output .= theme('aggregator_summary_items', array('summary_items' => $summary_items, 'source' => $category));
}
return theme('aggregator_wrapper', $output);
return theme('aggregator_wrapper', array('content' => $output));
}
/**
......@@ -356,19 +360,23 @@ function aggregator_page_rss() {
}
$feeds = $result->fetchAll();
return theme('aggregator_page_rss', $feeds, $category);
return theme('aggregator_page_rss', array('feeds' => $feeds, 'category' => $category));
}
/**
* Theme the RSS output.
*
* @param $feeds
* An array of the feeds to theme.
* @param $category
* A common category, if any, for all the feeds.
* @param $variables
* An associative array containing:
* - feeds: An array of the feeds to theme.
* - category: A common category, if any, for all the feeds.
*
* @ingroup themeable
*/
function theme_aggregator_page_rss($feeds, $category = NULL) {
function theme_aggregator_page_rss($variables) {
$feeds = $variables['feeds'];
$category = $variables['category'];
drupal_add_http_header('Content-Type', 'application/rss+xml; charset=utf-8');
$items = '';
......@@ -418,17 +426,21 @@ function aggregator_page_opml($cid = NULL) {
}
$feeds = $result->fetchAll();
return theme('aggregator_page_opml', $feeds);
return theme('aggregator_page_opml', array('feeds' => $feeds));
}
/**
* Theme the OPML feed output.
*
* @param $feeds
* An array of the feeds to theme.
* @param $variables
* An associative array containing:
* - feeds: An array of the feeds to theme.
*
* @ingroup themeable
*/
function theme_aggregator_page_opml($feeds) {
function theme_aggregator_page_opml($variables) {
$feeds = $variables['feeds'];
drupal_add_http_header('Content-Type', 'text/xml; charset=utf-8');
$output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
......@@ -454,7 +466,7 @@ function theme_aggregator_page_opml($feeds) {
*/
function template_preprocess_aggregator_summary_items(&$variables) {
$variables['title'] = check_plain($variables['source']->title);
$variables['summary_list'] = theme('item_list', $variables['summary_items']);
$variables['summary_list'] = theme('item_list', array('items' => $variables['summary_items']));
$variables['source_url'] = $variables['source']->url;
}
......@@ -486,7 +498,7 @@ function template_preprocess_aggregator_summary_item(&$variables) {
function template_preprocess_aggregator_feed_source(&$variables) {
$feed = $variables['feed'];
$variables['source_icon'] = theme('feed_icon', $feed->url, t('!title feed', array('!title' => $feed->title)));
$variables['source_icon'] = theme('feed_icon', array('url' => $feed->url, 'title' => t('!title feed', array('!title' => $feed->title))));
$variables['source_image'] = $feed->image;
$variables['source_description'] = aggregator_filter_xss($feed->description);
$variables['source_url'] = check_url(url($feed->link, array('absolute' => TRUE)));
......
......@@ -37,7 +37,7 @@ function aggregator_aggregator_parse($feed) {
}
if (!empty($image['link']) && !empty($image['url']) && !empty($image['title'])) {
$image = l(theme('image', $image['url'], $image['title']), $image['link'], array('html' => TRUE));
$image = l(theme('image', array('path' => $image['url'], 'alt' => $image['title'])), $image['link'], array('html' => TRUE));
}
else {
$image = '';
......
......@@ -177,7 +177,7 @@ function blog_block_view($delta = '') {
if ($node_title_list = node_title_list($result)) {
$block['content'] = $node_title_list;
$block['content'] .= theme('more_link', url('blog'), t('Read the latest blog entries.'));
$block['content'] .= theme('more_link', array('url' => url('blog'), 'title' => t('Read the latest blog entries.')));
$block['subject'] = t('Recent blog posts');
return $block;
}
......
......@@ -55,7 +55,7 @@ function blog_page_user($account) {
drupal_set_message(t('You have not created any blog entries.'));