Categories
Package/plugin/module WordPress

Text Replace v3.0

I’d like to announce the official release of the updated Text Replace plugin (v3.0) for WordPress.

Replace text with other text. Handy for creating shortcuts to common, lengthy, or frequently changing text/HTML, or for smilies.

The plugin’s official homepage is located at :
coffee2code.com/wp-plugins/text-replace.

Significant and recommended update. Highlights: re-implementation; added more settings and hooks for customization; allow replacing HTML; allow case insensitivity; disable autowrap in textarea; misc improvements; verified WP 3.0 compatibility; dropped compatibility with WP older than 2.8.

Comments welcome on this post for this version of the plugin. Comments will be closed once this release has been superseded by another.

Read more for a detailed ChangeLog of the release.

Detailed ChangeLog

These are the detailed changes, which may or may not make sense to you depending on your familiarity with the previous features and internals of the plugin.

  • Re-implementation by extending C2C_Plugin_012, which among other things adds support for:
  • * Reset of options to default values
  • * Better sanitization of input values
  • * Offload of core/basic functionality to generic plugin framework
  • * Additional hooks for various stages/places of plugin operation
  • * Easier localization support
  • Full localization support
  • Allow for replacement of tags, not just text wrapped by tags
  • Disable auto-wrapping of text in the textarea input field for replacements
  • Support localization of strings
  • Add option to indicate if text replacement should be case sensitive. Default is true.
  • NOTE: The plugin is now by default case sensitive when searching for potential replacements
  • For text_replace(), remove ‘case_sensitive’ argument
  • Allow filtering of text replacements via ‘c2c_text_replace’ filter
  • Allow filtering of hooks that get text replaced via ‘c2c_text_replace_filters’ filter
  • Allow filtering/overriding of text_replace_comments option via ‘c2c_text_replace_comments’ filter
  • Allow filtering/overriding of case_sensitive option via ‘c2c_text_replace_case_sensitive’ filter
  • Filter ‘widget_text’ for text replacement
  • Rename class from ‘TextReplace’ to ‘c2c_TextReplace’
  • Assign object instance to global variable, $c2c_text_replace, to allow for external manipulation
  • Remove docs from top of plugin file (all that and more are in readme.txt)
  • Change description
  • Update readme
  • Minor code reformatting (spacing)
  • Add Filters and Upgrade Notice sections to readme.txt
  • Add .pot file
  • Update screenshot
  • Add PHPDoc documentation
  • Add package info to top of file
  • Update copyright date
  • Remove trailing whitespace

12 replies on “Text Replace v3.0”

It doesn’t support wildcards at the moment. But it’s a good idea. I’ll make note of it for potential inclusion in a future release. There are, of course, performance concerns related to supporting wildcards, so that’ll be something I’ll make clear. I’d probably have them defined via a separate input field.

Hi, I’ve enjoyed using this plugin for quite awhile now (thanks!). With my last WordPress upgrade to 3.3.1, however, it appears to have stopped working. Text that was previously replaced is no longer modified. I haven’t changed anything other than just doing the upgrade. I confirmed the plugin is still enabled, and I have the latest, version 3.2.1. Can anyone confirm that version 3.2.1 is still working for them with WordPress 3.3.1?

Hi Troy, did you have v3.2.1 of the plugin running under the version of WordPress you were running before v3.3.1? (Which version of WP were you upgrading from, by the way?)

If so, then just to confirm: you had the latest version of the plugin (v3.2.1) running under your previous version of WP. And then after updating WP, the text replacements stopped working?

I just want to rule out you updating both the plugin and WP at the same time. Can you also confirm that your text replacement rules are still defined? And one thing: can you paste a few example text replacement entries so I can test them out.

Basically, I just upgrade whenever I see an upgrade is available, whether it be for WP or for any of my plugins.

I believe I was running v3.2.1 with WP v3.3.0 prior to the upgrade. I can’t swear that combo was working either, as I only recently noticed that Text Replace wasn’t working.

My text replacement rules are still there. Yesterday I tried changing them just to see if that would help.

I have 14 lines, all of this form:

[book:0520261402] => Arachnidsby Jan Beccaloni

Whenever I add a new rule I always test it, so the last time I added one it was working, but I don’t recall what versions I had at the time.

Thanks for helping out. I really just wanted some confirmation that you’ve seen the latest version of the plugin work with the latest version of wordpress.

I see the rule was rendered as HTML, let’s try it this way.

[book:0520261402] => <div style="clear:both;padding-top:5px;"><a href="http://www.amazon.com/exec/obidos/ASIN/0520261402/naturecloseups-20"><img style="float:left;padding-right:5px;border:0;" alt="" src="/amazon/0520261402.jpg" /><small><b>Arachnids</b></small></a><br/><small>by Jan Beccaloni</small></div>

It works for me under WP 3.3+, as well as under Multisite. I’ve only had one report of replacements not working for someone. There are a fair number of users for the plugin, so I’d hear about it if it completely broke for everyone.

To rule out one possibility, could you change one of your replacements to search for parentheses instead of square brackets? So your example above would be:


(book:0520261402) => <div style="clear:both;padding-top:5px;"><a href="http://www.amazon.com/exec/obidos/ASIN/0520261402/naturecloseups-20"><img style="float:left;padding-right:5px;border:0;" alt="" src="/amazon/0520261402.jpg" /><small><b>Arachnids</b></small></a><br/><small>by Jan Beccaloni</small></div>

And then use “(book:0520261402)” in a post. Does that work any better? The square brackets could be interpreted as shortcodes. While that doesn’t pose a problem on my test setups, I just want to rule it out as an issue for you before investigating further. Let me know how that goes.

I decided to try just deactivating, deleting, and readding the plugin. I copied off my rules and then restored them. That didn’t have any effect. Still didn’t work.

Then I removed all but one rule and tried changing the brackets to parentheses. I worked with one of my pages and made changes and previewed. Still didn’t work.

Then I changed the parentheses to colons (e.g. “:book:0520261402:”). That worked! I tried going back to brackets and then parentheses, previewing each time. I repeated that cycle a few times and confirmed that it only works for me with colons. Does that help diagnose the issue?

I’ll see if you have an idea on how to resolve the issue. If not, I’ll just switch to colons I guess. The trick will be finding some way to update all my existing entries. Maybe I can come up with some clever SQL to update everything at once.

Thanks again for investigating.

Nice job trying out different variations! It did end up helping me diagnose the issue. I just released v3.2.2 of the plugin. Revert back to the original rules you had and try them out with this latest version. Let me know, but I think that should do it for you.

Leave a Reply

Your email address will not be published.