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