balmet.com

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

loader.php (1724B)


      1 <?php
      2 /**
      3  * Use this file to load in the SDK from another plugin
      4  * Example: require_once plugin_dir_path(__FILE__) . 'extendify-templates-sdk/loader.php';
      5  */
      6 
      7 if (!defined('ABSPATH')) {
      8     exit;
      9 }
     10 
     11 if (!function_exists('extendifysdkCheckPluginInstalled')) {
     12     /**
     13      * Will be truthy if the plugin is installed.
     14      *
     15      * @param  string $name name of the plugin 'extendify-sdk'.
     16      * @return bool|string - will return path, ex. 'extendify-sdk/extendify-sdk.php'.
     17      */
     18     function extendifysdkCheckPluginInstalled($name)
     19     {
     20         if (!function_exists('get_plugins')) {
     21             include_once ABSPATH . 'wp-admin/includes/plugin.php';
     22         }
     23 
     24         foreach (get_plugins() as $plugin => $data) {
     25             if ($data['TextDomain'] === $name) {
     26                 return $plugin;
     27             }
     28         }
     29 
     30         return false;
     31     }
     32 }//end if
     33 
     34 // If the template SDK development build is installed, default to that.
     35 $extendifysdkSdk = extendifysdkCheckPluginInstalled('extendify-sdk');
     36 
     37 if ($extendifysdkSdk) {
     38     // Only if it's deactivated.
     39     if (is_plugin_active($extendifysdkSdk)) {
     40         return false;
     41     }
     42 }
     43 
     44 // If Editor Plus is installed, next default to that.
     45 $extendifysdkEditorPlus = extendifysdkCheckPluginInstalled('editor_plus');
     46 if ($extendifysdkEditorPlus) {
     47     // Only if it's deactivated.
     48     if (is_plugin_active($extendifysdkEditorPlus)) {
     49         // Only if we aren't currently inside Editor Plus.
     50         if (strpos(basename(dirname(__DIR__)), 'editorplus') === false) {
     51             return false;
     52         }
     53     }
     54 }
     55 
     56 // Next is first come, first serve.
     57 if (class_exists('ExtendifySdk')) {
     58     return false;
     59 }
     60 
     61 require_once plugin_dir_path(__FILE__) . 'extendify-sdk.php';