Code Duplication    Length = 3-3 lines in 6 locations

classes/autoptimizeExtra.php 1 location

@@ 128-130 (lines=3) @@
125
    public function extra_async_js( $in )
126
    {
127
        $exclusions = array();
128
        if ( ! empty( $in ) ) {
129
            $exclusions = array_fill_keys( array_filter( array_map( 'trim', explode( ',', $in ) ) ), '' );
130
        }
131
132
        $settings = $this->options['autoptimize_extra_text_field_3'];
133
        $async    = array_fill_keys( array_filter( array_map( 'trim', explode( ',', $settings ) ) ), '' );

classes/autoptimizeStyles.php 2 locations

@@ 173-175 (lines=3) @@
170
171
        $allowlist_css = apply_filters( 'autoptimize_filter_css_allowlist', '', $this->content );
172
        $allowlist_css = apply_filters( 'autoptimize_filter_css_whitelist', $allowlist_css, $this->content ); // fixme: to be removed in next version.
173
        if ( ! empty( $allowlist_css ) ) {
174
            $this->allowlist = array_filter( array_map( 'trim', explode( ',', $allowlist_css ) ) );
175
        }
176
177
        $removable_css = apply_filters( 'autoptimize_filter_css_removables', '' );
178
        if ( ! empty( $removable_css ) ) {
@@ 178-180 (lines=3) @@
175
        }
176
177
        $removable_css = apply_filters( 'autoptimize_filter_css_removables', '' );
178
        if ( ! empty( $removable_css ) ) {
179
            $this->cssremovables = array_filter( array_map( 'trim', explode( ',', $removable_css ) ) );
180
        }
181
182
        $this->cssinlinesize = apply_filters( 'autoptimize_filter_css_inlinesize', 256 );
183

classes/autoptimizeImages.php 1 location

@@ 902-904 (lines=3) @@
899
            // add from setting.
900
            if ( array_key_exists( 'autoptimize_imgopt_text_field_5', $options ) ) {
901
                $exclude_lazyload_option = $options['autoptimize_imgopt_text_field_5'];
902
                if ( ! empty( $exclude_lazyload_option ) ) {
903
                    $exclude_lazyload_array = array_merge( $exclude_lazyload_array, array_filter( array_map( 'trim', explode( ',', $options['autoptimize_imgopt_text_field_5'] ) ) ) );
904
                }
905
            }
906
907
            // and filter for developer-initiated changes.

classes/autoptimizeScripts.php 2 locations

@@ 221-223 (lines=3) @@
218
        // only optimize known good JS?
219
        $allowlist_js = apply_filters( 'autoptimize_filter_js_allowlist', '', $this->content );
220
        $allowlist_js = apply_filters( 'autoptimize_filter_js_whitelist', $allowlist_js, $this->content ); // fixme: to be removed in next version.
221
        if ( ! empty( $allowlist_js ) ) {
222
            $this->allowlist = array_filter( array_map( 'trim', explode( ',', $allowlist_js ) ) );
223
        }
224
225
        // is there JS we should simply remove?
226
        $removable_js = apply_filters( 'autoptimize_filter_js_removables', '', $this->content );
@@ 227-229 (lines=3) @@
224
225
        // is there JS we should simply remove?
226
        $removable_js = apply_filters( 'autoptimize_filter_js_removables', '', $this->content );
227
        if ( ! empty( $removable_js ) ) {
228
            $this->jsremovables = array_filter( array_map( 'trim', explode( ',', $removable_js ) ) );
229
        }
230
231
        // only header?
232
        if ( apply_filters( 'autoptimize_filter_js_justhead', $options['justhead'] ) ) {