daomapsieucap / fiber-admin

💈 Bring multiple customization features to make your own WordPress admin.
https://wordpress.org/plugins/fiber-admin/
0 stars 1 forks source link

Convert Email Text to Link conflicts with content in data attribute #11

Closed daomapsieucap closed 1 year ago

daomapsieucap commented 1 year ago

Convert Email Text to Link now converts all content using hook the_content which makes the wrong HTML structure in the data- attribute.

To prevent this issue, I think the feature Convert Email Text needs to use regex to prevent converting text in the data- attribute.

daomapsieucap commented 1 year ago

Suggest solutions:

zrvincent commented 1 year ago

@daomapsieucap Have issue convert email with regex. When element with a email structure attribute, and only 1 element is added on page. All content will not be wrapped with \

tag. So $att_email_regex regex not work. When there are more than 2 elements, all content will be wrapped with \

tag. But there is a problem if the element has more attributes, the regex doesn't work correctly

content-01

content-03 content-02

When the regex doesn't work correctly, the email structure attribute will be replaced with email link. Lead to incorrect email extraction results.

convert-is-wrong-attribute-1 convert-is-wrong-attribute-2 convert-is-wrong-attribute

I updated my code for function fiad_auto_convert_email_address. Demo on the lab site with Team List component. Please see demo on test bug convert email page and revise my code on the Lab site.

Link test Regex and preg_match:

https://regex101.com/r/1jhgsF/1 https://www.phpliveregex.com/p/IfC

daomapsieucap commented 1 year ago

@phongkhuu115 Could you help to check the case mentioned above?