This application is not used any more and exists only for history. Post new tickets on the Github account.
Cette application n'est plus utilisée, et existe uniquement pour son historique. Postez les nouveaux tickets sur le compte github.

Ticket #1447 (assigned enhancement)

Opened 3 years ago

Last modified 2 years ago

url_significant plugin, force https and http

Reported by: zitoun Owned by: zitoun
Priority: low Milestone:
Component: jelix:plugins:urls Version: 1.3.1
Severity: normal Keywords:
Cc: Blocked By:
Blocking: Documentation needed: no
Hosting Provider: Php version:

Description (last modified by laurentj) (diff)

While jurl can generate https urls with specific parameter in urls.xml, it cannot force to http other actions. I suggest to turn around this limitation by using the parameter in a 3-state value:

  • https="true" => force jurl to generate a full https url
  • http="false" => force jurl to generate a full http url
  • no parameter (=null) => common use, generate relative urls

List of files updated to support the patch:

  • jelix/plugins/urls/significant/jSignificantUrlsCompiler.class.php

method compile():

$this->defaultUrl = new significantUrlInfoParsing (
                $type,
                (string)$tag['name'],
                (isset($tag['default']) ? (((string)$tag['default']) == 'true'):false),
                (isset($tag['https']) ? (((string)$tag['https']) == 'true'):null)
            );
  • jelix/plugins/urls/significant/significants.urls.php

method create():

        if ($urlinfo[2])
            $url->scriptName = $GLOBALS['gJCoord']->request->getServerURI(true).$url->scriptName;
	else if ($urlinfo[2] === false)
	    $url->scriptName = $GLOBALS['gJCoord']->request->getServerURI(false).$url->scriptName;
}}

Change History

comment:1 Changed 3 years ago by zitoun

1/ jelix/plugins/urls/significant/jSignificantUrlsCompiler.class.php method compile():

$this->defaultUrl = new significantUrlInfoParsing (
                $type,
                (string)$tag['name'],
                (isset($tag['default']) ? (((string)$tag['default']) == 'true'):false),
                (isset($tag['https']) ? (((string)$tag['https']) == 'true'):null)
            );

2/ jelix/plugins/urls/significant/significants.urls.php method create():

if ($urlinfo[2])
            $url->scriptName = $GLOBALS['gJCoord']->request->getServerURI(true).$url->scriptName;
	else if ($urlinfo[2] === false)
	    $url->scriptName = $GLOBALS['gJCoord']->request->getServerURI(false).$url->scriptName;

comment:2 Changed 3 years ago by zitoun

This patch cause response type sitemap to provide wrong full urls. Change on the file jResponseSitemap.class.php:

method addUrl():

		if (preg_match('/^http/', $loc)) {
			$url->loc = $loc;
		}
		else {
			$url->loc=$gJCoord->request->getServerURI(). $loc;
		}

comment:3 Changed 2 years ago by laurentj

  • Owner set to zitoun
  • Status changed from new to assigned
  • Description modified (diff)

comment:4 Changed 2 years ago by laurentj

a true patch with unit tests may be better ;-)

Note: See TracTickets for help on using tickets.