data = stripslashes_deep($_POST['options']); else $this->data = $data; $this->action = $_REQUEST['act']; } /** * Return true is there in an asked action is no action name is specified or * true is the requested action matches the passed action. * Dies if it is not a safe call. */ function is_action($action = null) { if ($action == null) return $this->action != null; if ($this->action == null) return false; if ($this->action != $action) return false; if (check_admin_referer()) return true; die('Invalid call'); } /** * Show the errors and messages. */ function show() { if (!empty($this->errors)) { echo '

'; echo $this->errors; echo '

'; } if (!empty($this->messages)) { echo '

'; echo $this->messages; echo '

'; } } function yesno($name) { $value = isset($this->data[$name]) ? (int) $this->data[$name] : 0; echo '   '; } function select($name, $options, $first = null) { $value = ''; if (isset($this->data[$name])) $value = $this->data[$name]; echo ''; } function value($name) { if (isset($this->data[$name])) echo esc_html($this->data[$name]); } function text($name, $size = 20) { echo ''; } function hidden($name) { echo ''; } function button($action, $label, $function = null) { if ($function != null) { echo ''; } else { echo ''; } } function textarea($name, $width = '100%', $height = '150') { echo ''; if ($this->show_key) echo 'Key: ', esc_html($name), '
'; } function checkbox($name, $label = '') { echo 'data[$name])) echo ' checked="checked"'; echo '/>'; if ($label != '') echo ' '; } function init() { echo ''; echo ''; wp_nonce_field(); } function button_link($action, $url, $anchor) { if (strpos($url, '?') !== false) $url .= $url . '&'; else $url .= $url . '?'; $url .= 'act=' . $action; $url .= '&_wpnonce=' . wp_create_nonce(); echo '' . $anchor . ''; } }