ey ] ) && $this->defaults[ $key ] === $value ) { continue; } if ( 'id' === $key ) { continue; } $value = $this->esc_attr( $value ); if ( is_array( $value ) ) { $value = implode( ',', $value ); } if ( ! str_contains( $value, "'" ) ) { $value = "'$value'"; } elseif ( ! str_contains( $value, '"' ) ) { $value = '"' . $value . '"'; } else { // Shortcodes can't contain both '"' and "'". Strip one. $value = str_replace( "'", '', $value ); $value = "'$value'"; } $r .= "{$key}={$value} "; } $r = rtrim( $r ); if ( $this->fields ) { $r .= ']'; foreach ( $this->fields as $field ) { $r .= (string) $field; } $r .= "[/{$this->shortcode_name}]"; } else { $r .= '/]'; } return $r; } }