Skip to content

Commit 7496262

Browse files
committed
v. 4.53.2
* Melhorias e correções no ícone de pagamento. Definido utf-8 para caracteres especiais no SVG; Sanitização do $_GET que era inutilizado; Validação de existência do arquivo ícone; Controle explícito de formatação e espaços no load do SVG no DOM; Elimina duplicações da tag svg e remove declaração de XML e DOCTYPE. (contribuição de [Matheus Vale](https://matheusvale.com/)) Merge branch 'release/4.53.2'
2 parents aa790d4 + f9c525d commit 7496262

File tree

4 files changed

+24
-9
lines changed

4 files changed

+24
-9
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "ricardomartins/pagbank-woocommerce",
33
"description": "Integração PagBank (PagSeguro) WooCommerce com desconto nas taxas oficiais",
44
"type": "wordpress-plugin",
5-
"version": "4.53.1",
5+
"version": "4.53.2",
66
"license": "GPL-3.0",
77
"autoload": {
88
"psr-4": {

public/images/payment-icon.php

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,17 @@
55

66
use RM_PagBank\Helpers\Params;
77

8-
header('Content-Type: image/svg+xml');
8+
header('Content-Type: image/svg+xml; charset=utf-8');
9+
910
$allowedMethods = ['cc', 'pix', 'boleto'];
1011
$iconColor = Params::getConfig('icons_color', 'gray');
1112
$method = sanitize_text_field($_GET['method'] ?? '');
12-
$method = in_array($_GET['method'], $allowedMethods) ? $_GET['method'] : 'cc';
13+
$method = in_array($method, $allowedMethods) ? $method : 'cc';
14+
$svgPath = __DIR__ . '/' . $method . '.svg';
15+
16+
if (!file_exists($svgPath)) {
17+
exit;
18+
}
1319

1420
if (extension_loaded('DOM') === false) {
1521
echo file_get_contents(__DIR__ . '/' . $method . '.svg');
@@ -18,8 +24,13 @@
1824
exit;
1925
}
2026

27+
/*
28+
* Carrega SVG no DOM
29+
*/
2130
$doc = new DOMDocument();
22-
$doc->load(__DIR__ . '/' . $method . '.svg');
31+
$doc->preserveWhiteSpace = false;
32+
$doc->formatOutput = false;
33+
$doc->load($svgPath);
2334

2435
$paths = $doc->getElementsByTagName('path');
2536

@@ -30,7 +41,7 @@
3041
// Check if the style attribute contains a fill rule
3142
if (strpos($style, 'fill:') !== false) {
3243
// Replace the fill color in the style attribute
33-
$newStyle = preg_replace('/fill: #[0-9a-fA-F]+/', 'fill: ' . $iconColor, $style);
44+
$newStyle = preg_replace('/fill:\s*#[0-9a-fA-F]+/', 'fill: ' . $iconColor, $style);
3445
} else {
3546
// Add the fill rule to the style attribute
3647
$newStyle = $style . '; fill: ' . $iconColor;
@@ -39,7 +50,7 @@
3950
$path->setAttribute('style', $newStyle);
4051
}
4152

42-
echo $doc->saveXML();
53+
echo $doc->saveXML($doc->documentElement);
4354

4455
$output = @ob_get_clean(); // Get the buffer content and clean it
4556

readme.txt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Donate link: https://github.com/sponsors/r-martins
55
Requires at least: 4.0
66
Tested up to: 6.9
77
Requires PHP: 7.4
8-
Stable tag: 4.53.1
8+
Stable tag: 4.53.2
99
License: GPLv3
1010
License URI: https://www.gnu.org/licenses/gpl-3.0.html
1111
PagBank com PIX, Cartão de Crédito, Boleto, Recorrência + Envio Fácil e com Menos Taxas no PagSeguro.
@@ -239,6 +239,10 @@ A confirmação é exibida ainda na tela de sucesso, e pode opcionalmente dispar
239239
Sim! Você pode [configurar descontos percentuais ou fixos](https://ajuda.pbintegracoes.com/hc/pt-br/articles/19945430928909-Oferecer-Desconto-Pix-e-Boleto) para PIX e Boleto diretamente nas configurações do plugin.
240240

241241
== Changelog ==
242+
= 4.53.2 =
243+
* Melhorias e correções no ícone de pagamento. Definido utf-8 para caracteres especiais no SVG; Sanitização do $_GET que era inutilizado; Validação de existência do arquivo ícone; Controle explícito de formatação e espaços no load do SVG no DOM; Elimina duplicações da tag svg e remove declaração de XML e DOCTYPE. (contribuição de [Matheus Vale](https://matheusvale.com/))
244+
245+
242246
= 4.53.1 =
243247
* Correção: em doações recorrentes com valor especificado pelo comprador o valor não era replicado no item, causando falha e cancelamento da assinatura no segundo ciclo da recorrencia.
244248
* Correção: desconto pix nem sempre era exibido pois o checkout nem sempre atualizava o total

rm-pagbank.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
* Plugin Name: PagBank Connect
1212
* Plugin URI: https://pbintegracoes.com
1313
* Description: Integra seu WooCommerce com as APIs PagSeguro v4 através da aplicação de Ricardo Martins (com descontos nas taxas oficiais), com suporte a PIX transparente e muito mais.
14-
* Version: 4.53.1
14+
* Version: 4.53.2
1515
* Requires at least: 5.2
1616
* Tested up to: 6.9
1717
* Requires PHP: 7.4
@@ -33,7 +33,7 @@
3333
defined( 'ABSPATH' ) || die( 'No direct script access allowed!' );
3434

3535
// Plugin constants.
36-
define( 'WC_PAGSEGURO_CONNECT_VERSION', '4.53.1' );
36+
define( 'WC_PAGSEGURO_CONNECT_VERSION', '4.53.2' );
3737
define( 'WC_PAGSEGURO_CONNECT_PLUGIN_FILE', __FILE__ );
3838
define( 'WC_PAGSEGURO_CONNECT_BASE_DIR', __DIR__ );
3939
define( 'WC_PAGSEGURO_CONNECT_TEMPLATES_DIR', WC_PAGSEGURO_CONNECT_BASE_DIR . '/src/templates/' );

0 commit comments

Comments
 (0)