* * @param ServiceProvidersCollection $providers */ do_action(self::ACTION_ADD_SERVICE_PROVIDERS, $providers); return $providers; } /** * Admin Message * @param $message */ protected function adminNotice($message) { add_action( 'admin_notices', function () use ($message) { $class = 'notice notice-error'; printf('

%2$s

', esc_attr($class), esc_html($message)); } ); } /** * @return bool */ protected function versionCheck() { $minPhpVersion = '5.6'; if (PHP_VERSION < $minPhpVersion) { $this->adminNotice( sprintf( __( 'PayPal PLUS requires PHP version %1$1s or higher. You are running version %2$2s ', 'woo-paypalplus' ), $minPhpVersion, PHP_VERSION ) ); return false; } return true; } /** * @return bool */ protected function wooCommerceCheck() { if (!function_exists('WC')) { $this->adminNotice( __('PayPal PLUS requires WooCommerce to be active.', 'woo-paypalplus') ); return false; } if (version_compare(wc()->version, '3.6.4', '<')) { $this->adminNotice( __( 'PayPal PLUS requires WooCommerce version 3.6.4 or higher.', 'woo-paypalplus' ) ); return false; } return true; } }