GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gravityview-plugin-hooks-gravitymaps.php
Go to the documentation of this file.
1 <?php
2 
3 /**
4  * @inheritDoc
5  * @since 2.16
6  */
8  public function __construct() {
9 
10  if ( ! defined( 'GRAVITYVIEW_MAPS_VERSION' ) || version_compare( GRAVITYVIEW_MAPS_VERSION, '1.8', '>=' ) ) {
11  return;
12  }
13 
14  /**
15  * Temporarily keep maps working on the front-end when running new GV and old Maps.
16  *
17  * @since 2.16
18  */
19  add_filter( 'gravityview/maps/render/google_api_key', function( $api_key ) {
20 
21  if ( ! empty( $api_key ) ) {
22  return $api_key;
23  }
24 
25  $legacy_options = (array) get_option( 'gravityformsaddon_gravityview_app_settings' );
26 
27  return \GV\Utils::get( $legacy_options, 'googlemaps-api-key', '' );
28  } );
29 
30  /**
31  * @since 2.16
32  * @param array $notices
33  * @return array $notices, with a new notice about Maps compatibility added.
34  */
35  add_filter( 'gravityview/admin/notices', function ( $notices ) {
36 
37  $message = '<h3>' . esc_html__( 'Plugin update required.', 'gk-gravityview' ) . '</h3>';
38  $message .= esc_html_x( 'You are using [plugin] [version] that is incompatible with the current version of GravityView. Please [link]update [plugin][/link] to the latest version.', 'Placeholders inside [] are not to be translated.', 'gk-gravityview' );
39 
40  $message = strtr( $message, array(
41  '[version]' => GRAVITYVIEW_MAPS_VERSION,
42  '[link]' => '<a href="' . esc_url( GravityKitFoundation::licenses()->get_link_to_product_search( 27 ) ) . '">',
43  '[plugin]' => 'GravityView Maps',
44  '[/link]' => '</a>',
45  ) );
46 
47  $notices[] = [
48  'class' => 'error',
49  'message' => $message,
50  'dismiss' => false,
51  ];
52 
53  return $notices;
54  } );
55  }
56 }
57 
Abstract class that makes it easy for plugins and themes to register no-conflict scripts and styles...