Skip to content

Commit

Permalink
Merge pull request #75 from mailjet/development
Browse files Browse the repository at this point in the history
adding check for the server php version required to run the plugin
  • Loading branch information
goshon authored Aug 21, 2017
2 parents d0d3055 + 858bc16 commit a865060
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Mailjet offers user interfaces, documentation and 24/7 customer support in 4 lan
2. Go to Extensions > Add and send `mailjet-for-wordpress.zip`.
3. Activate the Mailjet extension through the 'Plugins' menu in WordPress.

You must have cURL extension enabled.
You must have cURL extension enabled. PHP 5.3 or later version is required.

## Frequently Asked Questions

Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ Mailjet offers user interfaces, documentation and 24/7 customer support in 4 lan
2. Go to Extensions > Add and send `mailjet-for-wordpress.zip`.
3. Activate the Mailjet extension through the 'Plugins' menu in WordPress.

You must have cURL extension enabled.
You must have cURL extension enabled. PHP 5.3 or later version is required.

## Frequently Asked Questions

Expand Down
25 changes: 25 additions & 0 deletions wp-mailjet.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@
# Define mailjet options object
$optionsMj = new WP_Mailjet_Options();

// Check the PHP version and display warning message if it is < 5.3
// (we may also deactivate automatically the plugin, but for now that code is commented)
if (version_compare(PHP_VERSION, '5.3', '<')) {
add_action('admin_notices', 'wp_mailjet_check_php_version');
/*
add_action('admin_init', 'wp_mailjet_deactivate_self');
function wp_mailjet_deactivate_self() {
deactivate_plugins(plugin_basename(__FILE__));
}
*/
return;
}

function wp_mailjet_check_php_version()
{
echo '<div class="error"><p>';
_e('Mailjet plugin requires PHP 5.3 to function properly. Please upgrade PHP', 'wp-mailjet');
echo "</p></div>";
/*
if (isset($_GET['activate'])) {
unset($_GET['activate']);
}
*/
}


# Check if the plugin is set up properly
if (get_option('mailjet_password') && get_option('mailjet_username')) {
Expand Down

0 comments on commit a865060

Please sign in to comment.