<?php if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly global $wc_email_att_skip_files, $wc_email_att_htaccess, $wc_email_att_plugin_base_name, $wc_email_att_are_activation_hooks; $wc_email_att_plugin_path = str_replace( basename( __FILE__ ), '', __FILE__ ); /** * load woocommerce_email_attachments main class, which loads needed classes with autoload when needed **/ require_once $wc_email_att_plugin_path . 'classes/class-wc-email-att.php'; // create object WC_Email_Att::instance(); WC_Email_Att::$show_activation = true; // true to show deactivation and uninstall checkbox WC_Email_Att::$show_uninstall = true; WC_Email_Att::$plugin_path = $wc_email_att_plugin_path; WC_Email_Att::$plugin_url = trailingslashit( plugins_url( '', plugin_basename( __FILE__ ) ) ); // also set in init hook to allow other plugins to change it in a filter hook WC_Email_Att::$plugin_base_name = $wc_email_att_plugin_base_name; WC_Email_Att::$skip_files = $wc_email_att_skip_files; WC_Email_Att_Func::$htaccess = $wc_email_att_htaccess; WC_Email_Att::instance()->init(); // allow plugins to load, which depend on this plugin being already loaded do_action( 'wc_email_att_plugin_loaded' );
/** * */ public function __construct() { spl_autoload_register( 'WC_Email_Att::autoload' ); if( ! isset( self::$show_activation ) ) { self::$show_activation = true; } if( ! isset( self::$show_uninstall ) ) { self::$show_uninstall = true; } if( ! isset( self::$plugin_path ) ) { self::$plugin_path = ''; } if( ! isset( self::$plugin_url ) ) { self::$plugin_url = ''; } if( ! isset( self::$plugin_base_name ) ) { self::$plugin_base_name = ''; } if( ! isset( self::$skip_files ) ) { self::$skip_files = array(); } $this->woo_addons = null; $this->emailsubjects = array( 'new_order' => array(), 'customer_processing_order' => array(), 'customer_completed_order' => array(), 'customer_invoice' => array(), 'customer_note' => array(), 'customer_new_account' => array(), 'customer_reset_password' => array(), 'low_stock' => array(), 'no_stock' => array(), 'backorder' => array() ); foreach ( $this->emailsubjects as $email_key => &$value ) { $this->emailsubjects[ $email_key ] = array( 'id' => $email_key, 'title' => $email_key, 'heading' => $email_key, 'description' => '', 'wc_email' => null ); } unset( $value ); $this->current_email_subject = ''; $this->current_email_object = null; $this->emailsubjects_init = false; $this->attachment_infos = array(); $this->wpml = null; // reload after WPML is activated in handler_wp_init $this->options = self::get_options_default( $this->emailsubjects ); $this->email_post = null; $this->attachments_sent = array(); add_action( 'init', array( $this, 'handler_wp_load_textdomains' ), 1 ); add_action( 'init', array( $this, 'handler_wp_init' ), 1 ); add_action( 'init', array( $this, 'handler_wp_register_cpt_email_att' ), 10 ); }