Index: microsummary.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/microsummary/microsummary.module,v retrieving revision 1.4.2.4 diff -u -p -r1.4.2.4 microsummary.module --- microsummary.module 9 Jun 2008 21:23:43 -0000 1.4.2.4 +++ microsummary.module 2 Jul 2009 22:21:31 -0000 @@ -65,6 +65,17 @@ function microsummary_menu($may_cache) { 'type' => MENU_NORMAL_ITEM, ); + if (variable_get('microsummary_teasers', FALSE)) { + $items[] = array( + 'path' => 'microsummary', + 'title' => t('Custom Microsummary'), + 'description' => t('Microsummary Pages.'), + 'callback' => 'microsummary_page', + 'callback arguments' => array('node'), + 'access' => user_access('access content'), + 'type' => MENU_CALLBACK, + ); + } else { // Show the custom microsummary nodes if configured. $nids = variable_get('microsummary_nids', FALSE); if ($nids) { @@ -83,6 +94,7 @@ function microsummary_menu($may_cache) { } } } + } if (variable_get('microsummary_default_inclusion', TRUE)) { drupal_set_html_head(microsummary_get_links()); @@ -109,6 +121,11 @@ function microsummary_admin_settings() { '#description' => t("Using microsummary's default inclusion method is easier but may be a performance problem on busy websites. If you use the block method then you should shut this off to remove duplicate microsummaries."), ); + $form["general"]["microsummary_teasers"] = array('#type' => 'checkbox', + '#title' => t('Enable microsummies for any node with a teaser.'), + '#default_value' => variable_get('microsummary_teasers', FALSE), + '#description' => t("Using microsummary's default inclusion method is easier but may be a performance problem on busy websites. If you use the block method then you should shut this off to remove duplicate microsummaries."), + ); $form["general"]["microsummary_nids"] = array('#type' => 'textarea', '#title' => t('Microsummary nodes'), '#default_value' => variable_get('microsummary_nids', ''), @@ -174,7 +191,7 @@ function microsummary_page($type) { case 'node': $node = node_load(arg(1)); - $output = str_replace(array("\r\n", "\n", "\r"), "", check_markup($node->body, $node->format, FALSE)); + $output = str_replace(array("\r\n", "\n", "\r"), "", check_markup(node_teaser($node->body, $node->format), $node->format, FALSE)); break; default: $output = t('Whoops - Configure your microsummaries!'); @@ -213,7 +230,7 @@ function microsummary_get_links() { $nids = variable_get('microsummary_nids', FALSE); //Only parse this data if we need it. - if (variable_get('microsummary_show_defaults', TRUE) || $nids) { + if (variable_get('microsummary_show_defaults', TRUE) || $nids || variable_get('microsummary_teasers', FALSE)) { $protocol = 'http://'; // Are we on a secure page? @@ -238,11 +255,20 @@ function microsummary_get_links() { $output .= ''; } + // If the current page has a node id, advertise it here. + if (variable_get('microsummary_teasers', FALSE) && ('node' === arg(0))) { + $nid = intval(arg(1)); + if ($nid) { + $output .= ''; + } + } // If there are nodes configured for microsummary, advertise those. if ($nids) { foreach (explode(',', $nids) as $nid) { $output .= ''; } } + + return $output; }