-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathphp-backwards-compatibility.php
More file actions
39 lines (39 loc) · 1018 Bytes
/
php-backwards-compatibility.php
File metadata and controls
39 lines (39 loc) · 1018 Bytes
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
<?php
// Prevent direct file access
if ( ! defined( 'ABSPATH' ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
exit;
}
/**
* Deactivates the plugin
*
* @return bool
*/
function wpfssl_deactivate_self() {
if( ! current_user_can( 'activate_plugins' ) ) {
return false;
}
// deactivate self
deactivate_plugins( 'wp-force-ssl/wp-force-ssl.php' );
// get rid of "Plugin activated" notice
if( isset( $_GET['activate'] ) ) {
unset( $_GET['activate'] );
}
// show notice to user
add_action( 'admin_notices', 'wpfssl_requirement_notice' );
return true;
}
/**
* Outputs a notice telling the user that the plugin deactivated itself
*/
function wpfssl_requirement_notice() {
?>
<div class="updated">
<p><?php _e( 'WP Force SSL did not activate because it requires your server to run PHP 5.4 or higher. <a href="http://www.wpupdatephp.com/update/" target="_blank">Learn More</a>', 'wp-force-ssl' ); ?></p>
</div>
<?php
}
// Hook into `admin_init`
add_action( 'admin_init', 'wpfssl_deactivate_self' );
?>