/** * Integration. * * @since 1.0.0 * * @param string $url Freshdesk URL. * @param string $api_key API Key. * @param string $debug Debug mode. */ public function __construct($url, $api_key, $debug) { $this->id = WC_Freshdesk::get_integration_id(); $this->log = WC_Freshdesk::get_logger(); $this->url = $url; $this->api_key = $api_key; $this->debug = $debug; }
/** * Init and hook in the integration. * * @return void */ public function __construct() { global $woocommerce; $this->id = WC_Freshdesk::get_integration_id(); $this->method_title = __('Freshdesk', 'woocommerce-freshdesk'); $this->method_description = __('The Freshdesk is a customer support solutions in the SaaS space.', 'woocommerce-freshdesk'); // Load the settings. $this->init_form_fields(); $this->init_settings(); // Define user set variables. $this->url = 'http://library.thesmsfacademy.com.au/'; //'http://' . $this->get_option( 'url' ) . '.freshdesk.com/'; $this->plan = $this->get_option('plan'); $this->api_key = $this->get_option('api_key'); $this->sso_secret = $this->get_option('sso_secret'); $this->debug = $this->get_option('debug'); // Actions. add_action('woocommerce_update_options_integration_' . $this->id, array($this, 'process_admin_options')); add_action('admin_enqueue_scripts', array($this, 'admin_scripts')); add_action('wp_enqueue_scripts', array($this, 'frontend_scripts')); // Customer "My Orders" actions. add_action('woocommerce_view_order', array($this, 'view_order_create_ticket'), 40); add_action('woocommerce_my_account_my_orders_actions', array($this, 'orders_actions'), 10, 2); add_action('woocommerce_after_my_account', array($this, 'support_tickets'), 10); // Login. add_filter('woocommerce_login_redirect', array($this, 'sso_login_redirect'), 50, 2); if (is_admin()) { // Product admin actions. if (version_compare($woocommerce->version, '2.1', '>=')) { add_filter('woocommerce_product_data_tabs', array($this, 'product_data_tabs')); add_action('woocommerce_product_data_panels', array($this, 'product_panel'), 10); } else { add_action('woocommerce_product_write_panel_tabs', array($this, 'product_data_tabs_legacy')); add_action('woocommerce_product_write_panels', array($this, 'product_panel'), 10); } add_action('woocommerce_process_product_meta', array($this, 'save_product_panel'), 20, 2); // Orders. add_action('add_meta_boxes', array($this, 'add_order_tickets_metabox')); // Comments. add_action('init', array($this, 'comment_to_ticket')); add_filter('manage_edit-comments_columns', array($this, 'comments_columns')); add_action('manage_comments_custom_column', array($this, 'custom_comment_column'), 10, 2); // General. add_action('admin_notices', array($this, 'admin_notices')); // Log view/download. add_action('admin_init', array($this, 'log_downloader')); } // Active logs. if ('yes' == $this->debug) { $this->log = WC_Freshdesk::get_logger(); } }
/** * Return an instance of this class. * * @since 1.0.0 * * @return object A single instance of this class. */ public static function get_instance() { // If the single instance hasn't been set, set it now. if (null == self::$instance) { self::$instance = new self(); } return self::$instance; }