Duplicate code and a feature request
-
Trying to have my site not to serve mixed content under certain CDN provider’s Flexible SSL (successful result included in the code snippet below) I discovered that you seem to have a duplicated code in your plugin:
... // Remove sizes and srcset attribute. $img->removeAttribute( 'sizes' ); $img->removeAttribute( 'srcset' ); // TODO: add "} // End if()." and delete everything below until next TODO // Get src value. $src = $img->getAttribute( 'src' ); // Check if we have a src. if ( '' === $src ) { // Set the value from data-noscript as src. $src = $img->getAttribute( 'data-noscript' ); } // End if(). // Set data-src value. $img->setAttribute( 'data-src', $src ); } else { // TODO: Stop here // Get src attribute. $src = $img->getAttribute( 'src' ); // TODO: Review new optional code: stripping HTTP and HTTPS from src URLs // or could you even maybe make it toggleable via checkbox in admin panel? $src = str_replace(['http:', 'https:'], '', $src); // Check if we do not have a value. if ( '' === $src ) { // Set the value from data-noscript as src. $src = $img->getAttribute( 'data-noscript' ); } // End if(). // Set data-src value. $img->setAttribute( 'data-src', $src ); // TODO: Delete the line below too. }// End if().
I would be happy to be proven wrong, but after my changes everything works as it did before, so consider it both a minor bug report and a minor feature request.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Duplicate code and a feature request’ is closed to new replies.