/** * @brief Obtains the default @ref ProxyWriter object for this site. The ProxyWriter * is responsible for actually converting the source HTML that is returned from * the source site into proxified and translated HTML that is output to the user. * * <p>The proxy writer is built and cached on the first request so that * this can be called multiple times to retrieve the same @ref ProxyWriter object.</p> * * @returns ProxyWriter The proxy writer for this class. */ public function getProxyWriter() { if (!isset($this->_proxyWriter)) { import('inc/ProxyWriter.php'); $proxy = new ProxyWriter(); if ($this->_rec->val('translation_parser_version')) { $proxy->translationParserVersion = intval($this->_rec->val('translation_parser_version')); } $proxy->setProxyUrl($this->getProxyUrl()); $proxy->setSrcUrl($this->getSiteUrl()); $res = SweteDb::q("select `name`,`alias` from path_aliases where website_id='" . addslashes($this->_rec->val('website_id')) . "'"); while ($row = mysql_fetch_assoc($res)) { $proxy->addAlias($row['name'], $row['alias']); } $proxy->setSourceLanguage($this->getSourceLanguage()); $proxy->setProxyLanguage($this->getDestinationLanguage()); $proxy->sourceDateLocale = $this->_rec->val('source_date_locale'); $proxy->targetDateLocale = $this->_rec->val('target_date_locale'); $this->_proxyWriter = $proxy; } return $this->_proxyWriter; }