First commit

This commit is contained in:
DavidCamejo 2025-11-04 23:03:43 -04:00
parent 31347b30cb
commit 5c5635e44b
3 changed files with 40 additions and 11 deletions

View File

@ -1,19 +1,11 @@
// assets/admin-settings.js
(function ($) {
const toggleSections = () => {
function toggleSections() {
const adapter = $('#flysystem-offload-adapter').val();
$('.flysystem-offload-adapter-section').hide();
$(`.flysystem-offload-adapter-section[data-adapter="${adapter}"]`).show();
};
}
$(document).ready(function () {
const $heading = $('h2:contains("Amazon S3 / Compatible")');
const $table = $heading.next('table');
if ($heading.length && $table.length) {
$heading.add($table).wrapAll('<div class="flysystem-offload-adapter-section" data-adapter="s3"></div>');
}
toggleSections();
$('#flysystem-offload-adapter').on('change', toggleSections);
});

17
git.txt Normal file
View File

@ -0,0 +1,17 @@
# Realizando push para um repositório existente por linha de comando
cd /ruta/de/tu/proyecto
git init
git add .
git commit -m "First commit"
git remote add origin https://git.brasdrive.com.br/Brasdrive/flysystem-offload.git
git push -u origin main
----------------
# Criando um novo repositório por linha de comando
touch README.md
git init
git checkout -b main
git add README.md
git commit -m "First commit"
git remote add origin https://git.brasdrive.com.br/Brasdrive/flysystem-offload.git
git push -u origin main

View File

@ -188,7 +188,10 @@ class SettingsPage
<form method="post" action="options.php">
<?php
settings_fields('flysystem_offload');
do_settings_sections('flysystem-offload');
$sectionsHtml = $this->generateSectionsMarkup();
echo $sectionsHtml; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
submit_button(__('Guardar cambios', 'flysystem-offload'));
?>
</form>
@ -196,6 +199,23 @@ class SettingsPage
<?php
}
private function generateSectionsMarkup(): string
{
ob_start();
do_settings_sections('flysystem-offload');
$html = ob_get_clean();
$label = preg_quote(__('Amazon S3 / Compatible', 'flysystem-offload'), '/');
$pattern = '/(<h2[^>]*>\s*' . $label . '\s*<\/h2>\s*<table[^>]*>.*?<\/table>)/is';
return preg_replace(
$pattern,
'<div class="flysystem-offload-adapter-section" data-adapter="s3">$1</div>',
$html
);
}
public function renderAdapterField(): void
{
$settings = get_option('flysystem_offload_settings', []);