Skip to content

Commit

Permalink
WordPress 4.6 and lower mock compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
soulseekah committed Jul 3, 2017
1 parent 410f4e2 commit 3337691
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions future/_mocks.php
Original file line number Diff line number Diff line change
Expand Up @@ -806,6 +806,23 @@ public static function reset() {
add_action( 'gravityview/template/after', function( $gravityview = null ) {
if ( defined( 'GRAVITYVIEW_FUTURE_CORE_ALPHA_ENABLED' ) && class_exists( '\GravityView_frontend' ) ) {
global $wp_filter;

if ( empty( $wp_filter['gravityview_after'] ) ) {
return;
}

/** WordPress 4.6 and lower compatibility, when WP_Hook classes were still absent. */
if ( is_array( $wp_filter['gravityview_after'] ) ) {
if ( ! empty( $wp_filter['gravityview_after'][10] ) ) {
foreach ( $wp_filter['gravityview_after'][10] as $function_key => $callback ) {
if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
unset( $wp_filter['gravityview_after'][10][ $function_key ] );
}
}
}
return;
}

foreach ( $wp_filter['gravityview_after']->callbacks[10] as $function_key => $callback ) {
if ( strpos( $function_key, 'context_not_configured_warning' ) ) {
unset( $wp_filter['gravityview_after']->callbacks[10][ $function_key ] );
Expand Down

0 comments on commit 3337691

Please sign in to comment.