/** * Funzione che aggiorna una traduzione nel db * @param Traduzione $traduzione * @return boolean */ public function updateTraduzione(Traduzione $traduzione) { try { $this->wpdb->update($this->table, array('text' => $traduzione->getText()), array('cod' => $traduzione->getCod()), array('%s'), array('%s')); return true; } catch (Exception $ex) { _e($ex); return false; } }
<?php //Autore: Alex Vezzelli - Alex Soluzioni Web //url: http://www.alexsoluzioniweb.it/ $traduzioneController = new TraduzioneController(); ?> <h1>Gestione Traduzioni</h1> <?php //pagina inserisci cv foreach ($_POST as $key => $value) { $traduzione = new Traduzione(); $traduzione->setCod($key); if (strpos($key, 'ita') == true) { //italiano $traduzione->setLan('ita'); } else { if (strpos($key, 'eng')) { //inglese $traduzione->setLan('eng'); } } $traduzione->setText($value); //salvo $traduzioneController->salvaTraduzione($traduzione); } ?> <form action="<?php