Simple History - Version 2.31.1

Version Description

Download this release

Release Info

Developer eskapism
Plugin Icon 128x128 Simple History
Version 2.31.1
Comparing to
See all releases

Code changes from version 2.31 to 2.31.1

Files changed (5) hide show
  1. code.md +19 -0
  2. composer.json +1 -1
  3. index.php +62 -74
  4. phpcs.xml +56 -0
  5. readme.txt +1 -1
code.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ Since I always forget what standards I us in different projects this file is here to remind me about the standards I use in this project:
3
+
4
+ - Formatting:
5
+ Prettier, for both JavaScript and PHP.
6
+ - Not WordPress standard, I try to move towards PSR standards.
7
+ - phpcs to lint while editing. Lots of code is old but working but was written before my editor had nice linting, so much of the code does not lint. This will be fixed.
8
+
9
+ ## How to use php codesniffer
10
+
11
+ List errors and warnings:
12
+
13
+ $ phpcs /path/to/code/myfile.php
14
+
15
+ Fix things:
16
+
17
+ $ phpcbf /path/to/code
18
+
19
+
composer.json CHANGED
@@ -14,7 +14,7 @@
14
  "require": {
15
  "php": ">=5.3.0"
16
  },
17
- "version": "2.31",
18
  "authors": [
19
  {
20
  "name": "Pär Thernström",
14
  "require": {
15
  "php": ">=5.3.0"
16
  },
17
+ "version": "2.31.1",
18
  "authors": [
19
  {
20
  "name": "Pär Thernström",
index.php CHANGED
@@ -4,8 +4,9 @@
4
  * Plugin URI: http://simple-history.com
5
  * Text Domain: simple-history
6
  * Domain Path: /languages
7
- * Description: Plugin that logs various things that occur in WordPress and then presents those events in a very nice GUI.
8
- * Version: 2.29.2
 
9
  * Author: Pär Thernström
10
  * Author URI: http://simple-history.com/
11
  * License: GPL2
@@ -29,7 +30,7 @@
29
  */
30
 
31
  if (!defined('WPINC')) {
32
- die();
33
  }
34
 
35
  // Plugin requires at least WordPress version "4.5.1", because usage of functions like wp_get_raw_referer.
@@ -38,93 +39,80 @@ $ok_wp_version = version_compare($GLOBALS['wp_version'], '4.5.1', '>=');
38
  $ok_php_version = version_compare(phpversion(), '5.3', '>=');
39
 
40
  if ($ok_php_version && $ok_wp_version) {
41
- /**
42
- * Register function that is called when plugin is installed
43
- *
44
- * @TODO: make activatigon multi site aware, as in https://github.com/scribu/wp-proper-network-activation
45
- * register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
46
- */
47
 
48
- if (!defined('SIMPLE_HISTORY_VERSION')) {
49
- define('SIMPLE_HISTORY_VERSION', '2.31');
50
- }
51
 
52
- if (!defined('SIMPLE_HISTORY_PATH')) {
53
- define('SIMPLE_HISTORY_PATH', plugin_dir_path(__FILE__));
54
- }
55
 
56
- if (!defined('SIMPLE_HISTORY_BASENAME')) {
57
- define('SIMPLE_HISTORY_BASENAME', plugin_basename(__FILE__));
58
- }
59
 
60
- if (!defined('SIMPLE_HISTORY_DIR_URL')) {
61
- define('SIMPLE_HISTORY_DIR_URL', plugin_dir_url(__FILE__));
62
- }
63
 
64
- if (!defined('SIMPLE_HISTORY_FILE')) {
65
- define('SIMPLE_HISTORY_FILE', __FILE__);
66
- }
67
 
68
- /** Load required files */
69
- require_once __DIR__ . '/inc/SimpleHistory.php';
70
- require_once __DIR__ . '/inc/SimpleHistoryLogQuery.php';
71
 
72
- /**
73
- Constants will be like:
74
- SIMPLE_HISTORY_FILE:
75
- Var is string with length 57: /Users/username/GIT/Simple-History/index.php
76
- SIMPLE_HISTORY_PATH:
77
- Var is string with length 48: /Users/username/GIT/Simple-History/
78
- SIMPLE_HISTORY_BASENAME:
79
- Var is string with length 24: simple-history/index.php
80
- */
81
-
82
- /** Boot up */
83
- SimpleHistory::get_instance();
84
  } else {
85
- // User is running to old version of php, add admin notice about that.
86
- add_action('admin_notices', 'simple_history_old_version_admin_notice');
87
 
88
- /**
89
- * Show an admin message if old PHP version.
90
- */
91
- function simple_history_old_version_admin_notice()
92
- {
93
- $ok_wp_version = version_compare($GLOBALS['wp_version'], '4.5.1', '>=');
94
- $ok_php_version = version_compare(phpversion(), '5.3', '>=');
95
- ?>
96
  <div class="updated error">
97
  <?php
98
  if (!$ok_php_version) {
99
- echo '<p>';
100
- printf(
101
- /* translators: 1: PHP version */
102
- esc_html(
103
- __(
104
- 'Simple History is a great plugin, but to use it your server must have at least PHP 5.3 installed (you have version %s).',
105
- 'simple-history'
106
- )
107
- ),
108
- phpversion() // 1
109
- );
110
- echo '</p>';
111
  }
112
 
113
  if (!$ok_wp_version) {
114
- echo '<p>';
115
- printf(
116
- /* translators: 1: WordPress version */
117
- esc_html(
118
- __(
119
- 'Simple History requires WordPress version 4.5.1 or higher (you have version %s).',
120
- 'simple-history'
121
- )
122
- ),
123
- $GLOBALS['wp_version'] // 1
124
- );
125
- echo '</p>';
126
  }?>
127
  </div>
128
  <?php
129
- }
130
  } // End if().
4
  * Plugin URI: http://simple-history.com
5
  * Text Domain: simple-history
6
  * Domain Path: /languages
7
+ * Description: Plugin that logs various things that occur in WordPress and then
8
+ * presents those events in a very nice GUI.
9
+ * Version: 2.31.1
10
  * Author: Pär Thernström
11
  * Author URI: http://simple-history.com/
12
  * License: GPL2
30
  */
31
 
32
  if (!defined('WPINC')) {
33
+ die();
34
  }
35
 
36
  // Plugin requires at least WordPress version "4.5.1", because usage of functions like wp_get_raw_referer.
39
  $ok_php_version = version_compare(phpversion(), '5.3', '>=');
40
 
41
  if ($ok_php_version && $ok_wp_version) {
42
+ /**
43
+ * Register function that is called when plugin is installed
44
+ *
45
+ * @TODO: make activatigon multi site aware, as in https://github.com/scribu/wp-proper-network-activation
46
+ * register_activation_hook( trailingslashit(WP_PLUGIN_DIR) . trailingslashit( plugin_basename(__DIR__) ) . "index.php" , array("SimpleHistory", "on_plugin_activate" ) );
47
+ */
48
 
49
+ if (!defined('SIMPLE_HISTORY_VERSION')) {
50
+ define('SIMPLE_HISTORY_VERSION', '2.31.1');
51
+ }
52
 
53
+ if (!defined('SIMPLE_HISTORY_PATH')) {
54
+ define('SIMPLE_HISTORY_PATH', plugin_dir_path(__FILE__));
55
+ }
56
 
57
+ if (!defined('SIMPLE_HISTORY_BASENAME')) {
58
+ define('SIMPLE_HISTORY_BASENAME', plugin_basename(__FILE__));
59
+ }
60
 
61
+ if (!defined('SIMPLE_HISTORY_DIR_URL')) {
62
+ define('SIMPLE_HISTORY_DIR_URL', plugin_dir_url(__FILE__));
63
+ }
64
 
65
+ if (!defined('SIMPLE_HISTORY_FILE')) {
66
+ define('SIMPLE_HISTORY_FILE', __FILE__);
67
+ }
68
 
69
+ /** Load required files */
70
+ require_once __DIR__ . '/inc/SimpleHistory.php';
71
+ require_once __DIR__ . '/inc/SimpleHistoryLogQuery.php';
72
 
73
+ /** Boot up */
74
+ SimpleHistory::get_instance();
 
 
 
 
 
 
 
 
 
 
75
  } else {
76
+ // User is running to old version of php, add admin notice about that.
77
+ add_action('admin_notices', 'simple_history_old_version_admin_notice');
78
 
79
+ /**
80
+ * Show an admin message if old PHP version.
81
+ */
82
+ function simple_history_old_version_admin_notice()
83
+ {
84
+ $ok_wp_version = version_compare($GLOBALS['wp_version'], '4.5.1', '>=');
85
+ $ok_php_version = version_compare(phpversion(), '5.3', '>=');
86
+ ?>
87
  <div class="updated error">
88
  <?php
89
  if (!$ok_php_version) {
90
+ echo '<p>';
91
+ printf(
92
+ /* translators: 1: PHP version */
93
+ esc_html(
94
+ __(
95
+ 'Simple History is a great plugin, but to use it your server must have at least PHP 5.3 installed (you have version %s).',
96
+ 'simple-history'
97
+ )
98
+ ),
99
+ phpversion() // 1
100
+ );
101
+ echo '</p>';
102
  }
103
 
104
  if (!$ok_wp_version) {
105
+ echo '<p>';
106
+ printf(
107
+ /* translators: 1: WordPress version */
108
+ esc_html(
109
+ __('Simple History requires WordPress version 4.5.1 or higher (you have version %s).', 'simple-history')
110
+ ),
111
+ $GLOBALS['wp_version'] // 1
112
+ );
113
+ echo '</p>';
 
 
 
114
  }?>
115
  </div>
116
  <?php
117
+ }
118
  } // End if().
phpcs.xml ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <ruleset name="WordPressSimpleHistory">
3
+ <description>Trying to standard things.</description>
4
+
5
+ <!--
6
+ If no files or directories are specified on the command line
7
+ your custom standard can specify what files should be checked
8
+ instead.
9
+ Note that specifying any file or directory path
10
+ on the command line will ignore all file tags.
11
+ -->
12
+ <file>index.php</file>
13
+
14
+ <!--
15
+ You can hard-code ignore patterns directly into your
16
+ custom standard so you don't have to specify the
17
+ patterns on the command line.
18
+ -->
19
+ <exclude-pattern>*/database/*</exclude-pattern>
20
+ <exclude-pattern>*/cache/*</exclude-pattern>
21
+ <exclude-pattern>*/*.js</exclude-pattern>
22
+ <exclude-pattern>*/*.css</exclude-pattern>
23
+ <exclude-pattern>*/*.xml</exclude-pattern>
24
+ <exclude-pattern>*/*.blade.php</exclude-pattern>
25
+ <exclude-pattern>*/autoload.php</exclude-pattern>
26
+ <exclude-pattern>*/storage/*</exclude-pattern>
27
+ <exclude-pattern>*/docs/*</exclude-pattern>
28
+ <exclude-pattern>*/vendor/*</exclude-pattern>
29
+ <exclude-pattern>*/migrations/*</exclude-pattern>
30
+
31
+ <!--
32
+ You can hard-code command line values into your custom standard.
33
+ Note that this does not work for the command line values:
34
+ -v[v][v], -l, -d, -sniffs and -standard
35
+ The following tags are equivalent to the command line arguments:
36
+ -p
37
+ -->
38
+ <arg name="report" value="summary"/>
39
+ <arg name="colors"/>
40
+ <arg value="p"/>
41
+
42
+ <!--
43
+ You can hard-code custom php.ini settings into your custom standard.
44
+ The following tag sets the memory limit to 64M.
45
+ -->
46
+ <ini name="memory_limit" value="128M"/>
47
+
48
+ <!--
49
+ Include all sniffs in the PEAR standard. Note that the
50
+ path to the standard does not have to be specified as the
51
+ PEAR standard exists inside the PHP_CodeSniffer install
52
+ directory.
53
+ -->
54
+ <rule ref="PSR2"/>
55
+
56
+ </ruleset>
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: history, log, changes, changelog, audit, audit log, event log, user tracki
5
  Requires at least: 4.5.1
6
  Tested up to: 5.2
7
  Requires PHP: 5.4
8
- Stable tag: 2.31
9
 
10
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
11
 
5
  Requires at least: 4.5.1
6
  Tested up to: 5.2
7
  Requires PHP: 5.4
8
+ Stable tag: 2.31.1
9
 
10
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
11