diff --git a/CHANGELOG.md b/CHANGELOG.md index 917ce12..02bd8ef 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## 1.1.3 - 2 Aug 2018 +* [#23](https://github.com/BeAPI/acf-options-for-polylang/pull/23) : Requirement to php5.6 whereas namespace are 5.3 + ## 1.1.2 - 31 Jul 2018 * [#22](https://github.com/BeAPI/acf-options-for-polylang/pull/22) : Fix error with repeater fields default values diff --git a/bea-acf-options-for-polylang.php b/bea-acf-options-for-polylang.php index b76c3fc..70078cc 100644 --- a/bea-acf-options-for-polylang.php +++ b/bea-acf-options-for-polylang.php @@ -2,7 +2,7 @@ /* Plugin Name: BEA - ACF Options for Polylang - Version: 1.1.2 + Version: 1.1.3 Plugin URI: https://github.com/BeAPI/acf-options-for-polylang Description: Add ACF options page support for Polylang. Author: Be API Technical team @@ -34,7 +34,7 @@ } // Plugin constants -define( 'BEA_ACF_OPTIONS_FOR_POLYLANG_VERSION', '1.1.2' ); +define( 'BEA_ACF_OPTIONS_FOR_POLYLANG_VERSION', '1.1.3' ); define( 'BEA_ACF_OPTIONS_FOR_POLYLANG_MIN_PHP_VERSION', '5.6' ); // Plugin URL and PATH @@ -43,6 +43,15 @@ define( 'BEA_ACF_OPTIONS_MAIN_FILE_DIR', __FILE__ ); define( 'BEA_ACF_OPTIONS_FOR_POLYLANG_PLUGIN_DIRNAME', basename( rtrim( dirname( __FILE__ ), '/' ) ) ); +// Check PHP min version +if ( version_compare( PHP_VERSION, BEA_ACF_OPTIONS_FOR_POLYLANG_MIN_PHP_VERSION, '<' ) ) { + require_once( BEA_PB_DIR . 'compat.php' ); + // possibly display a notice, trigger error + add_action( 'admin_init', array( 'BEA\PB\Compatibility', 'admin_init' ) ); + // stop execution of this file + return; +} + /** Autoload all the things \o/ */ require_once BEA_ACF_OPTIONS_FOR_POLYLANG_DIR . 'autoload.php'; diff --git a/classes/requirements.php b/classes/requirements.php index 6cc6214..bc8013e 100644 --- a/classes/requirements.php +++ b/classes/requirements.php @@ -10,12 +10,6 @@ class Requirements { * @return bool */ public function check_requirements() { - if ( version_compare( PHP_VERSION, BEA_ACF_OPTIONS_FOR_POLYLANG_MIN_PHP_VERSION, '<' ) ) { - $this->display_error( sprintf( __( 'Plugin Boilerplate require PHP version %s or greater to be activated. Your server is currently running PHP version %s.', 'bea-acf-options-for-polylang' ), BEA_ACF_OPTIONS_FOR_POLYLANG_MIN_PHP_VERSION, PHP_VERSION ) ); - - return false; - } - if ( ! function_exists( 'acf' ) || ! function_exists( 'pll_current_language' ) ) { $this->display_error( __( 'Advanced Custom Fields and Polylang are required plugins.', 'bea-acf-options-for-polylang' ) ); diff --git a/compat.php b/compat.php new file mode 100644 index 0000000..178b516 --- /dev/null +++ b/compat.php @@ -0,0 +1,38 @@ +'; + echo '

' . esc_html( sprintf( 'Plugin Boilerplate require PHP version %s or greater to be activated. Your server is currently running PHP version %s.', BEA_ACF_OPTIONS_FOR_POLYLANG_MIN_PHP_VERSION, PHP_VERSION ) ) . '

'; + echo ''; + } +}