/** * Logger. * * @param string $data */ protected function logger($data) { $options = $this->get_method_options(); if (!empty($options) && 'yes' == $options['debug']) { $logger = WC_Correios::logger(); $logger->add('correios', $data); } }
/** * Initialize the Correios shipping method. * * @return void */ public function __construct() { $this->id = 'correios'; $this->method_title = __('Correios', 'woocommerce-correios'); $this->method_description = __('Correios is a brazilian delivery method.', 'woocommerce-correios'); // Load the form fields. $this->init_form_fields(); // Load the settings. $this->init_settings(); // Define user set variables. $this->enabled = $this->get_option('enabled'); $this->title = $this->get_option('title'); $this->declare_value = $this->get_option('declare_value'); $this->display_date = $this->get_option('display_date'); $this->additional_time = $this->get_option('additional_time'); $this->fee = $this->get_option('fee'); $this->zip_origin = $this->get_option('zip_origin'); $this->simulator = $this->get_option('simulator', 'no'); $this->tracking_history = $this->get_option('tracking_history', 'no'); $this->corporate_service = $this->get_option('corporate_service'); $this->login = $this->get_option('login'); $this->password = $this->get_option('password'); $this->service_pac = $this->get_option('service_pac'); $this->service_sedex = $this->get_option('service_sedex'); $this->service_sedex_10 = $this->get_option('service_sedex_10'); $this->service_sedex_hoje = $this->get_option('service_sedex_hoje'); $this->service_esedex = $this->get_option('service_esedex'); $this->minimum_height = $this->get_option('minimum_height'); $this->minimum_width = $this->get_option('minimum_width'); $this->minimum_length = $this->get_option('minimum_length'); $this->debug = $this->get_option('debug'); // Method variables. $this->availability = 'specific'; $this->countries = array('BR'); // Actions. add_action('woocommerce_update_options_shipping_' . $this->id, array($this, 'process_admin_options')); // Active logs. if ('yes' == $this->debug) { $this->log = WC_Correios::logger(); } }
/** * Initialize the Connect class. * * @param string $debug Debug mode. */ public function __construct() { $this->id = 'correios'; $this->log = WC_Correios::logger(); }