Code Duplication    Length = 14-14 lines in 2 locations

classes/autoptimizeScripts.php 1 location

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

classes/autoptimizeStyles.php 1 location

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