Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added filter to support images regexp modifications #52

Merged
merged 3 commits into from
May 8, 2020

Conversation

igmoweb
Copy link
Contributor

@igmoweb igmoweb commented Dec 17, 2019

This will allow to filter tags used by certain page builders. Some of them will change the way images are displayed in WP.

@igmoweb igmoweb closed this Dec 17, 2019
@igmoweb igmoweb reopened this Dec 17, 2019
@igmoweb igmoweb requested a review from rmccue December 17, 2019 11:36
* 2 => Attachment ID
* ]
*/
$preg_match_result = apply_filters_ref_array( 'gaussholder.mangle_images_regexp_results', array( $preg_match_result, &$images, $content, $searcher ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the &$ will break in PHP 7.4 and shouldn't really be needed any more. It's best to declare the variable first, then let the function modify it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@roborourke I just tested it it 7.4 and it would fail outside an array but I'm using here apply_filters_ref_array and passing an array so I'm not seeing any error. Otherwise, the images list could not be changed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, I thought it would fatal or at least chuck out a warning. I guess we're a ways off adopting PHP 7.4 anyway so 👍 - thanks for confirming it

Copy link
Contributor

@roborourke roborourke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just one edit to make and then fine to merge

inc/frontend/namespace.php Outdated Show resolved Hide resolved
@igmoweb
Copy link
Contributor Author

igmoweb commented May 8, 2020

All good. Thanks @roborourke, merging this.

@igmoweb igmoweb merged commit b944769 into master May 8, 2020
@igmoweb igmoweb deleted the image-mangle-filter branch May 8, 2020 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants