Index: ed_readmore.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/ed_readmore/ed_readmore.module,v retrieving revision 1.5.8.2.2.11.2.6 diff -u -p -r1.5.8.2.2.11.2.6 ed_readmore.module --- ed_readmore.module 15 Sep 2009 20:06:58 -0000 1.5.8.2.2.11.2.6 +++ ed_readmore.module 15 Sep 2009 23:02:15 -0000 @@ -31,6 +31,7 @@ define('ED_READMORE_TEXT_DEFAULT', t(' '
', + 'blockquote' => '
', + 'cite' => '', + 'div' => '
', + 'h1' => '

', + 'h2' => '

', + 'h3' => '

', + 'h4' => '

', + 'h5' => '

', + 'h6' => '
', + 'p' => '

', + 'span' => '', + ); + $form['ed_readmore_display'] = array( '#type' => 'fieldset', '#title' => t('Read More link display options'), '#collapsible' => FALSE, ); - $form['ed_readmore_display']['ed_readmore_placement'] = array( '#type' => 'radios', '#title' => t('Link placement'), @@ -70,7 +85,15 @@ function ed_readmore_admin_settings() { '#default_value' => variable_get('ed_readmore_placement', ED_READMORE_PLACEMENT_DEFAULT), '#description' => t('For more information about how this is done, read this Angry Donuts post.', array('@link' => url('http://www.angrydonuts.com/the_nuisance_of_the_read_more_fl'))), ); - + $form['ed_readmore_display']['ed_readmore_elements'] = array( + '#type' => 'select', + '#title' => t('Elements'), + '#description' => t('Select the elements into which the Read More link may be inserted, if added inline.'), + '#multiple' => TRUE, + '#options' => $elements, + '#default_value' => variable_get('ed_readmore_elements', array('p')), + '#size' => 10, + ); $form['ed_readmore_display']['ed_readmore_remove'] = array( '#type' => 'checkbox', '#title' => t('Remove Read More link from links section'), @@ -83,7 +106,6 @@ function ed_readmore_admin_settings() { '#title' => t('Read More link formatting and attributes'), '#collapsible' => FALSE, ); - $form['ed_readmore_formatting']['ed_readmore_text'] = array( '#type' => 'textfield', '#title' => t('Link text'), @@ -91,7 +113,6 @@ function ed_readmore_admin_settings() { '#description' => t('Enter the text you wish to display in the Read More link. May contain HTML. Special characters should be encoded (like %raquo or %amp). Spaces will be changed to non-breaking spaces (%nbsp).', array('%raquo' => '»', '%amp' => '&', '%nbsp' => ' ')), '#required' => TRUE, ); - $form['ed_readmore_formatting']['ed_readmore_title'] = array( '#type' => 'textfield', '#title' => t('Link title'), @@ -99,14 +120,12 @@ function ed_readmore_admin_settings() { '#description' => t('Enter the text you wish to be used as the title for the Read More link (the value of the %title attribute). It is used for accessibility and search engine optimization purposes and appears as a tooltip in some browsers.', array('%title' => 'title=""')), '#required' => FALSE, ); - $form['ed_readmore_formatting']['ed_readmore_nofollow'] = array( '#type' => 'checkbox', '#title' => t('Make link nofollow'), '#default_value' => variable_get('ed_readmore_nofollow', TRUE), '#description' => t('Adds %nofollow to the link\'s attributes. Often used for search engine optimization purposes.', array('%nofollow' => 'rel="nofollow"')), ); - $form['ed_readmore_formatting']['ed_readmore_separator'] = array( '#type' => 'textfield', '#title' => t('Separator'), @@ -150,10 +169,12 @@ function ed_readmore_preprocess_node(&$v */ function ed_readmore_link_place($teaser, $node, $display) { if ($display == 'inline') { - $block_tags = '(?:p)'; - // Get last position of the last closing marker - // If found, insert the link before the marker - if (preg_match('!]*>s*$!mi', $teaser, $match, PREG_OFFSET_CAPTURE)) { + $elements_array = variable_get('ed_readmore_elements', array('p')); + $elements = '(?:'. implode('|', $elements_array) .')'; + + // Get last position of the last closing markers + // If found, insert the link before the markers + if (preg_match('!(]*>)+s*$!mi', $teaser, $match, PREG_OFFSET_CAPTURE)) { $teaser = substr_replace($teaser, ed_readmore_link_render($node, $display), $match[0][1], 0); } /*