Simple History - Version 2.33

Version Description

(November 2019) = - Better compatibility with the Gutenberg Block editor. - Correct URL redirected to after clearing log. Fixes #123. - Fix history log on dashboard leaving lots of white space and sometimes overlapping other dashboard widgets. Fixes https://wordpress.org/support/topic/dashboard-block-cut-off/, https://wordpress.org/support/topic/simple-history-v2-32/, and https://wordpress.org/support/topic/new-update-not-working-10/. - Fix join parameter order for PHP 7.4. - Update donate link. It's now https://www.paypal.me/eskapism. If you like the plugin please consider donate. A very small amount makes me much more happy than nothing at all! ;)

Download this release

Release Info

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

Code changes from version 2.32 to 2.33

composer.json CHANGED
@@ -10,11 +10,12 @@
10
  "homepage": "http://simple-history.com/",
11
  "minimum-stability": "dev",
12
  "require-dev": {
 
13
  },
14
  "require": {
15
- "php": ">=5.3.0"
16
  },
17
- "version": "2.32",
18
  "authors": [
19
  {
20
  "name": "Pär Thernström",
10
  "homepage": "http://simple-history.com/",
11
  "minimum-stability": "dev",
12
  "require-dev": {
13
+ "squizlabs/php_codesniffer": "3.*"
14
  },
15
  "require": {
16
+ "php": ">=5.2.0"
17
  },
18
+ "version": "2.33",
19
  "authors": [
20
  {
21
  "name": "Pär Thernström",
composer.lock CHANGED
@@ -4,16 +4,70 @@
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
- "content-hash": "59027ab3c002d867118ae3c2794d1066",
8
  "packages": [],
9
- "packages-dev": [],
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  "aliases": [],
11
  "minimum-stability": "dev",
12
- "stability-flags": [],
 
 
13
  "prefer-stable": false,
14
  "prefer-lowest": false,
15
  "platform": {
16
- "php": ">=5.3.0"
17
  },
18
  "platform-dev": []
19
  }
4
  "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
  "This file is @generated automatically"
6
  ],
7
+ "content-hash": "3b8dfbd08d71ac09ed083ecf8002d083",
8
  "packages": [],
9
+ "packages-dev": [
10
+ {
11
+ "name": "squizlabs/php_codesniffer",
12
+ "version": "dev-master",
13
+ "source": {
14
+ "type": "git",
15
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
16
+ "reference": "451a256c34e46ab346ee2b3d706e42eecb03223b"
17
+ },
18
+ "dist": {
19
+ "type": "zip",
20
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/451a256c34e46ab346ee2b3d706e42eecb03223b",
21
+ "reference": "451a256c34e46ab346ee2b3d706e42eecb03223b",
22
+ "shasum": ""
23
+ },
24
+ "require": {
25
+ "ext-simplexml": "*",
26
+ "ext-tokenizer": "*",
27
+ "ext-xmlwriter": "*",
28
+ "php": ">=5.4.0"
29
+ },
30
+ "require-dev": {
31
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
32
+ },
33
+ "bin": [
34
+ "bin/phpcs",
35
+ "bin/phpcbf"
36
+ ],
37
+ "type": "library",
38
+ "extra": {
39
+ "branch-alias": {
40
+ "dev-master": "3.x-dev"
41
+ }
42
+ },
43
+ "notification-url": "https://packagist.org/downloads/",
44
+ "license": [
45
+ "BSD-3-Clause"
46
+ ],
47
+ "authors": [
48
+ {
49
+ "name": "Greg Sherwood",
50
+ "role": "lead"
51
+ }
52
+ ],
53
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
54
+ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
55
+ "keywords": [
56
+ "phpcs",
57
+ "standards"
58
+ ],
59
+ "time": "2019-10-03T04:52:04+00:00"
60
+ }
61
+ ],
62
  "aliases": [],
63
  "minimum-stability": "dev",
64
+ "stability-flags": {
65
+ "squizlabs/php_codesniffer": 20
66
+ },
67
  "prefer-stable": false,
68
  "prefer-lowest": false,
69
  "platform": {
70
+ "php": ">=5.2.0"
71
  },
72
  "platform-dev": []
73
  }
css/styles.css CHANGED
@@ -51,7 +51,7 @@ The spinner that wp uses:;
51
  background-color: transparent;
52
  }
53
 
54
- .SimpleHistoryGui {
55
  width: 100%;
56
  float: left;
57
  }
51
  background-color: transparent;
52
  }
53
 
54
+ .SimpleHistoryGuiWrap .SimpleHistoryGui {
55
  width: 100%;
56
  float: left;
57
  }
examples/example-logger.php CHANGED
@@ -36,7 +36,7 @@ if (class_exists('SimpleLogger')) {
36
  * Return information about this logger.
37
  * Used to show info about the logger at various places.
38
  */
39
- function getInfo()
40
  {
41
 
42
  $arr_info = array(
36
  * Return information about this logger.
37
  * Used to show info about the logger at various places.
38
  */
39
+ public function getInfo()
40
  {
41
 
42
  $arr_info = array(
examples/examples.php CHANGED
@@ -12,7 +12,7 @@ exit;
12
  * Misc
13
  */
14
 
15
- // Add $_GET, $_POST, and more info to each logged even.
16
  define('SIMPLE_HISTORY_LOG_DEBUG', true);
17
 
18
 
12
  * Misc
13
  */
14
 
15
+ // Add $_GET, $_POST, and more info to each logged event.
16
  define('SIMPLE_HISTORY_LOG_DEBUG', true);
17
 
18
 
inc/SimpleHistory.php CHANGED
@@ -1818,7 +1818,8 @@ Because Simple History was just recently installed, this feed does not contain m
1818
  */
1819
  public function add_settings()
1820
  {
1821
- // Clear the log if clear button was clicked in settings.
 
1822
  if (isset($_GET['simple_history_clear_log_nonce']) &&
1823
  wp_verify_nonce($_GET['simple_history_clear_log_nonce'], 'simple_history_clear_log')
1824
  ) {
@@ -2068,10 +2069,16 @@ Because Simple History was just recently installed, this feed does not contain m
2068
  */
2069
  public function settings_field_clear_log()
2070
  {
2071
- $clear_link = esc_url(add_query_arg('', ''));
 
 
 
 
 
2072
  $clear_link = wp_nonce_url($clear_link, 'simple_history_clear_log', 'simple_history_clear_log_nonce');
2073
- $clear_days = $this->get_clear_history_interval();
2074
 
 
 
2075
  echo '<p>';
2076
 
2077
  if ($clear_days > 0) {
@@ -2088,7 +2095,7 @@ Because Simple History was just recently installed, this feed does not contain m
2088
  printf(
2089
  '<p><a class="button js-SimpleHistory-Settings-ClearLog" href="%2$s">%1$s</a></p>',
2090
  __('Clear log now', 'simple-history'),
2091
- $clear_link
2092
  );
2093
  }
2094
 
1818
  */
1819
  public function add_settings()
1820
  {
1821
+ // Clear the log if clear button was clicked in settings
1822
+ // and redirect user to show message.
1823
  if (isset($_GET['simple_history_clear_log_nonce']) &&
1824
  wp_verify_nonce($_GET['simple_history_clear_log_nonce'], 'simple_history_clear_log')
1825
  ) {
2069
  */
2070
  public function settings_field_clear_log()
2071
  {
2072
+
2073
+ // Get base URL to current page.
2074
+ // Will be like "/wordpress/wp-admin/options-general.php?page=simple_history_settings_menu_slug&"
2075
+ $clear_link = add_query_arg('', '');
2076
+
2077
+ // Append nonce to URL.
2078
  $clear_link = wp_nonce_url($clear_link, 'simple_history_clear_log', 'simple_history_clear_log_nonce');
 
2079
 
2080
+ $clear_days = $this->get_clear_history_interval();
2081
+
2082
  echo '<p>';
2083
 
2084
  if ($clear_days > 0) {
2095
  printf(
2096
  '<p><a class="button js-SimpleHistory-Settings-ClearLog" href="%2$s">%1$s</a></p>',
2097
  __('Clear log now', 'simple-history'),
2098
+ esc_url($clear_link)
2099
  );
2100
  }
2101
 
index.php CHANGED
@@ -5,7 +5,7 @@
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.32
9
  * Author: Pär Thernström
10
  * Author URI: http://simple-history.com/
11
  * License: GPL2
@@ -46,7 +46,7 @@ if ($ok_php_version && $ok_wp_version) {
46
  */
47
 
48
  if (!defined('SIMPLE_HISTORY_VERSION')) {
49
- define('SIMPLE_HISTORY_VERSION', '2.32');
50
  }
51
 
52
  if (!defined('SIMPLE_HISTORY_PATH')) {
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.33
9
  * Author: Pär Thernström
10
  * Author URI: http://simple-history.com/
11
  * License: GPL2
46
  */
47
 
48
  if (!defined('SIMPLE_HISTORY_VERSION')) {
49
+ define('SIMPLE_HISTORY_VERSION', '2.33');
50
  }
51
 
52
  if (!defined('SIMPLE_HISTORY_PATH')) {
loggers/SimplePostLogger.php CHANGED
@@ -57,7 +57,7 @@ class SimplePostLogger extends SimpleLogger
57
  add_action("rest_pre_insert_{$post_type->name}", array($this, 'on_rest_pre_insert'), 10, 2);
58
 
59
  // Rest insert happens after the post has been updated: "Fires after a single post is completely created or updated via the REST API."
60
- // add_action( "rest_after_insert_{$post_type->name}", array( $this, 'on_rest_after_insert' ), 10, 3 );
61
  }
62
  }
63
 
@@ -76,19 +76,6 @@ class SimplePostLogger extends SimpleLogger
76
  {
77
  // $prepared_post = stdClass Object with new and modified content.
78
  // changes are not saved to post in db yet, so get_post( $prepared_post->ID ) will get old contents.
79
- /*
80
- stdClass Object
81
- (
82
- [ID] => 889
83
- [post_title] => gutenberg 1
84
- [post_content] => <!-- wp:paragraph -->
85
- <p>hejsan</p>
86
- <!-- /wp:paragraph -->
87
- [post_excerpt] =>
88
- [post_type] => post
89
- [page_template] =>
90
- )
91
- */
92
 
93
  // $old_post = post with old content and old meta
94
  $old_post = get_post($prepared_post->ID);
@@ -104,22 +91,22 @@ class SimplePostLogger extends SimpleLogger
104
  /**
105
  * Fires after a single post is completely created or updated via the REST API.
106
  *
107
- * Here we can get the updated post, after it's updated in the db.
108
  *
109
- * @param WP_Post $post Inserted or updated post object.
110
  * @param WP_REST_Request $request Request object.
111
  * @param bool $creating True when creating a post, false when updating.
112
  */
113
- public function on_rest_after_insert($post, $request, $creating)
114
  {
115
- $post = get_post($post->ID);
116
- $post_meta = get_post_custom($post->ID);
117
 
118
- $old_post = $this->old_post_data[$post->ID]['post_data'];
119
- $old_post_meta = $this->old_post_data[$post->ID]['post_meta'];
120
 
121
  $args = array(
122
- 'new_post' => $post,
123
  'new_post_meta' => $post_meta,
124
  'old_post' => $old_post,
125
  'old_post_meta' => $old_post_meta,
@@ -629,6 +616,11 @@ class SimplePostLogger extends SimpleLogger
629
 
630
  /**
631
  * Fired when a post has changed status in the classical editor.
 
 
 
 
 
632
  * Only run in certain cases,
633
  * because when always enabled it catches a lots of edits made by plugins during cron jobs etc,
634
  * which by definition is not wrong, but perhaps not wanted/annoying.
@@ -639,11 +631,13 @@ class SimplePostLogger extends SimpleLogger
639
  */
640
  public function on_transition_post_status($new_status, $old_status, $post)
641
  {
642
- // $isRestApiRequest = ( defined( 'REST_API_REQUEST' ) && REST_API_REQUEST ) || ( defined( 'REST_REQUEST' ) && REST_REQUEST );
643
- // $is_admin = is_admin();
644
- // False if not a revision, ID of revision's parent otherwise.
645
- // $post_is_revision = wp_is_post_revision( $post );
646
- // sh_error_log('on_transition_post_status', '$new_status', $new_status, '$old_status', $old_status, '$isRestApiRequest', $isRestApiRequest, '$is_admin', $is_admin, '$post_is_revision', $post_is_revision);
 
 
647
  // Bail if post is not a post.
648
  if (!is_a($post, 'WP_Post')) {
649
  return;
57
  add_action("rest_pre_insert_{$post_type->name}", array($this, 'on_rest_pre_insert'), 10, 2);
58
 
59
  // Rest insert happens after the post has been updated: "Fires after a single post is completely created or updated via the REST API."
60
+ add_action("rest_after_insert_{$post_type->name}", array($this, 'on_rest_after_insert'), 10, 3);
61
  }
62
  }
63
 
76
  {
77
  // $prepared_post = stdClass Object with new and modified content.
78
  // changes are not saved to post in db yet, so get_post( $prepared_post->ID ) will get old contents.
 
 
 
 
 
 
 
 
 
 
 
 
 
79
 
80
  // $old_post = post with old content and old meta
81
  $old_post = get_post($prepared_post->ID);
91
  /**
92
  * Fires after a single post is completely created or updated via the REST API.
93
  *
94
+ * Here we get the updated post, after it is updated in the db.
95
  *
96
+ * @param WP_Post $updated_post Inserted or updated post object.
97
  * @param WP_REST_Request $request Request object.
98
  * @param bool $creating True when creating a post, false when updating.
99
  */
100
+ public function on_rest_after_insert($updatedPost, $request, $creating)
101
  {
102
+ $updatedPost = get_post($updatedPost->ID);
103
+ $post_meta = get_post_custom($updatedPost->ID);
104
 
105
+ $old_post = $this->old_post_data[$updatedPost->ID]['post_data'];
106
+ $old_post_meta = $this->old_post_data[$updatedPost->ID]['post_meta'];
107
 
108
  $args = array(
109
+ 'new_post' => $updatedPost,
110
  'new_post_meta' => $post_meta,
111
  'old_post' => $old_post,
112
  'old_post_meta' => $old_post_meta,
616
 
617
  /**
618
  * Fired when a post has changed status in the classical editor.
619
+ *
620
+ * It is also fired when saving from the Gutenberg editor,
621
+ * but it seems something is different because
622
+ * we can't get previosly custom fields here (we only get latest values instead).
623
+ *
624
  * Only run in certain cases,
625
  * because when always enabled it catches a lots of edits made by plugins during cron jobs etc,
626
  * which by definition is not wrong, but perhaps not wanted/annoying.
631
  */
632
  public function on_transition_post_status($new_status, $old_status, $post)
633
  {
634
+ $isRestApiRequest = defined('REST_REQUEST') && REST_REQUEST;
635
+
636
+ // Bail if this is a rest request.
637
+ if ($isRestApiRequest) {
638
+ return;
639
+ }
640
+
641
  // Bail if post is not a post.
642
  if (!is_a($post, 'WP_Post')) {
643
  return;
package-lock.json CHANGED
@@ -523,6 +523,24 @@
523
  "integrity": "sha1-eCFIGpkTxY11K22N9XV7ZRz6Ous=",
524
  "dev": true
525
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
526
  "grunt-wp-i18n": {
527
  "version": "0.4.9",
528
  "resolved": "https://registry.npmjs.org/grunt-wp-i18n/-/grunt-wp-i18n-0.4.9.tgz",
523
  "integrity": "sha1-eCFIGpkTxY11K22N9XV7ZRz6Ous=",
524
  "dev": true
525
  },
526
+ "grunt-version": {
527
+ "version": "1.3.1",
528
+ "resolved": "https://registry.npmjs.org/grunt-version/-/grunt-version-1.3.1.tgz",
529
+ "integrity": "sha512-EIx829NfFSAG3EbBKTAH15rj5SutSnjdZwVr80qWrmuVU4vOqP1S8RB3ghzetBYSiNBozKMNS+zeA6+jhmshUw==",
530
+ "dev": true,
531
+ "requires": {
532
+ "grunt": "0.4.5 - 1",
533
+ "semver": "^6.1.1"
534
+ },
535
+ "dependencies": {
536
+ "semver": {
537
+ "version": "6.3.0",
538
+ "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz",
539
+ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==",
540
+ "dev": true
541
+ }
542
+ }
543
+ },
544
  "grunt-wp-i18n": {
545
  "version": "0.4.9",
546
  "resolved": "https://registry.npmjs.org/grunt-wp-i18n/-/grunt-wp-i18n-0.4.9.tgz",
package.json CHANGED
@@ -1,25 +1,26 @@
1
  {
2
- "name": "simplehistory",
3
- "version": "0.0.1",
4
- "description": "WordPress log plugin",
5
- "author": "Pär Thernström",
6
- "license": "GPL",
7
- "devDependencies": {
8
- "grunt": "^0.4.5",
9
- "grunt-pot": "^0.2.1",
10
- "grunt-wp-i18n": "^0.4.9",
11
- "load-grunt-tasks": "^1.0.0",
12
- "time-grunt": "^1.4.0"
13
- },
14
- "dependencies": {
15
- "@prettier/plugin-php": "^0.10.2",
16
- "husky": "^2.1.0",
17
- "prettier": "^1.17.0",
18
- "pretty-quick": "^1.10.0"
19
- },
20
- "husky": {
21
- "hooks": {
22
- "pre-commit": "pretty-quick --staged"
23
- }
24
  }
 
25
  }
1
  {
2
+ "name": "simplehistory",
3
+ "version": "0.0.1",
4
+ "description": "WordPress log plugin",
5
+ "author": "Pär Thernström",
6
+ "license": "GPL",
7
+ "devDependencies": {
8
+ "grunt": "^0.4.5",
9
+ "grunt-pot": "^0.2.1",
10
+ "grunt-wp-i18n": "^0.4.9",
11
+ "load-grunt-tasks": "^1.0.0",
12
+ "time-grunt": "^1.4.0",
13
+ "grunt-version": "^1.3.1"
14
+ },
15
+ "dependencies": {
16
+ "@prettier/plugin-php": "^0.10.2",
17
+ "husky": "^2.1.0",
18
+ "prettier": "^1.17.0",
19
+ "pretty-quick": "^1.10.0"
20
+ },
21
+ "husky": {
22
+ "hooks": {
23
+ "pre-commit": "pretty-quick --staged"
24
  }
25
+ }
26
  }
phpcs.xml.dist CHANGED
@@ -17,10 +17,11 @@
17
 
18
  <config name="testVersion" value="5.3-"/>
19
 
20
- <rule ref="PSR2">
21
- <exclude name="PSR1.Classes.ClassDeclaration"/>
22
  <exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
23
  <exclude name="PSR1.Files.SideEffects" />
 
24
  </rule>
25
 
26
  <rule ref="Generic.Files.LineLength">
17
 
18
  <config name="testVersion" value="5.3-"/>
19
 
20
+ <rule ref="PSR12">
21
+ <!-- <exclude name="PSR1.Classes.ClassDeclaration"/>
22
  <exclude name="PSR1.Methods.CamelCapsMethodName.NotCamelCaps" />
23
  <exclude name="PSR1.Files.SideEffects" />
24
+ -->
25
  </rule>
26
 
27
  <rule ref="Generic.Files.LineLength">
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
  === Simple History ===
2
  Contributors: eskapism
3
- Donate link: http://eskapism.se/sida/donate/
4
  Tags: history, log, changes, changelog, audit, audit log, event log, user tracking, trail, pages, attachments, users, dashboard, admin, syslog, feed, activity, stream, audit trail, brute-force
5
  Requires at least: 5.2
6
  Tested up to: 5.2
7
  Requires PHP: 5.6
8
- Stable tag: 2.32
9
 
10
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
11
 
@@ -80,7 +80,7 @@ The plugin [Duplicate Post](https://wordpress.org/plugins/duplicate-post/) allow
80
  clone posts of any type.
81
  Simple History will log when a clone of a post or page is done.
82
 
83
- **Beaver Builder**
84
  The plugin [Beaver Build](https://wordpress.org/plugins/beaver-builder-lite-version/) is a page builder for WordPress that adds a flexible drag and drop page builder to the front end of your WordPress website.
85
  Simple History will log when a Beaver Builder layout or template is saved or when the settings for the plugins are saved.
86
 
@@ -191,6 +191,16 @@ Events in the log are stored for 60 days by default. Events older than this will
191
 
192
  ## Changelog
193
 
 
 
 
 
 
 
 
 
 
 
194
  = 2.32 (August 2019) =
195
 
196
  - Fix error in Beaver Builder logger. Fixes https://wordpress.org/support/topic/conflict-with-beaver-builder-plugin-4/.
1
  === Simple History ===
2
  Contributors: eskapism
3
+ Donate link: https://www.paypal.me/eskapism
4
  Tags: history, log, changes, changelog, audit, audit log, event log, user tracking, trail, pages, attachments, users, dashboard, admin, syslog, feed, activity, stream, audit trail, brute-force
5
  Requires at least: 5.2
6
  Tested up to: 5.2
7
  Requires PHP: 5.6
8
+ Stable tag: 2.33
9
 
10
  View changes made by users within WordPress. See who created a page, uploaded an attachment or approved an comment, and more.
11
 
80
  clone posts of any type.
81
  Simple History will log when a clone of a post or page is done.
82
 
83
+ **Beaver Builder**
84
  The plugin [Beaver Build](https://wordpress.org/plugins/beaver-builder-lite-version/) is a page builder for WordPress that adds a flexible drag and drop page builder to the front end of your WordPress website.
85
  Simple History will log when a Beaver Builder layout or template is saved or when the settings for the plugins are saved.
86
 
191
 
192
  ## Changelog
193
 
194
+ = 2.33 (November 2019) =
195
+ - Better compatibility with the Gutenberg Block editor.
196
+ - Correct URL redirected to after clearing log. Fixes #123.
197
+ - Fix history log on dashboard leaving lots of white space and sometimes overlapping other dashboard widgets.
198
+ Fixes https://wordpress.org/support/topic/dashboard-block-cut-off/, https://wordpress.org/support/topic/simple-history-v2-32/, and https://wordpress.org/support/topic/new-update-not-working-10/.
199
+ - Fix join parameter order for PHP 7.4.
200
+ - Update donate link. It's now https://www.paypal.me/eskapism.
201
+ If you like the plugin please consider donate.
202
+ A very small amount makes me much more happy than nothing at all! ;)
203
+
204
  = 2.32 (August 2019) =
205
 
206
  - Fix error in Beaver Builder logger. Fixes https://wordpress.org/support/topic/conflict-with-beaver-builder-plugin-4/.
templates/settings-statsForGeeks.php CHANGED
@@ -1,11 +1,10 @@
1
  <?php
2
- defined('ABSPATH') or die();
3
- ?>
4
 
5
  <script>
6
-
7
  jQuery(function($) {
8
-
9
  var $button = $(".js-SimpleHistoryShowsStatsForGeeks");
10
  var $wrapper = $(".SimpleHistory__statsForGeeksInner");
11
 
@@ -18,21 +17,18 @@ defined('ABSPATH') or die();
18
 
19
  </script>
20
  <?php
21
-
22
- defined('ABSPATH') or exit;
23
 
24
  echo '<hr>';
25
  echo "<p class='hide-if-no-js'><button class='button js-SimpleHistoryShowsStatsForGeeks'>Show stats for geeks</button></p>";
26
-
27
  ?>
28
 
29
  <div class="SimpleHistory__statsForGeeksInner hide-if-js">
30
  <?php
31
-
32
  echo '<h4>Rows count</h4>';
33
  $logQuery = new SimpleHistoryLogQuery();
34
  $rows = $logQuery->query(array(
35
- 'posts_per_page' => 1,
36
  // "date_from" => strtotime("-$period_days days")
37
  ));
38
 
@@ -52,9 +48,9 @@ echo "<p class='hide-if-no-js'><button class='button js-SimpleHistoryShowsStatsF
52
 
53
  $sql_table_size = sprintf(
54
  '
55
- SELECT table_name AS "table_name",
56
- round(((data_length + index_length) / 1024 / 1024), 2) "size_in_mb"
57
- FROM information_schema.TABLES
58
  WHERE table_schema = "%1$s"
59
  AND table_name IN ("%2$s", "%3$s");
60
  ',
@@ -65,7 +61,6 @@ echo "<p class='hide-if-no-js'><button class='button js-SimpleHistoryShowsStatsF
65
 
66
  $table_size_result = $wpdb->get_results($sql_table_size);
67
 
68
-
69
  echo '<h4>Database size</h4>';
70
 
71
  echo "<table class='widefat'>";
@@ -119,13 +114,17 @@ echo "<p class='hide-if-no-js'><button class='button js-SimpleHistoryShowsStatsF
119
  $arr_logger_slugs[] = $oneLogger['instance']->slug;
120
  }
121
 
122
- $sql_logger_counts = sprintf('
 
123
  SELECT logger, count(id) as count
124
  FROM %1$s
125
  WHERE logger IN ("%2$s")
126
  GROUP BY logger
127
  ORDER BY count DESC
128
- ', $table_name, join($arr_logger_slugs, '","'));
 
 
 
129
 
130
  $logger_rows_count = $wpdb->get_results($sql_logger_counts, OBJECT_K);
131
 
@@ -134,15 +133,15 @@ echo "<p class='hide-if-no-js'><button class='button js-SimpleHistoryShowsStatsF
134
  foreach ($arr_logger_slugs as $one_logger_slug) {
135
  $logger = $this->sh->getInstantiatedLoggerBySlug($one_logger_slug);
136
 
137
- if (! $logger) {
138
  continue;
139
  }
140
 
141
- if (isset($logger_rows_count[ $one_logger_slug ])) {
142
- $one_logger_count = $logger_rows_count[ $one_logger_slug ];
143
  } else {
144
  // logger was not is sql result, so fake result
145
- $one_logger_count = new stdclass;
146
  $one_logger_count->count = 0;
147
  }
148
 
@@ -180,8 +179,7 @@ echo "<p class='hide-if-no-js'><button class='button js-SimpleHistoryShowsStatsF
180
  );
181
 
182
  $loopnum++;
183
- }// End foreach().
184
  echo '</table>';
185
-
186
  ?>
187
  </div><!-- // stats for geeks inner -->
1
  <?php
2
+ defined('ABSPATH') or die(); ?>
 
3
 
4
  <script>
5
+
6
  jQuery(function($) {
7
+
8
  var $button = $(".js-SimpleHistoryShowsStatsForGeeks");
9
  var $wrapper = $(".SimpleHistory__statsForGeeksInner");
10
 
17
 
18
  </script>
19
  <?php
20
+ defined('ABSPATH') or exit();
 
21
 
22
  echo '<hr>';
23
  echo "<p class='hide-if-no-js'><button class='button js-SimpleHistoryShowsStatsForGeeks'>Show stats for geeks</button></p>";
 
24
  ?>
25
 
26
  <div class="SimpleHistory__statsForGeeksInner hide-if-js">
27
  <?php
 
28
  echo '<h4>Rows count</h4>';
29
  $logQuery = new SimpleHistoryLogQuery();
30
  $rows = $logQuery->query(array(
31
+ 'posts_per_page' => 1
32
  // "date_from" => strtotime("-$period_days days")
33
  ));
34
 
48
 
49
  $sql_table_size = sprintf(
50
  '
51
+ SELECT table_name AS "table_name",
52
+ round(((data_length + index_length) / 1024 / 1024), 2) "size_in_mb"
53
+ FROM information_schema.TABLES
54
  WHERE table_schema = "%1$s"
55
  AND table_name IN ("%2$s", "%3$s");
56
  ',
61
 
62
  $table_size_result = $wpdb->get_results($sql_table_size);
63
 
 
64
  echo '<h4>Database size</h4>';
65
 
66
  echo "<table class='widefat'>";
114
  $arr_logger_slugs[] = $oneLogger['instance']->slug;
115
  }
116
 
117
+ $sql_logger_counts = sprintf(
118
+ '
119
  SELECT logger, count(id) as count
120
  FROM %1$s
121
  WHERE logger IN ("%2$s")
122
  GROUP BY logger
123
  ORDER BY count DESC
124
+ ',
125
+ $table_name,
126
+ join('","', $arr_logger_slugs)
127
+ );
128
 
129
  $logger_rows_count = $wpdb->get_results($sql_logger_counts, OBJECT_K);
130
 
133
  foreach ($arr_logger_slugs as $one_logger_slug) {
134
  $logger = $this->sh->getInstantiatedLoggerBySlug($one_logger_slug);
135
 
136
+ if (!$logger) {
137
  continue;
138
  }
139
 
140
+ if (isset($logger_rows_count[$one_logger_slug])) {
141
+ $one_logger_count = $logger_rows_count[$one_logger_slug];
142
  } else {
143
  // logger was not is sql result, so fake result
144
+ $one_logger_count = new stdclass();
145
  $one_logger_count->count = 0;
146
  }
147
 
179
  );
180
 
181
  $loopnum++;
182
+ } // End foreach().
183
  echo '</table>';
 
184
  ?>
185
  </div><!-- // stats for geeks inner -->
templates/settings-statsLoggers.php CHANGED
@@ -17,14 +17,14 @@ $sql_logger_counts = sprintf(
17
  '
18
  SELECT logger, count(id) as count
19
  FROM %1$s
20
- WHERE
21
  logger IN ("%2$s")
22
  AND UNIX_TIMESTAMP(date) >= %3$d
23
  GROUP BY logger
24
  ORDER BY count DESC
25
  ',
26
  $table_name, // 1
27
- join($arr_logger_slugs, '","'), // 2
28
  strtotime("-$period_days days")
29
  );
30
 
@@ -42,7 +42,7 @@ $max_loggers_in_chart = sizeof($arr_colors);
42
  foreach ($logger_rows_count as $one_logger_count) {
43
  $logger = $this->sh->getInstantiatedLoggerBySlug($one_logger_count->logger);
44
 
45
- if (! $logger) {
46
  continue;
47
  }
48
 
@@ -61,7 +61,7 @@ foreach ($logger_rows_count as $one_logger_count) {
61
  },',
62
  $one_logger_count->count, // 1
63
  $logger_info['name'], // 2
64
- $arr_colors[ $i ] // 3
65
  );
66
 
67
  $str_js_chart_data_chartist .= sprintf(
@@ -69,10 +69,7 @@ foreach ($logger_rows_count as $one_logger_count) {
69
  $one_logger_count->count // 1
70
  );
71
 
72
- $str_js_chart_labels .= sprintf(
73
- '"%1$s",',
74
- $logger_info['name']
75
- );
76
 
77
  $str_js_google_chart_data .= sprintf(
78
  '["%1$s", %2$d], ',
@@ -81,40 +78,39 @@ foreach ($logger_rows_count as $one_logger_count) {
81
  );
82
 
83
  $i++;
84
- }// End foreach().
85
  $str_js_chart_data = rtrim($str_js_chart_data, ',');
86
  $str_js_chart_data_chartist = rtrim($str_js_chart_data_chartist, ',');
87
  $str_js_chart_labels = rtrim($str_js_chart_labels, ',');
88
  $str_js_google_chart_data = rtrim($str_js_google_chart_data, ',');
89
-
90
  ?>
91
  <script>
92
-
93
  /**
94
  * Pie chart with loggers distribution
95
  */
96
  jQuery(function($) {
97
 
98
- /*
99
  var data = {
100
- series: [<?php echo $str_js_chart_data_chartist ?>],
101
- labels: [<?php echo $str_js_chart_labels ?>]
102
- };
103
-
104
  var options = {};
105
 
106
  Chartist.Pie(".SimpleHistoryChart__loggersPie", data, options);
107
  */
108
 
109
  var data = google.visualization.arrayToDataTable([
110
- <?php echo $str_js_google_chart_data ?>
111
  ]);
112
 
113
  var options = {
114
  xtitle: 'My Daily Activities',
115
  backgroundColor: "transparent",
116
  is3D: true,
117
- legend: {
118
  xposition: 'top',
119
  alignment: 'center'
120
  }
@@ -123,7 +119,7 @@ $str_js_google_chart_data = rtrim($str_js_google_chart_data, ',');
123
 
124
  var chart = new google.visualization.PieChart( $(".SimpleHistoryChart__loggersPieGoogleChart").get(0) );
125
  chart.draw(data, options);
126
-
127
  //var chart2 = new google.visualization.BarChart( $(".SimpleHistoryChart__loggersGoogleBarChart").get(0) );
128
  //chart2.draw(data, options);
129
 
17
  '
18
  SELECT logger, count(id) as count
19
  FROM %1$s
20
+ WHERE
21
  logger IN ("%2$s")
22
  AND UNIX_TIMESTAMP(date) >= %3$d
23
  GROUP BY logger
24
  ORDER BY count DESC
25
  ',
26
  $table_name, // 1
27
+ join('","', $arr_logger_slugs), // 2
28
  strtotime("-$period_days days")
29
  );
30
 
42
  foreach ($logger_rows_count as $one_logger_count) {
43
  $logger = $this->sh->getInstantiatedLoggerBySlug($one_logger_count->logger);
44
 
45
+ if (!$logger) {
46
  continue;
47
  }
48
 
61
  },',
62
  $one_logger_count->count, // 1
63
  $logger_info['name'], // 2
64
+ $arr_colors[$i] // 3
65
  );
66
 
67
  $str_js_chart_data_chartist .= sprintf(
69
  $one_logger_count->count // 1
70
  );
71
 
72
+ $str_js_chart_labels .= sprintf('"%1$s",', $logger_info['name']);
 
 
 
73
 
74
  $str_js_google_chart_data .= sprintf(
75
  '["%1$s", %2$d], ',
78
  );
79
 
80
  $i++;
81
+ } // End foreach().
82
  $str_js_chart_data = rtrim($str_js_chart_data, ',');
83
  $str_js_chart_data_chartist = rtrim($str_js_chart_data_chartist, ',');
84
  $str_js_chart_labels = rtrim($str_js_chart_labels, ',');
85
  $str_js_google_chart_data = rtrim($str_js_google_chart_data, ',');
 
86
  ?>
87
  <script>
88
+
89
  /**
90
  * Pie chart with loggers distribution
91
  */
92
  jQuery(function($) {
93
 
94
+ /*
95
  var data = {
96
+ series: [<?php echo $str_js_chart_data_chartist; ?>],
97
+ labels: [<?php echo $str_js_chart_labels; ?>]
98
+ };
99
+
100
  var options = {};
101
 
102
  Chartist.Pie(".SimpleHistoryChart__loggersPie", data, options);
103
  */
104
 
105
  var data = google.visualization.arrayToDataTable([
106
+ <?php echo $str_js_google_chart_data; ?>
107
  ]);
108
 
109
  var options = {
110
  xtitle: 'My Daily Activities',
111
  backgroundColor: "transparent",
112
  is3D: true,
113
+ legend: {
114
  xposition: 'top',
115
  alignment: 'center'
116
  }
119
 
120
  var chart = new google.visualization.PieChart( $(".SimpleHistoryChart__loggersPieGoogleChart").get(0) );
121
  chart.draw(data, options);
122
+
123
  //var chart2 = new google.visualization.BarChart( $(".SimpleHistoryChart__loggersGoogleBarChart").get(0) );
124
  //chart2.draw(data, options);
125
 
templates/template-settings-tab-debug.php CHANGED
@@ -22,7 +22,6 @@ $period_end_date = DateTime::createFromFormat('U', time());
22
 
23
  echo '<h3>' . _x('Database size', 'debug dropin', 'simple-history') . '</h3>';
24
 
25
-
26
  // Get table sizes in mb.
27
  $sql_table_size = sprintf(
28
  '
@@ -63,15 +62,9 @@ printf(
63
 
64
  $loopnum = 0;
65
  foreach ($table_size_result as $one_table) {
66
- $size = sprintf(
67
- _x('%s MB', 'debug dropin', 'simple-history'),
68
- $one_table->size_in_mb
69
- );
70
 
71
- $rows = sprintf(
72
- _x('%s rows', 'debug dropin', 'simple-history'),
73
- number_format_i18n($one_table->num_rows, 0)
74
- );
75
 
76
  printf(
77
  '<tr class="%4$s">
@@ -92,7 +85,7 @@ echo '</table>';
92
 
93
  $logQuery = new SimpleHistoryLogQuery();
94
  $rows = $logQuery->query(array(
95
- 'posts_per_page' => 1,
96
  ));
97
 
98
  // This is the number of rows with occasions taken into consideration
@@ -105,7 +98,6 @@ printf(
105
  );
106
  echo '</p>';
107
 
108
-
109
  // echo "<h4>Clear history interval</h4>";
110
  // echo "<p>" . $this->sh->get_clear_history_interval() . "</p>";
111
  /**
@@ -121,13 +113,17 @@ foreach ($this->sh->getInstantiatedLoggers() as $oneLogger) {
121
  $arr_logger_slugs[] = $oneLogger['instance']->slug;
122
  }
123
 
124
- $sql_logger_counts = sprintf('
 
125
  SELECT logger, count(id) as count
126
  FROM %1$s
127
  WHERE logger IN ("%2$s")
128
  GROUP BY logger
129
  ORDER BY count DESC
130
- ', $table_name, join($arr_logger_slugs, '","'));
 
 
 
131
 
132
  $logger_rows_count = $wpdb->get_results($sql_logger_counts, OBJECT_K);
133
 
@@ -135,9 +131,9 @@ $logger_rows_count = $wpdb->get_results($sql_logger_counts, OBJECT_K);
135
  $missing_logger_slugs = array_diff($arr_logger_slugs, array_keys($logger_rows_count));
136
 
137
  foreach ($missing_logger_slugs as $one_missing_logger_slug) {
138
- $logger_rows_count[ $one_missing_logger_slug ] = (object) array(
139
  'logger' => $one_missing_logger_slug,
140
- 'count' => 0,
141
  );
142
  }
143
 
@@ -179,15 +175,15 @@ $loopnum = 0;
179
  foreach ($logger_rows_count as $one_logger_slug => $one_logger_val) {
180
  $logger = $this->sh->getInstantiatedLoggerBySlug($one_logger_slug);
181
 
182
- if (! $logger) {
183
  continue;
184
  }
185
 
186
- if (isset($logger_rows_count[ $one_logger_slug ])) {
187
- $one_logger_count = $logger_rows_count[ $one_logger_slug ];
188
  } else {
189
  // logger was not is sql result, so fake result
190
- $one_logger_count = new stdclass;
191
  $one_logger_count->count = 0;
192
  }
193
 
@@ -253,7 +249,7 @@ foreach ($logger_rows_count as $one_logger_slug => $one_logger_val) {
253
  );
254
 
255
  $loopnum++;
256
- }// End foreach().
257
 
258
  echo '</table>';
259
 
@@ -291,9 +287,7 @@ foreach ($plugins as $pluginFilePath => $onePlugin) {
291
  ',
292
  esc_html($onePlugin['Name']),
293
  esc_html($pluginFilePath),
294
- $isPluginActive ?
295
- _x('Yes', 'debug dropin', 'simple-history') :
296
- _x('No', 'debug dropin', 'simple-history')
297
  // 3
298
  );
299
  }
22
 
23
  echo '<h3>' . _x('Database size', 'debug dropin', 'simple-history') . '</h3>';
24
 
 
25
  // Get table sizes in mb.
26
  $sql_table_size = sprintf(
27
  '
62
 
63
  $loopnum = 0;
64
  foreach ($table_size_result as $one_table) {
65
+ $size = sprintf(_x('%s MB', 'debug dropin', 'simple-history'), $one_table->size_in_mb);
 
 
 
66
 
67
+ $rows = sprintf(_x('%s rows', 'debug dropin', 'simple-history'), number_format_i18n($one_table->num_rows, 0));
 
 
 
68
 
69
  printf(
70
  '<tr class="%4$s">
85
 
86
  $logQuery = new SimpleHistoryLogQuery();
87
  $rows = $logQuery->query(array(
88
+ 'posts_per_page' => 1
89
  ));
90
 
91
  // This is the number of rows with occasions taken into consideration
98
  );
99
  echo '</p>';
100
 
 
101
  // echo "<h4>Clear history interval</h4>";
102
  // echo "<p>" . $this->sh->get_clear_history_interval() . "</p>";
103
  /**
113
  $arr_logger_slugs[] = $oneLogger['instance']->slug;
114
  }
115
 
116
+ $sql_logger_counts = sprintf(
117
+ '
118
  SELECT logger, count(id) as count
119
  FROM %1$s
120
  WHERE logger IN ("%2$s")
121
  GROUP BY logger
122
  ORDER BY count DESC
123
+ ',
124
+ $table_name,
125
+ join('","', $arr_logger_slugs)
126
+ );
127
 
128
  $logger_rows_count = $wpdb->get_results($sql_logger_counts, OBJECT_K);
129
 
131
  $missing_logger_slugs = array_diff($arr_logger_slugs, array_keys($logger_rows_count));
132
 
133
  foreach ($missing_logger_slugs as $one_missing_logger_slug) {
134
+ $logger_rows_count[$one_missing_logger_slug] = (object) array(
135
  'logger' => $one_missing_logger_slug,
136
+ 'count' => 0
137
  );
138
  }
139
 
175
  foreach ($logger_rows_count as $one_logger_slug => $one_logger_val) {
176
  $logger = $this->sh->getInstantiatedLoggerBySlug($one_logger_slug);
177
 
178
+ if (!$logger) {
179
  continue;
180
  }
181
 
182
+ if (isset($logger_rows_count[$one_logger_slug])) {
183
+ $one_logger_count = $logger_rows_count[$one_logger_slug];
184
  } else {
185
  // logger was not is sql result, so fake result
186
+ $one_logger_count = new stdclass();
187
  $one_logger_count->count = 0;
188
  }
189
 
249
  );
250
 
251
  $loopnum++;
252
+ } // End foreach().
253
 
254
  echo '</table>';
255
 
287
  ',
288
  esc_html($onePlugin['Name']),
289
  esc_html($pluginFilePath),
290
+ $isPluginActive ? _x('Yes', 'debug dropin', 'simple-history') : _x('No', 'debug dropin', 'simple-history')
 
 
291
  // 3
292
  );
293
  }
vendor/autoload.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- // autoload.php @generated by Composer
4
-
5
- require_once __DIR__ . '/composer/autoload_real.php';
6
-
7
- return ComposerAutoloaderInit3f19e1fe69ca77f96f946c9d4920fd62::getLoader();
 
 
 
 
 
 
 
vendor/composer/ClassLoader.php DELETED
@@ -1,445 +0,0 @@
1
- <?php
2
-
3
- /*
4
- * This file is part of Composer.
5
- *
6
- * (c) Nils Adermann <naderman@naderman.de>
7
- * Jordi Boggiano <j.boggiano@seld.be>
8
- *
9
- * For the full copyright and license information, please view the LICENSE
10
- * file that was distributed with this source code.
11
- */
12
-
13
- namespace Composer\Autoload;
14
-
15
- /**
16
- * ClassLoader implements a PSR-0, PSR-4 and classmap class loader.
17
- *
18
- * $loader = new \Composer\Autoload\ClassLoader();
19
- *
20
- * // register classes with namespaces
21
- * $loader->add('Symfony\Component', __DIR__.'/component');
22
- * $loader->add('Symfony', __DIR__.'/framework');
23
- *
24
- * // activate the autoloader
25
- * $loader->register();
26
- *
27
- * // to enable searching the include path (eg. for PEAR packages)
28
- * $loader->setUseIncludePath(true);
29
- *
30
- * In this example, if you try to use a class in the Symfony\Component
31
- * namespace or one of its children (Symfony\Component\Console for instance),
32
- * the autoloader will first look for the class under the component/
33
- * directory, and it will then fallback to the framework/ directory if not
34
- * found before giving up.
35
- *
36
- * This class is loosely based on the Symfony UniversalClassLoader.
37
- *
38
- * @author Fabien Potencier <fabien@symfony.com>
39
- * @author Jordi Boggiano <j.boggiano@seld.be>
40
- * @see http://www.php-fig.org/psr/psr-0/
41
- * @see http://www.php-fig.org/psr/psr-4/
42
- */
43
- class ClassLoader
44
- {
45
- // PSR-4
46
- private $prefixLengthsPsr4 = array();
47
- private $prefixDirsPsr4 = array();
48
- private $fallbackDirsPsr4 = array();
49
-
50
- // PSR-0
51
- private $prefixesPsr0 = array();
52
- private $fallbackDirsPsr0 = array();
53
-
54
- private $useIncludePath = false;
55
- private $classMap = array();
56
- private $classMapAuthoritative = false;
57
- private $missingClasses = array();
58
- private $apcuPrefix;
59
-
60
- public function getPrefixes()
61
- {
62
- if (!empty($this->prefixesPsr0)) {
63
- return call_user_func_array('array_merge', $this->prefixesPsr0);
64
- }
65
-
66
- return array();
67
- }
68
-
69
- public function getPrefixesPsr4()
70
- {
71
- return $this->prefixDirsPsr4;
72
- }
73
-
74
- public function getFallbackDirs()
75
- {
76
- return $this->fallbackDirsPsr0;
77
- }
78
-
79
- public function getFallbackDirsPsr4()
80
- {
81
- return $this->fallbackDirsPsr4;
82
- }
83
-
84
- public function getClassMap()
85
- {
86
- return $this->classMap;
87
- }
88
-
89
- /**
90
- * @param array $classMap Class to filename map
91
- */
92
- public function addClassMap(array $classMap)
93
- {
94
- if ($this->classMap) {
95
- $this->classMap = array_merge($this->classMap, $classMap);
96
- } else {
97
- $this->classMap = $classMap;
98
- }
99
- }
100
-
101
- /**
102
- * Registers a set of PSR-0 directories for a given prefix, either
103
- * appending or prepending to the ones previously set for this prefix.
104
- *
105
- * @param string $prefix The prefix
106
- * @param array|string $paths The PSR-0 root directories
107
- * @param bool $prepend Whether to prepend the directories
108
- */
109
- public function add($prefix, $paths, $prepend = false)
110
- {
111
- if (!$prefix) {
112
- if ($prepend) {
113
- $this->fallbackDirsPsr0 = array_merge(
114
- (array) $paths,
115
- $this->fallbackDirsPsr0
116
- );
117
- } else {
118
- $this->fallbackDirsPsr0 = array_merge(
119
- $this->fallbackDirsPsr0,
120
- (array) $paths
121
- );
122
- }
123
-
124
- return;
125
- }
126
-
127
- $first = $prefix[0];
128
- if (!isset($this->prefixesPsr0[$first][$prefix])) {
129
- $this->prefixesPsr0[$first][$prefix] = (array) $paths;
130
-
131
- return;
132
- }
133
- if ($prepend) {
134
- $this->prefixesPsr0[$first][$prefix] = array_merge(
135
- (array) $paths,
136
- $this->prefixesPsr0[$first][$prefix]
137
- );
138
- } else {
139
- $this->prefixesPsr0[$first][$prefix] = array_merge(
140
- $this->prefixesPsr0[$first][$prefix],
141
- (array) $paths
142
- );
143
- }
144
- }
145
-
146
- /**
147
- * Registers a set of PSR-4 directories for a given namespace, either
148
- * appending or prepending to the ones previously set for this namespace.
149
- *
150
- * @param string $prefix The prefix/namespace, with trailing '\\'
151
- * @param array|string $paths The PSR-4 base directories
152
- * @param bool $prepend Whether to prepend the directories
153
- *
154
- * @throws \InvalidArgumentException
155
- */
156
- public function addPsr4($prefix, $paths, $prepend = false)
157
- {
158
- if (!$prefix) {
159
- // Register directories for the root namespace.
160
- if ($prepend) {
161
- $this->fallbackDirsPsr4 = array_merge(
162
- (array) $paths,
163
- $this->fallbackDirsPsr4
164
- );
165
- } else {
166
- $this->fallbackDirsPsr4 = array_merge(
167
- $this->fallbackDirsPsr4,
168
- (array) $paths
169
- );
170
- }
171
- } elseif (!isset($this->prefixDirsPsr4[$prefix])) {
172
- // Register directories for a new namespace.
173
- $length = strlen($prefix);
174
- if ('\\' !== $prefix[$length - 1]) {
175
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
176
- }
177
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
178
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
179
- } elseif ($prepend) {
180
- // Prepend directories for an already registered namespace.
181
- $this->prefixDirsPsr4[$prefix] = array_merge(
182
- (array) $paths,
183
- $this->prefixDirsPsr4[$prefix]
184
- );
185
- } else {
186
- // Append directories for an already registered namespace.
187
- $this->prefixDirsPsr4[$prefix] = array_merge(
188
- $this->prefixDirsPsr4[$prefix],
189
- (array) $paths
190
- );
191
- }
192
- }
193
-
194
- /**
195
- * Registers a set of PSR-0 directories for a given prefix,
196
- * replacing any others previously set for this prefix.
197
- *
198
- * @param string $prefix The prefix
199
- * @param array|string $paths The PSR-0 base directories
200
- */
201
- public function set($prefix, $paths)
202
- {
203
- if (!$prefix) {
204
- $this->fallbackDirsPsr0 = (array) $paths;
205
- } else {
206
- $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths;
207
- }
208
- }
209
-
210
- /**
211
- * Registers a set of PSR-4 directories for a given namespace,
212
- * replacing any others previously set for this namespace.
213
- *
214
- * @param string $prefix The prefix/namespace, with trailing '\\'
215
- * @param array|string $paths The PSR-4 base directories
216
- *
217
- * @throws \InvalidArgumentException
218
- */
219
- public function setPsr4($prefix, $paths)
220
- {
221
- if (!$prefix) {
222
- $this->fallbackDirsPsr4 = (array) $paths;
223
- } else {
224
- $length = strlen($prefix);
225
- if ('\\' !== $prefix[$length - 1]) {
226
- throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator.");
227
- }
228
- $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length;
229
- $this->prefixDirsPsr4[$prefix] = (array) $paths;
230
- }
231
- }
232
-
233
- /**
234
- * Turns on searching the include path for class files.
235
- *
236
- * @param bool $useIncludePath
237
- */
238
- public function setUseIncludePath($useIncludePath)
239
- {
240
- $this->useIncludePath = $useIncludePath;
241
- }
242
-
243
- /**
244
- * Can be used to check if the autoloader uses the include path to check
245
- * for classes.
246
- *
247
- * @return bool
248
- */
249
- public function getUseIncludePath()
250
- {
251
- return $this->useIncludePath;
252
- }
253
-
254
- /**
255
- * Turns off searching the prefix and fallback directories for classes
256
- * that have not been registered with the class map.
257
- *
258
- * @param bool $classMapAuthoritative
259
- */
260
- public function setClassMapAuthoritative($classMapAuthoritative)
261
- {
262
- $this->classMapAuthoritative = $classMapAuthoritative;
263
- }
264
-
265
- /**
266
- * Should class lookup fail if not found in the current class map?
267
- *
268
- * @return bool
269
- */
270
- public function isClassMapAuthoritative()
271
- {
272
- return $this->classMapAuthoritative;
273
- }
274
-
275
- /**
276
- * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
277
- *
278
- * @param string|null $apcuPrefix
279
- */
280
- public function setApcuPrefix($apcuPrefix)
281
- {
282
- $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
283
- }
284
-
285
- /**
286
- * The APCu prefix in use, or null if APCu caching is not enabled.
287
- *
288
- * @return string|null
289
- */
290
- public function getApcuPrefix()
291
- {
292
- return $this->apcuPrefix;
293
- }
294
-
295
- /**
296
- * Registers this instance as an autoloader.
297
- *
298
- * @param bool $prepend Whether to prepend the autoloader or not
299
- */
300
- public function register($prepend = false)
301
- {
302
- spl_autoload_register(array($this, 'loadClass'), true, $prepend);
303
- }
304
-
305
- /**
306
- * Unregisters this instance as an autoloader.
307
- */
308
- public function unregister()
309
- {
310
- spl_autoload_unregister(array($this, 'loadClass'));
311
- }
312
-
313
- /**
314
- * Loads the given class or interface.
315
- *
316
- * @param string $class The name of the class
317
- * @return bool|null True if loaded, null otherwise
318
- */
319
- public function loadClass($class)
320
- {
321
- if ($file = $this->findFile($class)) {
322
- includeFile($file);
323
-
324
- return true;
325
- }
326
- }
327
-
328
- /**
329
- * Finds the path to the file where the class is defined.
330
- *
331
- * @param string $class The name of the class
332
- *
333
- * @return string|false The path if found, false otherwise
334
- */
335
- public function findFile($class)
336
- {
337
- // class map lookup
338
- if (isset($this->classMap[$class])) {
339
- return $this->classMap[$class];
340
- }
341
- if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) {
342
- return false;
343
- }
344
- if (null !== $this->apcuPrefix) {
345
- $file = apcu_fetch($this->apcuPrefix.$class, $hit);
346
- if ($hit) {
347
- return $file;
348
- }
349
- }
350
-
351
- $file = $this->findFileWithExtension($class, '.php');
352
-
353
- // Search for Hack files if we are running on HHVM
354
- if (false === $file && defined('HHVM_VERSION')) {
355
- $file = $this->findFileWithExtension($class, '.hh');
356
- }
357
-
358
- if (null !== $this->apcuPrefix) {
359
- apcu_add($this->apcuPrefix.$class, $file);
360
- }
361
-
362
- if (false === $file) {
363
- // Remember that this class does not exist.
364
- $this->missingClasses[$class] = true;
365
- }
366
-
367
- return $file;
368
- }
369
-
370
- private function findFileWithExtension($class, $ext)
371
- {
372
- // PSR-4 lookup
373
- $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext;
374
-
375
- $first = $class[0];
376
- if (isset($this->prefixLengthsPsr4[$first])) {
377
- $subPath = $class;
378
- while (false !== $lastPos = strrpos($subPath, '\\')) {
379
- $subPath = substr($subPath, 0, $lastPos);
380
- $search = $subPath . '\\';
381
- if (isset($this->prefixDirsPsr4[$search])) {
382
- $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1);
383
- foreach ($this->prefixDirsPsr4[$search] as $dir) {
384
- if (file_exists($file = $dir . $pathEnd)) {
385
- return $file;
386
- }
387
- }
388
- }
389
- }
390
- }
391
-
392
- // PSR-4 fallback dirs
393
- foreach ($this->fallbackDirsPsr4 as $dir) {
394
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) {
395
- return $file;
396
- }
397
- }
398
-
399
- // PSR-0 lookup
400
- if (false !== $pos = strrpos($class, '\\')) {
401
- // namespaced class name
402
- $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1)
403
- . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR);
404
- } else {
405
- // PEAR-like class name
406
- $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext;
407
- }
408
-
409
- if (isset($this->prefixesPsr0[$first])) {
410
- foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) {
411
- if (0 === strpos($class, $prefix)) {
412
- foreach ($dirs as $dir) {
413
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
414
- return $file;
415
- }
416
- }
417
- }
418
- }
419
- }
420
-
421
- // PSR-0 fallback dirs
422
- foreach ($this->fallbackDirsPsr0 as $dir) {
423
- if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) {
424
- return $file;
425
- }
426
- }
427
-
428
- // PSR-0 include paths.
429
- if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) {
430
- return $file;
431
- }
432
-
433
- return false;
434
- }
435
- }
436
-
437
- /**
438
- * Scope isolated include.
439
- *
440
- * Prevents access to $this/self from included files.
441
- */
442
- function includeFile($file)
443
- {
444
- include $file;
445
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/LICENSE DELETED
@@ -1,21 +0,0 @@
1
-
2
- Copyright (c) Nils Adermann, Jordi Boggiano
3
-
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is furnished
9
- to do so, subject to the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be included in all
12
- copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
- THE SOFTWARE.
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/autoload_classmap.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- // autoload_classmap.php @generated by Composer
4
-
5
- $vendorDir = dirname(dirname(__FILE__));
6
- $baseDir = dirname($vendorDir);
7
-
8
- return array(
9
- );
 
 
 
 
 
 
 
 
 
vendor/composer/autoload_namespaces.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- // autoload_namespaces.php @generated by Composer
4
-
5
- $vendorDir = dirname(dirname(__FILE__));
6
- $baseDir = dirname($vendorDir);
7
-
8
- return array(
9
- );
 
 
 
 
 
 
 
 
 
vendor/composer/autoload_psr4.php DELETED
@@ -1,9 +0,0 @@
1
- <?php
2
-
3
- // autoload_psr4.php @generated by Composer
4
-
5
- $vendorDir = dirname(dirname(__FILE__));
6
- $baseDir = dirname($vendorDir);
7
-
8
- return array(
9
- );
 
 
 
 
 
 
 
 
 
vendor/composer/autoload_real.php DELETED
@@ -1,52 +0,0 @@
1
- <?php
2
-
3
- // autoload_real.php @generated by Composer
4
-
5
- class ComposerAutoloaderInit3f19e1fe69ca77f96f946c9d4920fd62
6
- {
7
- private static $loader;
8
-
9
- public static function loadClassLoader($class)
10
- {
11
- if ('Composer\Autoload\ClassLoader' === $class) {
12
- require __DIR__ . '/ClassLoader.php';
13
- }
14
- }
15
-
16
- public static function getLoader()
17
- {
18
- if (null !== self::$loader) {
19
- return self::$loader;
20
- }
21
-
22
- spl_autoload_register(array('ComposerAutoloaderInit3f19e1fe69ca77f96f946c9d4920fd62', 'loadClassLoader'), true, true);
23
- self::$loader = $loader = new \Composer\Autoload\ClassLoader();
24
- spl_autoload_unregister(array('ComposerAutoloaderInit3f19e1fe69ca77f96f946c9d4920fd62', 'loadClassLoader'));
25
-
26
- $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
27
- if ($useStaticLoader) {
28
- require_once __DIR__ . '/autoload_static.php';
29
-
30
- call_user_func(\Composer\Autoload\ComposerStaticInit3f19e1fe69ca77f96f946c9d4920fd62::getInitializer($loader));
31
- } else {
32
- $map = require __DIR__ . '/autoload_namespaces.php';
33
- foreach ($map as $namespace => $path) {
34
- $loader->set($namespace, $path);
35
- }
36
-
37
- $map = require __DIR__ . '/autoload_psr4.php';
38
- foreach ($map as $namespace => $path) {
39
- $loader->setPsr4($namespace, $path);
40
- }
41
-
42
- $classMap = require __DIR__ . '/autoload_classmap.php';
43
- if ($classMap) {
44
- $loader->addClassMap($classMap);
45
- }
46
- }
47
-
48
- $loader->register(true);
49
-
50
- return $loader;
51
- }
52
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/autoload_static.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
-
3
- // autoload_static.php @generated by Composer
4
-
5
- namespace Composer\Autoload;
6
-
7
- class ComposerStaticInit3f19e1fe69ca77f96f946c9d4920fd62
8
- {
9
- public static function getInitializer(ClassLoader $loader)
10
- {
11
- return \Closure::bind(function () use ($loader) {
12
-
13
- }, null, ClassLoader::class);
14
- }
15
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/composer/installed.json DELETED
@@ -1 +0,0 @@
1
- []