ScriptsConflict() { $_this = $this; $_this->permittedAssetsLocations['scripts'] = WPFunctions::get()->applyFilters('mailpoet_conflict_resolver_whitelist_script', $_this->permittedAssetsLocations['scripts']); // unload all scripts except from the list of allowed $dequeueScripts = function() use($_this) { global $wp_scripts; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps foreach ($wp_scripts->queue as $wpScript) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps if (empty($wp_scripts->registered[$wpScript])) continue; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps $registeredScript = $wp_scripts->registered[$wpScript]; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps if (!is_string($registeredScript->src)) { continue; } if (!preg_match('!' . implode('|', $_this->permittedAssetsLocations['scripts']) . '!i', $registeredScript->src)) { WPFunctions::get()->wpDequeueScript($wpScript); } } }; // execute last in the following hooks $executeLast = PHP_INT_MAX; WPFunctions::get()->addAction('admin_enqueue_scripts', $dequeueScripts, $executeLast); WPFunctions::get()->addAction('admin_footer', $dequeueScripts, $executeLast); // execute first in hooks for printing (after printing is too late) $executeFirst = defined('PHP_INT_MIN') ? constant('PHP_INT_MIN') : ~PHP_INT_MAX; WPFunctions::get()->addAction('admin_print_scripts', $dequeueScripts, $executeFirst); WPFunctions::get()->addAction('admin_print_footer_scripts', $dequeueScripts, $executeFirst); } public function resolveEditorConflict() { // mark editor as already enqueued to prevent loading its assets // when wp_enqueue_editor() used by some other plugin global $wp_actions; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps $wp_actions['wp_enqueue_editor'] = 1; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps // prevent editor loading when used wp_editor() used by some other plugin WPFunctions::get()->addFilter('wp_editor_settings', function () { ob_start(); return [ 'tinymce' => false, 'quicktags' => false, ]; }); WPFunctions::get()->addFilter('the_editor', function () { return ''; }); WPFunctions::get()->addFilter('the_editor_content', function () { ob_end_clean(); return ''; }); } public function resolveTinyMceConflict() { // WordPress TinyMCE scripts may not get enqueued as scripts when some plugins use wp_editor() // or wp_enqueue_editor(). Instead, they are printed inside the footer script print actions. // To unload TinyMCE we need to remove those actions. $tinyMceFooterScriptHooks = [ '_WP_Editors::enqueue_scripts', '_WP_Editors::editor_js', '_WP_Editors::force_uncompressed_tinymce', '_WP_Editors::print_default_editor_scripts', ]; $disableWpTinymce = function() use ($tinyMceFooterScriptHooks) { global $wp_filter; // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps $actionName = 'admin_print_footer_scripts'; if (!isset($wp_filter[$actionName])) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps return; } foreach ($wp_filter[$actionName]->callbacks as $priority => $callbacks) { // phpcs:ignore Squiz.NamingConventions.ValidVariableName.MemberNotCamelCaps foreach ($tinyMceFooterScriptHooks as $hook) { if (isset($callbacks[$hook])) { WPFunctions::get()->removeAction($actionName, $callbacks[$hook]['function'], $priority); } } } }; WPFunctions::get()->addAction('admin_footer', $disableWpTinymce, PHP_INT_MAX); } }
Fatal error: Uncaught Error: Class "MailPoet\Util\ConflictResolver" not found in /htdocs/wp-content/plugins/mailpoet/lib/Config/Initializer.php:498 Stack trace: #0 /htdocs/wp-content/plugins/mailpoet/lib/Config/Initializer.php(375): MailPoet\Config\Initializer->setupConflictResolver() #1 /htdocs/wp-includes/class-wp-hook.php(324): MailPoet\Config\Initializer->initialize('') #2 /htdocs/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array) #3 /htdocs/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #4 /htdocs/wp-settings.php(704): do_action('init') #5 /htdocs/wp-config.php(85): require_once('/htdocs/wp-sett...') #6 /htdocs/wp-load.php(50): require_once('/htdocs/wp-conf...') #7 /htdocs/wp-blog-header.php(13): require_once('/htdocs/wp-load...') #8 /htdocs/index.php(17): require('/htdocs/wp-blog...') #9 {main} thrown in /htdocs/wp-content/plugins/mailpoet/lib/Config/Initializer.php on line 498