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

Multiple URL replacements on the same line for CDN Plugin #20

Open
filipiz opened this issue Jan 27, 2014 · 0 comments
Open

Multiple URL replacements on the same line for CDN Plugin #20

filipiz opened this issue Jan 27, 2014 · 0 comments

Comments

@filipiz
Copy link

filipiz commented Jan 27, 2014

Hi Guys!

I went through a situation here that made me lose a few minutes.
The CDN plugin do a preg_replace on the entire rendered page to replace the old urls with the new ones.

The problem was when I had more than one URL to be replaced on the same line. The preg_replace did just one replacement, the first.

So, for example:

<a href="http://url.com/wp-content/uploads/2014/01/img.png"><img  src="http://url.com/wp-content/uploads/2014/01/img.png"></a>

would be replaced with

<a href="http://cdn.com/wp-content/uploads/2014/01/img.png"><img  src="http://url.com/wp-content/uploads/2014/01/img.png"></a>

Note that the href attribute for the a tag was replaced, but not the src for the img. Thats because they are on the same line.

filipiz added a commit to Nextt/WP-Stack that referenced this issue Jan 27, 2014
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

No branches or pull requests

1 participant