2 require_once('admin.php');
4 $title = __('Options');
5 $this_file = 'options.php';
6 $parent_file = 'options-general.php';
8 wp_reset_vars(array('action'));
10 if ( !current_user_can('manage_options') )
11 wp_die(__('Cheatin’ uh?'));
18 check_admin_referer('update-options');
20 if ( !$_POST['page_options'] ) {
21 foreach ( (array) $_POST as $key => $value) {
22 if ( !in_array($key, array('_wpnonce', '_wp_http_referer')) )
26 $options = explode(',', stripslashes($_POST['page_options']));
30 foreach ($options as $option) {
31 $option = trim($option);
32 $value = $_POST[$option];
33 if(!is_array($value)) $value = trim($value);
34 $value = stripslashes_deep($value);
35 update_option($option, $value);
39 $goback = add_query_arg('updated', 'true', wp_get_referer());
44 include('admin-header.php'); ?>
47 <h2><?php _e('All Options'); ?></h2>
48 <form name="form" action="options.php" method="post" id="all-options">
49 <?php wp_nonce_field('update-options') ?>
50 <input type="hidden" name="action" value="update" />
51 <p class="submit"><input type="submit" name="Update" value="<?php _e('Update Options »') ?>" /></p>
54 $options = $wpdb->get_results("SELECT * FROM $wpdb->options ORDER BY option_name");
56 foreach ( (array) $options as $option) :
58 $option->option_name = attribute_escape($option->option_name);
59 if ( is_serialized($option->option_value) ) {
60 if ( is_serialized_string($option->option_value) ) {
61 // this is a serialized string, so we should display it
62 $value = maybe_unserialize($option->option_value);
63 $options_to_update[] = $option->option_name;
64 $class = 'all-options';
66 $value = 'SERIALIZED DATA';
67 $disabled = ' disabled="disabled"';
68 $class = 'all-options disabled';
71 $value = $option->option_value;
72 $options_to_update[] = $option->option_name;
73 $class = 'all-options';
77 <th scope='row'><label for='$option->option_name'>$option->option_name</label></th>
80 if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>" . wp_specialchars($value) . "</textarea>";
81 else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . attribute_escape($value) . "'$disabled />";
88 <?php $options_to_update = implode(',', $options_to_update); ?>
89 <p class="submit"><input type="hidden" name="page_options" value="<?php echo $options_to_update; ?>" /><input type="submit" name="Update" value="<?php _e('Update Options »') ?>" /></p>
98 include('admin-footer.php');