Thursday, January 19, 2012

[Solved] chrome-auto-translate-plugin-dialog of Auto-Translate extension of Chrome

It's surprising to me that there are many wordpress plugins that are similar to mine. Some of them are:
  • re.place
  • Real-Time Find and Replace
  • Search Regex
  • Word Replacer
  • WP RegEx Replace
I know that adding another new 'the-same' plugin is not cool. So I decided to test them if they can solve my initial problem - remove html that is automatically inserted with Auto-Translate chrome extension, i.e. div with id chrome-auto-translate-plugin-dialog.
The regexp pattern that find Auto-Translate code is:

<div id=.-chrome-auto-translate-plugin-dialog[^>]*>[\n ]*<div [^>]*><.div>[\n ]*<img [^>]*>[\n ]*<.div>

And I started to test each plugin if it can automatically find this pattern and remove Auto-Translate extension code from TinyMCE editor. Plugins: 're.place', 'Real-Time Find and Replace', 'Word Replacer' didn't replace chrome-auto-translate-plugin-dialog divs. 'Search Regex' plugin find error in my pattern and report error in it's php file. Plugin 'WP RegEx Replace' - escapes all backslashes, so you cannot specify any special symbol (for example, '\n').

So, if you want to remove chrome-auto-translate-plugin-dialog from your wordpress editor use HTML Regex Replace plugin, and the Regexp is:
<div id=.-chrome-auto-translate-plugin-dialog[^>]*>[\n ]*<div [^>]*><.div>[\n ]*<img [^>]*>[\n ]*<.div>

No comments:

Post a Comment