<commit_before><?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');
        }
    }
}<commit_msg>FIX: Use new resource loading syntax for javascript<commit_after><?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();
        $currentProtocol = Director::protocol();
        $desiredProtocol = $this->ForceProtocol;
        if ($desiredProtocol && $currentProtocol !== $desiredProtocol) {
            $enforcedLocation = preg_replace(
                "#^${currentProtocol}#",
                $desiredProtocol,
                $this->AbsoluteLink()
            );
            return $this->redirect($enforcedLocation);
        }

        if ($this->IFrameURL) {
            Requirements::javascript('silverstripe/iframe: javascript/iframe_page.js');
        }
    }
}
{'fraction_non_alphanumeric': 0.14664410603496897, 'fraction_numerical': 0.0, 'mean_word_length': 2.7825159914712154, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 15, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6619358', 'n_tokens_mistral': 494, 'n_tokens_neox': 476, 'n_words': 83}