-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.php
More file actions
55 lines (45 loc) · 1.7 KB
/
plugin.php
File metadata and controls
55 lines (45 loc) · 1.7 KB
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
<?php
/**
* Plugin Name: GravityForms Fishbowl Integration
* Description: Enables GravityForms entries to submit to Fishbowl's CRM Platform
* Version: 1.2
* Author: Dan Scott
* Author URI: https://danscott.dev
* Author Email: danscott2150@gmail.com
*
*/
namespace GF_Fishbowl;
define( 'GF_FISHBOWL_PATH', plugin_dir_path( __FILE__ ) );
define( 'GF_FISHBOWL_URL', plugin_dir_url( __FILE__ ) );
if ( ! defined( 'WPINC' ) ) {
die( 'Nope' );
}
use GF_Fishbowl\Integration;
use GF_Fishbowl\Settings;
add_action( 'plugins_loaded', function() {
require_once GF_FISHBOWL_PATH . '/class-integration.php';
require_once GF_FISHBOWL_PATH . '/class-settings.php';
require_once GF_FISHBOWL_PATH . '/class-meta-boxes.php';
require_once GF_FISHBOWL_PATH . '/class-utils.php';
require_once GF_FISHBOWL_PATH . '/class-validation.php';
require_once GF_FISHBOWL_PATH . '/class-retry.php';
new Integration();
new Settings();
new Meta_Boxes();
new Validation();
new Retry();
} );
wp_enqueue_script('custom-gravity-forms-js', '' . GF_FISHBOWL_URL . '/custom-validation.js', array('jquery'), null, true);
// On plugin activation: Adds custom 'CRM Status' field to all forms.
// This field is not mission-critical, but adds a helpful layer of visibility to any entries that may not have posted.
register_activation_hook( __FILE__, function(){
// require_once GF_FISHBOWL_PATH . '/class-activation.php';
// Activation::activate();
if ( ! wp_next_scheduled('twb_fishbowl_retry_api')) {
wp_schedule_event(time(), 'hourly', 'twb_fishbowl_retry_api');
}
} );
register_deactivation_hook(__FILE__, function(){
$timestamp = wp_next_scheduled('twb_fishbowl_retry_api');
wp_unschedule_event($timestamp, 'twb_fishbowl_retry_api');
});