forked from tlamedia/gtm-kit
-
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
bc5a603
commit cea9041
Showing
8 changed files
with
106 additions
and
7 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,21 @@ | ||
<?php | ||
/** | ||
* GTM Kit plugin file. | ||
* | ||
* @package GTM Kit | ||
*/ | ||
|
||
namespace TLA_Media\GTM_Kit\Common\Conditionals; | ||
|
||
/** | ||
* Conditional interface. | ||
*/ | ||
interface Conditional { | ||
|
||
/** | ||
* Returns whether this conditional is met. | ||
* | ||
* @return bool Whether the conditional is met. | ||
*/ | ||
public function is_met(): bool; | ||
} |
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,23 @@ | ||
<?php | ||
/** | ||
* GTM Kit plugin file. | ||
* | ||
* @package GTM Kit | ||
*/ | ||
|
||
namespace TLA_Media\GTM_Kit\Common\Conditionals; | ||
|
||
/** | ||
* Conditional that is only met when Easy Digital Downloads is active. | ||
*/ | ||
class ContactForm7Conditional implements Conditional { | ||
|
||
/** | ||
* Returns `true` when the Contact Form 7 plugin is installed and activated. | ||
* | ||
* @return bool `true` when the Contact Form 7 plugin is installed and activated. | ||
*/ | ||
public function is_met(): bool { | ||
return \class_exists( 'CF7' ); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
src/Common/Conditionals/EasyDigitalDownloadsConditional.php
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,23 @@ | ||
<?php | ||
/** | ||
* GTM Kit plugin file. | ||
* | ||
* @package GTM Kit | ||
*/ | ||
|
||
namespace TLA_Media\GTM_Kit\Common\Conditionals; | ||
|
||
/** | ||
* Conditional that is only met when Easy Digital Downloads is active. | ||
*/ | ||
class EasyDigitalDownloadsConditional implements Conditional { | ||
|
||
/** | ||
* Returns `true` when the Easy Digital Downloads plugin is installed and activated. | ||
* | ||
* @return bool `true` when the Easy Digital Downloads plugin is installed and activated. | ||
*/ | ||
public function is_met(): bool { | ||
return \class_exists( 'Easy_Digital_Downloads' ); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
/** | ||
* GTM Kit plugin file. | ||
* | ||
* @package GTM Kit | ||
*/ | ||
|
||
namespace TLA_Media\GTM_Kit\Common\Conditionals; | ||
|
||
/** | ||
* Conditional that is only met when WooCommerce is active. | ||
*/ | ||
class WoocommerceConditional implements Conditional { | ||
|
||
/** | ||
* Returns `true` when the WooCommerce plugin is installed and activated. | ||
* | ||
* @return bool `true` when the WooCommerce plugin is installed and activated. | ||
*/ | ||
public function is_met(): bool { | ||
return \function_exists( 'WC' ); | ||
} | ||
} |
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
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