Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Bower components Debian packages RPM packages NuGet packages

jsarnowski / jsarnowski/jet-engine   php

Repository URL to install this package:

Version: 2.7.7 

/ modules / rest-api-listings / inc / module.php

<?php
namespace Jet_Engine\Modules\Rest_API_Listings;

if ( ! trait_exists( '\Jet_Engine_Notices_Trait' ) ) {
	require_once jet_engine()->plugin_path( 'includes/traits/notices.php' );
}

class Module {

	use \Jet_Engine_Notices_Trait;

	/**
	 * A reference to an instance of this class.
	 *
	 * @since  1.0.0
	 * @access private
	 * @var    object
	 */
	private static $instance = null;

	public $slug = 'rest-api-listings';
	public $data;
	public $request;
	public $settings;

	/**
	 * Constructor for the class
	 */
	public function __construct() {
		add_action( 'init', array( $this, 'init' ), 0 );
	}

	/**
	 * Init module components
	 *
	 * @return [type] [description]
	 */
	public function init() {

		require_once $this->module_path( 'auth-types/manager.php' );
		require_once $this->module_path( 'listings/manager.php' );
		require_once $this->module_path( 'data.php' );
		require_once $this->module_path( 'request.php' );
		require_once $this->module_path( 'settings.php' );
		require_once $this->module_path( 'forms.php' );

		$this->data       = new Data( $this );
		$this->request    = new Request();
		$this->settings   = new Settings();
		$this->listings   = new Listings\Manager();
		$this->auth_types = new Auth_Types\Manager();
		$this->form       = new Forms();

	}

	/**
	 * Return path inside module
	 *
	 * @param  string $relative_path [description]
	 * @return [type]                [description]
	 */
	public function module_path( $relative_path = '' ) {
		return jet_engine()->modules->modules_path( $this->slug . '/inc/' . $relative_path );
	}

	/**
	 * Return url inside module
	 *
	 * @param  string $relative_path [description]
	 * @return [type]                [description]
	 */
	public function module_url( $relative_path = '' ) {
		return jet_engine()->plugin_url( 'includes/modules/' . $this->slug . '/inc/' . $relative_path );
	}

	/**
	 * Returns the instance.
	 *
	 * @since  1.0.0
	 * @access public
	 * @return object
	 */
	public static function instance() {

		// If the single instance hasn't been set, set it now.
		if ( null == self::$instance ) {
			self::$instance = new self;
		}

		return self::$instance;
	}

}