public function gen_message($sucess = null, $failure = null) { if (arvlbSQA::is_post() || isset($_GET['settings-updated'])) { if (is_null($sucess)) { $sucess = "Successfully saved!"; } if (is_null($failure)) { $failure = "Not saved, correct the errors!"; } $class = $this->has_error() ? "updateerror" : "updatesuccess"; $msg = $this->has_error() ? $failure : $sucess; echo "<div class=\"{$class}\"><strong>{$msg}</strong></div>"; } }
/** * Process the request of an admin page * */ public function process_request() { /* make sure that we only execute our code if one of our registered page is loaded */ if ($this->determine_page() && !empty($_GET['page'])) { /* Remove all (in this case: unwanted) quotes */ $_POST = stripslashes_deep($_POST); $_REQUEST = stripslashes_deep($_REQUEST); $_GET = stripslashes_deep($_GET); add_action('admin_enqueue_scripts', array($this, 'load_assets')); $this->admin_view->process_request(); /* If current request is an post request, the user intends to update or save any admin form */ if (arvlbSQA::is_post()) { $this->admin_view->save(); } } }
public function process_request() { if (isset($_REQUEST['id'])) { $this->is_edit = $_REQUEST['id']; } if (arvlbSQA::is_POST()) { $data = isset($_POST['o']) ? $_POST['o'] : array(); $this->options = array("o" => $data); } elseif (!arvlbSQA::is_POST()) { $this->options = array("o" => $this->model->fetch($this->get_id())); } }