-
Notifications
You must be signed in to change notification settings - Fork 0
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
d2add47
commit 8656262
Showing
2 changed files
with
49 additions
and
48 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 |
---|---|---|
@@ -1,48 +1,48 @@ | ||
<?php | ||
/** | ||
* Conditionals. | ||
* | ||
* @package Fl_Custom_Product_Hooks | ||
*/ | ||
|
||
defined( 'ABSPATH' ) || exit; | ||
|
||
/** | ||
* Class FL_CPH_Conditionals | ||
*/ | ||
class FL_CPH_Conditionals { | ||
|
||
/** | ||
* Check if Flatsome theme is activated and its version is 3.4 or above. | ||
* | ||
* @return bool | ||
*/ | ||
public function is_flatsome_activated() { | ||
$theme = wp_get_theme( get_template() ); | ||
$name = $theme->get( 'Name' ); | ||
$version = $theme->get( 'Version' ); | ||
|
||
return 'Flatsome' === $name && version_compare( $version, '3.4.0', '>=' ); | ||
} | ||
|
||
/** | ||
* Check if WooCommerce is activated. | ||
* | ||
* @return bool | ||
*/ | ||
public function is_woocommerce_activated() { | ||
return class_exists( 'WooCommerce', false ); | ||
} | ||
|
||
/** | ||
* Check if plugin is activated. | ||
* | ||
* @param string $class Class name. | ||
* @param bool $autoload To autoload or not. | ||
* | ||
* @return bool | ||
*/ | ||
public function is_plugin_activated( $class, $autoload = false ) { | ||
return class_exists( $class, $autoload ); | ||
} | ||
<?php | ||
/** | ||
* Conditionals. | ||
* | ||
* @package Fl_Custom_Product_Hooks | ||
*/ | ||
|
||
defined( 'ABSPATH' ) || exit; | ||
|
||
/** | ||
* Class FL_CPH_Conditionals | ||
*/ | ||
class FL_CPH_Conditionals { | ||
|
||
/** | ||
* Check if Flatsome theme is activated and its version is 3.6 or above. | ||
* | ||
* @return bool | ||
*/ | ||
public function is_flatsome_activated() { | ||
$theme = wp_get_theme( get_template() ); | ||
$name = $theme->get( 'Name' ); | ||
$version = $theme->get( 'Version' ); | ||
|
||
return 'Flatsome' === $name && version_compare( $version, '3.6.0', '>=' ); | ||
} | ||
|
||
/** | ||
* Check if WooCommerce is activated. | ||
* | ||
* @return bool | ||
*/ | ||
public function is_woocommerce_activated() { | ||
return class_exists( 'WooCommerce', false ); | ||
} | ||
|
||
/** | ||
* Check if plugin is activated. | ||
* | ||
* @param string $class Class name. | ||
* @param bool $autoload To autoload or not. | ||
* | ||
* @return bool | ||
*/ | ||
public function is_plugin_activated( $class, $autoload = false ) { | ||
return class_exists( $class, $autoload ); | ||
} | ||
} |