| @@ -1,17 +1,16 @@ | ||
| 1 | -<?php if (!defined('WPO_VERSION')) die('No direct access allowed'); ?> | |
| 1 | +<?php if (!defined('ABSPATH')) die('No direct access allowed'); ?> | |
| 2 | 2 | |
| 3 | 3 | <h3><?php esc_html_e('Scheduled clean-up settings', 'wp-optimize'); ?></h3> |
| 4 | - | |
| 5 | 4 | <p> |
| 6 | - <a href="<?php echo esc_url(WP_Optimize()->premium_version_link); ?>" target="_blank"><?php esc_html_e('Take control of clean-ups: Upgrade to Premium for a more powerful and flexible scheduler', 'wp-optimize'); ?></a> | |
| 5 | + <a href="<?php echo esc_url($settings_cleanup_data['data']['premium_version_link']); ?>&utm_content=take-control-of-cleanups" target="_blank"><?php esc_html_e('Take control of clean-ups: Upgrade to Premium for a more powerful and flexible scheduler', 'wp-optimize'); ?></a> | |
| 7 | 6 | </p> |
| 8 | 7 | |
| 9 | -<div class="wpo-fieldgroup"> | |
| 8 | +<div class="wpo-fieldgroup wpo-fieldgroup--auto-cleanup"> | |
| 10 | 9 | |
| 11 | 10 | <p> |
| 12 | 11 | |
| 13 | - <input name="enable-schedule" id="enable-schedule" type="checkbox" value ="true" <?php checked($options->get_option('schedule'), 'true'); ?>> | |
| 12 | + <input name="enable-schedule" id="enable-schedule" type="checkbox" value="true" <?php checked($settings_cleanup_data['data']['enable_schedule'], 'true'); ?>> | |
| 14 | 13 | <label for="enable-schedule"><?php esc_html_e('Enable scheduled clean-up and optimization', 'wp-optimize'); ?></label> |
| 15 | 14 | |
| 16 | 15 | </p> |
| 17 | 16 | |
| @@ -19,29 +18,18 @@ | ||
| 19 | 18 | |
| 20 | 19 | <p> |
| 21 | 20 | |
| 22 | 21 | <?php esc_html_e('Select schedule type (default is Weekly)', 'wp-optimize'); ?><br> |
| 23 | - <select id="schedule_type" name="schedule_type"> | |
| 22 | + <select id="schedule_type" name="schedule_type" class="wpo-select2"> | |
| 24 | 23 | |
| 25 | 24 | <?php |
| 26 | - $schedule_options = array( | |
| 27 | - 'wpo_daily' => __('Daily', 'wp-optimize'), | |
| 28 | - 'wpo_weekly' => __('Weekly', 'wp-optimize'), | |
| 29 | - 'wpo_fortnightly' => __('Fortnightly', 'wp-optimize'), | |
| 30 | - 'wpo_monthly' => __('Monthly (approx. - every 30 days)', 'wp-optimize'), | |
| 31 | - ); | |
| 32 | 25 | |
| 33 | - $schedule_type_saved_id = $options->get_option('schedule-type', 'wpo_weekly'); | |
| 26 | + foreach ($settings_cleanup_data['data']['schedule_options'] as $option) { | |
| 27 | + ?> | |
| 28 | + <option value="<?php echo esc_attr($option['id']); ?>" <?php selected($option['selected']); ?>><?php echo esc_html($option['label']); ?></option> | |
| 29 | + <?php | |
| 30 | + } | |
| 34 | 31 | |
| 35 | - // Backwards compatibility: | |
| 36 | - if ('wpo_otherweekly' == $schedule_type_saved_id) $schedule_type_saved_id = 'wpo_fortnightly'; | |
| 37 | - | |
| 38 | - foreach ($schedule_options as $opt_id => $opt_description) { | |
| 39 | - ?> | |
| 40 | - <option value="<?php echo esc_attr($opt_id); ?>" <?php if ($opt_id == $schedule_type_saved_id) echo 'selected="selected"'; ?>><?php echo esc_html($opt_description); ?></option> | |
| 41 | - <?php | |
| 42 | - } | |
| 43 | - | |
| 44 | 32 | ?> |
| 45 | 33 | |
| 46 | 34 | </select> |
| 47 | 35 | |
| @@ -47,26 +35,22 @@ | ||
| 47 | 35 | |
| 48 | 36 | </p> |
| 49 | 37 | |
| 50 | 38 | <?php |
| 51 | - $wpo_auto_options = $options->get_option('auto'); | |
| 52 | 39 | |
| 53 | - $optimizations = $optimizer->sort_optimizations($optimizer->get_optimizations()); | |
| 40 | + foreach ($settings_cleanup_data['data']['optimizations'] as $optimization) { | |
| 54 | 41 | |
| 55 | - foreach ($optimizations as $id => $optimization) { | |
| 56 | - if (empty($optimization->available_for_auto)) continue; | |
| 42 | + $auto_id = $optimization['id']; | |
| 57 | 43 | |
| 58 | - $auto_id = $optimization->get_auto_id(); | |
| 44 | + $auto_dom_id = $optimization['dom_id']; | |
| 59 | 45 | |
| 60 | - $auto_dom_id = 'wp-optimize-auto-'.$auto_id; | |
| 61 | - | |
| 62 | - $setting_activated = (empty($wpo_auto_options[$auto_id]) || 'false' == $wpo_auto_options[$auto_id]) ? false : true; | |
| 63 | - ?> | |
| 46 | + $setting_activated = $optimization['activated']; | |
| 47 | + ?> | |
| 64 | 48 | <p> |
| 65 | - <input name="wp-optimize-auto[<?php echo esc_attr($auto_id); ?>]" id="<?php echo esc_attr($auto_dom_id); ?>" type="checkbox" value="true" <?php if ($setting_activated) echo 'checked="checked"'; ?>> <label for="<?php echo esc_attr($auto_dom_id); ?>"><?php echo esc_html($optimization->get_auto_option_description()); ?></label> | |
| 49 | + <input name="wp-optimize-auto[<?php echo esc_attr($auto_id); ?>]" id="<?php echo esc_attr($auto_dom_id); ?>" type="checkbox" value="true" <?php checked($setting_activated); ?>> <label for="<?php echo esc_attr($auto_dom_id); ?>"><?php echo esc_html($optimization['label']); ?></label> | |
| 66 | 50 | </p> |
| 67 | - <?php | |
| 68 | - } | |
| 51 | + <?php | |
| 52 | + } | |
| 69 | 53 | ?> |
| 70 | 54 | |
| 71 | 55 | <!-- disabled email notification |
| 72 | 56 | <p> |