Skip to content

Commit

Permalink
Merge pull request #284 from Freemius/develop
Browse files Browse the repository at this point in the history
[start] [essentials] [bug-fix]
  • Loading branch information
vovafeldman authored Nov 28, 2018
2 parents 553553d + b4f03f9 commit 4dab832
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 34 deletions.
34 changes: 1 addition & 33 deletions includes/fs-essential-functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,39 +36,7 @@ function fs_normalize_path( $path ) {
}
}

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;
}
}
require_once dirname( __FILE__ ) . '/supplements/fs-essential-functions-2.2.1.php';

#region Core Redirect (copied from BuddyPress) -----------------------------------------

Expand Down
45 changes: 45 additions & 0 deletions includes/supplements/fs-essential-functions-2.2.1.php
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;
}
}
6 changes: 5 additions & 1 deletion start.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*
* @var string
*/
$this_sdk_version = '2.2.1';
$this_sdk_version = '2.2.2';

#region SDK Selection Logic --------------------------------------------------------------------

Expand Down Expand Up @@ -120,6 +120,10 @@
require_once dirname( __FILE__ ) . '/includes/supplements/fs-essential-functions-1.1.7.1.php';
}

if ( ! function_exists( 'fs_get_plugins' ) ) {
require_once dirname( __FILE__ ) . '/includes/supplements/fs-essential-functions-2.2.1.php';
}

// Update current SDK info based on the SDK path.
if ( ! isset( $fs_active_plugins->plugins[ $this_sdk_relative_path ] ) ||
$this_sdk_version != $fs_active_plugins->plugins[ $this_sdk_relative_path ]->version
Expand Down

0 comments on commit 4dab832

Please sign in to comment.