HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/PvdBoogaard/indoorski.nl/backup/oude-site/cms/api/class.email.php
<?php
/**
 * This file contains the iwp_email class for use in IWP.
 *
 * @version $Id$
 * 
 *
 * @package IWP
 * @subpackage IWP_API
 */

/**
 * Extended Email_API Class
 * This class extends the Email_API class to include auto detection for the SMTP settings in IWP.
 *
 * @package IWP
 * @property iwp_email
 * @subpackage IWP_API
 */
class iwp_email extends Email_API {

	/**
	 * Instance
	 * This static variable holds the current instance of this object being loaded.
	 * So using the getInstance function anywhere will return the very same instance.
	 *
	 * @var object Instance
	 */
	public static $Instance;

	/**
	 * getInstance
	 * This is a static function that sets up the class instance and stores it to the static variable. It will then return that instantiation in the future.
	 *
	 * @return object Returns the instantiated object
	 **/
	public static function getInstance(){
		if(!isset(self::$Instance)){
			self::$Instance = new self();
		}
		return self::$Instance;
	}

	/**
	 * The Constructor
	 * This checks the application's config to see if they have explicitly set a smtp server and authentication values
	 *
	 * @return void
	 */
	public function __construct(){

		$SMTPServer =	iwp_config::Get('smtp_hostname');
		$SMTPUsername =	iwp_config::Get('smtp_username');
		$SMTPPassword =	iwp_config::Get('smtp_password');
		$SMTPPort =		iwp_config::Get('smtp_port');
		$SMTPOption =	iwp_config::Get('smtpoption');

		if($SMTPOption == 'usesmtp' && !empty($SMTPServer)) {
			$this->Set('SMTPServer', $SMTPServer);

			if(!empty($SMTPUsername)) {
				$this->Set('SMTPUsername', $SMTPUsername);
			}

			if(!empty($SMTPPassword)) {
				$this->Set('SMTPPassword', $SMTPPassword);
			}

			if(!empty($SMTPPort)) {
				$this->Set('SMTPPort', $SMTPPort);
			}
		}

		// old/parent constructor
		$this->Email_API();
	}

}