RELEASE EasySocial 3.2.18 Released! Seamless mobile experience and more! 📲 🔍

Helpdesk

Proper formatting for Twitter

The tag stripping made Twitter posts look terrible, so I changed the code. I'd love to see you guys do this in the next release so I don't have to keep replacing the code ;)

In short - change paragraph and break tags to newlines BEFORE stripping tags. This makes formatting correct.


// Replace the {introtext} tag

if (EBString::stristr($content, '{introtext}') !== false) {

$search[] = '{introtext}';

// Don't strip tags, so we can put newlines in for <p> and <br> elements first
$introText = $post->getIntro();

$introText = str_ireplace("<p>", "\n\n", $introText);
$introText = str_ireplace("<br>", "\n", $introText);
$introText = str_ireplace("<br/>", "\n", $introText);
$introText = str_ireplace("<br />", "\n", $introText);

// Now we can strip the tags, which will clean up the text

$introText = EBString::substr(strip_tags($introText), 0, 230) . JText::_('COM_EASYBLOG_ELLIPSES');

$replace[] = $introText;
}

This section can only be seen by users with a valid subscription.
If you have a valid subscription, please login now

Your time
Stack Ideas HQ
Support is
Online

The support team is online and will be able to answer your inquiries. Please stay calm, follow the rules and do not cross post.

We will attend to you as soon as we can.

Buy Us Coffee

Are you happy with our support and would like to buy us a cup of coffee?

$
Enjoy the Coffee!
Service via PayPal
Subscribe for product updates & promotions