public static function active_plugins($idx = false) { // create list only once if (empty(self::$plugins_idx)) { $all_plugins = self::$site_plugins = get_option('active_plugins', array()); if (is_multisite()) { self::$network_plugins = array_keys(get_site_option('active_sitewide_plugins', array())); if (!empty(self::$network_plugins)) { $all_plugins = array_merge(self::$site_plugins, self::$network_plugins); } } foreach ($all_plugins as $base) { self::$plugins_idx[$base] = true; } } if ($idx !== false) { if (isset(self::$plugins_idx[$idx])) { return self::$plugins_idx[$idx]; } else { return false; } } else { return self::$plugins_idx; } }