/** * Initialize connection params * * @param string $host * @param string $user * @param string $password * @param int $port * @param int $timeout (seconds) */ public static function forge($host = null, $user = null, $password = null, $port = 21, $timeout = 90) { static::$_host = $host; static::$_user = $user; static::$_pwd = $password; static::$_port = (int) $port; static::$_timeout = (int) $timeout; if (!static::$instance) { static::$instance = new self(); } return static::$instance; }
public function __construct() { $this->_active = defined('BLODE_EVENTS') && BLODE_EVENTS === true; $this->_url = 'http://' . BLODE_SERVER . ':' . BLODE_HTTP_PORT; static::$_ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : null; static::$_path = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : null; static::$_host = gethostname(); if (BLODE_USE_UDP) { $this->_init_socket(); } else { $this->_init_curl(); } }
public function __construct() { if (!\R::getDatabaseAdapter()) { $dbConfig = (require_once __DIR__ . '/cnf.php'); static::$_host = $dbConfig['host']; static::$_dbname = $dbConfig['dbname']; static::$_user = $dbConfig['user']; static::$_password = $dbConfig['password']; \R::setup('mysql:host=' . static::$_host . ';dbname=' . static::$_dbname, static::$_user, static::$_password, true); //for both mysql or mariaDB } $this->_redbeans = \R::getToolBox()->getRedBean(); $this->_rbToolbox = \R::getToolBox(); }