| 1 |
<?php |
| 2 |
/** |
| 3 |
* This file is used to help side load the library. |
| 4 |
* Be sure to remove the front matter from extendify.php |
| 5 |
*/ |
| 6 |
|
| 7 |
if (!defined('ABSPATH')) { |
| 8 |
exit; |
| 9 |
} |
| 10 |
|
| 11 |
if (!function_exists('extendifyCheckPluginInstalled')) { |
| 12 |
/** |
| 13 |
* Will be truthy if the plugin is installed. |
| 14 |
* |
| 15 |
* @param string $name name of the plugin 'extendify'. |
| 16 |
* @return bool|string - will return path, ex. 'extendify/extendify.php'. |
| 17 |
*/ |
| 18 |
function extendifyCheckPluginInstalled($name) |
| 19 |
{ |
| 20 |
if (!function_exists('get_plugins')) { |
| 21 |
include_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 22 |
} |
| 23 |
|
| 24 |
$plugins = get_plugins(); |
| 25 |
// Don't cache plugins this early. |
| 26 |
wp_cache_delete('plugins', 'plugins'); |
| 27 |
foreach ($plugins as $plugin => $data) { |
| 28 |
if ($data['TextDomain'] === $name) { |
| 29 |
return $plugin; |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
return false; |
| 34 |
} |
| 35 |
}//end if |
| 36 |
|
| 37 |
$extendifyPluginName = extendifyCheckPluginInstalled('extendify'); |
| 38 |
if ($extendifyPluginName) { |
| 39 |
// Exit if the library is installed and active. |
| 40 |
// Remember, this file is only loaded by partner plugins. |
| 41 |
if (is_plugin_active($extendifyPluginName)) { |
| 42 |
// If the SDK is active then ignore the partner plugins. |
| 43 |
$GLOBALS['extendify_sdk_partner'] = 'standalone'; |
| 44 |
return false; |
| 45 |
} |
| 46 |
} |
| 47 |
|
| 48 |
// Next is first come, first served. The later class is left in for historical reasons. |
| 49 |
if (class_exists('Extendify') || class_exists('ExtendifySdk')) { |
| 50 |
return false; |
| 51 |
} |
| 52 |
|
| 53 |
require_once plugin_dir_path(__FILE__) . 'extendify.php'; |
| 54 |
|