public function Render() { $this->id = isset($_GET['id']) ? int_val($_GET['id']) : 0; $this->tpl->assign('title_string', date('l F j, Y', $this->ts)); // to be used between the <title></title> tags $result = $this->DB->query('SELECT title, time_start, time_end, descrip FROM ' . T_MAIN . ' WHERE ID = ' . $this->id); if ($result->num_rows() != 1) { return FALSE; } $this->tpl->assign('data', $result->fetch()); $this->tpl->display('viewevent.tpl.php'); }
public function findOneById($id) { if (!is_int($id)) { throw new \InvalidArgumentException("l\\'id est sensé etre un integer. vous avez donné: " . $id, 500); } $result = $this->db->fetchAssoc("select * from where id = :id;", array(':id' => int_val($id))); if ($result == null || empty($result)) { return null; } $event = new GenericEvent($result); $event->setArgument("id", $id); $this->eventDispatcher->dispatch("post-findonebyid-" . $this->entityName, $event); return $event->getSubject(); }
public function deshydrater() { $donnee = array(); $donnee['id'] = int_val($this->id); return $donnee; }
<?php const STRING_VAL = "test"; function int_val(int $a = STRING_VAL) : int { return $a; } var_dump(int_val());
function myprefix_delete_user_cb() { //You should check nonces and user permissions at this point. $user_id = int_val($_REQUEST['user_id']); wp_delete_user($user_id); exit; }
function uddeIMintval($n) { return int_val($n); }