Anti-spam - Version 6.5.1

Version Description

  • 16.12.2019 =
  • Added: Multisite support.
  • Fixed: Bug with redirection loop in multisite mode.
  • Fixed: Readme. GDPR compatibility is ready. Plugin doesn't send any data to the remote server.
  • Removed: Dashboard widget with annoy ads.
Download this release

Release Info

Developer alexkovalevv
Plugin Icon 128x128 Anti-spam
Version 6.5.1
Comparing to
See all releases

Code changes from version 5.5 to 6.5.1

Files changed (212) hide show
  1. admin/ajax/index.php +2 -0
  2. admin/ajax/logs.php +24 -0
  3. admin/assets/css/settings.css +29 -0
  4. admin/assets/css/settings.css.map +1 -0
  5. admin/assets/css/settings.less +36 -0
  6. admin/assets/img/about-preview.jpg +0 -0
  7. admin/assets/js/settings.js +24 -0
  8. admin/boot.php +100 -0
  9. admin/class-activation.php +73 -0
  10. admin/pages/class-pages-about.php +132 -0
  11. admin/pages/class-pages-license.php +67 -0
  12. admin/pages/class-pages-logs.php +122 -0
  13. admin/pages/class-pages-settings.php +190 -0
  14. anti-spam-functions.php +0 -135
  15. anti-spam-settings.php +0 -89
  16. anti-spam.php +133 -75
  17. {js → assets/js}/anti-spam-5.5.js +5 -0
  18. anti-spam-info.php → includes/__anti-spam-info.php +0 -0
  19. includes/class-anti-spam-plugin.php +140 -0
  20. includes/class-protector.php +220 -0
  21. includes/functions.php +82 -0
  22. includes/logger/assets/css/base.css +20 -0
  23. includes/logger/assets/css/base.css.map +1 -0
  24. includes/logger/assets/css/base.less +21 -0
  25. includes/logger/assets/js/base.js +39 -0
  26. includes/logger/class-logger-export.php +253 -0
  27. includes/logger/class-logger-reader.php +72 -0
  28. includes/logger/class-logger-writter.php +402 -0
  29. index.php +2 -2
  30. libs/factory/bootstrap/assets/css-min/bootstrap.accordion.min.css +11 -0
  31. libs/factory/bootstrap/assets/css-min/bootstrap.blue.min.css +11 -0
  32. libs/factory/bootstrap/assets/css-min/bootstrap.coffee.min.css +11 -0
  33. libs/factory/bootstrap/assets/css-min/bootstrap.core.min.css +25 -0
  34. libs/factory/bootstrap/assets/css-min/bootstrap.datepicker.min.css +17 -0
  35. libs/factory/bootstrap/assets/css-min/bootstrap.ectoplasm.min.css +11 -0
  36. libs/factory/bootstrap/assets/css-min/bootstrap.form-group.min.css +11 -0
  37. libs/factory/bootstrap/assets/css-min/bootstrap.light.min.css +11 -0
  38. libs/factory/bootstrap/assets/css-min/bootstrap.midnight.min.css +11 -0
  39. libs/factory/bootstrap/assets/css-min/bootstrap.ocean.min.css +11 -0
  40. libs/factory/bootstrap/assets/css-min/bootstrap.separator.min.css +11 -0
  41. libs/factory/bootstrap/assets/css-min/bootstrap.sunrise.min.css +11 -0
  42. libs/factory/bootstrap/assets/css-min/control.checkbox.min.css +11 -0
  43. libs/factory/bootstrap/assets/css-min/control.dropdown.min.css +11 -0
  44. libs/factory/bootstrap/assets/css-min/control.multiple-textbox.min.css +11 -0
  45. libs/factory/bootstrap/assets/css-min/holder.more-link.min.css +11 -0
  46. libs/factory/bootstrap/assets/images/loader-sm-f6f6f6.gif +0 -0
  47. libs/factory/bootstrap/assets/images/loader-sm-tr.gif +0 -0
  48. libs/factory/bootstrap/assets/js-min/bootstrap.dropdown.min.js +10 -0
  49. libs/factory/bootstrap/assets/js-min/bootstrap.tooltip.min.js +10 -0
  50. libs/factory/bootstrap/assets/js-min/control.checkbox.min.js +10 -0
  51. libs/factory/bootstrap/assets/js-min/control.dropdown.min.js +10 -0
  52. libs/factory/bootstrap/assets/js-min/control.list.min.js +10 -0
  53. libs/factory/bootstrap/assets/js-min/control.multiple-textbox.min.js +10 -0
  54. libs/factory/bootstrap/boot.php +46 -0
  55. libs/factory/bootstrap/includes/functions.php +236 -0
  56. libs/factory/bootstrap/includes/index.php +2 -0
  57. libs/factory/bootstrap/index.php +2 -0
  58. libs/factory/clearfy/assets/css/clearfy-base.css +181 -0
  59. libs/factory/clearfy/assets/css/clearfy-base.css.map +1 -0
  60. libs/factory/clearfy/assets/css/clearfy-base.less +170 -0
  61. libs/factory/clearfy/assets/css/license-manager.css +663 -0
  62. libs/factory/clearfy/assets/img/loader.gif +0 -0
  63. libs/factory/clearfy/assets/js/globals.js +203 -0
  64. libs/factory/clearfy/assets/js/license-manager.js +92 -0
  65. libs/factory/clearfy/boot.php +49 -0
  66. libs/factory/clearfy/includes/ajax-handlers.php +101 -0
  67. libs/factory/clearfy/includes/class-configurate.php +116 -0
  68. libs/factory/clearfy/includes/class-helpers.php +266 -0
  69. libs/factory/clearfy/includes/index.php +0 -0
  70. libs/factory/clearfy/index.php +0 -0
  71. libs/factory/clearfy/langs/wbcr_factory_clearfy_216-ru_RU.mo +0 -0
  72. libs/factory/clearfy/langs/wbcr_factory_clearfy_216-ru_RU.po +307 -0
  73. libs/factory/clearfy/pages/class-page-license.php +393 -0
  74. libs/factory/clearfy/pages/class-page-more-features.php +170 -0
  75. libs/factory/clearfy/pages/class-pages.php +439 -0
  76. libs/factory/clearfy/pages/index.php +0 -0
  77. libs/factory/core/README.md +3 -0
  78. libs/factory/core/boot.php +62 -0
  79. libs/factory/core/includes/activation/class-factory-activator.php +43 -0
  80. libs/factory/core/includes/activation/class-factory-update.php +39 -0
  81. libs/factory/core/includes/activation/index.php +2 -0
  82. libs/factory/core/includes/assets-managment/class-factory-assets-list.php +126 -0
  83. libs/factory/core/includes/assets-managment/class-factory-script-list.php +166 -0
  84. libs/factory/core/includes/assets-managment/class-factory-style-list.php +86 -0
  85. libs/factory/core/includes/assets-managment/index.php +2 -0
  86. libs/factory/core/includes/class-check-compatibility.php +122 -0
  87. libs/factory/core/includes/class-factory-migrations.php +541 -0
  88. libs/factory/core/includes/class-factory-notices.php +291 -0
  89. libs/factory/core/includes/class-factory-options.php +432 -0
  90. libs/factory/core/includes/class-factory-plugin-abstract.php +688 -0
  91. libs/factory/core/includes/class-factory-plugin-base.php +573 -0
  92. libs/factory/core/includes/class-factory-requests.php +150 -0
  93. libs/factory/core/includes/class-factory-requirements.php +294 -0
  94. libs/factory/core/includes/entities/class-factory-paths.php +33 -0
  95. libs/factory/core/includes/entities/class-factory-support.php +124 -0
  96. libs/factory/core/includes/functions.php +205 -0
  97. libs/factory/core/includes/index.php +2 -0
  98. libs/factory/core/includes/premium/class-factory-license-interface.php +32 -0
  99. libs/factory/core/includes/premium/class-factory-manager.php +90 -0
  100. libs/factory/core/includes/premium/class-factory-provider-abstract.php +234 -0
  101. libs/factory/core/includes/premium/index.php +2 -0
  102. libs/factory/core/includes/updates/class-factory-premium-upgrader.php +792 -0
  103. libs/factory/core/includes/updates/class-factory-upgrader.php +313 -0
  104. libs/factory/core/includes/updates/index.php +2 -0
  105. libs/factory/core/includes/updates/repositories/class-factory-repository-abstract.php +62 -0
  106. libs/factory/core/includes/updates/repositories/class-factory-wordpress.php +72 -0
  107. libs/factory/core/includes/updates/repositories/index.php +0 -0
  108. libs/factory/core/index.php +2 -0
  109. libs/factory/core/langs/index.php +2 -0
  110. libs/factory/core/langs/wbcr_factory_424-ru_RU.mo +0 -0
  111. libs/factory/core/langs/wbcr_factory_424-ru_RU.po +128 -0
  112. libs/factory/forms/assets/css/editor.css +12 -0
  113. libs/factory/forms/assets/standard-controls.js +146 -0
  114. libs/factory/forms/boot.php +273 -0
  115. libs/factory/forms/controls/checkbox.php +177 -0
  116. libs/factory/forms/controls/color-and-opacity.php +88 -0
  117. libs/factory/forms/controls/color.php +62 -0
  118. libs/factory/forms/controls/customs/html.php +45 -0
  119. libs/factory/forms/controls/customs/index.php +2 -0
  120. libs/factory/forms/controls/customs/separator.php +35 -0
  121. libs/factory/forms/controls/datepicker-range.php +106 -0
  122. libs/factory/forms/controls/dropdown-and-colors.php +116 -0
  123. libs/factory/forms/controls/dropdown.php +393 -0
  124. libs/factory/forms/controls/font.php +270 -0
  125. libs/factory/forms/controls/google-font.php +152 -0
  126. libs/factory/forms/controls/gradient.php +103 -0
  127. libs/factory/forms/controls/hidden.php +50 -0
  128. libs/factory/forms/controls/holders/accordion-item.php +63 -0
  129. libs/factory/forms/controls/holders/accordion.php +58 -0
  130. libs/factory/forms/controls/holders/columns.php +99 -0
  131. libs/factory/forms/controls/holders/control-group-item.php +76 -0
  132. libs/factory/forms/controls/holders/control-group.php +97 -0
  133. libs/factory/forms/controls/holders/div.php +67 -0
  134. libs/factory/forms/controls/holders/form-group.php +71 -0
  135. libs/factory/forms/controls/holders/index.php +2 -0
  136. libs/factory/forms/controls/holders/more-link.php +75 -0
  137. libs/factory/forms/controls/holders/tab-item.php +68 -0
  138. libs/factory/forms/controls/holders/tab.php +139 -0
  139. libs/factory/forms/controls/index.php +2 -0
  140. libs/factory/forms/controls/integer.php +160 -0
  141. libs/factory/forms/controls/list.php +230 -0
  142. libs/factory/forms/controls/multiple-textbox.php +120 -0
  143. libs/factory/forms/controls/paddings-editor.php +82 -0
  144. libs/factory/forms/controls/pattern.php +181 -0
  145. libs/factory/forms/controls/radio-colors.php +111 -0
  146. libs/factory/forms/controls/radio.php +85 -0
  147. libs/factory/forms/controls/textarea.php +85 -0
  148. libs/factory/forms/controls/textbox.php +83 -0
  149. libs/factory/forms/controls/url.php +43 -0
  150. libs/factory/forms/controls/wp-editor.php +95 -0
  151. libs/factory/forms/includes/complex-control.class.php +133 -0
  152. libs/factory/forms/includes/control-holder.class.php +173 -0
  153. libs/factory/forms/includes/control.class.php +422 -0
  154. libs/factory/forms/includes/custom-element.class.php +46 -0
  155. libs/factory/forms/includes/form-element.class.php +423 -0
  156. libs/factory/forms/includes/form-layout.class.php +123 -0
  157. libs/factory/forms/includes/form.class.php +690 -0
  158. libs/factory/forms/includes/holder.class.php +170 -0
  159. libs/factory/forms/includes/html-builder.class.php +137 -0
  160. libs/factory/forms/includes/index.php +2 -0
  161. libs/factory/forms/includes/providers/index.php +2 -0
  162. libs/factory/forms/includes/providers/meta-value-provider.class.php +303 -0
  163. libs/factory/forms/includes/providers/options-value-provider.class.php +96 -0
  164. libs/factory/forms/includes/providers/value-provider.interface.php +62 -0
  165. libs/factory/forms/index.php +2 -0
  166. libs/factory/forms/langs/wbcr_factory_forms_422-ru_RU.mo +0 -0
  167. libs/factory/forms/langs/wbcr_factory_forms_422-ru_RU.po +95 -0
  168. libs/factory/forms/layouts/bootstrap-3/bootstrap-3.php +217 -0
  169. libs/factory/forms/layouts/bootstrap-3/index.php +2 -0
  170. libs/factory/forms/layouts/index.php +2 -0
  171. libs/factory/freemius/boot.php +52 -0
  172. libs/factory/freemius/includes/class-freemius-api.php +416 -0
  173. libs/factory/freemius/includes/entities/class-freemius-entity.php +178 -0
  174. libs/factory/freemius/includes/entities/class-freemius-license.php +369 -0
  175. libs/factory/freemius/includes/entities/class-freemius-plugin.php +114 -0
  176. libs/factory/freemius/includes/entities/class-freemius-scope.php +34 -0
  177. libs/factory/freemius/includes/entities/class-freemius-site.php +147 -0
  178. libs/factory/freemius/includes/entities/class-freemius-user.php +80 -0
  179. libs/factory/freemius/includes/entities/index.php +2 -0
  180. libs/factory/freemius/includes/index.php +2 -0
  181. libs/factory/freemius/includes/licensing/class-freemius-provider.php +739 -0
  182. libs/factory/freemius/includes/licensing/index.php +2 -0
  183. libs/factory/freemius/includes/sdk/Exceptions/ArgumentNotExistException.php +9 -0
  184. libs/factory/freemius/includes/sdk/Exceptions/EmptyArgumentException.php +9 -0
  185. libs/factory/freemius/includes/sdk/Exceptions/Exception.php +74 -0
  186. libs/factory/freemius/includes/sdk/Exceptions/InvalidArgumentException.php +8 -0
  187. libs/factory/freemius/includes/sdk/Exceptions/OAuthException.php +12 -0
  188. libs/factory/freemius/includes/sdk/Exceptions/index.php +3 -0
  189. libs/factory/freemius/includes/sdk/FreemiusBase.php +215 -0
  190. libs/factory/freemius/includes/sdk/FreemiusWordPress.php +704 -0
  191. libs/factory/freemius/includes/sdk/LICENSE.txt +340 -0
  192. libs/factory/freemius/includes/sdk/index.php +3 -0
  193. libs/factory/freemius/includes/updates/class-freemius-repository.php +123 -0
  194. libs/factory/freemius/includes/updates/index.php +2 -0
  195. libs/factory/freemius/index.php +2 -0
  196. libs/factory/pages/boot.php +43 -0
  197. libs/factory/pages/includes/admin-page.class.php +562 -0
  198. libs/factory/pages/includes/index.php +2 -0
  199. libs/factory/pages/includes/page.class.php +168 -0
  200. libs/factory/pages/index.php +2 -0
  201. libs/factory/pages/langs/wbcr_factory_pages_424-fr_FR.mo +0 -0
  202. libs/factory/pages/langs/wbcr_factory_pages_424-fr_FR.po +99 -0
  203. libs/factory/pages/langs/wbcr_factory_pages_424-ru_RU.mo +0 -0
  204. libs/factory/pages/langs/wbcr_factory_pages_424-ru_RU.po +98 -0
  205. libs/factory/pages/pages.php +107 -0
  206. libs/factory/pages/templates/assets/css/impressive.page.template.css +508 -0
  207. libs/factory/pages/templates/assets/css/impressive.page.template.css.map +1 -0
  208. libs/factory/pages/templates/assets/css/impressive.page.template.less +604 -0
  209. libs/factory/pages/templates/assets/img/5-stars22.png +0 -0
  210. libs/factory/pages/templates/assets/img/paypal-donate.png +0 -0
  211. libs/factory/pages/templates/assets/img/webcraftic-plugin-icon.png +0 -0
  212. libs/factory/pages/templates/impressive-page.class.php +204 -0
admin/ajax/index.php ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?php
2
+ // Silence is golden.
admin/ajax/logs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Used to clean-up logs.
5
+ */
6
+ add_action( 'wp_ajax_wlogger-logs-cleanup', function () {
7
+ check_admin_referer( 'wlogger_clean_logs', 'nonce' );
8
+
9
+ if ( ! current_user_can( 'manage_options' ) ) {
10
+ wp_die( - 1 );
11
+ }
12
+
13
+ if ( ! \WBCR\Logger\Writter::clean_up() ) {
14
+ wp_send_json_error( [
15
+ 'message' => esc_html__( 'Failed to clean-up logs. Please try again later.', 'robin-image-optimizer' ),
16
+ 'type' => 'danger',
17
+ ] );
18
+ }
19
+
20
+ wp_send_json( [
21
+ 'message' => esc_html__( 'Logs clean-up successfully', 'robin-image-optimizer' ),
22
+ 'type' => 'success',
23
+ ] );
24
+ } );
admin/assets/css/settings.css ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #WBCR .factory-checkbox.wantispam-checkbox-premium-label:after {
2
+ display: inline-block;
3
+ position: relative;
4
+ content: 'PRO';
5
+ background: #ff5722;
6
+ border-radius: 4px;
7
+ color: #fff;
8
+ font-size: 10px;
9
+ line-height: 1;
10
+ font-style: normal;
11
+ padding: 4px 6px;
12
+ margin-left: 4px;
13
+ vertical-align: top;
14
+ top: -8px;
15
+ left: -10px;
16
+ right: auto;
17
+ z-index: 11;
18
+ cursor: pointer;
19
+ }
20
+ #WBCR .factory-checkbox--disabled input,
21
+ #WBCR .factory-checkbox--disabled button {
22
+ pointer-events: none;
23
+ cursor: not-allowed;
24
+ opacity: 0.65;
25
+ filter: alpha(opacity=65);
26
+ -webkit-box-shadow: none;
27
+ box-shadow: none;
28
+ }
29
+ /*# sourceMappingURL=settings.css.map */
admin/assets/css/settings.css.map ADDED
@@ -0,0 +1 @@
 
1
+ {"version":3,"sources":["settings.less"],"names":[],"mappings":"AAEI,KADF,kBACG,iCAAiC;EAChC,qBAAA;EACA,kBAAA;EACA,SAAS,KAAT;EACA,mBAAA;EACA,kBAAA;EACA,WAAA;EACA,eAAA;EACA,cAAA;EACA,kBAAA;EACA,gBAAA;EACA,gBAAA;EACA,mBAAA;EACA,SAAA;EACA,WAAA;EACA,WAAA;EACA,WAAA;EACA,eAAA;;AAGF,KArBF,kBAqBG,UAAW;AACZ,KAtBF,kBAsBG,UAAW;EACV,oBAAA;EACA,mBAAA;EACA,aAAA;EACA,yBAAA;EACA,wBAAA;EACA,gBAAA","file":"settings.css"}
admin/assets/css/settings.less ADDED
@@ -0,0 +1,36 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #WBCR {
2
+ .factory-checkbox {
3
+ &.wantispam-checkbox-premium-label:after {
4
+ display: inline-block;
5
+ position: relative;
6
+ content: 'PRO';
7
+ background: #ff5722;
8
+ border-radius: 4px;
9
+ color: #fff;
10
+ font-size: 10px;
11
+ line-height: 1;
12
+ font-style: normal;
13
+ padding: 4px 6px;
14
+ margin-left: 4px;
15
+ vertical-align: top;
16
+ top: -8px;
17
+ left: -10px;
18
+ right: auto;
19
+ z-index: 11;
20
+ cursor: pointer;
21
+ }
22
+
23
+ &--disabled input,
24
+ &--disabled button {
25
+ pointer-events: none;
26
+ cursor: not-allowed;
27
+ opacity: 0.65;
28
+ filter: alpha(opacity=65);
29
+ -webkit-box-shadow: none;
30
+ box-shadow: none;
31
+ }
32
+ }
33
+
34
+
35
+ }
36
+
admin/assets/img/about-preview.jpg ADDED
Binary file
admin/assets/js/settings.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * General scripts
3
+ *
4
+ * @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
5
+ * @copyright (c) 03.12.2019, CreativeMotion
6
+ * @version 1.0
7
+ */
8
+
9
+
10
+ (function($) {
11
+ 'use strict';
12
+
13
+ $.wantispam = {};
14
+
15
+ if( $.wbcr_factory_clearfy_216 ) {
16
+ $.wantispam = $.wbcr_factory_clearfy_216;
17
+ }
18
+
19
+ $('.factory-checkbox--disabled.wantispam-checkbox-premium-label').click(function(e) {
20
+ e.stopPropagation();
21
+ window.location.href = 'https://anti-spam.space/pricing/';
22
+ });
23
+
24
+ })(jQuery);
admin/boot.php ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Admin boot
4
+ *
5
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
6
+ * @copyright Webcraftic 22.10.2019
7
+ */
8
+
9
+ // Exit if accessed directly
10
+ if ( ! defined( 'ABSPATH' ) ) {
11
+ exit;
12
+ }
13
+
14
+ /*add_action('wantispam/factory/clearfy/check_license_success', function($action, $license_key){
15
+ if('activate' === $action || 'sync' === $action) {
16
+
17
+ }
18
+ });*/
19
+
20
+ /**
21
+ * Виджет отзывов
22
+ *
23
+ * @param string $page_url
24
+ * @param string $plugin_name
25
+ *
26
+ * @return string
27
+ */
28
+ add_filter( 'wbcr_factory_pages_424_imppage_rating_widget_url', function ( $page_url, $plugin_name ) {
29
+ if ( $plugin_name == \WBCR\Antispam\Plugin::app()->getPluginName() ) {
30
+ return 'https://wordpress.org/support/plugin/anti-spam/reviews/';
31
+ }
32
+
33
+ return $page_url;
34
+ }, 10, 2 );
35
+
36
+ /**
37
+ * Удаляем лишние виджеты из правого сайдбара в интерфейсе плагина
38
+ *
39
+ * - Виджет с премиум рекламой
40
+ * - Виджет с рейтингом
41
+ * - Виджет с маркерами информации
42
+ */
43
+ add_filter( 'wbcr/factory/pages/impressive/widgets', function ( $widgets, $position, $plugin ) {
44
+ if ( \WBCR\Antispam\Plugin::app()->getPluginName() == $plugin->getPluginName() && 'right' == $position ) {
45
+ unset( $widgets['business_suggetion'] );
46
+ unset( $widgets['rating_widget'] );
47
+ unset( $widgets['info_widget'] );
48
+ }
49
+
50
+ return $widgets;
51
+ }, 20, 3 );
52
+
53
+ /**
54
+ * Changes plugin title in plugin interface header
55
+ */
56
+ add_filter( 'wbcr/factory/pages/impressive/plugin_title', function ( $title, $plugin_name ) {
57
+ if ( \WBCR\Antispam\Plugin::app()->getPluginName() == $plugin_name ) {
58
+ return __( 'Anti-spam', 'realforce' );
59
+ }
60
+
61
+ return $title;
62
+ }, 20, 2 );
63
+
64
+ /**
65
+ * Инициализации метабоксов и страницы "о плагине".
66
+ *
67
+ * Этот хук реализует условную логику, при которой пользователь переодически будет
68
+ * видет страницу "О плагине", а конкретно при активации и обновлении плагина.
69
+ */
70
+ add_action( 'admin_init', function () {
71
+ $plugin = \WBCR\Antispam\Plugin::app();
72
+
73
+ // If the user has updated the plugin or activated it for the first time,
74
+ // you need to show the page "What's new?"
75
+ //if ( ! $plugin->isNetworkAdmin() ) {
76
+ $about_page_viewed = $plugin->request->get( 'wantispam_about_page_viewed', null );
77
+
78
+ if ( is_null( $about_page_viewed ) ) {
79
+ if ( wantispam_is_need_show_about_page() ) {
80
+ try {
81
+ $redirect_url = $plugin->getPluginPageUrl( 'about', [ 'wantispam_about_page_viewed' => 1 ] );
82
+
83
+ if ( $redirect_url ) {
84
+ wp_safe_redirect( $redirect_url );
85
+ die();
86
+ }
87
+ } catch( Exception $e ) {
88
+ }
89
+ }
90
+ } else {
91
+ if ( wantispam_is_need_show_about_page() ) {
92
+ if ( $plugin->isNetworkAdmin() ) {
93
+ delete_site_option( $plugin->getOptionName( 'what_is_new_64' ) );
94
+ } else {
95
+ delete_option( $plugin->getOptionName( 'what_is_new_64' ) );
96
+ }
97
+ }
98
+ }
99
+ //}
100
+ } );
admin/class-activation.php ADDED
@@ -0,0 +1,73 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WBCR\Antispam;
4
+
5
+ /**
6
+ * Activator for the Antispam
7
+ *
8
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
9
+ * @copyright (c) 26.10.2019, Webcraftic
10
+ * @see Wbcr_Factory424_Activator
11
+ * @version 1.0
12
+ */
13
+
14
+ // Exit if accessed directly
15
+ if ( ! defined( 'ABSPATH' ) ) {
16
+ exit;
17
+ }
18
+
19
+ class Activation extends \Wbcr_Factory424_Activator {
20
+
21
+ /**
22
+ * Runs activation actions.
23
+ *
24
+ * @since 6.0
25
+ */
26
+ public function activate() {
27
+
28
+ $plugin_version_in_db = $this->get_plugin_version_in_db();
29
+ $current_plugin_version = $this->plugin->getPluginVersion();
30
+
31
+ $tab = "\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t";
32
+ $log_message = "Plugin starts activation [START].\r\n";
33
+ $log_message .= "{$tab}-Plugin Version in DB: {$plugin_version_in_db}\r\n";
34
+ $log_message .= "{$tab}-Current Plugin Version: {$current_plugin_version}";
35
+
36
+ \WBCR\Logger\Writter::info( $log_message );
37
+
38
+ if ( $this->plugin->isNetworkAdmin() ) {
39
+ update_site_option( $this->plugin->getOptionName( 'what_is_new_64' ), 1 );
40
+ } else {
41
+ update_option( $this->plugin->getOptionName( 'what_is_new_64' ), 1 );
42
+ }
43
+
44
+ \WBCR\Logger\Writter::info( "Plugin has been activated [END]!" );
45
+ }
46
+
47
+ /**
48
+ * Get previous plugin version
49
+ *
50
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>
51
+ * @since 6.0
52
+ * @return number
53
+ */
54
+ public function get_plugin_version_in_db() {
55
+ if ( \WBCR\Antispam\Plugin::app()->isNetworkActive() ) {
56
+ return get_site_option( \WBCR\Antispam\Plugin::app()->getOptionName( 'plugin_version' ), 0 );
57
+ }
58
+
59
+ return get_option( \WBCR\Antispam\Plugin::app()->getOptionName( 'plugin_version' ), 0 );
60
+ }
61
+
62
+
63
+ /**
64
+ * Run deactivation actions.
65
+ *
66
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>
67
+ * @since 6.0
68
+ */
69
+ public function deactivate() {
70
+ \WBCR\Logger\Writter::info( "Plugin starts deactivate [START]." );
71
+ \WBCR\Logger\Writter::info( "Plugin has been deactivated [END]!" );
72
+ }
73
+ }
admin/pages/class-pages-about.php ADDED
@@ -0,0 +1,132 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WBCR\Antispam\Page;
4
+
5
+ // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * The file contains a short help info.
12
+ *
13
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
14
+ * @copyright (c) 2019 Webraftic Ltd
15
+ * @version 1.0
16
+ */
17
+ class About extends \Wbcr_FactoryClearfy216_PageBase {
18
+
19
+ /**
20
+ * {@inheritdoc}
21
+ */
22
+ public $id = 'about';
23
+
24
+ /**
25
+ * {@inheritdoc}
26
+ */
27
+ public $page_menu_dashicon = 'dashicons-star-filled';
28
+
29
+ /**
30
+ * {@inheritdoc}
31
+ */
32
+ public $type = 'page';
33
+
34
+ /**
35
+ * {@inheritdoc}
36
+ */
37
+ public $show_right_sidebar_in_options = false;
38
+
39
+ /**
40
+ * {@inheritdoc}
41
+ */
42
+ public $page_menu_position = 0;
43
+
44
+
45
+ /**
46
+ * Logs constructor.
47
+ *
48
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>
49
+ *
50
+ * @param \Wbcr_Factory424_Plugin $plugin
51
+ */
52
+ public function __construct( \Wbcr_Factory424_Plugin $plugin ) {
53
+ $this->plugin = $plugin;
54
+
55
+ $this->menu_title = __( 'Premium', 'anti-spam' );
56
+ $this->page_menu_short_description = sprintf( __( 'What is new in %s?', 'anti-spam' ), $this->plugin->getPluginVersion() );
57
+
58
+ parent::__construct( $plugin );
59
+ }
60
+
61
+ /**
62
+ * {@inheritdoc}
63
+ */
64
+ public function showPageContent() {
65
+ global $wp_version;
66
+ ?>
67
+ <div class="wrap about-wrap full-width-layout" id="wbcr-inp-about">
68
+ <!-- News Title !-->
69
+ <h1>Meet with <?php echo $this->plugin->getPluginTitle() ?>
70
+ Pro in <?php echo $this->plugin->getPluginVersion() ?></h1>
71
+ <!-- News Subtext !-->
72
+ <div class="about-text">
73
+ Thanks for upgrading! Many new features and improvements are available that you will enjoy.
74
+ </div>
75
+ <!-- Latest News !-->
76
+ <div class="headline">
77
+ <h3 class="headline-title">
78
+ You’ve probably noticed how much our plugin has changed! Now, it’s a
79
+ fully-functional cloud anti-spam
80
+ service: easy to use and without captcha or complex settings.
81
+ </h3>
82
+ <div class="featured-image">
83
+ <img src="<?php echo WANTISPAM_PLUGIN_URL ?>/admin/assets/img/about-preview.jpg" alt="">
84
+ </div>
85
+ <p>&nbsp;</p>
86
+ <p class="introduction">
87
+ A new way of checking comments and registrations for spam. Once you install the plugin, all messages
88
+ pass a three-step verification:
89
+ </p>
90
+ <ul>
91
+ <li>- match with the constantly updated spam base;</li>
92
+ <li>- check by a neural network;</li>
93
+ <li>- filter comments posted on a website before the plugin installation.</li>
94
+ </ul>
95
+ <p>Besides, now you have a handy control panel with various settings and analytics section. The result of
96
+ our work is a great plugin that protects your site from spam much better! Check how it works. If you
97
+ like it, don’t forget to post a review – that motivates us the best!</p>
98
+ </div>
99
+ <div class="feature-section one-col">
100
+ <div class="col">
101
+ <h2>Useful features scheduled for future releases:</h2>
102
+ </div>
103
+ </div>
104
+ <div class="feature-section one-col">
105
+ <div class="col">
106
+ <ul>
107
+ <li>An additional level of checking comments on the base of stop words;</li>
108
+ <li>Additional integrations:
109
+ <p>popular plugins for generating forms; membership plugins, plugins
110
+ that add registration forms; elementor builders, beaver, composer; woocommerce; bbPress; the
111
+ subscription forms protection from popular services (for example, Mailchimp).
112
+ </p>
113
+ </li>
114
+ <li>Block or allow comments from specific countries.</li>
115
+ <li>Allow comments in a certain language only.</li>
116
+ <li>
117
+ Manual sorting of comments mistakenly marked as spam.
118
+ <p>(If a user clicked Spam (that it is not spam), display a pop-up window offering to remove the
119
+ user from the blacklist. In that case, the messages from this user won’t be considered as
120
+ spam anymore. It’s a sort of a training model helping the user to avoid manual operations
121
+ when his client mistakenly ended up being in the blacklist.)</p>
122
+ </li>
123
+ <li>Remove all links from comments.</li>
124
+ <li>Admin notifications to control the correct plugin performance.</li>
125
+ <li>The spam list auto clean after a certain period.</li>
126
+ </ul>
127
+ </div>
128
+ </div>
129
+ <?php
130
+ }
131
+
132
+ }
admin/pages/class-pages-license.php ADDED
@@ -0,0 +1,67 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WBCR\Antispam\Page;
4
+
5
+ // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * Страница лицензирования плагина.
12
+ *
13
+ * Поддерживает режим работы с мультисаймами. Вы можете увидеть эту страницу в панели настройки сети.
14
+ *
15
+ * @author Alex Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
16
+ *
17
+ * @copyright (c) 2018 Webraftic Ltd
18
+ */
19
+ class License extends \Wbcr_FactoryClearfy216_LicensePage {
20
+
21
+ /**
22
+ * {@inheritdoc}
23
+ *
24
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>
25
+ * @since 6.0
26
+ * @var string
27
+ */
28
+ public $id = 'license';
29
+
30
+ /**
31
+ * {@inheritdoc}
32
+ *
33
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>
34
+ * @since 6.0
35
+ * @var string
36
+ */
37
+ public $page_parent_page;
38
+
39
+ /**
40
+ * WCL_LicensePage constructor.
41
+ *
42
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>
43
+ *
44
+ * @param \Wbcr_Factory424_Plugin $plugin
45
+ */
46
+ public function __construct( \Wbcr_Factory424_Plugin $plugin ) {
47
+ $this->menu_title = __( 'License', 'anti-spam' );
48
+ $this->page_menu_short_description = __( 'Product activation', 'anti-spam' );
49
+ $this->plan_name = __( 'Anti-spam PRO', 'anti-spam' );
50
+
51
+ parent::__construct( $plugin );
52
+ }
53
+
54
+ /**
55
+ * {@inheritdoc}
56
+ *
57
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>
58
+ * @since 1.6.0
59
+ * @return string
60
+ */
61
+ public function get_plan_description() {
62
+ $description = '<p style="font-size: 16px;">' . __( '<b>Anti-spam PRO</b> is a paid package of components for the popular free WordPress plugin named Anti-spam PRO. You get access to all paid components at one price.', 'clearfy' ) . '</p>';
63
+ $description .= '<p style="font-size: 16px;">' . __( 'Paid license guarantees that you can download and update existing and future paid components of the plugin.', 'clearfy' ) . '</p>';
64
+
65
+ return $description;
66
+ }
67
+ }
admin/pages/class-pages-logs.php ADDED
@@ -0,0 +1,122 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WBCR\Antispam\Page;
4
+
5
+ // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * Страница журнала ошибок
12
+ *
13
+ * Не поддерживает режим работы с мультисаймами.
14
+ *
15
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
16
+ * @copyright (c) 2019 Webraftic Ltd
17
+ * @version 1.0
18
+ */
19
+ class Logs extends \Wbcr_FactoryClearfy216_PageBase {
20
+
21
+ /**
22
+ * {@inheritdoc}
23
+ */
24
+ public $id = 'logs';
25
+
26
+ /**
27
+ * {@inheritdoc}
28
+ */
29
+ public $page_menu_dashicon = 'dashicons-admin-tools';
30
+
31
+ /**
32
+ * {@inheritdoc}
33
+ */
34
+ public $type = 'page';
35
+
36
+ /**
37
+ * Logs constructor.
38
+ *
39
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>
40
+ *
41
+ * @param \Wbcr_Factory424_Plugin $plugin
42
+ */
43
+ public function __construct( \Wbcr_Factory424_Plugin $plugin ) {
44
+
45
+ $this->menu_title = __( 'Error Log', 'anti-spam' );
46
+ $this->page_menu_short_description = __( 'Plugin debug report', 'anti-spam' );
47
+
48
+ parent::__construct( $plugin );
49
+ }
50
+
51
+ /**
52
+ * {@inheritdoc}
53
+ *
54
+ * @since 1.0.0
55
+ * @return void
56
+ */
57
+ public function assets( $scripts, $styles ) {
58
+ parent::assets( $scripts, $styles );
59
+
60
+ $this->styles->add( WANTISPAM_PLUGIN_URL . '/includes/logger/assets/css/base.css' );
61
+ $this->scripts->add( WANTISPAM_PLUGIN_URL . '/includes/logger/assets/js/base.js' );
62
+ }
63
+
64
+ /**
65
+ * {@inheritdoc}
66
+ */
67
+ public function showPageContent() {
68
+ require_once( WANTISPAM_PLUGIN_DIR . '/includes/logger/class-logger-reader.php' );
69
+ ?>
70
+ <div class="wbcr-factory-page-group-header">
71
+ <strong><?php _e( 'Error Log', 'anti-spam' ) ?></strong>
72
+ <p>
73
+ <?php _e( 'In this section, you can track image optimization errors. Sending this log to us, will help in solving possible optimization issues.', 'anti-spam' ) ?>
74
+ </p>
75
+ </div>
76
+ <div class="wbcr-factory-page-group-body">
77
+ <div class="btn-group">
78
+ <a href="<?php echo wp_nonce_url( $this->getPageUrl() . 'action=export' ) ?>"
79
+ class="btn btn-default"><?php _e( 'Export Debug Information', 'anti-spam' ) ?></a>
80
+ <a href="#"
81
+ data-working="<?php echo esc_attr__( 'Working...', 'anti-spam' ) ?>"
82
+ data-nonce="<?php echo wp_create_nonce( 'wlogger_clean_logs' ) ?>"
83
+ class="btn btn-default js-wlogger-export-debug-report"><?php echo sprintf( __( 'Clean-up Logs (<span id="js-wlogger-size">%s</span>)', 'anti-spam' ), $this->get_log_size_formatted() ) ?></a>
84
+ </div>
85
+ <div class="wlogger-viewer" id="js-wlogger-viewer">
86
+ <?php echo \WBCR\Logger\Reader::prettify() ?>
87
+ </div>
88
+ </div>
89
+ <?php
90
+ }
91
+
92
+ /**
93
+ * Processing log export action in form of ZIP archive.
94
+ *
95
+ * @since 6.0
96
+ */
97
+ public function exportAction() {
98
+ require_once( WANTISPAM_PLUGIN_DIR . '/includes/logger/class-logger-export.php' );
99
+ $export = new \WBCR\Logger\Export();
100
+
101
+ if ( $export->prepare() ) {
102
+ $export->download( true );
103
+ }
104
+ }
105
+
106
+ /**
107
+ * Get log size formatted.
108
+ *
109
+ * @since 6.0
110
+ * @return false|string
111
+ */
112
+ private function get_log_size_formatted() {
113
+
114
+ try {
115
+ return size_format( \WBCR\Logger\Writter::get_total_size() );
116
+ } catch( \Exception $exception ) {
117
+ \WBCR\Logger\Writter::error( sprintf( 'Failed to get total log size as exception was thrown: %s', $exception->getMessage() ) );
118
+ }
119
+
120
+ return '';
121
+ }
122
+ }
admin/pages/class-pages-settings.php ADDED
@@ -0,0 +1,190 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ namespace WBCR\Antispam\Page;
4
+
5
+ // Exit if accessed directly
6
+ if ( ! defined( 'ABSPATH' ) ) {
7
+ exit;
8
+ }
9
+
10
+ /**
11
+ * Страница общих настроек для этого плагина.
12
+ *
13
+ * Не поддерживает режим работы с мультисаймами.
14
+ *
15
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>, Github: https://github.com/alexkovalevv
16
+ * @copyright (c) 2019 Webraftic Ltd
17
+ * @version 1.0
18
+ */
19
+ class Settings extends \Wbcr_FactoryClearfy216_PageBase {
20
+
21
+ /**
22
+ * {@inheritDoc}
23
+ *
24
+ * @since 6.0
25
+ * @var string
26
+ */
27
+ public $id = "settings";
28
+
29
+ /**
30
+ * {@inheritDoc}
31
+ *
32
+ * @since 6.0
33
+ * @var string
34
+ */
35
+ public $page_menu_dashicon = 'dashicons-testimonial';
36
+
37
+ /**
38
+ * {@inheritDoc}
39
+ *
40
+ * @since 6.0
41
+ * @var string
42
+ */
43
+ public $menu_target = 'options-general.php';
44
+
45
+ /**
46
+ * {@inheritDoc}
47
+ *
48
+ * @since 6.0
49
+ * @var bool
50
+ */
51
+ public $show_right_sidebar_in_options = true;
52
+
53
+ /**
54
+ * {@inheritDoc}
55
+ *
56
+ * @since 6.0
57
+ * @var bool
58
+ */
59
+ public $internal = false;
60
+
61
+ /**
62
+ * {@inheritDoc}
63
+ *
64
+ * @since 6.0
65
+ * @var bool
66
+ */
67
+ public $add_link_to_plugin_actions = true;
68
+
69
+ /**
70
+ * WBCR\Page\Settings constructor.
71
+ *
72
+ * @author Alexander Kovalev <alex.kovalevv@gmail.com>
73
+ *
74
+ * @param \Wbcr_Factory424_Plugin $plugin
75
+ */
76
+ public function __construct( \Wbcr_Factory424_Plugin $plugin ) {
77
+ $this->menu_title = __( 'Anti-spam', 'anti-spam' );
78
+ $this->page_menu_short_description = __( 'All settings', 'anti-spam' );
79
+
80
+ parent::__construct( $plugin );
81
+
82
+ $this->plugin = $plugin;
83
+ }
84
+
85
+
86
+ public function getPageTitle() {
87
+ return __( 'General', 'anti-spam' );
88
+ }
89
+
90
+ /**
91
+ * Enqueue page assets
92
+ *
93
+ * @since 6.2
94
+ * @return void
95
+ * @see Wbcr_FactoryPages424_AdminPage
96
+ *
97
+ */
98
+ public function assets( $scripts, $styles ) {
99
+ parent::assets( $scripts, $styles );
100
+
101
+ $this->styles->add( WANTISPAM_PLUGIN_URL . '/admin/assets/css/settings.css' );
102
+ $this->scripts->add( WANTISPAM_PLUGIN_URL . '/admin/assets/js/settings.js', [
103
+ 'jquery',
104
+ 'wbcr-factory-clearfy-216-global'
105
+ ], 'wantispam-settings' );
106
+ }
107
+
108
+ /**
109
+ * Permalinks options.
110
+ *
111
+ * @since 6.2
112
+ * @return mixed[]
113
+ */
114
+ public function getPageOptions() {
115
+ $is_premium = \WBCR\Antispam\Plugin::app()->premium->is_activate();
116
+
117
+ $options[] = [
118
+ 'type' => 'html',
119
+ 'html' => '<div class="wbcr-factory-page-group-header">' . '<strong>' . __( 'Base options.', 'anti-spam' ) . '</strong>' . '<p>' . __( 'More 1 000 000 spam comments were blocked by Anti-spam plugin so far. Upgrade to Anti-spam Pro for advanced protection.', 'anti-spam' ) . '</p>' . '</div>'
120
+ ];
121
+
122
+ $options[] = [
123
+ 'type' => 'checkbox',
124
+ 'way' => 'buttons',
125
+ 'name' => 'save_spam_comments',
126
+ 'title' => __( 'Save spam comments', 'anti-spam' ),
127
+ 'layout' => [ 'hint-type' => 'icon', 'hint-icon-color' => 'green' ],
128
+ 'hint' => __( 'Save spam comments into spam section. Useful for testing how the plugin works.', 'anti-spam' ),
129
+ 'default' => true
130
+ ];
131
+
132
+ if ( $is_premium ) {
133
+ $options[] = [
134
+ 'type' => 'checkbox',
135
+ 'way' => 'buttons',
136
+ 'name' => 'comment_form_privacy_notice',
137
+ 'title' => __( 'Display a privacy notice under your comment forms.', 'anti-spam' ),
138
+ 'layout' => [ 'hint-type' => 'icon', 'hint-icon-color' => 'green' ],
139
+ 'hint' => __( 'To help your site with transparency under privacy laws like the GDPR, Antispam can display a notice to your users under your comment forms. This feature is disabled by default, however, you can turn it on above.', 'anti-spam' ),
140
+ 'default' => false
141
+ ];
142
+ }
143
+
144
+ $options[] = [
145
+ 'type' => 'html',
146
+ 'html' => '<div class="wbcr-factory-page-group-header">' . '<strong>' . __( 'Modules.', 'anti-spam' ) . '</strong>' . '<p>' . __( 'Additional modules to spam protect.', 'anti-spam' ) . '</p>' . '</div>'
147
+ ];
148
+
149
+ $options[] = [
150
+ 'type' => 'checkbox',
151
+ 'way' => 'buttons',
152
+ 'name' => 'protect_register_form',
153
+ 'title' => __( 'Protect Register Form', 'anti-spam' ),
154
+ 'layout' => [ 'hint-type' => 'icon', 'hint-icon-color' => 'green' ],
155
+ 'hint' => __( 'Registration form can be protected in a matter of minutes with a few new fields and limits imposed.', 'anti-spam' ),
156
+ 'default' => false,
157
+ 'cssClass' => ! $is_premium ? [ 'factory-checkbox--disabled wantispam-checkbox-premium-label' ] : [],
158
+ ];
159
+ $options[] = [
160
+ 'type' => 'checkbox',
161
+ 'way' => 'buttons',
162
+ 'name' => 'protect_comments_form',
163
+ 'title' => __( 'Advanced protection of comment forms', 'anti-spam' ),
164
+ 'layout' => [ 'hint-type' => 'icon', 'hint-icon-color' => 'green' ],
165
+ 'hint' => sprintf( __( 'In order to protect your cooment forms, you need to make it difficult or impossible for an automated tool to fill in or submit the form while keeping it as easy as possible for your customers to fill out the form.', 'anti-spam' ), \WBCR\Antispam\Plugin::app()->getPluginTitle() ),
166
+ 'default' => false,
167
+ 'cssClass' => ! $is_premium ? [ 'factory-checkbox--disabled wantispam-checkbox-premium-label' ] : [],
168
+ ];
169
+ /*$options[] = [
170
+ 'type' => 'checkbox',
171
+ 'way' => 'buttons',
172
+ 'name' => 'protect_contacts_form',
173
+ 'title' => __( 'Protect Contact Forms (Beta)', 'anti-spam' ),
174
+ 'layout' => [ 'hint-type' => 'icon', 'hint-icon-color' => 'red' ],
175
+ 'hint' => __( 'Job Spam-Free for WordPress Contact Forms.', 'anti-spam' ),
176
+ 'default' => false,
177
+ 'cssClass' => ! $is_premium ? [ 'factory-checkbox--disabled wantispam-checkbox-premium-label' ] : [],
178
+ ];*/
179
+
180
+ $form_options = [];
181
+
182
+ $form_options[] = [
183
+ 'type' => 'form-group',
184
+ 'items' => $options,
185
+ //'cssClass' => 'postbox'
186
+ ];
187
+
188
+ return apply_filters( 'wantispam/settings_form/options', $form_options, $this );
189
+ }
190
+ }
anti-spam-functions.php DELETED
@@ -1,135 +0,0 @@
1
- <?php
2
-
3
- if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
4
- exit;
5
- }
6
-
7
- function antispam_default_settings() {
8
- $settings = array(
9
- 'save_spam_comments' => 0
10
- );
11
- return $settings;
12
- }
13
-
14
-
15
- function antispam_get_settings() {
16
- $antispam_settings = (array) get_option('antispam_settings');
17
- $default_settings = antispam_default_settings();
18
- $antispam_settings = array_merge($default_settings, $antispam_settings); // set empty options with default values
19
- return $antispam_settings;
20
- }
21
-
22
-
23
- function antispam_counter_stats() {
24
- $antispam_stats = get_option('antispam_stats', array());
25
- if (array_key_exists('blocked_total', $antispam_stats)){
26
- $antispam_stats['blocked_total']++;
27
- } else {
28
- $antispam_stats['blocked_total'] = 1;
29
- }
30
- update_option('antispam_stats', $antispam_stats);
31
- }
32
-
33
-
34
- function antispam_check_for_spam() {
35
- $spam_flag = false;
36
-
37
- $antspm_q = '';
38
- if (isset($_POST['antspm-q'])) {
39
- $antspm_q = trim($_POST['antspm-q']);
40
- }
41
-
42
- $antspm_d = '';
43
- if (isset($_POST['antspm-d'])) {
44
- $antspm_d = trim($_POST['antspm-d']);
45
- }
46
-
47
- $antspm_e = '';
48
- if (isset($_POST['antspm-e-email-url-website'])) {
49
- $antspm_e = trim($_POST['antspm-e-email-url-website']);
50
- }
51
-
52
- if ( $antspm_q != date('Y') ) { // year-answer is wrong - it is spam
53
- if ( $antspm_d != date('Y') ) { // extra js-only check: there is no js added input - it is spam
54
- $spam_flag = true;
55
- }
56
- }
57
-
58
- if ( ! empty($antspm_e)) { // trap field is not empty - it is spam
59
- $spam_flag = true;
60
- }
61
-
62
- return $spam_flag;
63
- }
64
-
65
-
66
- function antispam_store_comment($commentdata) {
67
- global $wpdb;
68
-
69
- if ( isset( $commentdata['user_ID'] ) ) {
70
- $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
71
- }
72
-
73
- $prefiltered_user_id = ( isset( $commentdata['user_id'] ) ) ? (int) $commentdata['user_id'] : 0;
74
-
75
- $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];
76
- if ( isset( $commentdata['user_ID'] ) && $prefiltered_user_id !== (int) $commentdata['user_ID'] ) {
77
- $commentdata['user_id'] = $commentdata['user_ID'] = (int) $commentdata['user_ID'];
78
- } elseif ( isset( $commentdata['user_id'] ) ) {
79
- $commentdata['user_id'] = (int) $commentdata['user_id'];
80
- }
81
-
82
- $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : 0;
83
- $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : '';
84
- $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0;
85
-
86
- if ( ! isset( $commentdata['comment_author_IP'] ) ) {
87
- $commentdata['comment_author_IP'] = $_SERVER['REMOTE_ADDR'];
88
- }
89
- $commentdata['comment_author_IP'] = preg_replace( '/[^0-9a-fA-F:., ]/', '', $commentdata['comment_author_IP'] );
90
-
91
- if ( ! isset( $commentdata['comment_agent'] ) ) {
92
- $commentdata['comment_agent'] = isset( $_SERVER['HTTP_USER_AGENT'] ) ? $_SERVER['HTTP_USER_AGENT']: '';
93
- }
94
- $commentdata['comment_agent'] = substr( $commentdata['comment_agent'], 0, 254 );
95
-
96
- if ( empty( $commentdata['comment_date'] ) ) {
97
- $commentdata['comment_date'] = current_time('mysql');
98
- }
99
-
100
- if ( empty( $commentdata['comment_date_gmt'] ) ) {
101
- $commentdata['comment_date_gmt'] = current_time( 'mysql', 1 );
102
- }
103
-
104
- $commentdata = wp_filter_comment($commentdata);
105
-
106
- $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die );
107
- if ( is_wp_error( $commentdata['comment_approved'] ) ) {
108
- return $commentdata['comment_approved'];
109
- }
110
-
111
- $comment_ID = wp_insert_comment($commentdata);
112
- if ( ! $comment_ID ) {
113
- $fields = array( 'comment_author', 'comment_author_email', 'comment_author_url', 'comment_content' );
114
-
115
- foreach ( $fields as $field ) {
116
- if ( isset( $commentdata[ $field ] ) ) {
117
- $commentdata[ $field ] = $wpdb->strip_invalid_text_for_column( $wpdb->comments, $field, $commentdata[ $field ] );
118
- }
119
- }
120
-
121
- $commentdata = wp_filter_comment( $commentdata );
122
-
123
- $commentdata['comment_approved'] = wp_allow_comment( $commentdata, $avoid_die );
124
- if ( is_wp_error( $commentdata['comment_approved'] ) ) {
125
- return $commentdata['comment_approved'];
126
- }
127
-
128
- $comment_ID = wp_insert_comment( $commentdata );
129
- if ( ! $comment_ID ) {
130
- return false;
131
- }
132
- }
133
-
134
- wp_set_comment_status( $comment_ID, 'spam' );
135
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
anti-spam-settings.php DELETED
@@ -1,89 +0,0 @@
1
- <?php
2
- /*
3
- Anti-spam settings code
4
- used WordPress Settings API - http://codex.wordpress.org/Settings_API
5
- */
6
-
7
- if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
8
- exit;
9
- }
10
-
11
-
12
- function antispam_menu() { // add menu item
13
- add_options_page('Anti-spam', 'Anti-spam', 'manage_options', 'anti-spam', 'antispam_settings');
14
- }
15
- add_action('admin_menu', 'antispam_menu');
16
-
17
-
18
- function antispam_admin_init() {
19
- register_setting('antispam_settings_group', 'antispam_settings', 'antispam_settings_validate');
20
-
21
- add_settings_section('antispam_settings_automatic_section', '', 'antispam_section_callback', 'antispam_automatic_page');
22
-
23
- add_settings_field('save_spam_comments', 'Save spam comments', 'antispam_field_save_spam_comments_callback', 'antispam_automatic_page', 'antispam_settings_automatic_section');
24
-
25
- }
26
- add_action('admin_init', 'antispam_admin_init');
27
-
28
-
29
- function antispam_settings_init() { // set default settings
30
- global $antispam_settings;
31
- $antispam_settings = antispam_get_settings();
32
- update_option('antispam_settings', $antispam_settings);
33
- }
34
- add_action('admin_init', 'antispam_settings_init');
35
-
36
-
37
- function antispam_settings_validate($input) {
38
- $default_settings = antispam_get_settings();
39
-
40
- // checkbox
41
- $output['save_spam_comments'] = $input['save_spam_comments'];
42
-
43
- return $output;
44
- }
45
-
46
-
47
- function antispam_section_callback() { // Anti-spam settings description
48
- echo '';
49
- }
50
-
51
-
52
- function antispam_field_save_spam_comments_callback() {
53
- $settings = antispam_get_settings();
54
- echo '<label><input type="checkbox" name="antispam_settings[save_spam_comments]" '.checked(1, $settings['save_spam_comments'], false).' value="1" />';
55
- echo ' Save spam comments into spam section</label>';
56
- echo '<p class="description">Useful for testing how the plugin works. <a href="'. admin_url( 'edit-comments.php?comment_status=spam' ) . '">View spam section</a>.</p>';
57
- }
58
-
59
-
60
- function antispam_settings() {
61
- $antispam_stats = get_option('antispam_stats', array());
62
- $blocked_total = $antispam_stats['blocked_total'];
63
- if (empty($blocked_total)) {
64
- $blocked_total = 0;
65
- }
66
- ?>
67
- <div class="wrap">
68
-
69
- <h2><span class="dashicons dashicons-admin-generic"></span> Anti-spam</h2>
70
-
71
- <div class="antispam-panel-info">
72
- <p style="margin: 0;">
73
- <span class="dashicons dashicons-chart-bar"></span>
74
- <strong><?php echo $blocked_total; ?></strong> spam comments were blocked by <a href="https://wordpress.org/plugins/anti-spam/" target="_blank">Anti-spam</a> plugin so far.
75
- Upgrade to <strong><a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii" target="_blank">Anti-spam Pro</a></strong> for advanced protection.
76
- </p>
77
- </div>
78
-
79
- <form method="post" action="options.php">
80
- <?php settings_fields('antispam_settings_group'); ?>
81
- <div class="antispam-group-automatic">
82
- <?php do_settings_sections('antispam_automatic_page'); ?>
83
- </div>
84
- <?php submit_button(); ?>
85
- </form>
86
-
87
- </div>
88
- <?php
89
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
anti-spam.php CHANGED
@@ -1,94 +1,152 @@
1
  <?php
2
  /*
3
- Plugin Name: Anti-spam
4
  Plugin URI: http://wordpress.org/plugins/anti-spam/
5
  Description: No spam in comments. No captcha.
6
- Version: 5.5
7
- Author: webvitaly
8
  Text Domain: anti-spam
9
- Author URI: http://web-profile.net/wordpress/plugins/
10
  License: GPLv3
11
  */
12
 
13
- if ( ! defined( 'ABSPATH' ) ) { // Avoid direct calls to this file and prevent full path disclosure
 
14
  exit;
15
  }
16
 
17
- define('ANTISPAM_PLUGIN_VERSION', '5.5');
 
 
 
 
 
 
 
 
 
 
 
18
 
19
- include('anti-spam-functions.php');
20
- include('anti-spam-settings.php');
21
- include('anti-spam-info.php');
 
 
 
 
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
- function antispam_enqueue_script() {
25
- global $withcomments; // WP flag to show comments on all pages
26
- if ((is_singular() || $withcomments) && comments_open()) { // load script only for pages with comments form
27
- wp_enqueue_script('anti-spam-script', plugins_url('/js/anti-spam-5.5.js', __FILE__), null, null, true);
28
- }
29
- }
30
- add_action('wp_enqueue_scripts', 'antispam_enqueue_script');
31
-
32
-
33
- function antispam_form_part() {
34
- $rn = "\r\n"; // .chr(13).chr(10)
35
-
36
- if ( ! is_user_logged_in()) { // add anti-spam fields only for not logged in users
37
- echo $rn.'<!-- Anti-spam plugin v.'.ANTISPAM_PLUGIN_VERSION.' wordpress.org/plugins/anti-spam/ -->'.$rn;
38
- echo ' <p class="antispam-group antispam-group-q" style="clear: both;">
39
- <label>Current ye@r <span class="required">*</span></label>
40
- <input type="hidden" name="antspm-a" class="antispam-control antispam-control-a" value="'.date('Y').'" />
41
- <input type="text" name="antspm-q" class="antispam-control antispam-control-q" value="'.ANTISPAM_PLUGIN_VERSION.'" autocomplete="off" />
42
- </p>'.$rn; // question (hidden with js)
43
- echo ' <p class="antispam-group antispam-group-e" style="display: none;">
44
- <label>Leave this field empty</label>
45
- <input type="text" name="antspm-e-email-url-website" class="antispam-control antispam-control-e" value="" autocomplete="off" />
46
- </p>'.$rn; // empty field (hidden with css); trap for spammers because many bots will try to put email or url here
47
- }
48
- }
49
- add_action('comment_form', 'antispam_form_part'); // add anti-spam inputs to the comment form
50
-
51
-
52
- function antispam_check_comment($commentdata) {
53
- $antispam_settings = antispam_get_settings();
54
-
55
- extract($commentdata);
56
-
57
- if ( ! is_user_logged_in() && $comment_type != 'pingback' && $comment_type != 'trackback') { // logged in user is not a spammer
58
- if( antispam_check_for_spam() ) {
59
- if( $antispam_settings['save_spam_comments'] ) {
60
- antispam_store_comment($commentdata);
61
- }
62
- antispam_counter_stats();
63
- wp_die('Comment is a spam.'); // die - do not send comment and show error message
64
- }
65
- }
66
-
67
- if ($comment_type == 'trackback') {
68
- if( $antispam_settings['save_spam_comments'] ) {
69
- antispam_store_comment($commentdata);
70
- }
71
- antispam_counter_stats();
72
- wp_die('Trackbacks are disabled.'); // die - do not send trackback and show error message
73
- }
74
-
75
- return $commentdata; // if comment does not looks like spam
76
- }
77
 
78
- if ( ! is_admin()) { // without this check it is not possible to add comment in admin section
79
- add_filter('preprocess_comment', 'antispam_check_comment', 1);
 
 
 
 
80
  }
81
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
82
 
83
- function antispam_plugin_meta($links, $file) { // add some links to plugin meta row
84
- if ( $file == plugin_basename( __FILE__ ) ) {
85
- $row_meta = array(
86
- 'support' => '<a href="http://web-profile.net/wordpress/plugins/anti-spam/" target="_blank">' . __( 'Anti-spam', 'anti-spam' ) . '</a>',
87
- 'donate' => '<a href="http://web-profile.net/donate/" target="_blank">' . __( 'Donate', 'anti-spam' ) . '</a>',
88
- 'upgrage' => '<a href="http://codecanyon.net/item/antispam-pro/6491169?ref=webvitalii" target="_blank">' . __( 'Anti-spam Pro', 'anti-spam' ) . '</a>'
89
- );
90
- $links = array_merge( $links, $row_meta );
91
- }
92
- return (array) $links;
93
  }
94
- add_filter('plugin_row_meta', 'antispam_plugin_meta', 10, 2);
1
  <?php
2
  /*
3
+ Plugin Name: Anti-Spam
4
  Plugin URI: http://wordpress.org/plugins/anti-spam/
5
  Description: No spam in comments. No captcha.
6
+ Version: 6.5.1
7
+ Author: CreativeMotion
8
  Text Domain: anti-spam
9
+ Author URI: https://cm-wp.com/
10
  License: GPLv3
11
  */
12
 
13
+ // Exit if accessed directly
14
+ if ( ! defined( 'ABSPATH' ) ) {
15
  exit;
16
  }
17
 
18
+ /**
19
+ * Developers who contributions in the development plugin:
20
+ *
21
+ * Alexander Kovalev
22
+ * ---------------------------------------------------------------------------------
23
+ * Full plugin development.
24
+ *
25
+ * Email: alex.kovalevv@gmail.com
26
+ * Personal card: https://alexkovalevv.github.io
27
+ * Personal repo: https://github.com/alexkovalevv
28
+ * ---------------------------------------------------------------------------------
29
+ */
30
 
31
+ /**
32
+ * -----------------------------------------------------------------------------
33
+ * CHECK REQUIREMENTS
34
+ * Check compatibility with php and wp version of the user's site. As well as checking
35
+ * compatibility with other plugins from Webcraftic.
36
+ * -----------------------------------------------------------------------------
37
+ */
38
 
39
+ require_once( dirname( __FILE__ ) . '/libs/factory/core/includes/class-factory-requirements.php' );
40
+
41
+ // @formatter:off
42
+ $cm_antspam_plugin_info = array(
43
+ 'prefix' => 'wantispam_',
44
+ 'plugin_name' => 'wantispam',
45
+ 'plugin_title' => __( 'Anti-Spam', 'anti-spam' ),
46
+
47
+ // PLUGIN SUPPORT
48
+ 'support_details' => array(
49
+ 'url' => 'https://anti-spam.space',
50
+ 'pages_map' => array(
51
+ 'support' => 'support', // {site}/support
52
+ 'docs' => 'docs' // {site}/docs
53
+ )
54
+ ),
55
+
56
+ // PLUGIN PREMIUM SETTINGS
57
+ 'has_premium' => true,
58
+ 'license_settings' => array(
59
+ 'provider' => 'freemius',
60
+ 'slug' => 'antispam-premium',
61
+ 'plugin_id' => '5079',
62
+ 'public_key' => 'pk_98a99846a14067246257d4f43c04a',
63
+ 'price' => 15,
64
+ 'has_updates' => true,
65
+ 'updates_settings' => array(
66
+ 'maybe_rollback' => true,
67
+ 'rollback_settings' => array(
68
+ 'prev_stable_version' => '0.0.0'
69
+ )
70
+ )
71
+ ),
72
+
73
+ // PLUGIN ADVERTS
74
+ 'render_adverts' => true,
75
+ 'adverts_settings' => array(
76
+ 'dashboard_widget' => true, // show dashboard widget (default: false)
77
+ 'right_sidebar' => true, // show adverts sidebar (default: false)
78
+ 'notice' => true, // show notice message (default: false)
79
+ ),
80
+
81
+ // FRAMEWORK MODULES
82
+ 'load_factory_modules' =>