Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 50 additions & 11 deletions options-importer.php
Original file line number Diff line number Diff line change
Expand Up @@ -486,15 +486,41 @@ private function pre_import() {
text-align: left;
}
#importing_options td, #importing_options th {
padding: 5px 10px;
padding: 10px;
border-bottom: 1px solid #dfdfdf;
word-break: break-all;
}
#importing_options td.column-value {
width: 33%;
}
#importing_options td input {
margin: 0;
}
#importing_options pre {
white-space: pre-wrap;
max-height: 100px;
overflow-y: auto;
background: #fff;
padding: 5px;
margin: 0;
}
#importing_options tr td:first-child {
border-left: 3px solid #a5d6a7;
}
#importing_options tr td:last-child {
border-right: 3px solid #a5d6a7;
}
#importing_options tr.not-equal td {
background: #fff;
}
#importing_options tr.not-equal pre {
border: 1px solid #ddd;
}
#importing_options tr.not-equal td:first-child {
border-left-color: #ef5350;
}
#importing_options tr.not-equal td:last-child {
border-right-color: #ef5350;
}
div.error#import_all_warning {
margin: 25px 0 5px;
Expand Down Expand Up @@ -551,6 +577,7 @@ private function pre_import() {
<th>&nbsp;</th>
<th><?php _e( 'Option Name', 'wp-options-importer' ); ?></th>
<th><?php _e( 'New Value', 'wp-options-importer' ) ?></th>
<th><?php _e( 'Current Value', 'wp-options-importer' ) ?></th>
</tr>
</thead>
<tbody>
Expand All @@ -560,19 +587,14 @@ private function pre_import() {
if ( defined( 'WP_OPTION_IMPORT_BLACKLIST_REGEX' ) && preg_match( WP_OPTION_IMPORT_BLACKLIST_REGEX, $option_name ) ) {
continue;
}
$current_value = maybe_serialize( get_option( $option_name ) );
$classname = $option_value == $current_value ? null : 'not-equal';
?>
<tr>
<tr class="<?php echo $classname ?>">
<td><input type="checkbox" name="options[]" value="<?php echo esc_attr( $option_name ) ?>" <?php checked( in_array( $option_name, $whitelist ) ) ?> /></td>
<td><?php echo esc_html( $option_name ) ?></td>
<?php if ( null === $option_value ) : ?>
<td><em>null</em></td>
<?php elseif ( '' === $option_value ) : ?>
<td><em>empty string</em></td>
<?php elseif ( false === $option_value ) : ?>
<td><em>false</em></td>
<?php else : ?>
<td><pre><?php echo esc_html( $option_value ) ?></pre></td>
<?php endif ?>
<td class="column-value"><?php $this->the_value( $option_value ) ?></td>
<td class="column-value"><?php $this->the_value( $current_value ) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
Expand All @@ -595,6 +617,23 @@ private function pre_import() {
<?php
}

/**
* Print value on screen
*
* @return boolean
*/
private function the_value( $option_value ) {

if ( null === $option_value )
echo '<em>null</em>';
elseif ( '' === $option_value )
echo '<em>empty string</em>';
elseif ( false === $option_value )
echo '<em>false</em>';
else
echo '<pre>' . esc_html( $option_value ) . '</pre>';

}

/**
* The main controller for the actual import stage.
Expand Down