Forum Replies Created

Viewing 4 replies - 1 through 4 (of 4 total)
  • Forum: Plugins
    In reply to: [TimeSpan] Wrong math?
    Thread Starter FredTheAnt

    (@fredtheant)

    <logged in with old profile to mark thread as resolved>

    Forum: Plugins
    In reply to: [TimeSpan] Wrong math?
    Thread Starter FredTheAnt

    (@fredtheant)

    Just tried your fix; didn’t work. :\

    Not sure I understand why saving $content to a temp variable would help? Why would you expect different results for…

    $temp = $content;
    $word_count = str_word_count( strip_tags( $temp ) );

    versus…

    $word_count = str_word_count( strip_tags( $content ) );

    ?

    Both return the same value for $word_count, at least when I run it. Do you get different results?

    Regarding the ‘1 minutes’ thing, your code is hardcoded to show ‘minutes’ (plural) by default:

    $full .= 'minutes</p></span>';

    Forum: Plugins
    In reply to: [TimeSpan] Wrong math?
    Thread Starter FredTheAnt

    (@fredtheant)

    Couldn’t wait. Debugged it myself. ??

    The strip_tags function is removing more text than, I think, you expected it to. On the blog post I linked to above, it was truncating everything subsequent to the first inline html element included with my blog post. Specifically, it returned everything up to ‘At one point I spent something like $50 bucks on a’ and truncated the rest. The next word in that sentence is encapsulated in an anchor element. My quick fix was to remove all occurrences of strip_tags from your code. The word counts might be slightly inflated now, but that’s better than severely reduced. There’s probably a better way to address the situation, but I’m not a PHP guy. I’ll leave that to you.

    On a side note, I went ahead and added this:

    $full .= $time_in_minutes == 1 ? 'minute' : 'minutes';
    $full .= '</p></span>';

    Maybe in a future release, something like that can be included as well so that we see “1 minute” rather than “1 minutes”.

    – Nick

    Thread Starter FredTheAnt

    (@fredtheant)

    Just updated to 12.02.08… same issue….

Viewing 4 replies - 1 through 4 (of 4 total)