forked from monksbistro/gravityflow
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gravityflow.php
182 lines (142 loc) · 5.2 KB
/
gravityflow.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
/**
Plugin Name: Gravity Flow
Plugin URI: https://gravityflow.io
Description: Build Workflow Applications with Gravity Forms.
Version: 2.2.2-dev
Author: Gravity Flow
Author URI: https://gravityflow.io
License: GPL-3.0+
Text Domain: gravityflow
Domain Path: /languages
------------------------------------------------------------------------
Copyright 2015-2018 Steven Henty S.L.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see http://www.gnu.org/licenses.
*/
define( 'GRAVITY_FLOW_VERSION', '2.2.2-dev' );
define( 'GRAVITY_FLOW_EDD_STORE_URL', 'https://gravityflow.io' );
define( 'GRAVITY_FLOW_EDD_ITEM_NAME', 'Gravity Flow' );
add_action( 'gform_loaded', array( 'Gravity_Flow_Bootstrap', 'load' ), 1 );
/**
* Class Gravity_Flow_Bootstrap
*/
class Gravity_Flow_Bootstrap {
/**
* Includes the required files and registers the add-on with Gravity Forms.
*/
public static function load() {
if ( ! method_exists( 'GFForms', 'include_feed_addon_framework' ) ) {
return;
}
if ( ! class_exists( 'Gravity_Flow_EDD_SL_Plugin_Updater' ) ) {
include( dirname( __FILE__ ) . '/includes/EDD_SL_Plugin_Updater.php' );
}
if ( ! class_exists( 'Gravity_Flow_API' ) ) {
include( dirname( __FILE__ ) . '/includes/class-api.php' );
}
if ( ! class_exists( 'Gravity_Flow_Web_API' ) ) {
include( dirname( __FILE__ ) . '/includes/class-web-api.php' );
}
if ( ! class_exists( 'Gravity_Flow_REST_API' ) ) {
include( dirname( __FILE__ ) . '/includes/class-rest-api.php' );
}
if ( ! class_exists( 'Gravity_Flow_Extension' ) ) {
include( dirname( __FILE__ ) . '/includes/class-extension.php' );
}
if ( ! class_exists( 'Gravity_Flow_Feed_Extension' ) ) {
include( dirname( __FILE__ ) . '/includes/class-feed-extension.php' );
}
if ( class_exists( 'GravityView_Field' ) ) {
include( dirname( __FILE__ ) . '/includes/class-gravityview-detail-link.php' );
}
require_once( dirname( __FILE__ ) . '/includes/class-common.php' );
require_once( 'includes/class-connected-apps.php' );
require_once( 'class-gravity-flow.php' );
require_once( 'includes/models/class-activity.php' );
require_once( 'includes/integrations/class-gp-nested-forms.php' );
self::include_assignees();
self::include_steps();
self::include_fields();
self::include_merge_tags();
GFAddOn::register( 'Gravity_Flow' );
do_action( 'gravityflow_loaded' );
}
/**
* Includes the assignee classes.
*/
public static function include_assignees() {
require_once( dirname( __FILE__ ) . '/includes/assignees/class-assignees.php' );
require_once( dirname( __FILE__ ) . '/includes/assignees/class-assignee.php' );
}
/**
* Includes the step classes.
*/
public static function include_steps() {
require_once( dirname( __FILE__ ) . '/includes/steps/class-step.php' );
require_once( dirname( __FILE__ ) . '/includes/steps/class-steps.php' );
require_once( dirname( __FILE__ ) . '/includes/steps/class-step-feed-add-on.php' );
foreach ( glob( dirname( __FILE__ ) . '/includes/steps/class-step-*.php' ) as $gravity_flow_filename ) {
require_once( $gravity_flow_filename );
}
}
/**
* Includes the field classes.
*/
public static function include_fields() {
require_once( dirname( __FILE__ ) . '/includes/fields/class-fields.php' );
foreach ( glob( dirname( __FILE__ ) . '/includes/fields/class-field-*.php' ) as $gravity_flow_filename ) {
require_once( $gravity_flow_filename );
}
}
/**
* Includes the merge tag classes.
*/
public static function include_merge_tags() {
require_once( dirname( __FILE__ ) . '/includes/merge-tags/class-merge-tag.php' );
require_once( dirname( __FILE__ ) . '/includes/merge-tags/class-merge-tags.php' );
foreach ( glob( dirname( __FILE__ ) . '/includes/merge-tags/class-merge-tag-*.php' ) as $gravity_flow_filename ) {
require_once( $gravity_flow_filename );
}
}
}
/**
* Returns an instance of the Gravity_Flow class.
*
* @return Gravity_Flow|null
*/
function gravity_flow() {
if ( class_exists( 'Gravity_Flow' ) ) {
return Gravity_Flow::get_instance();
}
return null;
}
add_action( 'init', 'gravityflow_edd_plugin_updater', 0 );
/**
* Initialize the EDD plugin updater.
*/
function gravityflow_edd_plugin_updater() {
$gravity_flow = gravity_flow();
if ( $gravity_flow ) {
if ( defined( 'GRAVITY_FLOW_LICENSE_KEY' ) ) {
$license_key = GRAVITY_FLOW_LICENSE_KEY;
} else {
$settings = gravity_flow()->get_app_settings();
$license_key = trim( rgar( $settings, 'license_key' ) );
}
new Gravity_Flow_EDD_SL_Plugin_Updater( GRAVITY_FLOW_EDD_STORE_URL, __FILE__, array(
'version' => GRAVITY_FLOW_VERSION,
'license' => $license_key,
'item_name' => GRAVITY_FLOW_EDD_ITEM_NAME,
'author' => 'Steven Henty',
) );
}
}