WP fail2ban - Version 4.2.6

Version Description

  • Add support for Remote Tools add-on.
  • Add support for the new ClassicPress security page.
  • Improved user enumeration blocking.
Download this release

Release Info

Developer invisnet
Plugin Icon 128x128 WP fail2ban
Version 4.2.6
Comparing to
See all releases

Code changes from version 4.2.5 to 4.2.6

admin/admin.php CHANGED
@@ -29,14 +29,39 @@ function admin_menu()
29
  __NAMESPACE__ . '\\about',
30
  'dashicons-analytics'
31
  );
32
- add_submenu_page(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  'wp-fail2ban',
34
- 'Settings',
35
- 'Settings',
36
  'manage_options',
37
- 'wp-fail2ban-settings',
38
- __NAMESPACE__ . '\\settings'
39
  );
 
 
 
 
 
40
  $submenu['wp-fail2ban'][0][0] = __( 'Welcome' );
41
  }
42
 
@@ -44,6 +69,7 @@ add_action( 'admin_menu', __NAMESPACE__ . '\\admin_menu' );
44
  /**
45
  * Add Settings link on Plugins page
46
  *
 
47
  * @since 4.2.0
48
  *
49
  * @param array $links
@@ -52,8 +78,13 @@ add_action( 'admin_menu', __NAMESPACE__ . '\\admin_menu' );
52
  function plugin_action_links( $links, $file )
53
  {
54
  if ( preg_match( "|{$file}\$|", WP_FAIL2BAN_FILE ) ) {
55
- // Add Settings at the start
56
- array_unshift( $links, '<a href="' . admin_url( 'admin.php' ) . '?page=wp-fail2ban-settings&tab=about">Settings</a>' );
 
 
 
 
 
57
  }
58
  return $links;
59
  }
29
  __NAMESPACE__ . '\\about',
30
  'dashicons-analytics'
31
  );
32
+
33
+ if ( function_exists( '\\add_security_page' ) ) {
34
+ $slug = 'wp-fail2ban';
35
+ add_security_page(
36
+ 'WP fail2ban',
37
+ 'WP fail2ban',
38
+ $slug,
39
+ __NAMESPACE__ . '\\security'
40
+ );
41
+ } else {
42
+ add_submenu_page(
43
+ 'wp-fail2ban',
44
+ 'Settings',
45
+ 'Settings',
46
+ 'manage_options',
47
+ 'wpf2b-settings',
48
+ __NAMESPACE__ . '\\settings'
49
+ );
50
+ }
51
+
52
+ $hook = add_submenu_page(
53
  'wp-fail2ban',
54
+ 'WP fail2ban - Remote Tools',
55
+ 'Remote Tools',
56
  'manage_options',
57
+ 'wp-fail2ban-tools',
58
+ __NAMESPACE__ . '\\remote_tools'
59
  );
60
+ add_action( "load-{$hook}", function () {
61
+ if ( function_exists( '\\org\\lecklider\\charles\\wordpress\\wp_fail2ban\\addons\\remote_tools\\help' ) ) {
62
+ \org\lecklider\charles\wordpress\wp_fail2ban\addons\remote_tools\help();
63
+ }
64
+ } );
65
  $submenu['wp-fail2ban'][0][0] = __( 'Welcome' );
66
  }
67
 
69
  /**
70
  * Add Settings link on Plugins page
71
  *
72
+ * @since 4.2.6 Add support for ClassicPress security page
73
  * @since 4.2.0
74
  *
75
  * @param array $links
78
  function plugin_action_links( $links, $file )
79
  {
80
  if ( preg_match( "|{$file}\$|", WP_FAIL2BAN_FILE ) ) {
81
+ array_unshift( $links, sprintf(
82
+ '<a href="%s?page=%s" title="%s">%s</a>',
83
+ admin_url( 'admin.php' ),
84
+ ( wf_fs()->is_free_plan() ? 'wp-fail2ban' : 'wpf2b-settings' ),
85
+ __( 'Settings' ),
86
+ ( function_exists( '\\add_security_page' ) ? '<span class="dashicon dashicons-admin-generic"></span>' : __( 'Settings' ) )
87
+ ) );
88
  }
89
  return $links;
90
  }
admin/config.php CHANGED
@@ -16,39 +16,87 @@ foreach ( glob( __DIR__ . '/config/*.php' ) as $filename ) {
16
  require_once $filename;
17
  }
18
  /**
19
- * Render Settings
20
  *
21
- * @since 4.0.0
22
  */
23
- function settings()
24
  {
25
  $tabs = [
26
  'logging',
27
  'syslog',
28
  'block',
29
- 'remote-ips',
30
- 'plugins'
31
  ];
32
- $title = 'WP fail2ban';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  ?>
34
  <div class="wrap">
35
- <h1><?php
36
- echo $title ;
37
- ?></h1>
38
  <hr class="wp-header-end">
39
 
40
  <h2 class="nav-tab-wrapper wp-clearfix">
41
- <?php
42
- $active_tab = Tab::getActiveTab( 'logging' );
43
  foreach ( $tabs as $slug ) {
44
  $class = 'nav-tab';
45
  if ( $active_tab->getSlug() == $slug ) {
46
  $class .= ' nav-tab-active';
47
  }
 
 
 
 
48
  printf(
49
- '<a class="%s" href="?page=wp-fail2ban-settings&tab=%s">%s</a>',
50
  $class,
51
- $slug,
52
  Tab::getTabName( $slug )
53
  );
54
  }
@@ -58,12 +106,59 @@ function settings()
58
  <form action="options.php?tab=<?php
59
  echo $active_tab->getSlug() ;
60
  ?>" method="post">
61
- <?php
62
  settings_fields( 'wp-fail2ban' );
63
- $active_tab->render();
64
- echo '<hr><p>' . __( '<strong>Note:</strong> The Free version of <em>WP fail2ban</em> is configured by defining constants in <tt>wp-config.php</tt>; these tabs display those values.<br>Upgrade to the Premium version to enable this interface.' ) . '</p>' ;
65
  ?>
66
  </form>
67
  </div>
68
  <?php
69
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  require_once $filename;
17
  }
18
  /**
19
+ * Render Security settings.
20
  *
21
+ * @since 4.2.6
22
  */
23
+ function security()
24
  {
25
  $tabs = [
26
  'logging',
27
  'syslog',
28
  'block',
29
+ 'remote-ips'
 
30
  ];
31
+ if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
32
+ $tabs[] = 'plugins';
33
+ }
34
+ $page = 'wp-fail2ban';
35
+ if ( wf_fs()->is_premium() ) {
36
+ $page .= '-premium';
37
+ }
38
+ render_tabs( $tabs, 'logging', $page );
39
+ }
40
+
41
+ /**
42
+ * Render Settings.
43
+ *
44
+ * @since 4.2.6
45
+ */
46
+ function settings()
47
+ {
48
+ $tabs = [];
49
+
50
+ if ( !function_exists( '\\add_security_page' ) ) {
51
+ $tabs = [
52
+ 'logging',
53
+ 'syslog',
54
+ 'block',
55
+ 'remote-ips'
56
+ ];
57
+ if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
58
+ $tabs[] = 'plugins';
59
+ }
60
+ }
61
+
62
+ $default = 'logging';
63
+ render_tabs( $tabs, $default, 'wpf2b-settings' );
64
+ }
65
+
66
+ /**
67
+ * Render Tabs.
68
+ *
69
+ * @since 4.2.6
70
+ *
71
+ * @param array $tabs List of slugs of tabs to render
72
+ * @param string $default Default tab slug
73
+ * @param string $menu Menu slug
74
+ */
75
+ function render_tabs( array $tabs, $default, $menu )
76
+ {
77
  ?>
78
  <div class="wrap">
79
+ <?php
80
+ echo apply_filters( __METHOD__ . '.title', "<h1>WP fail2ban</h1>" ) ;
81
+ ?>
82
  <hr class="wp-header-end">
83
 
84
  <h2 class="nav-tab-wrapper wp-clearfix">
85
+ <?php
86
+ $active_tab = Tab::getActiveTab( $default );
87
  foreach ( $tabs as $slug ) {
88
  $class = 'nav-tab';
89
  if ( $active_tab->getSlug() == $slug ) {
90
  $class .= ' nav-tab-active';
91
  }
92
+ $params = apply_filters( __METHOD__ . '.params', [
93
+ 'page' => $menu,
94
+ 'tab' => $slug,
95
+ ] );
96
  printf(
97
+ '<a class="%s" href="?%s">%s</a>',
98
  $class,
99
+ http_build_query( $params ),
100
  Tab::getTabName( $slug )
101
  );
102
  }
106
  <form action="options.php?tab=<?php
107
  echo $active_tab->getSlug() ;
108
  ?>" method="post">
109
+ <?php
110
  settings_fields( 'wp-fail2ban' );
111
+ $rendered = $active_tab->render();
112
+ echo '<hr><p>' . __( '<strong>Note:</strong> The Free version of <em>WP fail2ban</em> is configured by defining constants in <tt>wp-config.php</tt>; these tabs display those values.' ) . '<br>' . __( 'Upgrade to the Premium version to enable this interface.' ) . '</p>' ;
113
  ?>
114
  </form>
115
  </div>
116
  <?php
117
  }
118
+
119
+ /**
120
+ * Proxy for api.wp-fail2ban.com
121
+ *
122
+ * @since 4.2.6
123
+ */
124
+ function remote_tools()
125
+ {
126
+ global $current_user ;
127
+ ?>
128
+ <div class="wrap">
129
+ <h1>Remote Tools (&beta;)</h1>
130
+ <hr class="wp-header-end">
131
+ <?php
132
+
133
+ if ( function_exists( '\\org\\lecklider\\charles\\wordpress\\wp_fail2ban\\addons\\remote_tools\\tab' ) ) {
134
+ //delete_user_meta($current_user->ID, 'wp-fail2ban-tools-notice-ignore');
135
+ if ( !get_user_meta( $current_user->ID, 'wp-fail2ban-tools-notice-ignore' ) ) {
136
+ echo '<div class="notice notice-info"><p><strong>N.B.</strong> These tools are provided from a remote server. <a href="?page=wp-fail2ban-tools&wp-fail2ban-tools-dismiss-notice">Dismiss</a></p></div>' ;
137
+ }
138
+ \org\lecklider\charles\wordpress\wp_fail2ban\addons\remote_tools\tab();
139
+ } else {
140
+ ?>
141
+ <h2 class="nav-tab-wrapper wp-clearfix">
142
+ <a class="nav-tab nav-tab-active" href="#">Overview</a>
143
+ </h2>
144
+ <div class="card">
145
+ <h2>Remote Tools Add-on</h2>
146
+ <p>This add-on provides features that make life with WP fail2ban easier, all from a remote server. This gives access to valuable but infrequently used tools without bloating the core plugin.</p>
147
+ <p>The first of these is a <strong>Custom Filter Tool</strong> (CFT).</p>
148
+ <blockquote>
149
+ <p>The filter files included are intended only as a starting point for those who want <em>WPf2b</em> to work “out of the box”.</p>
150
+ <p>There is no &ldquo;one size fits all&rdquo; configuration possible for <em>fail2ban</em> - what may be a soft failure for one site should be treated as a hard failure for another, and vice versa.</p>
151
+ </blockquote>
152
+ <p>You could simply edit the filter files included, but it&lsquo;s surprisingly easy to make a mistake; I learned this the hard way with earlier versions of <em>WPf2b</em>.... The CFT removes most of the opportunities for human error - always a good thing!</p>
153
+ <hr>
154
+ <p>The Remote Tools Add-on is available from the <a href="<?php
155
+ echo admin_url( 'admin.php?page=wp-fail2ban-addons' ) ;
156
+ ?>">Add-Ons menu</a>.</p>
157
+ </div>
158
+ <?php
159
+ }
160
+
161
+ ?>
162
+ </div>
163
+ <?php
164
+ }
admin/lib/about.php CHANGED
@@ -39,6 +39,20 @@ function about( $hide_title = false )
39
  <div id="poststuff">
40
  <div id="post-body" class="metabox-holder columns-2">
41
  <div id="post-body-content">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  <div class="meta-box-sortables ui-sortable">
43
  <div class="postbox">
44
  <h2>Version 4.2.5</h2>
39
  <div id="poststuff">
40
  <div id="post-body" class="metabox-holder columns-2">
41
  <div id="post-body-content">
42
+ <div class="meta-box-sortables ui-sortable">
43
+ <div class="postbox">
44
+ <h2>Version 4.2.6</h2>
45
+ <div class="inside">
46
+ <ul>
47
+ <li>Add support for <a href="<?php
48
+ echo admin_url( 'admin.php?page=wp-fail2ban-tools' ) ;
49
+ ?>">Remote Tools</a> add-on.
50
+ <li>Add support for the new ClassicPress security page.</li>
51
+ <li>Improved user enumeration blocking.</li>
52
+ </ul>
53
+ </div>
54
+ </div>
55
+ </div>
56
  <div class="meta-box-sortables ui-sortable">
57
  <div class="postbox">
58
  <h2>Version 4.2.5</h2>
feature/user-enum.php CHANGED
@@ -102,3 +102,36 @@ if ( !function_exists( __NAMESPACE__ . '\\rest_user_query' ) ) {
102
  2
103
  );
104
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
102
  2
103
  );
104
  }
105
+
106
+ /**
107
+ * @since 4.2.6 Guard
108
+ */
109
+
110
+ if ( !function_exists( __NAMESPACE__ . '\\oembed_response_data' ) ) {
111
+ /**
112
+ *
113
+ * @see \get_oembed_response_data()
114
+ *
115
+ * @since 4.2.6
116
+ *
117
+ * @param array $data The response data.
118
+ * @param WP_Post $post The post object.
119
+ * @param int $width The requested width.
120
+ * @param int $height The calculated height.
121
+ *
122
+ * @return array
123
+ */
124
+ function oembed_response_data(
125
+ $data,
126
+ $post,
127
+ $width,
128
+ $height
129
+ )
130
+ {
131
+ unset( $data['author_name'] );
132
+ unset( $data['author_url'] );
133
+ return $data;
134
+ }
135
+
136
+ add_filter( 'oembed_response_data', __NAMESPACE__ . '\\oembed_response_data' );
137
+ }
filters.d/wordpress-extra.conf CHANGED
@@ -1,5 +1,5 @@
1
  # Fail2Ban filter for WordPress extra failures
2
- # Auto-generated: 2019-07-15T18:00:14+00:00
3
  #
4
 
5
  [INCLUDES]
1
  # Fail2Ban filter for WordPress extra failures
2
+ # Auto-generated: 2019-09-23T21:28:58+00:00
3
  #
4
 
5
  [INCLUDES]
filters.d/wordpress-hard.conf CHANGED
@@ -1,5 +1,5 @@
1
  # Fail2Ban filter for WordPress hard failures
2
- # Auto-generated: 2019-07-15T18:00:14+00:00
3
  #
4
 
5
  [INCLUDES]
1
  # Fail2Ban filter for WordPress hard failures
2
+ # Auto-generated: 2019-09-23T21:28:58+00:00
3
  #
4
 
5
  [INCLUDES]
filters.d/wordpress-soft.conf CHANGED
@@ -1,5 +1,5 @@
1
  # Fail2Ban filter for WordPress soft failures
2
- # Auto-generated: 2019-07-15T18:00:14+00:00
3
  #
4
 
5
  [INCLUDES]
1
  # Fail2Ban filter for WordPress soft failures
2
+ # Auto-generated: 2019-09-23T21:28:58+00:00
3
  #
4
 
5
  [INCLUDES]
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: https://wp-fail2ban.com/
6
  Tags: fail2ban, login, security, syslog
7
  Requires at least: 4.2
8
  Tested up to: 5.2
9
- Stable tag: 4.2.5
10
  Requires PHP: 5.3
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -26,10 +26,16 @@ Write a myriad of WordPress events to syslog for integration with fail2ban.
26
 
27
  = Features =
28
 
 
 
 
 
 
29
  * **NEW - Support for 3rd-party Plugins**
30
  Version 4.2 introduces a simple API for authors to integrate their plugins with *WPf2b*, with 2 *experimental* add-ons:
31
  * [Contact Form 7](https://wordpress.org/plugins/wp-fail2ban-addon-contact-form-7/)
32
  * [Gravity Forms](https://wordpress.org/plugins/wp-fail2ban-addon-gravity-forms/)
 
33
  **NB:** Requires PHP >= 5.6
34
 
35
  * **CloudFlare and Proxy Servers**
@@ -64,6 +70,14 @@ Write a myriad of WordPress events to syslog for integration with fail2ban.
64
 
65
  == Changelog ==
66
 
 
 
 
 
 
 
 
 
67
  = 4.2.5 =
68
  * Properly fix PHP 5.3 support; tested on CentOS 6. Does not support any UI or Premium features.
69
  * Fix potential issue with `WP_FAIL2BAN_BLOCK_USER_ENUMERATION` if calling REST API or XMLRPC from admin area.
@@ -207,6 +221,12 @@ Write a myriad of WordPress events to syslog for integration with fail2ban.
207
 
208
  == Upgrade Notice ==
209
 
 
 
 
 
 
 
210
  = 4.2.5 =
211
  This is a minor release. You do not need to update your filters from 4.1.0.
212
 
6
  Tags: fail2ban, login, security, syslog
7
  Requires at least: 4.2
8
  Tested up to: 5.2
9
+ Stable tag: 4.2.6
10
  Requires PHP: 5.3
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
26
 
27
  = Features =
28
 
29
+ * **NEW - Remote Tools Add-on**
30
+ The Remote Tools add-on provides extra features without adding bloat to the core plugin. For more details see the [add-on page](https://wp-fail2ban.com/add-ons/remote-tools/).
31
+
32
+ **NB:** Requires PHP >= 5.6
33
+
34
  * **NEW - Support for 3rd-party Plugins**
35
  Version 4.2 introduces a simple API for authors to integrate their plugins with *WPf2b*, with 2 *experimental* add-ons:
36
  * [Contact Form 7](https://wordpress.org/plugins/wp-fail2ban-addon-contact-form-7/)
37
  * [Gravity Forms](https://wordpress.org/plugins/wp-fail2ban-addon-gravity-forms/)
38
+
39
  **NB:** Requires PHP >= 5.6
40
 
41
  * **CloudFlare and Proxy Servers**
70
 
71
  == Changelog ==
72
 
73
+ = 4.2.6 =
74
+ * Add support for [Remote Tools](https://wp-fail2ban.com/add-ons/remote-tools/) add-on.
75
+ * Add support for the new ClassicPress security page.
76
+ * Improved user enumeration blocking.
77
+
78
+ = 4.2.5.1 =
79
+ * Fix premium activation issue with PHP < 7.0.
80
+
81
  = 4.2.5 =
82
  * Properly fix PHP 5.3 support; tested on CentOS 6. Does not support any UI or Premium features.
83
  * Fix potential issue with `WP_FAIL2BAN_BLOCK_USER_ENUMERATION` if calling REST API or XMLRPC from admin area.
221
 
222
  == Upgrade Notice ==
223
 
224
+ = 4.2.6 =
225
+ This is a minor release. You do not need to update your filters from 4.1.0.
226
+
227
+ = 4.2.5.1 =
228
+ This is a premium-only patch release. If you are on PHP 7.0 or later you do not need to upgrade.
229
+
230
  = 4.2.5 =
231
  This is a minor release. You do not need to update your filters from 4.1.0.
232
 
vendor/freemius/wordpress-sdk/assets/img/wp-fail2ban.png ADDED
Binary file
vendor/freemius/wordpress-sdk/templates/pricing.php CHANGED
@@ -88,7 +88,6 @@
88
  // Billing cycle.
89
  'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
90
  'is_network_admin' => fs_is_network_admin() ? 'true' : 'false',
91
- 'currency' => $fs->apply_filters( 'default_currency', 'usd' ),
92
  ) );
93
 
94
  if ( ! $fs->is_registered() ) {
88
  // Billing cycle.
89
  'billing_cycle' => fs_request_get( 'billing_cycle', WP_FS__PERIOD_ANNUALLY ),
90
  'is_network_admin' => fs_is_network_admin() ? 'true' : 'false',
 
91
  ) );
92
 
93
  if ( ! $fs->is_registered() ) {
wp-fail2ban.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin URI: https://wp-fail2ban.com/
6
  * Description: Write a myriad of WordPress events to syslog for integration with fail2ban.
7
  * Text Domain: wp-fail2ban
8
- * Version: 4.2.5
9
  * Author: Charles Lecklider
10
  * Author URI: https://charles.lecklider.org/
11
  * License: GPLv2
@@ -39,67 +39,70 @@ namespace org\lecklider\charles\wordpress\wp_fail2ban;
39
  /**
40
  * @since 4.0.5
41
  */
42
- define( 'WP_FAIL2BAN_VER', '4.2.5' );
43
  define( 'WP_FAIL2BAN_FILE', __FILE__ );
44
- /**
45
- * Freemius integration
46
- *
47
- * @since 4.0.0
48
- */
49
 
50
- if ( function_exists( __NAMESPACE__ . '\\wf_fs' ) ) {
51
- // @codeCoverageIgnoreStart
52
- wf_fs()->set_basename( false, __FILE__ );
53
- return;
54
- } else {
55
  /**
56
- * Create a helper function for easy SDK access.
 
 
57
  */
58
- function wf_fs()
59
- {
60
- global $wf_fs ;
61
-
62
- if ( !isset( $wf_fs ) ) {
63
- // Include Freemius SDK.
64
- require_once dirname( __FILE__ ) . '/vendor/freemius/wordpress-sdk/start.php';
65
- $wf_fs = fs_dynamic_init( array(
66
- 'id' => '3072',
67
- 'slug' => 'wp-fail2ban',
68
- 'type' => 'plugin',
69
- 'public_key' => 'pk_146d2c2a5bee3b157e43501ef8682',
70
- 'is_premium' => false,
71
- 'has_addons' => true,
72
- 'has_paid_plans' => true,
73
- 'trial' => array(
74
- 'days' => 7,
75
- 'is_require_payment' => false,
76
- ),
77
- 'menu' => array(
78
- 'slug' => 'wp-fail2ban',
79
- 'first-path' => 'admin.php?page=wp-fail2ban',
80
- 'support' => false,
81
- ),
82
- 'is_live' => true,
83
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
84
  }
85
 
86
- return $wf_fs;
 
 
 
 
 
 
 
87
  }
88
 
89
- // Init Freemius.
90
- wf_fs();
91
- // Set currency to GBP
92
- wf_fs()->add_filter( 'default_currency', function () {
93
- return 'gbp';
94
- } );
95
- // Signal that SDK was initiated.
96
- do_action( 'wf_fs_loaded' );
97
  }
98
-
99
- // @codeCoverageIgnoreEnd
100
- /**
101
- * Freemius insists on mangling the formatting of the main plugin file
102
- *
103
- * @since 4.0.0 Refactored
104
- */
105
- require_once 'wp-fail2ban-main.php';
5
  * Plugin URI: https://wp-fail2ban.com/
6
  * Description: Write a myriad of WordPress events to syslog for integration with fail2ban.
7
  * Text Domain: wp-fail2ban
8
+ * Version: 4.2.6
9
  * Author: Charles Lecklider
10
  * Author URI: https://charles.lecklider.org/
11
  * License: GPLv2
39
  /**
40
  * @since 4.0.5
41
  */
42
+ define( 'WP_FAIL2BAN_VER', '4.2.6' );
43
  define( 'WP_FAIL2BAN_FILE', __FILE__ );
 
 
 
 
 
44
 
45
+ if ( defined( 'ABSPATH' ) ) {
 
 
 
 
46
  /**
47
+ * Freemius integration
48
+ *
49
+ * @since 4.0.0
50
  */
51
+
52
+ if ( function_exists( __NAMESPACE__ . '\\wf_fs' ) ) {
53
+ // @codeCoverageIgnoreStart
54
+ wf_fs()->set_basename( false, __FILE__ );
55
+ return;
56
+ } else {
57
+ /**
58
+ * Create a helper function for easy SDK access.
59
+ */
60
+ function wf_fs()
61
+ {
62
+ global $wf_fs ;
63
+
64
+ if ( !isset( $wf_fs ) ) {
65
+ // Include Freemius SDK.
66
+ require_once dirname( __FILE__ ) . '/vendor/freemius/wordpress-sdk/start.php';
67
+ $wf_fs = fs_dynamic_init( array(
68
+ 'id' => '3072',
69
+ 'slug' => 'wp-fail2ban',
70
+ 'type' => 'plugin',
71
+ 'public_key' => 'pk_146d2c2a5bee3b157e43501ef8682',
72
+ 'is_premium' => false,
73
+ 'has_addons' => true,
74
+ 'has_paid_plans' => true,
75
+ 'trial' => array(
76
+ 'days' => 14,
77
+ 'is_require_payment' => false,
78
+ ),
79
+ 'menu' => array(
80
+ 'slug' => 'wp-fail2ban',
81
+ 'first-path' => 'admin.php?page=wp-fail2ban',
82
+ 'support' => false,
83
+ ),
84
+ 'is_live' => true,
85
+ ) );
86
+ }
87
+
88
+ return $wf_fs;
89
  }
90
 
91
+ // Init Freemius.
92
+ wf_fs();
93
+ // Set currency to GBP
94
+ wf_fs()->add_filter( 'default_currency', function () {
95
+ return 'gbp';
96
+ } );
97
+ // Signal that SDK was initiated.
98
+ do_action( 'wf_fs_loaded' );
99
  }
100
 
101
+ // @codeCoverageIgnoreEnd
102
+ /**
103
+ * Freemius insists on mangling the formatting of the main plugin file
104
+ *
105
+ * @since 4.0.0 Refactored
106
+ */
107
+ require_once 'wp-fail2ban-main.php';
 
108
  }