Skip to content
This repository has been archived by the owner on Oct 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #78 from kniebremser/patch-7
Browse files Browse the repository at this point in the history
editing settings.php
  • Loading branch information
ruhanirabin committed Nov 12, 2015
2 parents 017b580 + 1484c87 commit 1c036bb
Showing 1 changed file with 145 additions and 195 deletions.
340 changes: 145 additions & 195 deletions wp-optimize-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,124 +109,97 @@
}
} //endif isset


echo '<div id="message" class="updated fade">';
echo '<strong>'._e('Settings updated','wp-optimize').'</strong></div>';



}



?>
echo '<strong>'._e('Settings updated','wp-optimize').'</strong></div>';
} ?>

<div class="wpo_section wpo_group">
<form action="#" method="post" enctype="multipart/form-data" name="settings_form" id="settings_form">
<?php wp_nonce_field( 'wpo_settings' ); ?>
<form action="#" method="post" enctype="multipart/form-data" name="settings_form" id="settings_form">
<?php wp_nonce_field( 'wpo_settings' ); ?>

<div class="wpo_col wpo_span_1_of_3">
<div class="wpo_col wpo_span_1_of_3">
<div class="postbox">
<div class="inside">
<h3><?php _e('General Settings', 'wp-optimize'); ?></h3>
<p>
<input name="enable-retention" id="enable-retention" type="checkbox" value ="true" <?php echo get_option(OPTION_NAME_RETENTION_ENABLED) == 'true' ? 'checked="checked"':''; ?> />
<?php
echo '<label>';
printf(__('Keep last %s weeks data', 'wp-optimize'),
'<select id="retention-period" name="retention-period">
<option value="'.esc_attr( get_option(OPTION_NAME_RETENTION_PERIOD, '2') ).'">'.esc_html( get_option(OPTION_NAME_RETENTION_PERIOD,'2') ).'</option>
<option value="2">2</option>
<option value="4">4</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="10">10</option>
</select>'
<p>
<input name="enable-retention" id="enable-retention" type="checkbox" value ="true" <?php echo get_option(OPTION_NAME_RETENTION_ENABLED) == 'true' ? 'checked="checked"':''; ?> />
<?php
echo '<label>';
printf(__('Keep last %s weeks data', 'wp-optimize'),
'<select id="retention-period" name="retention-period">
<option value="'.esc_attr( get_option(OPTION_NAME_RETENTION_PERIOD, '2') ).'">'.esc_html( get_option(OPTION_NAME_RETENTION_PERIOD,'2') ).'</option>
<option value="2">2</option>
<option value="4">4</option>
<option value="6">6</option>
<option value="8">8</option>
<option value="10">10</option>
</select>'
);
echo '</label>';
?>
<br />
<small><?php
_e('This option will retain the last selected weeks data and remove any garbage data before that period. This will also affect Auto Clean-up process', 'wp-optimize');
?>
</small>
</p>

<p>
<label>
<input name="enable-admin-bar" id="enable-admin-bar" type="checkbox" value ="true" <?php echo get_option(OPTION_NAME_ENABLE_ADMIN_MENU, 'false') == 'true' ? 'checked="checked"':''; ?> />
<?php
_e('Enable admin bar link', 'wp-optimize');
echo ' ';
echo '<a href="?page=WP-Optimize&tab=wp_optimize_settings">';
_e('(Click here to refresh)', 'wp-optimize');
echo '</a>'
?>
</label>
<br />
<small><?php
_e('This option will put WP-Optimize link on the top admin bar (default is off). Requires page refresh.', 'wp-optimize');
?>
</small>
</p>
<h3><?php _e('Trackback/Comments Actions', 'wp-optimize'); ?></h3>
<p>
<?php _e('Disable/Enable Trackbacks', 'wp-optimize'); ?><br />
<select id="wp-optimize-disable-enable-trackbacks" name="wp-optimize-disable-enable-trackbacks">
<option value="-1"><?php _e('SELECT', 'wp-optimize'); ?></option>
<option value="0"><?php _e('Disable', 'wp-optimize'); ?></option>
<option value="1"><?php _e('Enable', 'wp-optimize'); ?></option>
</select>
<br /><br />
<small>
<?php
_e('This will disable/enable Trackbacks on all your current and previously published posts', 'wp-optimize');
?>
</small>
</p>

<p>
<?php _e('Disable/Enable Comments', 'wp-optimize'); ?><br />
<select id="wp-optimize-disable-enable-comments" name="wp-optimize-disable-enable-comments">
<option value="-1"><?php _e('SELECT', 'wp-optimize'); ?></option>
<option value="0"><?php _e('Disable', 'wp-optimize'); ?></option>
<option value="1"><?php _e('Enable', 'wp-optimize'); ?></option>
</select>
<br /><br />
<small>
<?php
_e('This will disable/enable Comments on all your current and previously published posts', 'wp-optimize');
?>
</small>
</p>

<p>
<a href="https://wordpress.org/plugins/youtube-embed-plus/" target="_blank">
<img src="<?php echo WPO_PLUGIN_URL ;?>embedplus.png" style="float: left;margin-right: 7px;"> <?php _e('Optimize YouTube embedding with this free plugin on WordPress.org', 'wp-optimize'); ?> &raquo;</a>
</p>

<p>
<input class="button-primary" type="submit" name="wp-optimize-settings1" value="<?php _e('SAVE SETTINGS', 'wp-optimize'); ?>" />
</p>
echo '</label>'; ?>
<br />
<small><?php_e('This option will retain the last selected weeks data and remove any garbage data before that period. This will also affect Auto Clean-up process', 'wp-optimize');?></small>
</p>
<p>
<label>
<input name="enable-admin-bar" id="enable-admin-bar" type="checkbox" value ="true" <?php echo get_option(OPTION_NAME_ENABLE_ADMIN_MENU, 'false') == 'true' ? 'checked="checked"':''; ?> />
<?php _e('Enable admin bar link', 'wp-optimize');
echo ' ';
echo '<a href="?page=WP-Optimize&tab=wp_optimize_settings">';
_e('(Click here to refresh)', 'wp-optimize');
echo '</a>' ?>
</label>
<br />
<small><?php _e('This option will put WP-Optimize link on the top admin bar (default is off). Requires page refresh.', 'wp-optimize');?></small>
</p>
<h3><?php _e('Trackback/Comments Actions', 'wp-optimize'); ?></h3>
<p>
<?php _e('Disable/Enable Trackbacks', 'wp-optimize'); ?>
<br />
<select id="wp-optimize-disable-enable-trackbacks" name="wp-optimize-disable-enable-trackbacks">
<option value="-1"><?php _e('SELECT', 'wp-optimize'); ?></option>
<option value="0"><?php _e('Disable', 'wp-optimize'); ?></option>
<option value="1"><?php _e('Enable', 'wp-optimize'); ?></option>
</select>
<br /><br />
<small><?php _e('This will disable/enable Trackbacks on all your current and previously published posts', 'wp-optimize');?></small>
</p>
<p>
<?php _e('Disable/Enable Comments', 'wp-optimize'); ?>
<br />
<select id="wp-optimize-disable-enable-comments" name="wp-optimize-disable-enable-comments">
<option value="-1"><?php _e('SELECT', 'wp-optimize'); ?></option>
<option value="0"><?php _e('Disable', 'wp-optimize'); ?></option>
<option value="1"><?php _e('Enable', 'wp-optimize'); ?></option>
</select>
<br /><br />
<small><?php _e('This will disable/enable Comments on all your current and previously published posts', 'wp-optimize');?></small>
</p>
<p>
<a href="https://wordpress.org/plugins/youtube-embed-plus/" target="_blank">
<img src="<?php echo WPO_PLUGIN_URL ;?>embedplus.png" style="float: left;margin-right: 7px;"> <?php _e('Optimize YouTube embedding with this free plugin on WordPress.org', 'wp-optimize'); ?> &raquo;</a>
</p>
<p>
<input class="button-primary" type="submit" name="wp-optimize-settings1" value="<?php _e('SAVE SETTINGS', 'wp-optimize'); ?>" />
</p>
</div>
</div>
</div>
</div>


<div class="wpo_col wpo_span_1_of_3">
<div class="postbox">
<div class="inside">
<h3><?php _e('Auto Clean-up Settings', 'wp-optimize'); $wpo_auto_options = get_option('wp-optimize-auto');?></h3>
<p>
<input name="enable-schedule" id="enable-schedule" type="checkbox" value ="true" <?php echo get_option(OPTION_NAME_SCHEDULE) == 'true' ? 'checked="checked"':''; ?> />
<?php _e('Enable scheduled clean-up and optimization (Beta feature!)', 'wp-optimize'); ?>
<br /><br />
<?php _e('Select schedule type (default is Weekly)', 'wp-optimize'); ?><br />
<select id="schedule_type" name="schedule_type">
<option value="<?php echo esc_attr( get_option(OPTION_NAME_SCHEDULE_TYPE, 'wpo_weekly') ); ?>">
<?php
$last_schedule = get_option(OPTION_NAME_SCHEDULE_TYPE,'wpo_weekly');
switch ($last_schedule) {
<div class="wpo_col wpo_span_1_of_3">
<div class="postbox">
<div class="inside">
<h3><?php _e('Auto Clean-up Settings', 'wp-optimize'); $wpo_auto_options = get_option('wp-optimize-auto');?></h3>
<p>
<input name="enable-schedule" id="enable-schedule" type="checkbox" value ="true" <?php echo get_option(OPTION_NAME_SCHEDULE) == 'true' ? 'checked="checked"':''; ?> />
<?php _e('Enable scheduled clean-up and optimization (Beta feature!)', 'wp-optimize'); ?>
<br /><br />
<?php _e('Select schedule type (default is Weekly)', 'wp-optimize'); ?><br />
<select id="schedule_type" name="schedule_type">
<option value="<?php echo esc_attr( get_option(OPTION_NAME_SCHEDULE_TYPE, 'wpo_weekly') ); ?>">
<?php
$last_schedule = get_option(OPTION_NAME_SCHEDULE_TYPE,'wpo_weekly');
switch ($last_schedule) {
case "wpo_daily":
_e('Every day', 'wp-optimize');
break;
Expand All @@ -246,96 +219,73 @@
default:
_e('Every week', 'wp-optimize');
break;
}
?>

</option>
<option value="wpo_daily"><?php _e('Every day', 'wp-optimize'); ?></option>
<option value="wpo_weekly"><?php _e('Every week', 'wp-optimize'); ?></option>
<option value="wpo_otherweekly"><?php _e('Every other week (every 14 days)', 'wp-optimize'); ?></option>
<option value="wpo_monthly"><?php _e('Every month (every 31 days)', 'wp-optimize'); ?></option>
</select>
<br /><br />
<small><?php
_e('Automatic cleanup will perform the following:', 'wp-optimize');
echo '<br/>';
_e('Remove revisions, auto drafts, posts/comments in trash, transient options. After that it will optimize the db.', 'wp-optimize');
?>
</small>
</p>

<p>
<?php
_e('These options will only work if the automatic clean-up schedule has been enabled','wp-optimize');
?>
</p>

<p>
<input name="wp-optimize-auto[revisions]" id="wp-optimize-auto[revisions]" type="checkbox" value="true" <?php echo $wpo_auto_options['revisions'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove auto revisions', 'wp-optimize'); ?>
</p>

<p>
<input name="wp-optimize-auto[drafts]" id="wp-optimize-auto[drafts]" type="checkbox" value="true" <?php echo $wpo_auto_options['drafts'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove auto drafts', 'wp-optimize'); ?>
</p>

<p>
<input name="wp-optimize-auto[spams]" id="wp-optimize-auto[spams]" type="checkbox" value="true" <?php echo $wpo_auto_options['spams'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove spam comments', 'wp-optimize'); ?>
</p>

<p>
<input name="wp-optimize-auto[unapproved]" id="wp-optimize-auto[unapproved]" type="checkbox" value="true" <?php echo $wpo_auto_options['unapproved'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove unapproved comments', 'wp-optimize'); ?>
</p>

<p>
<span style="color: red;">
<input name="wp-optimize-auto[transient]" id="wp-optimize-auto[transient]" type="checkbox" value="true" <?php echo $wpo_auto_options['transient'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove transient options', 'wp-optimize'); ?>
</span>
</p>

<!-- <input name="wp-optimize-auto[postmeta]" id="wp-optimize-auto[postmeta]" type="checkbox" value="true" <?php echo $wpo_auto_options['postmeta'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove orphaned post meta', 'wp-optimize'); ?>
<br /><br />-->

<!--
<input name="wp-optimize-auto[tags]" id="wp-optimize-auto[tags]" type="checkbox" value="true" <?php echo $wpo_auto_options['tags'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove unused tags', 'wp-optimize'); ?>
<br /><br />-->

<p>
<input name="wp-optimize-auto[optimize]" id="wp-optimize-auto[optimize]" type="checkbox" value="true" <?php echo $wpo_auto_options['optimize'] == 'true' ? 'checked="checked"':''; ?> /> <b><?php _e('Optimize database', 'wp-optimize'); ?></b>
</p>

<?php
// if (WPO_TABLE_TYPE == 'InnoDB'){
echo '<p>';
_e('InnoDB tables will not be optimized!', 'wp-optimize');
echo '</p>';
// }
?>

<p>
<label>
<input name="enable-email" id="enable-email" type="checkbox" value ="true" <?php echo get_option(OPTION_NAME_ENABLE_EMAIL, 'false') == 'true' ? 'checked="checked"':''; ?> />
<?php
_e('Enable email notification', 'wp-optimize');
?>
</label>
</p>
<p>
<label for="enable-email-address">
<?php
_e('Send email to', 'wp-optimize');
?>
<input name="enable-email-address" id="enable-email-address" type="text" value ="<?php echo esc_attr( get_option( OPTION_NAME_ENABLE_EMAIL_ADDRESS, get_bloginfo ( 'admin_email' ) ) ); ?>" />
</label>
</p>
<p>
<input class="button-primary" type="submit" name="wp-optimize-settings" value="<?php _e('SAVE AUTO CLEAN-UP SETTINGS', 'wp-optimize'); ?>" />
</p>

} ?>

<option value="wpo_daily"><?php _e('Every day', 'wp-optimize'); ?></option>
<option value="wpo_weekly"><?php _e('Every week', 'wp-optimize'); ?></option>
<option value="wpo_otherweekly"><?php _e('Every other week (every 14 days)', 'wp-optimize'); ?></option>
<option value="wpo_monthly"><?php _e('Every month (every 31 days)', 'wp-optimize'); ?></option>
</select>
<br /><br />
<small><?php _e('Automatic cleanup will perform the following:', 'wp-optimize');
echo '<br/>';
_e('Remove revisions, auto drafts, posts/comments in trash, transient options. After that it will optimize the db.', 'wp-optimize');?></small>
</p>
<p>
<?php _e('These options will only work if the automatic clean-up schedule has been enabled','wp-optimize');?>
</p>
<p>
<input name="wp-optimize-auto[revisions]" id="wp-optimize-auto[revisions]" type="checkbox" value="true" <?php echo $wpo_auto_options['revisions'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove auto revisions', 'wp-optimize'); ?>
</p>
<p>
<input name="wp-optimize-auto[drafts]" id="wp-optimize-auto[drafts]" type="checkbox" value="true" <?php echo $wpo_auto_options['drafts'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove auto drafts', 'wp-optimize'); ?>
</p>
<p>
<input name="wp-optimize-auto[spams]" id="wp-optimize-auto[spams]" type="checkbox" value="true" <?php echo $wpo_auto_options['spams'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove spam comments', 'wp-optimize'); ?>
</p>
<p>
<input name="wp-optimize-auto[unapproved]" id="wp-optimize-auto[unapproved]" type="checkbox" value="true" <?php echo $wpo_auto_options['unapproved'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove unapproved comments', 'wp-optimize'); ?>
</p>
<p>
<span style="color: red;">
<input name="wp-optimize-auto[transient]" id="wp-optimize-auto[transient]" type="checkbox" value="true" <?php echo $wpo_auto_options['transient'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove transient options', 'wp-optimize'); ?>
</span>
</p>
<!-- <input name="wp-optimize-auto[postmeta]" id="wp-optimize-auto[postmeta]" type="checkbox" value="true" <?php echo $wpo_auto_options['postmeta'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove orphaned post meta', 'wp-optimize'); ?>
<br /><br />-->

<!-- <input name="wp-optimize-auto[tags]" id="wp-optimize-auto[tags]" type="checkbox" value="true" <?php echo $wpo_auto_options['tags'] == 'true' ? 'checked="checked"':''; ?> /> <?php _e('Remove unused tags', 'wp-optimize'); ?>
<br /><br />-->
<p>
<input name="wp-optimize-auto[optimize]" id="wp-optimize-auto[optimize]" type="checkbox" value="true" <?php echo $wpo_auto_options['optimize'] == 'true' ? 'checked="checked"':''; ?> /> <b><?php _e('Optimize database', 'wp-optimize'); ?></b>
</p>
<?php
// if (WPO_TABLE_TYPE == 'InnoDB'){
echo '<p>';
_e('InnoDB tables will not be optimized!', 'wp-optimize');
echo '</p>';
// }
?>
<p>
<label>
<input name="enable-email" id="enable-email" type="checkbox" value ="true" <?php echo get_option(OPTION_NAME_ENABLE_EMAIL, 'false') == 'true' ? 'checked="checked"':''; ?> />
<?php _e('Enable email notification', 'wp-optimize');?>
</label>
</p>
<p>
<label for="enable-email-address">
<?php _e('Send email to', 'wp-optimize');?>
<input name="enable-email-address" id="enable-email-address" type="text" value ="<?php echo esc_attr( get_option( OPTION_NAME_ENABLE_EMAIL_ADDRESS, get_bloginfo ( 'admin_email' ) ) ); ?>" />
</label>
</p>
<p>
<input class="button-primary" type="submit" name="wp-optimize-settings" value="<?php _e('SAVE AUTO CLEAN-UP SETTINGS', 'wp-optimize'); ?>" />
</p>
</div>
</div>
</div>

</div>

<input type="hidden" name="action" value="save_redirect" />
<input type="hidden" name="action" value="save_redirect" />

</form>
</form>
</div>

0 comments on commit 1c036bb

Please sign in to comment.