function start_form($options = array(), $nonce_var = null) { if (isset($_REQUEST['page'])) { list($location, $query) = explode('?', $_SERVER['REQUEST_URI']); $file = basename($location); if ('admin.php' == $file) { $default_action = "{$location}?page={$_REQUEST['page']}"; } else { if ('edit.php' == $file && isset($_REQUEST['post_type'])) { $default_action = "{$location}?post_type={$_REQUEST['post_type']}&page={$_REQUEST['page']}"; } } } if (!isset($default_action)) { $default_action = $_SERVER['REQUEST_URI']; } $defaults = array('id' => 'posts-filter', 'enctype' => 'multipart/form-data', 'method' => 'post', 'action' => $default_action); $options = array_merge($defaults, $options); echo '<form'; foreach ((array) $options as $var => $val) { if (!is_array($val)) { $val = str_replace('"', '"', $val); echo " {$var}=\"{$val}\""; } } echo ">\n"; if (false !== $nonce_var) { ITForm::add_nonce($nonce_var); } }