Hi!
I think the entry ID should be evailable in the $eventData array, within the 'Frontend_display' cycle where the preg_replace is executed. ($eventData['id']).
However, the current preg_Replace cycle cannot incorporate that in the $regex and $sub patterns, there needs to be a dynamic placeholder that is substituted with the entryid, either via printf or also via a second preg_replace. Of course that would impact performance by roughly 50%, if a second preg_replace is added for each entry call...
Best regards,
Garvin
Lightbox plugin
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Re: Lightbox plugin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
-
garvinhicking
- Core Developer
- Posts: 30022
- Joined: Tue Sep 16, 2003 9:45 pm
- Location: Cologne, Germany
- Contact:
Hi Rob!
Phew. I'm afraid I see no way to add a backreference, because $eventData['id'] would need to be contained within $eventData[$element] inside the '<a href>' stuff. So you'd need at least one more regular expression preg_replace call to add the ID into that. Of coure that would then be just the same impact than issuing a second preg-replace call to replace something like '%ID%' with the current ID.
Of course this simple replacement of %ID% could be done with a simple str_replace call whose impact would not be as bad, but still more overhead than currently.
The whole preg_replace call could be modified to a preg_replace_callback, but I can't tell how much this impacts the performance. Maybe it is less than 2 replacement calls, but maybe it equals to that...
Phew. I'm afraid I see no way to add a backreference, because $eventData['id'] would need to be contained within $eventData[$element] inside the '<a href>' stuff. So you'd need at least one more regular expression preg_replace call to add the ID into that. Of coure that would then be just the same impact than issuing a second preg-replace call to replace something like '%ID%' with the current ID.
Of course this simple replacement of %ID% could be done with a simple str_replace call whose impact would not be as bad, but still more overhead than currently.
The whole preg_replace call could be modified to a preg_replace_callback, but I can't tell how much this impacts the performance. Maybe it is less than 2 replacement calls, but maybe it equals to that...
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/