Plugin Directory

Changeset 3446977


Ignore:
Timestamp:
01/26/2026 09:41:34 AM (6 weeks ago)
Author:
bennettmcelwee
Message:

2.5 Don't print spurious tags at end of post

Location:
evermore/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • evermore/trunk/Readme.txt

    r1961664 r3446977  
    33Tags: extract,more,abbreviate,short,preview,teaser
    44Requires at least: 3.0
    5 Tested up to: 5.0
     5Tested up to: 6.9
    66Stable tag: 2.4
    77
     
    4848== Changelog ==
    4949
     50= 2.5 =
     51* Don't output spurious <!--more--> at the end of a post.
     52
    5053= 2.4 =
    5154* Improve compatibility with current version of WordPress.
  • evermore/trunk/evermore.php

    r1241429 r3446977  
    44Plugin URI: http://thunderguy.com/semicolon/wordpress/evermore-wordpress-plugin/
    55Description: Abbreviate all posts when viewed on multiple post pages. This makes all posts behave as if there is a "<!--more-->" at an appropriate spot inside the content.
    6 Version: 2.4
     6Version: 2.5
    77Author: Bennett McElwee
    88Author URI: http://thunderguy.com/semicolon/
    99Requires at least: 3.0
    10 Tested up to: 4.3
     10Tested up to: 6.9
    1111Licence: GPLv2 or later
    1212
    1313$Revision$
    1414
    15 Copyright (C) 2005-15 Bennett McElwee
     15Copyright (C) 2005-26 Bennett McElwee
    1616
    1717This program is free software; you can redistribute it and/or
     
    126126                $skipped_end = $matches[2];
    127127                $unskipped_paras = substr($unskipped_chars, strlen($skipped_paras) + strlen($skipped_end));
    128                 if ($link_on_new_para) {
    129                     // Add 2 newlines after the more, to stop WP adding
    130                     // a <br> after the more which leaves a spurious blank line.
    131                     return $skipped_chars . $skipped_paras . $skipped_end . "<!--more-->\n\n" . $unskipped_paras;
    132                 } else {
    133                     return $skipped_chars . $skipped_paras . '<!--more-->' . $skipped_end . $unskipped_paras;
     128                if (trim(wp_strip_all_tags($unskipped_paras)) !== '') {
     129                    // We can insert a more here, since there is more content after the skipped paras
     130                    if ($link_on_new_para) {
     131                        // Add 2 newlines after the more, to stop WP adding
     132                        // a <br> after the more which leaves a spurious blank line.
     133                        return $skipped_chars . $skipped_paras . $skipped_end . "<!--more-->\n\n" . $unskipped_paras;
     134                    } else {
     135                        return $skipped_chars . $skipped_paras . '<!--more-->' . $skipped_end . $unskipped_paras;
     136                    }
    134137                }
    135138            }
     
    162165        if ($diagnostic_reason == "") {
    163166            // We must analyse the content to determine the reason
    164             $diagnostic_reason .= "Post did not contain end-of-paragraph";
     167            $diagnostic_reason .= "Post did not contain end-of-paragraph with subsequent content";
    165168            // Mark newlines, escape HTML
    166169            $diagnostic_unskipped_chars = substr($post_content, $char_skip_count);
Note: See TracChangeset for help on using the changeset viewer.