Skip to content

Commit

Permalink
refactor: ideias.
Browse files Browse the repository at this point in the history
  • Loading branch information
FabricioQueirozLkn committed Oct 23, 2023
1 parent 5614b88 commit 7ea0bef
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 13 deletions.
47 changes: 34 additions & 13 deletions public/class-lkn-give-free-form-public.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,21 +80,26 @@ public function form_customization($form_id, $args): void {
if ('enabled' !== $status) {
echo '';
} else {
$formCustomization = <<<HTML
<style>
.lkn_notice_wrapper {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-top: 75px;
}
// Pegaria todos as variáveis ali encima.
$fontSize = "50px";

.lknNoticeText {
font-size: 10px;
color: #989898;
}
// Pegaria o arquivo css template.
$cssTemplate = file_get_contents(LKN_DONATION_FORM_CUSTOMIZATION_DIR . 'public/css/lkn-give-free-form-public.css');

// Passaria um array com todos os placeholder das variáveis, e substituiria pelas variáveis em sí.
$cssNovo = str_replace('$fontSize', $fontSize, $cssTemplate);

// Atualizaria o arquivo de css (sem ser o usado como template).
file_put_contents(LKN_DONATION_FORM_CUSTOMIZATION_DIR . 'public/css/lkn-give-free-form-public-novo.css', $cssNovo);

// Dá enqueue no arquivo.
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/lkn-give-free-form-public-novo.css', array(), $this->version, 'all' );

// Transforma o arquivo css no modelo template novamente (para ficar apto a ter os parametros alterados novamente).
file_put_contents(LKN_DONATION_FORM_CUSTOMIZATION_DIR . 'public/css/lkn-give-free-form-public-novo.css', $cssTemplate);

$formCustomization = <<<HTML
<style>
.lknIframeText {
font-size: 13px;
}
Expand Down Expand Up @@ -466,6 +471,22 @@ public function lkn_give_free_form_footer_notice(): void {
<span class="dashicons dashicons-lock" style="color=#989898;"></span>
<a href="{$link}" target="_blank" style="color: #666;text-decoration: none;"><span class="lknNoticeText"> {$message}</span></a>
</div>
<style>
.lkn_notice_wrapper {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
margin-top: 75px;
}
.lknNoticeText {
font-size: 10px;
color: #989898;
}
</style>
HTML;
echo $html;
}
Expand Down
4 changes: 4 additions & 0 deletions public/css/lkn-give-free-form-public.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.lknNoticeText {
font-size: $fontSize;
color: #989898;
}

0 comments on commit 7ea0bef

Please sign in to comment.