@@ -14,178 +14,178 @@ |
||
14 | 14 | class EEH_Sideloader extends EEH_Base |
15 | 15 | { |
16 | 16 | |
17 | - private $_upload_to; |
|
18 | - private $_upload_from; |
|
19 | - private $_permissions; |
|
20 | - private $_new_file_name; |
|
21 | - |
|
22 | - |
|
23 | - /** |
|
24 | - * constructor allows the user to set the properties on the sideloader on construct. However, there are also setters for doing so. |
|
25 | - * |
|
26 | - * @access public |
|
27 | - * @param array $init array fo initializing the sideloader if keys match the properties. |
|
28 | - */ |
|
29 | - public function __construct($init = array()) |
|
30 | - { |
|
31 | - $this->_init($init); |
|
32 | - } |
|
33 | - |
|
34 | - |
|
35 | - /** |
|
36 | - * sets the properties for class either to defaults or using incoming initialization array |
|
37 | - * |
|
38 | - * @access private |
|
39 | - * @param array $init array on init (keys match properties others ignored) |
|
40 | - * @return void |
|
41 | - */ |
|
42 | - private function _init($init) |
|
43 | - { |
|
44 | - $defaults = array( |
|
45 | - '_upload_to' => $this->_get_wp_uploads_dir(), |
|
46 | - '_upload_from' => '', |
|
47 | - '_permissions' => 0644, |
|
48 | - '_new_file_name' => 'EE_Sideloader_' . uniqid() . '.default' |
|
49 | - ); |
|
50 | - |
|
51 | - $props = array_merge($defaults, $init); |
|
52 | - |
|
53 | - foreach ($props as $key => $val) { |
|
54 | - if (EEH_Class_Tools::has_property($this, $key)) { |
|
55 | - $this->{$key} = $val; |
|
56 | - } |
|
57 | - } |
|
58 | - |
|
59 | - // make sure we include the required wp file for needed functions |
|
60 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
61 | - } |
|
62 | - |
|
63 | - |
|
64 | - // utilities |
|
65 | - private function _get_wp_uploads_dir() |
|
66 | - { |
|
67 | - } |
|
68 | - |
|
69 | - // setters |
|
70 | - public function set_upload_to($upload_to_folder) |
|
71 | - { |
|
72 | - $this->_upload_to = $upload_to_folder; |
|
73 | - } |
|
74 | - public function set_upload_from($upload_from_folder) |
|
75 | - { |
|
76 | - $this->_upload_from_folder = $upload_from_folder; |
|
77 | - } |
|
78 | - public function set_permissions($permissions) |
|
79 | - { |
|
80 | - $this->_permissions = $permissions; |
|
81 | - } |
|
82 | - public function set_new_file_name($new_file_name) |
|
83 | - { |
|
84 | - $this->_new_file_name = $new_file_name; |
|
85 | - } |
|
86 | - |
|
87 | - // getters |
|
88 | - public function get_upload_to() |
|
89 | - { |
|
90 | - return $this->_upload_to; |
|
91 | - } |
|
92 | - public function get_upload_from() |
|
93 | - { |
|
94 | - return $this->_upload_from; |
|
95 | - } |
|
96 | - public function get_permissions() |
|
97 | - { |
|
98 | - return $this->_permissions; |
|
99 | - } |
|
100 | - public function get_new_file_name() |
|
101 | - { |
|
102 | - return $this->_new_file_name; |
|
103 | - } |
|
104 | - |
|
105 | - |
|
106 | - // upload methods |
|
107 | - public function sideload() |
|
108 | - { |
|
109 | - // setup temp dir |
|
110 | - $temp_file = wp_tempnam($this->_upload_from); |
|
111 | - |
|
112 | - if (!$temp_file) { |
|
113 | - EE_Error::add_error( |
|
114 | - esc_html__('Something went wrong with the upload. Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), |
|
115 | - __FILE__, |
|
116 | - __FUNCTION__, |
|
117 | - __LINE__ |
|
118 | - ); |
|
119 | - return false; |
|
120 | - } |
|
121 | - |
|
122 | - do_action('AHEE__EEH_Sideloader__sideload__before', $this, $temp_file); |
|
123 | - |
|
124 | - $wp_remote_args = apply_filters('FHEE__EEH_Sideloader__sideload__wp_remote_args', array( 'timeout' => 500, 'stream' => true, 'filename' => $temp_file ), $this, $temp_file); |
|
125 | - |
|
126 | - $response = wp_safe_remote_get($this->_upload_from, $wp_remote_args); |
|
127 | - |
|
128 | - if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
129 | - unlink($temp_file); |
|
130 | - if (defined('WP_DEBUG') && WP_DEBUG) { |
|
131 | - EE_Error::add_error( |
|
132 | - sprintf( |
|
133 | - esc_html__('Unable to upload the file. Either the path given to upload from is incorrect, or something else happened. Here is the path given: %s', 'event_espresso'), |
|
134 | - $this->_upload_from |
|
135 | - ), |
|
136 | - __FILE__, |
|
137 | - __FUNCTION__, |
|
138 | - __LINE__ |
|
139 | - ); |
|
140 | - } |
|
141 | - return false; |
|
142 | - } |
|
143 | - |
|
144 | - // possible md5 check |
|
145 | - $content_md5 = wp_remote_retrieve_header($response, 'content-md5'); |
|
146 | - if ($content_md5) { |
|
147 | - $md5_check = verify_file_md5($temp_file, $content_md5); |
|
148 | - if (is_wp_error($md5_check)) { |
|
149 | - unlink($temp_file); |
|
150 | - EE_Error::add_error( |
|
151 | - $md5_check->get_error_message(), |
|
152 | - __FILE__, |
|
153 | - __FUNCTION__, |
|
154 | - __LINE__ |
|
155 | - ); |
|
156 | - return false; |
|
157 | - } |
|
158 | - } |
|
159 | - |
|
160 | - $file = $temp_file; |
|
161 | - |
|
162 | - // now we have the file, let's get it in the right directory with the right name. |
|
163 | - $path = apply_filters('FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to . $this->_new_file_name, $this); |
|
164 | - |
|
165 | - // move file in |
|
166 | - if (false === @ rename($file, $path)) { |
|
167 | - unlink($temp_file); |
|
168 | - EE_Error::add_error( |
|
169 | - sprintf( |
|
170 | - esc_html__('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso'), |
|
171 | - $path |
|
172 | - ), |
|
173 | - __FILE__, |
|
174 | - __FUNCTION__, |
|
175 | - __LINE__ |
|
176 | - ); |
|
177 | - return false; |
|
178 | - } |
|
179 | - |
|
180 | - // set permissions |
|
181 | - $permissions = apply_filters('FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this); |
|
182 | - chmod($path, $permissions); |
|
183 | - |
|
184 | - // that's it. let's allow for actions after file uploaded. |
|
185 | - do_action('AHEE__EE_Sideloader__sideload_after', $this, $path); |
|
186 | - |
|
187 | - // unlink tempfile |
|
188 | - @unlink($temp_file); |
|
189 | - return true; |
|
190 | - } |
|
17 | + private $_upload_to; |
|
18 | + private $_upload_from; |
|
19 | + private $_permissions; |
|
20 | + private $_new_file_name; |
|
21 | + |
|
22 | + |
|
23 | + /** |
|
24 | + * constructor allows the user to set the properties on the sideloader on construct. However, there are also setters for doing so. |
|
25 | + * |
|
26 | + * @access public |
|
27 | + * @param array $init array fo initializing the sideloader if keys match the properties. |
|
28 | + */ |
|
29 | + public function __construct($init = array()) |
|
30 | + { |
|
31 | + $this->_init($init); |
|
32 | + } |
|
33 | + |
|
34 | + |
|
35 | + /** |
|
36 | + * sets the properties for class either to defaults or using incoming initialization array |
|
37 | + * |
|
38 | + * @access private |
|
39 | + * @param array $init array on init (keys match properties others ignored) |
|
40 | + * @return void |
|
41 | + */ |
|
42 | + private function _init($init) |
|
43 | + { |
|
44 | + $defaults = array( |
|
45 | + '_upload_to' => $this->_get_wp_uploads_dir(), |
|
46 | + '_upload_from' => '', |
|
47 | + '_permissions' => 0644, |
|
48 | + '_new_file_name' => 'EE_Sideloader_' . uniqid() . '.default' |
|
49 | + ); |
|
50 | + |
|
51 | + $props = array_merge($defaults, $init); |
|
52 | + |
|
53 | + foreach ($props as $key => $val) { |
|
54 | + if (EEH_Class_Tools::has_property($this, $key)) { |
|
55 | + $this->{$key} = $val; |
|
56 | + } |
|
57 | + } |
|
58 | + |
|
59 | + // make sure we include the required wp file for needed functions |
|
60 | + require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
61 | + } |
|
62 | + |
|
63 | + |
|
64 | + // utilities |
|
65 | + private function _get_wp_uploads_dir() |
|
66 | + { |
|
67 | + } |
|
68 | + |
|
69 | + // setters |
|
70 | + public function set_upload_to($upload_to_folder) |
|
71 | + { |
|
72 | + $this->_upload_to = $upload_to_folder; |
|
73 | + } |
|
74 | + public function set_upload_from($upload_from_folder) |
|
75 | + { |
|
76 | + $this->_upload_from_folder = $upload_from_folder; |
|
77 | + } |
|
78 | + public function set_permissions($permissions) |
|
79 | + { |
|
80 | + $this->_permissions = $permissions; |
|
81 | + } |
|
82 | + public function set_new_file_name($new_file_name) |
|
83 | + { |
|
84 | + $this->_new_file_name = $new_file_name; |
|
85 | + } |
|
86 | + |
|
87 | + // getters |
|
88 | + public function get_upload_to() |
|
89 | + { |
|
90 | + return $this->_upload_to; |
|
91 | + } |
|
92 | + public function get_upload_from() |
|
93 | + { |
|
94 | + return $this->_upload_from; |
|
95 | + } |
|
96 | + public function get_permissions() |
|
97 | + { |
|
98 | + return $this->_permissions; |
|
99 | + } |
|
100 | + public function get_new_file_name() |
|
101 | + { |
|
102 | + return $this->_new_file_name; |
|
103 | + } |
|
104 | + |
|
105 | + |
|
106 | + // upload methods |
|
107 | + public function sideload() |
|
108 | + { |
|
109 | + // setup temp dir |
|
110 | + $temp_file = wp_tempnam($this->_upload_from); |
|
111 | + |
|
112 | + if (!$temp_file) { |
|
113 | + EE_Error::add_error( |
|
114 | + esc_html__('Something went wrong with the upload. Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), |
|
115 | + __FILE__, |
|
116 | + __FUNCTION__, |
|
117 | + __LINE__ |
|
118 | + ); |
|
119 | + return false; |
|
120 | + } |
|
121 | + |
|
122 | + do_action('AHEE__EEH_Sideloader__sideload__before', $this, $temp_file); |
|
123 | + |
|
124 | + $wp_remote_args = apply_filters('FHEE__EEH_Sideloader__sideload__wp_remote_args', array( 'timeout' => 500, 'stream' => true, 'filename' => $temp_file ), $this, $temp_file); |
|
125 | + |
|
126 | + $response = wp_safe_remote_get($this->_upload_from, $wp_remote_args); |
|
127 | + |
|
128 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
129 | + unlink($temp_file); |
|
130 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
131 | + EE_Error::add_error( |
|
132 | + sprintf( |
|
133 | + esc_html__('Unable to upload the file. Either the path given to upload from is incorrect, or something else happened. Here is the path given: %s', 'event_espresso'), |
|
134 | + $this->_upload_from |
|
135 | + ), |
|
136 | + __FILE__, |
|
137 | + __FUNCTION__, |
|
138 | + __LINE__ |
|
139 | + ); |
|
140 | + } |
|
141 | + return false; |
|
142 | + } |
|
143 | + |
|
144 | + // possible md5 check |
|
145 | + $content_md5 = wp_remote_retrieve_header($response, 'content-md5'); |
|
146 | + if ($content_md5) { |
|
147 | + $md5_check = verify_file_md5($temp_file, $content_md5); |
|
148 | + if (is_wp_error($md5_check)) { |
|
149 | + unlink($temp_file); |
|
150 | + EE_Error::add_error( |
|
151 | + $md5_check->get_error_message(), |
|
152 | + __FILE__, |
|
153 | + __FUNCTION__, |
|
154 | + __LINE__ |
|
155 | + ); |
|
156 | + return false; |
|
157 | + } |
|
158 | + } |
|
159 | + |
|
160 | + $file = $temp_file; |
|
161 | + |
|
162 | + // now we have the file, let's get it in the right directory with the right name. |
|
163 | + $path = apply_filters('FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to . $this->_new_file_name, $this); |
|
164 | + |
|
165 | + // move file in |
|
166 | + if (false === @ rename($file, $path)) { |
|
167 | + unlink($temp_file); |
|
168 | + EE_Error::add_error( |
|
169 | + sprintf( |
|
170 | + esc_html__('Unable to move the file to new location (possible permissions errors). This is the path the class attempted to move the file to: %s', 'event_espresso'), |
|
171 | + $path |
|
172 | + ), |
|
173 | + __FILE__, |
|
174 | + __FUNCTION__, |
|
175 | + __LINE__ |
|
176 | + ); |
|
177 | + return false; |
|
178 | + } |
|
179 | + |
|
180 | + // set permissions |
|
181 | + $permissions = apply_filters('FHEE__EEH_Sideloader__sideload__permissions_applied', $this->_permissions, $this); |
|
182 | + chmod($path, $permissions); |
|
183 | + |
|
184 | + // that's it. let's allow for actions after file uploaded. |
|
185 | + do_action('AHEE__EE_Sideloader__sideload_after', $this, $path); |
|
186 | + |
|
187 | + // unlink tempfile |
|
188 | + @unlink($temp_file); |
|
189 | + return true; |
|
190 | + } |
|
191 | 191 | } //end EEH_Template class |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | '_upload_to' => $this->_get_wp_uploads_dir(), |
46 | 46 | '_upload_from' => '', |
47 | 47 | '_permissions' => 0644, |
48 | - '_new_file_name' => 'EE_Sideloader_' . uniqid() . '.default' |
|
48 | + '_new_file_name' => 'EE_Sideloader_'.uniqid().'.default' |
|
49 | 49 | ); |
50 | 50 | |
51 | 51 | $props = array_merge($defaults, $init); |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | } |
58 | 58 | |
59 | 59 | // make sure we include the required wp file for needed functions |
60 | - require_once(ABSPATH . 'wp-admin/includes/file.php'); |
|
60 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | |
@@ -109,7 +109,7 @@ discard block |
||
109 | 109 | // setup temp dir |
110 | 110 | $temp_file = wp_tempnam($this->_upload_from); |
111 | 111 | |
112 | - if (!$temp_file) { |
|
112 | + if ( ! $temp_file) { |
|
113 | 113 | EE_Error::add_error( |
114 | 114 | esc_html__('Something went wrong with the upload. Unable to create a tmp file for the uploaded file on the server', 'event_espresso'), |
115 | 115 | __FILE__, |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | do_action('AHEE__EEH_Sideloader__sideload__before', $this, $temp_file); |
123 | 123 | |
124 | - $wp_remote_args = apply_filters('FHEE__EEH_Sideloader__sideload__wp_remote_args', array( 'timeout' => 500, 'stream' => true, 'filename' => $temp_file ), $this, $temp_file); |
|
124 | + $wp_remote_args = apply_filters('FHEE__EEH_Sideloader__sideload__wp_remote_args', array('timeout' => 500, 'stream' => true, 'filename' => $temp_file), $this, $temp_file); |
|
125 | 125 | |
126 | 126 | $response = wp_safe_remote_get($this->_upload_from, $wp_remote_args); |
127 | 127 | |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | $file = $temp_file; |
161 | 161 | |
162 | 162 | // now we have the file, let's get it in the right directory with the right name. |
163 | - $path = apply_filters('FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to . $this->_new_file_name, $this); |
|
163 | + $path = apply_filters('FHEE__EEH_Sideloader__sideload__new_path', $this->_upload_to.$this->_new_file_name, $this); |
|
164 | 164 | |
165 | 165 | // move file in |
166 | 166 | if (false === @ rename($file, $path)) { |
@@ -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.9.76.rc.020'); |
|
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.9.76.rc.020'); |
|
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 | } |