47 self::$valid_gravity_forms = self::check_gravityforms();
49 self::$valid_wordpress = self::check_wordpress();
51 self::$valid_php = self::check_php();
53 self::check_gf_directory();
60 add_filter(
'gravityview/admin/notices', array( $this,
'insert_admin_notices' ) );
72 return array_merge(
$notices, self::$notices );
79 if( self::$instance ) {
80 return self::$instance;
105 return gravityview()->plugin->is_compatible_wordpress();
117 return gravityview()->plugin->is_compatible_gravityforms();
141 if( ! self::is_valid() ) {
144 add_shortcode(
'gravityview', array( $this,
'_shortcode_gf_notice') );
155 return self::$notices;
176 $message =
'<div style="border:1px solid red; padding: 15px;"><p style="text-align:center;"><em>' . esc_html__(
'You are seeing this notice because you are an administrator. Other users of the site will see nothing.',
'gk-gravityview') .
'</em></p>';
177 foreach( (array)
$notices as $notice ) {
178 $message .= wpautop( $notice[
'message'] );
180 $message .=
'</div>';
196 if ( !
gravityview()->plugin->is_compatible_php() ) {
198 self::$notices[
'php_version'] = array(
200 'message' => sprintf( __(
"%sGravityView requires PHP Version %s or newer.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.",
'gk-gravityview' ),
'<h3>',
GV_MIN_PHP_VERSION,
"</h3>\n\n",
'<span style="font-family: Consolas, Courier, monospace;">'.phpversion().
'</span>' ),
201 'cap' =>
'manage_options',
202 'dismiss' =>
'php_version',
208 if ( !
gravityview()->plugin->is_compatible_future_php() ) {
213 self::$notices[ $key ] = array(
215 'message' => sprintf( __(
"%sGravityView will soon require PHP Version %s.%s \n\nYou're using Version %s. Please ask your host to upgrade your server's PHP.",
'gk-gravityview' ),
'<h3>',
GV_FUTURE_MIN_PHP_VERSION,
"</h3>\n\n",
'<span style="font-family: Consolas, Courier, monospace;">'.phpversion().
'</span>' ),
216 'cap' =>
'manage_options',
234 if (
gravityview()->plugin->is_compatible_future_wordpress() ) {
238 if ( !
gravityview()->plugin->is_compatible_wordpress() ) {
240 self::$notices[
'wp_version'] = array(
242 'message' => sprintf( __(
"%sGravityView requires WordPress %s or newer.%s \n\nYou're using Version %s. Please upgrade your WordPress installation.",
'gk-gravityview' ),
'<h3>',
GV_MIN_WP_VERSION,
"</h3>\n\n",
'<span style="font-family: Consolas, Courier, monospace;">' . $wp_version .
'</span>' ),
243 'cap' =>
'update_core',
244 'dismiss' =>
'wp_version',
253 self::$notices[ $key ] = array(
254 'class' =>
'notice-warning',
255 'message' => sprintf( __(
"%sGravityView will soon require WordPress %s%s \n\nYou're using Version %s. Please upgrade your WordPress installation.",
'gk-gravityview' ),
'<h3>',
GV_FUTURE_MIN_WP_VERSION,
"</h3>\n\n",
'<span style="font-family: Consolas, Courier, monospace;">' . $wp_version .
'</span>' ),
256 'cap' =>
'update_core',
274 if( class_exists(
'GFCommon' ) ) {
277 if(
true ===
gravityview()->plugin->is_compatible_future_gravityforms() ) {
282 $meets_minimum =
gravityview()->plugin->is_compatible_gravityforms();
284 if( $meets_minimum ) {
286 $title = __(
'In the future, GravityView will require Gravity Forms Version %s or newer.',
'gk-gravityview' );
288 $class =
'notice-warning';
291 $title = __(
'GravityView requires Gravity Forms Version %s or newer.',
'gk-gravityview' );
296 $message =
'<h3>' . esc_html( sprintf(
$title, $version ) ) .
'</h3>';
299 $message .=
'<p>' . sprintf( esc_html__(
"You're using Version %s. Please update your Gravity Forms or purchase a license.",
'gk-gravityview' ),
'<span style="font-family: Consolas, Courier, monospace;">'.GFCommon::$version.
'</span>' ) .
'</p>';
302 $message .=
'<p><a href="https://www.gravitykit.com/gravityforms/" class="button button-secondary button-large button-hero">' . esc_html__(
'Get the Latest Gravity Forms',
'gk-gravityview' ) .
'</a></p>';
306 self::$notices[
'gf_version'] = array(
308 'message' => $message,
309 'cap' =>
'update_plugins',
310 'dismiss' =>
'gf_version_' . $version,
314 return $meets_minimum;
317 $gf_status = self::get_plugin_status(
'gravityforms/gravityforms.php' );
324 if(
true === $gf_status || is_network_admin() ) {
331 switch( $gf_status ) {
335 if( ! function_exists(
'wp_create_nonce') ) {
336 require_once ABSPATH . WPINC .
'/pluggable.php';
340 if( is_multisite() ) {
341 wp_cookie_constants();
346 $button = function_exists(
'is_network_admin') && is_network_admin() ?
'<strong><a href="#gravity-forms">' :
'<strong><a href="'. wp_nonce_url( admin_url(
'plugins.php?action=activate&plugin=gravityforms/gravityforms.php' ),
'activate-plugin_gravityforms/gravityforms.php') .
'" class="button button-large">';
348 self::$notices[
'gf_inactive'] = array(
350 'message' => sprintf( __(
'%sGravityView requires Gravity Forms to be active. %sActivate Gravity Forms%s to use the GravityView plugin.',
'gk-gravityview' ),
'<h3>',
"</h3>\n\n". $button,
'</a></strong>' ),
351 'cap' =>
'activate_plugins',
352 'dismiss' =>
'gf_inactive',
357 self::$notices[
'gf_installed'] = array(
359 'message' => sprintf( __(
'%sGravityView requires Gravity Forms to be installed in order to run properly. %sGet Gravity Forms%s - starting at $59%s%s',
'gk-gravityview' ),
'<h3>',
"</h3>\n\n".
'<a href="https://www.gravitykit.com/gravityforms/" class="button button-secondary button-large button-hero">' ,
'<em>',
'</em>',
'</a>'),
360 'cap' =>
'install_plugins',
361 'dismiss' =>
'gf_installed',
376 if( class_exists(
'GFDirectory' ) ) {
377 self::$notices[
'gf_directory'] = array(
378 'class' =>
'error is-dismissible',
379 'title' => __(
'Potential Conflict',
'gk-gravityview' ),
380 'message' => __(
'GravityView and Gravity Forms Directory are both active. This may cause problems. If you experience issues, disable the Gravity Forms Directory plugin.',
'gk-gravityview' ),
381 'dismiss' =>
'gf_directory',
382 'cap' =>
'activate_plugins',
397 if( ! function_exists(
'is_plugin_active') ) {
398 include_once( ABSPATH .
'/wp-admin/includes/plugin.php' );
401 if( is_network_admin() && is_plugin_active_for_network( $location ) ) {
405 if( ! is_network_admin() && is_plugin_active( $location ) ) {
410 !file_exists( trailingslashit( WP_PLUGIN_DIR ) . $location ) &&
411 !file_exists( trailingslashit( WPMU_PLUGIN_DIR ) . $location )
const GV_PLUGIN_VERSION(! GravityKit\GravityView\Foundation\meets_min_php_version_requirement(__FILE__, '7.2.0'))
Constants.
insert_admin_notices( $notices=array())
Add the compatibility notices to the other admin notices.
const GV_FUTURE_MIN_WP_VERSION
GravityView will soon require at least this version of WordPress to function properly.
static check_wordpress()
Is WordPress compatible?
_shortcode_gf_notice( $atts=array(), $content=null, $shortcode='gravityview')
static is_valid()
Is everything compatible with this version of GravityView?
if(empty( $field_settings['content'])) $content
static get_notices()
Get admin notices.
static check_gf_directory()
Check for potential conflicts and let users know about common issues.
static check_php()
Is the version of PHP compatible?
static $valid_gravity_forms
const GV_FUTURE_MIN_PHP_VERSION
const GV_FUTURE_MIN_GF_VERSION
GravityView will soon require at least this version of Gravity Forms to function properly.
static get_plugin_status( $location='')
Check if specified plugin is active, inactive or not installed.
static check_gravityforms()
Check if Gravity Forms plugin is active and show notice if not.
static is_valid_wordpress()
Is the version of WordPress compatible?
gravityview()
The main GravityView wrapper function.
static has_cap( $caps='', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
const GV_MIN_GF_VERSION
GravityView requires at least this version of Gravity Forms to function properly. ...
const GV_MIN_PHP_VERSION
GravityView requires at least this version of PHP to function properly.
Handle GravityView compatibility notices and fallback shortcodes.
static is_valid_gravity_forms()
const GV_MIN_WP_VERSION
GravityView requires at least this version of WordPress to function properly.