GravityView  2.17
The best, easiest way to display Gravity Forms entries on your website.
Core.php
Go to the documentation of this file.
1 <?php
2 /**
3  * @license GPL-2.0-or-later
4  *
5  * Modified by gravityview on 13-January-2023 using Strauss.
6  * @see https://github.com/BrianHenryIE/strauss
7  */
8 
10 
23 use Exception;
24 
25 class Core {
26  const VERSION = '1.0.8';
27 
28  const ID = 'gk_foundation';
29 
30  const WP_AJAX_ACTION = 'gk_foundation_do_ajax';
31 
32  const AJAX_ROUTER = 'core';
33 
34  const INIT_PRIORITY = 100;
35 
36  /**
37  * Class instance.
38  *
39  * @since 1.0.0
40  *
41  * @var Core
42  */
43  private static $_instance;
44 
45  /**
46  * Instance of plugin activation/deactivation handler class.
47  *
48  * @since 1.0.0
49  *
50  * @var PluginActivationHandler
51  */
53 
54  /**
55  * Absolute paths to the plugin files that instantiated this class.
56  *
57  * @since 1.0.0
58  *
59  * @var array
60  */
61  public $_registered_plugins = [];
62 
63  /**
64  * Instances of various components that make up the Core functionality.
65  *
66  * @since 1.0.0
67  *
68  * @var array
69  */
70  private $_components = [];
71 
72  /**
73  * Random string generated once for the current request.
74  *
75  * @since 1.0.0
76  *
77  * @var string
78  */
79  private static $_request_unique_string;
80 
81  /**
82  * Class constructor.
83  *
84  * @since 1.0.0
85  *
86  * @param string $plugin_file Absolute path to the main plugin file.
87  *
88  * @return void
89  */
90  private function __construct( $plugin_file ) {
91  $this->_plugin_activation_handler = new PluginActivationHandler();
92 
93  $this->_plugin_activation_handler->register_hooks( $plugin_file );
94 
95  $this->_registered_plugins['foundation_source'] = $plugin_file;
96 
97  add_filter(
98  'gk/foundation/get-instance',
99  function ( $passed_instance ) use ( $plugin_file ) {
100  if ( ! $passed_instance || ! defined( get_class( $passed_instance ) . '::VERSION' ) || ! is_callable( [ $passed_instance, 'get_registered_plugins' ] ) ) {
101  return $this;
102  }
103 
104  $instance_to_return = version_compare( $passed_instance::VERSION, self::VERSION, '<' ) ? $this : $passed_instance;
105 
106  /**
107  * Controls whether the Foundation standalone plugin instance should always be returned regardless of the version.
108  *
109  * @filter gk/foundation/force-standalone-foundation-instance
110  *
111  * @since 1.0.2
112  *
113  * @param bool $force_standalone_instance Default: true.
114  */
115  $force_standalone_instance = apply_filters( 'gk/foundation/force-standalone-foundation-instance', true );
116 
117  if ( $force_standalone_instance ) {
118  $plugin_data = CoreHelpers::get_plugin_data( $plugin_file );
119 
120  if ( 'gk-foundation' === Arr::get( $plugin_data, 'TextDomain' ) ) {
121  $instance_to_return = $this;
122  }
123  }
124 
125  // We need to make sure that the returned instance contains a list of all registered plugins that may have come with another passed instance.
126  if ( $instance_to_return === $this ) {
127  // Reset the other instance's registered plugin keys so that there is only 1 "foundation source" plugin, which is that of the current instance.
128  $registered_plugins = array_merge( $this->_registered_plugins, array_values( $passed_instance->get_registered_plugins() ) );
129  } else {
130  $registered_plugins = array_merge( array_values( $this->_registered_plugins ), $instance_to_return->get_registered_plugins() );
131  }
132 
133  $instance_to_return->set_registered_plugins( $registered_plugins );
134 
135  return $instance_to_return;
136  }
137  );
138 
139  add_action(
140  'plugins_loaded',
141  function () {
142  if ( class_exists( 'GravityKitFoundation' ) ) {
143  return;
144  }
145 
146  $gk_foundation = apply_filters( 'gk/foundation/get-instance', null );
147 
148  if ( ! $gk_foundation ) {
149  return;
150  }
151 
152  $gk_foundation->init();
153  },
154  self::INIT_PRIORITY
155  );
156  }
157 
158  /**
159  * Registers class instance.
160  *
161  * @since 1.0.0
162  *
163  * @param string $plugin_file Absolute path to the main plugin file.
164  *
165  * @return void
166  */
167  public static function register( $plugin_file ) {
168  if ( is_null( self::$_instance ) ) {
169  self::$_instance = new self( $plugin_file );
170  } elseif ( ! in_array( $plugin_file, self::$_instance->_registered_plugins ) ) {
171  self::$_instance->_registered_plugins[] = $plugin_file;
172  }
173  }
174 
175  /**
176  * Returns class instance.
177  *
178  * @since 1.0.0
179  *
180  * @return Core
181  */
182  public static function get_instance() {
183  return self::$_instance;
184  }
185 
186  /**
187  * Returns a list of plugins that have instantiated Foundation.
188  *
189  * @since 1.0.0
190  *
191  * @return array
192  */
193  public function get_registered_plugins() {
195  }
196 
197  /**
198  * Sets a list of plugins that have instantiated Foundation.
199  *
200  * @since 1.0.0
201  *
202  * @param array $plugins Array of absolute paths to the plugin files that instantiated this class.
203  *
204  * @return void
205  */
206  public function set_registered_plugins( $plugins ) {
207  $this->_registered_plugins = array_unique( $plugins );
208  }
209 
210  /**
211  * Initializes Foundation.
212  *
213  * @since 1.0.0
214  *
215  * @return void
216  */
217  public function init() {
218  if ( did_action( 'gk/foundation/initialized' ) ) {
219  return;
220  }
221 
222  add_action( 'wp_ajax_' . self::WP_AJAX_ACTION, [ $this, 'process_ajax_request' ] );
223 
224  $this->_components = [
225  'settings' => SettingsFramework::get_instance(),
226  'licenses' => LicensesFramework::get_instance(),
227  'translations' => TranslationsFramework::get_instance(),
228  'logger' => LoggerFramework::get_instance(),
229  'admin_menu' => AdminMenu::get_instance(),
230  'encryption' => Encryption::get_instance(),
231  'trustedlogin' => TrustedLogin::get_instance(),
232  'helpscout' => HelpScout::get_instance(),
233  'gravityforms' => GravityForms::get_instance(),
234  ];
235 
236  foreach ( $this->_components as $component => $instance ) {
237  if ( CoreHelpers::is_callable_class_method( [ $this->_components[ $component ], 'init' ] ) ) {
238  $this->_components[ $component ]->init();
239  }
240  }
241 
242  self::$_request_unique_string = $this->encryption()->get_random_nonce();
243 
244  if ( is_admin() ) {
245  $this->plugin_activation_handler()->fire_activation_hook();
246 
247  $this->configure_settings();
248 
249  add_action( 'admin_enqueue_scripts', [ $this, 'inline_scripts_and_styles' ], 20 );
250 
251  add_action( 'admin_footer', [ $this, 'display_foundation_information' ] );
252  }
253 
254  class_alias( __CLASS__, 'GravityKitFoundation' );
255 
256  /**
257  * Fires when the class has finished initializing.
258  *
259  * @action gk/foundation/initialized
260  *
261  * @since 1.0.0
262  *
263  * @param $this
264  */
265  do_action( 'gk/foundation/initialized', $this );
266  }
267 
268  /**
269  * Configures general GravityKit settings.
270  *
271  * @since 1.0.0
272  *
273  * @return void
274  */
275  public function configure_settings() {
276  add_filter(
277  'gk/foundation/settings/data/plugins',
278  function ( $plugins ) {
279  $gk_settings = $this->settings()->get_plugin_settings( self::ID );
280 
281  // If multisite and not the main site, get default settings from the main site.
282  // This allows site admins to configure the default settings for all subsites.
283  // If no settings are found on the main site, default settings (set below) will be used.
284  if ( ! is_main_site() && empty( $gk_settings ) ) {
285  $gk_settings = $this->settings()->get_plugin_settings( self::ID, get_main_site_id() );
286  }
287 
288  $default_settings = [
289  'support_email' => get_bloginfo( 'admin_email' ),
290  'support_port' => 1,
291  'no_conflict_mode' => 1,
292  'powered_by' => 0,
293  'beta' => 0,
294  ];
295 
296  $general_settings = [];
297 
298  // TODO: This is a temporary notice. To be removed once GravityView is updated to v2.16.
299  if ( defined( 'GV_PLUGIN_VERSION' ) && version_compare( GV_PLUGIN_VERSION, '2.16', '<' ) ) {
300  $notice_1 = esc_html__( 'You are using a version of GravityView that does not yet support the new GravityKit settings framework.', 'gk-gravityview' );
301 
302  $notice_2 = strtr(
303  esc_html_x( 'As such, the settings below will not apply to GravityView pages and you will have to continue using the [link]old settings[/link] until an updated version of the plugin is available. We apologize for the inconvenience as we work to update our products in a timely fashion.', 'Placeholders inside [] are not to be translated.', 'gk-gravityview' ),
304  [
305  '[link]' => '<a href="' . admin_url( 'edit.php?post_type=gravityview&page=gravityview_settings' ) . '" class="text-blue-gv underline hover:text-gray-900 focus:text-gray-900 focus:no-underline focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-900">',
306  '[/link]' => '</a>',
307  ]
308  );
309 
310  $html = <<<HTML
311 <div class="bg-yellow-50 p-4 rounded-md">
312  <div class="flex">
313  <div class="flex-shrink-0">
314  <svg class="h-5 w-5 text-yellow-400" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
315  <path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
316  </svg>
317  </div>
318  <div class="ml-3">
319  <p class="text-sm">
320  {$notice_1}
321  </p>
322  <br />
323  <p class="text-sm">
324  {$notice_2}
325  </p>
326  </div>
327  </div>
328 </div>
329 HTML;
330 
331  $general_settings[] = [
332  'id' => 'legacy_settings_notice',
333  'html' => $html,
334  ];
335  }
336 
337  $general_settings = array_merge(
338  $general_settings,
339  [
340  [
341  'id' => 'powered_by',
342  'type' => 'checkbox',
343  'value' => Arr::get( $gk_settings, 'powered_by', $default_settings['powered_by'] ),
344  'title' => esc_html__( 'Display "Powered By" Link', 'gk-gravityview' ),
345  'description' => esc_html__( 'A "Powered by GravityKit" link will be displayed below some GravityKit products. Help us spread the word!', 'gk-gravityview' ),
346  ],
347  [
348  'id' => 'affiliate_id',
349  'type' => 'number',
350  'value' => Arr::get( $gk_settings, 'affiliate_id' ),
351  'title' => esc_html__( 'Affiliate ID', 'gk-gravityview' ),
352  'description' => strtr(
353  esc_html_x( 'Earn money when people clicking your links become GravityKit customers. [link]Register as an affiliate[/link]!', 'Placeholders inside [] are not to be translated.', 'gk-gravityview' ),
354  [
355  '[link]' => '<a href="https://www.gravitykit.com/account/affiliates/?utm_source=in-plugin&utm_medium=setting&utm_content=Register%20as%20an%20affiliate" class="underline" rel="external">',
356  '[/link]' => '</a>',
357  ]
358  ),
359  'requires' => [
360  'id' => 'powered_by',
361  'operator' => '=',
362  'value' => '1',
363  ],
364  ],
365  [
366  'id' => 'beta',
367  'type' => 'checkbox',
368  'value' => Arr::get( $gk_settings, 'beta', $default_settings['beta'] ),
369  'title' => esc_html__( 'Become a Beta Tester', 'gk-gravityview' ),
370  'description' => esc_html__( 'You will have early access to the latest GravityKit products. There may be bugs! If you encounter an issue, report it to help make GravityKit products better!', 'gk-gravityview' ),
371  ],
372  ]
373  );
374 
375  $support_settings = [
376  [
377  'id' => 'support_email',
378  'type' => 'text',
379  'required' => true,
380  'value' => Arr::get( $gk_settings, 'support_email', $default_settings['support_email'] ),
381  'title' => esc_html__( 'Support Email', 'gk-gravityview' ),
382  'description' => esc_html__( 'In order to provide responses to your support requests, please provide your email address.', 'gk-gravityview' ),
383  'validation' => [
384  [
385  'rule' => 'required',
386  'message' => esc_html__( 'Support email is required', 'gk-gravityview' ),
387  ],
388  [
389  'rule' => 'email',
390  'message' => esc_html__( 'Please provide a valid email address', 'gk-gravityview' ),
391  ],
392  ],
393  ],
394  [
395  'id' => 'support_port',
396  'type' => 'checkbox',
397  'value' => Arr::get( $gk_settings, 'support_port', $default_settings['support_port'] ),
398  'title' => esc_html__( 'Show Support Port', 'gk-gravityview' ),
399  'description' => ( esc_html__( 'The Support Port provides quick access to how-to articles and tutorials. For administrators, it also makes it easy to contact support.', 'gk-gravityview' ) .
400  strtr(
401  esc_html_x( '[image]Support Port icon[/image]', 'Placeholders inside [] are not to be translated.', 'gk-gravityview' ),
402  [
403  '[image]' => '<div style="margin-top: 1em; width: 7em;">![',
404  '[/image]' => '](' . CoreHelpers::get_assets_url( 'support-port-icon.jpg' ) . ')</div>',
405  ]
406  ) ),
407  'markdown' => true,
408  ],
409  ];
410 
411  $technical_settings = [
412  [
413  'id' => 'no_conflict_mode',
414  'type' => 'checkbox',
415  'value' => Arr::get( $gk_settings, 'no_conflict_mode', $default_settings['no_conflict_mode'] ),
416  'title' => esc_html__( 'Enable No-Conflict Mode', 'gk-gravityview' ),
417  'description' => esc_html__( 'No-conflict mode prevents extraneous scripts and styles from being printed on GravityKit admin pages, reducing conflicts with other plugins and themes.', 'gk-gravityview' ),
418  ],
419  ];
420 
421  $all_settings = [
422  self::ID => [
423  'id' => self::ID,
424  'title' => 'GravityKit',
425  'defaults' => $default_settings,
426  'icon' => CoreHelpers::get_assets_url( 'gravitykit-icon.png' ),
427  'sections' => [
428  [
429  'title' => esc_html__( 'General', 'gk-gravityview' ),
430  'settings' => $general_settings,
431  ],
432  [
433  'title' => esc_html__( 'Support', 'gk-gravityview' ),
434  'settings' => $support_settings,
435  ],
436  [
437  'title' => esc_html__( 'Technical', 'gk-gravityview' ),
438  'settings' => $technical_settings,
439  ],
440  ],
441  ],
442  ];
443 
444  /**
445  * Modifies the GravityKit general settings object.
446  *
447  * @filter gk/foundation/settings
448  *
449  * @since 1.0.0
450  *
451  * @param array $all_settings GravityKit general settings.
452  */
453  $all_settings = apply_filters( 'gk/foundation/settings', $all_settings );
454 
455  return array_merge( $plugins, $all_settings );
456  }
457  );
458  }
459 
460  /**
461  * Registers the GravityKit admin menu.
462  *
463  * @since 1.0.0
464  *
465  * @param string $router AJAX router that will be handling the request.
466  *
467  * @return array
468  */
469  public static function get_ajax_params( $router ) {
470  return [
471  '_wpNonce' => wp_create_nonce( self::ID ),
472  '_wpAjaxUrl' => admin_url( 'admin-ajax.php' ),
473  '_wpAjaxAction' => self::WP_AJAX_ACTION,
474  'ajaxRouter' => $router ?: self::AJAX_ROUTER,
475  ];
476  }
477 
478  /**
479  * Processes AJAX request and routes it to the appropriate endpoint.
480  *
481  * @since 1.0.0
482  *
483  * @throws Exception
484  *
485  * @return void|mixed Send JSON response if an AJAX request or return the response as is.
486  */
487  public function process_ajax_request() {
488  $request = wp_parse_args(
489  $_POST, // phpcs:ignore WordPress.Security.NonceVerification.Missing
490  [
491  'nonce' => null,
492  'payload' => [],
493  'ajaxRouter' => null,
494  'ajaxRoute' => null,
495  ]
496  );
497 
498  list ( $nonce, $payload, $router, $route ) = array_values( $request );
499 
500  if ( ! is_array( $payload ) ) {
501  $payload = json_decode( stripslashes_deep( $payload ), true );
502  }
503 
504  $is_valid_nonce = wp_verify_nonce( $nonce, self::ID );
505 
506  if ( ! wp_doing_ajax() || ! $is_valid_nonce ) {
507  wp_die( false, false, [ 'response' => 403 ] );
508  }
509 
510  /**
511  * Modifies a list of AJAX routes that map to backend functions/class methods. $router groups routes to avoid a name collision (e.g., 'settings', 'licenses').
512  *
513  * @filter gk/foundation/ajax/{$router}/routes
514  *
515  * @since 1.0.0
516  *
517  * @param array[] $routes AJAX route to function/class method map.
518  */
519  $ajax_route_to_class_method_map = apply_filters( "gk/foundation/ajax/{$router}/routes", [] );
520 
521  $route_callback = Arr::get( $ajax_route_to_class_method_map, $route );
522 
523  if ( ! CoreHelpers::is_callable_function( $route_callback ) && ! CoreHelpers::is_callable_class_method( $route_callback ) ) {
524  wp_die( false, false, [ 'response' => 404 ] );
525  }
526 
527  try {
528  /**
529  * Modifies AJAX payload before the route is processed.
530  *
531  * @filter gk/foundation/ajax/payload
532  *
533  * @since 1.0.3
534  *
535  * @param array $payload
536  * @param string $router
537  * @param string $route
538  */
539  $payload = apply_filters( 'gk/foundation/ajax/payload', $payload, $router, $route );
540 
541  $result = call_user_func( $route_callback, $payload );
542  } catch ( Exception $e ) {
543  $result = new Exception( $e->getMessage() );
544  }
545 
546  /**
547  * Modifies AJAX response after the route is processed.
548  *
549  * @filter gk/foundation/ajax/result
550  *
551  * @since 1.0.3
552  *
553  * @param mixed|Exception $result
554  * @param string $router
555  * @param string $route
556  * @param array $payload
557  */
558  $result = apply_filters( 'gk/foundation/ajax/result', $result, $router, $route, $payload );
559 
560  return CoreHelpers::process_return( $result );
561  }
562 
563  /**
564  * Inlines scripts/styles.
565  *
566  * @since 1.0.0
567  *
568  * @return void
569  */
570  public function inline_scripts_and_styles() {
571  /**
572  * Modifies scripts inlined by Foundation.
573  *
574  * @filter gk/foundation/inline-scripts
575  *
576  * @since 1.0.0
577  *
578  * @param array $inline_scripts Scripts inlined by Foundation.
579  */
580  $inline_scripts = apply_filters( 'gk/foundation/inline-scripts', [] );
581 
582  if ( ! empty( $inline_scripts ) ) {
583  $dependencies = [];
584  $scripts = [];
585 
586  foreach ( $inline_scripts as $script_data ) {
587  if ( isset( $script_data['dependencies'] ) ) {
588  $dependencies = array_merge( $dependencies, $script_data['dependencies'] );
589  }
590 
591  if ( isset( $script_data['script'] ) ) {
592  $scripts[] = $script_data['script'];
593  }
594  }
595 
596  wp_register_script( self::ID, false, $dependencies ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.NotInFooter,WordPress.WP.EnqueuedResourceParameters.MissingVersion
597  wp_enqueue_script( self::ID );
598  wp_add_inline_script( self::ID, implode( ' ', $scripts ) );
599  }
600 
601  /**
602  * Modifies styles inlined by Foundation.
603  *
604  * @filter gk/foundation/inline-styles
605  *
606  * @since 1.0.0
607  *
608  * @param array $inline_styles Styles inlined by Foundation.
609  */
610  $inline_styles = apply_filters( 'gk/foundation/inline-styles', [] );
611 
612  if ( ! empty( $inline_styles ) ) {
613  $dependencies = [];
614  $styles = [];
615 
616  foreach ( $inline_styles as $style_data ) {
617  if ( isset( $style_data['dependencies'] ) ) {
618  $dependencies = array_merge( $dependencies, $style_data['dependencies'] );
619  }
620 
621  if ( isset( $style_data['style'] ) ) {
622  $styles[] = $style_data['style'];
623  }
624  }
625 
626  wp_register_style( self::ID, false ); // phpcs:ignore WordPress.WP.EnqueuedResourceParameters.MissingVersion
627  wp_enqueue_style( self::ID );
628  wp_add_inline_style( self::ID, implode( ' ', $styles ) );
629  }
630  }
631 
632  /**
633  * Magic method to get private class instances.
634  *
635  * @since 1.0.0
636  *
637  * @param string $name Component/class name.
638  * @param array $arguments Optional and not used.
639  *
640  * @return mixed
641  */
642  public function __call( $name, array $arguments = [] ) {
643  if ( 'plugin_activation_handler' === $name ) {
645  }
646 
647  if ( 'helpers' === $name ) {
648  return (object) [
649  'core' => new CoreHelpers(),
650  'array' => new Arr(),
651  ];
652  }
653 
654  if ( ! isset( $this->_components[ $name ] ) ) {
655  return;
656  }
657 
658  switch ( $name ) {
659  case 'logger':
660  $logger_name = isset( $arguments[0] ) ? $arguments[0] : null;
661  $logger_title = isset( $arguments[1] ) ? $arguments[1] : null;
662 
663  return call_user_func_array( [ $this->_components[ $name ], 'get_instance' ], [ $logger_name, $logger_title ] );
664  default:
665  return $this->_components[ $name ];
666  }
667  }
668 
669  /**
670  * Magic method to get private class instances as static methods.
671  *
672  * @since 1.0.0
673  *
674  * @param string $name Component/class name.
675  * @param array $arguments Optional and not used.
676  *
677  * @return mixed
678  */
679  public static function __callStatic( $name, array $arguments = [] ) {
680  $instance = apply_filters( 'gk/foundation/get-instance', null );
681 
682  return call_user_func_array( [ $instance, $name ], $arguments );
683  }
684 
685  /**
686  * Returns a unique value that was generated for this request.
687  * This value can be used, among other purposes, as a random initialization vector for encryption operations performed during the request (e.g., encrypting a license key in various places will result in the same encrypted value).
688  *
689  * @since 1.0
690  *
691  * @return string
692  */
693  public static function get_request_unique_string() {
694  return self::$_request_unique_string;
695  }
696 
697  /**
698  * Outputs an HTML comment with the Foundation version and the plugin that loaded it.
699  *
700  * @since 1.0.1
701  *
702  * @return void
703  */
704  public function display_foundation_information() {
705  /**
706  * Controls the display of HTML comment with Foundation information.
707  *
708  * @filter gk/foundation/display_foundation_information
709  *
710  * @since 1.0.1
711  *
712  * @param bool $display_foundation_information Whether to display the information.
713  */
714  $display_foundation_information = apply_filters( 'gk/foundation/display_foundation_information', true );
715 
716  if ( ! $display_foundation_information ) {
717  return;
718  }
719 
720  $foundation_version = self::VERSION;
721  $foundation_source = Arr::get( CoreHelpers::get_plugin_data( $this->_registered_plugins['foundation_source'] ), 'Name', '<unknown plugin>' );
722 
723  echo "<!-- GravityKit Foundation v{$foundation_version} (loaded by {$foundation_source}) -->"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
724  }
725 }
const GV_PLUGIN_VERSION(! GravityKit\GravityView\Foundation\meets_min_php_version_requirement(__FILE__, '7.2.0'))
Constants.
Definition: gravityview.php:34
GPL-2.0-or-later
Definition: Core.php:9
__call( $name, array $arguments=[])
Magic method to get private class instances.
Definition: Core.php:642
static get( $array, $key, $default=null)
{}
Definition: Arr.php:99
static static get_instance()
Returns class instance.
Definition: AdminMenu.php:42
static get_instance( $secret_key='')
Returns class instance.
Definition: Encryption.php:67
static get_instance()
Returns class instance.
Definition: Core.php:182
set_registered_plugins( $plugins)
Sets a list of plugins that have instantiated Foundation.
Definition: Core.php:206
configure_settings()
Configures general GravityKit settings.
Definition: Core.php:275
__construct( $plugin_file)
Class constructor.
Definition: Core.php:90
We use Laravel&#39;s Arr class for all array helper methods.
Definition: Arr.php:20
static get_ajax_params( $router)
Registers the GravityKit admin menu.
Definition: Core.php:469
inline_scripts_and_styles()
Inlines scripts/styles.
Definition: Core.php:570
static __callStatic( $name, array $arguments=[])
Magic method to get private class instances as static methods.
Definition: Core.php:679
display_foundation_information()
Outputs an HTML comment with the Foundation version and the plugin that loaded it.
Definition: Core.php:704
process_ajax_request()
Processes AJAX request and routes it to the appropriate endpoint.
Definition: Core.php:487
static get_instance()
Returns class instance.
Definition: HelpScout.php:40
static get_request_unique_string()
Returns a unique value that was generated for this request.
Definition: Core.php:693
This class is responsible for handling plugin activation and deactivation hooks.
get_registered_plugins()
Returns a list of plugins that have instantiated Foundation.
Definition: Core.php:193
init()
Initializes Foundation.
Definition: Core.php:217