first commit
This commit is contained in:
@@ -0,0 +1,75 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
|
||||
<table id="optimizations_list" class="wp-list-table widefat striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<td class="check-column"><input id="select_all_optimizations" type="checkbox"></td>
|
||||
<th><?php esc_html_e('Optimization', 'wp-optimize'); ?></th>
|
||||
<th></th>
|
||||
<!-- <th></th>-->
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
$optimizations = $optimizer->sort_optimizations($optimizer->get_optimizations());
|
||||
|
||||
foreach ($optimizations as $id => $optimization) {
|
||||
if ('optimizetables' == $id && false === $does_server_allows_table_optimization) continue;
|
||||
// If we don't want to show optimization on the first tab.
|
||||
if (false === $optimization->display_in_optimizations_list()) continue;
|
||||
// This is an array, with attributes dom_id, activated, settings_label, info; all values are strings.
|
||||
$html = $optimization->get_settings_html();
|
||||
$disable_optimization_button = false;
|
||||
|
||||
// Check if the DOM is optimize-db to generate a list of tables.
|
||||
if ('optimize-db' == $html['dom_id']) {
|
||||
$table_list = $optimizer->get_table_information();
|
||||
|
||||
// Make sure that optimization_table_inno_db is set.
|
||||
if ($table_list['inno_db_tables'] > 0 && 0 == $table_list['is_optimizable'] && 0 == $table_list['non_inno_db_tables']) {
|
||||
$disable_optimization_button = true;
|
||||
$html['activated'] = '';
|
||||
}
|
||||
}
|
||||
|
||||
$sensitive_items = array(
|
||||
'clean-transient',
|
||||
'clean-pingbacks',
|
||||
'clean-trackbacks',
|
||||
'clean-postmeta',
|
||||
'clean-orphandata',
|
||||
'clean-commentmeta',
|
||||
'clean-usermeta',
|
||||
);
|
||||
|
||||
?>
|
||||
<tr class="wp-optimize-settings wp-optimize-settings-<?php echo esc_attr($html['dom_id']); ?><?php echo (in_array($html['dom_id'], $sensitive_items)) ? ' wp-optimize-setting-is-sensitive' : ''; ?>" id="wp-optimize-settings-<?php echo esc_attr($html['dom_id']); ?>" data-optimization_id="<?php echo esc_attr($id); ?>" data-optimization_run_sort_order="<?php echo esc_attr($optimization->get_run_sort_order()); ?>" >
|
||||
<?php
|
||||
if (!empty($html['settings_label'])) {
|
||||
?>
|
||||
|
||||
<th class="wp-optimize-settings-optimization-checkbox check-column">
|
||||
<input name="<?php echo esc_attr($html['dom_id']); ?>" id="optimization_checkbox_<?php echo esc_attr($id); ?>" class="optimization_checkbox" type="checkbox" value="true" <?php echo ($html['activated']) ? 'checked="checked"' : ''; ?> <?php echo $disable_optimization_button ? 'data-disabled="1" disabled' : ''; ?> >
|
||||
|
||||
<img id="optimization_spinner_<?php echo esc_attr($id); ?>" class="optimization_spinner display-none" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="...">
|
||||
</th>
|
||||
|
||||
|
||||
<td>
|
||||
<label for="optimization_checkbox_<?php echo esc_attr($id); ?>"><?php echo esc_html($html['settings_label']); ?></label>
|
||||
<div class="wp-optimize-settings-optimization-info" id="optimization_info_<?php echo esc_attr($id); ?>">
|
||||
<?php echo join('<br>', $html['info']); ?>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td class="wp-optimize-settings-optimization-run">
|
||||
<button id="optimization_button_<?php echo esc_attr($id); ?>_big" class="button button-secondary wp-optimize-settings-optimization-run-button show_on_default_sizes optimization_button_<?php echo esc_attr($id); ?>" type="button" <?php echo $disable_optimization_button ? 'data-disabled="1" disabled' : ''; ?> ><?php esc_html_e('Run optimization', 'wp-optimize'); ?></button>
|
||||
|
||||
<button id="optimization_button_<?php echo esc_attr($id); ?>_small" class="button button-secondary wp-optimize-settings-optimization-run-button show_on_mobile_sizes optimization_button_<?php echo esc_attr($id); ?>" type="button" <?php echo $disable_optimization_button ? 'data-disabled="1" disabled' : ''; ?> ><?php esc_html_e('Go', 'wp-optimize'); ?></button>
|
||||
</td>
|
||||
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
if (!defined('WPO_VERSION')) die('No direct access allowed');
|
||||
|
||||
?>
|
||||
<div class="wpo_shade hidden">
|
||||
<div class="wpo_shade_inner">
|
||||
<span class="dashicons dashicons-update-alt wpo-rotate"></span>
|
||||
<h4><?php esc_html_e('Loading data...', 'wp-optimize'); ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="wpo_section wpo_group">
|
||||
|
||||
<?php
|
||||
if (!empty($optimization_results)) {
|
||||
echo '<div id="message" class="updated below-h2"><strong>';
|
||||
foreach ($optimization_results as $optimization_result) {
|
||||
if (!empty($optimization_result->output)) {
|
||||
foreach ($optimization_result->output as $line) {
|
||||
echo $line."<br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
echo '</strong></div>';
|
||||
}
|
||||
?>
|
||||
|
||||
<?php WP_Optimize()->include_template('database/status-box-contents.php', false, array('optimize_db' => false)); ?>
|
||||
<?php
|
||||
$message = __('Warning: This operation is permanent.', 'wp-optimize');
|
||||
$message .= ' ';
|
||||
$message .= __('Continue?', 'wp-optimize');
|
||||
?>
|
||||
<form onsubmit="return confirm('<?php echo esc_js($message); ?>')" action="#" method="post" enctype="multipart/form-data" name="optimize_form" id="optimize_form">
|
||||
|
||||
<?php wp_nonce_field('wpo_optimization'); ?>
|
||||
|
||||
<h3><?php esc_html_e('Optimizations', 'wp-optimize'); ?></h3>
|
||||
|
||||
|
||||
<div class="wpo-run-optimizations__container">
|
||||
<?php $button_caption = apply_filters('wpo_run_button_caption', __('Run all selected optimizations', 'wp-optimize')); ?>
|
||||
<input class="button button-primary button-large" type="submit" id="wp-optimize" name="wp-optimize" value="<?php echo esc_attr($button_caption); ?>"><?php WP_Optimize()->include_template('take-a-backup.php', false, array('checkbox_name' => 'enable-auto-backup')); ?>
|
||||
</div>
|
||||
|
||||
<?php do_action('wpo_additional_options'); ?>
|
||||
|
||||
<?php
|
||||
if ($load_data) {
|
||||
WP_Optimize()->include_template('database/optimizations-table.php', false, array('does_server_allows_table_optimization' => $does_server_allows_table_optimization));
|
||||
} else {
|
||||
?>
|
||||
<div class="wp-optimize-optimizations-table-placeholder">
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<p class="wp-optimize-sensitive-tables-warning">
|
||||
<span style="color: #E07575;">
|
||||
<span class="dashicons dashicons-warning"></span>
|
||||
<?php esc_html_e('Warning:', 'wp-optimize'); ?>
|
||||
</span>
|
||||
<?php
|
||||
$message = __('Items marked with this icon perform more intensive database operations.', 'wp-optimize');
|
||||
$message .= ' ';
|
||||
$message .= __('In very rare cases, if your database server happened to crash or be forcibly powered down at the same time as an optimization operation was running, data might be corrupted.', 'wp-optimize');
|
||||
$message .= ' ';
|
||||
$message .= __('You may wish to run a backup before optimizing.', 'wp-optimize');
|
||||
echo esc_html($message);
|
||||
?>
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
@@ -0,0 +1,58 @@
|
||||
<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
|
||||
<div class="wpo-power-tweak <?php echo sanitize_html_class($action_type); ?>" data-tweak="<?php echo esc_attr($tweak_name); ?>">
|
||||
<h4><?php echo esc_html($title); ?></h4>
|
||||
<div class="actions">
|
||||
|
||||
<?php if ($is_available) : ?>
|
||||
<?php if ('activate' === $action_type) : ?>
|
||||
|
||||
<div class="switch-container">
|
||||
<label class="switch">
|
||||
<input id="tweak-<?php echo esc_attr($tweak_name); ?>" name="tweak[<?php echo esc_attr($tweak_name); ?>]" class="enable-tweak" type="checkbox" value="true"<?php checked($is_active); ?>>
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
<label for="tweak-<?php echo esc_attr($tweak_name); ?>">
|
||||
<?php echo esc_html($toggle_label); ?>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<?php elseif('run' === $action_type) : ?>
|
||||
|
||||
<button class="button button-primary run-tweak" type="button"><?php echo esc_html($run); ?></button>
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<?php do_action('wpo_power_tweak_actions', $tweak_name, $is_available); ?>
|
||||
|
||||
<?php do_action('wpo_power_tweak_actions_'.$tweak_name, $is_available); ?>
|
||||
|
||||
<?php else: ?>
|
||||
<?php if ('run' === $action_type && false !== $last_run) : ?>
|
||||
<div class="notice"><p class="wpo-tweak-unavailable"><?php esc_html_e('The tweak has been performed.', 'wp-optimize'); ?></p></div>
|
||||
<?php else: ?>
|
||||
<div class="notice"><p class="wpo-tweak-unavailable"><?php esc_html_e('Not available on your site', 'wp-optimize'); ?></p></div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ('run' === $action_type) : ?>
|
||||
<div class="last-updated<?php echo $last_run ? '' : ' hidden'; ?>"><?php esc_html_e('Last run:', 'wp-optimize'); ?> <span class="date"><?php echo esc_html(WP_Optimize()->format_date_time($last_run)); ?></span></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ('activate' === $action_type) : ?>
|
||||
<div class="last-updated<?php echo $updated_status ? '' : ' hidden'; ?>"><?php esc_html_e('Last time the status was changed:', 'wp-optimize'); ?> <span class="date"><?php echo esc_html(WP_Optimize()->format_date_time($updated_status)); ?></span></div>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<div class="description"><?php echo esc_html($description); ?></div>
|
||||
<?php if ($details) : ?>
|
||||
<a href="#" class="show-details"><?php esc_html_e('Show more details', 'wp-optimize'); ?></a>
|
||||
<div class="details hidden"><?php echo esc_html($details); ?></div>
|
||||
<?php endif; ?>
|
||||
<?php if ($faq_link) : ?>
|
||||
<p><?php $wp_optimize->wp_optimize_url($faq_link, '', esc_html__('Read more on getwpo.com', 'wp-optimize').'<span class="dashicons dashicons-external"></span>', 'class="show-faqs"'); ?></p>
|
||||
<?php endif; ?>
|
||||
<div class="tweak-is-running">
|
||||
<?php esc_html_e('Running...', 'wp-optimize'); ?>
|
||||
<span class="spinner"></span>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?>
|
||||
<div class="wpo-power-tweaks-section">
|
||||
<h3 class="wpo-first-child"><?php esc_html_e('Power tweaks', 'wp-optimize'); ?></h3>
|
||||
|
||||
<div class="power-tweaks--list">
|
||||
<?php
|
||||
/**
|
||||
* Display the power tweaks
|
||||
*/
|
||||
do_action('wpo_power_tweaks_output');
|
||||
?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,324 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
<div id="wpo_auto_cleanup">
|
||||
<h3><?php esc_html_e('Scheduled clean-up settings', 'wp-optimize'); ?></h3>
|
||||
|
||||
<div class="wpo-fieldgroup">
|
||||
<div id="wp-optimize-auto-options">
|
||||
<div class="wpo_auto_event_heading wpo_no_schedules"><?php echo esc_html__('There are no scheduled tasks.', 'wp-optimize'); ?></div>
|
||||
<div id="save_settings_reminder" class="save_settings_reminder"><?php esc_html_e('Remember to save your settings so that your changes take effect.', 'wp-optimize');?></div>
|
||||
<p class="innodb_force_optimize--container<?php echo $show_innodb_option ? '' : ' hidden'; ?>">
|
||||
<span class="dashicons dashicons-warning"></span>
|
||||
<strong><?php esc_html_e('Tables using the InnoDB engine', 'wp-optimize'); ?></strong><br>
|
||||
<input name="auto-innodb" id="auto-innodb" type="checkbox" value="true" <?php checked($options->get_option('auto-innodb'), 'true'); ?>>
|
||||
<label for="auto-innodb"><?php esc_html_e('Optimize InnoDB tables anyway.', 'wp-optimize'); ?></label>
|
||||
<?php $wp_optimize->wp_optimize_url('https://getwpo.com/faqs/', __('Warning: you should read the FAQ about the risks of this operation first.', 'wp-optimize')); ?>
|
||||
</p>
|
||||
<div id="wpo_auto_events" class="wpo_cf">
|
||||
<?php
|
||||
|
||||
$auto_options = WP_Optimize_Premium()->get_scheduled_optimizations();
|
||||
if (!empty($auto_options)) {
|
||||
?>
|
||||
<div class="wpo_auto_event_heading_container wpo_cf">
|
||||
<div class="wpo_optimizations wpo_auto_event_heading"><?php esc_html_e('Optimizations', 'wp-optimize'); ?></div>
|
||||
<div class="wpo_schedule wpo_auto_event_heading"><?php esc_html_e('Type', 'wp-optimize'); ?></div>
|
||||
<div class="wpo_schedule_details wpo_auto_event_heading"><?php esc_html_e('Schedule', 'wp-optimize'); ?></div>
|
||||
<div class="wpo_schedule_status wpo_auto_event_heading"><?php esc_html_e('Status', 'wp-optimize'); ?></div>
|
||||
<div class="wpo_actions wpo_auto_event_heading"><?php esc_html_e('Actions', 'wp-optimize'); ?></div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
foreach ($auto_options as $index => $event) {
|
||||
$div_schedule_fields_opened = false;
|
||||
wpo_display_event_summary($index, $event);
|
||||
printf('<div class="wpo_auto_event wpo_cf" data-count="%s" style="display: none;">', esc_attr($index));
|
||||
foreach ($event as $key => $value) {
|
||||
switch ($key) {
|
||||
case 'optimization':
|
||||
wpo_display_optimizations($value, $index);
|
||||
break;
|
||||
case 'schedule_type':
|
||||
wpo_display_schedule_type($value, $index);
|
||||
echo '<div class="wpo_schedule_fields">';
|
||||
$div_schedule_fields_opened = true;
|
||||
break;
|
||||
case 'date':
|
||||
wpo_display_date($value, $index);
|
||||
break;
|
||||
case 'time':
|
||||
wpo_display_time($value, $index);
|
||||
break;
|
||||
case 'week':
|
||||
wpo_display_week($value, $index);
|
||||
break;
|
||||
case 'day':
|
||||
wpo_display_week_day($value, $index);
|
||||
break;
|
||||
case 'day_number':
|
||||
wpo_display_day_number($value, $index);
|
||||
break;
|
||||
case 'status':
|
||||
if ($div_schedule_fields_opened) {
|
||||
echo '</div>';
|
||||
$div_schedule_fields_opened = false;
|
||||
}
|
||||
wpo_display_status($value, $index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ($div_schedule_fields_opened) {
|
||||
echo '</div>';
|
||||
$div_schedule_fields_opened = false;
|
||||
}
|
||||
|
||||
wpo_display_actions($index);
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<p><a href="#" id="wpo-add-event" class="wpo-repeater__add"><span class="dashicons dashicons-plus"></span> <?php esc_html_e('Add scheduled task', 'wp-optimize'); ?></a></p>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
/**
|
||||
* Displays scheduled event summary
|
||||
*
|
||||
* @param integer $index Count of events
|
||||
* @param array $event An array with event details
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_event_summary($index, $event) {
|
||||
// var_dump($event);
|
||||
printf('<div class="wpo_scheduled_event wpo_cf" data-count="%s">'."\n", esc_attr($index));
|
||||
|
||||
if (isset($event['optimization']) && is_array($event['optimization'])) wpo_display_optimization_list($event['optimization']);
|
||||
if (isset($event['schedule_type'])) {
|
||||
?>
|
||||
|
||||
<div class="wpo_schedule"><?php echo esc_html(ucfirst(substr($event['schedule_type'], 4))); ?></div>
|
||||
|
||||
<?php } ?>
|
||||
<div class="wpo_schedule_details">
|
||||
<?php
|
||||
if (isset($event['date'])) {
|
||||
printf('<span class="wpo_schedule_date">%s</span>', sprintf(esc_html__('Date: %s', 'wp-optimize'), esc_html($event['date'])));
|
||||
}
|
||||
if (isset($event['time'])) {
|
||||
printf('<span class="wpo_schedule_time">%s</span>', sprintf(esc_html__('Time: %s', 'wp-optimize'), esc_html($event['time'])));
|
||||
}
|
||||
if (isset($event['week'])) {
|
||||
printf('<span class="wpo_schedule_week">%s</span>', sprintf(esc_html__('Week: %s', 'wp-optimize'), esc_html($event['week'])));
|
||||
}
|
||||
if (isset($event['day'])) {
|
||||
$week_days = WP_Optimize_Premium::get_week_days();
|
||||
printf('<span class="wpo_schedule_week_day">%s</span>', sprintf(esc_html__('Day: %s', 'wp-optimize'), esc_html($week_days[$event['day']])));
|
||||
}
|
||||
if (isset($event['day_number'])) {
|
||||
printf('<span class="wpo_schedule_day_number">%s</span>', sprintf(esc_html__('Date: %s', 'wp-optimize'), esc_html($event['day_number'])));
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php if (isset($event['status'])) { ?>
|
||||
|
||||
<div class="wpo_schedule_status <?php echo ('1' == $event['status']) ? 'active' : 'inactive'; ?>">
|
||||
<?php
|
||||
$status = ('1' == $event['status']) ? __('Active', 'wp-optimize') : __('Inactive', 'wp-optimize');
|
||||
echo esc_html($status);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
|
||||
wpo_display_actions($index, true);
|
||||
?>
|
||||
|
||||
</div> <!-- End of .wpo_scheduled_event -->
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays available auto optimizations as select field
|
||||
*
|
||||
* @param array $optimizations An array of available auto optimizations
|
||||
* @param integer $count Index of scheduled events
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_optimizations($optimizations, $count) {
|
||||
$auto_optimizations = WP_Optimize_Premium::get_auto_optimizations();
|
||||
$html = '';
|
||||
$html .= sprintf('<select class="wpo_auto_optimizations" name="wp-optimize-auto[%s][optimization][]" multiple="multiple">', esc_attr($count));
|
||||
foreach ($auto_optimizations as $id => $details) {
|
||||
$selected = in_array($id, $optimizations) ? 'selected="selected"' : '';
|
||||
$html .= sprintf('<option value="%1$s" %2$s>%3$s</option>', esc_attr($id), $selected, esc_html($details['optimization']));
|
||||
}
|
||||
$html .= '</select>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays schedule type as select field
|
||||
*
|
||||
* @param array $schedule_type Date value
|
||||
* @param integer $count Index of scheduled events
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_schedule_type($schedule_type, $count) {
|
||||
$schedule_types = WP_Optimize_Premium::get_schedule_types();
|
||||
$html = '';
|
||||
$html .= sprintf('<select class="wpo_schedule_type" name="wp-optimize-auto[%s][schedule_type]">', esc_attr($count));
|
||||
foreach ($schedule_types as $key => $value) {
|
||||
$html .= sprintf('<option value="%1$s" %2$s>%3$s</option>', esc_attr($key), selected($schedule_type, $key, false), esc_html($value));
|
||||
}
|
||||
$html .= '</select>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays date field
|
||||
*
|
||||
* @param string $date Date value
|
||||
* @param integer $count Index of scheduled events
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_date($date, $count) {
|
||||
$today = date("Y-m-d");
|
||||
$html = '';
|
||||
$html .= sprintf('<label>%s', esc_html__('Date:', 'wp-optimize'));
|
||||
$html .= sprintf('<input type="date" name="wp-optimize-auto[%1$s][date]" value="%2$s" min="%3$s">', esc_attr($count), esc_attr($date), esc_attr($today));
|
||||
$html .= '</label>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays time field
|
||||
*
|
||||
* @param string $time Time value
|
||||
* @param integer $count Index of scheduled events
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_time($time, $count) {
|
||||
$html = '';
|
||||
$html .= sprintf('<label>%s', esc_html__('Time:', 'wp-optimize'));
|
||||
$html .= sprintf('<input type="time" name="wp-optimize-auto[%1$s][time]" value="%2$s">', esc_attr($count), esc_attr($time));
|
||||
$html .= '</label>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays week select field
|
||||
*
|
||||
* @param array $week An array of 2 weeks
|
||||
* @param integer $count Index of scheduled events
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_week($week, $count) {
|
||||
$weeks = array('1st' => __('1st', 'wp-optimize'), '2nd' => __('2nd', 'wp-optimize'));
|
||||
$html = '';
|
||||
$html .= sprintf('<select class="wpo_week_number" name="wp-optimize-auto[%s][week]">', esc_attr($count));
|
||||
foreach ($weeks as $key => $value) {
|
||||
$html .= sprintf('<option value="%1$s" %2$s>%3$s</option>', esc_attr($key), selected($week, $key, false), esc_html($value));
|
||||
}
|
||||
$html .= '</select>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays week days select field
|
||||
*
|
||||
* @param array $week_day An array of week days
|
||||
* @param integer $count Index of scheduled events
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_week_day($week_day, $count) {
|
||||
$week_days = WP_Optimize_Premium::get_week_days();
|
||||
$html = '';
|
||||
$html .= sprintf('<select class="wpo_week_days" name="wp-optimize-auto[%s][day]">', esc_attr($count));
|
||||
foreach ($week_days as $key => $value) {
|
||||
$html .= sprintf('<option value="%1$s" %2$s>%3$s</option>', esc_attr($key), selected($week_day, $key, false), esc_html($value));
|
||||
}
|
||||
$html .= '</select>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays days select field
|
||||
*
|
||||
* @param array $day An array of days of a month
|
||||
* @param integer $count Index of scheduled events
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_day_number($day, $count) {
|
||||
$days = WP_Optimize_Premium::get_days();
|
||||
$html = '';
|
||||
$html .= sprintf('<label>%s</label>', esc_html__('Day Number:', 'wp-optimize'));
|
||||
$html .= sprintf('<select class="wpo_day_number" name="wp-optimize-auto[%s][day_number]">', esc_attr($count));
|
||||
foreach ($days as $value) {
|
||||
$html .= sprintf('<option value="%1$s" %2$s>%3$s</option>', esc_attr($value), selected($day, $value, false), esc_html($value));
|
||||
}
|
||||
$html .= '</select>';
|
||||
echo $html;
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays status field
|
||||
*
|
||||
* @param integer $status Status value
|
||||
* @param integer $count Index of scheduled events
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_status($status, $count) {
|
||||
echo '<div class="wpo_event_status">';
|
||||
printf('<label><input type="checkbox" name="wp-optimize-auto[%1$s][status]" value="1" %2$s>%3$s</label>', esc_attr($count), checked($status, 1, false), esc_html__('Active', 'wp-optimize'));
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays actions field
|
||||
*
|
||||
* @param integer $index Count of event
|
||||
* @param boolean $edit Boolean value to determine edit action
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_actions($index, $edit = false) {
|
||||
printf('<div class="wpo_event_actions %s">', $edit ? "wpo_event_edit" : "");
|
||||
if (true === $edit) {
|
||||
printf('<span class="wpo_edit_event" title="%1$s">%1$s</span>', esc_html__('Edit', 'wp-optimize'));
|
||||
printf('<span class="wpo_remove_event" title="%1$s" data-count="%2$s">%1s</span>', esc_html__('Delete', 'wp-optimize'), esc_attr($index));
|
||||
} else {
|
||||
printf('<span class="wpo_cancel_event button button-secondary" title="%1$s">%1$s</span>', esc_html__('Cancel', 'wp-optimize'));
|
||||
printf('<span class="wpo_save_event button button-primary" title="%1$s">%1$s</span>', esc_html__('Apply', 'wp-optimize'));
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays date field
|
||||
*
|
||||
* @param array $optimizations An array of selected optimizations
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
function wpo_display_optimization_list($optimizations) {
|
||||
$auto_optimizations = WP_Optimize_Premium::get_auto_optimizations();
|
||||
$html = '';
|
||||
$html .= '<ul class="wpo_optimizations">';
|
||||
foreach ($optimizations as $optimization) {
|
||||
$html .= sprintf('<li data-optimization="%s"><span class="dashicons dashicons-arrow-right"></span>%s</li>', esc_attr($optimization), esc_html($auto_optimizations[$optimization]['optimization']));
|
||||
}
|
||||
$html .= '</ul>';
|
||||
echo $html;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
|
||||
<h3 class="wpo-first-child"><?php esc_html_e('General settings', 'wp-optimize'); ?></h3>
|
||||
<div class="wpo-fieldgroup">
|
||||
<p>
|
||||
<?php esc_html_e('Whether manually or on a schedule, these settings apply whenever a relevant optimization is run.', 'wp-optimize'); ?>
|
||||
</p>
|
||||
<p>
|
||||
<input name="enable-retention" id="enable-retention" type="checkbox" value ="true" <?php echo ($options->get_option('retention-enabled') == 'true') ? 'checked="checked"' : ''; ?>>
|
||||
<?php
|
||||
$retention_period = max((int) $options->get_option('retention-period', '2'), 1);
|
||||
|
||||
echo '<label for="enable-retention">';
|
||||
printf(
|
||||
esc_html__('Keep last %s weeks data', 'wp-optimize'),
|
||||
'</label><input id="retention-period" name="retention-period" type="number" step="1" min="2" max="99" value="'.esc_attr($retention_period).'"><label for="enable-retention">'
|
||||
);
|
||||
echo '</label>';
|
||||
?>
|
||||
<br>
|
||||
<small><?php echo esc_html__('This option will, where relevant, retain data from the chosen period, and remove any garbage data before that period.', 'wp-optimize').' '.esc_html__('If the option is not active, then all garbage data will be removed.', 'wp-optimize').' '.esc_html__('This will also affect Auto Clean-up process', 'wp-optimize'); ?></small>
|
||||
</p>
|
||||
<p>
|
||||
<input name="enable-revisions-retention" id="enable-revisions-retention" type="checkbox" value ="true" <?php echo ('true' == $options->get_option('revisions-retention-enabled')) ? 'checked="checked"' : ''; ?>>
|
||||
<?php
|
||||
$revisions_retention_count = (int) $options->get_option('revisions-retention-count', '2');
|
||||
|
||||
echo '<label for="enable-revisions-retention">';
|
||||
printf(
|
||||
esc_html__('Always keep %s post revisions', 'wp-optimize'),
|
||||
'</label><input id="revisions-retention-count" name="revisions-retention-count" type="number" step="1" min="2" max="99" value="'.esc_attr($revisions_retention_count).'"><label for="revisions-retention-count">'
|
||||
);
|
||||
echo '</label>';
|
||||
?>
|
||||
<br>
|
||||
<small><?php echo esc_html__('This option will retain specified number of post revisions, and remove other revisions.', 'wp-optimize').' '.esc_html__('If the option is not active, then all garbage data will be removed.', 'wp-optimize').' '.esc_html__('This will also affect Auto Clean-up process', 'wp-optimize'); ?></small>
|
||||
</p>
|
||||
<?php WP_Optimize()->include_template('take-a-backup.php', false, array('label' => __('Take a backup with UpdraftPlus before running scheduled optimizations', 'wp-optimize'), 'checkbox_name' => 'enable-auto-backup-scheduled')); ?>
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
|
||||
<div id="wp-optimize-database-settings" class="wpo_section wpo_group">
|
||||
<form action="#" method="post" enctype="multipart/form-data" name="database_settings_form" id="database_settings_form">
|
||||
<div id="wpo_database_settings_warnings"></div>
|
||||
<?php
|
||||
WP_Optimize()->include_template('database/settings-general.php');
|
||||
WP_Optimize()->include_template('database/settings-auto-cleanup.php', false, array('show_innodb_option' => false));
|
||||
?>
|
||||
|
||||
<div id="wp-optimize-save-database-settings-results"></div>
|
||||
|
||||
<input type="hidden" name="action" value="save_redirect">
|
||||
|
||||
<?php wp_nonce_field('wpo_optimization', '_wpnonce_db_settings'); ?>
|
||||
|
||||
<div class="wp-optimize-settings-save-results"></div>
|
||||
|
||||
<input id="wp-optimize-save-database-settings" class="button button-primary wpo-save-settings" type="submit" name="wp-optimize-settings" value="<?php esc_attr_e('Save settings', 'wp-optimize'); ?>">
|
||||
|
||||
<img class="wpo_spinner wpo-saving-settings" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>" alt="...">
|
||||
|
||||
<span class="dashicons dashicons-yes display-none save-done"></span>
|
||||
|
||||
</form>
|
||||
</div><!-- end #wp-optimize-general-settings -->
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
if (!defined('WPO_VERSION')) die('No direct access allowed');
|
||||
|
||||
$retention_enabled = $options->get_option('retention-enabled', 'false');
|
||||
$retention_period = $options->get_option('retention-period', '2');
|
||||
$admin_page_url = $options->admin_page_url();
|
||||
|
||||
$revisions_retention_enabled = $options->get_option('revisions-retention-enabled', 'false');
|
||||
$revisions_retention_count = $options->get_option('revisions-retention-count', '2');
|
||||
|
||||
?>
|
||||
|
||||
<h3 class="wpo-first-child"><?php esc_html_e('Status', 'wp-optimize'); ?></h3>
|
||||
|
||||
<div class="wpo-fieldgroup" id="wp_optimize_status_box">
|
||||
<p>
|
||||
<?php
|
||||
$lastopt = $options->get_option('last-optimized', 'Never');
|
||||
if ('Never' !== $lastopt) {
|
||||
// check if last optimized value is integer.
|
||||
if (is_numeric($lastopt)) {
|
||||
$lastopt = date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $lastopt + ( get_option('gmt_offset') * HOUR_IN_SECONDS ));
|
||||
}
|
||||
printf(esc_html__('Last scheduled optimization was at %s', 'wp-optimize'), '<span style="color: #004600; font-weight:bold;">' . esc_html($lastopt) . '</span>');
|
||||
} else {
|
||||
echo esc_html__('There was no scheduled optimization', 'wp-optimize');
|
||||
}
|
||||
?>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
|
||||
$scheduled_optimizations_enabled = false;
|
||||
|
||||
if (WP_Optimize::is_premium()) {
|
||||
$scheduled_optimizations = WP_Optimize_Premium()->get_scheduled_optimizations();
|
||||
|
||||
if (!empty($scheduled_optimizations)) {
|
||||
foreach ($scheduled_optimizations as $optimization) {
|
||||
if (isset($optimization['status']) && 1 == $optimization['status']) {
|
||||
$scheduled_optimizations_enabled = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$scheduled_optimizations_enabled = $options->get_option('schedule', 'false') == 'true';
|
||||
}
|
||||
|
||||
if ($scheduled_optimizations_enabled) {
|
||||
printf(
|
||||
esc_html__('%sScheduled cleaning %senabled%s%s', 'wp-optimize'),
|
||||
'<strong>',
|
||||
'<span style="color: #009B24;">',
|
||||
'</span>',
|
||||
'</strong> '
|
||||
);
|
||||
|
||||
$timestamp = apply_filters('wpo_cron_next_event', wp_next_scheduled('wpo_cron_event2'));
|
||||
|
||||
if ($timestamp) {
|
||||
|
||||
$timestamp = $timestamp + 60 * 60 * get_option('gmt_offset');
|
||||
|
||||
$wp_optimize->cron_activate();
|
||||
|
||||
$date = new DateTime("@".$timestamp);
|
||||
esc_html_e('Next schedule:', 'wp-optimize');
|
||||
echo ' ';
|
||||
echo '<span style="font-color: #004600">';
|
||||
echo esc_html(gmdate(get_option('date_format') . ' ' . get_option('time_format'), $timestamp));
|
||||
echo '</span>';
|
||||
echo ' - <a id="wp_optimize_status_box_refresh" href="'.esc_url($admin_page_url).'">'.esc_html__('Refresh', 'wp-optimize').'</a>';
|
||||
}
|
||||
} else {
|
||||
printf(
|
||||
esc_html__('%sScheduled cleaning disabled%s', 'wp-optimize'),
|
||||
'<strong>',
|
||||
'</strong>'
|
||||
);
|
||||
}
|
||||
echo '<br>';
|
||||
|
||||
if ('true' == $retention_enabled) {
|
||||
echo '<strong><span style="font-color: #0000FF;">';
|
||||
printf(esc_html__('Keeping last %s weeks data', 'wp-optimize'), esc_html($retention_period));
|
||||
echo '</span></strong>';
|
||||
} else {
|
||||
echo '<strong>'.esc_html__('Not keeping recent data', 'wp-optimize').'</strong>';
|
||||
}
|
||||
|
||||
echo '<br>';
|
||||
|
||||
if ('true' == $revisions_retention_enabled) {
|
||||
echo '<strong><span style="font-color: #0000FF;">';
|
||||
printf(esc_html__('Keeping last %s revisions', 'wp-optimize'), esc_html($revisions_retention_count));
|
||||
echo '</span></strong>';
|
||||
} else {
|
||||
echo '<strong>'.esc_html__('Not keeping any revisions', 'wp-optimize').'</strong>';
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<?php
|
||||
$total_cleaned = $options->get_option('total-cleaned');
|
||||
$total_cleaned_num = floatval($total_cleaned);
|
||||
|
||||
if ($total_cleaned_num > 0) {
|
||||
printf(
|
||||
esc_html__('%sTotal clean up overall: %s %s', 'wp-optimize'),
|
||||
'<h5>',
|
||||
'<span style="color: #004600;">' . esc_html($wp_optimize->format_size($total_cleaned)) . '</span>',
|
||||
'</h5>'
|
||||
);
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
|
||||
<?php
|
||||
$corrupted_tables_count = $options->get_option('corrupted-tables-count', 0);
|
||||
|
||||
if ($corrupted_tables_count > 0) {
|
||||
?>
|
||||
<p>
|
||||
<span style="color: #E07575;"><?php echo esc_html(sprintf(_n('Your database has %s corrupted table.', 'Your database has %s corrupted tables.', $corrupted_tables_count, 'wp-optimize'), $corrupted_tables_count)); ?></span><br>
|
||||
<a href="<?php echo esc_url($admin_page_url); ?>&tab=wp_optimize_tables" onclick="jQuery('.wpo-pages-menu > a').first().trigger('click'); jQuery('#wp-optimize-nav-tab-wpo_database-tables').trigger('click'); return false;"><?php esc_html_e('Repair corrupted tables here.', 'wp-optimize'); ?></a>
|
||||
</p>
|
||||
<?php } ?>
|
||||
</div>
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
|
||||
<tbody id="the-list">
|
||||
<?php
|
||||
|
||||
// Check for InnoDB tables.
|
||||
// Check for windows servers.
|
||||
$sqlversion = $wp_optimize->get_db_info()->get_version();
|
||||
$tablesstatus = $wp_optimize->get_optimizer()->get_tables();
|
||||
$is_multisite_mode = $wp_optimize->is_multisite_mode();
|
||||
$total_gain = 0;
|
||||
$no = 0;
|
||||
$row_usage = 0;
|
||||
$data_usage = 0;
|
||||
$index_usage = 0;
|
||||
$overhead_usage = 0;
|
||||
$non_inno_db_tables = 0;
|
||||
$inno_db_tables = 0;
|
||||
$small_overhead_size = 1048576;
|
||||
|
||||
foreach ($tablesstatus as $tablestatus) {
|
||||
$no++;
|
||||
echo '<tr
|
||||
data-tablename="'.esc_attr($tablestatus->Name).'"
|
||||
data-type="'.esc_attr($tablestatus->Engine).'"
|
||||
data-optimizable="'.($tablestatus->is_optimizable ? 1 : 0).'"
|
||||
'.($is_multisite_mode ? 'data-blog_id="'.esc_attr($tablestatus->blog_id).'"' : '').'
|
||||
>'."\n";
|
||||
echo '<td data-colname="'.esc_attr__('No.', 'wp-optimize').'">'.esc_html(number_format_i18n($no)).'</td>'."\n";
|
||||
echo '<td data-tablename="'.esc_attr($tablestatus->Name).'" data-colname="'.esc_attr__('Table', 'wp-optimize').'">'.esc_html($tablestatus->Name);
|
||||
|
||||
if (!empty($tablestatus->plugin_status)) {
|
||||
if ($tablestatus->wp_core_table) {
|
||||
echo "<br><span style='font-size: 11px;'>".esc_html__('Belongs to:', 'wp-optimize')."</span> ";
|
||||
echo "<span style='font-size: 11px;'>".esc_html__('WordPress core', 'wp-optimize')."</span>";
|
||||
} elseif (false !== stripos($tablestatus->Name, 'actionscheduler_')) {
|
||||
$message = __('This table is used by many plugins for batch processing.', 'wp-optimize');
|
||||
$message .= ' ';
|
||||
echo "<br><span style='font-size: 11px;'>". esc_html($message) ."</span> ";
|
||||
echo "<span style='font-size: 11px;'>".esc_html__('Thus, it cannot be deleted.', 'wp-optimize')."</span>";
|
||||
} else {
|
||||
echo '<div class="table-plugins">';
|
||||
echo "<span style='font-size: 11px;'>".esc_html__('Known plugins that use this table name:', 'wp-optimize')."</span> ";
|
||||
foreach ($tablestatus->plugin_status as $plugins_status) {
|
||||
$plugin = $plugins_status['plugin'];
|
||||
$status = $plugins_status['status'];
|
||||
|
||||
echo '<br>';
|
||||
|
||||
$closed_plugins = array('404-monitor', 'redirections');
|
||||
|
||||
if (in_array($plugin, $closed_plugins)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ('sfwd-lms' === $plugin) {
|
||||
$wp_optimize->wp_optimize_url('https://www.learndash.com/', '', '<span style="font-size: 11px;">LearnDash</span>');
|
||||
} else {
|
||||
$wp_optimize->wp_optimize_url('https://wordpress.org/plugins/'.$plugin.'/', '', '<span style="font-size: 11px;">'.esc_html($plugin).'</span>');
|
||||
}
|
||||
|
||||
if (false == $status['installed']) {
|
||||
echo ' <span style="font-size: 11px; color: #9B0000; font-weight: bold;">['.esc_html__('not installed', 'wp-optimize').']</span>';
|
||||
} elseif (false == $status['active']) {
|
||||
echo ' <span style="font-size: 11px; color: #9B0000; font-weight: bold;">['.esc_html__('inactive', 'wp-optimize').']</span>';
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
echo "</td>\n";
|
||||
|
||||
echo '<td data-colname="'.esc_attr__('Records', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Rows)).'">'.esc_html(number_format_i18n($tablestatus->Rows)).'</td>'."\n";
|
||||
echo '<td data-colname="'.esc_attr__('Data Size', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Data_length)).'">'. esc_html($wp_optimize->format_size($tablestatus->Data_length)).'</td>'."\n";
|
||||
echo '<td data-colname="'.esc_attr__('Index Size', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Index_length)).'">'. esc_html($wp_optimize->format_size($tablestatus->Index_length)).'</td>'."\n";
|
||||
|
||||
if ($tablestatus->is_optimizable) {
|
||||
echo '<td data-colname="'.esc_attr__('Type', 'wp-optimize').'" data-optimizable="1">'.esc_html($tablestatus->Engine).'</td>'."\n";
|
||||
|
||||
echo '<td data-colname="'.esc_attr__('Overhead', 'wp-optimize').'" data-raw_value="'.esc_attr(intval($tablestatus->Data_free)).'">';
|
||||
$font_colour = ($optimize_db ? (($tablestatus->Data_free > $small_overhead_size) ? '#0000FF' : '#004600') : (($tablestatus->Data_free > $small_overhead_size) ? '#9B0000' : '#004600'));
|
||||
echo '<span style="color:'. esc_attr($font_colour) .';">';
|
||||
echo esc_html($wp_optimize->format_size($tablestatus->Data_free));
|
||||
echo '</span>';
|
||||
echo '</td>'."\n";
|
||||
|
||||
$overhead_usage += $tablestatus->Data_free;
|
||||
$total_gain += $tablestatus->Data_free;
|
||||
$non_inno_db_tables++;
|
||||
} else {
|
||||
echo '<td data-colname="'.esc_attr__('Type', 'wp-optimize').'" data-optimizable="0">'.esc_html($tablestatus->Engine).'</td>'."\n";
|
||||
echo '<td data-colname="'.esc_attr__('Overhead', 'wp-optimize').'">';
|
||||
echo '<span style="color:#0000FF;">-</span>';
|
||||
echo '</td>'."\n";
|
||||
|
||||
$inno_db_tables++;
|
||||
}
|
||||
|
||||
echo '<td data-colname="'.esc_attr__('Actions', 'wp-optimize').'">'. apply_filters('wpo_tables_list_additional_column_data', '', $tablestatus) .'</td>';
|
||||
|
||||
$row_usage += $tablestatus->Rows;
|
||||
$data_usage += $tablestatus->Data_length;
|
||||
$index_usage += $tablestatus->Index_length;
|
||||
|
||||
echo '</tr>'."\n";
|
||||
}
|
||||
|
||||
// THis extra tbody with class of tablesorter-no-sort
|
||||
// Is for tablesorter and it will not allow the total bar
|
||||
// At the bottom of the table information to be sorted with the rest of the data
|
||||
echo '<tbody class="tablesorter-no-sort">'."\n";
|
||||
|
||||
echo '<tr class="thead">'."\n";
|
||||
echo '<th>'.esc_html__('Total:', 'wp-optimize').'</th>'."\n";
|
||||
echo '<th>'.esc_html(sprintf(_n('%s Table', '%s Tables', $no, 'wp-optimize'), number_format_i18n($no))).'</th>'."\n";
|
||||
echo '<th>'.esc_html(number_format_i18n($row_usage)).'</th>'."\n";
|
||||
echo '<th>'.esc_html($wp_optimize->format_size($data_usage)).'</th>'."\n";
|
||||
echo '<th>'.esc_html($wp_optimize->format_size($index_usage)).'</th>'."\n";
|
||||
echo '<th>'.'-'.'</th>'."\n";
|
||||
echo '<th>';
|
||||
|
||||
$font_colour = (($optimize_db) ? (($overhead_usage > $small_overhead_size) ? '#0000FF' : '#004600') : (($overhead_usage > $small_overhead_size) ? '#9B0000' : '#004600'));
|
||||
|
||||
echo '<span style="color:'.esc_attr($font_colour).'">'.esc_html($wp_optimize->format_size($overhead_usage)).'</span>';
|
||||
|
||||
?>
|
||||
</th>
|
||||
<th><?php esc_html_e('Actions', 'wp-optimize'); ?></th>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
if (!defined('WPO_VERSION')) die('No direct access allowed');
|
||||
|
||||
if ($load_data) {
|
||||
$optimizer = WP_Optimize()->get_optimizer();
|
||||
list ($db_size, $total_gain) = $optimizer->get_current_db_size();
|
||||
}
|
||||
|
||||
?>
|
||||
<h3><?php esc_html_e('Total size of database:', 'wp-optimize'); ?> <span id="optimize_current_db_size"><?php
|
||||
if ($load_data) {
|
||||
echo esc_html($db_size);
|
||||
} else {
|
||||
echo '...';
|
||||
}
|
||||
?></span></h3>
|
||||
|
||||
<?php
|
||||
if ($optimize_db) {
|
||||
?>
|
||||
|
||||
<h3><?php esc_html_e('Optimization results:', 'wp-optimize'); ?></h3>
|
||||
<p style="color: #0000ff;" id="optimization_table_total_gain">
|
||||
<?php
|
||||
if ($total_gain > 0) {
|
||||
printf(esc_html__('Total space saved: %s', 'wp-optimize'), '<span>'. esc_html($wp_optimize->format_size($total_gain)).'</span> ');
|
||||
$optimizer->update_total_cleaned(strval($total_gain));
|
||||
}
|
||||
?>
|
||||
</p>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/html" id="tmpl-wpo-table-delete">
|
||||
<h3><span class="dashicons dashicons-warning"></span> <?php esc_html_e('Are you sure?', 'wp-optimize'); ?></h3>
|
||||
<div class="notice notice-warning">
|
||||
<p><?php echo esc_html__('WARNING - some plugins might not be detected as installed or activated if they are in unknown folders (for example premium plugins).', 'wp-optimize').' '.esc_html__('Only delete a table if you are sure of what you are doing, and after taking a backup.', 'wp-optimize'); ?></p>
|
||||
<p><?php echo esc_html__('If none of the plugins listed were ever installed on this website, you should not delete this table as it is likely to be used by an unlisted plugin.', 'wp-optimize'); ?></p>
|
||||
</div>
|
||||
<h4><?php printf(esc_html__('You are about to remove the table %s.', 'wp-optimize'), '<span class="table-name">{{data.table_name}}</span>'); ?></h4>
|
||||
<div class="wpo-table-delete--plugins">
|
||||
{{{data.plugins_list}}}
|
||||
</div>
|
||||
<# if (data.no_backup) { #>
|
||||
<p class="no-backup-detected">
|
||||
<input type="checkbox" id="confirm_deletion_without_backup"> <strong><?php esc_html_e('No automatic backup was detected.', 'wp-optimize'); ?></strong> <?php esc_html_e('I confirm that I will be able to revert the changes if needed.', 'wp-optimize'); ?>
|
||||
</p>
|
||||
<# } #>
|
||||
<p>
|
||||
<input type="checkbox" id="confirm_table_deletion"> <?php esc_html_e('I confirm that I have understood the risks in doing that, and that I know what I am doing.', 'wp-optimize'); ?>
|
||||
</p>
|
||||
<p>
|
||||
<input type="checkbox" id="ignores_table_delete_warning"> <?php esc_html_e('Do not show this warning again.', 'wp-optimize'); ?>
|
||||
</p>
|
||||
<button type="button" class="button button-primary delete-table" disabled><?php esc_html_e('Remove the table', 'wp-optimize'); ?></button>
|
||||
<button type="button" class="button cancel wpo-modal--close"><?php esc_html_e('Cancel', 'wp-optimize'); ?></button>
|
||||
</script>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
<p class="innodb_force_optimize--container hidden">
|
||||
<input id="innodb_force_optimize_single" type="checkbox">
|
||||
<label for="innodb_force_optimize_single"><?php esc_html_e('Optimize InnoDB tables anyway.', 'wp-optimize'); ?></label>
|
||||
<?php $wp_optimize->wp_optimize_url('https://getwpo.com/faqs/', __('Warning: you should read the FAQ on the risks of this operation first.', 'wp-optimize')); ?>
|
||||
</p>
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?>
|
||||
<div class="wpo_shade hidden">
|
||||
<div class="wpo_shade_inner">
|
||||
<span class="dashicons dashicons-update-alt wpo-rotate"></span>
|
||||
<h4><?php esc_html_e('Loading data...', 'wp-optimize'); ?></h4>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// This next bit belongs somewhere else, I think.
|
||||
?>
|
||||
<?php if ($optimize_db) { ?>
|
||||
<p><?php esc_html_e('Optimized all the tables found in the database.', 'wp-optimize'); ?></p>
|
||||
<?php } ?>
|
||||
<?php
|
||||
|
||||
// used for output premium functionality
|
||||
do_action('wpo_tables_list_before');
|
||||
|
||||
?>
|
||||
|
||||
<?php $wp_optimize->include_template('take-a-backup.php', false, array('label' => __('Take a backup with UpdraftPlus before any actions upon tables (recommended).', 'wp-optimize'), 'default_checkbox_value' => 'true', 'checkbox_name' => 'enable-auto-backup-1')); ?>
|
||||
|
||||
<p class="wpo-table-list-filter"><strong><?php echo esc_html__('Database name:', 'wp-optimize')." '".esc_html(DB_NAME)."'"; ?><a id="wp_optimize_table_list_refresh" href="#" class="wpo-refresh-button"><span class="dashicons dashicons-image-rotate"></span><?php esc_html_e('Refresh data', 'wp-optimize'); ?></a></strong> <input id="wpoptimize_table_list_filter" class="search" type="search" value="" placeholder="<?php esc_attr_e('Search for table', 'wp-optimize'); ?>" data-column="1"></p>
|
||||
|
||||
<?php
|
||||
$optimizer = WP_Optimize()->get_optimizer();
|
||||
$table_prefix = $optimizer->get_table_prefix();
|
||||
if (!$table_prefix) {
|
||||
?>
|
||||
<p class="wpo-table-list-filter"><span style="color: #0073aa;"><span class="dashicons dashicons-info"></span> <?php echo esc_html__('Note:', 'wp-optimize').'</span> '.esc_html__('Your WordPress install does not use a database prefix, so WP-Optimize was not able to differentiate which tables belong to WordPress so all tables are listed below.', 'wp-optimize'); ?></p>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
|
||||
<table id="wpoptimize_table_list" class="wp-list-table widefat striped tablesorter wp-list-table-mobile-labels">
|
||||
<thead>
|
||||
<tr>
|
||||
<th><?php esc_html_e('No.', 'wp-optimize'); ?></th>
|
||||
<th class="column-primary"><?php esc_html_e('Table', 'wp-optimize'); ?></th>
|
||||
<th><?php esc_html_e('Records', 'wp-optimize'); ?></th>
|
||||
<th><?php esc_html_e('Data Size', 'wp-optimize'); ?></th>
|
||||
<th><?php esc_html_e('Index Size', 'wp-optimize'); ?></th>
|
||||
<th><?php esc_html_e('Type', 'wp-optimize'); ?></th>
|
||||
<th><?php esc_html_e('Overhead', 'wp-optimize'); ?></th>
|
||||
<th><?php esc_html_e('Actions', 'wp-optimize'); ?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<?php
|
||||
if ($load_data) {
|
||||
WP_Optimize()->include_template('database/tables-body.php', false, array('optimize_db' => $optimize_db));
|
||||
} else {
|
||||
?>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td class="loading" align="center" colspan="6"><img class="wpo-ajax-template-loader" width="16" height="16" src="<?php echo esc_url(admin_url('images/spinner-2x.gif')); ?>"> <?php esc_html_e('Loading tables list...', 'wp-optimize'); ?></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
|
||||
<div id="wpoptimize_table_list_tables_not_found"><?php esc_html_e('Tables not found.', 'wp-optimize'); ?></div>
|
||||
|
||||
<?php
|
||||
|
||||
WP_Optimize()->include_template('database/tables-list-after.php', false, array('optimize_db' => $optimize_db, 'load_data' => $load_data));
|
||||
Reference in New Issue
Block a user