Easy Updates Manager - Version 6.0.0

Version Description

Released 2016-05-14

  • LOGS! A highly requested feature is now here. Please keep in mind we consider logs still in beta.
Download this release

Release Info

Developer ronalfy
Plugin Icon 128x128 Easy Updates Manager
Version 6.0.0
Comparing to
See all releases

Code changes from version 5.4.5 to 6.0.0

css/style.css CHANGED
@@ -270,6 +270,10 @@ input:checked ~ input,
270
  input:checked ~ input:active {
271
  background-position: 0 -24px;
272
  }
 
 
 
 
273
 
274
  @media only screen and (max-width:1200px) {
275
  #dashboard-main-outputs {
270
  input:checked ~ input:active {
271
  background-position: 0 -24px;
272
  }
273
+ .button.delete {
274
+ background-color: #e14d43;
275
+ color: #FFF;
276
+ }
277
 
278
  @media only screen and (max-width:1200px) {
279
  #dashboard-main-outputs {
includes/MPSUM_Admin.php CHANGED
@@ -127,9 +127,13 @@ class MPSUM_Admin {
127
  add_action( $prefix . 'plugin_action_links_' . MPSUM_Updates_Manager::get_plugin_basename(), array( $this, 'plugin_settings_link' ) );
128
 
129
  //todo - maybe load these conditionally based on $_REQUEST[ 'tab' ] param
 
130
  new MPSUM_Admin_Dashboard( self::get_slug() );
131
  new MPSUM_Admin_Plugins( self::get_slug() );
132
  new MPSUM_Admin_Themes( self::get_slug() );
 
 
 
133
  new MPSUM_Admin_Core( self::get_slug() );
134
  new MPSUM_Admin_Advanced( self::get_slug() );
135
 
@@ -159,19 +163,11 @@ class MPSUM_Admin {
159
  //Check to make sure we're on the mpsum admin page
160
  if ( $pagenow != 'mpsum-update-options' ) {
161
  return;
162
- } else {
163
- if ( count( $_GET ) == 1 && $_GET[ 'page' ] == 'mpsum-update-options' ) {
164
- $is_active_tab = 'dashboard';
165
- }
166
- }
167
- //Return of now active tabs
168
- if ( $is_active_tab == false || $is_active_tab != 'dashboard' ) {
169
- return;
170
  }
171
 
172
  wp_enqueue_script( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/js/admin.js' ), array( 'jquery' ), '20160429', true );
173
  wp_localize_script( 'mpsum_dashboard', 'mpsum', array( 'spinner' => MPSUM_Updates_Manager::get_plugin_url( '/images/spinner.gif' ) ) );
174
- wp_enqueue_style( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/css/style.css' ), array(), '20151125' );
175
  }
176
 
177
  /**
@@ -225,38 +221,45 @@ class MPSUM_Admin {
225
  <?php echo esc_html_e( 'Manage Updates', 'stops-core-theme-and-plugin-updates' ); ?>
226
  </h1>
227
  <?php
228
- $tabs =
229
- array(
230
- array(
231
- 'url' => add_query_arg( array( 'tab' => 'dashboard' ), self::get_url() ), /* URL to the tab */
232
- 'label' => esc_html__( 'Dashboard', 'stops-core-theme-and-plugin-updates' ),
233
- 'get' => 'dashboard' /*$_GET variable*/,
234
- 'action' => 'mpsum_admin_tab_dashboard' /* action variable in do_action */
235
- ),
236
- array(
237
- 'url' => add_query_arg( array( 'tab' => 'main' ), self::get_url() ), /* URL to the tab */
238
- 'label' => esc_html__( 'General', 'stops-core-theme-and-plugin-updates' ),
239
- 'get' => 'main' /*$_GET variable*/,
240
- 'action' => 'mpsum_admin_tab_main' /* action variable in do_action */
241
- ),
242
- array(
243
- 'url' => add_query_arg( array( 'tab' => 'plugins' ), self::get_url() ), /* URL to the tab */
244
- 'label' => esc_html__( 'Plugins', 'stops-core-theme-and-plugin-updates' ),
245
- 'get' => 'plugins' /*$_GET variable*/,
246
- 'action' => 'mpsum_admin_tab_plugins' /* action variable in do_action */
247
- ),
248
- array(
249
- 'url' => add_query_arg( array( 'tab' => 'themes' ), self::get_url() ), /* URL to the tab */
250
- 'label' => esc_html__( 'Themes', 'stops-core-theme-and-plugin-updates' ),
251
- 'get' => 'themes' /*$_GET variable*/,
252
- 'action' => 'mpsum_admin_tab_themes' /* action variable in do_action */
253
- ),
254
- array(
255
- 'url' => add_query_arg( array( 'tab' => 'advanced' ), self::get_url() ), /* URL to the tab */
256
- 'label' => esc_html__( 'Advanced', 'stops-core-theme-and-plugin-updates' ),
257
- 'get' => 'advanced' /*$_GET variable*/,
258
- 'action' => 'mpsum_admin_tab_advanced' /* action variable in do_action */
259
- )
 
 
 
 
 
 
 
260
  );
261
  $tabs_count = count( $tabs );
262
  if ( $tabs && !empty( $tabs ) ) {
127
  add_action( $prefix . 'plugin_action_links_' . MPSUM_Updates_Manager::get_plugin_basename(), array( $this, 'plugin_settings_link' ) );
128
 
129
  //todo - maybe load these conditionally based on $_REQUEST[ 'tab' ] param
130
+ $core_options = MPSUM_Updates_Manager::get_options( 'core' );
131
  new MPSUM_Admin_Dashboard( self::get_slug() );
132
  new MPSUM_Admin_Plugins( self::get_slug() );
133
  new MPSUM_Admin_Themes( self::get_slug() );
134
+ if ( isset( $core_options[ 'logs' ] ) && 'on' == $core_options[ 'logs' ] ) {
135
+ new MPSUM_Admin_Logs( self::get_slug() );
136
+ }
137
  new MPSUM_Admin_Core( self::get_slug() );
138
  new MPSUM_Admin_Advanced( self::get_slug() );
139
 
163
  //Check to make sure we're on the mpsum admin page
164
  if ( $pagenow != 'mpsum-update-options' ) {
165
  return;
 
 
 
 
 
 
 
 
166
  }
167
 
168
  wp_enqueue_script( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/js/admin.js' ), array( 'jquery' ), '20160429', true );
169
  wp_localize_script( 'mpsum_dashboard', 'mpsum', array( 'spinner' => MPSUM_Updates_Manager::get_plugin_url( '/images/spinner.gif' ) ) );
170
+ wp_enqueue_style( 'mpsum_dashboard', MPSUM_Updates_Manager::get_plugin_url( '/css/style.css' ), array(), '20160502' );
171
  }
172
 
173
  /**
221
  <?php echo esc_html_e( 'Manage Updates', 'stops-core-theme-and-plugin-updates' ); ?>
222
  </h1>
223
  <?php
224
+ $core_options = MPSUM_Updates_Manager::get_options( 'core' );
225
+ $tabs = array();
226
+ $tabs[] = array(
227
+ 'url' => add_query_arg( array( 'tab' => 'dashboard' ), self::get_url() ), /* URL to the tab */
228
+ 'label' => esc_html__( 'Dashboard', 'stops-core-theme-and-plugin-updates' ),
229
+ 'get' => 'dashboard' /*$_GET variable*/,
230
+ 'action' => 'mpsum_admin_tab_dashboard' /* action variable in do_action */
231
+ );
232
+ $tabs[] = array(
233
+ 'url' => add_query_arg( array( 'tab' => 'main' ), self::get_url() ), /* URL to the tab */
234
+ 'label' => esc_html__( 'General', 'stops-core-theme-and-plugin-updates' ),
235
+ 'get' => 'main' /*$_GET variable*/,
236
+ 'action' => 'mpsum_admin_tab_main' /* action variable in do_action */
237
+ );
238
+ $tabs[] = array(
239
+ 'url' => add_query_arg( array( 'tab' => 'plugins' ), self::get_url() ), /* URL to the tab */
240
+ 'label' => esc_html__( 'Plugins', 'stops-core-theme-and-plugin-updates' ),
241
+ 'get' => 'plugins' /*$_GET variable*/,
242
+ 'action' => 'mpsum_admin_tab_plugins' /* action variable in do_action */
243
+ );
244
+ $tabs[] = array(
245
+ 'url' => add_query_arg( array( 'tab' => 'themes' ), self::get_url() ), /* URL to the tab */
246
+ 'label' => esc_html__( 'Themes', 'stops-core-theme-and-plugin-updates' ),
247
+ 'get' => 'themes' /*$_GET variable*/,
248
+ 'action' => 'mpsum_admin_tab_themes' /* action variable in do_action */
249
+ );
250
+ if ( isset( $core_options[ 'logs' ] ) && 'on' == $core_options[ 'logs' ] ) {
251
+ $tabs[] = array(
252
+ 'url' => add_query_arg( array( 'tab' => 'logs' ), self::get_url() ), /* URL to the tab */
253
+ 'label' => esc_html__( 'Logs', 'stops-core-theme-and-plugin-updates' ),
254
+ 'get' => 'logs' /*$_GET variable*/,
255
+ 'action' => 'mpsum_admin_tab_logs' /* action variable in do_action */
256
+ );
257
+ }
258
+ $tabs[] = array(
259
+ 'url' => add_query_arg( array( 'tab' => 'advanced' ), self::get_url() ), /* URL to the tab */
260
+ 'label' => esc_html__( 'Advanced', 'stops-core-theme-and-plugin-updates' ),
261
+ 'get' => 'advanced' /*$_GET variable*/,
262
+ 'action' => 'mpsum_admin_tab_advanced' /* action variable in do_action */
263
  );
264
  $tabs_count = count( $tabs );
265
  if ( $tabs && !empty( $tabs ) ) {
includes/MPSUM_Admin_Advanced.php CHANGED
@@ -60,11 +60,9 @@ class MPSUM_Admin_Advanced {
60
  if ( !isset( $_GET[ 'page' ] ) || $_GET[ 'page' ] != $this->slug ) return;
61
  if ( !isset( $_POST[ 'action' ] ) ) return;
62
  if ( !isset( $_POST[ '_mpsum' ] ) ) return;
63
-
64
  //Get action
65
  $action = $_POST[ 'action' ];
66
  if ( empty( $action ) ) return;
67
-
68
  switch( $action ) {
69
  case 'mpsum_save_excluded_users':
70
  check_admin_referer( 'mpsum_exclude_users', '_mpsum' );
@@ -80,13 +78,39 @@ class MPSUM_Admin_Advanced {
80
  break;
81
  case 'mpsum_reset_options':
82
  check_admin_referer( 'mpsum_reset_options', '_mpsum' );
 
 
83
  MPSUM_Updates_Manager::update_options( array() );
 
 
 
 
 
 
 
84
  break;
85
  case 'mpsum_force_updates':
86
  wp_schedule_single_event( time() + 10, 'wp_update_plugins' );
87
  wp_schedule_single_event( time() + 10, 'wp_version_check' );
88
  wp_schedule_single_event( time() + 10, 'wp_update_themes' );
89
  wp_schedule_single_event( time() + 45, 'wp_maybe_auto_update' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  break;
91
  default:
92
  return;
@@ -128,9 +152,18 @@ class MPSUM_Admin_Advanced {
128
  case 'mpsum_force_updates':
129
  $message = __( 'Force update checks have been initialized. Please check your site in 90 seconds, and refresh to test automatic updates.', 'stops-core-theme-and-plugin-updates' );
130
  break;
 
 
 
 
 
 
 
 
 
131
  default:
132
  $message = __( 'Options saved.', 'stops-core-theme-and-plugin-updates' );
133
- return;
134
  }
135
 
136
  ?>
@@ -189,9 +222,9 @@ class MPSUM_Admin_Advanced {
189
  echo '</p>';
190
  ?>
191
  </form>
192
- <form action="<?php echo esc_url( add_query_arg( array() ) ); ?>" method="post">
193
  <h3><?php esc_html_e( 'Reset Options', 'stops-core-theme-and-plugin-updates' ); ?></h3>
194
- <p><?php esc_html_e( 'This will reset all options to as if you have just installed the plugin.', 'stops-core-theme-and-plugin-updates' ); ?></p>
195
  <input type="hidden" name="action" value='mpsum_reset_options' />
196
  <?php
197
  wp_nonce_field( 'mpsum_reset_options', '_mpsum' );
@@ -211,6 +244,45 @@ class MPSUM_Admin_Advanced {
211
  echo '</p>';
212
  ?>
213
  </form>
214
- <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
215
  } //end tab_output
216
- }
60
  if ( !isset( $_GET[ 'page' ] ) || $_GET[ 'page' ] != $this->slug ) return;
61
  if ( !isset( $_POST[ 'action' ] ) ) return;
62
  if ( !isset( $_POST[ '_mpsum' ] ) ) return;
 
63
  //Get action
64
  $action = $_POST[ 'action' ];
65
  if ( empty( $action ) ) return;
 
66
  switch( $action ) {
67
  case 'mpsum_save_excluded_users':
68
  check_admin_referer( 'mpsum_exclude_users', '_mpsum' );
78
  break;
79
  case 'mpsum_reset_options':
80
  check_admin_referer( 'mpsum_reset_options', '_mpsum' );
81
+
82
+ // Reset options
83
  MPSUM_Updates_Manager::update_options( array() );
84
+
85
+ // Remove logs table
86
+ global $wpdb;
87
+ $tablename = $wpdb->base_prefix . 'eum_logs';
88
+ $sql = "drop table if exists $tablename";
89
+ $wpdb->query( $sql );
90
+
91
  break;
92
  case 'mpsum_force_updates':
93
  wp_schedule_single_event( time() + 10, 'wp_update_plugins' );
94
  wp_schedule_single_event( time() + 10, 'wp_version_check' );
95
  wp_schedule_single_event( time() + 10, 'wp_update_themes' );
96
  wp_schedule_single_event( time() + 45, 'wp_maybe_auto_update' );
97
+ break;
98
+ case 'mpsum_enable_logs':
99
+ check_admin_referer( 'mpsum_logs', '_mpsum' );
100
+ $options = MPSUM_Updates_Manager::get_options( 'core' );
101
+ $options[ 'logs' ] = 'on';
102
+ MPSUM_Updates_Manager::update_options( $options, 'core' );
103
+ break;
104
+ case 'mpsum_delete_logs':
105
+ check_admin_referer( 'mpsum_logs', '_mpsum' );
106
+ $options = MPSUM_Updates_Manager::get_options( 'core' );
107
+ $options[ 'logs' ] = 'off';
108
+ MPSUM_Updates_Manager::update_options( $options, 'core' );
109
+ update_site_option( 'mpsum_log_table_version', '0' );
110
+ MPSUM_Logs::drop();
111
+ break;
112
+ case 'mpsum_clear_logs':
113
+ MPSUM_Logs::clear();
114
  break;
115
  default:
116
  return;
152
  case 'mpsum_force_updates':
153
  $message = __( 'Force update checks have been initialized. Please check your site in 90 seconds, and refresh to test automatic updates.', 'stops-core-theme-and-plugin-updates' );
154
  break;
155
+ case 'mpsum_enable_logs':
156
+ $message = __( 'Logs are now enabled', 'stops-core-theme-and-plugin-updates' );
157
+ break;
158
+ case 'mpsum_delete_logs':
159
+ $message = __( 'Logs have been disabled', 'stops-core-theme-and-plugin-updates' );
160
+ break;
161
+ case 'mpsum_clear_logs':
162
+ $message = __( 'Logs have been emptied', 'stops-core-theme-and-plugin-updates' );
163
+ break;
164
  default:
165
  $message = __( 'Options saved.', 'stops-core-theme-and-plugin-updates' );
166
+ break;
167
  }
168
 
169
  ?>
222
  echo '</p>';
223
  ?>
224
  </form>
225
+ <form action="<?php echo esc_url( add_query_arg( array() ) ); ?>" method="post">
226
  <h3><?php esc_html_e( 'Reset Options', 'stops-core-theme-and-plugin-updates' ); ?></h3>
227
+ <p><?php esc_html_e( 'This will reset all options to as if you have just installed the plugin. WARNING!: This also disables and clears the logs.', 'stops-core-theme-and-plugin-updates' ); ?></p>
228
  <input type="hidden" name="action" value='mpsum_reset_options' />
229
  <?php
230
  wp_nonce_field( 'mpsum_reset_options', '_mpsum' );
244
  echo '</p>';
245
  ?>
246
  </form>
247
+ <?php
248
+ $options = MPSUM_Updates_Manager::get_options( 'core' );
249
+ if ( !isset( $options[ 'logs' ] ) || 'off' == $options[ 'logs' ] ):
250
+ ?>
251
+ <form action="<?php echo esc_url( add_query_arg( array() ) ); ?>" method="post">
252
+ <?php wp_nonce_field( 'mpsum_logs', '_mpsum' ); ?>
253
+ <h3><?php echo esc_html( _x( 'Logs', 'Advanced title heading', 'stops-core-theme-and-plugin-updates' ) ); ?></h3>
254
+ <p><?php printf( __( 'This feature is currently in beta. Use at your own risk. Do not post support requests on WordPress.org. <a href="%s">File a GitHub issue instead</a>.', 'stops-core-theme-and-plugin-updates', 'stops-core-theme-and-plugin-updates' ), 'https://github.com/easy-updates-manager/easy-updates-manager/issues' );?></p>
255
+ <input type="hidden" name="action" value='mpsum_enable_logs' />
256
+ <p class="submit">
257
+ <?php submit_button( __( 'Enable Logs', 'stops-core-theme-and-plugin-updates' ), 'primary', 'enable-log', false ); ?>
258
+ </p>
259
+ </form>
260
+ <?php
261
+ else:
262
+ ?>
263
+ <h3><?php echo esc_html( _x( 'Logs', 'Advanced title heading', 'stops-core-theme-and-plugin-updates' ) ); ?></h3>
264
+ <p><?php printf( __( 'This feature is currently in beta. Use at your own risk. Do not post support requests on WordPress.org. <a href="%s">File a GitHub issue instead</a>.', 'stops-core-theme-and-plugin-updates', 'stops-core-theme-and-plugin-updates' ), 'https://github.com/easy-updates-manager/easy-updates-manager/issues' );?></p>
265
+ <form action="<?php echo esc_url( add_query_arg( array() ) ); ?>" method="post">
266
+ <?php wp_nonce_field( 'mpsum_logs', '_mpsum' ); ?>
267
+ <input type="hidden" name="action" value='mpsum_clear_logs' />
268
+ <?php
269
+ echo '<p><em>' . __( 'This will clear the log table.', 'stops-core-theme-and-plugin-updates' ) . '</em></p>';
270
+ echo '<p class="submit">';
271
+ submit_button( __( 'Clear Logs', 'stops-core-theme-and-plugin-updates' ) , 'primary', 'clear-log', false );
272
+ echo '</p>';
273
+ ?>
274
+ </form>
275
+ <form action="<?php echo esc_url( add_query_arg( array() ) ); ?>" method="post">
276
+ <?php wp_nonce_field( 'mpsum_logs', '_mpsum' ); ?>
277
+ <input type="hidden" name="action" value='mpsum_delete_logs' />
278
+ <?php
279
+ echo '<p><em>' . __( 'This will remove the log table and disable logging.', 'stops-core-theme-and-plugin-updates' ) . '</em></p>';
280
+ echo '<p class="submit">';
281
+ submit_button( __( 'Disable Logging', 'stops-core-theme-and-plugin-updates' ) , 'delete', 'delete-log', false );
282
+ echo '</p>';
283
+ ?>
284
+ </form>
285
+ <?php
286
+ endif;
287
  } //end tab_output
288
+ }
includes/MPSUM_Admin_Core.php CHANGED
@@ -56,23 +56,24 @@ class MPSUM_Admin_Core {
56
  */
57
  public static function get_defaults() {
58
  return array(
59
- 'all_updates' => 'on',
60
- 'core_updates' => 'on',
61
- 'plugin_updates' => 'on',
62
- 'theme_updates' => 'on',
63
- 'translation_updates' => 'on',
64
- 'automatic_development_updates' => 'off',
65
- 'automatic_major_updates' => 'off',
66
- 'automatic_minor_updates' => 'on',
67
- 'automatic_plugin_updates' => 'default',
68
- 'automatic_theme_updates' => 'default',
69
- 'automatic_translation_updates' => 'on',
70
- 'notification_core_update_emails' => 'on',
71
- 'misc_browser_nag' => 'on',
72
- 'misc_wp_footer' => 'on',
73
- 'notification_core_update_emails_plugins' => 'on',
74
- 'notification_core_update_emails_themes' => 'on',
75
- 'notification_core_update_emails_translations' => 'on'
 
76
  );
77
  }
78
 
56
  */
57
  public static function get_defaults() {
58
  return array(
59
+ 'all_updates' => 'on',
60
+ 'core_updates' => 'on',
61
+ 'plugin_updates' => 'on',
62
+ 'theme_updates' => 'on',
63
+ 'translation_updates' => 'on',
64
+ 'automatic_development_updates' => 'off',
65
+ 'automatic_major_updates' => 'off',
66
+ 'automatic_minor_updates' => 'on',
67
+ 'automatic_plugin_updates' => 'default',
68
+ 'automatic_theme_updates' => 'default',
69
+ 'automatic_translation_updates' => 'on',
70
+ 'notification_core_update_emails' => 'on',
71
+ 'misc_browser_nag' => 'on',
72
+ 'misc_wp_footer' => 'on',
73
+ 'notification_core_update_emails_plugins' => 'on',
74
+ 'notification_core_update_emails_themes' => 'on',
75
+ 'notification_core_update_emails_translations' => 'on',
76
+ 'logs' => 'off'
77
  );
78
  }
79
 
includes/MPSUM_Admin_Help.php CHANGED
@@ -24,34 +24,33 @@ class MPSUM_Admin_Help {
24
 
25
  $screen = get_current_screen();
26
  $content1 = '<p>';
27
- $content1 .= esc_html__( 'This is the Easy Updates Manager settings help tab. In here you will find helpful information on what Easy Updates Manager does and how to use it.', 'stops-core-theme-and-plugin-updates' );
28
- $content1 .= '</p>';
29
- $content1 .= sprintf( '<div><p><strong>%s - </strong>%s</p></div>', esc_html__( 'Please Note!', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'If either your WordPress core, theme, or plugins get too out of date, you may run into compatibility problems. Check the capability tab for more information.', 'stops-core-theme-and-plugin-updates' ) );
30
-
31
- $content2 = sprintf( '<div><p><a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki">%s</a></p></div>', esc_html__( 'Please see our Wiki for documentation and videos.', 'stops-core-theme-and-plugin-updates' ) );
32
-
33
- $content3_strings = array(
34
- 'website' => esc_html__( 'Our Website', 'stops-core-theme-and-plugin-updates' ),
35
  'support' => esc_html__( 'Support on WordPress', 'stops-core-theme-and-plugin-updates' ),
36
  'github' => esc_html__( 'GitHub Repository', 'stops-core-theme-and-plugin-updates' ),
37
  'official' => esc_html__( 'Official Documentation', 'stops-core-theme-and-plugin-updates' ),
38
  );
39
- $content3 = <<<CONTENT3
40
  <p>
41
- <a href="http://mpswp.wordpress.com" class="button">{$content3_strings['website']}</a>
42
- <a href="http://wordpress.org/support/plugin/stops-core-theme-and-plugin-updates" class="button">{$content3_strings['support']}</a>
43
- <a href="https://github.com/easy-updates-manager/easy-updates-manager" class="button">{$content3_strings['github']}</a>
44
- <a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki" class="button">{$content3_strings['official']}</a>
45
  </p>
 
 
 
 
46
 
47
- CONTENT3;
48
 
49
  $content4_strings = array(
50
- 'intro' => esc_html__( 'You will see four tabs where you can configure the update options.', 'stops-core-theme-and-plugin-updates' ),
51
  'dashboard' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'Dashboard', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'Use this screen for an at-a-glance view of your settings.', 'stops-core-theme-and-plugin-updates' ) ),
52
  'general' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'General', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'Use this screen to finely tune which updates and automatic updates you would like to see.', 'stops-core-theme-and-plugin-updates' ) ),
53
  'plugins' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'Plugins', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'If plugin updates are enabled and/or automatic updates for plugins are enabled, you can configure which plugins will receive updates and/or automatic updates.', 'stops-core-theme-and-plugin-updates' ) ),
54
  'themes' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'Themes', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'If theme updates are enabled and/or automatic updates for themes are enabled, you can configure which themes will receive updates and/or automatic updates.', 'stops-core-theme-and-plugin-updates' ) ),
 
55
  'advanced' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'Advanced', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'Reset all options or allow certain users to see all updates regardless of what settings you have set.', 'stops-core-theme-and-plugin-updates' ) ),
56
 
57
  );
@@ -59,17 +58,16 @@ CONTENT3;
59
  <p>
60
  {$content4_strings['intro']}
61
  <br>
62
- {$content4_strings['dashboard']}
63
  <br>
 
64
  <br>
65
  {$content4_strings['general']}
66
  <br>
67
- <br>
68
  {$content4_strings['plugins']}
69
  <br>
70
- <br>
71
  {$content4_strings['themes']}
72
  <br>
 
73
  <br>
74
  {$content4_strings['advanced']}
75
  <br>
@@ -79,7 +77,7 @@ CONTENT3;
79
  CONTENT4;
80
 
81
  $content5_strings = array(
82
- 'contributors' => esc_html__( 'Contributors:', 'stops-core-theme-and-plugin-updates' )
83
  );
84
  $content5 = <<<CONTENT5
85
 
@@ -90,6 +88,7 @@ CONTENT4;
90
  <li><a href="http://profiles.wordpress.org/ronalfy/">Ronald Huereca (ronalfy)</a></li>
91
  <li><a href="http://profiles.wordpress.org/pixolin/">Bego Mario Garde (pixolin)</a></li>
92
  <li><a href="http://profiles.wordpress.org/roary86/">Roary Tubbs</a></li>
 
93
  </ul>
94
  </p>
95
 
@@ -123,13 +122,7 @@ CONTENT5;
123
  'title' => __( 'Capability', 'stops-core-theme-and-plugin-updates' ),
124
  'content' => $content6,
125
  ));
126
-
127
- $screen->add_help_tab(array(
128
- 'id' => 'help_tab_content_3',
129
- 'title' => __( 'Troubleshooting', 'stops-core-theme-and-plugin-updates' ),
130
- 'content' => $content3,
131
- ));
132
-
133
  $screen->set_help_sidebar($content5);
134
 
135
  } //end constructor
24
 
25
  $screen = get_current_screen();
26
  $content1 = '<p>';
27
+ $content1_strings = array(
28
+ 'website' => esc_html__( 'Donate', 'stops-core-theme-and-plugin-updates' ),
 
 
 
 
 
 
29
  'support' => esc_html__( 'Support on WordPress', 'stops-core-theme-and-plugin-updates' ),
30
  'github' => esc_html__( 'GitHub Repository', 'stops-core-theme-and-plugin-updates' ),
31
  'official' => esc_html__( 'Official Documentation', 'stops-core-theme-and-plugin-updates' ),
32
  );
33
+ $content1 = <<<CONTENT1
34
  <p>
35
+ <a href="http://mediaron.com/contribute" class="button">{$content1_strings['website']}</a>
36
+ <a href="http://wordpress.org/support/plugin/stops-core-theme-and-plugin-updates" class="button">{$content1_strings['support']}</a>
37
+ <a href="https://github.com/easy-updates-manager/easy-updates-manager" class="button">{$content1_strings['github']}</a>
38
+ <a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki" class="button">{$content1_strings['official']}</a>
39
  </p>
40
+ CONTENT1;
41
+ $content1 .= esc_html__( 'This is the Easy Updates Manager settings help tab. Here you will find helpful information on what Easy Updates Manager does and how to use it.', 'stops-core-theme-and-plugin-updates' );
42
+ $content1 .= '</p>';
43
+ $content1 .= sprintf( '<div><p><strong>%s - </strong>%s</p></div>', esc_html__( 'Please Note!', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'If either your WordPress core, theme, or plugins get too out of date, you may run into compatibility problems. Check the capability tab for more information.', 'stops-core-theme-and-plugin-updates' ) );
44
 
45
+ $content2 = sprintf( '<div><p><a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki">%s</a></p></div>', esc_html__( 'Check out our Wiki for updated documentation and videos.', 'stops-core-theme-and-plugin-updates' ) );
46
 
47
  $content4_strings = array(
48
+ 'intro' => esc_html__( 'You will see multiple tabs where you can configure the update options.', 'stops-core-theme-and-plugin-updates' ),
49
  'dashboard' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'Dashboard', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'Use this screen for an at-a-glance view of your settings.', 'stops-core-theme-and-plugin-updates' ) ),
50
  'general' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'General', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'Use this screen to finely tune which updates and automatic updates you would like to see.', 'stops-core-theme-and-plugin-updates' ) ),
51
  'plugins' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'Plugins', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'If plugin updates are enabled and/or automatic updates for plugins are enabled, you can configure which plugins will receive updates and/or automatic updates.', 'stops-core-theme-and-plugin-updates' ) ),
52
  'themes' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'Themes', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'If theme updates are enabled and/or automatic updates for themes are enabled, you can configure which themes will receive updates and/or automatic updates.', 'stops-core-theme-and-plugin-updates' ) ),
53
+ 'logs' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'Logs', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'Logs all plugin, theme, and core updates. This tab is only visible if enabled in the "Advanced" tab.', 'stops-core-theme-and-plugin-updates' ) ),
54
  'advanced' => sprintf( '<strong>%s</strong> - %s', esc_html__( 'Advanced', 'stops-core-theme-and-plugin-updates' ), esc_html__( 'Reset all options or allow certain users to see all updates regardless of what settings you have set.', 'stops-core-theme-and-plugin-updates' ) ),
55
 
56
  );
58
  <p>
59
  {$content4_strings['intro']}
60
  <br>
 
61
  <br>
62
+ {$content4_strings['dashboard']}
63
  <br>
64
  {$content4_strings['general']}
65
  <br>
 
66
  {$content4_strings['plugins']}
67
  <br>
 
68
  {$content4_strings['themes']}
69
  <br>
70
+ {$content4_strings['logs']}
71
  <br>
72
  {$content4_strings['advanced']}
73
  <br>
77
  CONTENT4;
78
 
79
  $content5_strings = array(
80
+ 'contributors' => esc_html__( 'Easy Updates Manager Team:', 'stops-core-theme-and-plugin-updates' )
81
  );
82
  $content5 = <<<CONTENT5
83
 
88
  <li><a href="http://profiles.wordpress.org/ronalfy/">Ronald Huereca (ronalfy)</a></li>
89
  <li><a href="http://profiles.wordpress.org/pixolin/">Bego Mario Garde (pixolin)</a></li>
90
  <li><a href="http://profiles.wordpress.org/roary86/">Roary Tubbs</a></li>
91
+ <li><a href="http://profiles.wordpress.org/bigwing">BigWing Interactive</a></li>
92
  </ul>
93
  </p>
94
 
122
  'title' => __( 'Capability', 'stops-core-theme-and-plugin-updates' ),
123
  'content' => $content6,
124
  ));
125
+
 
 
 
 
 
 
126
  $screen->set_help_sidebar($content5);
127
 
128
  } //end constructor
includes/MPSUM_Admin_Logs.php ADDED
@@ -0,0 +1,69 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Controls the logs tab
4
+ *
5
+ * Controls the logs tab.
6
+ *
7
+ * @since 6.0.0
8
+ *
9
+ * @package WordPress
10
+ */
11
+ class MPSUM_Admin_Logs {
12
+ /**
13
+ * Holds the slug to the admin panel page
14
+ *
15
+ * @since 5.0.0
16
+ * @access private
17
+ * @var string $slug
18
+ */
19
+ private $slug = '';
20
+
21
+ /**
22
+ * Holds the tab name
23
+ *
24
+ * @since 5.0.0
25
+ * @access static
26
+ * @var string $tab
27
+ */
28
+ private $tab = 'logs';
29
+
30
+ /**
31
+ * Class constructor.
32
+ *
33
+ * Initialize the class
34
+ *
35
+ * @since 6.0.0
36
+ * @access public
37
+ *
38
+ * @param string $slug Slug to the admin panel page
39
+ */
40
+ public function __construct( $slug = '' ) {
41
+ $this->slug = $slug;
42
+ //Admin Tab Actions
43
+ add_action( 'mpsum_admin_tab_logs', array( $this, 'tab_output_logs' ) );
44
+ }
45
+
46
+ /**
47
+ * Output the HTML interface for the logs tab.
48
+ *
49
+ * Output the HTML interface for the logs tab.
50
+ *
51
+ * @since 6.0.0
52
+ * @access public
53
+ * @see __construct
54
+ * @internal Uses the mpsum_admin_tab_logs action
55
+ */
56
+ public function tab_output_logs() {
57
+ ?>
58
+ <h3><?php esc_html_e( 'Update Logs', 'stops-core-theme-and-plugin-updates' ); ?></h3>
59
+ <p><?php esc_html_e( 'Please note that this feature does not necessarily work for premium themes and plugins.', 'stops-core-theme-and-plugin-updates' );?></p>
60
+ <?php
61
+ $core_options = MPSUM_Updates_Manager::get_options( 'core' );
62
+ $logs_table = new MPSUM_Logs_List_Table( $args = array( 'screen' => $this->slug, 'tab' => $this->tab ) );
63
+ $logs_table->prepare_items();
64
+ $logs_table->views();
65
+ $logs_table->display();
66
+ ?>
67
+ <?php
68
+ } //end tab_output_plugins
69
+ }
includes/MPSUM_List_Table.php CHANGED
@@ -891,7 +891,7 @@ class MPSUM_List_Table {
891
  // If the primary column doesn't exist fall back to the
892
  // first non-checkbox column.
893
  if ( ! isset( $columns[ $default ] ) ) {
894
- $default = WP_List_Table::get_default_primary_column_name();
895
  }
896
 
897
  /**
891
  // If the primary column doesn't exist fall back to the
892
  // first non-checkbox column.
893
  if ( ! isset( $columns[ $default ] ) ) {
894
+ $default = MPSUM_List_Table::get_default_primary_column_name();
895
  }
896
 
897
  /**
includes/MPSUM_Logs.php ADDED
@@ -0,0 +1,370 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Easy Updates Manager log controller
4
+ *
5
+ * Initializes the log table and sets up actions/events
6
+ *
7
+ * @since 6.0.0
8
+ *
9
+ * @package WordPress
10
+ */
11
+ class MPSUM_Logs {
12
+
13
+ /**
14
+ * Holds the class instance.
15
+ *
16
+ * @since 6.0.0
17
+ * @access static
18
+ * @var MPSUM_Log $instance
19
+ */
20
+ private static $instance = null;
21
+
22
+ /**
23
+ * Holds version number of the table
24
+ *
25
+ * @since 6.0.0
26
+ * @access static
27
+ * @var string $slug
28
+ */
29
+ private $version = '1.0.0';
30
+
31
+ /**
32
+ * Set a class instance.
33
+ *
34
+ * Set a class instance.
35
+ *
36
+ * @since 5.0.0
37
+ * @access static
38
+ *
39
+ */
40
+ public static function run() {
41
+ if ( null == self::$instance ) {
42
+ self::$instance = new self;
43
+ }
44
+ } //end get_instance
45
+
46
+ /**
47
+ * Class constructor.
48
+ *
49
+ * Initialize the class
50
+ *
51
+ * @since 6.0.0
52
+ * @access private
53
+ *
54
+ */
55
+ private function __construct() {
56
+ $table_version = get_site_option( 'mpsum_log_table_version', '0' );
57
+ if ( version_compare( $table_version, $this->version ) < 0 ) {
58
+ $this->build_table();
59
+ update_site_option( 'mpsum_log_table_version', $this->version );
60
+ }
61
+
62
+ add_action( 'automatic_updates_complete', array( $this, 'automatic_updates' ) );
63
+ add_action( 'upgrader_process_complete', array( $this, 'manual_updates' ), 10, 2 );
64
+
65
+ } //end constructor
66
+
67
+ /**
68
+ * automatic_updates
69
+ *
70
+ * Log automatic updates
71
+ *
72
+ * @since 6.0.0
73
+ * @access public
74
+ *
75
+ */
76
+ public function automatic_updates( $update_results ) {
77
+ global $wpdb;
78
+ $tablename = $wpdb->base_prefix . 'eum_logs';
79
+ if ( empty( $update_results ) ) return;
80
+
81
+ foreach( $update_results as $type => $results ) {
82
+ switch( $type ) {
83
+ case 'core':
84
+ $core = $results[ 0 ];
85
+ $status = is_wp_error( $core->result ) ? 0: 1;
86
+ $version = ( 1 == $status ) ? $core->result : '';
87
+ $wpdb->insert(
88
+ $tablename,
89
+ array(
90
+ 'name' => $core->name,
91
+ 'type' => $type,
92
+ 'version' => $version,
93
+ 'action' => 'automatic',
94
+ 'status' => $status,
95
+ 'date' => current_time( 'mysql' ),
96
+ ),
97
+ array(
98
+ '%s',
99
+ '%s',
100
+ '%s',
101
+ '%s',
102
+ '%s',
103
+ '%s',
104
+ )
105
+ );
106
+ break;
107
+ case 'plugin':
108
+ foreach( $results as $plugin ) {
109
+ error_log( print_r( $plugin, true ) );
110
+ $status = is_wp_error( $plugin->result ) ? 0: 1;
111
+ $version = isset( $plugin->item->new_version ) ? $plugin->item->new_version : '0.00';
112
+ $name = ( isset( $plugin->name ) && !empty( $plugin->name ) ) ? $plugin->name : $plugin->item->slug;
113
+ $wpdb->insert(
114
+ $tablename,
115
+ array(
116
+ 'name' => $name,
117
+ 'type' => $type,
118
+ 'version' => $version,
119
+ 'action' => 'automatic',
120
+ 'status' => $status,
121
+ 'date' => current_time( 'mysql' ),
122
+ ),
123
+ array(
124
+ '%s',
125
+ '%s',
126
+ '%s',
127
+ '%s',
128
+ '%s',
129
+ '%s',
130
+ )
131
+ );
132
+ }
133
+ break;
134
+ case 'theme':
135
+ foreach( $results as $theme ) {
136
+ error_log( print_r( $theme, true ) );
137
+ $status = ( is_wp_error( $theme->result ) || empty( $theme->result ) ) ? 0: 1;
138
+ if ( 0 == $status ) {
139
+ $theme_data_from_cache = wp_get_themes();
140
+ $theme_data = $theme_data_from_cache[ $theme->item->theme ];
141
+ $version = $theme_data->get( 'Version' );
142
+ } else {
143
+ $version = $theme->item->new_version;
144
+ }
145
+ $wpdb->insert(
146
+ $tablename,
147
+ array(
148
+ 'name' => $theme->name,
149
+ 'type' => $type,
150
+ 'version' => $version,
151
+ 'action' => 'automatic',
152
+ 'status' => $status,
153
+ 'date' => current_time( 'mysql' ),
154
+ ),
155
+ array(
156
+ '%s',
157
+ '%s',
158
+ '%s',
159
+ '%s',
160
+ '%s',
161
+ '%s',
162
+ )
163
+ );
164
+ }
165
+ break;
166
+ case 'translation':
167
+ foreach( $results as $translation ) {
168
+ $status = is_wp_error( $translation->result ) ? 0: 1;
169
+ $version = ( 1 == $status ) ? $translation->item->new_version : '';
170
+ $wpdb->insert(
171
+ $tablename,
172
+ array(
173
+ 'name' => $translation->name,
174
+ 'type' => $type,
175
+ 'version' => $version,
176
+ 'action' => 'automatic',
177
+ 'status' => $status,
178
+ 'date' => current_time( 'mysql' ),
179
+ ),
180
+ array(
181
+ '%s',
182
+ '%s',
183
+ '%s',
184
+ '%s',
185
+ '%s',
186
+ '%s',
187
+ )
188
+ );
189
+ }
190
+ break;
191
+ }
192
+ }
193
+ }
194
+
195
+ public function manual_updates( $upgrader_object, $options ) {
196
+ if ( !isset( $options[ 'action' ] ) || 'update' !== $options[ 'action' ] ) return;
197
+ global $wpdb;
198
+ $tablename = $wpdb->base_prefix . 'eum_logs';
199
+ $user_id = get_current_user_id();
200
+ if ( 0 == $user_id ) return; // If there is no user, this is not a manual update
201
+
202
+
203
+ switch( $options[ 'type' ] ) {
204
+ case 'core':
205
+ include( ABSPATH . WPINC . '/version.php' );
206
+ $wpdb->insert(
207
+ $tablename,
208
+ array(
209
+ 'user_id' => $user_id,
210
+ 'name' => 'WordPress ' . $wp_version,
211
+ 'type' => $options[ 'type' ],
212
+ 'version' => $wp_version,
213
+ 'action' => 'manual',
214
+ 'status' => 1,
215
+ 'date' => current_time( 'mysql' ),
216
+ ),
217
+ array(
218
+ '%d',
219
+ '%s',
220
+ '%s',
221
+ '%s',
222
+ '%s',
223
+ '%s',
224
+ '%s',
225
+ )
226
+ );
227
+ break;
228
+ case 'plugin':
229
+ $plugins = array();
230
+ if ( ! function_exists( 'get_plugins' ) ) {
231
+ require_once ABSPATH . 'wp-admin/includes/plugin.php';
232
+ }
233
+ $plugins_from_cache = get_plugins();
234
+ wp_clean_plugins_cache();
235
+ $plugins = get_plugins();
236
+ if ( !empty( $plugins ) && isset( $options[ 'plugins' ] ) && !empty( $options[ 'plugins' ] ) ) {
237
+ foreach( $options[ 'plugins' ] as $plugin ) {
238
+ $plugin_data = isset( $plugins[ $plugin ] ) ? $plugins[ $plugin ] : false;
239
+ $plugin_data_cache = isset( $plugins_from_cache[ $plugin ] ) ? $plugins_from_cache[ $plugin ] : false;
240
+ if ( false !== $plugin_data && false !== $plugin_data_cache ) {
241
+ $status = ( $plugin_data[ 'Version' ] == $plugin_data_cache[ 'Version' ] ) ? 0 : 1;
242
+ $wpdb->insert(
243
+ $tablename,
244
+ array(
245
+ 'user_id' => $user_id,
246
+ 'name' => $plugin_data[ 'Name' ],
247
+ 'type' => $options[ 'type' ],
248
+ 'version' => $plugin_data[ 'Version' ],
249
+ 'action' => 'manual',
250
+ 'status' => $status,
251
+ 'date' => current_time( 'mysql' ),
252
+ ),
253
+ array(
254
+ '%d',
255
+ '%s',
256
+ '%s',
257
+ '%s',
258
+ '%s',
259
+ '%s',
260
+ '%s',
261
+ )
262
+ );
263
+ }
264
+ }
265
+ }
266
+ break;
267
+ case 'theme':
268
+ if ( isset( $options[ 'themes' ] ) && !empty( $options[ 'themes' ] ) ) {
269
+ $theme_data_from_cache = wp_get_themes();
270
+ wp_clean_themes_cache();
271
+ foreach( $options[ 'themes' ] as $theme ) {
272
+ $theme_data = wp_get_theme( $theme );
273
+ $theme_from_cache = $theme_data_from_cache[ $theme ];
274
+ if ( $theme_data->exists() ) {
275
+ $status = ( $theme_from_cache->get( 'Version' ) == $theme_data->get( 'Version' ) ) ? 0 : 1;
276
+ $wpdb->insert(
277
+ $tablename,
278
+ array(
279
+ 'user_id' => $user_id,
280
+ 'name' => $theme_data->get( 'Name' ),
281
+ 'type' => $options[ 'type' ],
282
+ 'version' => $theme_data->get( 'Version' ),
283
+ 'action' => 'manual',
284
+ 'status' => $status,
285
+ 'date' => current_time( 'mysql' ),
286
+ ),
287
+ array(
288
+ '%d',
289
+ '%s',
290
+ '%s',
291
+ '%s',
292
+ '%s',
293
+ '%s',
294
+ '%s',
295
+ )
296
+ );
297
+ }
298
+ }
299
+ }
300
+ break;
301
+ }
302
+ }
303
+
304
+ /**
305
+ * Creates the log table
306
+ *
307
+ * Creates the log table
308
+ *
309
+ * @since 6.0.0
310
+ * @access private
311
+ *
312
+ */
313
+ private function build_table() {
314
+ global $wpdb;
315
+ $tablename = $wpdb->base_prefix . 'eum_logs';
316
+
317
+ // Get collation - From /wp-admin/includes/schema.php
318
+ $charset_collate = '';
319
+ if ( ! empty($wpdb->charset) )
320
+ $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset";
321
+ if ( ! empty($wpdb->collate) )
322
+ $charset_collate .= " COLLATE $wpdb->collate";
323
+
324
+ $sql = "CREATE TABLE {$tablename} (
325
+ log_id BIGINT(20) NOT NULL AUTO_INCREMENT,
326
+ user_id BIGINT(20) NOT NULL DEFAULT 0,
327
+ name VARCHAR(255) NOT NULL,
328
+ type VARCHAR(255) NOT NULL,
329
+ version VARCHAR(255) NOT NULL,
330
+ action VARCHAR(255) NOT NULL,
331
+ status VARCHAR(255) NOT NULL,
332
+ date DATETIME NOT NULL,
333
+ PRIMARY KEY (log_id)
334
+ ) {$charset_collate};";
335
+ require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
336
+ dbDelta($sql);
337
+ }
338
+
339
+ /**
340
+ * Clears the log table
341
+ *
342
+ * Clears the log table
343
+ *
344
+ * @since 6.0.0
345
+ * @access static
346
+ *
347
+ */
348
+ public static function clear() {
349
+ global $wpdb;
350
+ $tablename = $wpdb->base_prefix . 'eum_logs';
351
+ $sql = "delete from $tablename";
352
+ $wpdb->query( $sql );
353
+ }
354
+
355
+ /**
356
+ * Drops the log table
357
+ *
358
+ * Drops the log table
359
+ *
360
+ * @since 6.0.0
361
+ * @access static
362
+ *
363
+ */
364
+ public static function drop() {
365
+ global $wpdb;
366
+ $tablename = $wpdb->base_prefix . 'eum_logs';
367
+ $sql = "drop table if exists $tablename";
368
+ $wpdb->query( $sql );
369
+ }
370
+ }
includes/MPSUM_Logs_List_Table.php ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Easy Updates Manager Logs List Table class.
4
+ *
5
+ * @package WordPress
6
+ * @subpackage MPSUM_List_Table
7
+ * @since 6.0.0
8
+ * @access private
9
+ */
10
+ class MPSUM_Logs_List_Table extends MPSUM_List_Table {
11
+
12
+ /**
13
+ * Constructor.
14
+ *
15
+ * @since 3.1.0
16
+ * @access public
17
+ *
18
+ * @see WP_List_Table::__construct() for more information on default arguments.
19
+ *
20
+ * @global object $post_type_object
21
+ * @global wpdb $wpdb
22
+ *
23
+ * @param array $args An associative array of arguments.
24
+ */
25
+ public function __construct( $args = array() ) {
26
+ global $post_type_object, $wpdb;
27
+
28
+ parent::__construct( array(
29
+ 'singular'=> 'log',
30
+ 'plural' => 'logs',
31
+ ) );
32
+ }
33
+
34
+ public function prepare_items() {
35
+ global $wpdb, $_wp_column_headers;
36
+ $screen = get_current_screen();
37
+ $tablename = $wpdb->base_prefix . 'eum_logs';
38
+ $per_page = 50;
39
+ $log_count = $wpdb->get_var( "select count( * ) from $tablename" );
40
+
41
+ $paged = isset( $_GET[ 'paged' ] ) ? absint( $_GET[ 'paged' ] ) : 0;
42
+ if ( 1 == $paged || 0 == $paged ) {
43
+ $offset = 0;
44
+ } else {
45
+ $offset = ( $paged -1 ) * $per_page;
46
+ }
47
+ $query = $wpdb->prepare( "select * from $tablename order by log_id DESC limit %d,%d", $offset, $per_page );
48
+
49
+ $this->items = $wpdb->get_results( $query );
50
+
51
+ /* -- Register the Columns -- */
52
+ $this->_column_headers = array(
53
+ $this->get_columns(), // columns
54
+ array(), // hidden
55
+ $this->get_sortable_columns(), // sortable
56
+ );
57
+
58
+ $this->set_pagination_args( array(
59
+ 'total_items' => $log_count,
60
+ 'per_page' => $per_page
61
+ ) );
62
+ }
63
+
64
+ /**
65
+ *
66
+ * @return array
67
+ */
68
+ protected function get_table_classes() {
69
+ return array( 'widefat', 'fixed', 'striped' );
70
+ }
71
+
72
+ /**
73
+ *
74
+ * @return array
75
+ */
76
+ public function get_columns() {
77
+ $columns = array(
78
+ 'user' => _x( 'User', 'Column header for logs', 'stops-core-theme-and-plugin-updates' ),
79
+ 'name' => _x( 'Name', 'Column header for logs', 'stops-core-theme-and-plugin-updates' ),
80
+ 'type' => _x( 'Type', 'Column header for logs', 'stops-core-theme-and-plugin-updates' ),
81
+ 'version' => _x( 'Version', 'Column header for logs', 'stops-core-theme-and-plugin-updates' ),
82
+ 'action' => _x( 'Action', 'Column header for logs', 'stops-core-theme-and-plugin-updates' ),
83
+ 'status' => _x( 'Status', 'Column header for logs', 'stops-core-theme-and-plugin-updates' ),
84
+ 'date' => _x( 'Date', 'Column header for logs', 'stops-core-theme-and-plugin-updates' ),
85
+
86
+ );
87
+ return $columns;
88
+ }
89
+
90
+ /**
91
+ * @global WP_Query $wp_query
92
+ * @global int $per_page
93
+ * @param array $posts
94
+ * @param int $level
95
+ */
96
+ public function display_rows( $posts = array(), $level = 0 ) {
97
+ $records = $this->items;
98
+ foreach ( $this->items as $record ) {
99
+ $this->single_row( $record );
100
+ }
101
+
102
+ }
103
+
104
+ /**
105
+ *
106
+ * @param array log record
107
+ */
108
+ public function single_row( $record ) {
109
+
110
+ ?>
111
+ <tr id="log-<?php echo $record->log_id; ?>">
112
+ <?php
113
+ foreach( $record as $record_key => $record_data ) {
114
+ if ( 'log_id' == $record_key ) continue;
115
+ echo '<td>';
116
+ switch( $record_key ) {
117
+ case 'user_id':
118
+ if ( 0 == $record_data ) {
119
+ echo _x( 'None', 'No user found', 'stops-core-theme-and-plugin-updates' );
120
+ } else {
121
+ $user = get_user_by( 'id', $record_data );
122
+ if ( $user ) {
123
+ echo esc_html( $user->user_nicename );
124
+ }
125
+
126
+ }
127
+ break;
128
+ case 'name':
129
+ echo esc_html( $record_data );
130
+ break;
131
+ case 'type':
132
+ if ( 'core' == $record_data ) {
133
+ echo esc_html( ucfirst( _x( 'core', 'update type', 'stops-core-theme-and-plugin-updates' ) ) );
134
+ } elseif ( 'translation' == $record_data ) {
135
+ echo esc_html( ucfirst( _x( 'translation', 'update type', 'stops-core-theme-and-plugin-updates' ) ) );
136
+ } elseif( 'plugin' == $record_data ) {
137
+ echo esc_html( ucfirst( _x( 'plugin', 'update type', 'stops-core-theme-and-plugin-updates' ) ) );
138
+ } elseif( 'theme' == $record_data ) {
139
+ echo esc_html( ucfirst( _x( 'theme', 'update type', 'stops-core-theme-and-plugin-updates' ) ) );
140
+ } else {
141
+ echo esc_html( ucfirst( $record_data ) );
142
+ }
143
+ break;
144
+ case 'version':
145
+ echo esc_html( $record_data );
146
+ break;
147
+ case 'action':
148
+ if ( 'manual' == $record_data ) {
149
+ echo esc_html( ucfirst( _x( 'manual', 'update type - manual or automatic updates', 'stops-core-theme-and-plugin-updates' ) ) );
150
+ } elseif( 'automatic' == $record_data ) {
151
+ echo esc_html( ucfirst( _x( 'automatic', 'update type - manual or automatic updates', 'stops-core-theme-and-plugin-updates' ) ) );
152
+ } else {
153
+ echo esc_html( ucfirst( $record_data ) );
154
+ }
155
+
156
+ break;
157
+ case 'status':
158
+ if ( 1 == $record_data ) {
159
+ echo esc_html__( 'Success', 'stops-core-theme-and-plugin-updates' );
160
+ } else {
161
+ echo esc_html__( 'Failure', 'stops-core-theme-and-plugin-updates' );
162
+ }
163
+ break;
164
+ case 'date':
165
+ echo esc_html( $record_data );
166
+ break;
167
+ default:
168
+ break;
169
+ }
170
+ echo '</td>';
171
+ }
172
+
173
+ ?>
174
+ </tr>
175
+ <?php
176
+ }
177
+ }
main.php CHANGED
@@ -2,10 +2,10 @@
2
  /*
3
  Plugin Name: Easy Updates Manager
4
  Plugin URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
5
- Description: Manage and disable WordPress updates, including core, plugin, theme, and automatic updates - Works with Multisite.
6
- Author: kidsguide, ronalfy, pixolin, roary86
7
- Version: 5.4.5
8
- Requires at least: 4.3
9
  Author URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
10
  Contributors: kidsguide, ronalfy
11
  Text Domain: stops-core-theme-and-plugin-updates
@@ -295,6 +295,12 @@ class MPSUM_Updates_Manager {
295
  MPSUM_Disable_Updates::run();
296
  }
297
 
 
 
 
 
 
 
298
  add_action( 'wp_ajax_mpsum_ajax_action', array( $this, 'ajax_update_option' ) );
299
 
300
 
@@ -309,7 +315,6 @@ class MPSUM_Updates_Manager {
309
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) ) {
310
  die( 'Cheating, huh' );
311
  }
312
- error_log( print_r( $_REQUEST, true ) );
313
  if ( !isset( $_POST[ 'context' ] ) || !isset( $_POST[ 'data_action' ] ) ) {
314
  die('');
315
  }
@@ -324,7 +329,6 @@ class MPSUM_Updates_Manager {
324
  $options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
325
  if ( 'core' == $context ) {
326
  $options[ $option ] = $option_value;
327
- error_log( print_r( $options, true ) );
328
  if ( $option == 'automatic_theme_updates' || $option == 'automatic_plugin_updates' ) {
329
  $options[ $option ] = $val;
330
  }
2
  /*
3
  Plugin Name: Easy Updates Manager
4
  Plugin URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
5
+ Description: Manage and disable WordPress updates, including core, plugin, theme, and automatic updates - Works with Multisite and has built-in logging features.
6
+ Author: Easy Updates Manager Team
7
+ Version: 6.0.0
8
+ Requires at least: 4.4
9
  Author URI: https://wordpress.org/plugins/stops-core-theme-and-plugin-updates/
10
  Contributors: kidsguide, ronalfy
11
  Text Domain: stops-core-theme-and-plugin-updates
295
  MPSUM_Disable_Updates::run();
296
  }
297
 
298
+ // Logging
299
+ $options = MPSUM_Updates_Manager::get_options( 'core' );
300
+ if ( isset( $options[ 'logs' ] ) && 'on' == $options[ 'logs' ] ) {
301
+ MPSUM_Logs::run();
302
+ }
303
+
304
  add_action( 'wp_ajax_mpsum_ajax_action', array( $this, 'ajax_update_option' ) );
305
 
306
 
315
  if ( !wp_verify_nonce( $_POST[ '_ajax_nonce' ], 'mpsum_options_save' ) ) {
316
  die( 'Cheating, huh' );
317
  }
 
318
  if ( !isset( $_POST[ 'context' ] ) || !isset( $_POST[ 'data_action' ] ) ) {
319
  die('');
320
  }
329
  $options = wp_parse_args( $options, MPSUM_Admin_Core::get_defaults() );
330
  if ( 'core' == $context ) {
331
  $options[ $option ] = $option_value;
 
332
  if ( $option == 'automatic_theme_updates' || $option == 'automatic_plugin_updates' ) {
333
  $options[ $option ] = $val;
334
  }
readme.txt CHANGED
@@ -1,12 +1,13 @@
1
  === Easy Updates Manager ===
2
- Contributors: kidsguide, ronalfy, pixolin, roary86
3
- Tags: updates manager, easy updates manager, disable updates manager, disable updates, update control, plugin updates, theme updates, core updates, automatic updates, multisite
4
- Requires at least: 4.3
5
  Tested up to: 4.5
6
- Stable tag: 5.4.5
7
  License: GPLv2 or later
 
8
 
9
- Manage all your WordPress updates, including individual plugin/theme updates, automatic updates, and loads more. Also works with WordPress Multisite.
10
 
11
  == Description ==
12
  Easy Updates Manager is a light yet powerful plugin which enables you to manage all types of updates on your single site install or in WordPress Multisite. With loads of settings making endless possibilities for configuration, Easy Updates Manager is an obvious choice for anyone wanting to take control of their websites updates.
@@ -33,6 +34,7 @@ Easy Updates Manager is a light yet powerful plugin which enables you to manage
33
  <li>The ability to block users from configuring the settings.</li>
34
  <li>The ability to select which users can still see and perform updates.</li>
35
  <li>The ability to update some third party plugins.</li>
 
36
  </ul>
37
 
38
  For more information on how to use Easy Updates Manager, check out our <a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki">wiki</a>.
@@ -51,6 +53,9 @@ If you want to contribute to the translation, please go to https://translate.wor
51
  9. Enable/Disable updates and automatic updates individually for themes
52
  10. Advanced options tab
53
  11. Help tab
 
 
 
54
 
55
  == Installation ==
56
  <strong>Installing Easy Updates Manager in your WordPress Dashboard</strong> (recommended)
@@ -68,10 +73,12 @@ If you want to contribute to the translation, please go to https://translate.wor
68
 
69
  Activate the plugin after installation. If you are on Multisite, the plugin must be network-activated.
70
 
 
 
71
  == Frequently Asked Questions ==
72
  = Do you support older WordPress versions? =
73
 
74
- Version 5.0.x should support WP versions 4.0 - 4.2.x. Version 4.7.0 should support WP versions 2.3 - 4.0.
75
 
76
  Since WordPress is constantly changing, this plugin will always strive to support the latest version of WordPress. As there are many security vulnerabilities reported, please always keep WordPress as up-to-date as possible.
77
 
@@ -88,12 +95,21 @@ A plugin was also created to change the background updates email address: https:
88
  Check out our video on how the automatic updating works in WordPress.
89
  [youtube https://www.youtube.com/watch?v=V8AWwBc6GrU]
90
 
 
 
 
 
91
  = Additional Information and FAQ =
92
 
93
  For additional information and FAQs for Easy Updates Manager check out our <a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki">wiki</a>.
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
97
  = 5.4.5 =
98
  Released 2016-04-29
99
 
@@ -178,38 +194,8 @@ In version 5.0.0 we completely re-wrote the plugin to offer a faster and more se
178
 
179
  == Upgrade Notice ==
180
 
 
 
 
181
  = 5.4.5 =
182
  Dashboard improvements and multisite fixes
183
-
184
- = 5.4.3 =
185
- CSS and JS enhancements for the main dashboard tab
186
-
187
- = 5.4.2 =
188
- Fixing GoDaddy permissions issue. Removing options that didn't make it into WordPress 4.4.
189
-
190
- = 5.4.1 =
191
- Fixing styling issues where EUM styles were being used elsewhere.
192
-
193
- = 5.4.0 =
194
- Major dashboard overhaul and WordPress 4.4 preparation
195
-
196
- = 5.3.2 =
197
- Fixed translation errors.
198
-
199
- = 5.3.1 =
200
- Fixing automatic updates in dashboard view.
201
-
202
- = 5.3.0 =
203
- New Dashboard View. Support for WordPress 4.4 Email Notifications.
204
-
205
- = 5.2.0 =
206
- Force update button available. Better support for third-party solutions.
207
-
208
- = 5.1.1 =
209
- Fixing internationalization issues and adding German translation.
210
-
211
- = 5.1.0 =
212
- Only upgrade if using WordPress 4.3. Many changes to ensure WordPress 4.3 compatibility.
213
-
214
- = 5.0.0 =
215
- Major plugin rewrite and update. Updating will port over your old options. We recommend you perform a backup of your site before updating. Now you can configure just about any aspect of WordPress updates.
1
  === Easy Updates Manager ===
2
+ Contributors: kidsguide, ronalfy, roary86, bigwing
3
+ Tags: updates manager, easy updates manager, disable updates manager, disable updates, update control, plugin updates, theme updates, core updates, automatic updates, multisite, logs
4
+ Requires at least: 4.4
5
  Tested up to: 4.5
6
+ Stable tag: 6.0.0
7
  License: GPLv2 or later
8
+ Donate link: https://mediaron.com/contribute/
9
 
10
+ Manage all your WordPress updates, including individual updates, automatic updates, logs, and loads more. Also works with WordPress Multisite.
11
 
12
  == Description ==
13
  Easy Updates Manager is a light yet powerful plugin which enables you to manage all types of updates on your single site install or in WordPress Multisite. With loads of settings making endless possibilities for configuration, Easy Updates Manager is an obvious choice for anyone wanting to take control of their websites updates.
34
  <li>The ability to block users from configuring the settings.</li>
35
  <li>The ability to select which users can still see and perform updates.</li>
36
  <li>The ability to update some third party plugins.</li>
37
+ <li>Logging plugin updates</li>
38
  </ul>
39
 
40
  For more information on how to use Easy Updates Manager, check out our <a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki">wiki</a>.
53
  9. Enable/Disable updates and automatic updates individually for themes
54
  10. Advanced options tab
55
  11. Help tab
56
+ 12. Enable Logs in Advanced options tab
57
+ 13. Disable or Clear logs
58
+ 14. Logs tab
59
 
60
  == Installation ==
61
  <strong>Installing Easy Updates Manager in your WordPress Dashboard</strong> (recommended)
73
 
74
  Activate the plugin after installation. If you are on Multisite, the plugin must be network-activated.
75
 
76
+ For additional information for Easy Updates Manager check out our <a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki">wiki</a>.
77
+
78
  == Frequently Asked Questions ==
79
  = Do you support older WordPress versions? =
80
 
81
+ Version 6.x.x should support WP versions 4.0 and up. Version 4.7.0 should support WP versions 2.3 - 4.0.
82
 
83
  Since WordPress is constantly changing, this plugin will always strive to support the latest version of WordPress. As there are many security vulnerabilities reported, please always keep WordPress as up-to-date as possible.
84
 
95
  Check out our video on how the automatic updating works in WordPress.
96
  [youtube https://www.youtube.com/watch?v=V8AWwBc6GrU]
97
 
98
+ = How Do I Enable Logging? =
99
+
100
+ [youtube https://www.youtube.com/watch?v=Z6dPPv8Wttc]
101
+
102
  = Additional Information and FAQ =
103
 
104
  For additional information and FAQs for Easy Updates Manager check out our <a href="https://github.com/easy-updates-manager/easy-updates-manager/wiki">wiki</a>.
105
 
106
  == Changelog ==
107
 
108
+ = 6.0.0 =
109
+ Released 2016-05-14
110
+
111
+ * LOGS! A highly requested feature is now here. Please keep in mind we consider logs still in beta.
112
+
113
  = 5.4.5 =
114
  Released 2016-04-29
115
 
194
 
195
  == Upgrade Notice ==
196
 
197
+ = 6.0.0 =
198
+ LOGS! A highly requested feature is now here. Please keep in mind we consider logs still in beta
199
+
200
  = 5.4.5 =
201
  Dashboard improvements and multisite fixes
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
uninstall.php CHANGED
@@ -14,4 +14,10 @@ if (!defined( 'WP_UNINSTALL_PLUGIN' )) {
14
  delete_option( '_disable_updates' );
15
  delete_site_option( '_disable_updates' );
16
  delete_option( 'MPSUM' );
17
- delete_site_option( 'MPSUM' );
 
 
 
 
 
 
14
  delete_option( '_disable_updates' );
15
  delete_site_option( '_disable_updates' );
16
  delete_option( 'MPSUM' );
17
+ delete_site_option( 'MPSUM' );
18
+ delete_option( 'mpsum_log_table_version' );
19
+ delete_site_option( 'mpsum_log_table_version' );
20
+ global $wpdb;
21
+ $tablename = $wpdb->base_prefix . 'eum_logs';
22
+ $sql = "drop table if exists $tablename";
23
+ $wpdb->query( $sql );