html entities in permalink and extraneous forward slash and dash

4 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: March 18   (RSS)

By Dave - February 22

Hi Jeff, 

Thanks so much for the report and code suggestions. 

There might be even more HTML entities so we decided to call html_entity_decode() so unknown chars can be filtered out and we don't to list them all in autopopulate_skipWords.

Can you try the attached plugin and let me know if resolves the issue for you?  If so we'll release this update.

Dave Edis - Senior Developer
interactivetools.com
Attachments:

permalinks.php 28K

By kitsguru - February 22

This line is actually dash not underscore which is a good thing, but removing the underscores would also be good

$permalinkText = preg_replace("/(^-+|-+$)/", '', $permalinkText);           // remove leading and trailing underscores

should be

  $permalinkText = preg_replace("/(^-+|-+$)/", '', $permalinkText);           // remove leading and trailing dashes
  $permalinkText = preg_replace("/(^_+|_+$)/", '', $permalinkText);           // remove leading and trailing undeerscores

There is some debate on whether underscores should be replaced with dash.

Replacing & with 'and' can lead to poor a permalink, i.e. good&bad gets converted to goodandbad where good-and-bad would be better.

Anyway, that's what I came up with so far.

Jeff Shields

By Dave - March 18

Hi Jeff, 

Thanks for the feedback! We've released permalinks v1.12 with the following changes: 

- Automatically remove “smart” ‘quotes’ instead of encoding them as HTML entities (lsquo, rsquo, etc.)
- Automatically remove periods when creating permalinks
- Add spaces when replacing & so "this&that" becomes "this-and-that" instead of "thisandthat"
- Misc Code and other minor improvements

The latest version can be downloaded here: https://www.interactivetools.com/plugins/permalinks/

Dave Edis - Senior Developer
interactivetools.com