diff --git a/includes/common.inc b/includes/common.inc index 31f3f426d5bfc0db8a645308e281077cf6612588..d65ebe7a256ee4dea1c599f0391344c3209b0861 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -1595,15 +1595,6 @@ function link_page() { } } -/** - * Fetch a set of links to display after a given node. - * - * The links are gathered by calls to hook_link('node') in each module. - */ -function link_node($node, $main = 0) { - return module_invoke_all('link', 'node', $node, $main); -} - /** * Perform end-of-request tasks. * diff --git a/includes/theme.inc b/includes/theme.inc index f22a775c0e75896a25f5d5241dec631d0859b322..8a32f389d3284fbb32343776a05738eee476417e 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -519,8 +519,8 @@ function theme_node($node, $teaser = FALSE, $page = FALSE) { $output .= $node->body; } - if ($links = link_node($node, $teaser)) { - $output .= '<div class="links">'. theme('links', $links) .'</div>'; + if ($node->links) { + $output .= '<div class="links">'. theme('links', $node->links) .'</div>'; } return $output; diff --git a/modules/node.module b/modules/node.module index 741a946f00430fb8ea72f5a66e54b26320c9ac1a..718e34ac2297ae4b6d2bfe591e013d3235812f10 100644 --- a/modules/node.module +++ b/modules/node.module @@ -507,11 +507,13 @@ function node_save($node) { * Whether to display only the teaser for the node. * @param $page * Whether the node is being displayed by itself as a page. + * @param $links + * Whether or not to display node links. Links are omitted for node previews. * * @return * An HTML representation of the themed node. */ -function node_view($node, $teaser = FALSE, $page = FALSE) { +function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) { $node = array2object($node); // Remove the delimiter (if any) that separates the teaser from the body. @@ -528,6 +530,9 @@ function node_view($node, $teaser = FALSE, $page = FALSE) { } // Allow modules to change $node->body before viewing. node_invoke_nodeapi($node, 'view', $teaser, $page); + if ($links) { + $node->links = module_invoke_all('link', 'node', $node, !$page); + } return theme('node', $node, $teaser, $page); } @@ -1354,13 +1359,13 @@ function node_preview($node) { // Display a preview of the node: if ($node->teaser && $node->teaser != $node->body) { $output = '<h3>'. t('Preview trimmed version') .'</h3>'; - $output .= node_view($node, 1); + $output .= node_view($node, 1, FALSE, 0); $output .= '<p><em>'. t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.') .'</em></p>'; $output .= '<h3>'. t('Preview full version') .'</h3>'; - $output .= node_view($node, 0); + $output .= node_view($node, 0, FALSE, 0); } else { - $output .= node_view($node, 0); + $output .= node_view($node, 0, FALSE, 0); } $output .= node_form($node); diff --git a/modules/node/node.module b/modules/node/node.module index 741a946f00430fb8ea72f5a66e54b26320c9ac1a..718e34ac2297ae4b6d2bfe591e013d3235812f10 100644 --- a/modules/node/node.module +++ b/modules/node/node.module @@ -507,11 +507,13 @@ function node_save($node) { * Whether to display only the teaser for the node. * @param $page * Whether the node is being displayed by itself as a page. + * @param $links + * Whether or not to display node links. Links are omitted for node previews. * * @return * An HTML representation of the themed node. */ -function node_view($node, $teaser = FALSE, $page = FALSE) { +function node_view($node, $teaser = FALSE, $page = FALSE, $links = TRUE) { $node = array2object($node); // Remove the delimiter (if any) that separates the teaser from the body. @@ -528,6 +530,9 @@ function node_view($node, $teaser = FALSE, $page = FALSE) { } // Allow modules to change $node->body before viewing. node_invoke_nodeapi($node, 'view', $teaser, $page); + if ($links) { + $node->links = module_invoke_all('link', 'node', $node, !$page); + } return theme('node', $node, $teaser, $page); } @@ -1354,13 +1359,13 @@ function node_preview($node) { // Display a preview of the node: if ($node->teaser && $node->teaser != $node->body) { $output = '<h3>'. t('Preview trimmed version') .'</h3>'; - $output .= node_view($node, 1); + $output .= node_view($node, 1, FALSE, 0); $output .= '<p><em>'. t('The trimmed version of your post shows what your post looks like when promoted to the main page or when exported for syndication. You can insert the delimiter "<!--break-->" (without the quotes) to fine-tune where your post gets split.') .'</em></p>'; $output .= '<h3>'. t('Preview full version') .'</h3>'; - $output .= node_view($node, 0); + $output .= node_view($node, 0, FALSE, 0); } else { - $output .= node_view($node, 0); + $output .= node_view($node, 0, FALSE, 0); } $output .= node_form($node); diff --git a/modules/poll.module b/modules/poll.module index 2c078f629cb31a7363418e69789b64ce84e7fedb..f55cacabfbdc0107ca66b3f95217cd1a8c57b02c 100644 --- a/modules/poll.module +++ b/modules/poll.module @@ -435,7 +435,7 @@ function poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE) { // No 'read more' link $node->body = $node->teaser = ''; - $links = link_node($node, $main); + $links = module_invoke_all('link', 'node', $node, 0); $links[] = l(t('older polls'), 'poll', array('title' => t('View the list of polls on this site.'))); if ($node->allowvotes && $block) { $links[] = l(t('results'), 'node/'. $node->nid .'/results', array('title' => t('View the current poll results.'))); diff --git a/modules/poll/poll.module b/modules/poll/poll.module index 2c078f629cb31a7363418e69789b64ce84e7fedb..f55cacabfbdc0107ca66b3f95217cd1a8c57b02c 100644 --- a/modules/poll/poll.module +++ b/modules/poll/poll.module @@ -435,7 +435,7 @@ function poll_view(&$node, $teaser = FALSE, $page = FALSE, $block = FALSE) { // No 'read more' link $node->body = $node->teaser = ''; - $links = link_node($node, $main); + $links = module_invoke_all('link', 'node', $node, 0); $links[] = l(t('older polls'), 'poll', array('title' => t('View the list of polls on this site.'))); if ($node->allowvotes && $block) { $links[] = l(t('results'), 'node/'. $node->nid .'/results', array('title' => t('View the current poll results.'))); diff --git a/modules/statistics.module b/modules/statistics.module index 568ee805b45cb910a6554ca752e7996755f4f29c..40791bc19956ba0376cef31ccd86aab16faaed88 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -629,7 +629,6 @@ function statistics_summary($dbfield, $dbrows) { $result = db_query_range('SELECT n.nid, n.title FROM {node_counter} s INNER JOIN {node} n ON s.nid = n.nid ORDER BY %s DESC', $dbfield, 0, $dbrows); while ($nid = db_fetch_array($result)) { $content = node_load(array('nid' => $nid['nid'])); - $links = link_node($content, 1); // Filter and prepare node teaser if (node_hook($content, 'view')) { @@ -641,7 +640,7 @@ function statistics_summary($dbfield, $dbrows) { $output .= '<tr><td><strong>'. l($nid['title'], 'node/'. $nid['nid'], array('title' => t('View this posting.'))) .'</strong></td><td style="text-align: right;"><small>'. t('Submitted by %a on %b', array('%a' => format_name($content), '%b' => format_date($content->created, 'large'))) .'</small></td></tr>'; $output .= '<tr><td colspan="2"><div style="margin-left: 20px;">'. $content->teaser .'</div></td></tr>'; - $output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $links) .' ]<br /><br /></td></tr>'; + $output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $content->links) .' ]<br /><br /></td></tr>'; } return $output; diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index 568ee805b45cb910a6554ca752e7996755f4f29c..40791bc19956ba0376cef31ccd86aab16faaed88 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -629,7 +629,6 @@ function statistics_summary($dbfield, $dbrows) { $result = db_query_range('SELECT n.nid, n.title FROM {node_counter} s INNER JOIN {node} n ON s.nid = n.nid ORDER BY %s DESC', $dbfield, 0, $dbrows); while ($nid = db_fetch_array($result)) { $content = node_load(array('nid' => $nid['nid'])); - $links = link_node($content, 1); // Filter and prepare node teaser if (node_hook($content, 'view')) { @@ -641,7 +640,7 @@ function statistics_summary($dbfield, $dbrows) { $output .= '<tr><td><strong>'. l($nid['title'], 'node/'. $nid['nid'], array('title' => t('View this posting.'))) .'</strong></td><td style="text-align: right;"><small>'. t('Submitted by %a on %b', array('%a' => format_name($content), '%b' => format_date($content->created, 'large'))) .'</small></td></tr>'; $output .= '<tr><td colspan="2"><div style="margin-left: 20px;">'. $content->teaser .'</div></td></tr>'; - $output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $links) .' ]<br /><br /></td></tr>'; + $output .= '<tr><td style="text-align: right;" colspan="2">[ '. theme('links', $content->links) .' ]<br /><br /></td></tr>'; } return $output; diff --git a/scripts/prefix.sh b/scripts/prefix.sh index 00793a8a52f8b60718d3491b30d20a25eca1085d..8c7f9365524f7b250b29893e8ef810d6ac1f8426 100644 --- a/scripts/prefix.sh +++ b/scripts/prefix.sh @@ -1,7 +1,7 @@ #!/bin/sh if [ $# != 2 ]; then - cat >&2 << EOH + cat >&2 << EOH This is Drupal database prefixer. Usage: diff --git a/themes/chameleon/chameleon.theme b/themes/chameleon/chameleon.theme index d81ed752e252731b859a93a2ba82e988460baf9f..b6c979311a121b3ecf1e11b403faea75d075061c 100644 --- a/themes/chameleon/chameleon.theme +++ b/themes/chameleon/chameleon.theme @@ -136,8 +136,8 @@ function chameleon_node($node, $main = 0, $page = 0) { $terms = taxonomy_link("taxonomy terms", $node); } - if ($links = link_node($node, $main)) { - $output .= " <div class=\"links\">". theme('links', array_merge($submitted, $terms, $links)) ."</div>\n"; + if ($node->links) { + $output .= " <div class=\"links\">". theme('links', array_merge($submitted, $terms, $node->links)) ."</div>\n"; } $output .= "</div>\n"; diff --git a/themes/engines/xtemplate/xtemplate.engine b/themes/engines/xtemplate/xtemplate.engine index 691b1e8d0bb3501094e742e60565193a81161902..253e3e85a648d8bf5cdca1964d8f61a835215283 100644 --- a/themes/engines/xtemplate/xtemplate.engine +++ b/themes/engines/xtemplate/xtemplate.engine @@ -63,8 +63,8 @@ function xtemplate_node($node, $main = 0, $page = 0) { $xtemplate->template->parse("node.taxonomy"); } - if ($links = link_node($node, $main)) { - $xtemplate->template->assign("links", theme_links($links)); + if ($node->links) { + $xtemplate->template->assign("links", theme_links($node->links)); $xtemplate->template->parse("node.links"); }