-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add gravity styles and scripts compatibility, fixed lint errors #919
- Loading branch information
Showing
3 changed files
with
52 additions
and
3 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,48 @@ | ||
<?php | ||
defined( 'ABSPATH' ) || die( 'Cheatin’ uh?' ); | ||
|
||
/** | ||
* Check if gravity form is active and no-conflict mode is enabled, | ||
* and you're in gravity form page. | ||
*/ | ||
if ( is_plugin_active( 'gravityforms/gravityforms.php' ) | ||
&& class_exists( 'GFCommon' ) | ||
&& get_option( 'gform_enable_noconflict', false ) | ||
&& GFForms::is_gravity_page() | ||
) { | ||
add_filter( 'gform_noconflict_styles', 'imagify_gf_noconflict_styles' ); | ||
add_filter( 'gform_noconflict_scripts', 'imagify_gf_noconflict_scripts' ); | ||
} | ||
|
||
/** | ||
* Register imagify styles to gravity forms conflict styles | ||
* | ||
* @param array $styles Array fo registered styles | ||
* | ||
* @return array | ||
*/ | ||
function imagify_gf_noconflict_styles( $styles ) { | ||
$styles[] = 'imagify-admin-bar'; | ||
$styles[] = 'imagify-admin'; | ||
$styles[] = 'imagify-notices'; | ||
$styles[] = 'imagify-pricing-modal'; | ||
|
||
return $styles; | ||
} | ||
|
||
/** | ||
* Register Imagify scripts to gravity forms conflict scripts | ||
* | ||
* @param array $scripts Array fo registered scripts | ||
* | ||
* @return array | ||
*/ | ||
function imagify_gf_noconflict_scripts( $scripts ) { | ||
$scripts[] = 'imagify-admin-bar'; | ||
$scripts[] = 'imagify-sweetalert'; | ||
$scripts[] = 'imagify-admin'; | ||
$scripts[] = 'imagify-notices'; | ||
$scripts[] = 'imagify-pricing-modal'; | ||
|
||
return $scripts; | ||
} |
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