<?php savePlataformSettings(); echo '<form action="" method="post" enctype="multipart/form-data">'; $plataformSettingsStrings = getPlataformSettings(); foreach ($plataformSettingsStrings['label'] as $key => $label) { $display = ''; if (!is_super_admin() && array_key_exists($key, $plataformSettingsStrings['perm']) && $plataformSettingsStrings['perm'][$key] == 'S') { $display = 'display:none;'; } if ($key == 'emailPassword') { echo '<p style="' . $display . '"><label>' . $label . '</label><br><input type="password" value="' . $plataformSettingsStrings['value'][$key] . '" name="plataform_settings_strings[' . $key . ']" size="80"></p>'; continue; } echo '<p style="' . $display . '"><label>' . $label . '</label><br><input type="text" value="' . $plataformSettingsStrings['value'][$key] . '" name="plataform_settings_strings[' . $key . ']" size="80"></p>'; } echo '<input type="submit" value="Salvar">'; echo '</form>';
function campanha_use_smtp($phpmailer) { $email = getPlataformSettings('email'); $emailrt = getPlataformSettings('emailReplyTo'); $phpmailer->From = $email; $phpmailer->AddReplyTo($emailrt); $phpmailer->IsHTML(true); if (getPlataformSettings('emailTipo') == 'gmail') { $email_p = getPlataformSettings('emailPassword'); $email = getPlataformSettings('email'); $phpmailer->IsSMTP(); $phpmailer->SMTPAuth = true; $phpmailer->Port = 465; $phpmailer->SMTPSecure = 'ssl'; $phpmailer->Host = 'smtp.gmail.com'; $phpmailer->Username = $email; $phpmailer->Password = $email_p; //$phpmailer->From = $email; //$phpmailer->FromName = 'Rede Livre'; -- Acho que podemos deixar isso inalterado, e manter o que foi colocado quando a wp_mail() foi chamada } }
function campanha_handle_form_contato() { $msg = ''; foreach ($_POST as $campo => $valor) { $msg .= "{$campo}: {$valor} \n"; } $msg .= '<br><br>Origem: <a href="' . home_url() . '">' . get_option('blogname') . '</a>'; $email = getPlataformSettings('emailContato'); // generate the response $response = json_encode(array('success' => wp_mail($email, 'Novo contato no site ' . get_option('blogname'), $msg, "From: 'Carteiro " . get_option('blogname') . "' <" . getPlataformSettings('email') . ">\r\nContent-type: text/html"))); // response output header("Content-Type: application/json"); echo $response; die; }
<?php //Tentando limpar o código e fazer um reaproveitamento. $mostrar = getPlataformSettings('MostrarPlanos'); $default_plan = getPlataformSettings('defaultPlan'); if ($mostrar == 'S') { ?> <tr class="form-field" style="display: none;"> <th scope="row"><label for="plan_id">Selecione um plano</label></th> <td> <style type="text/css"> .textcenter { text-align: center !important; } table#plans th,.feature { font-family: Arial, Verdana, Sans-serif; font-weight: bold !important; text-transform: uppercase; } table#plans th,table#plans td { border: 1px solid #efefef; } .valor { font-size: 16px !important; font-weight: bold; }
function savePlataformSettings() { if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['plataform_settings_strings'])) { $_POST['plataform_settings_strings'] = array_merge(getPlataformSettings(), $_POST['plataform_settings_strings']); if (update_option('plataform_defined_settings', $_POST['plataform_settings_strings'])) { echo 'Dados atualizados com sucesso!'; } } }