forked from CalderaWP/Caldera-Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcaldera-core.php
92 lines (71 loc) · 2.56 KB
/
caldera-core.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
<?php
/*
Plugin Name: Caldera Forms
Plugin URI: https://calderawp.com/caldera-forms/
Description: Easy to use, grid based responsive form builder for creating simple to complex forms.
Author: David Cramer
Version: 1.3.4
Author URI: https://calderawp.com
Text Domain: caldera-forms
GitHub Plugin URI: https://github.com/Desertsnowman/Caldera-Forms/
GitHub Branch: current-stable
*/
//initilize plugin
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
define('CFCORE_PATH', plugin_dir_path(__FILE__));
define('CFCORE_URL', plugin_dir_url(__FILE__));
define('CFCORE_VER', '1.3.4');
define('CFCORE_EXTEND_URL', 'https://api.calderaforms.com/1.0/');
define( 'CFCORE_BASENAME', plugin_basename( __FILE__ ) );
/**
* Caldera Forms DB version
*
* @since 1.3.4
*
* PLEASE keep this an integer
*/
define( 'CF_DB', 2 );
include_once CFCORE_PATH . 'classes/core.php';
include_once CFCORE_PATH . 'classes/widget.php';
include_once CFCORE_PATH . 'classes/sanitize.php';
include_once CFCORE_PATH . 'classes/forms.php';
// includes
include_once CFCORE_PATH . 'includes/ajax.php';
include_once CFCORE_PATH . 'includes/field_processors.php';
include_once CFCORE_PATH . 'includes/custom_field_class.php';
include_once CFCORE_PATH . 'includes/filter_addon_plugins.php';
include_once CFCORE_PATH . 'processors/classes/load.php';
include_once CFCORE_PATH . 'processors/classes/get_data.php';
// init internals of CF urls
add_action( 'init', array( 'Caldera_Forms', 'init_cf_internal' ) );
// table builder
register_activation_hook( __FILE__, array( 'Caldera_Forms', 'activate_caldera_forms' ) );
add_action( 'plugins_loaded', array( 'Caldera_Forms', 'get_instance' ) );
// Admin & Admin Ajax stuff.
if ( is_admin() || defined( 'DOING_AJAX' ) ) {
require_once( CFCORE_PATH . 'classes/admin.php' );
add_action( 'plugins_loaded', array( 'Caldera_Forms_Admin', 'get_instance' ) );
}
if ( is_admin() ) {
require_once( CFCORE_PATH . 'processors/classes/ui.php' );
}
add_action( 'activate_' . CFCORE_BASENAME, 'caldera_forms_db_update' );
add_action( 'admin_init', 'caldera_forms_db_update', 0 );
function caldera_forms_db_update(){
if( current_user_can( 'manage_options' ) ){
$db_version = get_option( 'CF_DB', 0 );
$force_update = false;
if( isset( $_GET[ 'cal_db_update' ] ) ) {
$force_update = (bool) wp_verify_nonce( $_GET[ 'cal_db_update' ] );
}
if( CF_DB > $db_version || $force_update ) {
include_once CFCORE_PATH . 'includes/updater.php';
if ( $db_version < 2 || $force_update ) {
caldera_forms_db_v2_update();
}
}
}
}