/** * Class constructor, manage params from component * * @access private * @return boolean */ public function __construct(&$subject) { // Load component config $this->cParams = JComponentHelper::getParams('com_jmap'); // Framework object dependencies $this->app = JFactory::getApplication(); $this->db = JFactory::getDbo(); // Avoid operations if plugin is executed in frontend if (!$this->app->getClientId()) { return; } // Avoid operation if not supported extension is detected if (!in_array($this->app->input->get('option'), array('com_content', 'com_k2', 'com_zoo'))) { return; } parent::__construct($subject); if (file_exists(JPATH_ROOT . '/administrator/components/com_jmap/framework/language/multilang.php')) { include_once JPATH_ROOT . '/administrator/components/com_jmap/framework/language/multilang.php'; } $this->adaptersMapping = array('com_content.article' => array('file' => JPATH_ROOT . '/components/com_content/helpers/route.php', 'class' => 'ContentHelperRoute', 'method' => 'getArticleRoute'), 'com_k2.item' => array('file' => JPATH_ROOT . '/components/com_k2/helpers/route.php', 'class' => 'K2HelperRoute', 'method' => 'getItemRoute'), 'com_zoo.item' => array('routing' => 'jmap', 'file' => JPATH_ROOT . '/administrator/components/com_jmap/framework/route/helper.php', 'class' => 'JMapRouteHelper', 'method' => 'getItemRoute')); // Manage partial language translations $jLang = JFactory::getLanguage(); $jLang->load('com_jmap', JPATH_ROOT . '/administrator/components/com_jmap', 'en-GB', true, true); if ($jLang->getTag() != 'en-GB') { $jLang->load('com_jmap', JPATH_SITE, null, true, false); $jLang->load('com_jmap', JPATH_SITE . '/administrator/components/com_jmap', null, true, false); } }
/** * Removes a client from client storage. * * @param Object $client Client object. */ public function removeClientOnClose($client) { $clientId = $client->getClientId(); $clientIp = $client->getClientIp(); $clientPort = $client->getClientPort(); $resource = $client->getClientSocket(); $this->_removeIpFromStorage($client->getClientIp()); if (isset($this->_requestStorage[$clientId])) { unset($this->_requestStorage[$clientId]); } unset($this->clients[(int) $resource]); $index = array_search($resource, $this->allsockets); unset($this->allsockets[$index], $client); // trigger status application: if ($this->getApplication('status') !== false) { $this->getApplication('status')->clientDisconnected($clientIp, $clientPort); } unset($clientId, $clientIp, $clientPort, $resource); }
/** * Removes a client from client storage. * * @param Object $client Client object. */ public function removeClientOnClose($client) { $clientId = $client->getClientId(); $clientIp = $client->getClientIp(); $clientPort = $client->getClientPort(); $clientToken = $client->getToken(); $resource = $client->getClientSocket(); $this->_removeIpFromStorage($client->getClientIp()); if (isset($this->_requestStorage[$clientId])) { unset($this->_requestStorage[$clientId]); } unset($this->clients[(int) $resource]); $index = array_search($resource, $this->allsockets); unset($this->allsockets[$index], $client); unset($clientId, $clientIp, $clientPort, $resource); /* // trigger status application: if ($this->getApplication('status') !== false) { $this->getApplication('status')->clientDisconnected($clientIp, $clientPort); } if ($this->getApplication('quiz') !== false) { $this->getApplication('quiz')->clientDisconnected($clientIp, $clientPort); } if ($this->getApplication('secondscreenapp') !== false) { $this->getApplication('secondscreenapp')->clientDisconnected($clientIp, $clientPort); } if ($this->getApplication('secondscreenjornaldacultura') !== false) { $this->getApplication('secondscreenjornaldacultura')->clientDisconnected($clientIp, $clientPort); } if ($this->getApplication('secondscreencartaoverde') !== false) { $this->getApplication('secondscreencartaoverde')->clientDisconnected($clientIp, $clientPort); } if ($this->getApplication('secondscreenrodaviva') !== false) { $this->getApplication('secondscreenrodaviva')->clientDisconnected($clientIp, $clientPort); } if ($this->getApplication('secondscreenqss') !== false) { $this->getApplication('secondscreenqss')->clientDisconnected($clientIp, $clientPort); } unset($clientId, $clientIp, $clientPort, $resource); */ }