Activity Log - Version 2.8.4

Version Description

  • 2022-09-04 =
  • Tweak: Added Activity Log setting to records log
  • Tweak: Added encoded value in CSV file (#165)
Download this release

Release Info

Developer KingYes
Plugin Icon 128x128 Activity Log
Version 2.8.4
Comparing to
See all releases

Code changes from version 2.8.3 to 2.8.4

aryo-activity-log.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://activitylog.io/?utm_source=wp-plugins&utm_campaign=plugin-ur
5
  Description: Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - it's all these for you to see.
6
  Author: Activity Log Team
7
  Author URI: https://activitylog.io/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
8
- Version: 2.8.3
9
  Text Domain: aryo-activity-log
10
  License: GPLv2 or later
11
 
5
  Description: Get aware of any activities that are taking place on your dashboard! Imagine it like a black-box for your WordPress site. e.g. post was deleted, plugin was activated, user logged in or logged out - it's all these for you to see.
6
  Author: Activity Log Team
7
  Author URI: https://activitylog.io/?utm_source=wp-plugins&utm_campaign=author-uri&utm_medium=wp-dash
8
+ Version: 2.8.4
9
  Text Domain: aryo-activity-log
10
  License: GPLv2 or later
11
 
classes/class-aal-export.php CHANGED
@@ -41,6 +41,8 @@ class AAL_Export {
41
  if ( ! array_key_exists( $exporter_selected, $this->get_exporters() ) ) {
42
  $this->redirect_back();
43
  }
 
 
44
 
45
  // Disable row limit
46
  add_filter( 'edit_aal_logs_per_page', array( $this, 'increase_throughput' ) );
@@ -110,6 +112,15 @@ class AAL_Export {
110
 
111
  return $row;
112
  }
 
 
 
 
 
 
 
 
 
113
 
114
  public function admin_register_exporters() {
115
  $builtin_exporters = array(
41
  if ( ! array_key_exists( $exporter_selected, $this->get_exporters() ) ) {
42
  $this->redirect_back();
43
  }
44
+
45
+ $this->insert_export_log();
46
 
47
  // Disable row limit
48
  add_filter( 'edit_aal_logs_per_page', array( $this, 'increase_throughput' ) );
112
 
113
  return $row;
114
  }
115
+
116
+ private function insert_export_log() {
117
+ aal_insert_log( array(
118
+ 'action' => 'exported',
119
+ 'object_type' => 'Options',
120
+ 'object_name' => 'exported',
121
+ 'object_subtype' => 'Activity Log',
122
+ ) );
123
+ }
124
 
125
  public function admin_register_exporters() {
126
  $builtin_exporters = array(
exporters/class-aal-exporter-csv.php CHANGED
@@ -16,6 +16,8 @@ class AAL_Exporter_csv {
16
  */
17
  public $id = 'csv';
18
 
 
 
19
  /**
20
  * Writes CSV data for download
21
  *
@@ -36,7 +38,8 @@ class AAL_Exporter_csv {
36
  fputcsv( $fp, $columns );
37
 
38
  foreach ( $data as $row ) {
39
- fputcsv( $fp, $row );
 
40
  }
41
 
42
  fclose( $fp );
@@ -45,4 +48,19 @@ class AAL_Exporter_csv {
45
  exit;
46
  }
47
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
  }
16
  */
17
  public $id = 'csv';
18
 
19
+ const FORMULAS_START_CHARACTERS = [ '=', '-', '+', '@', "\t", "\r" ];
20
+
21
  /**
22
  * Writes CSV data for download
23
  *
38
  fputcsv( $fp, $columns );
39
 
40
  foreach ( $data as $row ) {
41
+ $encoded_row = $this->get_encoded_row( $row );
42
+ fputcsv( $fp, $encoded_row );
43
  }
44
 
45
  fclose( $fp );
48
  exit;
49
  }
50
  }
51
+
52
+ private function get_encoded_row( $row ) {
53
+ $result = [];
54
+
55
+ foreach ( $row as $key => $value ) {
56
+ $encoded_value = $value;
57
+ if ( in_array( substr( (string) $value, 0, 1 ), self::FORMULAS_START_CHARACTERS, true ) ) {
58
+ $encoded_value = "'" . $value;
59
+ }
60
+
61
+ $result[ $key ] = $encoded_value;
62
+ }
63
+
64
+ return $result;
65
+ }
66
  }
hooks/class-aal-hook-options.php CHANGED
@@ -84,21 +84,43 @@ class AAL_Hook_Options extends AAL_Hook_Base {
84
 
85
  // Widgets
86
  'sidebars_widgets',
 
 
 
87
  ) );
88
 
89
- if ( ! in_array( $option, $whitelist_options ) )
90
  return;
 
 
 
 
91
 
 
92
  // TODO: need to think about save old & new values.
93
  aal_insert_log( array(
94
- 'action' => 'updated',
95
- 'object_type' => 'Options',
96
- 'object_name' => $option,
 
97
  ) );
98
  }
99
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  public function __construct() {
101
  add_action( 'updated_option', array( &$this, 'hooks_updated_option' ), 10, 3 );
 
102
 
103
  parent::__construct();
104
  }
84
 
85
  // Widgets
86
  'sidebars_widgets',
87
+
88
+ // AAL
89
+ 'logs_lifespan',
90
  ) );
91
 
92
+ if ( ! in_array( $option, $whitelist_options ) ) {
93
  return;
94
+ }
95
+
96
+ $this->insert_log( $option );
97
+ }
98
 
99
+ private function insert_log( $option_name, $context = '' ) {
100
  // TODO: need to think about save old & new values.
101
  aal_insert_log( array(
102
+ 'action' => 'updated',
103
+ 'object_type' => 'Options',
104
+ 'object_name' => $option_name,
105
+ 'object_subtype' => $context,
106
  ) );
107
  }
108
 
109
+ public function hooks_aal_options( $old_values, $new_values ) {
110
+ foreach ( (array) $old_values as $option_key => $old_value ) {
111
+ $is_new_value = ! empty( $new_values[ $option_key ] ) && $new_values[ $option_key ] !== $old_value;
112
+
113
+ if ( ! $is_new_value ) {
114
+ continue;
115
+ }
116
+
117
+ $this->insert_log( $option_key, 'Activity Log' );
118
+ }
119
+ }
120
+
121
  public function __construct() {
122
  add_action( 'updated_option', array( &$this, 'hooks_updated_option' ), 10, 3 );
123
+ add_action( 'update_option_activity-log-settings', array( $this, 'hooks_aal_options' ), 10, 2 );
124
 
125
  parent::__construct();
126
  }
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: pojo.me, KingYes, ariel.k, maor
3
  Tags: Activity Log, User Activity, User Log, Audit Log, Security, Tracking, WooCommerce, bbPress, GDPR,
4
  Requires at least: 4.4
5
- Tested up to: 6.0
6
- Stable tag: 2.8.3
7
  License: GPLv2 or later
8
 
9
  The #1 Activity Log plugin helps you monitor & log all changes and activities on your WordPress site, so you can run more securely and organized. Works simple & completely free!
@@ -108,6 +108,10 @@ Would you like to like to contribute to Activity Log? You are more than welcome
108
 
109
  == Changelog ==
110
 
 
 
 
 
111
  = 2.8.3 - 2022-03-09 =
112
  * Tweak: Run Clear old items from DB once daily to avoid unexpected errors ([#156](https://github.com/pojome/activity-log/issues/156))
113
 
2
  Contributors: pojo.me, KingYes, ariel.k, maor
3
  Tags: Activity Log, User Activity, User Log, Audit Log, Security, Tracking, WooCommerce, bbPress, GDPR,
4
  Requires at least: 4.4
5
+ Tested up to: 6.1
6
+ Stable tag: 2.8.4
7
  License: GPLv2 or later
8
 
9
  The #1 Activity Log plugin helps you monitor & log all changes and activities on your WordPress site, so you can run more securely and organized. Works simple & completely free!
108
 
109
  == Changelog ==
110
 
111
+ = 2.8.4 - 2022-09-04 =
112
+ * Tweak: Added Activity Log setting to records log
113
+ * Tweak: Added encoded value in CSV file ([#165](https://github.com/pojome/activity-log/issues/165))
114
+
115
  = 2.8.3 - 2022-03-09 =
116
  * Tweak: Run Clear old items from DB once daily to avoid unexpected errors ([#156](https://github.com/pojome/activity-log/issues/156))
117