| 1 |
<?php |
| 2 |
|
| 3 |
class RabbitLoader_21_Conflicts{ |
| 4 |
|
| 5 |
private static $messages = null; |
| 6 |
|
| 7 |
public static function &getMessages(){ |
| 8 |
if(self::$messages==null){ |
| 9 |
self::$messages = []; |
| 10 |
self::runSystemChecks(); |
| 11 |
self::runConflictsCheck(); |
| 12 |
} |
| 13 |
return self::$messages; |
| 14 |
} |
| 15 |
|
| 16 |
private static function runSystemChecks() { |
| 17 |
|
| 18 |
if(!class_exists('ZipArchive')){ |
| 19 |
self::$messages[] = RabbitLoader_21_Util_WP::__("ZipArchive PHP class not found on the server. Please contact the hosting server support and request to enable ZipArchive"); |
| 20 |
} |
| 21 |
|
| 22 |
if (defined(PHP_VERSION) && version_compare( PHP_VERSION, '7.0', '<' )) { |
| 23 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("RabbitLoader requires PHP 7.0 or higher. You\'re still on %s which may expose your site to security vulnerabilities."), PHP_VERSION); |
| 24 |
} |
| 25 |
} |
| 26 |
|
| 27 |
private static function runConflictsCheck() { |
| 28 |
|
| 29 |
$otherConflictPluginNames = []; |
| 30 |
$constants_to_check = [ |
| 31 |
'AUTOPTIMIZE_PLUGIN_VERSION'=>'Autoptimize', |
| 32 |
'BREEZE_PLUGIN_DIR'=>'Breeze', |
| 33 |
'COMET_CACHE_PLUGIN_FILE'=>'Comet Cache', |
| 34 |
'CYBVC_PLUGIN_DIR'=>'ViperCache', |
| 35 |
'DEBLOAT_PLUGIN_FILE'=>'Debloat', |
| 36 |
'JETPACK_BOOST_VERSION'=>'Jetpack Boost', |
| 37 |
'LSCACHE_ADV_CACHE'=>'LiteSpeed Cache', |
| 38 |
'LSCWP_DIR'=>'LiteSpeed Cache', |
| 39 |
'LSCWP_V'=>'LiteSpeed Cache', |
| 40 |
'PEGASAAS_ACCELERATOR_VERSION'=>'Pegasaas Accelerator WP', |
| 41 |
'PERFMATTERS_VERSION'=>'Perfmatters', |
| 42 |
'PERFMATTERS_CACHE_DIR'=>'Perfmatters', |
| 43 |
'PHASTPRESS_VERSION'=>'PhastPress', |
| 44 |
'SW_CLOUDFLARE_PAGECACHE'=>'WP Cloudflare Super Page Cache', |
| 45 |
'NITROPACK_VERSION'=>'NitroPack', |
| 46 |
'W3TC'=>'W3 Total Cache', |
| 47 |
'WMAC_PLUGIN_VERSION'=>'Clearfy Cache', |
| 48 |
'WP_ROCKET_VERSION'=>'WP-Rocket', |
| 49 |
'WP_SMUSH_VERSION'=>'Smush', |
| 50 |
'WPFC_WP_PLUGIN_DIR'=>'WP Fastest Cache', |
| 51 |
'WPFC_MAIN_PATH'=>'WP Fastest Cache', |
| 52 |
'WPHB_VERSION'=>'Hummingbird', |
| 53 |
'WPMETEOR_VERSION'=>'WP Meteor' |
| 54 |
|
| 55 |
]; |
| 56 |
|
| 57 |
$classes_to_check = [ |
| 58 |
'BJLL'=>'BJ Lazy Load', |
| 59 |
'PagespeedNinja'=>'PageSpeed Ninja', |
| 60 |
'Swift_Performance'=>'Swift Performance', |
| 61 |
'Swift_Performance_Lite'=>'Swift Performance', |
| 62 |
'SWCFPC_Backend'=>'WP Cloudflare Super Page Cache', |
| 63 |
'WPO_Cache_Config'=>'WP Optimize page caching' |
| 64 |
]; |
| 65 |
|
| 66 |
foreach($constants_to_check as $plugConst=>$plugName){ |
| 67 |
if (defined($plugConst)){ |
| 68 |
$otherConflictPluginNames[] = $plugName; |
| 69 |
} |
| 70 |
} |
| 71 |
|
| 72 |
foreach($classes_to_check as $className=>$plugName){ |
| 73 |
if (class_exists($className)){ |
| 74 |
$otherConflictPluginNames[] = $plugName; |
| 75 |
} |
| 76 |
} |
| 77 |
if(!empty($otherConflictPluginNames)){ |
| 78 |
$otherConflictPluginNames = array_unique($otherConflictPluginNames); |
| 79 |
foreach($otherConflictPluginNames as $plugName){ |
| 80 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("It seems you are also using %s plugin which conflicts with RabbitLoader optimizations. We suggest deactivating %s and hit the 'Purge All Pages' button on the RabbitLoader home tab."), $plugName, $plugName); |
| 81 |
} |
| 82 |
} |
| 83 |
|
| 84 |
if(defined('WPCACHEHOME') && function_exists("wp_cache_phase2")){ |
| 85 |
//WP Super Cache (also comes default with HostGator) |
| 86 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("It seems you are using %s plugin which conflicts with RabbitLoader optimizations. We suggest deactivating it and hit the 'Purge All Pages' button on the RabbitLoader home tab. If you think it is an error, please follow <a href='%s' target='_blank'>this guide</a>."), "WP Super Cache", "https://rabbitloader.com/kb/wordpress-plugin-activation-errors/"); |
| 87 |
} |
| 88 |
|
| 89 |
try{ |
| 90 |
if(defined('JETPACK__VERSION')){ |
| 91 |
$jp_options = get_option('jetpack_active_modules'); |
| 92 |
if(is_array($jp_options) && in_array('lazy-images', $jp_options)){ |
| 93 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "image lazy loading option in Jetpack"); |
| 94 |
} |
| 95 |
} |
| 96 |
}catch(Throwable $e){ |
| 97 |
RabbitLoader_21_Core::on_exception($e); |
| 98 |
} |
| 99 |
|
| 100 |
try{ |
| 101 |
if(defined('POWERKIT')){ |
| 102 |
$powerkit_enabled_lazyload = get_option('powerkit_enabled_lazyload'); |
| 103 |
if(!empty($powerkit_enabled_lazyload)){ |
| 104 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "image lazy loading option in Powerkit"); |
| 105 |
} |
| 106 |
} |
| 107 |
}catch(Throwable $e){ |
| 108 |
RabbitLoader_21_Core::on_exception($e); |
| 109 |
} |
| 110 |
|
| 111 |
try{ |
| 112 |
if(class_exists('Flatsome_Default')){ |
| 113 |
$theme_mods_flatsome = []; |
| 114 |
if(function_exists('of_get_options')){ |
| 115 |
$theme_mods_flatsome = of_get_options(); |
| 116 |
}else{ |
| 117 |
$theme_mods_flatsome = get_option('theme_mods_flatsome-child'); |
| 118 |
} |
| 119 |
if(!empty($theme_mods_flatsome)){ |
| 120 |
if(!empty($theme_mods_flatsome['lazy_load_images'])){ |
| 121 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "IMAGE lazy loading options in Flatsome Advanced Options"); |
| 122 |
} |
| 123 |
if(!empty($theme_mods_flatsome['lazy_load_backgrounds'])){ |
| 124 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "BANNER AND SECTION BACKGROUNDS lazy loading options in Flatsome Advanced Options"); |
| 125 |
} |
| 126 |
} |
| 127 |
} |
| 128 |
}catch(Throwable $e){ |
| 129 |
RabbitLoader_21_Core::on_exception($e); |
| 130 |
} |
| 131 |
|
| 132 |
try{ |
| 133 |
if(defined('ET_BUILDER_THEME') && defined('TEMPLATEPATH')){ |
| 134 |
$themeName = explode('/', TEMPLATEPATH); |
| 135 |
if(!empty($themeName)){ |
| 136 |
$themeName_c = end($themeName); |
| 137 |
$themeName_s = strtolower($themeName_c); |
| 138 |
$theme_options = get_option('et_'.$themeName_s); |
| 139 |
if(!empty($theme_options)){ |
| 140 |
$et_check_options = ['critical_css', 'dynamic_css']; |
| 141 |
$is_on = false; |
| 142 |
foreach($et_check_options as $et_check_option){ |
| 143 |
$et_current_option = $themeName_s.'_'.$et_check_option; |
| 144 |
$is_on = !empty($theme_options[$et_current_option]) && $theme_options[$et_current_option]=="on"; |
| 145 |
if($is_on){ |
| 146 |
break; |
| 147 |
} |
| 148 |
} |
| 149 |
if($is_on){ |
| 150 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "all performance optimizations in $themeName_c theme"); |
| 151 |
} |
| 152 |
} |
| 153 |
} |
| 154 |
} |
| 155 |
}catch(Throwable $e){ |
| 156 |
RabbitLoader_21_Core::on_exception($e); |
| 157 |
} |
| 158 |
|
| 159 |
try{ |
| 160 |
if (defined('WPO_VERSION')) { |
| 161 |
if(class_exists('WPO_Cache_Config')){ |
| 162 |
$wpo_inst = WPO_Cache_Config::instance(); |
| 163 |
if ($wpo_inst->get_option('enable_page_caching', false)) { |
| 164 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "page caching option in WP Optimize plugin"); |
| 165 |
} |
| 166 |
} |
| 167 |
} |
| 168 |
}catch(Throwable $e){ |
| 169 |
RabbitLoader_21_Core::on_exception($e); |
| 170 |
} |
| 171 |
|
| 172 |
try{ |
| 173 |
if (function_exists('ewww_image_optimizer_get_option')){ |
| 174 |
if(ewww_image_optimizer_get_option( 'ewww_image_optimizer_lazy_load')){ |
| 175 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "image lazy loading in EWWW Image Optimizer"); |
| 176 |
} |
| 177 |
} |
| 178 |
}catch(Throwable $e){ |
| 179 |
RabbitLoader_21_Core::on_exception($e); |
| 180 |
} |
| 181 |
|
| 182 |
try{ |
| 183 |
if (defined('WOOCS_VERSION')) { |
| 184 |
if(empty(get_option('woocs_shop_is_cached'))){ |
| 185 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please enable %s to be compatible with RabbitLoader. <a href='%s' target='_blank'>Check screenshot</a>"), "<i><b>I am using cache plugin</b></i> option in WOOCS Currency Switcher Settings", "https://rabbitloader.com/kb/woocs-currency-switcher-for-woocommerce/"); |
| 186 |
} |
| 187 |
} |
| 188 |
}catch(Throwable $e){ |
| 189 |
RabbitLoader_21_Core::on_exception($e); |
| 190 |
} |
| 191 |
|
| 192 |
try{ |
| 193 |
if (defined('WOOMULTI_CURRENCY_F_VERSION')) { |
| 194 |
if(empty(WOOMULTI_CURRENCY_F_Admin_Settings::get_field('cache_compatible'))){ |
| 195 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please enable %s to be compatible with RabbitLoader. <a href='%s' target='_blank'>Check screenshot</a>"), "<i><b>Use Cache Plugin</b></i> option in CURCY - Multi Currency for WooCommerce", "https://rabbitloader.com/kb/curcy-multi-currency-for-woocommerce/"); |
| 196 |
} |
| 197 |
} |
| 198 |
}catch(Throwable $e){ |
| 199 |
RabbitLoader_21_Core::on_exception($e); |
| 200 |
} |
| 201 |
|
| 202 |
try{ |
| 203 |
if (defined('FLYING_PRESS_VERSION')) { |
| 204 |
$fp_options = get_option('FLYING_PRESS_CONFIG'); |
| 205 |
if(!empty($fp_options['css_extract_used'])){ |
| 206 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "CSS optimizations in Flying Press"); |
| 207 |
} |
| 208 |
if(!empty($fp_options['js_preload_links']) || !empty($fp_options['js_defer']) || !empty($fp_options['js_interaction'])){ |
| 209 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "all JavaScript optimizations such as Preload, Defer, Interaction etc in Flying Press"); |
| 210 |
} |
| 211 |
if(!empty($fp_options['cache'])){ |
| 212 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader."), "cache option in Flying Press"); |
| 213 |
} |
| 214 |
} |
| 215 |
}catch(Throwable $e){ |
| 216 |
RabbitLoader_21_Core::on_exception($e); |
| 217 |
} |
| 218 |
|
| 219 |
if (defined('SiteGround_Optimizer\VERSION')) { |
| 220 |
$sg_combine_css = get_option('siteground_optimizer_combine_css'); |
| 221 |
if(!empty($sg_combine_css)){ |
| 222 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s in %s to avoid conflict with RabbitLoader."), "Combine CSS option", "Siteground Optimizer"); |
| 223 |
} |
| 224 |
} |
| 225 |
|
| 226 |
if (defined('EZOIC_INTEGRATION_VERSION')) { |
| 227 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Currently RabbitLoader is not compatible with %s."), "Ezoic"); |
| 228 |
} |
| 229 |
|
| 230 |
if (defined('WPACU_PLUGIN_ID') && defined('WPACU_PLUGIN_TITLE')) { |
| 231 |
$wpassetcleanup_settings = get_option('wpassetcleanup_settings'); |
| 232 |
if(!empty($wpassetcleanup_settings)){ |
| 233 |
if(!empty($wpassetcleanup_settings['combine_loaded_css_for']) && strcmp($wpassetcleanup_settings['combine_loaded_css_for'], 'guests')===0){ |
| 234 |
//CSS combination is for all guests |
| 235 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s in %s to avoid conflict with RabbitLoader."), "Combine CSS option", WPACU_PLUGIN_TITLE); |
| 236 |
} |
| 237 |
if(!empty($wpassetcleanup_settings['critical_css_status']) && strcmp($wpassetcleanup_settings['critical_css_status'], 'off')!==0){ |
| 238 |
//Critical css is on all guests |
| 239 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s in %s to avoid conflict with RabbitLoader."), "Critical CSS option", WPACU_PLUGIN_TITLE); |
| 240 |
} |
| 241 |
} |
| 242 |
} |
| 243 |
|
| 244 |
try{ |
| 245 |
if (defined('FUSION_BUILDER_VERSION')) { |
| 246 |
$template = explode('/', TEMPLATEPATH); |
| 247 |
if(!empty($template)){ |
| 248 |
$themeName = end($template); |
| 249 |
}else{ |
| 250 |
$themeName = 'current'; |
| 251 |
} |
| 252 |
$fb_options = get_option('fusion_options'); |
| 253 |
$empty_checks = [ |
| 254 |
'lazy_load'=>['none','off'], |
| 255 |
'js_compiler'=>['0'], |
| 256 |
'defer_jquery'=>['0'], |
| 257 |
'defer_styles'=>['0'], |
| 258 |
'css_cache_method'=>['none','off'], |
| 259 |
'css_combine_third_party_assets'=>['0'], |
| 260 |
'media_queries_async'=>['0'], |
| 261 |
'critical_css'=>['0'] |
| 262 |
]; |
| 263 |
foreach($empty_checks as $key=>$expValues){ |
| 264 |
if(empty($fb_options[$key])){ |
| 265 |
continue; |
| 266 |
}else if(in_array($fb_options[$key], $expValues)){ |
| 267 |
continue; |
| 268 |
}else{ |
| 269 |
self::$messages[] = sprintf(RabbitLoader_21_Util_WP::__("Please disable %s to avoid conflict with RabbitLoader. For help, refer <a href='%s' target='_blank'>this guide</a>."), " all performance options in $themeName theme performance settings such as ".str_ireplace("_"," ",$key), "https://rabbitloader.com/kb/settings-required-for-themefusion-users/"); |
| 270 |
break; |
| 271 |
} |
| 272 |
} |
| 273 |
} |
| 274 |
}catch(Throwable $e){ |
| 275 |
RabbitLoader_21_Core::on_exception($e); |
| 276 |
} |
| 277 |
} |
| 278 |
} |
| 279 |
|
| 280 |
?> |