@@ -38,103 +38,103 @@ |
||
38 | 38 | * @since 4.0 |
39 | 39 | */ |
40 | 40 | if (function_exists('espresso_version')) { |
41 | - if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | - /** |
|
43 | - * espresso_duplicate_plugin_error |
|
44 | - * displays if more than one version of EE is activated at the same time |
|
45 | - */ |
|
46 | - function espresso_duplicate_plugin_error() |
|
47 | - { |
|
48 | - ?> |
|
41 | + if (! function_exists('espresso_duplicate_plugin_error')) { |
|
42 | + /** |
|
43 | + * espresso_duplicate_plugin_error |
|
44 | + * displays if more than one version of EE is activated at the same time |
|
45 | + */ |
|
46 | + function espresso_duplicate_plugin_error() |
|
47 | + { |
|
48 | + ?> |
|
49 | 49 | <div class="error"> |
50 | 50 | <p> |
51 | 51 | <?php |
52 | - echo esc_html__( |
|
53 | - 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | - 'event_espresso' |
|
55 | - ); ?> |
|
52 | + echo esc_html__( |
|
53 | + 'Can not run multiple versions of Event Espresso! One version has been automatically deactivated. Please verify that you have the correct version you want still active.', |
|
54 | + 'event_espresso' |
|
55 | + ); ?> |
|
56 | 56 | </p> |
57 | 57 | </div> |
58 | 58 | <?php |
59 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | - } |
|
61 | - } |
|
62 | - add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
59 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
60 | + } |
|
61 | + } |
|
62 | + add_action('admin_notices', 'espresso_duplicate_plugin_error', 1); |
|
63 | 63 | } else { |
64 | - define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | - if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | - /** |
|
67 | - * espresso_minimum_php_version_error |
|
68 | - * |
|
69 | - * @return void |
|
70 | - */ |
|
71 | - function espresso_minimum_php_version_error() |
|
72 | - { |
|
73 | - ?> |
|
64 | + define('EE_MIN_PHP_VER_REQUIRED', '5.4.0'); |
|
65 | + if (! version_compare(PHP_VERSION, EE_MIN_PHP_VER_REQUIRED, '>=')) { |
|
66 | + /** |
|
67 | + * espresso_minimum_php_version_error |
|
68 | + * |
|
69 | + * @return void |
|
70 | + */ |
|
71 | + function espresso_minimum_php_version_error() |
|
72 | + { |
|
73 | + ?> |
|
74 | 74 | <div class="error"> |
75 | 75 | <p> |
76 | 76 | <?php |
77 | - printf( |
|
78 | - esc_html__( |
|
79 | - 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | - 'event_espresso' |
|
81 | - ), |
|
82 | - EE_MIN_PHP_VER_REQUIRED, |
|
83 | - PHP_VERSION, |
|
84 | - '<br/>', |
|
85 | - '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | - ); |
|
87 | - ?> |
|
77 | + printf( |
|
78 | + esc_html__( |
|
79 | + 'We\'re sorry, but Event Espresso requires PHP version %1$s or greater in order to operate. You are currently running version %2$s.%3$sIn order to update your version of PHP, you will need to contact your current hosting provider.%3$sFor information on stable PHP versions, please go to %4$s.', |
|
80 | + 'event_espresso' |
|
81 | + ), |
|
82 | + EE_MIN_PHP_VER_REQUIRED, |
|
83 | + PHP_VERSION, |
|
84 | + '<br/>', |
|
85 | + '<a href="http://php.net/downloads.php">http://php.net/downloads.php</a>' |
|
86 | + ); |
|
87 | + ?> |
|
88 | 88 | </p> |
89 | 89 | </div> |
90 | 90 | <?php |
91 | - espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | - } |
|
91 | + espresso_deactivate_plugin(plugin_basename(__FILE__)); |
|
92 | + } |
|
93 | 93 | |
94 | - add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | - } else { |
|
96 | - define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | - /** |
|
98 | - * espresso_version |
|
99 | - * Returns the plugin version |
|
100 | - * |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - function espresso_version() |
|
104 | - { |
|
105 | - return apply_filters('FHEE__espresso__espresso_version', '4.10.2.rc.000'); |
|
106 | - } |
|
94 | + add_action('admin_notices', 'espresso_minimum_php_version_error', 1); |
|
95 | + } else { |
|
96 | + define('EVENT_ESPRESSO_MAIN_FILE', __FILE__); |
|
97 | + /** |
|
98 | + * espresso_version |
|
99 | + * Returns the plugin version |
|
100 | + * |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + function espresso_version() |
|
104 | + { |
|
105 | + return apply_filters('FHEE__espresso__espresso_version', '4.10.2.rc.000'); |
|
106 | + } |
|
107 | 107 | |
108 | - /** |
|
109 | - * espresso_plugin_activation |
|
110 | - * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | - */ |
|
112 | - function espresso_plugin_activation() |
|
113 | - { |
|
114 | - update_option('ee_espresso_activation', true); |
|
115 | - } |
|
108 | + /** |
|
109 | + * espresso_plugin_activation |
|
110 | + * adds a wp-option to indicate that EE has been activated via the WP admin plugins page |
|
111 | + */ |
|
112 | + function espresso_plugin_activation() |
|
113 | + { |
|
114 | + update_option('ee_espresso_activation', true); |
|
115 | + } |
|
116 | 116 | |
117 | - register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
117 | + register_activation_hook(EVENT_ESPRESSO_MAIN_FILE, 'espresso_plugin_activation'); |
|
118 | 118 | |
119 | - require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | - bootstrap_espresso(); |
|
121 | - } |
|
119 | + require_once __DIR__ . '/core/bootstrap_espresso.php'; |
|
120 | + bootstrap_espresso(); |
|
121 | + } |
|
122 | 122 | } |
123 | 123 | if (! function_exists('espresso_deactivate_plugin')) { |
124 | - /** |
|
125 | - * deactivate_plugin |
|
126 | - * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | - * |
|
128 | - * @access public |
|
129 | - * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | - * @return void |
|
131 | - */ |
|
132 | - function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | - { |
|
134 | - if (! function_exists('deactivate_plugins')) { |
|
135 | - require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | - } |
|
137 | - unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | - deactivate_plugins($plugin_basename); |
|
139 | - } |
|
124 | + /** |
|
125 | + * deactivate_plugin |
|
126 | + * usage: espresso_deactivate_plugin( plugin_basename( __FILE__ )); |
|
127 | + * |
|
128 | + * @access public |
|
129 | + * @param string $plugin_basename - the results of plugin_basename( __FILE__ ) for the plugin's main file |
|
130 | + * @return void |
|
131 | + */ |
|
132 | + function espresso_deactivate_plugin($plugin_basename = '') |
|
133 | + { |
|
134 | + if (! function_exists('deactivate_plugins')) { |
|
135 | + require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
|
136 | + } |
|
137 | + unset($_GET['activate'], $_REQUEST['activate']); |
|
138 | + deactivate_plugins($plugin_basename); |
|
139 | + } |
|
140 | 140 | } |
@@ -17,196 +17,196 @@ |
||
17 | 17 | class EE_Log |
18 | 18 | { |
19 | 19 | |
20 | - /** |
|
21 | - * @var string |
|
22 | - */ |
|
23 | - private $_log = ''; |
|
24 | - |
|
25 | - /** |
|
26 | - * Used for remote logging |
|
27 | - * |
|
28 | - * @var string |
|
29 | - */ |
|
30 | - private $_remote_logging_url = ''; |
|
31 | - |
|
32 | - /** |
|
33 | - * @var string |
|
34 | - */ |
|
35 | - private $_remote_log = ''; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var EE_Log |
|
39 | - */ |
|
40 | - private static $_instance; |
|
41 | - |
|
42 | - |
|
43 | - /** |
|
44 | - * @return EE_Log |
|
45 | - */ |
|
46 | - public static function instance() |
|
47 | - { |
|
48 | - if (! self::$_instance instanceof EE_Log) { |
|
49 | - self::$_instance = new self(); |
|
50 | - } |
|
51 | - return self::$_instance; |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * @access private |
|
56 | - * @return EE_Log |
|
57 | - */ |
|
58 | - private function __construct() |
|
59 | - { |
|
60 | - |
|
61 | - if (! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
62 | - return; |
|
63 | - } |
|
64 | - |
|
65 | - $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
|
66 | - $this->_remote_log = ''; |
|
67 | - |
|
68 | - if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
69 | - add_action('shutdown', array($this, 'send_log'), 9999); |
|
70 | - } |
|
71 | - } |
|
72 | - |
|
73 | - |
|
74 | - /** |
|
75 | - * verify_filesystem |
|
76 | - * tests that the required files and folders exist and are writable |
|
77 | - * |
|
78 | - */ |
|
79 | - public function verify_filesystem() |
|
80 | - { |
|
81 | - $msg = esc_html__( |
|
82 | - 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
83 | - 'event_espresso' |
|
84 | - ); |
|
85 | - EE_Error::doing_it_wrong( |
|
86 | - __METHOD__, |
|
87 | - $msg, |
|
88 | - '4.10.1.p' |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * _format_message |
|
95 | - * makes yer log entries look all purdy |
|
96 | - * |
|
97 | - * @param string $file |
|
98 | - * @param string $function |
|
99 | - * @param string $message |
|
100 | - * @param string $type |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - private function _format_message($file = '', $function = '', $message = '', $type = '') |
|
104 | - { |
|
105 | - $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
106 | - $msg .= '[' . current_time('mysql') . '] '; |
|
107 | - $msg .= ! empty($file) ? basename($file) : ''; |
|
108 | - $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
109 | - $msg .= ! empty($function) ? $function . '()' : ''; |
|
110 | - $msg .= PHP_EOL; |
|
111 | - $type = ! empty($type) ? $type : 'log message'; |
|
112 | - $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
113 | - return $msg; |
|
114 | - } |
|
115 | - |
|
116 | - |
|
117 | - /** |
|
118 | - * log |
|
119 | - * adds content to the EE_Log->_log property which gets written to file during the WP 'shutdown' hookpoint via the |
|
120 | - * EE_Log::write_log() callback |
|
121 | - * |
|
122 | - * @param string $file |
|
123 | - * @param string $function |
|
124 | - * @param string $message |
|
125 | - * @param string $type |
|
126 | - */ |
|
127 | - public function log($file = '', $function = '', $message = '', $type = '') |
|
128 | - { |
|
129 | - $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
130 | - } |
|
131 | - |
|
132 | - |
|
133 | - /** |
|
134 | - * write_log |
|
135 | - * appends the results of the 'AHEE_log' filter to the espresso log file |
|
136 | - */ |
|
137 | - public function write_log() |
|
138 | - { |
|
139 | - $msg = esc_html__( |
|
140 | - 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
141 | - 'event_espresso' |
|
142 | - ); |
|
143 | - EE_Error::doing_it_wrong( |
|
144 | - __METHOD__, |
|
145 | - $msg, |
|
146 | - '4.10.1.p' |
|
147 | - ); |
|
148 | - } |
|
149 | - |
|
150 | - |
|
151 | - /** |
|
152 | - * send_log |
|
153 | - * sends the espresso log to a remote URL via a PHP cURL request |
|
154 | - */ |
|
155 | - public function send_log() |
|
156 | - { |
|
157 | - |
|
158 | - if (empty($this->_remote_logging_url)) { |
|
159 | - return; |
|
160 | - } |
|
161 | - |
|
162 | - $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
163 | - $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
164 | - $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
165 | - $data .= '&time=' . time(); |
|
166 | - $data .= '&remote_log=' . $this->_log; |
|
167 | - $data .= '&request_array=' . json_encode($_REQUEST); |
|
168 | - $data .= '&action=save'; |
|
169 | - |
|
170 | - if (defined('EELOGGING_PASS')) { |
|
171 | - $data .= '&pass=' . EELOGGING_PASS; |
|
172 | - } |
|
173 | - if (defined('EELOGGING_KEY')) { |
|
174 | - $data .= '&key=' . EELOGGING_KEY; |
|
175 | - } |
|
176 | - |
|
177 | - $c = curl_init($this->_remote_logging_url); |
|
178 | - curl_setopt($c, CURLOPT_POST, true); |
|
179 | - curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
180 | - curl_setopt($c, CURLOPT_RETURNTRANSFER, true); |
|
181 | - curl_exec($c); |
|
182 | - curl_close($c); |
|
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - /** |
|
187 | - * write_debug |
|
188 | - * writes the contents of the current request's $_GET and $_POST arrays to a log file. |
|
189 | - * previous entries are overwritten |
|
190 | - */ |
|
191 | - public function write_debug() |
|
192 | - { |
|
193 | - $msg = esc_html__( |
|
194 | - 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
195 | - 'event_espresso' |
|
196 | - ); |
|
197 | - EE_Error::doing_it_wrong( |
|
198 | - __METHOD__, |
|
199 | - $msg, |
|
200 | - '4.10.1.p' |
|
201 | - ); |
|
202 | - } |
|
203 | - |
|
204 | - |
|
205 | - /** |
|
206 | - * __clone |
|
207 | - */ |
|
208 | - public function __clone() |
|
209 | - { |
|
210 | - trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
211 | - } |
|
20 | + /** |
|
21 | + * @var string |
|
22 | + */ |
|
23 | + private $_log = ''; |
|
24 | + |
|
25 | + /** |
|
26 | + * Used for remote logging |
|
27 | + * |
|
28 | + * @var string |
|
29 | + */ |
|
30 | + private $_remote_logging_url = ''; |
|
31 | + |
|
32 | + /** |
|
33 | + * @var string |
|
34 | + */ |
|
35 | + private $_remote_log = ''; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var EE_Log |
|
39 | + */ |
|
40 | + private static $_instance; |
|
41 | + |
|
42 | + |
|
43 | + /** |
|
44 | + * @return EE_Log |
|
45 | + */ |
|
46 | + public static function instance() |
|
47 | + { |
|
48 | + if (! self::$_instance instanceof EE_Log) { |
|
49 | + self::$_instance = new self(); |
|
50 | + } |
|
51 | + return self::$_instance; |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * @access private |
|
56 | + * @return EE_Log |
|
57 | + */ |
|
58 | + private function __construct() |
|
59 | + { |
|
60 | + |
|
61 | + if (! EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
62 | + return; |
|
63 | + } |
|
64 | + |
|
65 | + $this->_remote_logging_url = EE_Registry::instance()->CFG->admin->remote_logging_url; |
|
66 | + $this->_remote_log = ''; |
|
67 | + |
|
68 | + if (EE_Registry::instance()->CFG->admin->use_remote_logging) { |
|
69 | + add_action('shutdown', array($this, 'send_log'), 9999); |
|
70 | + } |
|
71 | + } |
|
72 | + |
|
73 | + |
|
74 | + /** |
|
75 | + * verify_filesystem |
|
76 | + * tests that the required files and folders exist and are writable |
|
77 | + * |
|
78 | + */ |
|
79 | + public function verify_filesystem() |
|
80 | + { |
|
81 | + $msg = esc_html__( |
|
82 | + 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
83 | + 'event_espresso' |
|
84 | + ); |
|
85 | + EE_Error::doing_it_wrong( |
|
86 | + __METHOD__, |
|
87 | + $msg, |
|
88 | + '4.10.1.p' |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * _format_message |
|
95 | + * makes yer log entries look all purdy |
|
96 | + * |
|
97 | + * @param string $file |
|
98 | + * @param string $function |
|
99 | + * @param string $message |
|
100 | + * @param string $type |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + private function _format_message($file = '', $function = '', $message = '', $type = '') |
|
104 | + { |
|
105 | + $msg = '----------------------------------------------------------------------------------------' . PHP_EOL; |
|
106 | + $msg .= '[' . current_time('mysql') . '] '; |
|
107 | + $msg .= ! empty($file) ? basename($file) : ''; |
|
108 | + $msg .= ! empty($file) && ! empty($function) ? ' -> ' : ''; |
|
109 | + $msg .= ! empty($function) ? $function . '()' : ''; |
|
110 | + $msg .= PHP_EOL; |
|
111 | + $type = ! empty($type) ? $type : 'log message'; |
|
112 | + $msg .= ! empty($message) ? "\t" . '[' . $type . '] ' . $message . PHP_EOL : ''; |
|
113 | + return $msg; |
|
114 | + } |
|
115 | + |
|
116 | + |
|
117 | + /** |
|
118 | + * log |
|
119 | + * adds content to the EE_Log->_log property which gets written to file during the WP 'shutdown' hookpoint via the |
|
120 | + * EE_Log::write_log() callback |
|
121 | + * |
|
122 | + * @param string $file |
|
123 | + * @param string $function |
|
124 | + * @param string $message |
|
125 | + * @param string $type |
|
126 | + */ |
|
127 | + public function log($file = '', $function = '', $message = '', $type = '') |
|
128 | + { |
|
129 | + $this->_log .= $this->_format_message($file, $function, $message, $type); |
|
130 | + } |
|
131 | + |
|
132 | + |
|
133 | + /** |
|
134 | + * write_log |
|
135 | + * appends the results of the 'AHEE_log' filter to the espresso log file |
|
136 | + */ |
|
137 | + public function write_log() |
|
138 | + { |
|
139 | + $msg = esc_html__( |
|
140 | + 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
141 | + 'event_espresso' |
|
142 | + ); |
|
143 | + EE_Error::doing_it_wrong( |
|
144 | + __METHOD__, |
|
145 | + $msg, |
|
146 | + '4.10.1.p' |
|
147 | + ); |
|
148 | + } |
|
149 | + |
|
150 | + |
|
151 | + /** |
|
152 | + * send_log |
|
153 | + * sends the espresso log to a remote URL via a PHP cURL request |
|
154 | + */ |
|
155 | + public function send_log() |
|
156 | + { |
|
157 | + |
|
158 | + if (empty($this->_remote_logging_url)) { |
|
159 | + return; |
|
160 | + } |
|
161 | + |
|
162 | + $data = 'domain=' . $_SERVER['HTTP_HOST']; |
|
163 | + $data .= '&ip=' . $_SERVER['SERVER_ADDR']; |
|
164 | + $data .= '&server_type=' . $_SERVER['SERVER_SOFTWARE']; |
|
165 | + $data .= '&time=' . time(); |
|
166 | + $data .= '&remote_log=' . $this->_log; |
|
167 | + $data .= '&request_array=' . json_encode($_REQUEST); |
|
168 | + $data .= '&action=save'; |
|
169 | + |
|
170 | + if (defined('EELOGGING_PASS')) { |
|
171 | + $data .= '&pass=' . EELOGGING_PASS; |
|
172 | + } |
|
173 | + if (defined('EELOGGING_KEY')) { |
|
174 | + $data .= '&key=' . EELOGGING_KEY; |
|
175 | + } |
|
176 | + |
|
177 | + $c = curl_init($this->_remote_logging_url); |
|
178 | + curl_setopt($c, CURLOPT_POST, true); |
|
179 | + curl_setopt($c, CURLOPT_POSTFIELDS, $data); |
|
180 | + curl_setopt($c, CURLOPT_RETURNTRANSFER, true); |
|
181 | + curl_exec($c); |
|
182 | + curl_close($c); |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + /** |
|
187 | + * write_debug |
|
188 | + * writes the contents of the current request's $_GET and $_POST arrays to a log file. |
|
189 | + * previous entries are overwritten |
|
190 | + */ |
|
191 | + public function write_debug() |
|
192 | + { |
|
193 | + $msg = esc_html__( |
|
194 | + 'The Local File Logging functionality was removed permanently. Remote Logging is recommended instead.', |
|
195 | + 'event_espresso' |
|
196 | + ); |
|
197 | + EE_Error::doing_it_wrong( |
|
198 | + __METHOD__, |
|
199 | + $msg, |
|
200 | + '4.10.1.p' |
|
201 | + ); |
|
202 | + } |
|
203 | + |
|
204 | + |
|
205 | + /** |
|
206 | + * __clone |
|
207 | + */ |
|
208 | + public function __clone() |
|
209 | + { |
|
210 | + trigger_error(__('Clone is not allowed.', 'event_espresso'), E_USER_ERROR); |
|
211 | + } |
|
212 | 212 | } |