Version Description
Current Release = Released: 29th September, 2019 - Release Notes
(v.1) FIXED: Comment SPAM blocking wasn't working if set to "Detect and Reject".
(v.1) FIXED: Shield Widget/Badge broken in some cases.
(v.1) ADDED: You can force Shield to operate in any locale, regardless of site locale.
(v.1) ADDED: Russian translations are now at 100% and some Dutch translations have been adjusted.
Download this release
Release Info
Developer | paultgoodchild |
Plugin | Shield Security for WordPress |
Version | 8.0.1 |
Comparing to | |
See all releases |
Code changes from version 8.0.0 to 8.0.1
- icwp-wpsf.php +1 -1
- languages/{default.mo → wp-simple-firewall-en_GB.mo} +0 -0
- languages/{default.po → wp-simple-firewall-en_GB.po} +79 -151
- languages/wp-simple-firewall-nl_NL.mo +0 -0
- languages/wp-simple-firewall-ru_RU.mo +0 -0
- plugin-spec.php +3 -3
- readme.txt +11 -3
- src/features/plugin.php +3 -1
- src/lib/src/Controller/Controller.php +26 -24
- src/lib/src/Modules/Base/BaseModCon.php +2029 -0
- src/lib/src/Modules/Base/BaseProcessor.php +294 -0
- src/lib/src/Modules/BaseShield/ShieldModCon.php +9 -0
- src/lib/src/Modules/BaseShield/ShieldProcessor.php +9 -0
- src/lib/src/Modules/CommentsFilter/Scan/Scanner.php +8 -2
- src/lib/src/Modules/ModConsumer.php +3 -2
- src/lib/src/Modules/Plugin/Components/BadgeWidget.php +63 -0
- src/lib/src/Modules/Plugin/Components/PluginBadge.php +92 -0
- src/lib/src/Modules/Plugin/Options.php +8 -0
- src/lib/vendor/composer/autoload_classmap.php +6 -0
- src/lib/vendor/composer/autoload_static.php +6 -0
- src/processors/plugin.php +44 -22
- src/processors/plugin_badge.php +10 -53
- src/processors/plugin_badgewidget.php +6 -48
- templates/twig/snippets/plugin_badge_widget.twig +152 -0
icwp-wpsf.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Shield Security
|
4 |
* Plugin URI: https://icwp.io/2f
|
5 |
* Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
|
6 |
-
* Version: 8.0.
|
7 |
* Text Domain: wp-simple-firewall
|
8 |
* Domain Path: /languages
|
9 |
* Author: One Dollar Plugin
|
3 |
* Plugin Name: Shield Security
|
4 |
* Plugin URI: https://icwp.io/2f
|
5 |
* Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
|
6 |
+
* Version: 8.0.1
|
7 |
* Text Domain: wp-simple-firewall
|
8 |
* Domain Path: /languages
|
9 |
* Author: One Dollar Plugin
|
languages/{default.mo → wp-simple-firewall-en_GB.mo}
RENAMED
Binary file
|
languages/{default.po → wp-simple-firewall-en_GB.po}
RENAMED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WPSF v2.0\n"
|
4 |
-
"POT-Creation-Date: 2019-08-
|
5 |
-
"PO-Revision-Date: 2019-08-
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: en_GB\n"
|
@@ -273,27 +273,28 @@ msgstr ""
|
|
273 |
msgid "%s isn't automatically updated"
|
274 |
msgstr ""
|
275 |
|
276 |
-
#: src/features/base.php:737 src/
|
277 |
-
#: src/wizards/plugin.php:
|
278 |
-
#: src/wizards/plugin.php:695
|
279 |
msgid "Disabled"
|
280 |
msgstr ""
|
281 |
|
282 |
-
#: src/features/base.php:1038
|
283 |
msgid ""
|
284 |
"Unfortunately your WordPress and/or PHP versions are too old to support this "
|
285 |
"feature."
|
286 |
msgstr ""
|
287 |
|
288 |
-
#: src/features/base.php:1192
|
289 |
msgid "You don't currently have permission to save settings."
|
290 |
msgstr ""
|
291 |
|
292 |
-
#: src/features/base.php:1286
|
293 |
msgid "Password values do not match."
|
294 |
msgstr ""
|
295 |
|
296 |
#: src/features/base.php:1519 src/lib/src/Modules/AuditTrail/Strings.php:195
|
|
|
297 |
#: src/lib/src/Modules/HackGuard/Strings.php:194
|
298 |
#: src/lib/src/Modules/HackGuard/Strings.php:268
|
299 |
#: src/lib/src/Modules/LoginGuard/Strings.php:265
|
@@ -305,11 +306,12 @@ msgstr ""
|
|
305 |
msgid "Default"
|
306 |
msgstr ""
|
307 |
|
308 |
-
#: src/features/base.php:1526
|
309 |
msgid "For more information:"
|
310 |
msgstr ""
|
311 |
|
312 |
-
#: src/features/base.php:1527 src/lib/src/Modules/
|
|
|
313 |
msgid "Support Forums"
|
314 |
msgstr ""
|
315 |
|
@@ -434,10 +436,9 @@ msgid "Re-install First"
|
|
434 |
msgstr ""
|
435 |
|
436 |
#: src/features/hack_protect.php:566
|
437 |
-
#, fuzzy
|
438 |
#| msgid "License Options"
|
439 |
msgid "Then Activate"
|
440 |
-
msgstr "
|
441 |
|
442 |
#: src/features/hack_protect.php:568 src/features/license.php:537
|
443 |
#: src/lib/src/Modules/Base/Strings.php:27 src/lib/src/Tables/Build/Ip.php:51
|
@@ -1188,7 +1189,7 @@ msgstr ""
|
|
1188 |
#: src/lib/src/Modules/IPs/Strings.php:66
|
1189 |
#: src/lib/src/Modules/Lockdown/Strings.php:130
|
1190 |
#: src/lib/src/Modules/Lockdown/Strings.php:143
|
1191 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
1192 |
#: src/lib/src/Modules/Plugin/Strings.php:214
|
1193 |
#: src/lib/src/Modules/Traffic/Strings.php:54
|
1194 |
#: src/processors/hackprotect_scan_apc.php:128
|
@@ -1389,7 +1390,7 @@ msgid ""
|
|
1389 |
msgstr ""
|
1390 |
|
1391 |
#: src/features/login_protect.php:511
|
1392 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
1393 |
#: src/processors/lockdown.php:95
|
1394 |
msgid "Learn More."
|
1395 |
msgstr ""
|
@@ -1623,7 +1624,7 @@ msgstr ""
|
|
1623 |
msgid "Limited or no password polices are active"
|
1624 |
msgstr ""
|
1625 |
|
1626 |
-
#: src/lib/src/Controller/Controller.php:
|
1627 |
msgid "Update Now To Keep Your Security Current With The Latest Features."
|
1628 |
msgstr ""
|
1629 |
|
@@ -1649,19 +1650,16 @@ msgid "not provided"
|
|
1649 |
msgstr ""
|
1650 |
|
1651 |
#: src/lib/src/Modules/AuditTrail/Strings.php:15
|
1652 |
-
#: src/processors/audit_trail_plugins.php:26
|
1653 |
#, php-format
|
1654 |
msgid "Plugin \"%s\" was activated."
|
1655 |
msgstr ""
|
1656 |
|
1657 |
#: src/lib/src/Modules/AuditTrail/Strings.php:18
|
1658 |
-
#: src/processors/audit_trail_plugins.php:39
|
1659 |
#, php-format
|
1660 |
msgid "Plugin \"%s\" was deactivated."
|
1661 |
msgstr ""
|
1662 |
|
1663 |
#: src/lib/src/Modules/AuditTrail/Strings.php:21
|
1664 |
-
#: src/processors/audit_trail_plugins.php:57
|
1665 |
#, php-format
|
1666 |
msgid ""
|
1667 |
"An attempt was made to edit the plugin file \"%s\" directly through the "
|
@@ -1669,13 +1667,11 @@ msgid ""
|
|
1669 |
msgstr ""
|
1670 |
|
1671 |
#: src/lib/src/Modules/AuditTrail/Strings.php:24
|
1672 |
-
#: src/processors/audit_trail_themes.php:22
|
1673 |
#, php-format
|
1674 |
msgid "Theme \"%s\" was activated."
|
1675 |
msgstr ""
|
1676 |
|
1677 |
#: src/lib/src/Modules/AuditTrail/Strings.php:27
|
1678 |
-
#: src/processors/audit_trail_themes.php:38
|
1679 |
#, php-format
|
1680 |
msgid ""
|
1681 |
"An attempt was made to edit the theme file \"%s\" directly through the "
|
@@ -1683,19 +1679,16 @@ msgid ""
|
|
1683 |
msgstr ""
|
1684 |
|
1685 |
#: src/lib/src/Modules/AuditTrail/Strings.php:30
|
1686 |
-
#: src/processors/audit_trail_wordpress.php:23
|
1687 |
#, php-format
|
1688 |
msgid "WordPress Core was updated from \"%s\" to \"%s\"."
|
1689 |
msgstr ""
|
1690 |
|
1691 |
#: src/lib/src/Modules/AuditTrail/Strings.php:33
|
1692 |
-
#: src/processors/audit_trail_wordpress.php:36
|
1693 |
#, php-format
|
1694 |
msgid "WordPress Permalinks Structure was updated from \"%s\" to \"%s\"."
|
1695 |
msgstr ""
|
1696 |
|
1697 |
#: src/lib/src/Modules/AuditTrail/Strings.php:36
|
1698 |
-
#: src/processors/audit_trail_posts.php:24
|
1699 |
#, php-format
|
1700 |
msgid "WordPress Post entitled \"%s\" was permanently deleted from trash."
|
1701 |
msgstr ""
|
@@ -1735,29 +1728,24 @@ msgid "Post entitled \"%s\" was unpublished."
|
|
1735 |
msgstr ""
|
1736 |
|
1737 |
#: src/lib/src/Modules/AuditTrail/Strings.php:59
|
1738 |
-
#: src/processors/audit_trail_users.php:25
|
1739 |
#, php-format
|
1740 |
msgid "Attempted user login by \"%s\" was successful."
|
1741 |
msgstr ""
|
1742 |
|
1743 |
#: src/lib/src/Modules/AuditTrail/Strings.php:62
|
1744 |
-
#: src/processors/audit_trail_users.php:39
|
1745 |
msgid "New WordPress user registered."
|
1746 |
msgstr ""
|
1747 |
|
1748 |
#: src/lib/src/Modules/AuditTrail/Strings.php:63
|
1749 |
-
#: src/processors/audit_trail_users.php:41
|
1750 |
#, php-format
|
1751 |
msgid "New username is \"%s\" with email address \"%s\"."
|
1752 |
msgstr ""
|
1753 |
|
1754 |
#: src/lib/src/Modules/AuditTrail/Strings.php:66
|
1755 |
-
#: src/processors/audit_trail_users.php:55
|
1756 |
msgid "WordPress user deleted."
|
1757 |
msgstr ""
|
1758 |
|
1759 |
#: src/lib/src/Modules/AuditTrail/Strings.php:67
|
1760 |
-
#: src/processors/audit_trail_users.php:62
|
1761 |
#, php-format
|
1762 |
msgid "Username was \"%s\" with email address \"%s\"."
|
1763 |
msgstr ""
|
@@ -1778,7 +1766,6 @@ msgid ""
|
|
1778 |
msgstr ""
|
1779 |
|
1780 |
#: src/lib/src/Modules/AuditTrail/Strings.php:75
|
1781 |
-
#: src/processors/audit_trail_emails.php:36
|
1782 |
#, php-format
|
1783 |
msgid "It was sent to \"%s\" with the subject \"%s\"."
|
1784 |
msgstr ""
|
@@ -1789,7 +1776,6 @@ msgid "The \"wp_mail\" function was called from the file \"%s\" on line %s."
|
|
1789 |
msgstr ""
|
1790 |
|
1791 |
#: src/lib/src/Modules/AuditTrail/Strings.php:80
|
1792 |
-
#: src/processors/audit_trail_emails.php:66
|
1793 |
#, php-format
|
1794 |
msgid "Attempting to log email, but data was not of the correct type (%s)"
|
1795 |
msgstr ""
|
@@ -2744,21 +2730,21 @@ msgstr ""
|
|
2744 |
msgid "To reset any message to its default, enter the text exactly: %s"
|
2745 |
msgstr ""
|
2746 |
|
2747 |
-
#: src/lib/src/Modules/CommentsFilter/AdminNotices.php:
|
2748 |
msgid "Akismet Anti-SPAM plugin is also running"
|
2749 |
msgstr ""
|
2750 |
|
2751 |
-
#: src/lib/src/Modules/CommentsFilter/AdminNotices.php:
|
2752 |
msgid ""
|
2753 |
"It appears you have Akismet Anti-SPAM running alongside the our human Anti-"
|
2754 |
"SPAM filter."
|
2755 |
msgstr ""
|
2756 |
|
2757 |
-
#: src/lib/src/Modules/CommentsFilter/AdminNotices.php:
|
2758 |
msgid "This is not recommended and you should disable Akismet."
|
2759 |
msgstr ""
|
2760 |
|
2761 |
-
#: src/lib/src/Modules/CommentsFilter/AdminNotices.php:
|
2762 |
msgid "Click to deactivate Akismet now."
|
2763 |
msgstr ""
|
2764 |
|
@@ -3537,10 +3523,9 @@ msgid "Plugin File Edited"
|
|
3537 |
msgstr ""
|
3538 |
|
3539 |
#: src/lib/src/Modules/Events/Strings.php:228
|
3540 |
-
#, fuzzy
|
3541 |
#| msgid "License Options"
|
3542 |
msgid "Theme Activated"
|
3543 |
-
msgstr "
|
3544 |
|
3545 |
#: src/lib/src/Modules/Events/Strings.php:229
|
3546 |
msgid "Theme File Edited"
|
@@ -3607,16 +3592,14 @@ msgid "License Check Success"
|
|
3607 |
msgstr ""
|
3608 |
|
3609 |
#: src/lib/src/Modules/Events/Strings.php:245
|
3610 |
-
#, fuzzy
|
3611 |
#| msgid "License Key"
|
3612 |
msgid "License Failure Email"
|
3613 |
-
msgstr "
|
3614 |
|
3615 |
#: src/lib/src/Modules/Events/Strings.php:246
|
3616 |
-
#, fuzzy
|
3617 |
#| msgid "License Options"
|
3618 |
msgid "License Deactivated"
|
3619 |
-
msgstr "
|
3620 |
|
3621 |
#: src/lib/src/Modules/Firewall/Strings.php:23
|
3622 |
msgid ""
|
@@ -4779,24 +4762,24 @@ msgid ""
|
|
4779 |
"\"."
|
4780 |
msgstr ""
|
4781 |
|
4782 |
-
#: src/lib/src/Modules/IPs/AdminNotices.php:
|
4783 |
#, php-format
|
4784 |
msgid "%s is ignoring you"
|
4785 |
msgstr ""
|
4786 |
|
4787 |
-
#: src/lib/src/Modules/IPs/AdminNotices.php:
|
4788 |
#: src/lib/src/Modules/Plugin/Strings.php:382
|
4789 |
#: src/processors/plugin_badge.php:43
|
4790 |
#, php-format
|
4791 |
msgid "Your IP address is: %s"
|
4792 |
msgstr ""
|
4793 |
|
4794 |
-
#: src/lib/src/Modules/IPs/AdminNotices.php:
|
4795 |
msgid ""
|
4796 |
"Your IP address is whitelisted and NO features you activate apply to you."
|
4797 |
msgstr ""
|
4798 |
|
4799 |
-
#: src/lib/src/Modules/IPs/AdminNotices.php:
|
4800 |
msgid "Including the hiding the WP Login page."
|
4801 |
msgstr ""
|
4802 |
|
@@ -5452,16 +5435,14 @@ msgid "Valid license couldn't be found."
|
|
5452 |
msgstr ""
|
5453 |
|
5454 |
#: src/lib/src/Modules/License/Strings.php:14
|
5455 |
-
#, fuzzy
|
5456 |
#| msgid "License Key"
|
5457 |
msgid "License Summary"
|
5458 |
-
msgstr "
|
5459 |
|
5460 |
#: src/lib/src/Modules/License/Strings.php:15
|
5461 |
-
#, fuzzy
|
5462 |
#| msgid "License Options"
|
5463 |
msgid "License Activation"
|
5464 |
-
msgstr "
|
5465 |
|
5466 |
#: src/lib/src/Modules/License/Strings.php:16
|
5467 |
msgid "Check License Availability For This Site"
|
@@ -5735,30 +5716,30 @@ msgid ""
|
|
5735 |
"Enabling this option may interfere with expected operations of your site."
|
5736 |
msgstr ""
|
5737 |
|
5738 |
-
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:
|
5739 |
msgid "Please verify email has been received"
|
5740 |
msgstr ""
|
5741 |
|
5742 |
-
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:
|
5743 |
msgid ""
|
5744 |
"Before we can activate email 2-factor authentication, we need you to confirm "
|
5745 |
"your website can send emails."
|
5746 |
msgstr ""
|
5747 |
|
5748 |
-
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:
|
5749 |
msgid "Please click the link in the email you received."
|
5750 |
msgstr ""
|
5751 |
|
5752 |
-
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:
|
5753 |
#, php-format
|
5754 |
msgid "The email has been sent to you at blog admin address: %s"
|
5755 |
msgstr ""
|
5756 |
|
5757 |
-
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:
|
5758 |
msgid "Resend verification email"
|
5759 |
msgstr ""
|
5760 |
|
5761 |
-
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:
|
5762 |
msgid "Disable 2FA by email"
|
5763 |
msgstr ""
|
5764 |
|
@@ -6320,122 +6301,122 @@ msgid ""
|
|
6320 |
"don't check the box."
|
6321 |
msgstr ""
|
6322 |
|
6323 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6324 |
#, php-format
|
6325 |
msgid "%s is not protecting your site"
|
6326 |
msgstr ""
|
6327 |
|
6328 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6329 |
#, php-format
|
6330 |
msgid "Please delete the \"%s\" file to reactivate %s protection"
|
6331 |
msgstr ""
|
6332 |
|
6333 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6334 |
msgid "Click here to automatically delete the file"
|
6335 |
msgstr ""
|
6336 |
|
6337 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6338 |
msgid "Your Name"
|
6339 |
msgstr ""
|
6340 |
|
6341 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6342 |
msgid "Your Email"
|
6343 |
msgstr ""
|
6344 |
|
6345 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6346 |
msgid "Sign-Up"
|
6347 |
msgstr ""
|
6348 |
|
6349 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6350 |
msgid "I agree to Ts & Cs"
|
6351 |
msgstr ""
|
6352 |
|
6353 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6354 |
#, php-format
|
6355 |
msgid "Update available for the %s plugin"
|
6356 |
msgstr ""
|
6357 |
|
6358 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6359 |
msgid "Please click to update immediately"
|
6360 |
msgstr ""
|
6361 |
|
6362 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6363 |
msgid "Dismiss this notice"
|
6364 |
msgstr ""
|
6365 |
|
6366 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6367 |
msgid "I don't need the setup wizard just now"
|
6368 |
msgstr ""
|
6369 |
|
6370 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6371 |
#, php-format
|
6372 |
msgid "Get started quickly with the %s Setup Wizard"
|
6373 |
msgstr ""
|
6374 |
|
6375 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6376 |
#, php-format
|
6377 |
msgid ""
|
6378 |
"The welcome wizard will help you get setup quickly and become familiar with "
|
6379 |
"some of the core %s features"
|
6380 |
msgstr ""
|
6381 |
|
6382 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6383 |
msgid "Launch the welcome wizard"
|
6384 |
msgstr ""
|
6385 |
|
6386 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6387 |
#, php-format
|
6388 |
msgid "Make %s even better by sharing usage info?"
|
6389 |
msgstr ""
|
6390 |
|
6391 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6392 |
#, php-format
|
6393 |
msgid "We're hoping to understand how %s is configured and used."
|
6394 |
msgstr ""
|
6395 |
|
6396 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6397 |
msgid "We'd like to understand how effective it is on a global scale."
|
6398 |
msgstr ""
|
6399 |
|
6400 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6401 |
msgid ""
|
6402 |
"The data sent is always completely anonymous and we can never track you or "
|
6403 |
"your site."
|
6404 |
msgstr ""
|
6405 |
|
6406 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6407 |
msgid "It can be turned-off at any time within the plugin options."
|
6408 |
msgstr ""
|
6409 |
|
6410 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6411 |
msgid "Click to see the RAW data that would be sent"
|
6412 |
msgstr ""
|
6413 |
|
6414 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6415 |
msgid "Absolutely"
|
6416 |
msgstr ""
|
6417 |
|
6418 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6419 |
msgid "Yes, I'd be happy share this info"
|
6420 |
msgstr ""
|
6421 |
|
6422 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6423 |
msgid "I'd like to learn more, please"
|
6424 |
msgstr ""
|
6425 |
|
6426 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6427 |
msgid "No, I don't want to help"
|
6428 |
msgstr ""
|
6429 |
|
6430 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6431 |
msgid "Can You Help Us With A Quick Review?"
|
6432 |
msgstr ""
|
6433 |
|
6434 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6435 |
msgid "I'd rather not show this support"
|
6436 |
msgstr ""
|
6437 |
|
6438 |
-
#: src/lib/src/Modules/Plugin/AdminNotices.php:
|
6439 |
msgid "I've done this already"
|
6440 |
msgstr ""
|
6441 |
|
@@ -6944,7 +6925,7 @@ msgstr ""
|
|
6944 |
|
6945 |
#: src/lib/src/Modules/Plugin/Strings.php:321
|
6946 |
msgid "Search Engines"
|
6947 |
-
msgstr "
|
6948 |
|
6949 |
#: src/lib/src/Modules/Plugin/Strings.php:322
|
6950 |
msgid "Uptime Monitoring Services"
|
@@ -7320,53 +7301,53 @@ msgstr ""
|
|
7320 |
msgid "Go To Security Dashboard"
|
7321 |
msgstr ""
|
7322 |
|
7323 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7324 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7325 |
#, php-format
|
7326 |
msgid "%s Security Restrictions Applied"
|
7327 |
msgstr ""
|
7328 |
|
7329 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7330 |
msgid ""
|
7331 |
"Altering certain options has been restricted by your WordPress security "
|
7332 |
"administrator."
|
7333 |
msgstr ""
|
7334 |
|
7335 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7336 |
msgid ""
|
7337 |
"Repeated failed attempts to authenticate will probably lock you out of this "
|
7338 |
"site."
|
7339 |
msgstr ""
|
7340 |
|
7341 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7342 |
msgid "Admin Access Login"
|
7343 |
msgstr ""
|
7344 |
|
7345 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7346 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7347 |
#, php-format
|
7348 |
msgid "Go here to manage settings and authenticate with the %s plugin."
|
7349 |
msgstr ""
|
7350 |
|
7351 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7352 |
msgid ""
|
7353 |
"Editing existing administrators, promoting existing users to the "
|
7354 |
"administrator role, or deleting administrator users is currently restricted."
|
7355 |
msgstr ""
|
7356 |
|
7357 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7358 |
msgid ""
|
7359 |
"Please authenticate with the Security Admin system before attempting any "
|
7360 |
"administrator user modifications."
|
7361 |
msgstr ""
|
7362 |
|
7363 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7364 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7365 |
#: src/processors/admin_access_restriction.php:485
|
7366 |
msgid "Security Admin Login"
|
7367 |
msgstr ""
|
7368 |
|
7369 |
-
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:
|
7370 |
msgid "Unlock Now"
|
7371 |
msgstr ""
|
7372 |
|
@@ -8427,18 +8408,18 @@ msgstr ""
|
|
8427 |
msgid "Please contact your website administrator."
|
8428 |
msgstr ""
|
8429 |
|
8430 |
-
#: src/lib/src/Scans/Mal/Repair.php:
|
8431 |
#, php-format
|
8432 |
msgid "%s not installed from WordPress.org."
|
8433 |
msgstr ""
|
8434 |
|
8435 |
-
#: src/lib/src/Scans/Mal/Repair.php:
|
8436 |
#: src/processors/hackprotect_scan_apc.php:112
|
8437 |
#: src/processors/hackprotect_scan_wpv.php:286
|
8438 |
msgid "Plugin"
|
8439 |
msgstr ""
|
8440 |
|
8441 |
-
#: src/lib/src/Scans/Mal/Repair.php:
|
8442 |
msgid "Plugin developer doesn't use SVN tags for official releases."
|
8443 |
msgstr ""
|
8444 |
|
@@ -8650,59 +8631,6 @@ msgstr ""
|
|
8650 |
msgid "Unlock"
|
8651 |
msgstr ""
|
8652 |
|
8653 |
-
#: src/processors/audit_trail_emails.php:35
|
8654 |
-
#, php-format
|
8655 |
-
msgid "There was an attempt to send an email using the \"%s\" function."
|
8656 |
-
msgstr ""
|
8657 |
-
|
8658 |
-
#: src/processors/audit_trail_emails.php:58
|
8659 |
-
#, php-format
|
8660 |
-
msgid "The \"%s\" function was called from the file \"%s\" on line %s."
|
8661 |
-
msgstr ""
|
8662 |
-
|
8663 |
-
#: src/processors/audit_trail_posts.php:43
|
8664 |
-
msgid "moved to trash"
|
8665 |
-
msgstr ""
|
8666 |
-
|
8667 |
-
#: src/processors/audit_trail_posts.php:47
|
8668 |
-
msgid "recovered from trash"
|
8669 |
-
msgstr ""
|
8670 |
-
|
8671 |
-
#: src/processors/audit_trail_posts.php:53
|
8672 |
-
#: src/processors/audit_trail_posts.php:66
|
8673 |
-
msgid "updated"
|
8674 |
-
msgstr ""
|
8675 |
-
|
8676 |
-
#: src/processors/audit_trail_posts.php:57
|
8677 |
-
msgid "published"
|
8678 |
-
msgstr ""
|
8679 |
-
|
8680 |
-
#: src/processors/audit_trail_posts.php:62
|
8681 |
-
msgid "unpublished"
|
8682 |
-
msgstr ""
|
8683 |
-
|
8684 |
-
#: src/processors/audit_trail_posts.php:70
|
8685 |
-
#, php-format
|
8686 |
-
msgid "Post entitled \"%s\" was %s."
|
8687 |
-
msgstr ""
|
8688 |
-
|
8689 |
-
#: src/processors/audit_trail_posts.php:71
|
8690 |
-
msgid "Post Type"
|
8691 |
-
msgstr ""
|
8692 |
-
|
8693 |
-
#: src/processors/audit_trail_users.php:59
|
8694 |
-
msgid "User is unknown as it could not be loaded."
|
8695 |
-
msgstr ""
|
8696 |
-
|
8697 |
-
#: src/processors/audit_trail_users.php:69
|
8698 |
-
msgid "Their posts were not reassigned to another user."
|
8699 |
-
msgstr ""
|
8700 |
-
|
8701 |
-
#: src/processors/audit_trail_users.php:72
|
8702 |
-
#, php-format
|
8703 |
-
msgid "Their posts were reassigned to user \"%s\"."
|
8704 |
-
msgstr ""
|
8705 |
-
|
8706 |
#: src/processors/autoupdates.php:467
|
8707 |
#, php-format
|
8708 |
msgid ""
|
@@ -8969,7 +8897,7 @@ msgstr ""
|
|
8969 |
msgid "Abandoned Plugin(s) Discovered On Your Site."
|
8970 |
msgstr ""
|
8971 |
|
8972 |
-
#: src/processors/hackprotect_scan_base.php:
|
8973 |
msgid "Run Scanner"
|
8974 |
msgstr ""
|
8975 |
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: WPSF v2.0\n"
|
4 |
+
"POT-Creation-Date: 2019-08-29 09:21+0100\n"
|
5 |
+
"PO-Revision-Date: 2019-08-29 09:23+0100\n"
|
6 |
"Last-Translator: \n"
|
7 |
"Language-Team: \n"
|
8 |
"Language: en_GB\n"
|
273 |
msgid "%s isn't automatically updated"
|
274 |
msgstr ""
|
275 |
|
276 |
+
#: src/features/base.php:737 src/lib/src/Modules/Base/BaseModCon.php:741
|
277 |
+
#: src/wizards/plugin.php:482 src/wizards/plugin.php:515
|
278 |
+
#: src/wizards/plugin.php:551 src/wizards/plugin.php:695
|
279 |
msgid "Disabled"
|
280 |
msgstr ""
|
281 |
|
282 |
+
#: src/features/base.php:1038 src/lib/src/Modules/Base/BaseModCon.php:1042
|
283 |
msgid ""
|
284 |
"Unfortunately your WordPress and/or PHP versions are too old to support this "
|
285 |
"feature."
|
286 |
msgstr ""
|
287 |
|
288 |
+
#: src/features/base.php:1192 src/lib/src/Modules/Base/BaseModCon.php:1196
|
289 |
msgid "You don't currently have permission to save settings."
|
290 |
msgstr ""
|
291 |
|
292 |
+
#: src/features/base.php:1286 src/lib/src/Modules/Base/BaseModCon.php:1290
|
293 |
msgid "Password values do not match."
|
294 |
msgstr ""
|
295 |
|
296 |
#: src/features/base.php:1519 src/lib/src/Modules/AuditTrail/Strings.php:195
|
297 |
+
#: src/lib/src/Modules/Base/BaseModCon.php:1523
|
298 |
#: src/lib/src/Modules/HackGuard/Strings.php:194
|
299 |
#: src/lib/src/Modules/HackGuard/Strings.php:268
|
300 |
#: src/lib/src/Modules/LoginGuard/Strings.php:265
|
306 |
msgid "Default"
|
307 |
msgstr ""
|
308 |
|
309 |
+
#: src/features/base.php:1526 src/lib/src/Modules/Base/BaseModCon.php:1530
|
310 |
msgid "For more information:"
|
311 |
msgstr ""
|
312 |
|
313 |
+
#: src/features/base.php:1527 src/lib/src/Modules/Base/BaseModCon.php:1531
|
314 |
+
#: src/lib/src/Modules/Plugin/Strings.php:431
|
315 |
msgid "Support Forums"
|
316 |
msgstr ""
|
317 |
|
436 |
msgstr ""
|
437 |
|
438 |
#: src/features/hack_protect.php:566
|
|
|
439 |
#| msgid "License Options"
|
440 |
msgid "Then Activate"
|
441 |
+
msgstr ""
|
442 |
|
443 |
#: src/features/hack_protect.php:568 src/features/license.php:537
|
444 |
#: src/lib/src/Modules/Base/Strings.php:27 src/lib/src/Tables/Build/Ip.php:51
|
1189 |
#: src/lib/src/Modules/IPs/Strings.php:66
|
1190 |
#: src/lib/src/Modules/Lockdown/Strings.php:130
|
1191 |
#: src/lib/src/Modules/Lockdown/Strings.php:143
|
1192 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:88
|
1193 |
#: src/lib/src/Modules/Plugin/Strings.php:214
|
1194 |
#: src/lib/src/Modules/Traffic/Strings.php:54
|
1195 |
#: src/processors/hackprotect_scan_apc.php:128
|
1390 |
msgstr ""
|
1391 |
|
1392 |
#: src/features/login_protect.php:511
|
1393 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:194
|
1394 |
#: src/processors/lockdown.php:95
|
1395 |
msgid "Learn More."
|
1396 |
msgstr ""
|
1624 |
msgid "Limited or no password polices are active"
|
1625 |
msgstr ""
|
1626 |
|
1627 |
+
#: src/lib/src/Controller/Controller.php:730
|
1628 |
msgid "Update Now To Keep Your Security Current With The Latest Features."
|
1629 |
msgstr ""
|
1630 |
|
1650 |
msgstr ""
|
1651 |
|
1652 |
#: src/lib/src/Modules/AuditTrail/Strings.php:15
|
|
|
1653 |
#, php-format
|
1654 |
msgid "Plugin \"%s\" was activated."
|
1655 |
msgstr ""
|
1656 |
|
1657 |
#: src/lib/src/Modules/AuditTrail/Strings.php:18
|
|
|
1658 |
#, php-format
|
1659 |
msgid "Plugin \"%s\" was deactivated."
|
1660 |
msgstr ""
|
1661 |
|
1662 |
#: src/lib/src/Modules/AuditTrail/Strings.php:21
|
|
|
1663 |
#, php-format
|
1664 |
msgid ""
|
1665 |
"An attempt was made to edit the plugin file \"%s\" directly through the "
|
1667 |
msgstr ""
|
1668 |
|
1669 |
#: src/lib/src/Modules/AuditTrail/Strings.php:24
|
|
|
1670 |
#, php-format
|
1671 |
msgid "Theme \"%s\" was activated."
|
1672 |
msgstr ""
|
1673 |
|
1674 |
#: src/lib/src/Modules/AuditTrail/Strings.php:27
|
|
|
1675 |
#, php-format
|
1676 |
msgid ""
|
1677 |
"An attempt was made to edit the theme file \"%s\" directly through the "
|
1679 |
msgstr ""
|
1680 |
|
1681 |
#: src/lib/src/Modules/AuditTrail/Strings.php:30
|
|
|
1682 |
#, php-format
|
1683 |
msgid "WordPress Core was updated from \"%s\" to \"%s\"."
|
1684 |
msgstr ""
|
1685 |
|
1686 |
#: src/lib/src/Modules/AuditTrail/Strings.php:33
|
|
|
1687 |
#, php-format
|
1688 |
msgid "WordPress Permalinks Structure was updated from \"%s\" to \"%s\"."
|
1689 |
msgstr ""
|
1690 |
|
1691 |
#: src/lib/src/Modules/AuditTrail/Strings.php:36
|
|
|
1692 |
#, php-format
|
1693 |
msgid "WordPress Post entitled \"%s\" was permanently deleted from trash."
|
1694 |
msgstr ""
|
1728 |
msgstr ""
|
1729 |
|
1730 |
#: src/lib/src/Modules/AuditTrail/Strings.php:59
|
|
|
1731 |
#, php-format
|
1732 |
msgid "Attempted user login by \"%s\" was successful."
|
1733 |
msgstr ""
|
1734 |
|
1735 |
#: src/lib/src/Modules/AuditTrail/Strings.php:62
|
|
|
1736 |
msgid "New WordPress user registered."
|
1737 |
msgstr ""
|
1738 |
|
1739 |
#: src/lib/src/Modules/AuditTrail/Strings.php:63
|
|
|
1740 |
#, php-format
|
1741 |
msgid "New username is \"%s\" with email address \"%s\"."
|
1742 |
msgstr ""
|
1743 |
|
1744 |
#: src/lib/src/Modules/AuditTrail/Strings.php:66
|
|
|
1745 |
msgid "WordPress user deleted."
|
1746 |
msgstr ""
|
1747 |
|
1748 |
#: src/lib/src/Modules/AuditTrail/Strings.php:67
|
|
|
1749 |
#, php-format
|
1750 |
msgid "Username was \"%s\" with email address \"%s\"."
|
1751 |
msgstr ""
|
1766 |
msgstr ""
|
1767 |
|
1768 |
#: src/lib/src/Modules/AuditTrail/Strings.php:75
|
|
|
1769 |
#, php-format
|
1770 |
msgid "It was sent to \"%s\" with the subject \"%s\"."
|
1771 |
msgstr ""
|
1776 |
msgstr ""
|
1777 |
|
1778 |
#: src/lib/src/Modules/AuditTrail/Strings.php:80
|
|
|
1779 |
#, php-format
|
1780 |
msgid "Attempting to log email, but data was not of the correct type (%s)"
|
1781 |
msgstr ""
|
2730 |
msgid "To reset any message to its default, enter the text exactly: %s"
|
2731 |
msgstr ""
|
2732 |
|
2733 |
+
#: src/lib/src/Modules/CommentsFilter/AdminNotices.php:37
|
2734 |
msgid "Akismet Anti-SPAM plugin is also running"
|
2735 |
msgstr ""
|
2736 |
|
2737 |
+
#: src/lib/src/Modules/CommentsFilter/AdminNotices.php:38
|
2738 |
msgid ""
|
2739 |
"It appears you have Akismet Anti-SPAM running alongside the our human Anti-"
|
2740 |
"SPAM filter."
|
2741 |
msgstr ""
|
2742 |
|
2743 |
+
#: src/lib/src/Modules/CommentsFilter/AdminNotices.php:39
|
2744 |
msgid "This is not recommended and you should disable Akismet."
|
2745 |
msgstr ""
|
2746 |
|
2747 |
+
#: src/lib/src/Modules/CommentsFilter/AdminNotices.php:40
|
2748 |
msgid "Click to deactivate Akismet now."
|
2749 |
msgstr ""
|
2750 |
|
3523 |
msgstr ""
|
3524 |
|
3525 |
#: src/lib/src/Modules/Events/Strings.php:228
|
|
|
3526 |
#| msgid "License Options"
|
3527 |
msgid "Theme Activated"
|
3528 |
+
msgstr ""
|
3529 |
|
3530 |
#: src/lib/src/Modules/Events/Strings.php:229
|
3531 |
msgid "Theme File Edited"
|
3592 |
msgstr ""
|
3593 |
|
3594 |
#: src/lib/src/Modules/Events/Strings.php:245
|
|
|
3595 |
#| msgid "License Key"
|
3596 |
msgid "License Failure Email"
|
3597 |
+
msgstr ""
|
3598 |
|
3599 |
#: src/lib/src/Modules/Events/Strings.php:246
|
|
|
3600 |
#| msgid "License Options"
|
3601 |
msgid "License Deactivated"
|
3602 |
+
msgstr ""
|
3603 |
|
3604 |
#: src/lib/src/Modules/Firewall/Strings.php:23
|
3605 |
msgid ""
|
4762 |
"\"."
|
4763 |
msgstr ""
|
4764 |
|
4765 |
+
#: src/lib/src/Modules/IPs/AdminNotices.php:36
|
4766 |
#, php-format
|
4767 |
msgid "%s is ignoring you"
|
4768 |
msgstr ""
|
4769 |
|
4770 |
+
#: src/lib/src/Modules/IPs/AdminNotices.php:40
|
4771 |
#: src/lib/src/Modules/Plugin/Strings.php:382
|
4772 |
#: src/processors/plugin_badge.php:43
|
4773 |
#, php-format
|
4774 |
msgid "Your IP address is: %s"
|
4775 |
msgstr ""
|
4776 |
|
4777 |
+
#: src/lib/src/Modules/IPs/AdminNotices.php:43
|
4778 |
msgid ""
|
4779 |
"Your IP address is whitelisted and NO features you activate apply to you."
|
4780 |
msgstr ""
|
4781 |
|
4782 |
+
#: src/lib/src/Modules/IPs/AdminNotices.php:44
|
4783 |
msgid "Including the hiding the WP Login page."
|
4784 |
msgstr ""
|
4785 |
|
5435 |
msgstr ""
|
5436 |
|
5437 |
#: src/lib/src/Modules/License/Strings.php:14
|
|
|
5438 |
#| msgid "License Key"
|
5439 |
msgid "License Summary"
|
5440 |
+
msgstr ""
|
5441 |
|
5442 |
#: src/lib/src/Modules/License/Strings.php:15
|
|
|
5443 |
#| msgid "License Options"
|
5444 |
msgid "License Activation"
|
5445 |
+
msgstr ""
|
5446 |
|
5447 |
#: src/lib/src/Modules/License/Strings.php:16
|
5448 |
msgid "Check License Availability For This Site"
|
5716 |
"Enabling this option may interfere with expected operations of your site."
|
5717 |
msgstr ""
|
5718 |
|
5719 |
+
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:38
|
5720 |
msgid "Please verify email has been received"
|
5721 |
msgstr ""
|
5722 |
|
5723 |
+
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:39
|
5724 |
msgid ""
|
5725 |
"Before we can activate email 2-factor authentication, we need you to confirm "
|
5726 |
"your website can send emails."
|
5727 |
msgstr ""
|
5728 |
|
5729 |
+
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:40
|
5730 |
msgid "Please click the link in the email you received."
|
5731 |
msgstr ""
|
5732 |
|
5733 |
+
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:42
|
5734 |
#, php-format
|
5735 |
msgid "The email has been sent to you at blog admin address: %s"
|
5736 |
msgstr ""
|
5737 |
|
5738 |
+
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:45
|
5739 |
msgid "Resend verification email"
|
5740 |
msgstr ""
|
5741 |
|
5742 |
+
#: src/lib/src/Modules/LoginGuard/AdminNotices.php:46
|
5743 |
msgid "Disable 2FA by email"
|
5744 |
msgstr ""
|
5745 |
|
6301 |
"don't check the box."
|
6302 |
msgstr ""
|
6303 |
|
6304 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:88
|
6305 |
#, php-format
|
6306 |
msgid "%s is not protecting your site"
|
6307 |
msgstr ""
|
6308 |
|
6309 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:90
|
6310 |
#, php-format
|
6311 |
msgid "Please delete the \"%s\" file to reactivate %s protection"
|
6312 |
msgstr ""
|
6313 |
|
6314 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:94
|
6315 |
msgid "Click here to automatically delete the file"
|
6316 |
msgstr ""
|
6317 |
|
6318 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:116
|
6319 |
msgid "Your Name"
|
6320 |
msgstr ""
|
6321 |
|
6322 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:117
|
6323 |
msgid "Your Email"
|
6324 |
msgstr ""
|
6325 |
|
6326 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:118
|
6327 |
msgid "Sign-Up"
|
6328 |
msgstr ""
|
6329 |
|
6330 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:126
|
6331 |
msgid "I agree to Ts & Cs"
|
6332 |
msgstr ""
|
6333 |
|
6334 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:148
|
6335 |
#, php-format
|
6336 |
msgid "Update available for the %s plugin"
|
6337 |
msgstr ""
|
6338 |
|
6339 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:149
|
6340 |
msgid "Please click to update immediately"
|
6341 |
msgstr ""
|
6342 |
|
6343 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:150
|
6344 |
msgid "Dismiss this notice"
|
6345 |
msgstr ""
|
6346 |
|
6347 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:166
|
6348 |
msgid "I don't need the setup wizard just now"
|
6349 |
msgstr ""
|
6350 |
|
6351 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:167
|
6352 |
#, php-format
|
6353 |
msgid "Get started quickly with the %s Setup Wizard"
|
6354 |
msgstr ""
|
6355 |
|
6356 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:168
|
6357 |
#, php-format
|
6358 |
msgid ""
|
6359 |
"The welcome wizard will help you get setup quickly and become familiar with "
|
6360 |
"some of the core %s features"
|
6361 |
msgstr ""
|
6362 |
|
6363 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:169
|
6364 |
msgid "Launch the welcome wizard"
|
6365 |
msgstr ""
|
6366 |
|
6367 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:188
|
6368 |
#, php-format
|
6369 |
msgid "Make %s even better by sharing usage info?"
|
6370 |
msgstr ""
|
6371 |
|
6372 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:189
|
6373 |
#, php-format
|
6374 |
msgid "We're hoping to understand how %s is configured and used."
|
6375 |
msgstr ""
|
6376 |
|
6377 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:190
|
6378 |
msgid "We'd like to understand how effective it is on a global scale."
|
6379 |
msgstr ""
|
6380 |
|
6381 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:191
|
6382 |
msgid ""
|
6383 |
"The data sent is always completely anonymous and we can never track you or "
|
6384 |
"your site."
|
6385 |
msgstr ""
|
6386 |
|
6387 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:192
|
6388 |
msgid "It can be turned-off at any time within the plugin options."
|
6389 |
msgstr ""
|
6390 |
|
6391 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:193
|
6392 |
msgid "Click to see the RAW data that would be sent"
|
6393 |
msgstr ""
|
6394 |
|
6395 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:196
|
6396 |
msgid "Absolutely"
|
6397 |
msgstr ""
|
6398 |
|
6399 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:197
|
6400 |
msgid "Yes, I'd be happy share this info"
|
6401 |
msgstr ""
|
6402 |
|
6403 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:198
|
6404 |
msgid "I'd like to learn more, please"
|
6405 |
msgstr ""
|
6406 |
|
6407 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:199
|
6408 |
msgid "No, I don't want to help"
|
6409 |
msgstr ""
|
6410 |
|
6411 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:220
|
6412 |
msgid "Can You Help Us With A Quick Review?"
|
6413 |
msgstr ""
|
6414 |
|
6415 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:221
|
6416 |
msgid "I'd rather not show this support"
|
6417 |
msgstr ""
|
6418 |
|
6419 |
+
#: src/lib/src/Modules/Plugin/AdminNotices.php:221
|
6420 |
msgid "I've done this already"
|
6421 |
msgstr ""
|
6422 |
|
6925 |
|
6926 |
#: src/lib/src/Modules/Plugin/Strings.php:321
|
6927 |
msgid "Search Engines"
|
6928 |
+
msgstr ""
|
6929 |
|
6930 |
#: src/lib/src/Modules/Plugin/Strings.php:322
|
6931 |
msgid "Uptime Monitoring Services"
|
7301 |
msgid "Go To Security Dashboard"
|
7302 |
msgstr ""
|
7303 |
|
7304 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:42
|
7305 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:67
|
7306 |
#, php-format
|
7307 |
msgid "%s Security Restrictions Applied"
|
7308 |
msgstr ""
|
7309 |
|
7310 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:43
|
7311 |
msgid ""
|
7312 |
"Altering certain options has been restricted by your WordPress security "
|
7313 |
"administrator."
|
7314 |
msgstr ""
|
7315 |
|
7316 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:44
|
7317 |
msgid ""
|
7318 |
"Repeated failed attempts to authenticate will probably lock you out of this "
|
7319 |
"site."
|
7320 |
msgstr ""
|
7321 |
|
7322 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:50
|
7323 |
msgid "Admin Access Login"
|
7324 |
msgstr ""
|
7325 |
|
7326 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:51
|
7327 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:82
|
7328 |
#, php-format
|
7329 |
msgid "Go here to manage settings and authenticate with the %s plugin."
|
7330 |
msgstr ""
|
7331 |
|
7332 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:68
|
7333 |
msgid ""
|
7334 |
"Editing existing administrators, promoting existing users to the "
|
7335 |
"administrator role, or deleting administrator users is currently restricted."
|
7336 |
msgstr ""
|
7337 |
|
7338 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:69
|
7339 |
msgid ""
|
7340 |
"Please authenticate with the Security Admin system before attempting any "
|
7341 |
"administrator user modifications."
|
7342 |
msgstr ""
|
7343 |
|
7344 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:73
|
7345 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:81
|
7346 |
#: src/processors/admin_access_restriction.php:485
|
7347 |
msgid "Security Admin Login"
|
7348 |
msgstr ""
|
7349 |
|
7350 |
+
#: src/lib/src/Modules/SecurityAdmin/AdminNotices.php:74
|
7351 |
msgid "Unlock Now"
|
7352 |
msgstr ""
|
7353 |
|
8408 |
msgid "Please contact your website administrator."
|
8409 |
msgstr ""
|
8410 |
|
8411 |
+
#: src/lib/src/Scans/Mal/Repair.php:77
|
8412 |
#, php-format
|
8413 |
msgid "%s not installed from WordPress.org."
|
8414 |
msgstr ""
|
8415 |
|
8416 |
+
#: src/lib/src/Scans/Mal/Repair.php:78 src/processors/hack_protect.php:293
|
8417 |
#: src/processors/hackprotect_scan_apc.php:112
|
8418 |
#: src/processors/hackprotect_scan_wpv.php:286
|
8419 |
msgid "Plugin"
|
8420 |
msgstr ""
|
8421 |
|
8422 |
+
#: src/lib/src/Scans/Mal/Repair.php:85
|
8423 |
msgid "Plugin developer doesn't use SVN tags for official releases."
|
8424 |
msgstr ""
|
8425 |
|
8631 |
msgid "Unlock"
|
8632 |
msgstr ""
|
8633 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
8634 |
#: src/processors/autoupdates.php:467
|
8635 |
#, php-format
|
8636 |
msgid ""
|
8897 |
msgid "Abandoned Plugin(s) Discovered On Your Site."
|
8898 |
msgstr ""
|
8899 |
|
8900 |
+
#: src/processors/hackprotect_scan_base.php:506
|
8901 |
msgid "Run Scanner"
|
8902 |
msgstr ""
|
8903 |
|
languages/wp-simple-firewall-nl_NL.mo
CHANGED
Binary file
|
languages/wp-simple-firewall-ru_RU.mo
CHANGED
Binary file
|
plugin-spec.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
{
|
2 |
"properties": {
|
3 |
-
"version": "8.0.
|
4 |
-
"release_timestamp":
|
5 |
-
"build": "201908.
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"human_name": "Shield",
|
1 |
{
|
2 |
"properties": {
|
3 |
+
"version": "8.0.1",
|
4 |
+
"release_timestamp": 1567080000,
|
5 |
+
"build": "201908.2901",
|
6 |
"slug_parent": "icwp",
|
7 |
"slug_plugin": "wpsf",
|
8 |
"human_name": "Shield",
|
readme.txt
CHANGED
@@ -4,11 +4,11 @@ Donate link: https://icwp.io/bw
|
|
4 |
License: GPLv3
|
5 |
License URI: http://www.gnu.org/licenses/gpl.html
|
6 |
Tags: scan, firewall, two factor authentication, login protection, malware
|
7 |
-
Requires at least: 3.5.
|
8 |
Requires PHP: 5.4.0
|
9 |
Recommended PHP: 7.0
|
10 |
Tested up to: 5.2
|
11 |
-
Stable tag: 8.0.
|
12 |
|
13 |
Security protection from hackers through smarter automation. Powerful scanners, 2-Factor Auth, limit logins, auto IP blocks & more.
|
14 |
|
@@ -370,7 +370,15 @@ You will always be able to use Shield Security and its free features in-full.
|
|
370 |
|
371 |
[Go Pro for just $1/month](https://icwp.io/aa).
|
372 |
|
373 |
-
= 8.0 - Current Release =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
374 |
*Released: 27th September, 2019* - [Release Notes](https://icwp.io/fv)
|
375 |
|
376 |
* **(v.0)** NEW: [**PRO**] New Malware Scanner with automated file repair for WordPress.org Plugins and Core.
|
4 |
License: GPLv3
|
5 |
License URI: http://www.gnu.org/licenses/gpl.html
|
6 |
Tags: scan, firewall, two factor authentication, login protection, malware
|
7 |
+
Requires at least: 3.5.2
|
8 |
Requires PHP: 5.4.0
|
9 |
Recommended PHP: 7.0
|
10 |
Tested up to: 5.2
|
11 |
+
Stable tag: 8.0.1
|
12 |
|
13 |
Security protection from hackers through smarter automation. Powerful scanners, 2-Factor Auth, limit logins, auto IP blocks & more.
|
14 |
|
370 |
|
371 |
[Go Pro for just $1/month](https://icwp.io/aa).
|
372 |
|
373 |
+
= 8.0.1 - Current Release =
|
374 |
+
*Released: 29th September, 2019* - [Release Notes](https://icwp.io/fv)
|
375 |
+
|
376 |
+
* **(v.1)** FIXED: Comment SPAM blocking wasn't working if set to "Detect and Reject".
|
377 |
+
* **(v.1)** FIXED: Shield Widget/Badge broken in some cases.
|
378 |
+
* **(v.1)** ADDED: You can force Shield to operate in any [locale, regardless of site locale](https://icwp.io/gistshieldlocale).
|
379 |
+
* **(v.1)** ADDED: Russian translations are now at 100% and some Dutch translations have been adjusted.
|
380 |
+
|
381 |
+
= 8.0 - Series =
|
382 |
*Released: 27th September, 2019* - [Release Notes](https://icwp.io/fv)
|
383 |
|
384 |
* **(v.0)** NEW: [**PRO**] New Malware Scanner with automated file repair for WordPress.org Plugins and Core.
|
src/features/plugin.php
CHANGED
@@ -89,7 +89,9 @@ class ICWP_WPSF_FeatureHandler_Plugin extends ICWP_WPSF_FeatureHandler_BaseWpsf
|
|
89 |
* @return bool
|
90 |
*/
|
91 |
public function isDisplayPluginBadge() {
|
92 |
-
|
|
|
|
|
93 |
&& ( Services::Request()->cookie( $this->getCookieIdBadgeState() ) != 'closed' );
|
94 |
}
|
95 |
|
89 |
* @return bool
|
90 |
*/
|
91 |
public function isDisplayPluginBadge() {
|
92 |
+
/** @var Shield\Modules\Plugin\Options $oOpts */
|
93 |
+
$oOpts = $this->getOptions();
|
94 |
+
return $oOpts->isOnFloatingPluginBadge()
|
95 |
&& ( Services::Request()->cookie( $this->getCookieIdBadgeState() ) != 'closed' );
|
96 |
}
|
97 |
|
src/lib/src/Controller/Controller.php
CHANGED
@@ -318,13 +318,6 @@ class Controller extends Shield\Deprecated\Foundation {
|
|
318 |
add_filter( 'wp_privacy_personal_data_exporters', [ $this, 'onWpPrivacyRegisterExporter' ] );
|
319 |
add_filter( 'wp_privacy_personal_data_erasers', [ $this, 'onWpPrivacyRegisterEraser' ] );
|
320 |
|
321 |
-
/**
|
322 |
-
* Translations override - we want to use our in-plugin translations, not those
|
323 |
-
* provided by WordPress.org since getting our existing translations into the WP.org
|
324 |
-
* system is full of friction, though that's where we'd like to end-up eventually.
|
325 |
-
*/
|
326 |
-
add_filter( 'load_textdomain_mofile', [ $this, 'overrideTranslations' ], 100, 2 );
|
327 |
-
|
328 |
/**
|
329 |
* Support for WP-CLI and it marks the cli as complete plugin admin
|
330 |
*/
|
@@ -340,6 +333,14 @@ class Controller extends Shield\Deprecated\Foundation {
|
|
340 |
* @return bool
|
341 |
*/
|
342 |
protected function doLoadTextDomain() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
343 |
return load_plugin_textdomain(
|
344 |
$this->getTextDomain(),
|
345 |
false,
|
@@ -1932,26 +1933,27 @@ class Controller extends Shield\Deprecated\Foundation {
|
|
1932 |
*/
|
1933 |
public function overrideTranslations( $sMoFilePath, $sDomain ) {
|
1934 |
if ( $sDomain == $this->getTextDomain() ) {
|
1935 |
-
|
1936 |
-
|
1937 |
-
|
1938 |
-
|
1939 |
-
|
1940 |
-
|
1941 |
-
|
1942 |
-
|
1943 |
-
|
1944 |
-
|
1945 |
-
|
1946 |
-
|
1947 |
-
|
1948 |
-
|
1949 |
-
|
1950 |
-
|
1951 |
-
|
1952 |
}
|
1953 |
|
1954 |
$sMaybeFile = path_join( $this->getPath_Languages(), $this->getTextDomain().'-'.$sLocale.'.mo' );
|
|
|
1955 |
if ( Services::WpFs()->exists( $sMaybeFile ) ) {
|
1956 |
$sMoFilePath = $sMaybeFile;
|
1957 |
}
|
318 |
add_filter( 'wp_privacy_personal_data_exporters', [ $this, 'onWpPrivacyRegisterExporter' ] );
|
319 |
add_filter( 'wp_privacy_personal_data_erasers', [ $this, 'onWpPrivacyRegisterEraser' ] );
|
320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
/**
|
322 |
* Support for WP-CLI and it marks the cli as complete plugin admin
|
323 |
*/
|
333 |
* @return bool
|
334 |
*/
|
335 |
protected function doLoadTextDomain() {
|
336 |
+
|
337 |
+
/**
|
338 |
+
* Translations override - we want to use our in-plugin translations, not those
|
339 |
+
* provided by WordPress.org since getting our existing translations into the WP.org
|
340 |
+
* system is full of friction, though that's where we'd like to end-up eventually.
|
341 |
+
*/
|
342 |
+
add_filter( 'load_textdomain_mofile', [ $this, 'overrideTranslations' ], 100, 2 );
|
343 |
+
|
344 |
return load_plugin_textdomain(
|
345 |
$this->getTextDomain(),
|
346 |
false,
|
1933 |
*/
|
1934 |
public function overrideTranslations( $sMoFilePath, $sDomain ) {
|
1935 |
if ( $sDomain == $this->getTextDomain() ) {
|
1936 |
+
|
1937 |
+
$sLocale = apply_filters( 'shield_force_locale', Services::WpGeneral()->getLocale() );
|
1938 |
+
|
1939 |
+
/**
|
1940 |
+
* Cater for duplicate language translations that don't exist (yet)
|
1941 |
+
* E.g. where Spanish-Spain is present
|
1942 |
+
* This isn't ideal, and in-time we'll like full localizations, but we aren't there.
|
1943 |
+
*/
|
1944 |
+
$sCountry = substr( $sLocale, 0, 2 );
|
1945 |
+
$aDuplicateMappings = [
|
1946 |
+
'en' => 'en_GB',
|
1947 |
+
'es' => 'es_ES',
|
1948 |
+
'fr' => 'fr_FR',
|
1949 |
+
'pt' => 'pt_PT',
|
1950 |
+
];
|
1951 |
+
if ( array_key_exists( $sCountry, $aDuplicateMappings ) ) {
|
1952 |
+
$sLocale = $aDuplicateMappings[ $sCountry ];
|
1953 |
}
|
1954 |
|
1955 |
$sMaybeFile = path_join( $this->getPath_Languages(), $this->getTextDomain().'-'.$sLocale.'.mo' );
|
1956 |
+
|
1957 |
if ( Services::WpFs()->exists( $sMaybeFile ) ) {
|
1958 |
$sMoFilePath = $sMaybeFile;
|
1959 |
}
|
src/lib/src/Modules/Base/BaseModCon.php
ADDED
@@ -0,0 +1,2029 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Base;
|
4 |
+
|
5 |
+
use FernleafSystems\Wordpress\Plugin\Shield;
|
6 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Deprecated;
|
7 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules;
|
8 |
+
use FernleafSystems\Wordpress\Services\Services;
|
9 |
+
|
10 |
+
class BaseModCon extends Deprecated\Foundation {
|
11 |
+
|
12 |
+
use Modules\PluginControllerConsumer;
|
13 |
+
|
14 |
+
/**
|
15 |
+
* @var Options
|
16 |
+
*/
|
17 |
+
protected $oOptions;
|
18 |
+
|
19 |
+
/**
|
20 |
+
* @var string
|
21 |
+
*/
|
22 |
+
private $sOptionsStoreKey;
|
23 |
+
|
24 |
+
/**
|
25 |
+
* @var string
|
26 |
+
*/
|
27 |
+
protected $sModSlug;
|
28 |
+
|
29 |
+
/**
|
30 |
+
* @var boolean
|
31 |
+
*/
|
32 |
+
protected $bImportExportWhitelistNotify = false;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* @var \ICWP_WPSF_FeatureHandler_Email
|
36 |
+
*/
|
37 |
+
private static $oEmailHandler;
|
38 |
+
|
39 |
+
/**
|
40 |
+
* @var \ICWP_WPSF_Processor_Base
|
41 |
+
*/
|
42 |
+
private $oProcessor;
|
43 |
+
|
44 |
+
/**
|
45 |
+
* @var \ICWP_WPSF_Wizard_Base
|
46 |
+
*/
|
47 |
+
private $oWizard;
|
48 |
+
|
49 |
+
/**
|
50 |
+
* @var Shield\Databases\Base\Handler
|
51 |
+
*/
|
52 |
+
private $oDbh;
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @var AjaxHandlerShield
|
56 |
+
*/
|
57 |
+
private $oAjax;
|
58 |
+
|
59 |
+
/**
|
60 |
+
* @var Shield\Modules\Base\AdminNotices
|
61 |
+
*/
|
62 |
+
private $oAdminNotices;
|
63 |
+
|
64 |
+
/**
|
65 |
+
* @var Shield\Modules\Base\Strings
|
66 |
+
*/
|
67 |
+
private $oStrings;
|
68 |
+
|
69 |
+
/**
|
70 |
+
* @var Shield\Modules\Base\Options
|
71 |
+
*/
|
72 |
+
private $oOpts;
|
73 |
+
|
74 |
+
/**
|
75 |
+
* @param Shield\Controller\Controller $oPluginController
|
76 |
+
* @param array $aMod
|
77 |
+
* @throws \Exception
|
78 |
+
*/
|
79 |
+
public function __construct( $oPluginController, $aMod = [] ) {
|
80 |
+
if ( empty( self::$oPluginController ) ) {
|
81 |
+
if ( !$oPluginController instanceof Shield\Controller\Controller ) {
|
82 |
+
throw new \Exception( 'Plugin controller not supplied to Module' );
|
83 |
+
}
|
84 |
+
$this->setCon( $oPluginController );
|
85 |
+
}
|
86 |
+
|
87 |
+
if ( empty( $aMod[ 'storage_key' ] ) && empty( $aMod[ 'slug' ] ) ) {
|
88 |
+
throw new \Exception( 'Module storage key AND slug are undefined' );
|
89 |
+
}
|
90 |
+
|
91 |
+
$this->sOptionsStoreKey = empty( $aMod[ 'storage_key' ] ) ? $aMod[ 'slug' ] : $aMod[ 'storage_key' ];
|
92 |
+
if ( isset( $aMod[ 'slug' ] ) ) {
|
93 |
+
$this->sModSlug = $aMod[ 'slug' ];
|
94 |
+
}
|
95 |
+
|
96 |
+
if ( $this->verifyModuleMeetRequirements() ) {
|
97 |
+
$this->setupHooks( $aMod );
|
98 |
+
$this->doPostConstruction();
|
99 |
+
}
|
100 |
+
}
|
101 |
+
|
102 |
+
/**
|
103 |
+
* @param array $aModProps
|
104 |
+
*/
|
105 |
+
protected function setupHooks( $aModProps ) {
|
106 |
+
$oReq = Services::Request();
|
107 |
+
|
108 |
+
$nRunPriority = isset( $aModProps[ 'load_priority' ] ) ? $aModProps[ 'load_priority' ] : 100;
|
109 |
+
add_action( $this->prefix( 'run_processors' ), [ $this, 'onRunProcessors' ], $nRunPriority );
|
110 |
+
add_action( 'init', [ $this, 'onWpInit' ], 1 );
|
111 |
+
add_action( $this->prefix( 'import_options' ), [ $this, 'processImportOptions' ] );
|
112 |
+
|
113 |
+
if ( $this->isModuleRequest() ) {
|
114 |
+
|
115 |
+
if ( Services::WpGeneral()->isAjax() ) {
|
116 |
+
$this->getAjax();
|
117 |
+
}
|
118 |
+
|
119 |
+
if ( $oReq->request( 'action' ) == $this->prefix()
|
120 |
+
&& check_admin_referer( $oReq->request( 'exec' ), 'exec_nonce' )
|
121 |
+
) {
|
122 |
+
add_action( $this->prefix( 'mod_request' ), [ $this, 'handleModRequest' ] );
|
123 |
+
}
|
124 |
+
}
|
125 |
+
|
126 |
+
$nMenuPri = isset( $aModProps[ 'menu_priority' ] ) ? $aModProps[ 'menu_priority' ] : 100;
|
127 |
+
add_filter( $this->prefix( 'submenu_items' ), [ $this, 'supplySubMenuItem' ], $nMenuPri );
|
128 |
+
add_filter( $this->prefix( 'collect_mod_summary' ), [ $this, 'addModuleSummaryData' ], $nMenuPri );
|
129 |
+
add_filter( $this->prefix( 'collect_notices' ), [ $this, 'addInsightsNoticeData' ] );
|
130 |
+
add_filter( $this->prefix( 'collect_summary' ), [ $this, 'addInsightsConfigData' ], $nRunPriority );
|
131 |
+
add_action( $this->prefix( 'plugin_shutdown' ), [ $this, 'onPluginShutdown' ] );
|
132 |
+
add_action( $this->prefix( 'deactivate_plugin' ), [ $this, 'onPluginDeactivate' ] );
|
133 |
+
add_action( $this->prefix( 'delete_plugin' ), [ $this, 'onPluginDelete' ] );
|
134 |
+
add_filter( $this->prefix( 'aggregate_all_plugin_options' ), [ $this, 'aggregateOptionsValues' ] );
|
135 |
+
|
136 |
+
add_filter( $this->prefix( 'register_admin_notices' ), [ $this, 'fRegisterAdminNotices' ] );
|
137 |
+
add_filter( $this->prefix( 'gather_options_for_export' ), [ $this, 'exportTransferableOptions' ] );
|
138 |
+
|
139 |
+
add_action( $this->prefix( 'daily_cron' ), [ $this, 'runDailyCron' ] );
|
140 |
+
add_action( $this->prefix( 'hourly_cron' ), [ $this, 'runHourlyCron' ] );
|
141 |
+
|
142 |
+
// supply our supported plugin events for this module
|
143 |
+
add_filter( $this->prefix( 'is_event_supported' ), function ( $bSupported, $sEventTag ) {
|
144 |
+
return $bSupported || $this->isSupportedEvent( $sEventTag );
|
145 |
+
}, 10, 2 );
|
146 |
+
|
147 |
+
add_action( 'admin_enqueue_scripts', [ $this, 'onWpEnqueueAdminJs' ], 100 );
|
148 |
+
|
149 |
+
if ( is_admin() || is_network_admin() ) {
|
150 |
+
$this->getAdminNotices()->run();
|
151 |
+
}
|
152 |
+
|
153 |
+
// if ( $this->isAdminOptionsPage() ) {
|
154 |
+
// add_action( 'current_screen', array( $this, 'onSetCurrentScreen' ) );
|
155 |
+
// }
|
156 |
+
|
157 |
+
$this->setupCustomHooks();
|
158 |
+
}
|
159 |
+
|
160 |
+
protected function setupCustomHooks() {
|
161 |
+
}
|
162 |
+
|
163 |
+
protected function doPostConstruction() {
|
164 |
+
}
|
165 |
+
|
166 |
+
public function runDailyCron() {
|
167 |
+
$this->cleanupDatabases();
|
168 |
+
}
|
169 |
+
|
170 |
+
public function runHourlyCron() {
|
171 |
+
}
|
172 |
+
|
173 |
+
protected function cleanupDatabases() {
|
174 |
+
$oDbh = $this->getDbHandler();
|
175 |
+
try {
|
176 |
+
if ( $oDbh instanceof Shield\Databases\Base\Handler && $oDbh->isReady() ) {
|
177 |
+
$oDbh->autoCleanDb();
|
178 |
+
}
|
179 |
+
}
|
180 |
+
catch ( \Exception $oE ) {
|
181 |
+
}
|
182 |
+
}
|
183 |
+
|
184 |
+
/**
|
185 |
+
* @param string $sKey
|
186 |
+
* @return array|null
|
187 |
+
*/
|
188 |
+
public function getEventDef( $sKey ) {
|
189 |
+
return $this->isSupportedEvent( $sKey ) ? $this->getEvents()[ $sKey ] : null;
|
190 |
+
}
|
191 |
+
|
192 |
+
/**
|
193 |
+
* @return array[]
|
194 |
+
*/
|
195 |
+
public function getEvents() {
|
196 |
+
$aEvts = $this->getSupportedEvents();
|
197 |
+
|
198 |
+
$aDefaults = [
|
199 |
+
'context' => $this->getSlug(),
|
200 |
+
'cat' => 1,
|
201 |
+
'stat' => true,
|
202 |
+
'audit' => true,
|
203 |
+
'recent' => false, // whether to show in the recent events logs
|
204 |
+
'offense' => false, // whether to mark offense against IP
|
205 |
+
];
|
206 |
+
foreach ( $aEvts as $sKey => $aEvt ) {
|
207 |
+
$aEvts[ $sKey ] = array_merge( $aDefaults, $aEvt );
|
208 |
+
$aEvts[ $sKey ][ 'key' ] = $sKey;
|
209 |
+
}
|
210 |
+
return $aEvts;
|
211 |
+
}
|
212 |
+
|
213 |
+
/**
|
214 |
+
* @return array[]
|
215 |
+
*/
|
216 |
+
public function getStatEvents_Recent() {
|
217 |
+
return array_filter(
|
218 |
+
$this->getEvents(),
|
219 |
+
function ( $aEvt ) {
|
220 |
+
return $aEvt[ 'recent' ];
|
221 |
+
}
|
222 |
+
);
|
223 |
+
}
|
224 |
+
|
225 |
+
/**
|
226 |
+
* @return array[]
|
227 |
+
*/
|
228 |
+
protected function getSupportedEvents() {
|
229 |
+
$aEvts = $this->getDef( 'events' );
|
230 |
+
return is_array( $aEvts ) ? $aEvts : [];
|
231 |
+
}
|
232 |
+
|
233 |
+
/**
|
234 |
+
* @param string $sKey
|
235 |
+
* @return bool
|
236 |
+
*/
|
237 |
+
public function isSupportedEvent( $sKey ) {
|
238 |
+
return array_key_exists( $sKey, $this->getSupportedEvents() );
|
239 |
+
}
|
240 |
+
|
241 |
+
/**
|
242 |
+
* @param string $sKey
|
243 |
+
* @return bool
|
244 |
+
*/
|
245 |
+
public function isOffenseEvent( $sKey ) {
|
246 |
+
return $this->isSupportedEvent( $sKey ) && $this->getEvents()[ $sKey ][ 'offense' ];
|
247 |
+
}
|
248 |
+
|
249 |
+
/**
|
250 |
+
* Should be over-ridden by each new class to handle upgrades.
|
251 |
+
* Called upon construction and after plugin options are initialized.
|
252 |
+
*/
|
253 |
+
protected function updateHandler() {
|
254 |
+
}
|
255 |
+
|
256 |
+
/**
|
257 |
+
* @param string $sEncoding
|
258 |
+
* @return array
|
259 |
+
*/
|
260 |
+
public function getAjaxFormParams( $sEncoding = 'none' ) {
|
261 |
+
$oReq = Services::Request();
|
262 |
+
$aFormParams = [];
|
263 |
+
$sRaw = $oReq->post( 'form_params', '' );
|
264 |
+
|
265 |
+
if ( !empty( $sRaw ) ) {
|
266 |
+
|
267 |
+
$sMaybeEncoding = $oReq->post( 'enc_params' );
|
268 |
+
if ( in_array( $sMaybeEncoding, [ 'none', 'lz-string', 'b64' ] ) ) {
|
269 |
+
$sEncoding = $sMaybeEncoding;
|
270 |
+
}
|
271 |
+
|
272 |
+
switch ( $sEncoding ) {
|
273 |
+
case 'lz-string':
|
274 |
+
$sRaw = \LZCompressor\LZString::decompress( base64_decode( $sRaw ) );
|
275 |
+
break;
|
276 |
+
|
277 |
+
case 'b64':
|
278 |
+
$sRaw = base64_decode( $sRaw );
|
279 |
+
break;
|
280 |
+
|
281 |
+
case 'none':
|
282 |
+
default:
|
283 |
+
break;
|
284 |
+
}
|
285 |
+
|
286 |
+
parse_str( $sRaw, $aFormParams );
|
287 |
+
}
|
288 |
+
return $aFormParams;
|
289 |
+
}
|
290 |
+
|
291 |
+
/**
|
292 |
+
* @param array $aAdminNotices
|
293 |
+
* @return array
|
294 |
+
*/
|
295 |
+
public function fRegisterAdminNotices( $aAdminNotices ) {
|
296 |
+
if ( !is_array( $aAdminNotices ) ) {
|
297 |
+
$aAdminNotices = [];
|
298 |
+
}
|
299 |
+
return array_merge( $aAdminNotices, $this->getOptionsVo()->getAdminNotices() );
|
300 |
+
}
|
301 |
+
|
302 |
+
/**
|
303 |
+
* @return bool
|
304 |
+
*/
|
305 |
+
private function verifyModuleMeetRequirements() {
|
306 |
+
$bMeetsReqs = true;
|
307 |
+
|
308 |
+
$aPhpReqs = $this->getOptionsVo()->getFeatureRequirement( 'php' );
|
309 |
+
if ( !empty( $aPhpReqs ) ) {
|
310 |
+
|
311 |
+
if ( !empty( $aPhpReqs[ 'version' ] ) ) {
|
312 |
+
$bMeetsReqs = $bMeetsReqs && Services::Data()->getPhpVersionIsAtLeast( $aPhpReqs[ 'version' ] );
|
313 |
+
}
|
314 |
+
if ( !empty( $aPhpReqs[ 'functions' ] ) && is_array( $aPhpReqs[ 'functions' ] ) ) {
|
315 |
+
foreach ( $aPhpReqs[ 'functions' ] as $sFunction ) {
|
316 |
+
$bMeetsReqs = $bMeetsReqs && function_exists( $sFunction );
|
317 |
+
}
|
318 |
+
}
|
319 |
+
if ( !empty( $aPhpReqs[ 'constants' ] ) && is_array( $aPhpReqs[ 'constants' ] ) ) {
|
320 |
+
foreach ( $aPhpReqs[ 'constants' ] as $sConstant ) {
|
321 |
+
$bMeetsReqs = $bMeetsReqs && defined( $sConstant );
|
322 |
+
}
|
323 |
+
}
|
324 |
+
}
|
325 |
+
|
326 |
+
return $bMeetsReqs;
|
327 |
+
}
|
328 |
+
|
329 |
+
/**
|
330 |
+
*/
|
331 |
+
public function onRunProcessors() {
|
332 |
+
if ( $this->isUpgrading() ) {
|
333 |
+
$this->updateHandler();
|
334 |
+
}
|
335 |
+
if ( $this->getOptionsVo()->getFeatureProperty( 'auto_load_processor' ) ) {
|
336 |
+
$this->loadProcessor();
|
337 |
+
}
|
338 |
+
if ( !$this->isUpgrading() && $this->isModuleEnabled() && $this->isReadyToExecute() ) {
|
339 |
+
$this->doExecuteProcessor();
|
340 |
+
}
|
341 |
+
}
|
342 |
+
|
343 |
+
/**
|
344 |
+
* @param array $aOptions
|
345 |
+
*/
|
346 |
+
public function processImportOptions( $aOptions ) {
|
347 |
+
if ( !empty( $aOptions ) && is_array( $aOptions ) && array_key_exists( $this->getOptionsStorageKey(), $aOptions ) ) {
|
348 |
+
$this->getOptionsVo()
|
349 |
+
->setMultipleOptions( $aOptions[ $this->getOptionsStorageKey() ] );
|
350 |
+
$this->savePluginOptions();
|
351 |
+
}
|
352 |
+
}
|
353 |
+
|
354 |
+
/**
|
355 |
+
* Used to effect certain processing that is to do with options etc. but isn't related to processing
|
356 |
+
* functionality of the plugin.
|
357 |
+
*/
|
358 |
+
protected function isReadyToExecute() {
|
359 |
+
$oProcessor = $this->getProcessor();
|
360 |
+
return ( $oProcessor instanceof \ICWP_WPSF_Processor_Base );
|
361 |
+
}
|
362 |
+
|
363 |
+
protected function doExecuteProcessor() {
|
364 |
+
$this->getProcessor()->run();
|
365 |
+
}
|
366 |
+
|
367 |
+
/**
|
368 |
+
* A action added to WordPress 'init' hook
|
369 |
+
*/
|
370 |
+
public function onWpInit() {
|
371 |
+
do_action( $this->prefix( 'mod_request' ) );
|
372 |
+
|
373 |
+
$this->runWizards();
|
374 |
+
|
375 |
+
// GDPR
|
376 |
+
if ( $this->isPremium() ) {
|
377 |
+
add_filter( $this->prefix( 'wpPrivacyExport' ), [ $this, 'onWpPrivacyExport' ], 10, 3 );
|
378 |
+
add_filter( $this->prefix( 'wpPrivacyErase' ), [ $this, 'onWpPrivacyErase' ], 10, 3 );
|
379 |
+
}
|
380 |
+
}
|
381 |
+
|
382 |
+
/**
|
383 |
+
* We have to do it this way as the "page hook" is built upon the top-level plugin
|
384 |
+
* menu name. But what if we white label? So we need to dynamically grab the page hook
|
385 |
+
*/
|
386 |
+
public function onSetCurrentScreen() {
|
387 |
+
global $page_hook;
|
388 |
+
add_action( 'load-'.$page_hook, [ $this, 'onLoadOptionsScreen' ] );
|
389 |
+
}
|
390 |
+
|
391 |
+
/**
|
392 |
+
*/
|
393 |
+
public function onLoadOptionsScreen() {
|
394 |
+
if ( $this->getCon()->isValidAdminArea() ) {
|
395 |
+
$this->buildContextualHelp();
|
396 |
+
}
|
397 |
+
}
|
398 |
+
|
399 |
+
/**
|
400 |
+
* Override this and adapt per feature
|
401 |
+
* @return \ICWP_WPSF_Processor_Base|mixed
|
402 |
+
*/
|
403 |
+
protected function loadProcessor() {
|
404 |
+
if ( !isset( $this->oProcessor ) ) {
|
405 |
+
$sClassName = $this->getProcessorClassName();
|
406 |
+
if ( !class_exists( $sClassName ) ) {
|
407 |
+
return null;
|
408 |
+
}
|
409 |
+
$this->oProcessor = new $sClassName( $this );
|
410 |
+
}
|
411 |
+
return $this->oProcessor;
|
412 |
+
}
|
413 |
+
|
414 |
+
/**
|
415 |
+
* Override this and adapt per feature
|
416 |
+
* @return string
|
417 |
+
*/
|
418 |
+
protected function getProcessorClassName() {
|
419 |
+
return implode( '_',
|
420 |
+
[
|
421 |
+
strtoupper( $this->getCon()->getPluginPrefix( '_' ) ),
|
422 |
+
'Processor',
|
423 |
+
str_replace( ' ', '', ucwords( str_replace( '_', ' ', $this->getSlug() ) ) )
|
424 |
+
]
|
425 |
+
);
|
426 |
+
}
|
427 |
+
|
428 |
+
/**
|
429 |
+
* Override this and adapt per feature
|
430 |
+
* @return string
|
431 |
+
*/
|
432 |
+
protected function getWizardClassName() {
|
433 |
+
return implode( '_',
|
434 |
+
[
|
435 |
+
strtoupper( $this->getCon()->getPluginPrefix( '_' ) ),
|
436 |
+
'Wizard',
|
437 |
+
str_replace( ' ', '', ucwords( str_replace( '_', ' ', $this->getSlug() ) ) )
|
438 |
+
]
|
439 |
+
);
|
440 |
+
}
|
441 |
+
|
442 |
+
/**
|
443 |
+
* @return \ICWP_WPSF_OptionsVO
|
444 |
+
*/
|
445 |
+
public function getOptionsVo() {
|
446 |
+
if ( !isset( $this->oOptions ) ) {
|
447 |
+
$this->oOptions = $this->getOptions();
|
448 |
+
}
|
449 |
+
return $this->oOptions;
|
450 |
+
}
|
451 |
+
|
452 |
+
/**
|
453 |
+
* @return bool
|
454 |
+
*/
|
455 |
+
public function isUpgrading() {
|
456 |
+
return $this->getCon()->getIsRebuildOptionsFromFile() || $this->getOptionsVo()->getRebuildFromFile();
|
457 |
+
}
|
458 |
+
|
459 |
+
/**
|
460 |
+
* Hooked to the plugin's main plugin_shutdown action
|
461 |
+
*/
|
462 |
+
public function onPluginShutdown() {
|
463 |
+
if ( !$this->getCon()->isPluginDeleting() ) {
|
464 |
+
if ( rand( 1, 40 ) === 2 ) {
|
465 |
+
// cleanup databases randomly just in-case cron doesn't run.
|
466 |
+
$this->cleanupDatabases();
|
467 |
+
}
|
468 |
+
$this->savePluginOptions();
|
469 |
+
}
|
470 |
+
}
|
471 |
+
|
472 |
+
/**
|
473 |
+
* @return string
|
474 |
+
*/
|
475 |
+
protected function getOptionsStorageKey() {
|
476 |
+
return $this->getCon()->prefixOption( $this->sOptionsStoreKey ).'_options';
|
477 |
+
}
|
478 |
+
|
479 |
+
/**
|
480 |
+
* @return \ICWP_WPSF_Processor_Base|mixed
|
481 |
+
*/
|
482 |
+
public function getProcessor() {
|
483 |
+
return $this->loadProcessor();
|
484 |
+
}
|
485 |
+
|
486 |
+
/**
|
487 |
+
* @return string
|
488 |
+
*/
|
489 |
+
public function getUrl_AdminPage() {
|
490 |
+
return Services::WpGeneral()
|
491 |
+
->getUrl_AdminPage(
|
492 |
+
$this->getModSlug(),
|
493 |
+
$this->getCon()->getIsWpmsNetworkAdminOnly()
|
494 |
+
);
|
495 |
+
}
|
496 |
+
|
497 |
+
/**
|
498 |
+
* @param string $sOptKey
|
499 |
+
* @return string
|
500 |
+
*/
|
501 |
+
protected function getUrl_DirectLinkToOption( $sOptKey ) {
|
502 |
+
$sUrl = $this->getUrl_AdminPage();
|
503 |
+
$aDef = $this->getOptionsVo()->getOptDefinition( $sOptKey );
|
504 |
+
if ( !empty( $aDef[ 'section' ] ) ) {
|
505 |
+
$sUrl = $this->getUrl_DirectLinkToSection( $aDef[ 'section' ] );
|
506 |
+
}
|
507 |
+
return $sUrl;
|
508 |
+
}
|
509 |
+
|
510 |
+
/**
|
511 |
+
* @param string $sSection
|
512 |
+
* @return string
|
513 |
+
*/
|
514 |
+
public function getUrl_DirectLinkToSection( $sSection ) {
|
515 |
+
if ( $sSection == 'primary' ) {
|
516 |
+
$aSec = $this->getOptionsVo()->getPrimarySection();
|
517 |
+
$sSection = $aSec[ 'slug' ];
|
518 |
+
}
|
519 |
+
return $this->getUrl_AdminPage().'#tab-'.$sSection;
|
520 |
+
}
|
521 |
+
|
522 |
+
/**
|
523 |
+
* TODO: Get rid of this crap and/or handle the \Exception thrown in loadFeatureHandler()
|
524 |
+
* @return \ICWP_WPSF_FeatureHandler_Email
|
525 |
+
* @throws \Exception
|
526 |
+
*/
|
527 |
+
public function getEmailHandler() {
|
528 |
+
if ( is_null( self::$oEmailHandler ) ) {
|
529 |
+
self::$oEmailHandler = $this->getCon()->loadFeatureHandler( [ 'slug' => 'email' ] );
|
530 |
+
}
|
531 |
+
return self::$oEmailHandler;
|
532 |
+
}
|
533 |
+
|
534 |
+
/**
|
535 |
+
* @return \ICWP_WPSF_Processor_Email
|
536 |
+
*/
|
537 |
+
public function getEmailProcessor() {
|
538 |
+
return $this->getEmailHandler()->getProcessor();
|
539 |
+
}
|
540 |
+
|
541 |
+
/**
|
542 |
+
* @param bool $bEnable
|
543 |
+
* @return $this
|
544 |
+
*/
|
545 |
+
public function setIsMainFeatureEnabled( $bEnable ) {
|
546 |
+
return $this->setOpt( 'enable_'.$this->getSlug(), $bEnable ? 'Y' : 'N' );
|
547 |
+
}
|
548 |
+
|
549 |
+
/**
|
550 |
+
* @return bool
|
551 |
+
*/
|
552 |
+
public function isModuleEnabled() {
|
553 |
+
$oOpts = $this->getOptionsVo();
|
554 |
+
|
555 |
+
if ( $this->getOptionsVo()->getFeatureProperty( 'auto_enabled' ) === true ) {
|
556 |
+
// Auto enabled modules always run regardless
|
557 |
+
$bEnabled = true;
|
558 |
+
}
|
559 |
+
else if ( apply_filters( $this->prefix( 'globally_disabled' ), false ) ) {
|
560 |
+
$bEnabled = false;
|
561 |
+
}
|
562 |
+
else if ( $this->getCon()->getIfForceOffActive() ) {
|
563 |
+
$bEnabled = false;
|
564 |
+
}
|
565 |
+
else if ( $oOpts->getFeatureProperty( 'premium' ) === true && !$this->isPremium() ) {
|
566 |
+
$bEnabled = false;
|
567 |
+
}
|
568 |
+
else {
|
569 |
+
$bEnabled = $this->isModOptEnabled();
|
570 |
+
}
|
571 |
+
|
572 |
+
return $bEnabled;
|
573 |
+
}
|
574 |
+
|
575 |
+
/**
|
576 |
+
* @return bool
|
577 |
+
*/
|
578 |
+
protected function isModOptEnabled() {
|
579 |
+
return $this->isOpt( $this->getEnableModOptKey(), 'Y' )
|
580 |
+
|| $this->isOpt( $this->getEnableModOptKey(), true, true );
|
581 |
+
}
|
582 |
+
|
583 |
+
/**
|
584 |
+
* @return string
|
585 |
+
*/
|
586 |
+
protected function getEnableModOptKey() {
|
587 |
+
return 'enable_'.$this->getSlug();
|
588 |
+
}
|
589 |
+
|
590 |
+
/**
|
591 |
+
* @return string
|
592 |
+
*/
|
593 |
+
public function getMainFeatureName() {
|
594 |
+
return __( $this->getOptionsVo()->getFeatureProperty( 'name' ), 'wp-simple-firewall' );
|
595 |
+
}
|
596 |
+
|
597 |
+
/**
|
598 |
+
* @param bool $bWithPrefix
|
599 |
+
* @return string
|
600 |
+
*/
|
601 |
+
public function getModSlug( $bWithPrefix = true ) {
|
602 |
+
return $bWithPrefix ? $this->prefix( $this->getSlug() ) : $this->getSlug();
|
603 |
+
}
|
604 |
+
|
605 |
+
/**
|
606 |
+
* @return string
|
607 |
+
*/
|
608 |
+
public function getSlug() {
|
609 |
+
if ( !isset( $this->sModSlug ) ) {
|
610 |
+
$this->sModSlug = $this->getOptionsVo()->getFeatureProperty( 'slug' );
|
611 |
+
}
|
612 |
+
return $this->sModSlug;
|
613 |
+
}
|
614 |
+
|
615 |
+
/**
|
616 |
+
* @param array $aItems
|
617 |
+
* @return array
|
618 |
+
*/
|
619 |
+
public function supplySubMenuItem( $aItems ) {
|
620 |
+
|
621 |
+
$sTitle = $this->getOptionsVo()->getFeatureProperty( 'menu_title' );
|
622 |
+
$sTitle = empty( $sTitle ) ? $this->getMainFeatureName() : __( $sTitle, 'wp-simple-firewall' );
|
623 |
+
|
624 |
+
if ( !empty( $sTitle ) ) {
|
625 |
+
|
626 |
+
$sHumanName = $this->getCon()->getHumanName();
|
627 |
+
|
628 |
+
$bMenuHighlighted = $this->getOptionsVo()->getFeatureProperty( 'highlight_menu_item' );
|
629 |
+
if ( $bMenuHighlighted ) {
|
630 |
+
$sTitle = sprintf( '<span class="icwp_highlighted">%s</span>', $sTitle );
|
631 |
+
}
|
632 |
+
|
633 |
+
$sMenuPageTitle = $sTitle.' - '.$sHumanName;
|
634 |
+
$aItems[ $sMenuPageTitle ] = [
|
635 |
+
$sTitle,
|
636 |
+
$this->getModSlug(),
|
637 |
+
[ $this, 'displayModuleAdminPage' ],
|
638 |
+
$this->getIfShowModuleMenuItem()
|
639 |
+
];
|
640 |
+
|
641 |
+
$aAdditionalItems = $this->getOptionsVo()->getAdditionalMenuItems();
|
642 |
+
if ( !empty( $aAdditionalItems ) && is_array( $aAdditionalItems ) ) {
|
643 |
+
|
644 |
+
foreach ( $aAdditionalItems as $aMenuItem ) {
|
645 |
+
|
646 |
+
if ( empty( $aMenuItem[ 'callback' ] ) || !method_exists( $this, $aMenuItem[ 'callback' ] ) ) {
|
647 |
+
continue;
|
648 |
+
}
|
649 |
+
|
650 |
+
$sMenuPageTitle = $sHumanName.' - '.$aMenuItem[ 'title' ];
|
651 |
+
$aItems[ $sMenuPageTitle ] = [
|
652 |
+
$aMenuItem[ 'title' ],
|
653 |
+
$this->prefix( $aMenuItem[ 'slug' ] ),
|
654 |
+
[ $this, $aMenuItem[ 'callback' ] ]
|
655 |
+
];
|
656 |
+
}
|
657 |
+
}
|
658 |
+
}
|
659 |
+
return $aItems;
|
660 |
+
}
|
661 |
+
|
662 |
+
/**
|
663 |
+
* @return array
|
664 |
+
*/
|
665 |
+
protected function getAdditionalMenuItem() {
|
666 |
+
return [];
|
667 |
+
}
|
668 |
+
|
669 |
+
/**
|
670 |
+
* @param array $aSummaryData
|
671 |
+
* @return array
|
672 |
+
*/
|
673 |
+
public function addModuleSummaryData( $aSummaryData ) {
|
674 |
+
if ( $this->getIfShowModuleLink() ) {
|
675 |
+
$aSummaryData[ $this->getModSlug( false ) ] = $this->buildSummaryData();
|
676 |
+
}
|
677 |
+
return $aSummaryData;
|
678 |
+
}
|
679 |
+
|
680 |
+
/**
|
681 |
+
* @param array $aAllNotices
|
682 |
+
* @return array
|
683 |
+
*/
|
684 |
+
public function addInsightsNoticeData( $aAllNotices ) {
|
685 |
+
return $aAllNotices;
|
686 |
+
}
|
687 |
+
|
688 |
+
/**
|
689 |
+
* @param array $aAllData
|
690 |
+
* @return array
|
691 |
+
*/
|
692 |
+
public function addInsightsConfigData( $aAllData ) {
|
693 |
+
return $aAllData;
|
694 |
+
}
|
695 |
+
|
696 |
+
/**
|
697 |
+
* @return array
|
698 |
+
*/
|
699 |
+
protected function buildSummaryData() {
|
700 |
+
$oOptsVo = $this->getOptionsVo();
|
701 |
+
$sMenuTitle = $oOptsVo->getFeatureProperty( 'menu_title' );
|
702 |
+
|
703 |
+
$aSections = $oOptsVo->getSections();
|
704 |
+
foreach ( $aSections as $sSlug => $aSection ) {
|
705 |
+
try {
|
706 |
+
$aStrings = $this->getStrings()->getSectionStrings( $aSection[ 'slug' ] );
|
707 |
+
foreach ( $aStrings as $sKey => $sVal ) {
|
708 |
+
unset( $aSection[ $sKey ] );
|
709 |
+
$aSection[ $sKey ] = $sVal;
|
710 |
+
}
|
711 |
+
}
|
712 |
+
catch ( \Exception $oE ) {
|
713 |
+
}
|
714 |
+
}
|
715 |
+
|
716 |
+
$aSum = [
|
717 |
+
'enabled' => $this->isEnabledForUiSummary(),
|
718 |
+
'active' => $this->isThisModulePage() || $this->isPage_InsightsThisModule(),
|
719 |
+
'slug' => $this->getSlug(),
|
720 |
+
'name' => $this->getMainFeatureName(),
|
721 |
+
'menu_title' => empty( $sMenuTitle ) ? $this->getMainFeatureName() : __( $sMenuTitle, 'wp-simple-firewall' ),
|
722 |
+
'href' => network_admin_url( 'admin.php?page='.$this->getModSlug() ),
|
723 |
+
'sections' => $aSections,
|
724 |
+
'options' => [],
|
725 |
+
];
|
726 |
+
|
727 |
+
foreach ( $oOptsVo->getVisibleOptionsKeys() as $sOptKey ) {
|
728 |
+
try {
|
729 |
+
$aOptData = $this->getStrings()->getOptionStrings( $sOptKey );
|
730 |
+
$aOptData[ 'href' ] = $this->getUrl_DirectLinkToOption( $sOptKey );
|
731 |
+
$aSum[ 'options' ][ $sOptKey ] = $aOptData;
|
732 |
+
}
|
733 |
+
catch ( \Exception $oE ) {
|
734 |
+
}
|
735 |
+
}
|
736 |
+
|
737 |
+
// $aSum[ 'content' ] = $this->renderTemplate( 'snippets/summary_single', $aSum );
|
738 |
+
$aSum[ 'tooltip' ] = sprintf(
|
739 |
+
'%s%s',
|
740 |
+
$aSum[ 'name' ],
|
741 |
+
( $aSum[ 'enabled' ] ? '' : ' ('.strtolower( __( 'Disabled', 'wp-simple-firewall' ) ).')' )
|
742 |
+
);
|
743 |
+
return $aSum;
|
744 |
+
}
|
745 |
+
|
746 |
+
/**
|
747 |
+
* @return bool
|
748 |
+
*/
|
749 |
+
protected function isEnabledForUiSummary() {
|
750 |
+
return $this->isModuleEnabled();
|
751 |
+
}
|
752 |
+
|
753 |
+
/**
|
754 |
+
* @return boolean
|
755 |
+
*/
|
756 |
+
public function getIfShowModuleMenuItem() {
|
757 |
+
return (bool)$this->getOptionsVo()->getFeatureProperty( 'show_module_menu_item' );
|
758 |
+
}
|
759 |
+
|
760 |
+
/**
|
761 |
+
* @return boolean
|
762 |
+
*/
|
763 |
+
public function getIfShowModuleLink() {
|
764 |
+
return (bool)$this->getOptionsVo()->getFeatureProperty( 'show_module_options' );
|
765 |
+
}
|
766 |
+
|
767 |
+
/**
|
768 |
+
* @return boolean
|
769 |
+
*/
|
770 |
+
public function getIfUseSessions() {
|
771 |
+
return $this->getOptionsVo()->getFeatureProperty( 'use_sessions' );
|
772 |
+
}
|
773 |
+
|
774 |
+
/**
|
775 |
+
* Get config 'definition'.
|
776 |
+
* @param string $sKey
|
777 |
+
* @return mixed|null
|
778 |
+
*/
|
779 |
+
public function getDef( $sKey ) {
|
780 |
+
return $this->getOptionsVo()->getFeatureDefinition( $sKey );
|
781 |
+
}
|
782 |
+
|
783 |
+
/**
|
784 |
+
* @return $this
|
785 |
+
*/
|
786 |
+
public function clearLastErrors() {
|
787 |
+
return $this->setLastErrors( [] );
|
788 |
+
}
|
789 |
+
|
790 |
+
/**
|
791 |
+
* @param bool $bAsString
|
792 |
+
* @param string $sGlue
|
793 |
+
* @return string|array
|
794 |
+
*/
|
795 |
+
public function getLastErrors( $bAsString = true, $sGlue = " " ) {
|
796 |
+
$aErrors = $this->getOpt( 'last_errors' );
|
797 |
+
if ( !is_array( $aErrors ) ) {
|
798 |
+
$aErrors = [];
|
799 |
+
}
|
800 |
+
return $bAsString ? implode( $sGlue, $aErrors ) : $aErrors;
|
801 |
+
}
|
802 |
+
|
803 |
+
/**
|
804 |
+
* @return bool
|
805 |
+
*/
|
806 |
+
public function hasLastErrors() {
|
807 |
+
return count( $this->getLastErrors( false ) ) > 0;
|
808 |
+
}
|
809 |
+
|
810 |
+
/**
|
811 |
+
* @param string $sOptionKey
|
812 |
+
* @param mixed $mDefault
|
813 |
+
* @return mixed
|
814 |
+
*/
|
815 |
+
public function getOpt( $sOptionKey, $mDefault = false ) {
|
816 |
+
return $this->getOptionsVo()->getOpt( $sOptionKey, $mDefault );
|
817 |
+
}
|
818 |
+
|
819 |
+
/**
|
820 |
+
* @param string $sOptionKey
|
821 |
+
* @param mixed $mValueToTest
|
822 |
+
* @param boolean $bStrict
|
823 |
+
* @return bool
|
824 |
+
*/
|
825 |
+
public function isOpt( $sOptionKey, $mValueToTest, $bStrict = false ) {
|
826 |
+
$mOptionValue = $this->getOptionsVo()->getOpt( $sOptionKey );
|
827 |
+
return $bStrict ? $mOptionValue === $mValueToTest : $mOptionValue == $mValueToTest;
|
828 |
+
}
|
829 |
+
|
830 |
+
/**
|
831 |
+
* @param string $sOptKey
|
832 |
+
* @return string
|
833 |
+
*/
|
834 |
+
public function getTextOpt( $sOptKey ) {
|
835 |
+
$sValue = $this->getOpt( $sOptKey, 'default' );
|
836 |
+
if ( $sValue == 'default' ) {
|
837 |
+
$sValue = $this->getTextOptDefault( $sOptKey );
|
838 |
+
}
|
839 |
+
return $sValue;
|
840 |
+
}
|
841 |
+
|
842 |
+
/**
|
843 |
+
* Override this on each feature that has Text field options to supply the text field defaults
|
844 |
+
* @param string $sOptKey
|
845 |
+
* @return string
|
846 |
+
*/
|
847 |
+
public function getTextOptDefault( $sOptKey ) {
|
848 |
+
return 'Undefined Text Opt Default';
|
849 |
+
}
|
850 |
+
|
851 |
+
/**
|
852 |
+
* @param array|string $mErrors
|
853 |
+
* @return $this
|
854 |
+
*/
|
855 |
+
public function setLastErrors( $mErrors = [] ) {
|
856 |
+
if ( !is_array( $mErrors ) ) {
|
857 |
+
if ( is_string( $mErrors ) ) {
|
858 |
+
$mErrors = [ $mErrors ];
|
859 |
+
}
|
860 |
+
else {
|
861 |
+
$mErrors = [];
|
862 |
+
}
|
863 |
+
}
|
864 |
+
return $this->setOpt( 'last_errors', $mErrors );
|
865 |
+
}
|
866 |
+
|
867 |
+
/**
|
868 |
+
* Sets the value for the given option key
|
869 |
+
* Note: We also set the ability to bypass admin access since setOpt() is a protected function
|
870 |
+
* @param string $sOptionKey
|
871 |
+
* @param mixed $mValue
|
872 |
+
* @return $this
|
873 |
+
*/
|
874 |
+
protected function setOpt( $sOptionKey, $mValue ) {
|
875 |
+
$this->getOptionsVo()->setOpt( $sOptionKey, $mValue );
|
876 |
+
return $this;
|
877 |
+
}
|
878 |
+
|
879 |
+
/**
|
880 |
+
* @param array $aOptions
|
881 |
+
*/
|
882 |
+
public function setOptions( $aOptions ) {
|
883 |
+
$oVO = $this->getOptionsVo();
|
884 |
+
foreach ( $aOptions as $sKey => $mValue ) {
|
885 |
+
$oVO->setOpt( $sKey, $mValue );
|
886 |
+
}
|
887 |
+
}
|
888 |
+
|
889 |
+
/**
|
890 |
+
* @return bool
|
891 |
+
*/
|
892 |
+
public function isModuleRequest() {
|
893 |
+
return ( $this->getModSlug() == Services::Request()->request( 'mod_slug' ) );
|
894 |
+
}
|
895 |
+
|
896 |
+
/**
|
897 |
+
* @param string $sAction
|
898 |
+
* @param bool $bAsJsonEncodedObject
|
899 |
+
* @return array
|
900 |
+
*/
|
901 |
+
public function getAjaxActionData( $sAction = '', $bAsJsonEncodedObject = false ) {
|
902 |
+
$aData = $this->getNonceActionData( $sAction );
|
903 |
+
$aData[ 'ajaxurl' ] = admin_url( 'admin-ajax.php' );
|
904 |
+
return $bAsJsonEncodedObject ? json_encode( (object)$aData ) : $aData;
|
905 |
+
}
|
906 |
+
|
907 |
+
/**
|
908 |
+
* @param string $sAction
|
909 |
+
* @return array
|
910 |
+
*/
|
911 |
+
public function getNonceActionData( $sAction = '' ) {
|
912 |
+
$aData = $this->getCon()->getNonceActionData( $sAction );
|
913 |
+
$aData[ 'mod_slug' ] = $this->getModSlug();
|
914 |
+
return $aData;
|
915 |
+
}
|
916 |
+
|
917 |
+
/**
|
918 |
+
* @return string[]
|
919 |
+
*/
|
920 |
+
public function getDismissedNotices() {
|
921 |
+
$aDN = $this->getOpt( 'dismissed_notices' );
|
922 |
+
return is_array( $aDN ) ? $aDN : [];
|
923 |
+
}
|
924 |
+
|
925 |
+
|
926 |
+
/**
|
927 |
+
* @return string[]
|
928 |
+
*/
|
929 |
+
public function getUiTrack() {
|
930 |
+
$aDN = $this->getOpt( 'ui_track' );
|
931 |
+
return is_array( $aDN ) ? $aDN : [];
|
932 |
+
}
|
933 |
+
|
934 |
+
/**
|
935 |
+
* @param string[] $aDismissed
|
936 |
+
* @return $this
|
937 |
+
*/
|
938 |
+
public function setDismissedNotices( $aDismissed ) {
|
939 |
+
return $this->setOpt( 'dismissed_notices', $aDismissed );
|
940 |
+
}
|
941 |
+
/**
|
942 |
+
* @param string[] $aDismissed
|
943 |
+
* @return $this
|
944 |
+
*/
|
945 |
+
public function setUiTrack( $aDismissed ) {
|
946 |
+
return $this->setOpt( 'ui_track', $aDismissed );
|
947 |
+
}
|
948 |
+
|
949 |
+
/**
|
950 |
+
* @return \ICWP_WPSF_Wizard_Base|null
|
951 |
+
*/
|
952 |
+
public function getWizardHandler() {
|
953 |
+
if ( !isset( $this->oWizard ) ) {
|
954 |
+
$sClassName = $this->getWizardClassName();
|
955 |
+
if ( !class_exists( $sClassName ) ) {
|
956 |
+
return null;
|
957 |
+
}
|
958 |
+
$this->oWizard = new $sClassName();
|
959 |
+
$this->oWizard->setMod( $this );
|
960 |
+
}
|
961 |
+
return $this->oWizard;
|
962 |
+
}
|
963 |
+
|
964 |
+
/**
|
965 |
+
* Saves the options to the WordPress Options store.
|
966 |
+
* It will also update the stored plugin options version.
|
967 |
+
* @return void
|
968 |
+
*/
|
969 |
+
public function savePluginOptions() {
|
970 |
+
$this->doPrePluginOptionsSave();
|
971 |
+
if ( apply_filters( $this->prefix( 'force_options_resave' ), false ) ) {
|
972 |
+
$this->getOptionsVo()
|
973 |
+
->setNeedSave( true );
|
974 |
+
}
|
975 |
+
|
976 |
+
// we set the flag that options have been updated. (only use this flag if it's a MANUAL options update)
|
977 |
+
$this->bImportExportWhitelistNotify = $this->getOptionsVo()->getNeedSave();
|
978 |
+
$this->store();
|
979 |
+
}
|
980 |
+
|
981 |
+
private function store() {
|
982 |
+
add_filter( $this->prefix( 'bypass_is_plugin_admin' ), '__return_true', 1000 );
|
983 |
+
$this->getOptionsVo()
|
984 |
+
->doOptionsSave( $this->getCon()->getIsResetPlugin(), $this->isPremium() );
|
985 |
+
remove_filter( $this->prefix( 'bypass_is_plugin_admin' ), '__return_true', 1000 );
|
986 |
+
}
|
987 |
+
|
988 |
+
/**
|
989 |
+
* @param array $aAggregatedOptions
|
990 |
+
* @return array
|
991 |
+
*/
|
992 |
+
public function aggregateOptionsValues( $aAggregatedOptions ) {
|
993 |
+
return array_merge( $aAggregatedOptions, $this->getOptionsVo()->getAllOptionsValues() );
|
994 |
+
}
|
995 |
+
|
996 |
+
/**
|
997 |
+
* Will initiate the plugin options structure for use by the UI builder.
|
998 |
+
* It doesn't set any values, just populates the array created in buildOptions()
|
999 |
+
* with values stored.
|
1000 |
+
* It has to handle the conversion of stored values to data to be displayed to the user.
|
1001 |
+
*/
|
1002 |
+
public function buildOptions() {
|
1003 |
+
|
1004 |
+
$bPremiumEnabled = $this->getCon()->isPremiumExtensionsEnabled();
|
1005 |
+
|
1006 |
+
$oOptsVo = $this->getOptionsVo();
|
1007 |
+
$aOptions = $oOptsVo->getOptionsForPluginUse();
|
1008 |
+
|
1009 |
+
foreach ( $aOptions as $nSectionKey => $aSection ) {
|
1010 |
+
|
1011 |
+
if ( !empty( $aSection[ 'options' ] ) ) {
|
1012 |
+
|
1013 |
+
foreach ( $aSection[ 'options' ] as $nKey => $aOption ) {
|
1014 |
+
$aOption[ 'is_value_default' ] = ( $aOption[ 'value' ] === $aOption[ 'default' ] );
|
1015 |
+
$bIsPrem = isset( $aOption[ 'premium' ] ) && $aOption[ 'premium' ];
|
1016 |
+
if ( !$bIsPrem || $bPremiumEnabled ) {
|
1017 |
+
$aSection[ 'options' ][ $nKey ] = $this->buildOptionForUi( $aOption );
|
1018 |
+
}
|
1019 |
+
else {
|
1020 |
+
unset( $aSection[ 'options' ][ $nKey ] );
|
1021 |
+
}
|
1022 |
+
}
|
1023 |
+
|
1024 |
+
if ( empty( $aSection[ 'options' ] ) ) {
|
1025 |
+
unset( $aOptions[ $nSectionKey ] );
|
1026 |
+
}
|
1027 |
+
else {
|
1028 |
+
try {
|
1029 |
+
$aStrings = $this->getStrings()->getSectionStrings( $aSection[ 'slug' ] );
|
1030 |
+
foreach ( $aStrings as $sKey => $sVal ) {
|
1031 |
+
unset( $aSection[ $sKey ] );
|
1032 |
+
$aSection[ $sKey ] = $sVal;
|
1033 |
+
}
|
1034 |
+
}
|
1035 |
+
catch ( \Exception $oE ) {
|
1036 |
+
}
|
1037 |
+
$aOptions[ $nSectionKey ] = $aSection;
|
1038 |
+
}
|
1039 |
+
|
1040 |
+
$aWarnings = [];
|
1041 |
+
if ( !$oOptsVo->isSectionReqsMet( $aSection[ 'slug' ] ) ) {
|
1042 |
+
$aWarnings[] = __( 'Unfortunately your WordPress and/or PHP versions are too old to support this feature.', 'wp-simple-firewall' );
|
1043 |
+
}
|
1044 |
+
$aOptions[ $nSectionKey ][ 'warnings' ] = array_merge(
|
1045 |
+
$aWarnings,
|
1046 |
+
$this->getSectionWarnings( $aSection[ 'slug' ] )
|
1047 |
+
);
|
1048 |
+
$aOptions[ $nSectionKey ][ 'notices' ] = $this->getSectionNotices( $aSection[ 'slug' ] );
|
1049 |
+
|
1050 |
+
if ( !empty( $aSection[ 'help_video_id' ] ) ) {
|
1051 |
+
$sHelpVideoUrl = $this->getHelpVideoUrl( $aSection[ 'help_video_id' ] );
|
1052 |
+
}
|
1053 |
+
else {
|
1054 |
+
$sHelpVideoUrl = '';
|
1055 |
+
}
|
1056 |
+
$aOptions[ $nSectionKey ][ 'help_video_url' ] = $sHelpVideoUrl;
|
1057 |
+
}
|
1058 |
+
}
|
1059 |
+
|
1060 |
+
return $aOptions;
|
1061 |
+
}
|
1062 |
+
|
1063 |
+
/**
|
1064 |
+
* @param string $sSectionSlug
|
1065 |
+
* @return array
|
1066 |
+
*/
|
1067 |
+
protected function getSectionNotices( $sSectionSlug ) {
|
1068 |
+
return [];
|
1069 |
+
}
|
1070 |
+
|
1071 |
+
/**
|
1072 |
+
* @param string $sSection
|
1073 |
+
* @return array
|
1074 |
+
*/
|
1075 |
+
protected function getSectionWarnings( $sSection ) {
|
1076 |
+
return [];
|
1077 |
+
}
|
1078 |
+
|
1079 |
+
/**
|
1080 |
+
* @param array $aOptParams
|
1081 |
+
* @return array
|
1082 |
+
*/
|
1083 |
+
protected function buildOptionForUi( $aOptParams ) {
|
1084 |
+
|
1085 |
+
$mCurrent = $aOptParams[ 'value' ];
|
1086 |
+
|
1087 |
+
switch ( $aOptParams[ 'type' ] ) {
|
1088 |
+
|
1089 |
+
case 'password':
|
1090 |
+
if ( !empty( $mCurrent ) ) {
|
1091 |
+
$mCurrent = '';
|
1092 |
+
}
|
1093 |
+
break;
|
1094 |
+
|
1095 |
+
case 'array':
|
1096 |
+
|
1097 |
+
if ( empty( $mCurrent ) || !is_array( $mCurrent ) ) {
|
1098 |
+
$mCurrent = [];
|
1099 |
+
}
|
1100 |
+
|
1101 |
+
$aOptParams[ 'rows' ] = count( $mCurrent ) + 2;
|
1102 |
+
$mCurrent = stripslashes( implode( "\n", $mCurrent ) );
|
1103 |
+
|
1104 |
+
break;
|
1105 |
+
|
1106 |
+
case 'comma_separated_lists':
|
1107 |
+
|
1108 |
+
$aNewValues = [];
|
1109 |
+
if ( !empty( $mCurrent ) && is_array( $mCurrent ) ) {
|
1110 |
+
|
1111 |
+
foreach ( $mCurrent as $sPage => $aParams ) {
|
1112 |
+
$aNewValues[] = $sPage.', '.implode( ", ", $aParams );
|
1113 |
+
}
|
1114 |
+
}
|
1115 |
+
$aOptParams[ 'rows' ] = count( $aNewValues ) + 1;
|
1116 |
+
$mCurrent = implode( "\n", $aNewValues );
|
1117 |
+
|
1118 |
+
break;
|
1119 |
+
|
1120 |
+
case 'multiple_select':
|
1121 |
+
if ( !is_array( $mCurrent ) ) {
|
1122 |
+
$mCurrent = [];
|
1123 |
+
}
|
1124 |
+
break;
|
1125 |
+
|
1126 |
+
case 'text':
|
1127 |
+
$mCurrent = stripslashes( $this->getTextOpt( $aOptParams[ 'key' ] ) );
|
1128 |
+
break;
|
1129 |
+
}
|
1130 |
+
|
1131 |
+
$aParams = [
|
1132 |
+
'value' => is_scalar( $mCurrent ) ? esc_attr( $mCurrent ) : $mCurrent,
|
1133 |
+
'disabled' => !$this->isPremium() && ( isset( $aOptParams[ 'premium' ] ) && $aOptParams[ 'premium' ] ),
|
1134 |
+
];
|
1135 |
+
$aParams[ 'enabled' ] = !$aParams[ 'disabled' ];
|
1136 |
+
$aOptParams = array_merge( [ 'rows' => 2 ], $aOptParams, $aParams );
|
1137 |
+
|
1138 |
+
// add strings
|
1139 |
+
try {
|
1140 |
+
$aOptParams = Services::DataManipulation()->mergeArraysRecursive(
|
1141 |
+
$aOptParams,
|
1142 |
+
$this->getStrings()->getOptionStrings( $aOptParams[ 'key' ] )
|
1143 |
+
);
|
1144 |
+
}
|
1145 |
+
catch ( \Exception $oE ) {
|
1146 |
+
}
|
1147 |
+
return $aOptParams;
|
1148 |
+
}
|
1149 |
+
|
1150 |
+
/**
|
1151 |
+
* This is the point where you would want to do any options verification
|
1152 |
+
*/
|
1153 |
+
protected function doPrePluginOptionsSave() {
|
1154 |
+
}
|
1155 |
+
|
1156 |
+
/**
|
1157 |
+
*/
|
1158 |
+
public function onPluginDeactivate() {
|
1159 |
+
}
|
1160 |
+
|
1161 |
+
public function onPluginDelete() {
|
1162 |
+
$oDbh = $this->getDbHandler();
|
1163 |
+
if ( !empty( $oDbh ) ) {
|
1164 |
+
$oDbh->deleteTable();
|
1165 |
+
}
|
1166 |
+
$this->getOptions()->doOptionsDelete();
|
1167 |
+
}
|
1168 |
+
|
1169 |
+
/**
|
1170 |
+
* @return array - map of each option to its option type
|
1171 |
+
*/
|
1172 |
+
protected function getAllFormOptionsAndTypes() {
|
1173 |
+
$aOpts = [];
|
1174 |
+
|
1175 |
+
foreach ( $this->buildOptions() as $aOptionsSection ) {
|
1176 |
+
if ( !empty( $aOptionsSection ) ) {
|
1177 |
+
foreach ( $aOptionsSection[ 'options' ] as $aOption ) {
|
1178 |
+
$aOpts[ $aOption[ 'key' ] ] = $aOption[ 'type' ];
|
1179 |
+
}
|
1180 |
+
}
|
1181 |
+
}
|
1182 |
+
|
1183 |
+
return $aOpts;
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
/**
|
1187 |
+
*/
|
1188 |
+
public function handleModRequest() {
|
1189 |
+
}
|
1190 |
+
|
1191 |
+
/**
|
1192 |
+
* @throws \Exception
|
1193 |
+
*/
|
1194 |
+
public function saveOptionsSubmit() {
|
1195 |
+
if ( !$this->getCon()->isPluginAdmin() ) {
|
1196 |
+
throw new \Exception( __( "You don't currently have permission to save settings.", 'wp-simple-firewall' ) );
|
1197 |
+
}
|
1198 |
+
$this->doSaveStandardOptions();
|
1199 |
+
$this->doExtraSubmitProcessing();
|
1200 |
+
}
|
1201 |
+
|
1202 |
+
protected function verifyFormSubmit() {
|
1203 |
+
return $this->getCon()->isPluginAdmin()
|
1204 |
+
&& check_admin_referer( $this->getCon()->getPluginPrefix() );
|
1205 |
+
}
|
1206 |
+
|
1207 |
+
protected function doExtraSubmitProcessing() {
|
1208 |
+
}
|
1209 |
+
|
1210 |
+
/**
|
1211 |
+
* @param string $sMsg
|
1212 |
+
* @param bool $bError
|
1213 |
+
* @return $this
|
1214 |
+
*/
|
1215 |
+
public function setFlashAdminNotice( $sMsg, $bError = false, $bShowOnLogin = false ) {
|
1216 |
+
$this->getCon()
|
1217 |
+
->getAdminNotices()
|
1218 |
+
->addFlash(
|
1219 |
+
sprintf( '[%s] %s', $this->getCon()->getHumanName(), $sMsg ),
|
1220 |
+
$bError,
|
1221 |
+
$bShowOnLogin
|
1222 |
+
);
|
1223 |
+
return $this;
|
1224 |
+
}
|
1225 |
+
|
1226 |
+
/**
|
1227 |
+
* @return bool
|
1228 |
+
*/
|
1229 |
+
protected function isAdminOptionsPage() {
|
1230 |
+
return ( is_admin() && !Services::WpGeneral()->isAjax() && $this->isThisModulePage() );
|
1231 |
+
}
|
1232 |
+
|
1233 |
+
/**
|
1234 |
+
* @return bool
|
1235 |
+
*/
|
1236 |
+
public function isPremium() {
|
1237 |
+
return $this->getCon()->isPremiumActive();
|
1238 |
+
}
|
1239 |
+
|
1240 |
+
/**
|
1241 |
+
* UNUSED
|
1242 |
+
* Ensure that if an option is premium, it is never changed unless we have premium access
|
1243 |
+
*/
|
1244 |
+
protected function resetPremiumOptions() {
|
1245 |
+
if ( !$this->isPremium() ) {
|
1246 |
+
$this->getOptionsVo()->resetPremiumOptsToDefault();
|
1247 |
+
}
|
1248 |
+
}
|
1249 |
+
|
1250 |
+
/**
|
1251 |
+
* @throws \Exception
|
1252 |
+
*/
|
1253 |
+
private function doSaveStandardOptions() {
|
1254 |
+
$aForm = $this->getAjaxFormParams( 'b64' ); // standard options use b64 and failover to lz-string
|
1255 |
+
|
1256 |
+
foreach ( $this->getAllFormOptionsAndTypes() as $sKey => $sOptType ) {
|
1257 |
+
|
1258 |
+
$sOptionValue = isset( $aForm[ $sKey ] ) ? $aForm[ $sKey ] : null;
|
1259 |
+
if ( is_null( $sOptionValue ) ) {
|
1260 |
+
|
1261 |
+
if ( in_array( $sOptType, [ 'text', 'email' ] ) ) { //text box, and it's null, don't update
|
1262 |
+
continue;
|
1263 |
+
}
|
1264 |
+
else if ( $sOptType == 'checkbox' ) { //if it was a checkbox, and it's null, it means 'N'
|
1265 |
+
$sOptionValue = 'N';
|
1266 |
+
}
|
1267 |
+
else if ( $sOptType == 'integer' ) { //if it was a integer, and it's null, it means '0'
|
1268 |
+
$sOptionValue = 0;
|
1269 |
+
}
|
1270 |
+
else if ( $sOptType == 'multiple_select' ) {
|
1271 |
+
$sOptionValue = [];
|
1272 |
+
}
|
1273 |
+
}
|
1274 |
+
else { //handle any pre-processing we need to.
|
1275 |
+
|
1276 |
+
if ( $sOptType == 'text' || $sOptType == 'email' ) {
|
1277 |
+
$sOptionValue = trim( $sOptionValue );
|
1278 |
+
}
|
1279 |
+
if ( $sOptType == 'integer' ) {
|
1280 |
+
$sOptionValue = intval( $sOptionValue );
|
1281 |
+
}
|
1282 |
+
else if ( $sOptType == 'password' ) {
|
1283 |
+
$sTempValue = trim( $sOptionValue );
|
1284 |
+
if ( empty( $sTempValue ) ) {
|
1285 |
+
continue;
|
1286 |
+
}
|
1287 |
+
|
1288 |
+
$sConfirm = isset( $aForm[ $sKey.'_confirm' ] ) ? $aForm[ $sKey.'_confirm' ] : null;
|
1289 |
+
if ( $sTempValue !== $sConfirm ) {
|
1290 |
+
throw new \Exception( __( 'Password values do not match.', 'wp-simple-firewall' ) );
|
1291 |
+
}
|
1292 |
+
|
1293 |
+
$sOptionValue = md5( $sTempValue );
|
1294 |
+
}
|
1295 |
+
else if ( $sOptType == 'array' ) { //arrays are textareas, where each is separated by newline
|
1296 |
+
$sOptionValue = array_filter( explode( "\n", esc_textarea( $sOptionValue ) ), 'trim' );
|
1297 |
+
}
|
1298 |
+
else if ( $sOptType == 'comma_separated_lists' ) {
|
1299 |
+
$sOptionValue = Services::Data()->extractCommaSeparatedList( $sOptionValue );
|
1300 |
+
}
|
1301 |
+
else if ( $sOptType == 'multiple_select' ) {
|
1302 |
+
}
|
1303 |
+
}
|
1304 |
+
|
1305 |
+
// Prevent overwriting of non-editable fields
|
1306 |
+
if ( !in_array( $sOptType, [ 'noneditable_text' ] ) ) {
|
1307 |
+
$this->setOpt( $sKey, $sOptionValue );
|
1308 |
+
}
|
1309 |
+
}
|
1310 |
+
|
1311 |
+
$this->savePluginOptions();
|
1312 |
+
|
1313 |
+
// only use this flag when the options are being updated with a MANUAL save.
|
1314 |
+
if ( isset( $this->bImportExportWhitelistNotify ) && $this->bImportExportWhitelistNotify ) {
|
1315 |
+
if ( !wp_next_scheduled( $this->prefix( 'importexport_notify' ) ) ) {
|
1316 |
+
wp_schedule_single_event( Services::Request()->ts() + 15, $this->prefix( 'importexport_notify' ) );
|
1317 |
+
}
|
1318 |
+
}
|
1319 |
+
}
|
1320 |
+
|
1321 |
+
/**
|
1322 |
+
*/
|
1323 |
+
protected function runWizards() {
|
1324 |
+
if ( $this->isWizardPage() && $this->hasWizard() ) {
|
1325 |
+
$oWiz = $this->getWizardHandler();
|
1326 |
+
if ( $oWiz instanceof \ICWP_WPSF_Wizard_Base ) {
|
1327 |
+
$oWiz->init();
|
1328 |
+
}
|
1329 |
+
}
|
1330 |
+
}
|
1331 |
+
|
1332 |
+
/**
|
1333 |
+
* @return bool
|
1334 |
+
*/
|
1335 |
+
public function isThisModulePage() {
|
1336 |
+
return $this->getCon()->isModulePage()
|
1337 |
+
&& Services::Request()->query( 'page' ) == $this->getModSlug();
|
1338 |
+
}
|
1339 |
+
|
1340 |
+
/**
|
1341 |
+
* @return bool
|
1342 |
+
*/
|
1343 |
+
public function isPage_Insights() {
|
1344 |
+
return Services::Request()->query( 'page' ) == $this->getCon()->getModule_Insights()->getModSlug();
|
1345 |
+
}
|
1346 |
+
|
1347 |
+
/**
|
1348 |
+
* @return bool
|
1349 |
+
*/
|
1350 |
+
public function isPage_InsightsThisModule() {
|
1351 |
+
return $this->isPage_Insights()
|
1352 |
+
&& Services::Request()->query( 'subnav' ) == $this->getSlug();
|
1353 |
+
}
|
1354 |
+
|
1355 |
+
/**
|
1356 |
+
* @return bool
|
1357 |
+
*/
|
1358 |
+
protected function isModuleOptionsRequest() {
|
1359 |
+
return Services::Request()->post( 'mod_slug' ) === $this->getModSlug();
|
1360 |
+
}
|
1361 |
+
|
1362 |
+
/**
|
1363 |
+
* @return bool
|
1364 |
+
*/
|
1365 |
+
protected function isWizardPage() {
|
1366 |
+
return ( $this->getCon()->getShieldAction() == 'wizard' && $this->isThisModulePage() );
|
1367 |
+
}
|
1368 |
+
|
1369 |
+
/**
|
1370 |
+
* @return boolean
|
1371 |
+
*/
|
1372 |
+
public function hasEncryptOption() {
|
1373 |
+
return function_exists( 'md5' );
|
1374 |
+
}
|
1375 |
+
|
1376 |
+
/**
|
1377 |
+
* Will prefix and return any string with the unique plugin prefix.
|
1378 |
+
* @param string $sSuffix
|
1379 |
+
* @param string $sGlue
|
1380 |
+
* @return string
|
1381 |
+
*/
|
1382 |
+
public function prefix( $sSuffix = '', $sGlue = '-' ) {
|
1383 |
+
return $this->getCon()->prefix( $sSuffix, $sGlue );
|
1384 |
+
}
|
1385 |
+
|
1386 |
+
/**
|
1387 |
+
* @param string
|
1388 |
+
* @return string
|
1389 |
+
*/
|
1390 |
+
public function getOptionStoragePrefix() {
|
1391 |
+
return $this->getCon()->getOptionStoragePrefix();
|
1392 |
+
}
|
1393 |
+
|
1394 |
+
/**
|
1395 |
+
* @uses echo()
|
1396 |
+
*/
|
1397 |
+
public function displayModuleAdminPage() {
|
1398 |
+
if ( $this->canDisplayOptionsForm() ) {
|
1399 |
+
echo $this->renderModulePage();
|
1400 |
+
}
|
1401 |
+
else {
|
1402 |
+
echo $this->renderRestrictedPage();
|
1403 |
+
}
|
1404 |
+
}
|
1405 |
+
|
1406 |
+
/**
|
1407 |
+
* Override this to customize anything with the display of the page
|
1408 |
+
* @param array $aData
|
1409 |
+
* @return string
|
1410 |
+
*/
|
1411 |
+
protected function renderModulePage( $aData = [] ) {
|
1412 |
+
// Get Base Data
|
1413 |
+
$aData = Services::DataManipulation()
|
1414 |
+
->mergeArraysRecursive( $this->getBaseDisplayData(), $aData );
|
1415 |
+
$aData[ 'content' ][ 'options_form' ] = $this->renderOptionsForm();
|
1416 |
+
|
1417 |
+
return $this->renderTemplate( 'index.php', $aData );
|
1418 |
+
}
|
1419 |
+
|
1420 |
+
/**
|
1421 |
+
* @return string
|
1422 |
+
*/
|
1423 |
+
protected function renderRestrictedPage() {
|
1424 |
+
$aData = Services::DataManipulation()
|
1425 |
+
->mergeArraysRecursive(
|
1426 |
+
$this->getBaseDisplayData(),
|
1427 |
+
[
|
1428 |
+
'ajax' => [
|
1429 |
+
'restricted_access' => $this->getAjaxActionData( 'restricted_access' )
|
1430 |
+
]
|
1431 |
+
]
|
1432 |
+
);
|
1433 |
+
return $this->renderTemplate( 'access_restricted.php', $aData );
|
1434 |
+
}
|
1435 |
+
|
1436 |
+
/**
|
1437 |
+
* @return array
|
1438 |
+
*/
|
1439 |
+
protected function getBaseDisplayData() {
|
1440 |
+
$oCon = $this->getCon();
|
1441 |
+
|
1442 |
+
return [
|
1443 |
+
'sPluginName' => $oCon->getHumanName(),
|
1444 |
+
'sTagline' => $this->getOptionsVo()->getFeatureTagline(),
|
1445 |
+
'nonce_field' => wp_nonce_field( $oCon->getPluginPrefix(), '_wpnonce', true, false ), //don't echo!
|
1446 |
+
'form_action' => 'admin.php?page='.$this->getModSlug(),
|
1447 |
+
'aPluginLabels' => $oCon->getLabels(),
|
1448 |
+
'help_video' => [
|
1449 |
+
'auto_show' => $this->getIfAutoShowHelpVideo(),
|
1450 |
+
'iframe_url' => $this->getHelpVideoUrl( $this->getHelpVideoId() ),
|
1451 |
+
'display_id' => 'ShieldHelpVideo'.$this->getSlug(),
|
1452 |
+
'options' => $this->getHelpVideoOptions(),
|
1453 |
+
'displayable' => $this->isHelpVideoDisplayable(),
|
1454 |
+
'show' => $this->isHelpVideoDisplayable() && !$this->getHelpVideoHasBeenClosed(),
|
1455 |
+
'width' => 772,
|
1456 |
+
'height' => 454,
|
1457 |
+
],
|
1458 |
+
'aSummaryData' => $this->getModulesSummaryData(),
|
1459 |
+
|
1460 |
+
// 'sPageTitle' => sprintf( '%s: %s', $oCon->getHumanName(), $this->getMainFeatureName() ),
|
1461 |
+
'sPageTitle' => $this->getMainFeatureName(),
|
1462 |
+
'data' => [
|
1463 |
+
'mod_slug' => $this->getModSlug( true ),
|
1464 |
+
'mod_slug_short' => $this->getModSlug( false ),
|
1465 |
+
'all_options' => $this->buildOptions(),
|
1466 |
+
'hidden_options' => $this->getOptionsVo()->getHiddenOptions()
|
1467 |
+
],
|
1468 |
+
'ajax' => [
|
1469 |
+
'mod_options' => $this->getAjaxActionData( 'mod_options' ),
|
1470 |
+
],
|
1471 |
+
'strings' => $this->getStrings()->getDisplayStrings(),
|
1472 |
+
'flags' => [
|
1473 |
+
'access_restricted' => !$this->canDisplayOptionsForm(),
|
1474 |
+
'show_ads' => $this->getIsShowMarketing(),
|
1475 |
+
'wrap_page_content' => true,
|
1476 |
+
'show_standard_options' => true,
|
1477 |
+
'show_content_help' => true,
|
1478 |
+
'show_alt_content' => false,
|
1479 |
+
'has_wizard' => $this->hasWizard(),
|
1480 |
+
],
|
1481 |
+
'hrefs' => [
|
1482 |
+
'go_pro' => 'https://icwp.io/shieldgoprofeature',
|
1483 |
+
'goprofooter' => 'https://icwp.io/goprofooter',
|
1484 |
+
'wizard_link' => $this->getUrl_WizardLanding(),
|
1485 |
+
'wizard_landing' => $this->getUrl_WizardLanding()
|
1486 |
+
],
|
1487 |
+
'content' => [
|
1488 |
+
'options_form' => '',
|
1489 |
+
'alt' => '',
|
1490 |
+
'actions' => '',
|
1491 |
+
'help' => '',
|
1492 |
+
'wizard_landing' => ''
|
1493 |
+
]
|
1494 |
+
];
|
1495 |
+
}
|
1496 |
+
|
1497 |
+
/**
|
1498 |
+
* @return string
|
1499 |
+
*/
|
1500 |
+
protected function getContentHelp() {
|
1501 |
+
return $this->renderTemplate( 'snippets/module-help-template.php', $this->getBaseDisplayData() );
|
1502 |
+
}
|
1503 |
+
|
1504 |
+
/**
|
1505 |
+
* @return string
|
1506 |
+
*/
|
1507 |
+
protected function getContentWizardLanding() {
|
1508 |
+
$aData = $this->getBaseDisplayData();
|
1509 |
+
if ( $this->hasWizard() ) {
|
1510 |
+
$aData[ 'content' ][ 'wizard_landing' ] = $this->getWizardHandler()->renderWizardLandingSnippet();
|
1511 |
+
}
|
1512 |
+
return $this->renderTemplate( 'snippets/module-wizard-template.php', $aData );
|
1513 |
+
}
|
1514 |
+
|
1515 |
+
protected function buildContextualHelp() {
|
1516 |
+
if ( !function_exists( 'get_current_screen' ) ) {
|
1517 |
+
require_once( ABSPATH.'wp-admin/includes/screen.php' );
|
1518 |
+
}
|
1519 |
+
$screen = get_current_screen();
|
1520 |
+
//$screen->remove_help_tabs();
|
1521 |
+
$screen->add_help_tab( [
|
1522 |
+
'id' => 'my-plugin-default',
|
1523 |
+
'title' => __( 'Default' ),
|
1524 |
+
'content' => 'This is where I would provide tabbed help to the user on how everything in my admin panel works. Formatted HTML works fine in here too'
|
1525 |
+
] );
|
1526 |
+
//add more help tabs as needed with unique id's
|
1527 |
+
|
1528 |
+
// Help sidebars are optional
|
1529 |
+
$screen->set_help_sidebar(
|
1530 |
+
'<p><strong>'.__( 'For more information:' ).'</strong></p>'.
|
1531 |
+
'<p><a href="http://wordpress.org/support/" target="_blank">'._( 'Support Forums' ).'</a></p>'
|
1532 |
+
);
|
1533 |
+
}
|
1534 |
+
|
1535 |
+
/**
|
1536 |
+
* @return array[]
|
1537 |
+
*/
|
1538 |
+
protected function getModulesSummaryData() {
|
1539 |
+
return apply_filters( $this->prefix( 'collect_mod_summary' ), [] );
|
1540 |
+
}
|
1541 |
+
|
1542 |
+
/**
|
1543 |
+
* @param string $sWizardSlug
|
1544 |
+
* @return string
|
1545 |
+
* @uses nonce
|
1546 |
+
*/
|
1547 |
+
public function getUrl_Wizard( $sWizardSlug ) {
|
1548 |
+
$aDef = $this->getWizardDefinition( $sWizardSlug );
|
1549 |
+
if ( empty( $aDef[ 'min_user_permissions' ] ) ) { // i.e. no login/minimum perms
|
1550 |
+
$sUrl = Services::WpGeneral()->getHomeUrl();
|
1551 |
+
}
|
1552 |
+
else {
|
1553 |
+
$sUrl = Services::WpGeneral()->getAdminUrl( 'admin.php' );
|
1554 |
+
}
|
1555 |
+
|
1556 |
+
return add_query_arg(
|
1557 |
+
[
|
1558 |
+
'page' => $this->getModSlug(),
|
1559 |
+
'shield_action' => 'wizard',
|
1560 |
+
'wizard' => $sWizardSlug,
|
1561 |
+
'nonwizard' => wp_create_nonce( 'wizard'.$sWizardSlug )
|
1562 |
+
],
|
1563 |
+
$sUrl
|
1564 |
+
);
|
1565 |
+
}
|
1566 |
+
|
1567 |
+
/**
|
1568 |
+
* @return string
|
1569 |
+
*/
|
1570 |
+
protected function getUrl_WizardLanding() {
|
1571 |
+
return $this->getUrl_Wizard( 'landing' );
|
1572 |
+
}
|
1573 |
+
|
1574 |
+
/**
|
1575 |
+
* @param string $sWizardSlug
|
1576 |
+
* @return array
|
1577 |
+
*/
|
1578 |
+
public function getWizardDefinition( $sWizardSlug ) {
|
1579 |
+
$aDef = null;
|
1580 |
+
if ( $this->hasWizardDefinition( $sWizardSlug ) ) {
|
1581 |
+
$aW = $this->getWizardDefinitions();
|
1582 |
+
$aDef = $aW[ $sWizardSlug ];
|
1583 |
+
}
|
1584 |
+
return $aDef;
|
1585 |
+
}
|
1586 |
+
|
1587 |
+
/**
|
1588 |
+
* @return array
|
1589 |
+
*/
|
1590 |
+
public function getWizardDefinitions() {
|
1591 |
+
$aW = $this->getDef( 'wizards' );
|
1592 |
+
return is_array( $aW ) ? $aW : [];
|
1593 |
+
}
|
1594 |
+
|
1595 |
+
/**
|
1596 |
+
* @return bool
|
1597 |
+
*/
|
1598 |
+
public function hasWizard() {
|
1599 |
+
return ( count( $this->getWizardDefinitions() ) > 0 );
|
1600 |
+
}
|
1601 |
+
|
1602 |
+
/**
|
1603 |
+
* @param string $sWizardSlug
|
1604 |
+
* @return bool
|
1605 |
+
*/
|
1606 |
+
public function hasWizardDefinition( $sWizardSlug ) {
|
1607 |
+
$aW = $this->getWizardDefinitions();
|
1608 |
+
return !empty( $aW[ $sWizardSlug ] );
|
1609 |
+
}
|
1610 |
+
|
1611 |
+
/**
|
1612 |
+
* @return boolean
|
1613 |
+
*/
|
1614 |
+
protected function getIsShowMarketing() {
|
1615 |
+
return apply_filters( $this->prefix( 'show_marketing' ), !$this->isPremium() );
|
1616 |
+
}
|
1617 |
+
|
1618 |
+
/**
|
1619 |
+
* @return string
|
1620 |
+
*/
|
1621 |
+
public function renderOptionsForm() {
|
1622 |
+
|
1623 |
+
if ( $this->canDisplayOptionsForm() ) {
|
1624 |
+
$sTemplate = 'snippets/options_form.twig';
|
1625 |
+
}
|
1626 |
+
else {
|
1627 |
+
$sTemplate = 'subfeature-access_restricted';
|
1628 |
+
}
|
1629 |
+
|
1630 |
+
try {
|
1631 |
+
return $this->getCon()
|
1632 |
+
->getRenderer()
|
1633 |
+
->setTemplate( $sTemplate )
|
1634 |
+
->setRenderVars( $this->getBaseDisplayData() )
|
1635 |
+
->setTemplateEngineTwig()
|
1636 |
+
->render();
|
1637 |
+
}
|
1638 |
+
catch ( \Exception $oE ) {
|
1639 |
+
return 'Error rendering options form: '.$oE->getMessage();
|
1640 |
+
}
|
1641 |
+
}
|
1642 |
+
|
1643 |
+
/**
|
1644 |
+
* @return bool
|
1645 |
+
*/
|
1646 |
+
protected function canDisplayOptionsForm() {
|
1647 |
+
return $this->getOptionsVo()->isAccessRestricted() ? $this->getCon()->isPluginAdmin() : true;
|
1648 |
+
}
|
1649 |
+
|
1650 |
+
public function onWpEnqueueAdminJs() {
|
1651 |
+
$this->insertCustomJsVars_Admin();
|
1652 |
+
}
|
1653 |
+
|
1654 |
+
/**
|
1655 |
+
* Override this with custom JS vars for your particular module.
|
1656 |
+
*/
|
1657 |
+
public function insertCustomJsVars_Admin() {
|
1658 |
+
|
1659 |
+
if ( $this->isThisModulePage() ) {
|
1660 |
+
wp_localize_script(
|
1661 |
+
$this->prefix( 'plugin' ),
|
1662 |
+
'icwp_wpsf_vars_base',
|
1663 |
+
[
|
1664 |
+
'ajax' => [
|
1665 |
+
'mod_options' => $this->getAjaxActionData( 'mod_options' ),
|
1666 |
+
'mod_opts_form_render' => $this->getAjaxActionData( 'mod_opts_form_render' ),
|
1667 |
+
]
|
1668 |
+
]
|
1669 |
+
);
|
1670 |
+
}
|
1671 |
+
}
|
1672 |
+
|
1673 |
+
/**
|
1674 |
+
* @param array $aData
|
1675 |
+
* @param string $sSubView
|
1676 |
+
*/
|
1677 |
+
protected function display( $aData = [], $sSubView = '' ) {
|
1678 |
+
}
|
1679 |
+
|
1680 |
+
/**
|
1681 |
+
* @param array $aData
|
1682 |
+
* @return string
|
1683 |
+
* @throws \Exception
|
1684 |
+
*/
|
1685 |
+
public function renderAdminNotice( $aData ) {
|
1686 |
+
if ( empty( $aData[ 'notice_attributes' ] ) ) {
|
1687 |
+
throw new \Exception( 'notice_attributes is empty' );
|
1688 |
+
}
|
1689 |
+
|
1690 |
+
if ( !isset( $aData[ 'icwp_admin_notice_template' ] ) ) {
|
1691 |
+
$aData[ 'icwp_admin_notice_template' ] = $aData[ 'notice_attributes' ][ 'notice_id' ];
|
1692 |
+
}
|
1693 |
+
|
1694 |
+
if ( !isset( $aData[ 'notice_classes' ] ) ) {
|
1695 |
+
$aData[ 'notice_classes' ] = [];
|
1696 |
+
}
|
1697 |
+
if ( is_array( $aData[ 'notice_classes' ] ) ) {
|
1698 |
+
$aData[ 'notice_classes' ][] = $aData[ 'notice_attributes' ][ 'type' ];
|
1699 |
+
if ( empty( $aData[ 'notice_classes' ] )
|
1700 |
+
|| ( !in_array( 'error', $aData[ 'notice_classes' ] ) && !in_array( 'updated', $aData[ 'notice_classes' ] ) ) ) {
|
1701 |
+
$aData[ 'notice_classes' ][] = 'updated';
|
1702 |
+
}
|
1703 |
+
}
|
1704 |
+
$aData[ 'notice_classes' ] = implode( ' ', $aData[ 'notice_classes' ] );
|
1705 |
+
|
1706 |
+
$aAjaxData = $this->getAjaxActionData( 'dismiss_admin_notice' );
|
1707 |
+
$aAjaxData[ 'hide' ] = 1;
|
1708 |
+
$aAjaxData[ 'notice_id' ] = $aData[ 'notice_attributes' ][ 'notice_id' ];
|
1709 |
+
$aData[ 'ajax' ][ 'dismiss_admin_notice' ] = json_encode( $aAjaxData );
|
1710 |
+
|
1711 |
+
$bTwig = $aData[ 'notice_attributes' ][ 'twig' ];
|
1712 |
+
$sTemplate = $bTwig ? '/notices/'.$aAjaxData[ 'notice_id' ] : 'notices/admin-notice-template';
|
1713 |
+
return $this->renderTemplate( $sTemplate, $aData, $bTwig );
|
1714 |
+
}
|
1715 |
+
|
1716 |
+
/**
|
1717 |
+
* @param string $sTemplate
|
1718 |
+
* @param array $aData
|
1719 |
+
* @param bool $bUseTwig
|
1720 |
+
* @return string
|
1721 |
+
*/
|
1722 |
+
public function renderTemplate( $sTemplate, $aData = [], $bUseTwig = false ) {
|
1723 |
+
if ( empty( $aData[ 'unique_render_id' ] ) ) {
|
1724 |
+
$aData[ 'unique_render_id' ] = 'noticeid-'.substr( md5( mt_rand() ), 0, 5 );
|
1725 |
+
}
|
1726 |
+
try {
|
1727 |
+
$oRndr = $this->getCon()->getRenderer();
|
1728 |
+
if ( $bUseTwig ) {
|
1729 |
+
$oRndr->setTemplateEngineTwig();
|
1730 |
+
}
|
1731 |
+
|
1732 |
+
$sOutput = $oRndr->setTemplate( $sTemplate )
|
1733 |
+
->setRenderVars( $aData )
|
1734 |
+
->render();
|
1735 |
+
}
|
1736 |
+
catch ( \Exception $oE ) {
|
1737 |
+
$sOutput = $oE->getMessage();
|
1738 |
+
error_log( $oE->getMessage() );
|
1739 |
+
}
|
1740 |
+
|
1741 |
+
return $sOutput;
|
1742 |
+
}
|
1743 |
+
|
1744 |
+
/**
|
1745 |
+
* @param array $aTransferableOptions
|
1746 |
+
* @return array
|
1747 |
+
*/
|
1748 |
+
public function exportTransferableOptions( $aTransferableOptions ) {
|
1749 |
+
if ( !is_array( $aTransferableOptions ) ) {
|
1750 |
+
$aTransferableOptions = [];
|
1751 |
+
}
|
1752 |
+
$aTransferableOptions[ $this->getOptionsStorageKey() ] = $this->getOptionsVo()->getTransferableOptions();
|
1753 |
+
return $aTransferableOptions;
|
1754 |
+
}
|
1755 |
+
|
1756 |
+
/**
|
1757 |
+
* @return array
|
1758 |
+
*/
|
1759 |
+
public function collectOptionsForTracking() {
|
1760 |
+
$oVO = $this->getOptionsVo();
|
1761 |
+
$aOptionsData = $this->getOptionsVo()->getOptionsMaskSensitive();
|
1762 |
+
foreach ( $aOptionsData as $sOption => $mValue ) {
|
1763 |
+
unset( $aOptionsData[ $sOption ] );
|
1764 |
+
// some cleaning to ensure we don't have disallowed characters
|
1765 |
+
$sOption = preg_replace( '#[^_a-z]#', '', strtolower( $sOption ) );
|
1766 |
+
$sType = $oVO->getOptionType( $sOption );
|
1767 |
+
if ( $sType == 'checkbox' ) { // only want a boolean 1 or 0
|
1768 |
+
$aOptionsData[ $sOption ] = (int)( $mValue == 'Y' );
|
1769 |
+
}
|
1770 |
+
else {
|
1771 |
+
$aOptionsData[ $sOption ] = $mValue;
|
1772 |
+
}
|
1773 |
+
}
|
1774 |
+
return $aOptionsData;
|
1775 |
+
}
|
1776 |
+
|
1777 |
+
/**
|
1778 |
+
* See plugin controller for the nature of $aData wpPrivacyExport()
|
1779 |
+
* @param array $aExportItems
|
1780 |
+
* @param string $sEmail
|
1781 |
+
* @param int $nPage
|
1782 |
+
* @return array
|
1783 |
+
*/
|
1784 |
+
public function onWpPrivacyExport( $aExportItems, $sEmail, $nPage = 1 ) {
|
1785 |
+
return $aExportItems;
|
1786 |
+
}
|
1787 |
+
|
1788 |
+
/**
|
1789 |
+
* See plugin controller for the nature of $aData wpPrivacyErase()
|
1790 |
+
* @param array $aData
|
1791 |
+
* @param string $sEmail
|
1792 |
+
* @param int $nPage
|
1793 |
+
* @return array
|
1794 |
+
*/
|
1795 |
+
public function onWpPrivacyErase( $aData, $sEmail, $nPage = 1 ) {
|
1796 |
+
return $aData;
|
1797 |
+
}
|
1798 |
+
|
1799 |
+
protected function getHelpVideoOptions() {
|
1800 |
+
$aOptions = $this->getOpt( 'help_video_options', [] );
|
1801 |
+
if ( is_null( $aOptions ) || !is_array( $aOptions ) ) {
|
1802 |
+
$aOptions = [
|
1803 |
+
'closed' => false,
|
1804 |
+
'displayed' => false,
|
1805 |
+
'played' => false,
|
1806 |
+
];
|
1807 |
+
$this->setOpt( 'help_video_options', $aOptions );
|
1808 |
+
}
|
1809 |
+
return $aOptions;
|
1810 |
+
}
|
1811 |
+
|
1812 |
+
/**
|
1813 |
+
* @return bool
|
1814 |
+
*/
|
1815 |
+
protected function getHelpVideoHasBeenClosed() {
|
1816 |
+
return (bool)$this->getHelpVideoOption( 'closed' );
|
1817 |
+
}
|
1818 |
+
|
1819 |
+
/**
|
1820 |
+
* @return bool
|
1821 |
+
*/
|
1822 |
+
protected function getHelpVideoHasBeenDisplayed() {
|
1823 |
+
return (bool)$this->getHelpVideoOption( 'displayed' );
|
1824 |
+
}
|
1825 |
+
|
1826 |
+
/**
|
1827 |
+
* @return bool
|
1828 |
+
*/
|
1829 |
+
protected function getVideoHasBeenPlayed() {
|
1830 |
+
return (bool)$this->getHelpVideoOption( 'played' );
|
1831 |
+
}
|
1832 |
+
|
1833 |
+
/**
|
1834 |
+
* @param string $sKey
|
1835 |
+
* @return mixed|null
|
1836 |
+
*/
|
1837 |
+
protected function getHelpVideoOption( $sKey ) {
|
1838 |
+
$aOpts = $this->getHelpVideoOptions();
|
1839 |
+
return isset( $aOpts[ $sKey ] ) ? $aOpts[ $sKey ] : null;
|
1840 |
+
}
|
1841 |
+
|
1842 |
+
/**
|
1843 |
+
* @return bool
|
1844 |
+
*/
|
1845 |
+
protected function getIfAutoShowHelpVideo() {
|
1846 |
+
return !$this->getHelpVideoHasBeenClosed();
|
1847 |
+
}
|
1848 |
+
|
1849 |
+
/**
|
1850 |
+
* @return string
|
1851 |
+
*/
|
1852 |
+
protected function getHelpVideoId() {
|
1853 |
+
return $this->getDef( 'help_video_id' );
|
1854 |
+
}
|
1855 |
+
|
1856 |
+
/**
|
1857 |
+
* @param string $sId
|
1858 |
+
* @return string
|
1859 |
+
*/
|
1860 |
+
protected function getHelpVideoUrl( $sId ) {
|
1861 |
+
return sprintf( 'https://player.vimeo.com/video/%s', $sId );
|
1862 |
+
}
|
1863 |
+
|
1864 |
+
/**
|
1865 |
+
* @return bool
|
1866 |
+
*/
|
1867 |
+
protected function isHelpVideoDisplayable() {
|
1868 |
+
$sId = $this->getHelpVideoId();
|
1869 |
+
return false;
|
1870 |
+
return !empty( $sId );
|
1871 |
+
}
|
1872 |
+
|
1873 |
+
/**
|
1874 |
+
* @param string $sOpt
|
1875 |
+
* @param int $nAt
|
1876 |
+
* @return $this
|
1877 |
+
*/
|
1878 |
+
protected function setOptAt( $sOpt, $nAt = null ) {
|
1879 |
+
$nAt = is_null( $nAt ) ? Services::Request()->ts() : max( 0, (int)$nAt );
|
1880 |
+
return $this->setOpt( $sOpt, $nAt );
|
1881 |
+
}
|
1882 |
+
|
1883 |
+
/**
|
1884 |
+
* @return null|Shield\Modules\Base\ShieldOptions|mixed
|
1885 |
+
*/
|
1886 |
+
public function getOptions() {
|
1887 |
+
if ( !isset( $this->oOpts ) ) {
|
1888 |
+
|
1889 |
+
if ( @class_exists( '\FernleafSystems\Wordpress\Plugin\Shield\Modules\Base\Options' ) ) {
|
1890 |
+
$oOpts = $this->loadOptions()->setMod( $this );;
|
1891 |
+
}
|
1892 |
+
else {
|
1893 |
+
$oOpts = new \ICWP_WPSF_OptionsVO();
|
1894 |
+
}
|
1895 |
+
|
1896 |
+
$oCon = $this->getCon();
|
1897 |
+
$this->oOpts = $oOpts->setPathToConfig( $oCon->getPath_ConfigFile( $this->getSlug() ) )
|
1898 |
+
->setRebuildFromFile( $oCon->getIsRebuildOptionsFromFile() )
|
1899 |
+
->setOptionsStorageKey( $this->getOptionsStorageKey() )
|
1900 |
+
->setIfLoadOptionsFromStorage( !$oCon->getIsResetPlugin() );
|
1901 |
+
}
|
1902 |
+
return $this->oOpts;
|
1903 |
+
}
|
1904 |
+
|
1905 |
+
/**
|
1906 |
+
* @return null|Shield\Databases\Base\Handler|mixed
|
1907 |
+
*/
|
1908 |
+
public function getDbHandler() {
|
1909 |
+
if ( !isset( $this->oDbh ) ) {
|
1910 |
+
$this->oDbh = $this->loadDbHandler();
|
1911 |
+
if ( $this->oDbh instanceof Shield\Databases\Base\Handler ) {
|
1912 |
+
try {
|
1913 |
+
$this->oDbh->setMod( $this )
|
1914 |
+
->tableInit();
|
1915 |
+
}
|
1916 |
+
catch ( \Exception$oE ) {
|
1917 |
+
}
|
1918 |
+
}
|
1919 |
+
}
|
1920 |
+
return $this->oDbh;
|
1921 |
+
}
|
1922 |
+
|
1923 |
+
/**
|
1924 |
+
* @return Shield\Modules\Base\AdminNotices
|
1925 |
+
*/
|
1926 |
+
private function getAdminNotices() {
|
1927 |
+
if ( !isset( $this->oAdminNotices ) ) {
|
1928 |
+
$this->oAdminNotices = $this->loadAdminNotices()->setMod( $this );
|
1929 |
+
}
|
1930 |
+
return $this->oAdminNotices;
|
1931 |
+
}
|
1932 |
+
|
1933 |
+
/**
|
1934 |
+
* @return Shield\Modules\Base\AjaxHandlerShield
|
1935 |
+
*/
|
1936 |
+
private function getAjax() {
|
1937 |
+
if ( !isset( $this->oAjax ) ) {
|
1938 |
+
$this->oAjax = $this->loadAjaxHandler()->setMod( $this );
|
1939 |
+
}
|
1940 |
+
return $this->oAjax;
|
1941 |
+
}
|
1942 |
+
|
1943 |
+
/**
|
1944 |
+
* @return null|Shield\Modules\Base\Strings
|
1945 |
+
*/
|
1946 |
+
public function getStrings() {
|
1947 |
+
if ( !isset( $this->oStrings ) ) {
|
1948 |
+
$this->oStrings = $this->loadStrings()->setMod( $this );
|
1949 |
+
}
|
1950 |
+
return $this->oStrings;
|
1951 |
+
}
|
1952 |
+
|
1953 |
+
/**
|
1954 |
+
* @return Shield\Modules\Base\AdminNotices
|
1955 |
+
*/
|
1956 |
+
protected function loadAdminNotices() {
|
1957 |
+
return new Shield\Modules\Base\AdminNotices();
|
1958 |
+
}
|
1959 |
+
|
1960 |
+
/**
|
1961 |
+
* @return Shield\Databases\Base\Handler|mixed|false
|
1962 |
+
*/
|
1963 |
+
protected function loadDbHandler() {
|
1964 |
+
return false;
|
1965 |
+
}
|
1966 |
+
|
1967 |
+
/**
|
1968 |
+
* @return AjaxHandlerShield|mixed
|
1969 |
+
*/
|
1970 |
+
protected function loadAjaxHandler() {
|
1971 |
+
return new Shield\Modules\Base\AjaxHandlerShield;
|
1972 |
+
}
|
1973 |
+
|
1974 |
+
/**
|
1975 |
+
* @return Shield\Modules\Base\ShieldOptions|mixed
|
1976 |
+
*/
|
1977 |
+
protected function loadOptions() {
|
1978 |
+
return new Shield\Modules\Base\ShieldOptions;
|
1979 |
+
}
|
1980 |
+
|
1981 |
+
/**
|
1982 |
+
* @return Shield\Modules\Base\Strings|mixed
|
1983 |
+
*/
|
1984 |
+
protected function loadStrings() {
|
1985 |
+
return new Shield\Modules\Base\Strings();
|
1986 |
+
}
|
1987 |
+
|
1988 |
+
/**
|
1989 |
+
* @return array
|
1990 |
+
* @deprecated 7.5
|
1991 |
+
*/
|
1992 |
+
protected function getDisplayStrings() {
|
1993 |
+
return $this->getStrings()->getDisplayStrings();
|
1994 |
+
}
|
1995 |
+
|
1996 |
+
/**
|
1997 |
+
* @param bool $bBypass
|
1998 |
+
* @return $this
|
1999 |
+
* @deprecated 7.5
|
2000 |
+
*/
|
2001 |
+
protected function setBypassAdminProtection( $bBypass ) {
|
2002 |
+
return $this;
|
2003 |
+
}
|
2004 |
+
|
2005 |
+
/**
|
2006 |
+
* @deprecated 7.5
|
2007 |
+
*/
|
2008 |
+
public function action_doFeatureShutdown() {
|
2009 |
+
$this->onPluginShutdown();
|
2010 |
+
}
|
2011 |
+
|
2012 |
+
/**
|
2013 |
+
* Prefixes an option key only if it's needed
|
2014 |
+
* @param $sKey
|
2015 |
+
* @return string
|
2016 |
+
* @deprecated
|
2017 |
+
*/
|
2018 |
+
public function prefixOptionKey( $sKey = '' ) {
|
2019 |
+
return $this->prefix( $sKey, '_' );
|
2020 |
+
}
|
2021 |
+
|
2022 |
+
/**
|
2023 |
+
* @return bool
|
2024 |
+
* @deprecated 8
|
2025 |
+
*/
|
2026 |
+
protected function isAutoEnabled() {
|
2027 |
+
return ( $this->getOptionsVo()->getFeatureProperty( 'auto_enabled' ) === true );
|
2028 |
+
}
|
2029 |
+
}
|
src/lib/src/Modules/Base/BaseProcessor.php
ADDED
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Base;
|
4 |
+
|
5 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Deprecated;
|
6 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules;
|
7 |
+
use FernleafSystems\Wordpress\Services\Services;
|
8 |
+
|
9 |
+
class BaseProcessor extends Deprecated\Foundation {
|
10 |
+
|
11 |
+
use Modules\ModConsumer;
|
12 |
+
|
13 |
+
/**
|
14 |
+
* @var BaseProcessor[]
|
15 |
+
*/
|
16 |
+
protected $aSubPros;
|
17 |
+
|
18 |
+
/**
|
19 |
+
* @var bool
|
20 |
+
*/
|
21 |
+
private $bLoginCaptured;
|
22 |
+
|
23 |
+
/**
|
24 |
+
* @param BaseModCon $oMod
|
25 |
+
*/
|
26 |
+
public function __construct( $oMod ) {
|
27 |
+
$this->setMod( $oMod );
|
28 |
+
|
29 |
+
add_action( 'init', [ $this, 'onWpInit' ], 9 );
|
30 |
+
add_action( 'wp_loaded', [ $this, 'onWpLoaded' ] );
|
31 |
+
{ // Capture Logins
|
32 |
+
add_action( 'wp_login', [ $this, 'onWpLogin' ], 10, 2 );
|
33 |
+
if ( !Services::WpUsers()->isProfilePage() ) { // This can be fired during profile update.
|
34 |
+
add_action( 'set_logged_in_cookie', [ $this, 'onWpSetLoggedInCookie' ], 5, 4 );
|
35 |
+
}
|
36 |
+
}
|
37 |
+
add_action( $oMod->prefix( 'plugin_shutdown' ), [ $this, 'onModuleShutdown' ] );
|
38 |
+
add_action( $oMod->prefix( 'daily_cron' ), [ $this, 'runDailyCron' ] );
|
39 |
+
add_action( $oMod->prefix( 'hourly_cron' ), [ $this, 'runHourlyCron' ] );
|
40 |
+
add_action( $oMod->prefix( 'deactivate_plugin' ), [ $this, 'deactivatePlugin' ] );
|
41 |
+
add_action( $oMod->prefix( 'generate_admin_notices' ), [ $this, 'autoAddToAdminNotices' ] );
|
42 |
+
|
43 |
+
/**
|
44 |
+
* 2019-04-19:
|
45 |
+
* wp_service_worker: added to prevent infinite page reloads triggered by an error with the PWA plugin.
|
46 |
+
* It seems that using wp_localize_script() on a request with wp_service_worker=1 causes the worker
|
47 |
+
* reload the page. Why exactly this happens hasn't been investigated, so we just skip any FRONTend
|
48 |
+
* enqueues that might call wp_localize_script() for these requests.
|
49 |
+
*/
|
50 |
+
if ( Services::Request()->query( 'wp_service_worker', 0 ) != 1 ) {
|
51 |
+
add_action( 'wp_enqueue_scripts', [ $this, 'onWpEnqueueJs' ] );
|
52 |
+
}
|
53 |
+
|
54 |
+
$this->init();
|
55 |
+
}
|
56 |
+
|
57 |
+
public function onWpInit() {
|
58 |
+
}
|
59 |
+
|
60 |
+
public function onWpLoaded() {
|
61 |
+
}
|
62 |
+
|
63 |
+
public function onWpEnqueueJs() {
|
64 |
+
}
|
65 |
+
|
66 |
+
/**
|
67 |
+
* @param string $sUsername
|
68 |
+
* @param \WP_User $oUser
|
69 |
+
*/
|
70 |
+
public function onWpLogin( $sUsername, $oUser ) {
|
71 |
+
/*
|
72 |
+
if ( !$oUser instanceof WP_User ) {
|
73 |
+
$oUser = $this->loadWpUsers()->getUserByUsername( $sUsername );
|
74 |
+
}
|
75 |
+
*/
|
76 |
+
}
|
77 |
+
|
78 |
+
/**
|
79 |
+
* @param string $sCookie
|
80 |
+
* @param int $nExpire
|
81 |
+
* @param int $nExpiration
|
82 |
+
* @param int $nUserId
|
83 |
+
*/
|
84 |
+
public function onWpSetLoggedInCookie( $sCookie, $nExpire, $nExpiration, $nUserId ) {
|
85 |
+
}
|
86 |
+
|
87 |
+
/**
|
88 |
+
* @return bool
|
89 |
+
*/
|
90 |
+
protected function isLoginCaptured() {
|
91 |
+
return (bool)$this->bLoginCaptured;
|
92 |
+
}
|
93 |
+
|
94 |
+
public function runDailyCron() {
|
95 |
+
}
|
96 |
+
|
97 |
+
public function runHourlyCron() {
|
98 |
+
}
|
99 |
+
|
100 |
+
/**
|
101 |
+
* @return $this
|
102 |
+
*/
|
103 |
+
protected function setLoginCaptured() {
|
104 |
+
$this->bLoginCaptured = true;
|
105 |
+
return $this;
|
106 |
+
}
|
107 |
+
|
108 |
+
/**
|
109 |
+
* @return int
|
110 |
+
*/
|
111 |
+
protected function getPromoNoticesCount() {
|
112 |
+
return self::$nPromoNoticesCount;
|
113 |
+
}
|
114 |
+
|
115 |
+
/**
|
116 |
+
* @return $this
|
117 |
+
*/
|
118 |
+
protected function incrementPromoNoticesCount() {
|
119 |
+
self::$nPromoNoticesCount++;
|
120 |
+
return $this;
|
121 |
+
}
|
122 |
+
|
123 |
+
/**
|
124 |
+
* @param array $aAttrs
|
125 |
+
* @return bool
|
126 |
+
*/
|
127 |
+
protected function getIfDisplayAdminNotice( $aAttrs ) {
|
128 |
+
$bDisplay = true;
|
129 |
+
$oCon = $this->getCon();
|
130 |
+
$oWpNotices = $this->loadWpNotices();
|
131 |
+
|
132 |
+
if ( $aAttrs[ 'valid_admin' ] && !( $oCon->isValidAdminArea() && $oCon->isPluginAdmin() ) ) {
|
133 |
+
$bDisplay = false;
|
134 |
+
}
|
135 |
+
else if ( $aAttrs[ 'plugin_page_only' ] && !$this->getCon()->isModulePage() ) {
|
136 |
+
$bDisplay = false;
|
137 |
+
}
|
138 |
+
else if ( $aAttrs[ 'schedule' ] == 'once'
|
139 |
+
&& ( !Services::WpUsers()->canSaveMeta() || $oWpNotices->isDismissed( $aAttrs[ 'id' ] ) ) ) {
|
140 |
+
$bDisplay = false;
|
141 |
+
}
|
142 |
+
else if ( $aAttrs[ 'type' ] == 'promo' && Services::WpGeneral()->isMobile() ) {
|
143 |
+
$bDisplay = false;
|
144 |
+
}
|
145 |
+
|
146 |
+
return $bDisplay;
|
147 |
+
}
|
148 |
+
|
149 |
+
public function onModuleShutdown() {
|
150 |
+
}
|
151 |
+
|
152 |
+
/**
|
153 |
+
*/
|
154 |
+
public function init() {
|
155 |
+
}
|
156 |
+
|
157 |
+
/**
|
158 |
+
* @return bool
|
159 |
+
*/
|
160 |
+
public function isReadyToRun() {
|
161 |
+
return true;
|
162 |
+
}
|
163 |
+
|
164 |
+
/**
|
165 |
+
* Override to set what this processor does when it's "run"
|
166 |
+
*/
|
167 |
+
public function run() {
|
168 |
+
}
|
169 |
+
|
170 |
+
/**
|
171 |
+
* @param array $aNoticeData
|
172 |
+
* @throws \Exception
|
173 |
+
*/
|
174 |
+
protected function insertAdminNotice( $aNoticeData ) {
|
175 |
+
$aAttrs = $aNoticeData[ 'notice_attributes' ];
|
176 |
+
$bIsPromo = isset( $aAttrs[ 'type' ] ) && $aAttrs[ 'type' ] == 'promo';
|
177 |
+
if ( $bIsPromo && $this->getPromoNoticesCount() > 0 ) {
|
178 |
+
return;
|
179 |
+
}
|
180 |
+
|
181 |
+
$bCantDismiss = isset( $aNoticeData[ 'notice_attributes' ][ 'can_dismiss' ] )
|
182 |
+
&& !$aNoticeData[ 'notice_attributes' ][ 'can_dismiss' ];
|
183 |
+
|
184 |
+
$oNotices = $this->loadWpNotices();
|
185 |
+
if ( $bCantDismiss || !$oNotices->isDismissed( $aAttrs[ 'id' ] ) ) {
|
186 |
+
|
187 |
+
$sRenderedNotice = $this->getMod()->renderAdminNotice( $aNoticeData );
|
188 |
+
if ( !empty( $sRenderedNotice ) ) {
|
189 |
+
$oNotices->addAdminNotice(
|
190 |
+
$sRenderedNotice,
|
191 |
+
$aNoticeData[ 'notice_attributes' ][ 'notice_id' ]
|
192 |
+
);
|
193 |
+
if ( $bIsPromo ) {
|
194 |
+
$this->incrementPromoNoticesCount();
|
195 |
+
}
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
|
200 |
+
/**
|
201 |
+
* @param $sOptionKey
|
202 |
+
* @param mixed $mDefault
|
203 |
+
* @return mixed
|
204 |
+
*/
|
205 |
+
public function getOption( $sOptionKey, $mDefault = false ) {
|
206 |
+
return $this->getMod()->getOpt( $sOptionKey, $mDefault );
|
207 |
+
}
|
208 |
+
|
209 |
+
/**
|
210 |
+
* We don't handle locale derivatives (yet)
|
211 |
+
* @return string
|
212 |
+
*/
|
213 |
+
protected function getGoogleRecaptchaLocale() {
|
214 |
+
return Services::WpGeneral()->getLocale( '-' );
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* @return \ICWP_WPSF_Processor_Email
|
219 |
+
*/
|
220 |
+
public function getEmailProcessor() {
|
221 |
+
return $this->getMod()->getEmailProcessor();
|
222 |
+
}
|
223 |
+
|
224 |
+
/**
|
225 |
+
* @param string $sKey
|
226 |
+
* @return BaseProcessor|mixed|null
|
227 |
+
*/
|
228 |
+
protected function getSubPro( $sKey ) {
|
229 |
+
$aProcessors = $this->getSubProcessors();
|
230 |
+
if ( !isset( $aProcessors[ $sKey ] ) ) {
|
231 |
+
$aMap = $this->getSubProMap();
|
232 |
+
if ( !isset( $aMap[ $sKey ] ) ) {
|
233 |
+
error_log( 'Sub processor key not set: '.$sKey );
|
234 |
+
}
|
235 |
+
$aProcessors[ $sKey ] = new $aMap[ $sKey ]( $this->getMod() );
|
236 |
+
}
|
237 |
+
return $aProcessors[ $sKey ];
|
238 |
+
}
|
239 |
+
|
240 |
+
/**
|
241 |
+
* @return array
|
242 |
+
*/
|
243 |
+
protected function getSubProMap() {
|
244 |
+
return [];
|
245 |
+
}
|
246 |
+
|
247 |
+
/**
|
248 |
+
*/
|
249 |
+
public function deactivatePlugin() {
|
250 |
+
}
|
251 |
+
|
252 |
+
/**
|
253 |
+
* @return BaseProcessor[]
|
254 |
+
*/
|
255 |
+
protected function getSubProcessors() {
|
256 |
+
if ( !isset( $this->aSubPros ) ) {
|
257 |
+
$this->aSubPros = [];
|
258 |
+
}
|
259 |
+
return $this->aSubPros;
|
260 |
+
}
|
261 |
+
|
262 |
+
/**
|
263 |
+
* Will prefix and return any string with the unique plugin prefix.
|
264 |
+
* @param string $sSuffix
|
265 |
+
* @param string $sGlue
|
266 |
+
* @return string
|
267 |
+
* @deprecated
|
268 |
+
*/
|
269 |
+
protected function prefix( $sSuffix = '', $sGlue = '-' ) {
|
270 |
+
return $this->getMod()->prefix( $sSuffix, $sGlue );
|
271 |
+
}
|
272 |
+
|
273 |
+
/**
|
274 |
+
* @return string
|
275 |
+
* @deprecated
|
276 |
+
*/
|
277 |
+
protected function ip() {
|
278 |
+
return Services::IP()->getRequestIp();
|
279 |
+
}
|
280 |
+
|
281 |
+
/**
|
282 |
+
* @return int
|
283 |
+
* @deprecated 8
|
284 |
+
*/
|
285 |
+
protected function time() {
|
286 |
+
return Services::Request()->ts();
|
287 |
+
}
|
288 |
+
|
289 |
+
/**
|
290 |
+
* @deprecated
|
291 |
+
*/
|
292 |
+
public function autoAddToAdminNotices() {
|
293 |
+
}
|
294 |
+
}
|
src/lib/src/Modules/BaseShield/ShieldModCon.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\BaseShield;
|
4 |
+
|
5 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Base;
|
6 |
+
|
7 |
+
class ShieldModCon extends Base\BaseModCon {
|
8 |
+
|
9 |
+
}
|
src/lib/src/Modules/BaseShield/ShieldProcessor.php
ADDED
@@ -0,0 +1,9 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\BaseShield;
|
4 |
+
|
5 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Base;
|
6 |
+
|
7 |
+
class ShieldProcessor extends Base\BaseProcessor {
|
8 |
+
|
9 |
+
}
|
src/lib/src/Modules/CommentsFilter/Scan/Scanner.php
CHANGED
@@ -94,11 +94,17 @@ class Scanner {
|
|
94 |
);
|
95 |
|
96 |
if ( $mResult->get_error_code() == 'human' ) {
|
97 |
-
$
|
98 |
}
|
99 |
else {
|
100 |
-
$
|
101 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
$this->sCommentExplanation = $mResult->get_error_message();
|
103 |
}
|
104 |
}
|
94 |
);
|
95 |
|
96 |
if ( $mResult->get_error_code() == 'human' ) {
|
97 |
+
$sStatus = $oMod->getOpt( 'comments_default_action_human_spam' );
|
98 |
}
|
99 |
else {
|
100 |
+
$sStatus = $oMod->getOpt( 'comments_default_action_spam_bot' );
|
101 |
}
|
102 |
+
|
103 |
+
if ( $sStatus == 'reject' ) {
|
104 |
+
Services::Response()->redirectToHome();
|
105 |
+
}
|
106 |
+
|
107 |
+
$this->mCommentStatus = $sStatus;
|
108 |
$this->sCommentExplanation = $mResult->get_error_message();
|
109 |
}
|
110 |
}
|
src/lib/src/Modules/ModConsumer.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules;
|
4 |
|
5 |
use FernleafSystems\Wordpress\Plugin\Shield\Controller\Controller;
|
|
|
6 |
|
7 |
/**
|
8 |
* Trait ModConsumer
|
@@ -23,7 +24,7 @@ trait ModConsumer {
|
|
23 |
}
|
24 |
|
25 |
/**
|
26 |
-
* @return \ICWP_WPSF_FeatureHandler_Base
|
27 |
*/
|
28 |
public function getMod() {
|
29 |
return $this->oMod;
|
@@ -39,7 +40,7 @@ trait ModConsumer {
|
|
39 |
}
|
40 |
|
41 |
/**
|
42 |
-
* @param \ICWP_WPSF_FeatureHandler_Base $oMod
|
43 |
* @return $this
|
44 |
*/
|
45 |
public function setMod( $oMod ) {
|
3 |
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules;
|
4 |
|
5 |
use FernleafSystems\Wordpress\Plugin\Shield\Controller\Controller;
|
6 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules;
|
7 |
|
8 |
/**
|
9 |
* Trait ModConsumer
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
+
* @return \ICWP_WPSF_FeatureHandler_Base|Modules\Base\BaseModCon
|
28 |
*/
|
29 |
public function getMod() {
|
30 |
return $this->oMod;
|
40 |
}
|
41 |
|
42 |
/**
|
43 |
+
* @param \ICWP_WPSF_FeatureHandler_Base|Modules\Base\BaseModCon $oMod
|
44 |
* @return $this
|
45 |
*/
|
46 |
public function setMod( $oMod ) {
|
src/lib/src/Modules/Plugin/Components/BadgeWidget.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Plugin\Components;
|
4 |
+
|
5 |
+
class BadgeWidget extends \ICWP_WPSF_WpWidget {
|
6 |
+
|
7 |
+
use \FernleafSystems\Wordpress\Plugin\Shield\Modules\ModConsumer;
|
8 |
+
|
9 |
+
/**
|
10 |
+
* ICWP_WPSF_Processor_Plugin_BadgeWidget constructor.
|
11 |
+
* @param \ICWP_WPSF_FeatureHandler_Base $oMod
|
12 |
+
*/
|
13 |
+
public function __construct( $oMod ) {
|
14 |
+
if ( empty( $oMod ) ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
$this->setMod( $oMod );
|
18 |
+
$oCon = $this->getCon();
|
19 |
+
|
20 |
+
$sName = $oCon->getHumanName();
|
21 |
+
parent::__construct(
|
22 |
+
$oCon->prefixOption( 'plugin_badge' ),
|
23 |
+
sprintf( __( '%s Plugin Badge', 'wp-simple-firewall' ), $sName ),
|
24 |
+
[
|
25 |
+
'description' => sprintf( __( 'You can now help spread the word about the %s plugin anywhere on your site', 'wp-simple-firewall' ), $sName ),
|
26 |
+
]
|
27 |
+
);
|
28 |
+
|
29 |
+
add_shortcode( 'SHIELD_BADGE', [ $this, 'renderBadge' ] );
|
30 |
+
}
|
31 |
+
|
32 |
+
/**
|
33 |
+
* @param array $aNewInstance
|
34 |
+
* @param array $aOldInstance
|
35 |
+
* @return array
|
36 |
+
*/
|
37 |
+
public function update( $aNewInstance, $aOldInstance ) {
|
38 |
+
return parent::update( $aNewInstance, $aOldInstance );
|
39 |
+
// $aInstance = array(
|
40 |
+
// 'title' => empty( $aNewInstance['title'] ) ? '' : strip_tags( $aNewInstance['title'] )
|
41 |
+
// );
|
42 |
+
// return $aInstance;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @param array $aWidgetArguments
|
47 |
+
* @param array $aWidgetInstance
|
48 |
+
* @throws \Exception
|
49 |
+
*/
|
50 |
+
public function widget( $aWidgetArguments, $aWidgetInstance ) {
|
51 |
+
echo $this->standardRender( $aWidgetArguments, __( 'Site Secured', 'wp-simple-firewall' ), $this->renderBadge() );
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @return string
|
56 |
+
* @throws \Exception
|
57 |
+
*/
|
58 |
+
public function renderBadge() {
|
59 |
+
return ( new PluginBadge() )
|
60 |
+
->setMod( $this->getMod() )
|
61 |
+
->render();
|
62 |
+
}
|
63 |
+
}
|
src/lib/src/Modules/Plugin/Components/PluginBadge.php
ADDED
@@ -0,0 +1,92 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Plugin\Components;
|
4 |
+
|
5 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules\ModConsumer;
|
6 |
+
use FernleafSystems\Wordpress\Services\Services;
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Class PluginBadge
|
10 |
+
* @package FernleafSystems\Wordpress\Plugin\Shield\Modules\Plugin\Components
|
11 |
+
*/
|
12 |
+
class PluginBadge {
|
13 |
+
|
14 |
+
use ModConsumer;
|
15 |
+
|
16 |
+
public function run() {
|
17 |
+
/** @var \ICWP_WPSF_FeatureHandler_Plugin $oMod */
|
18 |
+
$oMod = $this->getMod();
|
19 |
+
if ( $oMod->isDisplayPluginBadge() ) {
|
20 |
+
add_action( 'wp_enqueue_scripts', [ $this, 'includeJquery' ] );
|
21 |
+
add_action( 'login_enqueue_scripts', [ $this, 'includeJquery' ] );
|
22 |
+
add_action( 'wp_footer', [ $this, 'printPluginBadge' ], 100 );
|
23 |
+
add_action( 'login_footer', [ $this, 'printPluginBadge' ], 100 );
|
24 |
+
}
|
25 |
+
|
26 |
+
add_action( 'widgets_init', [ $this, 'addPluginBadgeWidget' ] );
|
27 |
+
|
28 |
+
add_shortcode( 'SHIELD_BADGE', function () {
|
29 |
+
$this->render( false );
|
30 |
+
} );
|
31 |
+
}
|
32 |
+
|
33 |
+
/**
|
34 |
+
* https://wordpress.org/support/topic/fatal-errors-after-update-to-7-0-2/#post-11169820
|
35 |
+
*/
|
36 |
+
public function addPluginBadgeWidget() {
|
37 |
+
/** @var \ICWP_WPSF_FeatureHandler_Plugin $oMod */
|
38 |
+
$oMod = $this->getMod();
|
39 |
+
if ( !empty( $oMod ) && Services::WpGeneral()->getWordpressIsAtLeastVersion( '4.6.0' )
|
40 |
+
&& !class_exists( 'Tribe_WP_Widget_Factory' ) ) {
|
41 |
+
register_widget( new BadgeWidget( $oMod ) );
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
public function includeJquery() {
|
46 |
+
wp_enqueue_script( 'jquery', null, [], false, true );
|
47 |
+
}
|
48 |
+
|
49 |
+
public function printPluginBadge() {
|
50 |
+
echo $this->render( true );
|
51 |
+
}
|
52 |
+
|
53 |
+
/**
|
54 |
+
* @param bool $bFloating
|
55 |
+
* @return string
|
56 |
+
*/
|
57 |
+
public function render( $bFloating = false ) {
|
58 |
+
$oMod = $this->getMod();
|
59 |
+
$oCon = $this->getCon();
|
60 |
+
|
61 |
+
$sName = $oCon->getHumanName();
|
62 |
+
$aData = [
|
63 |
+
'ajax' => [
|
64 |
+
'plugin_badge_close' => $oMod->getAjaxActionData( 'plugin_badge_close', true ),
|
65 |
+
],
|
66 |
+
'flags' => [
|
67 |
+
'nofollow' => apply_filters( 'icwp_shield_badge_relnofollow', false ),
|
68 |
+
'is_floating' => $bFloating
|
69 |
+
],
|
70 |
+
'hrefs' => [
|
71 |
+
'badge' => 'https://icwp.io/wpsecurityfirewall',
|
72 |
+
'logo' => $oCon->getPluginUrl_Image( 'shield/shield-security-logo-colour-32px.png' ),
|
73 |
+
],
|
74 |
+
'strings' => [
|
75 |
+
'protected' => apply_filters( 'icwp_shield_plugin_badge_text',
|
76 |
+
sprintf( __( 'This Site Is Protected By %s', 'wp-simple-firewall' ),
|
77 |
+
'<br/><span class="plugin-badge-name">'.$sName.'</span>' )
|
78 |
+
),
|
79 |
+
'name' => $sName,
|
80 |
+
],
|
81 |
+
];
|
82 |
+
|
83 |
+
try {
|
84 |
+
$sRender = $oMod->renderTemplate( 'snippets/plugin_badge_widget', $aData, true );
|
85 |
+
}
|
86 |
+
catch ( \Exception $oE ) {
|
87 |
+
$sRender = 'Could not generate badge: '.$oE->getMessage();
|
88 |
+
}
|
89 |
+
|
90 |
+
return $sRender;
|
91 |
+
}
|
92 |
+
}
|
src/lib/src/Modules/Plugin/Options.php
CHANGED
@@ -3,6 +3,7 @@
|
|
3 |
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Plugin;
|
4 |
|
5 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Base;
|
|
|
6 |
|
7 |
class Options extends Base\ShieldOptions {
|
8 |
|
@@ -49,4 +50,11 @@ class Options extends Base\ShieldOptions {
|
|
49 |
}
|
50 |
return $aConfig;
|
51 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
}
|
3 |
namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\Plugin;
|
4 |
|
5 |
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Base;
|
6 |
+
use FernleafSystems\Wordpress\Services\Services;
|
7 |
|
8 |
class Options extends Base\ShieldOptions {
|
9 |
|
50 |
}
|
51 |
return $aConfig;
|
52 |
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* @return bool
|
56 |
+
*/
|
57 |
+
public function isOnFloatingPluginBadge() {
|
58 |
+
return $this->isOpt( 'display_plugin_badge', 'Y' );
|
59 |
+
}
|
60 |
}
|
src/lib/vendor/composer/autoload_classmap.php
CHANGED
@@ -141,9 +141,13 @@ return array(
|
|
141 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\AjaxHandler' => $baseDir . '/src/Modules/Autoupdates/AjaxHandler.php',
|
142 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\Options' => $baseDir . '/src/Modules/Autoupdates/Options.php',
|
143 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\Strings' => $baseDir . '/src/Modules/Autoupdates/Strings.php',
|
|
|
|
|
144 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AdminNotices' => $baseDir . '/src/Modules/Base/AdminNotices.php',
|
145 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AjaxHandlerBase' => $baseDir . '/src/Modules/Base/AjaxHandlerBase.php',
|
146 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AjaxHandlerShield' => $baseDir . '/src/Modules/Base/AjaxHandlerShield.php',
|
|
|
|
|
147 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Options' => $baseDir . '/src/Modules/Base/Options.php',
|
148 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\ShieldOptions' => $baseDir . '/src/Modules/Base/ShieldOptions.php',
|
149 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Strings' => $baseDir . '/src/Modules/Base/Strings.php',
|
@@ -196,6 +200,8 @@ return array(
|
|
196 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\PluginControllerConsumer' => $baseDir . '/src/Modules/PluginControllerConsumer.php',
|
197 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\AdminNotices' => $baseDir . '/src/Modules/Plugin/AdminNotices.php',
|
198 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\AjaxHandler' => $baseDir . '/src/Modules/Plugin/AjaxHandler.php',
|
|
|
|
|
199 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Options' => $baseDir . '/src/Modules/Plugin/Options.php',
|
200 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Strings' => $baseDir . '/src/Modules/Plugin/Strings.php',
|
201 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\SecurityAdmin\\AdminNotices' => $baseDir . '/src/Modules/SecurityAdmin/AdminNotices.php',
|
141 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\AjaxHandler' => $baseDir . '/src/Modules/Autoupdates/AjaxHandler.php',
|
142 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\Options' => $baseDir . '/src/Modules/Autoupdates/Options.php',
|
143 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\Strings' => $baseDir . '/src/Modules/Autoupdates/Strings.php',
|
144 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\BaseShield\\ShieldModCon' => $baseDir . '/src/Modules/BaseShield/ShieldModCon.php',
|
145 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\BaseShield\\ShieldProcessor' => $baseDir . '/src/Modules/BaseShield/ShieldProcessor.php',
|
146 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AdminNotices' => $baseDir . '/src/Modules/Base/AdminNotices.php',
|
147 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AjaxHandlerBase' => $baseDir . '/src/Modules/Base/AjaxHandlerBase.php',
|
148 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AjaxHandlerShield' => $baseDir . '/src/Modules/Base/AjaxHandlerShield.php',
|
149 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseModCon' => $baseDir . '/src/Modules/Base/BaseModCon.php',
|
150 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseProcessor' => $baseDir . '/src/Modules/Base/BaseProcessor.php',
|
151 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Options' => $baseDir . '/src/Modules/Base/Options.php',
|
152 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\ShieldOptions' => $baseDir . '/src/Modules/Base/ShieldOptions.php',
|
153 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Strings' => $baseDir . '/src/Modules/Base/Strings.php',
|
200 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\PluginControllerConsumer' => $baseDir . '/src/Modules/PluginControllerConsumer.php',
|
201 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\AdminNotices' => $baseDir . '/src/Modules/Plugin/AdminNotices.php',
|
202 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\AjaxHandler' => $baseDir . '/src/Modules/Plugin/AjaxHandler.php',
|
203 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Components\\BadgeWidget' => $baseDir . '/src/Modules/Plugin/Components/BadgeWidget.php',
|
204 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Components\\PluginBadge' => $baseDir . '/src/Modules/Plugin/Components/PluginBadge.php',
|
205 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Options' => $baseDir . '/src/Modules/Plugin/Options.php',
|
206 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Strings' => $baseDir . '/src/Modules/Plugin/Strings.php',
|
207 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\SecurityAdmin\\AdminNotices' => $baseDir . '/src/Modules/SecurityAdmin/AdminNotices.php',
|
src/lib/vendor/composer/autoload_static.php
CHANGED
@@ -290,9 +290,13 @@ class ComposerStaticInit18a31866e67f0a0bfffdc031786ecae1
|
|
290 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\AjaxHandler' => __DIR__ . '/../..' . '/src/Modules/Autoupdates/AjaxHandler.php',
|
291 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\Options' => __DIR__ . '/../..' . '/src/Modules/Autoupdates/Options.php',
|
292 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\Strings' => __DIR__ . '/../..' . '/src/Modules/Autoupdates/Strings.php',
|
|
|
|
|
293 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AdminNotices' => __DIR__ . '/../..' . '/src/Modules/Base/AdminNotices.php',
|
294 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AjaxHandlerBase' => __DIR__ . '/../..' . '/src/Modules/Base/AjaxHandlerBase.php',
|
295 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AjaxHandlerShield' => __DIR__ . '/../..' . '/src/Modules/Base/AjaxHandlerShield.php',
|
|
|
|
|
296 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Options' => __DIR__ . '/../..' . '/src/Modules/Base/Options.php',
|
297 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\ShieldOptions' => __DIR__ . '/../..' . '/src/Modules/Base/ShieldOptions.php',
|
298 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Strings' => __DIR__ . '/../..' . '/src/Modules/Base/Strings.php',
|
@@ -345,6 +349,8 @@ class ComposerStaticInit18a31866e67f0a0bfffdc031786ecae1
|
|
345 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\PluginControllerConsumer' => __DIR__ . '/../..' . '/src/Modules/PluginControllerConsumer.php',
|
346 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\AdminNotices' => __DIR__ . '/../..' . '/src/Modules/Plugin/AdminNotices.php',
|
347 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\AjaxHandler' => __DIR__ . '/../..' . '/src/Modules/Plugin/AjaxHandler.php',
|
|
|
|
|
348 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Options' => __DIR__ . '/../..' . '/src/Modules/Plugin/Options.php',
|
349 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Strings' => __DIR__ . '/../..' . '/src/Modules/Plugin/Strings.php',
|
350 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\SecurityAdmin\\AdminNotices' => __DIR__ . '/../..' . '/src/Modules/SecurityAdmin/AdminNotices.php',
|
290 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\AjaxHandler' => __DIR__ . '/../..' . '/src/Modules/Autoupdates/AjaxHandler.php',
|
291 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\Options' => __DIR__ . '/../..' . '/src/Modules/Autoupdates/Options.php',
|
292 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Autoupdates\\Strings' => __DIR__ . '/../..' . '/src/Modules/Autoupdates/Strings.php',
|
293 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\BaseShield\\ShieldModCon' => __DIR__ . '/../..' . '/src/Modules/BaseShield/ShieldModCon.php',
|
294 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\BaseShield\\ShieldProcessor' => __DIR__ . '/../..' . '/src/Modules/BaseShield/ShieldProcessor.php',
|
295 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AdminNotices' => __DIR__ . '/../..' . '/src/Modules/Base/AdminNotices.php',
|
296 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AjaxHandlerBase' => __DIR__ . '/../..' . '/src/Modules/Base/AjaxHandlerBase.php',
|
297 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\AjaxHandlerShield' => __DIR__ . '/../..' . '/src/Modules/Base/AjaxHandlerShield.php',
|
298 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseModCon' => __DIR__ . '/../..' . '/src/Modules/Base/BaseModCon.php',
|
299 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\BaseProcessor' => __DIR__ . '/../..' . '/src/Modules/Base/BaseProcessor.php',
|
300 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Options' => __DIR__ . '/../..' . '/src/Modules/Base/Options.php',
|
301 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\ShieldOptions' => __DIR__ . '/../..' . '/src/Modules/Base/ShieldOptions.php',
|
302 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Base\\Strings' => __DIR__ . '/../..' . '/src/Modules/Base/Strings.php',
|
349 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\PluginControllerConsumer' => __DIR__ . '/../..' . '/src/Modules/PluginControllerConsumer.php',
|
350 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\AdminNotices' => __DIR__ . '/../..' . '/src/Modules/Plugin/AdminNotices.php',
|
351 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\AjaxHandler' => __DIR__ . '/../..' . '/src/Modules/Plugin/AjaxHandler.php',
|
352 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Components\\BadgeWidget' => __DIR__ . '/../..' . '/src/Modules/Plugin/Components/BadgeWidget.php',
|
353 |
+
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Components\\PluginBadge' => __DIR__ . '/../..' . '/src/Modules/Plugin/Components/PluginBadge.php',
|
354 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Options' => __DIR__ . '/../..' . '/src/Modules/Plugin/Options.php',
|
355 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\Plugin\\Strings' => __DIR__ . '/../..' . '/src/Modules/Plugin/Strings.php',
|
356 |
'FernleafSystems\\Wordpress\\Plugin\\Shield\\Modules\\SecurityAdmin\\AdminNotices' => __DIR__ . '/../..' . '/src/Modules/SecurityAdmin/AdminNotices.php',
|
src/processors/plugin.php
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
<?php
|
2 |
|
|
|
3 |
use FernleafSystems\Wordpress\Services\Services;
|
4 |
|
5 |
class ICWP_WPSF_Processor_Plugin extends ICWP_WPSF_Processor_BasePlugin {
|
@@ -8,22 +9,23 @@ class ICWP_WPSF_Processor_Plugin extends ICWP_WPSF_Processor_BasePlugin {
|
|
8 |
*/
|
9 |
public function run() {
|
10 |
parent::run();
|
11 |
-
/** @var ICWP_WPSF_FeatureHandler_Plugin $
|
12 |
-
$
|
13 |
-
|
14 |
-
|
15 |
-
$this->getSubProCronHourly()
|
16 |
-
->run();
|
17 |
|
18 |
$this->removePluginConflicts();
|
19 |
-
$this->getSubProBadge()
|
20 |
-
->run();
|
21 |
|
22 |
-
|
|
|
|
|
|
|
|
|
23 |
$this->getSubProTracking()->run();
|
24 |
}
|
25 |
|
26 |
-
if ( $
|
27 |
$this->getSubProImportExport()->run();
|
28 |
}
|
29 |
|
@@ -36,7 +38,7 @@ class ICWP_WPSF_Processor_Plugin extends ICWP_WPSF_Processor_BasePlugin {
|
|
36 |
case 'importexport_import':
|
37 |
case 'importexport_handshake':
|
38 |
case 'importexport_updatenotified':
|
39 |
-
if ( $
|
40 |
add_action( 'init', [ $this->getSubProImportExport(), 'runAction' ] );
|
41 |
}
|
42 |
break;
|
@@ -48,41 +50,64 @@ class ICWP_WPSF_Processor_Plugin extends ICWP_WPSF_Processor_BasePlugin {
|
|
48 |
}
|
49 |
|
50 |
public function onWpLoaded() {
|
51 |
-
|
|
|
52 |
$this->maintainPluginLoadPosition();
|
53 |
}
|
|
|
54 |
}
|
55 |
|
56 |
/**
|
57 |
-
* @
|
|
|
58 |
*/
|
59 |
-
|
60 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
61 |
}
|
62 |
|
63 |
/**
|
64 |
-
* @return ICWP_WPSF_Processor_Plugin_CronDaily
|
65 |
*/
|
66 |
protected function getSubProCronDaily() {
|
67 |
return $this->getSubPro( 'crondaily' );
|
68 |
}
|
69 |
|
70 |
/**
|
71 |
-
* @return ICWP_WPSF_Processor_Plugin_CronHourly
|
72 |
*/
|
73 |
protected function getSubProCronHourly() {
|
74 |
return $this->getSubPro( 'cronhourly' );
|
75 |
}
|
76 |
|
77 |
/**
|
78 |
-
* @return ICWP_WPSF_Processor_Plugin_Tracking
|
79 |
*/
|
80 |
protected function getSubProTracking() {
|
81 |
return $this->getSubPro( 'tracking' );
|
82 |
}
|
83 |
|
84 |
/**
|
85 |
-
* @return ICWP_WPSF_Processor_Plugin_ImportExport
|
86 |
*/
|
87 |
public function getSubProImportExport() {
|
88 |
return $this->getSubPro( 'importexport' );
|
@@ -93,7 +118,6 @@ class ICWP_WPSF_Processor_Plugin extends ICWP_WPSF_Processor_BasePlugin {
|
|
93 |
*/
|
94 |
protected function getSubProMap() {
|
95 |
return [
|
96 |
-
'badge' => 'ICWP_WPSF_Processor_Plugin_Badge',
|
97 |
'importexport' => 'ICWP_WPSF_Processor_Plugin_ImportExport',
|
98 |
'tracking' => 'ICWP_WPSF_Processor_Plugin_Tracking',
|
99 |
'crondaily' => 'ICWP_WPSF_Processor_Plugin_CronDaily',
|
@@ -160,8 +184,6 @@ class ICWP_WPSF_Processor_Plugin extends ICWP_WPSF_Processor_BasePlugin {
|
|
160 |
}
|
161 |
|
162 |
public function runDailyCron() {
|
163 |
-
/** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
|
164 |
-
$oFO = $this->getMod();
|
165 |
$this->getCon()->fireEvent( 'test_cron_run' );
|
166 |
}
|
167 |
|
1 |
<?php
|
2 |
|
3 |
+
use FernleafSystems\Wordpress\Plugin\Shield\Modules\Plugin\Components\PluginBadge;
|
4 |
use FernleafSystems\Wordpress\Services\Services;
|
5 |
|
6 |
class ICWP_WPSF_Processor_Plugin extends ICWP_WPSF_Processor_BasePlugin {
|
9 |
*/
|
10 |
public function run() {
|
11 |
parent::run();
|
12 |
+
/** @var ICWP_WPSF_FeatureHandler_Plugin $oMod */
|
13 |
+
$oMod = $this->getMod();
|
14 |
+
|
15 |
+
$this->getSubProCronDaily()->run();
|
16 |
+
$this->getSubProCronHourly()->run();
|
|
|
17 |
|
18 |
$this->removePluginConflicts();
|
|
|
|
|
19 |
|
20 |
+
( new PluginBadge() )
|
21 |
+
->setMod( $oMod )
|
22 |
+
->run();
|
23 |
+
|
24 |
+
if ( $oMod->isTrackingEnabled() || !$oMod->isTrackingPermissionSet() ) {
|
25 |
$this->getSubProTracking()->run();
|
26 |
}
|
27 |
|
28 |
+
if ( $oMod->isImportExportPermitted() ) {
|
29 |
$this->getSubProImportExport()->run();
|
30 |
}
|
31 |
|
38 |
case 'importexport_import':
|
39 |
case 'importexport_handshake':
|
40 |
case 'importexport_updatenotified':
|
41 |
+
if ( $oMod->isImportExportPermitted() ) {
|
42 |
add_action( 'init', [ $this->getSubProImportExport(), 'runAction' ] );
|
43 |
}
|
44 |
break;
|
50 |
}
|
51 |
|
52 |
public function onWpLoaded() {
|
53 |
+
$oCon = $this->getCon();
|
54 |
+
if ( $oCon->isValidAdminArea() ) {
|
55 |
$this->maintainPluginLoadPosition();
|
56 |
}
|
57 |
+
add_filter( $oCon->prefix( 'dashboard_widget_content' ), [ $this, 'gatherPluginWidgetContent' ], 100 );
|
58 |
}
|
59 |
|
60 |
/**
|
61 |
+
* @param array $aContent
|
62 |
+
* @return array
|
63 |
*/
|
64 |
+
public function gatherPluginWidgetContent( $aContent ) {
|
65 |
+
/** @var \ICWP_WPSF_FeatureHandler_Plugin $oMod */
|
66 |
+
$oMod = $this->getMod();
|
67 |
+
$oCon = $this->getCon();
|
68 |
+
|
69 |
+
$aLabels = $oCon->getLabels();
|
70 |
+
$sFooter = sprintf( __( '%s is provided by %s', 'wp-simple-firewall' ), $oCon->getHumanName(),
|
71 |
+
sprintf( '<a href="%s">%s</a>', $aLabels[ 'AuthorURI' ], $aLabels[ 'Author' ] )
|
72 |
+
);
|
73 |
+
|
74 |
+
$aDisplayData = [
|
75 |
+
'sInstallationDays' => sprintf( __( 'Days Installed: %s', 'wp-simple-firewall' ), $this->getInstallationDays() ),
|
76 |
+
'sFooter' => $sFooter,
|
77 |
+
'sIpAddress' => sprintf( __( 'Your IP address is: %s', 'wp-simple-firewall' ), Services::IP()
|
78 |
+
->getRequestIp() )
|
79 |
+
];
|
80 |
+
|
81 |
+
if ( !is_array( $aContent ) ) {
|
82 |
+
$aContent = [];
|
83 |
+
}
|
84 |
+
$aContent[] = $oMod->renderTemplate( 'snippets/widget_dashboard_plugin.php', $aDisplayData );
|
85 |
+
return $aContent;
|
86 |
}
|
87 |
|
88 |
/**
|
89 |
+
* @return \ICWP_WPSF_Processor_Plugin_CronDaily
|
90 |
*/
|
91 |
protected function getSubProCronDaily() {
|
92 |
return $this->getSubPro( 'crondaily' );
|
93 |
}
|
94 |
|
95 |
/**
|
96 |
+
* @return \ICWP_WPSF_Processor_Plugin_CronHourly
|
97 |
*/
|
98 |
protected function getSubProCronHourly() {
|
99 |
return $this->getSubPro( 'cronhourly' );
|
100 |
}
|
101 |
|
102 |
/**
|
103 |
+
* @return \ICWP_WPSF_Processor_Plugin_Tracking
|
104 |
*/
|
105 |
protected function getSubProTracking() {
|
106 |
return $this->getSubPro( 'tracking' );
|
107 |
}
|
108 |
|
109 |
/**
|
110 |
+
* @return \ICWP_WPSF_Processor_Plugin_ImportExport
|
111 |
*/
|
112 |
public function getSubProImportExport() {
|
113 |
return $this->getSubPro( 'importexport' );
|
118 |
*/
|
119 |
protected function getSubProMap() {
|
120 |
return [
|
|
|
121 |
'importexport' => 'ICWP_WPSF_Processor_Plugin_ImportExport',
|
122 |
'tracking' => 'ICWP_WPSF_Processor_Plugin_Tracking',
|
123 |
'crondaily' => 'ICWP_WPSF_Processor_Plugin_CronDaily',
|
184 |
}
|
185 |
|
186 |
public function runDailyCron() {
|
|
|
|
|
187 |
$this->getCon()->fireEvent( 'test_cron_run' );
|
188 |
}
|
189 |
|
src/processors/plugin_badge.php
CHANGED
@@ -1,77 +1,34 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
|
4 |
-
|
|
|
|
|
5 |
class ICWP_WPSF_Processor_Plugin_Badge extends ICWP_WPSF_Processor_BaseWpsf {
|
6 |
|
7 |
/**
|
8 |
*/
|
9 |
public function run() {
|
10 |
-
/** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
|
11 |
-
$oFO = $this->getMod();
|
12 |
-
if ( $oFO->isDisplayPluginBadge() ) {
|
13 |
-
add_action( 'wp_enqueue_scripts', [ $this, 'includeJquery' ] );
|
14 |
-
add_action( 'login_enqueue_scripts', [ $this, 'includeJquery' ] );
|
15 |
-
add_action( 'wp_footer', [ $this, 'printPluginBadge' ], 100 );
|
16 |
-
add_action( 'login_footer', [ $this, 'printPluginBadge' ], 100 );
|
17 |
-
}
|
18 |
-
add_action( 'widgets_init', [ $this, 'addPluginBadgeWidget' ] );
|
19 |
-
add_filter( $oFO->prefix( 'dashboard_widget_content' ), [ $this, 'gatherPluginWidgetContent' ], 100 );
|
20 |
}
|
21 |
|
22 |
-
|
23 |
-
|
|
|
|
|
24 |
}
|
25 |
|
26 |
/**
|
27 |
* @param array $aContent
|
28 |
* @return array
|
|
|
29 |
*/
|
30 |
public function gatherPluginWidgetContent( $aContent ) {
|
31 |
-
/** @var \ICWP_WPSF_FeatureHandler_Plugin $oFO */
|
32 |
-
$oFO = $this->getMod();
|
33 |
-
$oCon = $this->getCon();
|
34 |
-
|
35 |
-
$aLabels = $oCon->getLabels();
|
36 |
-
$sFooter = sprintf( __( '%s is provided by %s', 'wp-simple-firewall' ), $oCon->getHumanName(),
|
37 |
-
sprintf( '<a href="%s">%s</a>', $aLabels[ 'AuthorURI' ], $aLabels[ 'Author' ] )
|
38 |
-
);
|
39 |
-
|
40 |
-
$aDisplayData = [
|
41 |
-
'sInstallationDays' => sprintf( __( 'Days Installed: %s', 'wp-simple-firewall' ), $this->getInstallationDays() ),
|
42 |
-
'sFooter' => $sFooter,
|
43 |
-
'sIpAddress' => sprintf( __( 'Your IP address is: %s', 'wp-simple-firewall' ), Services::IP()->getRequestIp() )
|
44 |
-
];
|
45 |
-
|
46 |
-
if ( !is_array( $aContent ) ) {
|
47 |
-
$aContent = [];
|
48 |
-
}
|
49 |
-
$aContent[] = $oFO->renderTemplate( 'snippets/widget_dashboard_plugin.php', $aDisplayData );
|
50 |
return $aContent;
|
51 |
}
|
52 |
|
53 |
/**
|
54 |
-
*
|
55 |
-
*/
|
56 |
-
public function addPluginBadgeWidget() {
|
57 |
-
/** @var \ICWP_WPSF_FeatureHandler_Plugin $oFO */
|
58 |
-
$oFO = $this->getMod();
|
59 |
-
if ( !empty( $oFO ) && Services::WpGeneral()->getWordpressIsAtLeastVersion( '4.6.0' )
|
60 |
-
&& !class_exists( 'Tribe_WP_Widget_Factory' ) ) {
|
61 |
-
register_widget( new ICWP_WPSF_Processor_Plugin_BadgeWidget( $oFO ) );
|
62 |
-
}
|
63 |
-
}
|
64 |
-
|
65 |
-
/**
|
66 |
-
* @uses echo
|
67 |
*/
|
68 |
public function printPluginBadge() {
|
69 |
-
/** @var ICWP_WPSF_FeatureHandler_Plugin $oFO */
|
70 |
-
$oFO = $this->getMod();
|
71 |
-
try {
|
72 |
-
echo $oFO->renderPluginBadge();
|
73 |
-
}
|
74 |
-
catch ( \Exception $oE ) {
|
75 |
-
}
|
76 |
}
|
77 |
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Class ICWP_WPSF_Processor_Plugin_Badge
|
5 |
+
* @deprecated 8.0.1
|
6 |
+
*/
|
7 |
class ICWP_WPSF_Processor_Plugin_Badge extends ICWP_WPSF_Processor_BaseWpsf {
|
8 |
|
9 |
/**
|
10 |
*/
|
11 |
public function run() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
12 |
}
|
13 |
|
14 |
+
/**
|
15 |
+
* @deprecated 8.0.1
|
16 |
+
*/
|
17 |
+
public function addPluginBadgeWidget() {
|
18 |
}
|
19 |
|
20 |
/**
|
21 |
* @param array $aContent
|
22 |
* @return array
|
23 |
+
* @deprecated 8.0.1
|
24 |
*/
|
25 |
public function gatherPluginWidgetContent( $aContent ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
return $aContent;
|
27 |
}
|
28 |
|
29 |
/**
|
30 |
+
* @deprecated 8.0.1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
*/
|
32 |
public function printPluginBadge() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
}
|
src/processors/plugin_badgewidget.php
CHANGED
@@ -1,5 +1,9 @@
|
|
1 |
<?php
|
2 |
|
|
|
|
|
|
|
|
|
3 |
class ICWP_WPSF_Processor_Plugin_BadgeWidget extends ICWP_WPSF_WpWidget {
|
4 |
|
5 |
use \FernleafSystems\Wordpress\Plugin\Shield\Modules\ModConsumer;
|
@@ -9,41 +13,7 @@ class ICWP_WPSF_Processor_Plugin_BadgeWidget extends ICWP_WPSF_WpWidget {
|
|
9 |
* @param ICWP_WPSF_FeatureHandler_Base $oMod
|
10 |
*/
|
11 |
public function __construct( $oMod ) {
|
12 |
-
|
13 |
-
try {
|
14 |
-
$oMod = ICWP_WPSF_Shield_Security::GetInstance()
|
15 |
-
->getController()
|
16 |
-
->getModule_Plugin();
|
17 |
-
}
|
18 |
-
catch ( \Exception $oE ) {
|
19 |
-
return;
|
20 |
-
}
|
21 |
-
}
|
22 |
-
$this->setMod( $oMod );
|
23 |
-
$oCon = $this->getCon();
|
24 |
-
parent::__construct(
|
25 |
-
$oCon->prefixOption( 'plugin_badge' ),
|
26 |
-
sprintf( __( '%s Plugin Badge', 'wp-simple-firewall' ), $oCon->getHumanName() ),
|
27 |
-
[
|
28 |
-
'description' => sprintf( __( 'You can now help spread the word about the %s plugin anywhere on your site', 'wp-simple-firewall' ), $this->getCon()
|
29 |
-
->getHumanName() ),
|
30 |
-
]
|
31 |
-
);
|
32 |
-
|
33 |
-
add_shortcode( 'SHIELD_BADGE', [ $this, 'renderBadge' ] );
|
34 |
-
}
|
35 |
-
|
36 |
-
/**
|
37 |
-
* @param array $aNewInstance
|
38 |
-
* @param array $aOldInstance
|
39 |
-
* @return array
|
40 |
-
*/
|
41 |
-
public function update( $aNewInstance, $aOldInstance ) {
|
42 |
-
return parent::update( $aNewInstance, $aOldInstance );
|
43 |
-
// $aInstance = array(
|
44 |
-
// 'title' => empty( $aNewInstance['title'] ) ? '' : strip_tags( $aNewInstance['title'] )
|
45 |
-
// );
|
46 |
-
// return $aInstance;
|
47 |
}
|
48 |
|
49 |
/**
|
@@ -52,7 +22,6 @@ class ICWP_WPSF_Processor_Plugin_BadgeWidget extends ICWP_WPSF_WpWidget {
|
|
52 |
* @throws \Exception
|
53 |
*/
|
54 |
public function widget( $aWidgetArguments, $aWidgetInstance ) {
|
55 |
-
echo $this->standardRender( $aWidgetArguments, __( 'Site Secured', 'wp-simple-firewall' ), $this->renderBadge() );
|
56 |
}
|
57 |
|
58 |
/**
|
@@ -60,17 +29,6 @@ class ICWP_WPSF_Processor_Plugin_BadgeWidget extends ICWP_WPSF_WpWidget {
|
|
60 |
* @throws \Exception
|
61 |
*/
|
62 |
public function renderBadge() {
|
63 |
-
|
64 |
-
$aData = [
|
65 |
-
'strings' => [
|
66 |
-
'plugin_name' => $oCon->getHumanName(),
|
67 |
-
],
|
68 |
-
'hrefs' => [
|
69 |
-
'img_src' => $oCon->getPluginUrl_Image( 'pluginlogo_32x32.png' )
|
70 |
-
]
|
71 |
-
];
|
72 |
-
|
73 |
-
return $this->getMod()
|
74 |
-
->renderTemplate( 'snippets/plugin_badge_widget', $aData );
|
75 |
}
|
76 |
}
|
1 |
<?php
|
2 |
|
3 |
+
/**
|
4 |
+
* Class ICWP_WPSF_Processor_Plugin_BadgeWidget
|
5 |
+
* @deprecated 8.0.1
|
6 |
+
*/
|
7 |
class ICWP_WPSF_Processor_Plugin_BadgeWidget extends ICWP_WPSF_WpWidget {
|
8 |
|
9 |
use \FernleafSystems\Wordpress\Plugin\Shield\Modules\ModConsumer;
|
13 |
* @param ICWP_WPSF_FeatureHandler_Base $oMod
|
14 |
*/
|
15 |
public function __construct( $oMod ) {
|
16 |
+
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
}
|
18 |
|
19 |
/**
|
22 |
* @throws \Exception
|
23 |
*/
|
24 |
public function widget( $aWidgetArguments, $aWidgetInstance ) {
|
|
|
25 |
}
|
26 |
|
27 |
/**
|
29 |
* @throws \Exception
|
30 |
*/
|
31 |
public function renderBadge() {
|
32 |
+
return '';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
}
|
34 |
}
|
templates/twig/snippets/plugin_badge_widget.twig
ADDED
@@ -0,0 +1,152 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<style type="text/css">
|
2 |
+
.icwp_wpsf_site_badge {
|
3 |
+
background-color: rgba(255, 255, 255, 0.9);
|
4 |
+
box-sizing: content-box;
|
5 |
+
color: #000000;
|
6 |
+
height: 33px;
|
7 |
+
padding: 7px 7px 4px;
|
8 |
+
text-align: left;
|
9 |
+
z-index: 100;
|
10 |
+
}
|
11 |
+
|
12 |
+
.icwp_wpsf_site_badge a,
|
13 |
+
.icwp_wpsf_site_badge a:hover {
|
14 |
+
border: 0 none;
|
15 |
+
box-sizing: inherit;
|
16 |
+
color: inherit !important;
|
17 |
+
display: block;
|
18 |
+
text-decoration: none !important;
|
19 |
+
line-height: 8px;
|
20 |
+
padding: 0;
|
21 |
+
}
|
22 |
+
|
23 |
+
.icwp_wpsf_site_badge .badge-text {
|
24 |
+
font-family: sans-serif;
|
25 |
+
font-size: 12px;
|
26 |
+
font-weight: normal;
|
27 |
+
line-height: 17px;
|
28 |
+
padding-left: 43px;
|
29 |
+
letter-spacing: 0;
|
30 |
+
}
|
31 |
+
.icwp_wpsf_site_badge img {
|
32 |
+
float: left;
|
33 |
+
}
|
34 |
+
.plugin-badge-name {
|
35 |
+
font-weight: bolder;
|
36 |
+
}
|
37 |
+
|
38 |
+
.icwp_wpsf_site_badge.floating_badge {
|
39 |
+
background-color: rgba(241, 241, 241, 0.99);
|
40 |
+
border-radius: 5px;
|
41 |
+
bottom: 9px;
|
42 |
+
box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.47);
|
43 |
+
box-sizing: content-box;
|
44 |
+
color: #000000;
|
45 |
+
height: 33px;
|
46 |
+
left: 9px;
|
47 |
+
opacity: 0.8;
|
48 |
+
padding: 7px 4px 7px 10px;
|
49 |
+
position: fixed;
|
50 |
+
text-align: left;
|
51 |
+
width: 38px;
|
52 |
+
z-index: 10000;
|
53 |
+
text-wrap: none;
|
54 |
+
|
55 |
+
-webkit-transition: width 0.25s; /* Safari */
|
56 |
+
transition: width 0.25s;
|
57 |
+
transition-delay: 1s
|
58 |
+
}
|
59 |
+
.icwp_wpsf_site_badge.floating_badge:hover {
|
60 |
+
opacity: 1.0;
|
61 |
+
width: 220px;
|
62 |
+
transition-delay: 0s;
|
63 |
+
}
|
64 |
+
.icwp_wpsf_site_badge.floating_badge .badge-text {
|
65 |
+
-webkit-transition: opacity 1s; /* Safari */
|
66 |
+
opacity: 0;
|
67 |
+
transition: opacity 0.3s;
|
68 |
+
transition-delay: 1s;
|
69 |
+
}
|
70 |
+
.icwp_wpsf_site_badge.floating_badge:hover .badge-text {
|
71 |
+
opacity: 1;
|
72 |
+
transition-delay: 0s;
|
73 |
+
}
|
74 |
+
a#icwpWpsfCloseButton {
|
75 |
+
background-color: #ffffff;
|
76 |
+
border: 1px solid #ddd;
|
77 |
+
border-radius: 4px;
|
78 |
+
display: none;
|
79 |
+
font-size: 10px;
|
80 |
+
height: 10px;
|
81 |
+
left: -2px;
|
82 |
+
line-height: 6px;
|
83 |
+
padding: 2px 1px 0 2px !important;
|
84 |
+
position: absolute;
|
85 |
+
text-align: center;
|
86 |
+
top: -3px;
|
87 |
+
width: 10px;
|
88 |
+
z-index: 1001;
|
89 |
+
}
|
90 |
+
#icwpWpsfSiteBadge:hover a#icwpWpsfCloseButton {
|
91 |
+
display: block;
|
92 |
+
}
|
93 |
+
#icwpWpsfCloseButton:hover {
|
94 |
+
cursor: pointer;
|
95 |
+
}
|
96 |
+
@media (max-width: 600px) {
|
97 |
+
.icwp_wpsf_site_badge.floating_badge {
|
98 |
+
height: 16px;
|
99 |
+
width: 112px;
|
100 |
+
}
|
101 |
+
.icwp_wpsf_site_badge.floating_badge .badge-text {
|
102 |
+
font-size: 8px;
|
103 |
+
font-weight: normal;
|
104 |
+
line-height: 10px;
|
105 |
+
padding-left: 20px;
|
106 |
+
}
|
107 |
+
.icwp_wpsf_site_badge.floating_badge img {
|
108 |
+
height: 16px;
|
109 |
+
width: 16px;
|
110 |
+
}
|
111 |
+
}
|
112 |
+
</style>
|
113 |
+
<div id="icwpWpsfSiteBadge" class="icwp_wpsf_site_badge {% if flags.is_floating %} floating_badge {% endif %}">
|
114 |
+
{% if flags.is_floating %}
|
115 |
+
<a id="icwpWpsfCloseButton">x</a>
|
116 |
+
{% endif %}
|
117 |
+
|
118 |
+
<a href="{{ hrefs.badge }}" target="_blank" title="{{ strings.name }}">
|
119 |
+
<img src="{{ hrefs.logo }}" alt="Logo: {{ strings.name }}" />
|
120 |
+
<div class="badge-text">{{ strings.protected|raw }} →</div>
|
121 |
+
</a>
|
122 |
+
</div>
|
123 |
+
|
124 |
+
{% if flags.is_floating %}
|
125 |
+
<script type="text/javascript">
|
126 |
+
var iCWP_WPSF_PluginBadgeClose = new function () {
|
127 |
+
|
128 |
+
let closeBadge = function () {
|
129 |
+
|
130 |
+
let aData = {{ ajax.plugin_badge_close|raw }};
|
131 |
+
jQuery.post( aData[ 'ajaxurl' ], aData,
|
132 |
+
function ( oResponse ) {
|
133 |
+
}
|
134 |
+
).always( function () {
|
135 |
+
jQuery( '.icwp_wpsf_site_badge.floating_badge' ).remove();
|
136 |
+
}
|
137 |
+
);
|
138 |
+
|
139 |
+
return true;
|
140 |
+
};
|
141 |
+
|
142 |
+
this.initialise = function () {
|
143 |
+
jQuery( document ).ready( function () {
|
144 |
+
jQuery( document ).on( "click", "a#icwpWpsfCloseButton", closeBadge );
|
145 |
+
} );
|
146 |
+
};
|
147 |
+
|
148 |
+
}();
|
149 |
+
|
150 |
+
iCWP_WPSF_PluginBadgeClose.initialise();
|
151 |
+
</script>
|
152 |
+
{% endif %}
|