Ejemplo n.º 1
0
 /**
  * Set URL for get front-end content. Correct URL
  *
  * @param   string  $url  Link
  *
  * @return  void
  */
 public static function setRenderUrl($url = '')
 {
     $uri = new JURI($url);
     if ($uri->getScheme() == '') {
         $scheme = 'http';
         if (@$_SERVER['HTTPS']) {
             $scheme = 'https';
         }
         $uri->setScheme($scheme);
     }
     @(list($host, $port) = explode(':', $_SERVER['HTTP_HOST']));
     if ($uri->getHost() == '') {
         $uri->setHost($host);
     }
     if ($uri->getPort() == '') {
         $uri->setPort($port);
     }
     if (strtolower($uri->getHost()) != strtolower($host)) {
         self::$_isExternal = true;
     } else {
         if (!$uri->hasVar('jsntpl_position')) {
             $uri->setVar('jsntpl_position', '1');
         }
         if (!$uri->hasVar('secret_key')) {
             $config = JFactory::getConfig();
             $secret = $config->get('secret');
             $uri->setVar('secret_key', md5($secret));
         }
         if ($uri->hasVar('Itemid') and $uri->getVar('Itemid') == '') {
             $uri->delVar('Itemid');
         }
         self::$_renderUrl = $uri->toString();
     }
 }
Ejemplo n.º 2
0
	public function testSetPort() {
		$this->object->setPort('8888');

		$this->assertThat(
			$this->object->getPort(),
			$this->equalTo('8888')
		);
	}
Ejemplo n.º 3
0
 /**
  * Set URL for get front-end content. Correct URL
  *
  * @param   string  $url  Link
  *
  * @return  void
  */
 public function setRenderUrl($url = '')
 {
     $uri = new JURI($url);
     if ($uri->getScheme() == '') {
         $scheme = 'http';
         if (@$_SERVER['HTTPS']) {
             $scheme = 'https';
         }
         $uri->setScheme($scheme);
     }
     @(list($host, $port) = explode(':', $_SERVER['HTTP_HOST']));
     if ($uri->getHost() == '') {
         $uri->setHost($host);
     }
     if ($uri->getPort() == '') {
         $uri->setPort($port);
     }
     if (JString::strtolower($uri->getHost()) != JString::strtolower($host)) {
         $this->_isExternal = true;
     } else {
         if (!$uri->hasVar('poweradmin')) {
             $uri->setVar('poweradmin', '1');
         }
         if ($uri->hasVar('Itemid') and $uri->getVar('Itemid') == '') {
             $uri->delVar('Itemid');
         }
         $this->_renderUrl = $uri->toString();
     }
 }