Nickness
Forum Replies Created
-
Forum: Plugins
In reply to: [Intercom for WordPress] Multiple WordPress Install to single Intercom AppHi,
I was able to fix my issue by generating an uuid by user using this code :
$intercom_user_id = get_user_meta( $current_user->ID, ‘ll_intercom_id’, true );
if ( empty ($intercom_user_id) ) {
$intercom_user_id = uniqid();
add_user_meta( $current_user->ID, ‘ll_intercom_id’, $intercom_user_id, true );
}Then I use the $intercom_user_id to comptute the hash and for the Intercom settings.
WARNING : if you have already synchronized users within Intercom the code above will not attach further users logins to the previously synced users but will create new Intercom users instead as user_id will not be the wordpress user id anymore but the new uuid…
Regards
Forum: Plugins
In reply to: [Lazy Load XT] img are processed multiple timesYes exactly the original regex version would match all of this.
The version I proposed just doesn’t match this:
<img src="" /><noscript></noscript>
because “<img…” is followed by “<noscript…”.
And doesn’t match this neither:<img src="" /><noscript></noscript>Blah blah<br />
because they are an
"<"
between"<img..."
and"<br />"
. So it breaks at the"<"
of"<noscript>"
in fact.Glad I could help ??
Forum: Plugins
In reply to: [Lazy Load XT] img are processed multiple timesI’m not a regex pro neither so we speak the same language.
Did you use the s modifier when you tested both regex?My understanding is that with the s modifier turned on the first regex will match the whole string :
<img width="155" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="https://local.wordpress.dev/wp-content/uploads/2013/03/featured-image-vertical-155x300.jpg" class="attachment-medium wp-post-image" alt="Horizontal Featured Image" /><noscript><img width="155" height="300" src="https://local.wordpress.dev/wp-content/uploads/2013/03/featured-image-vertical-155x300.jpg" class="attachment-medium wp-post-image" alt="Horizontal Featured Image" /></noscript> <img class="fl-photo-img" src="https://local.wordpress.dev/wp-content/uploads/2015/04/5527cc7c08d02_input_1.jpg" alt="5527cc7c08d02_input_1" itemprop="image" />
Indeed if we split the regex: <img[\s\r\n]+.*?\/>(?!<noscript>|<\/noscript>)
<img[\s\r\n]+
will match opening img tag followed by one or more white space, carriage return or new line.
.*?
match any character (new line included with the s modifier turned on), zero or more times.
\/>(?!<noscript>|<\/noscript>)
match the ending tag if not followed by <noscript> or </noscript>.
So this regex will not match :
<img width="155" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="https://local.wordpress.dev/wp-content/uploads/2013/03/featured-image-vertical-155x300.jpg" class="attachment-medium wp-post-image" alt="Horizontal Featured Image" /><noscript>
as the ending img tag is followed by <noscript>.
However it will match the whole string matching the first opening img tag and everything that stands between it (without any restriction with .*?) and the first closing tag that is not followed by <noscript> or </noscript> so the closing tag of the second img in our example :
<img width="155" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="https://local.wordpress.dev/wp-content/uploads/2013/03/featured-image-vertical-155x300.jpg" class="attachment-medium wp-post-image" alt="Horizontal Featured Image" /><noscript><img width="155" height="300" src="https://local.wordpress.dev/wp-content/uploads/2013/03/featured-image-vertical-155x300.jpg" class="attachment-medium wp-post-image" alt="Horizontal Featured Image" /></noscript> <img class="fl-photo-img" src="https://local.wordpress.dev/wp-content/uploads/2015/04/5527cc7c08d02_input_1.jpg" alt="5527cc7c08d02_input_1" itemprop="image" />
Now if we replace .*? by ([^<]+) we still match everything except a new opening tag and so it prevent the regex to spread accross multiple tags.
So the resulting regex should be:
<img[\s\r\n]+([^<]+)\/>(?!<noscript>|<\/noscript>)
With this you can even remove the s modifier as negative class always match new line character (see https://php.net/manual/en/reference.pcre.pattern.modifiers.php).
You’ll also noticed that I added back the + after [\s\r\n] that was missing in my previous version.
What do you think?
Forum: Plugins
In reply to: [Lazy Load XT] img are processed multiple timesI checkout the revision 1135603 this is the right one?
There is a problem with the regex and I thing you should turn this
preg_match_all('/<'.$tag.'[\s\r\n]+.*?'.$tag_end.'>(?!<noscript>|<\/noscript>)/is',$content,$matches);
to this
preg_match_all('/<'.$tag.'[\s\r\n]([^<]+)'.$tag_end.'>(?!<noscript>|<\/noscript>)/is',$content,$matches);
By replacing +.*? by ([^<]+) we just match everything except opening tag which is necessary with the (?!<noscript>|<\/noscript>) addition.
To see what happens, you can try both regex against following html :
<img width="155" height="300" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" data-src="https://local.wordpress.dev/wp-content/uploads/2013/03/featured-image-vertical-155x300.jpg" class="attachment-medium wp-post-image" alt="Horizontal Featured Image" /><noscript><img width="155" height="300" src="https://local.wordpress.dev/wp-content/uploads/2013/03/featured-image-vertical-155x300.jpg" class="attachment-medium wp-post-image" alt="Horizontal Featured Image" /></noscript> <img class="fl-photo-img" src="https://local.wordpress.dev/wp-content/uploads/2015/04/5527cc7c08d02_input_1.jpg" alt="5527cc7c08d02_input_1" itemprop="image" />
You’re welcome Michael.
Sorry to not answer your last question but in fact I did but by replying to the mail I received from www.ads-software.com and I was thinking it will update this entry.
Best regards.
Yes indeed, removing the empty check is what I done ??
Regards
Forum: Plugins
In reply to: [Lazy Load XT] img are processed multiple timesInteresting. So does your theme create some HTML that includes get_the_post_thumbnail(), then run apply_filter(‘the_content’, $that_html) ?
Yes exactly but it’s not the theme that include get_the_post_thumbnail(). It’s the Beaver Builder plugin which is a drag&drop frontend editor that allows to drop a post grid module anywhere in a page. I don’t know how other page builder plugins behave but I suspect it should be the same.
I’ll be checking your next version to see how it plays with Beaver Builder.
Regards
Hello,
From what I see the problem seems to be solved by the development version.
Thanks
Forum: Plugins
In reply to: [Polylang] Admin bar menu languages don't switch post id when editing postHi,
Ok thanks for the feedback.
However I don’t find it very intuitive and I think you could do both switch the post id when viewing a post and sitll filtering post, taxonomy, … where it is needed.
Regards
Forum: Plugins
In reply to: [WPML to Polylang] WPML Taxonomy Import is maybe missing something?Hi,
Seems ok for me. Taxonomy are now mapped correctly after the import from WPML and all seems to work fine.
Nice work, thanks.
Forum: Plugins
In reply to: [WPML to Polylang] WPML Taxonomy Import is maybe missing something?No it’s not the same.
Yes it seems ok, all languages are imported now when using Polylang 1.5.
Thanks