PluginProbe
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF / trunk
Imagify Image Optimization: Optimize Images | Compress & Convert to WebP/AVIF vtrunk
2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.9 2.2.8 trunk 1.10 1.3.3 1.3.4 1.3.5 1.3.5.1 1.3.5.2 1.3.6 1.3.6.1 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 All 103 releases
← All changes | classes/Webp/RewriteRules/IIS.php +13 -12 1.10 → trunk View file →
@@ -1,23 +1,23 @@
1 1 <?php
2 +declare(strict_types=1);
3 +
2 4 namespace Imagify\Webp\RewriteRules;
3 5
4 -defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' );
6 +use Imagify\WriteFile\AbstractIISDirConfFile;
5 7
6 8 /**
7 9 * Add and remove rewrite rules to the web.config file to display WebP images on the site.
8 10 *
9 - * @since 1.9
10 - * @author Grégory Viguier
11 + * @since 1.9
11 12 */
12 -class IIS extends \Imagify\WriteFile\AbstractIISDirConfFile {
13 +class IIS extends AbstractIISDirConfFile {
13 14
14 15 /**
15 16 * Name of the tag used as block delemiter.
16 17 *
17 - * @var string
18 - * @since 1.9
19 - * @author Grégory Viguier
18 + * @var string
19 + * @since 1.9
20 20 */
21 21 const TAG_NAME = 'Imagify: rewrite rules for webp';
22 22
23 23 /**
@@ -22,21 +22,21 @@
22 22
23 23 /**
24 24 * Get unfiltered new contents to write into the file.
25 25 *
26 - * @since 1.9
27 - * @access protected
26 + * @since 1.9
28 27 * @source https://github.com/igrigorik/webp-detect/blob/master/iis.config
29 - * @author Grégory Viguier
30 28 *
31 29 * @return string
32 30 */
33 31 protected function get_raw_new_contents() {
34 32 $extensions = $this->get_extensions_pattern();
33 + $extensions = str_replace( '|webp', '', $extensions );
35 34 $home_root = wp_parse_url( home_url( '/' ) );
36 35 $home_root = $home_root['path'];
37 36
38 - return trim( '
37 + return trim(
38 + '
39 39 <!-- @parent /configuration/system.webServer/rewrite/rules -->
40 40 <rule name="' . esc_attr( static::TAG_NAME ) . ' 2">
41 41 <match url="^(' . $home_root . '.+)\.(' . $extensions . ')$" ignoreCase="true" />
42 42 <conditions logicalGrouping="MatchAll">
@@ -57,7 +57,8 @@
57 57 <preConditions name="' . esc_attr( static::TAG_NAME ) . ' 4">
58 58 <preCondition name="IsWebp">
59 59 <add input="{ACCEPTS_WEBP}" pattern="true" ignoreCase="false" />
60 60 </preCondition>
61 -</preConditions>' );
61 +</preConditions>'
62 + );
62 63 }
63 64 }