get_option('auto-innodb'), 'true'); ?>>
wp_optimize_url('https://getwpo.com/faqs/', __('Warning: you should read the FAQ about the risks of this operation first.', 'wp-optimize')); ?>
get_scheduled_optimizations();
if (!empty($auto_options)) {
?>
$event) {
$div_schedule_fields_opened = false;
wpo_display_event_summary($index, $event);
printf('
', 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_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_schedule_fields_opened = false;
}
wpo_display_status($value, $index);
break;
}
}
if ($div_schedule_fields_opened) {
echo '
';
$div_schedule_fields_opened = false;
}
wpo_display_actions($index);
echo '
';
}
?>
'."\n", esc_attr($index));
if (isset($event['optimization']) && is_array($event['optimization'])) wpo_display_optimization_list($event['optimization']);
if (isset($event['schedule_type'])) {
?>
%s', sprintf(esc_html__('Date: %s', 'wp-optimize'), esc_html($event['date'])));
}
if (isset($event['time'])) {
printf('%s ', sprintf(esc_html__('Time: %s', 'wp-optimize'), esc_html($event['time'])));
}
if (isset($event['week'])) {
printf('%s ', sprintf(esc_html__('Week: %s', 'wp-optimize'), esc_html($event['week'])));
}
if (isset($event['day'])) {
$week_days = WP_Optimize_Premium::get_week_days();
printf('%s ', sprintf(esc_html__('Day: %s', 'wp-optimize'), esc_html($week_days[$event['day']])));
}
if (isset($event['day_number'])) {
printf('%s ', sprintf(esc_html__('Date: %s', 'wp-optimize'), esc_html($event['day_number'])));
}
?>
', esc_attr($count));
foreach ($auto_optimizations as $id => $details) {
$selected = in_array($id, $optimizations) ? 'selected="selected"' : '';
$html .= sprintf('%3$s ', esc_attr($id), $selected, esc_html($details['optimization']));
}
$html .= '';
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('', esc_attr($count));
foreach ($schedule_types as $key => $value) {
$html .= sprintf('%3$s ', esc_attr($key), selected($schedule_type, $key, false), esc_html($value));
}
$html .= ' ';
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('%s', esc_html__('Date:', 'wp-optimize'));
$html .= sprintf(' ', esc_attr($count), esc_attr($date), esc_attr($today));
$html .= ' ';
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('%s', esc_html__('Time:', 'wp-optimize'));
$html .= sprintf(' ', esc_attr($count), esc_attr($time));
$html .= ' ';
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('', esc_attr($count));
foreach ($weeks as $key => $value) {
$html .= sprintf('%3$s ', esc_attr($key), selected($week, $key, false), esc_html($value));
}
$html .= ' ';
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('', esc_attr($count));
foreach ($week_days as $key => $value) {
$html .= sprintf('%3$s ', esc_attr($key), selected($week_day, $key, false), esc_html($value));
}
$html .= ' ';
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('%s ', esc_html__('Day Number:', 'wp-optimize'));
$html .= sprintf('', esc_attr($count));
foreach ($days as $value) {
$html .= sprintf('%3$s ', esc_attr($value), selected($day, $value, false), esc_html($value));
}
$html .= ' ';
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 '';
printf(' %3$s ', esc_attr($count), checked($status, 1, false), esc_html__('Active', 'wp-optimize'));
echo '
';
}
/**
* 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('', $edit ? "wpo_event_edit" : "");
if (true === $edit) {
printf('%1$s ', esc_html__('Edit', 'wp-optimize'));
printf('%1s ', esc_html__('Delete', 'wp-optimize'), esc_attr($index));
} else {
printf('%1$s ', esc_html__('Cancel', 'wp-optimize'));
printf('%1$s ', esc_html__('Apply', 'wp-optimize'));
}
echo '
';
}
/**
* 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 .= '';
foreach ($optimizations as $optimization) {
$html .= sprintf(' %s ', esc_attr($optimization), esc_html($auto_optimizations[$optimization]['optimization']));
}
$html .= ' ';
echo $html;
}