GravityView  1.19.4
The best, easiest way to display Gravity Forms entries on your website.
class-gv-core.php
Go to the documentation of this file.
1 <?php
2 namespace GV;
3 
4 /** If this file is called directly, abort. */
5 if ( ! defined( 'GRAVITYVIEW_DIR' ) )
6  die();
7 
8 /**
9  * The core GravityView API.
10  *
11  * Returned by the wrapper gravityview() global function, exposes
12  * all the required public functionality and classes, sets up global
13  * state depending on current request context, etc.
14  */
15 final class Core {
16  /**
17  * @var \GV\Core The \GV\Core static instance.
18  */
19  private static $__instance = null;
20 
21  /**
22  * @var \GV\Plugin The WordPress plugin context.
23  *
24  * @api
25  * @since future
26  */
27  public $plugin;
28 
29  /**
30  * @var \GV\Request The current request.
31  *
32  * @api
33  * @since future
34  */
35  public $request;
36 
37  /**
38  * @var \GV\CoreSettings core GravityView settings
39  */
40  public $settings;
41 
42  /**
43  * Get the global instance of \GV\Core.
44  *
45  * @return \GV\Core The global instance of GravityView Core.
46  */
47  public static function get() {
48  if ( ! self::$__instance instanceof self )
49  self::$__instance = new self;
50  return self::$__instance;
51  }
52 
53  /**
54  * Bootstrap.
55  *
56  * @return void
57  */
58  private function __construct() {
59  self::$__instance = $this;
60  $this->init();
61  }
62 
63  /**
64  * Early initialization.
65  *
66  * Loads dependencies, sets up the object, adds hooks, etc.
67  *
68  * @return void
69  */
70  private function init() {
71  require_once dirname( __FILE__ ) . '/class-gv-plugin.php';
72  $this->plugin = Plugin::get();
73 
74  /**
75  * Stop all further functionality from loading if the WordPress
76  * plugin is incompatible with the current environment.
77  *
78  * @todo Output incompatibility notices.
79  */
80  if ( ! $this->plugin->is_compatible() ) {
81  return;
82  }
83 
84  /** Register the gravityview post type upon WordPress core init. */
85  require_once $this->plugin->dir( 'future/includes/class-gv-view.php' );
86  add_action( 'init', array( '\GV\View', 'register_post_type' ) );
87 
88  /** Add rewrite endpoint for single-entry URLs. */
89  require_once $this->plugin->dir( 'future/includes/class-gv-entry.php' );
90  add_action( 'init', array( '\GV\Entry', 'add_rewrite_endpoint' ) );
91  }
92 
93  private function __clone() { }
94 
95  private function __wakeup() { }
96 }
__construct()
Bootstrap.
init()
Early initialization.
The core GravityView API.