$setting = $args[ $setting ]; } } } /** * Checks if all requirements are ok, if not, display a notice and the rollback * * @since 3.0 * @author Remy Perona * * @return bool */ public function check() { if (! $this->phpPasses() || ! $this->wpPasses()) { add_action('admin_notices', array($this, 'notice')); return false; } return true; } /** * Checks if the current PHP version is equal or superior to the required PHP version * * @since 3.0 * @author Remy Perona * * @return bool */ private function phpPasses() { return version_compare(PHP_VERSION, $this->php_version) >= 0; } /** * Checks if the current WordPress version is equal or superior to the required PHP version * * @since 3.0 * @author Remy Perona * * @return bool */ private function wpPasses() { global $wp_version; return version_compare($wp_version, $this->wp_version) >= 0; } /** * Displays a notice if requirements are not met. * * @since 2.0 * @author Remy Perona */ public function notice() { if (! current_user_can('manage_options')) { return; } // Translators: %1$s = Plugin name, %2$s = Plugin version. $message = '
' . sprintf(__('To function properly, %1$s %2$s requires at least:', 'rocket-lazy-load'), $this->plugin_name, $this->plugin_version) . '