HTTPS path
Permalink Browser Info Environment
When using backstretch with the browser in secure mode (https), the url to the backstretch image remains in standard mode (http) causing security errors in browsers.
I fixed it by adding the following code to the getJS() function:
So the function looks like this:
I fixed it by adding the following code to the getJS() function:
if (!empty($_SERVER['HTTPS'])){ $fPath = str_replace('http','https',$fPath); }
So the function looks like this:
public function getJS(){ $fv = $this->getFileObject()->getApprovedVersion(); $fPath = $fv->getRelativePath(true); if (!empty($_SERVER['HTTPS'])){ $fPath = str_replace('http','https',$fPath); } $speed = $this->getSpeed(); if (!(is_numeric($speed))){ $speed = "'". $speed . "'"; } $centeredX = $this->getCenteredX(); $centeredY = $this->getCenteredY(); $js = "<script type=\"text/javascript\">\n"; $js .= "\t$.backstretch(\"{$fPath}\", {speed: {$speed}, centeredX: {$centeredX}, centeredY: {$centeredY} });\n"; $js .= "</script>\n";
Viewing 15 lines of 17 lines. View entire code block.
Type: | Discussion |
---|---|
Status: | New |