GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
loader.php
Go to the documentation of this file.
1 <?php
2 /**
3  * Just an early preloader for the future code.
4  *
5  * Compatible with all PHP versions syntax-wise.
6  */
7 
8 /** If this file is called directly, abort. */
9 if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
10  die();
11 }
12 
13 /**
14  * Do not allow activation if PHP version is lower than GV_MIN_PHP_VERSION
15  */
16 if ( version_compare( phpversion(), GV_MIN_PHP_VERSION, '<' ) ) {
17  $php_notices = array(
18  esc_html__( 'GravityView requires PHP [php_required_version] or newer.', 'gk-gravityview' ),
19  esc_html__( 'You are using version [php_installed_version].', 'gk-gravityview' ),
20  esc_html__( 'Please ask your host to upgrade PHP on the server.', 'gk-gravityview' ),
21  );
22 
23  foreach ( $php_notices as &$notice ) {
24  $notice = strtr(
25  $notice,
26  array(
27  '[php_required_version]' => GV_MIN_PHP_VERSION,
28  '[php_installed_version]' => phpversion()
29  )
30  );
31  }
32 
33  if ( 'cli' === php_sapi_name() ) {
34  printf( join( ' ', $php_notices ) );
35  } else {
36  add_action( 'admin_notices', function () use ( $php_notices ) {
37  $floaty_image = plugins_url( 'assets/images/astronaut-200x263.png', GRAVITYVIEW_FILE );
38  $floaty_image_alt = esc_attr__( 'The GravityKit Astronaut Says:', 'gk-gravityview' );
39 
40  list( $requires, $installed, $call_to_action ) = $php_notices;
41 
42  echo <<<HTML
43 <div class="error">
44  <div style="margin-top: 1em;">
45  <img src="{$floaty_image}" alt="{$floaty_image_alt}" style="float: left; height: 5em; margin-right: 1em;" />
46  <h3 style="font-size:16px; margin: 0 0 8px 0;">
47  {$requires}
48  </h3>
49  <p>{$installed}</p>
50  <p>{$call_to_action}</p>
51  </div>
52 </div>
53 HTML;
54  } );
55  }
56 
57  deactivate_plugins( GRAVITYVIEW_FILE );
58 
59  return;
60 }
61 
62 require_once GRAVITYVIEW_DIR . 'vendor/autoload.php';
63 require_once GRAVITYVIEW_DIR . 'vendor_prefixed/autoload.php';
64 
66 
67 /** @define "GRAVITYVIEW_DIR" "../" */
68 require GRAVITYVIEW_DIR . 'future/gravityview.php';
const GRAVITYVIEW_DIR
"GRAVITYVIEW_DIR" "./" The absolute path to the plugin directory, with trailing slash ...
Definition: gravityview.php:49
const GRAVITYVIEW_FILE
Full path to the GravityView file "GRAVITYVIEW_FILE" "./gravityview.php".
Definition: gravityview.php:40
static register( $plugin_file)
Registers class instance.
Definition: Core.php:167
const GV_MIN_PHP_VERSION
GravityView requires at least this version of PHP to function properly.
Definition: gravityview.php:78