-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgrfx.php
More file actions
executable file
·193 lines (151 loc) · 5.24 KB
/
grfx.php
File metadata and controls
executable file
·193 lines (151 loc) · 5.24 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
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
182
183
184
185
186
187
188
189
190
191
192
<?php
/**
* grfx
*
* grfx Core - Core functionality of the grfx system.
*
* @package grfx
* @author Leo Blanchette <clipartillustration.com@gmail.com>
* @license GPL-2.0+
* @link https://www.facebook.com/grfx.co
* @copyright 2015 Leo Blanchette
*
* @wordpress-plugin
* Plugin Name: Wordpress Stock Images by grfx
* Plugin URI: https://www.facebook.com/grfx.co
* Description: Sell stock images. Beautifully. Creates a specialized WooCommerce stock image product type. Loved by stock image producers, illustrators, and graphic artists. Automatically processes images into downloadable products, priced by size and license. Light-weight. Great SEO.
* Version: 1.2.2
* Author: Leo Blanchette
* Author URI: https://www.facebook.com/grfx.co
* Text Domain: grfx
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
* Domain Path: /languages
* GitHub Plugin URI: https://github.com/orangeman555/grfx
*/
/*
* Get main functions file
*/
require_once( plugin_dir_path( __FILE__ ) . 'includes/compatability.php' );
/* ----------------------------------------------------------------------------*
* General Functionality
* ---------------------------------------------------------------------------- */
/**
* Main path to plugin.
*
* @package grfx
* @subpackage Constants
*/
function grfx_core_plugin() {
if (!defined('grfx_core_plugin'))
define('grfx_core_plugin', trailingslashit(plugin_dir_path(__FILE__)));
return grfx_core_plugin;
}
grfx_core_plugin();
/**
* Main basename to plugin.
*
* @package grfx
* @subpackage Constants
*/
function grfx_plugin_basename() {
if (!defined('grfx_plugin_basename'))
define('grfx_plugin_basename',plugin_basename( __FILE__ ));
return grfx_plugin_basename;
}
grfx_plugin_basename();
/**
* File path to the 'grfx' plugin directory.
*
* @package grfx
* @subpackage Constants
*/
function grfx_plugin_url() {
if(defined('grfx_DOING_CRON'))
return;
if (!defined('grfx_plugin_url'))
define('grfx_plugin_url', trailingslashit(plugin_dir_url( __FILE__ ) ));
return grfx_plugin_url;
}
grfx_plugin_url();
/*----------------------------------------------------------------------------*
* General Functionality
*----------------------------------------------------------------------------*/
/**
* Check if WooCommerce is active -- if not, give notification.
**/
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ){
/*
* Get Constants
*/
require_once( plugin_dir_path( __FILE__ ) . 'includes/globals.php' );
/*
* Get main functions file
*/
require_once( plugin_dir_path( __FILE__ ) . 'includes/functions.php' );
/*
* Set up woocommerce / grfx cart integration
*/
require_once( plugin_dir_path( __FILE__ ) . 'includes/woocommerce/class-cart.php' );
/*
* Set up woocommerce / grfx integration
*/
require_once( plugin_dir_path( __FILE__ ) . 'includes/woocommerce/class-wc-grfx-settings.php' );
/*
* Set up custom product: Stock Image
*/
require_once(plugin_dir_path( __FILE__ ) . 'includes/woocommerce/product-types/class-wc-product-stock-image.php' );
/*----------------------------------------------------------------------------*
* Public-Facing Functionality
*----------------------------------------------------------------------------*/
require_once( plugin_dir_path( __FILE__ ) . 'public/class-grfx.php' );
/*
* Register hooks that are fired when the plugin is activated or deactivated.
* When the plugin is deleted, the uninstall.php file is loaded.
*/
register_activation_hook( __FILE__, array( 'grfx', 'activate' ) );
register_deactivation_hook( __FILE__, array( 'grfx', 'deactivate' ) );
add_action( 'plugins_loaded', array( 'grfx', 'get_instance' ) );
/*----------------------------------------------------------------------------*
* Dashboard and Administrative Functionality
*----------------------------------------------------------------------------*/
/*
* The code below is intended to to give the lightest footprint possible.
*/
if ( is_admin( ) || ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) {
require_once( plugin_dir_path( __FILE__ ) . 'admin/class-grfx-admin.php' );
add_action( 'plugins_loaded', array( 'grfx_Admin', 'get_instance' ) );
require_once ('admin/ajax.php');
/*
* PLUGIN MANAGEMENT FUNCTIONS (Setup, updates, stability)
*/
/*
* If not multisite, we tell site owner to get woocommerce.
*
* A multi-site webmaster has no excuse to not know this! :)
*/
if(!is_multisite()){
require_once('admin/includes/plugins/plugins.php');
}
/*
* Redirect user to various pages on various events (such as plugin activation)
*/
require_once( plugin_dir_path( __FILE__ ) . 'includes/admin-redirect.php' );
}
}else{
/**
* Gives a notice that Woocommerce should be installed before operating plugin.
*/
function grfx_install_plugins_notice() {
?>
<div class="error">
<p><?php _e( 'First install Woocommerce for grfx to work.', 'grfx' ); ?></p>
</div>
<?php
}
add_action( 'admin_notices', 'grfx_install_plugins_notice' );
if(!is_multisite()){
require_once('admin/includes/plugins/plugins.php');
}
update_option('grfx_installed_installed', false);
}