-
Notifications
You must be signed in to change notification settings - Fork 77
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0a28ef5
commit b4f03f9
Showing
3 changed files
with
51 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
<?php | ||
/** | ||
* @package Freemius | ||
* @copyright Copyright (c) 2015, Freemius, Inc. | ||
* @license https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Version 3 | ||
* @since 2.2.1 | ||
*/ | ||
|
||
if ( ! defined( 'ABSPATH' ) ) { | ||
exit; | ||
} | ||
|
||
if ( ! function_exists( 'fs_get_plugins' ) ) { | ||
/** | ||
* @author Leo Fajardo (@leorw) | ||
* @since 2.2.1 | ||
* | ||
* @param bool $delete_cache | ||
* | ||
* @return array | ||
*/ | ||
function fs_get_plugins( $delete_cache = false ) { | ||
$cached_plugins = wp_cache_get( 'plugins', 'plugins' ); | ||
if ( ! is_array( $cached_plugins ) ) { | ||
$cached_plugins = array(); | ||
} | ||
|
||
$plugin_folder = ''; | ||
if ( isset( $cached_plugins[ $plugin_folder ] ) ) { | ||
$plugins = $cached_plugins[ $plugin_folder ]; | ||
} else { | ||
if ( ! function_exists( 'get_plugins' ) ) { | ||
require_once ABSPATH . 'wp-admin/includes/plugin.php'; | ||
} | ||
|
||
$plugins = get_plugins(); | ||
|
||
if ( $delete_cache && is_plugin_active( 'woocommerce/woocommerce.php' ) ) { | ||
wp_cache_delete( 'plugins', 'plugins' ); | ||
} | ||
} | ||
|
||
return $plugins; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters