
­­­­­­­­­­­­­­­­­­
<!DOCTYPE html>
<html>
<?php
/**
 * Admin core class
 */


// Prevent direct call
if ( !defined( 'WPINC' ) ) die;
if ( !class_exists( 'GW_GoPricing_Yet' ) ) die;	


// Class
class GW_GoPricing_Yet_Admin {	

	protected static $instance = null;
	protected static $screen_hooks = null;
	
	protected static $plugin_version;
	protected static $db_version;
	protected static $plugin_prefix;
	protected static $plugin_slug;
	protected $plugin_file;
	protected $plugin_base;
	protected $plugin_dir;
	protected $plugin_path;
	protected $plugin_url;
	protected $admin_path;
	protected $admin_url;
	protected $includes_path;
	protected $includes_url;
	protected $views_path;
	protected $globals;


	/**
	 * Initialize the class
	 *
	 * @return object
	 */		  
	
	public function __construct( $globals ) {
		
		self::$plugin_version = $globals['plugin_version'];
		self::$db_version = $globals['db_version'];		
		self::$plugin_prefix = $globals['plugin_prefix'];
		self::$plugin_slug = $globals['plugin_slug'];
		$this->plugin_file = $globals['plugin_file'];		
		$this->plugin_base = $globals['plugin_base'];
		$this->plugin_dir = $globals['plugin_dir'];
		$this->plugin_path = $globals['plugin_path'];
		$this->plugin_url =	$globals['plugin_url'];
		$this->globals = $globals;
		
		// Column filters
		add_filter( 'go_pricing_admin_column_header_yet', array( $this, 'column_header' ), 10, 3 );				

		// Editor popup filters
		add_filter( 'go_pricing_admin_editor_popup_general_layout-style_yet', array( $this, 'editor_popup_general_layout_style' ), 10, 2 );
		add_filter( 'go_pricing_admin_editor_popup_header_style_yet', array( $this, 'editor_popup_header_style' ), 10, 2 );
		add_action( 'go_pricing_admin_editor_popup_header_media',  array( $this, 'editor_popup_header_media' ) );
		add_filter( 'go_pricing_admin_editor_popup_header_title_yet', array( $this, 'editor_popup_header_title' ), 10, 2 );
		add_filter( 'go_pricing_admin_editor_popup_header_price_yet', array( $this, 'editor_popup_header_price' ), 10, 2 );
		add_filter( 'go_pricing_admin_editor_popup_header_general_yet', array( $this, 'editor_popup_header_general' ), 10, 2 );
		add_filter( 'go_pricing_admin_editor_popup_body_row_yet', array( $this, 'editor_popup_body_row' ), 10, 2 );
		add_filter( 'go_pricing_admin_editor_popup_footer_row_yet', array( $this, 'editor_popup_footer_row' ), 10, 2 );
		
	}


	/**
	 * Return an instance of this class
	 *
	 * @return object | bool
	 */
	 
	public static function instance( $globals ) {
		
		if ( empty( $globals ) ) return false;
		
		if ( self::$instance == null ) {
			self::$instance = new self ( $globals );
		}
		
		return self::$instance;
		
	}
	
	/**
	 * Column editor header
	 *
	 * @return void
	 */	
	
	public function column_header ( $content, $table_data, $col_index ) {

		ob_start();
		include( 'views/column/header.php' );
		return ob_get_clean();

	}
	
	
	/**
	 * Editor popup view general style
	 *
	 * @return void
	 */		
	
	public function editor_popup_general_layout_style( $content, $postdata ) {

		ob_start();
		include( 'views/editor_popup/general_layout-style.php' );
		return ob_get_clean();
		
	}
	
		
	/**
	 * Editor popup view header style
	 *
	 * @return void
	 */		
	
	public function editor_popup_header_style( $content, $postdata ) {

		ob_start();
		include( 'views/editor_popup/header_style.php' );
		return ob_get_clean();
		
	}			


	/**
	 * Editor popup view header media
	 *
	 * @return void
	 */	

	public function editor_popup_header_media( $file ) {
		
		return $this->plugin_path . 'includes/admin/views/editor_popup/header_media.php';
		
	}		


	/**
	 * Editor popup view header title
	 *
	 * @return void
	 */		
	
	public function editor_popup_header_title( $content, $postdata ) {

		ob_start();
		include( 'views/editor_popup/header_title.php' );
		return ob_get_clean();
		
	}
	
	
	/**
	 * Editor popup view header price
	 *
	 * @return void
	 */		
	
	public function editor_popup_header_price( $content, $postdata ) {

		ob_start();
		include( 'views/editor_popup/header_price.php' );
		return ob_get_clean();
		
	}
	
	
	/**
	 * Editor popup view header general
	 *
	 * @return void
	 */		
	
	public function editor_popup_header_general( $content, $postdata ) {

		ob_start();
		include( 'views/editor_popup/header_general.php' );
		return ob_get_clean();
		
	}	
	
	
	/**
	 * Editor popup view for body row
	 *
	 * @return void
	 */		
	
	public function editor_popup_body_row ( $content, $postdata ) {

		ob_start();
		include( 'views/editor_popup/body_row.php' );
		return ob_get_clean();
		
	}


	/**
	 * Editor popup view for footer row
	 *
	 * @return void
	 */	

	public function editor_popup_footer_row ( $content, $postdata ) {

		ob_start();
		include( 'views/editor_popup/footer_row.php' );
		return ob_get_clean();

	}		
	
}
?>