wp-force-ssl
Last commit date
index.php
11 years ago
php-backwards-compatibility.php
7 years ago
plugin.php
7 years ago
readme.txt
6 years ago
wp-force-ssl.php
7 years ago
php-backwards-compatibility.php
39 lines
| 1 | <?php |
| 2 | // Prevent direct file access |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | header( 'Status: 403 Forbidden' ); |
| 5 | header( 'HTTP/1.1 403 Forbidden' ); |
| 6 | exit; |
| 7 | } |
| 8 | /** |
| 9 | * Deactivates the plugin |
| 10 | * |
| 11 | * @return bool |
| 12 | */ |
| 13 | function wpfssl_deactivate_self() { |
| 14 | if( ! current_user_can( 'activate_plugins' ) ) { |
| 15 | return false; |
| 16 | } |
| 17 | // deactivate self |
| 18 | deactivate_plugins( 'wp-force-ssl/wp-force-ssl.php' ); |
| 19 | // get rid of "Plugin activated" notice |
| 20 | if( isset( $_GET['activate'] ) ) { |
| 21 | unset( $_GET['activate'] ); |
| 22 | } |
| 23 | // show notice to user |
| 24 | add_action( 'admin_notices', 'wpfssl_requirement_notice' ); |
| 25 | return true; |
| 26 | } |
| 27 | /** |
| 28 | * Outputs a notice telling the user that the plugin deactivated itself |
| 29 | */ |
| 30 | function wpfssl_requirement_notice() { |
| 31 | ?> |
| 32 | <div class="updated"> |
| 33 | <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> |
| 34 | </div> |
| 35 | <?php |
| 36 | } |
| 37 | // Hook into `admin_init` |
| 38 | add_action( 'admin_init', 'wpfssl_deactivate_self' ); |
| 39 | ?> |