Pi Zi
Forum Replies Created
-
Forum: Plugins
In reply to: [WP Mailto Links - Protect Email Addresses] PHP errorEldenroot, can you be more specific?
What’s the error? Does it appear in the admin part or on the site?Forum: Plugins
In reply to: [External Links - nofollow, noopener & new window] Broke my websiteWP No External Links is an other plugin.
(see here)Forum: Plugins
In reply to: [External Links - nofollow, noopener & new window] Set up exclusion by code?Thanks Martin!
Forum: Plugins
In reply to: [External Links - nofollow, noopener & new window] Set up exclusion by code?pfff…sorry still some test code…
Now I tested it exactly the way you want to implement it. And this works on my local WP installation:function external_link_filter($created_link, $original_link, $label, $attrs = array()) { if (isset($attrs['class']) && strpos($attrs['class'], 'gajnfads') !== false) { return $original_link; } return $created_link; } add_filter('wpel_external_link', 'external_link_filter', 10, 4);Forum: Plugins
In reply to: [External Links - nofollow, noopener & new window] Set up exclusion by code?Sorry I copy/pasted from my testing code, but that’s part of a test-class. Try this:
function external_link_filter($created_link, $original_link, $label, $attrs = array()) { if (isset($attrs['class']) && strpos($attrs['class'], 'gajnfads') !== false) { return $original_link; } return '<b>'. $created_link .'</b>'; } add_filter('wpel_external_link', array($this, 'external_link_filter'), 10, 4);(1) Because searching for plain emailaddresses does not work always correctly. F.e. sometimes an input field already has a prefilled emailaddress, which the plugin will then convert into a protected mailto link.
(2) The plugin does not scan the whole page (instead of WPML), but only the posts, comments and text-widgets, and not the <head>. Both plugins have a different (technical) approach.
Forum: Plugins
In reply to: [External Links - nofollow, noopener & new window] Set up exclusion by code?You will need to use the filter
wpel_external_link. In your case it would look like:public function external_link_filter($created_link, $original_link, $label, $attrs = array()) { if (isset($attrs['class']) && strpos($attrs['class'], 'gajnfads') !== false) { return $original_link; } $this->external_link_filter_args = func_get_args(); return '<b>'. $created_link .'</b>'; } add_filter('wpel_external_link', array($this, 'external_link_filter'), 10, 4);I did found a bug though, so please update first.
JavaScript is indeed the safest way. And therefore it is also used by the other plugin.
I will fix making the protection text editable.
Good suggestions.
The CSS trick is being used in another plugin for protecting emails: WP Mailto Links. Maybe you like that one better.
I’ll put it on the TODO list
Forum: Plugins
In reply to: [External Links - nofollow, noopener & new window] Set up exclusion by code?Yep 🙂
hansopanso, thanks for your input.
Sith, thanks for testing.
Could you please check again with the latest version?
Some bugs have been fixed, that could have caused this behavior.Forum: Plugins
In reply to: [External Links - nofollow, noopener & new window] Set up exclusion by code?Hello Martin, the filter “wpel_external_link” is added in version 1.40.