/** * Get device features * * @return Application_Model_Device */ public function getDevice() { if ($this->device == null) { $this->device = false; $devices = Application_Model_DevicesMapper::i()->fetchAll(); /* @var Application_Model_Device $device */ foreach ($devices as $device) { // if exact do an == comparison if ($device->isExact() && $device->getPattern() == $_SERVER['HTTP_USER_AGENT'] || !$device->isExact() && preg_match($device->getPattern(), $_SERVER['HTTP_USER_AGENT']) > 0) { // valid $device found; $this->device = $device; break; } } if ($this->device == false) { // load things from default $this->device = new Application_Model_Device(); if (X_VlcShares_Plugins::broker()->isRegistered('wiimc')) { $this->device->setGuiClass($this->options->get('gui', 'X_VlcShares_Plugins_WiimcPlxRenderer')); } else { $this->device->setGuiClass($this->options->get('gui', 'X_VlcShares_Plugins_WebkitRenderer')); } $this->device->setIdProfile($this->options->get('profile', 1))->setLabel("Unknown device"); } } return $this->device; }