-
Notifications
You must be signed in to change notification settings - Fork 7
/
jigoshop.php
executable file
·162 lines (152 loc) · 5.71 KB
/
jigoshop.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
<?php
/**
* ./////////////////////////////.
* //////////////////////////////////
* /////////// ///////////////////
* //////// /////////////////////
* ////// ////////////////////////
* ///// ///////// ////////////
* ////// ///////// /////////
* ///////// ///////// ///////
* /////////// ////////// /////
* //////////////////////// //////
* ///////////////////// /////////
* /////////////////// ///////////
* //////////////////////////////////
* `//////////////////////////////`
*
* Plugin Name: Jigoshop eCommerce
* Plugin URI: http://www.jigoshop.com/
* Description: Jigoshop, a WordPress eCommerce plugin that works.
* Author: Jigo Ltd
* Author URI: http://www.jigoshop.com
* Version: 2.1.18.1
* Requires at least: 4.0
* Tested up to: 5.0.3
* Text Domain: jigoshop-ecommerce
* Domain Path: /languages/
*
* DISCLAIMER
* Do not edit or add directly to this file if you wish to upgrade Jigoshop to newer
* versions in the future. If you wish to customise Jigoshop core for your needs,
* please use our GitHub repository to publish essential changes for consideration.
*
* @package Jigoshop
* @category Core
* @author Jigo Ltd
* @copyright Copyright © 2011-2018 Jigo Ltd.
* @license GNU General Public License v3
*/
// Define plugin directory for inclusions
if (!defined('JIGOSHOP_DIR')) {
/**
* @deprecated 2.0:2.1 Use Jigoshop::getDir() instead
*/
define('JIGOSHOP_DIR', dirname(__FILE__));
}
// Define plugin URL for assets
if (!defined('JIGOSHOP_URL')) {
/**
* @deprecated 2.0:2.1 Use Jigoshop::getUrl() instead
*/
define('JIGOSHOP_URL', plugins_url('', __FILE__));
}
// Define plugin base name
if (!defined('JIGOSHOP_BASE_NAME')) {
/**
* @deprecated 2.0:2.1 Use Jigoshop::getBaseName() instead
*/
define('JIGOSHOP_BASE_NAME', plugin_basename(__FILE__));
}
if (!defined('WP_DEBUG')) {
define('WP_DEBUG', false);
}
define('JIGOSHOP_REQUIRED_MEMORY', 64);
define('JIGOSHOP_REQUIRED_WP_MEMORY', 40);
define('JIGOSHOP_PHP_VERSION', '5.6');
define('JIGOSHOP_WORDPRESS_VERSION', '3.8');
if(version_compare(PHP_VERSION, JIGOSHOP_PHP_VERSION, '<')){
function jigoshop_required_version(){
echo '<div class="error"><p>'.
sprintf(__('<strong>Error!</strong> Jigoshop requires at least PHP %s! Your version is: %s. Please upgrade.', 'jigoshop'), JIGOSHOP_PHP_VERSION, PHP_VERSION).
'</p></div>';
}
add_action('admin_notices', 'jigoshop_required_version');
return;
}
include ABSPATH.WPINC.'/version.php';
/** @noinspection PhpUndefinedVariableInspection */
if(version_compare($wp_version, JIGOSHOP_WORDPRESS_VERSION, '<')){
function jigoshop_required_wordpress_version()
{
include ABSPATH.WPINC.'/version.php';
/** @noinspection PhpUndefinedVariableInspection */
echo '<div class="error"><p>'.
sprintf(__('<strong>Error!</strong> Jigoshop requires at least WordPress %s! Your version is: %s. Please upgrade.', 'jigoshop'), JIGOSHOP_WORDPRESS_VERSION, $wp_version).
'</p></div>';
}
add_action('admin_notices', 'jigoshop_required_wordpress_version');
return;
}
$ini_memory_limit = ini_get('memory_limit');
preg_match('/^(\d+)(\w*)?$/', $ini_memory_limit, $memory);
if(isset($memory[1])) {
$memory_limit = $memory[1];
if (isset($memory[2])) {
switch (strtoupper($memory[2])) {
/** @noinspection PhpMissingBreakStatementInspection */
case 'G':
$memory_limit *= 1024 * 1024 * 1024;
break;
case 'M':
$memory_limit *= 1024 * 1024;
break;
case 'K':
$memory_limit *= 1024;
break;
}
}
if ($memory_limit < JIGOSHOP_REQUIRED_MEMORY * 1024 * 1024) {
function jigoshop_required_memory_warning()
{
$ini_memory_limit = ini_get('memory_limit');
echo '<div class="error"><p>' .
sprintf(__('<strong>Warning!</strong> Jigoshop requires at least %sM of memory! Your system currently has: %s.', 'jigoshop'), JIGOSHOP_REQUIRED_MEMORY, $ini_memory_limit) .
'</p></div>';
}
add_action('admin_notices', 'jigoshop_required_memory_warning');
}
}
preg_match('/^(\d+)(\w*)?$/', WP_MEMORY_LIMIT, $memory);
if(isset($memory[1])) {
$memory_limit = $memory[1];
if (isset($memory[2])) {
switch (strtoupper($memory[2])) {
/** @noinspection PhpMissingBreakStatementInspection */
case 'G':
$memory_limit *= 1024 * 1024 * 1024;
break;
case 'M':
$memory_limit *= 1024 * 1024;
break;
case 'K':
$memory_limit *= 1024;
break;
}
}
if ($memory_limit < JIGOSHOP_REQUIRED_WP_MEMORY * 1024 * 1024) {
function jigoshop_required_wp_memory_warning()
{
echo '<div class="error"><p>' .
sprintf(__('<strong>Warning!</strong> Jigoshop requires at least %sM of memory for WordPress! Your system currently has: %s. <a href="%s" target="_blank">How to change?</a>', 'jigoshop'),
JIGOSHOP_REQUIRED_WP_MEMORY, WP_MEMORY_LIMIT, 'http://codex.wordpress.org/Editing_wp-config.php#Increasing_memory_allocated_to_PHP') .
'</p></div>';
}
add_action('admin_notices', 'jigoshop_required_wp_memory_warning');
}
}
require_once(__DIR__.'/src/JigoshopInit.php');
$jigoshop = new JigoshopInit(__FILE__);
add_action('plugins_loaded', array($jigoshop, 'onLoad'), 20);
add_action('init', array($jigoshop, 'onInit'), 0);
register_activation_hook(__FILE__, array($jigoshop, 'update'));