Shield Security for WordPress - Version 13.0.2

Version Description

Download this release

Release Info

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

Code changes from version 13.0.1 to 13.0.2

Files changed (31) hide show
  1. cl.json +18 -0
  2. config/plugin.json +0 -5
  3. icwp-wpsf.php +1 -1
  4. plugin-spec.php +3 -3
  5. plugin.json +3 -3
  6. readme.txt +1 -1
  7. src/lib/src/Controller/Controller.php +25 -13
  8. src/lib/src/Modules/Base/ModCon.php +13 -12
  9. src/lib/src/Modules/Base/Options.php +1 -2
  10. src/lib/src/Modules/HackGuard/DB/ScanItems/Ops/Record.php +6 -1
  11. src/lib/src/Modules/Plugin/Lib/Debug/Collate.php +10 -4
  12. src/lib/src/Modules/Plugin/ModCon.php +5 -5
  13. src/lib/src/Modules/Plugin/Strings.php +0 -5
  14. src/lib/src/Scans/Afs/BuildScanAction.php +1 -3
  15. src/lib/src/Scans/Afs/BuildScanItems.php +8 -1
  16. src/lib/src/Scans/Afs/FileScanner.php +4 -2
  17. src/lib/vendor/composer/ClassLoader.php +109 -14
  18. src/lib/vendor/composer/autoload_classmap.php +1 -0
  19. src/lib/vendor/composer/autoload_static.php +1 -0
  20. src/lib/vendor/fernleafsystems/utilities/src/Data/Adapter/DynProperties.php +1 -5
  21. src/lib/vendor/fernleafsystems/utilities/src/Data/Adapter/DynamicProperties.php +0 -2
  22. src/lib/vendor/fernleafsystems/utilities/src/Data/Adapter/StdClassAdapter.php +0 -2
  23. src/lib/vendor/fernleafsystems/utilities/src/Data/Response/StdResponse.php +0 -2
  24. src/lib/vendor/fernleafsystems/utilities/src/Logic/OneTimeExecute.php +0 -4
  25. src/lib/vendor/fernleafsystems/utilities/src/Response.php +0 -4
  26. src/lib/vendor/fernleafsystems/wordpress-plugin-core/src/Databases/Base/Handler.php +8 -7
  27. src/lib/vendor/fernleafsystems/wordpress-services/src/Utilities/Data.php +30 -60
  28. src/lib/vendor/fernleafsystems/wordpress-services/src/Utilities/Encrypt/OpenSslEncrypt.php +31 -21
  29. src/lib/vendor/fernleafsystems/wordpress-services/src/Utilities/Encrypt/OpenSslEncryptVo.php +0 -2
  30. src/lib/vendor/fernleafsystems/wordpress-services/src/Utilities/File/Paths.php +26 -0
  31. templates/twig/admin/user/profile/mfa/mfa_ga.twig +22 -21
cl.json CHANGED
@@ -105,6 +105,24 @@
105
  "title": "Automatic selection of IP addresses in IP Analyse tool after switching to AJAX source.",
106
  "description": [],
107
  "patch": "13.0.1"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
109
  ]
110
  },
105
  "title": "Automatic selection of IP addresses in IP Analyse tool after switching to AJAX source.",
106
  "description": [],
107
  "patch": "13.0.1"
108
+ },
109
+ {
110
+ "type": "fixed",
111
+ "title": "Ensure database states are handled correctly.",
112
+ "description": [],
113
+ "patch": "13.0.2"
114
+ },
115
+ {
116
+ "type": "fixed",
117
+ "title": "MySQL requirements are checked more flexibly.",
118
+ "description": [],
119
+ "patch": "13.0.2"
120
+ },
121
+ {
122
+ "type": "fixed",
123
+ "title": "Add a class to Google Authenticator QR image.",
124
+ "description": [],
125
+ "patch": "13.0.2"
126
  }
127
  ]
128
  },
config/plugin.json CHANGED
@@ -107,11 +107,6 @@
107
  "title_short": "Import / Export",
108
  "beacon_id": 129
109
  },
110
- {
111
- "slug": "section_integrations",
112
- "title": "Integrations",
113
- "title_short": "Integrations"
114
- },
115
  {
116
  "slug": "section_global_security_options",
117
  "title": "Global Plugin Security Options",
107
  "title_short": "Import / Export",
108
  "beacon_id": 129
109
  },
 
 
 
 
 
110
  {
111
  "slug": "section_global_security_options",
112
  "title": "Global Plugin Security Options",
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: 13.0.1
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: 13.0.2
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": "13.0.1",
4
- "release_timestamp": 1636972249,
5
- "build": "202111.1502",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
1
  {
2
  "properties": {
3
+ "version": "13.0.2",
4
+ "release_timestamp": 1639995603,
5
+ "build": "202112.2001",
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": "13.0.1",
4
- "release_timestamp": 1636972249,
5
- "build": "202111.1502",
6
  "slug_parent": "icwp",
7
  "slug_plugin": "wpsf",
8
  "human_name": "Shield Security",
1
  {
2
  "properties": {
3
+ "version": "13.0.2",
4
+ "release_timestamp": 1639995603,
5
+ "build": "202112.2001",
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: 5.8
11
- Stable tag: 13.0.1
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: 5.8
11
+ Stable tag: 13.0.2
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/Controller/Controller.php CHANGED
@@ -9,8 +9,6 @@ use FernleafSystems\Wordpress\Services\Services;
9
  use FernleafSystems\Wordpress\Services\Utilities\Options\Transient;
10
 
11
  /**
12
- * Class Controller
13
- * @package FernleafSystems\Wordpress\Plugin\Shield\Controller
14
  * @property Config\ConfigVO $cfg
15
  * @property Shield\Controller\Assets\Urls $urls
16
  * @property Shield\Controller\Assets\Paths $paths
@@ -220,7 +218,11 @@ class Controller extends DynPropertiesClass {
220
  * @throws \Exception
221
  */
222
  private function checkMinimumRequirements() {
223
- if ( is_admin() ) {
 
 
 
 
224
  $reqsMsg = [];
225
 
226
  $minPHP = $this->cfg->requirements[ 'php' ];
@@ -245,15 +247,29 @@ class Controller extends DynPropertiesClass {
245
  add_action( 'network_admin_notices', [ $this, 'adminNoticeDoesNotMeetRequirements' ] );
246
  throw new \Exception( 'Plugin does not meet minimum requirements' );
247
  }
 
 
248
  }
249
  }
250
 
251
  private function isMysqlVersionSupported( string $versionToSupport ) :bool {
252
  $mysqlInfo = Services::WpDb()->getMysqlServerInfo();
253
- return empty( $versionToSupport )
254
- || empty( $mysqlInfo )
255
- || ( stripos( $mysqlInfo, 'MariaDB' ) !== false )
256
- || version_compare( preg_replace( '/[^0-9.].*/', '', $mysqlInfo ), $versionToSupport, '>=' );
 
 
 
 
 
 
 
 
 
 
 
 
257
  }
258
 
259
  public function adminNoticeDoesNotMeetRequirements() {
@@ -641,10 +657,11 @@ class Controller extends DynPropertiesClass {
641
  if ( !empty( $updates->response ) && isset( $updates->response[ $file ] ) ) {
642
  $reqs = $this->cfg->upgrade_reqs;
643
  if ( is_array( $reqs ) ) {
 
644
  foreach ( $reqs as $shieldVer => $verReqs ) {
645
  $toHide = version_compare( $updates->response[ $file ]->new_version, $shieldVer, '>=' )
646
  && (
647
- !Services::Data()->getPhpVersionIsAtLeast( $verReqs[ 'php' ] )
648
  || !Services::WpGeneral()->getWordpressIsAtLeastVersion( $verReqs[ 'wp' ] )
649
  || ( !empty( $verReqs[ 'mysql' ] ) && !$this->isMysqlVersionSupported( $verReqs[ 'mysql' ] ) )
650
  );
@@ -1295,11 +1312,6 @@ class Controller extends DynPropertiesClass {
1295
  $modProps[ 'namespace' ] = str_replace( ' ', '', ucwords( str_replace( '_', ' ', $modSlug ) ) );
1296
  }
1297
 
1298
- if ( !empty( $modProps[ 'min_php' ] )
1299
- && !Services::Data()->getPhpVersionIsAtLeast( $modProps[ 'min_php' ] ) ) {
1300
- return null;
1301
- }
1302
-
1303
  $modName = $modProps[ 'namespace' ];
1304
 
1305
  $className = $this->getModulesNamespace().sprintf( '\\%s\\ModCon', $modName );
9
  use FernleafSystems\Wordpress\Services\Utilities\Options\Transient;
10
 
11
  /**
 
 
12
  * @property Config\ConfigVO $cfg
13
  * @property Shield\Controller\Assets\Urls $urls
14
  * @property Shield\Controller\Assets\Paths $paths
218
  * @throws \Exception
219
  */
220
  private function checkMinimumRequirements() {
221
+ $FS = Services::WpFs();
222
+
223
+ $flag = $this->paths->forFlag( 'reqs_met.flag' );
224
+ if ( !$FS->isFile( $flag )
225
+ || Services::Request()->carbon()->subDays( 1 )->timestamp > $FS->getModifiedTime( $flag ) ) {
226
  $reqsMsg = [];
227
 
228
  $minPHP = $this->cfg->requirements[ 'php' ];
247
  add_action( 'network_admin_notices', [ $this, 'adminNoticeDoesNotMeetRequirements' ] );
248
  throw new \Exception( 'Plugin does not meet minimum requirements' );
249
  }
250
+
251
+ $FS->touch( $this->paths->forFlag( 'reqs_met.flag' ) );
252
  }
253
  }
254
 
255
  private function isMysqlVersionSupported( string $versionToSupport ) :bool {
256
  $mysqlInfo = Services::WpDb()->getMysqlServerInfo();
257
+ $supported = empty( $versionToSupport )
258
+ || empty( $mysqlInfo )
259
+ || ( stripos( $mysqlInfo, 'MariaDB' ) !== false )
260
+ || version_compare( preg_replace( '/[^0-9.].*/', '', $mysqlInfo ), $versionToSupport, '>=' );
261
+ if ( !$supported ) {
262
+ $miscFunctions = Services::WpDb()->selectCustom( "HELP miscellaneous_functions" );
263
+ if ( !empty( $miscFunctions ) && is_array( $miscFunctions ) ) {
264
+ foreach ( $miscFunctions as $func ) {
265
+ if ( strtoupper( $func[ 'name' ] ?? '' ) === 'INET6_ATON' ) {
266
+ $supported = true;
267
+ break;
268
+ }
269
+ }
270
+ }
271
+ }
272
+ return $supported;
273
  }
274
 
275
  public function adminNoticeDoesNotMeetRequirements() {
657
  if ( !empty( $updates->response ) && isset( $updates->response[ $file ] ) ) {
658
  $reqs = $this->cfg->upgrade_reqs;
659
  if ( is_array( $reqs ) ) {
660
+ $DP = Services::Data();
661
  foreach ( $reqs as $shieldVer => $verReqs ) {
662
  $toHide = version_compare( $updates->response[ $file ]->new_version, $shieldVer, '>=' )
663
  && (
664
+ !$DP->getPhpVersionIsAtLeast( (string)$verReqs[ 'php' ] )
665
  || !Services::WpGeneral()->getWordpressIsAtLeastVersion( $verReqs[ 'wp' ] )
666
  || ( !empty( $verReqs[ 'mysql' ] ) && !$this->isMysqlVersionSupported( $verReqs[ 'mysql' ] ) )
667
  );
1312
  $modProps[ 'namespace' ] = str_replace( ' ', '', ucwords( str_replace( '_', ' ', $modSlug ) ) );
1313
  }
1314
 
 
 
 
 
 
1315
  $modName = $modProps[ 'namespace' ];
1316
 
1317
  $className = $this->getModulesNamespace().sprintf( '\\%s\\ModCon', $modName );
src/lib/src/Modules/Base/ModCon.php CHANGED
@@ -225,27 +225,28 @@ abstract class ModCon {
225
  }
226
 
227
  private function verifyModuleMeetRequirements() :bool {
228
- $bMeetsReqs = true;
229
 
230
- $aPhpReqs = $this->getOptions()->getFeatureRequirement( 'php' );
231
- if ( !empty( $aPhpReqs ) ) {
232
 
233
- if ( !empty( $aPhpReqs[ 'version' ] ) ) {
234
- $bMeetsReqs = $bMeetsReqs && Services::Data()->getPhpVersionIsAtLeast( $aPhpReqs[ 'version' ] );
235
  }
236
- if ( !empty( $aPhpReqs[ 'functions' ] ) && is_array( $aPhpReqs[ 'functions' ] ) ) {
237
- foreach ( $aPhpReqs[ 'functions' ] as $sFunction ) {
238
- $bMeetsReqs = $bMeetsReqs && function_exists( $sFunction );
 
239
  }
240
  }
241
- if ( !empty( $aPhpReqs[ 'constants' ] ) && is_array( $aPhpReqs[ 'constants' ] ) ) {
242
- foreach ( $aPhpReqs[ 'constants' ] as $sConstant ) {
243
- $bMeetsReqs = $bMeetsReqs && defined( $sConstant );
244
  }
245
  }
246
  }
247
 
248
- return $bMeetsReqs;
249
  }
250
 
251
  protected function onModulesLoaded() {
225
  }
226
 
227
  private function verifyModuleMeetRequirements() :bool {
228
+ $meetReqs = true;
229
 
230
+ $reqPHP = $this->getOptions()->getFeatureRequirement( 'php' );
231
+ if ( !empty( $reqPHP ) ) {
232
 
233
+ if ( !empty( $reqPHP[ 'version' ] ) ) {
234
+ $meetReqs = Services::Data()->getPhpVersionIsAtLeast( $reqPHP[ 'version' ] );
235
  }
236
+
237
+ if ( !empty( $reqPHP[ 'functions' ] ) && is_array( $reqPHP[ 'functions' ] ) ) {
238
+ foreach ( $reqPHP[ 'functions' ] as $func ) {
239
+ $meetReqs = $meetReqs && function_exists( $func );
240
  }
241
  }
242
+ if ( !empty( $reqPHP[ 'constants' ] ) && is_array( $reqPHP[ 'constants' ] ) ) {
243
+ foreach ( $reqPHP[ 'constants' ] as $sConstant ) {
244
+ $meetReqs = $meetReqs && defined( $sConstant );
245
  }
246
  }
247
  }
248
 
249
+ return $meetReqs;
250
  }
251
 
252
  protected function onModulesLoaded() {
src/lib/src/Modules/Base/Options.php CHANGED
@@ -273,9 +273,8 @@ class Options {
273
 
274
  /**
275
  * @param string $slug
276
- * @return array
277
  */
278
- public function getSection_Requirements( $slug ) {
279
  $section = $this->getSection( $slug );
280
  return array_merge(
281
  [
273
 
274
  /**
275
  * @param string $slug
 
276
  */
277
+ public function getSection_Requirements( $slug ) :array {
278
  $section = $this->getSection( $slug );
279
  return array_merge(
280
  [
src/lib/src/Modules/HackGuard/DB/ScanItems/Ops/Record.php CHANGED
@@ -52,7 +52,12 @@ class Record extends \FernleafSystems\Wordpress\Plugin\Core\Databases\Base\Recor
52
  if ( !is_array( $value ) ) {
53
  $value = [];
54
  }
55
- $value = base64_encode( json_encode( $value ) );
 
 
 
 
 
56
  break;
57
 
58
  default:
52
  if ( !is_array( $value ) ) {
53
  $value = [];
54
  }
55
+ $json = json_encode( $value );
56
+ if ( !is_string( $json ) ) {
57
+ $json = json_encode( [] );
58
+ error_log( 'problem encoding json for: '.var_export( $value, true ) );
59
+ }
60
+ $value = base64_encode( $json );
61
  break;
62
 
63
  default:
src/lib/src/Modules/Plugin/Lib/Debug/Collate.php CHANGED
@@ -11,10 +11,6 @@ use FernleafSystems\Wordpress\Services\Services;
11
  use FernleafSystems\Wordpress\Services\Utilities\Integrations\WpHashes\ApiPing;
12
  use FernleafSystems\Wordpress\Services\Utilities\Licenses;
13
 
14
- /**
15
- * Class Collate
16
- * @package FernleafSystems\Wordpress\Plugin\Shield\Modules\Plugin\Lib\Debug
17
- */
18
  class Collate {
19
 
20
  use ModConsumer;
@@ -42,6 +38,9 @@ class Collate {
42
  sprintf( 'Inactive Plugins (%s)', count( $pluginsInactive ) ) => $pluginsInactive,
43
  sprintf( 'Active Themes (%s)', count( $themes ) ) => $themes,
44
  ],
 
 
 
45
  ];
46
  }
47
 
@@ -267,6 +266,13 @@ class Collate {
267
  return $data;
268
  }
269
 
 
 
 
 
 
 
 
270
  private function getWordPressSummary() :array {
271
  $WP = Services::WpGeneral();
272
  $data = [
11
  use FernleafSystems\Wordpress\Services\Utilities\Integrations\WpHashes\ApiPing;
12
  use FernleafSystems\Wordpress\Services\Utilities\Licenses;
13
 
 
 
 
 
14
  class Collate {
15
 
16
  use ModConsumer;
38
  sprintf( 'Inactive Plugins (%s)', count( $pluginsInactive ) ) => $pluginsInactive,
39
  sprintf( 'Active Themes (%s)', count( $themes ) ) => $themes,
40
  ],
41
+ 'Service IPs' => [
42
+ 'Summary' => $this->getServiceIPs(),
43
+ ],
44
  ];
45
  }
46
 
266
  return $data;
267
  }
268
 
269
+ private function getServiceIPs() :array {
270
+ return [
271
+ 'ips'=>var_export(Services::ServiceProviders()::GetProviderIPs(),true),
272
+
273
+ ];
274
+ }
275
+
276
  private function getWordPressSummary() :array {
277
  $WP = Services::WpGeneral();
278
  $data = [
src/lib/src/Modules/Plugin/ModCon.php CHANGED
@@ -231,14 +231,14 @@ class ModCon extends BaseShield\ModCon {
231
  public function getOpenSslPrivateKey() {
232
  $opts = $this->getOptions();
233
  $key = null;
234
- $oEnc = Services::Encrypt();
235
- if ( $oEnc->isSupportedOpenSslDataEncryption() ) {
236
  $key = $opts->getOpt( 'openssl_private_key' );
237
  if ( empty( $key ) ) {
238
  try {
239
- $aKeys = $oEnc->createNewPrivatePublicKeyPair();
240
- if ( !empty( $aKeys[ 'private' ] ) ) {
241
- $key = $aKeys[ 'private' ];
242
  $opts->setOpt( 'openssl_private_key', base64_encode( $key ) );
243
  $this->saveModOptions();
244
  }
231
  public function getOpenSslPrivateKey() {
232
  $opts = $this->getOptions();
233
  $key = null;
234
+ $srvEnc = Services::Encrypt();
235
+ if ( $srvEnc->isSupportedOpenSslDataEncryption() ) {
236
  $key = $opts->getOpt( 'openssl_private_key' );
237
  if ( empty( $key ) ) {
238
  try {
239
+ $keys = $srvEnc->createNewPrivatePublicKeyPair();
240
+ if ( !empty( $keys[ 'private' ] ) ) {
241
+ $key = $keys[ 'private' ];
242
  $opts->setOpt( 'openssl_private_key', base64_encode( $key ) );
243
  $this->saveModOptions();
244
  }
src/lib/src/Modules/Plugin/Strings.php CHANGED
@@ -164,11 +164,6 @@ class Strings extends Base\Strings {
164
  $titleShort = __( 'General Options', 'wp-simple-firewall' );
165
  break;
166
 
167
- case 'section_integrations' :
168
- $title = __( '3rd Party Integrations', 'wp-simple-firewall' );
169
- $titleShort = __( 'Integrations', 'wp-simple-firewall' );
170
- break;
171
-
172
  case 'section_third_party_captcha' :
173
  $title = __( 'CAPTCHA', 'wp-simple-firewall' );
174
  $titleShort = __( 'CAPTCHA', 'wp-simple-firewall' );
164
  $titleShort = __( 'General Options', 'wp-simple-firewall' );
165
  break;
166
 
 
 
 
 
 
167
  case 'section_third_party_captcha' :
168
  $title = __( 'CAPTCHA', 'wp-simple-firewall' );
169
  $titleShort = __( 'CAPTCHA', 'wp-simple-firewall' );
src/lib/src/Scans/Afs/BuildScanAction.php CHANGED
@@ -8,12 +8,10 @@ use FernleafSystems\Wordpress\Plugin\Shield\Scans\Base;
8
  class BuildScanAction extends Base\BuildScanAction {
9
 
10
  protected function buildItems() {
11
- $items = ( new BuildScanItems() )
12
  ->setMod( $this->getScanController()->getMod() )
13
  ->setScanActionVO( $this->getScanActionVO() )
14
  ->run();
15
- asort( $items );
16
- $this->getScanActionVO()->items = $items;
17
  }
18
 
19
  protected function setCustomFields() {
8
  class BuildScanAction extends Base\BuildScanAction {
9
 
10
  protected function buildItems() {
11
+ $this->getScanActionVO()->items = ( new BuildScanItems() )
12
  ->setMod( $this->getScanController()->getMod() )
13
  ->setScanActionVO( $this->getScanActionVO() )
14
  ->run();
 
 
15
  }
16
 
17
  protected function setCustomFields() {
src/lib/src/Scans/Afs/BuildScanItems.php CHANGED
@@ -13,12 +13,19 @@ class BuildScanItems extends BaseBuildFileMap {
13
  */
14
  public function build() :array {
15
  $this->preBuild();
 
16
  $files = array_unique( array_merge(
17
  $this->buildFilesFromDisk(),
18
  $this->buildFilesFromWpHashes()
19
  ) );
20
  natsort( $files );
21
- return $files;
 
 
 
 
 
 
22
  }
23
 
24
  private function buildFilesFromWpHashes() :array {
13
  */
14
  public function build() :array {
15
  $this->preBuild();
16
+
17
  $files = array_unique( array_merge(
18
  $this->buildFilesFromDisk(),
19
  $this->buildFilesFromWpHashes()
20
  ) );
21
  natsort( $files );
22
+
23
+ return array_map(
24
+ function ( $path ) {
25
+ return base64_encode( $path );
26
+ },
27
+ $files
28
+ );
29
  }
30
 
31
  private function buildFilesFromWpHashes() :array {
src/lib/src/Scans/Afs/FileScanner.php CHANGED
@@ -3,9 +3,9 @@
3
  namespace FernleafSystems\Wordpress\Plugin\Shield\Scans\Afs;
4
 
5
  use FernleafSystems\Wordpress\Plugin\Shield;
6
- use FernleafSystems\Wordpress\Plugin\Shield\Scans\Afs as AfsScan;
7
- use FernleafSystems\Wordpress\Plugin\Shield\Modules\HackGuard\Scan\Controller\Afs as AfsCon;
8
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\HackGuard\Lib;
 
 
9
 
10
  class FileScanner {
11
 
@@ -24,6 +24,8 @@ class FileScanner {
24
 
25
  $item = null;
26
 
 
 
27
  $validFile = false;
28
  try {
29
  $validFile =
3
  namespace FernleafSystems\Wordpress\Plugin\Shield\Scans\Afs;
4
 
5
  use FernleafSystems\Wordpress\Plugin\Shield;
 
 
6
  use FernleafSystems\Wordpress\Plugin\Shield\Modules\HackGuard\Lib;
7
+ use FernleafSystems\Wordpress\Plugin\Shield\Modules\HackGuard\Scan\Controller\Afs as AfsCon;
8
+ use FernleafSystems\Wordpress\Plugin\Shield\Scans\Afs as AfsScan;
9
 
10
  class FileScanner {
11
 
24
 
25
  $item = null;
26
 
27
+ $fullPath = base64_decode( $fullPath );
28
+
29
  $validFile = false;
30
  try {
31
  $validFile =
src/lib/vendor/composer/ClassLoader.php CHANGED
@@ -42,30 +42,75 @@ namespace Composer\Autoload;
42
  */
43
  class ClassLoader
44
  {
 
45
  private $vendorDir;
46
 
47
  // PSR-4
 
 
 
 
48
  private $prefixLengthsPsr4 = array();
 
 
 
 
49
  private $prefixDirsPsr4 = array();
 
 
 
 
50
  private $fallbackDirsPsr4 = array();
51
 
52
  // PSR-0
 
 
 
 
53
  private $prefixesPsr0 = array();
 
 
 
 
54
  private $fallbackDirsPsr0 = array();
55
 
 
56
  private $useIncludePath = false;
 
 
 
 
 
57
  private $classMap = array();
 
 
58
  private $classMapAuthoritative = false;
 
 
 
 
 
59
  private $missingClasses = array();
 
 
60
  private $apcuPrefix;
61
 
 
 
 
62
  private static $registeredLoaders = array();
63
 
 
 
 
64
  public function __construct($vendorDir = null)
65
  {
66
  $this->vendorDir = $vendorDir;
67
  }
68
 
 
 
 
69
  public function getPrefixes()
70
  {
71
  if (!empty($this->prefixesPsr0)) {
@@ -75,28 +120,47 @@ class ClassLoader
75
  return array();
76
  }
77
 
 
 
 
 
78
  public function getPrefixesPsr4()
79
  {
80
  return $this->prefixDirsPsr4;
81
  }
82
 
 
 
 
 
83
  public function getFallbackDirs()
84
  {
85
  return $this->fallbackDirsPsr0;
86
  }
87
 
 
 
 
 
88
  public function getFallbackDirsPsr4()
89
  {
90
  return $this->fallbackDirsPsr4;
91
  }
92
 
 
 
 
 
93
  public function getClassMap()
94
  {
95
  return $this->classMap;
96
  }
97
 
98
  /**
99
- * @param array $classMap Class to filename map
 
 
 
100
  */
101
  public function addClassMap(array $classMap)
102
  {
@@ -111,9 +175,11 @@ class ClassLoader
111
  * Registers a set of PSR-0 directories for a given prefix, either
112
  * appending or prepending to the ones previously set for this prefix.
113
  *
114
- * @param string $prefix The prefix
115
- * @param array|string $paths The PSR-0 root directories
116
- * @param bool $prepend Whether to prepend the directories
 
 
117
  */
118
  public function add($prefix, $paths, $prepend = false)
119
  {
@@ -156,11 +222,13 @@ class ClassLoader
156
  * Registers a set of PSR-4 directories for a given namespace, either
157
  * appending or prepending to the ones previously set for this namespace.
158
  *
159
- * @param string $prefix The prefix/namespace, with trailing '\\'
160
- * @param array|string $paths The PSR-4 base directories
161
- * @param bool $prepend Whether to prepend the directories
162
  *
163
  * @throws \InvalidArgumentException
 
 
164
  */
165
  public function addPsr4($prefix, $paths, $prepend = false)
166
  {
@@ -204,8 +272,10 @@ class ClassLoader
204
  * Registers a set of PSR-0 directories for a given prefix,
205
  * replacing any others previously set for this prefix.
206
  *
207
- * @param string $prefix The prefix
208
- * @param array|string $paths The PSR-0 base directories
 
 
209
  */
210
  public function set($prefix, $paths)
211
  {
@@ -220,10 +290,12 @@ class ClassLoader
220
  * Registers a set of PSR-4 directories for a given namespace,
221
  * replacing any others previously set for this namespace.
222
  *
223
- * @param string $prefix The prefix/namespace, with trailing '\\'
224
- * @param array|string $paths The PSR-4 base directories
225
  *
226
  * @throws \InvalidArgumentException
 
 
227
  */
228
  public function setPsr4($prefix, $paths)
229
  {
@@ -243,6 +315,8 @@ class ClassLoader
243
  * Turns on searching the include path for class files.
244
  *
245
  * @param bool $useIncludePath
 
 
246
  */
247
  public function setUseIncludePath($useIncludePath)
248
  {
@@ -265,6 +339,8 @@ class ClassLoader
265
  * that have not been registered with the class map.
266
  *
267
  * @param bool $classMapAuthoritative
 
 
268
  */
269
  public function setClassMapAuthoritative($classMapAuthoritative)
270
  {
@@ -285,6 +361,8 @@ class ClassLoader
285
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
286
  *
287
  * @param string|null $apcuPrefix
 
 
288
  */
289
  public function setApcuPrefix($apcuPrefix)
290
  {
@@ -305,14 +383,18 @@ class ClassLoader
305
  * Registers this instance as an autoloader.
306
  *
307
  * @param bool $prepend Whether to prepend the autoloader or not
 
 
308
  */
309
  public function register($prepend = false)
310
  {
311
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
312
 
313
  if (null === $this->vendorDir) {
314
- //no-op
315
- } elseif ($prepend) {
 
 
316
  self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
317
  } else {
318
  unset(self::$registeredLoaders[$this->vendorDir]);
@@ -322,6 +404,8 @@ class ClassLoader
322
 
323
  /**
324
  * Unregisters this instance as an autoloader.
 
 
325
  */
326
  public function unregister()
327
  {
@@ -336,7 +420,7 @@ class ClassLoader
336
  * Loads the given class or interface.
337
  *
338
  * @param string $class The name of the class
339
- * @return bool|null True if loaded, null otherwise
340
  */
341
  public function loadClass($class)
342
  {
@@ -345,6 +429,8 @@ class ClassLoader
345
 
346
  return true;
347
  }
 
 
348
  }
349
 
350
  /**
@@ -399,6 +485,11 @@ class ClassLoader
399
  return self::$registeredLoaders;
400
  }
401
 
 
 
 
 
 
402
  private function findFileWithExtension($class, $ext)
403
  {
404
  // PSR-4 lookup
@@ -470,6 +561,10 @@ class ClassLoader
470
  * Scope isolated include.
471
  *
472
  * Prevents access to $this/self from included files.
 
 
 
 
473
  */
474
  function includeFile($file)
475
  {
42
  */
43
  class ClassLoader
44
  {
45
+ /** @var ?string */
46
  private $vendorDir;
47
 
48
  // PSR-4
49
+ /**
50
+ * @var array[]
51
+ * @psalm-var array<string, array<string, int>>
52
+ */
53
  private $prefixLengthsPsr4 = array();
54
+ /**
55
+ * @var array[]
56
+ * @psalm-var array<string, array<int, string>>
57
+ */
58
  private $prefixDirsPsr4 = array();
59
+ /**
60
+ * @var array[]
61
+ * @psalm-var array<string, string>
62
+ */
63
  private $fallbackDirsPsr4 = array();
64
 
65
  // PSR-0
66
+ /**
67
+ * @var array[]
68
+ * @psalm-var array<string, array<string, string[]>>
69
+ */
70
  private $prefixesPsr0 = array();
71
+ /**
72
+ * @var array[]
73
+ * @psalm-var array<string, string>
74
+ */
75
  private $fallbackDirsPsr0 = array();
76
 
77
+ /** @var bool */
78
  private $useIncludePath = false;
79
+
80
+ /**
81
+ * @var string[]
82
+ * @psalm-var array<string, string>
83
+ */
84
  private $classMap = array();
85
+
86
+ /** @var bool */
87
  private $classMapAuthoritative = false;
88
+
89
+ /**
90
+ * @var bool[]
91
+ * @psalm-var array<string, bool>
92
+ */
93
  private $missingClasses = array();
94
+
95
+ /** @var ?string */
96
  private $apcuPrefix;
97
 
98
+ /**
99
+ * @var self[]
100
+ */
101
  private static $registeredLoaders = array();
102
 
103
+ /**
104
+ * @param ?string $vendorDir
105
+ */
106
  public function __construct($vendorDir = null)
107
  {
108
  $this->vendorDir = $vendorDir;
109
  }
110
 
111
+ /**
112
+ * @return string[]
113
+ */
114
  public function getPrefixes()
115
  {
116
  if (!empty($this->prefixesPsr0)) {
120
  return array();
121
  }
122
 
123
+ /**
124
+ * @return array[]
125
+ * @psalm-return array<string, array<int, string>>
126
+ */
127
  public function getPrefixesPsr4()
128
  {
129
  return $this->prefixDirsPsr4;
130
  }
131
 
132
+ /**
133
+ * @return array[]
134
+ * @psalm-return array<string, string>
135
+ */
136
  public function getFallbackDirs()
137
  {
138
  return $this->fallbackDirsPsr0;
139
  }
140
 
141
+ /**
142
+ * @return array[]
143
+ * @psalm-return array<string, string>
144
+ */
145
  public function getFallbackDirsPsr4()
146
  {
147
  return $this->fallbackDirsPsr4;
148
  }
149
 
150
+ /**
151
+ * @return string[] Array of classname => path
152
+ * @psalm-var array<string, string>
153
+ */
154
  public function getClassMap()
155
  {
156
  return $this->classMap;
157
  }
158
 
159
  /**
160
+ * @param string[] $classMap Class to filename map
161
+ * @psalm-param array<string, string> $classMap
162
+ *
163
+ * @return void
164
  */
165
  public function addClassMap(array $classMap)
166
  {
175
  * Registers a set of PSR-0 directories for a given prefix, either
176
  * appending or prepending to the ones previously set for this prefix.
177
  *
178
+ * @param string $prefix The prefix
179
+ * @param string[]|string $paths The PSR-0 root directories
180
+ * @param bool $prepend Whether to prepend the directories
181
+ *
182
+ * @return void
183
  */
184
  public function add($prefix, $paths, $prepend = false)
185
  {
222
  * Registers a set of PSR-4 directories for a given namespace, either
223
  * appending or prepending to the ones previously set for this namespace.
224
  *
225
+ * @param string $prefix The prefix/namespace, with trailing '\\'
226
+ * @param string[]|string $paths The PSR-4 base directories
227
+ * @param bool $prepend Whether to prepend the directories
228
  *
229
  * @throws \InvalidArgumentException
230
+ *
231
+ * @return void
232
  */
233
  public function addPsr4($prefix, $paths, $prepend = false)
234
  {
272
  * Registers a set of PSR-0 directories for a given prefix,
273
  * replacing any others previously set for this prefix.
274
  *
275
+ * @param string $prefix The prefix
276
+ * @param string[]|string $paths The PSR-0 base directories
277
+ *
278
+ * @return void
279
  */
280
  public function set($prefix, $paths)
281
  {
290
  * Registers a set of PSR-4 directories for a given namespace,
291
  * replacing any others previously set for this namespace.
292
  *
293
+ * @param string $prefix The prefix/namespace, with trailing '\\'
294
+ * @param string[]|string $paths The PSR-4 base directories
295
  *
296
  * @throws \InvalidArgumentException
297
+ *
298
+ * @return void
299
  */
300
  public function setPsr4($prefix, $paths)
301
  {
315
  * Turns on searching the include path for class files.
316
  *
317
  * @param bool $useIncludePath
318
+ *
319
+ * @return void
320
  */
321
  public function setUseIncludePath($useIncludePath)
322
  {
339
  * that have not been registered with the class map.
340
  *
341
  * @param bool $classMapAuthoritative
342
+ *
343
+ * @return void
344
  */
345
  public function setClassMapAuthoritative($classMapAuthoritative)
346
  {
361
  * APCu prefix to use to cache found/not-found classes, if the extension is enabled.
362
  *
363
  * @param string|null $apcuPrefix
364
+ *
365
+ * @return void
366
  */
367
  public function setApcuPrefix($apcuPrefix)
368
  {
383
  * Registers this instance as an autoloader.
384
  *
385
  * @param bool $prepend Whether to prepend the autoloader or not
386
+ *
387
+ * @return void
388
  */
389
  public function register($prepend = false)
390
  {
391
  spl_autoload_register(array($this, 'loadClass'), true, $prepend);
392
 
393
  if (null === $this->vendorDir) {
394
+ return;
395
+ }
396
+
397
+ if ($prepend) {
398
  self::$registeredLoaders = array($this->vendorDir => $this) + self::$registeredLoaders;
399
  } else {
400
  unset(self::$registeredLoaders[$this->vendorDir]);
404
 
405
  /**
406
  * Unregisters this instance as an autoloader.
407
+ *
408
+ * @return void
409
  */
410
  public function unregister()
411
  {
420
  * Loads the given class or interface.
421
  *
422
  * @param string $class The name of the class
423
+ * @return true|null True if loaded, null otherwise
424
  */
425
  public function loadClass($class)
426
  {
429
 
430
  return true;
431
  }
432
+
433
+ return null;
434
  }
435
 
436
  /**
485
  return self::$registeredLoaders;
486
  }
487
 
488
+ /**
489
+ * @param string $class
490
+ * @param string $ext
491
+ * @return string|false
492
+ */
493
  private function findFileWithExtension($class, $ext)
494
  {
495
  // PSR-4 lookup
561
  * Scope isolated include.
562
  *
563
  * Prevents access to $this/self from included files.
564
+ *
565
+ * @param string $file
566
+ * @return void
567
+ * @private
568
  */
569
  function includeFile($file)
570
  {
src/lib/vendor/composer/autoload_classmap.php CHANGED
@@ -1033,6 +1033,7 @@ return array(
1033
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\ExtractLinesFromFile' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/ExtractLinesFromFile.php',
1034
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\GetFileAsArray' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/GetFileAsArray.php',
1035
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\LocateStrInFile' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/LocateStrInFile.php',
 
1036
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\ReadDataFromFileEncrypted' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/ReadDataFromFileEncrypted.php',
1037
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\RemoveLineFromFile' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/RemoveLineFromFile.php',
1038
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\TestFileWritable' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/TestFileWritable.php',
1033
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\ExtractLinesFromFile' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/ExtractLinesFromFile.php',
1034
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\GetFileAsArray' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/GetFileAsArray.php',
1035
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\LocateStrInFile' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/LocateStrInFile.php',
1036
+ 'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\Paths' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/Paths.php',
1037
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\ReadDataFromFileEncrypted' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/ReadDataFromFileEncrypted.php',
1038
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\RemoveLineFromFile' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/RemoveLineFromFile.php',
1039
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\TestFileWritable' => $vendorDir . '/fernleafsystems/wordpress-services/src/Utilities/File/TestFileWritable.php',
src/lib/vendor/composer/autoload_static.php CHANGED
@@ -1219,6 +1219,7 @@ class ComposerStaticInit4fc2c6daaffaf40b64b79b6d26830171
1219
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\ExtractLinesFromFile' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/ExtractLinesFromFile.php',
1220
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\GetFileAsArray' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/GetFileAsArray.php',
1221
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\LocateStrInFile' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/LocateStrInFile.php',
 
1222
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\ReadDataFromFileEncrypted' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/ReadDataFromFileEncrypted.php',
1223
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\RemoveLineFromFile' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/RemoveLineFromFile.php',
1224
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\TestFileWritable' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/TestFileWritable.php',
1219
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\ExtractLinesFromFile' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/ExtractLinesFromFile.php',
1220
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\GetFileAsArray' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/GetFileAsArray.php',
1221
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\LocateStrInFile' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/LocateStrInFile.php',
1222
+ 'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\Paths' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/Paths.php',
1223
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\ReadDataFromFileEncrypted' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/ReadDataFromFileEncrypted.php',
1224
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\RemoveLineFromFile' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/RemoveLineFromFile.php',
1225
  'FernleafSystems\\Wordpress\\Services\\Utilities\\File\\TestFileWritable' => __DIR__ . '/..' . '/fernleafsystems/wordpress-services/src/Utilities/File/TestFileWritable.php',
src/lib/vendor/fernleafsystems/utilities/src/Data/Adapter/DynProperties.php CHANGED
@@ -2,10 +2,6 @@
2
 
3
  namespace FernleafSystems\Utilities\Data\Adapter;
4
 
5
- /**
6
- * Trait DynProperties
7
- * @package FernleafSystems\Utilities\Data\Adapter
8
- */
9
  trait DynProperties {
10
 
11
  private $raw = [];
@@ -37,7 +33,7 @@ trait DynProperties {
37
  unset( $this->raw[ $key ] );
38
  }
39
 
40
- public function applyFromArray( $data, array $restrictedKeys = [] ) {
41
  if ( !empty( $restrictedKeys ) ) {
42
  $data = array_intersect_key( $data, array_flip( $restrictedKeys ) );
43
  }
2
 
3
  namespace FernleafSystems\Utilities\Data\Adapter;
4
 
 
 
 
 
5
  trait DynProperties {
6
 
7
  private $raw = [];
33
  unset( $this->raw[ $key ] );
34
  }
35
 
36
+ public function applyFromArray( array $data, array $restrictedKeys = [] ) {
37
  if ( !empty( $restrictedKeys ) ) {
38
  $data = array_intersect_key( $data, array_flip( $restrictedKeys ) );
39
  }
src/lib/vendor/fernleafsystems/utilities/src/Data/Adapter/DynamicProperties.php CHANGED
@@ -3,8 +3,6 @@
3
  namespace FernleafSystems\Utilities\Data\Adapter;
4
 
5
  /**
6
- * Trait DynamicProperties
7
- * @package FernleafSystems\Utilities\Data\Adapter
8
  * @deprecated
9
  */
10
  trait DynamicProperties {
3
  namespace FernleafSystems\Utilities\Data\Adapter;
4
 
5
  /**
 
 
6
  * @deprecated
7
  */
8
  trait DynamicProperties {
src/lib/vendor/fernleafsystems/utilities/src/Data/Adapter/StdClassAdapter.php CHANGED
@@ -3,8 +3,6 @@
3
  namespace FernleafSystems\Utilities\Data\Adapter;
4
 
5
  /**
6
- * Trait StdClassAdapter
7
- * @package FernleafSystems\Utilities\Data\Adapter
8
  * @deprecated 1.4
9
  */
10
  trait StdClassAdapter {
3
  namespace FernleafSystems\Utilities\Data\Adapter;
4
 
5
  /**
 
 
6
  * @deprecated 1.4
7
  */
8
  trait StdClassAdapter {
src/lib/vendor/fernleafsystems/utilities/src/Data/Response/StdResponse.php CHANGED
@@ -5,8 +5,6 @@ namespace FernleafSystems\Utilities\Data\Response;
5
  use FernleafSystems\Utilities\Data\Adapter\DynPropertiesClass;
6
 
7
  /**
8
- * Class StdResponse
9
- * @package FernleafSystems\Utilities\Data\Response
10
  * @property bool $success
11
  * @property bool $failed
12
  * @property mixed $error_code
5
  use FernleafSystems\Utilities\Data\Adapter\DynPropertiesClass;
6
 
7
  /**
 
 
8
  * @property bool $success
9
  * @property bool $failed
10
  * @property mixed $error_code
src/lib/vendor/fernleafsystems/utilities/src/Logic/OneTimeExecute.php CHANGED
@@ -2,10 +2,6 @@
2
 
3
  namespace FernleafSystems\Utilities\Logic;
4
 
5
- /**
6
- * Trait OneTimeExecute
7
- * @package FernleafSystems\Utilities\Logic
8
- */
9
  trait OneTimeExecute {
10
 
11
  private $bHasOneTimeExecuted = false;
2
 
3
  namespace FernleafSystems\Utilities\Logic;
4
 
 
 
 
 
5
  trait OneTimeExecute {
6
 
7
  private $bHasOneTimeExecuted = false;
src/lib/vendor/fernleafsystems/utilities/src/Response.php CHANGED
@@ -4,10 +4,6 @@ namespace FernleafSystems\Utilities;
4
 
5
  use FernleafSystems\Utilities\Data\Adapter\StdClassAdapter;
6
 
7
- /**
8
- * Class Response
9
- * @package FernleafSystems\Utilities
10
- */
11
  class Response {
12
 
13
  use StdClassAdapter;
4
 
5
  use FernleafSystems\Utilities\Data\Adapter\StdClassAdapter;
6
 
 
 
 
 
7
  class Response {
8
 
9
  use StdClassAdapter;
src/lib/vendor/fernleafsystems/wordpress-plugin-core/src/Databases/Base/Handler.php CHANGED
@@ -9,11 +9,9 @@ use FernleafSystems\Wordpress\Plugin\Core\Databases\Common\{
9
  SubQueryLoader,
10
  TableSchema
11
  };
12
- use FernleafSystems\Wordpress\Services\Utilities\Options\Transient;
13
- use FernleafSystems\Wordpress\Plugin\Core\Databases\Exceptions\{
14
- NoSlugProvidedException
15
- };
16
  use FernleafSystems\Wordpress\Services\Services;
 
17
 
18
  abstract class Handler {
19
 
@@ -224,7 +222,7 @@ abstract class Handler {
224
 
225
  if ( !isset( $this->isReady ) ) {
226
  try {
227
- if ( Transient::Get( $this->getTransientReadyKey() ) ) {
228
  $this->isReady = true;
229
  }
230
  else {
@@ -232,7 +230,11 @@ abstract class Handler {
232
  $align = new AlignTableWithSchema( $schema );
233
  $align->align();
234
  $this->isReady = $this->tableExists() && $align->isAligned();
235
- Transient::Set( $this->getTransientReadyKey(), $this->isReady, $schema->ready_check_interval );
 
 
 
 
236
  }
237
  }
238
  catch ( \Exception $e ) {
@@ -252,7 +254,6 @@ abstract class Handler {
252
  }
253
 
254
  /**
255
- * @param bool $allowAutoDelete
256
  * @return $this
257
  */
258
  public function setAllowAutoDelete( bool $allowAutoDelete ) {
9
  SubQueryLoader,
10
  TableSchema
11
  };
12
+ use FernleafSystems\Wordpress\Plugin\Core\Databases\Exceptions\NoSlugProvidedException;
 
 
 
13
  use FernleafSystems\Wordpress\Services\Services;
14
+ use FernleafSystems\Wordpress\Services\Utilities\Options\Transient;
15
 
16
  abstract class Handler {
17
 
222
 
223
  if ( !isset( $this->isReady ) ) {
224
  try {
225
+ if ( Services::Request()->ts() - (int)Transient::Get( $this->getTransientReadyKey() ) < 30 ) {
226
  $this->isReady = true;
227
  }
228
  else {
230
  $align = new AlignTableWithSchema( $schema );
231
  $align->align();
232
  $this->isReady = $this->tableExists() && $align->isAligned();
233
+ Transient::Set(
234
+ $this->getTransientReadyKey(),
235
+ Services::Request()->ts(),
236
+ $schema->ready_check_interval
237
+ );
238
  }
239
  }
240
  catch ( \Exception $e ) {
254
  }
255
 
256
  /**
 
257
  * @return $this
258
  */
259
  public function setAllowAutoDelete( bool $allowAutoDelete ) {
src/lib/vendor/fernleafsystems/wordpress-services/src/Utilities/Data.php CHANGED
@@ -7,40 +7,28 @@ use FernleafSystems\Wordpress\Services\Services;
7
  class Data {
8
 
9
  /**
10
- * @param string $sPath
11
- * @param string $sExtensionToAdd
12
  * @return string
 
13
  */
14
- public function addExtensionToFilePath( $sPath, $sExtensionToAdd ) {
15
-
16
- if ( strpos( $sExtensionToAdd, '.' ) === false ) {
17
- $sExtensionToAdd = '.'.$sExtensionToAdd;
18
- }
19
-
20
- if ( !$this->getIfStringEndsIn( $sPath, $sExtensionToAdd ) ) {
21
- $sPath = $sPath.$sExtensionToAdd;
22
- }
23
- return $sPath;
24
  }
25
 
26
  /**
27
- * @param string $sHaystack
28
- * @param string $sNeedle
29
- * @return bool
30
  */
31
- public function getIfStringEndsIn( $sHaystack, $sNeedle ) {
32
- $nNeedleLength = strlen( $sNeedle );
33
- $sStringEndsIn = substr( $sHaystack, strlen( $sHaystack ) - $nNeedleLength, $nNeedleLength );
34
- return ( $sStringEndsIn == $sNeedle );
35
  }
36
 
37
  /**
38
  * @param string $path
39
- * @return string
40
  */
41
- public function getExtension( $path ) {
42
- $extPeriod = strrpos( $path, '.' );
43
- return ( $extPeriod === false ) ? $path : str_replace( '.', '', substr( $path, $extPeriod ) );
44
  }
45
 
46
  /**
@@ -82,9 +70,8 @@ class Data {
82
 
83
  /**
84
  * @param string $url
85
- * @return bool
86
  */
87
- public function isValidWebUrl( $url ) {
88
  $url = trim( $this->urlStripQueryPart( $url ) );
89
  return filter_var( $url, FILTER_VALIDATE_URL )
90
  && in_array( parse_url( $url, PHP_URL_SCHEME ), [ 'http', 'https' ] );
@@ -106,7 +93,6 @@ class Data {
106
 
107
  /**
108
  * @param string $email
109
- * @return bool
110
  */
111
  public function validEmail( $email ) :bool {
112
  return !empty( $email ) && is_email( $email );
@@ -289,46 +275,31 @@ class Data {
289
  return false;
290
  }
291
 
292
- /**
293
- * @return string
294
- */
295
- public function getPhpVersion() {
296
- return ( defined( 'PHP_VERSION' ) ? PHP_VERSION : phpversion() );
297
  }
298
 
299
  /**
300
  * Cleans out any of the junk that can appear in a PHP version and returns just the 5.4.45
301
  * e.g. 5.4.45-0+deb7u5
302
- * @param bool $bExcludeMinor
303
- * @return mixed|string
304
  */
305
- public function getPhpVersionCleaned( $bExcludeMinor = false ) {
306
- $sVersion = $this->getPhpVersion();
307
- if ( preg_match( '#^[0-9]+\.[0-9]+(\.[0-9]+)?#', $sVersion, $aMatches ) ) {
308
- $sVersion = $aMatches[ 0 ];
309
  }
310
- return $bExcludeMinor ? substr( $sVersion, 0, strrpos( $sVersion, '.' ) ) : $sVersion;
311
  }
312
 
313
- /**
314
- * @param string $sAtLeastVersion
315
- * @return bool
316
- */
317
- public function getPhpVersionIsAtLeast( $sAtLeastVersion ) {
318
- return version_compare( $this->getPhpVersion(), $sAtLeastVersion, '>=' );
319
  }
320
 
321
- /**
322
- * @return bool
323
- */
324
- public function getPhpSupportsNamespaces() {
325
  return $this->getPhpVersionIsAtLeast( '5.3' );
326
  }
327
 
328
- /**
329
- * @return bool
330
- */
331
- public function getCanOpensslSign() {
332
  return function_exists( 'base64_decode' )
333
  && function_exists( 'openssl_sign' )
334
  && function_exists( 'openssl_verify' )
@@ -336,17 +307,16 @@ class Data {
336
  }
337
 
338
  /**
339
- * @param array $aArray
340
- * @return \stdClass
341
  */
342
- public function convertArrayToStdClass( $aArray ) {
343
- $oObject = new \stdClass();
344
- if ( !empty( $aArray ) && is_array( $aArray ) ) {
345
- foreach ( $aArray as $sKey => $mValue ) {
346
- $oObject->{$sKey} = $mValue;
347
  }
348
  }
349
- return $oObject;
350
  }
351
 
352
  /**
7
  class Data {
8
 
9
  /**
10
+ * @param string $path
11
+ * @param string $ext
12
  * @return string
13
+ * @deprecated
14
  */
15
+ public function addExtensionToFilePath( $path, $ext ) :string {
16
+ return File\Paths::AddExt( (string)$path, (string)$ext );
 
 
 
 
 
 
 
 
17
  }
18
 
19
  /**
20
+ * @param string $haystack
21
+ * @param string $needle
 
22
  */
23
+ public function getIfStringEndsIn( $haystack, $needle, bool $ignoreCase = false ) :bool {
24
+ return preg_match( sprintf( '#%s$#%s', preg_quote( $needle, '#' ), $ignoreCase ? 'i' : '' ), $haystack ) > 0;
 
 
25
  }
26
 
27
  /**
28
  * @param string $path
 
29
  */
30
+ public function getExtension( $path ) :string {
31
+ return File\Paths::Ext( (string)$path );
 
32
  }
33
 
34
  /**
70
 
71
  /**
72
  * @param string $url
 
73
  */
74
+ public function isValidWebUrl( $url ) :bool {
75
  $url = trim( $this->urlStripQueryPart( $url ) );
76
  return filter_var( $url, FILTER_VALIDATE_URL )
77
  && in_array( parse_url( $url, PHP_URL_SCHEME ), [ 'http', 'https' ] );
93
 
94
  /**
95
  * @param string $email
 
96
  */
97
  public function validEmail( $email ) :bool {
98
  return !empty( $email ) && is_email( $email );
275
  return false;
276
  }
277
 
278
+ public function getPhpVersion() :string {
279
+ return (string)( defined( 'PHP_VERSION' ) ? PHP_VERSION : phpversion() );
 
 
 
280
  }
281
 
282
  /**
283
  * Cleans out any of the junk that can appear in a PHP version and returns just the 5.4.45
284
  * e.g. 5.4.45-0+deb7u5
 
 
285
  */
286
+ public function getPhpVersionCleaned( bool $excludeMinor = false ) :string {
287
+ $version = $this->getPhpVersion();
288
+ if ( preg_match( '#^[0-9]+\.[0-9]+(\.[0-9]+)?#', $version, $matches ) ) {
289
+ $version = $matches[ 0 ];
290
  }
291
+ return $excludeMinor ? substr( $version, 0, strrpos( $version, '.' ) ) : $version;
292
  }
293
 
294
+ public function getPhpVersionIsAtLeast( string $atLeast ) :bool {
295
+ return (bool)version_compare( $this->getPhpVersion(), $atLeast, '>=' );
 
 
 
 
296
  }
297
 
298
+ public function getPhpSupportsNamespaces() :bool {
 
 
 
299
  return $this->getPhpVersionIsAtLeast( '5.3' );
300
  }
301
 
302
+ public function getCanOpensslSign() :bool {
 
 
 
303
  return function_exists( 'base64_decode' )
304
  && function_exists( 'openssl_sign' )
305
  && function_exists( 'openssl_verify' )
307
  }
308
 
309
  /**
310
+ * @param array $arr
 
311
  */
312
+ public function convertArrayToStdClass( $arr ) :\stdClass {
313
+ $obj = new \stdClass();
314
+ if ( !empty( $arr ) && is_array( $arr ) ) {
315
+ foreach ( $arr as $sKey => $mValue ) {
316
+ $obj->{$sKey} = $mValue;
317
  }
318
  }
319
+ return $obj;
320
  }
321
 
322
  /**
src/lib/vendor/fernleafsystems/wordpress-services/src/Utilities/Encrypt/OpenSslEncrypt.php CHANGED
@@ -2,26 +2,26 @@
2
 
3
  namespace FernleafSystems\Wordpress\Services\Utilities\Encrypt;
4
 
5
- /**
6
- * Class OpenSslEncrypt
7
- * @package FernleafSystems\Wordpress\Services\Utilities\Encrypt
8
- */
9
  class OpenSslEncrypt {
10
 
11
  /**
12
- * @param array $args
13
- * @return array - keys are private & public as pem strings
14
  * @throws \Exception
15
  */
16
- public function createNewPrivatePublicKeyPair( $args = [] ) {
17
- $rKey = openssl_pkey_new( $args );
18
- if ( empty( $rKey ) || !is_resource( $rKey ) ) {
19
- throw new \Exception( 'Could not generate new private key' );
 
 
 
 
20
  }
21
- if ( !openssl_pkey_export( $rKey, $private ) || empty( $private ) ) {
22
  throw new \Exception( 'Could not export new private key' );
23
  }
24
- $pub = openssl_pkey_get_details( $rKey );
25
  if ( empty( $pub ) || empty( $pub[ 'key' ] ) ) {
26
  throw new \Exception( 'Could not generate public key from private' );
27
  }
@@ -32,16 +32,21 @@ class OpenSslEncrypt {
32
  }
33
 
34
  /**
35
- * @param string $key
36
  * @return string
37
  * @throws \Exception
38
  */
39
- public function getPublicKeyFromPrivateKey( $key ) {
40
- $rKey = openssl_pkey_get_private( $key );
41
- if ( empty( $rKey ) || !is_resource( $rKey ) ) {
42
- throw new \Exception( 'Could not build private key' );
 
 
 
 
43
  }
44
- $public = openssl_pkey_get_details( $rKey );
 
45
  if ( empty( $public ) || empty( $public[ 'key' ] ) ) {
46
  throw new \Exception( 'Could not generate public key from private' );
47
  }
@@ -49,11 +54,11 @@ class OpenSslEncrypt {
49
  }
50
 
51
  /**
52
- * @param OpenSslEncryptVo $VO
53
- * @param string $privateKey
54
  * @return string|false
55
  */
56
- public function openDataVo( OpenSslEncryptVo $VO, string $privateKey ) {
57
  $success = \openssl_open(
58
  $VO->sealed_data,
59
  $openedData,
@@ -192,4 +197,9 @@ class OpenSslEncrypt {
192
  public function hasCipherAlgo( string $cipher ) :bool {
193
  return in_array( strtolower( $cipher ), array_map( 'strtolower', openssl_get_cipher_methods( true ) ) );
194
  }
 
 
 
 
 
195
  }
2
 
3
  namespace FernleafSystems\Wordpress\Services\Utilities\Encrypt;
4
 
5
+ use FernleafSystems\Wordpress\Services\Services;
6
+
 
 
7
  class OpenSslEncrypt {
8
 
9
  /**
 
 
10
  * @throws \Exception
11
  */
12
+ public function createNewPrivatePublicKeyPair( array $args = [] ) :array {
13
+ $key = openssl_pkey_new( $args );
14
+ if ( empty( $key ) ) {
15
+ throw new \Exception( '[OPENSSL] New Private Key was empty' );
16
+ }
17
+ if ( !is_resource( $key )
18
+ && ( $this->usePHP8() && !$key instanceof \OpenSSLAsymmetricKey ) ) {
19
+ throw new \Exception( '[OPENSSL] Could not generate new private key' );
20
  }
21
+ if ( !openssl_pkey_export( $key, $private ) || empty( $private ) ) {
22
  throw new \Exception( 'Could not export new private key' );
23
  }
24
+ $pub = openssl_pkey_get_details( $key );
25
  if ( empty( $pub ) || empty( $pub[ 'key' ] ) ) {
26
  throw new \Exception( 'Could not generate public key from private' );
27
  }
32
  }
33
 
34
  /**
35
+ * @param \OpenSSLAsymmetricKey|string $privateKey
36
  * @return string
37
  * @throws \Exception
38
  */
39
+ public function getPublicKeyFromPrivateKey( $privateKey ) :string {
40
+ $key = openssl_pkey_get_private( $privateKey );
41
+ if ( empty( $key ) ) {
42
+ throw new \Exception( '[OPENSSL] Extracted Private Key was empty' );
43
+ }
44
+ if ( !is_resource( $key )
45
+ && ( $this->usePHP8() && !$key instanceof \OpenSSLAsymmetricKey ) ) {
46
+ throw new \Exception( '[OPENSSL] Could not generate new private key' );
47
  }
48
+
49
+ $public = openssl_pkey_get_details( $key );
50
  if ( empty( $public ) || empty( $public[ 'key' ] ) ) {
51
  throw new \Exception( 'Could not generate public key from private' );
52
  }
54
  }
55
 
56
  /**
57
+ * @param OpenSslEncryptVo $VO
58
+ * @param \OpenSSLAsymmetricKey|string $privateKey
59
  * @return string|false
60
  */
61
+ public function openDataVo( OpenSslEncryptVo $VO, $privateKey ) {
62
  $success = \openssl_open(
63
  $VO->sealed_data,
64
  $openedData,
197
  public function hasCipherAlgo( string $cipher ) :bool {
198
  return in_array( strtolower( $cipher ), array_map( 'strtolower', openssl_get_cipher_methods( true ) ) );
199
  }
200
+
201
+ private function usePHP8() :bool {
202
+ return Services::Data()->getPhpVersionIsAtLeast( '8.0' )
203
+ && @class_exists( '\OpenSSLAsymmetricKey' );
204
+ }
205
  }
src/lib/vendor/fernleafsystems/wordpress-services/src/Utilities/Encrypt/OpenSslEncryptVo.php CHANGED
@@ -5,8 +5,6 @@ namespace FernleafSystems\Wordpress\Services\Utilities\Encrypt;
5
  use FernleafSystems\Utilities\Data\Adapter\DynPropertiesClass;
6
 
7
  /**
8
- * Class EncryptVo
9
- * @package FernleafSystems\Wordpress\Services\Utilities\Encrypt
10
  * @property bool $success
11
  * @property int $result
12
  * @property string $cipher
5
  use FernleafSystems\Utilities\Data\Adapter\DynPropertiesClass;
6
 
7
  /**
 
 
8
  * @property bool $success
9
  * @property int $result
10
  * @property string $cipher
src/lib/vendor/fernleafsystems/wordpress-services/src/Utilities/File/Paths.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php declare( strict_types=1 );
2
+
3
+ namespace FernleafSystems\Wordpress\Services\Utilities\File;
4
+
5
+ use FernleafSystems\Wordpress\Services\Services;
6
+
7
+ class Paths {
8
+
9
+ public static function AddExt( string $path, string $ext ) :string {
10
+ $ext = '.'.ltrim( $ext, '.' );
11
+ return Services::Data()->getIfStringEndsIn( $path, $ext ) ? $path : rtrim( $path, '.' ).$ext;
12
+ }
13
+
14
+ public static function RemoveExt( string $path ) :string {
15
+ $extStart = strrpos( $path, '.' );
16
+ return $extStart === false ? $path : substr( $path, 0, $extStart );
17
+ }
18
+
19
+ /**
20
+ * Includes period.
21
+ */
22
+ public static function Ext( string $path ) :string {
23
+ $extStart = strrpos( $path, '.' );
24
+ return $extStart === false ? '' : str_replace( '.', '', substr( $path, $extStart ) );
25
+ }
26
+ }
templates/twig/admin/user/profile/mfa/mfa_ga.twig CHANGED
@@ -1,17 +1,17 @@
1
  <style>
2
  #shield_ga_secret {
3
- letter-spacing: 5px;
4
- font-family: monospace;
5
- font-size: 24px;
6
- text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
7
- border: 1px solid rgba(0, 0, 0, 0.1);
8
- padding: 0 7px;
9
- background-color: whitesmoke;
10
- }
11
- #shield_gacode {
12
- text-align: center;
13
- width: 350px
14
- }
15
  </style>
16
 
17
  {% if flags.is_profile_active %}
@@ -20,7 +20,7 @@
20
  <th><label for="shield_turn_off_ga">{{ strings.label_check_to_remove }}</label></th>
21
  <td>
22
  <button type="button" class="button"
23
- name="shield_turn_off_ga" id="shield_ga_remove"
24
  >{{ strings.remove_google_auth }}</button>
25
  {% if flags.show_explanatory_text %}
26
  <p class="description">{{ strings.desc_remove }}</p>
@@ -35,18 +35,19 @@
35
  <td>
36
  <div style="width: 350px; margin-bottom: 15px; text-align: center">
37
  <img src="{{ hrefs.src_chart_url }}" alt="{{ strings.description_chart_url }}"
38
- title="{{ strings.description_chart_url }}"
39
- style="display:block;margin:0 auto 10px" />
 
40
  <div style="margin: auto;width: fit-content;text-align: center;"
41
- id="shield_ga_secret">{{ vars.ga_secret }}</div>
42
  </div>
43
 
44
  <input class="regular-text"
45
- type="text"
46
- id="shield_gacode"
47
- name="{{ vars.otp_field_name }}"
48
- placeholder="{{ strings.enter_auth_app_code }}"
49
- value="" autocomplete="off" />
50
  {% if flags.show_explanatory_text %}
51
  <p class="description">
52
  {{ strings.description_chart_url }}
1
  <style>
2
  #shield_ga_secret {
3
+ letter-spacing: 5px;
4
+ font-family: monospace;
5
+ font-size: 24px;
6
+ text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.4);
7
+ border: 1px solid rgba(0, 0, 0, 0.1);
8
+ padding: 0 7px;
9
+ background-color: whitesmoke;
10
+ }
11
+ #shield_gacode {
12
+ text-align: center;
13
+ width: 350px
14
+ }
15
  </style>
16
 
17
  {% if flags.is_profile_active %}
20
  <th><label for="shield_turn_off_ga">{{ strings.label_check_to_remove }}</label></th>
21
  <td>
22
  <button type="button" class="button"
23
+ name="shield_turn_off_ga" id="shield_ga_remove"
24
  >{{ strings.remove_google_auth }}</button>
25
  {% if flags.show_explanatory_text %}
26
  <p class="description">{{ strings.desc_remove }}</p>
35
  <td>
36
  <div style="width: 350px; margin-bottom: 15px; text-align: center">
37
  <img src="{{ hrefs.src_chart_url }}" alt="{{ strings.description_chart_url }}"
38
+ title="{{ strings.description_chart_url }}"
39
+ class="shield-mfa-googleauth"
40
+ style="display:block;margin:0 auto 10px" />
41
  <div style="margin: auto;width: fit-content;text-align: center;"
42
+ id="shield_ga_secret">{{ vars.ga_secret }}</div>
43
  </div>
44
 
45
  <input class="regular-text"
46
+ type="text"
47
+ id="shield_gacode"
48
+ name="{{ vars.otp_field_name }}"
49
+ placeholder="{{ strings.enter_auth_app_code }}"
50
+ value="" autocomplete="off" />
51
  {% if flags.show_explanatory_text %}
52
  <p class="description">
53
  {{ strings.description_chart_url }}