private static function editCertificado(Evento $evento) { // var_dump($evento->certificado_arquivo); // die(); $file = wp_upload_dir(); $file = $file['path']; // var_dump($file); if ($_POST) { // var_dump($_FILES); // Nova imagem if ($_FILES['arquivo']) { // var_dump($_FILES); $name = strtolower($_FILES['arquivo']['name']); $name = str_replace(' ', '_', $name); if (strpos($name, '.png') === false) { die("O arquivo deve ser .PNG"); } $file .= "/" . $name; // var_dump($file); // Ajustar nome do arquivo // Mover move_uploaded_file($_FILES['arquivo']['tmp_name'], $file); // var_dump(file_exists($file)); // Ajustar tamanho PLib::smart_resize_image($file, null, 1280, 0, true, 'file', $file, false); // Atualizar evento update_post_meta($evento->id, 'certificado_arquivo', $file); update_post_meta($evento->id, 'certificado_incluir_evento', $_POST['evento'] == 1); update_post_meta($evento->id, 'certificado_incluir_nome', $_POST['nome'] == 1); $evento->certificado_arquivo = $file; $evento->certificado_incluir_evento = $_POST['evento'] == 1; $evento->certificado_incluir_nome = $_POST['nome'] == 1; } // Demais configurações $altura_nome = $_POST['altura_nome']; if ($altura_nome) { update_post_meta($evento->id, 'certificado_altura_nome', $altura_nome); $evento->certificado_altura_nome = $altura_nome; } require_once PLUGINPATH . '/view/eventos/view_certificado.php'; } else { // echo "<pre>"; // var_dump($evento); // echo "</pre>"; if ($evento->hasCertificadoArquivo()) { require_once PLUGINPATH . '/view/eventos/view_certificado.php'; } require_once PLUGINPATH . '/view/eventos/form_certificado.php'; } }