AJAX
1 year ago
Admin_Page
1 year ago
Custom_WordPress_Columns
2 years ago
Data_Pruning
1 year ago
Date_Picker
1 year ago
Date_Range
1 year ago
Ecommerce
1 year ago
Email_Reports
1 year ago
Filter_Lists
2 years ago
Form_Submissions
1 year ago
Interval
2 years ago
Menu_Bar_Stats
2 years ago
Migrations
1 year ago
Models
1 year ago
Public_API
2 years ago
Rows
1 year ago
Statistics
1 year ago
Tables
1 year ago
Utils
1 year ago
Campaign_Builder.php
2 years ago
Capability_Manager.php
1 year ago
Chart.php
1 year ago
Chart_Geo.php
1 year ago
Cron_Job.php
1 year ago
Cron_Job_Autoloader.php
1 year ago
Cron_Manager.php
2 years ago
Current_Traffic_Finder.php
2 years ago
Dashboard_Options.php
2 years ago
Dashboard_Widget.php
2 years ago
Database.php
2 years ago
Database_Manager.php
2 years ago
Empty_Report_Option.php
2 years ago
Env.php
1 year ago
Filters.php
1 year ago
Geo_Database_Background_Job.php
2 years ago
Geo_Database_Manager.php
2 years ago
Geoposition.php
2 years ago
Icon_Directory.php
2 years ago
Icon_Directory_Factory.php
2 years ago
Illuminate_Builder.php
2 years ago
Independent_Analytics.php
1 year ago
Interrupt.php
1 year ago
Known_Referrers.php
2 years ago
Patch.php
2 years ago
Plugin_Conflict_Detector.php
1 year ago
Plugin_Group.php
1 year ago
Plugin_Group_Option.php
2 years ago
Query.php
1 year ago
Query_Taps.php
1 year ago
Quick_Stats.php
2 years ago
REST_API.php
1 year ago
Real_Time.php
1 year ago
Report.php
2 years ago
Report_Finder.php
2 years ago
Report_Options_Parser.php
2 years ago
Resource_Identifier.php
1 year ago
Settings.php
1 year ago
Sort_Configuration.php
2 years ago
Track_Resource_Changes.php
2 years ago
View.php
2 years ago
View_Counter.php
2 years ago
Visitors_Over_Time_Finder.php
2 years ago
WP_Option_Cache_Bust.php
2 years ago
Plugin_Conflict_Detector.php
152 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWP; |
| 4 | |
| 5 | use IAWP\Utils\Plugin; |
| 6 | /** @internal */ |
| 7 | class Plugin_Conflict_Detector |
| 8 | { |
| 9 | private $error; |
| 10 | public function __construct() |
| 11 | { |
| 12 | $this->error = $this->run_conflict_check(); |
| 13 | } |
| 14 | /** |
| 15 | * Did the health check pass? |
| 16 | * |
| 17 | * @return bool |
| 18 | */ |
| 19 | public function has_conflict() : bool |
| 20 | { |
| 21 | return empty($this->error); |
| 22 | } |
| 23 | /** |
| 24 | * Returns the health check error, if any |
| 25 | * |
| 26 | * @return string|null |
| 27 | */ |
| 28 | public function get_error() : ?string |
| 29 | { |
| 30 | return $this->error; |
| 31 | } |
| 32 | /** |
| 33 | * @return string|null Returns a string error message if the health check fails |
| 34 | */ |
| 35 | private function run_conflict_check() : ?string |
| 36 | { |
| 37 | if (\is_plugin_active('disable-wp-rest-api/disable-wp-rest-api.php')) { |
| 38 | return \__('The "Disable WP REST API" plugin needs to be deactivated because Independent Analytics uses the REST API to record visits.', 'independent-analytics'); |
| 39 | } |
| 40 | if (\is_plugin_active('all-in-one-wp-security-and-firewall/wp-security.php')) { |
| 41 | $settings = \get_option('aio_wp_security_configs', []); |
| 42 | if (\array_key_exists('aiowps_disallow_unauthorized_rest_requests', $settings)) { |
| 43 | if ($settings['aiowps_disallow_unauthorized_rest_requests'] == 1) { |
| 44 | return \__('The "All In One WP Security" plugin is blocking REST API requests, which Independent Analytics needs to record views. Please disable this setting via the WP Security > Miscellaneous menu.', 'independent-analytics'); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 | if (\is_plugin_active('disable-json-api/disable-json-api.php')) { |
| 49 | $settings = \get_option('disable_rest_api_options', []); |
| 50 | if (\array_key_exists('roles', $settings)) { |
| 51 | if ($settings['roles']['none']['default_allow'] == \false) { |
| 52 | if ($settings['roles']['none']['allow_list']['/iawp/search'] == \false) { |
| 53 | return \__('The "Disable REST API" plugin is blocking REST API requests for unauthenticated users, which Independent Analytics needs to record views. Please enable the /iawp/search route, so Independent Analytics can track your visitors.', 'independent-analytics'); |
| 54 | } |
| 55 | } |
| 56 | } |
| 57 | } |
| 58 | if (\is_plugin_active('disable-xml-rpc-api/disable-xml-rpc-api.php')) { |
| 59 | $settings = \get_option('dsxmlrpc-settings'); |
| 60 | if (\array_key_exists('json-rest-api', $settings)) { |
| 61 | if ($settings['json-rest-api'] == 1) { |
| 62 | return \__('The "Disable XML-RPC-API" plugin is blocking REST API requests, which Independent Analytics needs to record views. Please visit the Security Settings menu and turn off the "Disable JSON REST API" option, so Independent Analytics can track your visitors.', 'independent-analytics'); |
| 63 | } |
| 64 | } |
| 65 | } |
| 66 | if (\is_plugin_active('wpo-tweaks/wordpress-wpo-tweaks.php')) { |
| 67 | return \__('The "WPO Tweaks & Optimizations" plugin needs to be deactivated because it is disabling the REST API, which Independent Analytics uses to record visits.', 'independent-analytics'); |
| 68 | } |
| 69 | if (\is_plugin_active('all-in-one-intranet/basic_all_in_one_intranet.php')) { |
| 70 | return \__('The "All-In-One Intranet" plugin needs to be deactivated because it is disabling the REST API, which Independent Analytics uses to record visits. You may want to try the "My Private Site" plugin instead.', 'independent-analytics'); |
| 71 | } |
| 72 | if (\is_plugin_active('wp-security-hardening/wp-hardening.php')) { |
| 73 | $settings = \get_option('whp_fixer_option'); |
| 74 | if (\array_key_exists('disable_json_api', $settings)) { |
| 75 | if ($settings['disable_json_api'] != 'off') { |
| 76 | return \__('The "WP Hardening" plugin is blocking the REST API, which Independent Analytics needs to record views. Please visit the WP Hardening > Security Fixers menu and turn off the "Disable WP API JSON" option, so Independent Analytics can track your visitors.', 'independent-analytics'); |
| 77 | } |
| 78 | } |
| 79 | } |
| 80 | if (\is_plugin_active('wp-rest-api-authentication/miniorange-api-authentication.php')) { |
| 81 | $settings = \get_option('mo_api_authentication_protectedrestapi_route_whitelist'); |
| 82 | if (\in_array('/iawp/search', $settings)) { |
| 83 | return \__('The "WordPress REST API Authentication" plugin is blocking the REST API, which Independent Analytics needs to record views. Please visit the miniOrange API Authentication > Protected REST APIs menu and uncheck the "/iawp/search" box to allow Independent Analytics to track your visitors.', 'independent-analytics'); |
| 84 | } |
| 85 | } |
| 86 | if (\is_plugin_active('ninjafirewall/ninjafirewall.php')) { |
| 87 | $settings = \get_option('nfw_options'); |
| 88 | if (\array_key_exists('no_restapi', $settings)) { |
| 89 | if ($settings['no_restapi'] == 1) { |
| 90 | return \__('The "NinjaFirewall" plugin is blocking the REST API, which Independent Analytics needs to record views. Please visit the NinjaFirewall > Firewall Policies menu and uncheck the "Block any access to the API" checkbox to allow Independent Analytics to track your visitors.', 'independent-analytics'); |
| 91 | } |
| 92 | } |
| 93 | } |
| 94 | if (\is_plugin_active('wp-cerber/wp-cerber.php')) { |
| 95 | // This option has been renamed before. If there's an issue in here, check that it wasn't renamed again. |
| 96 | $settings = \get_option('cerber_configuration'); |
| 97 | if ($settings === \false) { |
| 98 | $settings = \get_option('cerber-hardening'); |
| 99 | } |
| 100 | if (\array_key_exists('norest', $settings)) { |
| 101 | if ($settings['norest'] === '1') { |
| 102 | if (!\in_array('iawp', $settings['restwhite'])) { |
| 103 | return \__('The "WP Cerber" plugin is blocking the REST API, which Independent Analytics needs to record views. Please visit the WP Cerber > Dashboard > Hardening menu and add "iawp" to your allowed namespaces. This will keep the REST API locked down while allowing requests for Independent Analytics.', 'independent-analytics'); |
| 104 | } |
| 105 | } |
| 106 | } |
| 107 | } |
| 108 | if (\is_plugin_active('wp-simple-firewall/icwp-wpsf.php')) { |
| 109 | // This option has been renamed before. If there's an issue in here, check that it wasn't renamed again. |
| 110 | $settings = \get_option('icwp_wpsf_opts_all'); |
| 111 | if ($settings === \false) { |
| 112 | $settings = \get_option('icwp_wpsf_opts_free'); |
| 113 | } |
| 114 | if (\array_key_exists('lockdown', $settings)) { |
| 115 | if (\array_key_exists('disable_anonymous_restapi', $settings['lockdown'])) { |
| 116 | if ($settings['lockdown']['disable_anonymous_restapi'] == 'Y') { |
| 117 | if (\array_key_exists('api_namespace_exclusions', $settings['lockdown'])) { |
| 118 | if (!\in_array('iawp', $settings['lockdown']['api_namespace_exclusions'])) { |
| 119 | return \__('The "Shield Security" plugin is blocking the REST API, which Independent Analytics needs to record views. Please visit the Shield Security > Config > Lockdown menu and add "iawp" to your allowed namespaces. This will keep the REST API locked down while allowing requests for Independent Analytics.', 'independent-analytics'); |
| 120 | } |
| 121 | } |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | } |
| 126 | if (\is_plugin_active('wp-hide-security-enhancer/wp-hide.php')) { |
| 127 | $settings = \get_option('wph_settings'); |
| 128 | if (\array_key_exists('module_settings', $settings)) { |
| 129 | if (\array_key_exists('disable_json_rest_v2', $settings['module_settings'])) { |
| 130 | if ($settings['module_settings']['disable_json_rest_v2'] == 'yes') { |
| 131 | return \__('The "WP Hide" plugin is blocking the REST API, which Independent Analytics needs to record views. Please visit the WP Hide > Rewrite URLs menu and switch the "Disable JSON REST V2 service" option to "No."', 'independent-analytics'); |
| 132 | } |
| 133 | } |
| 134 | if (\array_key_exists('block_json_rest', $settings['module_settings'])) { |
| 135 | if ($settings['module_settings']['block_json_rest'] == 'yes' || $settings['module_settings']['block_json_rest'] == 'non-logged-in') { |
| 136 | return \__('The "WP Hide" plugin is blocking the REST API, which Independent Analytics needs to record views. Please visit the WP Hide > Rewrite URLs menu and switch the "Block any JSON REST calls" option to "No."', 'independent-analytics'); |
| 137 | } |
| 138 | } |
| 139 | } |
| 140 | } |
| 141 | if (\is_plugin_active('admin-site-enhancements/admin-site-enhancements.php')) { |
| 142 | $settings = \get_option('admin_site_enhancements'); |
| 143 | if (\array_key_exists('disable_rest_api', $settings)) { |
| 144 | if ($settings['disable_rest_api']) { |
| 145 | return \__('The "Admin and Site Enhancements" plugin is blocking the REST API, which Independent Analytics needs to record views. Please visit the Tools > Enhancements menu, click on the "Disable Components" section, and deselect the "Disable REST API" setting to allow Independent Analytics to track your visitors.', 'independent-analytics'); |
| 146 | } |
| 147 | } |
| 148 | } |
| 149 | return null; |
| 150 | } |
| 151 | } |
| 152 |