[buddypress-trac] [BuddyPress] #3452: Long Inserted Image in Post doesn't Render in Activity Stream
buddypress-trac at lists.automattic.com
buddypress-trac at lists.automattic.com
Sun Aug 14 16:22:35 UTC 2011
#3452: Long Inserted Image in Post doesn't Render in Activity Stream
-------------------------+------------------
Reporter: nahummadrid | Owner:
Type: defect | Status: new
Priority: normal | Milestone: 1.5
Component: Activity | Version: 1.5
Severity: normal | Resolution:
Keywords: has-patch |
-------------------------+------------------
Comment (by boonebgorges):
OK, good call. I hadn't seen that.
In 3452.02.patch I implement your first two suggestions.
As for the multibyte issue. In most places, I think that the non-multibyte
equivalent will be fine.
- Using strlen() instead of mb_strlen() means that sometimes the excerpt
will end up being shorter than intended (because multibyte characters will
have each of their bytes counted), but this is not the end of the world.
(In languages where it makes a huge difference, because most characters
are multibyte, a filter can be placed on 'bp_excerpt_length' to make the
number larger by default. Imprecise, but better than nothing.)
- Using strrpos() instead of mb_strrpos() - doesn't really make a
difference, as long as we're consistent. mb_strrpos() is used in Cake to
get the final position of a whitespace character, so that words aren't
broken. strrpos( $truncate, ' ' ); and mb_strrpos( $truncate, ' ' ); will
give different values, but as long as we're consistent in how they're used
(and as long as we use either substr or mb_substr, as appropriate, when
trimming) I don't think there will be an issue.
The remaining problem with multibyte, aside from excerpt length, is that
MB characters can sometimes get cut in the middle. When !$exact (ie when
we only break on word breaks) it won't be an issue, since we'll be
chopping everything after the last space anyway. For other cases, I've
stolen some code from wp_html_excerpt() to remove partial entities at the
end of the string.
In 3452.02.patch, I have simply taken out the mb_ functions. What do you
think instead of providing our own versions of these functions (maybe in
bp-core-wpabstraction.php or something)? They would simply return the non-
multibyte return value if the MB function doesn't exist. That way, the mb_
functions could be used if they exist, which it seems like will be more
likely to be true in parts of the world where it's more important.
--
Ticket URL: <https://buddypress.trac.wordpress.org/ticket/3452#comment:9>
BuddyPress <http://buddypress.org/>
BuddyPress
More information about the buddypress-trac
mailing list