| 1 |
<?php |
| 2 |
namespace Elementor\Modules\CompatibilityTag; |
| 3 |
|
| 4 |
use Elementor\Plugin; |
| 5 |
use Elementor\Core\Utils\Version; |
| 6 |
use Elementor\Core\Utils\Collection; |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit if accessed directly. |
| 10 |
} |
| 11 |
|
| 12 |
/** |
| 13 |
* Inspired By WooCommerce. |
| 14 |
* |
| 15 |
* @link https://github.com/woocommerce/woocommerce/blob/master/includes/admin/plugin-updates/class-wc-plugin-updates.php |
| 16 |
*/ |
| 17 |
class Module extends Base_Module { |
| 18 |
/** |
| 19 |
* This is the header used by extensions to show testing. |
| 20 |
* |
| 21 |
* @var string |
| 22 |
*/ |
| 23 |
const PLUGIN_VERSION_TESTED_HEADER = 'Elementor tested up to'; |
| 24 |
|
| 25 |
/** |
| 26 |
* @return string |
| 27 |
*/ |
| 28 |
protected function get_plugin_header() { |
| 29 |
return static::PLUGIN_VERSION_TESTED_HEADER; |
| 30 |
} |
| 31 |
|
| 32 |
/** |
| 33 |
* @return string |
| 34 |
*/ |
| 35 |
protected function get_plugin_label() { |
| 36 |
return esc_html__( 'Elementor', 'elementor' ); |
| 37 |
} |
| 38 |
|
| 39 |
/** |
| 40 |
* @return string |
| 41 |
*/ |
| 42 |
protected function get_plugin_name() { |
| 43 |
return ELEMENTOR_PLUGIN_BASE; |
| 44 |
} |
| 45 |
|
| 46 |
/** |
| 47 |
* @return string |
| 48 |
*/ |
| 49 |
protected function get_plugin_version() { |
| 50 |
return ELEMENTOR_VERSION; |
| 51 |
} |
| 52 |
|
| 53 |
/** |
| 54 |
* @return Collection |
| 55 |
*/ |
| 56 |
protected function get_plugins_to_check() { |
| 57 |
return parent::get_plugins_to_check() |
| 58 |
->merge( $this->get_plugins_with_plugin_title_in_their_name() ); |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* Get all the plugins that has the name of the current plugin in their name. |
| 63 |
* |
| 64 |
* @return Collection |
| 65 |
*/ |
| 66 |
private function get_plugins_with_plugin_title_in_their_name() { |
| 67 |
return Plugin::$instance->wp |
| 68 |
->get_plugins() |
| 69 |
->except( [ |
| 70 |
'elementor/elementor.php', |
| 71 |
'elementor-beta/elementor-beta.php', |
| 72 |
'block-builder/block-builder.php', |
| 73 |
] ) |
| 74 |
->filter( function ( array $data ) { |
| 75 |
return false !== strpos( strtolower( $data['Name'] ), 'elementor' ); |
| 76 |
} ); |
| 77 |
} |
| 78 |
} |
| 79 |
|