-
Notifications
You must be signed in to change notification settings - Fork 0
/
athena-gravityforms.php
60 lines (52 loc) · 1.56 KB
/
athena-gravityforms.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/*
Plugin Name: Athena Gravity Forms
Description: Provides Athena Framework styling for Gravity Forms.
Version: 2.0.2
Author: UCF Web Communications
License: GPL3
*/
if ( ! defined( 'WPINC' ) ) {
die;
}
define( 'ATHENA_GF__PLUGIN_FILE', __FILE__ );
/**
* Activation/deactivation hooks
**/
if ( !function_exists( 'athena_gf_plugin_activation' ) ) {
function athena_gf_plugin_activation() {
return;
}
}
if ( !function_exists( 'athena_gf_plugin_deactivation' ) ) {
function athena_gf_plugin_deactivation() {
return;
}
}
register_activation_hook( ATHENA_GF__PLUGIN_FILE, 'athena_gf_plugin_activation' );
register_deactivation_hook( ATHENA_GF__PLUGIN_FILE, 'athena_gf_plugin_deactivation' );
/**
* Plugin-dependent actions:
**/
if ( ! function_exists( 'athena_gf_init' ) ) {
function athena_gf_init() {
// If Gravity Forms is installed, update necessary settings.
if ( class_exists( 'GFForms' ) ) {
// Disable CSS
update_option( 'rg_gforms_disable_css', 1 );
// Enable HTML5 fields
update_option( 'rg_gforms_enable_html5', 1 );
}
}
add_action( 'plugins_loaded', 'athena_gf_init' );
}
if ( ! function_exists( 'athena_gf_enqueue_assets' ) ) {
function athena_gf_enqueue_assets() {
if ( class_exists( 'GFForms' ) ) {
// Enqueue assets if Gravity Forms is installed and active
$css_deps = apply_filters( 'athena_gf_style_deps', array() );
wp_enqueue_style( 'athena_gf_css', plugins_url( 'static/css/athena-gf.min.css', ATHENA_GF__PLUGIN_FILE ), $css_deps, false, 'screen' );
}
}
add_action( 'wp_enqueue_scripts', 'athena_gf_enqueue_assets' );
}