HEX
Server: LiteSpeed
System: Linux server315.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: globfdxw (6114)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/globfdxw/www/wp-content/plugins/wpforms-form-pages/src/Loader.php
<?php

namespace WPFormsFormPages;

use WPForms_Updater;

/**
 * Form Pages loader class.
 *
 * @since 1.0.0
 */
final class Loader {

	/**
	 * URL to a plugin directory. Used for assets.
	 *
	 * @var string
	 *
	 * @since 1.0.0
	 */
	public $url = '';

	/**
	 * Initiate main plugin instance.
	 *
	 * @since 1.0.0
	 *
	 * @return Loader
	 */
	public static function get_instance() {

		static $instance;

		if ( ! $instance ) {
			$instance = new self();

			$instance->init();
		}

		return $instance;
	}

	/**
	 * All the actual plugin loading is done here.
	 *
	 * @since 1.0.0
	 *
	 * @return Loader
	 */
	public function init() { // phpcs:ignore WPForms.PHP.HooksMethod.InvalidPlaceForAddingHooks

		$this->url = plugin_dir_url( __DIR__ );

		if ( wpforms_is_admin_page( 'builder' ) ) {
			new Admin\Builder();
		}

		if ( wpforms_is_admin_page( 'overview' ) ) {
			new Admin\Overview();
		}

		if ( wp_doing_ajax() ) {
			new Admin\Ajax();
		}

		if ( ! is_admin() ) {
			new Frontend();
		}

		( new SmartTags() )->init();

		return $this;
	}

	/**
	 * Load the plugin updater.
	 *
	 * @since 1.5.0
	 * @deprecated 1.11.0
	 *
	 * @todo Remove with core 1.9.2
	 *
	 * @param string $key License key.
	 */
	public function updater( $key ) {

		_deprecated_function( __METHOD__, '1.11.0 of the WPForms Form Pages plugin' );

		new WPForms_Updater(
			[
				'plugin_name' => 'WPForms Form Pages',
				'plugin_slug' => 'wpforms-form-pages',
				'plugin_path' => plugin_basename( WPFORMS_FORM_PAGES_FILE ),
				'plugin_url'  => trailingslashit( $this->url ),
				'remote_url'  => WPFORMS_UPDATER_API,
				'version'     => WPFORMS_FORM_PAGES_VERSION,
				'key'         => $key,
			]
		);
	}
}