HEX
Server: Apache/2.4.46 (Ubuntu)
System: Linux localhost 5.11.0-49-generic #55-Ubuntu SMP Wed Jan 12 17:36:34 UTC 2022 x86_64
User: root (0)
PHP: 7.4.16
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/wavecolordrop.com/wp-content/plugins/wps-team/includes/managers/attribute-manager.php
<?php

namespace WPSpeedo_Team;

if ( ! defined( 'ABSPATH' ) ) exit;

class Attribute_Manager {

    public $render_attributes = [];

    public function add_attribute( $element, $key = null, $value = null, $overwrite = false ) {
        
		if ( is_array( $element ) ) {
			foreach ( $element as $element_key => $attributes ) {
				$this->add_attribute( $element_key, $attributes, null, $overwrite );
			}
			return $this;
		}

		if ( is_array( $key ) ) {
			foreach ( $key as $attribute_key => $attributes ) {
				$this->add_attribute( $element, $attribute_key, $attributes, $overwrite );
			}
			return $this;
		}

		if ( empty( $this->render_attributes[ $element ][ $key ] ) ) {
			$this->render_attributes[ $element ][ $key ] = [];
		}

		settype( $value, 'array' );

		if ( $overwrite ) {
			$this->render_attributes[ $element ][ $key ] = $value;
		} else {
			$this->render_attributes[ $element ][ $key ] = array_merge( $this->render_attributes[ $element ][ $key ], $value );
		}

		return $this;
	}

    public function get_attribute_string( $element ) {

        $attributes = [];

        if ( gettype($element) == 'array' ) {

            foreach ( $element as $_element ) {

                if ( empty( $_attributes = $this->render_attributes[ $_element ] ) ) continue;
                
                foreach ( $_attributes as $attribute_key => $attribute_values ) {

                    settype($attribute_values, 'array');

                    if ( ! array_key_exists($attribute_key, $attributes) ) {
                        $attributes[$attribute_key] = $attribute_values;
                    } else {
                        $attributes[$attribute_key] = array_merge( $attributes[$attribute_key], $attribute_values );
                    }
                }
                
            }

        } else {

            if ( empty( $attributes = $this->render_attributes[ $element ] ) ) return '';

        }
            
        $rendered_attributes = [];
    
        foreach ( $attributes as $attribute_key => $attribute_values ) {
            if ( is_array( $attribute_values ) ) {
                $attribute_values = implode( ' ', $attribute_values );
            }
            $rendered_attributes[] = sprintf( '%1$s="%2$s"', sanitize_key( $attribute_key ), esc_attr( $attribute_values ) );
        }

        return implode( ' ', $rendered_attributes );

	}

    public function print_attribute_string( $element ) {
        echo sanitize_text_field( $this->get_attribute_string( $element ) );
    }

}