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/autoptimizeImages.php 1 location

@@ 861-863 (lines=3) @@
858
            // add from setting.
859
            if ( array_key_exists( 'autoptimize_imgopt_text_field_5', $options ) ) {
860
                $exclude_lazyload_option = $options['autoptimize_imgopt_text_field_5'];
861
                if ( ! empty( $exclude_lazyload_option ) ) {
862
                    $exclude_lazyload_array = array_merge( $exclude_lazyload_array, array_filter( array_map( 'trim', explode( ',', $options['autoptimize_imgopt_text_field_5'] ) ) ) );
863
                }
864
            }
865
866
            // and filter for developer-initiated changes.

classes/autoptimizeScripts.php 2 locations

@@ 211-213 (lines=3) @@
208
        // only optimize known good JS?
209
        $allowlist_js = apply_filters( 'autoptimize_filter_js_allowlist', '', $this->content );
210
        $allowlist_js = apply_filters( 'autoptimize_filter_js_whitelist', $allowlist_js, $this->content ); // fixme: to be removed in next version.
211
        if ( ! empty( $allowlist_js ) ) {
212
            $this->allowlist = array_filter( array_map( 'trim', explode( ',', $allowlist_js ) ) );
213
        }
214
215
        // is there JS we should simply remove?
216
        $removable_js = apply_filters( 'autoptimize_filter_js_removables', '', $this->content );
@@ 217-219 (lines=3) @@
214
215
        // is there JS we should simply remove?
216
        $removable_js = apply_filters( 'autoptimize_filter_js_removables', '', $this->content );
217
        if ( ! empty( $removable_js ) ) {
218
            $this->jsremovables = array_filter( array_map( 'trim', explode( ',', $removable_js ) ) );
219
        }
220
221
        // only header?
222
        if ( apply_filters( 'autoptimize_filter_js_justhead', $options['justhead'] ) ) {

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