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 kitsguru - February 10

When someone uses smart quotes in a field used in the permalink, it is encoded into the permalink.

I have added this to the plugin.

$GLOBALS['PERMALINKS']['autopopulate_skipWords']  = array("lsquo", "rsquo","ldquo","rdquo"); // array of words to remove from permalinks

Also, these two modifications around line 215

  $permalinkText = preg_replace("/\/+/", '/', $permalinkText);                // collapse multiple forward slashes
  $permalinkText = preg_replace("/\/-+/", '/', $permalinkText);               // remove - after /
Jeff Shields

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 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