/** * Return an instance of this class * * @return array */ public static function instance() { static $globals; if (self::$instance == null) { self::$instance = new self(); $globals = self::$instance->set_globals(); self::$instance->load_includes(); } return $globals; }
/** * Initialize the class */ private function __construct() { self::$globals = GW_GoPricing::instance(); self::$plugin_version = self::$globals['plugin_version']; self::$db_version = self::$globals['db_version']; self::$plugin_prefix = self::$globals['plugin_prefix']; self::$plugin_slug = self::$globals['plugin_slug']; // Register custom post types add_action('init', array($this, 'register_custom_post_type')); }
/** * Initialize the class * * @return void */ public function __construct() { $this->globals = GW_GoPricing::instance(); self::$plugin_version = $this->globals['plugin_version']; self::$db_version = $this->globals['db_version']; self::$plugin_prefix = $this->globals['plugin_prefix']; self::$plugin_slug = $this->globals['plugin_slug']; self::$plugin_path = $this->globals['plugin_path']; // Admin notices action add_action('admin_notices', array($this, 'print_admin_notices')); }
/** * Initialize the class * * @return void */ public function __construct() { $this->globals = GW_GoPricing::instance(); self::$plugin_version = $this->globals['plugin_version']; self::$db_version = $this->globals['db_version']; self::$plugin_prefix = $this->globals['plugin_prefix']; self::$plugin_slug = $this->globals['plugin_slug']; $this->plugin_url = $this->globals['plugin_url']; // Enqueue frontend styles add_action('wp_enqueue_scripts', array($this, 'enqueue_public_styles')); // Enqueue frontend scripts add_action('wp_enqueue_scripts', array($this, 'register_public_scripts')); }
/** * Initialize the class * * @return object */ public function __construct($ajax_action_callback = null) { $this->globals = GW_GoPricing::instance(); self::$plugin_version = $this->globals['plugin_version']; self::$db_version = $this->globals['db_version']; self::$plugin_prefix = $this->globals['plugin_prefix']; self::$plugin_slug = $this->globals['plugin_slug']; $this->plugin_file = $this->globals['plugin_file']; $this->plugin_base = $this->globals['plugin_base']; $this->plugin_dir = $this->globals['plugin_dir']; $this->plugin_path = $this->globals['plugin_path']; $this->plugin_url = $this->globals['plugin_url']; $this->screen = get_current_screen(); $this->action = !empty($_POST['_action']) ? $_POST['_action'] : ''; $this->action_type = !empty($_POST['_action_type']) ? $_POST['_action_type'] : ''; $this->referrer = !empty($_POST['_wp_http_referer']) ? esc_url($_POST['_wp_http_referer']) : ''; $this->is_ajax = isset($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest' && !empty($_POST['action']) ? true : false; // Register ajax actions if (!empty($ajax_action_callback)) { $this->register_ajax_actions($ajax_action_callback); } // Fire action $this->action(); }
<?php /** * Plugin Name: Go - Responsive Pricing & Compare Tables * Plugin URI: http://granthweb.com/go-pricing * Description: The New Generation Pricing Tables. If you like traditional Pricing Tables, but you would like get much more out of it, then this rodded product is a useful tool for you. * Version: 3.0.2 * Author: Granth * Author URI: http://granthweb.com/ * Text Domain: go_pricing_textdomain * Domain Path: /lang */ /* Prevent direct call */ if (!defined('WPINC')) { die; } /* Prevent redeclaring class */ if (class_exists('GW_GoPricing')) { wp_die(__('GW_GoPricing class has been declared!', 'go_pricing_textdomain')); } /* Include & init main class */ include_once plugin_dir_path(__FILE__) . 'class_go_pricing.php'; GW_GoPricing::instance();