Code Duplication    Length = 13-13 lines in 2 locations

classes/autoptimizeScripts.php 1 location

@@ 341-353 (lines=13) @@
338
                        // Should we minify the non-aggregated script?
339
                        // -> if aggregate is on and exclude minify is on
340
                        // -> if aggregate is off and the file is not in dontmove.
341
                        if ( $path && $this->minify_excluded ) {
342
                            $consider_minified_array = apply_filters( 'autoptimize_filter_js_consider_minified', false );
343
                            if ( ( false === $this->aggregate && str_replace( $this->dontmove, '', $path ) === $path ) || ( true === $this->aggregate && ( false === $consider_minified_array || str_replace( $consider_minified_array, '', $path ) === $path ) ) ) {
344
                                $minified_url = $this->minify_single( $path );
345
                                if ( ! empty( $minified_url ) ) {
346
                                    // Replace original URL with minified URL from cache.
347
                                    $new_tag = str_replace( $url, $minified_url, $new_tag );
348
                                } else {
349
                                    // Remove the original script tag, because cache content is empty.
350
                                    $new_tag = '';
351
                                }
352
                            }
353
                        }
354
355
                        if ( $this->ismovable( $new_tag ) ) {
356
                            // can be moved, flags and all.

classes/autoptimizeStyles.php 1 location

@@ 339-351 (lines=13) @@
336
                        // Excluded CSS, minify that file:
337
                        // -> if aggregate is on and exclude minify is on
338
                        // -> if aggregate is off and the file is not in dontmove.
339
                        if ( $path && $this->minify_excluded ) {
340
                            $consider_minified_array = apply_filters( 'autoptimize_filter_css_consider_minified', false );
341
                            if ( ( false === $this->aggregate && str_replace( $this->dontmove, '', $path ) === $path ) || ( true === $this->aggregate && ( false === $consider_minified_array || str_replace( $consider_minified_array, '', $path ) === $path ) ) ) {
342
                                $minified_url = $this->minify_single( $path );
343
                                if ( ! empty( $minified_url ) ) {
344
                                    // Replace orig URL with cached minified URL.
345
                                    $new_tag = str_replace( $url, $minified_url, $tag );
346
                                } else {
347
                                    // Remove the original style tag, because cache content is empty.
348
                                    $new_tag = '';
349
                                }
350
                            }
351
                        }
352
353
                        if ( '' !== $new_tag ) {
354
                            // Optionally defer (preload) non-aggregated CSS.