WP fail2ban - Version 4.0.2

Version Description

  • Fix PHP 5.3 compatibility.
  • Bugfix for WP_FAIL2BAN_LOG_COMMENTS_EXTRA.
  • Bugfix for WP_FAIL2BAN_REMOTE_ADDR summary.
Download this release

Release Info

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

Code changes from version 4.0.1 to 4.0.2

admin/summary.php CHANGED
@@ -56,7 +56,7 @@ function _doc_link($define, $name)
56
  */
57
  function _get_log_facility($facility)
58
  {
59
- $facilities = [
60
  LOG_AUTH => 'LOG_AUTH',
61
  LOG_AUTHPRIV => 'LOG_AUTHPRIV',
62
  LOG_CRON => 'LOG_CRON',
@@ -76,7 +76,7 @@ function _get_log_facility($facility)
76
  LOG_SYSLOG => 'LOG_SYSLOG',
77
  LOG_USER => 'LOG_USER',
78
  LOG_UUCP => 'LOG_UUCP',
79
- ];
80
 
81
  return (array_key_exists($facility, $facilities))
82
  ? $facilities[$facility]
@@ -97,13 +97,13 @@ function _log($name, $enabled, $location)
97
  {
98
  ?>
99
  <tr>
100
- <th><?=_doc_link($enabled, $name)?></th>
101
  <?php if (defined($enabled) && true === constant($enabled)) : ?>
102
- <td><?=__('Yes')?></td>
103
- <th><?=__('Facility')?></th>
104
- <td><?=_get_log_facility(constant($location))?> <?=(constant($location) == constant("DEFAULT_$location")) ? ' <em>('.__('default').')</em>' : ''?></td>
105
  <?php else : ?>
106
- <td><?=__('No')?></td>
107
  <?php endif; ?>
108
  </tr>
109
  <?php
@@ -121,7 +121,7 @@ function _log_options()
121
  ? WP_FAIL2BAN_OPENLOG_OPTIONS
122
  : DEFAULT_WP_FAIL2BAN_OPENLOG_OPTIONS;
123
 
124
- $opts = [];
125
  (LOG_CONS == ($options & LOG_CONS)) and $opts[] = 'LOG_CONS';
126
  (LOG_PERROR == ($options & LOG_PERROR)) and $opts[] = 'LOG_PERROR';
127
  (LOG_PID == ($options & LOG_PID)) and $opts[] = 'LOG_PID';
@@ -129,10 +129,10 @@ function _log_options()
129
  (LOG_ODELAY == ($options & LOG_ODELAY)) and $opts[] = 'LOG_ODELAY';
130
  ?>
131
  <tr>
132
- <th><?=_doc_link('WP_FAIL2BAN_OPENLOG_OPTIONS', __('Connection'))?></th>
133
- <td colspan="3"><?=sprintf((DEFAULT_WP_FAIL2BAN_OPENLOG_OPTIONS == $options)
134
  ? '%s <em>(%s)</em>'
135
- : '%s', join(', ', $opts), __('default'))?></td>
136
  </tr>
137
  <?php
138
  }
@@ -157,7 +157,7 @@ function _yes_no_array($name, $option, $ary = false)
157
  ? constant($option)
158
  : trim(' "', explode(',', constant($option)));
159
  } else {
160
- $items = ['-'];
161
  }
162
  $td = join(', ', $items);
163
  } elseif (is_null($ary)) {
@@ -190,7 +190,7 @@ ___YNA___;
190
  */
191
  function summary()
192
  {
193
- ?>
194
  <div class="wrap">
195
  <style>
196
  table.form-table a {
@@ -198,13 +198,37 @@ function summary()
198
  }
199
  </style>
200
  <h1>WP fail2ban - Summary</h1>
201
- <?php if (wf_fs()->is_not_paying()) : ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
202
  <p>Do you want a simple GUI to change these settings?</p>
203
  <p>Do you want reports on where and when attacks are happening?</p>
204
- <p><a href="<?=wf_fs()->get_upgrade_url()?>">Upgrade now!</a></p>
205
  <hr>
206
- <?php endif; ?>
207
- <h2><?=__('Logging')?></h2>
 
208
  <table class="form-table">
209
  <tbody>
210
  <?php
@@ -216,7 +240,7 @@ function summary()
216
  ?>
217
  </tbody>
218
  </table>
219
- <h3><?=__('Workarounds')?></h3>
220
  <table class="form-table">
221
  <tbody>
222
  <?php
@@ -227,7 +251,7 @@ function summary()
227
  </tbody>
228
  </table>
229
  <hr>
230
- <h2><?=__('Block')?></h2>
231
  <table class="form-table">
232
  <tbody>
233
  <?php
@@ -237,12 +261,12 @@ function summary()
237
  </tbody>
238
  </table>
239
  <hr>
240
- <h2><?=__('Misc')?></h2>
241
  <table class="form-table">
242
  <tbody>
243
  <?php
244
  _yes_no_array(__('Proxies'), 'WP_FAIL2BAN_PROXIES', true);
245
- _yes_no_array(__('Remote Address'), 'WP_FAIL2BAN_REMOTE_ADDR');
246
  ?>
247
  </tbody>
248
  </table>
56
  */
57
  function _get_log_facility($facility)
58
  {
59
+ $facilities = array(
60
  LOG_AUTH => 'LOG_AUTH',
61
  LOG_AUTHPRIV => 'LOG_AUTHPRIV',
62
  LOG_CRON => 'LOG_CRON',
76
  LOG_SYSLOG => 'LOG_SYSLOG',
77
  LOG_USER => 'LOG_USER',
78
  LOG_UUCP => 'LOG_UUCP',
79
+ );
80
 
81
  return (array_key_exists($facility, $facilities))
82
  ? $facilities[$facility]
97
  {
98
  ?>
99
  <tr>
100
+ <th><?php echo _doc_link($enabled, $name); ?></th>
101
  <?php if (defined($enabled) && true === constant($enabled)) : ?>
102
+ <td><?php _e('Yes'); ?></td>
103
+ <th><?php _e('Facility'); ?></th>
104
+ <td><?php echo _get_log_facility(constant($location))?> <?php echo (constant($location) == constant("DEFAULT_$location")) ? ' <em>('.__('default').')</em>' : ''; ?></td>
105
  <?php else : ?>
106
+ <td><?php _e('No'); ?></td>
107
  <?php endif; ?>
108
  </tr>
109
  <?php
121
  ? WP_FAIL2BAN_OPENLOG_OPTIONS
122
  : DEFAULT_WP_FAIL2BAN_OPENLOG_OPTIONS;
123
 
124
+ $opts = array();
125
  (LOG_CONS == ($options & LOG_CONS)) and $opts[] = 'LOG_CONS';
126
  (LOG_PERROR == ($options & LOG_PERROR)) and $opts[] = 'LOG_PERROR';
127
  (LOG_PID == ($options & LOG_PID)) and $opts[] = 'LOG_PID';
129
  (LOG_ODELAY == ($options & LOG_ODELAY)) and $opts[] = 'LOG_ODELAY';
130
  ?>
131
  <tr>
132
+ <th><?php echo _doc_link('WP_FAIL2BAN_OPENLOG_OPTIONS', __('Connection')); ?></th>
133
+ <td colspan="3"><?php sprintf((DEFAULT_WP_FAIL2BAN_OPENLOG_OPTIONS == $options)
134
  ? '%s <em>(%s)</em>'
135
+ : '%s', join(', ', $opts), __('default')); ?></td>
136
  </tr>
137
  <?php
138
  }
157
  ? constant($option)
158
  : trim(' "', explode(',', constant($option)));
159
  } else {
160
+ $items = array('-');
161
  }
162
  $td = join(', ', $items);
163
  } elseif (is_null($ary)) {
190
  */
191
  function summary()
192
  {
193
+ ?>
194
  <div class="wrap">
195
  <style>
196
  table.form-table a {
198
  }
199
  </style>
200
  <h1>WP fail2ban - Summary</h1>
201
+ <?php if (wf_fs()->is_not_paying()):
202
+ $ver = PHP_VERSION;
203
+ if (version_compare($ver, '7.1.0', '<')):
204
+ $wp = '<p>WordPress will <a href="https://make.wordpress.org/core/2018/12/08/updating-the-minimum-php-version/">soon require</a> at least PHP 5.6.</p>';
205
+ ?>
206
+ <h2>Please <a href="https://wordpress.org/support/update-php/">update PHP!</a></h2>
207
+ <?php if (version_compare($ver, '5.4.0', '<')): ?>
208
+ <p>Support for PHP 5.3 ended 14 Aug 2014.</p>
209
+ <p><em>WP fail2ban Premium</em> currently requires at least PHP 5.4.</p>
210
+ <?php echo $wp; ?>
211
+ <?php elseif (version_compare($ver, '5.5.0', '<')): ?>
212
+ <p>Support for PHP 5.4 ended 3 Sep 2015.</p>
213
+ <?php echo $wp; ?>
214
+ <?php elseif (version_compare($ver, '5.6.0', '<')): ?>
215
+ <p>Support for PHP 5.5 ended 21 Jul 2016.</p>
216
+ <?php echo $wp; ?>
217
+ <?php elseif (version_compare($ver, '7.0.0', '<')): ?>
218
+ <p>Support for PHP 5.6 ended 31 Dec 2018.</p>
219
+ <?php else: ?>
220
+ <p>Support for PHP 7.0 ended 3 Dec 2018.</p>
221
+ <?php endif; ?>
222
+ <hr>
223
+ <?php endif; ?>
224
+ <?php if (version_compare($ver, '5.3.0', '>')): ?>
225
  <p>Do you want a simple GUI to change these settings?</p>
226
  <p>Do you want reports on where and when attacks are happening?</p>
227
+ <p><a href="<?php echo wf_fs()->get_upgrade_url(); ?>">Upgrade now!</a></p>
228
  <hr>
229
+ <?php endif; ?>
230
+ <?php endif; ?>
231
+ <h2><?php _e('Logging'); ?></h2>
232
  <table class="form-table">
233
  <tbody>
234
  <?php
240
  ?>
241
  </tbody>
242
  </table>
243
+ <h3><?php _e('Workarounds'); ?></h3>
244
  <table class="form-table">
245
  <tbody>
246
  <?php
251
  </tbody>
252
  </table>
253
  <hr>
254
+ <h2><?php _e('Block'); ?></h2>
255
  <table class="form-table">
256
  <tbody>
257
  <?php
261
  </tbody>
262
  </table>
263
  <hr>
264
+ <h2><?php _e('Misc'); ?></h2>
265
  <table class="form-table">
266
  <tbody>
267
  <?php
268
  _yes_no_array(__('Proxies'), 'WP_FAIL2BAN_PROXIES', true);
269
+ _yes_no_array(__('Remote Address'), 'WP_FAIL2BAN_REMOTE_ADDR', null);
270
  ?>
271
  </tbody>
272
  </table>
feature/comments.php CHANGED
@@ -89,6 +89,7 @@ if ( defined( 'WP_FAIL2BAN_LOG_COMMENTS_EXTRA' ) ) {
89
  /**
90
  * Log attempted comment on trashed post
91
  *
 
92
  * @since 4.0.0
93
  *
94
  * @param int $comment_post_ID
@@ -98,7 +99,7 @@ if ( defined( 'WP_FAIL2BAN_LOG_COMMENTS_EXTRA' ) ) {
98
  function comment_on_trash( $comment_post_ID )
99
  {
100
  openlog( 'WP_FAIL2BAN_COMMENT_LOG' );
101
- syslog( LOG_INFO, "Comment on trash post {$comment_post_ID}" );
102
  // @codeCoverageIgnoreEnd
103
  }
104
 
@@ -111,6 +112,7 @@ if ( defined( 'WP_FAIL2BAN_LOG_COMMENTS_EXTRA' ) ) {
111
  /**
112
  * Log attempted comment on draft post
113
  *
 
114
  * @since 4.0.0
115
  *
116
  * @param int $comment_post_ID
@@ -120,7 +122,7 @@ if ( defined( 'WP_FAIL2BAN_LOG_COMMENTS_EXTRA' ) ) {
120
  function comment_on_draft( $comment_post_ID )
121
  {
122
  openlog( 'WP_FAIL2BAN_COMMENT_LOG' );
123
- syslog( LOG_INFO, "Comment on draft post {$comment_post_ID}" );
124
  // @codeCoverageIgnoreEnd
125
  }
126
 
@@ -133,6 +135,7 @@ if ( defined( 'WP_FAIL2BAN_LOG_COMMENTS_EXTRA' ) ) {
133
  /**
134
  * Log attempted comment on password-protected post
135
  *
 
136
  * @since 4.0.0
137
  *
138
  * @param int $comment_post_ID
@@ -142,7 +145,7 @@ if ( defined( 'WP_FAIL2BAN_LOG_COMMENTS_EXTRA' ) ) {
142
  function comment_on_password_protected( $comment_post_ID )
143
  {
144
  openlog( 'WP_FAIL2BAN_COMMENT_LOG' );
145
- syslog( LOG_INFO, "Comment on password-protected post {$comment_post_ID}" );
146
  // @codeCoverageIgnoreEnd
147
  }
148
 
89
  /**
90
  * Log attempted comment on trashed post
91
  *
92
+ * @since 4.0.2 Fix message
93
  * @since 4.0.0
94
  *
95
  * @param int $comment_post_ID
99
  function comment_on_trash( $comment_post_ID )
100
  {
101
  openlog( 'WP_FAIL2BAN_COMMENT_LOG' );
102
+ syslog( LOG_INFO, "Comment attempt on trash post {$comment_post_ID}" );
103
  // @codeCoverageIgnoreEnd
104
  }
105
 
112
  /**
113
  * Log attempted comment on draft post
114
  *
115
+ * @since 4.0.2 Fix message
116
  * @since 4.0.0
117
  *
118
  * @param int $comment_post_ID
122
  function comment_on_draft( $comment_post_ID )
123
  {
124
  openlog( 'WP_FAIL2BAN_COMMENT_LOG' );
125
+ syslog( LOG_INFO, "Comment attempt on draft post {$comment_post_ID}" );
126
  // @codeCoverageIgnoreEnd
127
  }
128
 
135
  /**
136
  * Log attempted comment on password-protected post
137
  *
138
+ * @since 4.0.2 Fix message
139
  * @since 4.0.0
140
  *
141
  * @param int $comment_post_ID
145
  function comment_on_password_protected( $comment_post_ID )
146
  {
147
  openlog( 'WP_FAIL2BAN_COMMENT_LOG' );
148
+ syslog( LOG_INFO, "Comment attempt on password-protected post {$comment_post_ID}" );
149
  // @codeCoverageIgnoreEnd
150
  }
151
 
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: https://wp-fail2ban.com/
6
  Tags: fail2ban, login, security, syslog
7
  Requires at least: 3.4
8
  Tested up to: 5.0
9
- Stable tag: 4.0.1
10
  Requires PHP: 5.3
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -22,12 +22,10 @@ Write a myriad of WordPress events to syslog for integration with fail2ban.
22
  Oct 17 20:59:54 foobar wordpress(www.example.com)[1234]: Authentication failure for admin from 192.168.0.1
23
  Oct 17 21:00:00 foobar wordpress(www.example.com)[2345]: Accepted password for admin from 192.168.0.1
24
 
25
- *WPf2b* comes with two `fail2ban` filters, `wordpress-hard.conf` and `wordpress-soft.conf`, designed to allow a split between immediate banning and the traditional more graceful approach.
26
 
27
  = Features =
28
 
29
-
30
-
31
  * **CloudFlare and Proxy Servers**
32
  *WPf2b* can be configured to work with CloudFlare and other proxy servers. For an overview see [`WP_FAIL2BAN_PROXIES`](https://docs.wp-fail2ban.com/en/4.0/defines.html#wp-fail2ban-proxies).
33
 
@@ -60,6 +58,11 @@ Write a myriad of WordPress events to syslog for integration with fail2ban.
60
 
61
  == Changelog ==
62
 
 
 
 
 
 
63
  = 4.0.1 =
64
  * Add extra features via Freemius. **This is entirely optional.** *WPf2b* works as before, including new features listed here.
65
  * Add settings summary page (Settings -> WP fail2ban).
@@ -156,7 +159,10 @@ Write a myriad of WordPress events to syslog for integration with fail2ban.
156
 
157
  == Upgrade Notice ==
158
 
159
- = 4.0.0 =
 
 
 
160
  To take advantage of the new features you will need up update your `fail2ban` filters; existing filters will continue to work as before.
161
 
162
  = 3.6.0 =
6
  Tags: fail2ban, login, security, syslog
7
  Requires at least: 3.4
8
  Tested up to: 5.0
9
+ Stable tag: 4.0.2
10
  Requires PHP: 5.3
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
22
  Oct 17 20:59:54 foobar wordpress(www.example.com)[1234]: Authentication failure for admin from 192.168.0.1
23
  Oct 17 21:00:00 foobar wordpress(www.example.com)[2345]: Accepted password for admin from 192.168.0.1
24
 
25
+ *WPf2b* comes with three `fail2ban` filters: `wordpress-hard.conf`, `wordpress-soft.conf`, and `wordpress-extra.conf`. These are designed to allow a split between immediate banning (hard) and the traditional more graceful approach (soft), with extra rules for custom configurations.
26
 
27
  = Features =
28
 
 
 
29
  * **CloudFlare and Proxy Servers**
30
  *WPf2b* can be configured to work with CloudFlare and other proxy servers. For an overview see [`WP_FAIL2BAN_PROXIES`](https://docs.wp-fail2ban.com/en/4.0/defines.html#wp-fail2ban-proxies).
31
 
58
 
59
  == Changelog ==
60
 
61
+ = 4.0.2 =
62
+ * Fix PHP 5.3 compatibility.
63
+ * Bugfix for WP_FAIL2BAN_LOG_COMMENTS_EXTRA.
64
+ * Bugfix for WP_FAIL2BAN_REMOTE_ADDR summary.
65
+
66
  = 4.0.1 =
67
  * Add extra features via Freemius. **This is entirely optional.** *WPf2b* works as before, including new features listed here.
68
  * Add settings summary page (Settings -> WP fail2ban).
159
 
160
  == Upgrade Notice ==
161
 
162
+ = 4.0.2 =
163
+ This is a bugfix. You do not need to update your filters from 4.0.1.
164
+
165
+ = 4.0.1 =
166
  To take advantage of the new features you will need up update your `fail2ban` filters; existing filters will continue to work as before.
167
 
168
  = 3.6.0 =
vendor/freemius/wordpress-sdk/.codeclimate.yml DELETED
@@ -1,19 +0,0 @@
1
- engines:
2
- phpcodesniffer:
3
- enabled: true
4
- config:
5
- standard: "WordPress"
6
- checks:
7
- Squiz Commenting InlineComment InvalidEndChar:
8
- enabled: false
9
- Squiz Commenting InlineComment SpacingBefore:
10
- enabled: false
11
- Squiz Commenting InlineComment WrongStyle:
12
- enabled: false
13
- Generic Commenting DocComment MissingShort:
14
- enabled: false
15
- Generic WhiteSpace ScopeIndent IncorrectExact:
16
- enabled: false
17
- ratings:
18
- paths:
19
- - "**.php"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/freemius/wordpress-sdk/.travis.yml DELETED
@@ -1,11 +0,0 @@
1
- sudo: false
2
-
3
- language: php
4
-
5
- php:
6
- - 5.3
7
- - 5.4
8
- - 5.5
9
- - 5.6
10
- - 7.0
11
- - hhvm
 
 
 
 
 
 
 
 
 
 
 
vendor/freemius/wordpress-sdk/README.md DELETED
@@ -1,253 +0,0 @@
1
- Freemius WordPress SDK
2
- ======================
3
-
4
- [Monetization](https://freemius.com/wordpress/), [analytics](https://freemius.com/wordpress/insights/), and marketing automation platform for plugin & theme developers. Freemius empower developers to create prosperous subscription based businesses.
5
-
6
- You can see some of the WordPress.org plugins & themes that are utilizing the power of Freemius here:
7
-
8
- https://includewp.com/freemius/#focus
9
-
10
- If you are a WordPress plugin or theme developer and you are interested to monetize with Freemius you can [sign-up here for free](https://dashboard.freemius.com/register/):
11
-
12
- https://dashboard.freemius.com/register/
13
-
14
- **Below you'll find the integration instructions for our WordPress SDK.**
15
-
16
- ## Code Documentation
17
-
18
- You can find the SDK's PHP-Doc documentation here:
19
- https://codedoc.pub/freemius/wordpress-sdk/master/
20
-
21
- ## Initializing the SDK
22
-
23
- Copy the code below and paste it into the top of your main plugin's PHP file, right after the plugin's header comment:
24
-
25
- ```php
26
- <?php
27
- // Create a helper function for easy SDK access.
28
- function my_prefix_fs() {
29
- global $my_prefix_fs;
30
- if ( ! isset( $my_prefix_fs ) ) {
31
- // Include Freemius SDK.
32
- require_once dirname(__FILE__) . '/freemius/start.php';
33
-
34
- $my_prefix_fs = fs_dynamic_init( array(
35
- 'id' => '1234',
36
- 'slug' => 'my-plugin-slug',
37
- 'menu_slug' => 'my_menu_slug', // You can also use __FILE__
38
- 'public_key' => 'pk_MY_PUBLIC_KEY',
39
- 'is_live' => true,
40
- 'is_premium' => true,
41
- 'has_addons' => false,
42
- 'has_paid_plans' => false,
43
- // Set the SDK to work in a sandbox mode (for development & testing).
44
- // IMPORTANT: MAKE SURE TO REMOVE SECRET KEY BEFORE DEPLOYMENT.
45
- 'secret_key' => 'sk_MY_SECRET_KEY',
46
- ) );
47
- }
48
-
49
- return $my_prefix_fs;
50
- }
51
-
52
- // Init Freemius.
53
- my_prefix_fs();
54
- ?>
55
- ```
56
-
57
- - **1234** - Replace with your plugin's ID.
58
- - **pk_MY_PUBLIC_KEY** - Replace with your plugin's public key.
59
- - **sk_MY_SECRET_KEY** - Replace with your plugin's secret key.
60
- - **my-plugin-slug** - Replace with your plugin's WordPress.org slug.
61
- - **my_menu_slug** - Replace with your admin dashboard settings menu slug.
62
-
63
-
64
- ## Usage example
65
-
66
- You can call the SDK by using the shortcode function:
67
-
68
- ```php
69
- <?php my_prefix_fs()->get_upgrade_url(); ?>
70
- ```
71
-
72
- Or when calling Freemius multiple times in a scope, it's recommended to use it with the global variable:
73
-
74
- ```php
75
- <?php
76
- global $my_prefix_fs;
77
- $my_prefix_fs->get_account_url();
78
- ?>
79
- ```
80
-
81
- ## Adding license based logic examples
82
-
83
- Add marketing content to encourage your users to upgrade for your paid version:
84
-
85
- ```php
86
- <?php
87
- if ( my_prefix_fs()->is_not_paying() ) {
88
- echo '<section><h1>' . esc_html__('Awesome Premium Features', 'my-plugin-slug') . '</h1>';
89
- echo '<a href="' . my_prefix_fs()->get_upgrade_url() . '">' .
90
- esc_html__('Upgrade Now!', 'my-plugin-slug') .
91
- '</a>';
92
- echo '</section>';
93
- }
94
- ?>
95
- ```
96
-
97
- Add logic which will only be available in your premium plugin version:
98
-
99
- ```php
100
- <?php
101
- // This "if" block will be auto removed from the Free version.
102
- if ( my_prefix_fs()->is__premium_only() ) {
103
-
104
- // ... premium only logic ...
105
-
106
- }
107
- ?>
108
- ```
109
-
110
- To add a function which will only be available in your premium plugin version, simply add __premium_only as the suffix of the function name. Just make sure that all lines that call that method directly or by hooks, are also wrapped in premium only logic:
111
-
112
- ```php
113
- <?php
114
- class My_Plugin {
115
- function init() {
116
- ...
117
-
118
- // This "if" block will be auto removed from the free version.
119
- if ( my_prefix_fs()->is__premium_only() ) {
120
- // Init premium version.
121
- $this->admin_init__premium_only();
122
-
123
- add_action( 'admin_init', array( &$this, 'admin_init_hook__premium_only' );
124
- }
125
-
126
- ...
127
- }
128
-
129
- // This method will be only included in the premium version.
130
- function admin_init__premium_only() {
131
- ...
132
- }
133
-
134
- // This method will be only included in the premium version.
135
- function admin_init_hook__premium_only() {
136
- ...
137
- }
138
- }
139
- ?>
140
- ```
141
-
142
- Add logic which will only be executed for customers in your 'professional' plan:
143
-
144
- ```php
145
- <?php
146
- if ( my_prefix_fs()->is_plan('professional', true) ) {
147
- // .. logic related to Professional plan only ...
148
- }
149
- ?>
150
- ```
151
-
152
- Add logic which will only be executed for customers in your 'professional' plan or higher plans:
153
-
154
- ```php
155
- <?php
156
- if ( my_prefix_fs()->is_plan('professional') ) {
157
- // ... logic related to Professional plan and higher plans ...
158
- }
159
- ?>
160
- ```
161
-
162
- Add logic which will only be available in your premium plugin version AND will only be executed for customers in your 'professional' plan (and higher plans):
163
-
164
- ```php
165
- <?php
166
- // This "if" block will be auto removed from the Free version.
167
- if ( my_prefix_fs()->is_plan__premium_only('professional') ) {
168
- // ... logic related to Professional plan and higher plans ...
169
- }
170
- ?>
171
- ```
172
-
173
- Add logic only for users in trial:
174
-
175
- ```php
176
- <?php
177
- if ( my_prefix_fs()->is_trial() ) {
178
- // ... logic for users in trial ...
179
- }
180
- ?>
181
- ```
182
-
183
- Add logic for specified paid plan:
184
-
185
- ```php
186
- <?php
187
- // This "if" block will be auto removed from the Free version.
188
- if ( my_prefix_fs()->is__premium_only() ) {
189
- if ( my_prefix_fs()->is_plan( 'professional', true ) ) {
190
-
191
- // ... logic related to Professional plan only ...
192
-
193
- } else if ( my_prefix_fs()->is_plan( 'business' ) ) {
194
-
195
- // ... logic related to Business plan and higher plans ...
196
-
197
- }
198
- }
199
- ?>
200
- ```
201
-
202
- ## Excluding files and folders from the free plugin version
203
- There are two ways to exclude files from your free version.
204
-
205
- 1. Add `__premium_only` just before the file extension. For example, functions__premium_only.php will be only included in the premium plugin version. This works for all type of files, not only PHP.
206
- 2. Add `@fs_premium_only` a sepcial meta tag to the plugin's main PHP file header. Example:
207
- ```php
208
- <?php
209
- /**
210
- * Plugin Name: My Very Awesome Plugin
211
- * Plugin URI: http://my-awesome-plugin.com
212
- * Description: Create and manage Awesomeness right in WordPress.
213
- * Version: 1.0.0
214
- * Author: Awesomattic
215
- * Author URI: http://my-awesome-plugin.com/me/
216
- * License: GPLv2
217
- * Text Domain: myplugin
218
- * Domain Path: /langs
219
- *
220
- * @fs_premium_only /lib/functions.php, /premium-files/
221
- */
222
-
223
- if ( ! defined( 'ABSPATH' ) ) {
224
- exit;
225
- }
226
-
227
- // ... my code ...
228
- ?>
229
- ```
230
- The file `/lib/functions.php` and the directory `/premium-files/` will be removed from the free plugin version.
231
-
232
- # WordPress.org Compliance
233
- Based on [WordPress.org Guidelines](https://wordpress.org/plugins/about/guidelines/) you are not allowed to submit a plugin that has premium code in it:
234
- > All code hosted by WordPress.org servers must be free and fully-functional. If you want to sell advanced features for a plugin (such as a "pro" version), then you must sell and serve that code from your own site, we will not host it on our servers.
235
-
236
- Therefore, if you want to deploy your free plugin's version to WordPress.org, make sure you wrap all your premium code with `if ( my_prefix_fs()->{{ method }}__premium_only() )` or the other methods provided to exclude premium features & files from the free version.
237
-
238
- ## Deployment
239
- Zip your plugin's root folder and upload it in the Deployment section in the *Freemius Developer's Dashboard*.
240
- The plugin will be scanned and processed by a custom developed *PHP Processor* which will auto-generate two versions of your plugin:
241
-
242
- 1. **Premium version**: Identical to your uploaded version, including all code (except your `secret_key`). Will be enabled for download ONLY for your paying or in trial customers.
243
- 2. **Free version**: The code stripped from all your paid features (based on the logic added wrapped in `{ method }__premium_only()`).
244
-
245
- The free version is the one that you should give your users to download. Therefore, download the free generated version and upload to your site. Or, if your plugin was WordPress.org complaint and you made sure to exclude all your premium code with the different provided techniques, you can deploy the downloaded free version to the .org repo.
246
-
247
- ## Reporting Bugs
248
- Email dev [at] freemius [dot] com
249
-
250
- ## FAQ
251
-
252
- ## Copyright
253
- Freemius, Inc.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/freemius/wordpress-sdk/composer.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "name": "freemius/wordpress-sdk",
3
- "description": "Freemius WordPress SDK",
4
- "keywords": ["freemius", "wordpress", "plugin", "sdk"],
5
- "homepage": "https://freemius.com",
6
- "license": "GPL-3.0-only",
7
- "require": {
8
- "php": ">=5.2"
9
- }
10
- }
 
 
 
 
 
 
 
 
 
 
vendor/freemius/wordpress-sdk/gulpfile.js DELETED
@@ -1,167 +0,0 @@
1
- var gulp = require('gulp');
2
- var path = require('path');
3
- var filesystem = require('fs');
4
- var wpPot = require('gulp-wp-pot');
5
- var gettext = require('gulp-gettext');
6
- var sort = require('gulp-sort');
7
- var pofill = require('gulp-pofill');
8
- var rename = require('gulp-rename');
9
- var clean = require('gulp-clean');
10
-
11
- var languagesFolder = './languages/';
12
-
13
- var options = require('./transifex-config.json');
14
-
15
- function getFolders(dir) {
16
- return filesystem.readdirSync(dir)
17
- .filter(function (file) {
18
- return filesystem.statSync(path.join(dir, file)).isDirectory();
19
- });
20
- }
21
-
22
- var transifex = require('gulp-transifex').createClient(options);
23
-
24
- // Create POT out of i18n.php.
25
- gulp.task('prepare-source', function () {
26
- gulp.src('**/*.php')
27
- .pipe(sort())
28
- .pipe(wpPot({
29
- destFile : 'freemius.pot',
30
- package : 'freemius',
31
- bugReport : 'https://github.com/Freemius/wordpress-sdk/issues',
32
- lastTranslator : 'Vova Feldman <vova@freemius.com>',
33
- team : 'Freemius Team <admin@freemius.com>',
34
- /*gettextMethods: {
35
- instances: ['this', '_fs'],
36
- methods: [
37
- 'get_text_inline'
38
- ]
39
- },*/
40
- gettextFunctions: [
41
- {name: 'get_text_inline'},
42
-
43
- {name: 'fs_text_inline'},
44
- {name: 'fs_echo_inline'},
45
- {name: 'fs_esc_js_inline'},
46
- {name: 'fs_esc_attr_inline'},
47
- {name: 'fs_esc_attr_echo_inline'},
48
- {name: 'fs_esc_html_inline'},
49
- {name: 'fs_esc_html_echo_inline'},
50
-
51
- {name: 'get_text_x_inline', context: 2},
52
- {name: 'fs_text_x_inline', context: 2},
53
- {name: 'fs_echo_x_inline', context: 2},
54
- {name: 'fs_esc_attr_x_inline', context: 2},
55
- {name: 'fs_esc_js_x_inline', context: 2},
56
- {name: 'fs_esc_js_echo_x_inline', context: 2},
57
- {name: 'fs_esc_html_x_inline', context: 2},
58
- {name: 'fs_esc_html_echo_x_inline', context: 2}
59
- /*,
60
-
61
-
62
- {name: '_fs_text'},
63
- {name: '_fs_x', context: 2},
64
- {name: '_fs_echo'},
65
- {name: '_fs_esc_attr'},
66
- {name: '_fs_esc_attr_echo'},
67
- {name: '_fs_esc_html'},
68
- {name: '_fs_esc_html_echo'},
69
- {name: '_fs_ex', context: 2},
70
- {name: '_fs_esc_attr_x', context: 2},
71
- {name: '_fs_esc_html_x', context: 2},
72
-
73
- {name: '_fs_n', plural: 2},
74
- {name: '_fs_n_noop', plural: 2},
75
- {name: '_fs_nx', plural: 2, context: 4},
76
- {name: '_fs_nx_noop', plural: 2, context: 3}*/
77
- ]
78
- }))
79
- .pipe(gulp.dest(languagesFolder + 'freemius.pot'));
80
-
81
- // Create English PO out of the POT.
82
- return gulp.src(languagesFolder + 'freemius.pot')
83
- .pipe(pofill({
84
- items: function (item) {
85
- // If msgstr is empty, use identity translation
86
- if (!item.msgstr.length) {
87
- item.msgstr = [''];
88
- }
89
- if (!item.msgstr[0]) {
90
- item.msgstr[0] = item.msgid;
91
- }
92
- return item;
93
- }
94
- }))
95
- .pipe(rename('freemius-en.po'))
96
- .pipe(gulp.dest(languagesFolder));
97
- });
98
-
99
- // Push updated po resource to transifex.
100
- gulp.task('update-transifex', ['prepare-source'], function () {
101
- return gulp.src(languagesFolder + 'freemius-en.po')
102
- .pipe(transifex.pushResource());
103
- });
104
-
105
- // Download latest *.po translations.
106
- gulp.task('download-translations', ['update-transifex'], function () {
107
- return gulp.src(languagesFolder + 'freemius-en.po')
108
- .pipe(transifex.pullResource());
109
- });
110
-
111
- // Move translations to languages root.
112
- gulp.task('prepare-translations', ['download-translations'], function () {
113
- var folders = getFolders(languagesFolder);
114
-
115
- return folders.map(function (folder) {
116
- return gulp.src(path.join(languagesFolder, folder, 'freemius-en.po'))
117
- .pipe(rename('freemius-' + folder + '.po'))
118
- .pipe(gulp.dest(languagesFolder));
119
- });
120
- });
121
-
122
- // Feel up empty translations with English.
123
- gulp.task('translations-feelup', ['prepare-translations'], function () {
124
- return gulp.src(languagesFolder + '*.po')
125
- .pipe(pofill({
126
- items: function (item) {
127
- // If msgstr is empty, use identity translation
128
- if (0 == item.msgstr.length) {
129
- item.msgstr = [''];
130
- }
131
- if (0 == item.msgstr[0].length) {
132
- // item.msgid[0] = item.msgid;
133
- item.msgstr[0] = item.msgid;
134
- }
135
- return item;
136
- }
137
- }))
138
- .pipe(gulp.dest(languagesFolder));
139
- });
140
-
141
- // Cleanup temporary translation folders.
142
- gulp.task('cleanup', ['prepare-translations'], function () {
143
- var folders = getFolders(languagesFolder);
144
-
145
- return folders.map(function (folder) {
146
- return gulp.src(path.join(languagesFolder, folder), {read: false})
147
- .pipe(clean());
148
- });
149
- });
150
-
151
- // Compile *.po to *.mo binaries for usage.
152
- gulp.task('compile-translations', ['translations-feelup'], function () {
153
- // Compile POs to MOs.
154
- return gulp.src(languagesFolder + '*.po')
155
- .pipe(gettext())
156
- .pipe(gulp.dest(languagesFolder))
157
- });
158
-
159
- gulp.task('default', [], function () {
160
- gulp.run('prepare-source');
161
- gulp.run('update-transifex');
162
- gulp.run('download-translations');
163
- gulp.run('prepare-translations');
164
- gulp.run('translations-feelup');
165
- gulp.run('cleanup');
166
- gulp.run('compile-translations');
167
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
vendor/freemius/wordpress-sdk/package.json DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "name": "freemius-wordpress-sdk",
3
- "description": "Monetization, analytics, and marketing automation platform for plugin & theme developers.",
4
- "author": "Freemius, Inc.",
5
- "license": "GPL-3.0",
6
- "homepage": "https://freemius.com",
7
- "version": "2.1.2",
8
- "main": "gulpfile.js",
9
- "dependencies": {},
10
- "scripts": {
11
- "test": "echo \"Error: no test specified\" && exit 1",
12
- "prune": "rimraf .codeclimate.yml .git .github .gitignore .travis.yml gulpfile.js composer.json"
13
- },
14
- "repository": "Freemius/wordpress-sdk.git",
15
- "devDependencies": {
16
- "gulp": "^3.9.1",
17
- "gulp-clean": "^0.3.2",
18
- "gulp-fs": "0.0.2",
19
- "gulp-gettext": "^0.3.0",
20
- "gulp-path": "^3.0.3",
21
- "gulp-pofill": "^1.0.0",
22
- "gulp-rename": "^1.2.2",
23
- "gulp-sort": "^2.0.0",
24
- "gulp-transifex": "^0.1.17",
25
- "gulp-wp-pot": "^1.3.5"
26
- }
27
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.0.1
9
  * Author: Charles Lecklider
10
  * Author URI: https://charles.lecklider.org/
11
  * License: GPLv2
@@ -44,7 +44,7 @@ global $wp_fail2ban ;
44
  if ( empty($wp_fail2ban) && defined( 'WP_FAIL2BAN' ) ) {
45
  return;
46
  }
47
- define( 'WP_FAIL2BAN', '4.0.1' );
48
  /**
49
  * Freemius integration
50
  *
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.0.2
9
  * Author: Charles Lecklider
10
  * Author URI: https://charles.lecklider.org/
11
  * License: GPLv2
44
  if ( empty($wp_fail2ban) && defined( 'WP_FAIL2BAN' ) ) {
45
  return;
46
  }
47
+ define( 'WP_FAIL2BAN', '4.0.2' );
48
  /**
49
  * Freemius integration
50
  *