mirror of
https://github.com/silverstripe/silverstripe-iframe
synced 2024-10-22 11:05:51 +02:00
5b8e0ba0b1
Implement namespacing Update unit tests
28 lines
856 B
PHP
28 lines
856 B
PHP
<?php
|
|
|
|
namespace SilverStripe\IFrame;
|
|
|
|
use SilverStripe\CMS\Controllers\ContentController;
|
|
use SilverStripe\Control\Director;
|
|
use SilverStripe\View\Requirements;
|
|
|
|
class IFramePageController extends ContentController
|
|
{
|
|
protected function init()
|
|
{
|
|
parent::init();
|
|
|
|
if ($this->ForceProtocol) {
|
|
if ($this->ForceProtocol == 'http://' && Director::protocol() != 'http://') {
|
|
return $this->redirect(preg_replace('#https://#', 'http://', $this->AbsoluteLink()));
|
|
} elseif ($this->ForceProtocol == 'https://' && Director::protocol() != 'https://') {
|
|
return $this->redirect(preg_replace('#http://#', 'https://', $this->AbsoluteLink()));
|
|
}
|
|
}
|
|
|
|
if ($this->IFrameURL) {
|
|
Requirements::javascript('iframe/javascript/iframe_page.js');
|
|
}
|
|
}
|
|
}
|