GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
class-gv-plugin.php
Go to the documentation of this file.
1 <?php
2 
3 namespace GV;
4 
6 use GVCommon;
7 
8 /** If this file is called directly, abort. */
9 if ( ! defined( 'GRAVITYVIEW_DIR' ) ) {
10  die();
11 }
12 
13 /**
14  * The GravityView WordPress plugin class.
15  *
16  * Contains functionality related to GravityView being
17  * a WordPress plugin and doing WordPress pluginy things.
18  *
19  * Accessible via gravityview()->plugin
20  */
21 final class Plugin {
22  const ALL_VIEWS_SLUG = 'gravityview_all_views';
23 
24  const NEW_VIEW_SLUG = 'gravityview_new_view';
25 
26  /**
27  * @since 2.0
28  * @api
29  * @var string The plugin version.
30  *
31  */
32  public static $version = GV_PLUGIN_VERSION;
33 
34  /**
35  * @var string Minimum WordPress version.
36  *
37  * GravityView requires at least this version of WordPress to function properly.
38  */
39  private static $min_wp_version = GV_MIN_WP_VERSION;
40 
41  /**
42  * @var string Minimum WordPress version.
43  *
44  * @since 2.9.3
45  *
46  * GravityView will require this version of WordPress soon.
47  */
48  private static $future_min_wp_version = GV_FUTURE_MIN_WP_VERSION;
49 
50  /**
51  * @var string Minimum Gravity Forms version.
52  *
53  * GravityView requires at least this version of Gravity Forms to function properly.
54  */
55  public static $min_gf_version = GV_MIN_GF_VERSION;
56 
57  /**
58  * @var string Minimum PHP version.
59  *
60  * GravityView requires at least this version of PHP to function properly.
61  */
62  private static $min_php_version = GV_MIN_PHP_VERSION;
63 
64  /**
65  * @var string|bool Minimum future PHP version.
66  *
67  * GravityView will require this version of PHP soon. False if no future PHP version changes are planned.
68  */
69  private static $future_min_php_version = GV_FUTURE_MIN_PHP_VERSION;
70 
71  /**
72  * @var string|bool Minimum future Gravity Forms version.
73  *
74  * GravityView will require this version of Gravity Forms soon. False if no future Gravity Forms version changes are planned.
75  */
76  private static $future_min_gf_version = GV_FUTURE_MIN_GF_VERSION;
77 
78  /**
79  * @var \GV\Plugin The \GV\Plugin static instance.
80  */
81  private static $__instance = null;
82 
83  /**
84  * @since 2.0
85  * @api
86  * @var \GV\Plugin_Settings The plugin settings.
87  *
88  */
89  public $settings;
90 
91  /**
92  * @var string The GFQuery functionality identifier.
93  */
94  const FEATURE_GFQUERY = 'gfquery';
95 
96  /**
97  * @var string The joins functionality identifier.
98  */
99  const FEATURE_JOINS = 'joins';
100 
101  /**
102  * @var string The unions functionality identifier.
103  */
104  const FEATURE_UNIONS = 'unions';
105 
106  /**
107  * @var string The REST API functionality identifier.
108  */
109  const FEATURE_REST = 'rest_api';
110 
111  /**
112  * Get the global instance of \GV\Plugin.
113  *
114  * @return \GV\Plugin The global instance of GravityView Plugin.
115  */
116  public static function get() {
117 
118  if ( ! self::$__instance instanceof self ) {
119  self::$__instance = new self;
120  }
121 
122  return self::$__instance;
123  }
124 
125  private function __construct() {
126  /**
127  * Load some frontend-related legacy files.
128  */
129  add_action( 'gravityview/loaded', array( $this, 'include_legacy_frontend' ) );
130 
131  /**
132  * GFAddOn-backed settings
133  */
134  add_action( 'plugins_loaded', array( $this, 'load_settings' ) );
135 
136  // Add "All Views" and "New View" as submenus to the GravityKit menu
137  add_action( 'gk/foundation/initialized', array( $this, 'add_to_gravitykit_admin_menu' ) );
138 
139  add_action( 'admin_menu', array( $this, 'setup_gravitykit_admin_menu_redirects' ) );
140  }
141 
142  public function load_settings() {
143  require_once $this->dir( 'future/includes/class-gv-settings-plugin.php' );
144  $this->settings = new Plugin_Settings();
145 
146  include_once $this->dir( 'includes/class-gravityview-settings.php' );
147  }
148 
149  /**
150  * Check whether Gravity Forms is v2.5-beta or newer
151  *
152  * @return bool
153  * @todo add @since
154  *
155  */
156  public function is_GF_25() {
157 
158  return version_compare( '2.5-beta', \GFForms::$version, '<=' );
159  }
160 
161  /**
162  * Check whether GravityView `is network activated.
163  *
164  * @return bool Whether it's network activated or not.
165  */
166  public static function is_network_activated() {
167 
168  $plugin_basename = plugin_basename( GRAVITYVIEW_FILE );
169 
170  return is_multisite() && ( function_exists( 'is_plugin_active_for_network' ) && is_plugin_active_for_network( $plugin_basename ) );
171  }
172 
173  /**
174  * Include more legacy stuff.
175  *
176  * @param boolean $force Whether to force the includes.
177  *
178  * @return void
179  */
180  public function include_legacy_frontend( $force = false ) {
181 
182  if ( gravityview()->request->is_admin() && ! $force ) {
183  return;
184  }
185 
186  include_once $this->dir( 'includes/class-gravityview-image.php' );
187  include_once $this->dir( 'includes/class-template.php' );
188  include_once $this->dir( 'includes/class-api.php' );
189  include_once $this->dir( 'includes/class-frontend-views.php' );
190  include_once $this->dir( 'includes/class-gravityview-change-entry-creator.php' );
191 
192  /**
193  * @action `gravityview_include_frontend_actions` Triggered after all GravityView frontend files are loaded
194  *
195  * @deprecated Use `gravityview/loaded` along with \GV\Request::is_admin(), etc.
196  *
197  * Nice place to insert extensions' frontend stuff
198  */
199  do_action( 'gravityview_include_frontend_actions' );
200  }
201 
202  /**
203  * Load more legacy core files.
204  *
205  * @return void
206  */
207  public function include_legacy_core() {
208  if ( ! class_exists( '\GravityView_Extension' ) ) {
209  include_once $this->dir( 'includes/class-gravityview-extension.php' );
210  }
211 
212  if ( ! gravityview()->plugin->is_compatible() ) {
213  return;
214  }
215 
216  // Load fields
217  include_once $this->dir( 'includes/fields/class-gravityview-fields.php' );
218  include_once $this->dir( 'includes/fields/class-gravityview-field.php' );
219 
220  // Load all field files automatically
221  foreach ( glob( $this->dir( 'includes/fields/class-gravityview-field*.php' ) ) as $gv_field_filename ) {
222  include_once $gv_field_filename;
223  }
224 
225  include_once $this->dir( 'includes/class-gravityview-entry-approval-status.php' );
226  include_once $this->dir( 'includes/class-gravityview-entry-approval-merge-tags.php' );
227  include_once $this->dir( 'includes/class-gravityview-entry-approval.php' );
228 
229  include_once $this->dir( 'includes/class-gravityview-entry-notes.php' );
230  include_once $this->dir( 'includes/load-plugin-and-theme-hooks.php' );
231 
232  // Load Extensions
233  // @todo: Convert to a scan of the directory or a method where this all lives
234  include_once $this->dir( 'includes/extensions/edit-entry/class-edit-entry.php' );
235  include_once $this->dir( 'includes/extensions/delete-entry/class-delete-entry.php' );
236  include_once $this->dir( 'includes/extensions/duplicate-entry/class-duplicate-entry.php' );
237  include_once $this->dir( 'includes/extensions/entry-notes/class-gravityview-field-notes.php' );
238  include_once $this->dir( 'includes/extensions/lightbox/class-gravityview-lightbox.php' );
239 
240  // Load WordPress Widgets
241  include_once $this->dir( 'includes/wordpress-widgets/register-wordpress-widgets.php' );
242 
243  // Load GravityView Widgets
244  include_once $this->dir( 'includes/widgets/register-gravityview-widgets.php' );
245 
246  // Add oEmbed
247  include_once $this->dir( 'includes/class-api.php' );
248  include_once $this->dir( 'includes/class-oembed.php' );
249 
250  // Add logging
251  include_once $this->dir( 'includes/class-gravityview-logging.php' );
252 
253  include_once $this->dir( 'includes/class-ajax.php' );
254  include_once $this->dir( 'includes/class-gravityview-html-elements.php' );
255  include_once $this->dir( 'includes/class-frontend-views.php' );
256  include_once $this->dir( 'includes/class-gravityview-admin-bar.php' );
257  include_once $this->dir( 'includes/class-gravityview-entry-list.php' );
258  include_once $this->dir( 'includes/class-gravityview-merge-tags.php' );
259  /** @since 1.8.4 */
260  include_once $this->dir( 'includes/class-data.php' );
261  include_once $this->dir( 'includes/class-gravityview-shortcode.php' );
262  include_once $this->dir( 'includes/class-gravityview-entry-link-shortcode.php' );
263  include_once $this->dir( 'includes/class-gvlogic-shortcode.php' );
264  include_once $this->dir( 'includes/presets/register-default-templates.php' );
265 
266  if ( class_exists( '\GFFormsModel' ) ) {
267  include_once $this->dir( 'includes/class-gravityview-gfformsmodel.php' );
268  }
269  }
270 
271  /**
272  * Register hooks that are fired when the plugin is activated and deactivated.
273  *
274  * @return void
275  */
276  public function register_activation_hooks() {
277 
278  register_activation_hook( $this->dir( 'gravityview.php' ), array( $this, 'activate' ) );
279  register_deactivation_hook( $this->dir( 'gravityview.php' ), array( $this, 'deactivate' ) );
280  }
281 
282  /**
283  * Plugin activation function.
284  *
285  * @return void
286  * @internal
287  */
288  public function activate() {
289 
290  gravityview();
291 
292  if ( ! $this->is_compatible() ) {
293  return;
294  }
295 
296  /** Register the gravityview post type upon WordPress core init. */
297  require_once $this->dir( 'future/includes/class-gv-view.php' );
298  View::register_post_type();
299 
300  /** Add the entry rewrite endpoint. */
301  require_once $this->dir( 'future/includes/class-gv-entry.php' );
302  Entry::add_rewrite_endpoint();
303 
304  /** Flush all URL rewrites. */
305  flush_rewrite_rules();
306 
307  update_option( 'gv_version', self::$version );
308 
309  /** Add the transient to redirect to configuration page. */
310  set_transient( '_gv_activation_redirect', true, 60 );
311 
312  /** Clear settings transient. */
313  delete_transient( 'gravityview_edd-activate_valid' );
314 
316  }
317 
318  /**
319  * Plugin deactivation function.
320  *
321  * @return void
322  * @internal
323  */
324  public function deactivate() {
325 
326  flush_rewrite_rules();
327  }
328 
329  /**
330  * Retrieve an absolute path within the GravityView plugin directory.
331  *
332  * @since 2.0
333  *
334  * @param string $path Optional. Append this extra path component.
335  * @return string The absolute path to the plugin directory.
336  * @api
337  */
338  public function dir( $path = '' ) {
339 
340  return wp_normalize_path( GRAVITYVIEW_DIR . ltrim( $path, '/' ) );
341  }
342 
343  /**
344  * Retrieve a relative path to the GravityView plugin directory from the WordPress plugin directory
345  *
346  * @since 2.2.3
347  *
348  * @param string $path Optional. Append this extra path component.
349  * @return string The relative path to the plugin directory from the plugin directory.
350  * @api
351  */
352  public function relpath( $path = '' ) {
353 
354  $dirname = trailingslashit( dirname( plugin_basename( GRAVITYVIEW_FILE ) ) );
355 
356  return wp_normalize_path( $dirname . ltrim( $path, '/' ) );
357  }
358 
359  /**
360  * Retrieve a URL within the GravityView plugin directory.
361  *
362  * @since 2.0
363  *
364  * @param string $path Optional. Extra path appended to the URL.
365  * @return string The URL to this plugin, with trailing slash.
366  * @api
367  */
368  public function url( $path = '/' ) {
369 
370  return plugins_url( $path, $this->dir( 'gravityview.php' ) );
371  }
372 
373  /**
374  * Is everything compatible with this version of GravityView?
375  *
376  * @since 2.0
377  *
378  * @return bool
379  * @api
380  */
381  public function is_compatible() {
382 
383  return
384  $this->is_compatible_php()
385  && $this->is_compatible_wordpress()
386  && $this->is_compatible_gravityforms();
387  }
388 
389  /**
390  * Is this version of GravityView compatible with the current version of PHP?
391  *
392  * @since 2.0
393  *
394  * @return bool true if compatible, false otherwise.
395  * @api
396  */
397  public function is_compatible_php() {
398 
399  return version_compare( $this->get_php_version(), self::$min_php_version, '>=' );
400  }
401 
402  /**
403  * Is this version of GravityView compatible with the future required version of PHP?
404  *
405  * @since 2.0
406  *
407  * @return bool true if compatible, false otherwise.
408  * @api
409  */
410  public function is_compatible_future_php() {
411 
412  return version_compare( $this->get_php_version(), self::$future_min_php_version, '>=' );
413  }
414 
415  /**
416  * Is this version of GravityView compatible with the current version of WordPress?
417  *
418  * @since 2.0
419  *
420  * @param string $version Version to check against; otherwise uses GV_MIN_WP_VERSION
421  *
422  * @return bool true if compatible, false otherwise.
423  * @api
424  */
425  public function is_compatible_wordpress( $version = null ) {
426 
427  if ( ! $version ) {
428  $version = self::$min_wp_version;
429  }
430 
431  return version_compare( $this->get_wordpress_version(), $version, '>=' );
432  }
433 
434  /**
435  * Is this version of GravityView compatible with the future version of WordPress?
436  *
437  * @since 2.9.3
438  *
439  * @return bool true if compatible, false otherwise
440  * @api
441  */
442  public function is_compatible_future_wordpress() {
443 
444  $version = $this->get_wordpress_version();
445 
446  return $version ? version_compare( $version, self::$future_min_wp_version, '>=' ) : false;
447  }
448 
449  /**
450  * Is this version of GravityView compatible with the current version of Gravity Forms?
451  *
452  * @since 2.0
453  *
454  * @return bool true if compatible, false otherwise (or not active/installed).
455  * @api
456  */
457  public function is_compatible_gravityforms() {
458 
459  $version = $this->get_gravityforms_version();
460 
461  return $version ? version_compare( $version, self::$min_gf_version, '>=' ) : false;
462  }
463 
464  /**
465  * Is this version of GravityView compatible with the future version of Gravity Forms?
466  *
467  * @since 2.0
468  *
469  * @return bool true if compatible, false otherwise (or not active/installed).
470  * @api
471  */
473 
474  $version = $this->get_gravityforms_version();
475 
476  return $version ? version_compare( $version, self::$future_min_gf_version, '>=' ) : false;
477  }
478 
479  /**
480  * Retrieve the current PHP version.
481  *
482  * Overridable with GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE during testing.
483  *
484  * @return string The version of PHP.
485  */
486  private function get_php_version() {
487 
488  return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] ) ?
489  $GLOBALS['GRAVITYVIEW_TESTS_PHP_VERSION_OVERRIDE'] : phpversion();
490  }
491 
492  /**
493  * Retrieve the current WordPress version.
494  *
495  * Overridable with GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE during testing.
496  *
497  * @return string The version of WordPress.
498  */
499  private function get_wordpress_version() {
500 
501  return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] ) ?
502  $GLOBALS['GRAVITYVIEW_TESTS_WP_VERSION_OVERRIDE'] : $GLOBALS['wp_version'];
503  }
504 
505  /**
506  * Retrieve the current Gravity Forms version.
507  *
508  * Overridable with GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE during testing.
509  *
510  * @return string|null The version of Gravity Forms or null if inactive.
511  */
512  private function get_gravityforms_version() {
513 
514  if ( ! class_exists( '\GFCommon' ) || ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_INACTIVE_OVERRIDE'] ) ) {
515  gravityview()->log->error( 'Gravity Forms is inactive or not installed.' );
516 
517  return null;
518  }
519 
520  return ! empty( $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] ) ?
521  $GLOBALS['GRAVITYVIEW_TESTS_GF_VERSION_OVERRIDE'] : \GFCommon::$version;
522  }
523 
524  /**
525  * Feature support detection.
526  *
527  * @param string $feature Feature name. Check FEATURE_* class constants.
528  *
529  * @return boolean
530  */
531  public function supports( $feature ) {
532 
533  /**
534  * @filter `gravityview/supports` Overrides whether GravityView supports a feature.
535  * @since 2.0
536  * @param boolean|null $supports Whether the feature is supported. Default: null.
537  */
538  $supports = apply_filters( "gravityview/plugin/feature/$feature", null );
539 
540  if ( ! is_null( $supports ) ) {
541  return (bool) $supports;
542  }
543 
544  switch ( $feature ):
545  case self::FEATURE_GFQUERY:
546  return class_exists( '\GF_Query' );
547  case self::FEATURE_JOINS:
548  case self::FEATURE_UNIONS:
549  return apply_filters( 'gravityview/query/class', false ) === '\GF_Patched_Query';
550  case self::FEATURE_REST:
551  return class_exists( '\WP_REST_Controller' );
552  default:
553  return false;
554  endswitch;
555  }
556 
557  /**
558  * Delete GravityView Views, settings, roles, caps, etc.
559  *
560  * @return void
561  */
562  public function uninstall() {
563 
564  global $wpdb;
565 
566  $suppress = $wpdb->suppress_errors();
567 
568  /**
569  * Posts.
570  */
571  $items = get_posts( array(
572  'post_type' => 'gravityview',
573  'post_status' => 'any',
574  'numberposts' => - 1,
575  'fields' => 'ids',
576  ) );
577 
578  foreach ( $items as $item ) {
579  wp_delete_post( $item, true );
580  }
581 
582  /**
583  * Meta.
584  */
585  $tables = array();
586 
587  if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) ) {
588  $tables [] = \GFFormsModel::get_entry_meta_table_name();
589  } elseif ( ! $this->is_GF_25() ) {
590  $tables [] = \GFFormsModel::get_lead_meta_table_name();
591  }
592 
593  foreach ( $tables as $meta_table ) {
594  $sql = "
595  DELETE FROM $meta_table
596  WHERE (
597  `meta_key` = 'is_approved'
598  );
599  ";
600  $wpdb->query( $sql );
601  }
602 
603  /**
604  * Notes.
605  */
606  $tables = array();
607 
608  if ( version_compare( \GravityView_GFFormsModel::get_database_version(), '2.3-dev-1', '>=' ) && method_exists( 'GFFormsModel', 'get_entry_notes_table_name' ) ) {
609  $tables[] = \GFFormsModel::get_entry_notes_table_name();
610  } elseif ( ! $this->is_GF_25() ) {
611  $tables[] = \GFFormsModel::get_lead_notes_table_name();
612  }
613 
614  $disapproved = __( 'Disapproved the Entry for GravityView', 'gk-gravityview' );
615  $approved = __( 'Approved the Entry for GravityView', 'gk-gravityview' );
616 
617  $suppress = $wpdb->suppress_errors();
618  foreach ( $tables as $notes_table ) {
619  $sql = $wpdb->prepare( "
620  DELETE FROM $notes_table
621  WHERE (
622  `note_type` = 'gravityview' OR
623  `value` = %s OR
624  `value` = %s
625  );
626  ", $approved, $disapproved );
627  $wpdb->query( $sql );
628  }
629 
630  $wpdb->suppress_errors( $suppress );
631 
632  /**
633  * Capabilities.
634  */
636 
637  /**
638  * Options.
639  */
640  delete_option( 'gravityview_cache_blacklist' );
641  delete_option( 'gravityview_cache_blocklist' );
642  delete_option( 'gv_version' );
643  delete_option( 'gv_version_upgraded_from' );
644  delete_transient( 'gravityview_edd-activate_valid' );
645  delete_transient( 'gravityview_edd-deactivate_valid' );
646  delete_transient( 'gravityview_dismissed_notices' );
647  delete_transient( '_gv_activation_redirect' );
648  delete_transient( 'gravityview_edd-activate_valid' );
649  delete_site_transient( 'gravityview_related_plugins' );
650  }
651 
652  /**
653  * Redirects GravityKit's GravityView submenu pages to the appropriate custom post endpoints.
654  *
655  * @since 2.16
656  *
657  * @return void
658  */
660  if ( ! class_exists( 'GVCommon' ) || ! GVCommon::has_cap( 'edit_gravityviews' ) ) {
661  return;
662  }
663 
664  global $pagenow;
665 
666  if ( ! $pagenow || ! is_admin() ) {
667  return;
668  }
669 
670  if ( 'admin.php' === $pagenow ) {
671  if ( self::ALL_VIEWS_SLUG === GravityKitFoundation::helpers()->array->get( $_GET, 'page' ) ) {
672  wp_safe_redirect( $this->get_link_to_all_views() );
673 
674  exit;
675  }
676 
677  if ( self::NEW_VIEW_SLUG === GravityKitFoundation::helpers()->array->get( $_GET, 'page' ) ) {
678  wp_safe_redirect( $this->get_link_to_new_view() );
679 
680  exit;
681  }
682  }
683  }
684 
685  /**
686  * Returns the URL to the "All Views" page.
687  *
688  * @since $ver$
689  *
690  * @return string
691  */
692  public function get_link_to_new_view() {
693  return add_query_arg(
694  [ 'post_type' => 'gravityview' ],
695  admin_url( 'post-new.php' )
696  );
697  }
698 
699  /**
700  * Returns the URL to the "New View" page.
701  *
702  * @since $ver$
703  *
704  * @return string
705  */
706  public function get_link_to_all_views() {
707  return add_query_arg(
708  [ 'post_type' => 'gravityview' ],
709  admin_url( 'edit.php' )
710  );
711  }
712 
713  /**
714  * Adds "All Views" and "New View" as submenus to the GravityKit menu.
715  *
716  * @since 2.16
717  *
718  * @param GravityKitFoundation $foundation Foundation instance.
719  *
720  * @return void
721  */
722  public function add_to_gravitykit_admin_menu( $foundation ) {
723  if ( ! GVCommon::has_cap( 'edit_gravityviews' ) || GravityKitFoundation::helpers()->core->is_network_admin() ) {
724  return;
725  }
726 
727  $admin_menu = $foundation::admin_menu();
728  $post_type = 'gravityview';
729  $capability = 'edit_gravityviews';
730  $all_views_menu_id = "{$post_type}_all_views";
731  $new_view_menu_id = "{$post_type}_new_view";
732 
733  $admin_menu::add_submenu_item( [
734  'page_title' => __( 'All Views', 'gk-gravityview' ),
735  'menu_title' => __( 'All Views', 'gk-gravityview' ),
736  'capability' => $capability,
737  'id' => $all_views_menu_id,
738  'callback' => '__return_false', // We'll redirect this to edit.php?post_type=gravityview (@see Plugin::setup_gravitykit_admin_menu_redirects()).
739  'order' => 1,
740  ], 'center' );
741 
742  $admin_menu::add_submenu_item( [
743  'page_title' => __( 'New View', 'gk-gravityview' ),
744  'menu_title' => __( 'New View', 'gk-gravityview' ),
745  'capability' => $capability,
746  'id' => $new_view_menu_id,
747  'callback' => '__return_false', // We'll redirect this to post-new.php?post_type=gravityview (@see Plugin::setup_gravitykit_admin_menu_redirects()).
748  'order' => 2,
749  ], 'center' );
750 
751  add_filter( 'parent_file', function ( $parent_file ) use ( $admin_menu, $post_type, $all_views_menu_id, $new_view_menu_id ) {
752  global $submenu_file;
753 
754  if ( ! $submenu_file || strpos( $submenu_file, "post_type={$post_type}" ) === false ) {
755  return $parent_file;
756  }
757 
758  if ( strpos( $submenu_file, 'edit.php' ) !== false ) {
759  $submenu_file = $all_views_menu_id;
760  }
761 
762  if ( strpos( $submenu_file, 'post-new.php' ) !== false ) {
763  $submenu_file = $new_view_menu_id;
764  }
765 
766  return constant( get_class( $admin_menu ) . '::WP_ADMIN_MENU_SLUG' );
767  } );
768  }
769 
770  public function __clone() {
771  }
772 
773  public function __wakeup() {
774  }
775 }
const GRAVITYVIEW_DIR
"GRAVITYVIEW_DIR" "./" The absolute path to the plugin directory, with trailing slash ...
Definition: gravityview.php:49
const GV_PLUGIN_VERSION(! GravityKit\GravityView\Foundation\meets_min_php_version_requirement(__FILE__, '7.2.0'))
Constants.
Definition: gravityview.php:34
deactivate()
Plugin deactivation function.
get_php_version()
Retrieve the current PHP version.
setup_gravitykit_admin_menu_redirects()
Redirects GravityKit&#39;s GravityView submenu pages to the appropriate custom post endpoints.
uninstall()
Delete GravityView Views, settings, roles, caps, etc.
is_compatible_future_gravityforms()
Is this version of GravityView compatible with the future version of Gravity Forms?
is_GF_25()
Check whether Gravity Forms is v2.5-beta or newer.
const GV_FUTURE_MIN_WP_VERSION
GravityView will soon require at least this version of WordPress to function properly.
Definition: gravityview.php:72
is_compatible_future_wordpress()
Is this version of GravityView compatible with the future version of WordPress?
get_link_to_all_views()
Returns the URL to the "New View" page.
get_wordpress_version()
Retrieve the current WordPress version.
static is_network_activated()
Check whether GravityView `is network activated.
is_compatible_wordpress( $version=null)
Is this version of GravityView compatible with the current version of WordPress?
is_compatible_gravityforms()
Is this version of GravityView compatible with the current version of Gravity Forms?
is_compatible_future_php()
Is this version of GravityView compatible with the future required version of PHP?
get_gravityforms_version()
Retrieve the current Gravity Forms version.
include_legacy_core()
Load more legacy core files.
dir( $path='')
Retrieve an absolute path within the GravityView plugin directory.
add_to_gravitykit_admin_menu( $foundation)
Adds "All Views" and "New View" as submenus to the GravityKit menu.
relpath( $path='')
Retrieve a relative path to the GravityView plugin directory from the WordPress plugin directory...
const GV_FUTURE_MIN_PHP_VERSION
Definition: gravityview.php:85
If this file is called directly, abort.
const GRAVITYVIEW_FILE
Full path to the GravityView file "GRAVITYVIEW_FILE" "./gravityview.php".
Definition: gravityview.php:40
const GV_FUTURE_MIN_GF_VERSION
GravityView will soon require at least this version of Gravity Forms to function properly.
Definition: gravityview.php:60
supports( $feature)
Feature support detection.
register_activation_hooks()
Register hooks that are fired when the plugin is activated and deactivated.
is_compatible()
Is everything compatible with this version of GravityView?
include_legacy_frontend( $force=false)
Include more legacy stuff.
gravityview()
The main GravityView wrapper function.
is_compatible_php()
Is this version of GravityView compatible with the current version of PHP?
static get_database_version()
Make sure the method exists, regardless of GF version.
static has_cap( $caps='', $object_id=null, $user_id=null)
Alias of GravityView_Roles_Capabilities::has_cap()
activate()
Plugin activation function.
Ex-GF Addon Settings class that&#39;s been stripped of GF functionality.
url( $path='/')
Retrieve a URL within the GravityView plugin directory.
get_link_to_new_view()
Returns the URL to the "All Views" page.
const GV_MIN_GF_VERSION
GravityView requires at least this version of Gravity Forms to function properly. ...
Definition: gravityview.php:54
const GV_MIN_PHP_VERSION
GravityView requires at least this version of PHP to function properly.
Definition: gravityview.php:78
const GV_MIN_WP_VERSION
GravityView requires at least this version of WordPress to function properly.
Definition: gravityview.php:66