Commit 0d3e85ca by Alexander Makarov

Merge pull request #2883 from kartik-v/patch-14

Simplify inline script code
parents 3a5e0c7f cd4038bf
...@@ -5,10 +5,13 @@ use yii\helpers\Json; ...@@ -5,10 +5,13 @@ use yii\helpers\Json;
/* @var $this \yii\base\View */ /* @var $this \yii\base\View */
/* @var $url string */ /* @var $url string */
/* @var $enforceRedirect boolean */ /* @var $enforceRedirect boolean */
?>
$redirectJavaScript = <<<EOL <!DOCTYPE html>
function popupWindowRedirect(url, enforceRedirect) <html>
{ <head>
<script>
function popupWindowRedirect(url, enforceRedirect)
{
if (window.opener && !window.opener.closed) { if (window.opener && !window.opener.closed) {
if (enforceRedirect === undefined || enforceRedirect) { if (enforceRedirect === undefined || enforceRedirect) {
window.opener.location = url; window.opener.location = url;
...@@ -18,16 +21,9 @@ function popupWindowRedirect(url, enforceRedirect) ...@@ -18,16 +21,9 @@ function popupWindowRedirect(url, enforceRedirect)
} else { } else {
window.location = url; window.location = url;
} }
} }
EOL; popupWindowRedirect(<?= Json::encode($url) ?>, <?= Json::encode($enforceRedirect) ?>);
</script>
$redirectJavaScript .= 'popupWindowRedirect(' . Json::encode($url) . ', ' . Json::encode($enforceRedirect) . ');';
?>
<!DOCTYPE html>
<html>
<head>
<?= Html::script($redirectJavaScript) ?>
</head> </head>
<body> <body>
<h2 id="title" style="display:none;">Redirecting back to the &quot;<?= Yii::$app->name ?>&quot;...</h2> <h2 id="title" style="display:none;">Redirecting back to the &quot;<?= Yii::$app->name ?>&quot;...</h2>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment