Shield Security for WordPress - Version 15.0.6

Version Description

Download this release

Release Info

Developer paultgoodchild
Plugin Icon 128x128 Shield Security for WordPress
Version 15.0.6
Comparing to
See all releases

Code changes from version 15.0.5 to 15.0.6

Files changed (43) hide show
  1. cl.json +10 -0
  2. icwp-wpsf.php +1 -1
  3. plugin-spec.php +3 -3
  4. plugin.json +3 -3
  5. readme.txt +1 -1
  6. src/lib/src/Modules/AuditTrail/UI.php +13 -17
  7. src/lib/src/Modules/Base/AdminPage.php +22 -27
  8. src/lib/src/Modules/Email/Processor.php +31 -36
  9. src/lib/src/Modules/Events/Lib/Reports/KeyStats.php +10 -13
  10. src/lib/src/Modules/HackGuard/AjaxHandler.php +13 -19
  11. src/lib/src/Modules/HackGuard/Lib/Reports/FileLockerAlerts.php +14 -17
  12. src/lib/src/Modules/HackGuard/Lib/Reports/ScanAlerts.php +19 -22
  13. src/lib/src/Modules/HackGuard/Lib/Reports/ScanRepairs.php +1 -2
  14. src/lib/src/Modules/HackGuard/Lib/ScanTables/Modals/BuildHistory.php +10 -15
  15. src/lib/src/Modules/HackGuard/Lib/ScanTables/Modals/BuildInfo.php +27 -30
  16. src/lib/src/Modules/HackGuard/Lib/ScanTables/Modals/FileContents.php +3 -7
  17. src/lib/src/Modules/HackGuard/Lib/ScanTables/Modals/ScanItemView.php +36 -39
  18. src/lib/src/Modules/HackGuard/Scan/Utilities/PtgAddReinstallLinks.php +20 -25
  19. src/lib/src/Modules/HackGuard/Scan/Utilities/WpvAddPluginRows.php +21 -26
  20. src/lib/src/Modules/IPs/Lib/AutoUnblock.php +1 -1
  21. src/lib/src/Modules/IPs/Lib/IpAnalyse/BuildDisplay.php +141 -161
  22. src/lib/src/Modules/IPs/UI.php +15 -19
  23. src/lib/src/Modules/Insights/UI.php +47 -62
  24. src/lib/src/Modules/Integrations/Lib/Bots/UserForms/Handlers/WordPress.php +3 -3
  25. src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/ExtensionSettingsPage.php +17 -22
  26. src/lib/src/Modules/LoginGuard/Lib/AntiBot/ProtectionProviders/GaspJs.php +4 -7
  27. src/lib/src/Modules/LoginGuard/Lib/TwoFactor/MfaProfilesController.php +4 -4
  28. src/lib/src/Modules/LoginGuard/Lib/TwoFactor/Provider/BaseProvider.php +2 -5
  29. src/lib/src/Modules/LoginGuard/Lib/TwoFactor/Provider/Email.php +1 -1
  30. src/lib/src/Modules/LoginGuard/Lib/TwoFactor/Render/RenderLoginIntentPage.php +2 -5
  31. src/lib/src/Modules/Plugin/Components/PluginBadge.php +19 -23
  32. src/lib/src/Modules/Plugin/Insights/AdminNotes.php +1 -7
  33. src/lib/src/Modules/Plugin/Lib/Debug/RecentEvents.php +9 -14
  34. src/lib/src/Modules/Reporting/Lib/ReportingController.php +1 -1
  35. src/lib/src/Modules/Reporting/Lib/Reports/Build/BuilderAlerts.php +9 -12
  36. src/lib/src/Modules/Reporting/Lib/Reports/Build/BuilderInfo.php +12 -15
  37. src/lib/src/Modules/Reporting/UI.php +28 -38
  38. src/lib/src/Modules/Traffic/UI.php +17 -22
  39. src/lib/src/Modules/UserManagement/Lib/Suspend/UserSuspendController.php +1 -1
  40. src/lib/src/Utilities/ReCaptcha/Enqueue.php +10 -14
  41. src/wizards/base.php +19 -26
  42. templates/twig/snippets/anti_bot/google_recaptcha_js.twig +64 -0
  43. templates/twig/snippets/plugin_badge_widget.twig +1 -1
cl.json CHANGED
@@ -174,6 +174,16 @@
174
  "type": "fixed"
175
  }
176
  ]
 
 
 
 
 
 
 
 
 
 
177
  }
178
  ]
179
  },
174
  "type": "fixed"
175
  }
176
  ]
177
+ },
178
+ {
179
+ "version": "6",
180
+ "released_at": 1652183772,
181
+ "items": [
182
+ {
183
+ "title": "Fix for reCAPTCHA on login forms not properly rendering.",
184
+ "type": "fixed"
185
+ }
186
+ ]
187
  }
188
  ]
189
  },
icwp-wpsf.php CHANGED
@@ -3,7 +3,7 @@
3
  * Plugin Name: Shield Security
4
  * Plugin URI: https://shsec.io/2f
5
  * Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
6
- * Version: 15.0.5
7
  * Text Domain: wp-simple-firewall
8
  * Domain Path: /languages
9
  * Author: Shield Security
3
  * Plugin Name: Shield Security
4
  * Plugin URI: https://shsec.io/2f
5
  * Description: Powerful, Easy-To-Use #1 Rated WordPress Security System
6
+ * Version: 15.0.6
7
  * Text Domain: wp-simple-firewall
8
  * Domain Path: /languages
9
  * Author: Shield Security
plugin-spec.php CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "properties": {
3
- "version": "15.0.5",
4
- "release_timestamp": 1652128056,
5
- "build": "202205.0905",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
1
  {
2
  "properties": {
3
+ "version": "15.0.6",
4
+ "release_timestamp": 1652183772,
5
+ "build": "202205.1002",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
plugin.json CHANGED
@@ -1,8 +1,8 @@
1
  {
2
  "properties": {
3
- "version": "15.0.5",
4
- "release_timestamp": 1652128056,
5
- "build": "202205.0905",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
1
  {
2
  "properties": {
3
+ "version": "15.0.6",
4
+ "release_timestamp": 1652183772,
5
+ "build": "202205.1002",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
readme.txt CHANGED
@@ -8,7 +8,7 @@ Requires at least: 3.7
8
  Requires PHP: 7.0
9
  Recommended PHP: 7.4
10
  Tested up to: 6.0
11
- Stable tag: 15.0.5
12
 
13
  No-Nonsense Security Hardening that protects WordPress against hackers, malicious bots, and spammers (no captchas!). Now with exclusive ShieldNET Technology.
14
 
8
  Requires PHP: 7.0
9
  Recommended PHP: 7.4
10
  Tested up to: 6.0
11
+ Stable tag: 15.0.6
12
 
13
  No-Nonsense Security Hardening that protects WordPress against hackers, malicious bots, and spammers (no captchas!). Now with exclusive ShieldNET Technology.
14
 
src/lib/src/Modules/AuditTrail/UI.php CHANGED
@@ -11,23 +11,19 @@ class UI extends BaseShield\UI {
11
  public function renderAuditTrailTable() :string {
12
  /** @var ModCon $mod */
13
  $mod = $this->getMod();
14
- return $mod->renderTemplate(
15
- '/wpadmin_pages/insights/audit_trail/audit_table.twig',
16
- [
17
- 'ajax' => [
18
- 'logtable_action' => $mod->getAjaxActionData( 'logtable_action', true ),
19
- ],
20
- 'flags' => [],
21
- 'strings' => [
22
- 'table_title' => __( 'Activity Log', 'wp-simple-firewall' ),
23
- ],
24
- 'vars' => [
25
- 'datatables_init' => ( new ForAuditTrail() )
26
- ->setMod( $this->getMod() )
27
- ->build()
28
- ],
29
  ],
30
- true
31
- );
 
 
 
 
 
 
 
 
32
  }
33
  }
11
  public function renderAuditTrailTable() :string {
12
  /** @var ModCon $mod */
13
  $mod = $this->getMod();
14
+ return $mod->renderTemplate( '/wpadmin_pages/insights/audit_trail/audit_table.twig', [
15
+ 'ajax' => [
16
+ 'logtable_action' => $mod->getAjaxActionData( 'logtable_action', true ),
 
 
 
 
 
 
 
 
 
 
 
 
17
  ],
18
+ 'flags' => [],
19
+ 'strings' => [
20
+ 'table_title' => __( 'Activity Log', 'wp-simple-firewall' ),
21
+ ],
22
+ 'vars' => [
23
+ 'datatables_init' => ( new ForAuditTrail() )
24
+ ->setMod( $this->getMod() )
25
+ ->build()
26
+ ],
27
+ ] );
28
  }
29
  }
src/lib/src/Modules/Base/AdminPage.php CHANGED
@@ -75,33 +75,28 @@ class AdminPage extends ExecOnceModConsumer {
75
  $modSecAdmin = $this->getCon()->getModule_SecAdmin();
76
  /** @var SecurityAdmin\Options $secOpts */
77
  $secOpts = $modSecAdmin->getOptions();
78
-
79
- $reportEmail = $mod->getPluginReportEmail();
80
-
81
- return $mod->renderTemplate(
82
- '/wpadmin_pages/security_admin/index.twig',
83
- Services::DataManipulation()
84
- ->mergeArraysRecursive(
85
- $mod->getUIHandler()->getBaseDisplayData(),
86
- [
87
- 'ajax' => [
88
- 'restricted_access' => $mod->getAjaxActionData( 'restricted_access' ),
89
- ],
90
- 'flags' => [
91
- 'allow_email_override' => $secOpts->isEmailOverridePermitted()
92
- ],
93
- 'hrefs' => [
94
- 'form_action' => $modSecAdmin->getUrl_AdminPage()
95
- ],
96
- 'strings' => [
97
- 'force_remove_email' => __( "If you've forgotten your PIN, a link can be sent to the plugin administrator email address to remove this restriction.", 'wp-simple-firewall' ),
98
- 'click_email' => __( "Click here to send the verification email.", 'wp-simple-firewall' ),
99
- 'send_to_email' => sprintf( __( "Email will be sent to %s", 'wp-simple-firewall' ),
100
- Obfuscate::Email( $reportEmail ) ),
101
- 'no_email_override' => __( "The Security Administrator has restricted the use of the email override feature.", 'wp-simple-firewall' ),
102
- ],
103
- ]
104
- )
105
  );
106
  }
107
 
75
  $modSecAdmin = $this->getCon()->getModule_SecAdmin();
76
  /** @var SecurityAdmin\Options $secOpts */
77
  $secOpts = $modSecAdmin->getOptions();
78
+ return $mod->renderTemplate( '/wpadmin_pages/security_admin/index.twig',
79
+ Services::DataManipulation()->mergeArraysRecursive(
80
+ $mod->getUIHandler()->getBaseDisplayData(),
81
+ [
82
+ 'ajax' => [
83
+ 'restricted_access' => $mod->getAjaxActionData( 'restricted_access' ),
84
+ ],
85
+ 'flags' => [
86
+ 'allow_email_override' => $secOpts->isEmailOverridePermitted()
87
+ ],
88
+ 'hrefs' => [
89
+ 'form_action' => $modSecAdmin->getUrl_AdminPage()
90
+ ],
91
+ 'strings' => [
92
+ 'force_remove_email' => __( "If you've forgotten your PIN, a link can be sent to the plugin administrator email address to remove this restriction.", 'wp-simple-firewall' ),
93
+ 'click_email' => __( "Click here to send the verification email.", 'wp-simple-firewall' ),
94
+ 'send_to_email' => sprintf( __( "Email will be sent to %s", 'wp-simple-firewall' ),
95
+ Obfuscate::Email( $mod->getPluginReportEmail() ) ),
96
+ 'no_email_override' => __( "The Security Administrator has restricted the use of the email override feature.", 'wp-simple-firewall' ),
97
+ ],
98
+ ]
99
+ )
 
 
 
 
 
100
  );
101
  }
102
 
src/lib/src/Modules/Email/Processor.php CHANGED
@@ -42,29 +42,28 @@ class Processor extends BaseShield\Processor {
42
 
43
  $isWhitelabelled = $con->getModule_SecAdmin()->getWhiteLabelController()->isEnabled();
44
  $footer = [
45
- $this->getMod()
46
- ->renderTemplate( '/email/footer.twig', [
47
- 'strings' => [
48
- 'benefits' => $benefits,
49
- 'much_more' => 'And So Much More',
50
- 'upgrade' => $goPro[ array_rand( $goPro ) ],
51
- 'sent_from' => sprintf( __( 'Email sent from the %s Plugin v%s, on %s.', 'wp-simple-firewall' ),
52
- $this->getCon()->getHumanName(),
53
- $this->getCon()->getVersion(),
54
- $WP->getHomeUrl()
55
- ),
56
- 'delays' => __( 'Note: Email delays are caused by website hosting and email providers.', 'wp-simple-firewall' ),
57
- 'time_sent' => sprintf( __( 'Time Sent: %s', 'wp-simple-firewall' ), $WP->getTimeStampForDisplay() ),
58
- ],
59
- 'hrefs' => [
60
- 'upgrade' => 'https://shsec.io/buyshieldproemailfooter',
61
- 'much_more' => 'https://shsec.io/gp'
62
- ],
63
- 'flags' => [
64
- 'is_pro' => $con->isPremiumActive(),
65
- 'is_whitelabelled' => $isWhitelabelled
66
- ]
67
- ] ),
68
  ];
69
 
70
  return apply_filters( 'icwp_shield_email_footer', $footer );
@@ -89,22 +88,18 @@ class Processor extends BaseShield\Processor {
89
  );
90
  }
91
 
92
- public function sendEmailWithTemplate( string $templ, string $to, string $subject, array $body ) :bool {
93
  return $this->send(
94
  $to,
95
  $subject,
96
- $this->getMod()->renderTemplate(
97
- $templ,
98
- [
99
- 'header' => $this->getEmailHeader(),
100
- 'body' => $body,
101
- 'footer' => $this->getEmailFooter(),
102
- 'vars' => [
103
- 'lang' => Services::WpGeneral()->getLocale( '-' )
104
- ]
105
- ],
106
- true
107
- )
108
  );
109
  }
110
 
42
 
43
  $isWhitelabelled = $con->getModule_SecAdmin()->getWhiteLabelController()->isEnabled();
44
  $footer = [
45
+ $this->getMod()->renderTemplate( '/email/footer.twig', [
46
+ 'strings' => [
47
+ 'benefits' => $benefits,
48
+ 'much_more' => 'And So Much More',
49
+ 'upgrade' => $goPro[ array_rand( $goPro ) ],
50
+ 'sent_from' => sprintf( __( 'Email sent from the %s Plugin v%s, on %s.', 'wp-simple-firewall' ),
51
+ $this->getCon()->getHumanName(),
52
+ $this->getCon()->getVersion(),
53
+ $WP->getHomeUrl()
54
+ ),
55
+ 'delays' => __( 'Note: Email delays are caused by website hosting and email providers.', 'wp-simple-firewall' ),
56
+ 'time_sent' => sprintf( __( 'Time Sent: %s', 'wp-simple-firewall' ), $WP->getTimeStampForDisplay() ),
57
+ ],
58
+ 'hrefs' => [
59
+ 'upgrade' => 'https://shsec.io/buyshieldproemailfooter',
60
+ 'much_more' => 'https://shsec.io/gp'
61
+ ],
62
+ 'flags' => [
63
+ 'is_pro' => $con->isPremiumActive(),
64
+ 'is_whitelabelled' => $isWhitelabelled
65
+ ]
66
+ ] ),
 
67
  ];
68
 
69
  return apply_filters( 'icwp_shield_email_footer', $footer );
88
  );
89
  }
90
 
91
+ public function sendEmailWithTemplate( string $template, string $to, string $subject, array $body ) :bool {
92
  return $this->send(
93
  $to,
94
  $subject,
95
+ $this->getMod()->renderTemplate( $template, [
96
+ 'header' => $this->getEmailHeader(),
97
+ 'body' => $body,
98
+ 'footer' => $this->getEmailFooter(),
99
+ 'vars' => [
100
+ 'lang' => Services::WpGeneral()->getLocale( '-' )
101
+ ]
102
+ ] )
 
 
 
 
103
  );
104
  }
105
 
src/lib/src/Modules/Events/Lib/Reports/KeyStats.php CHANGED
@@ -54,19 +54,16 @@ class KeyStats extends BaseReporter {
54
  }
55
 
56
  if ( count( $sums ) > 0 ) {
57
- $alerts[] = $this->getMod()->renderTemplate(
58
- '/components/reports/mod/events/info_keystats.twig',
59
- [
60
- 'vars' => [
61
- 'counts' => $sums
62
- ],
63
- 'strings' => [
64
- 'title' => __( 'Top Security Statistics', 'wp-simple-firewall' ),
65
- ],
66
- 'hrefs' => [
67
- ],
68
- ]
69
- );
70
  }
71
 
72
  return $alerts;
54
  }
55
 
56
  if ( count( $sums ) > 0 ) {
57
+ $alerts[] = $mod->renderTemplate( '/components/reports/mod/events/info_keystats.twig', [
58
+ 'strings' => [
59
+ 'title' => __( 'Top Security Statistics', 'wp-simple-firewall' ),
60
+ ],
61
+ 'hrefs' => [
62
+ ],
63
+ 'vars' => [
64
+ 'counts' => $sums
65
+ ],
66
+ ] );
 
 
 
67
  }
68
 
69
  return $alerts;
src/lib/src/Modules/HackGuard/AjaxHandler.php CHANGED
@@ -122,12 +122,10 @@ class AjaxHandler extends Shield\Modules\BaseShield\AjaxHandler {
122
  return [
123
  'success' => $data[ 'success' ],
124
  'message' => $data[ 'error' ],
125
- 'html' => $this->getMod()
126
- ->renderTemplate(
127
- '/wpadmin_pages/insights/scans/results/realtime/file_locker/file_diff.twig',
128
- $data,
129
- true
130
- )
131
  ];
132
  }
133
 
@@ -212,19 +210,15 @@ class AjaxHandler extends Shield\Modules\BaseShield\AjaxHandler {
212
  'success' => true,
213
  'running' => $queueCon->getScansRunningStates(),
214
  'vars' => [
215
- 'progress_html' => $mod->renderTemplate(
216
- '/wpadmin_pages/insights/scans/modal/progress_snippet.twig',
217
- [
218
- 'current_scan' => __( 'Current Scan', 'wp-simple-firewall' ),
219
- 'scan' => $currentScan,
220
- 'remaining_scans' => $remainingScans,
221
- 'progress' => 100*$queueCon->getScanJobProgress(),
222
- 'patience_1' => __( 'Please be patient.', 'wp-simple-firewall' ),
223
- 'patience_2' => __( 'Some scans can take quite a while to complete.', 'wp-simple-firewall' ),
224
- 'completed' => __( 'Scans completed.', 'wp-simple-firewall' ).' '.__( 'Reloading page', 'wp-simple-firewall' ).'...'
225
- ],
226
- true
227
- ),
228
  ]
229
  ];
230
  }
122
  return [
123
  'success' => $data[ 'success' ],
124
  'message' => $data[ 'error' ],
125
+ 'html' => $mod->renderTemplate(
126
+ '/wpadmin_pages/insights/scans/results/realtime/file_locker/file_diff.twig',
127
+ $data
128
+ )
 
 
129
  ];
130
  }
131
 
210
  'success' => true,
211
  'running' => $queueCon->getScansRunningStates(),
212
  'vars' => [
213
+ 'progress_html' => $mod->renderTemplate( '/wpadmin_pages/insights/scans/modal/progress_snippet.twig', [
214
+ 'current_scan' => __( 'Current Scan', 'wp-simple-firewall' ),
215
+ 'scan' => $currentScan,
216
+ 'remaining_scans' => $remainingScans,
217
+ 'progress' => 100*$queueCon->getScanJobProgress(),
218
+ 'patience_1' => __( 'Please be patient.', 'wp-simple-firewall' ),
219
+ 'patience_2' => __( 'Some scans can take quite a while to complete.', 'wp-simple-firewall' ),
220
+ 'completed' => __( 'Scans completed.', 'wp-simple-firewall' ).' '.__( 'Reloading page', 'wp-simple-firewall' ).'...'
221
+ ] ),
 
 
 
 
222
  ]
223
  ];
224
  }
src/lib/src/Modules/HackGuard/Lib/Reports/FileLockerAlerts.php CHANGED
@@ -19,23 +19,20 @@ class FileLockerAlerts extends BaseReporter {
19
  $notNotified = $lockOps->withProblemsNotNotified();
20
 
21
  if ( count( $notNotified ) > 0 ) {
22
- $alerts[] = $this->getMod()->renderTemplate(
23
- '/components/reports/mod/hack_protect/alert_filelocker.twig',
24
- [
25
- 'vars' => [
26
- 'count' => $mod->getFileLocker()->countProblems()
27
- ],
28
- 'strings' => [
29
- 'title' => __( 'File Locker Changes Detected', 'wp-simple-firewall' ),
30
- 'file_changed' => __( 'Changes have been detected in the contents of critical files.', 'wp-simple-firewall' ),
31
- 'total_files' => sprintf( '%s: %s', __( 'Total Changed Files', 'wp-simple-firewall' ), count( $notNotified ) ),
32
- 'view_results' => __( 'Click Here To View File Locker Results', 'wp-simple-firewall' ),
33
- ],
34
- 'hrefs' => [
35
- 'view_results' => $this->getCon()->getModule_Insights()->getUrl_ScansResults(),
36
- ],
37
- ]
38
- );
39
  $this->markAlertsAsNotified( $notNotified );
40
  $lockOps->clearLocksCache();
41
  }
19
  $notNotified = $lockOps->withProblemsNotNotified();
20
 
21
  if ( count( $notNotified ) > 0 ) {
22
+ $alerts[] = $this->getMod()->renderTemplate( '/components/reports/mod/hack_protect/alert_filelocker.twig', [
23
+ 'hrefs' => [
24
+ 'view_results' => $this->getCon()->getModule_Insights()->getUrl_ScansResults(),
25
+ ],
26
+ 'strings' => [
27
+ 'title' => __( 'File Locker Changes Detected', 'wp-simple-firewall' ),
28
+ 'file_changed' => __( 'Changes have been detected in the contents of critical files.', 'wp-simple-firewall' ),
29
+ 'total_files' => sprintf( '%s: %s', __( 'Total Changed Files', 'wp-simple-firewall' ), count( $notNotified ) ),
30
+ 'view_results' => __( 'Click Here To View File Locker Results', 'wp-simple-firewall' ),
31
+ ],
32
+ 'vars' => [
33
+ 'count' => $mod->getFileLocker()->countProblems()
34
+ ],
35
+ ] );
 
 
 
36
  $this->markAlertsAsNotified( $notNotified );
37
  $lockOps->clearLocksCache();
38
  }
src/lib/src/Modules/HackGuard/Lib/Reports/ScanAlerts.php CHANGED
@@ -2,7 +2,6 @@
2
 
3
  namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\HackGuard\Lib\Reports;
4
 
5
- use FernleafSystems\Wordpress\Plugin\Shield\Databases\Scanner;
6
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\HackGuard;
7
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\Reporting\Lib\Reports\BaseReporter;
8
  use FernleafSystems\Wordpress\Services\Services;
@@ -10,14 +9,15 @@ use FernleafSystems\Wordpress\Services\Services;
10
  class ScanAlerts extends BaseReporter {
11
 
12
  public function build() :array {
 
13
  $alerts = [];
14
 
15
  /** @var HackGuard\Strings $strings */
16
- $strings = $this->getMod()->getStrings();
17
 
18
  $scanCounts = array_filter(
19
  ( new Query\ScanCounts() )
20
- ->setMod( $this->getMod() )
21
  ->standard()
22
  );
23
 
@@ -28,26 +28,23 @@ class ScanAlerts extends BaseReporter {
28
  'name' => $strings->getScanName( $slug ),
29
  ];
30
  }
31
- $alerts[] = $this->getMod()->renderTemplate(
32
- '/components/reports/mod/hack_protect/alert_scanresults.twig',
33
- [
34
- 'vars' => [
35
- 'scan_counts' => $scanCounts
36
- ],
37
- 'strings' => [
38
- 'title' => __( 'New Scan Results', 'wp-simple-firewall' ),
39
- 'view_results' => __( 'Click Here To View Scan Results Details', 'wp-simple-firewall' ),
40
- 'note_changes' => sprintf( '%s: %s', __( 'Note', 'wp-simple-firewall' ),
41
- __( 'Depending on previous actions taken on the site or file system changes, these results may no longer be available to view.', 'wp-simple-firewall' ) ),
42
 
43
- ],
44
- 'hrefs' => [
45
- 'view_results' => $this->getCon()
46
- ->getModule_Insights()
47
- ->getUrl_ScansResults(),
48
- ],
49
- ]
50
- );
51
 
52
  $this->markAlertsAsNotified();
53
  }
2
 
3
  namespace FernleafSystems\Wordpress\Plugin\Shield\Modules\HackGuard\Lib\Reports;
4
 
 
5
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\HackGuard;
6
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\Reporting\Lib\Reports\BaseReporter;
7
  use FernleafSystems\Wordpress\Services\Services;
9
  class ScanAlerts extends BaseReporter {
10
 
11
  public function build() :array {
12
+ $mod = $this->getMod();
13
  $alerts = [];
14
 
15
  /** @var HackGuard\Strings $strings */
16
+ $strings = $mod->getStrings();
17
 
18
  $scanCounts = array_filter(
19
  ( new Query\ScanCounts() )
20
+ ->setMod( $mod )
21
  ->standard()
22
  );
23
 
28
  'name' => $strings->getScanName( $slug ),
29
  ];
30
  }
31
+ $alerts[] = $mod->renderTemplate( '/components/reports/mod/hack_protect/alert_scanresults.twig', [
32
+ 'hrefs' => [
33
+ 'view_results' => $this->getCon()
34
+ ->getModule_Insights()
35
+ ->getUrl_ScansResults(),
36
+ ],
37
+ 'strings' => [
38
+ 'title' => __( 'New Scan Results', 'wp-simple-firewall' ),
39
+ 'view_results' => __( 'Click Here To View Scan Results Details', 'wp-simple-firewall' ),
40
+ 'note_changes' => sprintf( '%s: %s', __( 'Note', 'wp-simple-firewall' ),
41
+ __( 'Depending on previous actions taken on the site or file system changes, these results may no longer be available to view.', 'wp-simple-firewall' ) ),
42
 
43
+ ],
44
+ 'vars' => [
45
+ 'scan_counts' => $scanCounts
46
+ ],
47
+ ] );
 
 
 
48
 
49
  $this->markAlertsAsNotified();
50
  }
src/lib/src/Modules/HackGuard/Lib/Reports/ScanRepairs.php CHANGED
@@ -71,8 +71,7 @@ class ScanRepairs extends BaseReporter {
71
  }
72
 
73
  if ( !empty( $repairs ) ) {
74
- $alerts[] = $this->getMod()->renderTemplate(
75
- '/components/reports/mod/hack_protect/alert_scanrepairs.twig',
76
  [
77
  'vars' => [
78
  'total' => $total,
71
  }
72
 
73
  if ( !empty( $repairs ) ) {
74
+ $alerts[] = $this->getMod()->renderTemplate( '/components/reports/mod/hack_protect/alert_scanrepairs.twig',
 
75
  [
76
  'vars' => [
77
  'total' => $total,
src/lib/src/Modules/HackGuard/Lib/ScanTables/Modals/BuildHistory.php CHANGED
@@ -16,7 +16,6 @@ class BuildHistory {
16
 
17
  /**
18
  * @param Scans\Base\ResultItem $resultItem
19
- * @return string
20
  * @throws \Exception
21
  */
22
  public function run( $resultItem ) :string {
@@ -52,24 +51,20 @@ class BuildHistory {
52
  }
53
  }
54
 
55
- return $this->getMod()->renderTemplate(
56
- '/wpadmin_pages/insights/scans/modal/scan_item_view/item_history.twig',
57
- [
58
- 'flags' => [
59
- 'has_history' => $results->hasItems(),
60
- ],
61
- 'vars' => [
62
- 'history' => $this->convertHistoryToHuman(),
63
- ],
64
- 'strings' => [
65
- ],
66
- ]
67
- );
68
  }
69
 
70
  /**
71
  * @param Scans\Base\ResultItem $item
72
- * @return string
73
  */
74
  private function getItemFileStatus( $item ) :string {
75
  if ( $item->is_unrecognised ) {
16
 
17
  /**
18
  * @param Scans\Base\ResultItem $resultItem
 
19
  * @throws \Exception
20
  */
21
  public function run( $resultItem ) :string {
51
  }
52
  }
53
 
54
+ return $mod->renderTemplate( '/wpadmin_pages/insights/scans/modal/scan_item_view/item_history.twig', [
55
+ 'flags' => [
56
+ 'has_history' => $results->hasItems(),
57
+ ],
58
+ 'strings' => [
59
+ ],
60
+ 'vars' => [
61
+ 'history' => $this->convertHistoryToHuman(),
62
+ ],
63
+ ] );
 
 
 
64
  }
65
 
66
  /**
67
  * @param Scans\Base\ResultItem $item
 
68
  */
69
  private function getItemFileStatus( $item ) :string {
70
  if ( $item->is_unrecognised ) {
src/lib/src/Modules/HackGuard/Lib/ScanTables/Modals/BuildInfo.php CHANGED
@@ -24,36 +24,33 @@ class BuildInfo {
24
 
25
  $isCoreFile = Services::CoreFileHashes()->isCoreFile( $item->path_fragment );
26
 
27
- return $this->getMod()->renderTemplate(
28
- '/wpadmin_pages/insights/scans/modal/scan_item_view/item_info.twig',
29
- [
30
- 'flags' => [
31
- 'is_core_file' => true,
32
- ],
33
- 'hrefs' => [
34
- 'file_vcs' => $isCoreFile ?
35
- ( new Wp\Repo() )
36
- ->getVcsUrlForFileAndVersion( $item->path_fragment, $WP->getVersion(), false )
37
- : ''
38
- ],
39
- 'vars' => [
40
- 'path_fragment' => $item->path_fragment,
41
- 'file_description' => $this->getFileDescriptionLines()
42
- ],
43
- 'strings' => [
44
- 'file_status' => sprintf( '%s: %s',
45
- __( 'File Status', 'wp-simple-firewall' ),
46
- $this->getFileStatus()
47
- ),
48
- 'file_full_path' => sprintf( '%s: <code>%s</code>',
49
- __( 'Full Path To File', 'wp-simple-firewall' ),
50
- $item->path_full
51
- ),
52
- 'file_description' => __( 'Description', 'wp-simple-firewall' ),
53
- 'view_file_vcs' => __( 'View Original File Contents', 'wp-simple-firewall' ),
54
- ],
55
- ]
56
- );
57
  }
58
 
59
  private function getFileDescriptionLines() :array {
24
 
25
  $isCoreFile = Services::CoreFileHashes()->isCoreFile( $item->path_fragment );
26
 
27
+ return $this->getMod()->renderTemplate( '/wpadmin_pages/insights/scans/modal/scan_item_view/item_info.twig', [
28
+ 'flags' => [
29
+ 'is_core_file' => true,
30
+ ],
31
+ 'hrefs' => [
32
+ 'file_vcs' => $isCoreFile ?
33
+ ( new Wp\Repo() )
34
+ ->getVcsUrlForFileAndVersion( $item->path_fragment, $WP->getVersion(), false )
35
+ : ''
36
+ ],
37
+ 'vars' => [
38
+ 'path_fragment' => $item->path_fragment,
39
+ 'file_description' => $this->getFileDescriptionLines()
40
+ ],
41
+ 'strings' => [
42
+ 'file_status' => sprintf( '%s: %s',
43
+ __( 'File Status', 'wp-simple-firewall' ),
44
+ $this->getFileStatus()
45
+ ),
46
+ 'file_full_path' => sprintf( '%s: <code>%s</code>',
47
+ __( 'Full Path To File', 'wp-simple-firewall' ),
48
+ $item->path_full
49
+ ),
50
+ 'file_description' => __( 'Description', 'wp-simple-firewall' ),
51
+ 'view_file_vcs' => __( 'View Original File Contents', 'wp-simple-firewall' ),
52
+ ],
53
+ ] );
 
 
 
54
  }
55
 
56
  private function getFileDescriptionLines() :array {
src/lib/src/Modules/HackGuard/Lib/ScanTables/Modals/FileContents.php CHANGED
@@ -34,13 +34,9 @@ class FileContents {
34
 
35
  if ( !$rawContents ) {
36
  $modContents = ( new ConvertLineEndings() )->fileDosToLinux( $path );
37
- $contents = $this->getMod()
38
- ->renderTemplate(
39
- '/wpadmin_pages/insights/scans/modal/code_block.twig',
40
- [
41
- 'lines' => explode( "\n", str_replace( "\t", " ", $modContents ) ),
42
- ]
43
- );
44
  }
45
  return [
46
  'contents' => $contents,
34
 
35
  if ( !$rawContents ) {
36
  $modContents = ( new ConvertLineEndings() )->fileDosToLinux( $path );
37
+ $contents = $this->getMod()->renderTemplate( '/wpadmin_pages/insights/scans/modal/code_block.twig', [
38
+ 'lines' => explode( "\n", str_replace( "\t", " ", $modContents ) ),
39
+ ] );
 
 
 
 
40
  }
41
  return [
42
  'contents' => $contents,
src/lib/src/Modules/HackGuard/Lib/ScanTables/Modals/ScanItemView.php CHANGED
@@ -70,46 +70,43 @@ class ScanItemView {
70
  $fullPath = empty( $item->path_full ) ? path_join( ABSPATH, $item->path_fragment ) : $item->path_full;
71
  return [
72
  'path' => \esc_html( $item->path_fragment ),
73
- 'contents' => $mod->renderTemplate(
74
- '/wpadmin_pages/insights/scans/modal/scan_item_view/modal_content.twig',
75
- [
76
- 'content' => [
77
- 'tab_filecontents' => $fileContent,
78
- 'tab_diff' => $diffContent,
79
- 'tab_history' => $historyContent,
80
- 'tab_info' => ( new BuildInfo() )
81
- ->setMod( $this->getMod() )
82
- ->setScanItem( $item )
83
- ->run(),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
  ],
85
- 'flags' => [
86
- 'can_download' => Services::WpFs()->isFile( $fullPath ),
87
- 'has_content' => $hasContent,
88
- 'has_diff' => $hasDiff,
89
- 'has_history' => $hasHistory,
90
- ],
91
- 'hrefs' => [
92
- 'file_download' => $mod->getScanCon( $item->VO->scan )
93
- ->createFileDownloadLink( $item->VO->scanresult_id ),
94
- 'has_content' => $hasContent,
95
- 'has_diff' => $hasDiff,
96
- 'has_history' => $hasHistory,
97
- ],
98
- 'imgs' => [
99
- 'svgs' => [
100
- 'file_download' => $con->svgs->raw( 'bootstrap/download.svg' ),
101
- ],
102
- ],
103
- 'strings' => [
104
- 'modal_title' => sprintf( '%s: %s', 'File', $item->path_fragment ),
105
- 'tab_filecontents' => 'Contents',
106
- 'tab_diff' => 'Diff',
107
- 'tab_history' => 'History',
108
- 'tab_info' => 'Info',
109
- 'file_download' => __( 'Download File', 'wp-simple-firewall' ),
110
- ],
111
- ]
112
- ),
113
  ];
114
  }
115
 
70
  $fullPath = empty( $item->path_full ) ? path_join( ABSPATH, $item->path_fragment ) : $item->path_full;
71
  return [
72
  'path' => \esc_html( $item->path_fragment ),
73
+ 'contents' => $mod->renderTemplate( '/wpadmin_pages/insights/scans/modal/scan_item_view/modal_content.twig', [
74
+ 'content' => [
75
+ 'tab_filecontents' => $fileContent,
76
+ 'tab_diff' => $diffContent,
77
+ 'tab_history' => $historyContent,
78
+ 'tab_info' => ( new BuildInfo() )
79
+ ->setMod( $this->getMod() )
80
+ ->setScanItem( $item )
81
+ ->run(),
82
+ ],
83
+ 'flags' => [
84
+ 'can_download' => Services::WpFs()->isFile( $fullPath ),
85
+ 'has_content' => $hasContent,
86
+ 'has_diff' => $hasDiff,
87
+ 'has_history' => $hasHistory,
88
+ ],
89
+ 'hrefs' => [
90
+ 'file_download' => $mod->getScanCon( $item->VO->scan )
91
+ ->createFileDownloadLink( $item->VO->scanresult_id ),
92
+ 'has_content' => $hasContent,
93
+ 'has_diff' => $hasDiff,
94
+ 'has_history' => $hasHistory,
95
+ ],
96
+ 'imgs' => [
97
+ 'svgs' => [
98
+ 'file_download' => $con->svgs->raw( 'bootstrap/download.svg' ),
99
  ],
100
+ ],
101
+ 'strings' => [
102
+ 'modal_title' => sprintf( '%s: %s', 'File', $item->path_fragment ),
103
+ 'tab_filecontents' => 'Contents',
104
+ 'tab_diff' => 'Diff',
105
+ 'tab_history' => 'History',
106
+ 'tab_info' => 'Info',
107
+ 'file_download' => __( 'Download File', 'wp-simple-firewall' ),
108
+ ],
109
+ ] )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
110
  ];
111
  }
112
 
src/lib/src/Modules/HackGuard/Scan/Utilities/PtgAddReinstallLinks.php CHANGED
@@ -69,30 +69,25 @@ class PtgAddReinstallLinks {
69
 
70
  private function printPluginReinstallDialogs() {
71
  $scanCon = $this->getScanController();
72
- echo $scanCon->getMod()
73
- ->renderTemplate(
74
- 'snippets/dialog_plugins_reinstall.twig',
75
- [
76
- 'strings' => [
77
- 'are_you_sure' => __( 'Are you sure?', 'wp-simple-firewll' ),
78
- 'really_reinstall' => __( 'Really Re-Install Plugin', 'wp-simple-firewll' ),
79
- 'wp_reinstall' => __( 'WordPress will now download and install the latest available version of this plugin.', 'wp-simple-firewll' ),
80
- 'in_case' => sprintf( '%s: %s',
81
- __( 'Note', 'wp-simple-firewall' ),
82
- __( 'In case of possible failure, it may be better to do this while the plugin is inactive.', 'wp-simple-firewll' )
83
- ),
84
- 'reinstall_first' => __( 'Re-install first?', 'wp-simple-firewall' ),
85
- 'corrupted' => __( "This ensures files for this plugin haven't been corrupted in any way.", 'wp-simple-firewall' ),
86
- 'choose' => __( "You can choose to 'Activate Only' (not recommended), or close this message to cancel activation.", 'wp-simple-firewall' ),
87
- 'editing_restricted' => __( 'Editing this option is currently restricted.', 'wp-simple-firewall' ),
88
- 'download' => sprintf(
89
- __( 'For best security practices, %s will download and re-install the latest available version of this plugin.', 'wp-simple-firewall' ),
90
- $scanCon->getCon()->getHumanName()
91
- )
92
- ],
93
- 'js_snippets' => []
94
- ],
95
- true
96
- );
97
  }
98
  }
69
 
70
  private function printPluginReinstallDialogs() {
71
  $scanCon = $this->getScanController();
72
+ echo $scanCon->getMod()->renderTemplate( 'snippets/dialog_plugins_reinstall.twig', [
73
+ 'strings' => [
74
+ 'are_you_sure' => __( 'Are you sure?', 'wp-simple-firewll' ),
75
+ 'really_reinstall' => __( 'Really Re-Install Plugin', 'wp-simple-firewll' ),
76
+ 'wp_reinstall' => __( 'WordPress will now download and install the latest available version of this plugin.', 'wp-simple-firewll' ),
77
+ 'in_case' => sprintf( '%s: %s',
78
+ __( 'Note', 'wp-simple-firewall' ),
79
+ __( 'In case of possible failure, it may be better to do this while the plugin is inactive.', 'wp-simple-firewll' )
80
+ ),
81
+ 'reinstall_first' => __( 'Re-install first?', 'wp-simple-firewall' ),
82
+ 'corrupted' => __( "This ensures files for this plugin haven't been corrupted in any way.", 'wp-simple-firewall' ),
83
+ 'choose' => __( "You can choose to 'Activate Only' (not recommended), or close this message to cancel activation.", 'wp-simple-firewall' ),
84
+ 'editing_restricted' => __( 'Editing this option is currently restricted.', 'wp-simple-firewall' ),
85
+ 'download' => sprintf(
86
+ __( 'For best security practices, %s will download and re-install the latest available version of this plugin.', 'wp-simple-firewall' ),
87
+ $scanCon->getCon()->getHumanName()
88
+ )
89
+ ],
90
+ 'js_snippets' => []
91
+ ] );
 
 
 
 
 
92
  }
93
  }
src/lib/src/Modules/HackGuard/Scan/Utilities/WpvAddPluginRows.php CHANGED
@@ -111,32 +111,27 @@ class WpvAddPluginRows {
111
  if ( $scanCon->hasVulnerabilities( $pluginFile ) ) {
112
  $name = $scanCon->getCon()->getHumanName();
113
  $plugin = Services::WpPlugins()->getPluginAsVo( $pluginFile );
114
- echo $scanCon->getMod()
115
- ->renderTemplate(
116
- '/snippets/plugin_vulnerability.twig',
117
- [
118
- 'strings' => [
119
- 'known_vuln' => sprintf(
120
- __( '%s has discovered that the currently installed version of the %s plugin has known security vulnerabilities.', 'wp-simple-firewall' ),
121
- $name, '<strong>'.$pData[ 'Name' ].'</strong>' ),
122
- 'more_info' => __( 'More Info', 'wp-simple-firewall' ),
123
- ],
124
- 'hrefs' => [
125
- 'vuln_lookup' => add_query_arg(
126
- [
127
- 'type' => $plugin->asset_type,
128
- 'slug' => $plugin->slug,
129
- 'version' => $plugin->Version,
130
- ],
131
- 'https://shsec.io/shieldvulnerabilitylookup'
132
- )
133
- ],
134
- 'vars' => [
135
- 'colspan' => $this->nColumnsCount
136
- ],
137
- ],
138
- true
139
- );
140
  }
141
  }
142
 
111
  if ( $scanCon->hasVulnerabilities( $pluginFile ) ) {
112
  $name = $scanCon->getCon()->getHumanName();
113
  $plugin = Services::WpPlugins()->getPluginAsVo( $pluginFile );
114
+ echo $scanCon->getMod()->renderTemplate( '/snippets/plugin_vulnerability.twig', [
115
+ 'strings' => [
116
+ 'known_vuln' => sprintf(
117
+ __( '%s has discovered that the currently installed version of the %s plugin has known security vulnerabilities.', 'wp-simple-firewall' ),
118
+ $name, '<strong>'.$pData[ 'Name' ].'</strong>' ),
119
+ 'more_info' => __( 'More Info', 'wp-simple-firewall' ),
120
+ ],
121
+ 'hrefs' => [
122
+ 'vuln_lookup' => add_query_arg(
123
+ [
124
+ 'type' => $plugin->asset_type,
125
+ 'slug' => $plugin->slug,
126
+ 'version' => $plugin->Version,
127
+ ],
128
+ 'https://shsec.io/shieldvulnerabilitylookup'
129
+ )
130
+ ],
131
+ 'vars' => [
132
+ 'colspan' => $this->nColumnsCount
133
+ ],
134
+ ] );
 
 
 
 
 
135
  }
136
  }
137
 
src/lib/src/Modules/IPs/Lib/AutoUnblock.php CHANGED
@@ -178,7 +178,7 @@ class AutoUnblock extends ExecOnceModConsumer {
178
  $user = Services::WpUsers()->getCurrentWpUser();
179
 
180
  $mod->getEmailProcessor()->sendEmailWithTemplate(
181
- '/email/uaum_init',
182
  $user->user_email,
183
  __( 'Automatic IP Unblock Request', 'wp-simple-firewall' ),
184
  [
178
  $user = Services::WpUsers()->getCurrentWpUser();
179
 
180
  $mod->getEmailProcessor()->sendEmailWithTemplate(
181
+ '/email/uaum_init.twig',
182
  $user->user_email,
183
  __( 'Automatic IP Unblock Request', 'wp-simple-firewall' ),
184
  [
src/lib/src/Modules/IPs/Lib/IpAnalyse/BuildDisplay.php CHANGED
@@ -39,30 +39,26 @@ class BuildDisplay {
39
  throw new \Exception( "A valid IP address wasn't provided." );
40
  }
41
 
42
- return $mod->renderTemplate(
43
- '/wpadmin_pages/insights/ips/ip_analyse/ip_info.twig',
44
- [
45
- 'strings' => [
46
- 'title' => sprintf( __( 'Info For IP Address %s', 'wp-simple-firewall' ), $ip ),
47
- 'nav_signals' => __( 'Bot Signals', 'wp-simple-firewall' ),
48
- 'nav_general' => __( 'General Info', 'wp-simple-firewall' ),
49
- 'nav_sessions' => __( 'User Sessions', 'wp-simple-firewall' ),
50
- 'nav_audit' => __( 'Activity Log', 'wp-simple-firewall' ),
51
- 'nav_traffic' => __( 'Recent Traffic', 'wp-simple-firewall' ),
52
- ],
53
- 'vars' => [
54
- 'ip' => $ip,
55
- ],
56
- 'content' => [
57
- 'general' => $this->renderForGeneral(),
58
- 'signals' => $this->renderForBotSignals(),
59
- 'sessions' => $this->renderForSessions(),
60
- 'audit_trail' => $this->renderForAuditTrail(),
61
- 'traffic' => $this->renderForTraffic(),
62
- ],
63
  ],
64
- true
65
- );
 
 
 
 
 
 
 
 
 
 
66
  }
67
 
68
  private function renderForGeneral() :string {
@@ -131,82 +127,78 @@ class BuildDisplay {
131
  ->setIP( $ip )
132
  ->retrieve()[ 'reputation_score' ] ?? '-';
133
 
134
- return $this->getMod()->renderTemplate(
135
- '/wpadmin_pages/insights/ips/ip_analyse/ip_general.twig',
136
- [
137
- 'strings' => [
138
- 'title_general' => __( 'Identifying Info', 'wp-simple-firewall' ),
139
- 'title_status' => __( 'IP Status', 'wp-simple-firewall' ),
140
-
141
- 'block_ip' => __( 'Block IP', 'wp-simple-firewall' ),
142
- 'unblock_ip' => __( 'Unblock IP', 'wp-simple-firewall' ),
143
- 'bypass_ip' => __( 'Add IP Bypass', 'wp-simple-firewall' ),
144
- 'unbypass_ip' => __( 'Remove IP Bypass', 'wp-simple-firewall' ),
145
- 'delete_notbot' => __( 'Reset For This IP', 'wp-simple-firewall' ),
146
- 'see_details' => __( 'See Details', 'wp-simple-firewall' ),
147
-
148
- 'status' => [
149
- 'is_you' => __( 'Is It You?', 'wp-simple-firewall' ),
150
- 'offenses' => __( 'Number of offenses', 'wp-simple-firewall' ),
151
- 'is_blocked' => __( 'Is Blocked', 'wp-simple-firewall' ),
152
- 'is_bypass' => __( 'Is Bypass IP', 'wp-simple-firewall' ),
153
- 'ip_reputation' => __( 'IP Reputation Score', 'wp-simple-firewall' ),
154
- 'snapi_ip_reputation' => __( 'ShieldNET IP Reputation Score', 'wp-simple-firewall' ),
155
- ],
156
-
157
- 'yes' => __( 'Yes', 'wp-simple-firewall' ),
158
- 'no' => __( 'No', 'wp-simple-firewall' ),
159
-
160
- 'identity' => [
161
- 'who_is_it' => __( 'Is this a known IP address?', 'wp-simple-firewall' ),
162
- 'rdns' => 'rDNS',
163
- 'country' => __( 'Country', 'wp-simple-firewall' ),
164
- 'timezone' => __( 'Timezone', 'wp-simple-firewall' ),
165
- 'coordinates' => __( 'Coordinates', 'wp-simple-firewall' ),
166
- ],
167
-
168
- 'extras' => [
169
- 'title' => __( 'Extras', 'wp-simple-firewall' ),
170
- 'ip_whois' => __( 'IP Whois', 'wp-simple-firewall' ),
171
- 'query_ip_whois' => __( 'Query IP Whois', 'wp-simple-firewall' ),
172
- ],
173
  ],
174
- 'hrefs' => [
175
- 'snapi_reputation_details' => add_query_arg(
176
- [ 'ip' => $ip ], 'https://shsec.io/botornot'
177
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  ],
179
- 'vars' => [
180
- 'ip' => $ip,
181
- 'status' => [
182
- 'is_you' => Services::IP()->checkIp( $ip, Services::IP()->getRequestIp() ),
183
- 'offenses' => !empty( $blockIP ) ? $blockIP->transgressions : 0,
184
- 'is_blocked' => !empty( $blockIP ) && $blockIP->blocked_at > 0,
185
- 'is_bypass' => !empty( $bypassIP ),
186
- 'ip_reputation_score' => $botScore,
187
- 'snapi_reputation_score' => is_numeric( $shieldNetScore ) ? $shieldNetScore : 'Unavailable',
188
- 'is_bot' => $isBot,
189
- ],
190
- 'identity' => [
191
- 'who_is_it' => $ipName,
192
- 'rdns' => $sRDNS === $ip ? __( 'Unavailable', 'wp-simple-firewall' ) : $sRDNS,
193
- 'country_name' => $geo->countryName ?? __( 'Unknown', 'wp-simple-firewall' ),
194
- 'timezone' => $geo->timeZone ?? __( 'Unknown', 'wp-simple-firewall' ),
195
- 'coordinates' => $geo->latitude ? sprintf( '%s: %s; %s: %s;',
196
- __( 'Latitude', 'wp-simple-firewall' ), $geo->latitude,
197
- __( 'Longitude', 'wp-simple-firewall' ), $geo->longitude )
198
- : __( 'Unknown', 'wp-simple-firewall' )
199
- ],
200
- 'extras' => [
201
- 'ip_whois' => sprintf( 'https://whois.domaintools.com/%s', $ip ),
202
- ],
203
  ],
204
- 'flags' => [
205
- 'has_geo' => !empty( $geo->getRawData() ),
206
  ],
207
  ],
208
- true
209
- );
210
  }
211
 
212
  private function renderForSessions() :string {
@@ -293,27 +285,23 @@ class BuildDisplay {
293
  $requests[ $key ] = $asArray;
294
  }
295
 
296
- return $this->getMod()->renderTemplate(
297
- '/wpadmin_pages/insights/ips/ip_analyse/ip_traffic.twig',
298
- [
299
- 'strings' => [
300
- 'title' => __( 'Visitor Requests', 'wp-simple-firewall' ),
301
- 'no_requests' => __( 'No requests logged for this IP', 'wp-simple-firewall' ),
302
- 'path' => __( 'Path', 'wp-simple-firewall' ),
303
- 'query' => __( 'Query', 'wp-simple-firewall' ),
304
- 'verb' => __( 'Verb', 'wp-simple-firewall' ),
305
- 'requested_at' => __( 'Requested At', 'wp-simple-firewall' ),
306
- 'response' => __( 'Response', 'wp-simple-firewall' ),
307
- 'http_code' => __( 'Code', 'wp-simple-firewall' ),
308
- 'offense' => __( 'Offense', 'wp-simple-firewall' ),
309
- ],
310
- 'vars' => [
311
- 'requests' => $requests,
312
- 'total_requests' => count( $requests ),
313
- ],
314
  ],
315
- true
316
- );
317
  }
318
 
319
  private function renderForBotSignals() :string {
@@ -355,37 +343,33 @@ class BuildDisplay {
355
  }
356
  }
357
 
358
- return $this->getMod()->renderTemplate(
359
- '/wpadmin_pages/insights/ips/ip_analyse/ip_botsignals.twig',
360
- [
361
- 'strings' => [
362
- 'title' => __( 'Bot Signals', 'wp-simple-firewall' ),
363
- 'signal' => __( 'Signal', 'wp-simple-firewall' ),
364
- 'score' => __( 'Score', 'wp-simple-firewall' ),
365
- 'total_score' => __( 'Total Reputation Score', 'wp-simple-firewall' ),
366
- 'when' => __( 'When', 'wp-simple-firewall' ),
367
- 'bot_probability' => __( 'Bad Bot Probability', 'wp-simple-firewall' ),
368
- 'botsignal_delete' => __( 'Delete All Bot Signals', 'wp-simple-firewall' ),
369
- 'signal_names' => $names,
370
- 'no_signals' => __( 'There are no bot signals for this IP address.', 'wp-simple-firewall' ),
371
- ],
372
- 'ajax' => [
373
- 'has_signals' => !empty( $signals ),
374
- ],
375
- 'flags' => [
376
- 'has_signals' => !empty( $signals ),
377
- ],
378
- 'vars' => [
379
- 'signals' => $signals,
380
- 'total_signals' => count( $signals ),
381
- 'scores' => $scores,
382
- 'total_score' => array_sum( $scores ),
383
- 'minimum' => array_sum( $scores ),
384
- 'probability' => 100 - (int)max( 0, min( 100, array_sum( $scores ) ) )
385
- ],
386
  ],
387
- true
388
- );
 
 
 
 
 
 
 
 
 
 
389
  }
390
 
391
  private function renderForAuditTrail() :string {
@@ -413,24 +397,20 @@ class BuildDisplay {
413
  }
414
  }
415
 
416
- return $this->getMod()->renderTemplate(
417
- '/wpadmin_pages/insights/ips/ip_analyse/ip_audittrail.twig',
418
- [
419
- 'strings' => [
420
- 'title' => __( 'Audit Log Entries', 'wp-simple-firewall' ),
421
- 'no_logs' => __( 'No logs at this IP', 'wp-simple-firewall' ),
422
- 'username' => __( 'Username', 'wp-simple-firewall' ),
423
- 'sec_admin' => __( 'Security Admin', 'wp-simple-firewall' ),
424
- 'event' => __( 'Event', 'wp-simple-firewall' ),
425
- 'created_at' => __( 'Logged At', 'wp-simple-firewall' ),
426
- ],
427
- 'vars' => [
428
- 'logs' => $logs,
429
- 'total_logs' => count( $logs ),
430
- ],
431
  ],
432
- true
433
- );
 
 
 
434
  }
435
 
436
  protected function getTimeAgo( int $ts ) :string {
39
  throw new \Exception( "A valid IP address wasn't provided." );
40
  }
41
 
42
+ return $mod->renderTemplate( '/wpadmin_pages/insights/ips/ip_analyse/ip_info.twig', [
43
+ 'content' => [
44
+ 'general' => $this->renderForGeneral(),
45
+ 'signals' => $this->renderForBotSignals(),
46
+ 'sessions' => $this->renderForSessions(),
47
+ 'audit_trail' => $this->renderForAuditTrail(),
48
+ 'traffic' => $this->renderForTraffic(),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  ],
50
+ 'strings' => [
51
+ 'title' => sprintf( __( 'Info For IP Address %s', 'wp-simple-firewall' ), $ip ),
52
+ 'nav_signals' => __( 'Bot Signals', 'wp-simple-firewall' ),
53
+ 'nav_general' => __( 'General Info', 'wp-simple-firewall' ),
54
+ 'nav_sessions' => __( 'User Sessions', 'wp-simple-firewall' ),
55
+ 'nav_audit' => __( 'Activity Log', 'wp-simple-firewall' ),
56
+ 'nav_traffic' => __( 'Recent Traffic', 'wp-simple-firewall' ),
57
+ ],
58
+ 'vars' => [
59
+ 'ip' => $ip,
60
+ ],
61
+ ] );
62
  }
63
 
64
  private function renderForGeneral() :string {
127
  ->setIP( $ip )
128
  ->retrieve()[ 'reputation_score' ] ?? '-';
129
 
130
+ return $this->getMod()->renderTemplate( '/wpadmin_pages/insights/ips/ip_analyse/ip_general.twig', [
131
+ 'flags' => [
132
+ 'has_geo' => !empty( $geo->getRawData() ),
133
+ ],
134
+ 'hrefs' => [
135
+ 'snapi_reputation_details' => add_query_arg(
136
+ [ 'ip' => $ip ], 'https://shsec.io/botornot'
137
+ )
138
+ ],
139
+ 'strings' => [
140
+ 'title_general' => __( 'Identifying Info', 'wp-simple-firewall' ),
141
+ 'title_status' => __( 'IP Status', 'wp-simple-firewall' ),
142
+
143
+ 'block_ip' => __( 'Block IP', 'wp-simple-firewall' ),
144
+ 'unblock_ip' => __( 'Unblock IP', 'wp-simple-firewall' ),
145
+ 'bypass_ip' => __( 'Add IP Bypass', 'wp-simple-firewall' ),
146
+ 'unbypass_ip' => __( 'Remove IP Bypass', 'wp-simple-firewall' ),
147
+ 'delete_notbot' => __( 'Reset For This IP', 'wp-simple-firewall' ),
148
+ 'see_details' => __( 'See Details', 'wp-simple-firewall' ),
149
+
150
+ 'status' => [
151
+ 'is_you' => __( 'Is It You?', 'wp-simple-firewall' ),
152
+ 'offenses' => __( 'Number of offenses', 'wp-simple-firewall' ),
153
+ 'is_blocked' => __( 'Is Blocked', 'wp-simple-firewall' ),
154
+ 'is_bypass' => __( 'Is Bypass IP', 'wp-simple-firewall' ),
155
+ 'ip_reputation' => __( 'IP Reputation Score', 'wp-simple-firewall' ),
156
+ 'snapi_ip_reputation' => __( 'ShieldNET IP Reputation Score', 'wp-simple-firewall' ),
 
 
 
 
 
 
 
 
 
 
 
 
157
  ],
158
+
159
+ 'yes' => __( 'Yes', 'wp-simple-firewall' ),
160
+ 'no' => __( 'No', 'wp-simple-firewall' ),
161
+
162
+ 'identity' => [
163
+ 'who_is_it' => __( 'Is this a known IP address?', 'wp-simple-firewall' ),
164
+ 'rdns' => 'rDNS',
165
+ 'country' => __( 'Country', 'wp-simple-firewall' ),
166
+ 'timezone' => __( 'Timezone', 'wp-simple-firewall' ),
167
+ 'coordinates' => __( 'Coordinates', 'wp-simple-firewall' ),
168
+ ],
169
+
170
+ 'extras' => [
171
+ 'title' => __( 'Extras', 'wp-simple-firewall' ),
172
+ 'ip_whois' => __( 'IP Whois', 'wp-simple-firewall' ),
173
+ 'query_ip_whois' => __( 'Query IP Whois', 'wp-simple-firewall' ),
174
+ ],
175
+ ],
176
+ 'vars' => [
177
+ 'ip' => $ip,
178
+ 'status' => [
179
+ 'is_you' => Services::IP()->checkIp( $ip, Services::IP()->getRequestIp() ),
180
+ 'offenses' => !empty( $blockIP ) ? $blockIP->transgressions : 0,
181
+ 'is_blocked' => !empty( $blockIP ) && $blockIP->blocked_at > 0,
182
+ 'is_bypass' => !empty( $bypassIP ),
183
+ 'ip_reputation_score' => $botScore,
184
+ 'snapi_reputation_score' => is_numeric( $shieldNetScore ) ? $shieldNetScore : 'Unavailable',
185
+ 'is_bot' => $isBot,
186
  ],
187
+ 'identity' => [
188
+ 'who_is_it' => $ipName,
189
+ 'rdns' => $sRDNS === $ip ? __( 'Unavailable', 'wp-simple-firewall' ) : $sRDNS,
190
+ 'country_name' => $geo->countryName ?? __( 'Unknown', 'wp-simple-firewall' ),
191
+ 'timezone' => $geo->timeZone ?? __( 'Unknown', 'wp-simple-firewall' ),
192
+ 'coordinates' => $geo->latitude ? sprintf( '%s: %s; %s: %s;',
193
+ __( 'Latitude', 'wp-simple-firewall' ), $geo->latitude,
194
+ __( 'Longitude', 'wp-simple-firewall' ), $geo->longitude )
195
+ : __( 'Unknown', 'wp-simple-firewall' )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  ],
197
+ 'extras' => [
198
+ 'ip_whois' => sprintf( 'https://whois.domaintools.com/%s', $ip ),
199
  ],
200
  ],
201
+ ] );
 
202
  }
203
 
204
  private function renderForSessions() :string {
285
  $requests[ $key ] = $asArray;
286
  }
287
 
288
+ return $this->getMod()->renderTemplate( '/wpadmin_pages/insights/ips/ip_analyse/ip_traffic.twig', [
289
+ 'strings' => [
290
+ 'title' => __( 'Visitor Requests', 'wp-simple-firewall' ),
291
+ 'no_requests' => __( 'No requests logged for this IP', 'wp-simple-firewall' ),
292
+ 'path' => __( 'Path', 'wp-simple-firewall' ),
293
+ 'query' => __( 'Query', 'wp-simple-firewall' ),
294
+ 'verb' => __( 'Verb', 'wp-simple-firewall' ),
295
+ 'requested_at' => __( 'Requested At', 'wp-simple-firewall' ),
296
+ 'response' => __( 'Response', 'wp-simple-firewall' ),
297
+ 'http_code' => __( 'Code', 'wp-simple-firewall' ),
298
+ 'offense' => __( 'Offense', 'wp-simple-firewall' ),
299
+ ],
300
+ 'vars' => [
301
+ 'requests' => $requests,
302
+ 'total_requests' => count( $requests ),
 
 
 
303
  ],
304
+ ] );
 
305
  }
306
 
307
  private function renderForBotSignals() :string {
343
  }
344
  }
345
 
346
+ return $this->getMod()->renderTemplate( '/wpadmin_pages/insights/ips/ip_analyse/ip_botsignals.twig', [
347
+ 'strings' => [
348
+ 'title' => __( 'Bot Signals', 'wp-simple-firewall' ),
349
+ 'signal' => __( 'Signal', 'wp-simple-firewall' ),
350
+ 'score' => __( 'Score', 'wp-simple-firewall' ),
351
+ 'total_score' => __( 'Total Reputation Score', 'wp-simple-firewall' ),
352
+ 'when' => __( 'When', 'wp-simple-firewall' ),
353
+ 'bot_probability' => __( 'Bad Bot Probability', 'wp-simple-firewall' ),
354
+ 'botsignal_delete' => __( 'Delete All Bot Signals', 'wp-simple-firewall' ),
355
+ 'signal_names' => $names,
356
+ 'no_signals' => __( 'There are no bot signals for this IP address.', 'wp-simple-firewall' ),
357
+ ],
358
+ 'ajax' => [
359
+ 'has_signals' => !empty( $signals ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  ],
361
+ 'flags' => [
362
+ 'has_signals' => !empty( $signals ),
363
+ ],
364
+ 'vars' => [
365
+ 'signals' => $signals,
366
+ 'total_signals' => count( $signals ),
367
+ 'scores' => $scores,
368
+ 'total_score' => array_sum( $scores ),
369
+ 'minimum' => array_sum( $scores ),
370
+ 'probability' => 100 - (int)max( 0, min( 100, array_sum( $scores ) ) )
371
+ ],
372
+ ] );
373
  }
374
 
375
  private function renderForAuditTrail() :string {
397
  }
398
  }
399
 
400
+ return $this->getMod()->renderTemplate( '/wpadmin_pages/insights/ips/ip_analyse/ip_audittrail.twig', [
401
+ 'strings' => [
402
+ 'title' => __( 'Audit Log Entries', 'wp-simple-firewall' ),
403
+ 'no_logs' => __( 'No logs at this IP', 'wp-simple-firewall' ),
404
+ 'username' => __( 'Username', 'wp-simple-firewall' ),
405
+ 'sec_admin' => __( 'Security Admin', 'wp-simple-firewall' ),
406
+ 'event' => __( 'Event', 'wp-simple-firewall' ),
407
+ 'created_at' => __( 'Logged At', 'wp-simple-firewall' ),
 
 
 
 
 
 
 
408
  ],
409
+ 'vars' => [
410
+ 'logs' => $logs,
411
+ 'total_logs' => count( $logs ),
412
+ ],
413
+ ] );
414
  }
415
 
416
  protected function getTimeAgo( int $ts ) :string {
src/lib/src/Modules/IPs/UI.php CHANGED
@@ -119,25 +119,21 @@ class UI extends BaseShield\UI {
119
 
120
  private function renderIpAnalyse() :string {
121
  $mod = $this->getMod();
122
- return $mod->renderTemplate(
123
- '/wpadmin_pages/insights/ips/ip_analyse/index.twig',
124
- [
125
- 'ajax' => [
126
- 'ip_analyse_build' => $mod->getAjaxActionData( 'ip_analyse_build', true ),
127
- 'ip_analyse_action' => $mod->getAjaxActionData( 'ip_analyse_action', true ),
128
- 'ip_review_select' => $mod->getAjaxActionData( 'ip_review_select', true ),
129
- ],
130
- 'strings' => [
131
- 'select_ip' => __( 'Select IP To Analyse', 'wp-simple-firewall' ),
132
- 'card_title' => 'IP Analysis',
133
- 'card_summary' => 'Investigate IP activity on this site',
134
- 'please_select' => 'Please select an IP address.',
135
- ],
136
- 'vars' => [
137
- 'unique_ips' => []
138
- ]
139
  ],
140
- true
141
- );
 
 
142
  }
143
  }
119
 
120
  private function renderIpAnalyse() :string {
121
  $mod = $this->getMod();
122
+ return $mod->renderTemplate( '/wpadmin_pages/insights/ips/ip_analyse/index.twig', [
123
+ 'ajax' => [
124
+ 'ip_analyse_build' => $mod->getAjaxActionData( 'ip_analyse_build', true ),
125
+ 'ip_analyse_action' => $mod->getAjaxActionData( 'ip_analyse_action', true ),
126
+ 'ip_review_select' => $mod->getAjaxActionData( 'ip_review_select', true ),
127
+ ],
128
+ 'strings' => [
129
+ 'select_ip' => __( 'Select IP To Analyse', 'wp-simple-firewall' ),
130
+ 'card_title' => 'IP Analysis',
131
+ 'card_summary' => 'Investigate IP activity on this site',
132
+ 'please_select' => 'Please select an IP address.',
 
 
 
 
 
 
133
  ],
134
+ 'vars' => [
135
+ 'unique_ips' => []
136
+ ]
137
+ ] );
138
  }
139
  }
src/lib/src/Modules/Insights/UI.php CHANGED
@@ -298,23 +298,19 @@ class UI extends BaseShield\UI {
298
  ksort( $events );
299
  }
300
 
301
- return $this->getMod()->renderTemplate(
302
- '/wpadmin_pages/insights/docs/events.twig',
303
- [
304
- 'vars' => [
305
- // the keys here must match the changelog item types
306
- 'event_defs' => $eventsSortedByLevel
307
- ],
308
- 'strings' => [
309
- // the keys here must match the changelog item types
310
- 'version' => __( 'Version', 'wp-simple-firewall' ),
311
- 'release_date' => __( 'Release Date', 'wp-simple-firewall' ),
312
- 'pro_only' => __( 'Pro Only', 'wp-simple-firewall' ),
313
- 'full_release' => __( 'Full Release Announcement', 'wp-simple-firewall' ),
314
- ],
315
  ],
316
- true
317
- );
 
 
 
 
 
 
318
  }
319
 
320
  private function renderTabUpdates() :string {
@@ -329,31 +325,26 @@ class UI extends BaseShield\UI {
329
  ->fromFile();
330
  }
331
 
332
- return $this->getMod()
333
- ->renderTemplate(
334
- '/wpadmin_pages/insights/overview/updates/index.twig',
335
- [
336
- 'vars' => [
337
- // the keys here must match the changelog item types
338
- 'badge_types' => [
339
- 'new' => 'primary',
340
- 'added' => 'light',
341
- 'improved' => 'info',
342
- 'changed' => 'warning',
343
- 'fixed' => 'danger',
344
- ]
345
- ],
346
- 'strings' => [
347
- // the keys here must match the changelog item types
348
- 'version' => __( 'Version', 'wp-simple-firewall' ),
349
- 'release_date' => __( 'Release Date', 'wp-simple-firewall' ),
350
- 'pro_only' => __( 'Pro Only', 'wp-simple-firewall' ),
351
- 'full_release' => __( 'Full Release Announcement', 'wp-simple-firewall' ),
352
- ],
353
- 'changelog' => $changelog
354
- ],
355
- true
356
- );
357
  }
358
 
359
  public function printAdminFooterItems() {
@@ -364,32 +355,26 @@ class UI extends BaseShield\UI {
364
  private function printGoProFooter() {
365
  $con = $this->getCon();
366
  $nav = Services::Request()->query( 'inav', 'overview' );
367
- echo $this->getMod()->renderTemplate(
368
- 'snippets/go_pro_banner.twig',
369
- [
370
- 'flags' => [
371
- 'show_promo' => $con->isModulePage()
372
- && !$con->isPremiumActive()
373
- && ( !in_array( $nav, [ 'scans_results', 'scans_run', 'wizard' ] ) ),
374
- ],
375
- 'hrefs' => [
376
- 'go_pro' => 'https://shsec.io/shieldgoprofeature',
377
- ]
378
  ]
379
- );
380
  }
381
 
382
  private function printToastTemplate() {
383
  if ( $this->getCon()->isModulePage() ) {
384
- echo $this->getMod()->renderTemplate(
385
- 'snippets/toaster.twig',
386
- [
387
- 'strings' => [
388
- 'title' => $this->getCon()->getHumanName(),
389
- ],
390
- 'js_snippets' => []
391
- ]
392
- );
393
  }
394
  }
395
  }
298
  ksort( $events );
299
  }
300
 
301
+ return $this->getMod()->renderTemplate( '/wpadmin_pages/insights/docs/events.twig', [
302
+ 'vars' => [
303
+ // the keys here must match the changelog item types
304
+ 'event_defs' => $eventsSortedByLevel
 
 
 
 
 
 
 
 
 
 
305
  ],
306
+ 'strings' => [
307
+ // the keys here must match the changelog item types
308
+ 'version' => __( 'Version', 'wp-simple-firewall' ),
309
+ 'release_date' => __( 'Release Date', 'wp-simple-firewall' ),
310
+ 'pro_only' => __( 'Pro Only', 'wp-simple-firewall' ),
311
+ 'full_release' => __( 'Full Release Announcement', 'wp-simple-firewall' ),
312
+ ],
313
+ ] );
314
  }
315
 
316
  private function renderTabUpdates() :string {
325
  ->fromFile();
326
  }
327
 
328
+ return $this->getMod()->renderTemplate( '/wpadmin_pages/insights/overview/updates/index.twig', [
329
+ 'changelog' => $changelog,
330
+ 'strings' => [
331
+ // the keys here must match the changelog item types
332
+ 'version' => __( 'Version', 'wp-simple-firewall' ),
333
+ 'release_date' => __( 'Release Date', 'wp-simple-firewall' ),
334
+ 'pro_only' => __( 'Pro Only', 'wp-simple-firewall' ),
335
+ 'full_release' => __( 'Full Release Announcement', 'wp-simple-firewall' ),
336
+ ],
337
+ 'vars' => [
338
+ // the keys here must match the changelog item types
339
+ 'badge_types' => [
340
+ 'new' => 'primary',
341
+ 'added' => 'light',
342
+ 'improved' => 'info',
343
+ 'changed' => 'warning',
344
+ 'fixed' => 'danger',
345
+ ]
346
+ ],
347
+ ] );
 
 
 
 
 
348
  }
349
 
350
  public function printAdminFooterItems() {
355
  private function printGoProFooter() {
356
  $con = $this->getCon();
357
  $nav = Services::Request()->query( 'inav', 'overview' );
358
+ echo $this->getMod()->renderTemplate( 'snippets/go_pro_banner.twig', [
359
+ 'flags' => [
360
+ 'show_promo' => $con->isModulePage()
361
+ && !$con->isPremiumActive()
362
+ && ( !in_array( $nav, [ 'scans_results', 'scans_run', 'wizard' ] ) ),
363
+ ],
364
+ 'hrefs' => [
365
+ 'go_pro' => 'https://shsec.io/shieldgoprofeature',
 
 
 
366
  ]
367
+ ] );
368
  }
369
 
370
  private function printToastTemplate() {
371
  if ( $this->getCon()->isModulePage() ) {
372
+ echo $this->getMod()->renderTemplate( 'snippets/toaster.twig', [
373
+ 'strings' => [
374
+ 'title' => $this->getCon()->getHumanName(),
375
+ ],
376
+ 'js_snippets' => []
377
+ ] );
 
 
 
378
  }
379
  }
380
  }
src/lib/src/Modules/Integrations/Lib/Bots/UserForms/Handlers/WordPress.php CHANGED
@@ -28,10 +28,10 @@ class WordPress extends Base {
28
  */
29
  public function checkLogin_WP( $userOrError, $username ) {
30
  if ( !is_wp_error( $userOrError ) || empty( $userOrError->get_error_codes() ) ) {
31
- $this->fireEventBlockLogin();
32
  $this->setAuditAction( 'login' )
33
  ->setAuditUser( $username );
34
  if ( $this->isBotBlockRequired() ) {
 
35
  $userOrError = new \WP_Error( 'shield-fail-login', $this->getErrorMessage() );
36
  remove_filter( 'authenticate', 'wp_authenticate_username_password', 20 ); // wp-includes/user.php
37
  remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 ); // wp-includes/user.php
@@ -46,7 +46,6 @@ class WordPress extends Base {
46
  */
47
  public function checkLostPassword_WP( $wpError = null, $user = false ) {
48
  if ( is_wp_error( $wpError ) && empty( $wpError->get_error_codes() ) ) {
49
- $this->fireEventBlockLostpassword();
50
  $this->setAuditAction( 'lostpassword' );
51
  if ( $user instanceof \WP_User ) {
52
  $this->setAuditUser( $user->user_login );
@@ -55,6 +54,7 @@ class WordPress extends Base {
55
  $this->setAuditUser( sanitize_user( Services::Request()->post( 'user_login', '' ) ) );
56
  }
57
  if ( $this->isBotBlockRequired() ) {
 
58
  $wpError->add( 'shield-fail-lostpassword', $this->getErrorMessage() );
59
  }
60
  }
@@ -67,10 +67,10 @@ class WordPress extends Base {
67
  */
68
  public function checkRegister_WP( $wpError, $username ) {
69
  if ( !is_wp_error( $wpError ) || empty( $wpError->get_error_codes() ) ) {
70
- $this->fireEventBlockRegister();
71
  $this->setAuditAction( 'register' )
72
  ->setAuditUser( $username );
73
  if ( $this->isBotBlockRequired() ) {
 
74
  $wpError = new \WP_Error( 'shield-fail-login', $this->getErrorMessage() );
75
  }
76
  }
28
  */
29
  public function checkLogin_WP( $userOrError, $username ) {
30
  if ( !is_wp_error( $userOrError ) || empty( $userOrError->get_error_codes() ) ) {
 
31
  $this->setAuditAction( 'login' )
32
  ->setAuditUser( $username );
33
  if ( $this->isBotBlockRequired() ) {
34
+ $this->fireEventBlockLogin();
35
  $userOrError = new \WP_Error( 'shield-fail-login', $this->getErrorMessage() );
36
  remove_filter( 'authenticate', 'wp_authenticate_username_password', 20 ); // wp-includes/user.php
37
  remove_filter( 'authenticate', 'wp_authenticate_email_password', 20 ); // wp-includes/user.php
46
  */
47
  public function checkLostPassword_WP( $wpError = null, $user = false ) {
48
  if ( is_wp_error( $wpError ) && empty( $wpError->get_error_codes() ) ) {
 
49
  $this->setAuditAction( 'lostpassword' );
50
  if ( $user instanceof \WP_User ) {
51
  $this->setAuditUser( $user->user_login );
54
  $this->setAuditUser( sanitize_user( Services::Request()->post( 'user_login', '' ) ) );
55
  }
56
  if ( $this->isBotBlockRequired() ) {
57
+ $this->fireEventBlockLostpassword();
58
  $wpError->add( 'shield-fail-lostpassword', $this->getErrorMessage() );
59
  }
60
  }
67
  */
68
  public function checkRegister_WP( $wpError, $username ) {
69
  if ( !is_wp_error( $wpError ) || empty( $wpError->get_error_codes() ) ) {
 
70
  $this->setAuditAction( 'register' )
71
  ->setAuditUser( $username );
72
  if ( $this->isBotBlockRequired() ) {
73
+ $this->fireEventBlockRegister();
74
  $wpError = new \WP_Error( 'shield-fail-login', $this->getErrorMessage() );
75
  }
76
  }
src/lib/src/Modules/Integrations/Lib/MainWP/Server/UI/ExtensionSettingsPage.php CHANGED
@@ -80,28 +80,23 @@ class ExtensionSettingsPage extends ExecOnceModConsumer {
80
  }
81
 
82
  try {
83
- echo $this->getMod()
84
- ->renderTemplate(
85
- '/integration/mainwp/page_extension.twig',
86
- [
87
- 'content' => [
88
- 'mainwp_header' => $mainwpHeader,
89
- 'mainwp_footer' => $mainwpFooter,
90
- 'page_inner' => $pageRenderer->setMod( $this->getMod() )->render(),
91
- ],
92
- 'vars' => [
93
- 'submenu' => [
94
- [
95
- 'title' => 'Sites',
96
- 'href' => add_query_arg( [ 'tab' => 'sites' ], $req->getUri() ),
97
- 'icon' => 'globe',
98
- 'active' => $currentTab === 'sites',
99
- ]
100
- ],
101
- ]
102
- ],
103
- true
104
- );
105
  }
106
  catch ( \Exception $e ) {
107
  var_dump( $e->getMessage() );
80
  }
81
 
82
  try {
83
+ echo $this->getMod()->renderTemplate( '/integration/mainwp/page_extension.twig', [
84
+ 'content' => [
85
+ 'mainwp_header' => $mainwpHeader,
86
+ 'mainwp_footer' => $mainwpFooter,
87
+ 'page_inner' => $pageRenderer->setMod( $this->getMod() )->render(),
88
+ ],
89
+ 'vars' => [
90
+ 'submenu' => [
91
+ [
92
+ 'title' => 'Sites',
93
+ 'href' => add_query_arg( [ 'tab' => 'sites' ], $req->getUri() ),
94
+ 'icon' => 'globe',
95
+ 'active' => $currentTab === 'sites',
96
+ ]
97
+ ],
98
+ ]
99
+ ] );
 
 
 
 
 
100
  }
101
  catch ( \Exception $e ) {
102
  var_dump( $e->getMessage() );
src/lib/src/Modules/LoginGuard/Lib/AntiBot/ProtectionProviders/GaspJs.php CHANGED
@@ -109,14 +109,11 @@ class GaspJs extends BaseProtectionProvider {
109
  * @inheritDoc
110
  */
111
  public function buildFormInsert( $formProvider ) {
112
- return $this->getMod()->renderTemplate(
113
- '/snippets/anti_bot/gasp_js.twig',
114
- [
115
- 'strings' => [
116
- 'loading' => __( 'Loading', 'wp-simple-firewall' )
117
- ]
118
  ]
119
- );
120
  }
121
 
122
  protected function isFactorJsRequired() :bool {
109
  * @inheritDoc
110
  */
111
  public function buildFormInsert( $formProvider ) {
112
+ return $this->getMod()->renderTemplate( '/snippets/anti_bot/gasp_js.twig', [
113
+ 'strings' => [
114
+ 'loading' => __( 'Loading', 'wp-simple-firewall' )
 
 
 
115
  ]
116
+ ] );
117
  }
118
 
119
  protected function isFactorJsRequired() :bool {
src/lib/src/Modules/LoginGuard/Lib/TwoFactor/MfaProfilesController.php CHANGED
@@ -180,10 +180,6 @@ class MfaProfilesController extends Shield\Modules\Base\Common\ExecOnceModConsum
180
  'is_admin_profile' => $isAdmin,
181
  'can_remove' => $con->isPluginAdmin() || !$isAdmin,
182
  ],
183
- 'vars' => [
184
- 'user_id' => $user->ID,
185
- 'mfa_factor_names' => $providers,
186
- ],
187
  'strings' => [
188
  'title' => __( 'Multi-Factor Authentication', 'wp-simple-firewall' ),
189
  'provided_by' => sprintf( __( 'Provided by %s', 'wp-simple-firewall' ), $pluginName ),
@@ -197,6 +193,10 @@ class MfaProfilesController extends Shield\Modules\Base\Common\ExecOnceModConsum
197
  'authenticate' => sprintf( __( 'You may authenticate with the %s Security Admin system and return here.' ),
198
  $pluginName ),
199
  ],
 
 
 
 
200
  ] );
201
  }
202
  }
180
  'is_admin_profile' => $isAdmin,
181
  'can_remove' => $con->isPluginAdmin() || !$isAdmin,
182
  ],
 
 
 
 
183
  'strings' => [
184
  'title' => __( 'Multi-Factor Authentication', 'wp-simple-firewall' ),
185
  'provided_by' => sprintf( __( 'Provided by %s', 'wp-simple-firewall' ), $pluginName ),
193
  'authenticate' => sprintf( __( 'You may authenticate with the %s Security Admin system and return here.' ),
194
  $pluginName ),
195
  ],
196
+ 'vars' => [
197
+ 'user_id' => $user->ID,
198
+ 'mfa_factor_names' => $providers,
199
+ ],
200
  ] );
201
  }
202
  }
src/lib/src/Modules/LoginGuard/Lib/TwoFactor/Provider/BaseProvider.php CHANGED
@@ -149,11 +149,8 @@ abstract class BaseProvider {
149
  $this->getProviderSpecificRenderData()
150
  );
151
  $data[ 'flags' ][ 'show_explanatory_text' ] = false;
152
- return $this->getMod()
153
- ->renderTemplate(
154
- sprintf( '/user/profile/mfa/provider_%s.twig', static::SLUG ),
155
- $data
156
- );
157
  }
158
 
159
  protected function getProviderSpecificRenderData() :array {
149
  $this->getProviderSpecificRenderData()
150
  );
151
  $data[ 'flags' ][ 'show_explanatory_text' ] = false;
152
+
153
+ return $this->getMod()->renderTemplate( sprintf( '/user/profile/mfa/provider_%s.twig', static::SLUG ), $data );
 
 
 
154
  }
155
 
156
  protected function getProviderSpecificRenderData() :array {
src/lib/src/Modules/LoginGuard/Lib/TwoFactor/Provider/Email.php CHANGED
@@ -84,7 +84,7 @@ class Email extends BaseProvider {
84
  || $this->getMod()
85
  ->getEmailProcessor()
86
  ->sendEmailWithTemplate(
87
- '/email/lp_2fa_email_code',
88
  $user->user_email,
89
  __( 'Two-Factor Login Verification', 'wp-simple-firewall' ),
90
  [
84
  || $this->getMod()
85
  ->getEmailProcessor()
86
  ->sendEmailWithTemplate(
87
+ '/email/lp_2fa_email_code.twig',
88
  $user->user_email,
89
  __( 'Two-Factor Login Verification', 'wp-simple-firewall' ),
90
  [
src/lib/src/Modules/LoginGuard/Lib/TwoFactor/Render/RenderLoginIntentPage.php CHANGED
@@ -81,8 +81,7 @@ class RenderLoginIntentPage extends RenderBase {
81
  $msg .= sprintf( ' [<a href="%s" target="_blank">%s</a>]', 'https://shsec.io/shieldcantaccess', __( 'More Info', 'wp-simple-firewall' ) );
82
  }
83
 
84
- return $mod->renderTemplate(
85
- '/components/login_intent/form.twig',
86
  Services::DataManipulation()->mergeArraysRecursive(
87
  $mod->getUIHandler()->getBaseDisplayData(),
88
  $this->getCommonFormData(),
@@ -94,8 +93,6 @@ class RenderLoginIntentPage extends RenderBase {
94
  'message_type' => 'info',
95
  ],
96
  ]
97
- ),
98
- true
99
- );
100
  }
101
  }
81
  $msg .= sprintf( ' [<a href="%s" target="_blank">%s</a>]', 'https://shsec.io/shieldcantaccess', __( 'More Info', 'wp-simple-firewall' ) );
82
  }
83
 
84
+ return $mod->renderTemplate( '/components/login_intent/form.twig',
 
85
  Services::DataManipulation()->mergeArraysRecursive(
86
  $mod->getUIHandler()->getBaseDisplayData(),
87
  $this->getCommonFormData(),
93
  'message_type' => 'info',
94
  ],
95
  ]
96
+ ) );
 
 
97
  }
98
  }
src/lib/src/Modules/Plugin/Components/PluginBadge.php CHANGED
@@ -94,30 +94,26 @@ class PluginBadge extends Modules\Base\Common\ExecOnceModConsumer {
94
  $badgeAttrs = apply_filters( 'icwp_shield_plugin_badge_attributes', $badgeAttrs, $isFloating );
95
  }
96
 
97
- return $mod->renderTemplate(
98
- 'snippets/plugin_badge_widget',
99
- [
100
- 'ajax' => [
101
- 'plugin_badge_close' => $mod->getAjaxActionData( 'plugin_badge_close', true ),
102
- ],
103
- 'content' => [
104
- 'custom_css' => esc_js( $badgeAttrs[ 'custom_css' ] ),
105
- ],
106
- 'flags' => [
107
- 'nofollow' => apply_filters( 'icwp_shield_badge_relnofollow', false ),
108
- 'is_floating' => $isFloating
109
- ],
110
- 'hrefs' => [
111
- 'badge' => $badgeAttrs[ 'url' ],
112
- 'logo' => $badgeAttrs[ 'logo' ],
113
- ],
114
- 'strings' => [
115
- 'protected' => $badgeAttrs[ 'protected_by' ],
116
- 'name' => $badgeAttrs[ 'name' ],
117
- ],
118
  ],
119
- true
120
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  }
122
 
123
  public function setBadgeStateClosed() :bool {
94
  $badgeAttrs = apply_filters( 'icwp_shield_plugin_badge_attributes', $badgeAttrs, $isFloating );
95
  }
96
 
97
+ return $mod->renderTemplate( 'snippets/plugin_badge_widget.twig', [
98
+ 'ajax' => [
99
+ 'plugin_badge_close' => $mod->getAjaxActionData( 'plugin_badge_close', true ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
100
  ],
101
+ 'content' => [
102
+ 'custom_css' => esc_js( $badgeAttrs[ 'custom_css' ] ),
103
+ ],
104
+ 'flags' => [
105
+ 'nofollow' => apply_filters( 'icwp_shield_badge_relnofollow', false ),
106
+ 'is_floating' => $isFloating
107
+ ],
108
+ 'hrefs' => [
109
+ 'badge' => $badgeAttrs[ 'url' ],
110
+ 'logo' => $badgeAttrs[ 'logo' ],
111
+ ],
112
+ 'strings' => [
113
+ 'protected' => $badgeAttrs[ 'protected_by' ],
114
+ 'name' => $badgeAttrs[ 'name' ],
115
+ ],
116
+ ] );
117
  }
118
 
119
  public function setBadgeStateClosed() :bool {
src/lib/src/Modules/Plugin/Insights/AdminNotes.php CHANGED
@@ -10,18 +10,12 @@ class AdminNotes {
10
  use ModConsumer;
11
 
12
  public function render() :string {
13
- return $this->getMod()
14
- ->renderTemplate(
15
- '/wpadmin_pages/insights/notes/admin_notes.twig',
16
- $this->buildData(),
17
- true
18
- );
19
  }
20
 
21
  private function buildData() :array {
22
  /** @var ModCon $mod */
23
  $mod = $this->getMod();
24
-
25
  return [
26
  'ajax' => [
27
  'render_table_adminnotes' => $mod->getAjaxActionData( 'render_table_adminnotes', true ),
10
  use ModConsumer;
11
 
12
  public function render() :string {
13
+ return $this->getMod()->renderTemplate( '/wpadmin_pages/insights/notes/admin_notes.twig', $this->buildData() );
 
 
 
 
 
14
  }
15
 
16
  private function buildData() :array {
17
  /** @var ModCon $mod */
18
  $mod = $this->getMod();
 
19
  return [
20
  'ajax' => [
21
  'render_table_adminnotes' => $mod->getAjaxActionData( 'render_table_adminnotes', true ),
src/lib/src/Modules/Plugin/Lib/Debug/RecentEvents.php CHANGED
@@ -12,20 +12,15 @@ class RecentEvents {
12
 
13
  public function build() :string {
14
  $con = $this->getCon();
15
- return $this->getMod()
16
- ->renderTemplate(
17
- '/wpadmin_pages/insights/overview/recent_events.twig',
18
- [
19
- 'vars' => [
20
- 'insight_events' => $this->getData()
21
- ],
22
- 'strings' => [
23
- 'title_recent' => __( 'Recent Events Log', 'wp-simple-firewall' ),
24
- 'box_receve_subtitle' => sprintf( __( 'Some of the most recent %s events', 'wp-simple-firewall' ), $con->getHumanName() ),
25
- ]
26
- ],
27
- true
28
- );
29
  }
30
 
31
  private function getData() :array {
12
 
13
  public function build() :string {
14
  $con = $this->getCon();
15
+ return $this->getMod()->renderTemplate( '/wpadmin_pages/insights/overview/recent_events.twig', [
16
+ 'strings' => [
17
+ 'title_recent' => __( 'Recent Events Log', 'wp-simple-firewall' ),
18
+ 'box_receve_subtitle' => sprintf( __( 'Some of the most recent %s events', 'wp-simple-firewall' ), $con->getHumanName() ),
19
+ ],
20
+ 'vars' => [
21
+ 'insight_events' => $this->getData()
22
+ ],
23
+ ] );
 
 
 
 
 
24
  }
25
 
26
  private function getData() :array {
src/lib/src/Modules/Reporting/Lib/ReportingController.php CHANGED
@@ -134,7 +134,7 @@ class ReportingController extends Modules\Base\Common\ExecOnceModConsumer {
134
  $this->getMod()
135
  ->getEmailProcessor()
136
  ->sendEmailWithTemplate(
137
- '/email/reports/cron_alert_info_report',
138
  $this->getMod()->getPluginReportEmail(),
139
  __( 'Site Report', 'wp-simple-firewall' ).' - '.$this->getCon()->getHumanName(),
140
  [
134
  $this->getMod()
135
  ->getEmailProcessor()
136
  ->sendEmailWithTemplate(
137
+ '/email/reports/cron_alert_info_report.twig',
138
  $this->getMod()->getPluginReportEmail(),
139
  __( 'Site Report', 'wp-simple-firewall' ).' - '.$this->getCon()->getHumanName(),
140
  [
src/lib/src/Modules/Reporting/Lib/Reports/Build/BuilderAlerts.php CHANGED
@@ -27,17 +27,14 @@ class BuilderAlerts extends BaseBuilder {
27
  }
28
 
29
  protected function render( array $gathered ) :string {
30
- return $this->getMod()->renderTemplate(
31
- '/components/reports/alert_body.twig',
32
- [
33
- 'vars' => [
34
- 'alerts' => $gathered
35
- ],
36
- 'strings' => [
37
- 'title' => __( 'Important Alerts', 'wp-simple-firewall' ),
38
- 'subtitle' => __( 'The following is a collection of the latest alerts since your previous report.', 'wp-simple-firewall' ),
39
- ],
40
- ]
41
- );
42
  }
43
  }
27
  }
28
 
29
  protected function render( array $gathered ) :string {
30
+ return $this->getMod()->renderTemplate( '/components/reports/alert_body.twig', [
31
+ 'vars' => [
32
+ 'alerts' => $gathered
33
+ ],
34
+ 'strings' => [
35
+ 'title' => __( 'Important Alerts', 'wp-simple-firewall' ),
36
+ 'subtitle' => __( 'The following is a collection of the latest alerts since your previous report.', 'wp-simple-firewall' ),
37
+ ],
38
+ ] );
 
 
 
39
  }
40
  }
src/lib/src/Modules/Reporting/Lib/Reports/Build/BuilderInfo.php CHANGED
@@ -26,20 +26,17 @@ class BuilderInfo extends BaseBuilder {
26
  }
27
 
28
  protected function render( array $gathered ) :string {
29
- return $this->getMod()->renderTemplate(
30
- '/components/reports/info_body.twig',
31
- [
32
- 'vars' => [
33
- 'alerts' => $gathered
34
- ],
35
- 'strings' => [
36
- 'title' => __( 'Site Information Report', 'wp-simple-firewall' ),
37
- 'subtitle' => __( 'The following is a collection of the latest information based on your reporting settings.', 'wp-simple-firewall' ),
38
- 'dates_below' => __( 'Information is for the following time period.', 'wp-simple-firewall' ),
39
- 'reporting_period' => __( 'Reporting Period', 'wp-simple-firewall' ),
40
- 'time_interval' => $this->getTimeIntervalForDisplay(),
41
- ],
42
- ]
43
- );
44
  }
45
  }
26
  }
27
 
28
  protected function render( array $gathered ) :string {
29
+ return $this->getMod()->renderTemplate( '/components/reports/info_body.twig', [
30
+ 'strings' => [
31
+ 'title' => __( 'Site Information Report', 'wp-simple-firewall' ),
32
+ 'subtitle' => __( 'The following is a collection of the latest information based on your reporting settings.', 'wp-simple-firewall' ),
33
+ 'dates_below' => __( 'Information is for the following time period.', 'wp-simple-firewall' ),
34
+ 'reporting_period' => __( 'Reporting Period', 'wp-simple-firewall' ),
35
+ 'time_interval' => $this->getTimeIntervalForDisplay(),
36
+ ],
37
+ 'vars' => [
38
+ 'alerts' => $gathered
39
+ ],
40
+ ] );
 
 
 
41
  }
42
  }
src/lib/src/Modules/Reporting/UI.php CHANGED
@@ -11,31 +11,26 @@ class UI extends BaseShield\UI {
11
  public function renderSectionCustomChart() :string {
12
  /** @var ModCon $mod */
13
  $mod = $this->getMod();
14
- return $this->getMod()
15
- ->renderTemplate(
16
- '/wpadmin_pages/insights/reports/charts_custom.twig',
17
- [
18
- 'ajax' => [
19
- 'render_custom_chart' => $mod->getAjaxActionData( 'render_custom_chart', true ),
20
- ],
21
- 'strings' => [
22
- 'select_events' => __( 'Events', 'wp-simple-firewall' ),
23
- 'select_interval' => __( 'Interval', 'wp-simple-firewall' ),
24
- 'build_chart' => __( 'Build Chart', 'wp-simple-firewall' ),
25
- ],
26
- 'vars' => [
27
- 'events' => $this->buildPossibleEvents(),
28
- 'interval' => [
29
- 'hourly' => __( 'Hourly', 'wp-simple-firewall' ),
30
- 'daily' => __( 'Daily', 'wp-simple-firewall' ),
31
- 'weekly' => __( 'Weekly', 'wp-simple-firewall' ),
32
- 'monthly' => __( 'Monthly', 'wp-simple-firewall' ),
33
- 'yearly' => __( 'Yearly', 'wp-simple-firewall' ),
34
- ],
35
- ],
36
- ],
37
- true
38
- );
39
  }
40
 
41
  /**
@@ -124,19 +119,14 @@ class UI extends BaseShield\UI {
124
 
125
  /** @var ModCon $mod */
126
  $mod = $this->getMod();
127
- return $this->getMod()
128
- ->renderTemplate(
129
- '/wpadmin_pages/insights/reports/charts_summary.twig',
130
- [
131
- 'ajax' => [
132
- 'render_summary_chart' => $mod->getAjaxActionData( 'render_summary_chart', true ),
133
- ],
134
- 'vars' => [
135
- 'stats' => $statsData,
136
- ],
137
- ],
138
- true
139
- );
140
  }
141
 
142
  public function buildInsightsVars() :array {
11
  public function renderSectionCustomChart() :string {
12
  /** @var ModCon $mod */
13
  $mod = $this->getMod();
14
+ return $mod->renderTemplate( '/wpadmin_pages/insights/reports/charts_custom.twig', [
15
+ 'ajax' => [
16
+ 'render_custom_chart' => $mod->getAjaxActionData( 'render_custom_chart', true ),
17
+ ],
18
+ 'strings' => [
19
+ 'select_events' => __( 'Events', 'wp-simple-firewall' ),
20
+ 'select_interval' => __( 'Interval', 'wp-simple-firewall' ),
21
+ 'build_chart' => __( 'Build Chart', 'wp-simple-firewall' ),
22
+ ],
23
+ 'vars' => [
24
+ 'events' => $this->buildPossibleEvents(),
25
+ 'interval' => [
26
+ 'hourly' => __( 'Hourly', 'wp-simple-firewall' ),
27
+ 'daily' => __( 'Daily', 'wp-simple-firewall' ),
28
+ 'weekly' => __( 'Weekly', 'wp-simple-firewall' ),
29
+ 'monthly' => __( 'Monthly', 'wp-simple-firewall' ),
30
+ 'yearly' => __( 'Yearly', 'wp-simple-firewall' ),
31
+ ],
32
+ ],
33
+ ] );
 
 
 
 
 
34
  }
35
 
36
  /**
119
 
120
  /** @var ModCon $mod */
121
  $mod = $this->getMod();
122
+ return $mod->renderTemplate( '/wpadmin_pages/insights/reports/charts_summary.twig', [
123
+ 'ajax' => [
124
+ 'render_summary_chart' => $mod->getAjaxActionData( 'render_summary_chart', true ),
125
+ ],
126
+ 'vars' => [
127
+ 'stats' => $statsData,
128
+ ],
129
+ ] );
 
 
 
 
 
130
  }
131
 
132
  public function buildInsightsVars() :array {
src/lib/src/Modules/Traffic/UI.php CHANGED
@@ -13,29 +13,24 @@ class UI extends BaseShield\UI {
13
  $mod = $this->getMod();
14
  /** @var Options $opts */
15
  $opts = $this->getOptions();
16
-
17
- return $mod->renderTemplate(
18
- '/wpadmin_pages/insights/traffic/traffic_table.twig',
19
- [
20
- 'ajax' => [
21
- 'traffictable_action' => $mod->getAjaxActionData( 'traffictable_action', true ),
22
- ],
23
- 'flags' => [
24
- 'is_enabled' => $opts->isTrafficLoggerEnabled(),
25
- ],
26
- 'hrefs' => [
27
- 'please_enable' => $mod->getUrl_DirectLinkToOption( 'enable_logger' ),
28
- ],
29
- 'strings' => [
30
- ],
31
- 'vars' => [
32
- 'datatables_init' => ( new ForTraffic() )
33
- ->setMod( $this->getMod() )
34
- ->build()
35
- ],
36
  ],
37
- true
38
- );
39
  }
40
 
41
  public function getSectionWarnings( string $section ) :array {
13
  $mod = $this->getMod();
14
  /** @var Options $opts */
15
  $opts = $this->getOptions();
16
+ return $mod->renderTemplate( '/wpadmin_pages/insights/traffic/traffic_table.twig', [
17
+ 'ajax' => [
18
+ 'traffictable_action' => $mod->getAjaxActionData( 'traffictable_action', true ),
19
+ ],
20
+ 'flags' => [
21
+ 'is_enabled' => $opts->isTrafficLoggerEnabled(),
22
+ ],
23
+ 'hrefs' => [
24
+ 'please_enable' => $mod->getUrl_DirectLinkToOption( 'enable_logger' ),
25
+ ],
26
+ 'strings' => [
27
+ ],
28
+ 'vars' => [
29
+ 'datatables_init' => ( new ForTraffic() )
30
+ ->setMod( $this->getMod() )
31
+ ->build()
 
 
 
 
32
  ],
33
+ ] );
 
34
  }
35
 
36
  public function getSectionWarnings( string $section ) :array {
src/lib/src/Modules/UserManagement/Lib/Suspend/UserSuspendController.php CHANGED
@@ -200,7 +200,7 @@ class UserSuspendController extends ExecOnceModConsumer {
200
  'vars' => [
201
  'form_field' => 'shield_suspend_user',
202
  ]
203
- ], true );
204
  }
205
 
206
  public function handleUserSuspendOptionSubmit( int $uid ) {
200
  'vars' => [
201
  'form_field' => 'shield_suspend_user',
202
  ]
203
+ ] );
204
  }
205
 
206
  public function handleUserSuspendOptionSubmit( int $uid ) {
src/lib/src/Utilities/ReCaptcha/Enqueue.php CHANGED
@@ -63,24 +63,20 @@ class Enqueue {
63
  * @throws \Exception
64
  */
65
  public function maybeDequeueRecaptcha() {
66
- /** @var ModCon $oMod */
67
- $oMod = $this->getMod();
68
- $oCFG = $oMod->getCaptchaCfg();
69
 
70
  if ( $this->bEnqueue ) {
71
- echo $oMod->renderTemplate(
72
- 'snippets/google_recaptcha_js',
73
- [
74
- 'sitekey' => $oCFG->key,
75
- 'size' => $oCFG->invisible ? 'invisible' : '',
76
- 'theme' => $oCFG->theme,
77
- 'invis' => $oCFG->invisible,
78
- ]
79
-
80
- );
81
  }
82
  else {
83
- wp_dequeue_script( $oCFG->js_handle );
84
  }
85
  }
86
 
63
  * @throws \Exception
64
  */
65
  public function maybeDequeueRecaptcha() {
66
+ /** @var ModCon $mod */
67
+ $mod = $this->getMod();
68
+ $cfg = $mod->getCaptchaCfg();
69
 
70
  if ( $this->bEnqueue ) {
71
+ echo $mod->renderTemplate( 'snippets/anti_bot/google_recaptcha_js.twig', [
72
+ 'sitekey' => $cfg->key,
73
+ 'size' => $cfg->invisible ? 'invisible' : '',
74
+ 'theme' => $cfg->theme,
75
+ 'invis' => $cfg->invisible,
76
+ ] );
 
 
 
 
77
  }
78
  else {
79
+ wp_dequeue_script( $cfg->js_handle );
80
  }
81
  }
82
 
src/wizards/base.php CHANGED
@@ -101,12 +101,10 @@ abstract class ICWP_WPSF_Wizard_Base {
101
  */
102
  public function renderWizardLandingPage() {
103
  try {
104
- $content = $this->getMod()
105
- ->renderTemplate(
106
- 'wizard/pages/landing.twig',
107
- $this->getRenderData_PageWizardLanding(),
108
- true
109
- );
110
  }
111
  catch ( \Exception $e ) {
112
  $content = $e->getMessage();
@@ -119,12 +117,10 @@ abstract class ICWP_WPSF_Wizard_Base {
119
  */
120
  public function renderWizardLandingSnippet() {
121
  try {
122
- $content = $this->getMod()
123
- ->renderTemplate(
124
- 'wizard/snippets/wizard_landing.twig',
125
- $this->getRenderData_PageWizardLanding(),
126
- true
127
- );
128
  }
129
  catch ( \Exception $e ) {
130
  $content = $e->getMessage();
@@ -246,8 +242,7 @@ abstract class ICWP_WPSF_Wizard_Base {
246
  */
247
  public function renderWizard() {
248
  remove_all_actions( 'wp_footer' ); // FIX: nextgen gallery forces this to run.
249
- return $this->getMod()
250
- ->renderTemplate( 'wizard/wizard_container.twig', $this->getRenderData_PageWizard(), true );
251
  }
252
 
253
  /**
@@ -455,24 +450,22 @@ abstract class ICWP_WPSF_Wizard_Base {
455
  }
456
 
457
  /**
458
- * @param string $sSlug
459
  * @return string
460
  * @throws Exception
461
  */
462
- protected function renderWizardStep( $sSlug ) {
463
 
464
- $sTemplateSlug = $sSlug;
465
- if ( strpos( $sSlug, '/' ) === false ) {
466
- $sBase = $this->isSlideCommon( $sSlug ) ? 'common' : $this->getWizardSlug();
467
- $sTemplateSlug = sprintf( '%s/%s', $sBase, $sSlug );
468
  }
469
 
470
- return $this->getMod()
471
- ->renderTemplate(
472
- sprintf( 'wizard/slides/%s.twig', $sTemplateSlug ),
473
- $this->getRenderData_Slide( $sSlug ),
474
- true
475
- );
476
  }
477
 
478
  /**
101
  */
102
  public function renderWizardLandingPage() {
103
  try {
104
+ $content = $this->getMod()->renderTemplate(
105
+ 'wizard/pages/landing.twig',
106
+ $this->getRenderData_PageWizardLanding()
107
+ );
 
 
108
  }
109
  catch ( \Exception $e ) {
110
  $content = $e->getMessage();
117
  */
118
  public function renderWizardLandingSnippet() {
119
  try {
120
+ $content = $this->getMod()->renderTemplate(
121
+ 'wizard/snippets/wizard_landing.twig',
122
+ $this->getRenderData_PageWizardLanding()
123
+ );
 
 
124
  }
125
  catch ( \Exception $e ) {
126
  $content = $e->getMessage();
242
  */
243
  public function renderWizard() {
244
  remove_all_actions( 'wp_footer' ); // FIX: nextgen gallery forces this to run.
245
+ return $this->getMod()->renderTemplate( 'wizard/wizard_container.twig', $this->getRenderData_PageWizard() );
 
246
  }
247
 
248
  /**
450
  }
451
 
452
  /**
453
+ * @param string $slug
454
  * @return string
455
  * @throws Exception
456
  */
457
+ protected function renderWizardStep( $slug ) {
458
 
459
+ $template = $slug;
460
+ if ( strpos( $slug, '/' ) === false ) {
461
+ $base = $this->isSlideCommon( $slug ) ? 'common' : $this->getWizardSlug();
462
+ $template = sprintf( '%s/%s', $base, $slug );
463
  }
464
 
465
+ return $this->getMod()->renderTemplate(
466
+ sprintf( 'wizard/slides/%s.twig', $template ),
467
+ $this->getRenderData_Slide( $slug )
468
+ );
 
 
469
  }
470
 
471
  /**
templates/twig/snippets/anti_bot/google_recaptcha_js.twig ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <script type="text/javascript">
2
+
3
+ var iCWP_WPSF_Recaptcha = new function () {
4
+
5
+ let isInvisible = {{ invis ? 'true' : 'false' }};
6
+
7
+ this.setupForm = function ( theForm ) {
8
+
9
+ let recaptchaContainer = theForm.querySelector( '.icwpg-recaptcha' );
10
+
11
+ if ( recaptchaContainer !== null ) {
12
+
13
+ let recaptchaContainerSpec = grecaptcha.render(
14
+ recaptchaContainer,
15
+ {
16
+ 'sitekey': '{{ sitekey }}',
17
+ 'size': '{{ size }}',
18
+ 'theme': '{{ theme }}',
19
+ 'badge': 'bottomright',
20
+ 'callback': function ( reCaptchaToken ) {
21
+ {% if invis %}
22
+ HTMLFormElement.prototype.submit.call( theForm );
23
+ {% endif %}
24
+ },
25
+ 'expired-callback': function () {
26
+ grecaptcha.reset( recaptchaContainerSpec );
27
+ }
28
+ }
29
+ );
30
+
31
+ {% if invis %}
32
+ let submitInputs = theForm.querySelectorAll( 'input, button' );
33
+ for ( var i = 0; i < submitInputs.length; i++ ) {
34
+ if ( submitInputs[ i ].type.toLowerCase() === 'submit' ) {
35
+ submitInputs[ i ].onclick = function ( event ) {
36
+ event.preventDefault();
37
+ grecaptcha.execute( recaptchaContainerSpec );
38
+ };
39
+ }
40
+ }
41
+ {% endif %}
42
+ }
43
+ };
44
+
45
+ this.initialise = function () {
46
+ if ( grecaptcha !== undefined ) {
47
+ for ( var i = 0; i < document.forms.length; i++ ) {
48
+ this.setupForm( document.forms[ i ] );
49
+ }
50
+ /**
51
+ * For some crazy reason invisible recaptcha badge attaches to div with this class.
52
+ * Fortunately removing the class at this stage doesn't interrupt normal behaviour.
53
+ */
54
+ if ( isInvisible ) {
55
+ document.querySelector( 'form' ).classList.remove( 'shake' );
56
+ }
57
+ }
58
+ };
59
+ }();
60
+
61
+ var onLoadIcwpRecaptchaCallback = function () {
62
+ iCWP_WPSF_Recaptcha.initialise();
63
+ };
64
+ </script>
templates/twig/snippets/plugin_badge_widget.twig CHANGED
@@ -1,4 +1,4 @@
1
- <style type="text/css">
2
  .icwp_wpsf_site_badge {
3
  background-color: rgba(255, 255, 255, 0.9);
4
  box-sizing: content-box;
1
+ <style>
2
  .icwp_wpsf_site_badge {
3
  background-color: rgba(255, 255, 255, 0.9);
4
  box-sizing: content-box;