| 1 |
<?php |
| 2 |
// phpcs:ignoreFile |
| 3 |
// This class was copied from JetPack (mostly) |
| 4 |
// so will be a bit of work to refactor |
| 5 |
/** |
| 6 |
* Manage plugin dependencies |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace Extendify\Library; |
| 10 |
|
| 11 |
class Plugin |
| 12 |
{ |
| 13 |
/** |
| 14 |
* Will return info about a plugin |
| 15 |
* |
| 16 |
* @param string $identifier The key of the plugin info. |
| 17 |
* @param string $plugin_id The plugin identifier string. |
| 18 |
* @return string |
| 19 |
*/ |
| 20 |
public static function getPluginInfo($identifier, $plugin_id) |
| 21 |
{ |
| 22 |
if (!function_exists('get_plugins')) { |
| 23 |
include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 24 |
} |
| 25 |
|
| 26 |
foreach (get_plugins() as $plugin => $data) { |
| 27 |
if ($data[$identifier] === $plugin_id) { |
| 28 |
return $plugin; |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
return false; |
| 33 |
} |
| 34 |
} |
| 35 |
|