### Eclipse Workspace Patch 1.0
#P wordpress
Index: wp-admin/options.php
===================================================================
--- wp-admin/options.php (revision 10593)
+++ wp-admin/options.php (working copy)
@@ -83,6 +83,148 @@
wp_redirect( $goback );
break;
+case 'serialoption':
+// viewer for a serialized option value.
+
+ // validate input
+ $option_name = isset( $_GET['option_name'] ) ? (string) trim( $_GET['option_name'] ) : null;
+
+ if ( $option_name === null )
+ wp_die(__('Cheatin’ uh?'));
+
+ $r = preg_match('/^[a-z0-9_]*$/', $option_name);
+ if ( $r == 0 )
+ wp_die(__('Cheatin’ uh?'));
+
+ $options_to_update = array(); // nothing to update right now.
+
+ include('admin-header.php'); ?>
+
+
@@ -99,38 +241,50 @@
foreach ( (array) $options as $option) :
$disabled = '';
+ $more = false;
$option->option_name = attribute_escape($option->option_name);
if ( is_serialized($option->option_value) ) {
if ( is_serialized_string($option->option_value) ) {
// this is a serialized string, so we should display it
$value = maybe_unserialize($option->option_value);
$options_to_update[] = $option->option_name;
- $class = 'all-options';
+ $class = 'all-options';
} else {
- $value = 'SERIALIZED DATA';
+ $value = sprintf('SERIALIZED DATA (~ %s %s)', number_format(strlen($option->option_value)), __('Bytes') );
$disabled = ' disabled="disabled"';
- $class = 'all-options disabled';
- }
- } else {
+ $class = 'all-options disabled';
+ $more = true;
+ }
+ } else {
$value = $option->option_value;
- $options_to_update[] = $option->option_name;
+ $options_to_update[] = $option->option_name;
$class = 'all-options';
}
- echo "
-
- |
-";
-
- if (strpos($value, "\n") !== false) echo "";
- else echo "";
+
+ $html_label = sprintf( '', $option->option_name );
+ $html_input = '';
+ if ( strpos($value, "\n") !== false ) {
+ $html_input = sprintf('', $class, $option->option_name, $option->option_name, wp_specialchars($value));
+ } else {
+ $html_input = sprintf('', $class, $option->option_name, $option->option_name, attribute_escape($value), $disabled);
+ }
+
+ /* more info on seriazlied data, add the expand button to gain access to serialoption */
+ if ( $more ) {
+ $html_href = sprintf('options.php?action=serialoption&option_name=%s', urlencode($option->option_name));
+ $html_label = sprintf('%s', $html_href, $option->option_name);
+ // uncommented: for label/expand button combo but I like the other combo more. $html_input .= sprintf(' %s', $html_href, _('Expand'));
+ }
- echo " |
-
";
-endforeach;
?>
+
+ |
+ |
+
+
-
+