updated plugin Companion Auto Update
version 3.8.5
This commit is contained in:
@ -1,185 +1,185 @@
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
// Get selected filter type
|
||||
|
||||
if( isset( $_GET['filter'] ) ) {
|
||||
|
||||
$filter = sanitize_key( $_GET['filter'] );
|
||||
|
||||
} else {
|
||||
|
||||
$filter = 'plugins';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Select correct database row
|
||||
|
||||
switch ( $filter ) {
|
||||
|
||||
case 'themes':
|
||||
|
||||
$db_table = 'notUpdateListTh';
|
||||
|
||||
$filter_name = __( 'Themes', 'companion-auto-update' );
|
||||
|
||||
$filterFunction = wp_get_themes();
|
||||
|
||||
break;
|
||||
|
||||
case 'plugins':
|
||||
|
||||
$db_table = 'notUpdateList';
|
||||
|
||||
$filter_name = __( 'Plugins', 'companion-auto-update' );
|
||||
|
||||
$filterFunction = get_plugins();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
$db_table = 'notUpdateList';
|
||||
|
||||
$filter_name = __( 'Plugins', 'companion-auto-update' );
|
||||
|
||||
$filterFunction = get_plugins();
|
||||
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<ul class="subsubsub">
|
||||
|
||||
<li><a <?php if( $filter == 'plugins' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'pluginlist&filter=plugins' ); ?>'><?php _e( 'Plugins', 'companion-auto-update' ); ?></a></li> |
|
||||
|
||||
<li><a <?php if( $filter == 'themes' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'pluginlist&filter=themes' ); ?>'><?php _e( 'Themes', 'companion-auto-update' ); ?></a></li>
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
<div style='clear: both;'></div>
|
||||
|
||||
|
||||
|
||||
<?php if( $filter == 'themes' ) { ?>
|
||||
|
||||
<div id="message" class="cau">
|
||||
|
||||
We've had to (temporarily) disable the theme filter because it was causing issues on some installations. We'll try to get it working again in a future update.
|
||||
|
||||
</div>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
<p><?php echo sprintf( esc_html__( 'Prevent certain %s from updating automatically. %s that you select here will be skipped by Companion Auto Update and will require manual updating.', 'companion-auto-update' ), strtolower( $filter_name ), $filter_name ); ?></p>
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
global $wpdb;
|
||||
|
||||
$table_name = $wpdb->prefix."auto_updates";
|
||||
|
||||
|
||||
|
||||
// Save list
|
||||
|
||||
if( isset( $_POST['submit'] ) ) {
|
||||
|
||||
|
||||
|
||||
check_admin_referer( 'cau_save_pluginlist' );
|
||||
|
||||
|
||||
|
||||
$noUpdateList = '';
|
||||
|
||||
$i = 0;
|
||||
|
||||
$noUpdateCount = 0;
|
||||
|
||||
|
||||
|
||||
if( isset( $_POST['post'] ) ) {
|
||||
|
||||
$noUpdateCount = count( $_POST['post'] );
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if( $noUpdateCount > 0 ) {
|
||||
|
||||
foreach ( $_POST['post'] as $key ) {
|
||||
|
||||
$noUpdateList .= sanitize_text_field( $key );
|
||||
|
||||
$i++;
|
||||
|
||||
if( $i != $noUpdateCount ) $noUpdateList .= ', ';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = '%s' WHERE name = '%s'", $noUpdateList, $db_table ) );
|
||||
|
||||
echo '<div id="message" class="updated"><p><b>'.__( 'Succes', 'companion-auto-update' ).' –</b> '.sprintf( esc_html__( '%1$s %2$s have been added to the no-update-list', 'companion-auto-update' ), $noUpdateCount, strtolower( $filter_name ) ).'.</p></div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Reset list
|
||||
|
||||
if( isset( $_POST['reset'] ) ) {
|
||||
|
||||
|
||||
|
||||
check_admin_referer( 'cau_save_pluginlist' );
|
||||
|
||||
|
||||
|
||||
$wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = '%s' WHERE name = %s", "", $db_table ) );
|
||||
|
||||
echo '<div id="message" class="updated"><p><b>'.__( 'Succes', 'companion-auto-update' ).' –</b> '.sprintf( esc_html__( 'The no-update-list has been reset, all %s will be auto-updated from now on', 'companion-auto-update' ), strtolower( $filter_name ) ).'.</p></div>';
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
<form method="POST">
|
||||
|
||||
|
||||
|
||||
<div class='pluginListButtons'>
|
||||
|
||||
<?php submit_button(); ?>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Get selected filter type
|
||||
|
||||
|
||||
if( isset( $_GET['filter'] ) ) {
|
||||
|
||||
|
||||
$filter = sanitize_key( $_GET['filter'] );
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
|
||||
$filter = 'plugins';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Select correct database row
|
||||
|
||||
|
||||
switch ( $filter ) {
|
||||
|
||||
|
||||
case 'themes':
|
||||
|
||||
|
||||
$db_table = 'notUpdateListTh';
|
||||
|
||||
|
||||
$filter_name = __( 'Themes', 'companion-auto-update' );
|
||||
|
||||
|
||||
$filterFunction = wp_get_themes();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
case 'plugins':
|
||||
|
||||
|
||||
$db_table = 'notUpdateList';
|
||||
|
||||
|
||||
$filter_name = __( 'Plugins', 'companion-auto-update' );
|
||||
|
||||
|
||||
$filterFunction = get_plugins();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
|
||||
|
||||
$db_table = 'notUpdateList';
|
||||
|
||||
|
||||
$filter_name = __( 'Plugins', 'companion-auto-update' );
|
||||
|
||||
|
||||
$filterFunction = get_plugins();
|
||||
|
||||
|
||||
break;
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<ul class="subsubsub">
|
||||
|
||||
|
||||
<li><a <?php if( $filter == 'plugins' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'pluginlist&filter=plugins' ); ?>'><?php _e( 'Plugins', 'companion-auto-update' ); ?></a></li> |
|
||||
|
||||
|
||||
<li><a <?php if( $filter == 'themes' ) { echo "class='current'"; } ?> href='<?php echo cau_url( 'pluginlist&filter=themes' ); ?>'><?php _e( 'Themes', 'companion-auto-update' ); ?></a></li>
|
||||
|
||||
|
||||
</ul>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div style='clear: both;'></div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php if( $filter == 'themes' ) { ?>
|
||||
|
||||
|
||||
<div id="message" class="cau">
|
||||
|
||||
|
||||
We've had to (temporarily) disable the theme filter because it was causing issues on some installations. We'll try to get it working again in a future update.
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<p><?php echo sprintf( esc_html__( 'Prevent certain %s from updating automatically. %s that you select here will be skipped by Companion Auto Update and will require manual updating.', 'companion-auto-update' ), strtolower( $filter_name ), $filter_name ); ?></p>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
global $wpdb;
|
||||
|
||||
|
||||
$table_name = $wpdb->prefix."auto_updates";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// Save list
|
||||
|
||||
|
||||
if( isset( $_POST['submit'] ) ) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
check_admin_referer( 'cau_save_pluginlist' );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$noUpdateList = '';
|
||||
|
||||
|
||||
$i = 0;
|
||||
|
||||
|
||||
$noUpdateCount = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if( isset( $_POST['post'] ) ) {
|
||||
|
||||
|
||||
$noUpdateCount = count( $_POST['post'] );
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user