-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsprout-clients.php
More file actions
148 lines (132 loc) · 3.9 KB
/
sprout-clients.php
File metadata and controls
148 lines (132 loc) · 3.9 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
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
<?php
/*
* Plugin Name: Sprout Clients
* Plugin URI: https://sproutinvoices.com/sprout-clients/
* Description: Contact relationship management to increase productivity in gaining clients and business relationships.
* Author: Sprout Apps
* Version: 3.2.3
* Author URI: https://sproutinvoices.com
* Text Domain: sprout-invoices
* Domain Path: languages
*/
/**
* SC directory
*/
define( 'SC_PATH', WP_PLUGIN_DIR . '/' . basename( dirname( __FILE__ ) ) );
/**
* Plugin File
*/
define( 'SC_PLUGIN_FILE', __FILE__ );
/**
* SC URL
*/
define( 'SC_URL', plugins_url( '', __FILE__ ) );
/**
* URL to resources directory
*/
define( 'SC_RESOURCES', plugins_url( 'resources/', __FILE__ ) );
/**
* Minimum supported verscon of WordPress
*/
define( 'SC_SUPPORTED_WP_VERSION', version_compare( get_bloginfo( 'version' ), '4.4', '>=' ) );
/**
* Minimum supported verscon of PHP
*/
define( 'SC_SUPPORTED_PHP_VERSION', version_compare( phpversion(), '5.2.4', '>=' ) );
function sc_fs() {
global $sc_fs;
if ( ! isset( $sc_fs ) ) {
// Include Freemius SDK.
require_once SC_PATH . '/controllers/updates/freemius-sdk/start.php';
$sc_fs = fs_dynamic_init( array(
'id' => '277',
'slug' => 'sprout-clients',
'public_key' => 'pk_c8de69aa4314d4663bf5ee5a47e76',
'is_premium' => false,
'has_addons' => false,
'has_paid_plans' => false,
'menu' => array(
'slug' => 'sprout-apps/settings',
'first-path' => 'admin.php?page=sprout-clients&tab=sc_getting_started',
'account' => false,
'contact' => false,
'support' => false,
),
) );
}
return $sc_fs;
}
// Init Freemius.
sc_fs();
/**
* Load plugin
*/
define( 'SC_FREE_TEST', true );
require_once SC_PATH . '/load.php';
/**
* Compatibility check
*/
if ( ! SC_SUPPORTED_WP_VERSION || ! SC_SUPPORTED_PHP_VERSION ) {
/**
* Disable SC and add fail notices if compatibility check fails
* @return string inserted within the WP dashboard
*/
sc_deactivate_plugin();
add_action( 'admin_head', 'sc_compatibility_check_fail_notices' );
return;
}
/**
* Load it up!
*/
add_action( 'plugins_loaded', 'sprout_clients_load', 110 ); // load up after Sprout Invoices
/**
* do_action when plugin is activated.
* @package Sprout_Clients
* @ignore
*/
register_activation_hook( __FILE__, 'sc_plugin_activated' );
if ( ! function_exists( 'sc_plugin_activated' ) ) {
function sc_plugin_activated() {
sprout_clients_load(); // load before hook
do_action( 'sc_plugin_activation_hook' );
}
}
/**
* do_action when plugin is deactivated.
* @package Sprout_Clients
* @ignore
*/
register_deactivation_hook( __FILE__, 'sc_plugin_deactivated' );
if ( ! function_exists( 'sc_plugin_deactivated' ) ) {
function sc_plugin_deactivated() {
//sprout_clients_load(); // load before hook
do_action( 'sc_plugin_deactivation_hook' );
}
}
/**
* Deactivate plugin
*/
if ( ! function_exists( 'sc_deactivate_plugin' ) ) {
function sc_deactivate_plugin() {
if ( is_admin() && ( ! defined( 'DOING_AJAX' ) || ! DOING_AJAX ) ) {
// Fire hooks
do_action( 'sc_plugin_deactivation_hook' );
require_once ABSPATH.'/wp-admin/includes/plugin.php';
deactivate_plugins( __FILE__ );
}
}
}
/**
* Error messaging for compatibility check.
* @return string error messages
*/
if ( ! function_exists( 'sc_compatibility_check_fail_notices' ) ) {
function sc_compatibility_check_fail_notices() {
if ( ! SC_SUPPORTED_WP_VERSION ) {
printf( '<div class="error"><p><strong>Sprout Clients</strong> requires WordPress %s or higher. Please upgrade WordPress and activate the Sprout Clients Plugin again.</p></div>', SC_SUPPORTED_WP_VERSION );
}
if ( ! SC_SUPPORTED_PHP_VERSION ) {
printf( '<div class="error"><p><strong>Sprout Clients</strong> requires PHP verscon %s or higher to be installed on your server. Talk to your web host about uscng a secure verscon of PHP.</p></div>', SC_SUPPORTED_PHP_VERSION );
}
}
}